|
|
@@ -861,6 +861,21 @@ function setGetReward(human, id)
|
|
|
tBattleRewards[intIndex] = Util.setBit(tBattleRewards[intIndex], byteIndex)
|
|
|
end
|
|
|
|
|
|
+-- 通过类型设置领取
|
|
|
+function setGetRewardByType(human, id, nBattleType)
|
|
|
+ local tBattleRewards = BattleLogic_GetBattleRewardsByType(human, nBattleType)
|
|
|
+ if not tBattleRewards then
|
|
|
+ Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleRewards 参数不正确")
|
|
|
+ print("[setGetReward] 不存在对应的 奖励配置")
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ local intIndex = math.ceil(id / WeiLen)
|
|
|
+ local byteIndex = id % WeiLen
|
|
|
+ tBattleRewards[intIndex] = tBattleRewards[intIndex] or 0
|
|
|
+ tBattleRewards[intIndex] = Util.setBit(tBattleRewards[intIndex], byteIndex)
|
|
|
+end
|
|
|
+
|
|
|
-- 是否有可领取的
|
|
|
function hasCanGetReward(human)
|
|
|
local tBattleConfig = BattleLogic_GetBattleConfig(human)
|
|
|
@@ -1232,7 +1247,8 @@ function query(human)
|
|
|
|
|
|
local nBattleAdopt = BattleLogic_GetBattleAdopt(human, nBattleType)
|
|
|
if nBattleAdopt == 1 then
|
|
|
- print("[query] nNowBattleID 为最大值 nNowBattleID = "..nNowBattleID.." nNowGuaJiID = "..nNowGuaJiID)
|
|
|
+ print("[query] nNowBattleID 为最大值 nNowBattleID = "
|
|
|
+ ..nNowBattleID.." nNowGuaJiID = "..nNowGuaJiID.." nBattleType = "..nBattleType)
|
|
|
msgRet.nowBattleID = configNode + 1
|
|
|
end
|
|
|
|
|
|
@@ -1252,10 +1268,11 @@ function query(human)
|
|
|
end
|
|
|
|
|
|
local nJudeNum = nNowGuaJiID
|
|
|
- if nNowGuaJiID ~= nNowBattleID then
|
|
|
- if nNowGuaJiID + 1 < nNowBattleID then
|
|
|
- nJudeNum = nNowBattleID - 1
|
|
|
- end
|
|
|
+ -- 已通关
|
|
|
+ if nBattleAdopt == 1 then
|
|
|
+ nJudeNum = configNode
|
|
|
+ else
|
|
|
+ nJudeNum = nNowBattleID - 1
|
|
|
end
|
|
|
|
|
|
msgRet.maxBattleID = configNode
|
|
|
@@ -2022,7 +2039,7 @@ local function hangExpGet(human,isDiamond)
|
|
|
|
|
|
-- 检测装备数量
|
|
|
if tBattleOut.equip then
|
|
|
- local equipCnt = #htBattleOut.equip
|
|
|
+ local equipCnt = #tBattleOut.equip
|
|
|
if not EquipLogic.checkEmptyCnt(human, equipCnt) then
|
|
|
return
|
|
|
end
|
|
|
@@ -3270,10 +3287,12 @@ local function BattleLogic_GetNorewardReceived(human, nBattleType, cIndex)
|
|
|
|
|
|
-- 判断ID得用战斗ID-1, 因为挂机ID可以设置
|
|
|
local nJudeNum = nGuaJiID
|
|
|
- if nGuaJiID ~= nBattleID then
|
|
|
- if nGuaJiID + 1 < nBattleID then
|
|
|
- nJudeNum = nBattleID - 1
|
|
|
- end
|
|
|
+ local nBattleAdopt = BattleLogic_GetBattleAdopt(human, nBattleType)
|
|
|
+ -- 已通过
|
|
|
+ if nBattleAdopt == 1 then
|
|
|
+ nJudeNum = battleNumber
|
|
|
+ else
|
|
|
+ nJudeNum = nBattleID - 1
|
|
|
end
|
|
|
|
|
|
print("[BattleLogic_GetNorewardReceived] nJudeNum = "..nJudeNum)
|
|
|
@@ -3353,8 +3372,6 @@ local function BattleLogic_GetNorewardReceived(human, nBattleType, cIndex)
|
|
|
msgRet.curIndex=curTotalNumber
|
|
|
-- curIndex = 1
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
-
|
|
|
- print("[BattleLogic_GetNorewardReceived] send client msgRet.curIndex:"..msgRet.curIndex.." msgRet.isEnd:"..msgRet.isEnd.." msgRet.list[0]:"..msgRet.list[0])
|
|
|
|
|
|
--local info=Util.printTable(msgRet)
|
|
|
--print("getNorewardReceived0->>:"..info)
|
|
|
@@ -3404,53 +3421,100 @@ function CG_ELITE_SELECT(human, nSelectDiff)
|
|
|
end
|
|
|
|
|
|
-- 客户端请求领取奖励
|
|
|
-function CG_BATTLE_TONGGUAN_REWARD_GET_COPY(human, nBattleType, nBattleID)
|
|
|
+function CG_BATTLE_TONGGUAN_REWARD_GET_COPY(human, nBattleType)
|
|
|
local tBattleConfig = BattleLogic_GetBattleConfig(human)
|
|
|
local nGuaJiID = BattleLogic_GetBattleGuaJiIDByType(human, nBattleType)
|
|
|
- if not tBattleConfig or -1 >= nGuaJiID then
|
|
|
+ local nBattleID = BattleLogic_GetBattleIDByType(human, nBattleType)
|
|
|
+ if not tBattleConfig or -1 >= nGuaJiID or -1 >= nBattleID then
|
|
|
return
|
|
|
end
|
|
|
+
|
|
|
local tMsgRet = Msg.gc.GC_BATTLE_TONGGUAN_REWARD_GET_COPY
|
|
|
- local tConfig = tBattleConfig.node[nBattleID].tongguan
|
|
|
- if #tConfig < 1 then
|
|
|
+ local nChoseLen = nBattleID - 1
|
|
|
+ local nConfigLen = #tBattleConfig.node
|
|
|
+ if 0 >= nChoseLen or nChoseLen > nConfigLen then
|
|
|
tMsgRet.status = 0
|
|
|
Msg.send(tMsgRet, human.fd)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+ print("[CG_BATTLE_TONGGUAN_REWARD_GET_COPY] nChoseLen = "..nChoseLen.. " nBattleID = "..nBattleID)
|
|
|
+
|
|
|
tMsgRet.status = 1
|
|
|
+ local tItemList = {}
|
|
|
+ for id = 1, nChoseLen, 1 do
|
|
|
+ local tNodeCofig = tBattleConfig.node[id]
|
|
|
+ if tNodeCofig and #tNodeCofig.tongguan >= 1 then
|
|
|
+ -- 未领取
|
|
|
+ if false == isGetRewardByType(human, id, nBattleType) then
|
|
|
+ print("[CG_BATTLE_TONGGUAN_REWARD_GET_COPY] 未领取的 id = "..id)
|
|
|
+ if #tNodeCofig.tongguan == 1 and tNodeCofig.tongguan[1][3] then
|
|
|
+ -- 英雄
|
|
|
+ if HeroLogic.getEmptyCnt(human) < 1 then
|
|
|
+ return Broadcast.sendErr(human, Lang.HERO_BAG_FULL)
|
|
|
+ end
|
|
|
+ local heroID = tNodeCofig.tongguan[1][1]
|
|
|
+ local cnt = tNodeCofig.tongguan[1][2]
|
|
|
+ local star = tNodeCofig.tongguan[1][3]
|
|
|
+ if cnt > 0 then
|
|
|
+ -- 设置已领取
|
|
|
+ setGetRewardByType(human, id, nBattleType)
|
|
|
+
|
|
|
+ local msg = Msg.gc.GC_SUIPIAN_SUMMON
|
|
|
+ for i = 1, cnt do
|
|
|
+ local heroGrid = HeroGrid.createHeroGrid(heroID, star)
|
|
|
+
|
|
|
+ HeroLogic.addHeroByGrid(human, heroGrid, "battle_extra_reward")
|
|
|
+
|
|
|
+ SuipianLogic.makeResultItemData(msg.heroList[i], heroID, 1, 1)
|
|
|
+ end
|
|
|
+
|
|
|
+ msg.isHero = 1
|
|
|
+ msg.list[0] = 0
|
|
|
+ msg.heroList[0] = cnt
|
|
|
+ msg.fenJieList[0] = 0
|
|
|
+
|
|
|
+ Msg.send(msg, human.fd)
|
|
|
+ else
|
|
|
+ Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "[CG_BATTLE_TONGGUAN_REWARD_GET_COPY] 领取奖励配置的英雄cnt为<= 0 id = "..human.db.name)
|
|
|
+ print("[CG_BATTLE_TONGGUAN_REWARD_GET_COPY] 不正确的 英雄碎片数量")
|
|
|
+ end
|
|
|
+ else
|
|
|
+ setGetRewardByType(human, id, nBattleType)
|
|
|
|
|
|
- getTongGuanReward(human, nBattleID)
|
|
|
-
|
|
|
- tMsgRet.tongguan[0] = 0
|
|
|
- if #tConfig ~= 0 then
|
|
|
- tMsgRet.tongguan[0] = 1
|
|
|
- local tNet = tMsgRet.tongguan[1]
|
|
|
- tNet.status = STATUS_NONE
|
|
|
- tNet.levelName = getBattleNameByType(nBattleID, nBattleType)
|
|
|
- tNet.index = nBattleID
|
|
|
- tNet.nowBattle = getBattleNameByType(nGuaJiID, nBattleType)
|
|
|
- tNet.reward[0] = 0
|
|
|
- tNet.heroReward[0] = 0
|
|
|
-
|
|
|
- if tConfig[1][3] then
|
|
|
- tNet.heroReward[0] = 1
|
|
|
- local other = { }
|
|
|
- other.star = tConfig[1][3]
|
|
|
- HeroGrid.makeHeroSimpleByID(tNet.heroReward[1], tConfig[1][1], nil, other, human)
|
|
|
- HeroGrid.makeHeroSimpleByGeneral(tNet.heroReward[1], tConfig[1][1])
|
|
|
- else
|
|
|
- tNet.reward[0] = 1
|
|
|
- for i = 1, tNet.reward[0] do
|
|
|
- local itemID = tConfig[i][1]
|
|
|
- local itemCnt = tConfig[i][2]
|
|
|
- Grid.makeItem(tNet.reward[i], itemID, itemCnt)
|
|
|
+ for k, v in ipairs(tNodeCofig.tongguan) do
|
|
|
+ local nItemID = v[1]
|
|
|
+ local nItemNum = v[2]
|
|
|
+ tItemList[nItemID] = tItemList[nItemID] or 0
|
|
|
+ tItemList[nItemID] = tItemList[nItemID] + nItemNum
|
|
|
+ end
|
|
|
+
|
|
|
+ --BagLogic.addItemList(human, tNodeCofig.tongguan, "tongguan")
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 触发国王君临奖励
|
|
|
+ ChatPaoMaLogic.broadcast(human, ChatPaoMaLogic.PAOMA_TYPE_BROAD_TYPE5, id)
|
|
|
+
|
|
|
+ RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1101)
|
|
|
+ if id == 80 then
|
|
|
+ KingWorldLogic.setState(human, 1)
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- Msg.send(tMsgRet, human.fd)
|
|
|
+ if nil ~= _G.next(tItemList) then
|
|
|
+ local tPrize = {}
|
|
|
+ for k, v in pairs(tItemList) do
|
|
|
+ table.insert(tPrize, {k,v})
|
|
|
+ end
|
|
|
|
|
|
+ BagLogic.addItemList(human, tPrize, "tongguan")
|
|
|
+ end
|
|
|
+
|
|
|
+ query(human)
|
|
|
+
|
|
|
+ Msg.send(tMsgRet, human.fd)
|
|
|
end
|
|
|
|
|
|
-- 客户端请求查询所有未领取奖励
|