示例#1
0
def login_method_handler(sock, arg):
    args = arg.split()
    if len(args) == 0:
        return
    args[0] = args[0].lower()

    if "create".startswith(args[0]):
        if len(args) != 3:
            return
        elif mudsys.account_exists(args[1]):
            sock.send("{cAn account by that name already exists.{n\r\n")
        elif not check_acct_name(args[1]):
            txt = "{cThat is an invalid account name. Your account name must "\
                  "only consist of characters and numbers, and it must be " \
                  "4 and 12 characters in length. The first character MUST be "\
                  "a letter. Please pick another.{n"
            sock.send(mud.format_string(txt, False))

        elif not try_create_account(sock, args[1], args[2]):
            sock.send("Your account was unable to be created.")

    elif "load".startswith(args[0]):
        if len(args) != 3:
            return
        elif not try_load_account(sock, args[1], args[2]):
            sock.send("{cInvalid account name or password.{n\r\n")
    elif "guest".startswith(args[0]):
        if (mudsys.sys_getval("lockdown") != '' and
            not utils.is_keyword(mudsys.sys_getval("lockdown"), "player")):
            sock.send("{cThe mud is currently locked out to new players.{n\r\n")
        else:
            sock.pop_ih()
            hooks.run("create_guest", hooks.build_info("sk", (sock,)))
示例#2
0
文件: currency.py 项目: KaSt/nereamud
def give_currency_hook(info):
    """Turns a currency object into actual currency when received.
    """
    ch, recv, obj = hooks.parse_info(info)
    # if obj.hasBit("currency"):
    if utils.is_keyword(obj.bits, "currency"):
        recv.worth += obj.worth
        mud.extract(obj)
示例#3
0
文件: currency.py 项目: KaSt/nereamud
def get_currency_hook(info):
    """Turns a currency object into actual currency when taken.
    """
    ch, obj = hooks.parse_info(info)
    # if obj.hasBit("currency"):
    if utils.is_keyword(obj.bits, "currency"):
        ch.worth += obj.worth
        mud.extract(obj)
示例#4
0
文件: currency.py 项目: KaSt/nereamud
def give_currency_hook(info):
    """Turns a currency object into actual currency when received.
    """
    ch, recv, obj = hooks.parse_info(info)
    # if obj.hasBit("currency"):
    if utils.is_keyword(obj.bits, "currency"):
        recv.worth += obj.worth
        mud.extract(obj)
示例#5
0
文件: currency.py 项目: KaSt/nereamud
def get_currency_hook(info):
    """Turns a currency object into actual currency when taken.
    """
    ch, obj = hooks.parse_info(info)
    # if obj.hasBit("currency"):
    if utils.is_keyword(obj.bits, "currency"):
        ch.worth += obj.worth
        mud.extract(obj)
示例#6
0
def do_get(ch, obj, cont):
    '''transfers an item from the ground to the character'''
    if utils.is_keyword(obj.bits, "notake"):
        ch.send("You cannot take " + ch.see_as(obj) + ".")
    elif cont != None:
        obj.carrier = ch
        mud.message(ch, None, obj, cont, True, "to_char", "You get $o from $O.")
        mud.message(ch, None, obj, cont, True, "to_room", "$n gets $o from $O.")
    else:
        obj.carrier = ch
        mud.message(ch, None, obj, None, True, "to_char", "You get $o.")
        mud.message(ch, None, obj, None, True, "to_room", "$n gets $o.")

        # run get hooks
        hooks.run("get", hooks.build_info("ch obj", (ch, obj)))
示例#7
0
def do_get(ch, obj, cont):
    '''transfers an item from the ground to the character'''
    if utils.is_keyword(obj.bits, "notake"):
        ch.send("You cannot take " + ch.see_as(obj) + ".")
    elif cont != None:
        obj.carrier = ch
        mud.message(ch, None, obj, cont, True, "to_char",
                    "You get $o from $O.")
        mud.message(ch, None, obj, cont, True, "to_room",
                    "$n gets $o from $O.")
    else:
        obj.carrier = ch
        mud.message(ch, None, obj, None, True, "to_char", "You get $o.")
        mud.message(ch, None, obj, None, True, "to_room", "$n gets $o.")

        # run get hooks
        hooks.run("get", hooks.build_info("ch obj", (ch, obj)))