예제 #1
0
 def func(self):
     "Show the connect screen."
     connection_screen = ansi.parse_ansi(
         utils.random_string_from_module(CONNECTION_SCREEN_MODULE))
     if not connection_screen:
         connection_screen = "No connection screen found. Please contact an admin."
     self.caller.msg(connection_screen)
예제 #2
0
def start(caller):
    """The user should enter his/her username or NEW to create one.

    This node is called at the very beginning of the menu, when
    a session has been created OR if an error occurs further
    down the menu tree.  From there, users can either enter a
    username (if this username exists) or type NEW (capitalized
    or not) to create a new account.

    """
    text = random_string_from_module(CONNECTION_SCREEN_MODULE)
    text += "\n\nEnter your username or |yNEW|n to create a new account."
    options = ({
        "key": "",
        "goto": "start"
    }, {
        "key": "new",
        "goto": "create_account"
    }, {
        "key": "quit",
        "goto": "quit"
    }, {
        "key": "_default",
        "goto": "username"
    })
    return text, options
예제 #3
0
def start(caller):
    """The user should enter his/her username or NEW to create one.

    This node is called at the very beginning of the menu, when
    a session has been created OR if an error occurs further
    down the menu tree.  From there, users can either enter a
    username (if this username exists) or type NEW (capitalized
    or not) to create a new player.

    """
    text = random_string_from_module(CONNECTION_SCREEN_MODULE)
    text += "\n\nEnter your username or |yNEW|n to create a new account."
    options = (
        {   "key": "",
            "goto": "start",
        },
        {
            "key": "new",
            "goto": "create_account",
        },
        {   "key": "quit",
            "goto": "quit"
        },
        {
            "key": "_default",
            "goto": "username",
        },
    )
    return text, options
예제 #4
0
def start(caller):
    """The user should enter his/her username or NEW to create one.

    This node is called at the very beginning of the menu, when
    a session has been created OR if an error occurs further
    down the menu tree.  From there, users can either enter a
    username (if this username exists) or type NEW (capitalized
    or not) to create a new account.

    """
    text = random_string_from_module(CONNECTION_SCREEN_MODULE)
    text += "\n\n" + dedent("""
            Si vous aviez un compte enregistré sur l'ancien Vancia et souhaitez
            récupérer le nom d'un de ses personnages, entrez son nom ci-dessous.
            |rNotez qu'il s'agit bien du nom du personnage, pas du nom du compte.|n

            Entrez votre nom d'utilisateur ou |yNOUVEAU|n pour en créer un.
        """).strip()
    options = (
        {
            "key": "nouveau",
            "goto": "create_account",
        },
        {
            "key": "quit",
            "goto": "quit",
        },
        {
            "key": "_default",
            "goto": "username",
        },
    )
    return text, options
예제 #5
0
    def func(self):
        """Show the connect screen."""

        callables = utils.callables_from_module(CONNECTION_SCREEN_MODULE)
        if "connection_screen" in callables:
            connection_screen = callables['connection_screen']()
        else:
            connection_screen = utils.random_string_from_module(CONNECTION_SCREEN_MODULE)
            if not connection_screen:
                connection_screen = "No connection screen found. Please contact an admin."
        self.caller.msg(connection_screen)
예제 #6
0
    def func(self):
        """Show the connect screen."""

        callables = utils.callables_from_module(CONNECTION_SCREEN_MODULE)
        if "connection_screen" in callables:
            connection_screen = callables["connection_screen"]()
        else:
            connection_screen = utils.random_string_from_module(
                CONNECTION_SCREEN_MODULE)
            if not connection_screen:
                connection_screen = "Pas d'écran de connexion, veuillez contacter l'assistance."
        self.caller.msg(connection_screen)
예제 #7
0
    def at_repeat(self):
        """

        """

        # If no current, pick random song from source and break into lines.
        if not self.db.current:
            self.db.current = utils.random_string_from_module(self.db.source).splitlines()

        # Broadcast next line.
        if self.db.channel:
            self.db.channel.msg(self.db.current.pop(0))
예제 #8
0
 def func(self):
     "Show the connect screen."
     connection_screen = utils.random_string_from_module(CONNECTION_SCREEN_MODULE)
     if not connection_screen:
         connection_screen = "No connection screen found. Please contact an admin."
     self.caller.msg(connection_screen)
예제 #9
0
from evennia.commands.cmdset import CmdSet
from evennia.utils import create, logger, utils, ansi
from evennia.commands.default.muxcommand import MuxCommand
from evennia.commands.cmdhandler import CMD_LOGINSTART

# limit symbol import for API
__all__ = ("CmdUnconnectedConnect", "CmdUnconnectedCreate",
           "CmdUnconnectedQuit", "CmdUnconnectedLook", "CmdUnconnectedHelp")

MULTISESSION_MODE = settings.MULTISESSION_MODE
CONNECTION_SCREEN_MODULE = settings.CONNECTION_SCREEN_MODULE
CONNECTION_SCREEN = ""
try:
    CONNECTION_SCREEN = ansi.parse_ansi(
        utils.random_string_from_module(CONNECTION_SCREEN_MODULE))
except Exception:
    pass
