You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

203 lines
4.5 KiB

  1. /* eslint-disable max-lines-per-function */
  2. module.exports = {
  3. fixDb: async function () {
  4. await io.deleteAsync({
  5. key: 'list',
  6. table: 'leaderboard'
  7. });
  8. },
  9. fixCharacter: function (player) {
  10. let inv = player.components.find(c => (c.type === 'inventory'));
  11. if ((inv) && (inv.items))
  12. this.fixItems(inv.items);
  13. },
  14. fixCustomChannels: function (customChannels) {
  15. return customChannels
  16. .filter(c => {
  17. return (
  18. c.length <= 15 &&
  19. c.match(/^[0-9a-zA-Z]+$/)
  20. );
  21. });
  22. },
  23. fixStash: function (stash) {
  24. this.fixItems(stash);
  25. },
  26. fixItems: function (items) {
  27. //There are some bugged mounts with cdMax: 0. Set that to 86 as 86 is the new CD (down from 171)
  28. items
  29. .filter(i => i.type === 'mount')
  30. .forEach(i => {
  31. i.cdMax = 86;
  32. });
  33. items
  34. .filter(i => i.name === 'Candy Corn')
  35. .forEach(i => {
  36. i.noDrop = true;
  37. });
  38. items
  39. .filter(i => i.name === 'Enchanted Wreath')
  40. .forEach(i => {
  41. delete i.noDrop;
  42. delete i.noDestroy;
  43. });
  44. items
  45. .filter(i => (i.name === 'Elixir of Infatuation'))
  46. .forEach(function (i) {
  47. i.cdMax = 342;
  48. i.sprite = [1, 0];
  49. });
  50. items
  51. .filter(i => i.name === 'Squashling Vine')
  52. .forEach(i => {
  53. i.petSheet = 'server/mods/iwd-souls-moor/images/skins.png';
  54. i.petCell = 16;
  55. });
  56. items
  57. .filter(i => ((i.name === 'Cowl of Obscurity') && (!i.factions)))
  58. .forEach(function (i) {
  59. i.factions = [{
  60. id: 'gaekatla',
  61. tier: 7
  62. }];
  63. });
  64. items
  65. .filter(i => i.stats && i.stats.magicFind > 135)
  66. .forEach(i => {
  67. let value = '' + i.stats.magicFind;
  68. i.stats.magicFind = ~~(value.substr(value.length - 2));
  69. });
  70. items
  71. .filter(i => (
  72. i.enchantedStats &&
  73. i.slot !== 'tool' &&
  74. Object.keys(i.enchantedStats).some(e => e.indexOf('catch') === 0 || e.indexOf('fish') === 0)
  75. ))
  76. .forEach(function (i) {
  77. let enchanted = i.enchantedStats;
  78. let stats = i.stats;
  79. Object.keys(enchanted).forEach(e => {
  80. if (e.indexOf('catch') === 0 || e.indexOf('fish') === 0) {
  81. delete stats[e];
  82. delete enchanted[e];
  83. }
  84. });
  85. if (!Object.keys(enchanted).length)
  86. delete i.enchantedStats;
  87. });
  88. items
  89. .filter(i => i.factions && i.factions.indexOf && i.factions.some(f => f.id === 'pumpkinSailor') && i.slot === 'finger')
  90. .forEach(i => {
  91. i.noDestroy = false;
  92. });
  93. items
  94. .filter(i => (i.name === 'Steelclaw\'s Bite'))
  95. .forEach(function (i) {
  96. let effect = i.effects[0];
  97. if (!effect.properties) {
  98. effect.properties = {
  99. element: 'poison'
  100. };
  101. } else if (!effect.properties.element)
  102. effect.properties.element = 'poison';
  103. });
  104. items
  105. .filter(i => i.name === 'Gourdhowl')
  106. .forEach(i => {
  107. const effect = i.effects[0];
  108. if (!effect.rolls.castSpell) {
  109. effect.rolls = {
  110. castSpell: {
  111. type: 'whirlwind',
  112. damage: effect.rolls.damage,
  113. range: 1,
  114. statType: 'str',
  115. statMult: 1,
  116. isAttack: true
  117. },
  118. castTarget: 'none',
  119. chance: effect.rolls.chance,
  120. textTemplate: 'Grants you a ((chance))% chance to cast a ((castSpell.damage)) damage whirlwind on hit',
  121. combatEvent: {
  122. name: 'afterDealDamage',
  123. afterDealDamage: {
  124. spellName: 'melee'
  125. }
  126. }
  127. };
  128. }
  129. });
  130. items
  131. .filter(i => i.name === 'Putrid Shank')
  132. .forEach(i => {
  133. const effect = i.effects[0];
  134. if (!effect.rolls.castSpell) {
  135. effect.rolls = {
  136. chance: effect.rolls.chance,
  137. textTemplate: 'Grants you a ((chance))% chance to cast a ((castSpell.damage)) damage smokebomb on hit',
  138. combatEvent: {
  139. name: 'afterDealDamage',
  140. afterDealDamage: {
  141. spellName: 'melee'
  142. }
  143. },
  144. castTarget: 'none',
  145. castSpell: {
  146. type: 'smokebomb',
  147. damage: 1,
  148. range: 1,
  149. element: 'poison',
  150. statType: 'dex',
  151. statMult: 1,
  152. duration: 5,
  153. isAttack: true
  154. }
  155. };
  156. }
  157. });
  158. items
  159. .filter(f => f.effects?.[0]?.factionId === 'akarei' && !f.effects[0].properties)
  160. .forEach(function (i) {
  161. let effect = i.effects[0];
  162. let chance = parseFloat(effect.text.split(' ')[0].replace('%', ''));
  163. effect.properties = {
  164. chance: chance
  165. };
  166. });
  167. items
  168. .filter(f => ((f.stats) && (f.stats.dmgPercent)))
  169. .forEach(function (i) {
  170. i.stats.physicalPercent = i.stats.dmgPercent;
  171. delete i.stats.dmgPercent;
  172. if ((i.enchantedStats) && (i.enchantedStats.dmgPercent)) {
  173. i.enchantedStats.physicalPercent = i.enchantedStats.dmgPercent;
  174. delete i.enchantedStats.dmgPercent;
  175. }
  176. });
  177. }
  178. };