- move the ImperialPost python files to the python directory, unclude system pathfinding from CFPython
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@1992 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
7c8beb53ba
commit
9dcd72efa0
|
@ -0,0 +1,55 @@
|
|||
# CFBank.py - CFBank class
|
||||
#
|
||||
# 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 -Todd Mitchell
|
||||
|
||||
|
||||
import shelve
|
||||
|
||||
import CFgetPaths
|
||||
|
||||
class CFBank:
|
||||
|
||||
bankdb_file = '%scrossfirebank' % (CFgetPaths.getPaths('localdir'))
|
||||
bankdb = {}
|
||||
|
||||
def __init__(self):
|
||||
self.bankdb = shelve.open(self.bankdb_file)
|
||||
|
||||
def deposit(self, user, amount):
|
||||
if not self.bankdb.has_key(user):
|
||||
self.bankdb[user]=amount
|
||||
else:
|
||||
temp=self.bankdb[user]
|
||||
self.bankdb[user]=temp+amount
|
||||
|
||||
def withdraw(self, user, amount):
|
||||
if self.bankdb.has_key(user):
|
||||
if (self.bankdb[user] >= amount):
|
||||
temp=self.bankdb[user]
|
||||
self.bankdb[user]=temp-amount
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def getbalance(self,user):
|
||||
if self.bankdb.has_key(user):
|
||||
return self.bankdb[user]
|
||||
else:
|
||||
return 0
|
|
@ -0,0 +1,70 @@
|
|||
# CFBoard.py - CFBoard class
|
||||
#
|
||||
# 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 -Todd Mitchell
|
||||
|
||||
|
||||
import shelve
|
||||
|
||||
import CFgetPaths
|
||||
|
||||
class CFBoard:
|
||||
|
||||
boarddb_file = '%scrossfireboard' % (CFgetPaths.getPaths('localdir'))
|
||||
boarddb = {}
|
||||
total = 0
|
||||
|
||||
def __init__(self):
|
||||
self.boarddb = shelve.open(self.boarddb_file)
|
||||
|
||||
def write(self, boardname, author, message):
|
||||
if not self.boarddb.has_key(boardname):
|
||||
self.boarddb[boardname]=[[author,message]]
|
||||
else:
|
||||
temp=self.boarddb[boardname]
|
||||
temp.append([author,message])
|
||||
self.boarddb[boardname]=temp
|
||||
|
||||
def list(self, boardname):
|
||||
if self.boarddb.has_key(boardname):
|
||||
elements=self.boarddb[boardname]
|
||||
return elements
|
||||
|
||||
|
||||
def delete(self, boardname, id):
|
||||
if self.boarddb.has_key(boardname):
|
||||
if id>0 and id<=len(self.boarddb[boardname]):
|
||||
temp=self.boarddb[boardname]
|
||||
temp.pop(id-1)
|
||||
self.boarddb[boardname]=temp
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def countmsg(self, boardname):
|
||||
if self.boarddb.has_key(boardname):
|
||||
return len(self.boarddb[boardname])
|
||||
else:
|
||||
return 0
|
||||
|
||||
def getauthor(self, boardname, id):
|
||||
if self.boarddb.has_key(boardname):
|
||||
if id>0 and id<=len(self.boarddb[boardname]):
|
||||
author,message=self.boarddb[boardname][id-1]
|
||||
return author
|
|
@ -4,11 +4,12 @@
|
|||
#Please do not put CFPython functions in this file,
|
||||
#but rather place these in the calling file (don't ask me why - it just feels right)
|
||||
|
||||
import CFgetPaths
|
||||
import os.path
|
||||
import shelve
|
||||
import random
|
||||
|
||||
import CFgetPaths
|
||||
|
||||
class SlotMachine:
|
||||
#sets up the file that holds all the slotmachine jackpots
|
||||
#make sure this points to your writable var/crossfire directory
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
# CFLog.py - CFLog class
|
||||
#
|
||||
# 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 -Todd Mitchell
|
||||
|
||||
import shelve
|
||||
|
||||
|
||||
import CFgetPaths
|
||||
from time import localtime, strftime, time
|
||||
|
||||
class CFLog:
|
||||
|
||||
logdb_file = '%scrossfirelog' % (CFgetPaths.getPaths('localdir'))
|
||||
logdb = {}
|
||||
|
||||
def __init__(self):
|
||||
self.logdb = shelve.open(self.logdb_file)
|
||||
|
||||
def create(self, name):
|
||||
date = strftime("%a, %d %b %Y %H:%M:%S CEST", localtime(time()))
|
||||
count=1
|
||||
self.logdb[name]=['unknown', date, count]
|
||||
|
||||
def update(self, name, ip):
|
||||
date = strftime("%a, %d %b %Y %H:%M:%S CEST", localtime(time()))
|
||||
count=0
|
||||
if self.logdb.has_key(name):
|
||||
oldip, olddate, count=self.logdb[name]
|
||||
count+=1
|
||||
self.logdb[name]=[ip, date, count]
|
||||
|
||||
def remove(self, name):
|
||||
if self.logdb.has_key(name):
|
||||
del self.logdb[name]
|
||||
|
||||
def exist(self, name):
|
||||
if self.logdb.has_key(name):
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def info(self, name):
|
||||
if self.exist(name):
|
||||
ip, date, count=self.logdb[name]
|
||||
return ip, date, count
|
|
@ -0,0 +1,56 @@
|
|||
# CFMail.py - CFMail class
|
||||
#
|
||||
# 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 -Todd Mitchell
|
||||
|
||||
import shelve
|
||||
|
||||
import CFgetPaths
|
||||
|
||||
class CFMail:
|
||||
|
||||
maildb_file = '%scrossfiremail' % (CFgetPaths.getPaths('localdir'))
|
||||
maildb = {}
|
||||
total = 0
|
||||
|
||||
def __init__(self):
|
||||
self.maildb = shelve.open(self.maildb_file)
|
||||
|
||||
def send(self, type, toname, fromname, message):
|
||||
# type: 1=mailscoll, 2=newsletter, 3=mailwarning
|
||||
if not self.maildb.has_key(toname):
|
||||
self.maildb[toname]=[[type,fromname,message]]
|
||||
else:
|
||||
temp=self.maildb[toname]
|
||||
temp.append([type,fromname,message])
|
||||
self.maildb[toname]=temp
|
||||
|
||||
def receive(self, toname):
|
||||
if self.maildb.has_key(toname):
|
||||
elements=self.maildb[toname]
|
||||
del self.maildb[toname]
|
||||
return elements
|
||||
|
||||
|
||||
def countmail(self, toname):
|
||||
if self.maildb.has_key(toname):
|
||||
return len(self.maildb[toname])
|
||||
else:
|
||||
return 0
|
|
@ -0,0 +1,85 @@
|
|||
# Script for say event of IPO message board
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# help - gives information about usage
|
||||
#
|
||||
#Updated to use new path functions in CFPython -Todd Mitchell
|
||||
|
||||
import CFPython
|
||||
import CFBoard
|
||||
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import string
|
||||
|
||||
board = CFBoard.CFBoard()
|
||||
|
||||
activator=CFPython.WhoIsActivator()
|
||||
activatorname=CFPython.GetName(activator)
|
||||
whoami=CFPython.WhoAmI()
|
||||
|
||||
boardname=CFPython.GetEventOptions(whoami,6) # 6 is say event
|
||||
|
||||
if (boardname):
|
||||
|
||||
text = string.split(CFPython.WhatIsMessage(), ' ', 1)
|
||||
|
||||
if text[0] == 'help' or text[0] == 'yes':
|
||||
message='Help for %s\nList of commands:\n\n- list\n- write <message>\n- remove <id>\n'%boardname
|
||||
CFPython.Write(message, activator)
|
||||
|
||||
elif text[0] == 'write':
|
||||
if len(text)==2:
|
||||
board.write(boardname, activatorname, text[1])
|
||||
CFPython.Write('Added to %s'%boardname, activator)
|
||||
else:
|
||||
CFPython.Write('Usage "write <text>"', activator)
|
||||
|
||||
elif text[0] == 'list':
|
||||
total = board.countmsg(boardname)
|
||||
if total > 0:
|
||||
CFPython.Write('Content of %s:'%boardname, activator)
|
||||
elements = board.list(boardname)
|
||||
element = []
|
||||
id = 1
|
||||
for element in elements:
|
||||
author, message = element
|
||||
CFPython.Write('<%d> (%s) %s'%(id,author,message), activator)
|
||||
id=id+1
|
||||
else:
|
||||
CFPython.Write('%s is empty'%boardname, activator)
|
||||
|
||||
elif text[0] == 'remove':
|
||||
if len(text)==2:
|
||||
if board.getauthor(boardname,int(text[1]))==activatorname or CFPython.IsDungeonMaster(activator):
|
||||
if board.delete(boardname, int(text[1])):
|
||||
CFPython.Write('Removed from %s'%boardname, activator)
|
||||
else:
|
||||
CFPython.Write('Doesn\'t exist on %s'%boardname, activator)
|
||||
else:
|
||||
CFPython.Write('Access denied', activator)
|
||||
else:
|
||||
CFPython.Write('Usage "remove <id>"', activator)
|
||||
|
||||
else:
|
||||
CFPython.Write('Do you need help?', activator)
|
||||
|
||||
else:
|
||||
CFPython.Write('Board Error', activator)
|
|
@ -0,0 +1,65 @@
|
|||
# recieve.py - Script for apply event of mailbox
|
||||
#
|
||||
# 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 -Todd Mitchell
|
||||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
|
||||
import CFMail
|
||||
import string
|
||||
|
||||
activator=CFPython.WhoIsActivator()
|
||||
activatorname=CFPython.GetName(activator)
|
||||
whoami=CFPython.WhoAmI()
|
||||
|
||||
mail = CFMail.CFMail()
|
||||
total = mail.countmail(activatorname)
|
||||
|
||||
if total > 0:
|
||||
elements = mail.receive(activatorname)
|
||||
element = []
|
||||
for element in elements:
|
||||
type, fromname, message = element
|
||||
if type==1:
|
||||
msgob = CFPython.CreateObjectInside('scroll', whoami)
|
||||
CFPython.SetName(msgob,'mailscroll F: '+fromname+' T: '+activatorname)
|
||||
CFPython.SetMessage(msgob, message)
|
||||
CFPython.SetValue(msgob, 0)
|
||||
elif type==2:
|
||||
msgob = CFPython.CreateObjectInside('note', whoami)
|
||||
CFPython.SetName(msgob,'newspaper D: '+fromname)
|
||||
CFPython.SetMessage(msgob, message)
|
||||
CFPython.SetValue(msgob, 0)
|
||||
elif type==3:
|
||||
msgob = CFPython.CreateObjectInside('diploma', whoami)
|
||||
CFPython.SetName(msgob,'mailwarning F: '+fromname+' T: '+activatorname)
|
||||
CFPython.SetMessage(msgob, message)
|
||||
CFPython.SetValue(msgob, 0)
|
||||
else:
|
||||
print 'ERROR: unknown mailtype\n'
|
||||
|
||||
if total == 1:
|
||||
CFPython.Write('You got 1 mail.', activator)
|
||||
elif total > 1:
|
||||
CFPython.Write('You got %s mails.'%total, activator)
|
||||
else:
|
||||
CFPython.Write('You haven\'t got any mail.', activator)
|
|
@ -0,0 +1,148 @@
|
|||
# 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 -Todd Mitchell
|
||||
#
|
||||
# help - gives information about usage
|
||||
# pen - drops IPO Writing Pen on the floor
|
||||
# literacy - drops IPO Scroll of Literacy on the floor
|
||||
# mailscroll <friend> - drops mailscroll to <friend> on the floor
|
||||
# mailwarning <foo> - drops mailwarning to <foo> on the floor
|
||||
|
||||
# Constant price values
|
||||
priceWritingPen=100
|
||||
priceScrollOfLiteracy=5000
|
||||
priceMailScroll=5
|
||||
|
||||
import CFPython
|
||||
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
|
||||
import string
|
||||
import CFLog
|
||||
import CFBank
|
||||
|
||||
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())
|
||||
|
||||
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)
|
||||
|
||||
elif text[0] == 'pen':
|
||||
if (CFPython.PayAmount(activator, priceWritingPen*50)):
|
||||
CFPython.Say(whoami, 'Here is your IPO Writing Pen')
|
||||
id = CFPython.CreateObject('writing pen', (x, y))
|
||||
CFPython.SetName(id, 'IPO Writing Pen')
|
||||
CFPython.SetValue(id, 0)
|
||||
else:
|
||||
CFPython.Say(whoami, 'You need %s platinum for an IPO Writing Pen'%priceWritingPen)
|
||||
|
||||
elif text[0] == 'literacy':
|
||||
if (CFPython.PayAmount(activator,priceScrollOfLiteracy*50)):
|
||||
CFPython.Say(whoami, 'Here is your IPO Scroll of Literacy')
|
||||
id = CFPython.CreateObject('scroll of literacy', (x, y))
|
||||
CFPython.SetName(id, 'IPO Scroll of Literacy')
|
||||
CFPython.SetValue(id, 0)
|
||||
else:
|
||||
CFPython.Say(whoami, 'You need %s platinum for an IPO Scroll of Literacy'%priceScrollOfLiteracy)
|
||||
|
||||
|
||||
elif text[0] == 'mailscroll':
|
||||
if len(text)==2:
|
||||
if log.exist(text[1]):
|
||||
if (CFPython.PayAmount(activator, priceMailScroll*50)):
|
||||
CFPython.Say(whoami, 'Here is your mailscroll')
|
||||
id = CFPython.CreateObject('scroll', (x, y))
|
||||
CFPython.SetName(id, 'mailscroll T: '+text[1]+' F: '+ activatorname)
|
||||
CFPython.SetValue(id, 0)
|
||||
else:
|
||||
CFPython.Say(whoami, 'You need %s platinum for a mailscroll'%priceMailScroll)
|
||||
else:
|
||||
CFPython.Say(whoami, 'I don\'t know any %s'%text[1])
|
||||
|
||||
else:
|
||||
CFPython.Say(whoami, 'Usage "mailscroll <friend>"')
|
||||
|
||||
|
||||
elif text[0] == 'mailwarning':
|
||||
if (CFPython.IsDungeonMaster(activator)):
|
||||
if len(text)==2:
|
||||
if log.exist(text[1]):
|
||||
CFPython.Say(whoami, 'Here is your mailwarning')
|
||||
id = CFPython.CreateObject('diploma', (x, y))
|
||||
CFPython.SetName(id, 'mailwarning T: '+text[1]+' F: '+ activatorname)
|
||||
CFPython.SetValue(id, 0)
|
||||
else:
|
||||
CFPython.Say(whoami, 'I don\'t know any %s'%text[1])
|
||||
|
||||
else:
|
||||
CFPython.Say(whoami, 'Usage "mailwarning <foo>"')
|
||||
else:
|
||||
CFPython.Say(whoami, 'You need to be DM to be able to use this command')
|
||||
|
||||
|
||||
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))
|
||||
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,83 @@
|
|||
# send.py - Script for close event of mailbox
|
||||
#
|
||||
# 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 -Todd Mitchell
|
||||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
|
||||
import CFMail
|
||||
import string
|
||||
from time import localtime, strftime, time
|
||||
|
||||
mail = CFMail.CFMail()
|
||||
date = strftime("%a, %d %b %Y %H:%M:%S CEST", localtime(time()))
|
||||
activator=CFPython.WhoIsActivator()
|
||||
activatorname=CFPython.GetName(activator)
|
||||
whoami=CFPython.WhoAmI()
|
||||
idlist=[]
|
||||
|
||||
inv = CFPython.CheckInventory(CFPython.WhoAmI(),"mailscroll")
|
||||
if inv != 0:
|
||||
while inv!=0:
|
||||
text=string.split(CFPython.GetName(inv))
|
||||
if text[0]=='mailscroll' and text[1]=='T:' and text[3]=='F:':
|
||||
idlist.append(inv)
|
||||
toname=text[2]
|
||||
fromname=text[4]
|
||||
message='From: %s\nTo: %s\nDate: %s\n\n%s\n' % (fromname, toname, date, CFPython.GetMessage(inv)[:-1])
|
||||
CFPython.Write('mailscroll to '+toname+' sent.', activator)
|
||||
mail.send(1, toname, fromname, message)
|
||||
elif text[0]=='mailscroll' and text[1]=='F:' and text[3]=='T:':
|
||||
idlist.append(inv)
|
||||
fromname=text[2]
|
||||
toname=text[4]
|
||||
message=CFPython.GetMessage(inv)[:-1]+'\n'
|
||||
mail.send(1, toname, fromname, message)
|
||||
else:
|
||||
print "ID: %d"%inv
|
||||
print "Name: "+CFPython.GetName(inv)
|
||||
inv=CFPython.GetNextObject(inv)
|
||||
|
||||
inv = CFPython.CheckInventory(CFPython.WhoAmI(),"mailwarning")
|
||||
if inv != 0:
|
||||
while inv!=0:
|
||||
text=string.split(CFPython.GetName(inv))
|
||||
if text[0]=='mailwarning' and text[1]=='T:' and text[3]=='F:':
|
||||
idlist.append(inv)
|
||||
toname=text[2]
|
||||
fromname=text[4]
|
||||
message='From: %s\nTo: %s\nDate: %s\n\n%s\n' % (fromname, toname, date, CFPython.GetMessage(inv)[:-1])
|
||||
CFPython.Write('mailwarning to '+toname+' sent.', activator)
|
||||
mail.send(3, toname, fromname, message)
|
||||
elif text[0]=='mailwarning' and text[1]=='F:' and text[3]=='T:':
|
||||
idlist.append(inv)
|
||||
fromname=text[2]
|
||||
toname=text[4]
|
||||
message=CFPython.GetMessage(inv)[:-1]+'\n'
|
||||
mail.send(3, toname, fromname, message)
|
||||
else:
|
||||
print "ID: %d"%inv
|
||||
print "Name: "+CFPython.GetName(inv)
|
||||
inv=CFPython.GetNextObject(inv)
|
||||
|
||||
for inv in idlist:
|
||||
CFPython.RemoveObject(inv)
|
|
@ -0,0 +1,33 @@
|
|||
# python_born.py - handler for global born 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 -Todd Mitchell
|
||||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import CFLog
|
||||
import string
|
||||
|
||||
activator = CFPython.WhoIsActivator()
|
||||
name = CFPython.GetName(activator)
|
||||
|
||||
log = CFLog.CFLog()
|
||||
log.create(name)
|
|
@ -0,0 +1,42 @@
|
|||
# python_login.py - handler for global login 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 -Todd Mitchell
|
||||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import CFMail
|
||||
import CFLog
|
||||
import string
|
||||
|
||||
activator = CFPython.WhoIsActivator()
|
||||
name = CFPython.GetName(activator)
|
||||
ip = CFPython.WhatIsMessage()
|
||||
|
||||
mail = CFMail.CFMail()
|
||||
log = CFLog.CFLog()
|
||||
total = mail.countmail(name)
|
||||
log.update(name, ip)
|
||||
|
||||
if total > 0:
|
||||
CFPython.Write('You have some mail waiting for you', activator)
|
||||
else:
|
||||
CFPython.Write('No mail...', activator)
|
|
@ -0,0 +1,33 @@
|
|||
# python_remove.py - handler for global remove 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 -Todd Mitchell
|
||||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import CFLog
|
||||
import string
|
||||
|
||||
activator = CFPython.WhoIsActivator()
|
||||
name = CFPython.GetName(activator)
|
||||
|
||||
log = CFLog.CFLog()
|
||||
log.remove(name)
|
Loading…
Reference in New Issue