if not CONNECTION_SCREEN:
    CONNECTION_SCREEN = "\nEvennia: Error in CONNECTION_SCREEN MODULE (randomly picked connection screen variable is not a string). \nEnter 'help' for aid."


class CmdUnconnectedConnect(MuxCommand):
    """
    Connect to the game.

    Usage (at login screen):
        connect <email> <password>

    Use the create command to first create an account before logging in.
    """
예제 #10
0
from evennia.comms.models import ChannelDB

from evennia.commands.cmdset import CmdSet
from evennia.utils import create, logger, utils, ansi
from evennia.commands.default.muxcommand import MuxCommand
from evennia.commands.cmdhandler import CMD_LOGINSTART

# limit symbol import for API
__all__ = ("CmdUnconnectedConnect", "CmdUnconnectedCreate",
           "CmdUnconnectedQuit", "CmdUnconnectedLook", "CmdUnconnectedHelp")

MULTISESSION_MODE = settings.MULTISESSION_MODE
CONNECTION_SCREEN_MODULE = settings.CONNECTION_SCREEN_MODULE
CONNECTION_SCREEN = ""
try:
    CONNECTION_SCREEN = ansi.parse_ansi(utils.random_string_from_module(CONNECTION_SCREEN_MODULE))
except Exception:
    pass
if not CONNECTION_SCREEN:
    CONNECTION_SCREEN = "\nEvennia: Error in CONNECTION_SCREEN MODULE (randomly picked connection screen variable is not a string). \nEnter 'help' for aid."


class CmdUnconnectedConnect(MuxCommand):
    """
    Connect to the game.

    Usage (at login screen):
        connect <email> <password>

    Use the create command to first create an account before logging in.
    """
예제 #11
0
from evennia.commands.cmdset import CmdSet
from evennia.utils import logger, utils, ansi
from evennia.commands.default.muxcommand import MuxCommand
from evennia.commands.cmdhandler import CMD_LOGINSTART
from evennia.commands.default import unloggedin as default_unloggedin  # Used in CmdUnconnectedCreate

# limit symbol import for API
__all__ = ("CmdUnconnectedConnect", "CmdUnconnectedCreate",
           "CmdUnconnectedQuit", "CmdUnconnectedLook", "CmdUnconnectedHelp")

MULTISESSION_MODE = settings.MULTISESSION_MODE
CONNECTION_SCREEN_MODULE = settings.CONNECTION_SCREEN_MODULE
CONNECTION_SCREEN = ""
try:
    CONNECTION_SCREEN = ansi.parse_ansi(utils.random_string_from_module(CONNECTION_SCREEN_MODULE))
except Exception:
    # malformed connection screen or no screen given
    pass
if not CONNECTION_SCREEN:
    CONNECTION_SCREEN = "\nEvennia: Error in CONNECTION_SCREEN MODULE" \
                        " (randomly picked connection screen variable is not a string). \nEnter 'help' for aid."


class CmdUnconnectedConnect(MuxCommand):
    """
    Connect to the game.

    Usage (at login screen):
        connect <email> <password>
예제 #12
0
파일: menu_login.py 프로젝트: Descyndis/mud
def node_enter_username(caller, raw_text, **kwargs):
    """
    Start node of menu
    Start login by displaying the connection screen and ask for a user name.

    """
    def _check_input(caller, username, **kwargs):
        """
        'Goto-callable', set up to be called from the _default option below.

        Called when user enters a username string. Check if this username already exists and set the flag
        'new_user' if not. Will also directly login if the username is 'guest'
        and GUEST_ENABLED is True.

        The return from this goto-callable determines which node we go to next
        and what kwarg it will be called with.

        """
        username = username.rstrip('\n')

        if username == 'guest' and _GUEST_ENABLED:
            # do an immediate guest login
            session = caller
            address = session.address
            account, errors = _GUEST.authenticate(ip=address)
            if account:
                return "node_quit_or_login", {
                    "login": True,
                    "account": account
                }
            else:
                session.msg("|R{}|n".format("\n".join(errors)))
                return None  # re-run the username node

        try:
            _ACCOUNT.objects.get(username__iexact=username)
        except _ACCOUNT.DoesNotExist:
            new_user = True
        else:
            new_user = False

        # pass username/new_user into next node as kwargs
        return "node_enter_password", {
            'new_user': new_user,
            'username': username
        }

    callables = callables_from_module(_CONNECTION_SCREEN_MODULE)
    if "connection_screen" in callables:
        connection_screen = callables['connection_screen']()
    else:
        connection_screen = random_string_from_module(
            _CONNECTION_SCREEN_MODULE)

    if _GUEST_ENABLED:
        text = "Enter a new or existing user name to login (write 'guest' for a guest login):"
    else:
        text = "Enter a new or existing user name to login:"******"{}\n\n{}".format(connection_screen, text)

    options = ({
        "key": "",
        "goto": "node_enter_username"
    }, {
        "key": ("quit", "q"),
        "goto": "node_quit_or_login"
    }, {
        "key": ("help", "h"),
        "goto": (_show_help, {
            "help_entry": _ACCOUNT_HELP,
            **kwargs
        })
    }, {
        "key": "_default",
        "goto": _check_input
    })
    return text, options