local levers = {
[5000] = { -- Action id of the lever
vocs = {1, 5}, -- Vocation ids
itemCost = {id = 2160, count = 10}, -- The item & count required
items = { -- Items
{id = 2175, count = 1},
{id = 2190, count = 1},
{id = 8819, count = 1},
{id = 8820, count = 1},
{id = 2468, count = 1},
{id = 2643, count = 1},
{id = 2661, count = 1}
}
},
[5001] = {
vocs = {2, 6},
itemCost = {id = 2160, count = 10},
items = {
{id = 2175, count = 1},
{id = 2182, count = 1},
{id = 8819, count = 1},
{id = 8820, count = 1},
{id = 2468, count = 1},
{id = 2643, count = 1},
{id = 2661, count = 1}
}
},
[5002] = {
vocs = {3, 7},
itemCost = {id = 2160, count = 10},
items = {
{id = 2525, count = 1},
{id = 2389, count = 5},
{id = 2660, count = 1},
{id = 8923, count = 1},
{id = 2643, count = 1},
{id = 2661, count = 1},
{id = 2480, count = 1}
}
},
[5003] = {
vocs = {4, 8},
itemCost = {id = 2160, count = 10},
items = {
{id = 2525, count = 1},
{id = 8601, count = 1},
{id = 2465, count = 1},
{id = 2460, count = 1},
{id = 2478, count = 1},
{id = 2643, count = 1},
{id = 2661, count = 1}
}
},
[5004] = {
vocs = {0},
itemCost = {id = 2160, count = 10},
items = {
{id = 2525, count = 1},
{id = 8601, count = 1},
{id = 2465, count = 1},
{id = 2460, count = 1},
{id = 2478, count = 1},
{id = 2643, count = 1},
{id = 2661, count = 1}
}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local lever = levers[item.actionid]
if not isInArray(lever.vocs, getPlayerVocation(cid)) then
doPlayerSendCancel(cid, "This is not for your vocation.")
return true
end
if doPlayerRemoveItem(cid, lever.itemCost.id, lever.itemCost.count) then
for _, item in ipairs(lever.items) do
doPlayerAddItem(cid, item.id, item.count)
end
else
doPlayerSendCancel(cid, "You do not have the required item.")
end
return true
end