def func(self): ch = self.caller cur_room = ch.location exit = cur_room.db.exits[self.key] if exit < 0: ch.msg(_ERR_MOVEMENT) return # double check to make sure destination room actually exists room = search_object(str(exit), typeclass=Room) if not room: logger.log_errmsg( "Attempting to move to a valid exit vnum, but room doesn't exist" ) ch.msg(_ERR_MOVEMENT) return room = room[0] # special condition if ch is in redit if ch.ndb._redit: ch.ndb._redit.__init__(ch, exit) # announce to the contents in rooms act(f"$n leaves {self.key}", True, True, ch, None, None, Announce.ToRoom) # valid, lets move ch.move_to(room) act(f"$n arrives", True, True, ch, None, None, Announce.ToRoom)
def func(self): "Execute the command" password = self.args self.caller.msg(echo=False) if not hasattr(self.menutree, 'playername'): self.caller.msg( "{rSomething went wrong! Playername not remembered from previous step!{n" ) self.menutree.goto("node2a") return playername = self.menutree.playername if len(password) < 3: # too short password string = "{rYour password must be at least 3 characters or longer." string += "\n\rFor best security, make it at least 8 characters " string += "long, avoid making it a real word and mix numbers " string += "into it.{n" self.caller.msg(string) self.menutree.goto("node2b") return # everything's ok. Create the new player account. Don't create # a Character here. try: permissions = settings.PERMISSION_PLAYER_DEFAULT typeclass = settings.BASE_PLAYER_TYPECLASS new_player = create_player(playername, None, password, typeclass=typeclass, permissions=permissions) if not new_player: self.msg( "There was an error creating the Player. This error was logged. Contact an admin." ) self.menutree.goto("START") return utils.init_new_player(new_player) # join the new player to the public channel pchanneldef = settings.CHANNEL_PUBLIC if pchanneldef: pchannel = managers.channels.get_channel(pchanneldef[0]) if not pchannel.connect(new_player): string = "New player '%s' could not connect to public channel!" % new_player.key logger.log_errmsg(string) # tell the caller everything went well. string = "{gA new account '%s' was created. Now go log in from the menu!{n" self.caller.msg(string % (playername)) self.menutree.goto("START") except Exception: # We are in the middle between logged in and -not, so we have # to handle tracebacks ourselves at this point. If we don't, we # won't see any errors at all. string = "%s\nThis is a bug. Please e-mail an admin if the problem persists." self.caller.msg(string % (traceback.format_exc())) logger.log_errmsg(traceback.format_exc())
def func(self): "Execute the command" password = self.args self.caller.msg(echo=False) if not hasattr(self.menutree, 'playername'): self.caller.msg("{rSomething went wrong! Playername not remembered from previous step!{n") self.menutree.goto("node2a") return playername = self.menutree.playername if len(password) < 3: # too short password string = "{rYour password must be at least 3 characters or longer." string += "\n\rFor best security, make it at least 8 characters " string += "long, avoid making it a real word and mix numbers " string += "into it.{n" self.caller.msg(string) self.menutree.goto("node2b") return # everything's ok. Create the new player account. Don't create # a Character here. try: permissions = settings.PERMISSION_PLAYER_DEFAULT typeclass = settings.BASE_PLAYER_TYPECLASS new_player = create_player(playername, None, password, typeclass=typeclass, permissions=permissions) if not new_player: self.msg("There was an error creating the Player. This error was logged. Contact an admin.") self.menutree.goto("START") return utils.init_new_player(new_player) # join the new player to the public channel pchanneldef = settings.CHANNEL_PUBLIC if pchanneldef: pchannel = managers.channels.get_channel(pchanneldef[0]) if not pchannel.connect(new_player): string = "New player '%s' could not connect to public channel!" % new_player.key logger.log_errmsg(string) # tell the caller everything went well. string = "{gA new account '%s' was created. Now go log in from the menu!{n" self.caller.msg(string % (playername)) self.menutree.goto("START") except Exception: # We are in the middle between logged in and -not, so we have # to handle tracebacks ourselves at this point. If we don't, we # won't see any errors at all. string = "%s\nThis is a bug. Please e-mail an admin if the problem persists." self.caller.msg(string % (traceback.format_exc())) logger.log_errmsg(traceback.format_exc())
def func(self): "Execute the command" password = self.args self.caller.msg(echo=False) if not hasattr(self.menutree, 'playername'): self.caller.msg( "{rSomething went wrong! Playername not remembered from previous step!{n" ) self.menutree.goto("node2a") return playername = self.menutree.playername if len(password) < 3: # too short password string = "{rYour password must be at least 3 characters or longer." string += "\n\rFor best security, make it at least 8 characters " string += "long, avoid making it a real word and mix numbers " string += "into it.{n" self.caller.msg(string) self.menutree.goto("node2b") return # everything's ok. Create the new player account and possibly the character # depending on the multisession mode from evennia.commands.default import unloggedin # we make use of the helper functions from the default set here. try: permissions = settings.PERMISSION_PLAYER_DEFAULT typeclass = settings.BASE_CHARACTER_TYPECLASS new_player = unloggedin._create_player(self.caller, playername, password, permissions) if new_player: if MULTISESSION_MODE < 2: default_home = ObjectDB.objects.get_id( settings.DEFAULT_HOME) unloggedin._create_character(self.caller, new_player, typeclass, default_home, permissions) # tell the caller everything went well. string = "{gA new account '%s' was created. Now go log in from the menu!{n" self.caller.msg(string % (playername)) self.menutree.goto("START") except Exception: # We are in the middle between logged in and -not, so we have # to handle tracebacks ourselves at this point. If we don't, we # won't see any errors at all. string = "%s\nThis is a bug. Please e-mail an admin if the problem persists." self.caller.msg(string % (traceback.format_exc())) logger.log_errmsg(traceback.format_exc())
def func(self): "Execute the command" password = self.args self.caller.msg(echo=False) if not hasattr(self.menutree, 'playername'): self.caller.msg("{rSomething went wrong! Playername not remembered from previous step!{n") self.menutree.goto("node2a") return playername = self.menutree.playername if len(password) < 3: # too short password string = "{rYour password must be at least 3 characters or longer." string += "\n\rFor best security, make it at least 8 characters " string += "long, avoid making it a real word and mix numbers " string += "into it.{n" self.caller.msg(string) self.menutree.goto("node2b") return # everything's ok. Create the new player account and possibly the character # depending on the multisession mode from evennia.commands.default import unloggedin # we make use of the helper functions from the default set here. try: permissions = settings.PERMISSION_PLAYER_DEFAULT typeclass = settings.BASE_CHARACTER_TYPECLASS new_player = unloggedin._create_player(self.caller, playername, password, permissions) if new_player: if MULTISESSION_MODE < 2: default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME) unloggedin._create_character(self.caller, new_player, typeclass, default_home, permissions) # tell the caller everything went well. string = "{gA new account '%s' was created. Now go log in from the menu!{n" self.caller.msg(string % (playername)) self.menutree.goto("START") except Exception: # We are in the middle between logged in and -not, so we have # to handle tracebacks ourselves at this point. If we don't, we # won't see any errors at all. string = "%s\nThis is a bug. Please e-mail an admin if the problem persists." self.caller.msg(string % (traceback.format_exc())) logger.log_errmsg(traceback.format_exc())
def func(self): ch = self.caller cur_room = ch.location exit = cur_room.db.exits[self.key] if exit < 0: ch.msg(_ERR_MOVEMENT) return # double check to make sure destination room actually exists room = search_object(str(exit), typeclass=Room) ch.msg("{}{}".format(exit, room)) if not room: logger.log_errmsg( "Attempting to move to a valid exit vnum, but room doesn't exist" ) ch.msg(_ERR_MOVEMENT) return room = room[0] # special condition if ch is in redit if ch.ndb._redit: ch.ndb._redit.__init__(ch, exit) # valid, lets move ch.move_to(room)