module.exports = class SisterGaraele { constructor() { this.id = 1; this.name = "Sister Garaele"; this.description = "A zealous young elf who tends the shrine. She appears battered and {hint}bruised{/hint}."; this.type = "mobile"; this.roomId = "PhandalinGaraeleHouse"; this.idleDelay = 30000; this.filename = "phandalin/sistergaraele.js"; this.lastIdle = 0; this.keywords = ["sister", "garaele"]; this.items = []; this.commandQueue = []; this.waitTime = 0; this.memory = {}; } mud_init() { world.mud_addMobileToRoom("PhandalinGaraeleHouse", this.id); world.mud_addItemToMobile(this.id, builder.mud_spawnItem("UnassumingKey").id); } mud_sendMessage(source, message) { message = message.replace(/\{.*?\}/g, ""); var cleanMessage = message.trim().toLowerCase(); if(source == this) { return; } if(source == null) { if(cleanMessage.indexOf("dawn") != -1 || cleanMessage.indexOf("twilight") != -1) { this.mud_addCommand(this, "tend"); return; } return; } if(cleanMessage.indexOf("shout") != -1) { return; } if(this.commandQueue.length > 1) { return; } if(libs.Conversation.basicDecency(source, cleanMessage, this)) { return; } if(cleanMessage.indexOf("enters the room") != -1 || cleanMessage.indexOf("walks in") != -1 ) { this.mud_addCommand(this, "emote looks up."); this.mud_addCommand(this, "say Oh, hello! Welcome to my home."); return; } if(cleanMessage.indexOf("shrine") != -1) { this.addCommand(this, "say Oh yes, I take care of the Shrine of Tymora."); this.addCommand(this, "emote remembers something and lays out a few new candles on the table by the door."); return; } if(cleanMessage.indexOf("bruise") != -1 || cleanMessage.indexOf("happened") != -1) { this.mud_addCommand(this, "emote grimaces."); this.mud_addCommand(this, "say I had an unfortunate run-in with a {hint}banshee{/hint}."); this.mud_addCommand(this, "emote rubs a large bruise on her arm."); return; } if(cleanMessage.indexOf("banshee") != -1) { this.mud_addCommand(this, "say The banshee Agatha off the trail near Triboar. I was going to ask her a {hint}question{/hint}."); return; } if(cleanMessage.indexOf("question") != -1 || cleanMessage.indexOf("ask") != -1) { this.mud_addCommand(this, "say I was going to ask her about the whereabouts of the Spellbook of {hint}Bowgentle{/hint}."); return; } if(cleanMessage.indexOf("bowgentle") != -1 || cleanMessage.indexOf("spellbook") != -1) { this.mud_addCommand(this, "say Bowgentle was a member of the {hint}Harpers{/hint} and an adventurous wizard."); this.mud_addCommand(this, "say He wrote up his life's research on magic into a spellbook that was lost after his death."); return; } if(cleanMessage.indexOf("harper") != -1) { this.mud_addCommand(this, "say The Harpers are a secret organization dedicated to promoting good, preserving history and maintaining a balance between civilization and nature."); this.mud_addCommand(this, "say I happen to be a member myself!"); this.mud_addCommand(this, "emote looks embarrassed."); this.mud_addCommand(this, "say Although, for a secret organization, I did kinda give it away..."); return; } if(cleanMessage.indexOf("quest") != -1) { this.mud_addCommand(this, "say Do you think you could find Agatha the banshee and ask her where the spellbook is?"); 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; } tend() { this.mud_addCommand(this, "say Excuse me for a moment."); this.mud_addCommand(this, "unlock door"); this.mud_addCommand(this, "open door"); this.mud_addCommand(this, "leave"); this.mud_addCommand(this, "emote approaches the shrine."); this.mud_addCommand(this, "wait 6"); this.mud_addCommand(this, "emote replaces the candles on the altar in the shrine."); this.mud_addCommand(this, "wait 12"); this.mud_addCommand(this, "emote adds another stick of incense."); this.mud_addCommand(this, "wait 12"); this.mud_addCommand(this, "emote kneels and prays quietly."); this.mud_addCommand(this, "wait 24"); this.mud_addCommand(this, "emote kneels and prays quietly."); this.mud_addCommand(this, "wait 24"); this.mud_addCommand(this, "emote stands and nods."); this.mud_addCommand(this, "wait 6"); this.mud_addCommand(this, "unlock door"); this.mud_addCommand(this, "open door"); this.mud_addCommand(this, "enter"); return true; } mud_addCommand(source, message) { this.commandQueue.push(message); } mud_addInterruptCommand(source, message) { this.commandQueue.shift(message); } mud_tick(time) { if(time >= this.lastIdle) { var idleMessages = [ "emote winces and lightly touches a bruise.", "emote closes her eyes and whispers a short prayer to Tymora.", "emote busies herself around her house, straightening things.", "emote idly plays with her prayer beads, silently whispering to Tymora."]; var randomIdle = idleMessages[parseInt(Math.random() * idleMessages.length)]; this.mud_addCommand(this, randomIdle); this.lastIdle = time + this.idleDelay; } if(this.waitTime > 0) { this.waitTime--; } if(this.commandQueue.length > 0 && this.waitTime <= 0) { world.mud_handleInput(this.roomId, this.id, this.commandQueue.shift().split(" ")); this.lastIdle = time + this.idleDelay; this.waitTime = 0; } } wait(room, mobile, input) { this.waitTime = parseInt(input.join(" ")); return true; } look(room, mobile, input) { switch(input[0]) { case "bruise": libs.Output.toMobile(mobile.id, "You can't see it very well. Maybe you can {hint}say{/hint} something to her about it."); 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."; } };