diff --git a/etc/toon.dc b/etc/toon.dc index ade48bb..5c4ed03 100755 --- a/etc/toon.dc +++ b/etc/toon.dc @@ -619,7 +619,6 @@ dclass DistributedToon : DistributedPlayer { setDISLname(string) ram; setDISLid(uint32) ram db airecv; toggleSleep() ownrecv; - magicWordTeleport(uint32) ownrecv; }; dclass DistributedCCharBase : DistributedObject { diff --git a/toontown/spellbook/MagicWordIndex.py b/toontown/spellbook/MagicWordIndex.py index 4009900..543e02b 100644 --- a/toontown/spellbook/MagicWordIndex.py +++ b/toontown/spellbook/MagicWordIndex.py @@ -555,7 +555,7 @@ class BossBattle(MagicWord): if not start: respText += " in Frolic state" - return respText + ", teleporting...", ["cogHQLoader", "cogHQBossBattle", "movie" if start else "teleportIn", boss.getHoodId(), boss.zoneId, 0] + return respText + ", teleporting...", toon.doId, ["cogHQLoader", "cogHQBossBattle", "movie" if start else "teleportIn", boss.getHoodId(), boss.zoneId, 0] elif command == "list": # List all the ongoing boss battles. @@ -597,7 +597,7 @@ class BossBattle(MagicWord): return "Index out of range!" boss = AllBossCogs[index] - return "Teleporting to boss battle...", ["cogHQLoader", "cogHQBossBattle", "", boss.getHoodId(), boss.zoneId, 0] + return "Teleporting to boss battle...", toon.doId, ["cogHQLoader", "cogHQBossBattle", "", boss.getHoodId(), boss.zoneId, 0] # The following commands needs the invoker to be in a boss battle. @@ -661,6 +661,7 @@ class Teleport(MagicWord): arguments = [("zoneName", str, False, '')] def handleWord(self, invoker, avId, toon, *args): + from toontown.hood import ZoneUtil from toontown.toonbase import ToontownGlobals zoneName = args[0] @@ -686,10 +687,8 @@ class Teleport(MagicWord): zone = zoneName2Id[zoneName] except KeyError: return "Unknown zone name!" - - toon.d_magicWordTeleport(zone) - return f"Requested to teleport {toon.getName()} to zone {zone}." + return f"Requested to teleport {toon.getName()} to zone {zone}.", toon.doId, [ZoneUtil.getBranchLoaderName(zone), ZoneUtil.getToonWhereName(zone), "", ZoneUtil.getHoodId(zone), zone, 0] class ToggleSleep(MagicWord): aliases = ["sleep", "nosleep", "neversleep", "togglesleeping", "insomnia"] diff --git a/toontown/spellbook/ToontownMagicWordManager.py b/toontown/spellbook/ToontownMagicWordManager.py index 9a53d36..d8a6c2f 100644 --- a/toontown/spellbook/ToontownMagicWordManager.py +++ b/toontown/spellbook/ToontownMagicWordManager.py @@ -275,11 +275,14 @@ class ToontownMagicWordManager(DistributedObject.DistributedObject): hoodId = place.loader.hood.id if avId == 0: avId = -1 - place.fsm.forceTransition('teleportOut', - [{"loader": loaderId, - "where": whereId, - "how": how, - "hoodId": hoodId, - "zoneId": zoneId, - "shardId": None, - "avId": avId}]) + try: + place.fsm.forceTransition('teleportOut', + [{"loader": loaderId, + "where": whereId, + "how": how, + "hoodId": hoodId, + "zoneId": zoneId, + "shardId": None, + "avId": avId}]) + except Exception: # Most likely cause is the place the avatar is in has no teleportOut state, for example, boss lobbies. + place.fsm.request('DFAReject') # We have to do this, or the avatar will be stuck. diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index ed7282a..3a52f75 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -2591,18 +2591,4 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return self.transitioning def toggleSleep(self): - base.localAvatar.noSleep = not base.localAvatar.noSleep - - def magicWordTeleport(self, zone): - hood = ZoneUtil.getHoodId(zone) - place = base.cr.playGame.getPlace() - try: - place.requestLeave({'loader': ZoneUtil.getBranchLoaderName(zone), - 'where': ZoneUtil.getToonWhereName(zone), - 'how': 'teleportIn', - 'hoodId': hood, - 'zoneId': zone, - 'shardId': None, - 'avId': -1}) - except Exception: # Most likely cause is the place the person is in has no teleportOut state, for example, boss lobbies. - place.fsm.request('DFAReject') # We have to do this, or the Toon will be stuck. \ No newline at end of file + base.localAvatar.noSleep = not base.localAvatar.noSleep \ No newline at end of file diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index af8f667..b5489fe 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -4136,9 +4136,6 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def d_toggleSleep(self): self.sendUpdate('toggleSleep', []) - def d_magicWordTeleport(self, zone): - self.sendUpdate('magicWordTeleport', [zone]) - @staticmethod def staticGetLogicalZoneChangeAllEvent(): return 'DOLogicalChangeZone-all'