farming-weight 0.7.1 → 0.7.3

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 +2 -1
  71. package/dist/items/accessories.js +6 -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 +26 -20
  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 +31 -23
  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 +47 -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
@@ -2,14 +2,14 @@ import { FarmingAccessoryInfo } from '../constants/accessories';
2
2
  import { Rarity } from '../constants/reforges';
3
3
  import { EliteItemDto } from './item';
4
4
  export declare class FarmingAccessory {
5
- readonly item: EliteItemDto;
6
- readonly info: FarmingAccessoryInfo;
7
- readonly rarity: Rarity;
8
- readonly recombobulated: boolean;
9
- fortune: number;
10
- fortuneBreakdown: Record<string, number>;
11
- constructor(item: EliteItemDto);
12
- private sumFortune;
13
- static isValid(item: EliteItemDto): boolean;
14
- static fromArray(items: EliteItemDto[]): FarmingAccessory[];
5
+ readonly item: EliteItemDto;
6
+ readonly info: FarmingAccessoryInfo;
7
+ readonly rarity: Rarity;
8
+ readonly recombobulated: boolean;
9
+ fortune: number;
10
+ fortuneBreakdown: Record<string, number>;
11
+ constructor(item: EliteItemDto);
12
+ private sumFortune;
13
+ static isValid(item: EliteItemDto): boolean;
14
+ static fromArray(items: EliteItemDto[]): FarmingAccessory[];
15
15
  }
@@ -1,54 +1,54 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.FarmingAccessory = void 0;
4
- const accessories_1 = require("../constants/accessories");
5
- const reforges_1 = require("../constants/reforges");
6
- const gems_1 = require("../util/gems");
7
- const itemstats_1 = require("../util/itemstats");
4
+ const ACCESSORIES_1 = require('../constants/accessories');
5
+ const REFORGES_1 = require('../constants/reforges');
6
+ const GEMS_1 = require('../util/gems');
7
+ const ITEMSTATS_1 = require('../util/itemstats');
8
8
  class FarmingAccessory {
9
- item;
10
- info;
11
- constructor(item) {
12
- this.item = item;
13
- const info = accessories_1.FARMING_ACCESSORIES_INFO[item.skyblockId];
14
- if (!info) {
15
- throw new Error(`Unknown lotus gear: ${item.name} (${item.skyblockId})`);
16
- }
17
- this.info = info;
18
- if (item.lore) {
19
- this.rarity = (0, itemstats_1.getRarityFromLore)(item.lore);
20
- }
21
- this.recombobulated = this.item.attributes?.rarity_upgrades === '1';
22
- this.sumFortune();
23
- }
24
- sumFortune() {
25
- this.fortuneBreakdown = {};
26
- let sum = 0;
27
- // Base fortune
28
- const base = this.info.stats?.[reforges_1.Stat.FarmingFortune] ?? 0;
29
- if (base > 0) {
30
- this.fortuneBreakdown['Base Stats'] = base;
31
- sum += base;
32
- }
33
- // Gems
34
- let peridot = (0, gems_1.getPeridotFortune)(this.rarity, this.item);
35
- if (peridot > 0) {
36
- peridot = +(peridot / 2).toFixed(2); // Only half the fortune is applied on accessories
37
- this.fortuneBreakdown['Peridot Gems'] = peridot;
38
- sum += peridot;
39
- }
40
- this.fortune = sum;
41
- return sum;
42
- }
43
- static isValid(item) {
44
- return accessories_1.FARMING_ACCESSORIES_INFO[item.skyblockId] !== undefined;
45
- }
46
- static fromArray(items) {
47
- return items
48
- .filter((item) => FarmingAccessory.isValid(item))
49
- .map((item) => new FarmingAccessory(item))
50
- .sort((a, b) => b.fortune - a.fortune);
51
- }
9
+ item;
10
+ info;
11
+ constructor(item) {
12
+ this.item = item;
13
+ const INFO = ACCESSORIES_1.FARMING_ACCESSORIES_INFO[item.skyblockId];
14
+ if (!INFO) {
15
+ throw new Error(`Unknown lotus gear: ${item.name} (${item.skyblockId})`);
16
+ }
17
+ this.info = INFO;
18
+ if (item.lore) {
19
+ this.rarity = (0, ITEMSTATS_1.getRarityFromLore)(item.lore);
20
+ }
21
+ this.recombobulated = this.item.attributes?.rarity_upgrades === '1';
22
+ this.sumFortune();
23
+ }
24
+ sumFortune() {
25
+ this.fortuneBreakdown = {};
26
+ let SUM = 0;
27
+ // Base fortune
28
+ const BASE = this.info.stats?.[REFORGES_1.Stat.FarmingFortune] ?? 0;
29
+ if (BASE > 0) {
30
+ this.fortuneBreakdown['Base Stats'] = BASE;
31
+ SUM += BASE;
32
+ }
33
+ // Gems
34
+ let PERIDOT = (0, GEMS_1.getPeridotFortune)(this.rarity, this.item);
35
+ if (PERIDOT > 0) {
36
+ PERIDOT = +(PERIDOT / 2).toFixed(2); // Only half the fortune is applied on accessories
37
+ this.fortuneBreakdown['Peridot Gems'] = PERIDOT;
38
+ SUM += PERIDOT;
39
+ }
40
+ this.fortune = SUM;
41
+ return SUM;
42
+ }
43
+ static isValid(item) {
44
+ return ACCESSORIES_1.FARMING_ACCESSORIES_INFO[item.skyblockId] !== undefined;
45
+ }
46
+ static fromArray(items) {
47
+ return items
48
+ .filter((item) => FarmingAccessory.isValid(item))
49
+ .map((item) => new FarmingAccessory(item))
50
+ .sort((a, b) => b.fortune - a.fortune);
51
+ }
52
52
  }
