item_chest.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Code generated by excel export. DO NOT EDIT.
  2. package data
  3. var ItemChest = &itemChestConfig{}
  4. func init() {
  5. _allList = append(_allList, ItemChest)
  6. }
  7. type (
  8. ItemChestRow struct {
  9. ID int32 `json:"ID"` // ID
  10. DropPoolID int32 `json:"DropPoolID"` // 掉落ID
  11. UseType int32 `json:"UseType"` // 使用类型
  12. }
  13. itemChestConfig struct {
  14. baseConfig
  15. list []*ItemChestRow // all list
  16. idUniMaps map[int32]*ItemChestRow // key:id
  17. }
  18. )
  19. func (p *itemChestConfig) Name() string {
  20. return "item_chest"
  21. }
  22. func (p *itemChestConfig) Init() {
  23. p.idUniMaps = map[int32]*ItemChestRow{}
  24. }
  25. func (p *itemChestConfig) OnLoad(maps interface{}, reload bool) (int, error) {
  26. if reload && p.denyLoad {
  27. return 0, nil
  28. }
  29. var list []*ItemChestRow
  30. if err := DecodeData(maps, &list); err != nil {
  31. return 0, err
  32. }
  33. p.list = list
  34. idUniMaps := map[int32]*ItemChestRow{}
  35. for _, row := range list {
  36. idUniMaps[row.ID] = row
  37. }
  38. p.idUniMaps = idUniMaps
  39. return len(list), nil
  40. }
  41. // func (p *itemChestConfig) OnAfterLoad(_ bool) {
  42. // }
  43. func (p *itemChestConfig) List() []*ItemChestRow {
  44. return p.list
  45. }
  46. func (p *itemChestConfig) GetByID(id int32) (*ItemChestRow, bool) {
  47. value, found := p.idUniMaps[id]
  48. return value, found
  49. }
  50. func (p *itemChestConfig) ContainID(id int32) bool {
  51. _, found := p.idUniMaps[id]
  52. return found
  53. }