diff --git a/python/IPO/banksay.py b/python/IPO/banksay.py new file mode 100644 index 000000000..2f573209f --- /dev/null +++ b/python/IPO/banksay.py @@ -0,0 +1,73 @@ +# Script for say event of IPO employees +# +# Copyright (C) 2002 Joris Bontje +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# The author can be reached via e-mail at jbontje@suespammers.org +# +#Updated to use new path functions in CFPython and broken apart by -Todd Mitchell + + +import CFPython + +import sys +sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory())) + +import string +import CFBank + +activator=CFPython.WhoIsActivator() +activatorname=CFPython.GetName(activator) +whoami=CFPython.WhoAmI() +x=CFPython.GetXPosition(activator) +y=CFPython.GetYPosition(activator) + +bank = CFBank.CFBank() + +text = string.split(CFPython.WhatIsMessage()) + + +if text[0] == 'help' or text[0] == 'yes': + message = 'Here is a quick list of commands:\n\n- deposit\n- withdraw\n- balance\nAll transactions are in Imperials\n(1 Ip = 1000 platinum coins).' + CFPython.Say(whoami,message) + +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 "') + +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 Imperials on your account') + else: + CFPython.Say(whoami, 'Usage "withdraw "') + +elif text[0] == 'balance': + balance = bank.getbalance(activatorname) + CFPython.Say(whoami, 'Amount on bank: %d Ip'%balance) + +else: + CFPython.Say(whoami, 'Do you need help?') diff --git a/python/IPO/say.py b/python/IPO/say.py index 1e2998e01..2429729b0 100755 --- a/python/IPO/say.py +++ b/python/IPO/say.py @@ -38,7 +38,6 @@ sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDire import string import CFLog -import CFBank activator=CFPython.WhoIsActivator() activatorname=CFPython.GetName(activator) @@ -49,9 +48,6 @@ y=CFPython.GetYPosition(activator) log = CFLog.CFLog() text = string.split(CFPython.WhatIsMessage()) -bank = CFBank.CFBank() - - 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 (%s platinum)\n- seen (free)\n'%(priceWritingPen,priceScrollOfLiteracy,priceMailScroll) CFPython.Say(whoami,message) @@ -113,36 +109,11 @@ elif text[0] == 'seen': if len(text)==2: if log.exist(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: CFPython.Say(whoami, "I have never seen '%s' joining" % text[1]) else: CFPython.Say(whoami, 'Usage "seen "') -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 "') - -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 "') - -elif text[0] == 'balance': - balance = bank.getbalance(activatorname) - CFPython.Say(whoami, 'Amount on bank: %d kp'%balance) - else: CFPython.Say(whoami, 'Do you need help?') diff --git a/python/IPO/seen.py b/python/IPO/seen.py new file mode 100644 index 000000000..2c6ebcd93 --- /dev/null +++ b/python/IPO/seen.py @@ -0,0 +1,53 @@ +# Script for seen event +# +# Copyright (C) 2002 Joris Bontje +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# The author can be reached via e-mail at jbontje@suespammers.org +# +#Updated to use new path functions in CFPython, and broken into tiny bits by -Todd Mitchell +# +# seen - tells player information from logger + +import CFPython + +import sys +sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory())) + +import CFLog + +activator=CFPython.WhoIsActivator() +activatorname=CFPython.GetName(activator) +whoami=CFPython.WhoAmI() +x=CFPython.GetXPosition(activator) +y=CFPython.GetYPosition(activator) + +log = CFLog.CFLog() +text = string.split(CFPython.WhatIsMessage()) + +if text[0] == 'seen': + if len(text)==2: + if log.exist(text[1]): + ip, date, count = log.info(text[1]) + CFPython.Say(whoami, "I have seen '%s' joining %d times, last at %s." % (text[1], count, date)) + else: + CFPython.Say(whoami, "I have never seen '%s' joining" % text[1]) + else: + CFPython.Say(whoami, 'Usage "seen "') + + +else: + CFPython.Say(whoami, 'You looking for someone?')