lootbox

package
v0.0.0-...-40aef72 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuantityWhaling = "simple_whaling_quantity"
	TargetWhaling   = "simple_whaling_target"
)
View Source
const (
	QuatityWhalingStats = "stats_whaling_quantity"
	TargetWhalingStats  = "stats_whaling_target"
)
View Source
const (
	Target sessionType = iota
	Quantity
	Stop
)
View Source
const (
	StatsSessionCount = 1000
	StatsWorkerCount  = 8
)
View Source
const (
	SafetyTargetWhaling = 100000
)

Variables

View Source
var (
	StateWorkerChan = make(chan *WhalingInput, StatsWorkerCount)
)

Functions

func InitStatsWorkers

func InitStatsWorkers()

func NewLootBoxCollection

func NewLootBoxCollection(dirPath string) (map[string]*LootBox, error)

func StopStatsWorkers

func StopStatsWorkers()

Types

type DrawResult

type DrawResult struct {
	Item     *Item
	Category *ItemCategory
}

type Item

type Item struct {
	Quantity     uint64            `json:"quantity"`     // Quantity dropped
	Name         string            `json:"name"`         // Name of the item
	ID           string            `json:"id"`           // Iternal ID
	Compensation *Item             `json:"compensation"` // Compensation in case the player already have the item
	Attributes   map[string]string `json:"attributes"`   // map of attributes (ex: {"tier": "X"})
}

type ItemCategory

type ItemCategory struct {
	Name                string   `json:"name"`                   // Name of the drop category
	ID                  string   `json:"id"`                     // Iternal ID
	DropRate            float64  `json:"drop_rate"`              // Drop Rate (percentage)
	Collectable         bool     `json:"collectable"`            // If true, If the player already have one of the items, it will be removed from the list of items which can drop
	Pitiable            bool     `json:"pitiable"`               // If true, this item is part of the pity mechanic
	DropRateTransfersTo []string `json:"drop_rate_transfers_to"` // List of Categories the drop rate transfers to if player already has all items
	Items               []*Item  `json:"items"`                  // List of items to get
}

type ItemShort

type ItemShort struct {
	Name       string            `json:"name"`       // Name of the item
	ID         string            `json:"id"`         // Iternal ID
	Attributes map[string]string `json:"attributes"` // map of attributes (ex: {"tier": "X"})
}

type ItemShortQuantity

type ItemShortQuantity struct {
	Quantity   uint64            `json:"quantity"`   // Quantity of this item dropped
	Name       string            `json:"name"`       // Name of the item
	ID         string            `json:"id"`         // Iternal ID
	Attributes map[string]string `json:"attributes"` // map of attributes (ex: {"tier": "X"})
}

type ItemShortQuantityFloat

type ItemShortQuantityFloat struct {
	Quantity   float64           `json:"quantity"`   // Quantity of this item dropped
	Name       string            `json:"name"`       // Name of the item
	ID         string            `json:"id"`         // Iternal ID
	Attributes map[string]string `json:"attributes"` // map of attributes (ex: {"tier": "X"})
}

type LootBox

type LootBox struct {
	Name               string                     `json:"name"`
	Img                string                     `json:"img"`
	Weight             int                        `json:"weight"`
	ID                 string                     `json:"id"`
	Drops              []map[string]*ItemCategory `json:"drops"`
	Pity               uint64                     `json:"pity"`
	Price              float64                    `json:"price"`
	ExchangeRateEuro   float64                    `json:"exchange_rate_euro"`
	ExchangeRateDollar float64                    `json:"exchange_rate_dollar"`
	// contains filtered or unexported fields
}

func NewLootBoxFromCSVs

func NewLootBoxFromCSVs(filePaths []string, name string, price float64, compensation *Item) (*LootBox, error)

func NewLootBoxFromJson

func NewLootBoxFromJson(filePath string) (*LootBox, error)

func (*LootBox) AddCollectable

func (lb *LootBox) AddCollectable(collectable string)

func (*LootBox) Draw

