Difference for python/IPO/say.py from version 1.1 to 1.2


version 1.1 version 1.2
Line 38
 
Line 38
   
 import string  import string
 import CFLog  import CFLog
 import CFBank  
   
 activator=CFPython.WhoIsActivator()  activator=CFPython.WhoIsActivator()
 activatorname=CFPython.GetName(activator)  activatorname=CFPython.GetName(activator)
Line 49
 
Line 48
 log = CFLog.CFLog()  log = CFLog.CFLog()
 text = string.split(CFPython.WhatIsMessage())  text = string.split(CFPython.WhatIsMessage())
   
 bank = CFBank.CFBank()  
   
   
 if text[0] == 'help' or text[0] == 'yes':  if text[0] == 'help' or text[0] == 'yes':
  message = 'How can I help you ? Here is a quick list of commands:\n\n- pen   (%s platinum)\n- literacy    (%s platinum)\n- mailscroll <friend>   (%s platinum)\n- seen <friend>   (free)\n'%(priceWritingPen,priceScrollOfLiteracy,priceMailScroll)   message = 'How can I help you ? Here is a quick list of commands:\n\n- pen   (%s platinum)\n- literacy    (%s platinum)\n- mailscroll <friend>   (%s platinum)\n- seen <friend>   (free)\n'%(priceWritingPen,priceScrollOfLiteracy,priceMailScroll)
  CFPython.Say(whoami,message)   CFPython.Say(whoami,message)
Line 113
 
Line 109
  if len(text)==2:   if len(text)==2:
  if log.exist(text[1]):   if log.exist(text[1]):
  ip, date, count = log.info(text[1])   ip, date, count = log.info(text[1])
  CFPython.Say(whoami, "I have seen '%s' joining %d times, last at %s, using IP: %s" % (text[1], count, date, ip))   CFPython.Say(whoami, "I have seen '%s' joining %d times, last at %s." % (text[1], count, date))
  else:   else:
  CFPython.Say(whoami, "I have never seen '%s' joining" % text[1])   CFPython.Say(whoami, "I have never seen '%s' joining" % text[1])
  else:   else:
  CFPython.Say(whoami, 'Usage "seen <friend>"')   CFPython.Say(whoami, 'Usage "seen <friend>"')
   
 elif text[0] == 'deposit':  
  if len(text)==2:  
  if (CFPython.PayAmount(activator, int(text[1])*50000)):  
  bank.deposit(activatorname, int(text[1]))  
  CFPython.Say(whoami, 'Deposited to bank account')  
  else:  
  CFPython.Say(whoami, 'You need %d platinum'%(int(text[1])*1000))  
  else:  
  CFPython.Say(whoami, 'Usage "deposit <amount kp>"')  
   
 elif text[0] == 'withdraw':  
  if len(text)==2:  
  if (bank.withdraw(activatorname, int(text[1]))):  
  CFPython.Say(whoami, 'Withdrawn from bank account')  
  id = CFPython.CreateObject('platinum coin', (x, y))  
  CFPython.SetQuantity(id, int(text[1])*1000)  
  else:  
  CFPython.Say(whoami, 'Not enough kp on your account')  
  else:  
  CFPython.Say(whoami, 'Usage "withdraw <amount kp>"')  
   
 elif text[0] == 'balance':  
     balance = bank.getbalance(activatorname)  
     CFPython.Say(whoami, 'Amount on bank: %d kp'%balance)  
   
 else:  else:
  CFPython.Say(whoami, 'Do you need help?')   CFPython.Say(whoami, 'Do you need help?')


Legend:
line(s) removed in v.1.1 
line(s) changed
 line(s) added in v.1.2

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