diff options
Diffstat (limited to 'src/routers/vault/types/Char.js')
-rw-r--r-- | src/routers/vault/types/Char.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/routers/vault/types/Char.js b/src/routers/vault/types/Char.js new file mode 100644 index 0000000..a90b950 --- /dev/null +++ b/src/routers/vault/types/Char.js @@ -0,0 +1,34 @@ +/** + * represents a generic game character + */ +module.exports = class Char { + /** reference to the parent GameAccount */ + account = null; + /** the ID of this char */ + charId = 0; + /** the public name */ + name = ""; + /** the level of the char */ + baseLevel = 1; + /** gender of the char */ + gender = "N"; + + constructor (acc, id, name) { + this.account = acc; + this.charId = id; + this.name = name; + } + + /** + * serialize for sending over the network + * @param {*} key + */ + toJSON (key) { + return { + charId: this.charId, + name: this.name, + level: this.baseLevel, + sex: this.gender, + }; + } +} |