<?xml version="1.0" encoding="UTF-8"?>
<mod name="action-shop" version="1.0" author="slawkens" contact="[email protected]" enabled="yes">
<config name="action-shop-config"><![CDATA[
items = {
-- health potions
[3001] = {itemid = 7618, cost = 1000, backpack = 2000, name = "backpack of health potions"},
[3002] = {itemid = 7588, cost = 2100, backpack = 2000, name = "backpack of strong health potions"},
[3003] = {itemid = 7591, cost = 3900, backpack = 2000, name = "backpack of great health potions"},
[3004] = {itemid = 8473, cost = 6300, backpack = 2000, name = "backpack of ultimate health potions"},
-- mana potions
[3005] = {itemid = 7620, cost = 1100, backpack = 2001, name = "backpack of mana potions"},
[3006] = {itemid = 7589, cost = 1700, backpack = 2001, name = "backpack of strong mana potions"},
[3007] = {itemid = 7590, cost = 2500, backpack = 2001, name = "backpack of great mana potions"},
-- spirit potions
[3008] = {itemid = 8472, cost = 3900, backpack = 1999, name = "backpack of great spirit potions"},
-- runes
[3009] = {itemid = 2268, cost = 7100, backpack = 2003, name = "backpack of sudden death runes", charges = 3},
[3010] = {itemid = 2273, cost = 6100, backpack = 2002, name = "backpack of ultimate healing runes", charges = 2},
-- other
[3011] = {itemid = 2120, cost = 50, name = "rope"},
[3012]= {itemid = 2554, cost = 40, name = "shovel"},
[3013]= {itemid = 2109, cost = 20000, name = "football"}
}
]]></config>
<action fromaid="3001" toaid="3013" event="script"><![CDATA[
domodlib('action-shop-config')
local items = items
function onUse(cid, item, fromPosition, itemEx, toPosition)
local tmp = items[item.actionid]
if(not tmp) then
error('ERROR - action-shop mod: actionid is empty.')
return false
end
local count = (tmp.count ~= nil and tmp.count or 1)
local charges = (tmp.charges ~= nil and tmp.charges or 1)
if(tmp.backpack) then
if(doPlayerBuyItemContainer(cid, tmp.backpack, tmp.itemid, 1, tmp.cost, charges)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought a " .. tmp.name .. ".")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enought money. (" .. tmp.cost .. "gp)")
end
else
if(doPlayerBuyItem(cid, tmp.itemid, count, tmp.cost, charges)) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. tmp.name .. ".")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have enought money. (" .. tmp.cost .. "gp)")
end
end
return true
end
]]></action>
</mod>