farming-weight 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/dist/classes/farmingaccessory.d.ts +10 -10
  2. package/dist/classes/farmingaccessory.js +50 -50
  3. package/dist/classes/farmingarmor.d.ts +41 -38
  4. package/dist/classes/farmingarmor.js +202 -207
  5. package/dist/classes/farmingequipment.d.ts +17 -17
  6. package/dist/classes/farmingequipment.js +105 -109
  7. package/dist/classes/farmingpet.d.ts +14 -14
  8. package/dist/classes/farmingpet.js +91 -90
  9. package/dist/classes/farmingtool.d.ts +34 -34
  10. package/dist/classes/farmingtool.js +192 -202
  11. package/dist/classes/item.d.ts +18 -18
  12. package/dist/classes/item.js +11 -11
  13. package/dist/classes/lotusgear.d.ts +17 -17
  14. package/dist/classes/lotusgear.js +103 -107
  15. package/dist/classes/player.d.ts +58 -55
  16. package/dist/classes/player.js +215 -228
  17. package/dist/classes/weightcalc.d.ts +56 -52
  18. package/dist/classes/weightcalc.js +185 -190
  19. package/dist/classes/weightcalc.test.js +102 -102
  20. package/dist/constants/accessories.d.ts +6 -6
  21. package/dist/constants/accessories.js +51 -51
  22. package/dist/constants/armor.d.ts +30 -30
  23. package/dist/constants/armor.js +699 -699
  24. package/dist/constants/enchants.d.ts +1 -1
  25. package/dist/constants/enchants.js +56 -56
  26. package/dist/constants/enchants.js.map +1 -1
  27. package/dist/constants/equipment.d.ts +20 -20
  28. package/dist/constants/equipment.js +116 -116
  29. package/dist/constants/gems.d.ts +2 -2
  30. package/dist/constants/gems.js +8 -8
  31. package/dist/constants/items.d.ts +8 -8
  32. package/dist/constants/items.js +14 -14
  33. package/dist/constants/lotus.d.ts +20 -20
  34. package/dist/constants/lotus.js +106 -106
  35. package/dist/constants/pets.d.ts +38 -38
  36. package/dist/constants/pets.js +253 -253
  37. package/dist/constants/reforges.d.ts +1 -1
  38. package/dist/constants/reforges.js +1 -1
  39. package/dist/constants/reforges.js.map +1 -1
  40. package/dist/constants/specific.d.ts +1 -1
  41. package/dist/constants/specific.js +6 -6
  42. package/dist/constants/stats.d.ts +1 -1
  43. package/dist/constants/tempfortune.js +14 -14
  44. package/dist/constants/tempfortune.js.map +1 -1
  45. package/dist/constants/tools.d.ts +7 -7
  46. package/dist/constants/tools.js +456 -456
  47. package/dist/constants/upgrades.d.ts +6 -6
  48. package/dist/crops/special.js +1 -1
  49. package/dist/crops/special.js.map +1 -1
  50. package/dist/fortune/farmingaccessory.d.ts +1 -1
  51. package/dist/fortune/farmingaccessory.js +1 -1
  52. package/dist/fortune/farmingaccessory.js.map +1 -1
  53. package/dist/fortune/farmingarmor.d.ts +4 -3
  54. package/dist/fortune/farmingarmor.js +28 -17
  55. package/dist/fortune/farmingarmor.js.map +1 -1
  56. package/dist/fortune/farmingequipment.d.ts +3 -3
  57. package/dist/fortune/farmingequipment.js +5 -5
  58. package/dist/fortune/farmingequipment.js.map +1 -1
  59. package/dist/fortune/farmingpet.d.ts +3 -3
  60. package/dist/fortune/farmingpet.js +2 -2
  61. package/dist/fortune/farmingpet.js.map +1 -1
  62. package/dist/fortune/farmingtool.d.ts +2 -2
  63. package/dist/fortune/farmingtool.js +4 -4
  64. package/dist/fortune/farmingtool.js.map +1 -1
  65. package/dist/fortune/upgradable.d.ts +35 -33
  66. package/dist/fortune/upgradable.js +1 -1
  67. package/dist/fortune/upgradeable.d.ts +6 -6
  68. package/dist/fortune/upgradeable.js +3 -3
  69. package/dist/fortune/upgradeable.js.map +1 -1
  70. package/dist/items/accessories.d.ts +1 -1
  71. package/dist/items/accessories.js +3 -3
  72. package/dist/items/accessories.js.map +1 -1
  73. package/dist/items/armor.d.ts +2 -2
  74. package/dist/items/armor.js +2 -2
  75. package/dist/items/armor.js.map +1 -1
  76. package/dist/items/equipment.js +8 -8
  77. package/dist/items/equipment.js.map +1 -1
  78. package/dist/items/pets.d.ts +2 -2
  79. package/dist/items/pets.js +15 -15
  80. package/dist/items/pets.js.map +1 -1
  81. package/dist/items/tools.d.ts +1 -1
  82. package/dist/items/tools.js +15 -15
  83. package/dist/items/tools.js.map +1 -1
  84. package/dist/player/index.js +1 -1
  85. package/dist/player/player.d.ts +1 -1
  86. package/dist/player/player.js +9 -9
  87. package/dist/player/player.js.map +1 -1
  88. package/dist/player/playeroptions.d.ts +10 -10
  89. package/dist/player.d.ts +21 -21
  90. package/dist/player.js +26 -26
  91. package/dist/ratecalc.d.ts +16 -14
  92. package/dist/ratecalc.js +148 -145
  93. package/dist/tool.js +3 -3
  94. package/dist/upgrades/progress.d.ts +2 -2
  95. package/dist/upgrades/progress.js +3 -3
  96. package/dist/upgrades/progress.js.map +1 -1
  97. package/dist/upgrades/sources/accessorysources.d.ts +2 -2
  98. package/dist/upgrades/sources/accessorysources.js +10 -8
  99. package/dist/upgrades/sources/accessorysources.js.map +1 -1
  100. package/dist/upgrades/sources/armorsetsources.d.ts +2 -2
  101. package/dist/upgrades/sources/armorsetsources.js +12 -11
  102. package/dist/upgrades/sources/armorsetsources.js.map +1 -1
  103. package/dist/upgrades/sources/cropsources.d.ts +3 -3
  104. package/dist/upgrades/sources/cropsources.js +22 -22
  105. package/dist/upgrades/sources/cropsources.js.map +1 -1
  106. package/dist/upgrades/sources/gearsources.d.ts +3 -3
  107. package/dist/upgrades/sources/gearsources.js +18 -19
  108. package/dist/upgrades/sources/gearsources.js.map +1 -1
  109. package/dist/upgrades/sources/generalsources.d.ts +2 -2
  110. package/dist/upgrades/sources/generalsources.js +18 -16
  111. package/dist/upgrades/sources/generalsources.js.map +1 -1
  112. package/dist/upgrades/sources/toolsources.d.ts +5 -5
  113. package/dist/upgrades/sources/toolsources.js +24 -23
  114. package/dist/upgrades/sources/toolsources.js.map +1 -1
  115. package/dist/upgrades/upgrades.d.ts +4 -4
  116. package/dist/upgrades/upgrades.js +19 -19
  117. package/dist/upgrades/upgrades.js.map +1 -1
  118. package/dist/util/enchants.d.ts +3 -3
  119. package/dist/util/enchants.js +1 -1
  120. package/dist/util/enchants.js.map +1 -1
  121. package/dist/util/garden.d.ts +2 -2
  122. package/dist/util/garden.js +6 -7
  123. package/dist/util/garden.js.map +1 -1
  124. package/dist/util/gems.d.ts +2 -2
  125. package/dist/util/gems.js +24 -14
  126. package/dist/util/gems.js.map +1 -1
  127. package/dist/util/pests.js +1 -1
  128. package/dist/util/pests.js.map +1 -1
  129. package/dist/util/pests.test.js +27 -25
  130. package/dist/util/ratecalc.js +2 -2
  131. package/dist/util/ratecalc.js.map +1 -1
  132. package/dist/util/skyblocktime.js +1 -1
  133. package/dist/util/skyblocktime.js.map +1 -1
  134. package/package.json +36 -48
