Improved look of IPO package system

git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@5409 282e977c-c81d-0410-88c4-b93c2d0d6712
master
aaron_baugher 2007-02-09 00:18:23 +00:00
parent 1c80406896
commit 1abd8198b4
2 changed files with 36 additions and 26 deletions

7
ChangeLog 100644
View File

@ -0,0 +1,7 @@
ChangeLog for SVN maps trunk directory:
---------------------------------------------------------------------------
python/IPO/say.py:
Changed code to give different packages different names and faces,
and to make packages clearly show they are used after being received.
-- Aaron Baugher 2007-02-08

View File

@ -41,7 +41,7 @@ storage_x = 2
storage_y = 2 storage_y = 2
# Post office sack name (one word without space) # Post office sack name (one word without space)
sackName = 'package' sackNames = [ 'IPO-bag', 'IPO-package', 'IPO-carton' ]
import Crossfire import Crossfire
import string import string
@ -130,7 +130,7 @@ elif text[0] == 'bag' or text[0] == 'package' or text[0] == 'carton':
if text[0] == 'bag': if text[0] == 'bag':
price = priceBag price = priceBag
max = 5000 max = 5000
item = 'r_sack' item = 'bag'
elif text[0] == 'package': elif text[0] == 'package':
price = pricePackage price = pricePackage
max = 50000 max = 50000
@ -138,11 +138,11 @@ elif text[0] == 'bag' or text[0] == 'package' or text[0] == 'carton':
else: else:
price = priceCarton price = priceCarton
max = 100000 max = 100000
item = 'r_sack' item = 'present_box_2'
if activator.PayAmount(price*priceFactor): if activator.PayAmount(price*priceFactor):
box = activator.CreateObject(item) box = activator.CreateObject(item)
box.Name = sackName+' T: '+text[1]+' F: '+activatorname box.Name = 'IPO-'+text[0]+' T: '+text[1]+' F: '+activatorname
box.WeightLimit = max box.WeightLimit = max
box.Str = 0 box.Str = 0
whoami.Say('Here is your %s'%text[0]) whoami.Say('Here is your %s'%text[0])
@ -159,21 +159,22 @@ elif text[0] == 'bag' or text[0] == 'package' or text[0] == 'carton':
elif text[0] == 'send': elif text[0] == 'send':
if len(text) == 2: if len(text) == 2:
count = 0 count = 0
inv = activator.CheckInventory(sackName) for sackName in sackNames:
while inv: inv = activator.CheckInventory(sackName)
next = inv.Below while inv:
text2 = string.split(inv.Name) next = inv.Below
if len(text2) == 5 and text2[0] == sackName and text2[1] == 'T:' and text2[3] == 'F:' and text2[2] == text[1]: text2 = string.split(inv.Name)
map = Crossfire.ReadyMap(storage_map) if len(text2) == 5 and text2[0] == sackName and text2[1] == 'T:' and text2[3] == 'F:' and text2[2] == text[1]:
if map: map = Crossfire.ReadyMap(storage_map)
# rename container to prevent sending it multiple times if map:
inv.Name = sackName+' F: '+text2[4]+' T: '+text2[2] # rename container to prevent sending it multiple times
inv.Name = sackName+' F: '+text2[4]+' T: '+text2[2]
inv.Teleport(map, storage_x, storage_y) inv.Teleport(map, storage_x, storage_y)
count = count+1 count = count+1
else: else:
whoami.Say('I\'m sorry but the post can\'t send your package now.') whoami.Say('I\'m sorry but the post can\'t send your package now.')
inv = next inv = next
if count <= 0: if count <= 0:
whoami.Say('No package to send.') whoami.Say('No package to send.')
elif count == 1: elif count == 1:
@ -188,14 +189,16 @@ elif text[0] == 'receive':
map = Crossfire.ReadyMap(storage_map) map = Crossfire.ReadyMap(storage_map)
if map: if map:
count = 0 count = 0
item = map.ObjectAt(storage_x, storage_y) for sackName in sackNames:
while item: item = map.ObjectAt(storage_x, storage_y)
previous = item.Above while item:
text2 = string.split(item.Name) previous = item.Above
if len(text2) == 5 and text2[0] == sackName and text2[4] == activatorname: text2 = string.split(item.Name)
item.InsertInto(activator) if len(text2) == 5 and text2[0] == sackName and text2[4] == activatorname:
count = count+1 item.Name = item.Name+' (used)'
item = previous item.InsertInto(activator)
count = count+1
item = previous
if count <= 0: if count <= 0:
whoami.Say('No package for you, sorry.') whoami.Say('No package for you, sorry.')
else: else: