local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
Manarune = {
id = 2275,
vocations = {1,2,5,6},
mana = getPlayerLevel(cid) * 10
},
Healthrune = {
id = 2307,
vocations = {3,4,7,8},
health = getPlayerLevel(cid) * 10
}
}
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
if item.itemid == config.Manarune.id then
if isInArray(config.Manarune.vocations, getPlayerVocation(cid)) then
doPlayerAddMana(cid, config.Manarune.mana)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),""..config.Manarune.mana.."", TEXTCOLOR_LIGHTBLUE)
doAddCondition(cid, exhaust)
else
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "This rune is only for sorcerers and druids.")
end
end
if item.itemid == config.Healthrune.id then
if isInArray(config.Healthrune.vocations, getPlayerVocation(cid)) then
doCreatureAddHealth(cid, config.Healthrune.health)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),""..config.Healthrune.health.."", TEXTCOLOR_GREEN)
doAddCondition(cid, exhaust)
else
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "This rune is only for paladins and knights.")
end
end
return true
end