farming-weight 0.7.0 → 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 (142) 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/personalbests.d.ts +1 -1
  36. package/dist/constants/personalbests.js +11 -11
  37. package/dist/constants/personalbests.js.map +1 -1
  38. package/dist/constants/pests.d.ts +1 -1
  39. package/dist/constants/pests.js +77 -84
  40. package/dist/constants/pests.js.map +1 -1
  41. package/dist/constants/pets.d.ts +38 -38
  42. package/dist/constants/pets.js +253 -253
  43. package/dist/constants/reforges.d.ts +1 -1
  44. package/dist/constants/reforges.js +1 -1
  45. package/dist/constants/reforges.js.map +1 -1
  46. package/dist/constants/specific.d.ts +1 -1
  47. package/dist/constants/specific.js +6 -6
  48. package/dist/constants/stats.d.ts +1 -1
  49. package/dist/constants/tempfortune.js +14 -14
  50. package/dist/constants/tempfortune.js.map +1 -1
  51. package/dist/constants/tools.d.ts +7 -7
  52. package/dist/constants/tools.js +456 -456
  53. package/dist/constants/upgrades.d.ts +6 -6
  54. package/dist/constants/weight.js +9 -9
  55. package/dist/constants/weight.js.map +1 -1
  56. package/dist/crops/special.js +1 -1
  57. package/dist/crops/special.js.map +1 -1
  58. package/dist/fortune/farmingaccessory.d.ts +1 -1
  59. package/dist/fortune/farmingaccessory.js +1 -1
  60. package/dist/fortune/farmingaccessory.js.map +1 -1
  61. package/dist/fortune/farmingarmor.d.ts +4 -3
  62. package/dist/fortune/farmingarmor.js +28 -17
  63. package/dist/fortune/farmingarmor.js.map +1 -1
  64. package/dist/fortune/farmingequipment.d.ts +3 -3
  65. package/dist/fortune/farmingequipment.js +5 -5
  66. package/dist/fortune/farmingequipment.js.map +1 -1
  67. package/dist/fortune/farmingpet.d.ts +3 -3
  68. package/dist/fortune/farmingpet.js +2 -2
  69. package/dist/fortune/farmingpet.js.map +1 -1
  70. package/dist/fortune/farmingtool.d.ts +2 -2
  71. package/dist/fortune/farmingtool.js +4 -4
  72. package/dist/fortune/farmingtool.js.map +1 -1
  73. package/dist/fortune/upgradable.d.ts +35 -33
  74. package/dist/fortune/upgradable.js +1 -1
  75. package/dist/fortune/upgradeable.d.ts +6 -6
  76. package/dist/fortune/upgradeable.js +3 -3
  77. package/dist/fortune/upgradeable.js.map +1 -1
  78. package/dist/items/accessories.d.ts +1 -1
  79. package/dist/items/accessories.js +3 -3
  80. package/dist/items/accessories.js.map +1 -1
  81. package/dist/items/armor.d.ts +2 -2
  82. package/dist/items/armor.js +2 -2
  83. package/dist/items/armor.js.map +1 -1
  84. package/dist/items/equipment.js +8 -8
  85. package/dist/items/equipment.js.map +1 -1
  86. package/dist/items/pets.d.ts +2 -2
  87. package/dist/items/pets.js +15 -15
  88. package/dist/items/pets.js.map +1 -1
  89. package/dist/items/tools.d.ts +1 -1
  90. package/dist/items/tools.js +15 -15
  91. package/dist/items/tools.js.map +1 -1
  92. package/dist/player/index.js +1 -1
  93. package/dist/player/player.d.ts +1 -1
  94. package/dist/player/player.js +9 -9
  95. package/dist/player/player.js.map +1 -1
  96. package/dist/player/playeroptions.d.ts +10 -10
  97. package/dist/player.d.ts +21 -21
  98. package/dist/player.js +26 -26
  99. package/dist/ratecalc.d.ts +16 -14
  100. package/dist/ratecalc.js +148 -145
  101. package/dist/tool.js +3 -3
  102. package/dist/upgrades/progress.d.ts +2 -2
  103. package/dist/upgrades/progress.js +3 -3
  104. package/dist/upgrades/progress.js.map +1 -1
  105. package/dist/upgrades/sources/accessorysources.d.ts +2 -2
  106. package/dist/upgrades/sources/accessorysources.js +10 -8
  107. package/dist/upgrades/sources/accessorysources.js.map +1 -1
  108. package/dist/upgrades/sources/armorsetsources.d.ts +2 -2
  109. package/dist/upgrades/sources/armorsetsources.js +12 -11
  110. package/dist/upgrades/sources/armorsetsources.js.map +1 -1
  111. package/dist/upgrades/sources/cropsources.d.ts +3 -3
  112. package/dist/upgrades/sources/cropsources.js +22 -22
  113. package/dist/upgrades/sources/cropsources.js.map +1 -1
  114. package/dist/upgrades/sources/gearsources.d.ts +3 -3
  115. package/dist/upgrades/sources/gearsources.js +18 -19
  116. package/dist/upgrades/sources/gearsources.js.map +1 -1
  117. package/dist/upgrades/sources/generalsources.d.ts +2 -2
  118. package/dist/upgrades/sources/generalsources.js +18 -16
  119. package/dist/upgrades/sources/generalsources.js.map +1 -1
  120. package/dist/upgrades/sources/toolsources.d.ts +5 -5
  121. package/dist/upgrades/sources/toolsources.js +24 -23
  122. package/dist/upgrades/sources/toolsources.js.map +1 -1
  123. package/dist/upgrades/upgrades.d.ts +4 -4
  124. package/dist/upgrades/upgrades.js +19 -19
  125. package/dist/upgrades/upgrades.js.map +1 -1
  126. package/dist/util/enchants.d.ts +3 -3
  127. package/dist/util/enchants.js +1 -1
  128. package/dist/util/enchants.js.map +1 -1
  129. package/dist/util/garden.d.ts +2 -2
  130. package/dist/util/garden.js +6 -7
  131. package/dist/util/garden.js.map +1 -1
  132. package/dist/util/gems.d.ts +2 -2
  133. package/dist/util/gems.js +24 -14
  134. package/dist/util/gems.js.map +1 -1
  135. package/dist/util/pests.js +1 -1
  136. package/dist/util/pests.js.map +1 -1
  137. package/dist/util/pests.test.js +27 -25
  138. package/dist/util/ratecalc.js +2 -2
  139. package/dist/util/ratecalc.js.map +1 -1
  140. package/dist/util/skyblocktime.js +1 -1
  141. package/dist/util/skyblocktime.js.map +1 -1
  142. package/package.json +36 -48
