init: mvp

This commit is contained in:
Arthur Khachaturov 2024-08-17 01:20:24 +03:00
commit e307989b9f
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
20 changed files with 835 additions and 0 deletions

View file

@ -0,0 +1,41 @@
package boosts
type Item struct {
ID string `json:"id"`
Price int `json:"price"`
EarnPerTap int `json:"earnPerTap"`
MaxTaps int `json:"maxTaps"`
CooldownSeconds *int `json:"cooldownSeconds"`
TotalCooldownSeconds *int `json:"totalCooldownSeconds"`
Level int `json:"level"`
MaxTapsDelta int `json:"maxTapsDelta"`
EarnPerTapDelta int `json:"earnPerTapDelta"`
MaxLevel *int `json:"maxLevel,omitempty"`
}
func (i *Item) Tick() {
if i.TotalCooldownSeconds != nil && *i.TotalCooldownSeconds > 0 {
(*i.TotalCooldownSeconds)--
}
}
type Boosts []*Item
type Response struct {
Boosts `json:"boostsForBuy"`
}
func (b *Boosts) Tick() {
for _, el := range *b {
el.Tick()
}
}
func (b *Boosts) SelectById(id string) *Item {
for _, i := range *b {
if i.ID == id {
return i
}
}
return nil
}