local hpMin = 2500
local hpMax = 10000
local HPmultiLvl = 6.0
local HPmultiMaglvl = 1.0
local HPplus = 1000
local hpValues = {0.8, 1.2} -- random range
local reqLevel = 250
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEALING)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEALING)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
return true
end
if(getPlayerLevel(cid) < reqLevel or not isInArray({4,8}, getPlayerVocation(cid))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not use this potion.")
return true
end
local health = getPlayerLevel(cid) * HPmultiLvl + getPlayerMagLevel(cid) * HPmultiMaglvl + HPplus
if(not doCreatureAddHealth(itemEx.uid, math.ceil(math.min(hpMax, math.max(hpMin, math.random(health * hpValues[1], health * hpValues[2])))))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
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
doAddCondition(cid, exhaust)
return true
end
local mpMin = 2500
local mpMax = 10000
local MPmultiLvl = 6.0
local MPmultiMaglvl = 1.0
local MPplus = 1000
local mpValues = {0.8, 1.2} -- random range
local reqLevel = 250
local reqVocations = {4, 8} -- knight (4) or elite knight (8)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerLevel(cid) < reqLevel or not isInArray(reqVocations, getPlayerVocation(cid))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not use this potion.")
return true
end
local mana = getPlayerLevel(cid) * MPmultiLvl + getPlayerMagLevel(cid) * MPmultiMaglvl + MPplus
if(not doCreatureAddMana(itemEx.uid, math.ceil(math.min(mpMax, math.max(mpMin, math.random(mana * mpValues[1], mana * mpValues[2])))))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
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
local hpMin = 2500
local hpMax = 10000
local HPmultiLvl = 6.0
local HPmultiMaglvl = 1.0
local HPplus = 1000
local hpValues = {0.8, 1.2} -- random range
local reqLevel = 250
local reqVocations = {4, 8} -- knight (4) or elite knight (8)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerLevel(cid) < reqLevel or not isInArray(reqVocations, getPlayerVocation(cid))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not use this potion.")
return true
end
local health = getPlayerLevel(cid) * HPmultiLvl + getPlayerMagLevel(cid) * HPmultiMaglvl + HPplus
if(not doCreatureAddHealth(itemEx.uid, math.ceil(math.min(hpMax, math.max(hpMin, math.random(health * hpValues[1], health * hpValues[2])))))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
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
local mpMin = 2500
local mpMax = 10000
local MPmultiLvl = 6.0
local MPmultiMaglvl = 1.0
local MPplus = 1000
local mpValues = {0.8, 1.2} -- random range
local hpMin = 2500
local hpMax = 10000
local HPmultiLvl = 6.0
local HPmultiMaglvl = 1.0
local HPplus = 1000
local hpValues = {0.8, 1.2} -- random range
local reqLevel = 250
local reqVocations = {4, 8} -- knight (4) or elite knight (8)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerLevel(cid) < reqLevel or not isInArray(reqVocations, getPlayerVocation(cid))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can not use this potion.")
return true
end
local mana = getPlayerLevel(cid) * MPmultiLvl + getPlayerMagLevel(cid) * MPmultiMaglvl + MPplus
if(not doCreatureAddMana(itemEx.uid, math.ceil(math.min(mpMax, math.max(mpMin, math.random(mana * mpValues[1], mana * mpValues[2])))))) then
return false
end
local health = getPlayerLevel(cid) * HPmultiLvl + getPlayerMagLevel(cid) * HPmultiMaglvl + HPplus
if(not doCreatureAddHealth(itemEx.uid, math.ceil(math.min(hpMax, math.max(hpMin, math.random(health * hpValues[1], health * hpValues[2])))))) then
return false
end
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
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