Difference for python/IPO/banksay.py from version 1.10 to 1.11


version 1.10 version 1.11
Line 22
 
Line 22
 # modified a bit by -Todd Mitchell  # modified a bit by -Todd Mitchell
   
   
 import CFPython  import Crossfire
   
 import string  import string
 import random  import random
 import CFBank  import CFBank
 import CFItemBroker  import CFItemBroker
   
 activator=CFPython.WhoIsActivator()  activator=Crossfire.WhoIsActivator()
 activatorname=CFPython.GetName(activator)  activatorname=activator.Name
 whoami=CFPython.WhoAmI()  whoami=Crossfire.WhoAmI()
 x=CFPython.GetXPosition(activator)  x=activator.X
 y=CFPython.GetYPosition(activator)  y=activator.Y
   
   
 #EASILY SETTABLE PARAMETERS  #EASILY SETTABLE PARAMETERS
Line 44
 
Line 44
 fees=(service_charge/100.0)+1  fees=(service_charge/100.0)+1
 bank = CFBank.CFBank(bankdatabase)  bank = CFBank.CFBank(bankdatabase)
   
 text = string.split(CFPython.WhatIsMessage())  text = string.split(Crossfire.WhatIsMessage())
 thanks_message = ['Thank you for banking the Imperial Way.', 'Thank you, please come \  thanks_message = ['Thank you for banking the Imperial Way.', 'Thank you, please come \
 again.', 'Thank you, please come again.','Thank you for banking the Imperial Way.', \  again.', 'Thank you, please come again.','Thank you for banking the Imperial Way.', \
 'Thank you for your patronage.', 'Thank you, have a nice day.', 'Thank you. "Service" \  'Thank you for your patronage.', 'Thank you, have a nice day.', 'Thank you. "Service" \
Line 61
 
Line 61
   
 elif text[0] == 'deposit':  elif text[0] == 'deposit':
  if len(text)==2:   if len(text)==2:
  if (CFPython.PayAmount(activator, int((int(text[1])*exchange_rate)*fees))):   if (activator.PayAmount(int((int(text[1])*exchange_rate)*fees))):
  bank.deposit(activatorname, int(text[1]))   bank.deposit(activatorname, int(text[1]))
  message = '%d received, %d imperials deposited to bank account.  %s' \   message = '%d received, %d imperials deposited to bank account.  %s' \
  %((int(text[1])*(exchange_rate/50))*fees,int(text[1]),random.choice(thanks_message))   %((int(text[1])*(exchange_rate/50))*fees,int(text[1]),random.choice(thanks_message))
Line 75
 
Line 75
  if (bank.withdraw(activatorname, int(text[1]))):   if (bank.withdraw(activatorname, int(text[1]))):
  message = '%d imperials withdrawn from bank account.  %s' \   message = '%d imperials withdrawn from bank account.  %s' \
  %(int(text[1]),random.choice(thanks_message))   %(int(text[1]),random.choice(thanks_message))
  id = CFPython.CreateObject('imperial', (x, y))   id = activator.Map.CreateObject('imperial', (x, y))
  CFItemBroker.Item(id).add(int(text[1]))   CFItemBroker.Item(id).add(int(text[1]))
  else:   else:
  message = 'Not enough imperials on your account'   message = 'Not enough imperials on your account'
Line 84
 
Line 84
   
 elif text[0] == 'exchange':  elif text[0] == 'exchange':
     if len(text)==2:      if len(text)==2:
         inv=CFPython.CheckInventory(activator,'imperial')          inv=activator.CheckInventory('imperial')
         if inv:          if inv:
             pay = CFItemBroker.Item(inv).subtract(int(text[1]))              pay = CFItemBroker.Item(inv).subtract(int(text[1]))
             if pay:              if pay:
                 id = CFPython.CreateObject('platinum coin', (x, y))                  id = activator.Map.CreateObject('platinum coin', (x, y))
                 CFItemBroker.Item(id).add(int(text[1])*(exchange_rate/50))                  CFItemBroker.Item(id).add(int(text[1])*(exchange_rate/50))
                 message = random.choice(thanks_message)                  message = random.choice(thanks_message)
             else:              else:
Line 109
 
Line 109
 else:  else:
  message = 'Do you need help?'   message = 'Do you need help?'
   
 CFPython.Say(whoami, message)  whoami.Say(message)


Legend:
line(s) removed in v.1.10 
line(s) changed
 line(s) added in v.1.11

File made using version 1.96 of cvs2html by leaf at 2006-02-15 17:27