DragonSoulSkillInfo.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ---@class DragonSoulSkillInfo @注释
  2. DragonSoulSkillInfo = class()
  3. local this = DragonSoulSkillInfo
  4. function this:ctor()
  5. end
  6. function this:Reset()
  7. self.gameStart = false
  8. self.comboSkillCfgId = nil
  9. self.comboSkillLevel = nil
  10. self.lateSkillEffectId = nil
  11. end
  12. function this:Init()
  13. self:InitData()
  14. self:RegistMessages()
  15. end
  16. function this:InitData()
  17. self.gameStart = false
  18. end
  19. function this:RegistMessages()
  20. SL:RegisterLuaNetMsg(MessageDef.ResComboSkillInfoMessage, self.ResComboSkillInfoMessage, self)
  21. SL:RegisterLUAEvent(LUA_EVENT_ENTRY_MAP_LOADING_PANEL_CLOSE, self.LUA_EVENT_ENTER_MAP, self)
  22. SL:RegisterLuaNetMsg(LuaMessageIdToClient.RES_COMBO_SKILL_MODEL_VIEW, self.RES_COMBO_SKILL_MODEL_VIEW, self)
  23. SL:RegisterLUAEvent(LUA_EVENT_BAG_CHANGE_AFTER, self.LUA_EVENT_BAG_CHANGE_AFTER, self)
  24. SL:RegisterLUAEvent(LUA_EVENT_MONEYCHANGE, self.LUA_EVENT_BAG_CHANGE_AFTER, self)
  25. end
  26. ---连击级发生变化,刷新玩家身上特效
  27. function this:ResComboSkillInfoMessage(_, message)
  28. if self.comboSkillCfgId ~= message.skillCfgId or self.comboSkillLevel ~= message.skillLv then
  29. if self.comboSkillCfgId then
  30. SL:SetMetaValue(EMetaVarSetKey.RECYCLE_EFFECT_ON_ROLE, self.skillInfo.haloEffect)
  31. end
  32. self.comboSkillCfgId = message.skillCfgId
  33. self.comboSkillLevel = message.skillLv
  34. ---@type cfg_skill_info_column
  35. self.skillInfo = SL:GetConfigMultiKeys('cfg_skill_info', self.comboSkillCfgId, self.comboSkillLevel, 'skillID', 'skillLevel')
  36. if self.gameStart then
  37. SL:SetMetaValue(EMetaVarSetKey.SET_EFFECT_ON_ROLE, SL:GetMetaValue(EMetaVarGetKey.MAIN_ACTOR_ID), self.skillInfo.haloEffect, nil, true, EPlayEffectOverType.Loop)
  38. end
  39. end
  40. SL:RefreshPanelALLRedStateKmlByCondition("checkComboSkillUpgrade")
  41. end
  42. function this:RES_COMBO_SKILL_MODEL_VIEW(_, message)
  43. if message["1"] then
  44. ---@type cfg_skill_info_column
  45. local skillInfo = SL:GetConfigMultiKeys('cfg_skill_info', tonumber(message["2"]), tonumber(message["3"]), 'skillID', 'skillLevel')
  46. if skillInfo and skillInfo.haloEffect > 0 then
  47. if self.lateSkillEffectId then
  48. SL:SetMetaValue(EMetaVarSetKey.RECYCLE_EFFECT_ON_ROLE, tonumber(message["1"]), self.lateSkillEffectId)
  49. end
  50. SL:SetMetaValue(EMetaVarSetKey.SET_EFFECT_ON_ROLE, tonumber(message["1"]), skillInfo.haloEffect, nil, true, EPlayEffectOverType.Loop)
  51. self.lateSkillEffectId = skillInfo.haloEffect
  52. end
  53. end
  54. end
  55. function this:LUA_EVENT_BAG_CHANGE_AFTER()
  56. SL:RefreshPanelALLRedStateKmlByCondition("checkComboSkillUpgrade")
  57. end
  58. function this:LUA_EVENT_ENTER_MAP()
  59. self.gameStart = true
  60. if self.comboSkillCfgId then
  61. SL:SetMetaValue(EMetaVarSetKey.SET_EFFECT_ON_ROLE, SL:GetMetaValue(EMetaVarGetKey.MAIN_ACTOR_ID), self.skillInfo.haloEffect, nil, true, EPlayEffectOverType.Loop)
  62. end
  63. end
  64. function this:GetRedPointShowStateInMainPanel()
  65. local comboSkillCfgId
  66. local comboSkillLevel
  67. if self.comboSkillCfgId and self.comboSkillCfgId > 0 then
  68. ---激活
  69. comboSkillCfgId = self.comboSkillCfgId
  70. comboSkillLevel = self.comboSkillLevel
  71. else
  72. ---未激活
  73. local job = SL:GetMetaValue(EMetaVarGetKey.JOB)
  74. local skill_str = SL:GetConfig("cfg_global", 1501).value
  75. local skillTbl = string.split(skill_str, '|') --1#1030001#1#0|2#1030002#1#0|3#1030003#1#0
  76. for i, v in pairs(skillTbl) do
  77. local tbl = string.split(v, '#')
  78. if tonumber(tbl[1]) == job then
  79. comboSkillCfgId = tonumber(tbl[2])
  80. comboSkillLevel = 0
  81. break
  82. end
  83. end
  84. end
  85. ---@type cfg_skill_info_column
  86. local skillInfo = SL:GetConfigMultiKeys('cfg_skill_info', comboSkillCfgId, comboSkillLevel + 1, 'skillID', 'skillLevel')
  87. if skillInfo then
  88. for i, v in pairs(skillInfo.skillLevelUpItemID) do
  89. if SL:GetBagItemCount(v[1]) < v[2] then
  90. return false
  91. end
  92. end
  93. else
  94. return false
  95. end
  96. return true
  97. end