No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

105 líneas
1.9 KiB

  1. define([
  2. 'items/config/slots'
  3. ], function (
  4. slots
  5. ) {
  6. return {
  7. slot: null,
  8. quality: 0,
  9. type: 'loot',
  10. build: function () {
  11. var slotNames = slots.slots
  12. .filter(s => (s != 'tool'));
  13. if (this.slot) {
  14. if (!slotNames.some(s => (s == this.slot)))
  15. this.slot = null;
  16. }
  17. if (!this.slot) {
  18. if (Math.random() < 0.2) {
  19. this.quality = 1 + ~~(Math.random() * 2);
  20. this.slotName = '';
  21. if (this.quality == 1) {
  22. var roll = ~~(Math.random() * 2);
  23. if (roll == 0)
  24. this.slotName = 'Magic Armor'
  25. else
  26. this.slotName = 'Magic Accessory';
  27. this.slot = ([
  28. [
  29. 'head',
  30. 'chest',
  31. 'hands',
  32. 'waist',
  33. 'legs',
  34. 'feet',
  35. 'offHand'
  36. ],
  37. [
  38. 'trinket',
  39. 'neck',
  40. 'finger'
  41. ]
  42. ])[roll];
  43. } else {
  44. this.slotName = 'Rare Equipment';
  45. this.slot = slotNames;
  46. }
  47. this.name = 'Purveyor of Rarities';
  48. this.description = 'Loot 1x ' + this.slotName;
  49. } else {
  50. this.name = 'Purveyor of Artefacts';
  51. this.slot = slotNames[~~(Math.random() * slotNames.length)];
  52. this.slotName = this.slot[0].toUpperCase() + this.slot.substr(1);
  53. this.description = 'Loot 1x ' + this.slotName + ' slot item';
  54. }
  55. }
  56. return true;
  57. },
  58. getXpMultiplier: function () {
  59. var multiplier = 1;
  60. if (!this.quality)
  61. multiplier *= 8;
  62. else if (this.quality == 2)
  63. multiplier *= 6;
  64. else if (this.quality == 1)
  65. multiplier *= 4;
  66. return multiplier;
  67. },
  68. events: {
  69. afterLootMobItem: function (item) {
  70. if (
  71. (this.isReady) ||
  72. (this.obj.zoneName != this.zoneName) ||
  73. (
  74. (this.quality) &&
  75. (item.quality < this.quality)
  76. ) ||
  77. (
  78. (this.slot.indexOf) &&
  79. (this.slot.indexOf(item.slot) == -1)
  80. ) ||
  81. (
  82. (!this.slot.indexOf) &&
  83. (this.slot != item.slot)
  84. )
  85. )
  86. return;
  87. this.ready();
  88. }
  89. }
  90. };
  91. });