book.js 1016 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. module.exports = class Book {
  2. constructor() {
  3. this.id = 0;
  4. this.name = "a leather-bound book";
  5. this.description = "A beautiful old book bound in aged brown leather.";
  6. this.type = "item";
  7. this.keywords = ["book"];
  8. this.resetDelay = 12000000;
  9. this.mud_reset(0);
  10. this.filename = "book.js";
  11. this.heldBy = -1;
  12. this.value = 25;
  13. this.itemSlot = libs.ItemSlot.MainHand;
  14. }
  15. mud_reset(time) {
  16. this.itemExpires = time + this.resetDelay;
  17. }
  18. mud_tick(time) {
  19. if(time >= this.itemExpires) {
  20. this.mud_reset(time);
  21. }
  22. }
  23. mud_getName() {
  24. return "{item}" + this.name + "{/item}";
  25. }
  26. mud_getDescription() {
  27. return this.description;
  28. }
  29. read(room, mobile, input) {
  30. if(this.isWorn == mobile.id) {
  31. libs.Output.toMobile(mobile.id, "Flipping briefly through the book, you see the pages are all blank.", mobile);
  32. return true;
  33. } else if(this.isWorn != mobile.id) {
  34. libs.Output.toMobile(mobile.id, "You would have to {hint}hold{/hint} a book first.", mobile);
  35. return true;
  36. }
  37. }
  38. }