From 168ae65d1e092a72363a90dc08646e20b866a2e0 Mon Sep 17 00:00:00 2001 From: DenialMC Date: Thu, 9 Apr 2015 20:17:24 +0300 Subject: [PATCH] Animated Props client --- astron/dclass/united.dc | 8 - otp/distributed/DCClassImports.py | 4 +- toontown/ai/NewsManager.py | 5 - toontown/battle/BattleBase.py | 1 - toontown/battle/BattleCalculatorAI.py | 5 +- toontown/battle/DistributedBattle.py | 40 +-- toontown/battle/DistributedBattleAI.py | 2 - toontown/battle/DistributedBattleBase.py | 40 ++- toontown/battle/Movie.py | 3 +- toontown/building/DistributedAnimBuilding.py | 50 ---- .../building/DistributedAnimBuildingAI.py | 6 - toontown/building/DistributedAnimDoor.py | 143 ---------- toontown/building/DistributedAnimDoorAI.py | 6 - toontown/building/DistributedBuilding.py | 47 ++-- toontown/building/DistributedBuildingMgrAI.py | 13 +- toontown/building/DoorTypes.py | 3 +- toontown/estate/BankGUI.py | 2 + toontown/hood/GenericAnimatedBuilding.py | 10 - toontown/hood/GenericAnimatedProp.py | 25 +- toontown/hood/HydrantInteractiveProp.py | 264 +++++------------- toontown/hood/HydrantOneAnimatedProp.py | 32 --- toontown/hood/HydrantTwoAnimatedProp.py | 32 --- toontown/hood/HydrantZeroAnimatedProp.py | 17 -- toontown/hood/InteractiveAnimatedProp.py | 50 +--- toontown/hood/MailboxInteractiveProp.py | 245 +++++----------- toontown/hood/MailboxOneAnimatedProp.py | 32 --- toontown/hood/MailboxTwoAnimatedProp.py | 32 --- toontown/hood/MailboxZeroAnimatedProp.py | 17 -- toontown/hood/SleepingHydrantAnimatedProp.py | 26 -- toontown/hood/TrashcanInteractiveProp.py | 236 ++++------------ toontown/hood/TrashcanOneAnimatedProp.py | 32 --- toontown/hood/TrashcanTwoAnimatedProp.py | 32 --- toontown/hood/TrashcanZeroAnimatedProp.py | 17 -- toontown/hood/ZeroAnimatedProp.py | 177 ------------ toontown/minigame/DistributedPhotoGame.py | 16 -- toontown/safezone/SafeZoneLoader.py | 16 -- toontown/suit/DistributedSuitBase.py | 4 +- toontown/suit/DistributedSuitPlannerAI.py | 9 +- toontown/toon/DistributedToonAI.py | 51 ++-- toontown/toon/InventoryNew.py | 15 +- toontown/toonbase/ToontownGlobals.py | 6 - toontown/town/TownLoader.py | 73 ++--- 42 files changed, 349 insertions(+), 1495 deletions(-) delete mode 100644 toontown/building/DistributedAnimBuilding.py delete mode 100644 toontown/building/DistributedAnimBuildingAI.py delete mode 100644 toontown/building/DistributedAnimDoor.py delete mode 100644 toontown/building/DistributedAnimDoorAI.py delete mode 100644 toontown/hood/GenericAnimatedBuilding.py delete mode 100644 toontown/hood/HydrantOneAnimatedProp.py delete mode 100644 toontown/hood/HydrantTwoAnimatedProp.py delete mode 100644 toontown/hood/HydrantZeroAnimatedProp.py delete mode 100644 toontown/hood/MailboxOneAnimatedProp.py delete mode 100644 toontown/hood/MailboxTwoAnimatedProp.py delete mode 100644 toontown/hood/MailboxZeroAnimatedProp.py delete mode 100644 toontown/hood/SleepingHydrantAnimatedProp.py delete mode 100644 toontown/hood/TrashcanOneAnimatedProp.py delete mode 100644 toontown/hood/TrashcanTwoAnimatedProp.py delete mode 100644 toontown/hood/TrashcanZeroAnimatedProp.py delete mode 100644 toontown/hood/ZeroAnimatedProp.py diff --git a/astron/dclass/united.dc b/astron/dclass/united.dc index f0275f74..958b48cc 100644 --- a/astron/dclass/united.dc +++ b/astron/dclass/united.dc @@ -461,7 +461,6 @@ from toontown.safezone import DistributedTreasure/AI from toontown.coghq import DistributedCashbotBossTreasure/AI from toontown.building import DistributedTrophyMgr/AI from toontown.building import DistributedBuilding/AI -from toontown.building import DistributedAnimBuilding/AI from toontown.building import DistributedBuildingQueryMgr/AI from toontown.building import DistributedToonInterior/AI from toontown.building import DistributedToonHallInterior/AI @@ -472,7 +471,6 @@ from toontown.building import DistributedPetshopInterior/AI from toontown.building import DistributedKartShopInterior/AI from toontown.building import DistributedLibraryInterior/AI from toontown.building import DistributedDoor/AI -from toontown.building import DistributedAnimDoor/AI from toontown.estate import DistributedHouseDoor/AI from toontown.coghq import DistributedCogHQDoor/AI from toontown.coghq import DistributedSellbotHQDoor/AI @@ -1903,9 +1901,6 @@ dclass DistributedBuilding : DistributedObject { setVictorReady() airecv clsend; }; -dclass DistributedAnimBuilding : DistributedBuilding { -}; - dclass DistributedBuildingQueryMgr : DistributedObject { isSuit(uint8, uint32) airecv clsend; response(uint8, bool); @@ -2055,9 +2050,6 @@ dclass DistributedDoor : DistributedObject { setExitDoorState(string, int16) required broadcast ram; }; -dclass DistributedAnimDoor : DistributedDoor { -}; - dclass DistributedHouseDoor : DistributedDoor { }; diff --git a/otp/distributed/DCClassImports.py b/otp/distributed/DCClassImports.py index 0c2418e2..373b9887 100644 --- a/otp/distributed/DCClassImports.py +++ b/otp/distributed/DCClassImports.py @@ -2,12 +2,12 @@ from pandac.PandaModules import * -hashVal = 877728986 +hashVal = 2712424547L from toontown.coghq import DistributedCashbotBossSafe, DistributedCashbotBossCrane, DistributedBattleFactory, DistributedCashbotBossTreasure, DistributedCogHQDoor, DistributedSellbotHQDoor, DistributedFactoryElevatorExt, DistributedMintElevatorExt, DistributedLawOfficeElevatorExt, DistributedLawOfficeElevatorInt, LobbyManager, DistributedMegaCorp, DistributedFactory, DistributedLawOffice, DistributedLawOfficeFloor, DistributedLift, DistributedDoorEntity, DistributedSwitch, DistributedButton, DistributedTrigger, DistributedCrushableEntity, DistributedCrusherEntity, DistributedStomper, DistributedStomperPair, DistributedLaserField, DistributedGolfGreenGame, DistributedSecurityCamera, DistributedMover, DistributedElevatorMarker, DistributedBarrelBase, DistributedGagBarrel, DistributedBeanBarrel, DistributedHealBarrel, DistributedGrid, ActiveCell, DirectionalCell, CrusherCell, DistributedCrate, DistributedSinkingPlatform, BattleBlocker, DistributedMint, DistributedMintRoom, DistributedMintBattle, DistributedStage, DistributedStageRoom, DistributedStageBattle, DistributedLawbotBossGavel, DistributedLawbotCannon, DistributedLawbotChair, DistributedCogKart, DistributedCountryClub, DistributedCountryClubRoom, DistributedMoleField, DistributedCountryClubBattle, DistributedMaze, DistributedFoodBelt, DistributedBanquetTable, DistributedGolfSpot from toontown.golf import DistributedPhysicsWorld, DistributedGolfHole, DistributedGolfCourse -from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, DistributedBuilding, DistributedAnimBuilding, DistributedBuildingQueryMgr, DistributedToonInterior, DistributedToonHallInterior, DistributedSuitInterior, DistributedHQInterior, DistributedGagshopInterior, DistributedPetshopInterior, DistributedKartShopInterior, DistributedLibraryInterior, DistributedDoor, DistributedAnimDoor, DistributedKnockKnockDoor, DistributedElevator, DistributedElevatorFSM, DistributedElevatorExt, DistributedElevatorInt, DistributedElevatorFloor, DistributedBossElevator, DistributedVPElevator, DistributedCFOElevator, DistributedCJElevator, DistributedBBElevator, DistributedBoardingParty, DistributedTutorialInterior, DistributedClubElevator +from toontown.building import DistributedAnimatedProp, DistributedTrophyMgr, DistributedBuilding, DistributedBuildingQueryMgr, DistributedToonInterior, DistributedToonHallInterior, DistributedSuitInterior, DistributedHQInterior, DistributedGagshopInterior, DistributedPetshopInterior, DistributedKartShopInterior, DistributedLibraryInterior, DistributedDoor, DistributedKnockKnockDoor, DistributedElevator, DistributedElevatorFSM, DistributedElevatorExt, DistributedElevatorInt, DistributedElevatorFloor, DistributedBossElevator, DistributedVPElevator, DistributedCFOElevator, DistributedCJElevator, DistributedBBElevator, DistributedBoardingParty, DistributedTutorialInterior, DistributedClubElevator from toontown.uberdog.DistributedPartyManager import DistributedPartyManager from otp.friends import FriendManager, PlayerFriendsManager, GuildManager, FriendInfo, AvatarFriendInfo from otp.level import DistributedLevel, DistributedEntity, DistributedInteractiveEntity diff --git a/toontown/ai/NewsManager.py b/toontown/ai/NewsManager.py index c603d53f..a95c98c9 100644 --- a/toontown/ai/NewsManager.py +++ b/toontown/ai/NewsManager.py @@ -201,8 +201,6 @@ class NewsManager(DistributedObject.DistributedObject): pass elif holidayId == ToontownGlobals.CIRCUIT_RACING_EVENT: self.setGrandPrixWeekendStart() - elif holidayId == ToontownGlobals.HYDRANT_ZERO_HOLIDAY: - self.setHydrantZeroHolidayStart() elif holidayId == ToontownGlobals.APRIL_FOOLS_COSTUMES: if hasattr(base, 'localAvatar') and base.localAvatar and hasattr(base.localAvatar, 'chatMgr') and base.localAvatar.chatMgr: base.localAvatar.chatMgr.chatInputSpeedChat.addAprilToonsMenu() @@ -467,9 +465,6 @@ class NewsManager(DistributedObject.DistributedObject): def setGrandPrixWeekendEnd(self): base.localAvatar.setSystemMessage(0, TTLocalizer.GrandPrixWeekendHolidayEnd) - def setHydrantZeroHolidayStart(self): - messenger.send('HydrantZeroIsRunning', [True]) - def setSellbotNerfHolidayStart(self): base.localAvatar.setSystemMessage(0, TTLocalizer.SellbotNerfHolidayStart) diff --git a/toontown/battle/BattleBase.py b/toontown/battle/BattleBase.py index b199f814..6dab8527 100644 --- a/toontown/battle/BattleBase.py +++ b/toontown/battle/BattleBase.py @@ -165,7 +165,6 @@ SERVER_BUFFER_TIME = 2.0 SERVER_INPUT_TIMEOUT = CLIENT_INPUT_TIMEOUT + SERVER_BUFFER_TIME MAX_JOIN_T = TTLocalizer.BBbattleInputTimeout FACEOFF_TAUNT_T = 3.5 -FACEOFF_LOOK_AT_PROP_T = 6 ELEVATOR_T = 4.0 BATTLE_SMALL_VALUE = 1e-07 MAX_EXPECTED_DISTANCE_FROM_BATTLE = 50.0 diff --git a/toontown/battle/BattleCalculatorAI.py b/toontown/battle/BattleCalculatorAI.py index f54d2323..192b8c11 100644 --- a/toontown/battle/BattleCalculatorAI.py +++ b/toontown/battle/BattleCalculatorAI.py @@ -261,10 +261,7 @@ class BattleCalculatorAI: return def __checkPropBonus(self, track): - result = False - if self.battle.getInteractivePropTrackBonus() == track: - result = True - return result + return self.battle.getInteractivePropTrackBonus() == track def __targetDefense(self, suit, atkTrack): if atkTrack == HEAL: diff --git a/toontown/battle/DistributedBattle.py b/toontown/battle/DistributedBattle.py index 001dc956..90a87c37 100644 --- a/toontown/battle/DistributedBattle.py +++ b/toontown/battle/DistributedBattle.py @@ -39,25 +39,6 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): self.ignore(self.PlayGameSetPlaceEvent) self.removeCollisionData() - def setInteractivePropTrackBonus(self, trackBonus): - DistributedBattleBase.DistributedBattleBase.setInteractivePropTrackBonus(self, trackBonus) - if self.interactivePropTrackBonus >= 0: - if base.cr.playGame.hood: - self.calcInteractiveProp() - else: - self.acceptOnce(self.PlayGameSetPlaceEvent, self.calcInteractiveProp) - - def calcInteractiveProp(self): - if base.cr.playGame.hood: - loader = base.cr.playGame.hood.loader - if hasattr(loader, 'getInteractiveProp'): - self.interactiveProp = loader.getInteractiveProp(self.zoneId) - self.notify.debug('self.interactiveProp = %s' % self.interactiveProp) - else: - self.notify.warning('no loader.getInteractiveProp self.interactiveProp is None') - else: - self.notify.warning('no hood self.interactiveProp is None') - def setMembers(self, suits, suitsJoining, suitsPending, suitsActive, suitsLured, suitTraps, toons, toonsJoining, toonsPending, toonsActive, toonsRunning, timestamp): if self.battleCleanedUp(): return @@ -119,9 +100,6 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): camTrack.append(Func(camera.setPos, self.camFOPos)) camTrack.append(Func(camera.lookAt, suit.getPos(self))) camTrack.append(Wait(faceoffTime)) - if self.interactiveProp: - camTrack.append(Func(camera.lookAt, self.interactiveProp.node.getPos(self))) - camTrack.append(Wait(FACEOFF_LOOK_AT_PROP_T)) suitTrack.append(Wait(delay)) toonTrack.append(Wait(delay)) suitTrack.append(Func(suit.headsUp, self, suitPos)) @@ -155,8 +133,10 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): if len(self.toons) > 0 and base.localAvatar == self.toons[0]: Emote.globalEmote.disableAll(self.toons[0], 'dbattle, enterFaceOff') self.__faceOff(ts, self.faceOffName, self.__handleFaceOffDone) - if self.interactiveProp: - self.interactiveProp.gotoFaceoff() + prop = self.getInteractiveProp() + + if prop: + prop.gotoBattleCheer() def __handleFaceOffDone(self): self.notify.debug('FaceOff done') @@ -184,8 +164,10 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): toon.startSmooth() self.accept('resumeAfterReward', self.handleResumeAfterReward) - if self.interactiveProp: - self.interactiveProp.gotoVictory() + prop = self.getInteractiveProp() + + if prop: + prop.gotoVictory() self.playReward(ts) def playReward(self, ts): @@ -213,8 +195,10 @@ class DistributedBattle(DistributedBattleBase.DistributedBattleBase): self.notify.debug('enterResume()') if self.hasLocalToon(): self.removeLocalToon() - if self.interactiveProp: - self.interactiveProp.requestIdleOrSad() + prop = self.getInteractiveProp() + + if prop: + prop.requestIdleOrSad() def exitResume(self): pass diff --git a/toontown/battle/DistributedBattleAI.py b/toontown/battle/DistributedBattleAI.py index 65c5dad5..a29da21a 100644 --- a/toontown/battle/DistributedBattleAI.py +++ b/toontown/battle/DistributedBattleAI.py @@ -56,8 +56,6 @@ class DistributedBattleAI(DistributedBattleBaseAI.DistributedBattleBaseAI): self.runableFsm.request('Unrunable') self.suits[0].releaseControl() timeForFaceoff = self.calcFaceoffTime(self.pos, self.initialSuitPos) + FACEOFF_TAUNT_T + SERVER_BUFFER_TIME - if self.interactivePropTrackBonus >= 0: - timeForFaceoff += FACEOFF_LOOK_AT_PROP_T self.timer.startCallback(timeForFaceoff, self.__serverFaceOffDone) return None diff --git a/toontown/battle/DistributedBattleBase.py b/toontown/battle/DistributedBattleBase.py index 51b6c89a..a96b7ccc 100644 --- a/toontown/battle/DistributedBattleBase.py +++ b/toontown/battle/DistributedBattleBase.py @@ -317,12 +317,23 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): def setBattleCellId(self, battleCellId): pass - - def setInteractivePropTrackBonus(self, trackBonus): - self.interactivePropTrackBonus = trackBonus - + + def getInteractiveProp(self): + if self.interactiveProp: + return self.interactiveProp + elif base.cr.playGame.hood: + loader = base.cr.playGame.hood.loader + + if hasattr(loader, 'getInteractiveProp'): + self.interactiveProp = base.cr.playGame.hood.loader.getInteractiveProp(self.zoneId) + + return self.interactiveProp + return None + def getInteractivePropTrackBonus(self): - return self.interactivePropTrackBonus + prop = self.getInteractiveProp() + + return prop.BattleTrack if prop else -1 def setPosition(self, x, y, z): self.notify.debug('setPosition() - %d %d %d' % (x, y, z)) @@ -363,12 +374,17 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): oldsuits = self.suits self.suits = [] suitGone = 0 + prop = self.getInteractiveProp() + for s in suits: if s in self.cr.doId2do: suit = self.cr.doId2do[s] suit.setState('Battle') self.suits.append(suit) - suit.interactivePropTrackBonus = self.interactivePropTrackBonus + + if prop: + suit.interactivePropTrackBonus = prop.BattleTrack + try: suit.battleTrap except: @@ -1048,9 +1064,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): return Task.done def enterWaitForInput(self, ts = 0): - self.notify.debug('enterWaitForInput()') - if self.interactiveProp: - self.interactiveProp.gotoBattleCheer() + prop = self.getInteractiveProp() + + if prop: + prop.gotoBattleCheer() self.choseAttackAlready = 0 if self.localToonActive(): self.__enterLocalToonWaitForInput() @@ -1242,7 +1259,10 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): if base.cr.playGame.getPlace() != None: base.cr.playGame.getPlace().setState('battle', self.localToonBattleEvent) if localAvatar and hasattr(localAvatar, 'inventory') and localAvatar.inventory: - localAvatar.inventory.setInteractivePropTrackBonus(self.interactivePropTrackBonus) + prop = self.getInteractiveProp() + + if prop: + localAvatar.inventory.setInteractivePropTrackBonus(prop.BattleTrack) camera.wrtReparentTo(self) base.camLens.setMinFov(self.camFov/(4./3.)) return diff --git a/toontown/battle/Movie.py b/toontown/battle/Movie.py index c3b3245b..1f3b4132 100644 --- a/toontown/battle/Movie.py +++ b/toontown/battle/Movie.py @@ -400,8 +400,7 @@ class Movie(DirectObject.DirectObject): if ival: track.append(ival) camTrack.append(camIval) - hasHealBonus = self.battle.getInteractivePropTrackBonus() == HEAL - ival, camIval = MovieHeal.doHeals(self.__findToonAttack(HEAL), hasHealBonus) + ival, camIval = MovieHeal.doHeals(self.__findToonAttack(HEAL), self.battle.getInteractivePropTrackBonus() == HEAL) if ival: track.append(ival) camTrack.append(camIval) diff --git a/toontown/building/DistributedAnimBuilding.py b/toontown/building/DistributedAnimBuilding.py deleted file mode 100644 index f20dc550..00000000 --- a/toontown/building/DistributedAnimBuilding.py +++ /dev/null @@ -1,50 +0,0 @@ -from pandac.PandaModules import DecalEffect, DepthWriteAttrib -from direct.directnotify import DirectNotifyGlobal -from toontown.building import DistributedBuilding - -class DistributedAnimBuilding(DistributedBuilding.DistributedBuilding): - - def __init__(self, cr): - DistributedBuilding.DistributedBuilding.__init__(self, cr) - - def enterToon(self, ts): - DistributedBuilding.DistributedBuilding.enterToon(self, ts) - self.fixEffects() - - def fixEffects(self): - nodes = self.getNodePaths() - for curNode in nodes: - mf = curNode.find('**/*mesh_front*') - sign_joint = curNode.find('**/sign_origin_joint') - if not sign_joint.isEmpty(): - self.notify.debug('I found sign_origin_joint 1') - if not mf.isEmpty(): - sign = mf.find('**/sign') - mf.clearEffect(DecalEffect.getClassType()) - if not sign.isEmpty(): - sign.setDepthWrite(1, 1) - sign.setEffect(DecalEffect.make()) - sign_joint = curNode.find('**/sign_origin_joint') - allSignJoints = curNode.findAllMatches('**/sign_origin_joint') - num = allSignJoints.getNumPaths() - if num: - sign_joint = allSignJoints.getPath(num - 1) - if not sign_joint.isEmpty(): - self.notify.debug('I found sign_origin_joint 2') - sign.wrtReparentTo(sign_joint) - - def setupNametag(self): - if not self.wantsNametag(): - return - DistributedBuilding.DistributedBuilding.setupNametag(self) - - def getSbSearchString(self): - result = 'landmarkBlocks/sb' + str(self.block) + ':*animated_building_*_DNARoot' - return result - - def adjustSbNodepathScale(self, nodePath): - nodePath.setScale(0.543667, 1, 1) - - def animToToon(self, timeStamp): - DistributedBuilding.DistributedBuilding.animToToon(self, timeStamp) - self.fixEffects() diff --git a/toontown/building/DistributedAnimBuildingAI.py b/toontown/building/DistributedAnimBuildingAI.py deleted file mode 100644 index 42f7602d..00000000 --- a/toontown/building/DistributedAnimBuildingAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.building.DistributedBuildingAI import DistributedBuildingAI - -class DistributedAnimBuildingAI(DistributedBuildingAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedAnimBuildingAI") - diff --git a/toontown/building/DistributedAnimDoor.py b/toontown/building/DistributedAnimDoor.py deleted file mode 100644 index 7c7a6736..00000000 --- a/toontown/building/DistributedAnimDoor.py +++ /dev/null @@ -1,143 +0,0 @@ -from pandac.PandaModules import NodePath, VBase3 -from direct.directnotify import DirectNotifyGlobal -from direct.interval.IntervalGlobal import Parallel, Sequence, Wait, HprInterval, LerpHprInterval, SoundInterval -from toontown.building import DistributedDoor -from toontown.building import DoorTypes -if (__debug__): - import pdb - -class DistributedAnimDoor(DistributedDoor.DistributedDoor): - - def __init__(self, cr): - DistributedDoor.DistributedDoor.__init__(self, cr) - base.animDoor = self - - def getBuilding(self): - if 'building' not in self.__dict__: - if self.doorType == DoorTypes.EXT_ANIM_STANDARD: - searchStr = '**/??' + str(self.block) + ':animated_building_*_DNARoot;+s' - self.notify.debug('searchStr=%s' % searchStr) - self.building = self.cr.playGame.hood.loader.geom.find(searchStr) - else: - self.notify.error('DistributedAnimDoor.getBuiding with doorType=%s' % self.doorType) - return self.building - - def getDoorNodePath(self): - if self.doorType == DoorTypes.EXT_ANIM_STANDARD: - if hasattr(self, 'tempDoorNodePath'): - return self.tempDoorNodePath - else: - building = self.getBuilding() - doorNP = building.find('**/door_origin') - self.notify.debug('creating doorOrigin at %s %s' % (str(doorNP.getPos()), str(doorNP.getHpr()))) - otherNP = NodePath('doorOrigin') - otherNP.setPos(doorNP.getPos()) - otherNP.setHpr(doorNP.getHpr()) - otherNP.reparentTo(doorNP.getParent()) - self.tempDoorNodePath = otherNP - else: - self.notify.error('DistributedAnimDoor.getDoorNodePath with doorType=%s' % self.doorType) - return otherNP - - def setTriggerName(self): - if self.doorType == DoorTypes.EXT_ANIM_STANDARD: - building = self.getBuilding() - if not building.isEmpty(): - doorTrigger = building.find('**/door_0_door_trigger') - if not doorTrigger.isEmpty(): - doorTrigger.node().setName(self.getTriggerName()) - else: - self.notify.warning('setTriggerName failed no building') - else: - self.notify.error('setTriggerName doorTYpe=%s' % self.doorType) - - def getAnimBuilding(self): - if 'animBuilding' not in self.__dict__: - if self.doorType == DoorTypes.EXT_ANIM_STANDARD: - bldg = self.getBuilding() - key = bldg.getParent().getParent() - animPropList = self.cr.playGame.hood.loader.animPropDict.get(key) - if animPropList: - for prop in animPropList: - if bldg == prop.getActor().getParent(): - self.animBuilding = prop - break - - else: - self.notify.error('could not find' + str(key)) - else: - self.notify.error('No such door type as ' + str(self.doorType)) - return self.animBuilding - - def getBuildingActor(self): - result = self.getAnimBuilding().getActor() - return result - - def enterOpening(self, ts): - bldgActor = self.getBuildingActor() - rightDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_right_door') - if rightDoor.isEmpty(): - self.notify.warning('enterOpening(): did not find rightDoor') - return - otherNP = self.getDoorNodePath() - trackName = 'doorOpen-%d' % self.doId - if self.rightSwing: - h = 100 - else: - h = -100 - self.finishDoorTrack() - self.doorTrack = Parallel(SoundInterval(self.openSfx, node=rightDoor), Sequence(HprInterval(rightDoor, VBase3(0, 0, 0)), Wait(0.4), LerpHprInterval(nodePath=rightDoor, duration=0.6, hpr=VBase3(h, 0, 0), startHpr=VBase3(0, 0, 0), blendType='easeInOut')), name=trackName) - self.doorTrack.start(ts) - return - - def enterClosing(self, ts): - bldgActor = self.getBuildingActor() - rightDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_right_door') - if rightDoor.isEmpty(): - self.notify.warning('enterClosing(): did not find rightDoor') - return - otherNP = self.getDoorNodePath() - trackName = 'doorClose-%d' % self.doId - if self.rightSwing: - h = 100 - else: - h = -100 - self.finishDoorTrack() - self.doorTrack = Sequence(LerpHprInterval(nodePath=rightDoor, duration=1.0, hpr=VBase3(0, 0, 0), startHpr=VBase3(h, 0, 0), blendType='easeInOut'), SoundInterval(self.closeSfx, node=rightDoor), name=trackName) - self.doorTrack.start(ts) - if hasattr(self, 'done'): - request = self.getRequestStatus() - messenger.send('doorDoneEvent', [request]) - return - - def exitDoorEnterOpening(self, ts): - bldgActor = self.getBuildingActor() - leftDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_left_door') - if self.leftSwing: - h = -100 - else: - h = 100 - if not leftDoor.isEmpty(): - otherNP = self.getDoorNodePath() - trackName = 'doorDoorExitTrack-%d' % self.doId - self.finishDoorExitTrack() - self.doorExitTrack = Parallel(SoundInterval(self.openSfx, node=leftDoor), Sequence(LerpHprInterval(nodePath=leftDoor, duration=0.6, hpr=VBase3(h, 0, 0), startHpr=VBase3(0, 0, 0), blendType='easeInOut')), name=trackName) - self.doorExitTrack.start(ts) - else: - self.notify.warning('exitDoorEnterOpening(): did not find leftDoor') - return - - def exitDoorEnterClosing(self, ts): - bldgActor = self.getBuildingActor() - leftDoor = bldgActor.controlJoint(None, 'modelRoot', 'def_left_door') - if self.leftSwing: - h = -100 - else: - h = 100 - if not leftDoor.isEmpty(): - otherNP = self.getDoorNodePath() - trackName = 'doorExitTrack-%d' % self.doId - self.finishDoorExitTrack() - self.doorExitTrack = Sequence(LerpHprInterval(nodePath=leftDoor, duration=1.0, hpr=VBase3(0, 0, 0), startHpr=VBase3(h, 0, 0), blendType='easeInOut'), SoundInterval(self.closeSfx, node=leftDoor), name=trackName) - self.doorExitTrack.start(ts) - return diff --git a/toontown/building/DistributedAnimDoorAI.py b/toontown/building/DistributedAnimDoorAI.py deleted file mode 100644 index d85b43d9..00000000 --- a/toontown/building/DistributedAnimDoorAI.py +++ /dev/null @@ -1,6 +0,0 @@ -from direct.directnotify import DirectNotifyGlobal -from toontown.building.DistributedDoorAI import DistributedDoorAI - -class DistributedAnimDoorAI(DistributedDoorAI): - notify = DirectNotifyGlobal.directNotify.newCategory("DistributedAnimDoorAI") - diff --git a/toontown/building/DistributedBuilding.py b/toontown/building/DistributedBuilding.py index 323d21fe..d2f5d2b3 100644 --- a/toontown/building/DistributedBuilding.py +++ b/toontown/building/DistributedBuilding.py @@ -236,8 +236,11 @@ class DistributedBuilding(DistributedObject.DistributedObject): pass def enterToon(self, ts): - if self.getInteractiveProp(): - self.getInteractiveProp().buildingLiberated(self.doId) + prop = self.getInteractiveProp() + + if prop: + prop.buildingLiberated(self.doId) + self.setToToon() def exitToon(self): @@ -922,38 +925,30 @@ class DistributedBuilding(DistributedObject.DistributedObject): self.elevatorNodePath.setPosHpr(0, 0, 0, 0, 0, 0) def getSbSearchString(self): - result = 'landmarkBlocks/sb' + str(self.block) + ':*_landmark_*_DNARoot' - return result + return 'landmarkBlocks/sb' + str(self.block) + ':*_landmark_*_DNARoot' def adjustSbNodepathScale(self, nodePath): pass def getVisZoneId(self): exteriorZoneId = base.cr.playGame.hood.dnaStore.getZoneFromBlockNumber(self.block) - visZoneId = ZoneUtil.getTrueZoneId(exteriorZoneId, self.zoneId) - return visZoneId + + return ZoneUtil.getTrueZoneId(exteriorZoneId, self.zoneId) def getInteractiveProp(self): - result = None if self.interactiveProp: - result = self.interactiveProp - else: - visZoneId = self.getVisZoneId() - if base.cr.playGame.hood: - loader = base.cr.playGame.hood.loader - if hasattr(loader, 'getInteractiveProp'): - self.interactiveProp = loader.getInteractiveProp(visZoneId) - result = self.interactiveProp - self.notify.debug('self.interactiveProp = %s' % self.interactiveProp) - else: - self.notify.warning('no loader.getInteractiveProp self.interactiveProp is None') - else: - self.notify.warning('no hood self.interactiveProp is None') - return result + return self.interactiveProp + elif base.cr.playGame.hood: + loader = base.cr.playGame.hood.loader + + if hasattr(loader, 'getInteractiveProp'): + self.interactiveProp = base.cr.playGame.hood.loader.getInteractiveProp(self.getVisZoneId()) + + return self.interactiveProp + return None def makePropSad(self): - self.notify.debug('makePropSad') - if self.getInteractiveProp(): - if self.getInteractiveProp().state == 'Sad': - pass - self.getInteractiveProp().gotoSad(self.doId) + prop = self.getInteractiveProp() + + if prop and not prop.state == 'Sad': + prop.gotoSad(self.doId) \ No newline at end of file diff --git a/toontown/building/DistributedBuildingMgrAI.py b/toontown/building/DistributedBuildingMgrAI.py index a391f4f4..f48ff8e2 100644 --- a/toontown/building/DistributedBuildingMgrAI.py +++ b/toontown/building/DistributedBuildingMgrAI.py @@ -8,7 +8,6 @@ from toontown.building import KartShopBuildingAI from toontown.building import PetshopBuildingAI from toontown.building import LibraryBuildingAI from toontown.hood import ZoneUtil -# from toontown.building import DistributedAnimBuildingAI class DistributedBuildingMgrAI: @@ -93,7 +92,6 @@ class DistributedBuildingMgrAI: petshopBlocks = [] kartshopBlocks = [] libraryBlocks = [] - animBldgBlocks = [] for i in xrange(self.dnaStore.getNumBlockNumbers()): blockNumber = self.dnaStore.getBlockNumberAt(i) buildingType = self.dnaStore.getBlockBuildingType(blockNumber) @@ -108,19 +106,15 @@ class DistributedBuildingMgrAI: kartshopBlocks.append(blockNumber) elif buildingType == 'library': libraryBlocks.append(blockNumber) - elif buildingType == 'animbldg': - animBldgBlocks.append(blockNumber) else: blocks.append(blockNumber) - return (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks, animBldgBlocks) + return (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks) def findAllLandmarkBuildings(self): backups = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={}) - (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks, animBldgBlocks) = self.getDNABlockLists() + (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks) = self.getDNABlockLists() for blockNumber in blocks: self.newBuilding(blockNumber, backup=backups.get(blockNumber, None)) - for blockNumber in animBldgBlocks: - self.newAnimBuilding(blockNumber, backup=backups.get(blockNumber, None)) for blockNumber in hqBlocks: self.newHQBuilding(blockNumber) for blockNumber in gagshopBlocks: @@ -158,9 +152,6 @@ class DistributedBuildingMgrAI: self.__buildings[blockNumber] = building return building - def newAnimBuilding(self, blockNumber, backup=None): - return self.newBuilding(blockNumber, backup=backup) - def newHQBuilding(self, blockNumber): dnaStore = self.air.dnaStoreMap[self.canonicalBranchId] exteriorZoneId = dnaStore.getZoneFromBlockNumber(blockNumber) diff --git a/toontown/building/DoorTypes.py b/toontown/building/DoorTypes.py index 9541a0f8..325710b9 100644 --- a/toontown/building/DoorTypes.py +++ b/toontown/building/DoorTypes.py @@ -7,5 +7,4 @@ INT_HOUSE = 6 EXT_COGHQ = 7 INT_COGHQ = 8 EXT_KS = 9 -INT_KS = 10 -EXT_ANIM_STANDARD = 11 +INT_KS = 10 \ No newline at end of file diff --git a/toontown/estate/BankGUI.py b/toontown/estate/BankGUI.py index 5fefe1ba..175ac522 100644 --- a/toontown/estate/BankGUI.py +++ b/toontown/estate/BankGUI.py @@ -62,6 +62,8 @@ class BankGui(DirectFrame): messenger.send(self.doneEvent, [0]) def __requestTransaction(self): + self.ignore(localAvatar.uniqueName('moneyChange')) + self.ignore(localAvatar.uniqueName('bankMoneyChange')) messenger.send(self.doneEvent, [self.__transactionAmount]) def __updateTransaction(self, amount): diff --git a/toontown/hood/GenericAnimatedBuilding.py b/toontown/hood/GenericAnimatedBuilding.py deleted file mode 100644 index 1390a759..00000000 --- a/toontown/hood/GenericAnimatedBuilding.py +++ /dev/null @@ -1,10 +0,0 @@ -from toontown.hood import GenericAnimatedProp - -class GenericAnimatedBuilding(GenericAnimatedProp.GenericAnimatedProp): - - def __init__(self, node): - GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) - - def enter(self): - if base.config.GetBool('buildings-animate', False): - GenericAnimatedProp.GenericAnimatedProp.enter(self) diff --git a/toontown/hood/GenericAnimatedProp.py b/toontown/hood/GenericAnimatedProp.py index 58de6d40..d439b675 100644 --- a/toontown/hood/GenericAnimatedProp.py +++ b/toontown/hood/GenericAnimatedProp.py @@ -23,8 +23,6 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): nextUnderscore = tempStr.find('_') finalStr = tempStr[nextUnderscore + 1:] pathStr = finalStr.split('__')[0] - elif code.startswith('animated_building_'): - pathStr = code[len('animated_building_'):].split('__')[0] phaseDelimeter = len('phase_') + pathStr[len('phase_'):].find('_') phaseStr = pathStr[:phaseDelimeter] pathTokens = pathStr[phaseDelimeter + 1:].split('_') @@ -48,19 +46,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): def enter(self): self.node.postFlatten() AnimatedProp.AnimatedProp.enter(self) - doAnimLoop = True - try: - if type(self).__name__ == 'instance': - if self.__class__.__name__ == 'GenericAnimatedProp': - if base.cr.newsManager.isHolidayRunning(ToontownGlobals.HYDRANTS_BUFF_BATTLES): - doAnimLoop = True - else: - doAnimLoop = False - except: - pass - - if doAnimLoop: - self.node.loop('anim') + self.node.loop('anim') def exit(self): AnimatedProp.AnimatedProp.exit(self) @@ -81,14 +67,13 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): self.hoodId = ToontownGlobals.ToontownCentral fullString = str(node) splits = fullString.split('/') - try: - visId = int(splits[2]) + if len(splits) >= 5: + visId = int(splits[4]) self.visId = visId self.hoodId = ZoneUtil.getCanonicalHoodId(visId) self.notify.debug('calcHoodId %d from %s' % (self.hoodId, fullString)) - except Exception, generic: - if 'Editor' not in fullString: - self.notify.warning("calcHoodId couldn't parse %s using 0" % fullString) + else: + self.notify.warning("calcHoodId couldn't parse %s using 0" % fullString) self.hoodId = 0 self.visId = 0 diff --git a/toontown/hood/HydrantInteractiveProp.py b/toontown/hood/HydrantInteractiveProp.py index e612b6a5..eb8e5e71 100644 --- a/toontown/hood/HydrantInteractiveProp.py +++ b/toontown/hood/HydrantInteractiveProp.py @@ -2,207 +2,94 @@ from direct.actor import Actor from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import Sequence, Func from toontown.hood import InteractiveAnimatedProp -from toontown.hood import GenericAnimatedProp from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('HydrantInteractiveProp') - BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.SQUIRT_TRACK] - ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_hydrant_idle0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_hydrant_idle2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_hydrant_idle1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_hydrant_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DonaldsDock: (('tt_a_ara_ttc_hydrant_idle0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_hydrant_idle2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_hydrant_idle1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_hydrant_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_hydrant_idle0', - 3, - 10, - 'tt_a_ara_dga_hydrant_idle0settle', - 3, - 10), - ('tt_a_ara_dga_hydrant_idleLook1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_hydrant_idleSneeze2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_hydrant_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_hydrant_idle0', - 3, - 10, - 'tt_a_ara_mml_hydrant_idle0settle', - 3, - 10), - ('tt_a_ara_mml_hydrant_idle2', - 3, - 10, - 'tt_a_ara_mml_hydrant_idle2settle', - 3, - 10), - ('tt_a_ara_mml_hydrant_idle1', - 3, - 10, - 'tt_a_ara_mml_hydrant_idle1settle', - 3, - 10), - ('tt_a_ara_mml_hydrant_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_hydrant_idleShiver1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_hydrant_idleRubNose0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_hydrant_idleSneeze2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_hydrant_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_hydrant_idle0', - 3, - 10, - None, - 0, - 0), - ('tt_a_ara_ddl_hydrant_idle1', - 1, - 1, - None, - 0, - 0), - ('tt_a_ara_ddl_hydrant_idle2', - 1, - 1, - None, - 0, - 0), - ('tt_a_ara_ddl_hydrant_idleAwesome3', - 1, - 1, - None, - 0, - 0))} - ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_idleIntoFight', - ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_idleIntoFight', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_idleIntoFight', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_idleIntoFight', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_idleIntoFight', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_idleIntoFight'} - ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_victoryDance', - ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_victoryDance', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_victoryDance', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_victoryDance', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_victoryDance', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_victoryDance'} - ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_fightSad', - ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_fightSad', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_fightSad', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_fightSad', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_fightSad', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_fightSad'} - ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), - ToontownGlobals.DonaldsDock: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), - ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_hydrant_fightBoost', 'tt_a_ara_dga_hydrant_fightCheer', 'tt_a_ara_dga_hydrant_fightIdle'), - ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_hydrant_fightBoost', 'tt_a_ara_mml_hydrant_fightCheer', 'tt_a_ara_mml_hydrant_fightIdle'), - ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_hydrant_fightBoost', 'tt_a_ara_tbr_hydrant_fightCheer', 'tt_a_ara_tbr_hydrant_fightIdle'), - ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_hydrant_fightBoost', 'tt_a_ara_ddl_hydrant_fightCheer', 'tt_a_ara_ddl_hydrant_fightIdle')} + BattleTrack = ToontownBattleGlobals.SQUIRT_TRACK + BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack] + + ZoneToIdles = { + ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_hydrant_idle0', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_hydrant_idle2', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_hydrant_idle1', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_hydrant_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DonaldsDock: (('tt_a_ara_ttc_hydrant_idle0', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_hydrant_idle2', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_hydrant_idle1', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_hydrant_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_hydrant_idle0', 3, 10, 'tt_a_ara_dga_hydrant_idle0settle', 3, 10), + ('tt_a_ara_dga_hydrant_idleLook1', 1, 1, None, 3, 10), + ('tt_a_ara_dga_hydrant_idleSneeze2', 1, 1, None, 3, 10), + ('tt_a_ara_dga_hydrant_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_hydrant_idle0', 3, 10, 'tt_a_ara_mml_hydrant_idle0settle', 3, 10), + ('tt_a_ara_mml_hydrant_idle2', 3, 10, 'tt_a_ara_mml_hydrant_idle2settle', 3, 10), + ('tt_a_ara_mml_hydrant_idle1', 3, 10, 'tt_a_ara_mml_hydrant_idle1settle', 3, 10), + ('tt_a_ara_mml_hydrant_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_hydrant_idleShiver1', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_hydrant_idleRubNose0', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_hydrant_idleSneeze2', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_hydrant_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_hydrant_idle0', 3, 10, None, 0, 0), + ('tt_a_ara_ddl_hydrant_idle1', 1, 1, None, 0, 0), + ('tt_a_ara_ddl_hydrant_idle2', 1, 1, None, 0, 0), + ('tt_a_ara_ddl_hydrant_idleAwesome3', 1, 1, None, 0, 0))} + + ZoneToIdleIntoFightAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_idleIntoFight', + ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_idleIntoFight', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_idleIntoFight', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_idleIntoFight', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_idleIntoFight', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_idleIntoFight'} + + ZoneToVictoryAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_victoryDance', + ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_victoryDance', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_victoryDance', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_victoryDance', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_victoryDance', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_victoryDance'} + + ZoneToSadAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_hydrant_fightSad', + ToontownGlobals.DonaldsDock: 'tt_a_ara_ttc_hydrant_fightSad', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_hydrant_fightSad', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_hydrant_fightSad', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_hydrant_fightSad', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_hydrant_fightSad'} + + ZoneToFightAnims = { + ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), + ToontownGlobals.DonaldsDock: ('tt_a_ara_ttc_hydrant_fightBoost', 'tt_a_ara_ttc_hydrant_fightCheer', 'tt_a_ara_ttc_hydrant_fightIdle'), + ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_hydrant_fightBoost', 'tt_a_ara_dga_hydrant_fightCheer', 'tt_a_ara_dga_hydrant_fightIdle'), + ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_hydrant_fightBoost', 'tt_a_ara_mml_hydrant_fightCheer', 'tt_a_ara_mml_hydrant_fightIdle'), + ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_hydrant_fightBoost', 'tt_a_ara_tbr_hydrant_fightCheer', 'tt_a_ara_tbr_hydrant_fightIdle'), + ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_hydrant_fightBoost', 'tt_a_ara_ddl_hydrant_fightCheer', 'tt_a_ara_ddl_hydrant_fightIdle')} + IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) def __init__(self, node): self.leftWater = None self.rightWater = None - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.HYDRANTS_BUFF_BATTLES) - return + InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) def setupActor(self, node): InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node) + if not self.hoodId == ToontownGlobals.TheBrrrgh: water = loader.loadModel('phase_5/models/char/tt_m_efx_hydrantSquirt') self.leftWater = water.find('**/efx_hydrantSquirtLeft') self.rightWater = water.find('**/efx_hydrantSquirtRight') - dx_left_water = self.node.find('**/dx_left_water') + if self.leftWater: - self.leftWater.reparentTo(dx_left_water) + self.leftWater.reparentTo(self.node.find('**/dx_left_water')) base.leftWater = self.leftWater self.leftWater.hide() - else: - self.notify.warning('couldnt find %s in rig for hood %d' % ('dx_left_water', self.hoodId)) - dx_right_water = self.node.find('**/dx_right_water') + if self.rightWater: - self.rightWater.reparentTo(dx_right_water) + self.rightWater.reparentTo(self.node.find('**/dx_right_water')) self.rightWater.hide() - else: - self.notify.warning('couldnt find %s in rig for hood %d' % ('dx_left_water', self.hoodId)) def hideWater(self): if self.leftWater: @@ -217,20 +104,15 @@ class HydrantInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): self.rightWater.show() def hasOverrideIval(self, origAnimName): - result = False - if ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh: - result = True - return result + return ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh def getOverrideIval(self, origAnimName): result = Sequence() - if ('fightBoost' in origAnimName or 'fightCheer' in origAnimName) and not self.hoodId == ToontownGlobals.TheBrrrgh: + + if self.hasOverrideIval(origAnimName): result.append(Func(self.showWater)) - if 'fightBoost' in origAnimName: - animKey = 'fight0' - else: - animKey = 'fight1' - animAndSound = self.createAnimAndSoundIval(animKey) + animAndSound = self.createAnimAndSoundIval('fight0' if 'fightBoost' in origAnimName else 'fight1') result.append(animAndSound) result.append(Func(self.hideWater)) - return result + + return result \ No newline at end of file diff --git a/toontown/hood/HydrantOneAnimatedProp.py b/toontown/hood/HydrantOneAnimatedProp.py deleted file mode 100644 index 71f2bdde..00000000 --- a/toontown/hood/HydrantOneAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class HydrantOneAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('HydrantOneAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_ttc_hydrant_firstMoveArmUp1', 40 * PauseTimeMult), - 1: ('tt_a_ara_ttc_hydrant_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_ttc_hydrant_firstMoveArmUp2', 10 * PauseTimeMult), - 3: ('tt_a_ara_ttc_hydrant_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_ttc_hydrant_firstMoveJumpBalance', 6 * PauseTimeMult), - 5: ('tt_a_ara_ttc_hydrant_firstMoveArmUp3', 4 * PauseTimeMult), - 6: ('tt_a_ara_ttc_hydrant_firstMoveJumpSpin', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 3 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'hydrant', self.PhaseInfo, ToontownGlobals.HYDRANT_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/HydrantTwoAnimatedProp.py b/toontown/hood/HydrantTwoAnimatedProp.py deleted file mode 100644 index c94435ec..00000000 --- a/toontown/hood/HydrantTwoAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class HydrantTwoAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('HydrantTwoAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_ttc_hydrant_firstMoveArmUp1', 40 * PauseTimeMult), - 1: ('tt_a_ara_ttc_hydrant_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_ttc_hydrant_firstMoveArmUp2', 10 * PauseTimeMult), - 3: ('tt_a_ara_ttc_hydrant_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_ttc_hydrant_firstMoveJumpBalance', 6 * PauseTimeMult), - 5: ('tt_a_ara_ttc_hydrant_firstMoveArmUp3', 4 * PauseTimeMult), - 6: ('tt_a_ara_ttc_hydrant_firstMoveJumpSpin', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 5 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'hydrant', self.PhaseInfo, ToontownGlobals.HYDRANT_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/HydrantZeroAnimatedProp.py b/toontown/hood/HydrantZeroAnimatedProp.py deleted file mode 100644 index 98249ad1..00000000 --- a/toontown/hood/HydrantZeroAnimatedProp.py +++ /dev/null @@ -1,17 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class HydrantZeroAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('HydrantZeroAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_ttc_hydrant_firstMoveArmUp1', 40 * PauseTimeMult), - 1: ('tt_a_ara_ttc_hydrant_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_ttc_hydrant_firstMoveArmUp2', 10 * PauseTimeMult), - 3: ('tt_a_ara_ttc_hydrant_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_ttc_hydrant_firstMoveJumpBalance', 6 * PauseTimeMult), - 5: ('tt_a_ara_ttc_hydrant_firstMoveArmUp3', 4 * PauseTimeMult), - 6: ('tt_a_ara_ttc_hydrant_firstMoveJumpSpin', 2 * PauseTimeMult)} - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'hydrant', self.PhaseInfo, ToontownGlobals.HYDRANT_ZERO_HOLIDAY) diff --git a/toontown/hood/InteractiveAnimatedProp.py b/toontown/hood/InteractiveAnimatedProp.py index af0b93a5..c95cc950 100644 --- a/toontown/hood/InteractiveAnimatedProp.py +++ b/toontown/hood/InteractiveAnimatedProp.py @@ -30,9 +30,8 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): HpTextGenerator = TextNode('HpTextGenerator') BattleCheerText = '+' - def __init__(self, node, holidayId = -1): + def __init__(self, node): FSM.FSM.__init__(self, 'InteractiveProp-%s' % str(node)) - self.holidayId = holidayId self.numIdles = 0 self.numFightAnims = 0 self.idleInterval = None @@ -49,7 +48,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.lastPlayingAnimPhase = 0 self.buildingsMakingMeSad = set() GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) - return def delete(self): self.exit() @@ -58,7 +56,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.battleCheerInterval = None self.sadInterval = None self.victoryInterval = None - return def getCellIndex(self): return self.cellIndex @@ -114,7 +111,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.battleCheerInterval = self.createBattleCheerInterval() self.victoryInterval = self.createVictoryInterval() self.sadInterval = self.createSadInterval() - return def createIdleInterval(self): result = Sequence() @@ -202,18 +198,9 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): GenericAnimatedProp.GenericAnimatedProp.enter(self) if base.config.GetBool('props-buff-battles', True): self.notify.debug('props buff battles is true') - if base.cr.newsManager.isHolidayRunning(self.holidayId): - self.notify.debug('holiday is running, doing idle interval') - self.node.stop() - self.node.pose('idle0', 0) - if base.config.GetBool('interactive-prop-random-idles', 1): - self.requestIdleOrSad() - else: - self.idleInterval.loop() - else: - self.notify.debug('holiday is NOT running, doing nothing') - self.node.stop() - self.node.pose('idle0', 0) + self.node.stop() + self.node.pose('idle0', 0) + self.idleInterval.loop() else: self.notify.debug('props do not buff battles') self.node.stop() @@ -343,39 +330,24 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def gotoFaceoff(self): self.notify.debugStateCall(self) - if base.cr.newsManager.isHolidayRunning(self.holidayId): - self.request('Faceoff') - else: - self.notify.debug('not going to faceoff because holiday %d is not running' % self.holidayId) + self.request('Faceoff') def gotoBattleCheer(self): self.notify.debugStateCall(self) - if base.cr.newsManager.isHolidayRunning(self.holidayId): - self.request('BattleCheer') - else: - self.notify.debug('not going to battleCheer because holiday %d is not running' % self.holidayId) + self.request('BattleCheer') def gotoIdle(self): self.notify.debugStateCall(self) - if base.cr.newsManager.isHolidayRunning(self.holidayId): - self.request('DoIdleAnim') - else: - self.notify.debug('not going to idle because holiday %d is not running' % self.holidayId) + self.request('DoIdleAnim') def gotoVictory(self): self.notify.debugStateCall(self) - if base.cr.newsManager.isHolidayRunning(self.holidayId): - self.request('Victory') - else: - self.notify.debug('not going to victory because holiday %d is not running' % self.holidayId) + self.request('Victory') def gotoSad(self, buildingDoId): self.notify.debugStateCall(self) self.buildingsMakingMeSad.add(buildingDoId) - if base.cr.newsManager.isHolidayRunning(self.holidayId): - self.request('Sad') - else: - self.notify.debug('not going to sad because holiday %d is not running' % self.holidayId) + self.request('Sad') def buildingLiberated(self, buildingDoId): self.buildingsMakingMeSad.discard(buildingDoId) @@ -391,7 +363,6 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.notify.debugStateCall(self) self.curIval.pause() self.curIval = None - return def calcWhichIdleAnim(self, animName): result = 0 @@ -504,5 +475,4 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): if self.curIval: self.curIval.finish() clearPythonIvals(self.curIval) - self.curIval = None - return + self.curIval = None \ No newline at end of file diff --git a/toontown/hood/MailboxInteractiveProp.py b/toontown/hood/MailboxInteractiveProp.py index 7d6bd11f..06ddba74 100644 --- a/toontown/hood/MailboxInteractiveProp.py +++ b/toontown/hood/MailboxInteractiveProp.py @@ -2,201 +2,92 @@ from direct.actor import Actor from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import Sequence, Func from toontown.hood import InteractiveAnimatedProp -from toontown.hood import GenericAnimatedProp from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer class MailboxInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('MailboxInteractiveProp') - BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.THROW_TRACK] - ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_mailbox_idle0', - 3, - 10, - 'tt_a_ara_ttc_mailbox_idle0settle', - 3, - 10), - ('tt_a_ara_ttc_mailbox_idleTake2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_mailbox_idleLook1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_mailbox_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_mailbox_idle0', - 3, - 10, - 'tt_a_ara_dod_mailbox_idle0settle', - 3, - 10), - ('tt_a_ara_dod_mailbox_idle2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dod_mailbox_idle1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dod_mailbox_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_mailbox_idle0', - 3, - 10, - 'tt_a_ara_dga_mailbox_idle0settle', - 3, - 10), - ('tt_a_ara_dga_mailbox_idleTake1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_mailbox_idleLook2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_mailbox_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_mailbox_idle0', - 3, - 10, - 'tt_a_ara_mml_mailbox_idle0settle', - 3, - 10), - ('tt_a_ara_mml_mailbox_idleTake1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_mml_mailbox_idleLook2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_mml_mailbox_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_mailbox_idleShiver1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_mailbox_idleSneeze2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_mailbox_idleSpin0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_mailbox_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_mailbox_idleSleep0', - 3, - 10, - None, - 0, - 0), - ('tt_a_ara_ddl_mailbox_idleShake2', - 1, - 1, - None, - 0, - 0), - ('tt_a_ara_ddl_mailbox_idleSnore1', - 1, - 1, - None, - 0, - 0), - ('tt_a_ara_ddl_mailbox_idleAwesome3', - 1, - 1, - None, - 0, - 0))} - ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_idleIntoFight', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_idleIntoFight', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_idleIntoFight', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_idleIntoFight', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_idleIntoFight', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_idleIntoFight'} - ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_victoryDance', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_victoryDance', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_victoryDance', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_victoryDance', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_victoryDance', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_victoryDance'} - ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_fightSad', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_fightSad', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_fightSad', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_fightSad', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_fightSad', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_fightSad'} - ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'), - ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_mailbox_fightBoost', 'tt_a_ara_dod_mailbox_fightCheer', 'tt_a_ara_dod_mailbox_fightIdle'), - ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_mailbox_fightBoost', 'tt_a_ara_dga_mailbox_fightCheer', 'tt_a_ara_dga_mailbox_fightIdle'), - ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_mailbox_fightBoost', 'tt_a_ara_mml_mailbox_fightCheer', 'tt_a_ara_mml_mailbox_fightIdle'), - ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_mailbox_fightBoost', 'tt_a_ara_tbr_mailbox_fightCheer', 'tt_a_ara_tbr_mailbox_fightIdle'), - ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_mailbox_fightBoost', 'tt_a_ara_ddl_mailbox_fightCheer', 'tt_a_ara_ddl_mailbox_fightIdle')} + BattleTrack = ToontownBattleGlobals.THROW_TRACK + BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack] + + ZoneToIdles = { + ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_mailbox_idle0', 3, 10, 'tt_a_ara_ttc_mailbox_idle0settle', 3, 10), + ('tt_a_ara_ttc_mailbox_idleTake2', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_mailbox_idleLook1', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_mailbox_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_mailbox_idle0', 3, 10, 'tt_a_ara_dod_mailbox_idle0settle', 3, 10), + ('tt_a_ara_dod_mailbox_idle2', 1, 1, None, 3, 10), + ('tt_a_ara_dod_mailbox_idle1', 1, 1, None, 3, 10), + ('tt_a_ara_dod_mailbox_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_mailbox_idle0', 3, 10, 'tt_a_ara_dga_mailbox_idle0settle', 3, 10), + ('tt_a_ara_dga_mailbox_idleTake1', 1, 1, None, 3, 10), + ('tt_a_ara_dga_mailbox_idleLook2', 1, 1, None, 3, 10), + ('tt_a_ara_dga_mailbox_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_mailbox_idle0', 3, 10, 'tt_a_ara_mml_mailbox_idle0settle', 3, 10), + ('tt_a_ara_mml_mailbox_idleTake1', 1, 1, None, 3, 10), + ('tt_a_ara_mml_mailbox_idleLook2', 1, 1, None, 3, 10), + ('tt_a_ara_mml_mailbox_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_mailbox_idleShiver1', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_mailbox_idleSneeze2', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_mailbox_idleSpin0', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_mailbox_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_mailbox_idleSleep0', 3, 10, None, 0, 0), + ('tt_a_ara_ddl_mailbox_idleShake2', 1, 1, None, 0, 0), + ('tt_a_ara_ddl_mailbox_idleSnore1', 1, 1, None, 0, 0), + ('tt_a_ara_ddl_mailbox_idleAwesome3', 1, 1, None, 0, 0))} + + ZoneToIdleIntoFightAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_idleIntoFight', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_idleIntoFight', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_idleIntoFight', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_idleIntoFight', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_idleIntoFight', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_idleIntoFight'} + + ZoneToVictoryAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_victoryDance', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_victoryDance', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_victoryDance', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_victoryDance', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_victoryDance', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_victoryDance'} + + ZoneToSadAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_mailbox_fightSad', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_mailbox_fightSad', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_mailbox_fightSad', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_mailbox_fightSad', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_mailbox_fightSad', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_mailbox_fightSad'} + + ZoneToFightAnims = { + ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_mailbox_fightBoost', 'tt_a_ara_ttc_mailbox_fightCheer', 'tt_a_ara_ttc_mailbox_fightIdle'), + ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_mailbox_fightBoost', 'tt_a_ara_dod_mailbox_fightCheer', 'tt_a_ara_dod_mailbox_fightIdle'), + ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_mailbox_fightBoost', 'tt_a_ara_dga_mailbox_fightCheer', 'tt_a_ara_dga_mailbox_fightIdle'), + ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_mailbox_fightBoost', 'tt_a_ara_mml_mailbox_fightCheer', 'tt_a_ara_mml_mailbox_fightIdle'), + ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_mailbox_fightBoost', 'tt_a_ara_tbr_mailbox_fightCheer', 'tt_a_ara_tbr_mailbox_fightIdle'), + ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_mailbox_fightBoost', 'tt_a_ara_ddl_mailbox_fightCheer', 'tt_a_ara_ddl_mailbox_fightIdle')} + IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) def __init__(self, node): - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.MAILBOXES_BUFF_BATTLES) + InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) def setupActor(self, node): self.pieActor = Actor.Actor('phase_5/models/char/tt_r_prp_ext_piePackage', {'fightBoost': 'phase_5/models/char/tt_a_prp_ext_piePackage_fightBoost'}) self.pieActor.reparentTo(self.node) self.pieActor.hide() + InteractiveAnimatedProp.InteractiveAnimatedProp.setupActor(self, node) def hasSpecialIval(self, origAnimName): - result = False - if 'fightBoost' in origAnimName: - result = True - return result + return 'fightBoost' in origAnimName def getSpecialIval(self, origAnimName): result = Sequence() - if 'fightBoost' in origAnimName: + + if self.hasSpecialIval(origAnimName): result.append(Func(self.pieActor.show)) result.append(self.pieActor.actorInterval('fightBoost')) result.append(Func(self.pieActor.hide)) - return result + + return result \ No newline at end of file diff --git a/toontown/hood/MailboxOneAnimatedProp.py b/toontown/hood/MailboxOneAnimatedProp.py deleted file mode 100644 index 26ca187d..00000000 --- a/toontown/hood/MailboxOneAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class MailboxOneAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('MailboxOneAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin1', 40 * PauseTimeMult), - 1: (('tt_a_ara_dod_mailbox_firstMoveStruggle', 'tt_a_ara_dod_mailbox_firstMoveJump'), 20 * PauseTimeMult), - 2: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin3', 8 * PauseTimeMult), - 4: ('tt_a_ara_dod_mailbox_firstMoveJumpSummersault', 6 * PauseTimeMult), - 5: ('tt_a_ara_dod_mailbox_firstMoveJumpFall', 4 * PauseTimeMult), - 6: ('tt_a_ara_dod_mailbox_firstMoveJump3Summersaults', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 3 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'mailbox', self.PhaseInfo, ToontownGlobals.MAILBOX_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/MailboxTwoAnimatedProp.py b/toontown/hood/MailboxTwoAnimatedProp.py deleted file mode 100644 index 8c2472a7..00000000 --- a/toontown/hood/MailboxTwoAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class MailboxTwoAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('MailboxTwoAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin1', 40 * PauseTimeMult), - 1: (('tt_a_ara_dod_mailbox_firstMoveStruggle', 'tt_a_ara_dod_mailbox_firstMoveJump'), 20 * PauseTimeMult), - 2: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin3', 8 * PauseTimeMult), - 4: ('tt_a_ara_dod_mailbox_firstMoveJumpSummersault', 6 * PauseTimeMult), - 5: ('tt_a_ara_dod_mailbox_firstMoveJumpFall', 4 * PauseTimeMult), - 6: ('tt_a_ara_dod_mailbox_firstMoveJump3Summersaults', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 5 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'mailbox', self.PhaseInfo, ToontownGlobals.MAILBOX_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/MailboxZeroAnimatedProp.py b/toontown/hood/MailboxZeroAnimatedProp.py deleted file mode 100644 index 2ccdf35b..00000000 --- a/toontown/hood/MailboxZeroAnimatedProp.py +++ /dev/null @@ -1,17 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class MailboxZeroAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('MailboxZeroAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin1', 40 * PauseTimeMult), - 1: (('tt_a_ara_dod_mailbox_firstMoveStruggle', 'tt_a_ara_dod_mailbox_firstMoveJump'), 20 * PauseTimeMult), - 2: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dod_mailbox_firstMoveFlagSpin3', 8 * PauseTimeMult), - 4: ('tt_a_ara_dod_mailbox_firstMoveJumpSummersault', 6 * PauseTimeMult), - 5: ('tt_a_ara_dod_mailbox_firstMoveJumpFall', 4 * PauseTimeMult), - 6: ('tt_a_ara_dod_mailbox_firstMoveJump3Summersaults', 2 * PauseTimeMult)} - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'mailbox', self.PhaseInfo, ToontownGlobals.MAILBOX_ZERO_HOLIDAY) diff --git a/toontown/hood/SleepingHydrantAnimatedProp.py b/toontown/hood/SleepingHydrantAnimatedProp.py deleted file mode 100644 index 0b6845b6..00000000 --- a/toontown/hood/SleepingHydrantAnimatedProp.py +++ /dev/null @@ -1,26 +0,0 @@ -import AnimatedProp -from direct.interval.IntervalGlobal import * -from direct.task import Task -import math - -class SleepingHydrantAnimatedProp(AnimatedProp.AnimatedProp): - - def __init__(self, node): - AnimatedProp.AnimatedProp.__init__(self, node) - self.task = None - return - - def bobTask(self, task): - self.node.setSz(1.0 + 0.08 * math.sin(task.time)) - return Task.cont - - def enter(self): - AnimatedProp.AnimatedProp.enter(self) - self.task = taskMgr.add(self.bobTask, self.uniqueName('bobTask')) - - def exit(self): - AnimatedProp.AnimatedProp.exit(self) - if self.task: - taskMgr.remove(self.task) - self.task = None - return diff --git a/toontown/hood/TrashcanInteractiveProp.py b/toontown/hood/TrashcanInteractiveProp.py index 36a726b2..1ac6c658 100644 --- a/toontown/hood/TrashcanInteractiveProp.py +++ b/toontown/hood/TrashcanInteractiveProp.py @@ -1,184 +1,72 @@ from direct.actor import Actor from direct.directnotify import DirectNotifyGlobal from toontown.hood import InteractiveAnimatedProp -from toontown.hood import GenericAnimatedProp from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer class TrashcanInteractiveProp(InteractiveAnimatedProp.InteractiveAnimatedProp): notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanInteractiveProp') - BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[ToontownBattleGlobals.HEAL_TRACK] - ZoneToIdles = {ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_trashcan_idleTake2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_trashcan_idleHiccup0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_trashcan_idleLook1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_ttc_trashcan_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_trashcan_idleBounce2', - 3, - 10, - 'tt_a_ara_dod_trashcan_idle0settle', - 3, - 10), - ('tt_a_ara_dod_trashcan_idle0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dod_trashcan_idle1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dod_trashcan_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_trashcan_idleTake2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_trashcan_idleHiccup0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_trashcan_idleLook1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_dga_trashcan_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_trashcan_idleBounce0', - 3, - 10, - 'tt_a_ara_mml_trashcan_idle0settle', - 3, - 10), - ('tt_a_ara_mml_trashcan_idleLook1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_mml_trashcan_idleHelicopter2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_mml_trashcan_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_trashcan_idleShiver1', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_trashcan_idleSneeze2', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_trashcan_idle0', - 1, - 1, - None, - 3, - 10), - ('tt_a_ara_tbr_trashcan_idleAwesome3', - 1, - 1, - None, - 3, - 10)), - ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_trashcan_idleSleep0', - 3, - 10, - None, - 0, - 0), - ('tt_a_ara_ddl_trashcan_idleShake2', - 1, - 1, - None, - 0, - 0), - ('tt_a_ara_ddl_trashcan_idleSnore1', - 1, - 1, - None, - 0, - 0), - ('tt_a_ara_ddl_trashcan_idleAwesome3', - 1, - 1, - None, - 0, - 0))} - ZoneToIdleIntoFightAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_idleIntoFight', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_idleIntoFight', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_idleIntoFight', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_idleIntoFight', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_idleIntoFight', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_idleIntoFight'} - ZoneToVictoryAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_victoryDance', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_victoryDance', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_victoryDance', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_victoryDance', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_victoryDance', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_victoryDance'} - ZoneToSadAnims = {ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_fightSad', - ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_fightSad', - ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_fightSad', - ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_fightSad', - ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_fightSad', - ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_fightSad'} - ZoneToFightAnims = {ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'), - ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_trashcan_fightBoost', 'tt_a_ara_dod_trashcan_fightCheer', 'tt_a_ara_dod_trashcan_fightIdle'), - ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_trashcan_fightBoost', 'tt_a_ara_dga_trashcan_fightCheer', 'tt_a_ara_dga_trashcan_fightIdle'), - ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_trashcan_fightBoost', - 'tt_a_ara_mml_trashcan_fightCheer0', - 'tt_a_ara_mml_trashcan_fightCheer1', - 'tt_a_ara_mml_trashcan_fightIdle'), - ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_trashcan_fightBoost', 'tt_a_ara_tbr_trashcan_fightCheer', 'tt_a_ara_tbr_trashcan_fightIdle'), - ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')} + BattleTrack = ToontownBattleGlobals.HEAL_TRACK + BattleCheerText = TTLocalizer.InteractivePropTrackBonusTerms[BattleTrack] + + ZoneToIdles = { + ToontownGlobals.ToontownCentral: (('tt_a_ara_ttc_trashcan_idleTake2', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_trashcan_idleHiccup0', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_trashcan_idleLook1', 1, 1, None, 3, 10), + ('tt_a_ara_ttc_trashcan_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DonaldsDock: (('tt_a_ara_dod_trashcan_idleBounce2', 3, 10, 'tt_a_ara_dod_trashcan_idle0settle', 3, 10), + ('tt_a_ara_dod_trashcan_idle0', 1, 1, None, 3, 10), + ('tt_a_ara_dod_trashcan_idle1', 1, 1, None, 3, 10), + ('tt_a_ara_dod_trashcan_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DaisyGardens: (('tt_a_ara_dga_trashcan_idleTake2', 1, 1, None, 3, 10), + ('tt_a_ara_dga_trashcan_idleHiccup0', 1, 1, None, 3, 10), + ('tt_a_ara_dga_trashcan_idleLook1', 1, 1, None, 3, 10), + ('tt_a_ara_dga_trashcan_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.MinniesMelodyland: (('tt_a_ara_mml_trashcan_idleBounce0', 3, 10, 'tt_a_ara_mml_trashcan_idle0settle', 3, 10), + ('tt_a_ara_mml_trashcan_idleLook1', 1, 1, None, 3, 10), + ('tt_a_ara_mml_trashcan_idleHelicopter2', 1, 1, None, 3, 10), + ('tt_a_ara_mml_trashcan_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.TheBrrrgh: (('tt_a_ara_tbr_trashcan_idleShiver1', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_trashcan_idleSneeze2', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_trashcan_idle0', 1, 1, None, 3, 10), + ('tt_a_ara_tbr_trashcan_idleAwesome3', 1, 1, None, 3, 10)), + ToontownGlobals.DonaldsDreamland: (('tt_a_ara_ddl_trashcan_idleSleep0', 3, 10, None, 0, 0), + ('tt_a_ara_ddl_trashcan_idleShake2', 1, 1, None, 0, 0), + ('tt_a_ara_ddl_trashcan_idleSnore1', 1, 1, None, 0, 0), + ('tt_a_ara_ddl_trashcan_idleAwesome3', 1, 1, None, 0, 0))} + + ZoneToIdleIntoFightAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_idleIntoFight', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_idleIntoFight', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_idleIntoFight', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_idleIntoFight', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_idleIntoFight', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_idleIntoFight'} + + ZoneToVictoryAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_victoryDance', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_victoryDance', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_victoryDance', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_victoryDance', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_victoryDance', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_victoryDance'} + + ZoneToSadAnims = { + ToontownGlobals.ToontownCentral: 'tt_a_ara_ttc_trashcan_fightSad', + ToontownGlobals.DonaldsDock: 'tt_a_ara_dod_trashcan_fightSad', + ToontownGlobals.DaisyGardens: 'tt_a_ara_dga_trashcan_fightSad', + ToontownGlobals.MinniesMelodyland: 'tt_a_ara_mml_trashcan_fightSad', + ToontownGlobals.TheBrrrgh: 'tt_a_ara_tbr_trashcan_fightSad', + ToontownGlobals.DonaldsDreamland: 'tt_a_ara_ddl_trashcan_fightSad'} + + ZoneToFightAnims = { + ToontownGlobals.ToontownCentral: ('tt_a_ara_ttc_trashcan_fightBoost', 'tt_a_ara_ttc_trashcan_fightCheer', 'tt_a_ara_ttc_trashcan_fightIdle'), + ToontownGlobals.DonaldsDock: ('tt_a_ara_dod_trashcan_fightBoost', 'tt_a_ara_dod_trashcan_fightCheer', 'tt_a_ara_dod_trashcan_fightIdle'), + ToontownGlobals.DaisyGardens: ('tt_a_ara_dga_trashcan_fightBoost', 'tt_a_ara_dga_trashcan_fightCheer', 'tt_a_ara_dga_trashcan_fightIdle'), + ToontownGlobals.MinniesMelodyland: ('tt_a_ara_mml_trashcan_fightBoost', 'tt_a_ara_mml_trashcan_fightCheer0', 'tt_a_ara_mml_trashcan_fightCheer1', 'tt_a_ara_mml_trashcan_fightIdle'), + ToontownGlobals.TheBrrrgh: ('tt_a_ara_tbr_trashcan_fightBoost', 'tt_a_ara_tbr_trashcan_fightCheer', 'tt_a_ara_tbr_trashcan_fightIdle'), + ToontownGlobals.DonaldsDreamland: ('tt_a_ara_ddl_trashcan_fightBoost', 'tt_a_ara_ddl_trashcan_fightCheer', 'tt_a_ara_ddl_trashcan_fightIdle')} + IdlePauseTime = base.config.GetFloat('prop-idle-pause-time', 0.0) def __init__(self, node): - InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node, ToontownGlobals.TRASHCANS_BUFF_BATTLES) + InteractiveAnimatedProp.InteractiveAnimatedProp.__init__(self, node) \ No newline at end of file diff --git a/toontown/hood/TrashcanOneAnimatedProp.py b/toontown/hood/TrashcanOneAnimatedProp.py deleted file mode 100644 index 68d4331a..00000000 --- a/toontown/hood/TrashcanOneAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class TrashcanOneAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanOneAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dga_trashcan_firstMoveLidFlip1', 40 * PauseTimeMult), - 1: ('tt_a_ara_dga_trashcan_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_dga_trashcan_firstMoveLidFlip2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dga_trashcan_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_dga_trashcan_firstMoveLidFlip3', 6 * PauseTimeMult), - 5: ('tt_a_ara_dga_trashcan_firstMoveJumpHit', 4 * PauseTimeMult), - 6: ('tt_a_ara_dga_trashcan_firstMoveJumpJuggle', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 3 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'trashcan', self.PhaseInfo, ToontownGlobals.TRASHCAN_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/TrashcanTwoAnimatedProp.py b/toontown/hood/TrashcanTwoAnimatedProp.py deleted file mode 100644 index f0b86cec..00000000 --- a/toontown/hood/TrashcanTwoAnimatedProp.py +++ /dev/null @@ -1,32 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class TrashcanTwoAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanTwoAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dga_trashcan_firstMoveLidFlip1', 40 * PauseTimeMult), - 1: ('tt_a_ara_dga_trashcan_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_dga_trashcan_firstMoveLidFlip2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dga_trashcan_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_dga_trashcan_firstMoveLidFlip3', 6 * PauseTimeMult), - 5: ('tt_a_ara_dga_trashcan_firstMoveJumpHit', 4 * PauseTimeMult), - 6: ('tt_a_ara_dga_trashcan_firstMoveJumpJuggle', 2 * PauseTimeMult)} - PhaseWeStartAnimating = 5 - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'trashcan', self.PhaseInfo, ToontownGlobals.TRASHCAN_ZERO_HOLIDAY) - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= self.PhaseWeStartAnimating: - self.request('DoAnim') - except: - pass - - def handleNewPhase(self, newPhase): - if newPhase < self.PhaseWeStartAnimating: - self.request('Off') - else: - self.startIfNeeded() diff --git a/toontown/hood/TrashcanZeroAnimatedProp.py b/toontown/hood/TrashcanZeroAnimatedProp.py deleted file mode 100644 index 7b432ad9..00000000 --- a/toontown/hood/TrashcanZeroAnimatedProp.py +++ /dev/null @@ -1,17 +0,0 @@ -from toontown.hood import ZeroAnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class TrashcanZeroAnimatedProp(ZeroAnimatedProp.ZeroAnimatedProp): - notify = DirectNotifyGlobal.directNotify.newCategory('TrashcanZeroAnimatedProp') - PauseTimeMult = base.config.GetFloat('zero-pause-mult', 1.0) - PhaseInfo = {0: ('tt_a_ara_dga_trashcan_firstMoveLidFlip1', 40 * PauseTimeMult), - 1: ('tt_a_ara_dga_trashcan_firstMoveStruggle', 20 * PauseTimeMult), - 2: ('tt_a_ara_dga_trashcan_firstMoveLidFlip2', 10 * PauseTimeMult), - 3: ('tt_a_ara_dga_trashcan_firstMoveJump', 8 * PauseTimeMult), - 4: ('tt_a_ara_dga_trashcan_firstMoveLidFlip3', 6 * PauseTimeMult), - 5: ('tt_a_ara_dga_trashcan_firstMoveJumpHit', 4 * PauseTimeMult), - 6: ('tt_a_ara_dga_trashcan_firstMoveJumpJuggle', 2 * PauseTimeMult)} - - def __init__(self, node): - ZeroAnimatedProp.ZeroAnimatedProp.__init__(self, node, 'trashcan', self.PhaseInfo, ToontownGlobals.TRASHCAN_ZERO_HOLIDAY) diff --git a/toontown/hood/ZeroAnimatedProp.py b/toontown/hood/ZeroAnimatedProp.py deleted file mode 100644 index ab7070f5..00000000 --- a/toontown/hood/ZeroAnimatedProp.py +++ /dev/null @@ -1,177 +0,0 @@ -import types -import math -from direct.interval.IntervalGlobal import Sequence, Wait, ActorInterval, Func, SoundInterval, Parallel -from direct.task import Task -from direct.fsm import FSM -from direct.showbase.PythonUtil import weightedChoice -from toontown.hood import GenericAnimatedProp -from toontown.hood import AnimatedProp -from toontown.toonbase import ToontownGlobals -from direct.directnotify import DirectNotifyGlobal - -class ZeroAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): - notify = DirectNotifyGlobal.directNotify.newCategory('ZeroAnimatedProp') - - def __init__(self, node, propString, phaseInfo, holidayId): - self.propString = propString - self.phaseInfo = phaseInfo - self.holidayId = holidayId - GenericAnimatedProp.GenericAnimatedProp.__init__(self, node) - FSM.FSM.__init__(self, '%sZeroAnimPropFsm' % self.propString) - self.node.unloadAnims('anim') - self.loadPhaseAnims() - self.phaseIvals = [] - self.curIval = None - self.curPhase = -1 - self.okToStartNextAnim = False - return - - def delete(self): - self.exit() - GenericAnimatedProp.GenericAnimatedProp.delete(self) - - def loadPhaseAnims(self): - animDict = {} - for key, info in self.phaseInfo.iteritems(): - if type(info[0]) == types.TupleType: - for index, anims in enumerate(info[0]): - fullPath = self.path + '/' + anims - animName = 'phase%d_%d' % (key, index) - animDict[animName] = fullPath - - else: - animName = 'phase%d' % key - fullPath = self.path + '/' + info[0] - animDict[animName] = fullPath - - self.node.loadAnims(animDict) - - def createPhaseIntervals(self): - if self.phaseIvals: - self.notify.debug('not creating phase ivals again') - return - self.phaseIvals = [] - for key, info in self.phaseInfo.iteritems(): - self.notify.debug('key=%s' % key) - if type(info[0]) == types.TupleType: - ival = Sequence() - for index, anims in enumerate(info[0]): - animName = 'phase%d_%d' % (key, index) - animIval = self.node.actorInterval(animName) - animIvalDuration = animIval.getDuration() - soundIval = self.createSoundInterval(anims, animIvalDuration) - soundIvalDuration = soundIval.getDuration() - animAndSound = Parallel(soundIval, animIval) - ival.append(animAndSound) - - self.phaseIvals.append(ival) - else: - animName = 'phase%d' % key - animIval = self.node.actorInterval('phase%d' % key) - animIvalDuration = animIval.getDuration() - soundIval = self.createSoundInterval(info[0], animIvalDuration) - soundIvalDuration = soundIval.getDuration() - ival = Parallel(animIval, soundIval) - self.phaseIvals.append(ival) - - def enter(self): - self.node.postFlatten() - self.createPhaseIntervals() - AnimatedProp.AnimatedProp.enter(self) - defaultAnim = self.node.getAnimControl('anim') - numFrames = defaultAnim.getNumFrames() - self.node.pose('phase0', 0) - self.accept('%sZeroPhase' % self.propString, self.handleNewPhase) - self.accept('%sZeroIsRunning' % self.propString, self.handleNewIsRunning) - self.startIfNeeded() - - def startIfNeeded(self): - try: - self.curPhase = self.getPhaseToRun() - if self.curPhase >= 0: - self.request('DoAnim') - except: - pass - - def chooseAnimToRun(self): - result = self.curPhase - if base.config.GetBool('anim-props-randomized', True): - pairs = [] - for i in xrange(self.curPhase + 1): - pairs.append((math.pow(2, i), i)) - - sum = math.pow(2, self.curPhase + 1) - 1 - result = weightedChoice(pairs, sum=sum) - self.notify.debug('chooseAnimToRun curPhase=%s pairs=%s result=%s' % (self.curPhase, pairs, result)) - return result - - def createAnimSequence(self, animPhase): - result = Sequence(self.phaseIvals[animPhase], Wait(self.phaseInfo[self.curPhase][1]), Func(self.startNextAnim)) - return result - - def startNextAnim(self): - self.notify.debug('startNextAnim self.okToStartNextAnim=%s' % self.okToStartNextAnim) - self.curIval = None - if self.okToStartNextAnim: - self.notify.debug('got pass okToStartNextAnim') - whichAnim = self.chooseAnimToRun() - self.notify.debug('whichAnim=%s' % whichAnim) - self.lastPlayingAnimPhase = whichAnim - self.curIval = self.createAnimSequence(whichAnim) - self.notify.debug('starting curIval of length %s' % self.curIval.getDuration()) - self.curIval.start() - else: - self.notify.debug('false self.okToStartNextAnim=%s' % self.okToStartNextAnim) - return - - def enterDoAnim(self): - self.notify.debug('enterDoAnim curPhase=%d' % self.curPhase) - self.okToStartNextAnim = True - self.startNextAnim() - - def exitDoAnim(self): - self.notify.debug('exitDoAnim curPhase=%d' % self.curPhase) - self.okToStartNextAnim = False - self.curIval.finish() - self.curIval = None - return - - def getPhaseToRun(self): - result = -1 - enoughInfoToRun = False - if base.cr.newsManager.isHolidayRunning(self.holidayId): - zeroMgrString = '%sZeroMgr' % self.propString - if hasattr(base.cr, zeroMgrString): - zeroMgr = eval('base.cr.%s' % zeroMgrString) - if not zeroMgr.isDisabled(): - enoughInfoToRun = True - else: - self.notify.debug('isDisabled = %s' % zeroMgr.isDisabled()) - else: - self.notify.debug('base.cr does not have %s' % zeroMgrString) - else: - self.notify.debug('holiday is not running') - self.notify.debug('enoughInfoToRun = %s' % enoughInfoToRun) - if enoughInfoToRun and zeroMgr.getIsRunning(): - curPhase = zeroMgr.getCurPhase() - if curPhase >= len(self.phaseIvals): - curPhase = len(self.phaseIvals) - 1 - self.notify.warning('zero mgr says to go to phase %d, but we only have %d ivals. forcing curPhase to %d' % (curPhase, len(self.phaseIvals), curPhase)) - result = curPhase - return result - - def exit(self): - self.okToStartNextAnim = False - self.ignore('%sZeroPhase' % self.propString) - self.ignore('%sZeroIsRunning' % self.propString) - GenericAnimatedProp.GenericAnimatedProp.exit(self) - self.request('Off') - - def handleNewPhase(self, newPhase): - self.startIfNeeded() - - def handleNewIsRunning(self, isRunning): - if isRunning: - self.startIfNeeded() - else: - self.request('Off') diff --git a/toontown/minigame/DistributedPhotoGame.py b/toontown/minigame/DistributedPhotoGame.py index 2872b9ae..279c6e45 100644 --- a/toontown/minigame/DistributedPhotoGame.py +++ b/toontown/minigame/DistributedPhotoGame.py @@ -1626,22 +1626,6 @@ class DistributedPhotoGame(DistributedMinigame, PhotoGameBase.PhotoGameBase): animPropList = self.animPropDict.setdefault(i, []) animPropList.append(animPropObj) - interactivePropNodes = i.findAllMatches('**/interactive_prop_*') - numInteractivePropNodes = interactivePropNodes.getNumPaths() - for j in xrange(numInteractivePropNodes): - interactivePropNode = interactivePropNodes.getPath(j) - className = 'GenericAnimatedProp' - symbols = {} - base.cr.importModule(symbols, 'toontown.hood', [className]) - classObj = getattr(symbols[className], className) - interactivePropObj = classObj(interactivePropNode) - animPropList = self.animPropDict.get(i) - if animPropList is None: - animPropList = self.animPropDict.setdefault(i, []) - animPropList.append(interactivePropObj) - - return - def deleteAnimatedProps(self): for animPropListKey in self.animPropDict: animPropList = self.animPropDict[animPropListKey] diff --git a/toontown/safezone/SafeZoneLoader.py b/toontown/safezone/SafeZoneLoader.py index 1f63df6f..ad673b46 100644 --- a/toontown/safezone/SafeZoneLoader.py +++ b/toontown/safezone/SafeZoneLoader.py @@ -222,22 +222,6 @@ class SafeZoneLoader(StateData.StateData): animPropList = self.animPropDict.setdefault(i, []) animPropList.append(animPropObj) - interactivePropNodes = i.findAllMatches('**/interactive_prop_*') - numInteractivePropNodes = interactivePropNodes.getNumPaths() - for j in xrange(numInteractivePropNodes): - interactivePropNode = interactivePropNodes.getPath(j) - className = 'GenericAnimatedProp' - symbols = {} - base.cr.importModule(symbols, 'toontown.hood', [className]) - classObj = getattr(symbols[className], className) - interactivePropObj = classObj(interactivePropNode) - animPropList = self.animPropDict.get(i) - if animPropList is None: - animPropList = self.animPropDict.setdefault(i, []) - animPropList.append(interactivePropObj) - - return - def deleteAnimatedProps(self): for zoneNode, animPropList in self.animPropDict.items(): for animProp in animPropList: diff --git a/toontown/suit/DistributedSuitBase.py b/toontown/suit/DistributedSuitBase.py index 186479e5..05e17edd 100644 --- a/toontown/suit/DistributedSuitBase.py +++ b/toontown/suit/DistributedSuitBase.py @@ -60,7 +60,9 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa self.maxSkeleRevives = 0 self.sillySurgeText = False self.interactivePropTrackBonus = -1 - return + + def setInteractivePropTrackBonus(self, trackBonus): + self.interactivePropTrackBonus = trackBonus def setVirtual(self, virtual): pass diff --git a/toontown/suit/DistributedSuitPlannerAI.py b/toontown/suit/DistributedSuitPlannerAI.py index ea3a5638..7648da69 100644 --- a/toontown/suit/DistributedSuitPlannerAI.py +++ b/toontown/suit/DistributedSuitPlannerAI.py @@ -97,13 +97,10 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan self.notify.debug('Creating a building manager AI in zone' + str(self.zoneId)) self.buildingMgr = self.air.buildingManagers.get(self.zoneId) if self.buildingMgr: - (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks, animBldgBlocks) = self.buildingMgr.getDNABlockLists() + (blocks, hqBlocks, gagshopBlocks, petshopBlocks, kartshopBlocks, libraryBlocks) = self.buildingMgr.getDNABlockLists() for currBlock in blocks: bldg = self.buildingMgr.getBuilding(currBlock) bldg.setSuitPlannerExt(self) - for currBlock in animBldgBlocks: - bldg = self.buildingMgr.getBuilding(currBlock) - bldg.setSuitPlannerExt(self) self.dnaStore.resetBlockNumbers() self.initBuildingsAndPoints() numSuits = simbase.config.GetInt('suit-count', -1) @@ -855,7 +852,11 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if hasattr(toon, 'doId'): toon.b_setBattleId(toonId) pos = self.battlePosDict[canonicalZoneId] + + # TODO interactivePropTrackBonus = -1 + # TODO + self.battleMgr.newBattle( zoneId, zoneId, pos, suit, toonId, self.__battleFinished, self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_SMAX], diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 0fafaf91..8e7ce59c 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -4536,6 +4536,18 @@ def maxMoney(maxMoney): spellbook.getTarget().b_setMaxMoney(maxMoney) return "Set {0}'s max money value to {1}!".format(target.getName(), maxMoney) +@magicWord(category=CATEGORY_PROGRAMMER, types=[int]) +def maxBankMoney(maxBankMoney): + """ + Modifies the target's max bank money value. + """ + + if not 10000 <= maxBankMoney <= 30000: + return 'Max bank money value must be in xrange (10000-30000).' + target = spellbook.getTarget() + spellbook.getTarget().b_setMaxBankMoney(maxBankMoney) + return "Set {0}'s max bank money value to {1}!".format(target.getName(), maxBankMoney) + @magicWord(category=CATEGORY_PROGRAMMER, types=[int]) def money(money): """ @@ -4548,39 +4560,18 @@ def money(money): target.b_setMoney(money) return "Set %s's money value to %d!" % (target.getName(), money) -@magicWord(category=CATEGORY_PROGRAMMER, types=[str, int]) -def bank(command, value): +@magicWord(category=CATEGORY_PROGRAMMER, types=[int]) +def bank(money): """ - Modifies the target's bank money values. + Modifies the target's current bank money value. """ - command = command.lower() target = spellbook.getTarget() - if command == 'transfer': - if value == 0: - return 'Invalid bank transfer.' - bankMoney = target.getBankMoney() - maxBankMoney = target.getMaxBankMoney() - money = target.getMoney() - maxMoney = target.getMaxMoney() - if value > 0: - maxDeposit = money - maxDeposit = min(maxDeposit, maxBankMoney - money) - deposit = min(value, maxDeposit) - bankMoney += deposit - money -= deposit - target.b_setBankMoney(bankMoney) - target.b_setMoney(money) - else: - maxWithdrawl = maxMoney - money - maxWithdrawl = min(maxWithdrawl, bankMoney) - withdrawl = min(value, maxWithdrawl) - bankMoney -= withdrawl - money += withdrawl - target.b_setBankMoney(bankMoney) - target.b_setMoney(money) - return 'Bank transfer successful!' - else: - return 'Invalid command!' + maxMoney = target.getMaxBankMoney() + + if not 0 <= money <= maxMoney: + return 'Bank money must be in xrange (0-%d.)' % maxMoney + target.b_setBankMoney(money) + return "Set %s's bank money value to %d!" % (target.getName(), money) @magicWord(category=CATEGORY_PROGRAMMER, types=[int]) def fishingRod(rod): diff --git a/toontown/toon/InventoryNew.py b/toontown/toon/InventoryNew.py index 2eed38bc..02769171 100644 --- a/toontown/toon/InventoryNew.py +++ b/toontown/toon/InventoryNew.py @@ -42,7 +42,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): self.__battleCreditMultiplier = base.baseXpMultiplier self.__invasionCreditMultiplier = base.baseXpMultiplier self.__respectInvasions = 1 - self._interactivePropTrackBonus = -1 + self.interactivePropTrackBonus = -1 self.tutorialFlag = 0 self.gagTutMode = 0 self.showSuperGags = ShowSuperGags @@ -61,10 +61,10 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): return self.__battleCreditMultiplier def setInteractivePropTrackBonus(self, trackBonus): - self._interactivePropTrackBonus = trackBonus + self.interactivePropTrackBonus = trackBonus def getInteractivePropTrackBonus(self): - return self._interactivePropTrackBonus + return self.interactivePropTrackBonus def setInvasionCreditMultiplier(self, mult): self.__invasionCreditMultiplier = mult @@ -996,7 +996,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): else: shadowColor = self.ShadowColor button.configure(image0_image=self.upButton, image2_image=self.rolloverButton, text_shadow=shadowColor, geom_color=self.PressableGeomColor, commandButtons=(DGG.LMB,)) - if self._interactivePropTrackBonus == track: + if self.interactivePropTrackBonus == track: button.configure(image_color=self.PropBonusPressableImageColor) self.addToPropBonusIval(button) else: @@ -1022,7 +1022,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): else: shadowColor = self.ShadowColor button.configure(image0_image=self.upButton, image2_image=self.rolloverButton, text_shadow=shadowColor, geom_color=self.PressableGeomColor, commandButtons=(DGG.LMB,)) - if self._interactivePropTrackBonus == track: + if self.interactivePropTrackBonus == track: button.configure(image_color=self.PropBonusNoncreditPressableImageColor) self.addToPropBonusIval(button) else: @@ -1187,10 +1187,7 @@ class InventoryNew(InventoryBase.InventoryBase, DirectFrame): messenger.send('exitTrackFrame', [track]) def checkPropBonus(self, track): - result = False - if track == self._interactivePropTrackBonus: - result = True - return result + return track == self.interactivePropTrackBonus def stopAndClearPropBonusIval(self): if self.propBonusIval and self.propBonusIval.isPlaying(): diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index b8563f60..d0222561 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -897,15 +897,9 @@ BEAN_COUNTER_INVASION = 54 DOUBLE_TALKER_INVASION = 55 DOWNSIZER_INVASION = 56 WINTER_CAROLING = 57 -HYDRANT_ZERO_HOLIDAY = 58 VALENTINES_DAY = 59 SILLYMETER_HOLIDAY = 60 -MAILBOX_ZERO_HOLIDAY = 61 -TRASHCAN_ZERO_HOLIDAY = 62 SILLY_SURGE_HOLIDAY = 63 -HYDRANTS_BUFF_BATTLES = 64 -MAILBOXES_BUFF_BATTLES = 65 -TRASHCANS_BUFF_BATTLES = 66 SILLY_CHATTER_ONE = 67 SILLY_CHATTER_TWO = 68 SILLY_CHATTER_THREE = 69 diff --git a/toontown/town/TownLoader.py b/toontown/town/TownLoader.py index fcd35e5d..f5e8a198 100644 --- a/toontown/town/TownLoader.py +++ b/toontown/town/TownLoader.py @@ -17,8 +17,7 @@ from toontown.toon.Toon import teleportDebug from toontown.battle import BattleParticles from direct.fsm import StateData from toontown.building import ToonInterior -from toontown.hood import QuietZoneState -from toontown.hood import ZoneUtil +from toontown.hood import QuietZoneState, ZoneUtil, HydrantInteractiveProp, MailboxInteractiveProp, TrashcanInteractiveProp from direct.interval.IntervalGlobal import * from toontown.dna.DNAParser import DNABulkLoader @@ -292,6 +291,7 @@ class TownLoader(StateData.StateData): def createAnimatedProps(self, nodeList): self.animPropDict = {} self.zoneIdToInteractivePropDict = {} + for i in nodeList: animPropNodes = i.findAllMatches('**/animated_prop_*') numAnimPropNodes = animPropNodes.getNumPaths() @@ -313,50 +313,26 @@ class TownLoader(StateData.StateData): animPropList.append(animPropObj) interactivePropNodes = i.findAllMatches('**/interactive_prop_*') - numInteractivePropNodes = interactivePropNodes.getNumPaths() - for j in xrange(numInteractivePropNodes): - interactivePropNode = interactivePropNodes.getPath(j) - className = 'InteractiveAnimatedProp' - if 'hydrant' in interactivePropNode.getName(): - className = 'HydrantInteractiveProp' - elif 'trashcan' in interactivePropNode.getName(): - className = 'TrashcanInteractiveProp' - elif 'mailbox' in interactivePropNode.getName(): - className = 'MailboxInteractiveProp' - symbols = {} - base.cr.importModule(symbols, 'toontown.hood', [className]) - classObj = getattr(symbols[className], className) - interactivePropObj = classObj(interactivePropNode) - animPropList = self.animPropDict.get(i) - if animPropList is None: - animPropList = self.animPropDict.setdefault(i, []) - animPropList.append(interactivePropObj) - if interactivePropObj.getCellIndex() == 0: - zoneId = int(i.getName()) - if zoneId not in self.zoneIdToInteractivePropDict: - self.zoneIdToInteractivePropDict[zoneId] = interactivePropObj - else: - self.notify.error('already have interactive prop %s in zone %s' % (self.zoneIdToInteractivePropDict, zoneId)) - - animatedBuildingNodes = i.findAllMatches('**/*:animated_building_*;-h') - for np in animatedBuildingNodes: - if np.getName().startswith('sb'): - animatedBuildingNodes.removePath(np) - - numAnimatedBuildingNodes = animatedBuildingNodes.getNumPaths() - for j in xrange(numAnimatedBuildingNodes): - animatedBuildingNode = animatedBuildingNodes.getPath(j) - className = 'GenericAnimatedBuilding' - symbols = {} - base.cr.importModule(symbols, 'toontown.hood', [className]) - classObj = getattr(symbols[className], className) - animatedBuildingObj = classObj(animatedBuildingNode) - animPropList = self.animPropDict.get(i) - if animPropList is None: - animPropList = self.animPropDict.setdefault(i, []) - animPropList.append(animatedBuildingObj) - - return + + for j in xrange(interactivePropNodes.getNumPaths()): + propNode = interactivePropNodes.getPath(j) + propName = propNode.getName() + + if 'hydrant' in propName: + prop = HydrantInteractiveProp.HydrantInteractiveProp(propNode) + elif 'trashcan' in propName: + prop = TrashcanInteractiveProp.TrashcanInteractiveProp(propNode) + elif 'mailbox' in propName: + prop = MailboxInteractiveProp.MailboxInteractiveProp(propNode) + else: + continue + + if i in self.animPropDict: + self.animPropDict[i].append(prop) + else: + self.animPropDict[i] = [prop] + + self.zoneIdToInteractivePropDict[int(i.getName())] = prop def deleteAnimatedProps(self): for zoneNode, animPropList in self.animPropDict.items(): @@ -374,7 +350,6 @@ class TownLoader(StateData.StateData): animProp.exit() def getInteractiveProp(self, zoneId): - result = None if zoneId in self.zoneIdToInteractivePropDict: - result = self.zoneIdToInteractivePropDict[zoneId] - return result + return self.zoneIdToInteractivePropDict[zoneId] + return None