diff --git a/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Chargen.md b/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Chargen.md index 9523bebaa..a7fc661e3 100644 --- a/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Chargen.md +++ b/docs/source/Howtos/Beginner-Tutorial/Part3/Beginner-Tutorial-Chargen.md @@ -622,7 +622,7 @@ node_apply_character(caller, raw_string, **kwargs): tmp_character = kwargs["tmp_character"] new_character = tmp_character.apply(caller) - caller.account.add_character_to_playable_list(new_character) + caller.account.add_character(new_character) text = "Character created!" diff --git a/docs/source/Howtos/Turn-based-Combat-System.md b/docs/source/Howtos/Turn-based-Combat-System.md index e823dee2d..b9168a8e9 100644 --- a/docs/source/Howtos/Turn-based-Combat-System.md +++ b/docs/source/Howtos/Turn-based-Combat-System.md @@ -389,7 +389,7 @@ def resolve_combat(combat_handler, actiondict): for (char, fleevalue) in flee.items(): if fleevalue == 2: combat_handler.msg_all(f"{char} withdraws from combat.") - combat_handler.remove_character_from_playable_list(char) + combat_handler.remove_character(char) ``` To make it simple (and to save space), this example rule module actually resolves each interchange twice - first when it gets to each character and then again when handling the target. Also, since we use the combat handler's `msg_all` method here, the system will get pretty spammy. To clean it up, one could imagine tracking all the possible interactions to make sure each pair is only handled and reported once. @@ -428,13 +428,13 @@ class CmdAttack(Command): # set up combat if target.ndb.combat_handler: # target is already in combat - join it - target.ndb.combat_handler.add_character_to_playable_list(self.caller) + target.ndb.combat_handler.add_character(self.caller) target.ndb.combat_handler.msg_all(f"{self.caller} joins combat!") else: # create a new combat handler chandler = create_script("combat_handler.CombatHandler") - chandler.add_character_to_playable_list(self.caller) - chandler.add_character_to_playable_list(target) + chandler.add_character(self.caller) + chandler.add_character(target) self.caller.msg(f"You attack {target}! You are in combat.") target.msg(f"{self.caller} attacks you! You are in combat.") ``` diff --git a/docs/source/Howtos/Web-Character-Generation.md b/docs/source/Howtos/Web-Character-Generation.md index 17680aab5..e7ef7c823 100644 --- a/docs/source/Howtos/Web-Character-Generation.md +++ b/docs/source/Howtos/Web-Character-Generation.md @@ -206,7 +206,7 @@ def creating(request): # create the character char = create.create_object(typeclass=typeclass, key=name, home=home, permissions=perms) - user.add_character_to_playable_list(char) + user.add_character(char) # add the right locks for the character so the account can # puppet it char.locks.add(" or ".join([ @@ -290,7 +290,7 @@ def creating(request): # create the character char = create.create_object(typeclass=typeclass, key=name, home=home, permissions=perms) - user.add_character_to_playable_list(char) + user.add_character(char) # add the right locks for the character so the account can # puppet it char.locks.add(" or ".join([ diff --git a/evennia/commands/default/unloggedin.py b/evennia/commands/default/unloggedin.py index c4b7c726a..7bc58dc11 100644 --- a/evennia/commands/default/unloggedin.py +++ b/evennia/commands/default/unloggedin.py @@ -465,64 +465,3 @@ class CmdUnconnectedInfo(COMMAND_DEFAULT_CLASS): utils.get_evennia_version(), ) ) - - -def _create_account(session, accountname, password, permissions, typeclass=None, email=None): - """ - Helper function, creates an account of the specified typeclass. - """ - try: - new_account = create.create_account( - accountname, email, password, permissions=permissions, typeclass=typeclass - ) - - except Exception as e: - session.msg( - "There was an error creating the Account:\n%s\n If this problem persists, contact an" - " admin." % e - ) - logger.log_trace() - return False - - # This needs to be set so the engine knows this account is - # logging in for the first time. (so it knows to call the right - # hooks during login later) - new_account.db.FIRST_LOGIN = True - - # join the new account to the public channel - pchannel = ChannelDB.objects.get_channel(settings.DEFAULT_CHANNELS[0]["key"]) - if not pchannel or not pchannel.connect(new_account): - string = "New account '%s' could not connect to public channel!" % new_account.key - logger.log_err(string) - return new_account - - -def _create_character(session, new_account, typeclass, home, permissions): - """ - Helper function, creates a character based on an account's name. - This is meant for Guest and AUTO_CREATRE_CHARACTER_WITH_ACCOUNT=True situations. - """ - try: - new_character = create.create_object( - typeclass, key=new_account.key, home=home, permissions=permissions - ) - # set playable character list - new_account.add_character_to_playable_list(new_character) - - # allow only the character itself and the account to puppet this character (and Developers). - new_character.locks.add( - "puppet:id(%i) or pid(%i) or perm(Developer) or pperm(Developer)" - % (new_character.id, new_account.id) - ) - - # If no description is set, set a default description - if not new_character.db.desc: - new_character.db.desc = "This is a character." - # We need to set this to have ic auto-connect to this character - new_account.db._last_puppet = new_character - except Exception as e: - session.msg( - "There was an error creating the Character:\n%s\n If this problem persists, contact an" - " admin." % e - ) - logger.log_trace() diff --git a/evennia/server/serversession.py b/evennia/server/serversession.py index 6f535c898..1ea0778f9 100644 --- a/evennia/server/serversession.py +++ b/evennia/server/serversession.py @@ -257,9 +257,6 @@ class ServerSession(_BASE_SESSION_CLASS): for the protocol(s). """ - if (t := kwargs.get("text", None)): - if hasattr(t, "__rich_console__"): - kwargs["text"] = self.print(t) self.sessionhandler.data_out(self, **kwargs) def data_in(self, **kwargs): @@ -296,8 +293,6 @@ class ServerSession(_BASE_SESSION_CLASS): kwargs.pop("session", None) kwargs.pop("from_obj", None) if text is not None: - if hasattr(text, "__rich_console__"): - text = self.print(text) self.data_out(text=text, **kwargs) else: self.data_out(**kwargs) diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index 4a2d6ead4..f5338ba24 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -2941,3 +2941,4 @@ def str2int(number): # invalid number-word, raise ValueError raise ValueError(f"String {original_input} cannot be converted to int.") return sum(sums) +