123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- module.exports = class RuinFlagstone {
- constructor() {
- this.id = 0;
- this.name = "a large flagstone";
- this.defaultName = "a large flagstone";
- this.description = "A heavy broken brick stone. It was probably previously part of a building that fell into ruin.";
- this.lastSentence = " It's large, flat sides would be perfect for a {hint}mark{/hint} or two.";
- this.defaultDescription = "A heavy broken brick stone. It was probably previously part of a building that fell into ruin.";
- this.type = "item";
- this.keywords = ["stone", "flagstone"];
- this.resetDelay = 12000000;
- this.mud_reset(0);
- this.filename = "ruinflagstone.js";
- this.isMarked = false;
- this.markText = "";
- }
- mud_reset(time) {
- this.isMarked = false;
- this.markText = "";
- this.description = this.defaultDescription + this.lastSentence;
- this.name = this.defaultName;
- this.itemExpires = time + this.resetDelay;
- }
- mud_tick(time) {
- if(time >= this.itemExpires) {
- this.mud_reset(time);
- }
- }
- mud_getName() {
- if(this.isMarked) {
- return "{item}a stone marked with '" + this.markText + "'{/item}";
- }
- return "{item}a large flagstone{/item}";
- }
- mud_getDescription() {
- var desc = this.defaultDescription;
- if(this.isMarked) {
- desc += " Someone has drawn '" + this.markText + "' on it.";
- } else {
- desc += " It's large, flat sides would be perfect for a {hint}mark{/hint} or two.";
- }
- return desc;
- }
- mark(room, mobile, input) {
- if(input[0] == null) {
- return false;
- }
- var inventoryItem = libs.Utilities.getSpecific(input[0], mobile.items, session.items);
- if(inventoryItem != null) {
- if(this != inventoryItem) {
- return false;
- }
- var desiredMark = input.slice(1, input.length).join(" ");
- if(desiredMark == null || desiredMark == "") {
- libs.Output.toMobile(mobile.id, "What mark would you like to put on it?");
- return true;
- }
- var desiredMark = desiredMark.trim();
- this.markText = desiredMark.substring(0, 2);
- this.isMarked = true;
- var output = "You mark the stone with '" + this.markText + "'";
- if(desiredMark.length != this.markText.length) {
- output += " but can't fit the rest";
- }
- libs.Output.toMobile(mobile.id, output + ".");
- return true;
- }
- }
- }
|