You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
653 B
38 lines
653 B
package models
|
|
|
|
type StatEntry struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Weight float64 `json:"weight"`
|
|
}
|
|
|
|
type StatProgressEntry struct {
|
|
StatEntry
|
|
|
|
Acquired int `json:"acquired"`
|
|
Required int `json:"required"`
|
|
}
|
|
|
|
type Stat struct {
|
|
StatEntry
|
|
|
|
Description string `json:"description"`
|
|
AllowedAmounts map[string]int `json:"allowedAmounts"`
|
|
}
|
|
|
|
func (stat *Stat) AllowsAmount(amount int) bool {
|
|
if stat == nil {
|
|
return false
|
|
}
|
|
if stat.AllowedAmounts == nil || len(stat.AllowedAmounts) == 0 {
|
|
return true
|
|
}
|
|
|
|
for _, v := range stat.AllowedAmounts {
|
|
if v == amount {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|