Account

Representation of a player's account

Constructor

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

static validateName(name) → {boolean}

Parameters:
Name Type Description
name string
Returns:
boolean

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

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