forked from slawkens/tfs-mods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action-shop.xml
61 lines (52 loc) · 2.63 KB
/
action-shop.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="UTF-8"?>
<mod name="action-shop" version="1.0" author="slawkens" contact="slawkens@gmail.com" enabled="yes">
<config name="action-shop-config"><![CDATA[
items = {
-- health potions
[3001] = {itemid = 7618, cost = 1000, container = 2000, name = "backpack of health potions"},
[3002] = {itemid = 7588, cost = 2100, container = 2000, name = "backpack of strong health potions"},
[3003] = {itemid = 7591, cost = 3900, container = 2000, name = "backpack of great health potions"},
[3004] = {itemid = 8473, cost = 6300, container = 2000, name = "backpack of ultimate health potions"},
-- mana potions
[3005] = {itemid = 7620, cost = 1100, container = 2001, name = "backpack of mana potions"},
[3006] = {itemid = 7589, cost = 1700, container = 2001, name = "backpack of strong mana potions"},
[3007] = {itemid = 7590, cost = 2500, container = 2001, name = "backpack of great mana potions"},
-- spirit potions
[3008] = {itemid = 8472, cost = 3900, container = 1999, name = "backpack of great spirit potions"},
-- runes
[3009] = {itemid = 2268, cost = 7100, container = 2003, name = "backpack of sudden death runes", charges = 3},
[3010] = {itemid = 2273, cost = 6100, container = 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('action-shop.xml :: 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.container) then
if(doPlayerBuyItemContainer(cid, tmp.container, 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>