local set = { -- each index should be an itemid
[12345] = 1,
[12342] = 1,
[12344] = 1,
[12347] = 1,
[12349] = 1,
}
function max(x)
local c = -1
for _, v in pairs(x) do
c = c + 1
end
return c
end
local storage, isset = 123456, 999999
local magicLevel = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(magicLevel, CONDITION_PARAM_BUFF, true)
setConditionParam(magicLevel, CONDITION_PARAM_TICKS, -1)
setConditionParam(magicLevel, CONDITION_PARAM_STAT_MAGICLEVEL, 10)
function onEquip(cid, item, slot)
local slots = getPlayerSlotItem(cid, slot)
if slots.itemid ~= item.itemid then
return true
end
setPlayerStorageValue(cid, storage, set[item.itemid] + 1)
if getPlayerStorageValue(cid, storage) == max(set) and getPlayerStorageValue(cid, isset) == -1 then
setPlayerStorageValue(cid, isset, 1)
doAddCondition(cid, magicLevel)
end
return true
end
function onDeEquip(cid, item, slot)
if getPlayerStorageValue(cid, isset) == 1 then
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
setPlayerStorageValue(cid, isset, -1)
end
setPlayerStorageValue(cid, storage, set[item.itemid] - 1)
return true
end