|
|
@@ -72,6 +72,8 @@ local CombatImpl = require("combat.CombatImpl")
|
|
|
local battleRougeCfg = require("excel.battleRouge").Sheet1
|
|
|
local WeekTaskLogic = require("dailyTask.WeekTaskLogic")
|
|
|
local TreasureChestLogic = require("treasurechest.TreasureChestLogic")
|
|
|
+-- local RoleStorageBox = require("roleSystem.RoleStorageBox")
|
|
|
+
|
|
|
|
|
|
BATTLE_HANG_EXP_OUT_PERIOD = 60 -- 经验产出时间间隔
|
|
|
BATTLE_HANG_ITEM_OUT_PERIOD = 300 -- 战利品道具产出时间间隔
|
|
|
@@ -154,27 +156,25 @@ local function fontBattleSkillNet(skillNet, skillID)
|
|
|
return true
|
|
|
end
|
|
|
|
|
|
---
|
|
|
+
|
|
|
+-- 处理策划修改开放不同模式条件的函数
|
|
|
local function initBattleSpeData(human)
|
|
|
human.db.battleSpeData = {
|
|
|
[EliteDefine.COPY_ELITE_NORMAL] = true
|
|
|
}
|
|
|
end
|
|
|
|
|
|
---
|
|
|
+-- 处理策划修改开放不同模式条件的函数
|
|
|
local function getBattleSpeData(human)
|
|
|
return human.db.battleSpeData
|
|
|
end
|
|
|
|
|
|
-
|
|
|
+-- 处理策划修改开放不同模式条件的函数
|
|
|
local function updateBattleSpeData(human, modeType, state)
|
|
|
human.db.battleSpeData[modeType] = state
|
|
|
end
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-- 获取当前战役类型
|
|
|
local function BattleLogic_GetBattleType(human)
|
|
|
if not human then
|
|
|
@@ -275,6 +275,18 @@ local function BattleLogic_SetBattleBattleID(human, nValue)
|
|
|
return true
|
|
|
end
|
|
|
|
|
|
+-- 设置 某个模式 战役即将战斗id
|
|
|
+local function setBattleBattleIDByType(human, nBattleType, nValue)
|
|
|
+ if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
+ human.db.battleID = nValue
|
|
|
+ elseif EliteDefine.COPY_LEVEL_ELITE == nBattleType then
|
|
|
+ human.db.battleID_elite = nValue
|
|
|
+ elseif EliteDefine.COPY_ELITE_DIFFICULTY == nBattleType then
|
|
|
+ human.db.battleID_hard = nValue
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
-- 获取当前战役 已通关关卡/挂机关卡
|
|
|
local function BattleLogic_GetBattleGuaJiID(human)
|
|
|
if not human then
|
|
|
@@ -354,6 +366,145 @@ local function BattleLogic_SetBattleGuaJiID(human, nValue)
|
|
|
return true
|
|
|
end
|
|
|
|
|
|
+-- 设置某个模式 已通关关卡/挂机关卡
|
|
|
+local function setBattleGuaJiIDByType(human, nBattleType, nValue)
|
|
|
+ if not human or 0 > nValue then
|
|
|
+ return false
|
|
|
+ end
|
|
|
+
|
|
|
+ if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
+ human.db.guajiID = nValue
|
|
|
+ elseif EliteDefine.COPY_LEVEL_ELITE == nBattleType then
|
|
|
+ human.db.guajiID_elite = nValue
|
|
|
+ elseif EliteDefine.COPY_ELITE_DIFFICULTY == nBattleType then
|
|
|
+ human.db.guajiID_hard = nValue
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+-- 获取配置信息
|
|
|
+local function BattleLogic_GetBattleConfig(human)
|
|
|
+ if not human then
|
|
|
+ Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleConfig 参数不正确")
|
|
|
+ return nil
|
|
|
+ end
|
|
|
+
|
|
|
+ local nBattleType = BattleLogic_GetBattleType(human)
|
|
|
+ if EliteDefine.COPY_ELITE_ERROR >= nBattleType or EliteDefine.COPY_ELITE_DIFFICULTY < nBattleType then
|
|
|
+ Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleConfig 获取到的战斗类型不正确 id = "
|
|
|
+ ..human.db._id.. "newUniqueTag = "..human.db.newUniqueTag.." name = "..human.db.name.." nBattleType = "..nBattleType)
|
|
|
+ return nil
|
|
|
+ end
|
|
|
+
|
|
|
+ if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
+ return BattleExcel
|
|
|
+ elseif EliteDefine.COPY_LEVEL_ELITE == nBattleType then
|
|
|
+ return BattleExcel_Elite
|
|
|
+ elseif EliteDefine.COPY_ELITE_DIFFICULTY == nBattleType then
|
|
|
+ return BattleExcel_Hard
|
|
|
+ else
|
|
|
+ Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleGuaJiID 未处理的战斗类型 id = "
|
|
|
+ ..human.db._id.. "newUniqueTag = "..human.db.newUniqueTag.." name = "..human.db.name.." nBattleType = "..nBattleType)
|
|
|
+ return nil
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+-- 获取某个闯关模式的配置
|
|
|
+local function getBattleCfgByType(nBattleType)
|
|
|
+ if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
+ return BattleExcel
|
|
|
+ elseif EliteDefine.COPY_LEVEL_ELITE == nBattleType then
|
|
|
+ return BattleExcel_Elite
|
|
|
+ elseif EliteDefine.COPY_ELITE_DIFFICULTY == nBattleType then
|
|
|
+ return BattleExcel_Hard
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+------------------------------------------------多队伍挑战相关------------------------------------
|
|
|
+
|
|
|
+-- 是否开启多队伍挑战
|
|
|
+local function isOpenOtherTeam(human)
|
|
|
+ local nowBattleID = BattleLogic_GetBattleBattleID(human)
|
|
|
+ if nowBattleID >= EliteDefine.OPEN_OTHER_TEAM_LEVEL then
|
|
|
+ return true
|
|
|
+ end
|
|
|
+
|
|
|
+ return false
|
|
|
+end
|
|
|
+
|
|
|
+-- 更新当前模式的出战队伍记录
|
|
|
+local function updateTeamRecord(human, teamIdx)
|
|
|
+ human.teamRecord = human.teamRecord or {}
|
|
|
+
|
|
|
+ local teamRecord = human.teamRecord
|
|
|
+ local nBattleType = BattleLogic_GetBattleType(human)
|
|
|
+ teamRecord[nBattleType] = teamRecord[nBattleType] or {}
|
|
|
+
|
|
|
+ teamRecord[nBattleType][teamIdx] = 1
|
|
|
+end
|
|
|
+
|
|
|
+-- 重置当前模式的出战队伍记录
|
|
|
+local function resetTeamRecord(human)
|
|
|
+ if not human.teamRecord then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ local nBattleType = BattleLogic_GetBattleType(human)
|
|
|
+ human.teamRecord[nBattleType] = nil
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+-- 当前应该是第几支队伍出战。 目前闯关最多有三支队伍
|
|
|
+local function getTeamIdx(human)
|
|
|
+ local teamIdx = 1
|
|
|
+
|
|
|
+ if not isOpenOtherTeam(human) then
|
|
|
+ return teamIdx
|
|
|
+ end
|
|
|
+
|
|
|
+ local nBattleType = BattleLogic_GetBattleType(human)
|
|
|
+
|
|
|
+ local teamRecord = human.teamRecord
|
|
|
+ if teamRecord and teamRecord[nBattleType] then
|
|
|
+ teamIdx = #teamRecord[nBattleType] + 1
|
|
|
+ end
|
|
|
+
|
|
|
+ print("====================getTeamIdx=====================", teamIdx)
|
|
|
+
|
|
|
+ return teamIdx
|
|
|
+end
|
|
|
+
|
|
|
+-- 获取当前出战阵容类型
|
|
|
+local function getCombatTypeByTeamIdx(teamIdx)
|
|
|
+ if teamIdx == 1 then
|
|
|
+ return CombatDefine.COMBAT_TYPE1
|
|
|
+ elseif teamIdx == 2 then
|
|
|
+ return CombatDefine.COMBAT_TYPE30
|
|
|
+ else
|
|
|
+ -- assert(false, "错误类型")
|
|
|
+
|
|
|
+ return CombatDefine.COMBAT_TYPE1
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+-- 获取当前模式下当前关卡需要的队伍数量
|
|
|
+local function getLevelTeamCnt(human)
|
|
|
+ local teamCnt = 1
|
|
|
+ local nowBattleID = BattleLogic_GetBattleBattleID(human)
|
|
|
+ if nowBattleID >= EliteDefine.OPEN_OTHER_TEAM_LEVEL then
|
|
|
+ local cfg = BattleLogic_GetBattleConfig(human)
|
|
|
+ local singleCfg = cfg.node[nowBattleID]
|
|
|
+ teamCnt = #singleCfg.monsterOutID
|
|
|
+ end
|
|
|
+
|
|
|
+ return teamCnt
|
|
|
+end
|
|
|
+
|
|
|
+-----------------------------------------------------------------------------------------------------
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-----------------------------------------------------肉鸽玩法-----------------------------------------------------
|
|
|
|
|
|
@@ -810,32 +961,6 @@ local function BattleLogic_InitAllBattleOut(human, now)
|
|
|
return true
|
|
|
end
|
|
|
|
|
|
--- 获取配置信息
|
|
|
-local function BattleLogic_GetBattleConfig(human)
|
|
|
- if not human then
|
|
|
- Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleConfig 参数不正确")
|
|
|
- return nil
|
|
|
- end
|
|
|
-
|
|
|
- local nBattleType = BattleLogic_GetBattleType(human)
|
|
|
- if EliteDefine.COPY_ELITE_ERROR >= nBattleType or EliteDefine.COPY_ELITE_DIFFICULTY < nBattleType then
|
|
|
- Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleConfig 获取到的战斗类型不正确 id = "
|
|
|
- ..human.db._id.. "newUniqueTag = "..human.db.newUniqueTag.." name = "..human.db.name.." nBattleType = "..nBattleType)
|
|
|
- return nil
|
|
|
- end
|
|
|
-
|
|
|
- if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
- return BattleExcel
|
|
|
- elseif EliteDefine.COPY_LEVEL_ELITE == nBattleType then
|
|
|
- return BattleExcel_Elite
|
|
|
- elseif EliteDefine.COPY_ELITE_DIFFICULTY == nBattleType then
|
|
|
- return BattleExcel_Hard
|
|
|
- else
|
|
|
- Log.write(Log.LOGID_OSS_BATTLE_MAINGATE, "BattleLogic_GetBattleGuaJiID 未处理的战斗类型 id = "
|
|
|
- ..human.db._id.. "newUniqueTag = "..human.db.newUniqueTag.." name = "..human.db.name.." nBattleType = "..nBattleType)
|
|
|
- return nil
|
|
|
- end
|
|
|
-end
|
|
|
|
|
|
-- 根据战斗类型获取配置
|
|
|
local function BattleLogic_GetBattleConfigByType(nBattleType)
|
|
|
@@ -981,7 +1106,6 @@ local function BattleLogic_SetBattleAdopt(human, nBattleType, nValue)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
- print("[BattleLogic_SetBattleAdopt] 玩家通过战役 nBattleType = "..nBattleType.." nValue = "..nValue)
|
|
|
if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
human.db.battleadopt = nValue
|
|
|
elseif EliteDefine.COPY_LEVEL_ELITE == nBattleType then
|
|
|
@@ -1123,6 +1247,21 @@ local function isOpenModeByOldCond(human, nSelectDiff)
|
|
|
return nChoseBattleID > EliteDefine.COPY_ELITE_LEVEL_OLD and true or false
|
|
|
end
|
|
|
|
|
|
+-- 修正三个模式中已经通关的模式的battleID, GuajiaID
|
|
|
+local function restoreReallyBattleID(human)
|
|
|
+ for i=EliteDefine.COPY_ELITE_NORMAL, EliteDefine.COPY_ELITE_DIFFICULTY do
|
|
|
+ local tag = BattleLogic_GetBattleAdopt(human, i)
|
|
|
+ local nowBattleID = BattleLogic_GetBattleIDByType(human, i)
|
|
|
+ local battleCfg = getBattleCfgByType(i)
|
|
|
+ if tag == 1 and #battleCfg.node > nowBattleID then
|
|
|
+ setBattleGuaJiIDByType(human, i, nowBattleID)
|
|
|
+
|
|
|
+ setBattleBattleIDByType(human, i, nowBattleID+1)
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
function onLogin(human)
|
|
|
@@ -1170,6 +1309,8 @@ function onLogin(human)
|
|
|
end
|
|
|
|
|
|
|
|
|
+ restoreReallyBattleID(human)
|
|
|
+
|
|
|
|
|
|
if human.db.lv >= BATTLE_LOGIN_LEV_TIPS then
|
|
|
return
|
|
|
@@ -1387,7 +1528,11 @@ function hangFightQuery(human)
|
|
|
-- local battleID = human.db.battleID > #BattleExcel.node and #BattleExcel.node or human.db.battleID
|
|
|
local battleID = nBattleID > #tBattleExcel.node and #tBattleExcel.node or nBattleID
|
|
|
local nowNodeConfig = tBattleExcel.node[battleID]
|
|
|
- local monsterOutID = nowNodeConfig.monsterOutID
|
|
|
+ -- local monsterOutID = nowNodeConfig.monsterOutID
|
|
|
+
|
|
|
+ local teamIdx = getTeamIdx(human)
|
|
|
+ local monsterOutID = nowNodeConfig.monsterOutID[teamIdx]
|
|
|
+
|
|
|
local monsterOutConfig = MonsterExcel.monsterOut[monsterOutID]
|
|
|
local msgRet = Msg.gc.GC_BATTLE_HANG_FIGHT
|
|
|
local len = 0
|
|
|
@@ -1667,8 +1812,9 @@ function query(human)
|
|
|
nNowGuaJiID = configNode
|
|
|
BattleLogic_SetBattleGuaJiID(human, nNowGuaJiID)
|
|
|
end
|
|
|
-
|
|
|
+
|
|
|
local nBattleAdopt = BattleLogic_GetBattleAdopt(human, nBattleType)
|
|
|
+
|
|
|
if nBattleAdopt == 1 then
|
|
|
print("[query] nNowBattleID 为最大值 nNowBattleID = "
|
|
|
..nNowBattleID.." nNowGuaJiID = "..nNowGuaJiID.." nBattleType = "..nBattleType)
|
|
|
@@ -1804,7 +1950,11 @@ function query(human)
|
|
|
msgRet.canMopup = 1
|
|
|
end
|
|
|
|
|
|
- local monsterOutId = nowNodeConfig.monsterOutID
|
|
|
+ -- local monsterOutId = nowNodeConfig.monsterOutID
|
|
|
+
|
|
|
+ local teamIdx = getTeamIdx(human)
|
|
|
+ local monsterOutId = nowNodeConfig.monsterOutID[teamIdx]
|
|
|
+
|
|
|
if not monsterOutId then
|
|
|
print("[BattleLogic query] monsterOutId 为空")
|
|
|
return
|
|
|
@@ -2266,7 +2416,6 @@ function calcBattleExpOut(human, now)
|
|
|
|
|
|
-- tBattleOut.qingbao = tBattleOut.qingbao + math.ceil(tBattleOut.qingbao * talismanAdd_qb)
|
|
|
-- tBattleOut.greenExp = tBattleOut.greenExp + math.ceil(tBattleOut.greenExp * talismanAdd_hero_exp)
|
|
|
-
|
|
|
end
|
|
|
|
|
|
-- 根据时间计算道具产出
|
|
|
@@ -2508,7 +2657,11 @@ local function hangExpGet(human,isDiamond)
|
|
|
for i = 1, #items do
|
|
|
local tempID = items[i].id
|
|
|
local tempCnt = items[i].cnt
|
|
|
+
|
|
|
+ -- tempCnt = RoleStorageBox.GetFinalItemCnt(human, tempID, tempCnt, "battle")
|
|
|
+
|
|
|
BagLogic.addItem(human, tempID, tempCnt, "battle")
|
|
|
+
|
|
|
end
|
|
|
|
|
|
-- 给装备
|
|
|
@@ -2709,11 +2862,16 @@ function fight(human)
|
|
|
|
|
|
|
|
|
local config = tBattleConfig.node[battleID]
|
|
|
- local mapConfig = tBattleConfig.map[config.mapID]
|
|
|
- local monsterOutID = config.monsterOutID
|
|
|
- local mapID = mapConfig.bg
|
|
|
- CombatLogic.combatBegin(human, config.sceneID, monsterOutID, CombatDefine.COMBAT_TYPE1, battleID)
|
|
|
-
|
|
|
+ -- local mapConfig = tBattleConfig.map[config.mapID]
|
|
|
+ -- local monsterOutID = config.monsterOutID
|
|
|
+ -- local mapID = mapConfig.bg
|
|
|
+ -- CombatLogic.combatBegin(human, config.sceneID, monsterOutID, CombatDefine.COMBAT_TYPE1, battleID)
|
|
|
+ -- GuideLogic.setDoSpecialGuide(human, GuideLogic.SKIPTYPE_JUMP_BATTLE)
|
|
|
+
|
|
|
+ local teamIdx = getTeamIdx(human)
|
|
|
+ local monsterOutID = config.monsterOutID[teamIdx]
|
|
|
+ local combatType = getCombatTypeByTeamIdx(teamIdx)
|
|
|
+ CombatLogic.combatBegin(human, config.sceneID, monsterOutID, combatType, battleID)
|
|
|
GuideLogic.setDoSpecialGuide(human, GuideLogic.SKIPTYPE_JUMP_BATTLE)
|
|
|
end
|
|
|
|
|
|
@@ -2721,10 +2879,21 @@ function onFightEnd(human, result, fightTypeID, param1, combatInfo)
|
|
|
-- 设置一些战斗结算信息
|
|
|
combatInfo.defender.name = Util.format(Lang.COMBAT_BATTLE_DEFEND_NAME, param1)
|
|
|
|
|
|
+ -- if CombatDefine.RESULT_WIN ~= result then
|
|
|
+ -- return
|
|
|
+ -- end
|
|
|
+
|
|
|
+ local bl = isOpenOtherTeam(human)
|
|
|
+
|
|
|
if CombatDefine.RESULT_WIN ~= result then
|
|
|
+ if bl then
|
|
|
+ resetTeamRecord(human)
|
|
|
+ end
|
|
|
+
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+
|
|
|
local nBattleType = BattleLogic_GetBattleType(human)
|
|
|
local guajiID = BattleLogic_GetBattleGuaJiID(human)
|
|
|
local battleID = BattleLogic_GetBattleBattleID(human)
|
|
|
@@ -2750,6 +2919,22 @@ function onFightEnd(human, result, fightTypeID, param1, combatInfo)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
+ -- 如果当前关卡是多队伍关卡,则需要所有队伍都胜利才算通关
|
|
|
+ if bl then
|
|
|
+ local needTeamCnt = getLevelTeamCnt(human)
|
|
|
+ local nowTeamIdx = getTeamIdx(human)
|
|
|
+
|
|
|
+ if needTeamCnt <= nowTeamIdx then
|
|
|
+ resetTeamRecord(human)
|
|
|
+ else
|
|
|
+ updateTeamRecord(human, nowTeamIdx)
|
|
|
+ local nextTeamIdx = getTeamIdx(human)
|
|
|
+ combatInfo.nextCombatType = getCombatTypeByTeamIdx(nextTeamIdx)
|
|
|
+ return
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
if EliteDefine.COPY_ELITE_NORMAL == nBattleType then
|
|
|
MainDianLogic.MaiDian_Begin(human, MaiDianDefine.MAIDIAN_TYPE_BATTLE, {nValue = battleID})
|
|
|
end
|
|
|
@@ -2824,9 +3009,14 @@ function onFightEnd(human, result, fightTypeID, param1, combatInfo)
|
|
|
for i = 1, #config.winReward do
|
|
|
local itemID = config.winReward[i][1]
|
|
|
local itemCnt = config.winReward[i][2]
|
|
|
+
|
|
|
+ local sourceId = 0
|
|
|
+ -- itemCnt, sourceId = RoleStorageBox.GetFinalItemCnt(human, itemID, itemCnt, "battle")
|
|
|
+
|
|
|
-- 装备不在这显示
|
|
|
combatInfo.rewardItem[i] = combatInfo.rewardItem[i] or { }
|
|
|
- combatInfo.rewardItem[i] = { itemID, itemCnt }
|
|
|
+ -- combatInfo.rewardItem[i] = { itemID, itemCnt }
|
|
|
+ combatInfo.rewardItem[i] = { itemID, itemCnt, [4] = sourceId}
|
|
|
BagLogic.addItem(human, itemID, itemCnt, "battle_win")
|
|
|
end
|
|
|
combatInfo.attacker.lv = human.db.lv
|
|
|
@@ -3329,9 +3519,13 @@ function mopupFight(human)
|
|
|
itemCnt = itemCnt + math.ceil(itemCnt * talismanAdd_zs)
|
|
|
end
|
|
|
|
|
|
+ local sourceId = 0
|
|
|
+ -- itemCnt, sourceId = RoleStorageBox.GetFinalItemCnt(human, itemID, itemCnt, "battle")
|
|
|
+
|
|
|
if not ItemDefine.isEquip(itemID) then
|
|
|
msgRet.item[0] = msgRet.item[0] + 1
|
|
|
- Grid.makeItem(msgRet.item[msgRet.item[0]], itemID, itemCnt)
|
|
|
+ -- Grid.makeItem(msgRet.item[msgRet.item[0]], itemID, itemCnt)
|
|
|
+ Grid.makeItem(msgRet.item[msgRet.item[0]], itemID, itemCnt, nil, nil, nil, nil, nil, nil, sourceId)
|
|
|
end
|
|
|
|
|
|
BagLogic.addItem(human, itemID, itemCnt, "battle")
|
|
|
@@ -3631,7 +3825,10 @@ function getCombatMonsterOutID(human, side)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
- return config.monsterOutID
|
|
|
+ -- return config.monsterOutID
|
|
|
+
|
|
|
+ local teamIdx = getTeamIdx(human)
|
|
|
+ return config.monsterOutID[teamIdx]
|
|
|
end
|
|
|
|
|
|
function getCombatName(human)
|
|
|
@@ -3755,7 +3952,10 @@ function getBattleMonsterOutID(human)
|
|
|
-- local battleID = human.db.battleID
|
|
|
-- local config = BattleExcel.node[battleID]
|
|
|
local config = tBattleExcel.node[nBattleID]
|
|
|
- return config.monsterOutID
|
|
|
+ -- return config.monsterOutID
|
|
|
+
|
|
|
+ local teamIdx = getTeamIdx(human)
|
|
|
+ return config.monsterOutID[teamIdx]
|
|
|
end
|
|
|
|
|
|
function onUpdatePos(human)
|
|
|
@@ -3795,10 +3995,10 @@ function battleChapterReward(human, mapID)
|
|
|
return
|
|
|
end
|
|
|
|
|
|
- local mapConf = tBattleConfig.map[mapID]
|
|
|
- if not mapConf then
|
|
|
- return
|
|
|
- end
|
|
|
+ -- local mapConf = tBattleConfig.map[mapID]
|
|
|
+ -- if not mapConf then
|
|
|
+ -- return
|
|
|
+ -- end
|
|
|
|
|
|
-- 没有通过当前大关卡
|
|
|
local battleID = nBattleID
|
|
|
@@ -3814,32 +4014,62 @@ function battleChapterReward(human, mapID)
|
|
|
roleMapId = battleNodeConfig.mapID
|
|
|
end
|
|
|
|
|
|
- if mapID > roleMapId then
|
|
|
- return
|
|
|
- end
|
|
|
+ -- if mapID > roleMapId then
|
|
|
+ -- return
|
|
|
+ -- end
|
|
|
|
|
|
- -- if not human.db.chapterReward then
|
|
|
- -- human.db.chapterReward = { }
|
|
|
+ -- -- if not human.db.chapterReward then
|
|
|
+ -- -- human.db.chapterReward = { }
|
|
|
+ -- -- end
|
|
|
+
|
|
|
+ -- -- 判断是否已经领取了当前大关卡的奖励
|
|
|
+ -- -- local chapterReward = human.db.chapterReward
|
|
|
+ -- local chapterReward = tChapterReward
|
|
|
+
|
|
|
+ -- if chapterReward[mapID] then
|
|
|
+ -- return Broadcast.sendErr(human, Lang.FRIEND_HEART_GET_HAD)
|
|
|
-- end
|
|
|
|
|
|
- -- 判断是否已经领取了当前大关卡的奖励
|
|
|
- -- local chapterReward = human.db.chapterReward
|
|
|
- local chapterReward = tChapterReward
|
|
|
+ -- chapterReward[mapID] = true
|
|
|
+ -- ObjHuman.save(human)
|
|
|
+
|
|
|
+ -- local reward = mapConf.reward
|
|
|
+ -- BagLogic.addItemList(human, reward, "chapterReward")
|
|
|
+ -- RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1105)
|
|
|
+
|
|
|
|
|
|
- if chapterReward[mapID] then
|
|
|
- return Broadcast.sendErr(human, Lang.FRIEND_HEART_GET_HAD)
|
|
|
+ -- 新修改: 一键领取所有可领取的奖励
|
|
|
+ local len = 0
|
|
|
+ local itemLArr = {}
|
|
|
+ local getMapIdList = {}
|
|
|
+
|
|
|
+ for mapId, mapCfg in ipairs(tBattleConfig.map) do
|
|
|
+ if not tChapterReward[mapId] and roleMapId >= mapId then
|
|
|
+ for _, itemInfo in ipairs(mapCfg.reward) do
|
|
|
+ len = len + 1
|
|
|
+ itemLArr[len] = {itemInfo[1], itemInfo[2]}
|
|
|
+ end
|
|
|
+
|
|
|
+ getMapIdList[mapId] = true
|
|
|
+ tChapterReward[mapId] = true
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
- chapterReward[mapID] = true
|
|
|
- ObjHuman.save(human)
|
|
|
+ if len > 0 then
|
|
|
+ BagLogic.addItemList(human, itemLArr, "chapterReward")
|
|
|
+ RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1105)
|
|
|
|
|
|
- local reward = mapConf.reward
|
|
|
- BagLogic.addItemList(human, reward, "chapterReward")
|
|
|
- RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1105)
|
|
|
+ len = 0
|
|
|
+ local msgRet = Msg.gc.GC_BATTLE_CHAPTER_REWARD
|
|
|
+ local mapIDList = msgRet.mapIDList
|
|
|
+ for mapId in pairs(getMapIdList) do
|
|
|
+ len = len + 1
|
|
|
+ mapIDList[len] = mapId
|
|
|
+ end
|
|
|
+ mapIDList[0] = len
|
|
|
|
|
|
- local msgRet = Msg.gc.GC_BATTLE_CHAPTER_REWARD
|
|
|
- msgRet.mapID = mapID
|
|
|
- Msg.send(msgRet, human.fd)
|
|
|
+ Msg.send(msgRet, human.fd)
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
-- 判断难度是否解锁
|
|
|
@@ -4269,7 +4499,7 @@ function GetGameReward(human, indexStr)
|
|
|
human.db.hardBattleGameTimes = hardBattleGameTimes
|
|
|
end
|
|
|
|
|
|
- BagLogic.addItemList(human, { {itemId, itemCnt} }, "battle")
|
|
|
+ BagLogic.addItemList(human, { {itemId, itemCnt} }, "battle_game")
|
|
|
|
|
|
local msgRet = Msg.gc.GC_BATTLE_GETGAMEREWARD
|
|
|
msgRet.battleGameTimes = battleGameTimes + eliteBattleGameTimes + hardBattleGameTimes
|
|
|
@@ -4551,3 +4781,19 @@ function GM_ClearNowModelAttrData(human)
|
|
|
human.db.eliteBattleAttrData = nil
|
|
|
human.db.hardBattleAttrData = nil
|
|
|
end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+-----------------------------多队伍--------------------------------------------------------
|
|
|
+-- 请求当前模式当前关卡需要几支队伍
|
|
|
+function QueryLevelTeamCnt(human)
|
|
|
+ local teamCnt = getLevelTeamCnt(human)
|
|
|
+ local msgRet = Msg.gc.GC_BATTLE_TEAM_COUNT
|
|
|
+ msgRet.teamCnt = teamCnt
|
|
|
+
|
|
|
+ print("====================QueryLevelTeamCnt==========================", teamCnt)
|
|
|
+
|
|
|
+ Msg.send(msgRet, human.fd)
|
|
|
+end
|
|
|
+
|
|
|
+-------------------------------------------------------------------------------------------
|