1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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 = this.name;
- if(this.isWorn) {
- dispName += " (worn)";
- }
- return "{item}" + dispName + "{/item}";
- }
- 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];
- }
- }
- }
- }
|