53
53
  exports.FarmingAccessory = FarmingAccessory;
54
- //# sourceMappingURL=farmingaccessory.js.map
54
+ //# sourceMappingURL=farmingaccessory.js.map
@@ -5,46 +5,49 @@ import { SpecialCrop } from '../constants/specialcrops';
5
5
  import { EliteItemDto } from './item';
6
6
  import { PlayerOptions } from './player';
7
7
  export interface ActiveArmorSetBonus {
8
- count: number;
9
- from: GearSlot[];
10
- bonus: ArmorSetBonus;
11
- special?: SpecialCrop[];
8
+ count: number;
9
+ from: GearSlot[];
10
+ bonus: ArmorSetBonus;
11
+ special?: SpecialCrop[];
12
12
  }
13
13
  export declare class ArmorSet {
14
- helmet?: FarmingArmor;
15
- chestplate?: FarmingArmor;
16
- leggings?: FarmingArmor;
17
- boots?: FarmingArmor;
18
- get armor(): (FarmingArmor | null)[];
19
- pieces: FarmingArmor[];
20
- fortune: number;
21
- setBonuses: ActiveArmorSetBonus[];
22
- constructor(armor: FarmingArmor[]);
23
- getPiece(slot: GearSlot): FarmingArmor | undefined;
24
- setPiece(armor: FarmingArmor): void;
25
- private recalculateFamilies;
26
- getFortuneBreakdown(reloadFamilies?: boolean): Record<string, number>;
27
- specialDropsCalc(blocksBroken: number, crop: Crop): {
28
- type: SpecialCrop;
29
- amount: number;
30
- npc: number;
31
- } | null;
14
+ helmet?: FarmingArmor;
15
+ chestplate?: FarmingArmor;
16
+ leggings?: FarmingArmor;
17
+ boots?: FarmingArmor;
18
+ get armor(): (FarmingArmor | null)[];
19
+ pieces: FarmingArmor[];
20
+ fortune: number;
21
+ setBonuses: ActiveArmorSetBonus[];
22
+ constructor(armor: FarmingArmor[]);
23
+ getPiece(slot: GearSlot): FarmingArmor | undefined;
24
+ setPiece(armor: FarmingArmor): void;
25
+ private recalculateFamilies;
26
+ getFortuneBreakdown(reloadFamilies?: boolean): Record<string, number>;
27
+ specialDropsCalc(
28
+ blocksBroken: number,
29
+ crop: Crop
30
+ ): {
31
+ type: SpecialCrop;
32
+ amount: number;
33
+ npc: number;
34
+ } | null;
32
35
  }
