Added CharactersHandler to account and altered all calls of add/remove characters to use it.

This commit is contained in:
Andrew Bastien 2023-09-10 12:23:56 -04:00
parent 3c4a3f1088
commit 2bf96f7c7f
11 changed files with 112 additions and 63 deletions

View file

@ -179,7 +179,7 @@ class CmdCharCreate(COMMAND_DEFAULT_CLASS):
"puppet:id(%i) or pid(%i) or perm(Developer) or pperm(Developer);delete:id(%i) or"
" perm(Admin)" % (new_character.id, account.id, account.id)
)
account.add_character_to_playable_list(new_character)
account.characters.add(new_character)
if desc:
new_character.db.desc = desc
elif not new_character.db.desc:
@ -238,7 +238,7 @@ class CmdCharDelete(COMMAND_DEFAULT_CLASS):
# only take action
delobj = caller.ndb._char_to_delete
key = delobj.key
caller.remove_character_from_playable_list(delobj)
caller.characters.remove(delobj)
delobj.delete()
self.msg(f"Character '{key}' was permanently deleted.")
logger.log_sec(

View file

@ -589,7 +589,7 @@ class TestAccount(BaseEvenniaCommandTest):
]
)
def test_ooc_look(self, multisession_mode, auto_puppet, max_nr_chars, expected_result):
self.account.add_character_to_playable_list(self.char1)
self.account.characters.add(self.char1)
self.account.unpuppet_all()
with self.settings(MULTISESSION=multisession_mode):
@ -609,14 +609,14 @@ class TestAccount(BaseEvenniaCommandTest):
self.call(account.CmdOOC(), "", "You go OOC.", caller=self.account)
def test_ic(self):
self.account.add_character_to_playable_list(self.char1)
self.account.characters.add(self.char1)
self.account.unpuppet_object(self.session)
self.call(
account.CmdIC(), "Char", "You become Char.", caller=self.account, receiver=self.char1
)
def test_ic__other_object(self):
self.account.add_character_to_playable_list(self.obj1)
self.account.characters.add(self.obj1)
self.account.unpuppet_object(self.session)
self.call(
account.CmdIC(), "Obj", "You become Obj.", caller=self.account, receiver=self.obj1
@ -670,7 +670,7 @@ class TestAccount(BaseEvenniaCommandTest):
# whether permissions are being checked
# Add char to account playable characters
self.account.add_character_to_playable_list(self.char1)
self.account.characters.add(self.char1)
# Try deleting as Developer
self.call(