@@ -1,235 +1,222 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.FarmingPlayer = exports.createFarmingPlayer = void 0;
4
- const crops_1 = require("../constants/crops");
5
- const personalbests_1 = require("../constants/personalbests");
6
- const pests_1 = require("../util/pests");
7
- const specific_1 = require("../constants/specific");
8
- const names_1 = require("../util/names");
9
- const farmingaccessory_1 = require("./farmingaccessory");
10
- const farmingarmor_1 = require("./farmingarmor");
11
- const farmingpet_1 = require("./farmingpet");
12
- const farmingtool_1 = require("./farmingtool");
13
- const farmingequipment_1 = require("./farmingequipment");
4
+ const CROPS_1 = require('../constants/crops');
5
+ const PERSONALBESTS_1 = require('../constants/personalbests');
6
+ const PESTS_1 = require('../util/pests');
7
+ const SPECIFIC_1 = require('../constants/specific');
8
+ const NAMES_1 = require('../util/names');
9
+ const FARMINGACCESSORY_1 = require('./farmingaccessory');
10
+ const FARMINGARMOR_1 = require('./farmingarmor');
11
+ const FARMINGPET_1 = require('./farmingpet');
12
+ const FARMINGTOOL_1 = require('./farmingtool');
13
+ const FARMINGEQUIPMENT_1 = require('./farmingequipment');
14
14
  function createFarmingPlayer(options) {
15
- return new FarmingPlayer(options);
15
+ return new FarmingPlayer(options);
16
16
  }
