Parcourir la source

神威灵装红点修改

gitxsm il y a 2 mois
Parent
commit
951d061221
2 fichiers modifiés avec 59 ajouts et 17 suppressions
  1. 58 17
      script/module/hero/HeroArtifacts.lua
  2. 1 0
      script/module/hero/Proto.lua

+ 58 - 17
script/module/hero/HeroArtifacts.lua

@@ -403,6 +403,38 @@ local function updatePowerAndRedDot(human, heroGrid, heroID, heroIndex)
     updateHeroAttr(human, heroID, heroIndex)
 end
 
+-- 能否升级
+local function isCanUpGradeLv(human, heroGrid)
+    local artifactsData = getArtifactsData(heroGrid)
+    local currentLevel = artifactsData and artifactsData.level or 0
+    local maxLevel = HeroArtifactsConfig.UpGradeLv[#HeroArtifactsConfig.UpGradeLv].level
+
+    if currentLevel < maxLevel then
+        local itemId, itemCnt = getNextStageCost(currentLevel, 1)
+        if BagLogic.getItemCnt(human, itemId) >= itemCnt then
+            return true
+        end
+    end
+
+    return false
+end
+
+-- 能否升星
+local function isCanUpGradeStar(human, heroGrid)
+    local artifactsData = getArtifactsData(heroGrid)
+    local currentStar = artifactsData and artifactsData.star or 0
+    local maxStar = HeroArtifactsConfig.UpGradeStar[#HeroArtifactsConfig.UpGradeStar].star
+
+    if currentStar < maxStar then
+        local itemId, itemCnt = getNextStageCost(currentStar, 2)
+        if BagLogic.getItemCnt(human, itemId) >= itemCnt then
+            return true
+        end
+    end
+
+    return false
+end
+
 
 
 
@@ -541,24 +573,12 @@ function isArtifactsDot(human, heroGrid)
         return false
     end
 
-    local artifactsData = getArtifactsData(heroGrid)
-
-    local currentLevel = artifactsData and artifactsData.level or 0
-    local maxLevel = HeroArtifactsConfig.UpGradeLv[#HeroArtifactsConfig.UpGradeLv].level
-    if currentLevel < maxLevel then
-        local itemId, itemCnt = getNextStageCost(currentLevel, 1)
-        if BagLogic.getItemCnt(human, itemId) >= itemCnt then
-            return true
-        end
+    if isCanUpGradeLv(human, heroGrid) then
+        return true
     end
 
-    local currentStar = artifactsData and artifactsData.star or 0
-    local maxStar = HeroArtifactsConfig.UpGradeStar[#HeroArtifactsConfig.UpGradeStar].star
-    if currentStar < maxStar then
-        local itemId, itemCnt = getNextStageCost(currentStar, 2)
-        if BagLogic.getItemCnt(human, itemId) >= itemCnt then
-            return true
-        end
+    if isCanUpGradeStar(human, heroGrid) then
+        return true
     end
 
     return false
@@ -631,7 +651,10 @@ function HeroArtifacts_Base_Query(human, heroID, heroIndex)
     msgRet.nowStarAttrs[0] = 0
     msgRet.effectArr[0] = 0
     msgRet.beSkillArr[0] = 0
-    msgRet.isActivate = isActivate(heroGrid) and 1 or 0
+    msgRet.isActivate = 0
+    msgRet.redDotArr[0] = 2
+    msgRet.redDotArr[1] = 0
+    msgRet.redDotArr[2] = 0
 
     populateActivateCostMsg(msgRet.ActivateCost)
     populateTotalAttrMsg(msgRet.nowLevelAttrs, currentLevel, 1)
@@ -643,6 +666,18 @@ function HeroArtifacts_Base_Query(human, heroID, heroIndex)
 
     populateBeSkillMsg(msgRet.beSkillArr, artifactsData and artifactsData.beSkillArr)
 
+    if isActivate(heroGrid) then
+        msgRet.isActivate = 1
+
+        if isCanUpGradeLv(human, heroGrid) then
+            msgRet.redDotArr[1] = 1
+        end
+
+        if isCanUpGradeStar(human, heroGrid) then
+            msgRet.redDotArr[2] = 1
+        end
+    end
+
     Msg.send(msgRet, human.fd)
 end
 
@@ -672,6 +707,8 @@ function HeroArtifacts_Activate(human, heroID, heroIndex)
 
     HeroArtifacts_Base_Query(human, heroID, heroIndex)
 
+    updateHeroAttr(human, heroID, heroIndex)
+
     -- 弹窗礼包
     GiftLogic = GiftLogic or require("topup.GiftLogic")
     GiftLogic.trigger(human, GiftLogic.GIFT_ARTIFACTS_OPEN, {currentVal = 0}, GiftLogic.GIFT_SEC_TYPE3)
@@ -748,6 +785,8 @@ function HeroArtifacts_UpGrade_Level(human, heroID, heroIndex)
     HeroArtifacts_Lv_Query(human, heroID, heroIndex)
 
     updatePowerAndRedDot(human, heroGrid, heroID, heroIndex)
+
+    HeroArtifacts_Base_Query(human, heroID, heroIndex)
 end
 
 -- 神威灵装升星信息查询
@@ -880,6 +919,8 @@ function HeroArtifacts_UpGrade_Star(human, heroID, heroIndex)
 
     updatePowerAndRedDot(human, heroGrid, heroID, heroIndex)
 
+    HeroArtifacts_Base_Query(human, heroID, heroIndex)
+
     -- 弹窗礼包
     GiftLogic = GiftLogic or require("topup.GiftLogic")
     GiftLogic.trigger(human, GiftLogic.GIFT_ARTIFACTS_UPGRADE_STAR, {currentVal = nextStar}, GiftLogic.GIFT_SEC_TYPE3)

+ 1 - 0
script/module/hero/Proto.lua

@@ -1053,6 +1053,7 @@ GC_HEROARTIFACTS_BASE_QUERY = {
 	{"beSkillArr",		7,		HEROARTIFACTS_EFFECT_DETAILEDINFO}, -- 被动技能
 	{"isActivate",		1,		"byte"},   -- 是否激活, 0-否, 1-是
 	{"ActivateCost", 	1,     ItemData},	-- 激活消耗的道具
+	{"redDotArr",		2,		"byte"}, 	-- 灵装升级,升星红点状态列表,0-没有红点, 1-有红点
 }
 
 -- 激活灵装