module.exports = class PlayerMobile { constructor() { this.id = 0; this.login = null; this.name = ""; this.description = "A player."; this.type = "mobile"; this.roomId = "PhandalinTownGreen"; this.filename = "playermobile.js"; this.keywords = []; this.items = []; this.health = 100; this.maxHealth = 100; this.roles = []; this.memory = {}; this.title = "the player"; } mud_sendMessage(source, message) { this.login.sendMessage(message); } mud_addMemory(section, newMemory) { if(!this.memory.hasOwnProperty(section)) { this.memory[section] = []; } this.memory[section].push(memory); } mud_checkMemory(section, memoryToCheck) { if(this.memory.hasOwnProperty(section)) { if(this.memory[section].hasOwnProperty(memory)) { return true; } } return false; } mud_tick(time) { if(this.health != this.maxHealth) { this.health++; this.hp(); } } hp(room, mobile, input) { libs.Output.toMobile(mobile.id, "[HP: "+mobile.health+"/" +mobile.maxHealth+"]"); return true; } mud_enterRoom(direction) { if(direction != null) { return this.name + " " + direction + "."; } return this.name + " enters the room."; } mud_leaveRoom(direction) { if(direction != null) { return this.name + " " + direction + "."; } return this.name + " leaves."; } quit(room, mobile, input) { this.login.logout(); return true; } save(room, mobile, input) { libs.Output.toMobile(mobile.id, "Saving player information."); world.mud_playerSave(this); libs.Output.toMobile(mobile.id, "Saved successfully."); return true; } hint(room, mobile, input) { if(["on", "please"].indexOf(input[0]) != -1) { mobile.hintColor = "FgMagenta"; libs.Output.toMobile(mobile.id, "Enabling hints."); return true; } if (["off"].indexOf(input[0]) != -1) { mobile.hintColor = "Reset"; libs.Output.toMobile(mobile.id, "Disabling hints."); return true; } } setting(room, mobile, input) { } chpass(room, mobile, input) { var username = mobile.name.toLowerCase(); mobile.password = world.mud_generateHash(username + input.join(" ")); world.mud_playerSave(mobile); libs.Output.toMobile(mobile.id, "Password has been updated!"); return true; } };