UNPKG

farming-weight

Version:

Tools for calculating farming weight and fortune in Hypixel Skyblock

109 lines 4.57 kB
import { FARMING_ENCHANTS } from '../../constants/enchants.js'; import { REFORGES, Rarity, ReforgeTarget } from '../../constants/reforges.js'; import { Stat, getStatValue } from '../../constants/stats.js'; import { GemRarity } from '../../fortune/item.js'; import { FarmingToolType } from '../../items/tools.js'; import { getFortuneFromEnchant, getMaxFortuneFromEnchant } from '../../util/enchants.js'; import { getPeridotFortune, getPeridotGemFortune } from '../../util/gems.js'; export const TOOL_FORTUNE_SOURCES = [ { name: 'Base Stats', exists: (tool) => { return (tool.getLastItemUpgrade() ?? tool)?.info?.baseStats?.[Stat.FarmingFortune] !== undefined; }, max: (tool) => { return (tool.getLastItemUpgrade() ?? tool)?.info?.baseStats?.[Stat.FarmingFortune] ?? 0; }, current: (tool) => { return tool.info.baseStats?.[Stat.FarmingFortune] ?? 0; }, }, { name: 'Base Stats', exists: (tool) => { const last = (tool.getLastItemUpgrade() ?? tool)?.info; return last?.stats?.[last.maxRarity]?.[Stat.FarmingFortune] !== undefined; }, max: (tool) => { const last = (tool.getLastItemUpgrade() ?? tool)?.info; return getStatValue(last?.stats?.[last.maxRarity]?.[Stat.FarmingFortune], tool.options); }, current: (tool) => { return getStatValue(tool.info.stats?.[tool.rarity]?.[Stat.FarmingFortune], tool.options); }, }, { name: 'Item Ability', exists: (tool) => tool.info.computedStats !== undefined, // Temporary set to max of 170 for deadaalus axe max: () => 170, current: (tool) => { return tool.getCalculatedStats()[Stat.FarmingFortune] ?? 0; }, }, { name: 'Reforge Stats', wiki: () => REFORGES?.bountiful?.wiki, exists: (tool) => tool.type !== ReforgeTarget.Sword, max: (tool) => { const last = (tool.getLastItemUpgrade() ?? tool)?.info; return tool.reforge?.name === 'Bountiful' ? (REFORGES.bountiful?.tiers[last.maxRarity]?.stats[Stat.FarmingFortune] ?? 0) : (REFORGES.blessed?.tiers?.[last.maxRarity]?.stats[Stat.FarmingFortune] ?? 0); }, current: (tool) => { return tool.reforgeStats?.stats?.[Stat.FarmingFortune] ?? 0; }, }, { name: 'Gemstone Slots', wiki: () => 'https://wiki.hypixel.net/Gemstone#Gemstone_Slots', exists: (tool) => { const last = (tool.getLastItemUpgrade() ?? tool)?.info; return last?.gemSlots?.peridot !== undefined; }, max: (tool) => { const last = (tool.getLastItemUpgrade() ?? tool)?.info; return ((last?.gemSlots?.peridot ?? 0) * getPeridotGemFortune(last?.maxRarity ?? Rarity.Common, GemRarity.Perfect)); }, current: (tool) => { return getPeridotFortune(tool.rarity, tool.item); }, }, { name: 'Farming For Dummies', wiki: () => 'https://wiki.hypixel.net/Farming_For_Dummies', exists: (tool) => tool.type !== ReforgeTarget.Sword, max: () => 5, current: (tool) => { return +(tool.item.attributes?.farming_for_dummies_count ?? 0); }, }, { name: 'Logarithmic Counter', wiki: (tool) => tool.info.wiki, exists: (tool) => tool.info.type === FarmingToolType.MathematicalHoe, max: () => 16 * 7, current: (tool) => { const numberOfDigits = Math.max(Math.floor(Math.log10(Math.abs(tool.counter ?? 0))), 0) + 1; return Math.max((numberOfDigits - 4) * 16, 0); }, }, { name: 'Collection Analysis', wiki: (tool) => tool.info.wiki, exists: (tool) => tool.info.type === FarmingToolType.MathematicalHoe, max: () => 8 * 7, current: (tool) => tool.collAnalysis ?? 0, }, ...Object.entries(FARMING_ENCHANTS).map(([id, enchant]) => ({ name: enchant.name, wiki: () => enchant.wiki, exists: (tool) => enchant.appliesTo.includes(tool.type) && (!enchant.cropSpecific || enchant.cropSpecific === tool.crop), max: (tool) => getMaxFortuneFromEnchant(enchant, tool.options, tool.crop), current: (tool) => getFortuneFromEnchant(tool.item.enchantments?.[id] ?? 0, enchant, tool.options, tool.crop), })), ]; //# sourceMappingURL=toolsources.js.map