new Account(data)
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Object | Account save data |
Properties:
| Name | Type | Description |
|---|---|---|
username |
string | |
characters |
Array.<string> | List of character names in this account |
password |
string | Hashed password |
banned |
boolean | Whether this account is banned or not |
Methods
-
addCharacter(username)
-
Parameters:
Name Type Description usernamestring -
ban()
-
Set this account to banned There is no unban because this can just be done by manually editing the account file
-
checkPassword(pass) → {boolean}
-
Parameters:
Name Type Description passstring Unhashed password to check against account's password
Returns:
boolean -
deleteAccount()
-
Set this account to deleted There is no undelete because this can just be done by manually editing the account file
-
deleteCharacter(name)
-
Parameters:
Name Type Description namestring Delete one of the chars
-
getUsername() → {string}
-
Returns:
string -
hasCharacter(name) → {boolean}
-
Parameters:
Name Type Description namestring Returns:
boolean -
save(callback)
-
Parameters:
Name Type Description callbackfunction after-save callback
-
serialize() → {Object}
-
Gather data from account object that will be persisted to disk
Returns:
Object -
setPassword(password)
-
Parameters:
Name Type Description passwordstring Unhashed password. Is hashed inside this function
-
undeleteCharacter(name)
-
Parameters:
Name Type Description namestring Removes the deletion of one of the chars