@@ -1,197 +1,192 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.createFarmingWeightCalculator = void 0;
4
- const crops_1 = require("../constants/crops");
5
- const weight_1 = require("../constants/weight");
6
- const jacob_1 = require("../util/jacob");
7
- const pests_1 = require("../util/pests");
4
+ const CROPS_1 = require('../constants/crops');
5
+ const WEIGHT_1 = require('../constants/weight');
6
+ const JACOB_1 = require('../util/jacob');
7
+ const PESTS_1 = require('../util/pests');
8
8
  function createFarmingWeightCalculator(info) {
9
- return new FarmingWeight(info);
9
+ return new FarmingWeight(info);
10
10
  }
11
11
  exports.createFarmingWeightCalculator = createFarmingWeightCalculator;
12
- const crops = [
13
- crops_1.Crop.Cactus,
14
- crops_1.Crop.Carrot,
15
- crops_1.Crop.CocoaBeans,
16
- crops_1.Crop.Melon,
17
- crops_1.Crop.Mushroom,
18
- crops_1.Crop.NetherWart,
19
- crops_1.Crop.Potato,
20
- crops_1.Crop.Pumpkin,
21
- crops_1.Crop.SugarCane,
22
- crops_1.Crop.Wheat,
12
+ const CROPS = [
13
+ CROPS_1.Crop.Cactus,
14
+ CROPS_1.Crop.Carrot,
15
+ CROPS_1.Crop.CocoaBeans,
16
+ CROPS_1.Crop.Melon,
17
+ CROPS_1.Crop.Mushroom,
18
+ CROPS_1.Crop.NetherWart,
19
+ CROPS_1.Crop.Potato,
20
+ CROPS_1.Crop.Pumpkin,
21
+ CROPS_1.Crop.SugarCane,
22
+ CROPS_1.Crop.Wheat,
23
23
  ];
24
24
  class FarmingWeight {
25
- info;
26
- constructor(info) {
27
- this.info = info;
28
- this.collection = {};
29
- this.levelCapUpgrade = info?.levelCapUpgrade ?? 0;
30
- this.anitaBonusFarmingFortuneLevel = info?.anitaBonusFarmingFortuneLevel ?? 0;
31
- this.farmingXp = info?.farmingXp ?? 0;
32
- this.earnedMedals = { diamond: 0, platinum: 0, gold: 0 };
33
- this.tier12MinionCount = 0;
34
- this.bonusSources = {};
35
- this.uncountedCrops = {};
36
- this.setContests(info?.contests ?? []);
37
- this.calcUncountedCrops(info?.pests ?? {});
38
- this.setCropsFromCollections(info?.collection ?? {});
39
- this.addMinions(info?.minions ?? []);
40
- }
41
- /**
42
- * Expectes a dictionary of collections and amounts with the default Hypixel SkyBlock IDs
43
- * @param {Record<string, number>} collections
44
- * @returns {FarmingWeight}
45
- */
46
- setCropsFromCollections(collections) {
47
- for (const crop of crops) {
48
- this.collection[crop] = collections[crop] ?? 0;
49
- }
50
- this.getCropWeights();
51
- return this;
52
- }
53
- setCrop = (crop, collection) => {
54
- this.collection[crop] = collection;
55
- this.getCropWeights();
56
- return this;
57
- };
58
- setLevelCap = (levelCap) => {
59
- this.levelCapUpgrade = levelCap;
60
- return this;
61
- };
62
- setFarmingXp = (farmingXp) => {
63
- this.farmingXp = farmingXp;
64
- return this;
65
- };
66
- setAnitaBonusLevel = (anitaBonusFarmingFortuneLevel) => {
67
- this.anitaBonusFarmingFortuneLevel = anitaBonusFarmingFortuneLevel;
68
- return this;
69
- };
70
- addMinions = (minions) => {
71
- for (const minion of minions) {
72
- if (!minion.endsWith('_12'))
73
- continue;
74
- if (!weight_1.TIER_12_MINIONS.includes(minion))
75
- continue;
76
- this.tier12MinionCount++;
77
- }
78
- return this;
79
- };
80
- setEarnedMedals = ({ diamond, platinum, gold }) => {
81
- this.earnedMedals = {
82
- diamond: diamond ?? this.earnedMedals.diamond,
83
- platinum: platinum ?? this.earnedMedals.platinum,
84
- gold: gold ?? this.earnedMedals.gold,
85
- };
86
- return this;
87
- };
88
- setTier12MinionCount = (count) => {
89
- this.tier12MinionCount = count;
90
- return this;
91
- };
92
- setContests = (contests) => {
93
- if (!contests?.length)
94
- return this;
95
- for (const contest of contests) {
96
- const medal = (0, jacob_1.calculateJacobContestMedal)(contest);
97
- if (!medal)
98
- continue;
99
- if (medal === 'diamond') {
100
- this.earnedMedals.diamond++;
101
- }
102
- else if (medal === 'platinum') {
103
- this.earnedMedals.platinum++;
104
- }
105
- else if (medal === 'gold') {
106
- this.earnedMedals.gold++;
107
- }
108
- }
109
- this.getBonusWeights();
110
- return this;
111
- };
112
- getWeightInfo = () => {
113
- const bonus = this.getBonusWeights();
114
- const crops = this.getCropWeights();
115
- const bonusTotal = Object.values(bonus).reduce((a, b) => a + b, 0);
116
- const cropTotal = Object.values(crops).reduce((a, b) => a + b, 0);
117
- return {
118
- totalWeight: bonusTotal + cropTotal,
119
- bonusWeight: bonusTotal,
120
- cropWeight: cropTotal,
121
- bonusSources: bonus,
122
- uncountedCrops: this.uncountedCrops,
123
- };
124
- };
125
- getBonusWeights = () => {
126
- this.bonusSources = {};
127
- if (this.farmingXp >= 111_672_425 && this.levelCapUpgrade >= 10) {
128
- // Farming 60 bonus
129
- this.bonusSources['Farming 60'] = weight_1.BONUS_WEIGHT.Farming60Bonus;
130
- }
131
- else if (this.farmingXp >= 55_172_425) {
132
- // Farming 50 bonus
133
- this.bonusSources['Farming 50'] = weight_1.BONUS_WEIGHT.Farming50Bonus;
134
- }
135
- // Tier 12 minion bonus
136
- if (this.tier12MinionCount > 0) {
137
- this.bonusSources['Tier 12 Minions'] = this.tier12MinionCount * weight_1.BONUS_WEIGHT.MinionRewardWeight;
138
- }
139
- // Anita bonus
140
- if (this.anitaBonusFarmingFortuneLevel > 0) {
141
- this.bonusSources['Anita Bonus'] =
142
- this.anitaBonusFarmingFortuneLevel * weight_1.BONUS_WEIGHT.AnitaBuffBonusMultiplier;
143
- }
144
- const maxMedals = weight_1.BONUS_WEIGHT.MaxMedalsCounted;
145
- if (this.earnedMedals.diamond >= maxMedals) {
146
- this.bonusSources['Contest Medals'] = weight_1.BONUS_WEIGHT.WeightPerDiamondMedal * weight_1.BONUS_WEIGHT.MaxMedalsCounted;
147
- }
148
- else {
149
- const diamond = this.earnedMedals.diamond;
150
- const platinum = Math.min(maxMedals - diamond, this.earnedMedals.platinum);
151
- const gold = Math.min(maxMedals - diamond - platinum, this.earnedMedals.gold);
152
- const medals = diamond * weight_1.BONUS_WEIGHT.WeightPerDiamondMedal +
153
- platinum * weight_1.BONUS_WEIGHT.WeightPerPlatinumMedal +
154
- gold * weight_1.BONUS_WEIGHT.WeightPerGoldMedal;
155
- this.bonusSources['Contest Medals'] = medals;
156
- }
157
- return this.bonusSources;
158
- };
159
- getCropWeights = () => {
160
- const cropWeight = {};
161
- let totalWeight = 0;
162
- let doubleBreakWeight = 0;
163
- for (const crop of crops) {
164
- let collected = this.collection[crop] ?? 0;
165
- // Subtract uncounted crops
166
- if (this.uncountedCrops[crop]) {
167
- collected = Math.max(0, collected - (this.uncountedCrops[crop] ?? 0));
168
- }
169
- const weight = collected / weight_1.CROP_WEIGHT[crop];
170
- totalWeight += weight;
171
- if (crop === crops_1.Crop.Cactus || crop === crops_1.Crop.SugarCane) {
172
- doubleBreakWeight += weight;
173
- }
174
- cropWeight[crop] = weight;
175
- }
176
- // Mushroom is a special case, it needs to be calculated dynamically based on the
177
- // ratio between the farmed crops that give two mushrooms per break with cow pet
178
- // and the farmed crops that give one mushroom per break with cow pet
179
- const mushroomCollection = this.collection[crops_1.Crop.Mushroom] ?? 0;
180
- const mushroomWeightNumber = weight_1.CROP_WEIGHT[crops_1.Crop.Mushroom];
181
- const doubleBreakRatio = doubleBreakWeight / totalWeight;
182
- const normalCropRatio = (totalWeight - doubleBreakWeight) / totalWeight;
183
- const mushroomWeight = doubleBreakRatio * (mushroomCollection / (mushroomWeightNumber * 2)) +
184
- normalCropRatio * (mushroomCollection / mushroomWeightNumber);
185
- cropWeight[crops_1.Crop.Mushroom] = mushroomWeight;
186
- return cropWeight;
187
- };
188
- calcUncountedCrops = (bestiary) => {
189
- this.uncountedCrops = (0, pests_1.uncountedCropsFromPests)(bestiary);
190
- this.getCropWeights();
191
- return this;
192
- };
193
- getCropWeight = (crop) => {
194
- weight_1.CROP_WEIGHT[crop];
195
- };
25
+ info;
26
+ constructor(info) {
27
+ this.info = info;
28
+ this.collection = {};
29
+ this.levelCapUpgrade = info?.levelCapUpgrade ?? 0;
30
+ this.anitaBonusFarmingFortuneLevel = info?.anitaBonusFarmingFortuneLevel ?? 0;
31
+ this.farmingXp = info?.farmingXp ?? 0;
32
+ this.earnedMedals = { diamond: 0, platinum: 0, gold: 0 };
33
+ this.tier12MinionCount = 0;
34
+ this.bonusSources = {};
35
+ this.uncountedCrops = {};
36
+ this.setContests(info?.contests ?? []);
37
+ this.calcUncountedCrops(info?.pests ?? {});
38
+ this.setCropsFromCollections(info?.collection ?? {});
39
+ this.addMinions(info?.minions ?? []);
40
+ }
41
+ /**
42
+ * Expectes a dictionary of collections and amounts with the default Hypixel SkyBlock IDs
43
+ * @param {Record<string, number>} collections
44
+ * @returns {FarmingWeight}
45
+ */
46
+ setCropsFromCollections(collections) {
47
+ for (const CROP of CROPS) {
48
+ this.collection[CROP] = collections[CROP] ?? 0;
49
+ }
50
+ this.getCropWeights();
51
+ return this;
52
+ }
53
+ setCrop = (crop, collection) => {
54
+ this.collection[crop] = collection;
55
+ this.getCropWeights();
56
+ return this;
57
+ };
58
+ setLevelCap = (levelCap) => {
59
+ this.levelCapUpgrade = levelCap;
60
+ return this;
61
+ };
62
+ setFarmingXp = (farmingXp) => {
63
+ this.farmingXp = farmingXp;
64
+ return this;
65
+ };
66
+ setAnitaBonusLevel = (anitaBonusFarmingFortuneLevel) => {
67
+ this.anitaBonusFarmingFortuneLevel = anitaBonusFarmingFortuneLevel;
68
+ return this;
69
+ };
70
+ addMinions = (minions) => {
71
+ for (const MINION of minions) {
72
+ if (!MINION.endsWith('_12')) continue;
73
+ if (!WEIGHT_1.TIER_12_MINIONS.includes(MINION)) continue;
74
+ this.tier12MinionCount++;
75
+ }
76
+ return this;
77
+ };
78
+ setEarnedMedals = ({ diamond, platinum, gold }) => {
79
+ this.earnedMedals = {
80
+ diamond: diamond ?? this.earnedMedals.diamond,
81
+ platinum: platinum ?? this.earnedMedals.platinum,
82
+ gold: gold ?? this.earnedMedals.gold,
83
+ };
84
+ return this;
85
+ };
86
+ setTier12MinionCount = (count) => {
87
+ this.tier12MinionCount = count;
88
+ return this;
89
+ };
90
+ setContests = (contests) => {
91
+ if (!contests?.length) return this;
92
+ for (const CONTEST of contests) {
93
+ const MEDAL = (0, JACOB_1.calculateJacobContestMedal)(CONTEST);
94
+ if (!MEDAL) continue;
95
+ if (MEDAL === 'diamond') {
96
+ this.earnedMedals.diamond++;
97
+ } else if (MEDAL === 'platinum') {
98
+ this.earnedMedals.platinum++;
99
+ } else if (MEDAL === 'gold') {
100
+ this.earnedMedals.gold++;
101
+ }
102
+ }
103
+ this.getBonusWeights();
104
+ return this;
105
+ };
106
+ getWeightInfo = () => {
107
+ const BONUS = this.getBonusWeights();
108
+ const crops = this.getCropWeights();
109
+ const BONUS_TOTAL = Object.values(BONUS).reduce((a, b) => a + b, 0);
110
+ const CROP_TOTAL = Object.values(crops).reduce((a, b) => a + b, 0);
111
+ return {
112
+ totalWeight: BONUS_TOTAL + CROP_TOTAL,
113
+ bonusWeight: BONUS_TOTAL,
114
+ cropWeight: CROP_TOTAL,
115
+ bonusSources: BONUS,
116
+ uncountedCrops: this.uncountedCrops,
117
+ };
118
+ };
119
+ getBonusWeights = () => {
120
+ this.bonusSources = {};
121
+ if (this.farmingXp >= 111_672_425 && this.levelCapUpgrade >= 10) {
122
+ // Farming 60 bonus
123
+ this.bonusSources['Farming 60'] = WEIGHT_1.BONUS_WEIGHT.Farming60Bonus;
124
+ } else if (this.farmingXp >= 55_172_425) {
125
+ // Farming 50 bonus
126
+ this.bonusSources['Farming 50'] = WEIGHT_1.BONUS_WEIGHT.Farming50Bonus;
127
+ }
128
+ // Tier 12 minion bonus
129
+ if (this.tier12MinionCount > 0) {
130
+ this.bonusSources['Tier 12 Minions'] = this.tier12MinionCount * WEIGHT_1.BONUS_WEIGHT.MinionRewardWeight;
131
+ }
132
+ // Anita bonus
133
+ if (this.anitaBonusFarmingFortuneLevel > 0) {
134
+ this.bonusSources['Anita Bonus'] =
135
+ this.anitaBonusFarmingFortuneLevel * WEIGHT_1.BONUS_WEIGHT.AnitaBuffBonusMultiplier;
136
+ }
137
+ const MAX_MEDALS = WEIGHT_1.BONUS_WEIGHT.MaxMedalsCounted;
138
+ if (this.earnedMedals.diamond >= MAX_MEDALS) {
139
+ this.bonusSources['Contest Medals'] =
140
+ WEIGHT_1.BONUS_WEIGHT.WeightPerDiamondMedal * WEIGHT_1.BONUS_WEIGHT.MaxMedalsCounted;
141
+ } else {
142
+ const DIAMOND = this.earnedMedals.diamond;
143
+ const PLATINUM = Math.min(MAX_MEDALS - DIAMOND, this.earnedMedals.platinum);
144
+ const GOLD = Math.min(MAX_MEDALS - DIAMOND - PLATINUM, this.earnedMedals.gold);
145
+ const MEDALS =
146
+ DIAMOND * WEIGHT_1.BONUS_WEIGHT.WeightPerDiamondMedal +
147
+ PLATINUM * WEIGHT_1.BONUS_WEIGHT.WeightPerPlatinumMedal +
148
+ GOLD * WEIGHT_1.BONUS_WEIGHT.WeightPerGoldMedal;
149
+ this.bonusSources['Contest Medals'] = MEDALS;
150
+ }
151
+ return this.bonusSources;
152
+ };
153
+ getCropWeights = () => {
154
+ const CROP_WEIGHT = {};
155
+ let TOTAL_WEIGHT = 0;
156
+ let DOUBLE_BREAK_WEIGHT = 0;
157
+ for (const CROP of CROPS) {
158
+ let COLLECTED = this.collection[CROP] ?? 0;
159
+ // Subtract uncounted crops
160
+ if (this.uncountedCrops[CROP]) {
161
+ COLLECTED = Math.max(0, COLLECTED - (this.uncountedCrops[CROP] ?? 0));
162
+ }
163
+ const WEIGHT = COLLECTED / WEIGHT_1.CROP_WEIGHT[CROP];
164
+ TOTAL_WEIGHT += WEIGHT;
165
+ if (CROP === CROPS_1.Crop.Cactus || CROP === CROPS_1.Crop.SugarCane) {
166
+ DOUBLE_BREAK_WEIGHT += WEIGHT;
167
+ }
168
+ CROP_WEIGHT[CROP] = WEIGHT;
169
+ }
170
+ // Mushroom is a special case, it needs to be calculated dynamically based on the
171
+ // ratio between the farmed crops that give two mushrooms per break with cow pet
172
+ // and the farmed crops that give one mushroom per break with cow pet
173
+ const MUSHROOM_COLLECTION = this.collection[CROPS_1.Crop.Mushroom] ?? 0;
174
+ const MUSHROOM_WEIGHT_NUMBER = WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Mushroom];
175
+ const DOUBLE_BREAK_RATIO = DOUBLE_BREAK_WEIGHT / TOTAL_WEIGHT;
176
+ const NORMAL_CROP_RATIO = (TOTAL_WEIGHT - DOUBLE_BREAK_WEIGHT) / TOTAL_WEIGHT;
177
+ const MUSHROOM_WEIGHT =
178
+ DOUBLE_BREAK_RATIO * (MUSHROOM_COLLECTION / (MUSHROOM_WEIGHT_NUMBER * 2)) +
179
+ NORMAL_CROP_RATIO * (MUSHROOM_COLLECTION / MUSHROOM_WEIGHT_NUMBER);
180
+ CROP_WEIGHT[CROPS_1.Crop.Mushroom] = MUSHROOM_WEIGHT;
181
+ return CROP_WEIGHT;
182
+ };
183
+ calcUncountedCrops = (bestiary) => {
184
+ this.uncountedCrops = (0, PESTS_1.uncountedCropsFromPests)(bestiary);
185
+ this.getCropWeights();
186
+ return this;
187
+ };
188
+ getCropWeight = (crop) => {
189
+ WEIGHT_1.CROP_WEIGHT[crop];
190
+ };
196
191
  }
