123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- module.exports = class PhandalinShrineLuck {
- constructor() {
- this.id = this.constructor.name;
- this.name = "The Shrine of Luck";
- this.description = "A rough semicircle wall surrounds a {hint}shrine{/hint} to Tymora, the goddess of Luck. The shrine is well-tended, and the {hint}incense{/hint} and {hint}candles{/hint} here appear to have been set recently. There is an unassuming {hint}house{/hint} to the north.";
- this.openDoorDescription = "A rough semicircle wall surrounds a {hint}shrine{/hint} to Tymora, the goddess of Luck. The shrine is well-tended, and the {hint}incense{/hint} and {hint}candles{/hint} here appear to have been set recently. There is an unassuming {hint}house{/hint} to the north with the {hint}door{/hint} standing open.";
- this.defaultDescription = "A rough semicircle wall surrounds a {hint}shrine{/hint} to Tymora, the goddess of Luck. The shrine is well-tended, and the {hint}incense{/hint} and {hint}candles{/hint} here appear to have been set recently. There is an unassuming {hint}house{/hint} to the north.";
- this.filename = "phandalin/shrineluck.js";
- this.type = "room";
- this.items = [];
- this.mobiles = [];
- this.roomExpires = 0;
- this.resetDelay = 12000000;
- this.roomExits = ["south"];
- this.homeIsLocked = true;
- this.homeIsOpen = false;
- this.stoneIsMissing = false;
- this.keyIsFound = false;
- }
- mud_reset(time) {
- libs.Output.toRoom(this.id, "A coil of smoke rises from a stick of {hint}incense{/hint}.");
- this.roomExpires = time + this.resetDelay;
- this.homeIsLocked = true;
- this.homeIsOpen = false;
- this.stoneIsMissing = false;
- this.description = this.defaultDescription;
- this.keyIsFound = false;
- this.roomExits = ["south"];
- }
- mud_tick(time) {
- if(time >= this.roomExpires) {
- this.mud_reset(time);
- }
- }
- look(room, mobile, input) {
-
- switch(input[0]) {
- case "debug":
- console.log(admin, builder);
- return true;
- case "door":
- libs.Output.toMobile(mobile.id, "The door to the small house is made of strong oak, with a small keyhole and a stylized door knob.");
- return true;
- case "house":
- case "home":
- libs.Output.toMobile(mobile.id, "The house is small, but looks cozy and tidy. You wonder if the person who lives there also takes care of the {hint}shrine{/hint}.");
- return true;
- case "shrine":
- case "luck":
- libs.Output.toMobile(mobile.id, "A small {hint}statuette{/hint} of Tymora placed on a stone altar is surrounded by lit candles and incense. The altar is protected by a semicircle of {hint}stones{/hint} that look like they were salvaged from the nearby ruins.");
- return true;
- case "candle":
- case "candles":
- libs.Output.toMobile(mobile.id, "The yellow beeswax candles stand tall, having only recently been replaced and lit.");
- return true;
- case "incense":
- libs.Output.toMobile(mobile.id, "Smoke curls upwards from the sticks of incense, their tips glowing orange.");
- return true;
- case "statue":
- case "statuette":
- libs.Output.toMobile(mobile.id, "The small statue of Tymora stands with her arms outstretched. On her left hand a swallow perches, and a coinpurse is clutched in her right.");
- return true;
- case "stones":
- if(!this.stoneIsMissing) {
- libs.Output.toMobile(mobile.id, "The stones are identical to the other broken stones from the ruined buildings just outside of town. One of the flagstones seems to have been moved recently. Perhaps you could {hint}take{/hint} it?");
- this.stoneIsMissing = true;
- } else {
- libs.Output.toMobile(mobile.id, "The stones are identical to the other broken stones from the ruined buildings just outside of town. One of the flagstones is missing, leaving a small {hint}hole{/hint}.");
- }
- return true;
- case "hole":
- if(this.stoneIsMissing) {
- if(!this.keyIsFound) {
- libs.Output.toMobile(mobile.id, "Looking in the small hole left by the stone, you find an unassuming key tucked inside.");
- world.mud_addItemToRoom("PhandalinShrineLuck", builder.mud_spawnItem("UnassumingKey").id);
- this.keyIsFound = true;
- } else {
- libs.Output.toMobile(mobile.id, "It looks like someone has stolen one of the stones from the edge of the shrine.");
- }
- return true;
- }
- }
- }
- unlock(room, mobile, input) {
- if(["door", "home", "north"].indexOf(input[0]) != -1) {
- var hasKey = false;
- for(var i = 0; i < mobile.items.length; i++) {
- if(session.items[mobile.items[i]].constructor.name == "UnassumingKey") {
- hasKey = true;
- }
- }
- if(this.homeIsLocked && !this.homeIsOpen && hasKey) {
- libs.Output.toMobile(mobile.id, "You unlock the door.");
- libs.Output.toRoom(room.id, mobile.name + " unlocks the door.", mobile);
- this.homeIsLocked = false;
- return true;
- } else if(!this.homeIsLocked) {
- libs.Output.toMobile(mobile.id, "The door is already unlocked.");
- return true;
- } else if(!hasKey) {
- libs.Output.toMobile(mobile.id, "You don't have a key that fits.");
- return true;
- }
- }
- }
- open(room, mobile, input) {
- if(["door", "home", "north"].indexOf(input[0]) != -1) {
- if(!this.homeIsOpen && !this.homeIsLocked) {
- libs.Output.toMobile(mobile.id, "You open the door.");
- libs.Output.toRoom(room.id, mobile.name + " opens the door.", mobile);
- this.homeIsOpen = true;
- if(this.roomExits.indexOf("enter") == -1) {
- this.roomExits.push("enter");
- }
- this.description = this.openDoorDescription;
- return true;
- } else if(!this.homeIsOpen && this.homeIsLocked) {
- libs.Output.toMobile(mobile.id, "The door is locked.");
- return true;
- } else if(this.homeIsOpen) {
- libs.Output.toMobile(mobile.id, "The door is already open.");
- return true;
- }
- }
- }
- lock(room, mobile, input) {
- if(["door", "home", "north"].indexOf(input[0]) != -1) {
- var hasKey = false;
- for(var i = 0; i < mobile.items.length; i++) {
- if(session.items[mobile.items[i]].constructor.name == "UnassumingKey") {
- hasKey = true;
- }
- }
- if(!this.homeIsLocked && !this.homeIsOpen && hasKey) {
- libs.Output.toMobile(mobile.id, "You lock the door.");
- libs.Output.toRoom(room.id, mobile.name + " locks the door.", mobile);
- this.homeIsLocked = true;
- return true;
- } else if(!this.homeIsLocked && this.homeIsOpen && hasKey) {
- libs.Output.toMobile(mobile.id, "You close and lock the door.");
- libs.Output.toRoom(room.id, mobile.name + " closes and locks the door.", mobile);
- this.homeIsLocked = true;
- this.homeIsOpen = false;
- this.roomExits.splice(this.roomExits.indexOf("enter"), 1);
- return true;
- } else if(this.homeIsLocked && !this.homeIsOpen) {
- libs.Output.toMobile(mobile.id, "The door is already locked.");
- return true;
- } else if(!this.hasKey) {
- libs.Output.toMobile(mobile.id, "You don't have the key to this door.");
- return true;
- }
- }
- }
- close(room, mobile, input) {
- if(["door", "home", "north"].indexOf(input[0]) != -1) {
- if(this.homeIsOpen) {
- libs.Output.toMobile(mobile.id, "You close the door.");
- libs.Output.toRoom(room.id, mobile.name + " closes the door.", mobile);
- this.homeIsOpen = false;
- this.roomExits.splice(this.roomExits.indexOf("enter"), 1);
- this.description = this.defaultDescription;
- return true;
- } else if(!this.homeIsOpen) {
- libs.Output.toMobile(mobile.id, "The door is already closed.");
- return true;
- }
- }
- }
- take(room, mobile, input) {
- if(["stone", "flagstone"].indexOf(input[0]) != -1) {
- if(!this.stoneIsMissing) {
- libs.Output.toMobile(mobile.id, "You find a loose flagstone and steal it!");
- libs.Output.toRoom(room.id, mobile.name + " shifts a flagstone loose and steals it.\n", mobile);
- this.stoneIsMissing = true;
- world.mud_addItemToMobile(mobile.id, builder.mud_spawnItem("RuinFlagstone").id);
- return true;
- } else {
- libs.Output.toMobile(mobile.id, "There are no loose stones.");
- return true;
- }
- }
- }
- enter(room, mobile, input) {
- if(this.homeIsLocked && !this.homeIsOpen) {
- libs.Output.toMobile(mobile.id, "The door to the small home is closed and locked.");
- libs.Output.toRoom(room.id, mobile.name + " tries to open the door but fails.", mobile);
- return true;
- } else if(!this.homeIsLocked && !this.homeIsOpen) {
- libs.Output.toMobile(mobile.id, "The door is not open.");
- return true;
- } else if(!this.homeIsLocked && this.homeIsOpen) {
- world.mud_moveMobile(mobile.id, this.id, "PhandalinGaraeleHouse", "enters the house", "walks in");
- return true;
- }
- }
- north(room, mobile, input) {
- return this.enter(room, mobile, input);
- }
- south(room, mobile, input) {
- world.mud_moveMobile(mobile.id, this.id, "PhandalinTownSquare", "walks away south", "walks in from the north");
- return true;
- }
- };
|