Browse Source

圣者遗物红点异常问题

niexx 1 year ago
parent
commit
d15c84f67e
1 changed files with 15 additions and 16 deletions
  1. 15 16
      script/module/winnerRelic/WinnerRelicLogic.lua

+ 15 - 16
script/module/winnerRelic/WinnerRelicLogic.lua

@@ -65,18 +65,16 @@ local function dotJudgment(human, cfgHtbl)
         -- print("当前遗物等级",nLevel)
         if nLevel == nil or nLevel == 0 then
             if BagLogic.getItemCnt(human, relicCfg.nProp) >= 1 then
-                print("当前包含红点")
                 return true
             end
-        elseif nLevel +1 < 10 then
-            local num = relicUpgradeConfig and relicUpgradeConfig[nLevel +1] and relicUpgradeConfig[nLevel +1].costNum or 0
+        elseif nLevel +1 <= 10 then
+            local num = relicUpgradeConfig and relicUpgradeConfig[nLevel +1] and relicUpgradeConfig[nLevel +1].CostNum or 0
             if BagLogic.getItemCnt(human, relicCfg.nProp) >= num then
-                print("当前包含红点")
                 return true
             end
         end
     end
-    print("当前不包含红点")
+    -- print("当前不包含红点")
     return false
 end
 
@@ -170,7 +168,7 @@ function Listofrelics(human)
 end
 
 function ActiveandUpgrade(human,relicId)
-    print("开始激活圣者遗物")
+    -- print("开始激活圣者遗物")
     local relicCfg = relicDataConfig[relicId]
     if not relicCfg then
         return Broadcast.sendErr(human, Lang.COMMON_COMFIG_ERROR)
@@ -225,7 +223,7 @@ function ActiveandUpgrade(human,relicId)
         RelicData.effectMaxData[i] = replaceValueMax
     end
     RelicData.type = relicCfg.nType or {}
-    local costNum = nextStar <= 10 and relicUpgradeConfig and relicUpgradeConfig[nextStar] and relicUpgradeConfig[nextStar].CostNum or 0
+    local costNum = nextStar+1 <= 10 and relicUpgradeConfig and relicUpgradeConfig[nextStar+1] and relicUpgradeConfig[nextStar+1].CostNum or 0
     Grid.makeItem(RelicData.upGradeCost, relicCfg.nProp, costNum)
     RelicData.upGradeCost.cnt = costNum or 0
     RelicData.starLevel = nextStar or 0
@@ -257,9 +255,10 @@ function ActiveandUpgrade(human,relicId)
     RoleAttr.cleanHeroAttrCache(human)
     RoleAttr.doCalc(human)
     ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
-    --刷新红点,当所有可激活遗物均已被激活时
-
-    if not dotJudgment(human, relicDataConfig) then
+    --刷新红点,
+    nextStar = nextStar + 1
+    costNum = nextStar <= 10 and relicUpgradeConfig and relicUpgradeConfig[nextStar] and relicUpgradeConfig[nextStar].CostNum or 0
+    if nextStar > 10 or BagLogic.getItemCnt(human, costItemId) < costNum then
         local dotID = 0
         if relicCfg.nType  == 1 then
             dotID = RoleSystemDefine.ROLE_SYS_ID_2022
@@ -275,7 +274,7 @@ function ActiveandUpgrade(human,relicId)
 end
 
 function putmsg(human,RelicData,relicCfg,oldid,isexist)
-    print("当前进入给old赋值")
+    -- print("当前进入给old赋值")
     local relicId = oldid
     if isexist then
         RelicData.id = oldid
@@ -327,7 +326,7 @@ function putmsg(human,RelicData,relicCfg,oldid,isexist)
         RelicData.heroIdx = {}  -- 先初始化为空表
         RelicData.heroIdx[0] = 0
     end
-    print("当前结束old赋值")
+    -- print("当前结束old赋值")
 end
 -- 装备/卸下圣者遗物
 
@@ -385,7 +384,7 @@ function EquipeandRemove(human, heroID, heroIdx, relicId, operate)
         if LEN and LEN >= NumLimit then
           return Broadcast.sendErr(human, Lang.RELIC_EQUIP_LIMIT)
         end
-        print("当前进入装备操作")
+        -- print("当前进入装备操作")
         -- 如果当前英雄已经装备了遗物
         human.db.relicListData.equipped = human.db.relicListData.equipped or {}
         human.db.relicListData.equipped[relicId] = human.db.relicListData.equipped[relicId] or {}
@@ -414,13 +413,13 @@ function EquipeandRemove(human, heroID, heroIdx, relicId, operate)
                 end
             end
             table.insert(human.db.relicListData.equipped[relicId],heroIdx)
-            print("成功装备遗物", relicId, "给英雄", heroIdx)
+            -- print("成功装备遗物", relicId, "给英雄", heroIdx)
        end
        heroGrid.relic = heroGrid.relic or {}
        heroGrid.relic.relicID = relicId
        heroGrid.relic.star = human.db.relicListData and human.db.relicListData.status and human.db.relicListData.status[relicId] or 0
 
-       print("成功装备遗物", relicId, "给英雄", heroIdx,"当前遗物星级为",heroGrid.relic.star)
+    --    print("成功装备遗物", relicId, "给英雄", heroIdx,"当前遗物星级为",heroGrid.relic.star)
     else
         if human.db.relicListData and human.db.relicListData.equipped and human.db.relicListData.equipped[relicId] then
             for idx,rid in pairs(human.db.relicListData.equipped[relicId]) do
@@ -488,7 +487,7 @@ function EquipeandRemove(human, heroID, heroIdx, relicId, operate)
     Msg.send(tMsgData, human.fd)
     --重算战力
     HeroLogic.sendHeroBagUpdate(human,heroIdx)
-    print("圣者遗物装备完毕")
+    -- print("圣者遗物装备完毕")
     ObjHuman.doCalcHero(human, heroIdx)
 	
 	HeroLogic.sendHeroBagDynamic(human, heroID, heroIdx)