package scratchcard import ( "active/tools" "fmt" ) var ScratchardConf = &ScratchardConfig{} type ScratchardConfig struct { CardTotal int64 `json:"card_total" yaml:"card_total"` CardRate []int64 `json:"card_rate" yaml:"card_rate"` CardNumber []int64 `json:"card_number" yaml:"card_number"` GetCardLimit int64 `json:"get_card_limit" yaml:"get_card_limit"` WatchAdLimit int64 `json:"watch_ad_limit" yaml:"watch_ad_limit"` ALLSend int64 `json:"all_send" yaml:"all_send"` BigPrizeList []int `json:"big_prize_list" yaml:"big_prize_list"` ItemsList []struct { Rate int64 `json:"rate" yaml:"rate"` Random [][]int64 `json:"random" yaml:"random"` Items [][]int64 `json:"items" yaml:"items"` Level int64 `json:"level" yaml:"level"` Limit int64 `json:"limit" yaml:"limit"` ToLink int64 `json:"to_link" yaml:"to_link"` BigPrize int64 `json:"big_prize" yaml:"big_prize"` } `json:"items_list" yaml:"items_list"` ItemTotal int64 `json:"item_total"` HelpLimit int64 `json:"help_limit" yaml:"help_limit"` } func (this *ScratchardConfig) ReloadConf() { tools.ReloadYaml("scrathcard.yaml", this) var rate int64 for i := range this.CardRate { rate += this.CardRate[i] this.CardRate[i] = rate } rate = 0 for i := range this.ItemsList { rate += this.ItemsList[i].Rate this.ItemsList[i].Rate = rate } this.ItemTotal = rate fmt.Printf("fff %+v\n", *this) }