197
- //# sourceMappingURL=weightcalc.js.map
192
+ //# sourceMappingURL=weightcalc.js.map
@@ -1,108 +1,108 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const weightcalc_1 = require("./weightcalc");
5
- const crops_1 = require("../constants/crops");
6
- const weight_1 = require("../constants/weight");
7
- const pests_1 = require("../util/pests");
8
- const crops = {
9
- [crops_1.Crop.Cactus]: weight_1.CROP_WEIGHT[crops_1.Crop.Cactus] * 50,
10
- [crops_1.Crop.Carrot]: weight_1.CROP_WEIGHT[crops_1.Crop.Carrot] * 10,
11
- [crops_1.Crop.CocoaBeans]: weight_1.CROP_WEIGHT[crops_1.Crop.CocoaBeans] * 10,
12
- [crops_1.Crop.Melon]: weight_1.CROP_WEIGHT[crops_1.Crop.Melon] * 10,
13
- [crops_1.Crop.NetherWart]: weight_1.CROP_WEIGHT[crops_1.Crop.NetherWart] * 10,
14
- [crops_1.Crop.Potato]: weight_1.CROP_WEIGHT[crops_1.Crop.Potato] * 10,
15
- [crops_1.Crop.Pumpkin]: weight_1.CROP_WEIGHT[crops_1.Crop.Pumpkin] * 10,
16
- [crops_1.Crop.SugarCane]: weight_1.CROP_WEIGHT[crops_1.Crop.SugarCane] * 50,
17
- [crops_1.Crop.Wheat]: weight_1.CROP_WEIGHT[crops_1.Crop.Wheat] * 10,
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ const VITEST_1 = require('vitest');
4
+ const WEIGHTCALC_1 = require('./weightcalc');
5
+ const CROPS_1 = require('../constants/crops');
6
+ const WEIGHT_1 = require('../constants/weight');
7
+ const PESTS_1 = require('../util/pests');
8
+ const CROPS = {
9
+ [CROPS_1.Crop.Cactus]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Cactus] * 50,
10
+ [CROPS_1.Crop.Carrot]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Carrot] * 10,
11
+ [CROPS_1.Crop.CocoaBeans]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.CocoaBeans] * 10,
12
+ [CROPS_1.Crop.Melon]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Melon] * 10,
13
+ [CROPS_1.Crop.NetherWart]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.NetherWart] * 10,
14
+ [CROPS_1.Crop.Potato]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Potato] * 10,
15
+ [CROPS_1.Crop.Pumpkin]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Pumpkin] * 10,
16
+ [CROPS_1.Crop.SugarCane]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.SugarCane] * 50,
17
+ [CROPS_1.Crop.Wheat]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Wheat] * 10,
18
18
  };
