module.exports = class PhandalinVillager1 { constructor() { this.id = 1; this.name = "A villager"; this.description = "She is a human woman wearing a brightly colored coverall with her hair up in a frizzy bun. She is returning from a delivery and looks pretty pleased with herself."; this.type = "mobile"; this.roomId = 1; this.idleDelay = 30000; this.filename = "phandalin/villager1.js"; this.lastIdle = 0; this.keywords = ["villager", "lady", "woman", "human"]; this.items = []; this.commandQueue = []; this.memory = {}; } mud_init() { world.mud_addMobileToRoom("PhandalinRoad1", this.id); } mud_sendMessage(source, message) { message = message.replace(/\{.*?\}/g, ""); var cleanMessage = message.trim(); if(source == this) { return; } if(cleanMessage.indexOf("shout") != -1) { return; } if(libs.Conversation.basicDecency(source, cleanMessage, this)) { return; } /*if(libs.Conversation.followsOrders(source, cleanMessage, this)) { return; }*/ } 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_addCommand(source, message) { this.commandQueue.push(message); } mud_tick(time) { if(time >= this.lastIdle) { var idleMessages = ["emote wipes some sweat from her brow.", "emote whistles happily as she walks.", "emote brushes a strand of hair from her face and frowns.", "emote stops for a minute and retightens her hair bun." ]; var randomIdle = idleMessages[parseInt(Math.random() * idleMessages.length)]; this.mud_addCommand(this, randomIdle); this.lastIdle = time + this.idleDelay; } if(this.commandQueue.length > 0 ) { world.mud_handleInput(this.roomId, this.id, this.commandQueue.shift().split(" ")); this.lastIdle = time + this.idleDelay; } } };