Skip to content

Commit

Permalink
modified a heck of a lot of plugins to use the DB instead of conf fil…
Browse files Browse the repository at this point in the history
…es. Now to fix all my typos :)
  • Loading branch information
fdChasm committed May 31, 2010
1 parent 3d8b7ed commit 27ece03
Show file tree
Hide file tree
Showing 22 changed files with 205 additions and 166 deletions.
23 changes: 0 additions & 23 deletions src/pyscripts/Config/maprotation.conf

This file was deleted.

5 changes: 0 additions & 5 deletions src/pyscripts/Config/mapvote.conf

This file was deleted.

7 changes: 0 additions & 7 deletions src/pyscripts/Config/masterclient.conf

This file was deleted.

2 changes: 0 additions & 2 deletions src/pyscripts/Config/motd.conf

This file was deleted.

4 changes: 0 additions & 4 deletions src/pyscripts/Config/mute.conf

This file was deleted.

4 changes: 0 additions & 4 deletions src/pyscripts/Config/namesdb.conf

This file was deleted.

6 changes: 0 additions & 6 deletions src/pyscripts/Config/notk.conf

This file was deleted.

3 changes: 0 additions & 3 deletions src/pyscripts/Config/server.conf

This file was deleted.

5 changes: 0 additions & 5 deletions src/pyscripts/Config/usermanager.conf

This file was deleted.

10 changes: 0 additions & 10 deletions src/pyscripts/Config/userprivilege.conf

This file was deleted.

3 changes: 0 additions & 3 deletions src/pyscripts/Config/votekick.conf

This file was deleted.

57 changes: 44 additions & 13 deletions src/pyscripts/plugins/maprotation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from xsbs.events import registerServerEventHandler, triggerServerEvent
from xsbs.settings import PluginConfig
from xsbs.settings import loadPluginConfig
from xsbs.game import modes
from xsbs.ui import error, info
from xsbs.colors import colordict
Expand All @@ -8,13 +8,43 @@
import sbserver
import string

config = PluginConfig('maprotation')
preset_rotation = config.getOption('Config', 'use_preset_rotation', 'yes') == 'yes'
start_mode = config.getOption('Config', 'start_mode', 'ffa')
nextmap_response = config.getOption('Config', 'nextmap_response', 'The next map is ${blue}${mapname}')
map_modes = config.getAllOptions('Maps')
del config
nextmap_response = string.Template(nextmap_response)
config = {
'Main':
{
'use_preset_rotation': 'yes',
'start_mode': 'ffa',
},
'Templates':
{
'nextmap_response': 'The next map is ${blue}${mapname}',
},
'Maps'
{
'capture': 'urban_c, nevil_c, fb_capture, nmp9, c_valley, lostinspace, fc3, face-capture, nmp4, nmp8, hallo, monastery, ph-capture, hades, fc4, relic, frostbyte, venice, paradigm, corruption, asteroids, ogrosupply, reissen, akroseum, duomo, capture_night, c_egypt, tejen, dust2, campo, killcore3, damnation, arabic, cwcastle, river_c, serenity'
'instactf': 'hallo, reissen, flagstone, face-capture, shipwreck, dust2, urban_c, berlin_wall, akroseum, valhalla, damnation, mach2, redemption, tejen, europium, capture_night, l_ctf, forge, campo, wdcd, sacrifice, core_transfer, recovery'
'coop': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm'
'tacteam': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'demo': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm'
'tac': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'protect': 'hallo, reissen, flagstone, face-capture, shipwreck, dust2, urban_c, berlin_wall, akroseum, valhalla, damnation, mach2, redemption, tejen, europium, capture_night, l_ctf, forge, campo, wdcd, sacrifice, core_transfer, recovery'
'instaprotect': 'hallo, reissen, flagstone, face-capture, shipwreck, dust2, urban_c, berlin_wall, akroseum, valhalla, damnation, mach2, redemption, tejen, europium, capture_night, l_ctf, forge, campo, wdcd, sacrifice, core_transfer, recovery'
'ctf': 'hallo, reissen, flagstone, face-capture, shipwreck, dust2, urban_c, berlin_wall, akroseum, valhalla, damnation, mach2, redemption, tejen, europium, capture_night, l_ctf, forge, campo, wdcd, sacrifice, core_transfer, recovery'
'insta': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'instateam': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'regencapture': 'urban_c, nevil_c, fb_capture, nmp9, c_valley, lostinspace, fc3, face-capture, nmp4, nmp8, hallo, monastery, ph-capture, hades, fc4, relic, frostbyte, venice, paradigm, corruption, asteroids, ogrosupply, reissen, akroseum, duomo, capture_night, c_egypt, tejen, dust2, campo, killcore3, damnation, arabic, cwcastle, river_c, serenity'
'effic': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'teamplay': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'ffa': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
'efficteam': 'complex, douze, ot, academy, metl2, metl3, nmp8, refuge, tartech, kalking1, dock, turbine, fanatic_quake, oddworld, wake5, aard3c, curvedm, fragplaza, pgdm, kffa, neondevastation, hog2, memento, neonpanic, lostinspace, DM_BS1, shindou, sdm1, shinmei1, stemple, powerplant, phosgene, oasis, island, metl4, ruby, frozen, ksauer1, killfactory, corruption, deathtek, aqueducts, orbe, roughinery, shadowed, torment, konkuri-to, moonlite, darkdeath, fanatic_castle_trap, orion, nmp10, katrez_d, thor, frostbyte, ogrosupply, kmap5, thetowers, guacamole, tejen, hades, paradigm, mechanic, wdcd'
}
}

def init():
loadPluginConfig(config, 'MapRotation')
config['Main']['use_preset_rotation'] = config['Main']['use_preset_rotation'] == 'yes'
config['Templates']['nextmap_response'] = string.Template(config['Templates']['nextmap_response'])

init()

class Map:
def __init__(self, name, mode):
Expand Down Expand Up @@ -67,7 +97,7 @@ def onNextMapCmd(cn, args):
sbserver.playerMessage(cn, error('Usage: #nextmap'))
else:
try:
sbserver.playerMessage(cn, info(nextmap_response.substitute(colordict, mapname=getSuccessor(sbserver.gameMode(), sbserver.mapName()))))
sbserver.playerMessage(cn, info(config['Templates']['nextmap_response'].substitute(colordict, mapname=getSuccessor(sbserver.gameMode(), sbserver.mapName()))))
except (KeyError, ValueError):
sbserver.playerMessage(cn, error('Could not determine next map'))

Expand All @@ -76,16 +106,17 @@ def onConnect(cn):
rotate_on_join[0] = False
sbserver.setPaused(False)

if preset_rotation:
if config['Main']['use_preset_rotation']:
modeMapLists = {}
for mode in map_modes:
for mode in config['Maps']:
modeMapLists[mode[0]] = mode[1].replace(' ', '').split(',')
rotate_on_join = [False]
mn = modes.index(start_mode)
sbserver.setMap(modeMapLists[start_mode][0], mn)
mn = modes.index(config['Main']['start_mode'])
sbserver.setMap(modeMapLists[config['Main']['start_mode']][0], mn)
registerServerEventHandler('intermission_ended', presetRotate)
registerCommandHandler('nextmap', onNextMapCmd)
registerServerEventHandler('player_connect', onConnect)
else:
registerServerEventHandler('intermission_ended', onIntermEnd)


0 comments on commit 27ece03

Please sign in to comment.