Crossfire Server, Trunk
deposit_box.py
Go to the documentation of this file.
1 import CFBank
2 import Crossfire
3 
4 activator = Crossfire.WhoIsActivator()
5 whoami = Crossfire.WhoAmI()
6 
7 def get_inventory(obj):
8  """An iterator for a given object's inventory."""
9  current_item = obj.Inventory
10  while current_item != None:
11  next_item = current_item.Below
12  yield current_item
13  current_item = next_item
14 
16  """Find the total value of items in the deposit box and deposit."""
17  total_value = 0
18  for obj in get_inventory(whoami):
19  if obj.Name != 'event_close':
20  total_value += obj.Value * obj.Quantity
21  obj.Remove()
22  with CFBank.open() as bank:
23  bank.deposit(activator.Name, total_value)
24  whoami.Say("%s credited to your account." \
25  % Crossfire.CostStringFromValue(total_value))
26 
CFBank.open
def open()
Definition: CFBank.py:69
deposit_box.get_inventory
def get_inventory(obj)
Definition: deposit_box.py:7
deposit_box.deposit_box_close
def deposit_box_close()
Definition: deposit_box.py:15