From 2f764e00a7d86737b969625824a2244553f04aac Mon Sep 17 00:00:00 2001 From: Little Cat Date: Fri, 9 Jul 2021 01:35:56 -0300 Subject: [PATCH] chat: dymanically allow prefixes --- toontown/chat/TTChatInputWhiteList.py | 7 ++++++- toontown/spellbook/ToontownMagicWordManager.py | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toontown/chat/TTChatInputWhiteList.py b/toontown/chat/TTChatInputWhiteList.py index 4889d3f..8186cc7 100644 --- a/toontown/chat/TTChatInputWhiteList.py +++ b/toontown/chat/TTChatInputWhiteList.py @@ -175,7 +175,12 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame): def applyFilter(self, keyArgs, strict = False): text = self.chatEntry.get(plain=True) - if len(text) > 0 and text[0] in ['~', '>']: + prefixes = [] + if base.cr.magicWordManager and base.cr.wantMagicWords: + prefixes.append(base.cr.magicWordManager.chatPrefix) + if config.GetBool('exec-chat', 0): + prefixes.append('>') + if len(text) > 0 and text[0] in prefixes: self.okayToSubmit = True else: words = text.split(' ') diff --git a/toontown/spellbook/ToontownMagicWordManager.py b/toontown/spellbook/ToontownMagicWordManager.py index 915ae08..bf32b8b 100644 --- a/toontown/spellbook/ToontownMagicWordManager.py +++ b/toontown/spellbook/ToontownMagicWordManager.py @@ -49,8 +49,7 @@ class ToontownMagicWordManager(DistributedObject.DistributedObject): DistributedObject.DistributedObject.announceGenerate(self) # Only use a custom Magic Word activator if the index is allowed - # TODO: Uncomment after adding settings support - activatorIndex = 0 # base.settings.getInt('game', 'magic-word-activator', 0) + activatorIndex = base.settings.getSetting('magic-word-activator', 0) if 0 <= activatorIndex <= (len(PREFIX_ALLOWED) - 1): self.chatPrefix = PREFIX_ALLOWED[activatorIndex]