| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var QuestAchievePool = &questAchievePoolConfig{}
- func init() {
- _allList = append(_allList, QuestAchievePool)
- }
- type (
- QuestAchievePoolRow struct {
- PoolID int32 `json:"PoolID"` // 库ID
- ChapterID int32 `json:"ChapterID"` // 章节ID
- QuestGroupIDs types.List[int32] `json:"QuestGroupIDs"` // 任务组ID列表
- }
- questAchievePoolConfig struct {
- baseConfig
- list []*QuestAchievePoolRow // all list
- poolIDListMaps map[int32][]*QuestAchievePoolRow // key:poolID
- poolIDChapterIDUniMaps map[int32]map[int32]*QuestAchievePoolRow // key:poolID, chapterID
- }
- )
- func (p *questAchievePoolConfig) Name() string {
- return "quest_achieve_pool"
- }
- func (p *questAchievePoolConfig) Init() {
- p.poolIDListMaps = map[int32][]*QuestAchievePoolRow{}
- p.poolIDChapterIDUniMaps = map[int32]map[int32]*QuestAchievePoolRow{}
- }
- func (p *questAchievePoolConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*QuestAchievePoolRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- poolIDListMaps := map[int32][]*QuestAchievePoolRow{}
- for _, row := range list {
- poolIDListMaps[row.PoolID] = append(poolIDListMaps[row.PoolID], row)
- }
- p.poolIDListMaps = poolIDListMaps
- poolIDChapterIDUniMaps := map[int32]map[int32]*QuestAchievePoolRow{}
- for _, row := range list {
- itemMap := poolIDChapterIDUniMaps[row.PoolID]
- if itemMap == nil {
- itemMap = map[int32]*QuestAchievePoolRow{}
- poolIDChapterIDUniMaps[row.PoolID] = itemMap
- }
- itemMap[row.ChapterID] = row
- }
- p.poolIDChapterIDUniMaps = poolIDChapterIDUniMaps
- return len(list), nil
- }
- // func (p *questAchievePoolConfig) OnAfterLoad(_ bool) {
- // }
- func (p *questAchievePoolConfig) List() []*QuestAchievePoolRow {
- return p.list
- }
- func (p *questAchievePoolConfig) ListByPoolID(poolID int32) ([]*QuestAchievePoolRow, bool) {
- value, found := p.poolIDListMaps[poolID]
- return value, found
- }
- func (p *questAchievePoolConfig) ListContainPoolID(poolID int32) bool {
- _, found := p.poolIDListMaps[poolID]
- return found
- }
- func (p *questAchievePoolConfig) GetByPoolIDChapterID(poolID int32, chapterID int32) (*QuestAchievePoolRow, bool) {
- mapItem, found := p.poolIDChapterIDUniMaps[poolID]
- if !found {
- return nil, false
- }
- value, found := mapItem[chapterID]
- return value, found
- }
- func (p *questAchievePoolConfig) ContainPoolIDChapterID(poolID int32, chapterID int32) bool {
- mapItem, found := p.poolIDChapterIDUniMaps[poolID]
- if !found {
- return false
- }
- _, found = mapItem[chapterID]
- return found
- }
|