Migration needed. Refactored the config.configValue model into server.ServerConfig (that's what the config model were used for anyway). The new model can handle arbitrary data structures through pickle. Run ./manage.py migrate to sync your database with the new setup.

Moved Connect screens (the text screen first seen when connecting) away from the database and into a module in gamesrc/world. This module allows for conveniently adding new connect screens on the fly. More than one screen in the given module will mean a random screen is used.
This commit is contained in:
Griatch 2011-04-12 21:43:57 +00:00
parent f1404356ea
commit 7f9f21f45e
21 changed files with 162 additions and 257 deletions

View file

@ -219,14 +219,6 @@ class CmdInventory(MuxCommand):
string += "\n %s" % item.name
self.caller.msg(string)
## money = int(caller.MONEY)
## if money == 1:
## money_name = ConfigValue.objects.get_configvalue("MONEY_NAME_SINGULAR")
## else:
## money_name = ConfigValue.objects.get_configvalue("MONEY_NAME_PLURAL")
##caller.msg("You have %d %s." % (money, money_name))
class CmdGet(MuxCommand):
"""
get

View file

@ -14,7 +14,7 @@ from src.server.sessionhandler import SESSIONS
from src.scripts.models import ScriptDB
from src.objects.models import ObjectDB
from src.players.models import PlayerDB
from src.config.models import ConfigValue
from src.server.models import ServerConfig
from src.utils import reloads, create, logger, utils, gametime
from src.commands.default.muxcommand import MuxCommand
@ -57,7 +57,7 @@ class CmdPy(MuxCommand):
'config': dummy conf instance
'ObjectDB' : ObjectDB class
'ScriptDB' : ScriptDB class
'ConfigValue' ConfigValue class
'ServerConfig' ServerConfig class
only two
variables are defined: 'self'/'me' which refers to one's
own object, and 'here' which refers to self's current
@ -83,7 +83,7 @@ class CmdPy(MuxCommand):
key = 'testscript')
obj = create.create_object("src.objects.objects.Object",
key='testobject')
conf = ConfigValue() # used to access conf values
conf = ServerConfig() # used to access conf values
available_vars = {'self':caller,
'me':caller,
@ -93,7 +93,7 @@ class CmdPy(MuxCommand):
'config':conf,
'ObjectDB':ObjectDB,
'ScriptDB':ScriptDB,
'ConfigValue':ConfigValue}
'ServerConfig':ServerConfig}
caller.msg(">>> %s" % pycode)
try:

View file

@ -22,7 +22,7 @@ from django.conf import settings
from src.utils import create, ansi
from src.server import session, sessionhandler
from src.locks.lockhandler import LockHandler
from src.config.models import ConfigValue
from src.server.models import ServerConfig
#------------------------------------------------------------
# Command testing
@ -77,7 +77,7 @@ class CommandTest(TestCase):
"""
def setUp(self):
"sets up the testing environment"
c = ConfigValue(db_key="default_home", db_value="2")
c = ServerConfig.objects.conf("default_home", 2)
c.save()
self.room1 = create.create_object(settings.BASE_ROOM_TYPECLASS, key="room1")

View file

@ -7,7 +7,7 @@ from django.contrib.auth.models import User
from src.server import sessionhandler
from src.players.models import PlayerDB
from src.objects.models import ObjectDB
from src.config.models import ConfigValue
from src.server.models import ServerConfig
from src.comms.models import Channel
from src.utils import create, logger, utils, ansi
@ -67,7 +67,7 @@ class CmdConnect(MuxCommand):
# Create a new character object to tie the player to. This should
# usually not be needed unless the old character object was manually
# deleted.
default_home_id = ConfigValue.objects.conf(db_key="default_home")
default_home_id = ServerConfig.objects.conf("default_home")
default_home = ObjectDB.objects.get_id(default_home_id)
typeclass = settings.BASE_CHARACTER_TYPECLASS
character = create.create_object(typeclass=typeclass,
@ -185,7 +185,7 @@ class CmdCreate(MuxCommand):
else:
# everything's ok. Create the new player account
try:
default_home_id = ConfigValue.objects.conf(db_key="default_home")
default_home_id = ServerConfig.objects.conf("default_home")
default_home = ObjectDB.objects.get_id(default_home_id)
typeclass = settings.BASE_CHARACTER_TYPECLASS