-- by Keraxel // for otcentrum.pl
local config = {
effect = 1,
aolPrice = 25000
}
local prices = {
--[runeId] = {cost, charges, backpackColor, count},
--POTIONS--
[7618] = {800, 1, "red", 1}, --health potion
[7620] = {900, 1, "purple", 1}, --mana potion
[7588] = {1800, 1, "red", 1}, --strong health potion
[7589] = {1500, 1, "purple", 1}, --strong mana potion
[7591] = {3500, 1, "red", 1}, --great health potion
[7590] = {2200, 1, "purple", 1}, --great mana potion
[8472] = {3500, 1, "backpack", 1}, --great spirit potion
[8473] = {5800, 1, "red", 1}, --ultimate health potion
--RUNES--
[2273] = {3300, 3, "blue", 1}, --UH
[2268] = {6600, 3, "grey", 1}, --SD
[2313] = {4700, 6, "purple", 1}, --explosion
[2311] = {2200, 10, "purple", 1}, --heavy magic missile
[2304] = {3400, 4, "red", 1}, --great fireball
[2261] = {800, 3, "grey", 1}, --destroy field
[2262] = {3500, 2, "grey", 1}, --energy bomb
[2315] = {2800, 4, "purple", 1}, --thunderstorm
[2274] = {3400, 4, "blue", 1}, --avalanche
[2271] = {2900, 5, "blue", 1}, --icile
[2305] = {4400, 3, "red", 1}, --firebomb
[2278] = {5900, 2, "beach", 1}, --paralyze
[2293] = {2400, 5, "golden", 1}, --magic wall
[2197] = {6600, 5, "backpack", 1}, --STONESKINAMULET
}
-----
function onUse(cid, item, fromPosition, itemEx, toPosition)
local function backpackIdByName(name)
local backpacksId = {["green"]=1998, ["yellow"]=1999, ["red"]=2000, ["purple"]=2001, ["beach"]=5949, ["blue"]=2002, ["grey"]=2003, ["backpack"]=1988, ["golden"]=2004}
return backpacksId[name] or LUA_ERROR
end
local aid = item.actionid - 10000
if aid == 2173 then
if (doPlayerBuyItem(cid, 2173, 1, config.aolPrice, 1)) ~= LUA_ERROR then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've bought an amulet of loss.")
doSendMagicEffect(getCreaturePosition(cid), config.effect)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..config.aolPrice.." gold pieces.")
end
else
if (doPlayerBuyItemContainer(cid, backpackIdByName(prices[aid][3]), aid, 1, prices[aid][1], prices[aid][2])) == LUA_NO_ERROR then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You've bought a backpack of "..getItemName(aid)..".")
doSendMagicEffect(getCreaturePosition(cid), config.effect)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..prices[aid][1].." gold pieces.")
end
end
return TRUE
end