local config =
{
healthMultiplier = 1.4,
manaMultiplier = 1.0
}
local RUNES = {
[0] = {hpMin = 500, hpMax = 10000, HPmultiLvl = 6.0, HPmultiMaglvl = 1.0, HPplus = 1000, hpValues = {0.8, 1.2}, -- HP RUNE
reqLevel = 250},
[0] = {hpMin = 2000, hpMax = 25000, HPmultiLvl = 7.0, HPmultiMaglvl = 1.0, HPplus = 8000, hpValues = {0.8, 1.2}, -- SUPER HP RUNE
reqLevel = 1000},
[2307] = {hpMin = 0, hpMax = 700000, HPmultiLvl = 2.0, HPmultiMaglvl = 1.2, HPplus = 100, hpValues = {1.2, 1.3}, -- DONATOR HP RUNE
reqLevel = 1},
[0] = {-- MANA RUNE
mpMin = 1000, mpMax = 7000, MPmultiLvl = 4.0, MPmultiMaglvl = 5.0, MPplus = 300, manaValues = {0.8, 1.2},
reqLevel = 250},
[2282] = {-- SUPER MANA RUNE
mpMin = 0, mpMax = 20005550, MPmultiLvl = 1.2, MPmultiMaglvl = 1.3, MPplus = 100, manaValues = {0.8, 0.9},
reqLevel = 8},
[2270] = {-- SUPER MANA RUNE
mpMin = 0, mpMax = 150000000, MPmultiLvl = 1.2, MPmultiMaglvl = 1.3, MPplus = 100, manaValues = {1.3, 1.4},
reqLevel = 100},
[2276] = {-- DONATOR MANA RUNE
mpMin = 0, mpMax = 200000000, MPmultiLvl = 1.3, MPmultiMaglvl = 1.4, MPplus = 100, manaValues = {1.4, 1.5},
reqLevel = 8}
}
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 5000))
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEALING)
function onUse(cid, item, fromPosition, itemEx, toPosition)
local rune = RUNES[item.itemid]
if not isPlayer(itemEx.uid) then
return false
end
if(((rune.reqLevel and getPlayerLevel(cid) < rune.reqLevel) or (rune.vocations and not isInArray(rune.vocations, getPlayerVocation(cid)))) and
not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Only players " .. (rune.reqLevel and (" of level " .. rune.reqLevel) or "") .. " or above may use this rune.")
return true
end
if(rune.hpMin) then
local health = getPlayerLevel(cid) * rune.HPmultiLvl + getPlayerMagLevel(cid) * rune.HPmultiMaglvl + rune.HPplus
if(not doCreatureAddHealth(itemEx.uid, math.ceil(math.min(rune.hpMax, math.max(rune.hpMin, math.random(health * rune.hpValues[1], health * rune.hpValues[2]))) * config.healthMultiplier))) then
return false
end
end
if(rune.mpMin) then
local mana = getPlayerLevel(cid) * rune.MPmultiLvl + getPlayerMagLevel(cid) * rune.MPmultiMaglvl + rune.MPplus
if(not doCreatureAddMana(itemEx.uid, math.ceil(math.min(rune.mpMax, math.max(rune.mpMin, math.random(mana * rune.manaValues[1], mana * rune.manaValues[2]))) * config.manaMultiplier))) then
return false
end
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_RED)
for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
if(isPlayer(tid)) then
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
end
end
return true
end