farming-weight
Version:
Tools for calculating farming weight and fortune in Hypixel Skyblock
218 lines (217 loc) • 6.34 kB
TypeScript
import type { EffectOp, Scope } from '../effects/types.js';
import type { EliteItemDto } from '../fortune/item.js';
import type { UpgradeableInfo } from '../fortune/upgradeable.js';
import type { GearSlot } from '../items/armor.js';
import type { FARMING_TOOLS } from '../items/tools.js';
import type { JacobContestMedal } from '../util/jacob.js';
import type { Crop } from './crops.js';
import { Stat } from './stats.js';
export declare enum UpgradeReason {
NextTier = "next",// Standard upgrade
DeadEnd = "dead",// Not worth using, no more upgrades
Situational = "situational"
}
export interface FortuneSource {
name: string;
fortunePerLevel: number;
cropSpecific?: boolean;
maxLevel: number;
wiki: string;
statsPerLevel?: Partial<Record<Stat, number>>;
upgradeCosts?: Partial<Record<number, UpgradeCost>>;
}
export interface FortuneSourceProgress {
name: string;
/**
* When present and true, this entry should be included in `getProgress()` output
* even if it contributes 0/0 and has no upgrades/sub-progress.
*/
alwaysInclude?: true;
current: number;
ratio: number;
/**
* Optional per-stat progress. When present, consumers should prefer this
* over the legacy `min/max/ratio` fields.
*/
stats?: Partial<Record<Stat, {
current: number;
max: number;
ratio: number;
}>>;
effects?: EffectSummary[];
maxLevel?: number;
fortunePerLevel?: number;
max: number;
wiki?: string;
upgrades?: FortuneUpgrade[];
progress?: FortuneSourceProgress[];
item?: EliteItemDto;
info?: UpgradeableInfo;
nextInfo?: UpgradeableInfo;
maxInfo?: UpgradeableInfo;
api?: boolean;
active?: {
active: boolean;
reason?: string;
fortune?: number;
stats?: Partial<Record<Stat, number>>;
};
}
export interface EffectSummary {
source: string;
op: EffectOp;
description?: string;
relatedStats?: readonly Stat[];
scope?: Scope;
value?: number;
valueDisplay?: 'stat' | 'percent' | 'factor';
valueStat?: Stat;
}
export interface UpgradeCost {
items?: Record<string, number>;
coins?: number;
copper?: number;
bits?: number;
kernels?: number;
medals?: Partial<Record<Exclude<JacobContestMedal, 'platinum' | 'diamond'>, number>>;
applyCost?: Omit<UpgradeCost, 'applyCost'>;
}
export declare function mergeCost(...costs: UpgradeCost[]): UpgradeCost;
export declare enum UpgradeCategory {
Enchant = "enchantment",
Rarity = "rarity",
Item = "item",
Gem = "gem",
Reforge = "reforge",
Plot = "plot",
Skill = "skill",
CommunityCenter = "community_center",
Milestone = "milestone",
Anita = "anita",
Misc = "misc",
Attribute = "attribute",
Composter = "composter",
Pet = "pet"
}
export declare enum UpgradeAction {
Apply = "apply",
Recombobulate = "recombobulate",
LevelUp = "levelup",
Purchase = "purchase",
Consume = "consume",
Upgrade = "upgrade",
Unlock = "unlock"
}
export interface UpgradeInfoImprovement<T> {
name: string;
output: T;
}
export interface FortuneUpgradeImprovement {
name: string;
fortune: number;
}
export interface UpgradeGroupDefinition {
id: string;
label: string;
strategy: 'available-pieces';
warning?: string;
}
export interface FortuneUpgradeGroupMeta extends UpgradeGroupDefinition {
memberCount: number;
}
export interface UpgradeInfo<T = number> {
title: string;
onto?: {
name?: string | null;
skyblockId?: string | null;
newSkyblockId?: string | null;
slot?: GearSlot;
};
max?: T;
current: T;
increase: T;
action: UpgradeAction;
purchase?: string;
category: UpgradeCategory;
optional?: boolean;
api?: boolean;
repeatable?: number;
deadEnd?: boolean;
cost?: UpgradeCost;
wiki?: string;
conflictKey?: string;
improvements?: UpgradeInfoImprovement<T>[];
}
export interface UpgradeMeta {
id?: string;
itemUuid?: string;
type?: 'enchant' | 'item' | 'reforge' | 'gem' | 'skill' | 'accessory' | 'plot' | 'attribute' | 'crop_upgrade' | 'chip' | 'pet_item' | 'pet_level' | 'setting' | 'unlock' | 'upgrade_group' | 'buy_item';
key?: string;
value?: number | string;
slotIndex?: number;
slot?: string;
}
export interface FortuneUpgrade {
title: string;
onto?: {
name?: string | null;
skyblockId?: string | null;
newSkyblockId?: string | null;
slot?: GearSlot;
};
max?: number;
/**
* The primary stat increase amount. For backwards compatibility.
* This is typically the FarmingFortune increase.
*/
increase: number;
/**
* All stat increases this upgrade provides.
* If not specified, the upgrade is assumed to only affect FarmingFortune
* with the value from the `increase` field.
*/
stats?: Partial<Record<Stat, number>>;
effects?: EffectSummary[];
action: UpgradeAction;
purchase?: string;
category: UpgradeCategory;
optional?: boolean;
api?: boolean;
repeatable?: number;
deadEnd?: boolean;
cost?: UpgradeCost;
wiki?: string;
conflictKey?: string;
group?: FortuneUpgradeGroupMeta | UpgradeGroupDefinition;
groupedUpgrades?: FortuneUpgrade[];
improvements?: FortuneUpgradeImprovement[];
meta?: UpgradeMeta;
skillReq?: Partial<Record<string, number>> | undefined;
}
export interface StatQueryOptions {
stat?: Stat;
stats?: Stat[];
includeUpgradeGroups?: boolean;
}
export declare function getQueryStats(options?: StatQueryOptions, fallback?: Stat[]): Stat[];
export interface UpgradeTreeNode {
upgrade: FortuneUpgrade;
statsBefore: Partial<Record<Stat, number>>;
statsAfter: Partial<Record<Stat, number>>;
statsGained: Partial<Record<Stat, number>>;
totalCost?: UpgradeCost;
children: UpgradeTreeNode[];
}
export interface Upgrade {
id: string;
reason: UpgradeReason;
cost?: UpgradeCost;
why?: string;
preferred?: boolean;
group?: UpgradeGroupDefinition;
}
export interface InitialItems {
tools: Partial<Record<Crop, keyof typeof FARMING_TOOLS>>;
armor: Record<GearSlot, string | string[]>;
pets: string[];
}