dkmud/menus/char_manager.py
Francesco Cappelli 5ef1b78c42 sistemati spells
2022-02-17 18:33:26 +01:00

58 lines
No EOL
1.7 KiB
Python

_ACCOUNT_HELP = (
"Enter the name you used to log into the game before, " "or a new account-name if you are new."
)
_PASSWORD_HELP = (
"Password should be a minimum of 8 characters (preferably longer) and "
"can contain a mix of letters, spaces, digits and @/./+/-/_/'/, only."
)
def _show_help(caller, raw_string, **kwargs):
"""Echo help message, then re-run node that triggered it"""
help_entry = kwargs["help_entry"]
caller.msg(help_entry)
return None # re-run calling node
def node_enter_char_management(caller, raw_string, **kwargs):
account = caller.ndb._menutree.account
if not account:
raise Exception("No account found!")
# TODO
# text = "{}".format(w_first_login)
#
# options = (
# {"key": "", "goto": "node_enter_char_management"},
# {"key": ("help", "h"), "goto": (_show_help, {"help_entry": _ACCOUNT_HELP, **kwargs})},
# {"key": "_default", "goto": "node_enter_char_management"},
# )
#
# return text, options
# TODO
character = account.db._last_puppet
character.db.health = 10
character.db.mana = 10
character.db.spells = []
character.db.spells.append('light')
character.db.recipes = []
character.db.recipes.append('vial of blood')
character.db.recipes.append('torch')
caller.msg("|gLogging in ...|n")
caller.sessionhandler.login(caller, account)
return "", {}
def plain_node_formatter(nodetext, optionstext, caller=None):
"""Do not display the options, only the text.
This function is used by EvMenu to format the text of nodes. The menu login
is just a series of prompts, so we disable all automatic display decoration
and let the nodes handle everything on their own.
"""
return nodetext