33
36
  export declare class FarmingArmor {
34
- readonly item: EliteItemDto;
35
- readonly armor: FarmingArmorInfo;
36
- get slot(): GearSlot;
37
- readonly rarity: Rarity;
38
- readonly reforge: Reforge | undefined;
39
- readonly reforgeStats: ReforgeTier | undefined;
40
- readonly recombobulated: boolean;
41
- get potential(): number;
42
- fortune: number;
43
- fortuneBreakdown: Record<string, number>;
44
- private options?;
45
- constructor(item: EliteItemDto, options?: PlayerOptions);
46
- setOptions(options: PlayerOptions): void;
47
- private sumFortune;
48
- static isValid(item: EliteItemDto): boolean;
49
- static fromArray(items: EliteItemDto[], options?: PlayerOptions): FarmingArmor[];
37
+ readonly item: EliteItemDto;
38
+ readonly armor: FarmingArmorInfo;
39
+ get slot(): GearSlot;
40
+ readonly rarity: Rarity;
41
+ readonly reforge: Reforge | undefined;
42
+ readonly reforgeStats: ReforgeTier | undefined;
43
+ readonly recombobulated: boolean;
44
+ get potential(): number;
45
+ fortune: number;
46
+ fortuneBreakdown: Record<string, number>;
47
+ private options?;
48
+ constructor(item: EliteItemDto, options?: PlayerOptions);
49
+ setOptions(options: PlayerOptions): void;
50
+ private sumFortune;
51
+ static isValid(item: EliteItemDto): boolean;
52
+ static fromArray(items: EliteItemDto[], options?: PlayerOptions): FarmingArmor[];
50
53
  }