17
17
  exports.createFarmingPlayer = createFarmingPlayer;
18
18
  class FarmingPlayer {
19
- constructor(options) {
20
- this.options = options;
21
- options.tools ??= [];
22
- if (options.tools[0] instanceof farmingtool_1.FarmingTool) {
23
- this.tools = options.tools;
24
- for (const tool of this.tools)
25
- tool.setOptions(options);
26
- }
27
- else {
28
- this.tools = farmingtool_1.FarmingTool.fromArray(options.tools, options);
29
- }
30
- this.selectedTool = this.options.selectedTool ?? this.tools[0];
31
- options.pets ??= [];
32
- if (options.pets[0] instanceof farmingpet_1.FarmingPet) {
33
- this.pets = options.pets.sort((a, b) => b.fortune - a.fortune);
34
- for (const pet of this.pets)
35
- pet.setOptions(options);
36
- }
37
- else {
38
- this.pets = farmingpet_1.FarmingPet.fromArray(options.pets, options);
39
- }
40
- this.selectedPet = this.options.selectedPet;
41
- options.armor ??= [];
42
- if (options.armor instanceof farmingarmor_1.ArmorSet) {
43
- this.armorSet = options.armor;
44
- this.armor = this.armorSet.pieces;
45
- for (const a of this.armor)
46
- a.setOptions(options);
47
- this.armorSet.getFortuneBreakdown(true);
48
- }
49
- else if (options.armor[0] instanceof farmingarmor_1.FarmingArmor) {
50
- this.armor = options.armor.sort((a, b) => b.fortune - a.fortune);
51
- for (const a of this.armor)
52
- a.setOptions(options);
53
- this.armorSet = new farmingarmor_1.ArmorSet(this.armor);
54
- }
55
- else {
56
- this.armor = farmingarmor_1.FarmingArmor.fromArray(options.armor, options);
57
- this.armorSet = new farmingarmor_1.ArmorSet(this.armor);
58
- }
59
- options.equipment ??= [];
60
- if (options.equipment[0] instanceof farmingequipment_1.FarmingEquipment) {
61
- this.equipment = options.equipment.sort((a, b) => b.fortune - a.fortune);
62
- for (const e of this.equipment)
63
- e.setOptions(options);
64
- }
65
- else {
66
- this.equipment = farmingequipment_1.FarmingEquipment.fromArray(options.equipment, options);
67
- }
68
- options.accessories ??= [];
69
- if (options.accessories[0] instanceof farmingaccessory_1.FarmingAccessory) {
70
- this.accessories = options.accessories.sort((a, b) => b.fortune - a.fortune);
71
- }
72
- else {
73
- this.accessories = farmingaccessory_1.FarmingAccessory.fromArray(options.accessories);
74
- }
75
- this.fortune = this.getGeneralFortune();
76
- }
77
- changeArmor(armor) {
78
- this.armorSet = new farmingarmor_1.ArmorSet(armor.sort((a, b) => b.fortune - a.fortune));
79
- }
80
- selectTool(tool) {
81
- this.selectedTool = tool;
82
- this.fortune = this.getGeneralFortune();
83
- }
84
- selectPet(pet) {
85
- this.selectedPet = pet;
86
- this.fortune = this.getGeneralFortune();
87
- }
88
- setStrength(strength) {
89
- this.options.strength = strength;
90
- for (const pet of this.pets) {
91
- pet.fortune = pet.getFortune();
92
- }
93
- this.fortune = this.getGeneralFortune();
94
- }
95
- getGeneralFortune() {
96
- let sum = 0;
97
- const breakdown = {};
98
- // Plots
99
- const plots = specific_1.FORTUNE_PER_PLOT * (this.options.plotsUnlocked ?? 0);
100
- if (plots > 0) {
101
- breakdown['Unlocked Plots'] = plots;
102
- sum += plots;
103
- }
104
- // Farming Level
105
- const level = specific_1.FORTUNE_PER_FARMING_LEVEL * (this.options.farmingLevel ?? 0);
106
- if (level > 0) {
107
- breakdown['Farming Level'] = level;
108
- sum += level;
109
- }
110
- // Bestiary
111
- if (this.options.bestiaryKills) {
112
- const bestiary = (0, pests_1.fortuneFromPestBestiary)(this.options.bestiaryKills);
113
- if (bestiary > 0) {
114
- breakdown['Pest Bestiary'] = bestiary;
115
- sum += bestiary;
116
- }
117
- }
118
- // Armor Set
119
- const armorSet = this.armorSet.fortune;
120
- if (armorSet > 0) {
121
- breakdown['Armor Set'] = armorSet;
122
- sum += armorSet;
123
- }
124
- // Lotus Gear
125
- const equipment = this.equipment.reduce((a, b) => a + b.fortune, 0);
126
- if (equipment > 0) {
127
- breakdown['Equipment'] = equipment;
128
- sum += equipment;
129
- }
130
- // Anita Bonus
131
- const anitaBonus = (this.options.anitaBonus ?? 0) * specific_1.FORTUNE_PER_ANITA_BONUS;
132
- if (anitaBonus > 0) {
133
- breakdown['Anita Bonus Drops'] = anitaBonus;
134
- sum += anitaBonus;
135
- }
136
- // Community Center
137
- const communityCenter = (this.options.communityCenter ?? 0) * specific_1.FORTUNE_PER_COMMUNITY_CENTER;
138
- if (communityCenter > 0) {
139
- breakdown['Community Center'] = communityCenter;
140
- sum += communityCenter;
141
- }
142
- // Selected Pet
143
- const pet = this.selectedPet;
144
- if (pet && pet.fortune > 0) {
145
- breakdown[pet.info.name ?? 'Selected Pet'] = pet.fortune;
146
- sum += pet.fortune;
147
- }
148
- // Accessories, only count highest fortune from each family
149
- const families = new Map();
150
- for (const accessory of this.accessories.filter((a) => a.fortune > 0).sort((a, b) => b.fortune - a.fortune)) {
151
- if (accessory.info.family) {
152
- if (!families.has(accessory.info.family)) {
153
- families.set(accessory.info.family, accessory);
154
- }
155
- else {
156
- continue;
157
- }
158
- }
159
- breakdown[accessory.item.name ?? accessory.item.skyblockId ?? 'Accessory [Error]'] = accessory.fortune;
160
- sum += accessory.fortune;
161
- }
162
- // Refined Truffles
163
- const truffles = Math.min(5, (this.options.refinedTruffles ?? 0));
164
- if (truffles > 0) {
165
- breakdown['Refined Truffles'] = truffles;
166
- sum += truffles;
167
- }
168
- // Extra Fortune
169
- for (const extra of this.options.extraFortune ?? []) {
170
- if (extra.crop)
171
- continue;
172
- breakdown[extra.name ?? 'Extra Fortune'] = extra.fortune;
173
- sum += extra.fortune;
174
- }
175
- this.breakdown = breakdown;
176
- return sum;
177
- }
178
- getCropFortune(crop, tool = this.selectedTool) {
179
- if (tool) {
180
- this.selectTool(tool);
181
- }
182
- let sum = 0;
183
- const breakdown = {};
184
- // Crop upgrades
185
- const upgrade = specific_1.FORTUNE_PER_CROP_UPGRADE * (this.options.cropUpgrades?.[crop] ?? 0);
186
- if (upgrade > 0) {
187
- breakdown['Crop Upgrade'] = upgrade;
188
- sum += upgrade;
189
- }
190
- // Personal bests
191
- const personalBest = this.options.personalBests?.[(0, names_1.getItemIdFromCrop)(crop)] ??
192
- this.options.personalBests?.[(0, names_1.getCropDisplayName)(crop).replace(/ /g, '')];
193
- if (personalBest) {
194
- const fortune = (0, personalbests_1.fortuneFromPersonalBestContest)(crop, personalBest);
195
- if (fortune > 0) {
196
- breakdown['Personal Best'] = fortune;
197
- sum += fortune;
198
- }
199
- }
200
- // Tool
201
- const toolFortune = this.selectedTool?.fortune ?? 0;
202
- if (toolFortune > 0) {
203
- breakdown['Selected Tool'] = toolFortune;
204
- sum += toolFortune;
205
- }
206
- // Accessories
207
- //* There's only one accessory family for farming right now
208
- const accessory = this.accessories.find((a) => a.info.crops && a.info.crops.includes(crop));
209
- if (accessory && accessory.fortune > 0) {
210
- breakdown[accessory.item.name ?? 'Accessories'] = accessory.fortune ?? 0;
211
- sum += accessory.fortune ?? 0;
212
- }
213
- // Exportable Crops
214
- if (this.options.exportableCrops?.[crop]) {
215
- const exportable = this.options.exportableCrops[crop];
216
- if (exportable) {
217
- breakdown['Exportable Crop'] = crops_1.EXPORTABLE_CROP_FORTUNE;
218
- sum += crops_1.EXPORTABLE_CROP_FORTUNE;
219
- }
220
- }
221
- // Extra Fortune
222
- for (const extra of this.options.extraFortune ?? []) {
223
- if (extra.crop !== crop)
224
- continue;
225
- breakdown[extra.name ?? 'Extra Fortune'] = extra.fortune;
226
- sum += extra.fortune;
227
- }
228
- return {
229
- fortune: sum,
230
- breakdown,
231
- };
232
- }
19
+ constructor(options) {
20
+ this.options = options;
21
+ options.tools ??= [];
22
+ if (options.tools[0] instanceof FARMINGTOOL_1.FarmingTool) {
23
+ this.tools = options.tools;
24
+ for (const TOOL of this.tools) TOOL.setOptions(options);
25
+ } else {
26
+ this.tools = FARMINGTOOL_1.FarmingTool.fromArray(options.tools, options);
27
+ }
28
+ this.selectedTool = this.options.selectedTool ?? this.tools[0];
29
+ options.pets ??= [];
30
+ if (options.pets[0] instanceof FARMINGPET_1.FarmingPet) {
31
+ this.pets = options.pets.sort((a, b) => b.fortune - a.fortune);
32
+ for (const PET of this.pets) PET.setOptions(options);
33
+ } else {
34
+ this.pets = FARMINGPET_1.FarmingPet.fromArray(options.pets, options);
35
+ }
36
+ this.selectedPet = this.options.selectedPet;
37
+ options.armor ??= [];
38
+ if (options.armor instanceof FARMINGARMOR_1.ArmorSet) {
39
+ this.armorSet = options.armor;
40
+ this.armor = this.armorSet.pieces;
41
+ for (const A of this.armor) A.setOptions(options);
42
+ this.armorSet.getFortuneBreakdown(true);
43
+ } else if (options.armor[0] instanceof FARMINGARMOR_1.FarmingArmor) {
44
+ this.armor = options.armor.sort((a, b) => b.fortune - a.fortune);
45
+ for (const A of this.armor) A.setOptions(options);
46
+ this.armorSet = new FARMINGARMOR_1.ArmorSet(this.armor);
47
+ } else {
48
+ this.armor = FARMINGARMOR_1.FarmingArmor.fromArray(options.armor, options);
49
+ this.armorSet = new FARMINGARMOR_1.ArmorSet(this.armor);
50
+ }
51
+ options.equipment ??= [];
52
+ if (options.equipment[0] instanceof FARMINGEQUIPMENT_1.FarmingEquipment) {
53
+ this.equipment = options.equipment.sort((a, b) => b.fortune - a.fortune);
54
+ for (const E of this.equipment) E.setOptions(options);
55
+ } else {
56
+ this.equipment = FARMINGEQUIPMENT_1.FarmingEquipment.fromArray(options.equipment, options);
57
+ }
58
+ options.accessories ??= [];
59
+ if (options.accessories[0] instanceof FARMINGACCESSORY_1.FarmingAccessory) {
60
+ this.accessories = options.accessories.sort((a, b) => b.fortune - a.fortune);
61
+ } else {
62
+ this.accessories = FARMINGACCESSORY_1.FarmingAccessory.fromArray(options.accessories);
63
+ }
64
+ this.fortune = this.getGeneralFortune();
65
+ }
66
+ changeArmor(armor) {
67
+ this.armorSet = new FARMINGARMOR_1.ArmorSet(armor.sort((a, b) => b.fortune - a.fortune));
68
+ }
69
+ selectTool(tool) {
70
+ this.selectedTool = tool;
71
+ this.fortune = this.getGeneralFortune();
72
+ }
73
+ selectPet(pet) {
74
+ this.selectedPet = pet;
75
+ this.fortune = this.getGeneralFortune();
76
+ }
77
+ setStrength(strength) {
78
+ this.options.strength = strength;
79
+ for (const PET of this.pets) {
80
+ PET.fortune = PET.getFortune();
81
+ }
82
+ this.fortune = this.getGeneralFortune();
83
+ }
84
+ getGeneralFortune() {
85
+ let SUM = 0;
86
+ const BREAKDOWN = {};
87
+ // Plots
88
+ const PLOTS = SPECIFIC_1.FORTUNE_PER_PLOT * (this.options.plotsUnlocked ?? 0);
89
+ if (PLOTS > 0) {
90
+ BREAKDOWN['Unlocked Plots'] = PLOTS;
91
+ SUM += PLOTS;
92
+ }
93
+ // Farming Level
94
+ const LEVEL = SPECIFIC_1.FORTUNE_PER_FARMING_LEVEL * (this.options.farmingLevel ?? 0);
95
+ if (LEVEL > 0) {
96
+ BREAKDOWN['Farming Level'] = LEVEL;
97
+ SUM += LEVEL;
98
+ }
99
+ // Bestiary
100
+ if (this.options.bestiaryKills) {
101
+ const BESTIARY = (0, PESTS_1.fortuneFromPestBestiary)(this.options.bestiaryKills);
102
+ if (BESTIARY > 0) {
103
+ BREAKDOWN['Pest Bestiary'] = BESTIARY;
104
+ SUM += BESTIARY;
105
+ }
106
+ }
107
+ // Armor Set
108
+ const ARMOR_SET = this.armorSet.fortune;
109
+ if (ARMOR_SET > 0) {
110
+ BREAKDOWN['Armor Set'] = ARMOR_SET;
111
+ SUM += ARMOR_SET;
112
+ }
113
+ // Lotus Gear
114
+ const EQUIPMENT = this.equipment.reduce((a, b) => a + b.fortune, 0);
115
+ if (EQUIPMENT > 0) {
116
+ BREAKDOWN['Equipment'] = EQUIPMENT;
117
+ SUM += EQUIPMENT;
118
+ }
119
+ // Anita Bonus
120
+ const ANITA_BONUS = (this.options.anitaBonus ?? 0) * SPECIFIC_1.FORTUNE_PER_ANITA_BONUS;
121
+ if (ANITA_BONUS > 0) {
122
+ BREAKDOWN['Anita Bonus Drops'] = ANITA_BONUS;
123
+ SUM += ANITA_BONUS;
124
+ }
125
+ // Community Center
126
+ const COMMUNITY_CENTER = (this.options.communityCenter ?? 0) * SPECIFIC_1.FORTUNE_PER_COMMUNITY_CENTER;
127
+ if (COMMUNITY_CENTER > 0) {
128
+ BREAKDOWN['Community Center'] = COMMUNITY_CENTER;
129
+ SUM += COMMUNITY_CENTER;
130
+ }
131
+ // Selected Pet
132
+ const PET = this.selectedPet;
133
+ if (PET && PET.fortune > 0) {
134
+ BREAKDOWN[PET.info.name ?? 'Selected Pet'] = PET.fortune;
135
+ SUM += PET.fortune;
136
+ }
137
+ // Accessories, only count highest fortune from each family
138
+ const FAMILIES = new Map();
139
+ for (const ACCESSORY of this.accessories.filter((a) => a.fortune > 0).sort((a, b) => b.fortune - a.fortune)) {
140
+ if (ACCESSORY.info.family) {
141
+ if (!FAMILIES.has(ACCESSORY.info.family)) {
142
+ FAMILIES.set(ACCESSORY.info.family, ACCESSORY);
143
+ } else {
144
+ continue;
145
+ }
146
+ }
147
+ BREAKDOWN[ACCESSORY.item.name ?? ACCESSORY.item.skyblockId ?? 'Accessory [Error]'] = ACCESSORY.fortune;
148
+ SUM += ACCESSORY.fortune;
149
+ }
150
+ // Refined Truffles
151
+ const TRUFFLES = Math.min(5, this.options.refinedTruffles ?? 0);
152
+ if (TRUFFLES > 0) {
153
+ BREAKDOWN['Refined Truffles'] = TRUFFLES;
154
+ SUM += TRUFFLES;
155
+ }
156
+ // Extra Fortune
157
+ for (const EXTRA of this.options.extraFortune ?? []) {
158
+ if (EXTRA.crop) continue;
159
+ BREAKDOWN[EXTRA.name ?? 'Extra Fortune'] = EXTRA.fortune;
160
+ SUM += EXTRA.fortune;
161
+ }
162
+ this.breakdown = BREAKDOWN;
163
+ return SUM;
164
+ }
165
+ getCropFortune(crop, tool = this.selectedTool) {
166
+ if (tool) {
167
+ this.selectTool(tool);
168
+ }
169
+ let SUM = 0;
170
+ const BREAKDOWN = {};
171
+ // Crop upgrades
172
+ const UPGRADE = SPECIFIC_1.FORTUNE_PER_CROP_UPGRADE * (this.options.cropUpgrades?.[crop] ?? 0);
173
+ if (UPGRADE > 0) {
174
+ BREAKDOWN['Crop Upgrade'] = UPGRADE;
175
+ SUM += UPGRADE;
176
+ }
177
+ // Personal bests
178
+ const PERSONAL_BEST =
179
+ this.options.personalBests?.[(0, NAMES_1.getItemIdFromCrop)(crop)] ??
180
+ this.options.personalBests?.[(0, NAMES_1.getCropDisplayName)(crop).replace(/ /g, '')];
181
+ if (PERSONAL_BEST) {
182
+ const FORTUNE = (0, PERSONALBESTS_1.fortuneFromPersonalBestContest)(crop, PERSONAL_BEST);
183
+ if (FORTUNE > 0) {
184
+ BREAKDOWN['Personal Best'] = FORTUNE;
185
+ SUM += FORTUNE;
186
+ }
187
+ }
188
+ // Tool
189
+ const TOOL_FORTUNE = this.selectedTool?.fortune ?? 0;
190
+ if (TOOL_FORTUNE > 0) {
191
+ BREAKDOWN['Selected Tool'] = TOOL_FORTUNE;
192
+ SUM += TOOL_FORTUNE;
193
+ }
194
+ // Accessories
195
+ //* There's only one accessory family for farming right now
196
+ const ACCESSORY = this.accessories.find((a) => a.info.crops && a.info.crops.includes(crop));
197
+ if (ACCESSORY && ACCESSORY.fortune > 0) {
198
+ BREAKDOWN[ACCESSORY.item.name ?? 'Accessories'] = ACCESSORY.fortune ?? 0;
199
+ SUM += ACCESSORY.fortune ?? 0;
200
+ }
201
+ // Exportable Crops
202
+ if (this.options.exportableCrops?.[crop]) {
203
+ const EXPORTABLE = this.options.exportableCrops[crop];
204
+ if (EXPORTABLE) {
205
+ BREAKDOWN['Exportable Crop'] = CROPS_1.EXPORTABLE_CROP_FORTUNE;
206
+ SUM += CROPS_1.EXPORTABLE_CROP_FORTUNE;
207
+ }
208
+ }
209
+ // Extra Fortune
210
+ for (const EXTRA of this.options.extraFortune ?? []) {
211
+ if (EXTRA.crop !== crop) continue;
212
+ BREAKDOWN[EXTRA.name ?? 'Extra Fortune'] = EXTRA.fortune;
213
+ SUM += EXTRA.fortune;
214
+ }
215
+ return {
216
+ fortune: SUM,
217
+ breakdown: BREAKDOWN,
218
+ };
219
+ }
233
220
  }
