Difference for python/IPO/say.py from version 1.6 to 1.7


version 1.6 version 1.7
Line 30
 
Line 30
 priceWritingPen=100  priceWritingPen=100
 priceScrollOfLiteracy=5000  priceScrollOfLiteracy=5000
 priceMailScroll=5  priceMailScroll=5
   priceBag = 5
   pricePackage = 50
   priceCarton = 200
   priceFactor = 50 # platinum to silver conversion
   
   # Map storage
   storage_map = '/planes/IPO_storage'
   storage_x = 2
   storage_y = 2
   
   # Post office sack name (one word without space)
   sackName = 'package'
   
 import CFPython  import CFPython
 import string  import string
Line 45
 
Line 57
 text = string.split(CFPython.WhatIsMessage())  text = string.split(CFPython.WhatIsMessage())
   
 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'%(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- bag <friend>   (%s platinum)\n- package <friend>   (%s platinum)\n- carton <friend>   (%s platinum)\n- send <friend>\n- receive'%(priceWritingPen,priceScrollOfLiteracy,priceMailScroll,priceBag,pricePackage,priceCarton)
  CFPython.Say(whoami,message)   CFPython.Say(whoami,message)
   
 elif text[0] == 'pen':  elif text[0] == 'pen':
  if (CFPython.PayAmount(activator, priceWritingPen*50)):   if (CFPython.PayAmount(activator, priceWritingPen*priceFactor)):
  CFPython.Say(whoami, 'Here is your IPO Writing Pen')   CFPython.Say(whoami, 'Here is your IPO Writing Pen')
  id = CFPython.CreateObject('writing pen', (x, y))   id = CFPython.CreateObject('writing pen', (x, y))
  CFPython.SetName(id, 'IPO Writing Pen')   CFPython.SetName(id, 'IPO Writing Pen')
Line 58
 
Line 70
  CFPython.Say(whoami, 'You need %s platinum for an IPO Writing Pen'%priceWritingPen)   CFPython.Say(whoami, 'You need %s platinum for an IPO Writing Pen'%priceWritingPen)
   
 elif text[0] == 'literacy':  elif text[0] == 'literacy':
  if (CFPython.PayAmount(activator,priceScrollOfLiteracy*50)):   if (CFPython.PayAmount(activator,priceScrollOfLiteracy*priceFactor)):
         CFPython.Say(whoami, 'Here is your IPO Scroll of Literacy')          CFPython.Say(whoami, 'Here is your IPO Scroll of Literacy')
         id = CFPython.CreateObject('scroll of literacy', (x, y))          id = CFPython.CreateObject('scroll of literacy', (x, y))
  CFPython.SetName(id, 'IPO Scroll of Literacy')   CFPython.SetName(id, 'IPO Scroll of Literacy')
Line 70
 
Line 82
 elif text[0] == 'mailscroll':  elif text[0] == 'mailscroll':
  if len(text)==2:   if len(text)==2:
  if log.info(text[1]):   if log.info(text[1]):
  if (CFPython.PayAmount(activator, priceMailScroll)):   if (CFPython.PayAmount(activator, priceMailScroll*priceFactor)):
  CFPython.Say(whoami, 'Here is your mailscroll')   CFPython.Say(whoami, 'Here is your mailscroll')
  id = CFPython.CreateObject('scroll', (x, y))   id = CFPython.CreateObject('scroll', (x, y))
  CFPython.SetName(id, 'mailscroll T: '+text[1]+' F: '+ activatorname)   CFPython.SetName(id, 'mailscroll T: '+text[1]+' F: '+ activatorname)
Line 100
 
Line 112
  else:   else:
  CFPython.Say(whoami, 'You need to be DM to be able to use this command')   CFPython.Say(whoami, 'You need to be DM to be able to use this command')
   
   elif text[0] == 'bag' or text[0] == 'package' or text[0] == 'carton':
    if (len(text) == 2):
    if log.info(text[1]):
    if text[0] == 'bag':
    price = priceBag
    max = 5000
    item = 'r_sack'
    elif text[0] == 'package':
    price = pricePackage
    max = 50000
    item = 'r_sack'
    else:
    price = priceCarton
    max = 100000
    item = 'r_sack'
   
    if ( CFPython.PayAmount(activator, price*priceFactor) ):
    box = CFPython.CreateObject(item, (x, y))
    CFPython.SetName(box, sackName + ' T: ' + text[1] + ' F: ' + activatorname)
    CFPython.SetWeightLimit(box, max)
    CFPython.SetStrength(box, 0)
    CFPython.Say(whoami, 'Here is your %s'%text[0])
    CFPython.InsertObjectInside(box, activator)
    else:
    CFPython.Say(whoami, 'You need %s platinum to buy a %s'%( price, text[0] ) )
   
    else:
    CFPython.Say(whoami, 'I don\'t know any %s'%text[1])
   
    else:
    CFPython.Say(whoami, 'Send a %s to who?'%text[0] )
   
   elif text[0] == 'send':
    if len(text) == 2:
    inv = CFPython.CheckInventory(activator,sackName)
    map = 0
    if inv != 0:
    while inv != 0:
    next = CFPython.GetNextObject(inv)
    text2=string.split(CFPython.GetName(inv))
    if text2[0]==sackName and text2[1]=='T:' and text2[3]=='F:' and text2[2] == text[1]:
    map = CFPython.ReadyMap(storage_map)
    if map == 0:
    CFPython.Say(whoami, 'I\'m sorry but the post can\'t send your package now.')
    else:
    CFPython.Teleport(inv, map, storage_x, storage_y)
    CFPython.Say(whoami, 'Package sent')
    inv = next
    else:
    CFPython.Say(whoami, 'No package to send.')
    else:
    CFPython.Say(whoami, 'Send packages to who?')
   elif text[0] == 'receive':
    map = CFPython.ReadyMap(storage_map)
    if ( map != 0 ):
    item = CFPython.GetObjectAt(map, storage_x, storage_y)
    count = 0
    while item != 0:
    previous = CFPython.GetPreviousObject(item)
    text2 = string.split(CFPython.GetName(item))
    if ( len(text2) == 5 ) and ( text2[0] == sackName ) and ( text2[2] == activatorname ):
    CFPython.InsertObjectInside(item,activator)
    count = count + 1
    item = previous
    if ( count == 0 ):
    CFPython.Say(whoami, 'No package for you, sorry.')
    else:
    CFPython.Say(whoami, 'Here you go.')
    else:
    CFPython.Say(whoami, 'Sorry, our package delivery service is currently in strike. Please come back later.')
 else:  else:
  CFPython.Say(whoami, 'Do you need help?')   CFPython.Say(whoami, 'Do you need help?')


Legend:
line(s) removed in v.1.6 
line(s) changed
 line(s) added in v.1.7

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