summaryrefslogtreecommitdiff
path: root/src/routers/vault/types/Char.js
blob: a90b950034d0c6f52615b879c05634fe0a163e95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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,
        };
    }
}