@@ -1,214 +1,209 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.FarmingArmor = exports.ArmorSet = void 0;
4
- const armor_1 = require("../constants/armor");
5
- const enchants_1 = require("../constants/enchants");
6
- const reforges_1 = require("../constants/reforges");
7
- const skills_1 = require("../constants/skills");
8
- const specialcrops_1 = require("../constants/specialcrops");
9
- const special_1 = require("../crops/special");
10
- const gems_1 = require("../util/gems");
11
- const itemstats_1 = require("../util/itemstats");
4
+ const ARMOR_1 = require('../constants/armor');
5
+ const ENCHANTS_1 = require('../constants/enchants');
6
+ const REFORGES_1 = require('../constants/reforges');
7
+ const SKILLS_1 = require('../constants/skills');
8
+ const SPECIALCROPS_1 = require('../constants/specialcrops');
9
+ const SPECIAL_1 = require('../crops/special');
10
+ const GEMS_1 = require('../util/gems');
11
+ const ITEMSTATS_1 = require('../util/itemstats');
12
12
  class ArmorSet {
13
- get armor() {
14
- return [this.helmet ?? null, this.chestplate ?? null, this.leggings ?? null, this.boots ?? null];
15
- }
16
- constructor(armor) {
17
- armor.sort((a, b) => b.potential - a.potential);
18
- this.pieces = armor;
19
- this.helmet = armor.find((a) => a.slot === armor_1.GearSlot.Helmet);
20
- this.chestplate = armor.find((a) => a.slot === armor_1.GearSlot.Chestplate);
21
- this.leggings = armor.find((a) => a.slot === armor_1.GearSlot.Leggings);
22
- this.boots = armor.find((a) => a.slot === armor_1.GearSlot.Boots);
23
- this.recalculateFamilies();
24
- }
25
- getPiece(slot) {
26
- switch (slot) {
27
- case armor_1.GearSlot.Helmet:
28
- return this.helmet;
29
- case armor_1.GearSlot.Chestplate:
30
- return this.chestplate;
31
- case armor_1.GearSlot.Leggings:
32
- return this.leggings;
33
- case armor_1.GearSlot.Boots:
34
- return this.boots;
35
- default:
36
- return undefined;
37
- }
38
- }
39
- setPiece(armor) {
40
- switch (armor.slot) {
41
- case armor_1.GearSlot.Helmet:
42
- this.helmet = armor;
43
- break;
44
- case armor_1.GearSlot.Chestplate:
45
- this.chestplate = armor;
46
- break;
47
- case armor_1.GearSlot.Leggings:
48
- this.leggings = armor;
49
- break;
50
- case armor_1.GearSlot.Boots:
51
- this.boots = armor;
52
- break;
53
- default:
54
- return;
55
- }
56
- this.recalculateFamilies();
57
- }
58
- recalculateFamilies() {
59
- const families = new Map();
60
- const armor = this.armor.filter((a) => a);
61
- this.setBonuses = [];
62
- for (const piece of armor) {
63
- if (!piece.armor.family)
64
- continue;
65
- families.set(piece.armor.family, (families.get(piece.armor.family) ?? 0) + 1);
66
- }
67
- for (const [family, count] of families.entries()) {
68
- if (count < 2)
69
- continue;
70
- const bonus = armor_1.ARMOR_SET_BONUS[family];
71
- if (!bonus)
72
- continue;
73
- this.setBonuses.push({
74
- count,
75
- from: armor.filter((a) => a.armor.family === family).map((a) => a.slot),
76
- bonus,
77
- special: bonus.special,
78
- });
79
- }
80
- this.getFortuneBreakdown();
81
- }
82
- getFortuneBreakdown(reloadFamilies = false) {
83
- if (reloadFamilies) {
84
- this.recalculateFamilies();
85
- }
86
- let sum = 0;
87
- const breakdown = {};
88
- for (const piece of this.armor) {
89
- if (!piece)
90
- continue;
91
- const fortune = piece.fortune;
92
- if (fortune > 0) {
93
- breakdown[piece.item.name ?? ''] = fortune;
94
- sum += fortune;
95
- }
96
- }
97
- for (const { bonus, count } of this.setBonuses) {
98
- if (count < 2 || count > 4)
99
- continue;
100
- const fortune = bonus.stats?.[count]?.[reforges_1.Stat.FarmingFortune] ?? 0;
101
- if (fortune > 0) {
102
- breakdown[bonus.name] = fortune;
103
- sum += fortune;
104
- }
105
- }
106
- this.fortune = sum;
107
- return breakdown;
108
- }
109
- specialDropsCalc(blocksBroken, crop) {
110
- const special = specialcrops_1.MATCHING_SPECIAL_CROP[crop];
111
- const applicableBonuses = this.setBonuses.filter((b) => b.special?.includes(special));
112
- if (applicableBonuses.length === 0)
113
- return null;
114
- // Armor set counts need to be combined for special crops
115
- // There will only be 2 applicable bonuses at most when Fermento armor plus
116
- // a lower tier armor is used. Hypixel appeats to count these as the same
117
- // set bonus instead of rolling them separately.
118
- let count = 0;
119
- for (const bonus of applicableBonuses) {
120
- count += bonus.count;
121
- }
122
- return (0, special_1.calculateAverageSpecialCrops)(blocksBroken, crop, count);
123
- }
13
+ get armor() {
14
+ return [this.helmet ?? null, this.chestplate ?? null, this.leggings ?? null, this.boots ?? null];
15
+ }
16
+ constructor(armor) {
17
+ armor.sort((a, b) => b.potential - a.potential);
18
+ this.pieces = armor;
19
+ this.helmet = armor.find((a) => a.slot === ARMOR_1.GearSlot.Helmet);
20
+ this.chestplate = armor.find((a) => a.slot === ARMOR_1.GearSlot.Chestplate);
21
+ this.leggings = armor.find((a) => a.slot === ARMOR_1.GearSlot.Leggings);
22
+ this.boots = armor.find((a) => a.slot === ARMOR_1.GearSlot.Boots);
23
+ this.recalculateFamilies();
24
+ }
25
+ getPiece(slot) {
26
+ switch (slot) {
27
+ case ARMOR_1.GearSlot.Helmet:
28
+ return this.helmet;
29
+ case ARMOR_1.GearSlot.Chestplate:
30
+ return this.chestplate;
31
+ case ARMOR_1.GearSlot.Leggings:
32
+ return this.leggings;
33
+ case ARMOR_1.GearSlot.Boots:
34
+ return this.boots;
35
+ default:
36
+ return undefined;
37
+ }
38
+ }
39
+ setPiece(armor) {
40
+ switch (armor.slot) {
41
+ case ARMOR_1.GearSlot.Helmet:
42
+ this.helmet = armor;
43
+ break;
44
+ case ARMOR_1.GearSlot.Chestplate:
45
+ this.chestplate = armor;
46
+ break;
47
+ case ARMOR_1.GearSlot.Leggings:
48
+ this.leggings = armor;
49
+ break;
50
+ case ARMOR_1.GearSlot.Boots:
51
+ this.boots = armor;
52
+ break;
53
+ default:
54
+ return;
55
+ }
56
+ this.recalculateFamilies();
57
+ }
58
+ recalculateFamilies() {
59
+ const FAMILIES = new Map();
60
+ const ARMOR = this.armor.filter((a) => a);
61
+ this.setBonuses = [];
62
+ for (const PIECE of ARMOR) {
63
+ if (!PIECE.armor.family) continue;
64
+ FAMILIES.set(PIECE.armor.family, (FAMILIES.get(PIECE.armor.family) ?? 0) + 1);
65
+ }
66
+ for (const [FAMILY, COUNT] of FAMILIES.entries()) {
67
+ if (COUNT < 2) continue;
68
+ const BONUS = ARMOR_1.ARMOR_SET_BONUS[FAMILY];
69
+ if (!BONUS) continue;
70
+ this.setBonuses.push({
71
+ count: COUNT,
72
+ from: ARMOR.filter((a) => a.armor.family === FAMILY).map((a) => a.slot),
73
+ bonus: BONUS,
74
+ special: BONUS.special,
75
+ });
76
+ }
77
+ this.getFortuneBreakdown();
78
+ }
79
+ getFortuneBreakdown(reloadFamilies = false) {
80
+ if (reloadFamilies) {
81
+ this.recalculateFamilies();
82
+ }
83
+ let SUM = 0;
84
+ const BREAKDOWN = {};
85
+ for (const PIECE of this.armor) {
86
+ if (!PIECE) continue;
87
+ const FORTUNE = PIECE.fortune;
88
+ if (FORTUNE > 0) {
89
+ BREAKDOWN[PIECE.item.name ?? ''] = FORTUNE;
90
+ SUM += FORTUNE;
91
+ }
92
+ }
93
+ for (const { bonus, count } of this.setBonuses) {
94
+ if (count < 2 || count > 4) continue;
95
+ const FORTUNE = bonus.stats?.[count]?.[REFORGES_1.Stat.FarmingFortune] ?? 0;
96
+ if (FORTUNE > 0) {
97
+ BREAKDOWN[bonus.name] = FORTUNE;
98
+ SUM += FORTUNE;
99
+ }
100
+ }
101
+ this.fortune = SUM;
102
+ return BREAKDOWN;
103
+ }
104
+ specialDropsCalc(blocksBroken, crop) {
105
+ const SPECIAL = SPECIALCROPS_1.MATCHING_SPECIAL_CROP[crop];
106
+ const APPLICABLE_BONUSES = this.setBonuses.filter((b) => b.special?.includes(SPECIAL));
107
+ if (APPLICABLE_BONUSES.length === 0) return null;
108
+ // Armor set counts need to be combined for special crops
109
+ // There will only be 2 applicable bonuses at most when Fermento armor plus
110
+ // a lower tier armor is used. Hypixel appeats to count these as the same
111
+ // set bonus instead of rolling them separately.
112
+ let COUNT = 0;
113
+ for (const BONUS of APPLICABLE_BONUSES) {
114
+ COUNT += BONUS.count;
115
+ }
116
+ return (0, SPECIAL_1.calculateAverageSpecialCrops)(blocksBroken, crop, COUNT);
117
+ }
124
118
  }
