spellbook: Fix Teleport command redundancies, add support for BossBattle targeting
This commit is contained in:
parent
ff220f7f5f
commit
ecf87d34b3
5 changed files with 16 additions and 32 deletions
|
@ -619,7 +619,6 @@ dclass DistributedToon : DistributedPlayer {
|
|||
setDISLname(string) ram;
|
||||
setDISLid(uint32) ram db airecv;
|
||||
toggleSleep() ownrecv;
|
||||
magicWordTeleport(uint32) ownrecv;
|
||||
};
|
||||
|
||||
dclass DistributedCCharBase : DistributedObject {
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
base.localAvatar.noSleep = not base.localAvatar.noSleep
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue