- using new directory getting functions in the Plugin, makes python more better
- converted the slots over, now easier to install - added a script that returns the directories for easy use git-svn-id: svn://svn.code.sf.net/p/crossfire/code/trunk/maps@1990 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
4a2f3c6148
commit
0f7f451615
|
@ -2,7 +2,9 @@
|
||||||
# Todd Mitchell
|
# Todd Mitchell
|
||||||
#The Python control file for Slot Machines and other such nonsense
|
#The Python control file for Slot Machines and other such nonsense
|
||||||
#Please do not put CFPython functions in this file,
|
#Please do not put CFPython functions in this file,
|
||||||
#but rather place these in the calling file
|
#but rather place these in the calling file (don't ask me why - it just feels right)
|
||||||
|
|
||||||
|
import CFgetPaths
|
||||||
import os.path
|
import os.path
|
||||||
import shelve
|
import shelve
|
||||||
import random
|
import random
|
||||||
|
@ -11,7 +13,7 @@ class SlotMachine:
|
||||||
#sets up the file that holds all the slotmachine jackpots
|
#sets up the file that holds all the slotmachine jackpots
|
||||||
#make sure this points to your writable var/crossfire directory
|
#make sure this points to your writable var/crossfire directory
|
||||||
#you can delete that file to reset all the slotmachine jackpots
|
#you can delete that file to reset all the slotmachine jackpots
|
||||||
slotfile = '/usr/local/CF/var/crossfire/SlotMachine_file'
|
slotfile = '%sSlotMachine_file' %(CFgetPaths.getPaths("localdir"))
|
||||||
slotdb = {}
|
slotdb = {}
|
||||||
def __init__(self,slotname,slotlist,minpot,maxpot):
|
def __init__(self,slotname,slotlist,minpot,maxpot):
|
||||||
slotdb = shelve.open(self.slotfile)
|
slotdb = shelve.open(self.slotfile)
|
|
@ -0,0 +1,35 @@
|
||||||
|
## CFgetPaths.py
|
||||||
|
## Todd Mitchell (temitchell@sympatico.ca)
|
||||||
|
## Generates the proper Crossfire directory paths
|
||||||
|
## returns the absolute paths with a nice "/" at the end.
|
||||||
|
|
||||||
|
import CFPython
|
||||||
|
|
||||||
|
def getPaths(directory):
|
||||||
|
'''returns absolute path for crossfire directory specified.
|
||||||
|
Options are datadir, mapdir, uniquedir, localdir, playerdir, configdir, tempdir, all.
|
||||||
|
"all" will return a dictionary of all paths'''
|
||||||
|
|
||||||
|
#Get the Paths
|
||||||
|
|
||||||
|
datadir = "%s/" %(CFPython.GetDataDirectory())
|
||||||
|
mapdir = "%s/%s/" %(datadir, CFPython.GetMapDirectory())
|
||||||
|
uniquedir = "%s/%s/" %(datadir, CFPython.GetUniqueDirectory())
|
||||||
|
localdir = "%s/" %(CFPython.GetLocalDirectory())
|
||||||
|
playerdir = "%s/%s/" %(localdir, CFPython.GetPlayerDirectory())
|
||||||
|
configdir = "%s/" %(CFPython.GetConfigurationDirectory())
|
||||||
|
tempdir = "%s/" %(CFPython.GetTempDirectory())
|
||||||
|
|
||||||
|
#make the dictionary
|
||||||
|
|
||||||
|
paths = {"datadir":datadir, "mapdir":mapdir, "uniquedir":uniquedir, "localdir":localdir, "playerdir":playerdir, "configdir":configdir, "tempdir":tempdir}
|
||||||
|
|
||||||
|
#return the proper
|
||||||
|
|
||||||
|
if directory == "all":
|
||||||
|
return paths
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
return paths[directory]
|
||||||
|
except KeyError:
|
||||||
|
return 0
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import CFPython
|
import CFPython
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('/usr/local/CF/share/crossfire/maps/python')
|
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||||
import CFGamble
|
import CFGamble
|
||||||
|
|
||||||
activator=CFPython.WhoIsActivator()
|
activator=CFPython.WhoIsActivator()
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import CFPython
|
import CFPython
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('/usr/local/CF/share/crossfire/maps/python')
|
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||||
import CFGamble
|
import CFGamble
|
||||||
|
|
||||||
activator=CFPython.WhoIsActivator()
|
activator=CFPython.WhoIsActivator()
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import CFPython
|
import CFPython
|
||||||
import sys
|
import sys
|
||||||
sys.path.append('/usr/local/CF/share/crossfire/maps/python')
|
sys.path.append('%s/%s/python' %(CFPython.GetDataDirectory(),CFPython.GetMapDirectory()))
|
||||||
import CFGamble
|
import CFGamble
|
||||||
|
|
||||||
activator=CFPython.WhoIsActivator()
|
activator=CFPython.WhoIsActivator()
|
|
@ -237,7 +237,7 @@ Drop a platinum coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/platinumslots.py
|
event_apply /python/casino/platinumslots.py
|
||||||
x 1
|
x 1
|
||||||
y 8
|
y 8
|
||||||
end
|
end
|
||||||
|
@ -263,7 +263,7 @@ msg
|
||||||
Drop a gold coin to play.
|
Drop a gold coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/goldslots.py
|
event_apply /python/casino/goldslots.py
|
||||||
title Slot
|
title Slot
|
||||||
x 1
|
x 1
|
||||||
y 10
|
y 10
|
||||||
|
@ -291,7 +291,7 @@ Drop a silver coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/silverslots.py
|
event_apply /python/casino/silverslots.py
|
||||||
x 1
|
x 1
|
||||||
y 12
|
y 12
|
||||||
end
|
end
|
||||||
|
@ -417,7 +417,7 @@ Drop a platinum coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/platinumslots.py
|
event_apply /python/casino/platinumslots.py
|
||||||
x 2
|
x 2
|
||||||
y 8
|
y 8
|
||||||
end
|
end
|
||||||
|
@ -444,7 +444,7 @@ Drop a gold coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/goldslots.py
|
event_apply /python/casino/goldslots.py
|
||||||
x 2
|
x 2
|
||||||
y 10
|
y 10
|
||||||
end
|
end
|
||||||
|
@ -471,7 +471,7 @@ Drop a silver coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/silverslots.py
|
event_apply /python/casino/silverslots.py
|
||||||
x 2
|
x 2
|
||||||
y 12
|
y 12
|
||||||
end
|
end
|
||||||
|
@ -597,7 +597,7 @@ Drop a platinum coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/platinumslots.py
|
event_apply /python/casino/platinumslots.py
|
||||||
x 3
|
x 3
|
||||||
y 8
|
y 8
|
||||||
end
|
end
|
||||||
|
@ -624,7 +624,7 @@ Drop a gold coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/goldslots.py
|
event_apply /python/casino/goldslots.py
|
||||||
x 3
|
x 3
|
||||||
y 10
|
y 10
|
||||||
end
|
end
|
||||||
|
@ -651,7 +651,7 @@ Drop a silver coin to play.
|
||||||
endmsg
|
endmsg
|
||||||
title Slot
|
title Slot
|
||||||
event_apply_plugin Python
|
event_apply_plugin Python
|
||||||
event_apply /unlinked/casino/silverslots.py
|
event_apply /python/casino/silverslots.py
|
||||||
x 3
|
x 3
|
||||||
y 12
|
y 12
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue