UNPKG

farming-weight

Version:

Tools for calculating farming weight and fortune in Hypixel Skyblock

98 lines (97 loc) 4.13 kB
import type { PlayerOptions } from '../player/playeroptions.js'; export declare enum Stat { Strength = "Strength", Health = "Health", Defense = "Defense", Speed = "Speed", Intelligence = "Intelligence", CritChance = "Crit Chance", CritDamage = "Crit Damage", AttackSpeed = "Attack Speed", AbilityDamage = "Ability Damage", MagicFind = "Magic Find", PetLuck = "Pet Luck", TrueDefense = "True Defense", SeaCreatureChance = "Sea Creature Chance", Ferocity = "Ferocity", MiningSpeed = "Mining Speed", MiningFortune = "mining_fortune", FarmingFortune = "farming_fortune", CactusFortune = "cactus_fortune", CarrotFortune = "carrot_fortune", CocoaBeanFortune = "cocoa_beans_fortune", MelonFortune = "melon_fortune", MushroomFortune = "mushroom_fortune", NetherWartFortune = "nether_wart_fortune", PotatoFortune = "potato_fortune", PumpkinFortune = "pumpkin_fortune", SugarCaneFortune = "sugar_cane_fortune", WheatFortune = "wheat_fortune", SunflowerFortune = "sunflower_fortune", MoonflowerFortune = "moonflower_fortune", WildRoseFortune = "wild_rose_fortune", PestKillFortune = "pest_kill_fortune", ForagingFortune = "foraging_fortune", MiningWisdom = "Mining Wisdom", FarmingWisdom = "Farming Wisdom", ForagingWisdom = "Foraging Wisdom", Pristine = "Pristine", BonusPestChance = "Bonus Pest Chance", PestCooldownReduction = "Pest Cooldown Reduction", Overbloom = "Overbloom", FishingSpeed = "Fishing Speed" } /** * Mapping of parent stats to their child stats. * For example, FarmingFortune is a parent stat for WheatFortune, CarrotFortune, etc. * This allows for querying a general stat (e.g., FarmingFortune) and getting all specific stats that fall under it. */ export declare const STAT_GROUPS: Partial<Record<Stat, Set<Stat>>>; /** * Expand a stat query to include child stats from stat groups. * Returns an array containing the original stat plus any grouped child stats. */ export declare function expandStatQuery(stat: Stat): Stat[]; /** * Mapping of stats to the list of stats that contribute to them. * This is effectively the reverse of STAT_GROUPS, but pre-calculated for efficient lookup. * * Example: WheatFortune is improved by sources that provide WheatFortune OR FarmingFortune. * So CONTRIBUTORY_STATS[WheatFortune] = [WheatFortune, FarmingFortune]. */ export declare const CONTRIBUTORY_STATS: Partial<Record<Stat, Stat[]>>; /** * Get all stats that contribute to the target stat. * Returns [targetStat, ...parentStats]. */ export declare function getContributoryStats(stat: Stat): Stat[]; export declare function getStatValue<T = unknown, C = PlayerOptions>(stat?: StatValue<T, C>, option?: C): number; export type StatValue<T = unknown, C = PlayerOptions> = StatValueFlat<T, C> | StatValueCalculated<T, C> | StatValueCompound<T, C>; export type StatValueCompound<T, C = PlayerOptions> = StatValueFlat<T, C> & StatValueCalculated<T, C>; export type StatsRecord<T = unknown, C = PlayerOptions> = Partial<Record<Stat, StatValue<T, C>>>; export interface StatValueBase<T, C = PlayerOptions> { name?: string; exists?: (opt: C) => boolean; type?: T; } export interface StatValueFlat<T, C = PlayerOptions> extends StatValueBase<T, C> { value: number; } export interface StatValueCalculated<T, C = PlayerOptions> extends StatValueBase<T, C> { calculated: (opt: C) => number; } export type BreakDownEntry = { value: number; stat: Stat; }; /** Extended breakdown entry for late-calculated stats that may have a multiplier factor */ export type LateBreakdownEntry = BreakDownEntry & { factor?: number; }; export type StatBreakdown = Record<string, BreakDownEntry | LateBreakdownEntry>; export interface StatValueCalculated<T, C = PlayerOptions> extends StatValueBase<T, C> { calculated: (opt: C) => number; } export declare const CROP_FORTUNE_STATS: ReadonlySet<Stat>; export declare function statMatchesQuery(statToCheck: Stat, queryStat: Stat): boolean; export declare const STAT_NAMES: Record<Stat, string>;