| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var Vip = &vipConfig{}
- func init() {
- _allList = append(_allList, Vip)
- }
- type (
- VipRow struct {
- Level int32 `json:"Level"` // 等级
- Exp int64 `json:"Exp"` // 升至下级所需点数
- DailyBox types.Assets `json:"DailyBox"` // 每日宝箱
- SpecialBox types.Assets `json:"SpecialBox"` // 专属宝箱
- SpecialBoxChargeID int32 `json:"SpecialBoxChargeID"` // 专属宝箱充值ID
- Attrs types.Attrs `json:"Attrs"` // 特权加成
- }
- vipConfig struct {
- baseConfig
- list []*VipRow // all list
- levelUniMaps map[int32]*VipRow // key:level
- specialBoxChargeIDUniMaps map[int32]*VipRow // key:specialBoxChargeID
- }
- )
- func (p *vipConfig) Name() string {
- return "vip"
- }
- func (p *vipConfig) Init() {
- p.levelUniMaps = map[int32]*VipRow{}
- p.specialBoxChargeIDUniMaps = map[int32]*VipRow{}
- }
- func (p *vipConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*VipRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- levelUniMaps := map[int32]*VipRow{}
- for _, row := range list {
- levelUniMaps[row.Level] = row
- }
- p.levelUniMaps = levelUniMaps
- specialBoxChargeIDUniMaps := map[int32]*VipRow{}
- for _, row := range list {
- specialBoxChargeIDUniMaps[row.SpecialBoxChargeID] = row
- }
- p.specialBoxChargeIDUniMaps = specialBoxChargeIDUniMaps
- return len(list), nil
- }
- // func (p *vipConfig) OnAfterLoad(_ bool) {
- // }
- func (p *vipConfig) List() []*VipRow {
- return p.list
- }
- func (p *vipConfig) GetByLevel(level int32) (*VipRow, bool) {
- value, found := p.levelUniMaps[level]
- return value, found
- }
- func (p *vipConfig) ContainLevel(level int32) bool {
- _, found := p.levelUniMaps[level]
- return found
- }
- func (p *vipConfig) GetBySpecialBoxChargeID(specialBoxChargeID int32) (*VipRow, bool) {
- value, found := p.specialBoxChargeIDUniMaps[specialBoxChargeID]
- return value, found
- }
- func (p *vipConfig) ContainSpecialBoxChargeID(specialBoxChargeID int32) bool {
- _, found := p.specialBoxChargeIDUniMaps[specialBoxChargeID]
- return found
- }
|