19
- const pests = {
20
- pest_fly_1: 150,
21
- pest_beetle_1: 86,
19
+ const PESTS = {
20
+ pest_fly_1: 150,
21
+ pest_beetle_1: 86,
22
22
  };
23
- (0, vitest_1.test)('Basic weight calculation', () => {
24
- const weight = (0, weightcalc_1.createFarmingWeightCalculator)({
25
- collection: crops,
26
- });
27
- (0, vitest_1.expect)(weight.getWeightInfo().totalWeight).toBeCloseTo(170);
23
+ (0, VITEST_1.test)('Basic weight calculation', () => {
24
+ const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
25
+ collection: CROPS,
26
+ });
27
+ (0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(170);
28
28
  });
29
- (0, vitest_1.test)('Mushroom weight calculation', () => {
30
- const weight = (0, weightcalc_1.createFarmingWeightCalculator)({
31
- collection: {
32
- ...crops,
33
- [crops_1.Crop.Mushroom]: weight_1.CROP_WEIGHT[crops_1.Crop.Mushroom] * 13.74,
34
- },
35
- });
36
- (0, vitest_1.expect)(weight.getWeightInfo().totalWeight).toBeCloseTo(180);
29
+ (0, VITEST_1.test)('Mushroom weight calculation', () => {
30
+ const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
31
+ collection: {
32
+ ...CROPS,
33
+ [CROPS_1.Crop.Mushroom]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Mushroom] * 13.74,
34
+ },
35
+ });
36
+ (0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(180);
37
37
  });
38
- (0, vitest_1.test)('Pest debuff weight calculation', () => {
39
- const weight = (0, weightcalc_1.createFarmingWeightCalculator)({
40
- collection: crops,
41
- pests: pests,
42
- });
43
- const uncounted = (0, pests_1.uncountedCropsFromPests)(pests);
44
- const uncountedWheat = uncounted[crops_1.Crop.Wheat] ?? 0;
45
- const uncountedWart = uncounted[crops_1.Crop.NetherWart] ?? 0;
46
- (0, vitest_1.expect)(weight.getWeightInfo().uncountedCrops[crops_1.Crop.Wheat]).toBeCloseTo(uncountedWheat);
47
- (0, vitest_1.expect)(weight.getWeightInfo().uncountedCrops[crops_1.Crop.NetherWart]).toBeCloseTo(uncountedWart);
48
- const weightExpected = (0, weightcalc_1.createFarmingWeightCalculator)({
49
- collection: {
50
- ...crops,
51
- [crops_1.Crop.Wheat]: crops[crops_1.Crop.Wheat] - uncountedWheat,
52
- [crops_1.Crop.NetherWart]: crops[crops_1.Crop.NetherWart] - uncountedWart,
53
- },
54
- });
55
- (0, vitest_1.expect)(weight.getWeightInfo().cropWeight).toBeCloseTo(weightExpected.getWeightInfo().cropWeight);
38
+ (0, VITEST_1.test)('Pest debuff weight calculation', () => {
39
+ const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
40
+ collection: CROPS,
41
+ pests: PESTS,
42
+ });
43
+ const UNCOUNTED = (0, PESTS_1.uncountedCropsFromPests)(PESTS);
44
+ const UNCOUNTED_WHEAT = UNCOUNTED[CROPS_1.Crop.Wheat] ?? 0;
45
+ const UNCOUNTED_WART = UNCOUNTED[CROPS_1.Crop.NetherWart] ?? 0;
46
+ (0, VITEST_1.expect)(WEIGHT.getWeightInfo().uncountedCrops[CROPS_1.Crop.Wheat]).toBeCloseTo(UNCOUNTED_WHEAT);
47
+ (0, VITEST_1.expect)(WEIGHT.getWeightInfo().uncountedCrops[CROPS_1.Crop.NetherWart]).toBeCloseTo(UNCOUNTED_WART);
48
+ const WEIGHT_EXPECTED = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
49
+ collection: {
50
+ ...CROPS,
51
+ [CROPS_1.Crop.Wheat]: CROPS[CROPS_1.Crop.Wheat] - UNCOUNTED_WHEAT,
52
+ [CROPS_1.Crop.NetherWart]: CROPS[CROPS_1.Crop.NetherWart] - UNCOUNTED_WART,
53
+ },
54
+ });
55
+ (0, VITEST_1.expect)(WEIGHT.getWeightInfo().cropWeight).toBeCloseTo(WEIGHT_EXPECTED.getWeightInfo().cropWeight);
56
56
  });
