def cmd_lockdown(ch, cmd, arg): '''Usage: lockdown [allowed groups | off] Locks the game for anyone not a member of one of the user groups specified. No argument will list all the user groups locked out of the mud. The off argument will remove all lockdowns.''' if arg == '': lockdown = mudsys.sys_getval("lockdown") if lockdown == '': ch.send("Lockdown is currently off.") else: ch.send("Lockdown is currently to members not of: " + lockdown) ch.send("To turn off lockdown, use {clockdown off{n") elif arg.lower() == "off": ch.send("Lockdown disabled.") mudsys.sys_setval("lockdown", "") # make sure we're not locking ourself out elif not ch.isInGroup(arg): ch.send("You cannot lock yourself out!") else: ch.send("MUD locked down to everyone not in groups: " + arg) mudsys.sys_setval("lockdown", arg) # kick out everyone who we've just locked out for ch in mudchar.char_list(): if ch.is_pc and not ch.isInGroup(arg): ch.send("The mud has just been locked down to you.") mudsys.do_save(ch) mudsys.do_disconnect(ch) extract(ch)
def acct_menu_handler(sock, arg): '''parses account commands (new character, enter game, quit, etc)''' if len(arg) == 0: return args = arg.split() args[0] = args[0].upper() if args[0].isdigit(): opts = sock.account.characters() arg = int(args[0]) if arg < 0 or arg >= len(opts): sock.send("Invalid choice!") else: acct_load_char(sock, opts[arg]) elif args[0] == 'L': if len(args) == 1: sock.send("Which character would you like to load?") else: acct_load_char(sock, args[1]) elif args[0] == 'Q' or "QUIT".startswith(args[0]): sock.send("Come back soon!") mudsys.do_save(sock.account) sock.close() elif args[0] == 'P': # sock.push_ih(acct_confirm_password_handler,acct_confirm_password_prompt) sock.push_ih(acct_new_password_handler, acct_new_password_prompt) sock.push_ih(acct_password_handler, acct_password_prompt) elif args[0] == 'N': if "player" in [x.strip() for x in mudsys.sys_getval("lockdown").split(",")]: sock.send("New characters are not allowed to be created at this time.") else: hooks.run("create_character", hooks.build_info("sk", (sock,))) else: sock.send("Invalid choice!")
def cg_finish_handler(sock, arg): # pop our input handler for finishing character generation sock.pop_ih() # log that the character created mud.log_string("New player: " + sock.ch.name + " has entered the game.") # register and save him to disk and to an account mudsys.do_register(sock.ch) # make him exist in the game for functions to look him up mudsys.try_enter_game(sock.ch) # run the init_player hook hooks.run("init_player", hooks.build_info("ch", (sock.ch, ))) # attach him to his account and save the account sock.account.add_char(sock.ch) mudsys.do_save(sock.account) mudsys.do_save(sock.ch) # clear their screen sock.ch.act("clear") # send them the motd sock.ch.page(mud.get_motd()) # make him look at the room sock.ch.act("look") # run our enter hook hooks.run("enter", hooks.build_info("ch rm", (sock.ch, sock.ch.room)))
def cg_finish_handler(sock, arg): # pop our input handler for finishing character generation sock.pop_ih() # log that the character created mud.log_string("New player: " + sock.ch.name + " has entered the game.") # register and save him to disk and to an account mudsys.do_register(sock.ch) # make him exist in the game for functions to look him up mudsys.try_enter_game(sock.ch) # run the init_player hook hooks.run("init_player", hooks.build_info("ch", (sock.ch,))) # attach him to his account and save the account sock.account.add_char(sock.ch) mudsys.do_save(sock.account) mudsys.do_save(sock.ch) # clear their screen sock.ch.act("clear") # send them the motd sock.ch.page(mud.get_motd()) # make him look at the room sock.ch.act("look") # run our enter hook hooks.run("enter", hooks.build_info("ch rm", (sock.ch, sock.ch.room)))
def cmd_save(ch, cmd, arg): '''Attempt to save your character and all recent changes made to it, to disk. This automatically happens when logging out.''' if mudsys.do_save(ch): ch.send("Saved.") else: ch.send("Your character was not saved.")
def cmd_save(ch, cmd, arg): """Attempt to save your character and all recent changes made to it, to disk. This automatically happens when logging out.""" if mudsys.do_save(ch): ch.send("Saved.") else: ch.send("Your character was not saved.")
def cmd_quit(ch, cmd, arg): '''Attempts to save and log out of the game.''' mud.log_string(ch.name + " has left the game.") mudsys.do_save(ch) mudsys.do_quit(ch)
def cmd_quit(ch, cmd, arg): """Attempts to save and log out of the game.""" mud.log_string(ch.name + " has left the game.") mudsys.do_save(ch) mudsys.do_quit(ch)