| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- // Code generated by excel export. DO NOT EDIT.
- package data
- import (
- "f1-game/internal/types"
- )
- var ChapterLevel = &chapterLevelConfig{}
- func init() {
- _allList = append(_allList, ChapterLevel)
- }
- type (
- ChapterLevelRow struct {
- ChapterID int32 `json:"ChapterID"` // 所属章节
- ID int32 `json:"ID"` // 关卡ID
- UnlockID int32 `json:"UnlockID"` // 前置关卡ID
- LevelType int32 `json:"LevelType"` // 关卡类型
- MonsterGroupID int32 `json:"MonsterGroupID"` // 怪物组ID
- CostStamina types.Assets `json:"CostStamina"` // 挑战消耗精力值
- DayChallengeCount int32 `json:"DayChallengeCount"` // 每日可挑战次数
- DayCanBuyTimes int32 `json:"DayCanBuyTimes"` // 每日可购买次数
- Conditions types.List[int32] `json:"Conditions"` // 星级条件
- FixedRewards types.Assets `json:"FixedRewards"` // 固定奖励
- FirstReward types.Assets `json:"FirstReward"` // 首通奖励
- RandomRewardPools types.PairList[int32, int] `json:"RandomRewardPools"` // 随机奖励库
- BattleSceneID uint32 `json:"BattleSceneID"` // 战场地图ID
- }
- chapterLevelConfig struct {
- baseConfig
- list []*ChapterLevelRow // all list
- idUniMaps map[int32]*ChapterLevelRow // key:id
- chapterIDIDUniMaps map[int32]map[int32]*ChapterLevelRow // key:chapterID, id
- }
- )
- func (p *chapterLevelConfig) Name() string {
- return "chapter_level"
- }
- func (p *chapterLevelConfig) Init() {
- p.idUniMaps = map[int32]*ChapterLevelRow{}
- p.chapterIDIDUniMaps = map[int32]map[int32]*ChapterLevelRow{}
- }
- func (p *chapterLevelConfig) OnLoad(maps interface{}, reload bool) (int, error) {
- if reload && p.denyLoad {
- return 0, nil
- }
- var list []*ChapterLevelRow
- if err := DecodeData(maps, &list); err != nil {
- return 0, err
- }
- p.list = list
- idUniMaps := map[int32]*ChapterLevelRow{}
- for _, row := range list {
- idUniMaps[row.ID] = row
- }
- p.idUniMaps = idUniMaps
- chapterIDIDUniMaps := map[int32]map[int32]*ChapterLevelRow{}
- for _, row := range list {
- itemMap := chapterIDIDUniMaps[row.ChapterID]
- if itemMap == nil {
- itemMap = map[int32]*ChapterLevelRow{}
- chapterIDIDUniMaps[row.ChapterID] = itemMap
- }
- itemMap[row.ID] = row
- }
- p.chapterIDIDUniMaps = chapterIDIDUniMaps
- return len(list), nil
- }
- // func (p *chapterLevelConfig) OnAfterLoad(_ bool) {
- // }
- func (p *chapterLevelConfig) List() []*ChapterLevelRow {
- return p.list
- }
- func (p *chapterLevelConfig) GetByID(id int32) (*ChapterLevelRow, bool) {
- value, found := p.idUniMaps[id]
- return value, found
- }
- func (p *chapterLevelConfig) ContainID(id int32) bool {
- _, found := p.idUniMaps[id]
- return found
- }
- func (p *chapterLevelConfig) GetByChapterIDID(chapterID int32, id int32) (*ChapterLevelRow, bool) {
- mapItem, found := p.chapterIDIDUniMaps[chapterID]
- if !found {
- return nil, false
- }
- value, found := mapItem[id]
- return value, found
- }
- func (p *chapterLevelConfig) ContainChapterIDID(chapterID int32, id int32) bool {
- mapItem, found := p.chapterIDIDUniMaps[chapterID]
- if !found {
- return false
- }
- _, found = mapItem[id]
- return found
- }
|