|
|
@@ -33,6 +33,26 @@ local function getEquipGrid(human, bagIndex, heroUuid, pos)
|
|
|
return equipGrid, nil, nil
|
|
|
end
|
|
|
|
|
|
+-- 获得装备洗练数据中被锁定属性的数量, 索引...
|
|
|
+local function getEquipLockAttrInfo(equipGrid)
|
|
|
+ if not equipGrid or not equipGrid.attr or #equipGrid.attr <= 1 then
|
|
|
+ return
|
|
|
+ end
|
|
|
+
|
|
|
+ local num = 0
|
|
|
+ local idxList = {}
|
|
|
+
|
|
|
+ for idx, attrInfo in ipairs(equipGrid.attr) do
|
|
|
+ if attrInfo[4] and attrInfo[4] == 1 then
|
|
|
+ num = num + 1
|
|
|
+ idxList[idx] = idx
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ return num, idxList
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-- 查询装备图鉴 全部信息
|
|
|
function fenjieQuey(human, inputList)
|
|
|
@@ -128,6 +148,9 @@ function randomQuery(human, bagIndex, heroUuid, pos)
|
|
|
local rareExcel = EquipRareExcel[equipGrid.quality]
|
|
|
if not rareExcel then return end
|
|
|
|
|
|
+
|
|
|
+ local attrLockNum = getEquipLockAttrInfo(equipGrid)
|
|
|
+
|
|
|
local msgRet = Msg.gc.GC_EQUIP_RAMDOM_QUERY
|
|
|
Grid.makeItem(msgRet.equipOld, equipGrid.id, 1, nil, equipGrid, bagIndex)
|
|
|
|
|
|
@@ -143,7 +166,14 @@ function randomQuery(human, bagIndex, heroUuid, pos)
|
|
|
|
|
|
msgRet.needItem[0] = #rareExcel.rebirth
|
|
|
for i = 1, msgRet.needItem[0] do
|
|
|
- Grid.makeItem(msgRet.needItem[i], rareExcel.rebirth[i][1], rareExcel.rebirth[i][2])
|
|
|
+ -- Grid.makeItem(msgRet.needItem[i], rareExcel.rebirth[i][1], rareExcel.rebirth[i][2])
|
|
|
+
|
|
|
+ local itemCnt = rareExcel.rebirth[i][2]
|
|
|
+ if attrLockNum and attrLockNum > 0 then
|
|
|
+ itemCnt = itemCnt * (attrLockNum + 1)
|
|
|
+ end
|
|
|
+
|
|
|
+ Grid.makeItem(msgRet.needItem[i], rareExcel.rebirth[i][1], itemCnt)
|
|
|
end
|
|
|
|
|
|
Msg.send(msgRet, human.fd)
|
|
|
@@ -209,9 +239,16 @@ function randomDo(human, bagIndex, heroUuid, pos)
|
|
|
local rareExcel = EquipRareExcel[equipGrid.quality]
|
|
|
if not rareExcel then return end
|
|
|
|
|
|
+ local attrLockNum, idxList = getEquipLockAttrInfo(equipGrid)
|
|
|
+
|
|
|
for i = 1, #rareExcel.rebirth do
|
|
|
local needItemID = rareExcel.rebirth[i][1]
|
|
|
local needItemCnt = rareExcel.rebirth[i][2]
|
|
|
+
|
|
|
+ if attrLockNum and attrLockNum > 0 then
|
|
|
+ needItemCnt = needItemCnt * (attrLockNum + 1)
|
|
|
+ end
|
|
|
+
|
|
|
local nowItemCnt = BagLogic.getItemCnt(human, needItemID)
|
|
|
if nowItemCnt < needItemCnt then
|
|
|
return Broadcast.sendErr(human, Util.format(Lang.XIANZHI_NO_ITEM, ItemDefine.getValue(needItemID,"name")))
|
|
|
@@ -221,11 +258,38 @@ function randomDo(human, bagIndex, heroUuid, pos)
|
|
|
for i = 1, #rareExcel.rebirth do
|
|
|
local needItemID = rareExcel.rebirth[i][1]
|
|
|
local needItemCnt = rareExcel.rebirth[i][2]
|
|
|
+
|
|
|
+ if attrLockNum and attrLockNum > 0 then
|
|
|
+ needItemCnt = needItemCnt * (attrLockNum + 1)
|
|
|
+ end
|
|
|
+
|
|
|
BagLogic.delItem(human, needItemID, needItemCnt, "equip_wash")
|
|
|
end
|
|
|
|
|
|
|
|
|
- local attr, quality = EquipLogic.randomAttr(equipGrid.id, true, equipGrid.quality)
|
|
|
+ local excludeAttrList
|
|
|
+ if idxList then
|
|
|
+ excludeAttrList = {}
|
|
|
+ for idx in pairs(idxList) do
|
|
|
+ local attrType = equipGrid.attr[idx] and equipGrid.attr[idx][1]
|
|
|
+ if attrType then
|
|
|
+ excludeAttrList[attrType] = 1
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ local attr, quality = EquipLogic.randomAttr(equipGrid.id, true, equipGrid.quality, excludeAttrList)
|
|
|
+
|
|
|
+ for idx in pairs(idxList or {}) do
|
|
|
+ if attr[idx] and equipGrid.attr[idx] then
|
|
|
+ attr[idx][1] = equipGrid.attr[idx][1] -- attrType
|
|
|
+ attr[idx][2] = equipGrid.attr[idx][2] -- attrValue
|
|
|
+ attr[idx][3] = equipGrid.attr[idx][3] -- color
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
equipGrid.washAttr = attr
|
|
|
equipGrid.washQuality = quality
|
|
|
|
|
|
@@ -246,7 +310,15 @@ function randomSave(human, bagIndex, heroUuid, pos)
|
|
|
local washQuality = equipGrid.washQuality
|
|
|
if not washAttr or not washQuality then return end
|
|
|
|
|
|
- equipGrid.attr = washAttr
|
|
|
+ -- equipGrid.attr = washAttr
|
|
|
+
|
|
|
+ local _, idxList = getEquipLockAttrInfo(equipGrid)
|
|
|
+ for idx, attrInfo in ipairs(washAttr) do
|
|
|
+ if not idxList or not idxList[idx] then
|
|
|
+ equipGrid.attr[idx] = attrInfo
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
equipGrid.quality = washQuality
|
|
|
equipGrid.washAttr = nil
|
|
|
equipGrid.washQuality = nil
|
|
|
@@ -267,4 +339,71 @@ function randomSave(human, bagIndex, heroUuid, pos)
|
|
|
ObjHuman.doCalcHero(human, heroIndex)
|
|
|
HeroLogic.sendHeroBagDynamic(human, heroGrid.id, heroIndex)
|
|
|
end
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+-- 锁定/解锁装备洗练属性
|
|
|
+function LockEquipAttr(human, bagIndex, heroUuid, pos, opType, attrIdx)
|
|
|
+ if opType ~= 0 and opType ~= 1 then
|
|
|
+ return Broadcast.sendErr(human, Lang.COMMON_ARGUMENT_ERROR)
|
|
|
+ end
|
|
|
+
|
|
|
+ local equipGrid = getEquipGrid(human, bagIndex, heroUuid, pos)
|
|
|
+ if not equipGrid then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_GRID_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+ if not equipGrid.attr or #equipGrid.attr <= 1 then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_ATTR_CANNOT_LOCK)
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 洗练结束才能锁定
|
|
|
+ if equipGrid.washAttr then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_ATTR_CANNOT_LOCK)
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ if not equipGrid.attr[attrIdx] then
|
|
|
+ return Broadcast.sendErr(human, Lang.COMMON_ARGUMENT_ERROR)
|
|
|
+ end
|
|
|
+
|
|
|
+ local attrLockNum, idxList = getEquipLockAttrInfo(equipGrid)
|
|
|
+
|
|
|
+ if not attrLockNum then
|
|
|
+ Broadcast.sendErr(human, Lang.EQUIP_ATTR_CANNOT_LOCK)
|
|
|
+ end
|
|
|
+
|
|
|
+ if opType == 1 then
|
|
|
+ if attrLockNum + 1 >= #equipGrid.attr then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_ATTR_CANNOT_LOCK_ALL)
|
|
|
+ end
|
|
|
+
|
|
|
+ if idxList[attrIdx] then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_ATTR_LOCKED)
|
|
|
+ end
|
|
|
+ else
|
|
|
+ if not idxList[attrIdx] then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_ATTR_UNLOCK)
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ -- 更新数据
|
|
|
+ equipGrid.attr[attrIdx][4] = opType
|
|
|
+
|
|
|
+ -- 推送数据给客户端
|
|
|
+ randomQuery(human, bagIndex, heroUuid, pos)
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+-- 取消装备未选择的洗练属性
|
|
|
+function CancelEquipRandomAttr(human, bagIndex, heroUuid, pos)
|
|
|
+ local equipGrid = getEquipGrid(human, bagIndex, heroUuid, pos)
|
|
|
+ if not equipGrid then
|
|
|
+ return Broadcast.sendErr(human, Lang.EQUIP_GRID_ERR)
|
|
|
+ end
|
|
|
+
|
|
|
+ equipGrid.washAttr = nil
|
|
|
+ equipGrid.washQuality = nil
|
|
|
+
|
|
|
+ randomQuery(human, bagIndex, heroUuid, pos)
|
|
|
end
|