season_quest.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. import (
  4. "f1-game/internal/enum"
  5. "f1-game/internal/types"
  6. )
  7. var SeasonQuest = &seasonQuestConfig{}
  8. func init() {
  9. _allList = append(_allList, SeasonQuest)
  10. }
  11. type (
  12. SeasonQuestRow struct {
  13. ID int32 `json:"ID"` // 霸业ID
  14. NextID int32 `json:"NextID"` // 下一个霸业ID
  15. QuestType enum.SeasonQuestType `json:"QuestType"` // 任务类型
  16. QuestParams types.List[int32] `json:"QuestParams"` // 任务参数
  17. Rewards types.Assets `json:"Rewards"` // 任务奖励
  18. QuestDuration int64 `json:"QuestDuration"` // 任务时长(分)
  19. UnlockFunc types.List[int32] `json:"UnlockFunc"` // 解锁功能
  20. }
  21. seasonQuestConfig struct {
  22. baseConfig
  23. list []*SeasonQuestRow // all list
  24. idUniMaps map[int32]*SeasonQuestRow // key:id
  25. }
  26. )
  27. func (p *seasonQuestConfig) Name() string {
  28. return "season_quest"
  29. }
  30. func (p *seasonQuestConfig) Init() {
  31. p.idUniMaps = map[int32]*SeasonQuestRow{}
  32. }
  33. func (p *seasonQuestConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  34. if reload && p.denyLoad {
  35. return 0, nil
  36. }
  37. var list []*SeasonQuestRow
  38. if err := DecodeData(maps, &list); err != nil {
  39. return 0, err
  40. }
  41. p.list = list
  42. idUniMaps := map[int32]*SeasonQuestRow{}
  43. for _, row := range list {
  44. idUniMaps[row.ID] = row
  45. }
  46. p.idUniMaps = idUniMaps
  47. return len(list), nil
  48. }
  49. // func (p *seasonQuestConfig) OnAfterLoad(_ bool) {
  50. // }
  51. func (p *seasonQuestConfig) List() []*SeasonQuestRow {
  52. return p.list
  53. }
  54. func (p *seasonQuestConfig) GetByID(id int32) (*SeasonQuestRow, bool) {
  55. value, found := p.idUniMaps[id]
  56. return value, found
  57. }
  58. func (p *seasonQuestConfig) ContainID(id int32) bool {
  59. _, found := p.idUniMaps[id]
  60. return found
  61. }