Преглед изворни кода

巅峰战场增加一键扫荡功能

gitxsm пре 4 месеци
родитељ
комит
d7b72e8d55

+ 2 - 1
script/common/Lang.lua

@@ -859,4 +859,5 @@ LOST_HAS_ONECLICKSWEEP = [[已经一键扫荡过]]
 --------------------------巅峰战场-------------------------
 BG_MATCHLIST_ERR = [[匹配列表中未找到该对手]]
 BG_COMBAT_TYPE_ERR = [[战斗类型错误]]
-BG_CONDITION_ERR = [[挑战次数或挑战券不足]]
+BG_CONDITION_ERR = [[挑战次数或挑战券不足]]
+BG_FREECNT_NOT_ENOUGH = [[免费次数不足]]

+ 1 - 0
script/common/ProtoID.lua

@@ -1750,5 +1750,6 @@ _ENV[1790]="GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANK_QUERY"
 _ENV[1791]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY"
 _ENV[1792]="GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY"
 _ENV[1793]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_UPDATE_MATCHLIST"
+_ENV[1794]="CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ONECLICK_SWEEP"
 
 _ENV[1795]="GC_AB_TIPS"

+ 4 - 0
script/module/serverCommerce/Handler.lua

@@ -97,4 +97,8 @@ end
 
 function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_UPDATE_MATCHLIST(human, msg)
     ServerCommerceActBattleGroundNS.BattleGround_Update_MatchList(human, msg)
+end
+
+function CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ONECLICK_SWEEP(human, msg)
+    ServerCommerceActBattleGroundNS.BattleGround_OneClickSweep(human, msg)
 end

+ 3 - 0
script/module/serverCommerce/Proto.lua

@@ -306,3 +306,6 @@ GC_SERVEERCOMMERCE_ACT_BATTLEGROUND_RANKAWARD_QUERY = {
 -- 更新匹配列表
 CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_UPDATE_MATCHLIST = {}
 
+-- 一键扫荡
+CG_SERVEERCOMMERCE_ACT_BATTLEGROUND_ONECLICK_SWEEP = {}
+

+ 3 - 4
script/module/serverCommerce/ServerCommerceActBattleGroundCS.lua

@@ -474,6 +474,9 @@ function BG_N2C_Act_End(msg)
     local logStr = table.concat(logTb)
     writeLog(logStr)
 
+    -- 更新标识
+    notifyActEnd = true
+
     local fd_2_Rank = {}
     local joinList = battleGroundData.joinList
     local allAreaRankList = battleGroundData.allAreaRankList
@@ -486,7 +489,6 @@ function BG_N2C_Act_End(msg)
             fd_2_Rank[fd] = fd_2_Rank[fd] or {}
             fd_2_Rank[fd][#fd_2_Rank[fd]+1] = {ServerCommerceActDefine.COMMERCEACT_NPC_CNT, playerInfo[2]}
         end
-
     end
 
     -- 在榜玩家
@@ -515,8 +517,5 @@ function BG_N2C_Act_End(msg)
         battleGroundData.allAreaRankList = nil
         battleGroundData.generaRankList = nil
         saveAllData()
-
-        -- 更新标识
-        notifyActEnd = true
     end
 end

+ 34 - 7
script/module/serverCommerce/ServerCommerceActBattleGroundNS.lua

@@ -243,7 +243,7 @@ local function unlockHero(human, unlockHeroInfo, isInit)
 
     if #unlockHeroInfo == 0 then
         for heroId, heroCfg in pairs(HeroConfig) do
-            if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and not findVal(heroBagData, heroId) then
+            if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and heroId > 100000 and not findVal(heroBagData, heroId) then
                 heroBagData[#heroBagData+1] = genHeroGrid(heroId)
             end
         end
@@ -255,7 +255,7 @@ local function unlockHero(human, unlockHeroInfo, isInit)
     -- local heroList = {}
     local heroArr = {}
     for heroId, heroCfg in pairs(HeroConfig) do
-        if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and not findVal(heroBagData, heroId) then
+        if heroCfg.grade >= HeroDefine.HERO_SSR_GRADE and heroId > 100000 and not findVal(heroBagData, heroId) then
             -- heroList[heroId] = heroCfg
             heroArr[#heroArr+1] = {heroId, heroCfg}
         end
@@ -328,11 +328,11 @@ local function rankImprove(msg)
     end
 
     human.battleGroundRank = msg.newRank
-    local newMatchList = matchListAlgorithm(human.battleGroundRank)
+    -- local newMatchList = matchListAlgorithm(human.battleGroundRank)
 
     -- 更新对手列表
     local battleGroundData = human.db.ServerCommerce.battleGround
-    battleGroundData.matchList = newMatchList
+    -- battleGroundData.matchList = newMatchList
 
     -- 检查是否能解锁新英雄
     local idx, unlockHeroInfo = getUnlockHeroInfoByRank(human.battleGroundRank)
@@ -344,7 +344,7 @@ local function rankImprove(msg)
 
     -- 玩家在线
     if human.fd then
-        BattleGround_MatchPage_Query(human)
+        -- BattleGround_MatchPage_Query(human)
         return
     end
 
@@ -398,6 +398,11 @@ local function fightEndHanle(human, result)
     local challengeAward = varCfg.defeatAward
 
     if result == CombatDefine.RESULT_WIN then
+        -- 更新对手列表
+        local newMatchList = matchListAlgorithm(human.battleGroundRank)
+        local battleGroundData = human.db.ServerCommerce.battleGround
+        battleGroundData.matchList = newMatchList
+
         -- 展示数据
         --if human.battleGroundRank <= ServerCommerceActDefine.COMMERCEACT_NPC_CNT then
             populatePlayerShowData(human, msgData.playerShowData, human.battleGroundCache.defRank)
@@ -669,7 +674,6 @@ function BattleGround_Update_MatchList(human)
     BattleGround_MatchPage_Query(human)
 end
 
-
 -- 匹配对手查询
 function BattleGround_Player_Query(human, targetRank)
     if not isRunning() then
@@ -698,6 +702,30 @@ function BattleGround_Try_Challenge(human, targetRank)
     InnerMsg.sendMsg(0, msgData)
 end
 
+-- 一键扫荡
+function BattleGround_OneClickSweep(human)
+    if not isRunning() then
+        return Broadcast.sendErr(human, Lang.ACT_NOT_START)
+    end
+
+    local battleGroundData = human.db.ServerCommerce.battleGround
+    if battleGroundData.freeChallengeCnt <= 0 then
+        return Broadcast.sendErr(human, Lang.BG_FREECNT_NOT_ENOUGH)
+    end
+
+    local winAwardCfg = battleGroundConfig.var[1].winAward
+    local winAwardArr = {}
+
+    for i, itemInfo in ipairs(winAwardCfg) do
+        winAwardArr[i] = { itemInfo[1], itemInfo[2] * battleGroundData.freeChallengeCnt }
+    end
+
+    battleGroundData.freeChallengeCnt = 0
+    BattleGround_MatchPage_Query(human)
+
+    BagLogic.addItemList(human, winAwardArr, LOGTYPE)
+end
+
 -- 英雄背包查询
 function BattleGround_HeroBag_Query(human)
     if not isRunning() then
@@ -1048,7 +1076,6 @@ function getCombatMonsterOutID(human, side, args)
     return args[1]
 end
 
-
 function getCombatObjList(human, side, args, combatType)
     if side == CombatDefine.ATTACK_SIDE and not human then return end