farming-weight
Version:
Tools for calculating farming weight and fortune in Hypixel Skyblock
65 lines (64 loc) • 2.75 kB
TypeScript
import { Crop } from '../constants/crops.js';
import type { AppliedEffect, Effect, EffectEnvironment, EffectsBreakdown } from '../effects/types.js';
import type { FarmingPet } from '../fortune/farmingpet.js';
/**
* New effect-driven detailed-drops calculator.
*
* Replaces the legacy `ratesModifier` plumbing for shards/chips/reforges and
* the `overbloom` / `overbloomBreakdown` inputs with declarative `Effect[]`
* resolution. Built-in crop drops still flow through the same baseline math
* (drops, NPC coins, special-crop pre-bonus) - the difference is everything
* scoped: `add-rare-pct` (Overbloom), `mul-rare` (Cropeetle, armor sets),
* `mul-drop` (Deep Fried), and `add-drop` (Warty Bug Shard) are all resolved
* through the effect pipeline with proper per-drop scoping.
*
* Bountiful and Mooshroom remain bespoke - they're coin-side computations,
* not scoped multipliers, and the architecture plan keeps them out of v1.
*/
export interface CalculateDetailedDropsFromEffectsOptions {
crop: Crop;
blocksBroken: number;
farmingFortune?: number;
dicerLevel?: 1 | 2 | 3;
armorPieces?: 0 | 1 | 2 | 3 | 4;
bountiful?: boolean;
mooshroom?: boolean;
maxTool?: boolean;
pet?: FarmingPet;
chips?: Record<string, number | null | undefined>;
toolReforge?: string;
/** Effects collected via `FarmingPlayer.collectEffects(env)`. */
effects: readonly Effect[];
/** Environment for the calc. Built by `buildEffectEnvironment(player, crop)`. */
env: EffectEnvironment;
}
/**
* Output of {@link calculateDetailedDropsFromEffects}.
*
* Compared to the legacy `DetailedDropsResult`, the `rareItemBonus`/
* `rareItemBonusBreakdown` pair is replaced by:
* - `appliedEffects`: per-item `AppliedEffect[]` describing every effect that
* touched the drop (phase, op, source, resolved amount).
* - `effectsBreakdown`: per-source totals across all drops, surfaced in the
* UI as the new "Overbloom (and friends)" breakdown.
*/
export interface DetailedDropsFromEffectsResult {
npcPrice: number;
collection: number;
npcCoins: number;
fortune: number;
blocksBroken: number;
coinSources: Record<string, number>;
otherCollection: Record<string, number>;
items: Record<string, number>;
currencies: Record<string, number>;
rngItems?: Record<string, number>;
specialCropBonus: number;
specialCropBonusBreakdown: Record<string, number>;
appliedEffects: Record<string, AppliedEffect[]>;
effectsBreakdown: EffectsBreakdown;
}
/**
* Run the new effect-driven detailed-drops calculation.
*/
export declare function calculateDetailedDropsFromEffects(options: CalculateDetailedDropsFromEffectsOptions): DetailedDropsFromEffectsResult;