234
221
  exports.FarmingPlayer = FarmingPlayer;
235
- //# sourceMappingURL=player.js.map
222
+ //# sourceMappingURL=player.js.map
@@ -1,59 +1,63 @@
1
1
  import { Crop } from '../constants/crops';
2
2
  export declare function createFarmingWeightCalculator(info?: FarmingWeightInfo): FarmingWeight;
3
3
  export interface FarmingWeightInfo {
4
- collection?: Record<string, number>;
5
- farmingXp?: number;
6
- levelCapUpgrade?: number;
7
- anitaBonusFarmingFortuneLevel?: number;
8
- minions?: string[];
9
- contests?: {
10
- collected: number;
11
- claimed_position?: number;
12
- claimed_participants?: number;
13
- claimed_medal?: 'bronze' | 'silver' | 'gold' | 'platinum' | 'diamond' | string;
14
- }[];
15
- pests?: Record<string, number>;
4
+ collection?: Record<string, number>;
5
+ farmingXp?: number;
6
+ levelCapUpgrade?: number;
7
+ anitaBonusFarmingFortuneLevel?: number;
8
+ minions?: string[];
9
+ contests?: {
10
+ collected: number;
11
+ claimed_position?: number;
12
+ claimed_participants?: number;
13
+ claimed_medal?: 'bronze' | 'silver' | 'gold' | 'platinum' | 'diamond' | string;
14
+ }[];
15
+ pests?: Record<string, number>;
16
16
  }
