auction

package
v0.0.0-...-7360598 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadAuctionData = errors.New("invalid data, must include entries for only one item")
	ErrInvalidRank    = errors.New("invalid rank")
	ErrMissingItemID  = errors.New("missing item ID in data")
)

Functions

func AucHasBonusRanks

func AucHasBonusRanks(aucData model.AucEntries) bool

AucHasBonusRanks returns true if any item in the dataset includes a bonusID which indicates a bonus rank, or false otherwise

func FilterByLegendaryRank

func FilterByLegendaryRank(items *model.AucData, itemID, rank int) (*model.AucData, error)

FilterByLegendaryRank filters auctions and returns a copy with only the items of a given "rank". Ranks are tied to specific bonusIDs present on the item as retrieved from the AH. Ranks correspond to item level increases or other modifiers. An error is returned if the given rank is invalid or the data is not for a single item.

func FormatGoldStr

func FormatGoldStr(copper uint64) string

FormatGoldStr renders an amount of copper in a readable gold/silver/copper format

func FormatRoundedGoldStr

func FormatRoundedGoldStr(copper uint64) string

FormatRoundedGoldStr renders an amount of copper in a readable format, rounded to the nearest gold.

func GetAveragePriceForItem

func GetAveragePriceForItem(abLog *model.AucBotContext, aucData model.AucData, id int) (int, error)

GetAveragePriceForItem is a shortcut for AucCalc that retrieves the average copper price of an item

func GetPercentile12PriceForItem

func GetPercentile12PriceForItem(abLog *model.AucBotContext, aucData model.AucData, id int) (int, error)

GetPercentile12PriceForItem is a shortcut for AucCalc that retrieves the average copper price of the 12th percentile of an item

func GoldStringToCopper

func GoldStringToCopper(abLog *model.AucBotContext, goldString string) int

GoldStringToCopper is a utility function to convert a gold string back into the copper value used by Blizzard TODO in the future, the Results value could be a Gold struct {gold, silver, copper} instead of doing this

func ItemHasBonusRanks

func ItemHasBonusRanks(bonusList []int) bool

ItemHasBonusRanks returns true if the item includes a bonusID which indicates a bonus rank, or false otherwise

Types

type Accessor

type Accessor struct {
	BnetAccessor  *bnet.Accessor
	DbAccessor    *db.Accessor
	CacheAccessor cache.ICache
	RealmEntry    *model.RealmCacheEntry
	// Last-Modified header value
	LastModified time.Time
}

Accessor contains functions for interacting with the WoW Auction house API TODO linked realms have the same AH Data store a bank of accessors, instead of mapping by guild id

func (*Accessor) GetAuctionData

func (a *Accessor) GetAuctionData(ctx *model.AucBotContext) (*model.AucData, error)

type AucCalc

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

AucCalc is a builder that runs calculations on a set of auctions

func NewCalcBuilder

func NewCalcBuilder() *AucCalc

NewCalcBuilder returns a new AucCalc builder

func (*AucCalc) All

func (a *AucCalc) All() *AucCalc

All applies all calc functions

func (*AucCalc) AveragePrice

func (a *AucCalc) AveragePrice() *AucCalc

AveragePrice adds average price calculation to the builder

func (*AucCalc) Build

Build runs the calculation and returns all desired results It combines all calculations into one loop to keep all if there are no auction entries, returns a blank struct

func (*AucCalc) LowestBuyout

func (a *AucCalc) LowestBuyout() *AucCalc

LowestBuyout adds lowest buyout calculation to the builder

func (*AucCalc) None

func (a *AucCalc) None() *AucCalc

None applies no calc functions (is basically a no-op for completeness/explicitness)

func (*AucCalc) Percentile12

func (a *AucCalc) Percentile12() *AucCalc

Percentile12 adds the average price of the lowest 25% ie 12th percentile of items to the builder

func (*AucCalc) StdDev

func (a *AucCalc) StdDev() *AucCalc

StdDev adds 75th percentile estimate buyout calculation to the builder

func (*AucCalc) TotalQuantity

func (a *AucCalc) TotalQuantity() *AucCalc

TotalQuantity counts the total number of singular items on the AH

type Data

type Data struct {
	Auctions []model.AucEntry
}

Data contains auction Data.

type RealmEntry

type RealmEntry struct {
	Name string
	Slug string
}

RealmEntry contains realm information for auction Data.

Jump to

Keyboard shortcuts

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