Files
muuhd/server/models/player.js
Kim Ravn Hansen 8a4eb25507 things + stff
2025-09-07 23:24:50 +02:00

49 lines
936 B
JavaScript
Executable File

import WebSocket from "ws";
import { Character } from "./character.js";
/**
* Player Account.
*
* Contain persistent player account info.
*/
export class Player {
/**
* @protected
* @type {string} unique username
*/
_username;
get username() {
return this._username;
}
/**
* @protected
* @type {string}
*/
_passwordHash;
get passwordHash() {
return this._passwordHash;
}
/** @protected @type {Set<Character>} */
_characters = new Set();
get characters() {
return this._characters;
}
/**
* @param {string} username
* @param {string} passwordHash
*/
constructor(username, passwordHash) {
this._username = username;
this._passwordHash = passwordHash;
this.createdAt = new Date();
}
setPasswordHash(hashedPassword) {
this._passwordHash = hashedPassword;
}
}