recruit.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. import (
  4. "f1-game/internal/types"
  5. )
  6. var Recruit = &recruitConfig{}
  7. func init() {
  8. _allList = append(_allList, Recruit)
  9. }
  10. type (
  11. RecruitRow struct {
  12. ID int32 `json:"ID"` // ID
  13. CostItemID int32 `json:"CostItemID"` // 消耗道具ID
  14. CostX1 int32 `json:"CostX1"` // 单抽消耗
  15. CostX5 int32 `json:"CostX5"` // 五连消耗
  16. CostX10 int32 `json:"CostX10"` // 十连消耗
  17. Rewards types.Assets `json:"Rewards"` // 奖励
  18. NormalPool int32 `json:"NormalPool"` // 卡池ID
  19. MidFloorNum int32 `json:"MidFloorNum"` // 小保底次数
  20. MidFloorPool int32 `json:"MidFloorPool"` // 小保底池
  21. FinalFloorNum int32 `json:"FinalFloorNum"` // 大保底次数
  22. FinalFloorPool int32 `json:"FinalFloorPool"` // 大保底池
  23. }
  24. recruitConfig struct {
  25. baseConfig
  26. list []*RecruitRow // all list
  27. idUniMaps map[int32]*RecruitRow // key:id
  28. }
  29. )
  30. func (p *recruitConfig) Name() string {
  31. return "recruit"
  32. }
  33. func (p *recruitConfig) Init() {
  34. p.idUniMaps = map[int32]*RecruitRow{}
  35. }
  36. func (p *recruitConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  37. if reload && p.denyLoad {
  38. return 0, nil
  39. }
  40. var list []*RecruitRow
  41. if err := DecodeData(maps, &list); err != nil {
  42. return 0, err
  43. }
  44. p.list = list
  45. idUniMaps := map[int32]*RecruitRow{}
  46. for _, row := range list {
  47. idUniMaps[row.ID] = row
  48. }
  49. p.idUniMaps = idUniMaps
  50. return len(list), nil
  51. }
  52. // func (p *recruitConfig) OnAfterLoad(_ bool) {
  53. // }
  54. func (p *recruitConfig) List() []*RecruitRow {
  55. return p.list
  56. }
  57. func (p *recruitConfig) GetByID(id int32) (*RecruitRow, bool) {
  58. value, found := p.idUniMaps[id]
  59. return value, found
  60. }
  61. func (p *recruitConfig) ContainID(id int32) bool {
  62. _, found := p.idUniMaps[id]
  63. return found
  64. }