57
- (0, vitest_1.test)('Full weight calculation', () => {
58
- const crops = {
59
- [crops_1.Crop.Cactus]: 1219395,
60
- [crops_1.Crop.Carrot]: 14238991,
61
- [crops_1.Crop.CocoaBeans]: 901826,
62
- [crops_1.Crop.Melon]: 5041491,
63
- [crops_1.Crop.Mushroom]: 9063168,
64
- [crops_1.Crop.NetherWart]: 897212645,
65
- [crops_1.Crop.Potato]: 171017100,
66
- [crops_1.Crop.Pumpkin]: 1496477,
67
- [crops_1.Crop.SugarCane]: 15509429,
68
- [crops_1.Crop.Wheat]: 21996256,
69
- };
70
- const pests = {
71
- pest_fly_1: 222,
72
- pest_rat_1: 40,
73
- pest_mite_1: 43,
74
- pest_moth_1: 40,
75
- pest_slug_1: 34,
76
- pest_worm_1: 32,
77
- pest_beetle_1: 265,
78
- pest_locust_1: 41,
79
- pest_cricket_1: 36,
80
- pest_mosquito_1: 41,
81
- };
82
- const minions = [
83
- 'WHEAT_11',
84
- 'CARROT_11',
85
- 'POTATO_12',
86
- 'PUMPKIN_12',
87
- 'MELON_12',
88
- 'MUSHROOM_12',
89
- 'COCOA_11',
90
- 'CACTUS_11',
91
- 'SUGAR_CANE_12',
92
- 'NETHER_WARTS_12',
93
- ];
94
- const weight = (0, weightcalc_1.createFarmingWeightCalculator)({
95
- collection: crops,
96
- pests: pests,
97
- farmingXp: 286958923.31966937,
98
- levelCapUpgrade: 10,
99
- anitaBonusFarmingFortuneLevel: 15,
100
- minions: minions,
101
- }).setEarnedMedals({
102
- diamond: 246,
103
- platinum: 75,
104
- gold: 99,
105
- });
106
- (0, vitest_1.expect)(weight.getWeightInfo().totalWeight).toBeCloseTo(5176.617);
57
+ (0, VITEST_1.test)('Full weight calculation', () => {
58
+ const crops = {
59
+ [CROPS_1.Crop.Cactus]: 1219395,
60
+ [CROPS_1.Crop.Carrot]: 14238991,
61
+ [CROPS_1.Crop.CocoaBeans]: 901826,
62
+ [CROPS_1.Crop.Melon]: 5041491,
63
+ [CROPS_1.Crop.Mushroom]: 9063168,
64
+ [CROPS_1.Crop.NetherWart]: 897212645,
65
+ [CROPS_1.Crop.Potato]: 171017100,
66
+ [CROPS_1.Crop.Pumpkin]: 1496477,
67
+ [CROPS_1.Crop.SugarCane]: 15509429,
68
+ [CROPS_1.Crop.Wheat]: 21996256,
69
+ };
70
+ const pests = {
71
+ pest_fly_1: 222,
72
+ pest_rat_1: 40,
73
+ pest_mite_1: 43,
74
+ pest_moth_1: 40,
75
+ pest_slug_1: 34,
76
+ pest_worm_1: 32,
77
+ pest_beetle_1: 265,
78
+ pest_locust_1: 41,
79
+ pest_cricket_1: 36,
80
+ pest_mosquito_1: 41,
81
+ };
82
+ const MINIONS = [
83
+ 'WHEAT_11',
84
+ 'CARROT_11',
85
+ 'POTATO_12',
86
+ 'PUMPKIN_12',
87
+ 'MELON_12',
88
+ 'MUSHROOM_12',
89
+ 'COCOA_11',
90
+ 'CACTUS_11',
91
+ 'SUGAR_CANE_12',
92
+ 'NETHER_WARTS_12',
93
+ ];
94
+ const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
95
+ collection: crops,
96
+ pests: pests,
97
+ farmingXp: 286958923.31966937,
98
+ levelCapUpgrade: 10,
99
+ anitaBonusFarmingFortuneLevel: 15,
100
+ minions: MINIONS,
101
+ }).setEarnedMedals({
102
+ diamond: 246,
103
+ platinum: 75,
104
+ gold: 99,
105
+ });
106
+ (0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(5176.617);
107
107
  });
108
- //# sourceMappingURL=weightcalc.test.js.map
108
+ //# sourceMappingURL=weightcalc.test.js.map
@@ -3,11 +3,11 @@ import { Crop } from './crops';
3
3
  import { Rarity } from './reforges';
4
4
  import { Skill } from './skills';
5
5
  export interface FarmingAccessoryInfo extends UpgradeableInfo {
6
- name: string;
7
- wiki: string;
8
- family?: string;
9
- maxRarity: Rarity;
10
- crops?: Crop[];
11
- skillReq?: Partial<Record<Skill, number>>;
6
+ name: string;
7
+ wiki: string;
8
+ family?: string;
9
+ maxRarity: Rarity;
10
+ crops?: Crop[];
11
+ skillReq?: Partial<Record<Skill, number>>;
12
12
  }
13
13
  export declare const FARMING_ACCESSORIES_INFO: Partial<Record<string, FarmingAccessoryInfo>>;