local t = {
[{1,999}] = 2500,
[{1000,4999}] = 10000,
[{5000,9999}] = 100000,
[{10000,19999}] = 250000,
[{20000,29999}] = 400000,
[{30000,math.huge}] = 500000
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEAL)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEAL) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
elseif not isPlayer(itemEx.uid) then
return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
local lvl = getPlayerLevel(cid)
for k, v in pairs(t) do
if lvl >= k[1] and lvl <= k[2] then
doPlayerAddMana(itemEx.uid, v)
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
doAddCondition(cid, exhaust)
doSendAnimatedText(toPosition, 'Manarune!', math.random(255))
return true
end
end
end