WolfSoulFortressInfo.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ---@class WolfSoulFortressInfo
  2. ---@field cfgTabel cfg_rep_column[]
  3. ---@field activityId number @活动id
  4. ---@field activityCfg cfg_activity_rule_column @活动表
  5. ---@field nowWolfSoulFortressCfg cfg_rep_column @最后一次获取的表数据(防止在副本中升级先存起来)
  6. ---@field nowWolfSoulCfg cfg_wolf_soul_column @最后一次获取的表数据(防止在副本中升级先存起来)
  7. ---@field wolf_soulTable cfg_wolf_soul_column[] @狼魂要塞相关参数表
  8. ---@field nextStateTime number @阶段时间
  9. ---@field nextStateTime_2 number @结束时间
  10. ---@field summonCount number @召唤了几个守护
  11. ---@field rankInfos {success:boolean,list:{score:number,career:number,level:number,name:string,rank:number,rid:string}[]}
  12. ---@field isEnter boolean @是否进入副本
  13. ---@field success boolean @是否守护成功
  14. WolfSoulFortressInfo = class()
  15. local this = WolfSoulFortressInfo
  16. function this:ctor()
  17. end
  18. function this:Init()
  19. self.activityId = EActivityType.WolfSoulFortress
  20. self.cfgTabel = {}
  21. self.wolf_soulTable = {}
  22. ---@ type cfg_rep_column[]
  23. local repTable = SL:GetConfigTable("cfg_rep")
  24. ---@ type cfg_wolf_soul_column[]
  25. local tempWolfTable = SL:GetConfigTable("cfg_wolf_soul")
  26. for k, v in pairs(repTable) do
  27. if v.type == self.activityId then
  28. self.cfgTabel[v.id] = v
  29. end
  30. end
  31. for k, v in pairs(tempWolfTable) do
  32. self.wolf_soulTable[v.id] = v
  33. end
  34. self.summonCount = 0
  35. self:InitData()
  36. self:RegistMessages()
  37. end
  38. function this:InitData()
  39. end
  40. function this:RegistMessages()
  41. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_WOLF_SOUL_STATE, self.RES_WOLF_SOUL_STATE, self)
  42. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_WOLF_SOUL_FIGHT_PANEL, self.RES_WOLF_SOUL_FIGHT_PANEL, self)
  43. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_WOLF_SOUL_PREPARE_PANEL, self.RES_WOLF_SOUL_PREPARE_PANEL, self)
  44. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_WOLF_SOUL_SETTLEMENT_PANEL, self.RES_WOLF_SOUL_SETTLEMENT_PANEL, self)
  45. end
  46. ---@param message {success:boolean,list:{score:number,career:number,level:number,name:string,rank:number,rid:string}[]}
  47. function this:RES_WOLF_SOUL_SETTLEMENT_PANEL(_,message)
  48. self.rankInfos = message
  49. self.success = message.success
  50. GUI:UIPanel_Open("dev/outui/Activity/Panel/KLWolfSoulFortressScore/KLWolfSoulFortressScorePanel",nil,nil,message)
  51. end
  52. ---@param message {"1":雕像HP万分比, "2":积分,"3":排名 , "4":下一波时间}
  53. function this:RES_WOLF_SOUL_FIGHT_PANEL(_, message)
  54. end
  55. ---@param message {"1":副本id, "2":哪个阶段,"3":下个阶段的时间}
  56. function this:RES_WOLF_SOUL_STATE(_, message)
  57. local id = message["1"]
  58. self.nowWolfSoulFortressCfg = self.cfgTabel[id]
  59. self.nowWolfSoulCfg = self.wolf_soulTable[id]
  60. self.state = message["2"]
  61. self.nextStateTime = message["3"]
  62. self.nextStateTime_2 = 0
  63. self.isEnter = true
  64. if self.state ~= 1 then
  65. self.nextStateTime_2 = message["3"]
  66. end
  67. end
  68. ---@param message {"1":召唤数量}
  69. function this:RES_WOLF_SOUL_PREPARE_PANEL(_, message)
  70. self.summonCount = message["1"]
  71. end
  72. ---@return cfg_rep_column
  73. function this:GetCfgByOpenServerDay()
  74. local openServerDay = SL:GetOpenServerDay()
  75. for k, v in pairs(self.cfgTabel) do
  76. local minDay = self.wolf_soulTable[k].numberDay[1]
  77. local maxDay = self.wolf_soulTable[k].numberDay[2]
  78. if openServerDay >= minDay and openServerDay <= maxDay then
  79. self.nowWolfSoulFortressCfg = v
  80. self.nowWolfSoulCfg = self.wolf_soulTable[k]
  81. end
  82. end
  83. return self.nowWolfSoulFortressCfg
  84. end
  85. function this:GetNowRankReward(rank)
  86. if not self.nowWolfSoulCfg then
  87. return
  88. end
  89. local temp = {}
  90. local rewardCfg = {}
  91. if self.success then
  92. rewardCfg = self.nowWolfSoulCfg.victoryReward
  93. else
  94. rewardCfg = self.nowWolfSoulCfg.defeatReward
  95. end
  96. ---名次上限#名次上限#道具id#道具数量#道具id#道具数量|
  97. for k, v in pairs(rewardCfg) do
  98. local rankUp = v[1]
  99. local rankDown = v[2]
  100. if rank >= rankUp and rank <= rankDown then
  101. temp = v
  102. break
  103. end
  104. end
  105. local reward = {}
  106. for i = 3, #temp, 2 do
  107. local itemId = temp[i]
  108. local itemCount = temp[i + 1]
  109. table.insert(reward, { itemId = itemId, itemCount = itemCount })
  110. end
  111. return reward
  112. end
  113. function this:Reset()
  114. end