// Code generated by excel export. DO NOT EDIT. package data var GenPool = &genPoolConfig{} func init() { _allList = append(_allList, GenPool) } type ( GenPoolRow struct { ID int32 `json:"ID"` // 产出池ID ItemID int32 `json:"ItemID"` // 道具ID Num int64 `json:"Num"` // 数量 TimeType int32 `json:"TimeType"` // 间隔时间类型 } genPoolConfig struct { baseConfig list []*GenPoolRow // all list idListMaps map[int32][]*GenPoolRow // key:id idItemIDUniMaps map[int32]map[int32]*GenPoolRow // key:id, itemID } ) func (p *genPoolConfig) Name() string { return "gen_pool" } func (p *genPoolConfig) Init() { p.idListMaps = map[int32][]*GenPoolRow{} p.idItemIDUniMaps = map[int32]map[int32]*GenPoolRow{} } func (p *genPoolConfig) OnLoad(maps interface{}, reload bool) (int, error) { if reload && p.denyLoad { return 0, nil } var list []*GenPoolRow if err := DecodeData(maps, &list); err != nil { return 0, err } p.list = list idListMaps := map[int32][]*GenPoolRow{} for _, row := range list { idListMaps[row.ID] = append(idListMaps[row.ID], row) } p.idListMaps = idListMaps idItemIDUniMaps := map[int32]map[int32]*GenPoolRow{} for _, row := range list { itemMap := idItemIDUniMaps[row.ID] if itemMap == nil { itemMap = map[int32]*GenPoolRow{} idItemIDUniMaps[row.ID] = itemMap } itemMap[row.ItemID] = row } p.idItemIDUniMaps = idItemIDUniMaps return len(list), nil } // func (p *genPoolConfig) OnAfterLoad(_ bool) { // } func (p *genPoolConfig) List() []*GenPoolRow { return p.list } func (p *genPoolConfig) ListByID(id int32) ([]*GenPoolRow, bool) { value, found := p.idListMaps[id] return value, found } func (p *genPoolConfig) ListContainID(id int32) bool { _, found := p.idListMaps[id] return found } func (p *genPoolConfig) GetByIDItemID(id int32, itemID int32) (*GenPoolRow, bool) { mapItem, found := p.idItemIDUniMaps[id] if !found { return nil, false } value, found := mapItem[itemID] return value, found } func (p *genPoolConfig) ContainIDItemID(id int32, itemID int32) bool { mapItem, found := p.idItemIDUniMaps[id] if !found { return false } _, found = mapItem[itemID] return found }