farming-weight
Version:
Tools for calculating farming weight and fortune in Hypixel Skyblock
150 lines (149 loc) • 6.53 kB
TypeScript
import { type Crop } from '../constants/crops.js';
import { Stat, type StatBreakdown } from '../constants/stats.js';
import { type EffectSummary, type FortuneUpgrade, type StatQueryOptions, type UpgradeTreeNode } from '../constants/upgrades.js';
import type { Effect, EffectEnvironment } from '../effects/types.js';
import { FarmingAccessory } from '../fortune/farmingaccessory.js';
import { ArmorSet, FarmingArmor } from '../fortune/farmingarmor.js';
import { FarmingEquipment } from '../fortune/farmingequipment.js';
import { FarmingPet } from '../fortune/farmingpet.js';
import { FarmingTool } from '../fortune/farmingtool.js';
import { type DetailedDropsFromEffectsResult } from '../util/ratecalc-effects.js';
import { createFarmingWeightCalculator, type FarmingWeightInfo } from '../weight/weightcalc.js';
import type { PlayerOptions } from './playeroptions.js';
export declare function createFarmingPlayer(options: PlayerOptions): FarmingPlayer;
export interface PlayerStatQuery {
stats: Stat[];
crop?: Crop;
}
export interface PlayerStatView {
totals: Partial<Record<Stat, number>>;
breakdowns: Partial<Record<Stat, StatBreakdown>>;
effects: EffectSummary[];
upgrades: FortuneUpgrade[];
}
export interface UpgradeRateImpactOptions {
crop: Crop;
blocksBroken: number;
}
export interface DetailedDropsFromEffectsDelta {
collection: number;
npcCoins: number;
coinSources: Record<string, number>;
otherCollection: Record<string, number>;
items: Record<string, number>;
currencies: Record<string, number>;
rngItems: Record<string, number>;
totalItems: number;
}
export interface UpgradeRateImpact {
before: DetailedDropsFromEffectsResult;
after: DetailedDropsFromEffectsResult;
delta: DetailedDropsFromEffectsDelta;
}
export declare class FarmingPlayer {
options: PlayerOptions;
permFortune: number;
tempFortune: number;
get fortune(): number;
breakdown: StatBreakdown;
tempFortuneBreakdown: StatBreakdown;
baseFortune: number;
tools: FarmingTool[];
armor: FarmingArmor[];
armorSet: ArmorSet;
equipment: FarmingEquipment[];
accessories: FarmingAccessory[];
activeAccessories: FarmingAccessory[];
pets: FarmingPet[];
selectedTool?: FarmingTool;
selectedPet?: FarmingPet;
get attributes(): Record<string, number>;
constructor(options: PlayerOptions);
setOptions(options: PlayerOptions): void;
populatePets(): void;
populateTools(): void;
populateArmor(): void;
populateEquipment(): void;
populateActiveAccessories(): void;
private syncActiveAccessories;
changeArmor(armor: FarmingArmor[]): void;
selectTool(tool: FarmingTool): void;
selectPet(pet: FarmingPet): void;
setStrength(strength: number): void;
getProgress(stats?: Stat[]): import("../constants/upgrades.js").FortuneSourceProgress[];
getPetProgress(stats?: Stat[]): import("../constants/upgrades.js").FortuneSourceProgress[];
getUpgrades(options?: StatQueryOptions): FortuneUpgrade[];
getStatView(query: PlayerStatQuery): PlayerStatView;
getCropUpgrades(crop?: Crop, tool?: FarmingTool): FortuneUpgrade[];
getGeneralFortune(): number;
getToolStat(tool: FarmingTool, stat: Stat, crop?: Crop): number;
/**
* Build the canonical {@link EffectEnvironment} for this player + crop.
* Thin wrapper over {@link buildEffectEnvironment}; provided so callers
* never have to import the helper directly.
*/
buildEnvironment(crop?: Crop): EffectEnvironment;
/**
* Aggregate the declarative {@link Effect}[] from every active source on
* the player: armor set (armor + equipment + set bonuses, including each
* piece's reforge & enchants), the selected tool, active accessories, the
* selected pet, every attribute shard, and every garden chip.
*
* Sources with a `getActive` guard that returns `active: false` are
* skipped. Sources whose `getEffects` returns `[]` contribute nothing.
*
* This method is the single seam consumed by the new effect-resolver
* pipeline (`getStat`, `getRates`). It does **not** apply scopes - that's
* the resolver's job - so the returned list includes every effect the
* player could plausibly emit, with their declarative scopes intact.
*/
collectEffects(env: EffectEnvironment): Effect[];
getStat(stat: Stat, targetCrop?: Crop): number;
getStatBreakdown(stat: Stat, targetCrop?: Crop): StatBreakdown;
getTempFortune(): number;
getCropFortune(crop?: Crop, tool?: FarmingTool | undefined): {
fortune: number;
breakdown: StatBreakdown;
};
getCropProgress(crop: Crop, stats?: Stat[]): import("../constants/upgrades.js").FortuneSourceProgress[];
getRates(crop: Crop, blocksBroken: number): DetailedDropsFromEffectsResult;
getUpgradeRateImpact(upgrade: FortuneUpgrade, options: UpgradeRateImpactOptions): UpgradeRateImpact;
getWeightCalc(info?: FarmingWeightInfo): ReturnType<typeof createFarmingWeightCalculator>;
getBestTool(crop: Crop): FarmingTool | undefined;
getSelectedCropTool(crop: Crop): FarmingTool | undefined;
applyUpgrade(upgrade: FortuneUpgrade): void;
/**
* Creates a deep clone of this FarmingPlayer that can be modified without affecting the original.
*/
clone(): FarmingPlayer;
/**
* Expands an upgrade into a tree of follow-up upgrades.
* This applies the upgrade on a cloned player and recursively finds upgrades
* for the same target item.
*
* @param upgrade - The upgrade to expand
* @param options.maxDepth - Maximum recursion depth (default: 10)
* @param options.crop - Crop for crop-specific fortune calculations
* @param options.stats - Stats to track (default: [Stat.FarmingFortune])
* @param options.includeAllTierUpgradeChildren - If true, first-level children of tier upgrades include ALL available upgrades for the new item (default: false)
*/
expandUpgrade(upgrade: FortuneUpgrade, options?: {
maxDepth?: number;
crop?: Crop;
stats?: Stat[];
includeAllTierUpgradeChildren?: boolean;
}): UpgradeTreeNode;
private buildUpgradeTree;
private getAllStats;
private computeStatsDiff;
private getUpgradeKey;
private getFollowUpUpgrades;
}
export interface JacobFarmingContest {
crop: Crop;
timestamp: number;
collected: number;
position?: number;
participants?: number;
medal?: number;
}