- change path finding to use os.path - hopefully this will fix these
scripts for the (new) windows server - CFgetPaths is now dead and will be removed - change your scripts if you use it. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@2891 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
73be8b1aea
commit
16d1e0224e
|
@ -20,16 +20,16 @@
|
|||
#
|
||||
#Updated to use new path functions in CFPython -Todd Mitchell
|
||||
|
||||
|
||||
import os.path
|
||||
import shelve
|
||||
|
||||
import CFgetPaths
|
||||
import CFPython
|
||||
|
||||
class CFBank:
|
||||
bankdb = {}
|
||||
|
||||
def __init__(self, bankfile):
|
||||
self.bankdb_file = '%s%s' % (CFgetPaths.getPaths('localdir'),bankfile)
|
||||
self.bankdb_file = os.path.join(CFPython.GetLocalDirectory(),bankfile)
|
||||
self.bankdb = shelve.open(self.bankdb_file)
|
||||
|
||||
def deposit(self, user, amount):
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
#
|
||||
#Updated to use new path functions in CFPython -Todd Mitchell
|
||||
|
||||
|
||||
import os.path
|
||||
import shelve
|
||||
|
||||
import CFgetPaths
|
||||
import CFPython
|
||||
|
||||
class CFBoard:
|
||||
|
||||
boarddb_file = '%scrossfireboard' % (CFgetPaths.getPaths('localdir'))
|
||||
boarddb_file = os.path.join(CFPython.GetLocalDirectory(),'crossfireboard')
|
||||
boarddb = {}
|
||||
total = 0
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ import os.path
|
|||
import shelve
|
||||
import random
|
||||
|
||||
import CFgetPaths
|
||||
import CFPython
|
||||
|
||||
class SlotMachine:
|
||||
#sets up the file that holds all the slotmachine jackpots
|
||||
#make sure this points to your writable var/crossfire directory
|
||||
#you can delete that file to reset all the slotmachine jackpots
|
||||
slotfile = '%sSlotMachine_file' %(CFgetPaths.getPaths("localdir"))
|
||||
slotfile = os.path.join(CFPython.GetLocalDirectory(),'SlotMachine_file')
|
||||
slotdb = {}
|
||||
def __init__(self,slotname,slotlist,minpot,maxpot):
|
||||
slotdb = shelve.open(self.slotfile)
|
||||
|
|
|
@ -21,43 +21,43 @@
|
|||
#Updated to use new path functions in CFPython -Todd Mitchell
|
||||
|
||||
import shelve
|
||||
import os.path
|
||||
|
||||
|
||||
import CFgetPaths
|
||||
import CFPython
|
||||
from time import localtime, strftime, time
|
||||
|
||||
class CFLog:
|
||||
|
||||
logdb_file = '%scrossfirelog' % (CFgetPaths.getPaths('localdir'))
|
||||
logdb = {}
|
||||
logdb_file = os.path.join(CFPython.GetLocalDirectory(),'crossfirelog')
|
||||
logdb = {}
|
||||
|
||||
def __init__(self):
|
||||
self.logdb = shelve.open(self.logdb_file)
|
||||
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 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 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 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
|
||||
def info(self, name):
|
||||
if self.exist(name):
|
||||
ip, date, count=self.logdb[name]
|
||||
return ip, date, count
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
#
|
||||
#Updated to use new path functions in CFPython -Todd Mitchell
|
||||
|
||||
import os.path
|
||||
import shelve
|
||||
|
||||
import CFgetPaths
|
||||
import CFPython
|
||||
|
||||
class CFMail:
|
||||
|
||||
maildb_file = '%scrossfiremail' % (CFgetPaths.getPaths('localdir'))
|
||||
maildb_file = os.path.join(CFPython.GetLocalDirectory(),'crossfiremail')
|
||||
maildb = {}
|
||||
total = 0
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
## Todd Mitchell (temitchell@sympatico.ca)
|
||||
## Generates the proper Crossfire directory paths
|
||||
## returns the absolute paths with a nice "/" at the end.
|
||||
##
|
||||
## It is depreciated as it is of dubuois value and breaks paths for win32 systems
|
||||
## DON"T USE THIS ANYMORE! It is being removed shortly.
|
||||
|
||||
import CFPython
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
import CFPython
|
||||
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
|
||||
import string
|
||||
import random
|
||||
|
|
|
@ -26,7 +26,8 @@ import CFPython
|
|||
import CFBoard
|
||||
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
import string
|
||||
|
||||
board = CFBoard.CFBoard()
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
|
||||
import CFMail
|
||||
import string
|
||||
|
|
|
@ -34,7 +34,8 @@ priceMailScroll=5
|
|||
import CFPython
|
||||
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
|
||||
import string
|
||||
import CFLog
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
import CFPython
|
||||
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
|
||||
import CFLog
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
|
||||
import CFMail
|
||||
import string
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
import CFGamble
|
||||
import CFItemBroker
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
import CFGamble
|
||||
import CFItemBroker
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
import CFGamble
|
||||
import CFItemBroker
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
import CFGamble
|
||||
import CFItemBroker
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
import CFPython
|
||||
import sys
|
||||
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||
import os.path
|
||||
sys.path.append(os.path.join(CFPython.GetDataDirectory(),CFPython.GetMapDirectory(),'python'))
|
||||
import CFGamble
|
||||
import CFItemBroker
|
||||
|
||||
|
|
Loading…
Reference in New Issue