func (lb *LootBox) Draw(isPity bool) (drawResult []DrawResult, err error)

func (*LootBox) GetRemainingCollectables

func (lb *LootBox) GetRemainingCollectables() []string

func (*LootBox) Init

func (lb *LootBox) Init()

func (*LootBox) IsCollectable

func (lb *LootBox) IsCollectable(target string) bool

func (*LootBox) ListCollectables

func (lb *LootBox) ListCollectables() (ret []*ItemShort)

func (*LootBox) NewWhalingSession

func (lb *LootBox) NewWhalingSession(collectables []string) (*WhalingSession, error)

func (*LootBox) NewWhalingStatsSession

func (lb *LootBox) NewWhalingStatsSession(collectables []string) *WhalingStatsSession

func (*LootBox) RefreshDrawTree

func (lb *LootBox) RefreshDrawTree() error

func (*LootBox) RemoveOwnedCollectablesFromDropableItems

func (lb *LootBox) RemoveOwnedCollectablesFromDropableItems()

func (*LootBox) Transfer

func (lb *LootBox) Transfer(index int, cat *ItemCategory, substitute *Item)

type WhalingInput

type WhalingInput struct {
	SessionType    sessionType
	Target         string
	Quantity       int
	WhalingSession *WhalingStatsSession
	OutChannel     chan *WhalingSession
}

type WhalingSession

type WhalingSession struct {
	SimulationType string `json:"simulation_type"`
	Target         string `json:"target"`

	ContainerOpened  uint64                       `json:"container_opened"`
	Pities           uint64                       `json:"pities"`
	Spent            float64                      `json:"game_money_spent"`
	SpentEuro        float64                      `json:"euro_spent"`
	SpentDollar      float64                      `json:"dollar_spent"`
	CollectableItems []*ItemShort                 `json:"collectables_items"`
	OtherItems       []*ItemShortQuantity         `json:"other_items"`
	ByAttribute      map[string]map[string]uint64 `json:"by_attributes"`
	// contains filtered or unexported fields
}

func (*WhalingSession) Draw

func (ws *WhalingSession) Draw() (*ItemShort, error)

func (*WhalingSession) Finalize

func (ws *WhalingSession) Finalize()

func (*WhalingSession) RemainingCollectables

func (ws *WhalingSession) RemainingCollectables() []string

func (*WhalingSession) SimpleWhaling

func (ws *WhalingSession) SimpleWhaling(counter int) error

func (*WhalingSession) TargetWhaling

func (ws *WhalingSession) TargetWhaling(target string) error

type WhalingStatsSession

type WhalingStatsSession struct {
	SimulationType           string                             `json:"simulation_type"`
	Target                   string                             `json:"target"`
	Opened                   uint64                             `json:"total_opened"`
	SessionCounter           uint64                             `json:"session_count"`
	OpenedEach               []uint64                           `json:"opened_each"`
	ByAttributeEach          []map[string]map[string]uint64     `json:"by_attribute_each"`
	AverageByItem            map[string]*ItemShortQuantityFloat `json:"avg_by_item"`
	AverageByAttribute       map[string]map[string]float64      `json:"avg_by_attribute"`
	ContainterOpened         uint64                             `json:"session_opened"`
	AverageOpened            float64                            `json:"avg_opened"`
	AverageSpent             float64                            `json:"avg_game_money_spent"`
	AverageSpentDollar       float64                            `json:"avg_euro_spent"`
	AverageSpentEuro         float64                            `json:"avg_dollar_spent"`
	AveragePities            float64                            `json:"avg_pities"`
	AverageCollectablesItems float64                            `json:"avg_collectable_items"`
	Percentiles              map[string]uint64                  `json:"percentiles_open"`
	// contains filtered or unexported fields
}

func (*WhalingStatsSession) StatsSimpleWhaling

func (wss *WhalingStatsSession) StatsSimpleWhaling(count int) error

func (*WhalingStatsSession) StatsTargetWhaling

func (wss *WhalingStatsSession) StatsTargetWhaling(target string) error

Jump to

Keyboard shortcuts

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