Fixed some bugs, added an example connection screen for the menu-login system.

This commit is contained in:
Griatch 2011-11-06 19:16:34 +01:00
parent c4d353ee01
commit e379816866
3 changed files with 38 additions and 9 deletions

View file

@ -1,8 +1,9 @@
"""
Alternative Login system
Menu-driven login system
Contribution 2011 - Griatch
This is an alternative login system for Evennia, using the
contrib.menusystem module. As opposed to the default system it doesn't
use emails for authentication and also don't auto-creates a Character
@ -10,6 +11,21 @@ with the same name as the Player (instead assuming some sort of
character-creation to come next).
Install is simple:
To your settings file, add/edit the line:
CMDSET_UNLOGGEDIN = "contrib.alt_login.UnloggedInCmdSet"
That's it. The cmdset in this module will now be used instead of the
default one.
The initial login "graphic" is taken from strings in the module given
by settings.CONNECTION_SCREEN_MODULE. You will want to edit the string
in that module (at least comment out the default string that mentions
commands that are not available) and add something more suitable for
the initial splash screen.
"""
import re
@ -253,7 +269,7 @@ class CmdUnloggedinQuit(Command):
# The login menu tree, using the commands above
START = MenuNode("START", text=utils.string_from_module(CONNECTION_SCREEN_MODULE) + "\n\rPick one of the following:",
START = MenuNode("START", text=utils.string_from_module(CONNECTION_SCREEN_MODULE),
links=["node1a", "node2a", "node3", "END"],
linktexts=["Log in with an existing account",
"Create a new account",

View file

@ -222,7 +222,7 @@ class MenuNode(object):
"""
def __init__(self, key, text="", links=None, linktexts=None,
keywords=None, cols=1, helptext=None, selectcmds=None, code="", nodefaultcmds=False):
keywords=None, cols=1, helptext=None, selectcmds=None, code="", nodefaultcmds=False, separator=""):
"""
key - the unique identifier of this node.
text - is the text that will be displayed at top when viewing this node.
@ -243,6 +243,7 @@ class MenuNode(object):
as soon after it's been selected from another node). self.caller is available
to call from this code block, as well as ObjectDB and PlayerDB.
nodefaultcmds - if true, don't offer the default help and look commands in the node
separator - this string will be put on the line between menu nodes5B.
"""
self.key = key
self.cmdset = None
@ -253,6 +254,7 @@ class MenuNode(object):
self.selectcmds = selectcmds
self.code = code
self.nodefaultcmds = nodefaultcmds
self.separator = separator
Nlinks = len(self.links)
# validate the input
@ -307,7 +309,7 @@ class MenuNode(object):
for row in ftable:
string +="\n" + "".join(row)
# store text
self.text = 78*"-" + "\n" + string.rstrip()
self.text = self.separator + "\n" + string.rstrip()
def init(self, menutree):
"""

View file

@ -7,16 +7,18 @@
# The names of the string variables doesn't matter (except they
# shouldn't start with _), but each should hold a string defining a
# connection screen - as seen when first connecting to the game
# (before having logged in). If there are more than one string
# variable defined, a random one is picked.
# (before having logged in).
#
# After adding new connection screens to this module you must
# either reboot or reload the server to make them available.
# OBS - If there are more than one string variable viable in this
# module, a random one is picked!
#
# After adding new connection screens to this module you must either
# reboot or reload the server to make them available.
#
from src.commands.connection_screen import DEFAULT_SCREEN
# from src.utils import utils
#from src.utils import utils
#
# CUSTOM_SCREEN = \
# """{b=============================================================={n
@ -29,3 +31,12 @@ from src.commands.connection_screen import DEFAULT_SCREEN
#
# Enter {whelp{n for more info. {wlook{n will re-load this screen.
#{b=============================================================={n""" % utils.get_evennia_version()
# # A suggested alternative screen for the Menu login system
# from src.utils import utils
# MENU_SCREEN = \
# """{b=============================================================={n
# Welcome to {gEvennnia{n, version %s!
# {b=============================================================={n""" % utils.get_evennia_version()