local config = {
[3001] = {potion = 8472, cost = 6500, backpack_id = 2003, charges = 3}, -- sudden death rune rune
[1254] = {potion = 2273, cost = 3500, backpack_id = 2002, charges = 1}, -- ultimate healing rune
[1256] = {potion = 2293, cost = 7000, backpack_id = 2004, charges = 3}, -- magic wall rune
[1256] = {potion = 2293, cost = 7000, backpack_id = 2004, charges = 3}, -- explosion rune
[1256] = {potion = 2293, cost = 7000, backpack_id = 2004, charges = 3}, -- great fireball
} -- config end --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = config[item.uid]
if isInArray({1945, 1946}, item.itemid) ~= TRUE then
return TRUE
end
if doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, potion.charges) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a backpack "..getItemNameById(potion.potion)..".")
end
return TRUE
end