init: mvp
This commit is contained in:
commit
e307989b9f
20 changed files with 835 additions and 0 deletions
41
internal/entity/boosts/boosts.go
Normal file
41
internal/entity/boosts/boosts.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue