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.
 
 
 

64 lines
847 B

  1. module.exports = {
  2. slots: [
  3. 'head',
  4. 'neck',
  5. 'chest',
  6. 'hands',
  7. 'finger',
  8. 'waist',
  9. 'legs',
  10. 'feet',
  11. 'trinket',
  12. 'oneHanded',
  13. 'twoHanded',
  14. 'offHand',
  15. 'tool'
  16. ],
  17. chance: {
  18. head: 85,
  19. neck: 45,
  20. chest: 100,
  21. hands: 90,
  22. finger: 40,
  23. waist: 80,
  24. legs: 100,
  25. feet: 90,
  26. trinket: 35,
  27. oneHanded: 60,
  28. twoHanded: 60,
  29. offHand: 40,
  30. tool: 0
  31. },
  32. armorMult: {
  33. head: 0.2,
  34. neck: 0,
  35. chest: 0.4,
  36. hands: 0.1,
  37. finger: 0,
  38. waist: 0,
  39. legs: 0.2,
  40. feet: 0.1,
  41. trinket: 0,
  42. oneHanded: 0,
  43. twoHanded: 0,
  44. offHand: 0,
  45. tool: 0
  46. },
  47. getRandomSlot: function (exclude) {
  48. let chances = [];
  49. for (let c in this.chance) {
  50. if (c === exclude)
  51. continue;
  52. let rolls = this.chance[c];
  53. for (let i = 0; i < rolls; i++)
  54. chances.push(c);
  55. }
  56. return chances[~~(Math.random() * chances.length)];
  57. }
  58. };