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 username
string -
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 pass
string 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 name
string Delete one of the chars
-
getUsername() → {string}
-
Returns:
string -
hasCharacter(name) → {boolean}
-
Parameters:
Name Type Description name
string Returns:
boolean -
save(callback)
-
Parameters:
Name Type Description callback
function after-save callback
-
serialize() → {Object}
-
Gather data from account object that will be persisted to disk
Returns:
Object -
setPassword(password)
-
Parameters:
Name Type Description password
string Unhashed password. Is hashed inside this function
-
undeleteCharacter(name)
-
Parameters:
Name Type Description name
string Removes the deletion of one of the chars