|
@@ -433,6 +433,23 @@ local function getIndexByRand(totalWeight, randList)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+--获得与当前ID同类型的最低级ID
|
|
|
|
|
+-- local function getLowestIDByType(attrId)
|
|
|
|
|
+-- local cfg = battleRougeCfg[attrId]
|
|
|
|
|
+-- if cfg.lv == 1 then
|
|
|
|
|
+-- return attrId
|
|
|
|
|
+-- end
|
|
|
|
|
+
|
|
|
|
|
+-- local tp = cfg.type
|
|
|
|
|
+-- for k,v in ipairs(battleRougeCfg) do
|
|
|
|
|
+-- if v.type == tp and v.lv == 1 then
|
|
|
|
|
+-- return k
|
|
|
|
|
+-- end
|
|
|
|
|
+-- end
|
|
|
|
|
+-- end
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
--生成老号不同闯关模式的属性加成
|
|
--生成老号不同闯关模式的属性加成
|
|
|
local function generateDiffBattleAttr(human, battleType)
|
|
local function generateDiffBattleAttr(human, battleType)
|
|
|
local config
|
|
local config
|
|
@@ -457,17 +474,27 @@ local function generateDiffBattleAttr(human, battleType)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
if times > 0 then
|
|
if times > 0 then
|
|
|
- local attrList = {}
|
|
|
|
|
local totalWeight, randList = generateCfgWeightInfo()
|
|
local totalWeight, randList = generateCfgWeightInfo()
|
|
|
|
|
|
|
|
if totalWeight <= 0 then
|
|
if totalWeight <= 0 then
|
|
|
return
|
|
return
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
+ local type2Id = {}
|
|
|
|
|
+ local attrList = {}
|
|
|
|
|
+
|
|
|
for i=1, times do
|
|
for i=1, times do
|
|
|
local id = getIndexByRand(totalWeight, randList)
|
|
local id = getIndexByRand(totalWeight, randList)
|
|
|
local cfg = battleRougeCfg[id]
|
|
local cfg = battleRougeCfg[id]
|
|
|
- attrList[id] = (attrList[id] or 0) + cfg.lv
|
|
|
|
|
|
|
+
|
|
|
|
|
+ local targetId = type2Id[cfg.type]
|
|
|
|
|
+
|
|
|
|
|
+ if targetId then
|
|
|
|
|
+ attrList[targetId] = attrList[targetId] + cfg.lv
|
|
|
|
|
+ else
|
|
|
|
|
+ attrList[id] = cfg.lv
|
|
|
|
|
+ type2Id[cfg.type] = id
|
|
|
|
|
+ end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
return attrList
|
|
return attrList
|
|
@@ -4127,7 +4154,13 @@ local function sendNowBattleModeAllAttr(human, chosenAttrList)
|
|
|
msgRet.attrInfo[0] = 0
|
|
msgRet.attrInfo[0] = 0
|
|
|
msgRet.isEnd = 0
|
|
msgRet.isEnd = 0
|
|
|
|
|
|
|
|
|
|
+ local num = 0
|
|
|
local itemCnt = 100
|
|
local itemCnt = 100
|
|
|
|
|
+ for _, _ in pairs(chosenAttrList) do
|
|
|
|
|
+ num = num + 1
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
for id, nowLv in pairs(chosenAttrList) do
|
|
for id, nowLv in pairs(chosenAttrList) do
|
|
|
len = len + 1
|
|
len = len + 1
|
|
|
local cfg = battleRougeCfg[id]
|
|
local cfg = battleRougeCfg[id]
|
|
@@ -4143,6 +4176,12 @@ local function sendNowBattleModeAllAttr(human, chosenAttrList)
|
|
|
if len >= max_len then
|
|
if len >= max_len then
|
|
|
msgRet.attrInfo[0] = len
|
|
msgRet.attrInfo[0] = len
|
|
|
Grid.makeItem(msgRet.refreshCost, ItemDefine.ITEM_ZUANSHI_ID, itemCnt)
|
|
Grid.makeItem(msgRet.refreshCost, ItemDefine.ITEM_ZUANSHI_ID, itemCnt)
|
|
|
|
|
+
|
|
|
|
|
+ num = num - max_len
|
|
|
|
|
+ if num <= 0 then
|
|
|
|
|
+ msgRet.isEnd = 1
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
Msg.send(msgRet, human.fd)
|
|
Msg.send(msgRet, human.fd)
|
|
|
len = 0
|
|
len = 0
|
|
|
end
|
|
end
|
|
@@ -4175,9 +4214,28 @@ function ChooseAttr(human, id)
|
|
|
return Broadcast.sendErr(human, Lang.BATTLE_NO_ATTR)
|
|
return Broadcast.sendErr(human, Lang.BATTLE_NO_ATTR)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- local lv = attrAddData.unSelectedAttrList[id]
|
|
|
|
|
attrAddData.chosenAttrList = attrAddData.chosenAttrList or {}
|
|
attrAddData.chosenAttrList = attrAddData.chosenAttrList or {}
|
|
|
- attrAddData.chosenAttrList[id] = (attrAddData.chosenAttrList[id] or 0) + lv
|
|
|
|
|
|
|
+ local chosenAttrList = attrAddData.chosenAttrList
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ local targetId = 0
|
|
|
|
|
+ local targetType = battleRougeCfg[id].type
|
|
|
|
|
+ local lv = attrAddData.unSelectedAttrList[id]
|
|
|
|
|
+
|
|
|
|
|
+ for attrId in pairs(chosenAttrList) do
|
|
|
|
|
+ local cfg = battleRougeCfg[attrId]
|
|
|
|
|
+ if cfg.type == targetType then
|
|
|
|
|
+ targetId = attrId
|
|
|
|
|
+ break
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ if targetId ~= 0 then
|
|
|
|
|
+ chosenAttrList[targetId] = chosenAttrList[targetId] + lv
|
|
|
|
|
+ else
|
|
|
|
|
+ chosenAttrList[id] = lv
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
attrAddData.unSelectedAttrList = nil
|
|
attrAddData.unSelectedAttrList = nil
|
|
|
|
|
|
|
|
sendNowBattleModeAllAttr(human, attrAddData.chosenAttrList)
|
|
sendNowBattleModeAllAttr(human, attrAddData.chosenAttrList)
|
|
@@ -4185,8 +4243,6 @@ function ChooseAttr(human, id)
|
|
|
QueryDiffBattleUnSelectAttr(human)
|
|
QueryDiffBattleUnSelectAttr(human)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
--刷新属性
|
|
--刷新属性
|
|
|
function RefreshAttr(human, type_m, targetId)
|
|
function RefreshAttr(human, type_m, targetId)
|
|
|
local nBattleType = BattleLogic_GetBattleType(human)
|
|
local nBattleType = BattleLogic_GetBattleType(human)
|
|
@@ -4265,3 +4321,20 @@ function RefreshAttr(human, type_m, targetId)
|
|
|
|
|
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
+
|
|
|
|
|
+--GM, 清理当前闯关模式的加成属性数据
|
|
|
|
|
+function GM_ClearNowModelAttrData(human)
|
|
|
|
|
+ -- local battleType = BattleLogic_GetBattleType(human)
|
|
|
|
|
+
|
|
|
|
|
+ -- if EliteDefine.COPY_ELITE_NORMAL == battleType then
|
|
|
|
|
+ -- human.db.normalBattleAttrData = nil
|
|
|
|
|
+ -- elseif EliteDefine.COPY_LEVEL_ELITE == battleType then
|
|
|
|
|
+ -- human.db.eliteBattleAttrData = nil
|
|
|
|
|
+ -- elseif EliteDefine.COPY_ELITE_DIFFICULTY == battleType then
|
|
|
|
|
+ -- human.db.hardBattleAttrData = nil
|
|
|
|
|
+ -- end
|
|
|
|
|
+
|
|
|
|
|
+ human.db.normalBattleAttrData = nil
|
|
|
|
|
+ human.db.eliteBattleAttrData = nil
|
|
|
|
|
+ human.db.hardBattleAttrData = nil
|
|
|
|
|
+end
|