// Code generated by excel export. DO NOT EDIT. package data var DropPool = &dropPoolConfig{} func init() { _allList = append(_allList, DropPool) } type ( DropPoolRow struct { ID int32 `json:"ID"` // ID ItemID int32 `json:"ItemID"` // 道具ID Num int64 `json:"Num"` // 数量 Weight int32 `json:"Weight"` // 权重 } dropPoolConfig struct { baseConfig list []*DropPoolRow // all list idListMaps map[int32][]*DropPoolRow // key:id } ) func (p *dropPoolConfig) Name() string { return "drop_pool" } func (p *dropPoolConfig) Init() { p.idListMaps = map[int32][]*DropPoolRow{} } func (p *dropPoolConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*DropPoolRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list idListMaps := map[int32][]*DropPoolRow{} for _, row := range list { idListMaps[row.ID] = append(idListMaps[row.ID], row) } p.idListMaps = idListMaps return len(list), nil } // func (p *dropPoolConfig) OnAfterLoad(_ bool) { // } func (p *dropPoolConfig) List() []*DropPoolRow { return p.list } func (p *dropPoolConfig) ListByID(id int32) ([]*DropPoolRow, bool) { value, found := p.idListMaps[id] return value, found } func (p *dropPoolConfig) ListContainID(id int32) bool { _, found := p.idListMaps[id] return found }