优化版:
--允许打孔位置
x000110_g_EquipGemSet = {
[0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1,
[5] = 1, [6] = 1, [7] = 1, [11] = 1, [12] = 1,
[13] = 1, [14] = 1, [15] = 1, [17] = 1, [18] = 1
}
--**********************************
-- 一键打孔
--**********************************
function x000110_OneKey3Slot( sceneId, selfId,isTips )
local tEquipGemTable = {0,1,2,3,4,5,6,7,11,12,13,14,15,17,18}
local bagbegin = GetBasicBagStartPos(sceneId, selfId)
local bagend = GetBasicBagEndPos(sceneId, selfId)
-- 遍历背包中的物品
for i= bagbegin, bagend do
local itemIndex = LuaFnGetItemTableIndexByIndex( sceneId, selfId, i )
-- 检查物品是否存在且未锁定
if itemIndex > 0 then
local ret = LuaFnIsItemLocked( sceneId, selfId, i )
if ret ~= 0 then
return
end
-- 获取装备类型并检查
local EquipType = LuaFnGetBagEquipType( sceneId, selfId, i )
if x000110_g_EquipGemSet[EquipType] then
LuaFnSetEquipSlot(sceneId, selfId, i,3)
end
end
end
if isTips == 1 then
BeginEvent(sceneId)
AddText(sceneId,"恭喜您,您包裹所有装备已经成功三孔打孔")
EndEvent(sceneId)
DispatchEventList(sceneId,selfId,targetId)
--特效
LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, selfId, 18, 0)
end
end