27 priceScrollOfLiteracy = 5000
33 packages = {
'bag' : [ 5, 5000,
'bag',
'IPO-bag'],
34 'package' : [ 45, 50000,
'package',
'IPO-package' ],
35 'carton' : [ 90, 100000,
'carton_box_1',
'IPO-carton' ] }
38 storage_map =
'/planes/IPO_storage'
46 activator = Crossfire.WhoIsActivator()
47 activatorname = activator.Name
48 whoami = Crossfire.WhoAmI()
54 text = Crossfire.WhatIsMessage().
split()
57 if Crossfire.MatchString(
"buy", text[0]):
58 whoami.Say(
"Well, we have a few items for sale. You can also send out letters and packages to your friends. What can I interest you in?")
59 Crossfire.AddReply(
"items",
"What items do you sell?")
60 Crossfire.AddReply(
"letter",
"I'd like to send a letter.")
61 Crossfire.AddReply(
"mail",
"I want to send a package.")
63 elif Crossfire.MatchString(
"items", text[0]):
64 whoami.Say(
"Here are the items on sale:\n" +
65 " - pen (%i platinum)\n" % priceWritingPen +
66 " - literacy scroll (%i platinum)\n" % priceScrollOfLiteracy +
67 "Please tell me what you'd like to buy.")
69 if activator.DungeonMaster:
70 whoami.Say(
"Oh, and as a dungeon master, you can also order:\n" +
71 " - mailwarning <player name> (free)")
73 elif Crossfire.MatchString(
"letter", text[0]):
74 whoami.Say(
"For %i platinum you can send a letter to your friend. Just say 'mailscroll <friend name>'." % priceMailScroll)
76 elif Crossfire.MatchString(
"mail", text[0]):
77 reply =
"To send items, select one of our following containers:\n"
79 for pack
in packages.keys():
81 reply +=
" - %s (limit %d kg, %d platinum)\n" % (pack, packages[pack][1] / 1000, packages[pack][0])
83 reply +=
"To buy it, say <container type> <friend name>'.\n"
84 reply +=
"When you're ready to send it, say 'send <friend name>'."
88 elif text[0] ==
'pen':
89 if activator.PayAmount(priceWritingPen*priceFactor):
90 whoami.Say(
"Here is your pen, enjoy!")
91 id = activator.Map.CreateObject(
'writing pen', x, y)
92 id.Name =
'IPO writing pen'
95 whoami.Say(
"I'm sorry, you need %d platinum to buy a pen." % priceWritingPen)
97 elif text[0] ==
'literacy':
98 if activator.PayAmount(priceScrollOfLiteracy*priceFactor):
99 whoami.Say(
'Here is your IPO Scroll of Literacy')
100 id = activator.Map.CreateObject(
'scroll of literacy', x, y)
101 id.Name =
'IPO Scroll of Literacy'
102 id.NamePl =
'IPO Scrolls of Literacy'
105 whoami.Say(
'You need %s platinum for an IPO Scroll of Literacy'%priceScrollOfLiteracy)
108 elif text[0] ==
'mailscroll':
110 if log.info(text[1]):
111 if activator.PayAmount(priceMailScroll*priceFactor):
112 whoami.Say(
'Here is your mailscroll')
113 id = activator.Map.CreateObject(
'scroll', x, y)
114 id.Name =
'mailscroll T: '+text[1]+
' F: '+activatorname
115 id.NamePl =
'mailscrolls T: '+text[1]+
' F: '+activatorname
118 whoami.Say(
'You need %s platinum for a mailscroll'%priceMailScroll)
120 whoami.Say(
'I don\'t know %s'%text[1])
123 whoami.Say(
'Usage "mailscroll <friend>"')
126 elif text[0] ==
'mailwarning':
127 if activator.DungeonMaster:
129 if log.info(text[1]):
130 whoami.Say(
'Here is your mailwarning')
131 id = activator.Map.CreateObject(
'diploma', x, y)
132 id.Name =
'mailwarning T: '+text[1]+
' F: '+activatorname
133 id.NamePl =
'mailwarnings T: '+text[1]+
' F: '+activatorname
136 whoami.Say(
'I don\'t know any %s'%text[1])
139 whoami.Say(
'Usage "mailwarning <player>"')
141 whoami.Say(
'You need to be DM to be able to use this command')
144 elif text[0]
in packages:
146 if log.info(text[1]):
147 price = packages[text[0]][0]
148 max = packages[text[0]][1]
149 item = packages[text[0]][2]
151 if activator.PayAmount(price*priceFactor):
152 box = activator.CreateObject(item)
153 box.Name = packages[text[0]][3] +
' T: '+text[1]+
' F: '+activatorname
154 box.WeightLimit = max
156 whoami.Say(
'Here is your %s'%text[0])
158 whoami.Say(
'You need %s platinum to buy a %s'%(price, text[0]))
161 whoami.Say(
'I don\'t know any %s'%text[1])
164 whoami.Say(
'Send a %s to who?'%text[0] )
167 elif text[0] ==
'send':
170 for package
in packages.keys():
171 sackName = packages[package][3]
172 inv = activator.CheckInventory(sackName)
175 text2 = inv.Name.split()
176 if len(text2) == 5
and text2[0] == sackName
and text2[1] ==
'T:' and text2[3] ==
'F:' and text2[2] == text[1]:
177 map = Crossfire.ReadyMap(storage_map)
180 inv.Name = sackName+
' F: '+text2[4]+
' T: '+text2[2]
182 inv.Teleport(map, storage_x, storage_y)
185 whoami.Say(
'I\'m sorry but the post can\'t send your package now.')
188 whoami.Say(
'No package to send.')
190 whoami.Say(
'Package sent.')
192 whoami.Say(
'%d packages sent.'%count)
194 whoami.Say(
'Send packages to who?')
197 elif text[0] ==
'receive':
198 map = Crossfire.ReadyMap(storage_map)
201 for package
in packages.keys():
202 sackName = packages[package][3]
203 item = map.ObjectAt(storage_x, storage_y)
205 previous = item.Above
206 text2 = item.Name.split()
207 if len(text2) == 5
and text2[0] == sackName
and text2[4] == activatorname:
208 item.Name = item.Name+
' (used)'
209 item.InsertInto(activator)
213 whoami.Say(
'No package for you, sorry.')
215 whoami.Say(
'Here you go.')
217 whoami.Say(
"I'm sorry, our package delivery service is currently on strike. Please come back later.")
221 whoami.Say(
"Welcome to the IPO! How can I help you?")
222 Crossfire.AddReply(
"buy",
"What can I buy here?")
223 Crossfire.AddReply(
"receive",
"Do I have any packages?")
225 Crossfire.SetReturnValue(1)