skyhelpernetworthgo

package module
v1.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 9 Imported by: 0

README

SkyHelper-Networth-Go

discord license Go Reference

[!NOTE] This repository is specifically designed for integration with SkyCryptv3. While this Go implementation focuses on core networth calculation functionality (including standard and non-cosmetic calculations), it does not include all features available in the Node.js module, such as UpdateManager and NetworthManager components.

SkyHelper's Networth Calculation as a Go module to calculate a player's SkyBlock networth by using their profile data provided by the Hypixel API.

Installation

go get github.com/SkyCryptWebsite/SkyHelper-Networth-Go

Quick Start

package main

import (
    "fmt"
    "github.com/SkyCryptWebsite/SkyHelper-Networth-Go"
)

func main() {
    userProfile := // https://api.hypixel.net/#tag/SkyBlock/paths/~1v2~1skyblock~1profile/get - profile.Members[uuid]
    museumData := // https://api.hypixel.net/v2/skyblock/museum - museum.Members[uuid]

	calculator, err := skyhelpernetworthgo.NewProfileNetworthCalculator(userProfile, museumData, profile.Banking.Balance)
	if err != nil {
		return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
			"error": fmt.Sprintf("Failed to create networth calculator: %v", err),
		})
	}

    networth := calculator.GetNetworth()
    nonCosmeticNetworth := calculator.GetNonCosmeticNetworth()

    fmt.Printf("Networth: %+v\n", networth)
    fmt.Printf("Non-Cosmetic Networth: %+v\n", networth)
}

Testing

Run the comprehensive test suite:

go test ./tests

# Run specific item tests
go test ./tests/ -run TestEnchantedBook
go test ./tests/ -run TestPets
go test ./tests/ -run TestGemstones

# Run with verbose output
go test -v ./tests/...

Benchmarking

Performance benchmarks are available to measure calculation speed:

# Run benchmarks
go test -bench=. ./benchmark/...

# Run specific benchmarks
go test -bench=BenchmarkNetworth ./benchmark/...

# Run benchmarks with memory profiling
go test -bench=. -benchmem ./benchmark/...

License

This project is licensed under the terms specified in LICENSE.MD.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateFromSpecifiedInventories added in v1.2.0

func CalculateFromSpecifiedInventories(inventories SpecifiedInventory, opts ...models.NetworthOptions) (*models.NetworthResult, error)

func GetItems added in v1.2.0

func GetItems(cache bool, cacheTimeSeconds int64, retries int) (map[string]models.HypixelItem, error)

func GetPrices added in v1.1.2

func GetPrices(cache bool, cacheTimeSeconds int64, retries int) (map[string]float64, error)

Types

type CalculatorService added in v1.1.2

type CalculatorService struct {
	// contains filtered or unexported fields
}

func NewCalculatorService added in v1.1.2

func NewCalculatorService() *CalculatorService

func (*CalculatorService) CalculateItem added in v1.1.2

func (cs *CalculatorService) CalculateItem(item *models.NetworthItem)

func (*CalculatorService) CalculatePet added in v1.1.2

func (cs *CalculatorService) CalculatePet(pet *models.NetworthPet)

func (*CalculatorService) NewSkyBlockItemCalculator added in v1.1.2

func (cs *CalculatorService) NewSkyBlockItemCalculator(item *skycrypttypes.Item, prices map[string]float64, options NetworthOptions) *models.NetworthItem

func (*CalculatorService) NewSkyBlockPetCalculator added in v1.1.2

func (cs *CalculatorService) NewSkyBlockPetCalculator(pet *skycrypttypes.Pet, prices map[string]float64, options NetworthOptions) *models.NetworthPet

type NetworthOptions added in v1.2.2

type NetworthOptions struct {
	Prices           map[string]float64 `json:"prices"`
	NonCosmetic      bool               `json:"nonCosmetic"`
	CachePrices      bool               `json:"cachePrices"`
	OnlyNetworth     bool               `json:"onlyNetworth"`
	IncludeItemData  bool               `json:"includeItemData"`
	SortItems        bool               `json:"sortItems"`
	StackItems       bool               `json:"stackItems"`
	KeepInvalidItems bool               `json:"keepInvalidItems"`
}

func (NetworthOptions) ToInternal added in v1.2.2

func (opts NetworthOptions) ToInternal() models.NetworthOptions

type ProfileNetworthCalculator

type ProfileNetworthCalculator struct {
	ProfileData         *skycrypttypes.Member
	MuseumData          *skycrypttypes.Museum
	Bank                float64
	Purse               float64
	PersonalBankBalance float64
	Items               *models.ParsedItems
	Prices              map[string]float64
}

func NewProfileNetworthCalculator

func NewProfileNetworthCalculator(userProfile *skycrypttypes.Member, museumData *skycrypttypes.Museum, bankBalance float64) (*ProfileNetworthCalculator, error)

func (*ProfileNetworthCalculator) GetNetworth

func (*ProfileNetworthCalculator) GetNonCosmeticNetworth

func (p *ProfileNetworthCalculator) GetNonCosmeticNetworth(opts ...NetworthOptions) *models.NetworthResult

type SpecifiedInventory added in v1.2.0

type SpecifiedInventory map[string]skycrypttypes.EncodedItems

Directories

Path Synopsis
internal
lib

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL