local t = {
[2263] = {vocation = 1, level = 50, magic_level = 60, voc = 5},
[2267] = {vocation = 2, level = 50, magic_level = 60, voc = 6},
[2270] = {vocation = 3, level = 50, magic_level = 15, voc = 7},
[2272] = {vocation = 4, level = 40, magic_level = 5, voc = 8}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
lvlmin = getPlayerLevel(cid)*2
lvlmax = getPlayerLevel(cid)*3
ppos = getPlayerPosition(cid)
local v = t[item.itemid]
if v then
if getPlayerLevel(cid) >= v.level then
if getPlayerMagLevel(cid) >= v.magic_level then
if isInArray({v.vocation, v.voc},getPlayerVocation(cid)) then
doPlayerAddMana(cid,math.random(lvlmin, lvlmax))
doSendMagicEffect(ppos,CONST_ME_MAGIC_BLUE)
doAddCondition(cid, exhausted)
doSendAnimatedText(ppos, "Mana rune!", math.random(1,100))
else
doPlayerSendCancel(cid,"You do not have the required vocation to use this rune")
end
else
doPlayerSendCancel(cid,You do not have the required magic level to use this rune")
end
else
doPlayerSendCancel(cid,"You do not have the level required to use this rune")
end
if hasCondition(cid, CONDITION_EXHAUST_HEAL) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
end
if not isPlayer(itemEx.uid) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
return true
end
end