125
119
  exports.ArmorSet = ArmorSet;
126
120
  class FarmingArmor {
127
- get slot() {
128
- return this.armor.slot;
129
- }
130
- get potential() {
131
- if (!this.armor.family) {
132
- return this.fortune;
133
- }
134
- // Add the set bonus potential to the fortune
135
- return this.fortune + (armor_1.ARMOR_SET_BONUS[this.armor.family]?.piecePotential?.[reforges_1.Stat.FarmingFortune] ?? 0);
136
- }
137
- constructor(item, options) {
138
- this.options = options;
139
- this.item = item;
140
- const armor = armor_1.ARMOR_INFO[item.skyblockId];
141
- if (!armor) {
142
- throw new Error(`Unknown farming armor: ${item.name} (${item.skyblockId})`);
143
- }
144
- this.armor = armor;
145
- if (item.lore) {
146
- this.rarity = (0, itemstats_1.getRarityFromLore)(item.lore);
147
- }
148
- this.reforge = reforges_1.REFORGES[item.attributes?.modifier ?? ''] ?? undefined;
149
- this.reforgeStats = this.reforge?.tiers?.[this.rarity];
150
- this.recombobulated = this.item.attributes?.rarity_upgrades === '1';
151
- this.sumFortune();
152
- }
153
- setOptions(options) {
154
- this.options = options;
155
- this.fortune = this.sumFortune();
156
- }
157
- sumFortune() {
158
- this.fortuneBreakdown = {};
159
- let sum = 0;
160
- // Base fortune
161
- const base = this.armor.stats?.[reforges_1.Stat.FarmingFortune] ?? 0;
162
- if (base > 0) {
163
- this.fortuneBreakdown['Base Stats'] = base;
164
- sum += base;
165
- }
166
- // Per farming level stats like Rancher's Boots
167
- if (this.armor.perLevelStats?.skill === skills_1.Skill.Farming && this.options?.farmingLevel) {
168
- const perLevel = this.armor.perLevelStats?.stats[reforges_1.Stat.FarmingFortune] ?? 0;
169
- if (perLevel > 0) {
170
- this.fortuneBreakdown['Farming Level'] = perLevel * this.options.farmingLevel;
171
- sum += perLevel * this.options.farmingLevel;
172
- }
173
- }
174
- // Reforge stats
175
- const reforge = this.reforgeStats?.stats?.[reforges_1.Stat.FarmingFortune] ?? 0;
176
- if (reforge > 0) {
177
- this.fortuneBreakdown[this.reforge?.name ?? 'Reforge'] = reforge;
178
- sum += reforge;
179
- }
180
- // Gems
181
- const peridot = (0, gems_1.getPeridotFortune)(this.rarity, this.item);
182
- if (peridot > 0) {
183
- this.fortuneBreakdown['Peridot Gems'] = peridot;
184
- sum += peridot;
185
- }
186
- // Enchantments
187
- const enchantments = Object.entries(this.item.enchantments ?? {});
188
- for (const [enchant, level] of enchantments) {
189
- if (!level)
190
- continue;
191
- const enchantment = enchants_1.FARMING_ARMOR_ENCHANTS[enchant];
192
- if (!enchantment || !level)
193
- continue;
194
- const fortune = enchantment.levels?.[level]?.[reforges_1.Stat.FarmingFortune] ?? 0;
195
- if (fortune > 0) {
196
- this.fortuneBreakdown[enchantment.name] = fortune;
197
- sum += fortune;
198
- }
199
- }
200
- this.fortune = sum;
201
- return sum;
202
- }
203
- static isValid(item) {
204
- return armor_1.ARMOR_INFO[item.skyblockId] !== undefined;
205
- }
206
- static fromArray(items, options) {
207
- return items
208
- .filter((item) => FarmingArmor.isValid(item))
209
- .map((item) => new FarmingArmor(item, options))
210
- .sort((a, b) => b.fortune - a.fortune);
211
- }
121
+ get slot() {
122
+ return this.armor.slot;
123
+ }
124
+ get potential() {
125
+ if (!this.armor.family) {
126
+ return this.fortune;
127
+ }
128
+ // Add the set bonus potential to the fortune
129
+ return (
130
+ this.fortune +
131
+ (ARMOR_1.ARMOR_SET_BONUS[this.armor.family]?.piecePotential?.[REFORGES_1.Stat.FarmingFortune] ?? 0)
132
+ );
133
+ }
134
+ constructor(item, options) {
135
+ this.options = options;
136
+ this.item = item;
137
+ const ARMOR = ARMOR_1.ARMOR_INFO[item.skyblockId];
138
+ if (!ARMOR) {
139
+ throw new Error(`Unknown farming armor: ${item.name} (${item.skyblockId})`);
140
+ }
141
+ this.armor = ARMOR;
142
+ if (item.lore) {
143
+ this.rarity = (0, ITEMSTATS_1.getRarityFromLore)(item.lore);
144
+ }
145
+ this.reforge = REFORGES_1.REFORGES[item.attributes?.modifier ?? ''] ?? undefined;
146
+ this.reforgeStats = this.reforge?.tiers?.[this.rarity];
147
+ this.recombobulated = this.item.attributes?.rarity_upgrades === '1';
148
+ this.sumFortune();
149
+ }
150
+ setOptions(options) {
151
+ this.options = options;
152
+ this.fortune = this.sumFortune();
153
+ }
154
+ sumFortune() {
155
+ this.fortuneBreakdown = {};
156
+ let SUM = 0;
157
+ // Base fortune
158
+ const BASE = this.armor.stats?.[REFORGES_1.Stat.FarmingFortune] ?? 0;
159
+ if (BASE > 0) {
160
+ this.fortuneBreakdown['Base Stats'] = BASE;
161
+ SUM += BASE;
162
+ }
163
+ // Per farming level stats like Rancher's Boots
164
+ if (this.armor.perLevelStats?.skill === SKILLS_1.Skill.Farming && this.options?.farmingLevel) {
165
+ const PER_LEVEL = this.armor.perLevelStats?.stats[REFORGES_1.Stat.FarmingFortune] ?? 0;
166
+ if (PER_LEVEL > 0) {
167
+ this.fortuneBreakdown['Farming Level'] = PER_LEVEL * this.options.farmingLevel;
168
+ SUM += PER_LEVEL * this.options.farmingLevel;
169
+ }
170
+ }
171
+ // Reforge stats
172
+ const REFORGE = this.reforgeStats?.stats?.[REFORGES_1.Stat.FarmingFortune] ?? 0;
173
+ if (REFORGE > 0) {
174
+ this.fortuneBreakdown[this.reforge?.name ?? 'Reforge'] = REFORGE;
175
+ SUM += REFORGE;
176
+ }
177
+ // Gems
178
+ const PERIDOT = (0, GEMS_1.getPeridotFortune)(this.rarity, this.item);
179
+ if (PERIDOT > 0) {
180
+ this.fortuneBreakdown['Peridot Gems'] = PERIDOT;
181
+ SUM += PERIDOT;
182
+ }
183
+ // Enchantments
184
+ const ENCHANTMENTS = Object.entries(this.item.enchantments ?? {});
185
+ for (const [ENCHANT, LEVEL] of ENCHANTMENTS) {
186
+ if (!LEVEL) continue;
187
+ const ENCHANTMENT = ENCHANTS_1.FARMING_ARMOR_ENCHANTS[ENCHANT];
188
+ if (!ENCHANTMENT || !LEVEL) continue;
189
+ const FORTUNE = ENCHANTMENT.levels?.[LEVEL]?.[REFORGES_1.Stat.FarmingFortune] ?? 0;
190
+ if (FORTUNE > 0) {
191
+ this.fortuneBreakdown[ENCHANTMENT.name] = FORTUNE;
192
+ SUM += FORTUNE;
193
+ }
194
+ }
195
+ this.fortune = SUM;
196
+ return SUM;
197
+ }
198
+ static isValid(item) {
199
+ return ARMOR_1.ARMOR_INFO[item.skyblockId] !== undefined;
200
+ }
201
+ static fromArray(items, options) {
202
+ return items
203
+ .filter((item) => FarmingArmor.isValid(item))
204
+ .map((item) => new FarmingArmor(item, options))
205
+ .sort((a, b) => b.fortune - a.fortune);
206
+ }
212
207
  }
213
208
  exports.FarmingArmor = FarmingArmor;
214
- //# sourceMappingURL=farmingarmor.js.map
209
+ //# sourceMappingURL=farmingarmor.js.map