17
17
  declare class FarmingWeight {
18
- collection: Record<Crop, number>;
19
- levelCapUpgrade: number;
20
- farmingXp: number;
21
- anitaBonusFarmingFortuneLevel: number;
22
- tier12MinionCount: number;
23
- earnedMedals: Record<'diamond' | 'platinum' | 'gold', number>;
24
- cropWeights: Record<Crop, number>;
25
- bonusSources: Record<string, number>;
26
- uncountedCrops: Partial<Record<Crop, number>>;
27
- readonly info?: FarmingWeightInfo;
28
- constructor(info?: FarmingWeightInfo);
29
- /**
30
- * Expectes a dictionary of collections and amounts with the default Hypixel SkyBlock IDs
31
- * @param {Record<string, number>} collections
32
- * @returns {FarmingWeight}
33
- */
34
- setCropsFromCollections(collections: Record<string, number>): FarmingWeight;
35
- setCrop: (crop: Crop, collection: number) => this;
36
- setLevelCap: (levelCap: number) => this;
37
- setFarmingXp: (farmingXp: number) => this;
38
- setAnitaBonusLevel: (anitaBonusFarmingFortuneLevel: number) => this;
39
- addMinions: (minions: string[]) => this;
40
- setEarnedMedals: ({ diamond, platinum, gold }: {
41
- diamond?: number | undefined;
42
- platinum?: number | undefined;
43
- gold?: number | undefined;
44
- }) => this;
45
- setTier12MinionCount: (count: number) => this;
46
- setContests: (contests: FarmingWeightInfo['contests']) => this;
47
- getWeightInfo: () => {
48
- totalWeight: number;
49
- bonusWeight: number;
50
- cropWeight: number;
51
- bonusSources: Record<string, number>;
52
- uncountedCrops: Partial<Record<Crop, number>>;
53
- };
54
- getBonusWeights: () => Record<string, number>;
55
- getCropWeights: () => Record<Crop, number>;
56
- calcUncountedCrops: (bestiary: Record<string, number>) => this;
57
- getCropWeight: (crop: Crop) => void;
18
+ collection: Record<Crop, number>;
19
+ levelCapUpgrade: number;
20
+ farmingXp: number;
21
+ anitaBonusFarmingFortuneLevel: number;
22
+ tier12MinionCount: number;
23
+ earnedMedals: Record<'diamond' | 'platinum' | 'gold', number>;
24
+ cropWeights: Record<Crop, number>;
25
+ bonusSources: Record<string, number>;
26
+ uncountedCrops: Partial<Record<Crop, number>>;
27
+ readonly info?: FarmingWeightInfo;
28
+ constructor(info?: FarmingWeightInfo);
29
+ /**
30
+ * Expectes a dictionary of collections and amounts with the default Hypixel SkyBlock IDs
31
+ * @param {Record<string, number>} collections
32
+ * @returns {FarmingWeight}
33
+ */
34
+ setCropsFromCollections(collections: Record<string, number>): FarmingWeight;
35
+ setCrop: (crop: Crop, collection: number) => this;
36
+ setLevelCap: (levelCap: number) => this;
37
+ setFarmingXp: (farmingXp: number) => this;
38
+ setAnitaBonusLevel: (anitaBonusFarmingFortuneLevel: number) => this;
39
+ addMinions: (minions: string[]) => this;
40
+ setEarnedMedals: ({
41
+ diamond,
42
+ platinum,
43
+ gold,
44
+ }: {
45
+ diamond?: number | undefined;
46
+ platinum?: number | undefined;
47
+ gold?: number | undefined;
48
+ }) => this;
49
+ setTier12MinionCount: (count: number) => this;
50
+ setContests: (contests: FarmingWeightInfo['contests']) => this;
51
+ getWeightInfo: () => {
52
+ totalWeight: number;
53
+ bonusWeight: number;
54
+ cropWeight: number;
55
+ bonusSources: Record<string, number>;
56
+ uncountedCrops: Partial<Record<Crop, number>>;
57
+ };
58
+ getBonusWeights: () => Record<string, number>;
59
+ getCropWeights: () => Record<Crop, number>;
60
+ calcUncountedCrops: (bestiary: Record<string, number>) => this;
61
+ getCropWeight: (crop: Crop) => void;
58
62
  }
59
63
  export {};