Farming Weight
NPM package for Farming Weight and fortune calculations in Hypixel SkyBlock.
Created specifically for the EliteWebsite and EliteBot projects, but can be used for any project, as long as some credit is given per the license.
This is a new package that's changing rapidly, there aren't any comprehensive docs at this time
Installation
npm install farming-weight
Usage
This package is made with TypeScript, and has type definitions included. While there is a lack of docs, relevant types and autocomplete should help a lot with understanding the package.
General philosophy
The goal of this package is to provide an easy way to pass in existing data and get Farming Weight information back. With this in mind, the input data is not always raw Hypixel API responses, as those are prone to change. While this may be inconvenient for some projects, it should be easy enough to convert the data to the format expected by this package, and it moves the burden of keeping up with Hypixel API changes out of this package.
Farming Weight Calculator
The createFarmingWeightCalculator
function is the main entry point for this package. It takes in a single object with data required for the full farming weight calculation. Data can be skipped, and the weight calculator will skip the related weight that would be calculated from that data.
import { createFarmingWeightCalculator } from 'farming-weight';
const member =
const calculator = createFarmingWeightCalculator({
collection: member.collection,
farmingXp: member.player_data?.experience?.SKILL_FARMING,
levelCapUpgrade: member.jacobs_contest?.perks?.farming_level_cap,
anitaBonusFarmingFortuneLevel?: member.jacobs_contest?.perks?.double_drops,
minions: member.player_data?.crafted_generators,
contests: Object.values(member.jacob_contests?.contests ?? {}),
pests: member.bestiary.kills
})
calculator.setEarnedMedals({
diamond: ,
platinum: ,
gold: ,
})
const weight = calculator.getWeightInfo();
console.log(weight.totalWeight);
console.log(weight.bonusSources);
Rates Calculator
This package also contains a rates calculator, which can be used to calculate farming drops and NPC profit for each crop.
import { calculateDetailedAverageDrops, Crop } from 'farming-weight';
const drops = calculateDetailedAverageDrops({
farmingFortune: 1500,
bountiful: true,
mooshroom: true,
dicerLevel: 3,
blocksBroken: 24000
});
console.log(drops[Crop.Wheat].collection)
FarmingPlayer Calculator
The createFarmingPlayer
function is used to create a FarmingPlayer
object, which can be used to calculate fortune and other player-specific farming values. However, this approach is limited by the data available in Hypixel's API, which won't include every fortune source.
const options = {
tools: farmingTools
armor: armorSet
equipment: equipment
accessories: accessories
pets: pets
} satisfies PlayerOptions;
const player = createFarmingPlayer(options);
const cropFortune = player.getCropFortune(Crop.Wheat);
const calculator = calculateDetailedAverageDrops({
farmingFortune: player.fortune + cropFortune.fortune,
bountiful: player.selectedTool?.reforge?.name === 'Bountiful',
mooshroom: player.selectedPet?.type === FarmingPets.MooshroomCow,
dicerLevel: player.selectedTool?.item.skyblockId?.match(/DICER_(\d+)/)?.[1] ?? 3) as 1 | 2 | 3,
blocksBroken: blocksBroken,
});