- breaking out seen into it's own script, the bank stuff into it's own
script and removing the part if the seen command that hands out players IP addresses to other players. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@2269 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
0c1c79272a
commit
42c4b9eb73
|
@ -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 <amount Ip>"')
|
||||
|
||||
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 <amount Ip>"')
|
||||
|
||||
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?')
|
|
@ -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 <friend> (%s platinum)\n- seen <friend> (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 <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:
|
||||
CFPython.Say(whoami, 'Do you need help?')
|
||||
|
|
|
@ -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 <friend>"')
|
||||
|
||||
|
||||
else:
|
||||
CFPython.Say(whoami, 'You looking for someone?')
|
Loading…
Reference in New Issue