npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

farming-weight

v0.7.0

Published

Tools for calculating farming weight and fortune in Hypixel Skyblock

Downloads

1,088

Readme

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 = // Get SkyBlock member from elsewhere (https://api.hypixel.net/)

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, // You should also include minions crafted from other members on the same profile
	contests: Object.values(member.jacob_contests?.contests ?? {}),
	pests: member.bestiary.kills
})

// Can pass in some values instead of calculating them (you can exclude contests above if you do this)
calculator.setEarnedMedals({
	diamond: /* Number of diamond medals */,
	platinum: /* Number of platinum medals */,
	gold: /* Number of gold medals */,
})

const weight = calculator.getWeightInfo();

console.log(weight.totalWeight); 
// 10000.53 (or whatever the total weight is)

console.log(weight.bonusSources);
// { "Contest Medals": 123.25, "Farming Level": 250, ... }

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 // 100% efficiency for 20 minutes
});

console.log(drops[Crop.Wheat].collection) // 123000 (or whatever the collection is)

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 // Array of FarmingTool objects, or EliteItemFto objects (not raw NBT data) 
	armor: armorSet // Array of FarmingArmor objects, an ArmorSet object, or EliteItemDto objects
	equipment: equipment // Array of FarmingEquipment objects, or EliteItemDto objects
	accessories: accessories // Array of FarmingAccessory objects, or EliteItemDto objects
	pets: pets // Array of FarmingPet objects, or raw Hypixel API pet data

	// ... other options (check the type definition)
} satisfies PlayerOptions;

const player = createFarmingPlayer(options);
// Get a player's Wheat fortune
const cropFortune = player.getCropFortune(Crop.Wheat);

// Create a calculator for a player's Wheat fortune
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,
});