|
|
@@ -28,6 +28,59 @@ local TriggerDefine = require("trigger.TriggerDefine")
|
|
|
local TriggerLogic = require("trigger.TriggerLogic")
|
|
|
local Abs365CardLogic = require("absAct.Abs365CardLogic")
|
|
|
|
|
|
+-- 符文锁定属性,技能后的刷新时额外消耗的道具Id
|
|
|
+local LOCK_COST_ITEN_ID = 136
|
|
|
+
|
|
|
+-- 支持锁定属性,技能的符文的最低品质
|
|
|
+local LOCK_FUWEN_COLOR_BASE = 5
|
|
|
+
|
|
|
+-- 符文属性 + 技能的最大锁定数量
|
|
|
+local LOCK_FUWEN_MAX_NUM = 4
|
|
|
+
|
|
|
+-- 计算符文属性, 技能锁定后消耗的道具数量
|
|
|
+local function calcLockCost(fuwenGrid)
|
|
|
+ local num = 0
|
|
|
+
|
|
|
+ -- 属性
|
|
|
+ for _, attrInfo in pairs(fuwenGrid.attr or {}) do
|
|
|
+ if attrInfo[3] and attrInfo[3] == 1 then
|
|
|
+ num = num + 2
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 技能
|
|
|
+ local skillLockList = fuwenGrid.skillLockList
|
|
|
+ if skillLockList then
|
|
|
+ for _, _ in pairs(skillLockList) do
|
|
|
+ num = num + 6
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ return num
|
|
|
+end
|
|
|
+
|
|
|
+-- 获取符文的锁定信息
|
|
|
+local function getFuwenLockInfo(fuwenGrid)
|
|
|
+ local lockNum = 0
|
|
|
+ -- local attrLockPosTb, skillLockPosTb = {}, {}
|
|
|
+
|
|
|
+ for pos, attrInfo in pairs(fuwenGrid.attr) do
|
|
|
+ if attrInfo[3] and attrInfo[3] == 1 then
|
|
|
+ lockNum = lockNum + 1
|
|
|
+ -- attrLockPosTb[pos] = 1
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ for skillId, pos in pairs(fuwenGrid.skillLockList or {}) do
|
|
|
+ lockNum = lockNum + 1
|
|
|
+ -- skillLockPosTb[pos] = skillId
|
|
|
+ end
|
|
|
+
|
|
|
+ -- return lockNum, attrLockPosTb, skillLockPosTb
|
|
|
+ return lockNum
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
--发送所有符文列表 onLogin
|
|
|
function sendFuwenRefineList(human)
|
|
|
local msgRet = Msg.gc.GC_FUWEN_ALL_LIST
|
|
|
@@ -572,8 +625,12 @@ function fuwenRefreshQuery(human,fuwenID,fuwenIndex,pos,heroID,heroIndex)
|
|
|
-- 临时属性备份
|
|
|
local attrLen = #fuwen.attrTemp
|
|
|
for zz = 1,attrLen do
|
|
|
- msgRet.fuwenTemp.attrs[zz].key = fuwen.attrTemp[zz][1]
|
|
|
- msgRet.fuwenTemp.attrs[zz].value = fuwen.attrTemp[zz][2]
|
|
|
+ -- msgRet.fuwenTemp.attrs[zz].key = fuwen.attrTemp[zz][1]
|
|
|
+ -- msgRet.fuwenTemp.attrs[zz].value = fuwen.attrTemp[zz][2]
|
|
|
+
|
|
|
+ msgRet.fuwenTemp.attrs[zz].attrArray.key = fuwen.attrTemp[zz][1]
|
|
|
+ msgRet.fuwenTemp.attrs[zz].attrArray.value = fuwen.attrTemp[zz][2]
|
|
|
+ msgRet.fuwenTemp.attrs[zz].isLock = fuwen.attrTemp[zz][3] or 0
|
|
|
end
|
|
|
msgRet.fuwenTemp.attrs[0] = attrLen
|
|
|
|
|
|
@@ -583,7 +640,7 @@ function fuwenRefreshQuery(human,fuwenID,fuwenIndex,pos,heroID,heroIndex)
|
|
|
else
|
|
|
local skillLen = #fuwen.skillTemp
|
|
|
for zz = 1,skillLen do
|
|
|
- Grid.makeFuwenSkill(msgRet.fuwenTemp.skills[zz], fuwen.skillTemp[zz])
|
|
|
+ Grid.makeFuwenSkill(msgRet.fuwenTemp.skills[zz], fuwen.skillTemp[zz], fuwen.skillLockList)
|
|
|
end
|
|
|
msgRet.fuwenTemp.skills[0] = skillLen
|
|
|
end
|
|
|
@@ -600,6 +657,16 @@ function fuwenRefreshQuery(human,fuwenID,fuwenIndex,pos,heroID,heroIndex)
|
|
|
end
|
|
|
msgRet.expend[0] = lenth
|
|
|
|
|
|
+
|
|
|
+ -- 锁定属性,技能的额外消耗
|
|
|
+ local itemCnt = calcLockCost(fuwen)
|
|
|
+ if itemCnt > 0 then
|
|
|
+ lenth = lenth + 1
|
|
|
+ msgRet.expend[0] = lenth
|
|
|
+ Grid.makeItem(msgRet.expend[lenth], LOCK_COST_ITEN_ID, itemCnt)
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
msgRet.refreshCnt = 0
|
|
|
if refreshConfig.rare == ItemDefine.ITEM_RARE_COLOR_5 then
|
|
|
msgRet.refreshCnt = human.db.fuwenRefreshCnt.sh
|
|
|
@@ -671,6 +738,14 @@ function fuwenRefreshDo(human,fuwenID,fuwenIndex,heroID,heroIndex,pos)
|
|
|
return Broadcast.sendErr(human,Lang.FUWEN_REFRESH_FILL_ERR) -- 材料不够
|
|
|
end
|
|
|
|
|
|
+ local itemCnt = calcLockCost(fuwenGrid)
|
|
|
+ if itemCnt > 0 then
|
|
|
+ if BagLogic.getItemCnt(human, LOCK_COST_ITEN_ID) < itemCnt then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_REFRESH_FILL_ERR)
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
if refreshConfig.rare == ItemDefine.ITEM_RARE_COLOR_5 then
|
|
|
human.db.fuwenRefreshCnt.sh = human.db.fuwenRefreshCnt.sh + 1
|
|
|
elseif refreshConfig.rare == ItemDefine.ITEM_RARE_COLOR_6 then
|
|
|
@@ -688,7 +763,13 @@ function fuwenRefreshDo(human,fuwenID,fuwenIndex,heroID,heroIndex,pos)
|
|
|
-- 扣消耗
|
|
|
local fuwenGridTemp = Util.copyTable(fuwenGrid)
|
|
|
ObjHuman.updateJinbi(human, -refreshConfig.expend[1][2], "fuwen_refresh")
|
|
|
- BagLogic.delItem(human, ItemDefine.ITEM_FUWEN_JINGHUA, refreshConfig.expend[2][2], "fuwen_refresh")
|
|
|
+ BagLogic.delItem(human, ItemDefine.ITEM_FUWEN_JINGHUA, refreshConfig.expend[2][2], "fuwen_refresh")
|
|
|
+
|
|
|
+ if itemCnt > 0 then
|
|
|
+ BagLogic.delItem(human, LOCK_COST_ITEN_ID, itemCnt, "fuwen_refresh")
|
|
|
+ end
|
|
|
+
|
|
|
+ Util.printTable(fuwenGridTemp.attr)
|
|
|
|
|
|
-- 改属性
|
|
|
FuwenGrid.genFuwenAttr(fuwenGridTemp,luckRefresh)
|
|
|
@@ -706,6 +787,97 @@ function fuwenRefreshDo(human,fuwenID,fuwenIndex,heroID,heroIndex,pos)
|
|
|
TriggerLogic.PublishEvent(TriggerDefine.FUWEN_RESET, human.db._id, 1)
|
|
|
end
|
|
|
|
|
|
+
|
|
|
+-- 锁定/解锁符文的属性,技能
|
|
|
+function ResetLock(human, fuwenID,fuwenIndex,heroID,heroIndex,pos, opTarget, opIdx, opType)
|
|
|
+ local refreshConfig = FuwenExcel.fuwen[fuwenID]
|
|
|
+ if refreshConfig == nil then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_GRID_ERR) -- 传入参数非法
|
|
|
+ end
|
|
|
+
|
|
|
+ if refreshConfig.order < LOCK_FUWEN_COLOR_BASE then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_COLOR_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+ local fuwenGrid = nil
|
|
|
+ if fuwenIndex == -1 then -- 刷英雄身上的
|
|
|
+ local heroGrid = HeroLogic.getHeroGrid(human, heroID, heroIndex)
|
|
|
+ if heroGrid == nil then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_HERO_GRID_ERR) -- 传入的英雄数据非法
|
|
|
+ end
|
|
|
+
|
|
|
+ if pos == nil then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_PUTOFF_ERR) -- 传入的参数非法
|
|
|
+ end
|
|
|
+
|
|
|
+ if heroGrid.fuwen == nil or heroGrid.fuwen[pos] == nil or heroGrid.fuwen[pos].id == nil then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_PUTOFF_ERR) -- 传入的参数非法
|
|
|
+ end
|
|
|
+
|
|
|
+ fuwenGrid = heroGrid.fuwen[pos]
|
|
|
+ else -- 刷背包里的
|
|
|
+ if human.db.fuwenBag == nil or human.db.fuwenBag[fuwenIndex] == nil then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_HECHENG_FILL_ERR) -- 材料不存在
|
|
|
+ end
|
|
|
+
|
|
|
+ fuwenGrid = human.db.fuwenBag[fuwenIndex]
|
|
|
+ end
|
|
|
+
|
|
|
+ if fuwenGrid == nil or fuwenGrid.id == nil then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_HECHENG_FILL_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+ if fuwenGrid.id ~= nil and fuwenGrid.id ~= fuwenID then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_ID_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ if opType ~= 1 and opType ~= 0 then
|
|
|
+ return Broadcast.sendErr(human,Lang.COMMON_ARGUMENT_ERROR)
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 锁定数量判断
|
|
|
+ if opType == 1 then
|
|
|
+ local lockNum = getFuwenLockInfo(fuwenGrid)
|
|
|
+ if lockNum >= LOCK_FUWEN_MAX_NUM then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_LOCK_MAX_ERR)
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 对属性进行锁定/解锁
|
|
|
+ if opTarget == 1 then
|
|
|
+ if not fuwenGrid.attr[opIdx] then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_ATTR_POS_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+ fuwenGrid.attr[opIdx][3] = opType
|
|
|
+
|
|
|
+ elseif opTarget == 2 then -- 对技能进行锁定/解锁
|
|
|
+ if not fuwenGrid.skill or not fuwenGrid.skill[opIdx] then
|
|
|
+ return Broadcast.sendErr(human,Lang.FUWEN_SKILL_POS_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+ local skillId = fuwenGrid.skill[opIdx]
|
|
|
+ fuwenGrid.skillLockList = fuwenGrid.skillLockList or {}
|
|
|
+
|
|
|
+ if opType == 1 then
|
|
|
+ fuwenGrid.skillLockList[skillId] = opIdx
|
|
|
+ end
|
|
|
+
|
|
|
+ if opType == 0 then
|
|
|
+ fuwenGrid.skillLockList[skillId] = nil
|
|
|
+ end
|
|
|
+
|
|
|
+ else
|
|
|
+ return Broadcast.sendErr(human,Lang.COMMON_ARGUMENT_ERROR)
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ fuwenRefreshQuery(human,fuwenID,fuwenIndex,pos,heroID,heroIndex)
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
local function cmpSkill(a, b)
|
|
|
if a.sortID ~= b.sortID then
|
|
|
return a.sortID < b.sortID
|
|
|
@@ -833,14 +1005,14 @@ function fuwenRefreshSave(human,fuwenID,fuwenIndex,pos,heroID,heroIndex)
|
|
|
end
|
|
|
|
|
|
if fuwen.attrTemp ~= nil or fuwen.skillTemp ~= nil then
|
|
|
- if next(fuwen.attrTemp) then
|
|
|
+ if fuwen.attrTemp and next(fuwen.attrTemp) then
|
|
|
fuwen.attr = fuwen.attrTemp
|
|
|
fuwen.attrTemp = {}
|
|
|
else
|
|
|
--Log.write(Log.LOGID_DEBUG, human.db._id, human.db.account, human.db.name, human.db.lv, fuwen.id,"refreshsave attrTemp is empty")
|
|
|
Log.write(Log.LOGID_DEBUG, human.db._id, human.db.newUniqueTag, human.db.name, human.db.lv, fuwen.id,"refreshsave attrTemp is empty")
|
|
|
end
|
|
|
- if next(fuwen.skillTemp) then
|
|
|
+ if fuwen.skillTemp and next(fuwen.skillTemp) then
|
|
|
fuwen.skill = fuwen.skillTemp
|
|
|
fuwen.skillTemp = nil
|
|
|
else
|