123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- module.exports = class Linkpearl {
- constructor() {
- this.id = 0;
- this.name = "a small pearl";
- this.description = "A small opalescent pearl.";
- this.type = "item";
- this.keywords = ["pearl", "linkpearl"];
- this.resetDelay = 12000000;
- this.itemExpires = 0;
- this.filename = "linkpearl.js";
- this.isWorn = false;
- this.belongsTo = 0;
- }
- mud_reset(time) {
- this.itemExpires = time + this.resetDelay;
- }
- mud_tick(time) {
- if(time >= this.itemExpires) {
- this.mud_reset(time);
- }
- }
- mud_getName() {
- var dispName = "{item}" + this.name + "{/item}";
- if(this.isWorn) {
- dispName += " (worn)";
- }
- return dispName;
- }
- mud_getDescription() {
- return this.description;
- }
- remove(room, mobile, input) {
- if(this.keywords.indexOf(input.join(" ")) != -1) {
- libs.Output.toMobile(mobile.id, "You pull the linkpearl out of your ear.", mobile);
- libs.Output.toRoom(mobile.roomId, mobile.name + " removes a linkpearl from their ear.", mobile);
- this.isWorn = false;
- return true;
- }
- }
- wear(room, mobile, input) {
- if(this.keywords.indexOf(input.join(" ")) != -1) {
- libs.Output.toMobile(mobile.id, "You slip the linkpearl into your ear.", mobile);
- libs.Output.toRoom(mobile.roomId, mobile.name + " puts a linkpearl in their ear.", mobile);
- this.isWorn = true;
- return true;
- }
- }
- mud_saveItem() {
- var dataToSave = {};
- dataToSave.belongsTo = this.belongsTo;
- return dataToSave;
- }
- mud_loadItem(itemData) {
- for(var dataIndex in itemData) {
- if(this.hasOwnProperty(dataIndex)) {
- this[dataIndex] = itemData[dataIndex];
- }
- }
- }
- }
|