WinnerRelicLogic.lua 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. local Msg = require("core.Msg")
  2. local CommonDB = require("common.CommonDB")
  3. local relicModule = require("excel.ServerRelic")
  4. local Grid = require("bag.Grid")
  5. local BagLogic = require("bag.BagLogic")
  6. local RoleAttr = require("role.RoleAttr")
  7. local ObjHuman = require("core.ObjHuman")
  8. local RoleDefine = require("role.RoleDefine")
  9. local Lang = require("common.Lang")
  10. local Broadcast = require("broadcast.Broadcast")
  11. local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  12. local HeroConfig = require("excel.hero").hero
  13. local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
  14. local HeroLogic = require("hero.HeroLogic")
  15. local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
  16. local LOGTYPE = "WinnerRelic"
  17. local relicUpgradeConfig = relicModule.RelicUpgrade -- 获取升级配置表
  18. local relicDataConfig = relicModule.RelicData -- 获取遗物数据表
  19. local COND_TOWER_LEVEL = 500 --开启本系统需要通关恶魔之塔的层数
  20. --[[
  21. DB =
  22. {{
  23. -- 激活状态
  24. status ={
  25. --{[1601] = 3,(star级别)
  26. --[1602] = 0,
  27. }
  28. -- 装备状态(整合到同一命名空间)
  29. --equipped = {
  30. [1601] = {heoidx, heoidx}
  31. -- }}
  32. ]]
  33. --判断是否开启圣者遗物
  34. function isOpen(human)
  35. local towerLevel = HuanJingTowerLogic.getTowerLevel(human)
  36. if towerLevel >= COND_TOWER_LEVEL then
  37. return true
  38. end
  39. return false
  40. end
  41. -- 获取对应类型的遗物
  42. local function generateCfgByType(type_m)
  43. local tbl = {}
  44. for relicId, relicCfg in pairs(relicDataConfig) do
  45. if relicCfg.nType == type_m then
  46. tbl[relicId] = relicCfg
  47. end
  48. end
  49. if not next(tbl) then
  50. return nil
  51. end
  52. return tbl
  53. end
  54. -- 填充协议
  55. -- 红点判断
  56. local function dotJudgment(human, cfgHtbl)
  57. local relicData = human.db.relicListData
  58. for relicId, relicCfg in pairs(cfgHtbl) do
  59. local nLevel = 0
  60. if relicData and relicData.status and relicData.status[relicId] then
  61. nLevel = relicData.status[relicId]
  62. end
  63. if nLevel == 0 and nLevel <= 10 then
  64. if BagLogic.getItemCnt(human, relicCfg.nProp) >= 1 then
  65. return true
  66. end
  67. end
  68. end
  69. return false
  70. end
  71. local function AddTableAttr(tNode, tConfig, tConfig2)
  72. tNode[0] = 4
  73. tNode[1].key = tConfig.HP
  74. tNode[1].value = tConfig2.nLife
  75. tNode[2].key = tConfig.ATK
  76. tNode[2].value= tConfig2.nAttack
  77. tNode[3].key = tConfig.DEF
  78. tNode[3].value = tConfig2.nDefense
  79. tNode[4].key = tConfig.SPEED
  80. tNode[4].value = tConfig2.nSpeed
  81. end
  82. function Listofrelics(human)
  83. local tMsgData = Msg.gc.GC_SACRED_RELIC_QUERY
  84. local RelicConfigs = tMsgData.SacredRelicConfigs
  85. local relicData = human.db.relicListData or {} --数据库
  86. relicData.status = relicData.status or {}
  87. relicData.equipped = relicData.equipped or {}
  88. RelicConfigs[0] = 0
  89. local len = 0
  90. for relicId, relicCfg in pairs(relicDataConfig) do
  91. len = len + 1
  92. RelicConfigs[0] = len
  93. local playerRelicData = (relicData and relicData.status and relicData.status[relicId]) or 0 -- 默认未激活
  94. local currentStar = playerRelicData or 0
  95. local msgEntry = RelicConfigs[len]
  96. -- 基础属性
  97. msgEntry.id = relicId
  98. msgEntry.name = relicCfg.nName
  99. msgEntry.activateItem = relicCfg.nProp
  100. AddTableAttr(msgEntry.attr, RoleDefine, relicCfg)
  101. AddTableAttr(msgEntry.nextattr, RoleDefine, relicCfg)
  102. msgEntry.effectDesc = relicCfg.nEffectdescription
  103. local bonusValues = {}
  104. if relicCfg.nLifeBonus then table.insert(bonusValues, relicCfg.nLifeBonus) end
  105. if relicCfg.nAttackBonus then table.insert(bonusValues, relicCfg.nAttackBonus) end
  106. if relicCfg.nDefenseBonus then table.insert(bonusValues, relicCfg.nDefenseBonus) end
  107. if relicCfg.nSpeedBonus then table.insert(bonusValues, relicCfg.nSpeedBonus) end
  108. msgEntry.effectData[0] = 4
  109. msgEntry.effectNextData[0] = 4
  110. msgEntry.effectMaxData[0] = 4
  111. for i, bonusArray in ipairs(bonusValues) do
  112. local replaceValue = currentStar > 0 and bonusArray[currentStar] or 0
  113. local replaceValueNext = currentStar + 1 > 0 and currentStar + 1 <= 10 and bonusArray[currentStar+1] or 0
  114. local replaceValueMax = bonusArray and bonusArray[10] or 0
  115. -- effectDesc = string.gsub(effectDesc, "X%%", tostring(replaceValue).."%%", 1)
  116. msgEntry.effectData[i] = replaceValue
  117. msgEntry.effectNextData[i] = replaceValueNext
  118. msgEntry.effectMaxData[i] = replaceValueMax
  119. end
  120. msgEntry.type = relicCfg.nType
  121. local nextStar = currentStar + 1
  122. local costNum = nextStar <= 10 and relicUpgradeConfig and relicUpgradeConfig[nextStar] and relicUpgradeConfig[nextStar].CostNum or 0
  123. Grid.makeItem(msgEntry.upGradeCost, relicCfg.nProp, costNum)
  124. msgEntry.upGradeCost.cnt = costNum or 0
  125. msgEntry.starLevel = currentStar or 0
  126. -- print("当前下发的遗物等级为:",currentStar)
  127. -- print("当前各种遗物的星级",msgEntry.starLevel)
  128. if relicUpgradeConfig and relicUpgradeConfig[currentStar] then
  129. msgEntry.equipLimit = relicUpgradeConfig[currentStar].EquipHeroNum or 0
  130. else
  131. msgEntry.equipLimit = 0
  132. end
  133. if relicData and relicData.equipped and relicData.equipped[relicId] then
  134. msgEntry.heroIdx[0] = #relicData.equipped[relicId]
  135. for idx, rid in ipairs(relicData.equipped[relicId]) do
  136. msgEntry.heroIdx[idx] = rid
  137. end
  138. else
  139. msgEntry.heroIdx = {} -- 先初始化为空表
  140. msgEntry.heroIdx[0] = 0
  141. end
  142. end
  143. Msg.send(tMsgData, human.fd)
  144. end
  145. function ActiveandUpgrade(human,relicId)
  146. print("开始激活圣者遗物11111111111111111")
  147. -- 基础校验
  148. if not isOpen(human) then
  149. return Broadcast.sendErr(human, Lang.COMMOM_NOT_ENABLED)
  150. end
  151. local relicCfg = relicDataConfig[relicId]
  152. if not relicCfg then
  153. return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
  154. end
  155. human.db.relicListData = human.db.relicListData or {}
  156. human.db.relicListData.status = human.db.relicListData.status or {}
  157. local relicData=human.db.relicListData
  158. local playerRelicData = relicData and relicData.status and relicData.status[relicId] or 0
  159. local currentStar = playerRelicData or 0
  160. -- 检查是否已达到最大星级
  161. if currentStar >=10 then
  162. return Broadcast.sendErr(human, Lang.COMMON_MAX_LEVEL)
  163. end
  164. local nextStar = currentStar +1
  165. print("激活/升级,当前取得遗物的星级为",currentStar)
  166. print("激活/升级,当前遗物下一星级",nextStar)
  167. if nextStar > 10 or not relicUpgradeConfig or not relicUpgradeConfig[nextStar] then
  168. return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
  169. end
  170. local costItemId = relicCfg and relicCfg.nProp
  171. local costNum = relicUpgradeConfig and relicUpgradeConfig[nextStar] and relicUpgradeConfig[nextStar].CostNum or 0
  172. if not costItemId or BagLogic.getItemCnt(human, costItemId) < costNum then
  173. return Broadcast.sendErr(human, Lang.COMMON_ITEM_NOT_ENOUGH)
  174. end
  175. BagLogic.delItem(human, costItemId, costNum, LOGTYPE)
  176. --更新数据
  177. playerRelicData = nextStar or 0
  178. human.db.relicListData.status = human.db.relicListData.status or {}
  179. human.db.relicListData.status[relicId] = playerRelicData
  180. print("当前今激活或升级后存入数据库的星级",playerRelicData)
  181. --返回数据
  182. local tMsgData = Msg.gc.GC_SACRED_RELIC_UPGRADE
  183. local RelicData = tMsgData.data or {}
  184. RelicData.id = relicId
  185. RelicData.name = relicCfg.nName
  186. RelicData.activateItem = relicCfg.nProp
  187. AddTableAttr(RelicData.attr, RoleDefine, relicCfg)
  188. AddTableAttr(RelicData.nextattr, RoleDefine, relicCfg)
  189. local bonusValues = {}
  190. RelicData.effectDesc = relicCfg.nEffectdescription
  191. if relicCfg.nLifeBonus then table.insert(bonusValues, relicCfg.nLifeBonus) end
  192. if relicCfg.nAttackBonus then table.insert(bonusValues, relicCfg.nAttackBonus) end
  193. if relicCfg.nDefenseBonus then table.insert(bonusValues, relicCfg.nDefenseBonus) end
  194. if relicCfg.nSpeedBonus then table.insert(bonusValues, relicCfg.nSpeedBonus) end
  195. RelicData.effectData[0] = 4
  196. RelicData.effectNextData[0] = 4
  197. RelicData.effectMaxData[0] = 4
  198. for i, bonusArray in ipairs(bonusValues) do
  199. local replaceValue = currentStar > 0 and bonusArray[currentStar] or 0
  200. local replaceValueNext = currentStar + 1 > 0 and currentStar + 1 <= 10 and bonusArray[currentStar+1] or 0
  201. local replaceValueMax = bonusArray and bonusArray[10] or 0
  202. -- effectDesc = string.gsub(effectDesc, "X%%", tostring(replaceValue).."%%", 1)
  203. RelicData.effectData[i] = replaceValue
  204. RelicData.effectNextData[i] = replaceValueNext
  205. RelicData.effectMaxData[i] = replaceValueMax
  206. end
  207. RelicData.type = relicCfg.nType or {}
  208. local costNum = nextStar <= 10 and relicUpgradeConfig and relicUpgradeConfig[nextStar] and relicUpgradeConfig[nextStar].CostNum or 0
  209. Grid.makeItem(RelicData.upGradeCost, relicCfg.nProp, costNum)
  210. RelicData.upGradeCost.cnt = costNum or 0
  211. RelicData.starLevel = nextStar or 0
  212. if relicUpgradeConfig and relicUpgradeConfig[nextStar] then
  213. RelicData.equipLimit = relicUpgradeConfig[nextStar].EquipHeroNum or 0
  214. else
  215. RelicData.equipLimit = 0
  216. end
  217. if relicData and relicData.equipped and relicData.equipped[relicId] then
  218. RelicData.heroIdx[0] = #relicData.equipped[relicId]
  219. for idx, rid in ipairs(relicData.equipped[relicId]) do
  220. RelicData.heroIdx[idx] = rid
  221. end
  222. else
  223. RelicData.heroIdx = {} -- 先初始化为空表
  224. RelicData.heroIdx[0] = 0
  225. end
  226. -- tMsgData = relicData
  227. Msg.send(tMsgData, human.fd)
  228. --重算战力
  229. RoleAttr.cleanHeroAttrCache(human)
  230. RoleAttr.doCalc(human)
  231. ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
  232. --刷新红点,当所有可激活遗物均已被激活时
  233. if not dotJudgment(human, relicDataConfig) then
  234. local dotID = 0
  235. if relicCfg.nType == 1 then
  236. dotID = RoleSystemDefine.ROLE_SYS_ID_2022
  237. elseif relicCfg.nType == 2 then
  238. dotID = RoleSystemDefine.ROLE_SYS_ID_2023
  239. elseif relicCfg.nType == 3 then
  240. dotID = RoleSystemDefine.ROLE_SYS_ID_2024
  241. end
  242. RoleSystemLogic.onDot(human, dotID)
  243. --刷新入口处
  244. RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_2021)
  245. end
  246. end
  247. -- 装备/卸下圣者遗物
  248. function EquipeandRemove(human, heroID, heroIdx, relicId, operate)
  249. local relicCfg = relicDataConfig and relicDataConfig[relicId]
  250. local playerRelicData = human.db.relicListData and human.db.relicListData.status and human.db.relicListData.status[relicId] or 0
  251. local currentStar = playerRelicData or 0
  252. -- 检查系统是否开启
  253. if not isOpen(human) then
  254. return Broadcast.sendErr(human, Lang.COMMON_NOT_OPEN)
  255. end
  256. --检查英雄是否存在
  257. local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIdx)
  258. if not heroGrid then
  259. return Broadcast.sendErr(human, Lang.HERO_NOT_EXIST)
  260. end
  261. --检查英雄是否达到14星
  262. if heroGrid.star < 14 then
  263. return Broadcast.sendErr(human, Lang.SACRED_RELIC_HERO_LEVEL_LIMIT)
  264. end
  265. -- 初始化遗物数据
  266. human.db.relicListData = human.db.relicListData or {}
  267. local relicData =human.db.relicListData or {}
  268. -- 装备操作
  269. local tMsgData = Msg.gc.GC_SACRED_RELIC_EQUIP
  270. local RelicData = tMsgData.olddata
  271. tMsgData.heroIdx = heroIdx
  272. RelicData.id = relicId
  273. RelicData.name = relicCfg.nName
  274. RelicData.activateItem = relicCfg.nProp
  275. AddTableAttr(RelicData.attr, RoleDefine, relicCfg)
  276. AddTableAttr(RelicData.nextattr, RoleDefine, relicCfg)
  277. RelicData.effectDesc = relicCfg.nEffectdescription
  278. local bonusValues = {}
  279. if relicCfg.nLifeBonus then table.insert(bonusValues, relicCfg.nLifeBonus) end
  280. if relicCfg.nAttackBonus then table.insert(bonusValues, relicCfg.nAttackBonus) end
  281. if relicCfg.nDefenseBonus then table.insert(bonusValues, relicCfg.nDefenseBonus) end
  282. if relicCfg.nSpeedBonus then table.insert(bonusValues, relicCfg.nSpeedBonus) end
  283. RelicData.effectData[0] = 4
  284. RelicData.effectNextData[0] = 4
  285. RelicData.effectMaxData[0] = 4
  286. for i, bonusArray in ipairs(bonusValues) do
  287. local replaceValue = currentStar > 0 and bonusArray[currentStar] or 0
  288. local replaceValueNext = currentStar + 1 > 0 and currentStar + 1 <= 10 and bonusArray[currentStar+1] or 0
  289. local replaceValueMax = bonusArray and bonusArray[10] or 0
  290. -- effectDesc = string.gsub(effectDesc, "X%%", tostring(replaceValue).."%%", 1)
  291. RelicData.effectData[i] = replaceValue
  292. RelicData.effectNextData[i] = replaceValueNext
  293. RelicData.effectMaxData[i] = replaceValueMax
  294. end
  295. RelicData.type = relicCfg.nType
  296. local costNum = currentStar+1 <= 10 and relicUpgradeConfig and relicUpgradeConfig[currentStar+1] and relicUpgradeConfig[currentStar+1].CostNum or 0
  297. Grid.makeItem(RelicData.upGradeCost, relicCfg.nProp, costNum)
  298. RelicData.upGradeCost.cnt = costNum or 0
  299. RelicData.starLevel = currentStar or 0
  300. if relicUpgradeConfig and relicUpgradeConfig[currentStar] then
  301. RelicData.equipLimit = relicUpgradeConfig[currentStar].EquipHeroNum or 0
  302. else
  303. RelicData.equipLimit = 0
  304. end
  305. -- 填充已装备英雄信息
  306. if relicData and relicData.equipped and relicData.equipped[relicId] then
  307. RelicData.heroIdx[0] = #relicData.equipped[relicId]
  308. for idx, rid in ipairs(relicData.equipped[relicId]) do
  309. RelicData.heroIdx[idx] = rid
  310. end
  311. else
  312. RelicData.heroIdx = {} -- 先初始化为空表
  313. RelicData.heroIdx[0] = 0
  314. end
  315. if operate == 1 then
  316. print("当前进入装备操作")
  317. -- 如果当前英雄已经装备了遗物
  318. human.db.relicListData.equipped = human.db.relicListData.equipped or {}
  319. human.db.relicListData.equipped[relicId] = human.db.relicListData.equipped[relicId] or {}
  320. -- 遍历找到对应的英雄索引并移除
  321. for i, equippedHeroIdx in ipairs(human.db.relicListData.equipped[relicId]) do
  322. if equippedHeroIdx == heroIdx then
  323. table.remove(human.db.relicListData.equipped[relicId], i)
  324. break
  325. end
  326. end
  327. print("当前进入装备操作22222")
  328. heroGrid.relic = {}
  329. local LEN = human.db.relicListData and human.db.relicListData.equipped and human.db.relicListData.equipped[relicId] and #human.db.relicListData.equipped[relicId]
  330. local star = human.db and human.db.relicListData and human.db.relicListData[relicId] or 0
  331. print("当前进入装备操作kkkkkkkkkkk",star)
  332. local NumLimit = relicUpgradeConfig and relicUpgradeConfig[star] and relicUpgradeConfig[star].EquipHeroNum or 0
  333. if LEN and LEN >= 5 then
  334. return Broadcast.sendErr(human, Lang.SACRED_RELIC_HERO_LEVEL_LIMIT)
  335. end
  336. if not human.db.relicListData.equipped[relicId] then
  337. human.db.relicListData.equipped[relicId] = {} -- 初始化
  338. end
  339. print("当前进入装备操作33333")
  340. if human.db.relicListData and human.db.relicListData.equipped and human.db.relicListData.equipped[relicId] then
  341. local alreadyExist = false
  342. for _, idx in ipairs(human.db.relicListData.equipped[relicId]) do
  343. if idx == heroIdx then
  344. alreadyExist = true
  345. break
  346. end
  347. end
  348. if not alreadyExist then
  349. table.insert(human.db.relicListData.equipped[relicId],heroIdx)
  350. print("成功装备遗物", relicId, "给英雄", heroIdx)
  351. else
  352. print("英雄已装备该遗物,无需重复操作", heroIdx, relicId)
  353. end
  354. end
  355. print("当前进入装备操作4444")
  356. heroGrid.relic = heroGrid.relic or {}
  357. heroGrid.relic.relicID = relicId
  358. heroGrid.relic.star = human.db.relicListData.status[relicId] or 0
  359. print("当前遗物装备完毕",heroGrid.relic.relicID)
  360. else
  361. for idx,rid in pairs(human.db.relicListData.equipped[relicId]) do
  362. if rid == heroIdx then
  363. table.remove(human.db.relicListData.equipped[relicId],idx)
  364. break
  365. end
  366. return Broadcast.sendErr(human, Lang.SACRED_RELIC_HERO_LEVEL_LIMIT)
  367. end
  368. end
  369. -- 获取更新之后的数据
  370. print("11111111111111111111111111111111ggg")
  371. local nRelicData = tMsgData.newdata
  372. nRelicData.id = relicId
  373. nRelicData.name = relicCfg.nName
  374. nRelicData.activateItem = relicCfg.nProp
  375. AddTableAttr(nRelicData.attr, RoleDefine, relicCfg)
  376. AddTableAttr(nRelicData.nextattr, RoleDefine, relicCfg)
  377. nRelicData.effectDesc = relicCfg.nEffectdescription
  378. local bonusValues = {}
  379. if relicCfg.nLifeBonus then table.insert(bonusValues, relicCfg.nLifeBonus) end
  380. if relicCfg.nAttackBonus then table.insert(bonusValues, relicCfg.nAttackBonus) end
  381. if relicCfg.nDefenseBonus then table.insert(bonusValues, relicCfg.nDefenseBonus) end
  382. if relicCfg.nSpeedBonus then table.insert(bonusValues, relicCfg.nSpeedBonus) end
  383. nRelicData.effectData[0] = 4
  384. nRelicData.effectNextData[0] = 4
  385. nRelicData.effectMaxData[0] = 4
  386. for i, bonusArray in ipairs(bonusValues) do
  387. local replaceValue = currentStar > 0 and bonusArray[currentStar] or 0
  388. local replaceValueNext = currentStar + 1 > 0 and currentStar + 1 <= 10 and bonusArray[currentStar+1] or 0
  389. local replaceValueMax = bonusArray and bonusArray[10] or 0
  390. -- effectDesc = string.gsub(effectDesc, "X%%", tostring(replaceValue).."%%", 1)
  391. nRelicData.effectData[i] = replaceValue
  392. nRelicData.effectNextData[i] = replaceValueNext
  393. nRelicData.effectMaxData[i] = replaceValueMax
  394. end
  395. nRelicData.type = relicCfg.nType
  396. local costNum = currentStar+1 <= 10 and relicUpgradeConfig and relicUpgradeConfig[currentStar+1] and relicUpgradeConfig[currentStar+1].CostNum or 0
  397. Grid.makeItem(RelicData.upGradeCost, relicCfg.nProp, costNum)
  398. nRelicData.upGradeCost.cnt = costNum or 0
  399. nRelicData.starLevel = currentStar or 0
  400. if relicUpgradeConfig and relicUpgradeConfig[currentStar] then
  401. nRelicData.equipLimit = relicUpgradeConfig[currentStar].EquipHeroNum or 0
  402. else
  403. nRelicData.equipLimit = 0
  404. end
  405. -- 填充已装备英雄信息
  406. if relicData and relicData.equipped and relicData.equipped[relicId] then
  407. nRelicData.heroIdx[0] = #relicData.equipped[relicId]
  408. print("当前长度111111111111111111",nRelicData.heroIdx[0])
  409. for idx, rid in ipairs(relicData.equipped[relicId]) do
  410. nRelicData.heroIdx[idx] = rid
  411. end
  412. else
  413. nRelicData.heroIdx = {} -- 先初始化为空表
  414. nRelicData.heroIdx[0] = 0
  415. end
  416. Msg.send(tMsgData, human.fd)
  417. --重算战力
  418. HeroLogic.sendHeroBagUpdate(human,heroIdx)
  419. -- table.print_lua_table(tMsgData)
  420. print("圣者遗物装备完毕")
  421. RoleAttr.cleanHeroAttrCache(human)
  422. RoleAttr.doCalc(human)
  423. ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
  424. end
  425. -- 遗物对英雄属性加成
  426. function doCalcHero(heroGrid,addAttrs)
  427. if not heroGrid or not heroGrid.relic then
  428. return
  429. end
  430. local relicid = heroGrid.relic and heroGrid.relic.relicID
  431. local star = heroGrid.relic and heroGrid.relic.star
  432. local Life,Attack,Defense,Speed = 0, 0, 0, 0
  433. local relicData = relicDataConfig[relicid]
  434. Life = relicData and relicData.nLifeBonus and relicData.nLifeBonus[star] or 0
  435. Attack = relicData and relicData.nAttackBonus and relicData.nAttackBonus[star] or 0
  436. Life = relicData and relicData.nDefenseBonus and relicData.nDefenseBonus[star] or 0
  437. Life = relicData and relicData.nSpeedBonus and relicData.nSpeedBonus[star] or 0
  438. RoleAttr.updateValue(RoleDefine.HP,Life,addAttrs)
  439. RoleAttr.updateValue(RoleDefine.ATK,Attack,addAttrs)
  440. RoleAttr.updateValue(RoleDefine.DEF,Defense,addAttrs)
  441. RoleAttr.updateValue(RoleDefine.SPEED,Speed,addAttrs)
  442. end
  443. --红点
  444. function isDot(human, dotConfig)
  445. if not isOpen(human) then
  446. return false
  447. end
  448. --入口处的红点判断
  449. if dotConfig.id == RoleSystemDefine.ROLE_SYS_ID_2021 then
  450. return dotJudgment(human, relicDataConfig)
  451. else
  452. --单个分页的红点
  453. local RelicType = 0
  454. if dotConfig.id == RoleSystemDefine.ROLE_SYS_ID_2022 then
  455. RelicType = 1
  456. elseif dotConfig.id == RoleSystemDefine.ROLE_SYS_ID_2023 then
  457. RelicType = 2
  458. elseif dotConfig.id == RoleSystemDefine.ROLE_SYS_ID_2024 then
  459. RelicType = 3
  460. end
  461. local cfgHtbl = generateCfgByType(RelicType)
  462. if not cfgHtbl then
  463. return 1
  464. end
  465. return dotJudgment(human, cfgHtbl)
  466. end
  467. end