cfg_newarea_offerreward_post.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ---@class cfg_newarea_offerreward_post @注释
  2. ---@field groupInfo table<number,cfg_newarea_offerreward_column[]>
  3. cfg_newarea_offerreward_post = class()
  4. local this = cfg_newarea_offerreward_post
  5. this.isInit = false
  6. this.levelInfo = {}
  7. this.groupRewardInfo = {}
  8. this.groupInfo = {}
  9. ---@return void @使用时才调用
  10. --- 存储需要展示的人物属性l
  11. function this.InitOnUse()
  12. if this.isInit then
  13. return
  14. end
  15. this.isInit = true
  16. local cfg = SL:GetConfigTable('cfg_newarea_offerreward')
  17. if cfg then
  18. ---@param v cfg_newarea_offerreward_column
  19. for k, v in pairs(cfg) do
  20. if not table.contains(this.levelInfo,v.level) then
  21. table.insert(this.levelInfo,v.level)
  22. end
  23. if not this.groupRewardInfo[v.level] then
  24. this.groupRewardInfo[v.level] = v.groupReward
  25. end
  26. if not this.groupInfo[v.level] then
  27. this.groupInfo[v.level] = {}
  28. end
  29. table.insert(this.groupInfo[v.level],v)
  30. end
  31. end
  32. end
  33. function this.GetLevelInfo()
  34. return this.levelInfo
  35. end
  36. function this.GetGroupRewardInfo()
  37. return this.groupRewardInfo
  38. end
  39. function this.GetGroupInfo()
  40. return this.groupInfo
  41. end
  42. ---@return cfg_newarea_offerreward_column
  43. function this.GetCfgByMonsterId(id)
  44. return SL:GetConfig("cfg_newarea_offerreward",id,"monsterId")
  45. end
  46. function this.GetGroupIdByLevel(level)
  47. if not this.groupInfo[level][1] then
  48. SL:LogError("cfg_newarea_offerreward level="..level.."没有数据")
  49. return
  50. end
  51. return this.groupInfo[level][1].group
  52. end
  53. ---@return cfg_newarea_offerreward_column[]
  54. function this.GetLevelMonsterInfo(level)
  55. if not this.groupInfo[level] then
  56. SL:LogError("cfg_newarea_offerreward level="..level.."没有数据")
  57. return
  58. end
  59. return this.groupInfo[level]
  60. end
  61. this.InitOnUse()