UNPKG

farming-weight

Version:

Tools for calculating farming weight and fortune in Hypixel Skyblock

67 lines 1.99 kB
import { REFORGES, Rarity } from '../constants/reforges.js'; import { getItemUpgrades, getLastItemUpgradeableTo, getNextItemUpgradeableTo } from '../upgrades/upgrades.js'; import { getRarityFromLore, previousRarity } from '../util/itemstats.js'; export class UpgradeableBase { item; info; _type; get type() { return this._type; } set type(value) { this._type = value; } crop; options; recombobulated; rarity; reforge; reforgeStats; fortune; items; constructor(options) { this.item = options.item; const info = options.items[options.item.skyblockId]; if (!info) { throw new Error(`Unknown item: ${options.item.name} (${options.item.skyblockId})`); } this.info = info; this.options = options.options; this.items = options.items; if (this.item.lore) { this.rarity = getRarityFromLore(this.item.lore); } else { this.rarity = previousRarity(this.info.maxRarity); this.rarity ??= Rarity.Common; } this.reforge = REFORGES[options.item.attributes?.modifier ?? ''] ?? undefined; this.reforgeStats = this.reforge?.tiers?.[this.rarity]; this.recombobulated = this.item.attributes?.rarity_upgrades === '1'; this.fortune = 0; } getFortune() { return this.fortune; } getCalculatedStats() { if (!this.info.computedStats || !this.options) return {}; return this.info.computedStats?.(this.options) ?? {}; } getUpgrades() { return getItemUpgrades(this); } getProgress() { return []; } getItemUpgrade() { return this.info.upgrade; } getNextItemUpgrade() { return getNextItemUpgradeableTo(this, this.items); } getLastItemUpgrade() { return getLastItemUpgradeableTo(this, this.items); } } //# sourceMappingURL=upgradeable.js.map