local all = {1,2,3,4,5,7,6,8} -- All Vocations.
local potions = {
[7620] = {vocations = all, emptypotion = 7636, mana = {1200, 1200}},
[7589] = {level = 50, vocations = {1, 2, 3, 5, 6, 7}, emptypotion = 7634, mana = {1200, 1200}},
[7590] = {level = 80, vocations = {1, 2, 5, 6}, emptypotion = 7635, mana = {1200, 1200}},
[8704] = {vocations = all, emptypotion = 7636, health = {1200, 1200}},
[7618] = {vocations = all, emptypotion = 7636, health = {1200, 1200}},
[7588] = {level = 50, vocations = {3, 4, 7, 8}, emptypotion = 7634, health = {1200, 1200}},
[7591] = {level = 80, vocations = {4, 8}, emptypotion = 7635, health = {1200, 1200}},
[8473] = {level = 130, vocations = {4, 8}, emptypotion = 7635, health = {1200, 1200}},
[8472] = {level = 80, vocations = {3, 7}, emptypotion = 7635, health = {1200, 1200}, mana = {1200, 1200}},
}
local potionc = "" -- Use ".
function getVocNames(tab)
function getVocName(v)
return isInArray({1, 5}, v) and "sorcerers" or isInArray({2, 6}, v) and "druids" or isInArray({3,7}, v) and "paladins" or isInArray({4,8}, v) and "knights" or ""
end
for i = 1, #tab do
if not string.find((a == nil and "" or a), getVocName(tab)) then
a = a and a .. " and " .. getVocName(tab) or getVocName(tab)
end
end
return a
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isPlayer(itemEx.uid) then
if getPlayerAccess(cid) >= 4 or isInArray(potions[item.itemid].vocations, getPlayerVocation(itemEx.uid)) and getPlayerLevel(itemEx.uid) >= (potions[item.itemid].level == nil and 0 or potions[item.itemid].level) and getPlayerLevel(cid) >= (potions[item.itemid].level == nil and 0 or potions[item.itemid].level) then
if potions[item.itemid].mana then
doCreatureAddMana(itemEx.uid, math.random(potions[item.itemid].mana[1], potions[item.itemid].mana[2]))
end
if potions[item.itemid].health then
doCreatureAddHealth(itemEx.uid, math.random(potions[item.itemid].health[1], potions[item.itemid].health[2]))
end
if potionc == "transform" then
if getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).uid ~= 0 then
if getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).type < 100 then
doTransformItem(getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).uid, potions[item.itemid].emptypotion, getPlayerItemById(cid, TRUE, potions[item.itemid].emptypotion).type+1)
doRemoveItem(item.uid, 1)
else
doPlayerAddItem(cid, potions[item.itemid].emptypotion, 1)
doRemoveItem(item.uid, 1)
end
else
doPlayerAddItem(cid, potions[item.itemid].emptypotion, 1)
doRemoveItem(item.uid, 1)
end
elseif potionc == "remove" then
doRemoveItem(item.uid, 1)
end
doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
else
return doCreatureSay(itemEx.uid, "Only " .. getVocNames(potions[item.itemid].vocations) .. (potions[item.itemid].level and " of level " .. potions[item.itemid].level .. " or above " or " ") .. "may drink this fluid.", TALKTYPE_ORANGE_1)
end
end
return TRUE
end