From 50601fc92dc0c2224247aca76a29dd8f4a8f94ae Mon Sep 17 00:00:00 2001 From: Samuel T Date: Thu, 9 Nov 2023 01:15:48 +0000 Subject: [PATCH] spellbook: SetGM magic word --- toontown/spellbook/MagicWordIndex.py | 16 ++++++++++++++++ toontown/toon/DistributedToon.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/toontown/spellbook/MagicWordIndex.py b/toontown/spellbook/MagicWordIndex.py index a9cbd26..4cf08d8 100644 --- a/toontown/spellbook/MagicWordIndex.py +++ b/toontown/spellbook/MagicWordIndex.py @@ -718,6 +718,22 @@ class ToggleGhost(MagicWord): # 1 is for the attic, 2 enables you to see yourself other ghost toons. 0 is off. toon.b_setGhostMode(2 if not toon.ghostMode else 0) # As it's primarily for moderation purposes, we set it to 2 here, or 0 if it's already on. return f"Toggled ghost mode for {toon.getName()}" + +class SetGM(MagicWord): + aliases = ["icon", "seticon", "gm", "gmicon", "setgmicon"] + desc = "Sets the GM icon on the target." + execLocation = MagicWordConfig.EXEC_LOC_SERVER + arguments = [("iconRequest", int, False, 0),] + + def handleWord(self, invoker, avId, toon, *args): + from toontown.toonbase import TTLocalizer + + iconRequest = args[0] + if iconRequest > len(TTLocalizer.GM_NAMES) or iconRequest < 0: + return "Invalid GM icon ID!" + + toon.b_setGM(iconRequest) + return f"GM icon set to {iconRequest} for {toon.getName()}" class Fireworks(MagicWord): aliases = ["firework"] diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index 8e85357..ed7282a 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2528,7 +2528,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self._handleGMName() def _handleGMName(self): - name = self.name + name = self._name self.setDisplayName(name) if self._isGM: self.setNametagStyle(5)