From 3c14c1462317e338a5a82f66afe834d6a5743b44 Mon Sep 17 00:00:00 2001 From: John Cote Date: Mon, 30 Dec 2019 01:07:56 -0500 Subject: [PATCH] toontown: initial work on python 3.x support --- toontown/ai/AIStart.py | 6 +- toontown/ai/CrashedLeaderBoardDecorator.py | 2 +- toontown/ai/DatabaseObject.py | 16 +- toontown/ai/DistributedTrickOrTreatTarget.py | 2 +- .../ai/DistributedWinterCarolingTarget.py | 2 +- toontown/ai/HalloweenHolidayDecorator.py | 2 +- toontown/ai/HolidayDecorator.py | 2 +- toontown/ai/NewsManager.py | 14 +- toontown/ai/ServerEventBuffer.py | 2 +- toontown/ai/ToontownAIMsgTypes.py | 6 +- toontown/ai/ToontownAIRepository.py | 8 +- toontown/ai/ToontownMagicWordManager.py | 16 +- toontown/battle/BattleBase.py | 2 +- toontown/battle/BattleCalculatorAI.py | 112 +++++++------- toontown/battle/BattleManagerAI.py | 8 +- toontown/battle/BattleProps.py | 8 +- toontown/battle/BattleSounds.py | 2 +- toontown/battle/DistributedBattle.py | 8 +- toontown/battle/DistributedBattleAI.py | 8 +- toontown/battle/DistributedBattleBase.py | 26 ++-- toontown/battle/DistributedBattleBaseAI.py | 66 ++++---- toontown/battle/DistributedBattleBldg.py | 8 +- toontown/battle/DistributedBattleBldgAI.py | 8 +- toontown/battle/DistributedBattleDiners.py | 2 +- toontown/battle/DistributedBattleFinal.py | 10 +- toontown/battle/DistributedBattleFinalAI.py | 8 +- toontown/battle/DistributedBattleWaiters.py | 2 +- toontown/battle/Fanfare.py | 14 +- toontown/battle/Movie.py | 48 +++--- toontown/battle/MovieCamera.py | 64 ++++---- toontown/battle/MovieDrop.py | 26 ++-- toontown/battle/MovieFire.py | 18 +-- toontown/battle/MovieHeal.py | 24 +-- toontown/battle/MovieLure.py | 20 +-- toontown/battle/MovieNPCSOS.py | 14 +- toontown/battle/MoviePetSOS.py | 14 +- toontown/battle/MovieSOS.py | 2 +- toontown/battle/MovieSound.py | 18 +-- toontown/battle/MovieSquirt.py | 20 +-- toontown/battle/MovieSuitAttacks.py | 22 +-- toontown/battle/MovieThrow.py | 20 +-- toontown/battle/MovieToonVictory.py | 8 +- toontown/battle/MovieTrap.py | 32 ++-- toontown/battle/MovieUtil.py | 8 +- toontown/battle/PlayByPlayText.py | 4 +- toontown/battle/RewardPanel.py | 8 +- toontown/battle/SuitBattleGlobals.py | 146 +++++++++--------- toontown/building/BoardingGroupShow.py | 2 +- toontown/building/BoardingPartyBase.py | 10 +- toontown/building/DistributedAnimDoor.py | 4 +- toontown/building/DistributedBBElevator.py | 6 +- toontown/building/DistributedBBElevatorAI.py | 4 +- toontown/building/DistributedBoardingParty.py | 14 +- .../building/DistributedBoardingPartyAI.py | 42 ++--- toontown/building/DistributedBossElevator.py | 8 +- .../building/DistributedBossElevatorAI.py | 4 +- toontown/building/DistributedBuilding.py | 14 +- toontown/building/DistributedBuildingAI.py | 10 +- toontown/building/DistributedBuildingMgrAI.py | 26 ++-- toontown/building/DistributedCFOElevator.py | 6 +- toontown/building/DistributedCFOElevatorAI.py | 4 +- toontown/building/DistributedCJElevator.py | 6 +- toontown/building/DistributedCJElevatorAI.py | 4 +- toontown/building/DistributedClubElevator.py | 8 +- .../building/DistributedClubElevatorAI.py | 2 +- toontown/building/DistributedDoor.py | 22 +-- toontown/building/DistributedDoorAI.py | 6 +- toontown/building/DistributedElevator.py | 24 +-- toontown/building/DistributedElevatorAI.py | 4 +- toontown/building/DistributedElevatorExt.py | 6 +- toontown/building/DistributedElevatorExtAI.py | 4 +- toontown/building/DistributedElevatorFSM.py | 26 ++-- toontown/building/DistributedElevatorFSMAI.py | 8 +- toontown/building/DistributedElevatorFloor.py | 8 +- .../building/DistributedElevatorFloorAI.py | 6 +- toontown/building/DistributedElevatorInt.py | 6 +- toontown/building/DistributedElevatorIntAI.py | 2 +- .../building/DistributedGagshopInterior.py | 2 +- toontown/building/DistributedHQInterior.py | 6 +- toontown/building/DistributedHQInteriorAI.py | 6 +- .../building/DistributedKnockKnockDoor.py | 8 +- .../building/DistributedKnockKnockDoorAI.py | 2 +- .../building/DistributedPetshopInterior.py | 2 +- toontown/building/DistributedSuitInterior.py | 14 +- .../building/DistributedSuitInteriorAI.py | 6 +- .../building/DistributedToonHallInterior.py | 6 +- .../building/DistributedToonHallInteriorAI.py | 2 +- toontown/building/DistributedToonInterior.py | 10 +- .../building/DistributedToonInteriorAI.py | 4 +- .../building/DistributedTutorialInterior.py | 6 +- toontown/building/DistributedVPElevator.py | 6 +- toontown/building/DistributedVPElevatorAI.py | 4 +- toontown/building/ElevatorUtils.py | 2 +- toontown/building/GagshopBuildingAI.py | 2 +- toontown/building/HQBuildingAI.py | 2 +- toontown/building/PetshopBuildingAI.py | 2 +- toontown/building/SuitBuildingGlobals.py | 2 +- toontown/building/SuitInterior.py | 2 +- toontown/building/SuitPlannerInteriorAI.py | 2 +- toontown/building/ToonInterior.py | 6 +- toontown/catalog/CatalogAccessoryItem.py | 6 +- .../catalog/CatalogAnimatedFurnitureItem.py | 2 +- toontown/catalog/CatalogAtticItem.py | 2 +- toontown/catalog/CatalogBeanItem.py | 2 +- toontown/catalog/CatalogChatItem.py | 12 +- toontown/catalog/CatalogChatItemPicker.py | 2 +- toontown/catalog/CatalogClothingItem.py | 2 +- toontown/catalog/CatalogEmoteItem.py | 2 +- toontown/catalog/CatalogFlooringItem.py | 6 +- toontown/catalog/CatalogFurnitureItem.py | 14 +- toontown/catalog/CatalogGardenItem.py | 6 +- toontown/catalog/CatalogGardenStarterItem.py | 10 +- toontown/catalog/CatalogGenerator.py | 56 +++---- toontown/catalog/CatalogInvalidItem.py | 2 +- toontown/catalog/CatalogItem.py | 20 +-- toontown/catalog/CatalogItemList.py | 6 +- toontown/catalog/CatalogItemPanel.py | 16 +- toontown/catalog/CatalogItemTypes.py | 40 ++--- toontown/catalog/CatalogMouldingItem.py | 6 +- toontown/catalog/CatalogNametagItem.py | 2 +- toontown/catalog/CatalogPetTrickItem.py | 4 +- toontown/catalog/CatalogPoleItem.py | 2 +- toontown/catalog/CatalogRentalItem.py | 2 +- toontown/catalog/CatalogScreen.py | 14 +- toontown/catalog/CatalogSurfaceItem.py | 6 +- toontown/catalog/CatalogToonStatueItem.py | 2 +- toontown/catalog/CatalogWainscotingItem.py | 6 +- toontown/catalog/CatalogWallpaperItem.py | 6 +- toontown/catalog/CatalogWindowItem.py | 4 +- toontown/catalog/MailboxScreen.py | 14 +- toontown/char/Char.py | 4 +- toontown/char/DistributedChar.py | 2 +- toontown/chat/ResistanceChat.py | 8 +- toontown/chat/TTChatInputNormal.py | 2 +- toontown/chat/TTChatInputWhiteList.py | 4 +- toontown/chat/TTSCWhiteListTerminal.py | 2 +- toontown/chat/ToonChatGarbler.py | 4 +- toontown/chat/ToontownChatManager.py | 8 +- toontown/classicchars/CharStateDatas.py | 2 +- toontown/classicchars/CharStateDatasAI.py | 2 +- toontown/classicchars/DistributedCCharBase.py | 6 +- .../classicchars/DistributedCCharBaseAI.py | 6 +- toontown/classicchars/DistributedChip.py | 4 +- toontown/classicchars/DistributedChipAI.py | 4 +- toontown/classicchars/DistributedDaisy.py | 4 +- toontown/classicchars/DistributedDaisyAI.py | 4 +- toontown/classicchars/DistributedDale.py | 4 +- toontown/classicchars/DistributedDaleAI.py | 4 +- toontown/classicchars/DistributedDonald.py | 6 +- toontown/classicchars/DistributedDonaldAI.py | 4 +- .../classicchars/DistributedDonaldDock.py | 4 +- .../classicchars/DistributedDonaldDockAI.py | 2 +- .../classicchars/DistributedFrankenDonald.py | 8 +- toontown/classicchars/DistributedGoofy.py | 4 +- toontown/classicchars/DistributedGoofyAI.py | 4 +- .../classicchars/DistributedGoofySpeedway.py | 4 +- .../DistributedGoofySpeedwayAI.py | 4 +- .../classicchars/DistributedJailbirdDale.py | 6 +- toontown/classicchars/DistributedMickey.py | 4 +- toontown/classicchars/DistributedMickeyAI.py | 4 +- toontown/classicchars/DistributedMinnie.py | 4 +- toontown/classicchars/DistributedMinnieAI.py | 4 +- toontown/classicchars/DistributedPluto.py | 4 +- toontown/classicchars/DistributedPlutoAI.py | 2 +- .../classicchars/DistributedPoliceChip.py | 6 +- .../classicchars/DistributedSockHopDaisy.py | 6 +- .../classicchars/DistributedSuperGoofy.py | 6 +- .../classicchars/DistributedVampireMickey.py | 6 +- .../classicchars/DistributedWesternPluto.py | 6 +- .../classicchars/DistributedWitchMinnie.py | 6 +- .../coderedemption/TTCodeRedemptionMgr.py | 4 +- toontown/cogdominium/CogdoBarrelRoomAI.py | 2 +- toontown/cogdominium/CogdoBarrelRoomConsts.py | 2 +- .../cogdominium/CogdoBarrelRoomRewardPanel.py | 2 +- toontown/cogdominium/CogdoCraneGameConsts.py | 2 +- toontown/cogdominium/CogdoElevatorMovie.py | 4 +- .../cogdominium/CogdoExecutiveSuiteMovies.py | 4 +- .../cogdominium/CogdoFlyingCameraManager.py | 10 +- toontown/cogdominium/CogdoFlyingGame.py | 20 +-- .../cogdominium/CogdoFlyingGameGlobals.py | 2 +- toontown/cogdominium/CogdoFlyingGameGuis.py | 6 +- toontown/cogdominium/CogdoFlyingGameMovies.py | 6 +- toontown/cogdominium/CogdoFlyingGuiManager.py | 8 +- toontown/cogdominium/CogdoFlyingLegalEagle.py | 6 +- toontown/cogdominium/CogdoFlyingLevel.py | 14 +- .../cogdominium/CogdoFlyingLevelQuadrant.py | 10 +- .../cogdominium/CogdoFlyingLocalPlayer.py | 16 +- toontown/cogdominium/CogdoFlyingObjects.py | 10 +- toontown/cogdominium/CogdoFlyingObstacles.py | 6 +- toontown/cogdominium/CogdoFlyingPlayer.py | 8 +- toontown/cogdominium/CogdoFlyingUtil.py | 2 +- toontown/cogdominium/CogdoGameAudioManager.py | 2 +- toontown/cogdominium/CogdoGameExit.py | 4 +- toontown/cogdominium/CogdoGameGatherable.py | 2 +- .../cogdominium/CogdoGameMessageDisplay.py | 2 +- toontown/cogdominium/CogdoLevelGameBase.py | 4 +- toontown/cogdominium/CogdoMaze.py | 12 +- .../cogdominium/CogdoMazeCameraManager.py | 2 +- toontown/cogdominium/CogdoMazeGame.py | 36 ++--- toontown/cogdominium/CogdoMazeGameGuis.py | 6 +- toontown/cogdominium/CogdoMazeGameMovies.py | 6 +- toontown/cogdominium/CogdoMazeGameObjects.py | 6 +- toontown/cogdominium/CogdoMazeGuiManager.py | 8 +- toontown/cogdominium/CogdoMazeLocalPlayer.py | 8 +- toontown/cogdominium/CogdoMazePlayer.py | 6 +- toontown/cogdominium/CogdoMazeSuits.py | 6 +- toontown/cogdominium/CogdoMemoGui.py | 4 +- toontown/cogdominium/DistCogdoCraneGame.py | 8 +- toontown/cogdominium/DistCogdoCraneGameAI.py | 12 +- toontown/cogdominium/DistCogdoCraneObject.py | 8 +- toontown/cogdominium/DistCogdoFlyingGame.py | 8 +- toontown/cogdominium/DistCogdoFlyingGameAI.py | 4 +- toontown/cogdominium/DistCogdoGame.py | 2 +- toontown/cogdominium/DistCogdoGameAI.py | 2 +- toontown/cogdominium/DistCogdoMazeGame.py | 10 +- toontown/cogdominium/DistCogdoMazeGameAI.py | 10 +- toontown/cogdominium/DistCogdoMazeGameBase.py | 2 +- .../cogdominium/DistributedCogdoInterior.py | 14 +- .../cogdominium/DistributedCogdoInteriorAI.py | 18 +-- toontown/coghq/BossbotCogHQLoader.py | 2 +- ...botCountryClubFairwayRoom_Battle00_Cogs.py | 2 +- ...ossbotCountryClubKartRoom_Battle00_Cogs.py | 2 +- ...ossbotCountryClubMazeRoom_Battle00_Cogs.py | 2 +- ...ossbotCountryClubMazeRoom_Battle01_Cogs.py | 2 +- ...ossbotCountryClubMazeRoom_Battle02_Cogs.py | 2 +- ...ossbotCountryClubMazeRoom_Battle03_Cogs.py | 2 +- ...tCountryClubPresidentRoom_Battle00_Cogs.py | 2 +- toontown/coghq/BossbotOfficeExterior.py | 2 +- toontown/coghq/CashbotCogHQLoader.py | 6 +- .../CashbotMintBoilerRoom_Battle00_Cogs.py | 2 +- .../CashbotMintBoilerRoom_Battle01_Cogs.py | 2 +- .../CashbotMintControlRoom_Battle00_Cogs.py | 2 +- .../CashbotMintDuctRoom_Battle00_Cogs.py | 2 +- .../CashbotMintDuctRoom_Battle01_Cogs.py | 2 +- .../CashbotMintGearRoom_Battle00_Cogs.py | 2 +- .../CashbotMintGearRoom_Battle01_Cogs.py | 2 +- .../CashbotMintLavaRoomFoyer_Battle00_Cogs.py | 2 +- .../CashbotMintLavaRoomFoyer_Battle01_Cogs.py | 2 +- .../coghq/CashbotMintLobby_Battle00_Cogs.py | 2 +- .../coghq/CashbotMintLobby_Battle01_Cogs.py | 2 +- .../coghq/CashbotMintOilRoom_Battle00_Cogs.py | 2 +- ...shbotMintPaintMixerReward_Battle00_Cogs.py | 2 +- .../CashbotMintPipeRoom_Battle00_Cogs.py | 2 +- .../CashbotMintPipeRoom_Battle01_Cogs.py | 2 +- toontown/coghq/CogDisguiseGlobals.py | 2 +- toontown/coghq/CogHQExterior.py | 2 +- toontown/coghq/CogHQLoader.py | 2 +- toontown/coghq/CogSuitManagerAI.py | 2 +- toontown/coghq/ConveyorBelt.py | 6 +- toontown/coghq/CountryClubLayout.py | 38 ++--- toontown/coghq/CountryClubManagerAI.py | 4 +- toontown/coghq/CountryClubRoomBase.py | 2 +- toontown/coghq/CountryClubRoomSpecs.py | 8 +- toontown/coghq/CrusherCell.py | 2 +- toontown/coghq/CrusherCellAI.py | 2 +- toontown/coghq/DinerStatusIndicator.py | 2 +- toontown/coghq/DirectionalCell.py | 2 +- toontown/coghq/DirectionalCellAI.py | 2 +- toontown/coghq/DistributedBanquetTable.py | 34 ++-- toontown/coghq/DistributedBanquetTableAI.py | 10 +- toontown/coghq/DistributedBattleFactoryAI.py | 2 +- toontown/coghq/DistributedBeanBarrel.py | 2 +- toontown/coghq/DistributedBeanBarrelAI.py | 2 +- toontown/coghq/DistributedButton.py | 4 +- toontown/coghq/DistributedButtonAI.py | 2 +- .../coghq/DistributedCashbotBossObject.py | 8 +- toontown/coghq/DistributedCashbotBossSafe.py | 2 +- .../coghq/DistributedCashbotBossSafeAI.py | 2 +- toontown/coghq/DistributedCogHQDoorAI.py | 6 +- toontown/coghq/DistributedCogKart.py | 6 +- toontown/coghq/DistributedCountryClub.py | 2 +- toontown/coghq/DistributedCountryClubAI.py | 2 +- .../coghq/DistributedCountryClubBattleAI.py | 2 +- toontown/coghq/DistributedCountryClubRoom.py | 8 +- toontown/coghq/DistributedCrate.py | 6 +- toontown/coghq/DistributedCrateAI.py | 6 +- toontown/coghq/DistributedDoorEntity.py | 16 +- toontown/coghq/DistributedDoorEntityAI.py | 2 +- toontown/coghq/DistributedElevatorMarker.py | 2 +- toontown/coghq/DistributedFactory.py | 8 +- toontown/coghq/DistributedFactoryAI.py | 6 +- toontown/coghq/DistributedFoodBelt.py | 20 +-- toontown/coghq/DistributedGagBarrel.py | 2 +- toontown/coghq/DistributedGagBarrelAI.py | 2 +- toontown/coghq/DistributedGolfGreenGame.py | 32 ++-- toontown/coghq/DistributedGolfGreenGameAI.py | 12 +- toontown/coghq/DistributedGolfSpot.py | 14 +- toontown/coghq/DistributedGrid.py | 4 +- toontown/coghq/DistributedGridAI.py | 6 +- toontown/coghq/DistributedHealBarrel.py | 2 +- toontown/coghq/DistributedHealBarrelAI.py | 2 +- toontown/coghq/DistributedInGameEditor.py | 54 +++---- toontown/coghq/DistributedInGameEditorAI.py | 4 +- toontown/coghq/DistributedLaserField.py | 4 +- toontown/coghq/DistributedLaserFieldAI.py | 6 +- toontown/coghq/DistributedLawOffice.py | 6 +- toontown/coghq/DistributedLawOfficeAI.py | 10 +- .../DistributedLawOfficeElevatorIntAI.py | 4 +- toontown/coghq/DistributedLawOfficeFloor.py | 8 +- toontown/coghq/DistributedLawOfficeFloorAI.py | 6 +- toontown/coghq/DistributedLawbotCannon.py | 6 +- toontown/coghq/DistributedLevelBattle.py | 4 +- toontown/coghq/DistributedLevelBattleAI.py | 2 +- toontown/coghq/DistributedLift.py | 6 +- toontown/coghq/DistributedLiftAI.py | 2 +- toontown/coghq/DistributedMaze.py | 4 +- toontown/coghq/DistributedMazeAI.py | 2 +- toontown/coghq/DistributedMint.py | 2 +- toontown/coghq/DistributedMintBattleAI.py | 2 +- toontown/coghq/DistributedMintElevatorExt.py | 2 +- .../coghq/DistributedMintElevatorExtAI.py | 2 +- toontown/coghq/DistributedMintRoom.py | 8 +- toontown/coghq/DistributedMoleField.py | 10 +- toontown/coghq/DistributedMoleFieldAI.py | 2 +- toontown/coghq/DistributedMover.py | 2 +- toontown/coghq/DistributedSecurityCamera.py | 2 +- toontown/coghq/DistributedSellbotHQDoor.py | 2 +- toontown/coghq/DistributedSellbotHQDoorAI.py | 2 +- toontown/coghq/DistributedSinkingPlatform.py | 4 +- .../coghq/DistributedSinkingPlatformAI.py | 2 +- toontown/coghq/DistributedStage.py | 6 +- toontown/coghq/DistributedStageBattleAI.py | 2 +- toontown/coghq/DistributedStageRoom.py | 8 +- toontown/coghq/DistributedStomper.py | 6 +- toontown/coghq/DistributedStomperAI.py | 2 +- toontown/coghq/DistributedStomperPair.py | 4 +- toontown/coghq/DistributedStomperPairAI.py | 2 +- toontown/coghq/DistributedSwitch.py | 4 +- toontown/coghq/DistributedSwitchAI.py | 2 +- toontown/coghq/DistributedTrigger.py | 4 +- toontown/coghq/DistributedTriggerAI.py | 2 +- toontown/coghq/FactoryBase.py | 4 +- toontown/coghq/FactoryEntityCreator.py | 22 +-- toontown/coghq/FactoryEntityCreatorAI.py | 4 +- toontown/coghq/FactoryLevelMgr.py | 2 +- toontown/coghq/FactoryManagerAI.py | 2 +- toontown/coghq/FactoryMockupCogs.py | 2 +- toontown/coghq/FactoryMockupSpec.py | 2 +- toontown/coghq/FactorySpecs.py | 12 +- toontown/coghq/FactoryUtil.py | 2 +- toontown/coghq/GearEntity.py | 2 +- toontown/coghq/InGameEditor.py | 48 +++--- toontown/coghq/InGameEditorDCImports.py | 2 +- toontown/coghq/InGameEditorDCImportsAI.py | 2 +- toontown/coghq/LawOfficeBase.py | 4 +- toontown/coghq/LawOfficeLayout.py | 4 +- toontown/coghq/LawOfficeManagerAI.py | 4 +- toontown/coghq/LawbotCogHQLoader.py | 10 +- toontown/coghq/LawbotLegFactoryCogs.py | 2 +- .../LawbotOfficeBoilerRoom_Battle00_Cogs.py | 2 +- .../LawbotOfficeBoilerRoom_Trap00_Cogs.py | 2 +- .../LawbotOfficeDiamondRoom_Battle00_Cogs.py | 2 +- .../LawbotOfficeDiamondRoom_Trap00_Cogs.py | 2 +- toontown/coghq/LawbotOfficeExterior.py | 2 +- .../LawbotOfficeGearRoom_Battle00_Cogs.py | 2 +- .../coghq/LawbotOfficeLobby_Trap00_Cogs.py | 2 +- .../LawbotOfficeOilRoom_Battle00_Cogs.py | 2 +- .../LawbotOfficeOilRoom_Battle01_Cogs.py | 2 +- toontown/coghq/LevelBattleManagerAI.py | 4 +- toontown/coghq/LevelSuitPlannerAI.py | 4 +- toontown/coghq/MintLayout.py | 36 ++--- toontown/coghq/MintManagerAI.py | 4 +- toontown/coghq/MintRoomBase.py | 2 +- toontown/coghq/MintRoomSpecs.py | 8 +- toontown/coghq/MoleFieldBase.py | 2 +- toontown/coghq/MovingPlatform.py | 2 +- toontown/coghq/NullCogs.py | 2 +- toontown/coghq/PaintMixer.py | 2 +- toontown/coghq/PlatformEntity.py | 2 +- toontown/coghq/PromotionManagerAI.py | 3 +- toontown/coghq/SellbotCogHQLoader.py | 10 +- toontown/coghq/SellbotLegFactoryCogs.py | 2 +- toontown/coghq/StageLayout.py | 44 +++--- toontown/coghq/StageManagerAI.py | 4 +- toontown/coghq/StageRoomBase.py | 2 +- toontown/coghq/StageRoomSpecs.py | 14 +- toontown/distributed/DelayDeletable.py | 4 +- toontown/distributed/DistributedTimer.py | 2 +- toontown/distributed/HoodMgr.py | 2 +- .../NonRepeatableRandomSourceAI.py | 6 +- .../NonRepeatableRandomSourceUD.py | 4 +- toontown/distributed/PlayGame.py | 2 +- .../distributed/ToontownClientRepository.py | 66 ++++---- toontown/distributed/ToontownDistrictStats.py | 4 +- toontown/effects/BlastEffect.py | 2 +- toontown/effects/ChrysanthemumEffect.py | 2 +- toontown/effects/DistributedFireworkShowAI.py | 4 +- toontown/effects/EffectController.py | 4 +- toontown/effects/FireworkShow.py | 2 +- toontown/effects/FireworkShowMixin.py | 6 +- toontown/effects/FireworkShows.py | 2 +- toontown/effects/FireworkSparkles.py | 4 +- toontown/effects/Fireworks.py | 2 +- toontown/effects/FlashEffect.py | 2 +- toontown/effects/Glow.py | 4 +- toontown/effects/GlowTrail.py | 4 +- toontown/effects/IceCream.py | 4 +- toontown/effects/NoiseSparkles.py | 4 +- toontown/effects/PeonyEffect.py | 4 +- toontown/effects/RayBurst.py | 2 +- toontown/effects/RingEffect.py | 4 +- toontown/effects/ScavengerHuntEffects.py | 2 +- toontown/effects/SimpleSparkles.py | 4 +- toontown/effects/SkullBurst.py | 4 +- toontown/effects/SkullFlash.py | 4 +- toontown/effects/SparksTrail.py | 4 +- toontown/effects/SparksTrailLong.py | 4 +- toontown/effects/Splash.py | 2 +- toontown/effects/StarBurst.py | 4 +- toontown/effects/TrailExplosion.py | 4 +- toontown/estate/ClosetGUI.py | 2 +- toontown/estate/DistributedBank.py | 6 +- toontown/estate/DistributedCannon.py | 22 +-- toontown/estate/DistributedCannonAI.py | 2 +- .../estate/DistributedChangingStatuary.py | 2 +- toontown/estate/DistributedCloset.py | 24 +-- toontown/estate/DistributedEstate.py | 20 +-- toontown/estate/DistributedFireworksCannon.py | 6 +- toontown/estate/DistributedFurnitureItem.py | 4 +- .../estate/DistributedFurnitureManager.py | 2 +- toontown/estate/DistributedGagTree.py | 4 +- toontown/estate/DistributedGarden.py | 10 +- toontown/estate/DistributedGardenBox.py | 4 +- toontown/estate/DistributedGardenPlot.py | 6 +- toontown/estate/DistributedHouse.py | 2 +- toontown/estate/DistributedHouseDoor.py | 2 +- toontown/estate/DistributedHouseInterior.py | 2 +- toontown/estate/DistributedLawnDecor.py | 2 +- toontown/estate/DistributedMailbox.py | 4 +- toontown/estate/DistributedPhone.py | 8 +- toontown/estate/DistributedPlantBase.py | 6 +- toontown/estate/DistributedStatuary.py | 8 +- toontown/estate/DistributedToonStatuary.py | 2 +- toontown/estate/DistributedTrunk.py | 24 +-- toontown/estate/Estate.py | 2 +- toontown/estate/EstateLoader.py | 22 +-- toontown/estate/EstateManager.py | 4 +- toontown/estate/FireworkItemPanel.py | 2 +- toontown/estate/FireworksGui.py | 4 +- toontown/estate/FlowerBase.py | 6 +- toontown/estate/FlowerBasket.py | 4 +- toontown/estate/FlowerBrowser.py | 6 +- toontown/estate/FlowerCollection.py | 4 +- toontown/estate/FlowerPanel.py | 8 +- toontown/estate/FlowerPhoto.py | 14 +- toontown/estate/FlowerPicker.py | 2 +- toontown/estate/FlowerSellGUI.py | 4 +- toontown/estate/FlowerSpeciesPanel.py | 4 +- toontown/estate/GardenDropGame.py | 16 +- toontown/estate/GardenGlobals.py | 40 ++--- toontown/estate/GardenProgressMeter.py | 6 +- toontown/estate/SpecialsPhoto.py | 12 +- toontown/estate/ToonStatueSelectionGUI.py | 2 +- toontown/estate/TrunkGUI.py | 2 +- toontown/estate/houseDesign.py | 16 +- toontown/fishing/BingoCardBase.py | 12 +- toontown/fishing/BingoCardGui.py | 14 +- toontown/fishing/BingoGlobals.py | 6 +- toontown/fishing/BlockoutBingo.py | 2 +- toontown/fishing/DistributedFishingPond.py | 10 +- toontown/fishing/DistributedFishingTarget.py | 2 +- toontown/fishing/FishBase.py | 2 +- toontown/fishing/FishBrowser.py | 6 +- toontown/fishing/FishCollection.py | 4 +- toontown/fishing/FishGlobals.py | 48 +++--- toontown/fishing/FishPanel.py | 8 +- toontown/fishing/FishPhoto.py | 12 +- toontown/fishing/FishPicker.py | 2 +- toontown/fishing/FishSellGUI.py | 4 +- toontown/fishing/FishTank.py | 4 +- toontown/fishing/GenusPanel.py | 6 +- toontown/fishing/NormalBingo.py | 2 +- toontown/friends/FriendInvitee.py | 4 +- toontown/friends/FriendInviter.py | 6 +- toontown/friends/FriendNotifier.py | 2 +- toontown/friends/FriendsListManager.py | 12 +- toontown/friends/FriendsListPanel.py | 24 +-- toontown/golf/DistributedGolfCourse.py | 4 +- toontown/golf/DistributedGolfCourseAI.py | 34 ++-- toontown/golf/DistributedGolfHole.py | 12 +- toontown/golf/DistributedGolfHoleAI.py | 6 +- toontown/golf/DistributedPhysicsWorld.py | 2 +- toontown/golf/DistributedPhysicsWorldAI.py | 14 +- toontown/golf/GolfGlobals.py | 6 +- toontown/golf/GolfHoleBase.py | 16 +- toontown/golf/GolfRewardDialog.py | 2 +- toontown/golf/PhysicsWorldBase.py | 16 +- toontown/hood/BRHood.py | 2 +- toontown/hood/BRHoodDataAI.py | 2 +- toontown/hood/BossbotHQ.py | 2 +- toontown/hood/BossbotHQDataAI.py | 4 +- toontown/hood/CSHoodDataAI.py | 2 +- toontown/hood/CashbotHQ.py | 2 +- toontown/hood/CashbotHQDataAI.py | 2 +- toontown/hood/CogHood.py | 2 +- toontown/hood/DDHood.py | 2 +- toontown/hood/DDHoodDataAI.py | 2 +- toontown/hood/DGHood.py | 4 +- toontown/hood/DGHoodDataAI.py | 2 +- toontown/hood/DLHood.py | 2 +- toontown/hood/DLHoodDataAI.py | 2 +- toontown/hood/EstateHood.py | 6 +- toontown/hood/FishAnimatedProp.py | 2 +- toontown/hood/GSHood.py | 4 +- toontown/hood/GSHoodDataAI.py | 2 +- toontown/hood/GZHood.py | 4 +- toontown/hood/GZHoodDataAI.py | 4 +- toontown/hood/GenericAnimatedProp.py | 4 +- toontown/hood/HQPeriscopeAnimatedProp.py | 2 +- toontown/hood/HQTelescopeAnimatedProp.py | 2 +- toontown/hood/Hood.py | 6 +- toontown/hood/HoodDataAI.py | 4 +- toontown/hood/InteractiveAnimatedProp.py | 20 +-- toontown/hood/LawbotHQ.py | 2 +- toontown/hood/LawbotHQDataAI.py | 2 +- toontown/hood/MMHood.py | 2 +- toontown/hood/MMHoodDataAI.py | 2 +- toontown/hood/OZHood.py | 4 +- toontown/hood/OZHoodDataAI.py | 2 +- toontown/hood/PetShopFishAnimatedProp.py | 2 +- toontown/hood/Place.py | 12 +- toontown/hood/QuietZoneState.py | 6 +- toontown/hood/SellbotHQ.py | 2 +- toontown/hood/SleepingHydrantAnimatedProp.py | 2 +- toontown/hood/TTHood.py | 4 +- toontown/hood/TTHoodDataAI.py | 2 +- toontown/hood/ToonHood.py | 2 +- toontown/hood/TrialerForceAcknowledge.py | 2 +- toontown/hood/TutorialHood.py | 4 +- toontown/hood/ZeroAnimatedProp.py | 10 +- toontown/launcher/QuickLauncher.py | 16 +- toontown/launcher/ToontownDummyLauncher.py | 4 +- toontown/launcher/ToontownLauncher.py | 18 +-- toontown/login/AccountServerDate.py | 10 +- toontown/login/AvatarChooser.py | 2 +- toontown/login/TTDateObject.py | 2 +- toontown/makeatoon/BodyShop.py | 4 +- toontown/makeatoon/ClothesGUI.py | 4 +- toontown/makeatoon/ColorShop.py | 6 +- toontown/makeatoon/GenderShop.py | 2 +- toontown/makeatoon/MakeAToon.py | 12 +- toontown/makeatoon/MakeClothesGUI.py | 2 +- toontown/makeatoon/NameGenerator.py | 32 ++-- toontown/makeatoon/NameShop.py | 26 ++-- toontown/makeatoon/ShuffleButton.py | 2 +- toontown/minigame/CatchGameGlobals.py | 2 +- toontown/minigame/CatchGameToonSD.py | 2 +- toontown/minigame/ClerkPurchase.py | 2 +- toontown/minigame/CogThief.py | 4 +- toontown/minigame/DistributedCannonGame.py | 18 +-- toontown/minigame/DistributedCannonGameAI.py | 4 +- toontown/minigame/DistributedCatchGame.py | 49 +++--- toontown/minigame/DistributedCatchGameAI.py | 6 +- toontown/minigame/DistributedCogThiefGame.py | 22 +-- .../minigame/DistributedCogThiefGameAI.py | 12 +- toontown/minigame/DistributedDivingGame.py | 34 ++-- toontown/minigame/DistributedDivingGameAI.py | 16 +- toontown/minigame/DistributedIceGame.py | 38 ++--- toontown/minigame/DistributedIceGameAI.py | 18 +-- toontown/minigame/DistributedMazeGame.py | 56 +++---- toontown/minigame/DistributedMazeGameAI.py | 16 +- toontown/minigame/DistributedMinigame.py | 24 +-- toontown/minigame/DistributedMinigameAI.py | 16 +- .../minigame/DistributedMinigameTemplate.py | 2 +- .../minigame/DistributedMinigameTemplateAI.py | 2 +- toontown/minigame/DistributedPairingGame.py | 20 +-- toontown/minigame/DistributedPairingGameAI.py | 12 +- toontown/minigame/DistributedPatternGame.py | 10 +- toontown/minigame/DistributedPatternGameAI.py | 4 +- toontown/minigame/DistributedPhotoGame.py | 12 +- toontown/minigame/DistributedPhotoGameAI.py | 4 +- toontown/minigame/DistributedRaceGame.py | 10 +- toontown/minigame/DistributedRaceGameAI.py | 14 +- toontown/minigame/DistributedRingGame.py | 29 ++-- toontown/minigame/DistributedRingGameAI.py | 6 +- toontown/minigame/DistributedTagGame.py | 8 +- toontown/minigame/DistributedTagGameAI.py | 6 +- toontown/minigame/DistributedTargetGame.py | 14 +- toontown/minigame/DistributedTargetGameAI.py | 12 +- toontown/minigame/DistributedTravelGame.py | 48 +++--- toontown/minigame/DistributedTravelGameAI.py | 20 +-- toontown/minigame/DistributedTugOfWarGame.py | 16 +- .../minigame/DistributedTugOfWarGameAI.py | 10 +- toontown/minigame/DistributedTwoDGame.py | 20 +-- toontown/minigame/DistributedTwoDGameAI.py | 46 +++--- toontown/minigame/DistributedVineGame.py | 42 ++--- toontown/minigame/DistributedVineGameAI.py | 14 +- toontown/minigame/DivingFishSpawn.py | 4 +- toontown/minigame/DivingGameToonSD.py | 2 +- toontown/minigame/DivingTreasure.py | 2 +- toontown/minigame/DropPlacer.py | 12 +- toontown/minigame/Maze.py | 4 +- toontown/minigame/MazeMapGui.py | 4 +- toontown/minigame/MazeSuit.py | 16 +- toontown/minigame/MinigameAvatarScorePanel.py | 2 +- toontown/minigame/MinigameCreatorAI.py | 46 +++--- toontown/minigame/MinigameRulesPanel.py | 2 +- toontown/minigame/OrthoDrive.py | 2 +- toontown/minigame/OrthoWalk.py | 2 +- toontown/minigame/PairingGameCard.py | 4 +- toontown/minigame/PairingGameGlobals.py | 2 +- toontown/minigame/PatternGameGlobals.py | 2 +- toontown/minigame/PhotoGameBase.py | 4 +- toontown/minigame/PlayingCard.py | 2 +- toontown/minigame/PlayingCardDeck.py | 6 +- toontown/minigame/Purchase.py | 12 +- toontown/minigame/Ring.py | 2 +- toontown/minigame/RingAction.py | 2 +- toontown/minigame/RingGroup.py | 8 +- toontown/minigame/RingTrack.py | 2 +- toontown/minigame/RingTrackGroups.py | 12 +- toontown/minigame/RingTracks.py | 4 +- toontown/minigame/SwingVine.py | 38 ++--- toontown/minigame/TagTreasurePlannerAI.py | 2 +- toontown/minigame/TempMinigameAI.py | 2 +- toontown/minigame/ToonBlitzAssetMgr.py | 4 +- toontown/minigame/TwoDDrive.py | 2 +- toontown/minigame/TwoDEnemyMgr.py | 2 +- toontown/minigame/TwoDGameToonSD.py | 2 +- toontown/minigame/TwoDSectionMgr.py | 2 +- toontown/minigame/TwoDStomper.py | 2 +- toontown/minigame/TwoDStomperMgr.py | 2 +- toontown/minigame/TwoDTreasureMgr.py | 4 +- toontown/minigame/TwoDWalk.py | 2 +- toontown/minigame/VineBat.py | 2 +- toontown/minigame/VineHeadFrame.py | 2 +- toontown/minigame/VineSpider.py | 6 +- toontown/minigame/VoteResultsTrolleyPanel.py | 4 +- toontown/parties/CalendarGuiMonth.py | 12 +- toontown/parties/Decoration.py | 2 +- toontown/parties/DistributedParty.py | 4 +- toontown/parties/DistributedPartyActivity.py | 4 +- toontown/parties/DistributedPartyCannon.py | 6 +- .../parties/DistributedPartyCannonActivity.py | 8 +- .../parties/DistributedPartyCatchActivity.py | 54 +++---- .../DistributedPartyCatchActivityBase.py | 5 +- .../parties/DistributedPartyCogActivity.py | 6 +- .../DistributedPartyDance20Activity.py | 2 +- .../parties/DistributedPartyDanceActivity.py | 2 +- .../DistributedPartyDanceActivityBase.py | 14 +- .../DistributedPartyFireworksActivity.py | 22 +-- .../DistributedPartyTrampolineActivity.py | 2 +- .../DistributedPartyTugOfWarActivity.py | 18 +-- ...istributedPartyValentineDance20Activity.py | 2 +- .../DistributedPartyValentineDanceActivity.py | 2 +- .../DistributedPartyWinterCatchActivity.py | 6 +- toontown/parties/JukeboxGui.py | 6 +- toontown/parties/KeyCodes.py | 2 +- toontown/parties/Party.py | 4 +- toontown/parties/PartyCog.py | 2 +- toontown/parties/PartyCogActivity.py | 30 ++-- toontown/parties/PartyCogActivityGui.py | 2 +- toontown/parties/PartyCogActivityPlayer.py | 10 +- toontown/parties/PartyCogUtils.py | 2 +- toontown/parties/PartyGlobals.py | 6 +- toontown/parties/PartyLoader.py | 16 +- toontown/parties/PartyPlanner.py | 2 +- .../parties/WinterPartyCatchActivityToonSD.py | 2 +- toontown/parties/activityFSMMixins.py | 2 +- toontown/parties/activityFSMs.py | 20 +-- toontown/pets/DistributedPet.py | 12 +- toontown/pets/DistributedPetAI.py | 24 +-- toontown/pets/DistributedPetProxy.py | 6 +- toontown/pets/DistributedPetProxyAI.py | 12 +- toontown/pets/Pet.py | 24 +-- toontown/pets/PetBrain.py | 6 +- toontown/pets/PetCollider.py | 2 +- toontown/pets/PetDCImports.py | 2 +- toontown/pets/PetDCImportsAI.py | 2 +- toontown/pets/PetDNA.py | 18 +-- toontown/pets/PetDetailPanel.py | 2 +- toontown/pets/PetGoalMgr.py | 2 +- toontown/pets/PetLookerAI.py | 8 +- toontown/pets/PetNameGenerator.py | 4 +- toontown/pets/PetObserve.py | 2 +- toontown/pets/PetTraits.py | 8 +- toontown/pets/PetTricks.py | 4 +- toontown/quest/QuestBookPoster.py | 2 +- toontown/quest/QuestChoiceGui.py | 4 +- toontown/quest/QuestMap.py | 4 +- toontown/quest/QuestParser.py | 18 +-- toontown/quest/QuestPoster.py | 26 ++-- toontown/quest/QuestRewardCounter.py | 2 +- toontown/quest/Quests.py | 66 ++++---- toontown/racing/DistributedGag.py | 2 +- toontown/racing/DistributedLeaderBoard.py | 4 +- toontown/racing/DistributedLeaderBoardAI.py | 4 +- toontown/racing/DistributedRace.py | 22 +-- toontown/racing/DistributedRaceAI.py | 10 +- toontown/racing/DistributedVehicle.py | 4 +- toontown/racing/Kart.py | 16 +- toontown/racing/KartDNA.py | 20 +-- toontown/racing/KartShopGui.py | 8 +- toontown/racing/Piejectile.py | 4 +- toontown/racing/RaceEndPanels.py | 6 +- toontown/racing/RaceGUI.py | 12 +- toontown/racing/RaceGag.py | 2 +- toontown/racing/RaceGlobals.py | 6 +- toontown/racing/RaceHeadFrame.py | 2 +- toontown/racing/RaceManagerAI.py | 16 +- toontown/safezone/BRPlayground.py | 2 +- toontown/safezone/BRSafeZoneLoader.py | 4 +- toontown/safezone/BRTreasurePlannerAI.py | 2 +- toontown/safezone/ButterflyGlobals.py | 10 +- toontown/safezone/DDPlayground.py | 2 +- toontown/safezone/DDSafeZoneLoader.py | 4 +- toontown/safezone/DDTreasurePlannerAI.py | 2 +- toontown/safezone/DGPlayground.py | 2 +- toontown/safezone/DGSafeZoneLoader.py | 4 +- toontown/safezone/DGTreasurePlannerAI.py | 2 +- toontown/safezone/DLPlayground.py | 2 +- toontown/safezone/DLSafeZoneLoader.py | 4 +- toontown/safezone/DLTreasurePlannerAI.py | 2 +- toontown/safezone/DistributedBRTreasure.py | 2 +- toontown/safezone/DistributedBRTreasureAI.py | 2 +- toontown/safezone/DistributedButterfly.py | 2 +- toontown/safezone/DistributedCheckers.py | 4 +- .../safezone/DistributedChineseCheckers.py | 4 +- toontown/safezone/DistributedDDTreasure.py | 2 +- toontown/safezone/DistributedDDTreasureAI.py | 2 +- toontown/safezone/DistributedDGTreasure.py | 2 +- toontown/safezone/DistributedDGTreasureAI.py | 2 +- toontown/safezone/DistributedDLTreasure.py | 2 +- toontown/safezone/DistributedDLTreasureAI.py | 2 +- .../safezone/DistributedEFlyingTreasure.py | 2 +- toontown/safezone/DistributedETreasure.py | 2 +- toontown/safezone/DistributedFindFour.py | 6 +- toontown/safezone/DistributedGolfKart.py | 8 +- toontown/safezone/DistributedGolfKartAI.py | 2 +- toontown/safezone/DistributedMMTreasure.py | 2 +- toontown/safezone/DistributedMMTreasureAI.py | 2 +- toontown/safezone/DistributedOZTreasure.py | 2 +- toontown/safezone/DistributedOZTreasureAI.py | 2 +- toontown/safezone/DistributedPartyGate.py | 2 +- toontown/safezone/DistributedPicnicBasket.py | 8 +- .../safezone/DistributedPicnicBasketAI.py | 2 +- toontown/safezone/DistributedPicnicTable.py | 26 ++-- toontown/safezone/DistributedSZTreasure.py | 2 +- toontown/safezone/DistributedSZTreasureAI.py | 6 +- toontown/safezone/DistributedTTTreasure.py | 2 +- toontown/safezone/DistributedTTTreasureAI.py | 2 +- toontown/safezone/DistributedTreasure.py | 2 +- toontown/safezone/DistributedTrolley.py | 14 +- toontown/safezone/DistributedTrolleyAI.py | 2 +- toontown/safezone/GSPlayground.py | 4 +- toontown/safezone/GSSafeZoneLoader.py | 4 +- toontown/safezone/GZPlayground.py | 4 +- toontown/safezone/GZSafeZoneLoader.py | 6 +- toontown/safezone/GameMenu.py | 2 +- toontown/safezone/MMPlayground.py | 2 +- toontown/safezone/MMSafeZoneLoader.py | 6 +- toontown/safezone/MMTreasurePlannerAI.py | 2 +- toontown/safezone/OZPlayground.py | 2 +- toontown/safezone/OZSafeZoneLoader.py | 14 +- toontown/safezone/OZTreasurePlannerAI.py | 2 +- toontown/safezone/Playground.py | 8 +- toontown/safezone/PublicWalk.py | 2 +- toontown/safezone/RegenTreasurePlannerAI.py | 2 +- toontown/safezone/SafeZoneLoader.py | 4 +- toontown/safezone/TTPlayground.py | 2 +- toontown/safezone/TTSafeZoneLoader.py | 6 +- toontown/safezone/TTTreasurePlannerAI.py | 2 +- toontown/shtiker/DirectNewsFrame.py | 6 +- toontown/shtiker/DisguisePage.py | 2 +- toontown/shtiker/EventsPage.py | 16 +- toontown/shtiker/FishPage.py | 4 +- toontown/shtiker/GardenPage.py | 10 +- toontown/shtiker/GolfPage.py | 16 +- toontown/shtiker/HtmlView.py | 8 +- toontown/shtiker/InventoryPage.py | 2 +- toontown/shtiker/IssueFrame.py | 4 +- toontown/shtiker/KartPage.py | 20 +-- toontown/shtiker/MapPage.py | 2 +- toontown/shtiker/NPCFriendPage.py | 2 +- toontown/shtiker/NewbiePurchaseManager.py | 2 +- toontown/shtiker/NewbiePurchaseManagerAI.py | 2 +- toontown/shtiker/OptionsPage.py | 6 +- toontown/shtiker/PhotoAlbumPage.py | 14 +- toontown/shtiker/PurchaseManager.py | 2 +- toontown/shtiker/PurchaseManagerAI.py | 12 +- toontown/shtiker/QuestPage.py | 8 +- toontown/shtiker/ShardPage.py | 4 +- toontown/shtiker/ShtikerBook.py | 2 +- toontown/shtiker/ShtikerPage.py | 2 +- toontown/shtiker/SuitPage.py | 20 +-- toontown/shtiker/TIPPage.py | 2 +- toontown/shtiker/TrackPage.py | 2 +- toontown/speedchat/TTSCAprilToonsMenu.py | 4 +- toontown/speedchat/TTSCBoardingMenu.py | 6 +- toontown/speedchat/TTSCDecoders.py | 4 +- toontown/speedchat/TTSCGolfMenu.py | 4 +- toontown/speedchat/TTSCHalloweenMenu.py | 4 +- toontown/speedchat/TTSCIdesOfMarchMenu.py | 4 +- toontown/speedchat/TTSCJellybeanJamMenu.py | 6 +- toontown/speedchat/TTSCKartRacingMenu.py | 4 +- toontown/speedchat/TTSCResistanceMenu.py | 2 +- .../speedchat/TTSCSellbotFieldOfficeMenu.py | 6 +- toontown/speedchat/TTSCSellbotInvasionMenu.py | 6 +- toontown/speedchat/TTSCSellbotNerfMenu.py | 4 +- toontown/speedchat/TTSCSillyPhaseFiveMenu.py | 4 +- toontown/speedchat/TTSCSillyPhaseFourMenu.py | 4 +- toontown/speedchat/TTSCSillyPhaseOneMenu.py | 4 +- toontown/speedchat/TTSCSillyPhaseThreeMenu.py | 4 +- toontown/speedchat/TTSCSillyPhaseTwoMenu.py | 4 +- toontown/speedchat/TTSCSingingMenu.py | 8 +- toontown/speedchat/TTSCToontaskMenu.py | 4 +- toontown/speedchat/TTSCVictoryPartiesMenu.py | 4 +- toontown/speedchat/TTSCWinterMenu.py | 6 +- toontown/speedchat/TTSpeedChatGlobals.py | 4 +- toontown/speedchat/TTSpeedChatTypes.py | 52 +++---- toontown/suit/BossCog.py | 6 +- toontown/suit/DistributedBossCog.py | 12 +- toontown/suit/DistributedBossCogAI.py | 10 +- toontown/suit/DistributedBossbotBoss.py | 10 +- toontown/suit/DistributedBossbotBossAI.py | 12 +- toontown/suit/DistributedCashbotBoss.py | 16 +- toontown/suit/DistributedCashbotBossAI.py | 6 +- toontown/suit/DistributedCashbotBossGoon.py | 4 +- toontown/suit/DistributedCashbotBossGoonAI.py | 2 +- toontown/suit/DistributedFactorySuit.py | 2 +- toontown/suit/DistributedFactorySuitAI.py | 4 +- toontown/suit/DistributedGoon.py | 6 +- toontown/suit/DistributedGoonAI.py | 6 +- toontown/suit/DistributedGridGoon.py | 2 +- toontown/suit/DistributedGridGoonAI.py | 2 +- toontown/suit/DistributedLawbotBoss.py | 16 +- toontown/suit/DistributedLawbotBossAI.py | 14 +- toontown/suit/DistributedLawbotBossSuit.py | 16 +- toontown/suit/DistributedSellbotBoss.py | 4 +- toontown/suit/DistributedSellbotBossAI.py | 8 +- toontown/suit/DistributedStageSuit.py | 2 +- toontown/suit/DistributedSuit.py | 32 ++-- toontown/suit/DistributedSuitAI.py | 8 +- toontown/suit/DistributedSuitBase.py | 12 +- toontown/suit/DistributedSuitBaseAI.py | 2 +- toontown/suit/DistributedSuitPlanner.py | 4 +- toontown/suit/DistributedSuitPlannerAI.py | 74 ++++----- toontown/suit/DistributedTutorialSuit.py | 2 +- toontown/suit/Goon.py | 4 +- toontown/suit/RoguesGallery.py | 6 +- toontown/suit/SellbotBossGlobals.py | 2 +- toontown/suit/Suit.py | 6 +- toontown/suit/SuitAvatarPanel.py | 2 +- toontown/suit/SuitBase.py | 8 +- toontown/suit/SuitDNA.py | 8 +- toontown/suit/SuitDialog.py | 4 +- toontown/suit/SuitPlannerBase.py | 4 +- toontown/toon/BoardingGroupInviterPanels.py | 2 +- toontown/toon/DeathForceAcknowledge.py | 4 +- toontown/toon/DistributedNPCBlocker.py | 4 +- toontown/toon/DistributedNPCBlockerAI.py | 4 +- toontown/toon/DistributedNPCClerk.py | 4 +- toontown/toon/DistributedNPCClerkAI.py | 4 +- toontown/toon/DistributedNPCFisherman.py | 4 +- toontown/toon/DistributedNPCFishermanAI.py | 4 +- .../toon/DistributedNPCFlippyInToonHall.py | 2 +- .../toon/DistributedNPCFlippyInToonHallAI.py | 2 +- toontown/toon/DistributedNPCKartClerk.py | 4 +- toontown/toon/DistributedNPCKartClerkAI.py | 4 +- toontown/toon/DistributedNPCPartyPerson.py | 2 +- toontown/toon/DistributedNPCPartyPersonAI.py | 4 +- toontown/toon/DistributedNPCPetclerk.py | 6 +- toontown/toon/DistributedNPCPetclerkAI.py | 8 +- toontown/toon/DistributedNPCScientist.py | 2 +- toontown/toon/DistributedNPCScientistAI.py | 2 +- .../toon/DistributedNPCSpecialQuestGiver.py | 4 +- .../toon/DistributedNPCSpecialQuestGiverAI.py | 2 +- toontown/toon/DistributedNPCTailor.py | 38 ++--- toontown/toon/DistributedNPCTailorAI.py | 8 +- toontown/toon/DistributedNPCToon.py | 2 +- toontown/toon/DistributedNPCToonAI.py | 2 +- toontown/toon/DistributedNPCToonBase.py | 6 +- toontown/toon/DistributedNPCToonBaseAI.py | 4 +- toontown/toon/DistributedToon.py | 54 +++---- toontown/toon/DistributedToonAI.py | 85 +++++----- toontown/toon/GroupPanel.py | 4 +- toontown/toon/InventoryBase.py | 4 +- toontown/toon/InventoryNew.py | 2 +- toontown/toon/LaffMeter.py | 2 +- toontown/toon/LocalToon.py | 61 ++++---- toontown/toon/Motion.py | 2 +- toontown/toon/NPCFriendPanel.py | 8 +- toontown/toon/NPCToons.py | 46 +++--- toontown/toon/PlayerDetailPanel.py | 6 +- toontown/toon/PlayerInfoPanel.py | 8 +- toontown/toon/TTEmote.py | 14 +- toontown/toon/TailorClothesGUI.py | 2 +- toontown/toon/Toon.py | 57 +++---- toontown/toon/ToonAvatarDetailPanel.py | 6 +- toontown/toon/ToonAvatarPanel.py | 10 +- toontown/toon/ToonDNA.py | 22 +-- toontown/toon/ToonHead.py | 2 +- toontown/toon/ToonHeadFrame.py | 2 +- toontown/toon/ToonTeleportPanel.py | 6 +- toontown/toonbase/TTLocalizer.py | 30 ++-- toontown/toonbase/TTLocalizerEnglish.py | 4 +- toontown/toonbase/ToonBase.py | 8 +- toontown/toonbase/ToonBaseGlobal.py | 2 +- toontown/toonbase/ToontownBattleGlobals.py | 4 +- toontown/toonbase/ToontownGlobals.py | 4 +- toontown/toonbase/ToontownStart.py | 36 ++--- toontown/toonbase/UserFunnel.py | 20 +-- toontown/toontowngui/TeaserPanel.py | 2 +- toontown/toontowngui/ToonHeadDialog.py | 2 +- toontown/town/BRStreet.py | 2 +- toontown/town/BRTownLoader.py | 4 +- toontown/town/DDStreet.py | 2 +- toontown/town/DDTownLoader.py | 4 +- toontown/town/DGStreet.py | 2 +- toontown/town/DGTownLoader.py | 4 +- toontown/town/DLStreet.py | 2 +- toontown/town/DLTownLoader.py | 4 +- toontown/town/MMStreet.py | 2 +- toontown/town/MMTownLoader.py | 4 +- toontown/town/Street.py | 4 +- toontown/town/TTStreet.py | 2 +- toontown/town/TTTownLoader.py | 4 +- toontown/town/TownBattle.py | 18 +-- toontown/town/TownBattleSOSPanel.py | 8 +- toontown/town/TownBattleSOSPetInfoPanel.py | 4 +- toontown/town/TownBattleToonPanel.py | 2 +- toontown/town/TownLoader.py | 6 +- toontown/town/TutorialStreet.py | 2 +- toontown/town/TutorialTownLoader.py | 6 +- toontown/uberdog/DataStore.py | 28 ++-- .../uberdog/DistributedDeliveryManager.py | 6 +- toontown/uberdog/UDStart.py | 6 +- 927 files changed, 3703 insertions(+), 3700 deletions(-) diff --git a/toontown/ai/AIStart.py b/toontown/ai/AIStart.py index 07b27ff..618d7f3 100644 --- a/toontown/ai/AIStart.py +++ b/toontown/ai/AIStart.py @@ -1,10 +1,10 @@ -import __builtin__ +import builtins class game: name = 'toontown' process = 'server' -__builtin__.game = game +builtins.game = game from panda3d.core import * @@ -38,5 +38,5 @@ except SystemExit: raise except Exception: from otp.otpbase import PythonUtil - print PythonUtil.describeException() + print(PythonUtil.describeException()) raise diff --git a/toontown/ai/CrashedLeaderBoardDecorator.py b/toontown/ai/CrashedLeaderBoardDecorator.py index 7b636eb..f8db4ff 100644 --- a/toontown/ai/CrashedLeaderBoardDecorator.py +++ b/toontown/ai/CrashedLeaderBoardDecorator.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -import HolidayDecorator +from . import HolidayDecorator from toontown.toonbase import ToontownGlobals from pandac.PandaModules import Vec4, CSDefault, TransformState, NodePath, TransparencyAttrib from libtoontown import loadDNAFile diff --git a/toontown/ai/DatabaseObject.py b/toontown/ai/DatabaseObject.py index e685a01..6feae9b 100644 --- a/toontown/ai/DatabaseObject.py +++ b/toontown/ai/DatabaseObject.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -from ToontownAIMsgTypes import * +from .ToontownAIMsgTypes import * from direct.directnotify.DirectNotifyGlobal import * from toontown.toon import DistributedToonAI from direct.distributed.PyDatagram import PyDatagram @@ -61,7 +61,7 @@ class DatabaseObject: if fields != None: values = {} for field in fields: - if self.values.has_key(field): + if field in self.values: values[field] = self.values[field] else: self.notify.warning('Field %s not defined.' % field) @@ -128,7 +128,7 @@ class DatabaseObject: dg.addServerHeader(DBSERVER_ID, self.air.ourChannel, DBSERVER_SET_STORED_VALUES) dg.addUint32(self.doId) dg.addUint16(len(values)) - items = values.items() + items = list(values.items()) for field, value in items: dg.addString(field) @@ -150,7 +150,7 @@ class DatabaseObject: def fillin(self, do, dclass): do.doId = self.doId - for field, value in self.values.items(): + for field, value in list(self.values.items()): if field == 'setZonesVisited' and value.getLength() == 1: self.notify.warning('Ignoring broken setZonesVisited') else: @@ -172,7 +172,7 @@ class DatabaseObject: def createObject(self, objectType): values = {} - for key, value in values.items(): + for key, value in list(values.items()): values[key] = PyDatagram(str(value)) context = self.air.dbObjContext @@ -185,10 +185,10 @@ class DatabaseObject: dg.addString('') dg.addUint16(objectType) dg.addUint16(len(values)) - for field in values.keys(): + for field in list(values.keys()): dg.addString(field) - for value in values.values(): + for value in list(values.values()): dg.addString(value.getMessage()) self.air.send(dg) @@ -209,5 +209,5 @@ class DatabaseObject: dg = PyDatagram() dg.addServerHeader(DBSERVER_ID, self.air.ourChannel, DBSERVER_DELETE_STORED_OBJECT) dg.addUint32(self.doId) - dg.addUint32(3735928559L) + dg.addUint32(3735928559) self.air.send(dg) diff --git a/toontown/ai/DistributedTrickOrTreatTarget.py b/toontown/ai/DistributedTrickOrTreatTarget.py index 5791f6a..c5340ce 100644 --- a/toontown/ai/DistributedTrickOrTreatTarget.py +++ b/toontown/ai/DistributedTrickOrTreatTarget.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed import DistributedObject from otp.speedchat import SpeedChatGlobals -import DistributedScavengerHuntTarget +from . import DistributedScavengerHuntTarget class DistributedTrickOrTreatTarget(DistributedScavengerHuntTarget.DistributedScavengerHuntTarget): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTrickOrTreatTarget') diff --git a/toontown/ai/DistributedWinterCarolingTarget.py b/toontown/ai/DistributedWinterCarolingTarget.py index ddcff72..fe861e1 100644 --- a/toontown/ai/DistributedWinterCarolingTarget.py +++ b/toontown/ai/DistributedWinterCarolingTarget.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed import DistributedObject from toontown.speedchat.TTSCIndexedTerminal import TTSCIndexedMsgEvent -import DistributedScavengerHuntTarget +from . import DistributedScavengerHuntTarget class DistributedWinterCarolingTarget(DistributedScavengerHuntTarget.DistributedScavengerHuntTarget): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWinterCarolingTarget') diff --git a/toontown/ai/HalloweenHolidayDecorator.py b/toontown/ai/HalloweenHolidayDecorator.py index b7513c2..4430093 100644 --- a/toontown/ai/HalloweenHolidayDecorator.py +++ b/toontown/ai/HalloweenHolidayDecorator.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -import HolidayDecorator +from . import HolidayDecorator from toontown.toonbase import ToontownGlobals from toontown.safezone import Playground from toontown.town import Street diff --git a/toontown/ai/HolidayDecorator.py b/toontown/ai/HolidayDecorator.py index 1ec59ec..391890d 100644 --- a/toontown/ai/HolidayDecorator.py +++ b/toontown/ai/HolidayDecorator.py @@ -62,7 +62,7 @@ class HolidayDecorator: index = int(np.getTag('transformIndex')) transform = loader.holidayPropTransforms.get(index, TransformState.makeIdentity()) newNP.setTransform(NodePath(), transform) - newNP.setTag('transformIndex', `index`) + newNP.setTag('transformIndex', repr(index)) s = Sequence(Wait(wait), np.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1), blendType='easeInOut'), Func(np.detachNode), Func(np.clearTransparency), newNP.colorScaleInterval(tFadeOut, Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0), blendType='easeInOut'), Func(newNP.clearTransparency), Func(newNP.clearColorScale)) p.append(s) diff --git a/toontown/ai/NewsManager.py b/toontown/ai/NewsManager.py index 54227ea..51d202c 100644 --- a/toontown/ai/NewsManager.py +++ b/toontown/ai/NewsManager.py @@ -5,9 +5,9 @@ from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals from toontown.battle import SuitBattleGlobals from toontown.toonbase import TTLocalizer -import HolidayDecorator -import HalloweenHolidayDecorator -import CrashedLeaderBoardDecorator +from . import HolidayDecorator +from . import HalloweenHolidayDecorator +from . import CrashedLeaderBoardDecorator from direct.interval.IntervalGlobal import * import calendar from copy import deepcopy @@ -323,11 +323,11 @@ class NewsManager(DistributedObject.DistributedObject): def isStarting(id): return id not in self.holidayIdList - toEnd = filter(isEnding, self.holidayIdList) + toEnd = list(filter(isEnding, self.holidayIdList)) for endingHolidayId in toEnd: self.endHoliday(endingHolidayId) - toStart = filter(isStarting, holidayIdList) + toStart = list(filter(isStarting, holidayIdList)) for startingHolidayId in toStart: self.startHoliday(startingHolidayId) @@ -461,11 +461,11 @@ class NewsManager(DistributedObject.DistributedObject): def setSpookyBlackCatHolidayStart(self): base.localAvatar.setSystemMessage(0, TTLocalizer.SpookyBlackCatHolidayStart) - for currToon in base.cr.toons.values(): + for currToon in list(base.cr.toons.values()): currToon.setDNA(currToon.style.clone()) def setSpookyBlackCatHolidayEnd(self): - for currToon in base.cr.toons.values(): + for currToon in list(base.cr.toons.values()): currToon.setDNA(currToon.style.clone()) def setTopToonsMarathonStart(self): diff --git a/toontown/ai/ServerEventBuffer.py b/toontown/ai/ServerEventBuffer.py index 047c209..1c5d0e8 100644 --- a/toontown/ai/ServerEventBuffer.py +++ b/toontown/ai/ServerEventBuffer.py @@ -59,7 +59,7 @@ class ServerEventMultiAccumulator(ServerEventBuffer): if not len(self.events): return msg = '' - eventNames = self.events.keys() + eventNames = list(self.events.keys()) eventNames.sort() for eventName in eventNames: msg += '%s:%s' % (eventName, self.events[eventName]) diff --git a/toontown/ai/ToontownAIMsgTypes.py b/toontown/ai/ToontownAIMsgTypes.py index 25529fb..1fdf673 100644 --- a/toontown/ai/ToontownAIMsgTypes.py +++ b/toontown/ai/ToontownAIMsgTypes.py @@ -6,10 +6,10 @@ TTAIMsgName2Id = {'DBSERVER_GET_ESTATE': 1040, 'WHITELIST_MANAGER_UD_TO_ALL_AI': 1044} TTAIMsgId2Names = invertDictLossless(TTAIMsgName2Id) if not isClient(): - print 'EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id + print('EXECWARNING ToontownAIMsgTypes: %s' % TTAIMsgName2Id) printStack() -for name, value in TTAIMsgName2Id.items(): - exec '%s = %s' % (name, value) +for name, value in list(TTAIMsgName2Id.items()): + exec('%s = %s' % (name, value)) del name del value diff --git a/toontown/ai/ToontownAIRepository.py b/toontown/ai/ToontownAIRepository.py index f46313f..6f8a7aa 100644 --- a/toontown/ai/ToontownAIRepository.py +++ b/toontown/ai/ToontownAIRepository.py @@ -226,7 +226,7 @@ class ToontownAIRepository(ToontownInternalRepository): self.welcomeValleyManager.createWelcomeValleyZones() # Assign the initial suit buildings. - for suitPlanner in self.suitPlanners.values(): + for suitPlanner in list(self.suitPlanners.values()): suitPlanner.assignInitialSuitBuildings() def genDNAFileName(self, zoneId): @@ -258,7 +258,7 @@ class ToontownAIRepository(ToontownInternalRepository): found = vfs.resolveFilename(filename, searchPath) if not found: self.notify.warning('lookupDNAFileName - %s not found on:' % dnaFileName) - print searchPath + print(searchPath) else: return filename.getFullpath() @@ -287,7 +287,7 @@ class ToontownAIRepository(ToontownInternalRepository): kartPads.append(viewPad) kartPadGroups.append(dnaData) - for i in xrange(dnaData.getNumChildren()): + for i in range(dnaData.getNumChildren()): foundKartPads, foundKartPadGroups = self.findRacingPads(dnaData.at(i), zoneId, area, type, overrideDNAZone) kartPads.extend(foundKartPads) kartPadGroups.extend(foundKartPadGroups) @@ -306,7 +306,7 @@ class ToontownAIRepository(ToontownInternalRepository): leaderBoard.generateWithRequired(zoneId) leaderBoards.append(leaderBoard) - for i in xrange(dnaData.getNumChildren()): + for i in range(dnaData.getNumChildren()): foundLeaderBoards = self.findLeaderBoards(dnaData.at(i), zoneId) leaderBoards.extend(foundLeaderBoards) diff --git a/toontown/ai/ToontownMagicWordManager.py b/toontown/ai/ToontownMagicWordManager.py index 4654093..c017209 100644 --- a/toontown/ai/ToontownMagicWordManager.py +++ b/toontown/ai/ToontownMagicWordManager.py @@ -104,10 +104,10 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): go = Fanfare.makeFanfareWithMessageImage(0, base.localAvatar, 1, "You just did a ~fanfare. Here's a rake.", Vec2(0, 0.2), 0.08, base.localAvatar.inventory.buttonLookup(1, 1), Vec3(0, 0, 0), 4) Sequence(go[0], Func(go[1].show), LerpColorScaleInterval(go[1], duration=0.5, startColorScale=Vec4(1, 1, 1, 0), colorScale=Vec4(1, 1, 1, 1)), Wait(2), LerpColorScaleInterval(go[1], duration=0.5, startColorScale=Vec4(1, 1, 1, 1), colorScale=Vec4(1, 1, 1, 0)), Func(go[1].remove)).start() elif wordIs('~endgame'): - print 'Requesting minigame abort...' + print('Requesting minigame abort...') messenger.send('minigameAbort') elif wordIs('~wingame'): - print 'Requesting minigame victory...' + print('Requesting minigame victory...') messenger.send('minigameVictory') elif wordIs('~walk'): try: @@ -139,7 +139,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): self.rogues.animate() self.acceptOnce('mouse1', self.exit_rogues) elif wordIs('~showPaths'): - for obj in self.cr.doId2do.values(): + for obj in list(self.cr.doId2do.values()): if isinstance(obj, DistributedSuitPlanner.DistributedSuitPlanner): obj.showPaths() @@ -147,7 +147,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): if hasattr(place, 'showPaths'): place.showPaths() elif wordIs('~hidePaths'): - for obj in self.cr.doId2do.values(): + for obj in list(self.cr.doId2do.values()): if isinstance(obj, DistributedSuitPlanner.DistributedSuitPlanner): obj.hidePaths() @@ -221,7 +221,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): if not camParent.isEmpty(): myCam.wrtReparentTo(camParent) self.setMagicWordResponse(response) - print response + print(response) elif wordIs('~sync'): tm = base.cr.timeManager if tm == None: @@ -581,7 +581,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): hoodId = ToontownGlobals.PartyHood ToontownDistrictStats.refresh('shardInfoUpdated') curShardTuples = base.cr.listActiveShards() - lowestPop = 100000000000000000L + lowestPop = 100000000000000000 shardId = None for shardInfo in curShardTuples: pop = shardInfo[2] @@ -680,7 +680,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): def identifyDistributedObjects(self, name): result = [] lowerName = string.lower(name) - for obj in base.cr.doId2do.values(): + for obj in list(base.cr.doId2do.values()): className = obj.__class__.__name__ try: name = obj.getName() @@ -741,7 +741,7 @@ class ToontownMagicWordManager(MagicWordManager.MagicWordManager): def doBossBattle(self, word): args = word.split() bossCog = None - for distObj in self.cr.doId2do.values(): + for distObj in list(self.cr.doId2do.values()): if isinstance(distObj, DistributedBossCog.DistributedBossCog): bossCog = distObj break diff --git a/toontown/battle/BattleBase.py b/toontown/battle/BattleBase.py index 338b250..b199f81 100644 --- a/toontown/battle/BattleBase.py +++ b/toontown/battle/BattleBase.py @@ -133,7 +133,7 @@ def getDefaultSuitAttack(): def findToonAttack(toons, attacks, track): foundAttacks = [] for t in toons: - if attacks.has_key(t): + if t in attacks: attack = attacks[t] local_track = attack[TOON_TRACK_COL] if track != NPCSOS and attack[TOON_TRACK_COL] == NPCSOS: diff --git a/toontown/battle/BattleCalculatorAI.py b/toontown/battle/BattleCalculatorAI.py index f53bbe2..d76ea92 100644 --- a/toontown/battle/BattleCalculatorAI.py +++ b/toontown/battle/BattleCalculatorAI.py @@ -1,9 +1,9 @@ -from BattleBase import * -from DistributedBattleAI import * +from .BattleBase import * +from .DistributedBattleAI import * from toontown.toonbase.ToontownBattleGlobals import * import random from toontown.suit import DistributedSuitBaseAI -import SuitBattleGlobals, BattleExperienceAI +from . import SuitBattleGlobals, BattleExperienceAI from toontown.toon import NPCToons from toontown.pets import PetTricks, DistributedPetProxyAI from direct.showbase.PythonUtil import lerp @@ -166,7 +166,7 @@ class BattleCalculatorAI: prevAttack = self.battle.toonAttacks[prevAtkId] prevAtkTrack = self.__getActualTrack(prevAttack) lure = atkTrack == LURE and (not attackAffectsGroup(atkTrack, atkLevel, - attack[TOON_TRACK_COL]) and self.successfulLures.has_key(attack[TOON_TGT_COL]) or attackAffectsGroup(atkTrack, atkLevel, attack[TOON_TRACK_COL])) + attack[TOON_TRACK_COL]) and attack[TOON_TGT_COL] in self.successfulLures or attackAffectsGroup(atkTrack, atkLevel, attack[TOON_TRACK_COL])) if atkTrack == prevAtkTrack and (attack[TOON_TGT_COL] == prevAttack[TOON_TGT_COL] or lure): if prevAttack[TOON_ACCBONUS_COL] == 1: if debug: @@ -280,7 +280,7 @@ class BattleCalculatorAI: return NO_ATTACK def getSuitTrapType(self, suitId): - if self.traps.has_key(suitId): + if suitId in self.traps: if self.traps[suitId][0] == self.TRAP_CONFLICT: return NO_TRAP else: @@ -289,7 +289,7 @@ class BattleCalculatorAI: return NO_TRAP def __suitTrapDamage(self, suitId): - if self.traps.has_key(suitId): + if suitId in self.traps: return self.traps[suitId][2] else: return 0 @@ -297,7 +297,7 @@ class BattleCalculatorAI: def addTrainTrapForJoiningSuit(self, suitId): self.notify.debug('addTrainTrapForJoiningSuit suit=%d self.traps=%s' % (suitId, self.traps)) trapInfoToUse = None - for trapInfo in self.traps.values(): + for trapInfo in list(self.traps.values()): if trapInfo[0] == UBER_GAG_LEVEL_INDEX: trapInfoToUse = trapInfo break @@ -310,14 +310,14 @@ class BattleCalculatorAI: def __addSuitGroupTrap(self, suitId, trapLvl, attackerId, allSuits, npcDamage=0): if npcDamage == 0: - if self.traps.has_key(suitId): + if suitId in self.traps: if self.traps[suitId][0] == self.TRAP_CONFLICT: pass else: self.traps[suitId][0] = self.TRAP_CONFLICT for suit in allSuits: id = suit.doId - if self.traps.has_key(id): + if id in self.traps: self.traps[id][0] = self.TRAP_CONFLICT else: self.traps[id] = [ @@ -336,7 +336,7 @@ class BattleCalculatorAI: self.notify.debug('calling __addLuredSuitsDelayed') self.__addLuredSuitsDelayed(attackerId, targetId=-1, ignoreDamageCheck=True) else: - if self.traps.has_key(suitId): + if suitId in self.traps: if self.traps[suitId][0] == self.TRAP_CONFLICT: self.traps[suitId] = [ trapLvl, 0, npcDamage] @@ -347,7 +347,7 @@ class BattleCalculatorAI: def __addSuitTrap(self, suitId, trapLvl, attackerId, npcDamage=0): if npcDamage == 0: - if self.traps.has_key(suitId): + if suitId in self.traps: if self.traps[suitId][0] == self.TRAP_CONFLICT: pass else: @@ -363,7 +363,7 @@ class BattleCalculatorAI: else: self.traps[suitId] = [trapLvl, 0, damage] else: - if self.traps.has_key(suitId): + if suitId in self.traps: if self.traps[suitId][0] == self.TRAP_CONFLICT: self.traps[suitId] = [ trapLvl, 0, npcDamage] @@ -373,28 +373,28 @@ class BattleCalculatorAI: trapLvl, 0, npcDamage] def __removeSuitTrap(self, suitId): - if self.traps.has_key(suitId): + if suitId in self.traps: del self.traps[suitId] def __clearTrapCreator(self, creatorId, suitId=None): if suitId == None: - for currTrap in self.traps.keys(): + for currTrap in list(self.traps.keys()): if creatorId == self.traps[currTrap][1]: self.traps[currTrap][1] = 0 - elif self.traps.has_key(suitId): + elif suitId in self.traps: self.traps[suitId][1] = 0 return def __trapCreator(self, suitId): - if self.traps.has_key(suitId): + if suitId in self.traps: return self.traps[suitId][1] else: return 0 def __initTraps(self): self.trainTrapTriggered = False - keysList = self.traps.keys() + keysList = list(self.traps.keys()) for currTrap in keysList: if self.traps[currTrap][0] == self.TRAP_CONFLICT: del self.traps[currTrap] @@ -437,7 +437,7 @@ class BattleCalculatorAI: targetLured = 1 else: attackTrack = TRAP - if self.traps.has_key(targetId): + if targetId in self.traps: trapInfo = self.traps[targetId] attackLevel = trapInfo[0] else: @@ -467,7 +467,7 @@ class BattleCalculatorAI: targetLured = 1 if attackLevel != -1: self.__addLuredSuitsDelayed(toonId, targetId) - if targetLured and (not self.successfulLures.has_key(targetId) or self.successfulLures.has_key(targetId) and self.successfulLures[targetId][1] < atkLevel): + if targetLured and (targetId not in self.successfulLures or targetId in self.successfulLures and self.successfulLures[targetId][1] < atkLevel): self.notify.debug('Adding target ' + str(targetId) + ' to successfulLures list') self.successfulLures[targetId] = [toonId, atkLevel, @@ -510,7 +510,7 @@ class BattleCalculatorAI: simbase.air.writeServerEvent('suspicious', toonId, commentStr) dislId = toon.DISLid simbase.air.banManager.ban(toonId, dislId, commentStr) - print 'Not enough PinkSlips to fire cog - print a warning here' + print('Not enough PinkSlips to fire cog - print a warning here') else: suit.skeleRevives = 0 attackDamage = suit.getHP() @@ -554,7 +554,7 @@ class BattleCalculatorAI: result = result / len(targetList) if self.notify.getDebug(): self.notify.debug('Splitting heal among ' + str(len(targetList)) + ' targets') - if self.successfulLures.has_key(targetId) and atkTrack == LURE: + if targetId in self.successfulLures and atkTrack == LURE: self.notify.debug('Updating lure damage to ' + str(result)) self.successfulLures[targetId][3] = result else: @@ -756,14 +756,14 @@ class BattleCalculatorAI: attack = self.battle.toonAttacks[attackerId] track = self.__getActualTrack(attack) if hp: - if self.hpBonuses[tgtPos].has_key(track): + if track in self.hpBonuses[tgtPos]: self.hpBonuses[tgtPos][track].append([attackIndex, dmg]) else: self.hpBonuses[tgtPos][track] = [ [ attackIndex, dmg]] elif self.__suitIsLured(currTgt.getDoId()): - if self.kbBonuses[tgtPos].has_key(track): + if track in self.kbBonuses[tgtPos]: self.kbBonuses[tgtPos][track].append([attackIndex, dmg]) else: self.kbBonuses[tgtPos][track] = [ @@ -795,7 +795,7 @@ class BattleCalculatorAI: self.notify.debug('Processing kbBonuses: ' + repr(self.kbBonuses)) tgtPos = 0 for currTgt in bonusList: - for currAtkType in currTgt.keys(): + for currAtkType in list(currTgt.keys()): if len(currTgt[currAtkType]) > 1 or not hp and len(currTgt[currAtkType]) > 0: totalDmgs = 0 for currDmg in currTgt[currAtkType]: @@ -855,10 +855,10 @@ class BattleCalculatorAI: self.notify.warning('__clearAttack not implemented for suits!') def __rememberToonAttack(self, suitId, toonId, damage): - if not self.SuitAttackers.has_key(suitId): + if suitId not in self.SuitAttackers: self.SuitAttackers[suitId] = {toonId: damage} else: - if not self.SuitAttackers[suitId].has_key(toonId): + if toonId not in self.SuitAttackers[suitId]: self.SuitAttackers[suitId][toonId] = damage else: if self.SuitAttackers[suitId][toonId] <= damage: @@ -882,7 +882,7 @@ class BattleCalculatorAI: if damageDone > 0: self.__rememberToonAttack(currTgt.getDoId(), attack[TOON_ID_COL], damageDone) if atkTrack == TRAP: - if self.traps.has_key(currTgt.doId): + if currTgt.doId in self.traps: trapInfo = self.traps[currTgt.doId] currTgt.battleTrap = trapInfo[0] targetDead = 0 @@ -895,13 +895,13 @@ class BattleCalculatorAI: self.__clearTgtDied(currTgt, currLastAtk, attack) tgtId = currTgt.getDoId() - if self.successfulLures.has_key(tgtId) and atkTrack == LURE: + if tgtId in self.successfulLures and atkTrack == LURE: lureInfo = self.successfulLures[tgtId] self.notify.debug('applying lure data: ' + repr(lureInfo)) toonId = lureInfo[0] lureAtk = self.battle.toonAttacks[toonId] tgtPos = self.battle.activeSuits.index(currTgt) - if self.traps.has_key(currTgt.doId): + if currTgt.doId in self.traps: trapInfo = self.traps[currTgt.doId] if trapInfo[0] == UBER_GAG_LEVEL_INDEX: self.notify.debug('train trap triggered for %d' % currTgt.doId) @@ -1073,20 +1073,20 @@ class BattleCalculatorAI: def __calcSuitTarget(self, attackIndex): attack = self.battle.suitAttacks[attackIndex] suitId = attack[SUIT_ID_COL] - if self.SuitAttackers.has_key(suitId) and random.randint(0, 99) < 75: + if suitId in self.SuitAttackers and random.randint(0, 99) < 75: totalDamage = 0 - for currToon in self.SuitAttackers[suitId].keys(): + for currToon in list(self.SuitAttackers[suitId].keys()): totalDamage += self.SuitAttackers[suitId][currToon] dmgs = [] - for currToon in self.SuitAttackers[suitId].keys(): + for currToon in list(self.SuitAttackers[suitId].keys()): dmgs.append(self.SuitAttackers[suitId][currToon] / totalDamage * 100) dmgIdx = SuitBattleGlobals.pickFromFreqList(dmgs) if dmgIdx == None: toonId = self.__pickRandomToon(suitId) else: - toonId = self.SuitAttackers[suitId].keys()[dmgIdx] + toonId = list(self.SuitAttackers[suitId].keys())[dmgIdx] if toonId == -1 or toonId not in self.battle.activeToons: return -1 self.notify.debug('Suit attacking back at toon ' + str(toonId)) @@ -1177,7 +1177,7 @@ class BattleCalculatorAI: def __getToonHp(self, toonDoId): handle = self.battle.getToon(toonDoId) - if handle != None and self.toonHPAdjusts.has_key(toonDoId): + if handle != None and toonDoId in self.toonHPAdjusts: return handle.hp + self.toonHPAdjusts[toonDoId] else: return 0 @@ -1215,14 +1215,14 @@ class BattleCalculatorAI: return 1 def __updateSuitAtkStat(self, toonId): - if self.suitAtkStats.has_key(toonId): + if toonId in self.suitAtkStats: self.suitAtkStats[toonId] += 1 else: self.suitAtkStats[toonId] = 1 def __printSuitAtkStats(self): self.notify.debug('Suit Atk Stats:') - for currTgt in self.suitAtkStats.keys(): + for currTgt in list(self.suitAtkStats.keys()): if currTgt not in self.battle.activeToons: continue tgtPos = self.battle.activeToons.index(currTgt) @@ -1283,7 +1283,7 @@ class BattleCalculatorAI: self.notify.debug('__updateLureTimeouts()') self.notify.debug('Lured suits: ' + str(self.currentlyLuredSuits)) noLongerLured = [] - for currLuredSuit in self.currentlyLuredSuits.keys(): + for currLuredSuit in list(self.currentlyLuredSuits.keys()): self.__incLuredCurrRound(currLuredSuit) if self.__luredMaxRoundsReached(currLuredSuit) or self.__luredWakeupTime(currLuredSuit): noLongerLured.append(currLuredSuit) @@ -1392,14 +1392,14 @@ class BattleCalculatorAI: def toonLeftBattle(self, toonId): if self.notify.getDebug(): self.notify.debug('toonLeftBattle()' + str(toonId)) - if self.toonSkillPtsGained.has_key(toonId): + if toonId in self.toonSkillPtsGained: del self.toonSkillPtsGained[toonId] - if self.suitAtkStats.has_key(toonId): + if toonId in self.suitAtkStats: del self.suitAtkStats[toonId] if not self.CLEAR_SUIT_ATTACKERS: oldSuitIds = [] - for s in self.SuitAttackers.keys(): - if self.SuitAttackers[s].has_key(toonId): + for s in list(self.SuitAttackers.keys()): + if toonId in self.SuitAttackers[s]: del self.SuitAttackers[s][toonId] if len(self.SuitAttackers[s]) == 0: oldSuitIds.append(s) @@ -1414,7 +1414,7 @@ class BattleCalculatorAI: if self.notify.getDebug(): self.notify.debug('suitLeftBattle(): ' + str(suitId)) self.__removeLured(suitId) - if self.SuitAttackers.has_key(suitId): + if suitId in self.SuitAttackers: del self.SuitAttackers[suitId] self.__removeSuitTrap(suitId) @@ -1423,8 +1423,8 @@ class BattleCalculatorAI: self.notify.debug('updateActiveToons()') if not self.CLEAR_SUIT_ATTACKERS: oldSuitIds = [] - for s in self.SuitAttackers.keys(): - for t in self.SuitAttackers[s].keys(): + for s in list(self.SuitAttackers.keys()): + for t in list(self.SuitAttackers[s].keys()): if t not in self.battle.activeToons: del self.SuitAttackers[s][t] if len(self.SuitAttackers[s]) == 0: @@ -1433,7 +1433,7 @@ class BattleCalculatorAI: for oldSuitId in oldSuitIds: del self.SuitAttackers[oldSuitId] - for trap in self.traps.keys(): + for trap in list(self.traps.keys()): if self.traps[trap][1] not in self.battle.activeToons: self.notify.debug('Trap for toon ' + str(self.traps[trap][1]) + ' will no longer give exp') self.traps[trap][1] = 0 @@ -1442,22 +1442,22 @@ class BattleCalculatorAI: return BattleExperienceAI.getSkillGained(self.toonSkillPtsGained, toonId, track) def getLuredSuits(self): - luredSuits = self.currentlyLuredSuits.keys() + luredSuits = list(self.currentlyLuredSuits.keys()) self.notify.debug('Lured suits reported to battle: ' + repr(luredSuits)) return luredSuits def __suitIsLured(self, suitId, prevRound=0): - inList = self.currentlyLuredSuits.has_key(suitId) + inList = suitId in self.currentlyLuredSuits if prevRound: return inList and self.currentlyLuredSuits[suitId][0] != -1 return inList def __findAvailLureId(self, lurerId): - luredSuits = self.currentlyLuredSuits.keys() + luredSuits = list(self.currentlyLuredSuits.keys()) lureIds = [] for currLured in luredSuits: lurerInfo = self.currentlyLuredSuits[currLured][3] - lurers = lurerInfo.keys() + lurers = list(lurerInfo.keys()) for currLurer in lurers: currId = lurerInfo[currLurer][1] if currLurer == lurerId and currId not in lureIds: @@ -1481,9 +1481,9 @@ class BattleCalculatorAI: credit = 0 else: credit = self.itemIsCredit(LURE, lureLvl) - if self.currentlyLuredSuits.has_key(suitId): + if suitId in self.currentlyLuredSuits: lureInfo = self.currentlyLuredSuits[suitId] - if not lureInfo[3].has_key(lurer): + if lurer not in lureInfo[3]: lureInfo[1] += maxRounds if wakeChance < lureInfo[2]: lureInfo[2] = wakeChance @@ -1498,7 +1498,7 @@ class BattleCalculatorAI: def __getLurers(self, suitId): if self.__suitIsLured(suitId): - return self.currentlyLuredSuits[suitId][3].keys() + return list(self.currentlyLuredSuits[suitId][3].keys()) return [] def __getLuredExpInfo(self, suitId): @@ -1513,10 +1513,10 @@ class BattleCalculatorAI: return returnInfo def __clearLurer(self, lurerId, lureId=-1): - luredSuits = self.currentlyLuredSuits.keys() + luredSuits = list(self.currentlyLuredSuits.keys()) for currLured in luredSuits: lurerInfo = self.currentlyLuredSuits[currLured][3] - lurers = lurerInfo.keys() + lurers = list(lurerInfo.keys()) for currLurer in lurers: if currLurer == lurerId and (lureId == -1 or lureId == lurerInfo[currLurer][1]): del lurerInfo[currLurer] @@ -1581,7 +1581,7 @@ class BattleCalculatorAI: trickId = toonAttack[TOON_LVL_COL] healRange = PetTricks.TrickHeals[trickId] hp = 0 - if simbase.air.doId2do.has_key(petProxyId): + if petProxyId in simbase.air.doId2do: petProxy = simbase.air.doId2do[petProxyId] if trickId < len(petProxy.trickAptitudes): aptitude = petProxy.trickAptitudes[trickId] @@ -1594,7 +1594,7 @@ class BattleCalculatorAI: def __calculatePetTrickSuccess(self, toonAttack): petProxyId = toonAttack[TOON_TGT_COL] - if not simbase.air.doId2do.has_key(petProxyId): + if petProxyId not in simbase.air.doId2do: self.notify.warning('pet proxy %d not in doId2do!' % petProxyId) toonAttack[TOON_ACCBONUS_COL] = 1 return (0, 0) diff --git a/toontown/battle/BattleManagerAI.py b/toontown/battle/BattleManagerAI.py index bff96cd..07705e2 100644 --- a/toontown/battle/BattleManagerAI.py +++ b/toontown/battle/BattleManagerAI.py @@ -1,4 +1,4 @@ -import DistributedBattleAI +from . import DistributedBattleAI from direct.directnotify import DirectNotifyGlobal class BattleManagerAI: @@ -10,15 +10,15 @@ class BattleManagerAI: self.battleConstructor = DistributedBattleAI.DistributedBattleAI def cellHasBattle(self, cellId): - return self.cellId2battle.has_key(cellId) + return cellId in self.cellId2battle def getBattle(self, cellId): - if self.cellId2battle.has_key(cellId): + if cellId in self.cellId2battle: return self.cellId2battle[cellId] return None def newBattle(self, cellId, zoneId, pos, suit, toonId, finishCallback=None, maxSuits=4, interactivePropTrackBonus=-1): - if self.cellId2battle.has_key(cellId): + if cellId in self.cellId2battle: self.notify.info("A battle is already present in the suit's zone!") if not self.requestBattleAddSuit(cellId, suit): suit.flyAwayNow() diff --git a/toontown/battle/BattleProps.py b/toontown/battle/BattleProps.py index 2879c35..d717b37 100644 --- a/toontown/battle/BattleProps.py +++ b/toontown/battle/BattleProps.py @@ -263,7 +263,7 @@ class PropPool: self.propStrings[propName] = (self.getPath(5, 'half-windsor'),) self.propTypes[propName] = 'model' splatAnimFileName = self.getPath(3.5, 'splat-chan') - for splat in Splats.keys(): + for splat in list(Splats.keys()): propName = 'splat-' + splat self.propStrings[propName] = (self.getPath(3.5, 'splat-mod'), splatAnimFileName) self.propTypes[propName] = 'actor' @@ -376,7 +376,7 @@ class PropPool: self.props[name] = self.props[name].find('**/trolley_car') def unloadProps(self): - for p in self.props.values(): + for p in list(self.props.values()): if type(p) != type(()): self.__delProp(p) @@ -388,7 +388,7 @@ class PropPool: def __getPropCopy(self, name): if self.propTypes[name] == 'actor': - if not self.props.has_key(name): + if name not in self.props: prop = Actor.Actor() prop.loadModel(self.propStrings[name][0]) animDict = {} @@ -400,7 +400,7 @@ class PropPool: self.makeVariant(name) return Actor.Actor(other=self.props[name]) else: - if not self.props.has_key(name): + if name not in self.props: prop = loader.loadModel(self.propStrings[name][0]) prop.setName(name) self.storeProp(name, prop) diff --git a/toontown/battle/BattleSounds.py b/toontown/battle/BattleSounds.py index ba88dbc..2a61838 100644 --- a/toontown/battle/BattleSounds.py +++ b/toontown/battle/BattleSounds.py @@ -47,7 +47,7 @@ class BattleSounds: found = vfs.resolveFilename(filename, self.sfxSearchPath) if not found: self.notify.warning('%s not found on:' % name) - print self.sfxSearchPath + print(self.sfxSearchPath) else: return self.mgr.getSound(filename.getFullpath()) return self.mgr.getNullSound() diff --git a/toontown/battle/DistributedBattle.py b/toontown/battle/DistributedBattle.py index 92b03fc..eb62d0b 100644 --- a/toontown/battle/DistributedBattle.py +++ b/toontown/battle/DistributedBattle.py @@ -1,17 +1,17 @@ from pandac.PandaModules import * from libotp import * from direct.interval.IntervalGlobal import * -from BattleBase import * +from .BattleBase import * from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals -import DistributedBattleBase +from . import DistributedBattleBase from direct.directnotify import DirectNotifyGlobal -import MovieUtil +from . import MovieUtil from toontown.suit import Suit from direct.actor import Actor from toontown.toon import TTEmote from otp.avatar import Emote -import SuitBattleGlobals +from . import SuitBattleGlobals from toontown.distributed import DelayDelete import random diff --git a/toontown/battle/DistributedBattleAI.py b/toontown/battle/DistributedBattleAI.py index 00b85a3..76c0ac9 100644 --- a/toontown/battle/DistributedBattleAI.py +++ b/toontown/battle/DistributedBattleAI.py @@ -1,9 +1,9 @@ from otp.ai.AIBase import * -from BattleBase import * -from BattleCalculatorAI import * +from .BattleBase import * +from .BattleCalculatorAI import * from toontown.toonbase.ToontownBattleGlobals import * -from SuitBattleGlobals import * -import DistributedBattleBaseAI +from .SuitBattleGlobals import * +from . import DistributedBattleBaseAI from direct.task import Task from direct.directnotify import DirectNotifyGlobal import random diff --git a/toontown/battle/DistributedBattleBase.py b/toontown/battle/DistributedBattleBase.py index 01b856b..4218f40 100644 --- a/toontown/battle/DistributedBattleBase.py +++ b/toontown/battle/DistributedBattleBase.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.interval.IntervalGlobal import * -from BattleBase import * +from .BattleBase import * from direct.distributed.ClockDelta import * from toontown.toonbase import ToontownBattleGlobals from direct.distributed import DistributedNode @@ -9,13 +9,13 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task.Task import Task from direct.directnotify import DirectNotifyGlobal -import Movie -import MovieUtil +from . import Movie +from . import MovieUtil from toontown.suit import Suit from direct.actor import Actor -import BattleProps +from . import BattleProps from direct.particles import ParticleEffect -import BattleParticles +from . import BattleParticles from toontown.hood import ZoneUtil from toontown.distributed import DelayDelete from toontown.toon import TTEmote @@ -99,28 +99,28 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): self.activeIntervals[name] = interval def __cleanupIntervals(self): - for interval in self.activeIntervals.values(): + for interval in list(self.activeIntervals.values()): interval.finish() DelayDelete.cleanupDelayDeletes(interval) self.activeIntervals = {} def clearInterval(self, name, finish = 0): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: ival = self.activeIntervals[name] if finish: ival.finish() else: ival.pause() - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: DelayDelete.cleanupDelayDeletes(ival) - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: del self.activeIntervals[name] else: self.notify.debug('interval: %s already cleared' % name) def finishInterval(self, name): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: interval = self.activeIntervals[name] interval.finish() @@ -361,7 +361,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): self.suits = [] suitGone = 0 for s in suits: - if self.cr.doId2do.has_key(s): + if s in self.cr.doId2do: suit = self.cr.doId2do[s] suit.setState('Battle') self.suits.append(suit) @@ -940,7 +940,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): self.storeInterval(runMTrack, runName) def getToon(self, toonId): - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: return self.cr.doId2do[toonId] else: self.notify.warning('getToon() - toon: %d not in repository!' % toonId) @@ -1135,7 +1135,7 @@ class DistributedBattleBase(DistributedNode.DistributedNode, BattleBase): elif mode == 'PETSOSINFO': petProxyId = response['id'] self.notify.debug('got a PETSOSINFO for pet: %d' % petProxyId) - if base.cr.doId2do.has_key(petProxyId): + if petProxyId in base.cr.doId2do: self.notify.debug('pet: %d was already in the repository' % petProxyId) proxyGenerateMessage = 'petProxy-%d-generated' % petProxyId messenger.send(proxyGenerateMessage) diff --git a/toontown/battle/DistributedBattleBaseAI.py b/toontown/battle/DistributedBattleBaseAI.py index 5c570b6..771cb3b 100644 --- a/toontown/battle/DistributedBattleBaseAI.py +++ b/toontown/battle/DistributedBattleBaseAI.py @@ -1,11 +1,11 @@ from otp.ai.AIBase import * from direct.distributed.ClockDelta import * -from BattleBase import * -import BattleCalculatorAI +from .BattleBase import * +from . import BattleCalculatorAI from toontown.toonbase.ToontownBattleGlobals import * -from SuitBattleGlobals import * +from .SuitBattleGlobals import * from pandac.PandaModules import * -import BattleExperienceAI +from . import BattleExperienceAI from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -144,7 +144,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas del suit.battleTrap del self.finishCallback - for petProxy in self.pets.values(): + for petProxy in list(self.pets.values()): petProxy.requestDelete() DistributedObjectAI.DistributedObjectAI.delete(self) @@ -319,7 +319,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas p.append(self.activeToons) p.append(suitIds) for t in self.activeToons: - if self.toonAttacks.has_key(t): + if t in self.toonAttacks: ta = self.toonAttacks[t] index = -1 id = ta[TOON_ID_COL] @@ -387,7 +387,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas levels = [] targets = [] for t in self.activeToons: - if self.toonAttacks.has_key(t): + if t in self.toonAttacks: ta = self.toonAttacks[t] else: ta = getToonAttack(t) @@ -481,7 +481,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas return 0 def addToon(self, avId): - print 'DBB-addToon %s' % avId + print('DBB-addToon %s' % avId) self.notify.debug('addToon(%d)' % avId) toon = self.getToon(avId) if toon == None: @@ -682,7 +682,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas self.notify.warning('removeToon() - toon: %d was adjusting!' % toonId) self.adjustingToons.remove(toonId) self.toonGone = 1 - if self.pets.has_key(toonId): + if toonId in self.pets: self.pets[toonId].requestDelete() del self.pets[toonId] self.__removeResponse(toonId) @@ -721,7 +721,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas return def getToon(self, toonId): - if self.air.doId2do.has_key(toonId): + if toonId in self.air.doId2do: return self.air.doId2do[toonId] else: self.notify.warning('getToon() - toon: %d not in repository!' % toonId) @@ -741,7 +741,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas self.notify.warning('toon tried to run, but not found in activeToons: %d' % toonId) return for toon in self.activeToons: - if self.toonAttacks.has_key(toon): + if toon in self.toonAttacks: ta = self.toonAttacks[toon] track = ta[TOON_TRACK_COL] level = ta[TOON_LVL_COL] @@ -851,7 +851,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas return 1 def __removeAdjustingResponse(self, toonId): - if self.adjustingResponses.has_key(toonId): + if toonId in self.adjustingResponses: del self.adjustingResponses[toonId] if self.ignoreAdjustingResponses == 0 and len(self.toons) > 0: if self.__allAdjustingToonsResponded(): @@ -859,7 +859,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas def __addJoinResponse(self, avId, taskName, toon=0): if toon == 1: - for jr in self.joinResponses.values(): + for jr in list(self.joinResponses.values()): jr[avId] = 0 self.joinResponses[avId] = {} @@ -871,8 +871,8 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas def __removeJoinResponses(self, avId): self.__removeJoinResponse(avId) removedOne = 0 - for j in self.joinResponses.values(): - if j.has_key(avId): + for j in list(self.joinResponses.values()): + if avId in j: del j[avId] removedOne = 1 @@ -882,7 +882,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas self.__makeAvPending(t) def __removeJoinResponse(self, avId): - if self.joinResponses.has_key(avId): + if avId in self.joinResponses: taskMgr.remove(self.joinResponses[avId]['taskName']) del self.joinResponses[avId] @@ -895,7 +895,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas return 1 def __cleanupJoinResponses(self): - for jr in self.joinResponses.values(): + for jr in list(self.joinResponses.values()): taskMgr.remove(jr['taskName']) del jr @@ -993,11 +993,11 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas if self.toons.count(toonId) == 0: self.notify.warning('joinDone() - toon: %d not in toon list' % toonId) return - if not self.joinResponses.has_key(avId): + if avId not in self.joinResponses: self.notify.debug('joinDone() - no entry for: %d - ignoring: %d' % (avId, toonId)) return jr = self.joinResponses[avId] - if jr.has_key(toonId): + if toonId in jr: jr[toonId] += 1 self.notify.debug('client with localToon: %d done joining av: %d' % (toonId, avId)) if self.__allToonsRespondedJoin(avId): @@ -1037,9 +1037,9 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas toon = self.getToon(toonId) if toon == None: return - if toon.NPCFriendsDict.has_key(av): + if av in toon.NPCFriendsDict: npcCollision = 0 - if self.npcAttacks.has_key(av): + if av in self.npcAttacks: callingToon = self.npcAttacks[av] if self.activeToons.count(callingToon) == 1: self.toonAttacks[toonId] = getToonAttack(toonId, track=PASS) @@ -1060,7 +1060,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas elif track == UN_ATTACK: self.notify.debug('toon: %d changed its mind' % toonId) self.toonAttacks[toonId] = getToonAttack(toonId, track=UN_ATTACK) - if self.responses.has_key(toonId): + if toonId in self.responses: self.responses[toonId] = 0 validResponse = 0 elif track == PASS: @@ -1115,7 +1115,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas petId = toon.getPetId() zoneId = self.zoneId if petId == av: - if not self.pets.has_key(toonId): + if toonId not in self.pets: def handleGetPetProxy(success, petProxy, petId=petId, zoneId=zoneId, toonId=toonId): if success: @@ -1178,7 +1178,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas self.movieHasPlayed = 0 self.rewardHasPlayed = 0 for t in self.activeToons: - if not self.toonAttacks.has_key(t): + if t not in self.toonAttacks: self.toonAttacks[t] = getToonAttack(t) attack = self.toonAttacks[t] if attack[TOON_TRACK_COL] == PASS or attack[TOON_TRACK_COL] == UN_ATTACK: @@ -1322,7 +1322,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas suitsLuredOntoTraps = [] npcTrapAttacks = [] for activeToon in self.activeToons + self.exitedToons: - if self.toonAttacks.has_key(activeToon): + if activeToon in self.toonAttacks: attack = self.toonAttacks[activeToon] track = attack[TOON_TRACK_COL] npc_level = None @@ -1428,13 +1428,13 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas pass suit.battleTrap = NO_TRAP needUpdate = 1 - if trapDict.has_key(suit.doId): + if suit.doId in trapDict: del trapDict[suit.doId] if suitsLuredOntoTraps.count(suit) == 0: suitsLuredOntoTraps.append(suit) if track == TRAP: targetId = suit.doId - if trapDict.has_key(targetId): + if targetId in trapDict: trapDict[targetId].append(attack) else: trapDict[targetId] = [attack] @@ -1458,7 +1458,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas else: hp = hps[targetIndex] if track == TRAP: - if trapDict.has_key(targetId): + if targetId in trapDict: trapDict[targetId].append(attack) else: trapDict[targetId] = [attack] @@ -1468,7 +1468,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas pass target.battleTrap = NO_TRAP needUpdate = 1 - if trapDict.has_key(target.doId): + if target.doId in trapDict: del trapDict[target.doId] if suitsLuredOntoTraps.count(target) == 0: suitsLuredOntoTraps.append(target) @@ -1476,7 +1476,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas for otherSuit in self.activeSuits: if not otherSuit == target: otherSuit.battleTrap = NO_TRAP - if trapDict.has_key(otherSuit.doId): + if otherSuit.doId in trapDict: del trapDict[otherSuit.doId] died = attack[SUIT_DIED_COL] & 1 << targetIndex @@ -1485,7 +1485,7 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas deadSuits.append(target) self.exitedToons = [] - for suitKey in trapDict.keys(): + for suitKey in list(trapDict.keys()): attackList = trapDict[suitKey] attack = attackList[0] target = self.findSuit(attack[TOON_TGT_COL]) @@ -1674,13 +1674,13 @@ class DistributedBattleBaseAI(DistributedObjectAI.DistributedObjectAI, BattleBas msgName = '%s%s' % (cog, level) if encounter['isSkelecog']: msgName += '+' - if eventMsg.has_key(msgName): + if msgName in eventMsg: eventMsg[msgName] += 1 else: eventMsg[msgName] = 1 msgText = '' - for msgName, count in eventMsg.items(): + for msgName, count in list(eventMsg.items()): if msgText != '': msgText += ',' msgText += '%s%s' % (count, msgName) diff --git a/toontown/battle/DistributedBattleBldg.py b/toontown/battle/DistributedBattleBldg.py index d0f518e..50394e7 100644 --- a/toontown/battle/DistributedBattleBldg.py +++ b/toontown/battle/DistributedBattleBldg.py @@ -1,18 +1,18 @@ from pandac.PandaModules import * from libotp import * from direct.interval.IntervalGlobal import * -from BattleBase import * +from .BattleBase import * from direct.actor import Actor from toontown.suit import SuitDNA from direct.directnotify import DirectNotifyGlobal -import DistributedBattleBase +from . import DistributedBattleBase from toontown.toon import TTEmote from otp.avatar import Emote from toontown.toonbase import TTLocalizer -import MovieUtil +from . import MovieUtil from direct.fsm import State from toontown.suit import Suit -import SuitBattleGlobals +from . import SuitBattleGlobals import random from toontown.toonbase import ToontownGlobals diff --git a/toontown/battle/DistributedBattleBldgAI.py b/toontown/battle/DistributedBattleBldgAI.py index 8714592..8aa5b87 100644 --- a/toontown/battle/DistributedBattleBldgAI.py +++ b/toontown/battle/DistributedBattleBldgAI.py @@ -1,11 +1,11 @@ from otp.ai.AIBase import * from direct.distributed.ClockDelta import * -from BattleBase import * -from BattleCalculatorAI import * +from .BattleBase import * +from .BattleCalculatorAI import * from toontown.toonbase.ToontownBattleGlobals import * -from SuitBattleGlobals import * +from .SuitBattleGlobals import * from direct.showbase.PythonUtil import addListsByValue -import DistributedBattleBaseAI +from . import DistributedBattleBaseAI from direct.task import Task from direct.directnotify import DirectNotifyGlobal import random diff --git a/toontown/battle/DistributedBattleDiners.py b/toontown/battle/DistributedBattleDiners.py index a16efd0..0cc0dd4 100644 --- a/toontown/battle/DistributedBattleDiners.py +++ b/toontown/battle/DistributedBattleDiners.py @@ -40,7 +40,7 @@ class DistributedBattleDiners(DistributedBattleFinal.DistributedBattleFinal): def moveSuitsToInitialPos(self): battlePts = self.suitPoints[len(self.suitPendingPoints) - 1] - for i in xrange(len(self.suits)): + for i in range(len(self.suits)): suit = self.suits[i] suit.reparentTo(self) destPos, destHpr = self.getActorPosHpr(suit, self.suits) diff --git a/toontown/battle/DistributedBattleFinal.py b/toontown/battle/DistributedBattleFinal.py index 6e4a0c8..e853cf6 100644 --- a/toontown/battle/DistributedBattleFinal.py +++ b/toontown/battle/DistributedBattleFinal.py @@ -1,13 +1,13 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from BattleBase import * +from .BattleBase import * from direct.actor import Actor from toontown.distributed import DelayDelete from direct.directnotify import DirectNotifyGlobal -import DistributedBattleBase -import MovieUtil +from . import DistributedBattleBase +from . import MovieUtil from toontown.suit import Suit -import SuitBattleGlobals +from . import SuitBattleGlobals from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import ToontownGlobals from direct.fsm import State @@ -49,7 +49,7 @@ class DistributedBattleFinal(DistributedBattleBase.DistributedBattleBase): def setBossCogId(self, bossCogId): self.bossCogId = bossCogId - if base.cr.doId2do.has_key(bossCogId): + if bossCogId in base.cr.doId2do: tempBossCog = base.cr.doId2do[bossCogId] self.__gotBossCog([tempBossCog]) else: diff --git a/toontown/battle/DistributedBattleFinalAI.py b/toontown/battle/DistributedBattleFinalAI.py index 8aabc32..c4579a8 100644 --- a/toontown/battle/DistributedBattleFinalAI.py +++ b/toontown/battle/DistributedBattleFinalAI.py @@ -1,9 +1,9 @@ from otp.ai.AIBase import * -from BattleBase import * -from BattleCalculatorAI import * +from .BattleBase import * +from .BattleCalculatorAI import * from toontown.toonbase.ToontownBattleGlobals import * -from SuitBattleGlobals import * -import DistributedBattleBaseAI +from .SuitBattleGlobals import * +from . import DistributedBattleBaseAI from direct.task import Task from direct.directnotify import DirectNotifyGlobal from direct.fsm import State diff --git a/toontown/battle/DistributedBattleWaiters.py b/toontown/battle/DistributedBattleWaiters.py index 400675e..756d86c 100644 --- a/toontown/battle/DistributedBattleWaiters.py +++ b/toontown/battle/DistributedBattleWaiters.py @@ -43,7 +43,7 @@ class DistributedBattleWaiters(DistributedBattleFinal.DistributedBattleFinal): def moveSuitsToInitialPos(self): battlePts = self.suitPoints[len(self.suitPendingPoints) - 1] - for i in xrange(len(self.suits)): + for i in range(len(self.suits)): suit = self.suits[i] suit.reparentTo(self) destPos, destHpr = self.getActorPosHpr(suit, self.suits) diff --git a/toontown/battle/Fanfare.py b/toontown/battle/Fanfare.py index 25c0352..d93dedb 100644 --- a/toontown/battle/Fanfare.py +++ b/toontown/battle/Fanfare.py @@ -1,18 +1,18 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * from toontown.toon.ToonDNA import * from toontown.suit.SuitDNA import * from direct.particles.ParticleEffect import * from direct.gui.DirectGui import * from pandac.PandaModules import * -import MovieUtil -import MovieCamera +from . import MovieUtil +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal -import BattleParticles +from . import BattleParticles from toontown.toonbase import ToontownGlobals -import RewardPanel +from . import RewardPanel notify = DirectNotifyGlobal.directNotify.newCategory('Fanfare') def makePanel(toon, showToonName): diff --git a/toontown/battle/Movie.py b/toontown/battle/Movie.py index 5919df0..a50c94d 100644 --- a/toontown/battle/Movie.py +++ b/toontown/battle/Movie.py @@ -1,29 +1,29 @@ from toontown.toonbase.ToontownBattleGlobals import * -from BattleBase import * +from .BattleBase import * from direct.interval.IntervalGlobal import * from direct.showbase import DirectObject -import MovieFire -import MovieSOS -import MovieNPCSOS -import MoviePetSOS -import MovieHeal -import MovieTrap -import MovieLure -import MovieSound -import MovieThrow -import MovieSquirt -import MovieDrop -import MovieSuitAttacks -import MovieToonVictory -import PlayByPlayText -import BattleParticles +from . import MovieFire +from . import MovieSOS +from . import MovieNPCSOS +from . import MoviePetSOS +from . import MovieHeal +from . import MovieTrap +from . import MovieLure +from . import MovieSound +from . import MovieThrow +from . import MovieSquirt +from . import MovieDrop +from . import MovieSuitAttacks +from . import MovieToonVictory +from . import PlayByPlayText +from . import BattleParticles from toontown.distributed import DelayDelete -import BattleExperience -from SuitBattleGlobals import * +from . import BattleExperience +from .SuitBattleGlobals import * from direct.directnotify import DirectNotifyGlobal -import RewardPanel +from . import RewardPanel import random -import MovieUtil +from . import MovieUtil from toontown.toon import Toon from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog @@ -760,7 +760,7 @@ class Movie(DirectObject.DirectObject): adict['target'] = sdict adict['hpbonus'] = ta[TOON_HPBONUS_COL] adict['sidestep'] = ta[TOON_ACCBONUS_COL] - if adict.has_key('npcId'): + if 'npcId' in adict: adict['sidestep'] = 0 adict['battle'] = self.battle adict['playByPlayText'] = self.playByPlayText @@ -785,7 +785,7 @@ class Movie(DirectObject.DirectObject): setCapture = 0 tp = [] for ta in self.toonAttackDicts: - if ta['track'] == track or track == NPCSOS and ta.has_key('special'): + if ta['track'] == track or track == NPCSOS and 'special' in ta: tp.append(ta) if track == SQUIRT: setCapture = 1 @@ -793,11 +793,11 @@ class Movie(DirectObject.DirectObject): if track == TRAP: sortedTraps = [] for attack in tp: - if not attack.has_key('npcId'): + if 'npcId' not in attack: sortedTraps.append(attack) for attack in tp: - if attack.has_key('npcId'): + if 'npcId' in attack: sortedTraps.append(attack) tp = sortedTraps diff --git a/toontown/battle/MovieCamera.py b/toontown/battle/MovieCamera.py index 234cddb..c131a69 100644 --- a/toontown/battle/MovieCamera.py +++ b/toontown/battle/MovieCamera.py @@ -1,12 +1,12 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * +from .BattleBase import * +from .BattleProps import * from toontown.toonbase.ToontownBattleGlobals import * -from SuitBattleGlobals import * +from .SuitBattleGlobals import * from direct.directnotify import DirectNotifyGlobal import random -import MovieUtil +from . import MovieUtil notify = DirectNotifyGlobal.directNotify.newCategory('MovieCamera') def chooseHealShot(heals, attackDuration): @@ -16,7 +16,7 @@ def chooseHealShot(heals, attackDuration): isUber = 1 if isUber: - print 'is uber' + print('is uber') openShot = chooseHealOpenShot(heals, attackDuration, isUber) openDuration = openShot.getDuration() openName = openShot.getName() @@ -38,7 +38,7 @@ def chooseHealOpenShot(heals, attackDuration, isUber = 0): if isUber: duration = 5.0 shotChoices = [toonGroupShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -49,7 +49,7 @@ def chooseHealMidShot(heals, attackDuration, isUber = 0): if isUber: duration = 2.1 shotChoices = [toonGroupHighShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -59,7 +59,7 @@ def chooseHealCloseShot(heals, openDuration, openName, attackDuration, isUber = shotChoices = [toonGroupShot] if isUber: shotChoices = [allGroupLowShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -79,7 +79,7 @@ def chooseTrapOpenShot(traps, attackDuration): av = None duration = 3.0 shotChoices = [allGroupLowShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -87,7 +87,7 @@ def chooseTrapCloseShot(traps, openDuration, openName, attackDuration): av = None duration = attackDuration - openDuration shotChoices = [allGroupLowShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -107,7 +107,7 @@ def chooseLureOpenShot(lures, attackDuration): av = None duration = 3.0 shotChoices = [allGroupLowShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -125,7 +125,7 @@ def chooseLureCloseShot(lures, openDuration, openName, attackDuration): av = lures[0]['toon'] else: shotChoices = [allGroupLowShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -160,7 +160,7 @@ def chooseSoundOpenShot(sounds, targets, attackDuration): shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of sounds: %s' % numSounds) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -178,7 +178,7 @@ def chooseSoundCloseShot(sounds, targets, openDuration, openName, attackDuration shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of suits: %s' % numSuits) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -206,7 +206,7 @@ def chooseThrowOpenShot(throws, suitThrowsDict, attackDuration): shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of throws: %s' % numThrows) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -215,7 +215,7 @@ def chooseThrowCloseShot(throws, suitThrowsDict, openDuration, openName, attackD av = None duration = attackDuration - openDuration if numSuits == 1: - av = base.cr.doId2do[suitThrowsDict.keys()[0]] + av = base.cr.doId2do[list(suitThrowsDict.keys())[0]] shotChoices = [avatarCloseUpThrowShot, avatarCloseUpThreeQuarterLeftShot, allGroupLowShot, @@ -224,7 +224,7 @@ def chooseThrowCloseShot(throws, suitThrowsDict, openDuration, openName, attackD shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of suits: %s' % numSuits) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -252,7 +252,7 @@ def chooseSquirtOpenShot(squirts, suitSquirtsDict, attackDuration): shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of squirts: %s' % numSquirts) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -261,7 +261,7 @@ def chooseSquirtCloseShot(squirts, suitSquirtsDict, openDuration, openName, atta av = None duration = attackDuration - openDuration if numSuits == 1: - av = base.cr.doId2do[suitSquirtsDict.keys()[0]] + av = base.cr.doId2do[list(suitSquirtsDict.keys())[0]] shotChoices = [avatarCloseUpThrowShot, avatarCloseUpThreeQuarterLeftShot, allGroupLowShot, @@ -270,7 +270,7 @@ def chooseSquirtCloseShot(squirts, suitSquirtsDict, openDuration, openName, atta shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of suits: %s' % numSuits) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -300,7 +300,7 @@ def chooseDropOpenShot(drops, suitDropsDict, attackDuration): shotChoices = [allGroupLowShot, suitGroupThreeQuarterLeftBehindShot] else: notify.error('Bad number of drops: %s' % numDrops) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -309,7 +309,7 @@ def chooseDropCloseShot(drops, suitDropsDict, openDuration, openName, attackDura av = None duration = attackDuration - openDuration if numSuits == 1: - av = base.cr.doId2do[suitDropsDict.keys()[0]] + av = base.cr.doId2do[list(suitDropsDict.keys())[0]] shotChoices = [avatarCloseUpThrowShot, avatarCloseUpThreeQuarterLeftShot, allGroupLowShot, @@ -327,7 +327,7 @@ def chooseNPCEnterShot(enters, entersDuration): av = None duration = entersDuration shotChoices = [toonGroupShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -335,7 +335,7 @@ def chooseNPCExitShot(exits, exitsDuration): av = None duration = exitsDuration shotChoices = [toonGroupShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -522,7 +522,7 @@ def chooseSuitCloseShot(attack, openDuration, openName, attackDuration): diedTrack = pbpText.getToonsDiedInterval(diedTextList, duration) else: notify.error('Bad groupStatus: %s' % groupStatus) - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) if diedTrack == None: return track else: @@ -568,7 +568,7 @@ def chooseSOSShot(av, duration): avatarBehindShot, avatarBehindHighShot, suitGroupThreeQuarterLeftBehindShot] - track = apply(random.choice(shotChoices), [av, duration]) + track = random.choice(shotChoices)(*[av, duration]) return track @@ -894,7 +894,7 @@ def randomCameraSelection(suit, attack, attackDuration, openShotDuration): if openShotDuration > attackDuration: openShotDuration = attackDuration closeShotDuration = attackDuration - openShotDuration - openShot = apply(random.choice(shotChoices), [suit, openShotDuration]) + openShot = random.choice(shotChoices)(*[suit, openShotDuration]) closeShot = chooseSuitCloseShot(attack, closeShotDuration, openShot.getName(), attackDuration) return Sequence(openShot, closeShot) @@ -946,8 +946,8 @@ def chooseFireOpenShot(throws, suitThrowsDict, attackDuration): else: notify.error('Bad number of throws: %s' % numThrows) shotChoice = random.choice(shotChoices) - track = apply(shotChoice, [av, duration]) - print 'chooseFireOpenShot %s' % shotChoice + track = shotChoice(*[av, duration]) + print('chooseFireOpenShot %s' % shotChoice) return track @@ -956,7 +956,7 @@ def chooseFireCloseShot(throws, suitThrowsDict, openDuration, openName, attackDu av = None duration = attackDuration - openDuration if numSuits == 1: - av = base.cr.doId2do[suitThrowsDict.keys()[0]] + av = base.cr.doId2do[list(suitThrowsDict.keys())[0]] shotChoices = [avatarCloseUpFireShot, avatarCloseUpThreeQuarterLeftFireShot, allGroupLowShot, @@ -966,8 +966,8 @@ def chooseFireCloseShot(throws, suitThrowsDict, openDuration, openName, attackDu else: notify.error('Bad number of suits: %s' % numSuits) shotChoice = random.choice(shotChoices) - track = apply(shotChoice, [av, duration]) - print 'chooseFireOpenShot %s' % shotChoice + track = shotChoice(*[av, duration]) + print('chooseFireOpenShot %s' % shotChoice) return track diff --git a/toontown/battle/MovieDrop.py b/toontown/battle/MovieDrop.py index 05e9c0b..084e758 100644 --- a/toontown/battle/MovieDrop.py +++ b/toontown/battle/MovieDrop.py @@ -1,12 +1,12 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * -import MovieCamera +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal -import MovieUtil -import MovieNPCSOS -from MovieUtil import calcAvgSuitPos +from . import MovieUtil +from . import MovieNPCSOS +from .MovieUtil import calcAvgSuitPos from direct.showutil import Effects notify = DirectNotifyGlobal.directNotify.newCategory('MovieDrop') hitSoundFiles = ('AA_drop_flowerpot.mp3', 'AA_drop_sandbag.mp3', 'AA_drop_anvil.mp3', 'AA_drop_bigweight.mp3', 'AA_drop_safe.mp3', 'AA_drop_piano.mp3', 'AA_drop_boat.mp3') @@ -38,7 +38,7 @@ def doDrops(drops): targets = drop['target'] if len(targets) == 1: suitId = targets[0]['suit'].doId - if suitDropsDict.has_key(suitId): + if suitId in suitDropsDict: suitDropsDict[suitId].append((drop, targets[0])) else: suitDropsDict[suitId] = [(drop, targets[0])] @@ -47,7 +47,7 @@ def doDrops(drops): else: for target in targets: suitId = target['suit'].doId - if suitDropsDict.has_key(suitId): + if suitId in suitDropsDict: otherDrops = suitDropsDict[suitId] alreadyInList = 0 for oDrop in otherDrops: @@ -59,7 +59,7 @@ def doDrops(drops): else: suitDropsDict[suitId] = [(drop, target)] - suitDrops = suitDropsDict.values() + suitDrops = list(suitDropsDict.values()) def compFunc(a, b): if len(a) > len(b): @@ -217,9 +217,9 @@ def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased, npcs toon = drop['toon'] repeatNPC = 0 battle = drop['battle'] - if drop.has_key('npc'): + if 'npc' in drop: toon = drop['npc'] - if npcDrops.has_key(toon): + if toon in npcDrops: repeatNPC = 1 else: npcDrops[toon] = 1 @@ -379,7 +379,7 @@ def __dropObject(drop, delay, objName, level, alreadyDodged, alreadyTeased, npcs def __createSuitTrack(drop, delay, level, alreadyDodged, alreadyTeased, target, npcs): toon = drop['toon'] - if drop.has_key('npc'): + if 'npc' in drop: toon = drop['npc'] battle = drop['battle'] majorObject = level >= 3 diff --git a/toontown/battle/MovieFire.py b/toontown/battle/MovieFire.py index 8d4157a..a87871f 100644 --- a/toontown/battle/MovieFire.py +++ b/toontown/battle/MovieFire.py @@ -1,15 +1,15 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * from toontown.toon.ToonDNA import * from toontown.suit.SuitDNA import * from direct.directnotify import DirectNotifyGlobal import random -import MovieCamera -import MovieUtil -from MovieUtil import calcAvgSuitPos +from . import MovieCamera +from . import MovieUtil +from .MovieUtil import calcAvgSuitPos notify = DirectNotifyGlobal.directNotify.newCategory('MovieThrow') hitSoundFiles = ('AA_tart_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_wholepie_only.mp3', 'AA_wholepie_only.mp3') tPieLeavesHand = 2.7 @@ -20,7 +20,7 @@ tPieShrink = 0.7 pieFlyTaskName = 'MovieThrow-pieFly' def addHit(dict, suitId, hitCount): - if dict.has_key(suitId): + if suitId in dict: dict[suitId] += hitCount else: dict[suitId] = hitCount @@ -33,12 +33,12 @@ def doFires(fires): suitFiresDict = {} for fire in fires: suitId = fire['target']['suit'].doId - if suitFiresDict.has_key(suitId): + if suitId in suitFiresDict: suitFiresDict[suitId].append(fire) else: suitFiresDict[suitId] = [fire] - suitFires = suitFiresDict.values() + suitFires = list(suitFiresDict.values()) def compFunc(a, b): if len(a) > len(b): return 1 diff --git a/toontown/battle/MovieHeal.py b/toontown/battle/MovieHeal.py index f02d7a6..0bd14e7 100644 --- a/toontown/battle/MovieHeal.py +++ b/toontown/battle/MovieHeal.py @@ -1,17 +1,17 @@ from direct.interval.IntervalGlobal import * -from BattleProps import * -from BattleSounds import * -from BattleBase import * +from .BattleProps import * +from .BattleSounds import * +from .BattleBase import * from direct.directnotify import DirectNotifyGlobal -import MovieCamera +from . import MovieCamera import random -import MovieUtil -import BattleParticles -import HealJokes +from . import MovieUtil +from . import BattleParticles +from . import HealJokes from toontown.toonbase import TTLocalizer from toontown.toonbase.ToontownBattleGlobals import AvPropDamage from toontown.toon import NPCToons -import MovieNPCSOS +from . import MovieNPCSOS from toontown.effects import Splash from direct.task import Task notify = DirectNotifyGlobal.directNotify.newCategory('MovieHeal') @@ -166,7 +166,7 @@ def __healTickle(heal, hasInteractivePropHealBonus): def __healJoke(heal, hasInteractivePropHealBonus): npcId = 0 - if heal.has_key('npcId'): + if 'npcId' in heal: npcId = heal['npcId'] toon = NPCToons.createLocalNPC(npcId) if toon == None: @@ -257,7 +257,7 @@ def __healSmooch(heal, hasInteractivePropHealBonus): def __healDance(heal, hasInteractivePropHealBonus): npcId = 0 - if heal.has_key('npcId'): + if 'npcId' in heal: npcId = heal['npcId'] toon = NPCToons.createLocalNPC(npcId) if toon == None: @@ -340,7 +340,7 @@ def __healSprinkle(heal, hasInteractivePropHealBonus): def __healJuggle(heal, hasInteractivePropHealBonus): npcId = 0 - if heal.has_key('npcId'): + if 'npcId' in heal: npcId = heal['npcId'] toon = NPCToons.createLocalNPC(npcId) if toon == None: @@ -388,7 +388,7 @@ def __healDive(heal, hasInteractivePropHealBonus): splash = Splash.Splash(render) splash.reparentTo(render) npcId = 0 - if heal.has_key('npcId'): + if 'npcId' in heal: npcId = heal['npcId'] toon = NPCToons.createLocalNPC(npcId) if toon == None: diff --git a/toontown/battle/MovieLure.py b/toontown/battle/MovieLure.py index 1eeab41..d17c052 100644 --- a/toontown/battle/MovieLure.py +++ b/toontown/battle/MovieLure.py @@ -1,16 +1,16 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * +from .BattleBase import * +from .BattleProps import * from toontown.suit.SuitBase import * from toontown.toon.ToonDNA import * -from BattleSounds import * -import MovieCamera +from .BattleSounds import * +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal -import MovieUtil +from . import MovieUtil from toontown.toonbase import ToontownBattleGlobals -import BattleParticles -import BattleProps -import MovieNPCSOS +from . import BattleParticles +from . import BattleProps +from . import MovieNPCSOS notify = DirectNotifyGlobal.directNotify.newCategory('MovieLures') def safeWrtReparentTo(nodePath, parent): @@ -129,7 +129,7 @@ def __createFishingPoleMultiTrack(lure, dollar, dollarName): def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1, npcs = []): toon = lure['toon'] - if lure.has_key('npc'): + if 'npc' in lure: toon = lure['npc'] battle = lure['battle'] sidestep = lure['sidestep'] @@ -189,7 +189,7 @@ def __createMagnetMultiTrack(lure, magnet, pos, hpr, scale, isSmallMagnet = 1, n def __createHypnoGogglesMultiTrack(lure, npcs = []): toon = lure['toon'] - if lure.has_key('npc'): + if 'npc' in lure: toon = lure['npc'] targets = lure['target'] battle = lure['battle'] diff --git a/toontown/battle/MovieNPCSOS.py b/toontown/battle/MovieNPCSOS.py index a444775..48e9d5d 100644 --- a/toontown/battle/MovieNPCSOS.py +++ b/toontown/battle/MovieNPCSOS.py @@ -1,12 +1,12 @@ from direct.interval.IntervalGlobal import * -from BattleProps import * -from BattleSounds import * +from .BattleProps import * +from .BattleSounds import * from direct.directnotify import DirectNotifyGlobal -import MovieCamera +from . import MovieCamera import random -import MovieUtil -import BattleParticles -import HealJokes +from . import MovieUtil +from . import BattleParticles +from . import HealJokes from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals from toontown.toon import NPCToons @@ -241,7 +241,7 @@ def doNPCTeleports(attacks): arrivals = Sequence() departures = Parallel() for attack in attacks: - if attack.has_key('npcId'): + if 'npcId' in attack: npcId = attack['npcId'] npc = NPCToons.createLocalNPC(npcId) if npc != None: diff --git a/toontown/battle/MoviePetSOS.py b/toontown/battle/MoviePetSOS.py index c0f3887..bb8cc44 100644 --- a/toontown/battle/MoviePetSOS.py +++ b/toontown/battle/MoviePetSOS.py @@ -1,12 +1,12 @@ from direct.interval.IntervalGlobal import * -from BattleProps import * -from BattleSounds import * +from .BattleProps import * +from .BattleSounds import * from direct.directnotify import DirectNotifyGlobal -import MovieCamera +from . import MovieCamera import random -import MovieUtil -import BattleParticles -import HealJokes +from . import MovieUtil +from . import BattleParticles +from . import HealJokes from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals from toontown.pets import Pet, PetTricks @@ -89,7 +89,7 @@ def __healJuggle(heal): petProxyId = heal['petId'] pet = Pet.Pet() gender = 0 - if base.cr.doId2do.has_key(petProxyId): + if petProxyId in base.cr.doId2do: petProxy = base.cr.doId2do[petProxyId] if petProxy == None: return diff --git a/toontown/battle/MovieSOS.py b/toontown/battle/MovieSOS.py index 8cfa7e5..f02f0be 100644 --- a/toontown/battle/MovieSOS.py +++ b/toontown/battle/MovieSOS.py @@ -1,5 +1,5 @@ from direct.interval.IntervalGlobal import * -import MovieCamera +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer from pandac.PandaModules import * diff --git a/toontown/battle/MovieSound.py b/toontown/battle/MovieSound.py index 2a4bcdd..c4c8e92 100644 --- a/toontown/battle/MovieSound.py +++ b/toontown/battle/MovieSound.py @@ -1,13 +1,13 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * -import BattleParticles -from RewardPanel import * -import MovieCamera +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * +from . import BattleParticles +from .RewardPanel import * +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal -import MovieUtil -import MovieNPCSOS +from . import MovieUtil +from . import MovieNPCSOS from toontown.toonbase import ToontownBattleGlobals notify = DirectNotifyGlobal.directNotify.newCategory('MovieSound') soundFiles = ('AA_sound_bikehorn.mp3', 'AA_sound_whistle.mp3', 'AA_sound_bugle.mp3', 'AA_sound_aoogah.mp3', 'AA_sound_elephant.mp3', 'SZ_DD_foghorn.mp3', 'AA_sound_Opera_Singer.mp3') @@ -129,7 +129,7 @@ def __doSoundsLevel(sounds, delay, hitCount, npcs): deathTracks = Parallel() for sound in sounds: toon = sound['toon'] - if sound.has_key('npc'): + if 'npc' in sound: toon = sound['npc'] level = sound['level'] targets = sound['target'] diff --git a/toontown/battle/MovieSquirt.py b/toontown/battle/MovieSquirt.py index 8f1151e..600a2e0 100644 --- a/toontown/battle/MovieSquirt.py +++ b/toontown/battle/MovieSquirt.py @@ -1,13 +1,13 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * from toontown.toon.ToonDNA import * from toontown.suit.SuitDNA import * -import MovieUtil -import MovieCamera +from . import MovieUtil +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal -import BattleParticles +from . import BattleParticles from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals import random @@ -38,18 +38,18 @@ def doSquirts(squirts): if 1: target = squirt['target'][0] suitId = target['suit'].doId - if suitSquirtsDict.has_key(suitId): + if suitId in suitSquirtsDict: suitSquirtsDict[suitId].append(squirt) else: suitSquirtsDict[suitId] = [squirt] else: suitId = squirt['target']['suit'].doId - if suitSquirtsDict.has_key(suitId): + if suitId in suitSquirtsDict: suitSquirtsDict[suitId].append(squirt) else: suitSquirtsDict[suitId] = [squirt] - suitSquirts = suitSquirtsDict.values() + suitSquirts = list(suitSquirtsDict.values()) def compFunc(a, b): if len(a) > len(b): @@ -221,7 +221,7 @@ def __getSuitTrack(suit, tContact, tDodge, hp, hpbonus, kbbonus, anim, died, lef def say(statement): - print statement + print(statement) def __getSoundTrack(level, hitSuit, delay, node = None): diff --git a/toontown/battle/MovieSuitAttacks.py b/toontown/battle/MovieSuitAttacks.py index 53be49a..d092685 100644 --- a/toontown/battle/MovieSuitAttacks.py +++ b/toontown/battle/MovieSuitAttacks.py @@ -1,17 +1,17 @@ from libotp import * from toontown.toonbase.ToontownGlobals import * -from SuitBattleGlobals import * +from .SuitBattleGlobals import * from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * +from .BattleBase import * +from .BattleProps import * from toontown.suit.SuitDNA import * -from BattleBase import * -from BattleSounds import * -import MovieCamera +from .BattleBase import * +from .BattleSounds import * +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal -import MovieUtil +from . import MovieUtil from direct.particles import ParticleEffect -import BattleParticles +from . import BattleParticles from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer notify = DirectNotifyGlobal.directNotify.newCategory('MovieSuitAttacks') @@ -1592,8 +1592,8 @@ def doReOrg(attack): partTrack = getPartTrack(sprayEffect, 1.0, 1.9, [sprayEffect, suit, 0]) if dmg > 0: headParts = toon.getHeadParts() - print '***********headParts pos=', headParts[0].getPos() - print '***********headParts hpr=', headParts[0].getHpr() + print('***********headParts pos=', headParts[0].getPos()) + print('***********headParts hpr=', headParts[0].getHpr()) headTracks = Parallel() for partNum in range(0, headParts.getNumPaths()): part = headParts.getPath(partNum) @@ -1613,7 +1613,7 @@ def doReOrg(attack): arms = toon.findAllMatches('**/arms') sleeves = toon.findAllMatches('**/sleeves') hands = toon.findAllMatches('**/hands') - print '*************arms hpr=', arms[0].getHpr() + print('*************arms hpr=', arms[0].getHpr()) for partNum in range(0, arms.getNumPaths()): chestTracks.append(getChestTrack(arms.getPath(partNum))) chestTracks.append(getChestTrack(sleeves.getPath(partNum))) diff --git a/toontown/battle/MovieThrow.py b/toontown/battle/MovieThrow.py index 5916b5a..55822f7 100644 --- a/toontown/battle/MovieThrow.py +++ b/toontown/battle/MovieThrow.py @@ -1,15 +1,15 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * from toontown.toon.ToonDNA import * from toontown.suit.SuitDNA import * from direct.directnotify import DirectNotifyGlobal import random -import MovieCamera -import MovieUtil -from MovieUtil import calcAvgSuitPos +from . import MovieCamera +from . import MovieUtil +from .MovieUtil import calcAvgSuitPos notify = DirectNotifyGlobal.directNotify.newCategory('MovieThrow') hitSoundFiles = ('AA_tart_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_slice_only.mp3', 'AA_wholepie_only.mp3', 'AA_wholepie_only.mp3') tPieLeavesHand = 2.7 @@ -20,7 +20,7 @@ tPieShrink = 0.7 pieFlyTaskName = 'MovieThrow-pieFly' def addHit(dict, suitId, hitCount): - if dict.has_key(suitId): + if suitId in dict: dict[suitId] += hitCount else: dict[suitId] = hitCount @@ -35,12 +35,12 @@ def doThrows(throws): pass else: suitId = throw['target']['suit'].doId - if suitThrowsDict.has_key(suitId): + if suitId in suitThrowsDict: suitThrowsDict[suitId].append(throw) else: suitThrowsDict[suitId] = [throw] - suitThrows = suitThrowsDict.values() + suitThrows = list(suitThrowsDict.values()) def compFunc(a, b): if len(a) > len(b): @@ -574,7 +574,7 @@ def __throwGroupPie(throw, delay, groupHitDict): singleSuitResponseTrack.append(Func(suit.loop, 'neutral')) singleSuitResponseTrack = Parallel(singleSuitResponseTrack, bonusTrack) else: - groupHitValues = groupHitDict.values() + groupHitValues = list(groupHitDict.values()) if groupHitValues.count(0) == len(groupHitValues): singleSuitResponseTrack = MovieUtil.createSuitDodgeMultitrack(delay + tSuitDodges, suit, leftSuits, rightSuits) else: diff --git a/toontown/battle/MovieToonVictory.py b/toontown/battle/MovieToonVictory.py index 705de6a..03e3f26 100644 --- a/toontown/battle/MovieToonVictory.py +++ b/toontown/battle/MovieToonVictory.py @@ -1,9 +1,9 @@ from libotp import * from direct.interval.IntervalGlobal import * from direct.showbase.DirectObject import DirectObject -from RewardPanel import * -from BattleSounds import * -import MovieCamera +from .RewardPanel import * +from .BattleSounds import * +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal import types notify = DirectNotifyGlobal.directNotify.newCategory('MovieToonVictory') @@ -84,7 +84,7 @@ def doToonVictory(localToonActive, toons, rewardToonIds, rewardDicts, deathList, countToons = 0 uberListNew = [] for t in toons: - if isinstance(t, types.IntType): + if isinstance(t, int): t = base.cr.doId2do.get(t) if t: toonList.append(t) diff --git a/toontown/battle/MovieTrap.py b/toontown/battle/MovieTrap.py index a5c703a..07d6d80 100644 --- a/toontown/battle/MovieTrap.py +++ b/toontown/battle/MovieTrap.py @@ -1,17 +1,17 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * -from BattleSounds import * -import MovieUtil -import MovieCamera +from .BattleBase import * +from .BattleProps import * +from .BattleSounds import * +from . import MovieUtil +from . import MovieCamera from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownBattleGlobals from direct.actor import Actor from direct.particles import ParticleEffect -import BattleParticles -import BattleProps -import MovieNPCSOS -from MovieSound import createSuitResetPosTrack +from . import BattleParticles +from . import BattleProps +from . import MovieNPCSOS +from .MovieSound import createSuitResetPosTrack notify = DirectNotifyGlobal.directNotify.newCategory('MovieTrap') def doTraps(traps): @@ -24,14 +24,14 @@ def doTraps(traps): targets = trap['target'] if len(targets) == 1: suitId = targets[0]['suit'].doId - if suitTrapsDict.has_key(suitId): + if suitId in suitTrapsDict: suitTrapsDict[suitId].append(trap) else: suitTrapsDict[suitId] = [trap] else: for target in targets: suitId = target['suit'].doId - if not suitTrapsDict.has_key(suitId): + if suitId not in suitTrapsDict: suitTrapsDict[suitId] = [trap] break @@ -43,7 +43,7 @@ def doTraps(traps): if suit.battleTrap != NO_TRAP: hasUberTrapConflict = True - suitTrapLists = suitTrapsDict.values() + suitTrapLists = list(suitTrapsDict.values()) mtrack = Parallel() for trapList in suitTrapLists: trapPropList = [] @@ -280,7 +280,7 @@ def __createThrownTrapMultiTrack(trap, propList, propName, propPos = None, propH def __createPlacedTrapMultiTrack(trap, prop, propName, propPos = None, propHpr = None, explode = 0, visibleOnlyForThisSuitId = None): toon = trap['toon'] - if trap.has_key('npc'): + if 'npc' in trap: toon = trap['npc'] level = trap['level'] battle = trap['battle'] @@ -387,7 +387,7 @@ def __trapQuicksand(trap, trapProps, explode): def __trapTrapdoor(trap, trapProps, explode): toon = trap['toon'] - if trap.has_key('npc'): + if 'npc' in trap: toon = trap['npc'] targets = trap['target'] for target in targets: @@ -408,7 +408,7 @@ def __trapTNT(trap, trapProps, explode): def __trapTrain(trap, trapProps, explode): toon = trap['toon'] - if trap.has_key('npc'): + if 'npc' in trap: toon = trap['npc'] targets = trap['target'] battle = trap['battle'] @@ -477,7 +477,7 @@ def createCartoonExplosionTrack(parent, animName, explosionPoint = None): def __createPlacedGroupTrapTrack(trap, prop, propName, centerSuit, propPos = None, propHpr = None, explode = 0): toon = trap['toon'] - if trap.has_key('npc'): + if 'npc' in trap: toon = trap['npc'] level = trap['level'] battle = trap['battle'] diff --git a/toontown/battle/MovieUtil.py b/toontown/battle/MovieUtil.py index 1068e72..7e5d48a 100644 --- a/toontown/battle/MovieUtil.py +++ b/toontown/battle/MovieUtil.py @@ -1,11 +1,11 @@ from direct.interval.IntervalGlobal import * -from BattleBase import * -from BattleProps import * +from .BattleBase import * +from .BattleProps import * from direct.directnotify import DirectNotifyGlobal import random from direct.particles import ParticleEffect -import BattleParticles -import BattleProps +from . import BattleParticles +from . import BattleProps from toontown.toonbase import TTLocalizer notify = DirectNotifyGlobal.directNotify.newCategory('MovieUtil') SUIT_LOSE_DURATION = 6.0 diff --git a/toontown/battle/PlayByPlayText.py b/toontown/battle/PlayByPlayText.py index 00fe9e5..b48cbff 100644 --- a/toontown/battle/PlayByPlayText.py +++ b/toontown/battle/PlayByPlayText.py @@ -2,12 +2,12 @@ from pandac.PandaModules import * from toontown.toonbase import TTLocalizer from toontown.toonbase.ToontownBattleGlobals import * from toontown.toonbase.ToontownGlobals import * -from SuitBattleGlobals import * +from .SuitBattleGlobals import * from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal import string from direct.gui import OnscreenText -import BattleBase +from . import BattleBase class PlayByPlayText(OnscreenText.OnscreenText): notify = DirectNotifyGlobal.directNotify.newCategory('PlayByPlayText') diff --git a/toontown/battle/RewardPanel.py b/toontown/battle/RewardPanel.py index 9736403..0a4db0a 100644 --- a/toontown/battle/RewardPanel.py +++ b/toontown/battle/RewardPanel.py @@ -3,7 +3,7 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.toonbase import ToontownBattleGlobals -import BattleBase +from . import BattleBase from direct.directnotify import DirectNotifyGlobal import random import string @@ -16,7 +16,7 @@ from toontown.toon import NPCToons import math from toontown.coghq import CogDisguiseGlobals from toontown.shtiker import DisguisePage -import Fanfare +from . import Fanfare from otp.otpbase import OTPGlobals class RewardPanel(DirectFrame): @@ -303,7 +303,7 @@ class RewardPanel(DirectFrame): def getRandomCongratsPair(self, toon): congratsStrings = TTLocalizer.RewardPanelCongratsStrings numStrings = len(congratsStrings) - indexList = range(numStrings) + indexList = list(range(numStrings)) index1 = random.choice(indexList) indexList.remove(index1) index2 = random.choice(indexList) @@ -445,7 +445,7 @@ class RewardPanel(DirectFrame): def getTrackIntervalList(self, toon, track, origSkill, earnedSkill, hasUber, guestWaste = 0): if hasUber < 0: - print (toon.doId, 'Reward Panel received an invalid hasUber from an uberList') + print((toon.doId, 'Reward Panel received an invalid hasUber from an uberList')) tickDelay = 1.0 / 60 intervalList = [] if origSkill + earnedSkill >= ToontownBattleGlobals.UnpaidMaxSkills[track] and toon.getGameAccess() != OTPGlobals.AccessFull: diff --git a/toontown/battle/SuitBattleGlobals.py b/toontown/battle/SuitBattleGlobals.py index ec0b656..bb2dcbd 100644 --- a/toontown/battle/SuitBattleGlobals.py +++ b/toontown/battle/SuitBattleGlobals.py @@ -1,4 +1,4 @@ -from BattleBase import * +from .BattleBase import * import random from direct.directnotify import DirectNotifyGlobal from otp.otpbase import OTPLocalizer @@ -77,7 +77,7 @@ def pickSuitAttack(attacks, suitLevel): return attackNum elif configAttackName == 'sequence': for i in range(len(attacks)): - if not debugAttackSequence.has_key(attacks[i]): + if attacks[i] not in debugAttackSequence: debugAttackSequence[attacks[i]] = 1 return i @@ -101,7 +101,7 @@ def getSuitAttack(suitName, suitLevel, attackNum = -1): adict['suitName'] = suitName name = attack[0] adict['name'] = name - adict['id'] = SuitAttacks.keys().index(name) + adict['id'] = list(SuitAttacks.keys()).index(name) adict['animName'] = SuitAttacks[name][0] adict['hp'] = attack[1][suitLevel] adict['acc'] = attack[2][suitLevel] @@ -2953,76 +2953,76 @@ SuitAttacks = {'Audit': ('phone', ATK_TGT_SINGLE), 'Watercooler': ('watercooler', ATK_TGT_SINGLE), 'Withdrawal': ('magic1', ATK_TGT_SINGLE), 'WriteOff': ('hold-pencil', ATK_TGT_SINGLE)} -AUDIT = SuitAttacks.keys().index('Audit') -BITE = SuitAttacks.keys().index('Bite') -BOUNCE_CHECK = SuitAttacks.keys().index('BounceCheck') -BRAIN_STORM = SuitAttacks.keys().index('BrainStorm') -BUZZ_WORD = SuitAttacks.keys().index('BuzzWord') -CALCULATE = SuitAttacks.keys().index('Calculate') -CANNED = SuitAttacks.keys().index('Canned') -CHOMP = SuitAttacks.keys().index('Chomp') -CIGAR_SMOKE = SuitAttacks.keys().index('CigarSmoke') -CLIPON_TIE = SuitAttacks.keys().index('ClipOnTie') -CRUNCH = SuitAttacks.keys().index('Crunch') -DEMOTION = SuitAttacks.keys().index('Demotion') -DOWNSIZE = SuitAttacks.keys().index('Downsize') -DOUBLE_TALK = SuitAttacks.keys().index('DoubleTalk') -EVICTION_NOTICE = SuitAttacks.keys().index('EvictionNotice') -EVIL_EYE = SuitAttacks.keys().index('EvilEye') -FILIBUSTER = SuitAttacks.keys().index('Filibuster') -FILL_WITH_LEAD = SuitAttacks.keys().index('FillWithLead') -FINGER_WAG = SuitAttacks.keys().index('FingerWag') -FIRED = SuitAttacks.keys().index('Fired') -FIVE_O_CLOCK_SHADOW = SuitAttacks.keys().index('FiveOClockShadow') -FLOOD_THE_MARKET = SuitAttacks.keys().index('FloodTheMarket') -FOUNTAIN_PEN = SuitAttacks.keys().index('FountainPen') -FREEZE_ASSETS = SuitAttacks.keys().index('FreezeAssets') -GAVEL = SuitAttacks.keys().index('Gavel') -GLOWER_POWER = SuitAttacks.keys().index('GlowerPower') -GUILT_TRIP = SuitAttacks.keys().index('GuiltTrip') -HALF_WINDSOR = SuitAttacks.keys().index('HalfWindsor') -HANG_UP = SuitAttacks.keys().index('HangUp') -HEAD_SHRINK = SuitAttacks.keys().index('HeadShrink') -HOT_AIR = SuitAttacks.keys().index('HotAir') -JARGON = SuitAttacks.keys().index('Jargon') -LEGALESE = SuitAttacks.keys().index('Legalese') -LIQUIDATE = SuitAttacks.keys().index('Liquidate') -MARKET_CRASH = SuitAttacks.keys().index('MarketCrash') -MUMBO_JUMBO = SuitAttacks.keys().index('MumboJumbo') -PARADIGM_SHIFT = SuitAttacks.keys().index('ParadigmShift') -PECKING_ORDER = SuitAttacks.keys().index('PeckingOrder') -PICK_POCKET = SuitAttacks.keys().index('PickPocket') -PINK_SLIP = SuitAttacks.keys().index('PinkSlip') -PLAY_HARDBALL = SuitAttacks.keys().index('PlayHardball') -POUND_KEY = SuitAttacks.keys().index('PoundKey') -POWER_TIE = SuitAttacks.keys().index('PowerTie') -POWER_TRIP = SuitAttacks.keys().index('PowerTrip') -QUAKE = SuitAttacks.keys().index('Quake') -RAZZLE_DAZZLE = SuitAttacks.keys().index('RazzleDazzle') -RED_TAPE = SuitAttacks.keys().index('RedTape') -RE_ORG = SuitAttacks.keys().index('ReOrg') -RESTRAINING_ORDER = SuitAttacks.keys().index('RestrainingOrder') -ROLODEX = SuitAttacks.keys().index('Rolodex') -RUBBER_STAMP = SuitAttacks.keys().index('RubberStamp') -RUB_OUT = SuitAttacks.keys().index('RubOut') -SACKED = SuitAttacks.keys().index('Sacked') -SANDTRAP = SuitAttacks.keys().index('SandTrap') -SCHMOOZE = SuitAttacks.keys().index('Schmooze') -SHAKE = SuitAttacks.keys().index('Shake') -SHRED = SuitAttacks.keys().index('Shred') -SONG_AND_DANCE = SuitAttacks.keys().index('SongAndDance') -SPIN = SuitAttacks.keys().index('Spin') -SYNERGY = SuitAttacks.keys().index('Synergy') -TABULATE = SuitAttacks.keys().index('Tabulate') -TEE_OFF = SuitAttacks.keys().index('TeeOff') -THROW_BOOK = SuitAttacks.keys().index('ThrowBook') -TREMOR = SuitAttacks.keys().index('Tremor') -WATERCOOLER = SuitAttacks.keys().index('Watercooler') -WITHDRAWAL = SuitAttacks.keys().index('Withdrawal') -WRITE_OFF = SuitAttacks.keys().index('WriteOff') +AUDIT = list(SuitAttacks.keys()).index('Audit') +BITE = list(SuitAttacks.keys()).index('Bite') +BOUNCE_CHECK = list(SuitAttacks.keys()).index('BounceCheck') +BRAIN_STORM = list(SuitAttacks.keys()).index('BrainStorm') +BUZZ_WORD = list(SuitAttacks.keys()).index('BuzzWord') +CALCULATE = list(SuitAttacks.keys()).index('Calculate') +CANNED = list(SuitAttacks.keys()).index('Canned') +CHOMP = list(SuitAttacks.keys()).index('Chomp') +CIGAR_SMOKE = list(SuitAttacks.keys()).index('CigarSmoke') +CLIPON_TIE = list(SuitAttacks.keys()).index('ClipOnTie') +CRUNCH = list(SuitAttacks.keys()).index('Crunch') +DEMOTION = list(SuitAttacks.keys()).index('Demotion') +DOWNSIZE = list(SuitAttacks.keys()).index('Downsize') +DOUBLE_TALK = list(SuitAttacks.keys()).index('DoubleTalk') +EVICTION_NOTICE = list(SuitAttacks.keys()).index('EvictionNotice') +EVIL_EYE = list(SuitAttacks.keys()).index('EvilEye') +FILIBUSTER = list(SuitAttacks.keys()).index('Filibuster') +FILL_WITH_LEAD = list(SuitAttacks.keys()).index('FillWithLead') +FINGER_WAG = list(SuitAttacks.keys()).index('FingerWag') +FIRED = list(SuitAttacks.keys()).index('Fired') +FIVE_O_CLOCK_SHADOW = list(SuitAttacks.keys()).index('FiveOClockShadow') +FLOOD_THE_MARKET = list(SuitAttacks.keys()).index('FloodTheMarket') +FOUNTAIN_PEN = list(SuitAttacks.keys()).index('FountainPen') +FREEZE_ASSETS = list(SuitAttacks.keys()).index('FreezeAssets') +GAVEL = list(SuitAttacks.keys()).index('Gavel') +GLOWER_POWER = list(SuitAttacks.keys()).index('GlowerPower') +GUILT_TRIP = list(SuitAttacks.keys()).index('GuiltTrip') +HALF_WINDSOR = list(SuitAttacks.keys()).index('HalfWindsor') +HANG_UP = list(SuitAttacks.keys()).index('HangUp') +HEAD_SHRINK = list(SuitAttacks.keys()).index('HeadShrink') +HOT_AIR = list(SuitAttacks.keys()).index('HotAir') +JARGON = list(SuitAttacks.keys()).index('Jargon') +LEGALESE = list(SuitAttacks.keys()).index('Legalese') +LIQUIDATE = list(SuitAttacks.keys()).index('Liquidate') +MARKET_CRASH = list(SuitAttacks.keys()).index('MarketCrash') +MUMBO_JUMBO = list(SuitAttacks.keys()).index('MumboJumbo') +PARADIGM_SHIFT = list(SuitAttacks.keys()).index('ParadigmShift') +PECKING_ORDER = list(SuitAttacks.keys()).index('PeckingOrder') +PICK_POCKET = list(SuitAttacks.keys()).index('PickPocket') +PINK_SLIP = list(SuitAttacks.keys()).index('PinkSlip') +PLAY_HARDBALL = list(SuitAttacks.keys()).index('PlayHardball') +POUND_KEY = list(SuitAttacks.keys()).index('PoundKey') +POWER_TIE = list(SuitAttacks.keys()).index('PowerTie') +POWER_TRIP = list(SuitAttacks.keys()).index('PowerTrip') +QUAKE = list(SuitAttacks.keys()).index('Quake') +RAZZLE_DAZZLE = list(SuitAttacks.keys()).index('RazzleDazzle') +RED_TAPE = list(SuitAttacks.keys()).index('RedTape') +RE_ORG = list(SuitAttacks.keys()).index('ReOrg') +RESTRAINING_ORDER = list(SuitAttacks.keys()).index('RestrainingOrder') +ROLODEX = list(SuitAttacks.keys()).index('Rolodex') +RUBBER_STAMP = list(SuitAttacks.keys()).index('RubberStamp') +RUB_OUT = list(SuitAttacks.keys()).index('RubOut') +SACKED = list(SuitAttacks.keys()).index('Sacked') +SANDTRAP = list(SuitAttacks.keys()).index('SandTrap') +SCHMOOZE = list(SuitAttacks.keys()).index('Schmooze') +SHAKE = list(SuitAttacks.keys()).index('Shake') +SHRED = list(SuitAttacks.keys()).index('Shred') +SONG_AND_DANCE = list(SuitAttacks.keys()).index('SongAndDance') +SPIN = list(SuitAttacks.keys()).index('Spin') +SYNERGY = list(SuitAttacks.keys()).index('Synergy') +TABULATE = list(SuitAttacks.keys()).index('Tabulate') +TEE_OFF = list(SuitAttacks.keys()).index('TeeOff') +THROW_BOOK = list(SuitAttacks.keys()).index('ThrowBook') +TREMOR = list(SuitAttacks.keys()).index('Tremor') +WATERCOOLER = list(SuitAttacks.keys()).index('Watercooler') +WITHDRAWAL = list(SuitAttacks.keys()).index('Withdrawal') +WRITE_OFF = list(SuitAttacks.keys()).index('WriteOff') def getFaceoffTaunt(suitName, doId): - if SuitFaceoffTaunts.has_key(suitName): + if suitName in SuitFaceoffTaunts: taunts = SuitFaceoffTaunts[suitName] else: taunts = TTLocalizer.SuitFaceoffDefaultTaunts @@ -3037,7 +3037,7 @@ def getAttackTauntIndexFromIndex(suit, attackIndex): def getAttackTauntIndex(attackName): - if SuitAttackTaunts.has_key(attackName): + if attackName in SuitAttackTaunts: taunts = SuitAttackTaunts[attackName] return random.randint(0, len(taunts) - 1) else: @@ -3045,7 +3045,7 @@ def getAttackTauntIndex(attackName): def getAttackTaunt(attackName, index = None): - if SuitAttackTaunts.has_key(attackName): + if attackName in SuitAttackTaunts: taunts = SuitAttackTaunts[attackName] else: taunts = TTLocalizer.SuitAttackDefaultTaunts diff --git a/toontown/building/BoardingGroupShow.py b/toontown/building/BoardingGroupShow.py index 0e93714..83b98ec 100644 --- a/toontown/building/BoardingGroupShow.py +++ b/toontown/building/BoardingGroupShow.py @@ -179,7 +179,7 @@ class BoardingGroupShow: base.cTrav.traverse(render) queue.sortEntries() if queue.getNumEntries(): - for entryNum in xrange(queue.getNumEntries()): + for entryNum in range(queue.getNumEntries()): entry = queue.getEntry(entryNum) hitObject = entry.getIntoNodePath() if hitObject.getNetTag('pieCode') != '3': diff --git a/toontown/building/BoardingPartyBase.py b/toontown/building/BoardingPartyBase.py index 6eac7da..6644bfa 100644 --- a/toontown/building/BoardingPartyBase.py +++ b/toontown/building/BoardingPartyBase.py @@ -30,7 +30,7 @@ class BoardingPartyBase: self.maxSize = groupSize def getGroupLeader(self, avatarId): - if self.avIdDict.has_key(avatarId): + if avatarId in self.avIdDict: leaderId = self.avIdDict[avatarId] return leaderId else: @@ -45,7 +45,7 @@ class BoardingPartyBase: return False def getGroupMemberList(self, avatarId): - if self.avIdDict.has_key(avatarId): + if avatarId in self.avIdDict: leaderId = self.avIdDict[avatarId] group = self.groupListDict.get(leaderId) if group: @@ -56,7 +56,7 @@ class BoardingPartyBase: return [] def getGroupInviteList(self, avatarId): - if self.avIdDict.has_key(avatarId): + if avatarId in self.avIdDict: leaderId = self.avIdDict[avatarId] group = self.groupListDict.get(leaderId) if group: @@ -67,7 +67,7 @@ class BoardingPartyBase: return [] def getGroupKickList(self, avatarId): - if self.avIdDict.has_key(avatarId): + if avatarId in self.avIdDict: leaderId = self.avIdDict[avatarId] group = self.groupListDict.get(leaderId) if group: @@ -86,7 +86,7 @@ class BoardingPartyBase: def hasPendingInvite(self, avatarId): pendingInvite = False - if self.avIdDict.has_key(avatarId): + if avatarId in self.avIdDict: leaderId = self.avIdDict[avatarId] leaderInviteList = self.getGroupInviteList(leaderId) if leaderId == avatarId: diff --git a/toontown/building/DistributedAnimDoor.py b/toontown/building/DistributedAnimDoor.py index 2c93313..7c7a673 100644 --- a/toontown/building/DistributedAnimDoor.py +++ b/toontown/building/DistributedAnimDoor.py @@ -13,7 +13,7 @@ class DistributedAnimDoor(DistributedDoor.DistributedDoor): base.animDoor = self def getBuilding(self): - if not self.__dict__.has_key('building'): + 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) @@ -52,7 +52,7 @@ class DistributedAnimDoor(DistributedDoor.DistributedDoor): self.notify.error('setTriggerName doorTYpe=%s' % self.doorType) def getAnimBuilding(self): - if not self.__dict__.has_key('animBuilding'): + if 'animBuilding' not in self.__dict__: if self.doorType == DoorTypes.EXT_ANIM_STANDARD: bldg = self.getBuilding() key = bldg.getParent().getParent() diff --git a/toontown/building/DistributedBBElevator.py b/toontown/building/DistributedBBElevator.py index f79a930..6d94e01 100644 --- a/toontown/building/DistributedBBElevator.py +++ b/toontown/building/DistributedBBElevator.py @@ -1,6 +1,6 @@ -import DistributedElevator -import DistributedBossElevator -from ElevatorConstants import * +from . import DistributedElevator +from . import DistributedBossElevator +from .ElevatorConstants import * from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer diff --git a/toontown/building/DistributedBBElevatorAI.py b/toontown/building/DistributedBBElevatorAI.py index 433007c..a61d56b 100644 --- a/toontown/building/DistributedBBElevatorAI.py +++ b/toontown/building/DistributedBBElevatorAI.py @@ -1,5 +1,5 @@ -from ElevatorConstants import * -import DistributedBossElevatorAI +from .ElevatorConstants import * +from . import DistributedBossElevatorAI class DistributedBBElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): diff --git a/toontown/building/DistributedBoardingParty.py b/toontown/building/DistributedBoardingParty.py index 2bbce05..f9e263c 100644 --- a/toontown/building/DistributedBoardingParty.py +++ b/toontown/building/DistributedBoardingParty.py @@ -12,7 +12,7 @@ from toontown.toontowngui import TTDialog from toontown.hood import ZoneUtil from toontown.toontowngui import TeaserPanel from direct.interval.IntervalGlobal import * -import BoardingGroupShow +from . import BoardingGroupShow class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPartyBase.BoardingPartyBase): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedBoardingParty') @@ -74,7 +74,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart self.notify.debug('postgroupInfo') isMyGroup = 0 removedMemberIdList = [] - if self.groupListDict.has_key(leaderId): + if leaderId in self.groupListDict: oldGroupEntry = self.groupListDict[leaderId] else: oldGroupEntry = [[], [], []] @@ -100,7 +100,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart if newGroupEntry[0] == [0] or not newGroupEntry[0]: dgroup = self.groupListDict.pop(leaderId) for memberId in dgroup[0]: - if self.avIdDict.has_key(memberId): + if memberId in self.avIdDict: self.avIdDict.pop(memberId) if isMyGroup: @@ -335,16 +335,16 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart isMyGroup = 0 if localAvatar.doId == quitterId or localAvatar.doId == leaderId: isMyGroup = 1 - if self.groupListDict.has_key(leaderId): + if leaderId in self.groupListDict: if leaderId == localAvatar.doId: isMyGroup = 1 - if self.avIdDict.has_key(leaderId): + if leaderId in self.avIdDict: self.avIdDict.pop(leaderId) dgroup = self.groupListDict.pop(leaderId) for memberId in memberList: if memberId == localAvatar.doId: isMyGroup = 1 - if self.avIdDict.has_key(memberId): + if memberId in self.avIdDict: self.avIdDict.pop(memberId) if isMyGroup: @@ -427,7 +427,7 @@ class DistributedBoardingParty(DistributedObject.DistributedObject, BoardingPart place = base.cr.playGame.getPlace() if place: if not place.getState() == 'elevator': - if self.avIdDict.has_key(localAvatar.doId): + if localAvatar.doId in self.avIdDict: leaderId = self.avIdDict[localAvatar.doId] self.sendUpdate('requestLeave', [leaderId]) diff --git a/toontown/building/DistributedBoardingPartyAI.py b/toontown/building/DistributedBoardingPartyAI.py index d9cad47..4e18be7 100644 --- a/toontown/building/DistributedBoardingPartyAI.py +++ b/toontown/building/DistributedBoardingPartyAI.py @@ -2,7 +2,7 @@ from otp.otpbase import OTPGlobals from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * +from .ElevatorConstants import * from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -142,7 +142,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi reason = BoardingPartyBase.BOARDCODE_PROMOTION self.sendUpdateToAvatarId(inviterId, 'postInviteNotQualify', [inviterId, reason, self.elevatorIdList[0]]) return - if self.avIdDict.has_key(inviterId): + if inviterId in self.avIdDict: self.notify.debug('old group') leaderId = self.avIdDict[inviterId] groupList = self.groupListDict.get(leaderId) @@ -157,7 +157,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi if inviteeId not in groupList[1]: groupList[1].append(inviteeId) self.groupListDict[leaderId] = groupList - if self.avIdDict.has_key(inviteeId): + if inviteeId in self.avIdDict: self.notify.warning('inviter %s tried to invite %s who already exists in the avIdDict.' % (inviterId, inviteeId)) self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId) self.avIdDict[inviteeId] = leaderId @@ -169,7 +169,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi elif inviterId in groupList[2]: self.sendUpdate('postKickReject', [leaderId, inviterId, inviteeId]) else: - if self.avIdDict.has_key(inviteeId): + if inviteeId in self.avIdDict: self.notify.warning('inviter %s tried to invite %s who already exists in avIdDict.' % (inviterId, inviteeId)) self.air.writeServerEvent('suspicious: inviter', inviterId, ' tried to invite %s who already exists in the avIdDict.' % inviteeId) self.notify.debug('new group') @@ -182,7 +182,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi def requestCancelInvite(self, inviteeId): inviterId = self.air.getAvatarIdFromSender() - if self.avIdDict.has_key(inviterId): + if inviterId in self.avIdDict: leaderId = self.avIdDict[inviterId] groupList = self.groupListDict.get(leaderId) if groupList: @@ -192,11 +192,11 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi def requestAcceptInvite(self, leaderId, inviterId): inviteeId = self.air.getAvatarIdFromSender() self.notify.debug('requestAcceptInvite leader%s inviter%s invitee%s' % (leaderId, inviterId, inviteeId)) - if self.avIdDict.has_key(inviteeId): + if inviteeId in self.avIdDict: if self.hasActiveGroup(inviteeId): self.sendUpdateToAvatarId(inviteeId, 'postAlreadyInGroup', []) return - if not self.avIdDict.has_key(leaderId) or not self.isInGroup(inviteeId, leaderId): + if leaderId not in self.avIdDict or not self.isInGroup(inviteeId, leaderId): self.sendUpdateToAvatarId(inviteeId, 'postSomethingMissing', []) return memberList = self.getGroupMemberList(leaderId) @@ -225,14 +225,14 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi def requestKick(self, kickId): leaderId = self.air.getAvatarIdFromSender() - if self.avIdDict.has_key(kickId): + if kickId in self.avIdDict: if self.avIdDict[kickId] == leaderId: self.removeFromGroup(leaderId, kickId, kick=1) self.sendUpdateToAvatarId(kickId, 'postKick', [leaderId]) def requestLeave(self, leaderId): memberId = self.air.getAvatarIdFromSender() - if self.avIdDict.has_key(memberId): + if memberId in self.avIdDict: if leaderId == self.avIdDict[memberId]: self.removeFromGroup(leaderId, memberId) @@ -254,7 +254,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi if elevatorId in self.elevatorIdList: elevator = simbase.air.doId2do.get(elevatorId) if elevator: - if self.avIdDict.has_key(leaderId): + if leaderId in self.avIdDict: if leaderId == self.avIdDict[leaderId]: boardOkay = BoardingPartyBase.BOARDCODE_OKAY for avId in self.getGroupMemberList(leaderId): @@ -294,7 +294,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi if elevatorId in self.elevatorIdList: elevator = simbase.air.doId2do.get(elevatorId) if elevator: - if self.avIdDict.has_key(leaderId): + if leaderId in self.avIdDict: if leaderId == self.avIdDict[leaderId]: group = self.groupListDict.get(leaderId) if group: @@ -319,7 +319,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi return def testGoButtonRequirements(self, leaderId, elevatorId): - if self.avIdDict.has_key(leaderId): + if leaderId in self.avIdDict: if leaderId == self.avIdDict[leaderId]: if elevatorId in self.elevatorIdList: elevator = simbase.air.doId2do.get(elevatorId) @@ -374,7 +374,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi def handleAvatarDisco(self, avId): self.notify.debug('handleAvatarDisco %s' % avId) - if self.avIdDict.has_key(avId): + if avId in self.avIdDict: leaderId = self.avIdDict[avId] self.removeFromGroup(leaderId, avId) @@ -383,12 +383,12 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi if zoneNew in self.visibleZones: self.toonInZone(avId) else: - if self.avIdDict.has_key(avId): + if avId in self.avIdDict: leaderId = self.avIdDict[avId] self.removeFromGroup(leaderId, avId) def toonInZone(self, avId): - if self.avIdDict.has_key(avId): + if avId in self.avIdDict: leaderId = self.avIdDict[avId] group = self.groupListDict.get(leaderId) if leaderId and group: @@ -415,9 +415,9 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi self.notify.debug('removeFromGroup leaderId %s memberId %s' % (leaderId, memberId)) self.notify.debug('Groups %s' % self.groupListDict) self.notify.debug('avDict %s' % self.avIdDict) - if not self.avIdDict.has_key(leaderId): + if leaderId not in self.avIdDict: self.sendUpdate('postGroupDissolve', [memberId, leaderId, [], kick]) - if self.avIdDict.has_key(memberId): + if memberId in self.avIdDict: self.avIdDict.pop(memberId) return self.removeWacthAvStatus(memberId) @@ -434,16 +434,16 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi else: return if memberId == leaderId or len(group[0]) < 2: - if self.avIdDict.has_key(leaderId): + if leaderId in self.avIdDict: self.avIdDict.pop(leaderId) for inviteeId in group[1]: - if self.avIdDict.has_key(inviteeId): + if inviteeId in self.avIdDict: self.avIdDict.pop(inviteeId) self.sendUpdateToAvatarId(inviteeId, 'postInviteCanceled', []) dgroup = self.groupListDict.pop(leaderId) for dMemberId in dgroup[0]: - if self.avIdDict.has_key(dMemberId): + if dMemberId in self.avIdDict: self.avIdDict.pop(dMemberId) self.notify.debug('postGroupDissolve') @@ -454,7 +454,7 @@ class DistributedBoardingPartyAI(DistributedObjectAI.DistributedObjectAI, Boardi if post: self.notify.debug('Calling postGroupInfo from removeFromGroup') self.sendUpdate('postGroupInfo', [leaderId, group[0], group[1], group[2]]) - if self.avIdDict.has_key(memberId): + if memberId in self.avIdDict: self.avIdDict.pop(memberId) self.notify.debug('Remove from group END') self.notify.debug('Groups %s' % self.groupListDict) diff --git a/toontown/building/DistributedBossElevator.py b/toontown/building/DistributedBossElevator.py index ba8b1ec..4254ad4 100644 --- a/toontown/building/DistributedBossElevator.py +++ b/toontown/building/DistributedBossElevator.py @@ -1,10 +1,10 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * -from ElevatorUtils import * -import DistributedElevator -import DistributedElevatorExt +from .ElevatorConstants import * +from .ElevatorUtils import * +from . import DistributedElevator +from . import DistributedElevatorExt from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM diff --git a/toontown/building/DistributedBossElevatorAI.py b/toontown/building/DistributedBossElevatorAI.py index cf06a8a..d0d064a 100644 --- a/toontown/building/DistributedBossElevatorAI.py +++ b/toontown/building/DistributedBossElevatorAI.py @@ -1,8 +1,8 @@ from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * -import DistributedElevatorAI, DistributedElevatorExtAI +from .ElevatorConstants import * +from . import DistributedElevatorAI, DistributedElevatorExtAI from direct.fsm import ClassicFSM from direct.fsm import State from direct.task import Task diff --git a/toontown/building/DistributedBuilding.py b/toontown/building/DistributedBuilding.py index c5fe0eb..a7e324b 100644 --- a/toontown/building/DistributedBuilding.py +++ b/toontown/building/DistributedBuilding.py @@ -2,9 +2,9 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from direct.directtools.DirectGeometry import * -from ElevatorConstants import * -from ElevatorUtils import * -from SuitBuildingGlobals import * +from .ElevatorConstants import * +from .ElevatorUtils import * +from .SuitBuildingGlobals import * from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals @@ -710,7 +710,7 @@ class DistributedBuilding(DistributedObject.DistributedObject): def plantVictorsOutsideBldg(self): retVal = 0 for victor in self.victorList: - if victor != 0 and self.cr.doId2do.has_key(victor): + if victor != 0 and victor in self.cr.doId2do: toon = self.cr.doId2do[victor] toon.setPosHpr(self.elevatorModel, 0, -10, 0, 0, 0, 0) toon.startSmooth() @@ -725,12 +725,12 @@ class DistributedBuilding(DistributedObject.DistributedObject): delayDeletes = [] i = 0 for victor in self.victorList: - if victor != 0 and self.cr.doId2do.has_key(victor): + if victor != 0 and victor in self.cr.doId2do: toon = self.cr.doId2do[victor] delayDeletes.append(DelayDelete.DelayDelete(toon, 'getVictoryRunTrack')) toon.stopSmooth() toon.setParent(ToontownGlobals.SPHidden) - origPosTrack.append(Func(toon.setPosHpr, self.elevatorNodePath, apply(Point3, ElevatorPoints[i]), Point3(180, 0, 0))) + origPosTrack.append(Func(toon.setPosHpr, self.elevatorNodePath, Point3(*ElevatorPoints[i]), Point3(180, 0, 0))) origPosTrack.append(Func(toon.setParent, ToontownGlobals.SPRender)) i += 1 @@ -740,7 +740,7 @@ class DistributedBuilding(DistributedObject.DistributedObject): runOutAll = Parallel() i = 0 for victor in self.victorList: - if victor != 0 and self.cr.doId2do.has_key(victor): + if victor != 0 and victor in self.cr.doId2do: toon = self.cr.doId2do[victor] p0 = Point3(0, 0, 0) p1 = Point3(ElevatorPoints[i][0], ElevatorPoints[i][1] - 5.0, ElevatorPoints[i][2]) diff --git a/toontown/building/DistributedBuildingAI.py b/toontown/building/DistributedBuildingAI.py index 9a22337..39c262e 100644 --- a/toontown/building/DistributedBuildingAI.py +++ b/toontown/building/DistributedBuildingAI.py @@ -7,7 +7,7 @@ from direct.distributed import DistributedObjectAI from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.toonbase.ToontownGlobals import ToonHall -import DistributedToonInteriorAI, DistributedToonHallInteriorAI, DistributedSuitInteriorAI, DistributedDoorAI, DoorTypes, DistributedElevatorExtAI, DistributedKnockKnockDoorAI, SuitPlannerInteriorAI, SuitBuildingGlobals, FADoorCodes +from . import DistributedToonInteriorAI, DistributedToonHallInteriorAI, DistributedSuitInteriorAI, DistributedDoorAI, DoorTypes, DistributedElevatorExtAI, DistributedKnockKnockDoorAI, SuitPlannerInteriorAI, SuitBuildingGlobals, FADoorCodes from toontown.hood import ZoneUtil import random, time from toontown.cogdominium.DistributedCogdoInteriorAI import DistributedCogdoInteriorAI @@ -244,7 +244,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): return def setVictorExited(self, avId): - print 'victor %d exited unexpectedly for bldg %d' % (avId, self.doId) + print('victor %d exited unexpectedly for bldg %d' % (avId, self.doId)) self.recordVictorResponse(avId) if self.allVictorsResponded(): self.toonTakeOver() @@ -276,7 +276,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): pass def getToon(self, toonId): - if self.air.doId2do.has_key(toonId): + if toonId in self.air.doId2do: return self.air.doId2do[toonId] else: self.notify.warning('getToon() - toon: %d not in repository!' % toonId) @@ -313,7 +313,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): for i in range(0, 4): victor = victorList[i] - if victor == None or not self.air.doId2do.has_key(victor): + if victor == None or victor not in self.air.doId2do: victorList[i] = 0 else: event = self.air.getAvatarExitEvent(victor) @@ -355,7 +355,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI): for i in range(0, 4): victor = victorList[i] - if victor == None or not self.air.doId2do.has_key(victor): + if victor == None or victor not in self.air.doId2do: victorList[i] = 0 else: event = self.air.getAvatarExitEvent(victor) diff --git a/toontown/building/DistributedBuildingMgrAI.py b/toontown/building/DistributedBuildingMgrAI.py index 5a13499..9a69532 100644 --- a/toontown/building/DistributedBuildingMgrAI.py +++ b/toontown/building/DistributedBuildingMgrAI.py @@ -1,8 +1,8 @@ import os from direct.task.Task import Task -import cPickle +import pickle from otp.ai.AIBaseGlobal import * -import DistributedBuildingAI, HQBuildingAI, GagshopBuildingAI, PetshopBuildingAI +from . import DistributedBuildingAI, HQBuildingAI, GagshopBuildingAI, PetshopBuildingAI from toontown.building.KartShopBuildingAI import KartShopBuildingAI from toontown.building import DistributedAnimBuildingAI from direct.directnotify import DirectNotifyGlobal @@ -28,13 +28,13 @@ class DistributedBuildingMgrAI: def cleanup(self): taskMgr.remove(str(self.branchID) + '_delayed_save-timer') - for building in self.__buildings.values(): + for building in list(self.__buildings.values()): building.cleanup() self.__buildings = {} def isValidBlockNumber(self, blockNumber): - return self.__buildings.has_key(blockNumber) + return blockNumber in self.__buildings def delayedSaveTask(self, task): self.save() @@ -46,7 +46,7 @@ class DistributedBuildingMgrAI: def getSuitBlocks(self): blocks = [] - for i in self.__buildings.values(): + for i in list(self.__buildings.values()): if i.isSuitBlock(): blocks.append(i.getBlock()[0]) @@ -57,7 +57,7 @@ class DistributedBuildingMgrAI: def getCogdoBlocks(self): blocks = [] - for i in self.__buildings.values(): + for i in list(self.__buildings.values()): if i.isCogdo(): blocks.append(i.getBlock()[0]) @@ -65,7 +65,7 @@ class DistributedBuildingMgrAI: def getEstablishedSuitBlocks(self): blocks = [] - for i in self.__buildings.values(): + for i in list(self.__buildings.values()): if i.isEstablishedSuitBlock(): blocks.append(i.getBlock()[0]) @@ -73,7 +73,7 @@ class DistributedBuildingMgrAI: def getToonBlocks(self): blocks = [] - for i in self.__buildings.values(): + for i in list(self.__buildings.values()): if isinstance(i, HQBuildingAI.HQBuildingAI): continue if not i.isSuitBlock(): @@ -82,7 +82,7 @@ class DistributedBuildingMgrAI: return blocks def getBuildings(self): - return self.__buildings.values() + return list(self.__buildings.values()) def getFrontDoorPoint(self, blockNumber): return self.__buildings[blockNumber].getFrontDoorPoint() @@ -237,13 +237,13 @@ class DistributedBuildingMgrAI: def saveTo(self, file, block=None): if block: pickleData = block.getPickleData() - cPickle.dump(pickleData, file) + pickle.dump(pickleData, file) else: - for i in self.__buildings.values(): + for i in list(self.__buildings.values()): if isinstance(i, HQBuildingAI.HQBuildingAI): continue pickleData = i.getPickleData() - cPickle.dump(pickleData, file) + pickle.dump(pickleData, file) def fastSave(self, block): return @@ -280,7 +280,7 @@ class DistributedBuildingMgrAI: blocks = {} try: while 1: - pickleData = cPickle.load(file) + pickleData = pickle.load(file) blocks[int(pickleData['block'])] = pickleData except EOFError: diff --git a/toontown/building/DistributedCFOElevator.py b/toontown/building/DistributedCFOElevator.py index a0c1536..c496fe1 100644 --- a/toontown/building/DistributedCFOElevator.py +++ b/toontown/building/DistributedCFOElevator.py @@ -1,6 +1,6 @@ -import DistributedElevator -import DistributedBossElevator -from ElevatorConstants import * +from . import DistributedElevator +from . import DistributedBossElevator +from .ElevatorConstants import * from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer diff --git a/toontown/building/DistributedCFOElevatorAI.py b/toontown/building/DistributedCFOElevatorAI.py index e4c706e..cd0fc48 100644 --- a/toontown/building/DistributedCFOElevatorAI.py +++ b/toontown/building/DistributedCFOElevatorAI.py @@ -1,5 +1,5 @@ -from ElevatorConstants import * -import DistributedBossElevatorAI +from .ElevatorConstants import * +from . import DistributedBossElevatorAI class DistributedCFOElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): diff --git a/toontown/building/DistributedCJElevator.py b/toontown/building/DistributedCJElevator.py index 26fb9b8..eb7119c 100644 --- a/toontown/building/DistributedCJElevator.py +++ b/toontown/building/DistributedCJElevator.py @@ -1,6 +1,6 @@ -import DistributedElevator -import DistributedBossElevator -from ElevatorConstants import * +from . import DistributedElevator +from . import DistributedBossElevator +from .ElevatorConstants import * from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer diff --git a/toontown/building/DistributedCJElevatorAI.py b/toontown/building/DistributedCJElevatorAI.py index 98a9a12..854d6cb 100644 --- a/toontown/building/DistributedCJElevatorAI.py +++ b/toontown/building/DistributedCJElevatorAI.py @@ -1,5 +1,5 @@ -from ElevatorConstants import * -import DistributedBossElevatorAI +from .ElevatorConstants import * +from . import DistributedBossElevatorAI class DistributedCJElevatorAI(DistributedBossElevatorAI.DistributedBossElevatorAI): diff --git a/toontown/building/DistributedClubElevator.py b/toontown/building/DistributedClubElevator.py index 6117c36..7b938b9 100644 --- a/toontown/building/DistributedClubElevator.py +++ b/toontown/building/DistributedClubElevator.py @@ -307,7 +307,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM): def kickEveryoneOut(self): bailFlag = 0 - for avId, slot in self.boardedAvIds.items(): + for avId, slot in list(self.boardedAvIds.items()): self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime()) if avId == base.localAvatar.doId: pass @@ -380,7 +380,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM): del self.toonRequests[index] if avId == 0: pass - elif not self.cr.doId2do.has_key(avId): + elif avId not in self.cr.doId2do: func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) elif not self.isSetup: @@ -460,7 +460,7 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM): newSlots.append(slot) self.deferredSlots = newSlots - elif self.cr.doId2do.has_key(avId): + elif avId in self.cr.doId2do: if bailFlag == 1 and hasattr(self, 'clockNode'): if timestamp < self.countdownTime and timestamp >= 0: self.countdown(self.countdownTime - timestamp) @@ -527,5 +527,5 @@ class DistributedClubElevator(DistributedElevatorFSM.DistributedElevatorFSM): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) diff --git a/toontown/building/DistributedClubElevatorAI.py b/toontown/building/DistributedClubElevatorAI.py index ab21556..e2a2f5f 100644 --- a/toontown/building/DistributedClubElevatorAI.py +++ b/toontown/building/DistributedClubElevatorAI.py @@ -129,7 +129,7 @@ class DistributedClubElevatorAI(DistributedElevatorFSMAI.DistributedElevatorFSMA for i in range(len(self.seats)): self.seats[i] = None - print self.seats + print(self.seats) if self.wantState == 'closed': self.demand('Closing') else: diff --git a/toontown/building/DistributedDoor.py b/toontown/building/DistributedDoor.py index a4e67c1..95896d8 100644 --- a/toontown/building/DistributedDoor.py +++ b/toontown/building/DistributedDoor.py @@ -9,9 +9,9 @@ from direct.distributed import DistributedObject from toontown.hood import ZoneUtil from toontown.suit import Suit from toontown.distributed import DelayDelete -import FADoorCodes +from . import FADoorCodes from direct.task.Task import Task -import DoorTypes +from . import DoorTypes from toontown.toontowngui import TTDialog from toontown.toonbase import TTLocalizer from toontown.toontowngui import TeaserPanel @@ -70,7 +70,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): self.ignore('clearOutToonInterior') self.fsm.request('off') self.exitDoorFSM.request('off') - if self.__dict__.has_key('building'): + if 'building' in self.__dict__: del self.building self.finishAllTracks() self.avatarIDList = [] @@ -116,7 +116,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): return def getTriggerName(self): - if self.doorType == DoorTypes.INT_HQ or self.specialDoorTypes.has_key(self.doorType): + if self.doorType == DoorTypes.INT_HQ or self.doorType in self.specialDoorTypes: return 'door_trigger_' + str(self.block) + '_' + str(self.doorIndex) else: return 'door_trigger_' + str(self.block) @@ -132,7 +132,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): return 'exit' + self.getTriggerName() def hideDoorParts(self): - if self.specialDoorTypes.has_key(self.doorType): + if self.doorType in self.specialDoorTypes: self.hideIfHasFlat(self.findDoorNode('rightDoor')) self.hideIfHasFlat(self.findDoorNode('leftDoor')) self.findDoorNode('doorFrameHoleRight').hide() @@ -141,7 +141,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): return def setTriggerName(self): - if self.specialDoorTypes.has_key(self.doorType): + if self.doorType in self.specialDoorTypes: building = self.getBuilding() doorTrigger = building.find('**/door_' + str(self.doorIndex) + '/**/door_trigger*') doorTrigger.node().setName(self.getTriggerName()) @@ -200,7 +200,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): self.setupNametag() def getBuilding(self): - if not self.__dict__.has_key('building'): + if 'building' not in self.__dict__: if self.doorType == DoorTypes.INT_STANDARD: door = render.find('**/leftDoor;+s') self.building = door.getParent() @@ -220,12 +220,12 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): return self.building def getBuilding_wip(self): - if not self.__dict__.has_key('building'): - if self.__dict__.has_key('block'): + if 'building' not in self.__dict__: + if 'block' in self.__dict__: self.building = self.cr.playGame.hood.loader.geom.find('**/??' + str(self.block) + ':*_landmark_*_DNARoot;+s') else: self.building = self.cr.playGame.hood.loader.geom - print '---------------- door is interior -------' + print('---------------- door is interior -------') return self.building def readyToExit(self): @@ -400,7 +400,7 @@ class DistributedDoor(DistributedObject.DistributedObject, DelayDeletable): otherNP.setPos(posHpr.getPos()) otherNP.setHpr(posHpr.getHpr()) self.tempDoorNodePath = otherNP - elif self.specialDoorTypes.has_key(self.doorType): + elif self.doorType in self.specialDoorTypes: building = self.getBuilding() otherNP = building.find('**/door_origin_' + str(self.doorIndex)) elif self.doorType == DoorTypes.INT_HQ: diff --git a/toontown/building/DistributedDoorAI.py b/toontown/building/DistributedDoorAI.py index b3ce1a2..2c7ff58 100644 --- a/toontown/building/DistributedDoorAI.py +++ b/toontown/building/DistributedDoorAI.py @@ -123,7 +123,7 @@ class DistributedDoorAI(DistributedObjectAI.DistributedObjectAI): self.otherDoor.getZoneId(), self.otherDoor.getDoId()]) def enqueueAvatarIdEnter(self, avatarID): - if not self.avatarsWhoAreEntering.has_key(avatarID): + if avatarID not in self.avatarsWhoAreEntering: self.avatarsWhoAreEntering[avatarID] = 1 self.sendUpdate('avatarEnter', [avatarID]) self.openDoor(self.fsm) @@ -142,10 +142,10 @@ class DistributedDoorAI(DistributedObjectAI.DistributedObjectAI): self.enqueueAvatarIdExit(avatarID) def enqueueAvatarIdExit(self, avatarID): - if self.avatarsWhoAreEntering.has_key(avatarID): + if avatarID in self.avatarsWhoAreEntering: del self.avatarsWhoAreEntering[avatarID] else: - if not self.avatarsWhoAreExiting.has_key(avatarID): + if avatarID not in self.avatarsWhoAreExiting: self.avatarsWhoAreExiting[avatarID] = 1 self.openDoor(self.exitDoorFSM) diff --git a/toontown/building/DistributedElevator.py b/toontown/building/DistributedElevator.py index 157ac4b..5aef868 100644 --- a/toontown/building/DistributedElevator.py +++ b/toontown/building/DistributedElevator.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * -from ElevatorUtils import * +from .ElevatorConstants import * +from .ElevatorUtils import * from direct.showbase import PythonUtil from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State @@ -88,7 +88,7 @@ class DistributedElevator(DistributedObject.DistributedObject): if self.bldgRequest: self.cr.relatedObjectMgr.abortRequest(self.bldgRequest) self.bldgRequest = None - for request in self.toonRequests.values(): + for request in list(self.toonRequests.values()): self.cr.relatedObjectMgr.abortRequest(request) self.toonRequests = {} @@ -186,7 +186,7 @@ class DistributedElevator(DistributedObject.DistributedObject): del self.toonRequests[index] if avId == 0: pass - elif not self.cr.doId2do.has_key(avId): + elif avId not in self.cr.doId2do: func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) elif not self.isSetup: @@ -226,8 +226,8 @@ class DistributedElevator(DistributedObject.DistributedObject): else: animInFunc = Sequence(Func(toon.setAnimState, 'run', 1.0)) animFunc = Func(toon.setAnimState, 'neutral', 1.0) - toon.headsUp(self.getElevatorModel(), apply(Point3, self.elevatorPoints[index])) - track = Sequence(animInFunc, LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, apply(Point3, self.elevatorPoints[index]), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), Func(self.clearToonTrack, avId), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) + toon.headsUp(self.getElevatorModel(), Point3(*self.elevatorPoints[index])) + track = Sequence(animInFunc, LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, Point3(*self.elevatorPoints[index]), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), Func(self.clearToonTrack, avId), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) if wantBoardingShow: boardingTrack, boardingTrackType = self.getBoardingTrack(toon, index, False) track = Sequence(boardingTrack, track) @@ -301,7 +301,7 @@ class DistributedElevator(DistributedObject.DistributedObject): timeToSet = self.countdownTime if timeSent > 0: timeToSet = timeSent - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: if bailFlag == 1 and hasattr(self, 'clockNode'): if timestamp < timeToSet and timestamp >= 0: self.countdown(timeToSet - timestamp) @@ -362,7 +362,7 @@ class DistributedElevator(DistributedObject.DistributedObject): place.fsm.request('walk') def rejectBoard(self, avId, reason = 0): - print 'rejectBoard %s' % reason + print('rejectBoard %s' % reason) if hasattr(base.localAvatar, 'elevatorNotifier'): if reason == REJECT_SHUFFLE: base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) @@ -423,7 +423,7 @@ class DistributedElevator(DistributedObject.DistributedObject): pass def onDoorCloseFinish(self): - for avId in self.boardedAvIds.keys(): + for avId in list(self.boardedAvIds.keys()): av = self.cr.doId2do.get(avId) if av is not None: if av.getParent().compareTo(self.getElevatorModel()) == 0: @@ -543,7 +543,7 @@ class DistributedElevator(DistributedObject.DistributedObject): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) def getDestName(self): @@ -553,11 +553,11 @@ class DistributedElevator(DistributedObject.DistributedObject): return self.JumpOutOffsets[seatIndex] def getOffsetPosWrtToonParent(self, toon, seatIndex = 0): - self.offsetNP.setPos(apply(Point3, self.getOffsetPos(seatIndex))) + self.offsetNP.setPos(Point3(*self.getOffsetPos(seatIndex))) return self.offsetNP.getPos(toon.getParent()) def getOffsetPosWrtRender(self, seatIndex = 0): - self.offsetNP.setPos(apply(Point3, self.getOffsetPos(seatIndex))) + self.offsetNP.setPos(Point3(*self.getOffsetPos(seatIndex))) return self.offsetNP.getPos(render) def canHideBoardingQuitBtn(self, avId): diff --git a/toontown/building/DistributedElevatorAI.py b/toontown/building/DistributedElevatorAI.py index 19b46dd..7e65c79 100644 --- a/toontown/building/DistributedElevatorAI.py +++ b/toontown/building/DistributedElevatorAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * +from .ElevatorConstants import * from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -258,7 +258,7 @@ class DistributedElevatorAI(DistributedObjectAI.DistributedObjectAI): self.accepting = 1 def exitWaitCountdown(self): - print 'exit wait countdown' + print('exit wait countdown') self.accepting = 0 taskMgr.remove(self.uniqueName('countdown-timer')) self.newTrip() diff --git a/toontown/building/DistributedElevatorExt.py b/toontown/building/DistributedElevatorExt.py index f2ea237..d12f815 100644 --- a/toontown/building/DistributedElevatorExt.py +++ b/toontown/building/DistributedElevatorExt.py @@ -2,9 +2,9 @@ from pandac.PandaModules import * from libotp import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * -from ElevatorUtils import * -import DistributedElevator +from .ElevatorConstants import * +from .ElevatorUtils import * +from . import DistributedElevator from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM diff --git a/toontown/building/DistributedElevatorExtAI.py b/toontown/building/DistributedElevatorExtAI.py index f2c608b..5d7bcdf 100644 --- a/toontown/building/DistributedElevatorExtAI.py +++ b/toontown/building/DistributedElevatorExtAI.py @@ -1,8 +1,8 @@ from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * -import DistributedElevatorAI +from .ElevatorConstants import * +from . import DistributedElevatorAI from direct.fsm import ClassicFSM from direct.fsm import State from direct.task import Task diff --git a/toontown/building/DistributedElevatorFSM.py b/toontown/building/DistributedElevatorFSM.py index 5f57d4a..5e7ab88 100644 --- a/toontown/building/DistributedElevatorFSM.py +++ b/toontown/building/DistributedElevatorFSM.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * -from ElevatorUtils import * +from .ElevatorConstants import * +from .ElevatorUtils import * from direct.showbase import PythonUtil from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM @@ -102,7 +102,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): if self.bldgRequest: self.cr.relatedObjectMgr.abortRequest(self.bldgRequest) self.bldgRequest = None - for request in self.toonRequests.values(): + for request in list(self.toonRequests.values()): self.cr.relatedObjectMgr.abortRequest(request) self.toonRequests = {} @@ -197,7 +197,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): del self.toonRequests[index] if avId == 0: pass - elif not self.cr.doId2do.has_key(avId): + elif avId not in self.cr.doId2do: func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) elif not self.isSetup: @@ -218,8 +218,8 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): else: toon.setAnimState('run', 1.0) animFunc = Func(toon.setAnimState, 'neutral', 1.0) - toon.headsUp(self.getElevatorModel(), apply(Point3, self.getScaledPoint(index))) - track = Sequence(LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, apply(Point3, self.getScaledPoint(index)), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) + toon.headsUp(self.getElevatorModel(), Point3(*self.getScaledPoint(index))) + track = Sequence(LerpPosInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.75, Point3(*self.getScaledPoint(index)), other=self.getElevatorModel()), LerpHprInterval(toon, TOON_BOARD_ELEVATOR_TIME * 0.25, Point3(180, 0, 0), other=self.getElevatorModel()), animFunc, name=toon.uniqueName('fillElevator'), autoPause=1) track.start() self.boardedAvIds[avId] = index @@ -251,7 +251,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): if self.cr: toon.setAnimState('neutral', 1.0) if toon == base.localAvatar: - print 'moving the local toon off the elevator' + print('moving the local toon off the elevator') doneStatus = {'where': 'exit'} elevator = self.getPlaceElevator() elevator.signalDone(doneStatus) @@ -261,7 +261,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): return def emptySlot(self, index, avId, bailFlag, timestamp): - print 'Emptying slot: %d for %d' % (index, avId) + print('Emptying slot: %d for %d' % (index, avId)) if avId == 0: pass elif not self.isSetup: @@ -271,7 +271,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): newSlots.append(slot) self.deferredSlots = newSlots - elif self.cr.doId2do.has_key(avId): + elif avId in self.cr.doId2do: if bailFlag == 1 and hasattr(self, 'clockNode'): if timestamp < self.countdownTime and timestamp >= 0: self.countdown(self.countdownTime - timestamp) @@ -289,7 +289,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): if self.offTrack[index].isPlaying(): self.offTrack[index].finish() self.offTrack[index] = None - self.offTrack[index] = Sequence(LerpPosInterval(toon, TOON_EXIT_ELEVATOR_TIME, Point3(0, -ElevatorData[self.type]['collRadius'], 0), startPos=apply(Point3, self.getScaledPoint(index)), other=self.getElevatorModel()), animFunc, Func(self.notifyToonOffElevator, toon), name=toon.uniqueName('emptyElevator'), autoPause=1) + self.offTrack[index] = Sequence(LerpPosInterval(toon, TOON_EXIT_ELEVATOR_TIME, Point3(0, -ElevatorData[self.type]['collRadius'], 0), startPos=Point3(*self.getScaledPoint(index)), other=self.getElevatorModel()), animFunc, Func(self.notifyToonOffElevator, toon), name=toon.uniqueName('emptyElevator'), autoPause=1) if avId == base.localAvatar.getDoId(): messenger.send('exitElevator') scale = base.localAvatar.getScale() @@ -303,7 +303,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): def handleEnterSphere(self, collEntry): self.notify.debug('Entering Elevator Sphere....') - print 'FSMhandleEnterSphere elevator%s avatar%s' % (self.elevatorTripId, localAvatar.lastElevatorLeft) + print('FSMhandleEnterSphere elevator%s avatar%s' % (self.elevatorTripId, localAvatar.lastElevatorLeft)) if self.elevatorTripId and localAvatar.lastElevatorLeft == self.elevatorTripId: self.rejectBoard(base.localAvatar.doId, REJECT_SHUFFLE) elif base.localAvatar.hp > 0: @@ -312,7 +312,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): self.sendUpdate('requestBoard', []) def rejectBoard(self, avId, reason = 0): - print 'rejectBoard %s' % reason + print('rejectBoard %s' % reason) if hasattr(base.localAvatar, 'elevatorNotifier'): if reason == REJECT_SHUFFLE: base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) @@ -378,7 +378,7 @@ class DistributedElevatorFSM(DistributedObject.DistributedObject, FSM): pass def onDoorCloseFinish(self): - for avId in self.boardedAvIds.keys(): + for avId in list(self.boardedAvIds.keys()): av = self.cr.doId2do.get(avId) if av is not None: if av.getParent().compareTo(self.getElevatorModel()) == 0: diff --git a/toontown/building/DistributedElevatorFSMAI.py b/toontown/building/DistributedElevatorFSMAI.py index d23c541..8270848 100644 --- a/toontown/building/DistributedElevatorFSMAI.py +++ b/toontown/building/DistributedElevatorFSMAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * +from .ElevatorConstants import * from direct.distributed import DistributedObjectAI from direct.task import Task from direct.directnotify import DirectNotifyGlobal @@ -210,7 +210,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM): self.accepting = 1 def exitWaitCountdown(self): - print 'exit wait countdown' + print('exit wait countdown') self.accepting = 0 taskMgr.remove(self.uniqueName('countdown-timer')) self.newTrip() @@ -232,7 +232,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM): def enterClosed(self): if hasattr(self, 'doId'): - print self.doId + print(self.doId) self.d_setState('Closed') def exitClosed(self): @@ -242,7 +242,7 @@ class DistributedElevatorFSMAI(DistributedObjectAI.DistributedObjectAI, FSM): for i in range(len(self.seats)): self.seats[i] = None - print self.seats + print(self.seats) self.d_setState('WaitEmpty') self.accepting = 1 return diff --git a/toontown/building/DistributedElevatorFloor.py b/toontown/building/DistributedElevatorFloor.py index 5dc2be2..28a825b 100644 --- a/toontown/building/DistributedElevatorFloor.py +++ b/toontown/building/DistributedElevatorFloor.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * -from ElevatorUtils import * -import DistributedElevatorFSM +from .ElevatorConstants import * +from .ElevatorUtils import * +from . import DistributedElevatorFSM from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM @@ -265,7 +265,7 @@ class DistributedElevatorFloor(DistributedElevatorFSM.DistributedElevatorFSM): def kickEveryoneOut(self): bailFlag = 0 - for avId, slot in self.boardedAvIds.items(): + for avId, slot in list(self.boardedAvIds.items()): self.emptySlot(slot, avId, bailFlag, globalClockDelta.getRealNetworkTime()) if avId == base.localAvatar.doId: pass diff --git a/toontown/building/DistributedElevatorFloorAI.py b/toontown/building/DistributedElevatorFloorAI.py index 6bcf429..35ab445 100644 --- a/toontown/building/DistributedElevatorFloorAI.py +++ b/toontown/building/DistributedElevatorFloorAI.py @@ -1,8 +1,8 @@ from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * -import DistributedElevatorFSMAI +from .ElevatorConstants import * +from . import DistributedElevatorFSMAI from direct.task import Task from direct.directnotify import DirectNotifyGlobal from direct.fsm.FSM import FSM @@ -128,7 +128,7 @@ class DistributedElevatorFloorAI(DistributedElevatorFSMAI.DistributedElevatorFSM for i in range(len(self.seats)): self.seats[i] = None - print self.seats + print(self.seats) if self.wantState == 'closed': self.demand('Closing') else: diff --git a/toontown/building/DistributedElevatorInt.py b/toontown/building/DistributedElevatorInt.py index b36b686..094a700 100644 --- a/toontown/building/DistributedElevatorInt.py +++ b/toontown/building/DistributedElevatorInt.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * -from ElevatorUtils import * -import DistributedElevator +from .ElevatorConstants import * +from .ElevatorUtils import * +from . import DistributedElevator from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM diff --git a/toontown/building/DistributedElevatorIntAI.py b/toontown/building/DistributedElevatorIntAI.py index d535457..791336e 100644 --- a/toontown/building/DistributedElevatorIntAI.py +++ b/toontown/building/DistributedElevatorIntAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from toontown.toonbase import ToontownGlobals from direct.distributed.ClockDelta import * -from ElevatorConstants import * +from .ElevatorConstants import * import copy, DistributedElevatorAI from direct.fsm import ClassicFSM from direct.fsm import State diff --git a/toontown/building/DistributedGagshopInterior.py b/toontown/building/DistributedGagshopInterior.py index adae884..b9f2261 100644 --- a/toontown/building/DistributedGagshopInterior.py +++ b/toontown/building/DistributedGagshopInterior.py @@ -5,7 +5,7 @@ from toontown.toonbase.ToontownGlobals import * import random from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal -import ToonInteriorColors +from . import ToonInteriorColors from toontown.hood import ZoneUtil class DistributedGagshopInterior(DistributedObject.DistributedObject): diff --git a/toontown/building/DistributedHQInterior.py b/toontown/building/DistributedHQInterior.py index ca7a4b5..d11ea96 100644 --- a/toontown/building/DistributedHQInterior.py +++ b/toontown/building/DistributedHQInterior.py @@ -6,8 +6,8 @@ import random from direct.task.Task import Task from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal -import ToonInteriorColors -import cPickle +from . import ToonInteriorColors +import pickle from toontown.toonbase import TTLocalizer class DistributedHQInterior(DistributedObject.DistributedObject): @@ -122,7 +122,7 @@ class DistributedHQInterior(DistributedObject.DistributedObject): trophyStar) def setLeaderBoard(self, leaderData): - avIds, names, scores = cPickle.loads(leaderData) + avIds, names, scores = pickle.loads(leaderData) self.notify.debug('setLeaderBoard: avIds: %s, names: %s, scores: %s' % (avIds, names, scores)) self.leaderAvIds = avIds self.leaderNames = names diff --git a/toontown/building/DistributedHQInteriorAI.py b/toontown/building/DistributedHQInteriorAI.py index 3863f05..2aba154 100644 --- a/toontown/building/DistributedHQInteriorAI.py +++ b/toontown/building/DistributedHQInteriorAI.py @@ -1,6 +1,6 @@ from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal -import cPickle +import pickle class DistributedHQInteriorAI(DistributedObjectAI.DistributedObjectAI): @@ -35,10 +35,10 @@ class DistributedHQInteriorAI(DistributedObjectAI.DistributedObjectAI): def sendNewLeaderBoard(self): if self.air: self.isDirty = False - self.sendUpdate('setLeaderBoard', [cPickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1)]) + self.sendUpdate('setLeaderBoard', [pickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1)]) def getLeaderBoard(self): - return cPickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1) + return pickle.dumps(self.air.trophyMgr.getLeaderInfo(), 1) def getTutorial(self): return self.tutorial diff --git a/toontown/building/DistributedKnockKnockDoor.py b/toontown/building/DistributedKnockKnockDoor.py index b8b905e..baa9a67 100644 --- a/toontown/building/DistributedKnockKnockDoor.py +++ b/toontown/building/DistributedKnockKnockDoor.py @@ -2,11 +2,11 @@ from pandac.PandaModules import * from libotp import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * -from KnockKnockJokes import * +from .KnockKnockJokes import * from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM -import DistributedAnimatedProp +from . import DistributedAnimatedProp from toontown.distributed import DelayDelete from toontown.toonbase import TTLocalizer from toontown.hood import ZoneUtil @@ -71,13 +71,13 @@ class DistributedKnockKnockDoor(DistributedAnimatedProp.DistributedAnimatedProp) if self.propId == 44: joke = KnockKnockContestJokes[ToontownGlobals.SillyStreet] elif branch == ToontownGlobals.LoopyLane: - if self.propId in KnockKnockContestJokes[ToontownGlobals.LoopyLane].keys(): + if self.propId in list(KnockKnockContestJokes[ToontownGlobals.LoopyLane].keys()): joke = KnockKnockContestJokes[ToontownGlobals.LoopyLane][self.propId] elif branch == ToontownGlobals.PunchlinePlace: if self.propId == 1: joke = KnockKnockContestJokes[ToontownGlobals.PunchlinePlace] elif branch == ToontownGlobals.PolarPlace: - if self.propId in KnockKnockContestJokes[ToontownGlobals.PolarPlace].keys(): + if self.propId in list(KnockKnockContestJokes[ToontownGlobals.PolarPlace].keys()): joke = KnockKnockContestJokes[ToontownGlobals.PolarPlace][self.propId] self.nametag = None self.nametagNP = None diff --git a/toontown/building/DistributedKnockKnockDoorAI.py b/toontown/building/DistributedKnockKnockDoorAI.py index 27727f3..9fdcc19 100644 --- a/toontown/building/DistributedKnockKnockDoorAI.py +++ b/toontown/building/DistributedKnockKnockDoorAI.py @@ -2,7 +2,7 @@ from otp.ai.AIBaseGlobal import * from direct.distributed.ClockDelta import * from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM -import DistributedAnimatedPropAI +from . import DistributedAnimatedPropAI from direct.task.Task import Task from direct.fsm import State diff --git a/toontown/building/DistributedPetshopInterior.py b/toontown/building/DistributedPetshopInterior.py index 0e6baf3..d2e39a4 100644 --- a/toontown/building/DistributedPetshopInterior.py +++ b/toontown/building/DistributedPetshopInterior.py @@ -6,7 +6,7 @@ import random from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal from direct.actor import Actor -import ToonInteriorColors +from . import ToonInteriorColors from toontown.hood import ZoneUtil class DistributedPetshopInterior(DistributedObject.DistributedObject): diff --git a/toontown/building/DistributedSuitInterior.py b/toontown/building/DistributedSuitInterior.py index 941d574..a89b0bb 100644 --- a/toontown/building/DistributedSuitInterior.py +++ b/toontown/building/DistributedSuitInterior.py @@ -1,7 +1,7 @@ from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * -from ElevatorConstants import * -import ElevatorUtils +from .ElevatorConstants import * +from . import ElevatorUtils from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals from direct.directnotify import DirectNotifyGlobal @@ -142,13 +142,13 @@ class DistributedSuitInterior(DistributedObject.DistributedObject): self.ignore(toon.uniqueName('disable')) def __finishInterval(self, name): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: interval = self.activeIntervals[name] if interval.isPlaying(): interval.finish() def __cleanupIntervals(self): - for interval in self.activeIntervals.values(): + for interval in list(self.activeIntervals.values()): interval.finish() self.activeIntervals = {} @@ -184,7 +184,7 @@ class DistributedSuitInterior(DistributedObject.DistributedObject): self.toons = [] for toonId in toonIds: if toonId != 0: - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: toon = self.cr.doId2do[toonId] toon.stopSmooth() self.toons.append(toon) @@ -202,7 +202,7 @@ class DistributedSuitInterior(DistributedObject.DistributedObject): self.suits = [] self.joiningReserves = [] for suitId in suitIds: - if self.cr.doId2do.has_key(suitId): + if suitId in self.cr.doId2do: suit = self.cr.doId2do[suitId] self.suits.append(suit) suit.fsm.request('Battle') @@ -216,7 +216,7 @@ class DistributedSuitInterior(DistributedObject.DistributedObject): self.reserveSuits = [] for index in range(len(reserveIds)): suitId = reserveIds[index] - if self.cr.doId2do.has_key(suitId): + if suitId in self.cr.doId2do: suit = self.cr.doId2do[suitId] self.reserveSuits.append((suit, values[index])) else: diff --git a/toontown/building/DistributedSuitInteriorAI.py b/toontown/building/DistributedSuitInteriorAI.py index f1014e0..3359c20 100644 --- a/toontown/building/DistributedSuitInteriorAI.py +++ b/toontown/building/DistributedSuitInteriorAI.py @@ -1,7 +1,7 @@ from toontown.toonbase.ToontownBattleGlobals import * from otp.ai.AIBaseGlobal import * from direct.distributed.ClockDelta import * -from ElevatorConstants import * +from .ElevatorConstants import * from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.distributed import DistributedObjectAI @@ -97,7 +97,7 @@ class DistributedSuitInteriorAI(DistributedObjectAI.DistributedObjectAI): return def __addToon(self, toonId): - if not self.air.doId2do.has_key(toonId): + if toonId not in self.air.doId2do: self.notify.warning('addToon() - no toon for doId: %d' % toonId) return event = self.air.getAvatarExitEvent(toonId) @@ -111,7 +111,7 @@ class DistributedSuitInteriorAI(DistributedObjectAI.DistributedObjectAI): self.toons.remove(toonId) if self.toonIds.count(toonId): self.toonIds[self.toonIds.index(toonId)] = None - if self.responses.has_key(toonId): + if toonId in self.responses: del self.responses[toonId] event = self.air.getAvatarExitEvent(toonId) if self.avatarExitEvents.count(event): diff --git a/toontown/building/DistributedToonHallInterior.py b/toontown/building/DistributedToonHallInterior.py index b721d49..d2c3f88 100644 --- a/toontown/building/DistributedToonHallInterior.py +++ b/toontown/building/DistributedToonHallInterior.py @@ -4,8 +4,8 @@ from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from direct.showbase import Audio3DManager from toontown.toonbase import ToontownGlobals -import cPickle -from DistributedToonInterior import DistributedToonInterior +import pickle +from .DistributedToonInterior import DistributedToonInterior from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.distributed import DistributedObject @@ -13,7 +13,7 @@ from direct.fsm import State from direct.actor import Actor import random import time -import ToonInteriorColors +from . import ToonInteriorColors from toontown.hood import ZoneUtil from toontown.toon import ToonDNA from toontown.toon import ToonHead diff --git a/toontown/building/DistributedToonHallInteriorAI.py b/toontown/building/DistributedToonHallInteriorAI.py index de16dc7..23a9252 100644 --- a/toontown/building/DistributedToonHallInteriorAI.py +++ b/toontown/building/DistributedToonHallInteriorAI.py @@ -1,4 +1,4 @@ -from DistributedToonInteriorAI import * +from .DistributedToonInteriorAI import * from toontown.toonbase import ToontownGlobals class DistributedToonHallInteriorAI(DistributedToonInteriorAI): diff --git a/toontown/building/DistributedToonInterior.py b/toontown/building/DistributedToonInterior.py index d9ec6a8..d683c68 100644 --- a/toontown/building/DistributedToonInterior.py +++ b/toontown/building/DistributedToonInterior.py @@ -4,14 +4,14 @@ from libtoontown import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from toontown.toonbase import ToontownGlobals -import cPickle -import ToonInterior +import pickle +from . import ToonInterior from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.distributed import DistributedObject from direct.fsm import State import random -import ToonInteriorColors +from . import ToonInteriorColors from toontown.hood import ZoneUtil from toontown.toon import ToonDNA from toontown.toon import ToonHead @@ -138,7 +138,7 @@ class DistributedToonInterior(DistributedObject.DistributedObject): self.block = block def setToonData(self, toonData): - savedBy = cPickle.loads(toonData) + savedBy = pickle.loads(toonData) self.savedBy = savedBy def buildTrophy(self): @@ -158,7 +158,7 @@ class DistributedToonInterior(DistributedObject.DistributedObject): def buildFrame(self, name, dnaTuple): frame = loader.loadModel('phase_3.5/models/modules/trophy_frame') dna = ToonDNA.ToonDNA() - apply(dna.newToonFromProperties, dnaTuple) + dna.newToonFromProperties(*dnaTuple) head = ToonHead.ToonHead() head.setupHead(dna) head.setPosHprScale(0, -0.05, -0.05, 180, 0, 0, 0.55, 0.02, 0.55) diff --git a/toontown/building/DistributedToonInteriorAI.py b/toontown/building/DistributedToonInteriorAI.py index 07e502c..f1af11f 100644 --- a/toontown/building/DistributedToonInteriorAI.py +++ b/toontown/building/DistributedToonInteriorAI.py @@ -1,7 +1,7 @@ from toontown.toonbase.ToontownGlobals import * from otp.ai.AIBaseGlobal import * from direct.distributed.ClockDelta import * -import cPickle +import pickle from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.distributed import DistributedObjectAI @@ -39,7 +39,7 @@ class DistributedToonInteriorAI(DistributedObjectAI.DistributedObjectAI): return r def getToonData(self): - return cPickle.dumps(self.building.savedBy, 1) + return pickle.dumps(self.building.savedBy, 1) def getState(self): r = [ diff --git a/toontown/building/DistributedTutorialInterior.py b/toontown/building/DistributedTutorialInterior.py index 81cfde5..2d8b1d1 100644 --- a/toontown/building/DistributedTutorialInterior.py +++ b/toontown/building/DistributedTutorialInterior.py @@ -3,11 +3,11 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from toontown.toonbase import ToontownGlobals -import ToonInterior +from . import ToonInterior from direct.directnotify import DirectNotifyGlobal from direct.distributed import DistributedObject import random -import ToonInteriorColors +from . import ToonInteriorColors from toontown.hood import ZoneUtil from toontown.char import Char from toontown.suit import SuitDNA @@ -123,7 +123,7 @@ class DistributedTutorialInterior(DistributedObject.DistributedObject): del self.dnaStore del self.randomGenerator self.interior.flattenMedium() - npcOrigin = self.interior.find('**/npc_origin_' + `(self.npc.posIndex)`) + npcOrigin = self.interior.find('**/npc_origin_' + repr((self.npc.posIndex))) if not npcOrigin.isEmpty(): self.npc.reparentTo(npcOrigin) self.npc.clearMat() diff --git a/toontown/building/DistributedVPElevator.py b/toontown/building/DistributedVPElevator.py index afcbf51..10dd6a1 100644 --- a/toontown/building/DistributedVPElevator.py +++ b/toontown/building/DistributedVPElevator.py @@ -1,6 +1,6 @@ -import DistributedElevator -import DistributedBossElevator -from ElevatorConstants import * +from . import DistributedElevator +from . import DistributedBossElevator +from .ElevatorConstants import * from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer diff --git a/toontown/building/DistributedVPElevatorAI.py b/toontown/building/DistributedVPElevatorAI.py index d63dbad..7a840f4 100644 --- a/toontown/building/DistributedVPElevatorAI.py +++ b/toontown/building/DistributedVPElevatorAI.py @@ -1,5 +1,5 @@ -from ElevatorConstants import * -import DistributedBossElevatorAI +from .ElevatorConstants import * +from . import DistributedBossElevatorAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals diff --git a/toontown/building/ElevatorUtils.py b/toontown/building/ElevatorUtils.py index c11def8..2b2cd79 100644 --- a/toontown/building/ElevatorUtils.py +++ b/toontown/building/ElevatorUtils.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from ElevatorConstants import * +from .ElevatorConstants import * def getLeftClosePoint(type): width = ElevatorData[type]['width'] diff --git a/toontown/building/GagshopBuildingAI.py b/toontown/building/GagshopBuildingAI.py index 8f09a39..213bb04 100644 --- a/toontown/building/GagshopBuildingAI.py +++ b/toontown/building/GagshopBuildingAI.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -import DistributedDoorAI, DistributedGagshopInteriorAI, FADoorCodes, DoorTypes +from . import DistributedDoorAI, DistributedGagshopInteriorAI, FADoorCodes, DoorTypes from toontown.toon import NPCToons from toontown.quest import Quests diff --git a/toontown/building/HQBuildingAI.py b/toontown/building/HQBuildingAI.py index 2874184..633066b 100644 --- a/toontown/building/HQBuildingAI.py +++ b/toontown/building/HQBuildingAI.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -import DistributedDoorAI, DistributedHQInteriorAI, FADoorCodes, DoorTypes +from . import DistributedDoorAI, DistributedHQInteriorAI, FADoorCodes, DoorTypes from toontown.toon import NPCToons from toontown.quest import Quests diff --git a/toontown/building/PetshopBuildingAI.py b/toontown/building/PetshopBuildingAI.py index f63b349..86dabbf 100644 --- a/toontown/building/PetshopBuildingAI.py +++ b/toontown/building/PetshopBuildingAI.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -import DistributedDoorAI, DistributedPetshopInteriorAI, FADoorCodes, DoorTypes +from . import DistributedDoorAI, DistributedPetshopInteriorAI, FADoorCodes, DoorTypes from toontown.toon import NPCToons from toontown.toonbase import ToontownGlobals from toontown.quest import Quests diff --git a/toontown/building/SuitBuildingGlobals.py b/toontown/building/SuitBuildingGlobals.py index cafa5cd..3eb9174 100644 --- a/toontown/building/SuitBuildingGlobals.py +++ b/toontown/building/SuitBuildingGlobals.py @@ -1,4 +1,4 @@ -from ElevatorConstants import * +from .ElevatorConstants import * SuitBuildingInfo = (((1, 1), (1, 3), (4, 4), diff --git a/toontown/building/SuitInterior.py b/toontown/building/SuitInterior.py index 5cdb1c1..c7447f8 100644 --- a/toontown/building/SuitInterior.py +++ b/toontown/building/SuitInterior.py @@ -8,7 +8,7 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.town import TownBattle from toontown.suit import Suit -import Elevator +from . import Elevator from direct.task.Task import Task from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs from toontown.toonbase import ToontownGlobals diff --git a/toontown/building/SuitPlannerInteriorAI.py b/toontown/building/SuitPlannerInteriorAI.py index 75d75cb..811c4ce 100644 --- a/toontown/building/SuitPlannerInteriorAI.py +++ b/toontown/building/SuitPlannerInteriorAI.py @@ -20,7 +20,7 @@ class SuitPlannerInteriorAI: self.dbg_defaultSuitType = None else: self.dbg_defaultSuitType = SuitDNA.getSuitType(dbg_defaultSuitName) - if isinstance(bldgLevel, types.StringType): + if isinstance(bldgLevel, bytes): self.notify.warning('bldgLevel is a string!') bldgLevel = int(bldgLevel) self._genSuitInfos(numFloors, bldgLevel, bldgTrack) diff --git a/toontown/building/ToonInterior.py b/toontown/building/ToonInterior.py index c5c9512..29e41d2 100644 --- a/toontown/building/ToonInterior.py +++ b/toontown/building/ToonInterior.py @@ -130,7 +130,7 @@ class ToonInterior(Place.Place): elif ds == 'incomplete': self.fsm.request('DFAReject') else: - self.notify.error('Unknown done status for DownloadForceAcknowledge: ' + `doneStatus`) + self.notify.error('Unknown done status for DownloadForceAcknowledge: ' + repr(doneStatus)) def enterNPCFA(self, requestStatus): self.acceptOnce(self.npcfaDoneEvent, self.enterNPCFACallback, [requestStatus]) @@ -151,7 +151,7 @@ class ToonInterior(Place.Place): elif doneStatus['mode'] == 'incomplete': self.fsm.request('NPCFAReject') else: - self.notify.error('Unknown done status for NPCForceAcknowledge: ' + `doneStatus`) + self.notify.error('Unknown done status for NPCForceAcknowledge: ' + repr(doneStatus)) def enterNPCFAReject(self): self.fsm.request('walk') @@ -178,7 +178,7 @@ class ToonInterior(Place.Place): elif doneStatus['mode'] == 'incomplete': self.fsm.request('HFAReject') else: - self.notify.error('Unknown done status for HealthForceAcknowledge: ' + `doneStatus`) + self.notify.error('Unknown done status for HealthForceAcknowledge: ' + repr(doneStatus)) def enterHFAReject(self): self.fsm.request('walk') diff --git a/toontown/catalog/CatalogAccessoryItem.py b/toontown/catalog/CatalogAccessoryItem.py index c291a8b..8632b91 100644 --- a/toontown/catalog/CatalogAccessoryItem.py +++ b/toontown/catalog/CatalogAccessoryItem.py @@ -1,5 +1,5 @@ -import CatalogItem -from CatalogAccessoryItemGlobals import * +from . import CatalogItem +from .CatalogAccessoryItemGlobals import * from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.toon import ToonDNA @@ -231,7 +231,7 @@ class CatalogAccessoryItem(CatalogItem.CatalogItem): def applyColor(self, model, color): if model == None or color == None: return - if isinstance(color, types.StringType): + if isinstance(color, bytes): tex = loader.loadTexture(color) tex.setMinfilter(Texture.FTLinearMipmapLinear) tex.setMagfilter(Texture.FTLinear) diff --git a/toontown/catalog/CatalogAnimatedFurnitureItem.py b/toontown/catalog/CatalogAnimatedFurnitureItem.py index 8184892..af31576 100644 --- a/toontown/catalog/CatalogAnimatedFurnitureItem.py +++ b/toontown/catalog/CatalogAnimatedFurnitureItem.py @@ -1,4 +1,4 @@ -from CatalogFurnitureItem import * +from .CatalogFurnitureItem import * FTAnimRate = 6 AnimatedFurnitureItemKeys = (10020, 270, 990, 460, 470, 480, 490, 491, 492) diff --git a/toontown/catalog/CatalogAtticItem.py b/toontown/catalog/CatalogAtticItem.py index 44cd6e7..cda98e0 100644 --- a/toontown/catalog/CatalogAtticItem.py +++ b/toontown/catalog/CatalogAtticItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import TTLocalizer from direct.showbase import PythonUtil from direct.gui.DirectGui import * diff --git a/toontown/catalog/CatalogBeanItem.py b/toontown/catalog/CatalogBeanItem.py index b2f09b6..0a3e0d5 100644 --- a/toontown/catalog/CatalogBeanItem.py +++ b/toontown/catalog/CatalogBeanItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPLocalizer diff --git a/toontown/catalog/CatalogChatItem.py b/toontown/catalog/CatalogChatItem.py index 4726a9e..0a89e4c 100644 --- a/toontown/catalog/CatalogChatItem.py +++ b/toontown/catalog/CatalogChatItem.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from otp.otpbase import OTPLocalizer from toontown.toonbase import TTLocalizer @@ -83,7 +83,7 @@ class CatalogChatItem(CatalogItem.CatalogItem): def showMessagePicker(self, phone, callback): self.phone = phone self.callback = callback - import CatalogChatItemPicker + from . import CatalogChatItemPicker self.messagePicker = CatalogChatItemPicker.CatalogChatItemPicker(self.__handlePickerDone, self.customIndex) self.messagePicker.show() @@ -91,16 +91,16 @@ class CatalogChatItem(CatalogItem.CatalogItem): self.mailbox = mailbox self.callback = callback self.index = index - import CatalogChatItemPicker + from . import CatalogChatItemPicker self.messagePicker = CatalogChatItemPicker.CatalogChatItemPicker(self.__handlePickerOnAccept, self.customIndex) self.messagePicker.show() def __handlePickerOnAccept(self, status, pickedMessage = None): - print 'Picker Status%s' % status + print('Picker Status%s' % status) if status == 'pick': self.mailbox.acceptItem(self, self.index, self.callback, pickedMessage) else: - print 'picker canceled' + print('picker canceled') self.callback(ToontownGlobals.P_UserCancelled, None, self.index) self.messagePicker.hide() self.messagePicker.destroy() @@ -140,7 +140,7 @@ def getChatRange(fromIndex, toIndex, *otherRanges): tos.append(otherRanges[i + 1]) i += 2 - for chatId in OTPLocalizer.CustomSCStrings.keys(): + for chatId in list(OTPLocalizer.CustomSCStrings.keys()): for fromIndex, toIndex in zip(froms, tos): if chatId >= fromIndex and chatId <= toIndex and chatId not in bannedPhrases: list.append(CatalogChatItem(chatId)) diff --git a/toontown/catalog/CatalogChatItemPicker.py b/toontown/catalog/CatalogChatItemPicker.py index 2f36608..655ae02 100644 --- a/toontown/catalog/CatalogChatItemPicker.py +++ b/toontown/catalog/CatalogChatItemPicker.py @@ -1,7 +1,7 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.showbase import DirectObject -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPLocalizer diff --git a/toontown/catalog/CatalogClothingItem.py b/toontown/catalog/CatalogClothingItem.py index 429986e..83aac86 100644 --- a/toontown/catalog/CatalogClothingItem.py +++ b/toontown/catalog/CatalogClothingItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.toon import ToonDNA diff --git a/toontown/catalog/CatalogEmoteItem.py b/toontown/catalog/CatalogEmoteItem.py index ed421a1..52bebd8 100644 --- a/toontown/catalog/CatalogEmoteItem.py +++ b/toontown/catalog/CatalogEmoteItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPLocalizer diff --git a/toontown/catalog/CatalogFlooringItem.py b/toontown/catalog/CatalogFlooringItem.py index 01abba8..984b135 100644 --- a/toontown/catalog/CatalogFlooringItem.py +++ b/toontown/catalog/CatalogFlooringItem.py @@ -1,4 +1,4 @@ -from CatalogSurfaceItem import * +from .CatalogSurfaceItem import * FTTextureName = 0 FTColor = 1 FTBasePrice = 2 @@ -100,7 +100,7 @@ class CatalogFlooringItem(CatalogSurfaceItem): if colorIndex < len(colors): return colors[colorIndex] else: - print 'Warning: colorIndex not in colors. Returning white.' + print('Warning: colorIndex not in colors. Returning white.') return CT_WHITE else: return CT_WHITE @@ -158,7 +158,7 @@ def getFlooringRange(fromIndex, toIndex, *otherRanges): tos.append(otherRanges[i + 1]) i += 2 - for patternIndex in FlooringTypes.keys(): + for patternIndex in list(FlooringTypes.keys()): for fromIndex, toIndex in zip(froms, tos): if patternIndex >= fromIndex and patternIndex <= toIndex: colors = FlooringTypes[patternIndex][FTColor] diff --git a/toontown/catalog/CatalogFurnitureItem.py b/toontown/catalog/CatalogFurnitureItem.py index 5afbce0..dd2f28a 100644 --- a/toontown/catalog/CatalogFurnitureItem.py +++ b/toontown/catalog/CatalogFurnitureItem.py @@ -1,5 +1,5 @@ -import CatalogAtticItem -import CatalogItem +from . import CatalogAtticItem +from . import CatalogItem import random from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -73,7 +73,7 @@ BankToMoney = {1300: 12000, 1340: 12000, 1350: 12000} MoneyToBank = {} -for bankId, maxMoney in BankToMoney.items(): +for bankId, maxMoney in list(BankToMoney.items()): MoneyToBank[maxMoney] = bankId MaxBankId = 1350 @@ -88,8 +88,8 @@ ClosetToClothes = {500: 10, 516: 25, 518: 50} ClothesToCloset = {} -for closetId, maxClothes in ClosetToClothes.items(): - if not ClothesToCloset.has_key(maxClothes): +for closetId, maxClothes in list(ClosetToClothes.items()): + if maxClothes not in ClothesToCloset: ClothesToCloset[maxClothes] = (closetId,) else: ClothesToCloset[maxClothes] += (closetId,) @@ -1080,7 +1080,7 @@ class CatalogFurnitureItem(CatalogAtticItem.CatalogAtticItem): self.applyColor(model, type[FTColor]) if type[FTColorOptions] != None: if self.colorOption == None: - option = random.choice(type[FTColorOptions].values()) + option = random.choice(list(type[FTColorOptions].values())) else: option = type[FTColorOptions].get(self.colorOption) self.applyColor(model, option) @@ -1161,7 +1161,7 @@ def getMaxClosets(): def getAllClosets(): list = [] - for closetId in ClosetToClothes.keys(): + for closetId in list(ClosetToClothes.keys()): list.append(CatalogFurnitureItem(closetId)) return list diff --git a/toontown/catalog/CatalogGardenItem.py b/toontown/catalog/CatalogGardenItem.py index 97ed7fb..6a8e98d 100644 --- a/toontown/catalog/CatalogGardenItem.py +++ b/toontown/catalog/CatalogGardenItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPLocalizer @@ -50,7 +50,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem): def getPicture(self, avatar): photoModel = GardenGlobals.Specials[self.gardenIndex]['photoModel'] - if GardenGlobals.Specials[self.gardenIndex].has_key('photoAnimation'): + if 'photoAnimation' in GardenGlobals.Specials[self.gardenIndex]: modelPath = photoModel + GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][0] animationName = GardenGlobals.Specials[self.gardenIndex]['photoAnimation'][1] animationPath = photoModel + animationName @@ -160,7 +160,7 @@ class CatalogGardenItem(CatalogItem.CatalogItem): result = False if canPlant < numBeansRequired: result = True - if not result and GardenGlobals.Specials.has_key(self.gardenIndex) and GardenGlobals.Specials[self.gardenIndex].has_key('minSkill'): + if not result and self.gardenIndex in GardenGlobals.Specials and 'minSkill' in GardenGlobals.Specials[self.gardenIndex]: minSkill = GardenGlobals.Specials[self.gardenIndex]['minSkill'] if avatar.shovelSkill < minSkill: result = True diff --git a/toontown/catalog/CatalogGardenStarterItem.py b/toontown/catalog/CatalogGardenStarterItem.py index 6e2f3ec..0baa318 100644 --- a/toontown/catalog/CatalogGardenStarterItem.py +++ b/toontown/catalog/CatalogGardenStarterItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem import time from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer @@ -30,15 +30,15 @@ class CatalogGardenStarterItem(CatalogItem.CatalogItem): return TTLocalizer.GardenStarterTypeName def recordPurchase(self, avatar, optional): - print 'rental-- record purchase' + print('rental-- record purchase') if avatar: - print 'starter garden-- has avater' + print('starter garden-- has avater') estate = simbase.air.estateMgr.estate.get(avatar.doId) if estate: - print 'starter garden-- has estate' + print('starter garden-- has estate') estate.placeStarterGarden(avatar.doId) else: - print 'starter garden-- something not there' + print('starter garden-- something not there') return ToontownGlobals.P_ItemAvailable def getPicture(self, avatar): diff --git a/toontown/catalog/CatalogGenerator.py b/toontown/catalog/CatalogGenerator.py index 90ab5f4..e686935 100644 --- a/toontown/catalog/CatalogGenerator.py +++ b/toontown/catalog/CatalogGenerator.py @@ -1,24 +1,24 @@ from direct.directnotify import DirectNotifyGlobal -import CatalogItem -import CatalogItemList -from CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk -from CatalogAnimatedFurnitureItem import CatalogAnimatedFurnitureItem -from CatalogClothingItem import CatalogClothingItem, getAllClothes -from CatalogChatItem import CatalogChatItem, getChatRange -from CatalogEmoteItem import CatalogEmoteItem -from CatalogWallpaperItem import CatalogWallpaperItem, getWallpapers -from CatalogFlooringItem import CatalogFlooringItem, getFloorings -from CatalogMouldingItem import CatalogMouldingItem, getAllMouldings -from CatalogWainscotingItem import CatalogWainscotingItem, getAllWainscotings -from CatalogWindowItem import CatalogWindowItem -from CatalogPoleItem import nextAvailablePole, getAllPoles -from CatalogPetTrickItem import CatalogPetTrickItem, getAllPetTricks -from CatalogGardenItem import CatalogGardenItem -from CatalogToonStatueItem import CatalogToonStatueItem -from CatalogRentalItem import CatalogRentalItem -from CatalogGardenStarterItem import CatalogGardenStarterItem -from CatalogNametagItem import CatalogNametagItem -from CatalogAccessoryItem import CatalogAccessoryItem +from . import CatalogItem +from . import CatalogItemList +from .CatalogFurnitureItem import CatalogFurnitureItem, nextAvailableCloset, getAllClosets, get50ItemCloset, getMaxClosets, get50ItemTrunk +from .CatalogAnimatedFurnitureItem import CatalogAnimatedFurnitureItem +from .CatalogClothingItem import CatalogClothingItem, getAllClothes +from .CatalogChatItem import CatalogChatItem, getChatRange +from .CatalogEmoteItem import CatalogEmoteItem +from .CatalogWallpaperItem import CatalogWallpaperItem, getWallpapers +from .CatalogFlooringItem import CatalogFlooringItem, getFloorings +from .CatalogMouldingItem import CatalogMouldingItem, getAllMouldings +from .CatalogWainscotingItem import CatalogWainscotingItem, getAllWainscotings +from .CatalogWindowItem import CatalogWindowItem +from .CatalogPoleItem import nextAvailablePole, getAllPoles +from .CatalogPetTrickItem import CatalogPetTrickItem, getAllPetTricks +from .CatalogGardenItem import CatalogGardenItem +from .CatalogToonStatueItem import CatalogToonStatueItem +from .CatalogRentalItem import CatalogRentalItem +from .CatalogGardenStarterItem import CatalogGardenStarterItem +from .CatalogNametagItem import CatalogNametagItem +from .CatalogAccessoryItem import CatalogAccessoryItem from direct.actor import Actor from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -1636,9 +1636,9 @@ class CatalogGenerator: saleItem = 1 if callable(item): item = item(avatar, duplicateItems) - if isinstance(item, types.TupleType): + if isinstance(item, tuple): chooseCount, item = item - if isinstance(item, types.IntType): + if isinstance(item, int): item = MetaItems[item] selection = [] if isinstance(item, CatalogItem.CatalogItem): @@ -1673,7 +1673,7 @@ class CatalogGenerator: def outputSchedule(self, filename): out = open(Filename(filename).toOsSpecific(), 'w') sched = self.generateScheduleDictionary() - items = sched.keys() + items = list(sched.keys()) items.sort() for item in items: weeklist, maybeWeeklist = sched[item] @@ -1681,7 +1681,7 @@ class CatalogGenerator: seriesDict = {} self.__determineSeries(seriesDict, weeklist) self.__determineSeries(seriesDict, maybeWeeklist) - seriesList = seriesDict.keys() + seriesList = list(seriesDict.keys()) seriesList.sort() series = str(seriesList)[1:-1] week = self.__formatWeeklist(weeklist) @@ -1708,7 +1708,7 @@ class CatalogGenerator: def __determineSeries(self, seriesDict, weeklist): for week in weeklist: - if isinstance(week, types.IntType): + if isinstance(week, int): series = (week - 1) / ToontownGlobals.CatalogNumWeeksPerSeries + 1 seriesDict[series] = None @@ -1763,9 +1763,9 @@ class CatalogGenerator: else: self.notify.warning("Don't know how to interpret function " % repr(name)) item = None - elif isinstance(item, types.TupleType): + elif isinstance(item, tuple): item = item[1] - if isinstance(item, types.IntType): + if isinstance(item, int): item = MetaItems[item] if isinstance(item, CatalogItem.CatalogItem): self.__recordScheduleItem(sched, weekCode, None, item) @@ -1776,7 +1776,7 @@ class CatalogGenerator: return def __recordScheduleItem(self, sched, weekCode, maybeWeekCode, item): - if not sched.has_key(item): + if item not in sched: sched[item] = [[], []] if weekCode != None: sched[item][0].append(weekCode) diff --git a/toontown/catalog/CatalogInvalidItem.py b/toontown/catalog/CatalogInvalidItem.py index 15ee9b4..fca964a 100644 --- a/toontown/catalog/CatalogInvalidItem.py +++ b/toontown/catalog/CatalogInvalidItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import TTLocalizer from direct.showbase import PythonUtil from toontown.toonbase import ToontownGlobals diff --git a/toontown/catalog/CatalogItem.py b/toontown/catalog/CatalogItem.py index 1670961..bb169d8 100644 --- a/toontown/catalog/CatalogItem.py +++ b/toontown/catalog/CatalogItem.py @@ -209,7 +209,7 @@ class CatalogItem: mailbox.acceptItem(self, index, callback) def discardItem(self, mailbox, index, callback): - print 'Item discardItem' + print('Item discardItem') mailbox.discardItem(self, index, callback) def acceptItemCleanup(self): @@ -323,7 +323,7 @@ class CatalogItem: dg.addUint8(self.specialEventId) def getTypeCode(self): - import CatalogItemTypes + from . import CatalogItemTypes return CatalogItemTypes.CatalogItemTypes[self.__class__] def applyColor(self, model, colorDesc): @@ -333,7 +333,7 @@ class CatalogItem: matches = model.findAllMatches(partName) if color == None: matches.hide() - elif isinstance(color, types.StringType): + elif isinstance(color, bytes): tex = loader.loadTexture(color) tex.setMinfilter(Texture.FTLinearMipmapLinear) tex.setMagfilter(Texture.FTLinear) @@ -404,7 +404,7 @@ class CatalogItem: def encodeCatalogItem(dg, item, store): - import CatalogItemTypes + from . import CatalogItemTypes flags = item.getTypeCode() if item.isSaleItem(): flags |= CatalogItemTypes.CatalogItemSaleFlag @@ -422,10 +422,10 @@ def encodeCatalogItem(dg, item, store): def decodeCatalogItem(di, versionNumber, store): global CatalogReverseType - import CatalogItemTypes + from . import CatalogItemTypes if CatalogReverseType == None: CatalogReverseType = {} - for itemClass, index in CatalogItemTypes.CatalogItemTypes.items(): + for itemClass, index in list(CatalogItemTypes.CatalogItemTypes.items()): CatalogReverseType[index] = itemClass startIndex = di.getCurrentIndex() @@ -439,11 +439,11 @@ def decodeCatalogItem(di, versionNumber, store): code = di.getUint8() itemClass = CatalogReverseType[typeIndex] item = itemClass(di, versionNumber, store=store) - except Exception, e: + except Exception as e: CatalogItem.notify.warning('Invalid catalog item in stream: %s, %s' % (sys.exc_info()[0], e)) d = Datagram(di.getDatagram().getMessage()[startIndex:]) d.dumpHex(Notify.out()) - import CatalogInvalidItem + from . import CatalogInvalidItem return CatalogInvalidItem.CatalogInvalidItem() if flags & CatalogItemTypes.CatalogItemSaleFlag: @@ -459,8 +459,8 @@ def getItem(blob, store = 0): try: versionNumber = di.getUint8() return decodeCatalogItem(di, versionNumber, store) - except Exception, e: + except Exception as e: CatalogItem.notify.warning('Invalid catalog item: %s, %s' % (sys.exc_info()[0], e)) dg.dumpHex(Notify.out()) - import CatalogInvalidItem + from . import CatalogInvalidItem return CatalogInvalidItem.CatalogInvalidItem() diff --git a/toontown/catalog/CatalogItemList.py b/toontown/catalog/CatalogItemList.py index ae8f4eb..5249038 100644 --- a/toontown/catalog/CatalogItemList.py +++ b/toontown/catalog/CatalogItemList.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from pandac.PandaModules import * import types from direct.distributed.PyDatagram import PyDatagram @@ -10,9 +10,9 @@ class CatalogItemList: self.store = store self.__blob = None self.__list = None - if isinstance(source, types.StringType): + if isinstance(source, bytes): self.__blob = source - elif isinstance(source, types.ListType): + elif isinstance(source, list): self.__list = source[:] elif isinstance(source, CatalogItemList): if source.store == store: diff --git a/toontown/catalog/CatalogItemPanel.py b/toontown/catalog/CatalogItemPanel.py index 67f1596..1d6be69 100644 --- a/toontown/catalog/CatalogItemPanel.py +++ b/toontown/catalog/CatalogItemPanel.py @@ -3,14 +3,14 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog from toontown.toonbase import TTLocalizer -import CatalogItemTypes -import CatalogItem -from CatalogWallpaperItem import getAllWallpapers -from CatalogFlooringItem import getAllFloorings -from CatalogMouldingItem import getAllMouldings -from CatalogWainscotingItem import getAllWainscotings -from CatalogFurnitureItem import getAllFurnitures -from CatalogFurnitureItem import FLTrunk +from . import CatalogItemTypes +from . import CatalogItem +from .CatalogWallpaperItem import getAllWallpapers +from .CatalogFlooringItem import getAllFloorings +from .CatalogMouldingItem import getAllMouldings +from .CatalogWainscotingItem import getAllWainscotings +from .CatalogFurnitureItem import getAllFurnitures +from .CatalogFurnitureItem import FLTrunk from toontown.toontowngui.TeaserPanel import TeaserPanel from otp.otpbase import OTPGlobals from direct.directnotify import DirectNotifyGlobal diff --git a/toontown/catalog/CatalogItemTypes.py b/toontown/catalog/CatalogItemTypes.py index 8162ba1..190aa8d 100644 --- a/toontown/catalog/CatalogItemTypes.py +++ b/toontown/catalog/CatalogItemTypes.py @@ -1,23 +1,23 @@ -import CatalogFurnitureItem -import CatalogChatItem -import CatalogClothingItem -import CatalogEmoteItem -import CatalogWallpaperItem -import CatalogFlooringItem -import CatalogWainscotingItem -import CatalogMouldingItem -import CatalogWindowItem -import CatalogPoleItem -import CatalogPetTrickItem -import CatalogBeanItem -import CatalogGardenItem -import CatalogInvalidItem -import CatalogRentalItem -import CatalogGardenStarterItem -import CatalogNametagItem -import CatalogToonStatueItem -import CatalogAnimatedFurnitureItem -import CatalogAccessoryItem +from . import CatalogFurnitureItem +from . import CatalogChatItem +from . import CatalogClothingItem +from . import CatalogEmoteItem +from . import CatalogWallpaperItem +from . import CatalogFlooringItem +from . import CatalogWainscotingItem +from . import CatalogMouldingItem +from . import CatalogWindowItem +from . import CatalogPoleItem +from . import CatalogPetTrickItem +from . import CatalogBeanItem +from . import CatalogGardenItem +from . import CatalogInvalidItem +from . import CatalogRentalItem +from . import CatalogGardenStarterItem +from . import CatalogNametagItem +from . import CatalogToonStatueItem +from . import CatalogAnimatedFurnitureItem +from . import CatalogAccessoryItem INVALID_ITEM = 0 FURNITURE_ITEM = 1 CHAT_ITEM = 2 diff --git a/toontown/catalog/CatalogMouldingItem.py b/toontown/catalog/CatalogMouldingItem.py index 858c904..ca976d0 100644 --- a/toontown/catalog/CatalogMouldingItem.py +++ b/toontown/catalog/CatalogMouldingItem.py @@ -1,4 +1,4 @@ -from CatalogSurfaceItem import * +from .CatalogSurfaceItem import * MTTextureName = 0 MTColor = 1 MTBasePrice = 2 @@ -85,7 +85,7 @@ class CatalogMouldingItem(CatalogSurfaceItem): if colorIndex < len(colors): return colors[colorIndex] else: - print 'Warning: colorIndex not in colors. Returning white.' + print('Warning: colorIndex not in colors. Returning white.') return CT_WHITE else: return CT_WHITE @@ -138,7 +138,7 @@ def getMouldingRange(fromIndex, toIndex, *otherRanges): tos.append(otherRanges[i + 1]) i += 2 - for patternIndex in MouldingTypes.keys(): + for patternIndex in list(MouldingTypes.keys()): for fromIndex, toIndex in zip(froms, tos): if patternIndex >= fromIndex and patternIndex <= toIndex: colors = MouldingTypes[patternIndex][MTColor] diff --git a/toontown/catalog/CatalogNametagItem.py b/toontown/catalog/CatalogNametagItem.py index 21c3d13..296d7cc 100644 --- a/toontown/catalog/CatalogNametagItem.py +++ b/toontown/catalog/CatalogNametagItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPLocalizer diff --git a/toontown/catalog/CatalogPetTrickItem.py b/toontown/catalog/CatalogPetTrickItem.py index b05260f..29117a3 100644 --- a/toontown/catalog/CatalogPetTrickItem.py +++ b/toontown/catalog/CatalogPetTrickItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.pets import PetTricks from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer @@ -97,7 +97,7 @@ class CatalogPetTrickItem(CatalogItem.CatalogItem): def getAllPetTricks(): list = [] - for trickId in PetTricks.TrickId2scIds.keys(): + for trickId in list(PetTricks.TrickId2scIds.keys()): list.append(CatalogPetTrickItem(trickId)) return list diff --git a/toontown/catalog/CatalogPoleItem.py b/toontown/catalog/CatalogPoleItem.py index 1011b8e..afa6e02 100644 --- a/toontown/catalog/CatalogPoleItem.py +++ b/toontown/catalog/CatalogPoleItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.fishing import FishGlobals from direct.actor import Actor diff --git a/toontown/catalog/CatalogRentalItem.py b/toontown/catalog/CatalogRentalItem.py index 1027a41..4f2a465 100644 --- a/toontown/catalog/CatalogRentalItem.py +++ b/toontown/catalog/CatalogRentalItem.py @@ -1,4 +1,4 @@ -import CatalogItem +from . import CatalogItem import time from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer diff --git a/toontown/catalog/CatalogScreen.py b/toontown/catalog/CatalogScreen.py index 111d345..2f31d86 100644 --- a/toontown/catalog/CatalogScreen.py +++ b/toontown/catalog/CatalogScreen.py @@ -4,12 +4,12 @@ from pandac.PandaModules import * from direct.gui.DirectScrolledList import * from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog -import CatalogItem -import CatalogInvalidItem -import CatalogFurnitureItem +from . import CatalogItem +from . import CatalogInvalidItem +from . import CatalogFurnitureItem from toontown.toonbase import TTLocalizer -import CatalogItemPanel -import CatalogItemTypes +from . import CatalogItemPanel +from . import CatalogItemTypes from direct.actor import Actor import random from toontown.toon import DistributedToon @@ -309,7 +309,7 @@ class CatalogScreen(DirectFrame): for j in range(NUM_CATALOG_COLS): if pIndex < len(self.visiblePanels): type = self.visiblePanels[pIndex]['item'].getTypeCode() - self.squares[i][j].setColor(CatalogPanelColors.values()[randGen.randint(0, len(CatalogPanelColors) - 1)]) + self.squares[i][j].setColor(list(CatalogPanelColors.values())[randGen.randint(0, len(CatalogPanelColors) - 1)]) cs = 0.7 + 0.3 * randGen.random() self.squares[i][j].setColorScale(0.7 + 0.3 * randGen.random(), 0.7 + 0.3 * randGen.random(), 0.7 + 0.3 * randGen.random(), 1) else: @@ -345,7 +345,7 @@ class CatalogScreen(DirectFrame): def adjustForSound(self): numEmoteItems = 0 emotePanels = [] - for visIndex in xrange(len(self.visiblePanels)): + for visIndex in range(len(self.visiblePanels)): panel = self.visiblePanels[visIndex] item = panel['item'] catalogType = item.getTypeCode() diff --git a/toontown/catalog/CatalogSurfaceItem.py b/toontown/catalog/CatalogSurfaceItem.py index 8984e12..b391000 100644 --- a/toontown/catalog/CatalogSurfaceItem.py +++ b/toontown/catalog/CatalogSurfaceItem.py @@ -1,8 +1,8 @@ -import CatalogItem -import CatalogAtticItem +from . import CatalogItem +from . import CatalogAtticItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -from CatalogSurfaceColors import * +from .CatalogSurfaceColors import * STWallpaper = 0 STMoulding = 1 STFlooring = 2 diff --git a/toontown/catalog/CatalogToonStatueItem.py b/toontown/catalog/CatalogToonStatueItem.py index 0353753..20046d8 100644 --- a/toontown/catalog/CatalogToonStatueItem.py +++ b/toontown/catalog/CatalogToonStatueItem.py @@ -1,4 +1,4 @@ -import CatalogGardenItem +from . import CatalogGardenItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPLocalizer diff --git a/toontown/catalog/CatalogWainscotingItem.py b/toontown/catalog/CatalogWainscotingItem.py index accd395..b6b9cad 100644 --- a/toontown/catalog/CatalogWainscotingItem.py +++ b/toontown/catalog/CatalogWainscotingItem.py @@ -1,4 +1,4 @@ -from CatalogSurfaceItem import * +from .CatalogSurfaceItem import * WSTTextureName = 0 WSTColor = 1 WSTBasePrice = 2 @@ -76,7 +76,7 @@ class CatalogWainscotingItem(CatalogSurfaceItem): if colorIndex < len(colors): return colors[colorIndex] else: - print 'Warning: colorIndex not in colors. Returning white.' + print('Warning: colorIndex not in colors. Returning white.') return CT_WHITE else: return CT_WHITE @@ -129,7 +129,7 @@ def getWainscotingRange(fromIndex, toIndex, *otherRanges): tos.append(otherRanges[i + 1]) i += 2 - for patternIndex in WainscotingTypes.keys(): + for patternIndex in list(WainscotingTypes.keys()): for fromIndex, toIndex in zip(froms, tos): if patternIndex >= fromIndex and patternIndex <= toIndex: colors = WainscotingTypes[patternIndex][WSTColor] diff --git a/toontown/catalog/CatalogWallpaperItem.py b/toontown/catalog/CatalogWallpaperItem.py index ec5bc70..fd0f107 100644 --- a/toontown/catalog/CatalogWallpaperItem.py +++ b/toontown/catalog/CatalogWallpaperItem.py @@ -1,4 +1,4 @@ -from CatalogSurfaceItem import * +from .CatalogSurfaceItem import * WTTextureName = 0 WTColor = 1 WTBorderList = 2 @@ -636,7 +636,7 @@ class CatalogWallpaperItem(CatalogSurfaceItem): if colorIndex < len(colors): return colors[colorIndex] else: - print 'Warning: colorIndex > len(colors). Returning white.' + print('Warning: colorIndex > len(colors). Returning white.') return CT_WHITE return @@ -732,7 +732,7 @@ def getWallpaperRange(fromIndex, toIndex, *otherRanges): tos.append(otherRanges[i + 1]) i += 2 - for patternIndex in WallpaperTypes.keys(): + for patternIndex in list(WallpaperTypes.keys()): for fromIndex, toIndex in zip(froms, tos): if patternIndex >= fromIndex and patternIndex <= toIndex: borderKeys = WallpaperTypes[patternIndex][WTBorderList] diff --git a/toontown/catalog/CatalogWindowItem.py b/toontown/catalog/CatalogWindowItem.py index 48858b7..9ad7fab 100644 --- a/toontown/catalog/CatalogWindowItem.py +++ b/toontown/catalog/CatalogWindowItem.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * -import CatalogAtticItem -import CatalogItem +from . import CatalogAtticItem +from . import CatalogItem from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer WVTModelName = 0 diff --git a/toontown/catalog/MailboxScreen.py b/toontown/catalog/MailboxScreen.py index 97b00c3..acbcff5 100644 --- a/toontown/catalog/MailboxScreen.py +++ b/toontown/catalog/MailboxScreen.py @@ -10,7 +10,7 @@ from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.toontowngui import TTDialog from toontown.toontowngui.TeaserPanel import TeaserPanel from toontown.parties.InviteVisual import InviteVisual -import CatalogItem +from . import CatalogItem from direct.showbase.PythonUtil import StackTrace class MailboxScreen(DirectObject.DirectObject): @@ -45,9 +45,9 @@ class MailboxScreen(DirectObject.DirectObject): else: self.notify.warning('hide called, but frame is deleted, self.frame deleted in:') if hasattr(self, 'frameDelStackTrace'): - print self.frameDelStackTrace + print(self.frameDelStackTrace) self.notify.warning('current stackTrace =') - print StackTrace() + print(StackTrace()) self.notify.warning('crash averted, but root cause unknown') def load(self): @@ -243,7 +243,7 @@ class MailboxScreen(DirectObject.DirectObject): if not hasattr(self, 'frame'): return if retcode == ToontownGlobals.P_UserCancelled: - print 'mailbox screen user canceled' + print('mailbox screen user canceled') self.acceptingIndex = None self.__updateItems() return @@ -294,7 +294,7 @@ class MailboxScreen(DirectObject.DirectObject): self.dialogBox = None self.items = self.getItems() if self.itemIndex > index or self.itemIndex >= len(self.items): - print 'adjusting item index -1' + print('adjusting item index -1') self.itemIndex -= 1 if len(self.items) < 1: self.__handleExit() @@ -314,10 +314,10 @@ class MailboxScreen(DirectObject.DirectObject): self.dialogBox = None self.items = self.getItems() if self.itemIndex >= len(self.items): - print 'adjusting item index -1' + print('adjusting item index -1') self.itemIndex = len(self.items) - 1 if len(self.items) == 0: - print 'exiting due to lack of items' + print('exiting due to lack of items') self.__handleExit() return self.itemCountLabel['text'] = (self.__getNumberOfItemsText(),) diff --git a/toontown/char/Char.py b/toontown/char/Char.py index 510dcf0..d779346 100644 --- a/toontown/char/Char.py +++ b/toontown/char/Char.py @@ -217,14 +217,14 @@ class Char(Avatar.Avatar): self.loadDialogue(dna.name) self.ears = [] if self._name == 'mickey' or self._name == 'vampire_mickey' or self._name == 'minnie': - for bundle in self.getPartBundleDict().values(): + for bundle in list(self.getPartBundleDict().values()): bundle = bundle['modelRoot'].getBundle() earNull = bundle.findChild('sphere3') if not earNull: earNull = bundle.findChild('*sphere3') earNull.clearNetTransforms() - for bundle in self.getPartBundleDict().values(): + for bundle in list(self.getPartBundleDict().values()): charNodepath = bundle['modelRoot'].partBundleNP bundle = bundle['modelRoot'].getBundle() earNull = bundle.findChild('sphere3') diff --git a/toontown/char/DistributedChar.py b/toontown/char/DistributedChar.py index e397e7a..6517af5 100644 --- a/toontown/char/DistributedChar.py +++ b/toontown/char/DistributedChar.py @@ -1,5 +1,5 @@ from otp.avatar import DistributedAvatar -import Char +from . import Char class DistributedChar(DistributedAvatar.DistributedAvatar, Char.Char): diff --git a/toontown/chat/ResistanceChat.py b/toontown/chat/ResistanceChat.py index 0bb7283..d15cbc6 100644 --- a/toontown/chat/ResistanceChat.py +++ b/toontown/chat/ResistanceChat.py @@ -80,7 +80,7 @@ def validateId(textId): if textId < 0: return 0 menuIndex, itemIndex = decodeId(textId) - if not resistanceDict.has_key(menuIndex): + if menuIndex not in resistanceDict: return 0 if itemIndex >= len(resistanceDict[menuIndex]['values']): return 0 @@ -139,7 +139,7 @@ def doEffect(textId, speakingToon, nearbyToons): 'particles-3': (0, 1, 0, 1), 'particles-4': (0, 0, 1, 1), 'particles-5': (1, 0, 1, 1)} - for name, color in colors.items(): + for name, color in list(colors.items()): node = bean.copyTo(NodePath()) node.setColorScale(*color) p = effect.getParticlesNamed(name) @@ -158,7 +158,7 @@ def doEffect(textId, speakingToon, nearbyToons): icons.append(invModel.find('**/%s' % iconName)) else: - tracks = range(7) + tracks = list(range(7)) random.shuffle(tracks) for i in range(6): track = tracks[i] @@ -172,7 +172,7 @@ def doEffect(textId, speakingToon, nearbyToons): 'particles-4': icons[3], 'particles-5': icons[4], 'particles-6': icons[5]} - for name, icon in iconDict.items(): + for name, icon in list(iconDict.items()): p = effect.getParticlesNamed(name) p.renderer.setFromNode(icon) diff --git a/toontown/chat/TTChatInputNormal.py b/toontown/chat/TTChatInputNormal.py index 0e8765d..d1f0198 100644 --- a/toontown/chat/TTChatInputNormal.py +++ b/toontown/chat/TTChatInputNormal.py @@ -32,7 +32,7 @@ class TTChatInputNormal(ChatInputNormal.ChatInputNormal): def importExecNamespace(self): ChatInputNormal.ChatInputNormal.importExecNamespace(self) - exec 'from toontown.toonbase.ToonBaseGlobal import *' in globals(), self.ExecNamespace + exec('from toontown.toonbase.ToonBaseGlobal import *', globals(), self.ExecNamespace) def typeCallback(self, extraArgs): if localAvatar.chatMgr.chatInputWhiteList.isActive(): diff --git a/toontown/chat/TTChatInputWhiteList.py b/toontown/chat/TTChatInputWhiteList.py index 6911b52..c71f539 100644 --- a/toontown/chat/TTChatInputWhiteList.py +++ b/toontown/chat/TTChatInputWhiteList.py @@ -119,7 +119,7 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame): def sendWhisperByFriend(self, avatarId, text): online = 0 - if base.cr.doId2do.has_key(avatarId): + if avatarId in base.cr.doId2do: online = 1 avatarUnderstandable = 0 av = None @@ -132,7 +132,7 @@ class TTChatInputWhiteList(ChatInputWhiteListFrame): return def chatButtonPressed(self): - print 'chatButtonPressed' + print('chatButtonPressed') if self.okayToSubmit: self.sendChat(self.chatEntry.get()) else: diff --git a/toontown/chat/TTSCWhiteListTerminal.py b/toontown/chat/TTSCWhiteListTerminal.py index dfff6c7..934054b 100644 --- a/toontown/chat/TTSCWhiteListTerminal.py +++ b/toontown/chat/TTSCWhiteListTerminal.py @@ -13,7 +13,7 @@ class TTSCWhiteListTerminal(SCTerminal): self.parentClass = parentMenu self.textId = textId self.text = SpeedChatStaticText[self.textId] - print 'SpeedText %s %s' % (self.textId, self.text) + print('SpeedText %s %s' % (self.textId, self.text)) def handleSelect(self): SCTerminal.handleSelect(self) diff --git a/toontown/chat/ToonChatGarbler.py b/toontown/chat/ToonChatGarbler.py index 71394dc..5254154 100644 --- a/toontown/chat/ToonChatGarbler.py +++ b/toontown/chat/ToonChatGarbler.py @@ -19,7 +19,7 @@ class ToonChatGarbler(ChatGarbler.ChatGarbler): def garble(self, toon, message): newMessage = '' animalType = toon.getStyle().getType() - if ToonChatGarbler.animalSounds.has_key(animalType): + if animalType in ToonChatGarbler.animalSounds: wordlist = ToonChatGarbler.animalSounds[animalType] else: wordlist = ToonChatGarbler.animalSounds['default'] @@ -35,7 +35,7 @@ class ToonChatGarbler(ChatGarbler.ChatGarbler): def garbleSingle(self, toon, message): newMessage = '' animalType = toon.getStyle().getType() - if ToonChatGarbler.animalSounds.has_key(animalType): + if animalType in ToonChatGarbler.animalSounds: wordlist = ToonChatGarbler.animalSounds[animalType] else: wordlist = ToonChatGarbler.animalSounds['default'] diff --git a/toontown/chat/ToontownChatManager.py b/toontown/chat/ToontownChatManager.py index e807797..8de7fa6 100644 --- a/toontown/chat/ToontownChatManager.py +++ b/toontown/chat/ToontownChatManager.py @@ -9,9 +9,9 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from otp.chat import ChatManager -from TTChatInputSpeedChat import TTChatInputSpeedChat -from TTChatInputNormal import TTChatInputNormal -from TTChatInputWhiteList import TTChatInputWhiteList +from .TTChatInputSpeedChat import TTChatInputSpeedChat +from .TTChatInputNormal import TTChatInputNormal +from .TTChatInputWhiteList import TTChatInputWhiteList class HackedDirectRadioButton(DirectCheckButton): @@ -404,7 +404,7 @@ class ToontownChatManager(ChatManager.ChatManager): else: self.fsm.request('normalChat') else: - print 'ChatManager: productName: %s not recognized' % base.cr.productName + print('ChatManager: productName: %s not recognized' % base.cr.productName) def __scButtonPressed(self): if base.config.GetBool('want-qa-regression', 0): diff --git a/toontown/classicchars/CharStateDatas.py b/toontown/classicchars/CharStateDatas.py index 7c446ec..da4e438 100644 --- a/toontown/classicchars/CharStateDatas.py +++ b/toontown/classicchars/CharStateDatas.py @@ -5,7 +5,7 @@ from direct.fsm import StateData from direct.directnotify import DirectNotifyGlobal from direct.showbase.PythonUtil import * from direct.task import Task -import CCharPaths +from . import CCharPaths from toontown.toonbase import ToontownGlobals class CharNeutralState(StateData.StateData): diff --git a/toontown/classicchars/CharStateDatasAI.py b/toontown/classicchars/CharStateDatasAI.py index 508d474..c30384d 100644 --- a/toontown/classicchars/CharStateDatasAI.py +++ b/toontown/classicchars/CharStateDatasAI.py @@ -5,7 +5,7 @@ from direct.directnotify import DirectNotifyGlobal import random from direct.task import Task from toontown.toonbase import ToontownGlobals -import CCharChatter, CCharPaths +from . import CCharChatter, CCharPaths CHATTY_DURATION = 120.0 class CharLonelyStateAI(StateData.StateData): diff --git a/toontown/classicchars/DistributedCCharBase.py b/toontown/classicchars/DistributedCCharBase.py index d3732a1..65a9938 100644 --- a/toontown/classicchars/DistributedCCharBase.py +++ b/toontown/classicchars/DistributedCCharBase.py @@ -12,8 +12,8 @@ from direct.controls.ControlManager import CollisionHandlerRayStart from toontown.toonbase import ToontownGlobals from toontown.toonbase.TTLocalizer import Donald, DonaldDock, WesternPluto, Pluto from toontown.effects import DustCloud -import CCharChatter -import CCharPaths +from . import CCharChatter +from . import CCharPaths import string import copy @@ -167,7 +167,7 @@ class DistributedCCharBase(DistributedChar.DistributedChar): return turnTracks def setChat(self, category, msg, avId): - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: avatar = self.cr.doId2do[avId] chatter = CCharChatter.getChatter(self.getName(), self.getCCChatter()) if category >= len(chatter): diff --git a/toontown/classicchars/DistributedCCharBaseAI.py b/toontown/classicchars/DistributedCCharBaseAI.py index 5d243d9..ece19b1 100644 --- a/toontown/classicchars/DistributedCCharBaseAI.py +++ b/toontown/classicchars/DistributedCCharBaseAI.py @@ -34,7 +34,7 @@ class DistributedCCharBaseAI(DistributedAvatarAI.DistributedAvatarAI): r = random.random() fixedAvId = 1000000006 if r < 0.3: - avId = random.randrange(1L << 32) + avId = random.randrange(1 << 32) else: if r < 0.6: players = self.air.doFindAllOfType('DistributedToonAI')[0] @@ -56,7 +56,7 @@ class DistributedCCharBaseAI(DistributedAvatarAI.DistributedAvatarAI): if msg is SetChat: length = rrange(1024) s = '' - for i in xrange(length): + for i in range(length): s += chr(rrange(1 << 8)) self.setNearbyAvatarChat(s) @@ -156,7 +156,7 @@ class DistributedCCharBaseAI(DistributedAvatarAI.DistributedAvatarAI): def __avatarSpoke(self, avId): now = globalClock.getRealTime() - if self.nearbyAvatarInfoDict.has_key(avId): + if avId in self.nearbyAvatarInfoDict: self.nearbyAvatarInfoDict[avId]['lastChatTime'] = now self.__interestingAvatarEventOccured() diff --git a/toontown/classicchars/DistributedChip.py b/toontown/classicchars/DistributedChip.py index f0a1d9d..6400200 100644 --- a/toontown/classicchars/DistributedChip.py +++ b/toontown/classicchars/DistributedChip.py @@ -1,9 +1,9 @@ from direct.showbase.ShowBaseGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer diff --git a/toontown/classicchars/DistributedChipAI.py b/toontown/classicchars/DistributedChipAI.py index 3defa31..d9cd262 100644 --- a/toontown/classicchars/DistributedChipAI.py +++ b/toontown/classicchars/DistributedChipAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedChipAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedChipAI') diff --git a/toontown/classicchars/DistributedDaisy.py b/toontown/classicchars/DistributedDaisy.py index 2cc7945..a495f28 100644 --- a/toontown/classicchars/DistributedDaisy.py +++ b/toontown/classicchars/DistributedDaisy.py @@ -1,9 +1,9 @@ from direct.showbase.ShowBaseGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import TTHood diff --git a/toontown/classicchars/DistributedDaisyAI.py b/toontown/classicchars/DistributedDaisyAI.py index 8d6c93f..89a136e 100644 --- a/toontown/classicchars/DistributedDaisyAI.py +++ b/toontown/classicchars/DistributedDaisyAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedDaisyAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDaisyAI') diff --git a/toontown/classicchars/DistributedDale.py b/toontown/classicchars/DistributedDale.py index ec70726..a153008 100644 --- a/toontown/classicchars/DistributedDale.py +++ b/toontown/classicchars/DistributedDale.py @@ -1,9 +1,9 @@ from direct.showbase.ShowBaseGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer diff --git a/toontown/classicchars/DistributedDaleAI.py b/toontown/classicchars/DistributedDaleAI.py index fed78c5..4b0991f 100644 --- a/toontown/classicchars/DistributedDaleAI.py +++ b/toontown/classicchars/DistributedDaleAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedDaleAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDaleAI') diff --git a/toontown/classicchars/DistributedDonald.py b/toontown/classicchars/DistributedDonald.py index 8fa908c..7f2cde7 100644 --- a/toontown/classicchars/DistributedDonald.py +++ b/toontown/classicchars/DistributedDonald.py @@ -1,11 +1,11 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import CharStateDatas -import CCharChatter +from . import CharStateDatas +from . import CCharChatter from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import GSHood diff --git a/toontown/classicchars/DistributedDonaldAI.py b/toontown/classicchars/DistributedDonaldAI.py index a5acbcb..c7d0152 100644 --- a/toontown/classicchars/DistributedDonaldAI.py +++ b/toontown/classicchars/DistributedDonaldAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedDonaldAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedDonaldAI') diff --git a/toontown/classicchars/DistributedDonaldDock.py b/toontown/classicchars/DistributedDonaldDock.py index 523d358..7ba4567 100644 --- a/toontown/classicchars/DistributedDonaldDock.py +++ b/toontown/classicchars/DistributedDonaldDock.py @@ -1,11 +1,11 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import ToontownGlobals -import CharStateDatas +from . import CharStateDatas from direct.fsm import StateData from direct.task import Task from toontown.toonbase import TTLocalizer diff --git a/toontown/classicchars/DistributedDonaldDockAI.py b/toontown/classicchars/DistributedDonaldDockAI.py index 691f899..411bbac 100644 --- a/toontown/classicchars/DistributedDonaldDockAI.py +++ b/toontown/classicchars/DistributedDonaldDockAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/classicchars/DistributedFrankenDonald.py b/toontown/classicchars/DistributedFrankenDonald.py index e10ebc1..8ec5baf 100644 --- a/toontown/classicchars/DistributedFrankenDonald.py +++ b/toontown/classicchars/DistributedFrankenDonald.py @@ -1,12 +1,12 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import DistributedCCharBase -import DistributedDonald +from . import DistributedCCharBase +from . import DistributedDonald from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import CharStateDatas -import CCharChatter +from . import CharStateDatas +from . import CCharChatter from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import GSHood diff --git a/toontown/classicchars/DistributedGoofy.py b/toontown/classicchars/DistributedGoofy.py index d3a3296..ebcdc07 100644 --- a/toontown/classicchars/DistributedGoofy.py +++ b/toontown/classicchars/DistributedGoofy.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer diff --git a/toontown/classicchars/DistributedGoofyAI.py b/toontown/classicchars/DistributedGoofyAI.py index 894ada3..7b0a5b8 100644 --- a/toontown/classicchars/DistributedGoofyAI.py +++ b/toontown/classicchars/DistributedGoofyAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedGoofyAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGoofyAI') diff --git a/toontown/classicchars/DistributedGoofySpeedway.py b/toontown/classicchars/DistributedGoofySpeedway.py index 3512e17..2f2e946 100644 --- a/toontown/classicchars/DistributedGoofySpeedway.py +++ b/toontown/classicchars/DistributedGoofySpeedway.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import DLHood diff --git a/toontown/classicchars/DistributedGoofySpeedwayAI.py b/toontown/classicchars/DistributedGoofySpeedwayAI.py index 24d0ae1..ad76202 100644 --- a/toontown/classicchars/DistributedGoofySpeedwayAI.py +++ b/toontown/classicchars/DistributedGoofySpeedwayAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedGoofySpeedwayAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedGoofySpeedwayAI') diff --git a/toontown/classicchars/DistributedJailbirdDale.py b/toontown/classicchars/DistributedJailbirdDale.py index 74375d3..c0b2f7c 100644 --- a/toontown/classicchars/DistributedJailbirdDale.py +++ b/toontown/classicchars/DistributedJailbirdDale.py @@ -1,12 +1,12 @@ from direct.showbase.ShowBaseGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import DistributedDale +from . import DistributedDale class DistributedJailbirdDale(DistributedDale.DistributedDale): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedJailbirdDale') diff --git a/toontown/classicchars/DistributedMickey.py b/toontown/classicchars/DistributedMickey.py index 9aed6e6..da8894e 100644 --- a/toontown/classicchars/DistributedMickey.py +++ b/toontown/classicchars/DistributedMickey.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import DGHood diff --git a/toontown/classicchars/DistributedMickeyAI.py b/toontown/classicchars/DistributedMickeyAI.py index 0b07d6b..5055413 100644 --- a/toontown/classicchars/DistributedMickeyAI.py +++ b/toontown/classicchars/DistributedMickeyAI.py @@ -1,12 +1,12 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task import random from toontown.toonbase import ToontownGlobals -import CharStateDatasAI +from . import CharStateDatasAI from toontown.toonbase import TTLocalizer class DistributedMickeyAI(DistributedCCharBaseAI.DistributedCCharBaseAI): diff --git a/toontown/classicchars/DistributedMinnie.py b/toontown/classicchars/DistributedMinnie.py index 6f01360..1ad09b3 100644 --- a/toontown/classicchars/DistributedMinnie.py +++ b/toontown/classicchars/DistributedMinnie.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import BRHood diff --git a/toontown/classicchars/DistributedMinnieAI.py b/toontown/classicchars/DistributedMinnieAI.py index ad1c43a..e6d2946 100644 --- a/toontown/classicchars/DistributedMinnieAI.py +++ b/toontown/classicchars/DistributedMinnieAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State @@ -7,7 +7,7 @@ from direct.task import Task import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import CharStateDatasAI +from . import CharStateDatasAI class DistributedMinnieAI(DistributedCCharBaseAI.DistributedCCharBaseAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedMinnieAI') diff --git a/toontown/classicchars/DistributedPluto.py b/toontown/classicchars/DistributedPluto.py index 2bffb28..cd07da8 100644 --- a/toontown/classicchars/DistributedPluto.py +++ b/toontown/classicchars/DistributedPluto.py @@ -1,11 +1,11 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import ToontownGlobals -import CharStateDatas +from . import CharStateDatas from direct.fsm import StateData from direct.task import Task from toontown.toonbase import TTLocalizer diff --git a/toontown/classicchars/DistributedPlutoAI.py b/toontown/classicchars/DistributedPlutoAI.py index 456c8f4..667b40d 100644 --- a/toontown/classicchars/DistributedPlutoAI.py +++ b/toontown/classicchars/DistributedPlutoAI.py @@ -1,5 +1,5 @@ from otp.ai.AIBaseGlobal import * -import DistributedCCharBaseAI +from . import DistributedCCharBaseAI from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/classicchars/DistributedPoliceChip.py b/toontown/classicchars/DistributedPoliceChip.py index b064b96..28bfc9b 100644 --- a/toontown/classicchars/DistributedPoliceChip.py +++ b/toontown/classicchars/DistributedPoliceChip.py @@ -1,12 +1,12 @@ from direct.showbase.ShowBaseGlobal import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import DistributedChip +from . import DistributedChip class DistributedPoliceChip(DistributedChip.DistributedChip): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPoliceChip') diff --git a/toontown/classicchars/DistributedSockHopDaisy.py b/toontown/classicchars/DistributedSockHopDaisy.py index 05ecc21..28f711a 100644 --- a/toontown/classicchars/DistributedSockHopDaisy.py +++ b/toontown/classicchars/DistributedSockHopDaisy.py @@ -1,10 +1,10 @@ from direct.showbase.ShowBaseGlobal import * -import DistributedCCharBase -import DistributedDaisy +from . import DistributedCCharBase +from . import DistributedDaisy from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import TTHood diff --git a/toontown/classicchars/DistributedSuperGoofy.py b/toontown/classicchars/DistributedSuperGoofy.py index d2c19b5..578c967 100644 --- a/toontown/classicchars/DistributedSuperGoofy.py +++ b/toontown/classicchars/DistributedSuperGoofy.py @@ -1,13 +1,13 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.classicchars import DistributedGoofySpeedway -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import DistributedCCharBase +from . import DistributedCCharBase class DistributedSuperGoofy(DistributedGoofySpeedway.DistributedGoofySpeedway): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSuperGoofy') diff --git a/toontown/classicchars/DistributedVampireMickey.py b/toontown/classicchars/DistributedVampireMickey.py index 0ca001c..0340382 100644 --- a/toontown/classicchars/DistributedVampireMickey.py +++ b/toontown/classicchars/DistributedVampireMickey.py @@ -1,13 +1,13 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.classicchars import DistributedMickey -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import DistributedCCharBase +from . import DistributedCCharBase class DistributedVampireMickey(DistributedMickey.DistributedMickey): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedVampireMickey') diff --git a/toontown/classicchars/DistributedWesternPluto.py b/toontown/classicchars/DistributedWesternPluto.py index 90418f2..5f5768c 100644 --- a/toontown/classicchars/DistributedWesternPluto.py +++ b/toontown/classicchars/DistributedWesternPluto.py @@ -1,13 +1,13 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.classicchars import DistributedPluto -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import DistributedCCharBase +from . import DistributedCCharBase class DistributedWesternPluto(DistributedPluto.DistributedPluto): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWesternPluto') diff --git a/toontown/classicchars/DistributedWitchMinnie.py b/toontown/classicchars/DistributedWitchMinnie.py index 336bc06..a3fc0b4 100644 --- a/toontown/classicchars/DistributedWitchMinnie.py +++ b/toontown/classicchars/DistributedWitchMinnie.py @@ -1,13 +1,13 @@ from pandac.PandaModules import * -import DistributedCCharBase +from . import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.classicchars import DistributedMinnie -import CharStateDatas +from . import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import DistributedCCharBase +from . import DistributedCCharBase class DistributedWitchMinnie(DistributedMinnie.DistributedMinnie): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedWitchMinnie') diff --git a/toontown/coderedemption/TTCodeRedemptionMgr.py b/toontown/coderedemption/TTCodeRedemptionMgr.py index 8f4d8a9..3566b42 100644 --- a/toontown/coderedemption/TTCodeRedemptionMgr.py +++ b/toontown/coderedemption/TTCodeRedemptionMgr.py @@ -11,7 +11,7 @@ class TTCodeRedemptionMgr(DistributedObject): def announceGenerate(self): DistributedObject.announceGenerate(self) base.codeRedemptionMgr = self - self._contextGen = SerialMaskedGen(4294967295L) + self._contextGen = SerialMaskedGen(4294967295) self._context2callback = {} def delete(self): @@ -24,7 +24,7 @@ class TTCodeRedemptionMgr(DistributedObject): return def redeemCode(self, code, callback): - context = self._contextGen.next() + context = next(self._contextGen) self._context2callback[context] = callback self.notify.debug('redeemCode(%s, %s)' % (context, code)) self.sendUpdate('redeemCode', [context, code]) diff --git a/toontown/cogdominium/CogdoBarrelRoomAI.py b/toontown/cogdominium/CogdoBarrelRoomAI.py index a44a10b..0a27174 100644 --- a/toontown/cogdominium/CogdoBarrelRoomAI.py +++ b/toontown/cogdominium/CogdoBarrelRoomAI.py @@ -111,7 +111,7 @@ class CogdoBarrelRoomAI: return not toon.isToonedUp() def __allBarrelsCollected(self): - toonsNeedingLaff = Set(filter(lambda toon: self.__toonIdNeedsLaff(toon), self.cogdoInteriorAI.toons)) + toonsNeedingLaff = Set([toon for toon in self.cogdoInteriorAI.toons if self.__toonIdNeedsLaff(toon)]) for barrel in self.spawnedBarrels: if not toonsNeedingLaff.issubset(Set(barrel.grabbedBy)): return False diff --git a/toontown/cogdominium/CogdoBarrelRoomConsts.py b/toontown/cogdominium/CogdoBarrelRoomConsts.py index 48948a5..75c2260 100644 --- a/toontown/cogdominium/CogdoBarrelRoomConsts.py +++ b/toontown/cogdominium/CogdoBarrelRoomConsts.py @@ -91,7 +91,7 @@ BarrelCollParams = (0, 2.0) BarrelBumpSound = 'phase_4/audio/sfx/Golf_Hit_Barrier_2.mp3' BarrelGrabSound = 'phase_4/audio/sfx/SZ_DD_treasure.mp3' -StateHidden, StateAvailable, StateUsed, StateCrushed = range(4) +StateHidden, StateAvailable, StateUsed, StateCrushed = list(range(4)) def numBarrels(): return len(BarrelProps) diff --git a/toontown/cogdominium/CogdoBarrelRoomRewardPanel.py b/toontown/cogdominium/CogdoBarrelRoomRewardPanel.py index cf22ee7..1ac65d8 100644 --- a/toontown/cogdominium/CogdoBarrelRoomRewardPanel.py +++ b/toontown/cogdominium/CogdoBarrelRoomRewardPanel.py @@ -26,7 +26,7 @@ class CogdoBarrelRoomRewardPanel(DirectFrame): for p in range(len(results[0])): doId = results[0][p] laff = results[1][p] - if doId > 0 and base.cr.doId2do.has_key(doId): + if doId > 0 and doId in base.cr.doId2do: toon = base.cr.doId2do[doId] self.rewardLines[p]['name'].setProp('text', toon.getName()) self.rewardLines[p]['laff'].setProp('text', str(laff)) diff --git a/toontown/cogdominium/CogdoCraneGameConsts.py b/toontown/cogdominium/CogdoCraneGameConsts.py index 2ea2f3e..4d0e6cf 100644 --- a/toontown/cogdominium/CogdoCraneGameConsts.py +++ b/toontown/cogdominium/CogdoCraneGameConsts.py @@ -55,5 +55,5 @@ MoneyBagPosHprs = [[77.2 - 84, 180, 0, 0]] -for i in xrange(len(MoneyBagPosHprs)): +for i in range(len(MoneyBagPosHprs)): MoneyBagPosHprs[i][2] += 6 diff --git a/toontown/cogdominium/CogdoElevatorMovie.py b/toontown/cogdominium/CogdoElevatorMovie.py index 8e114de..84e1858 100644 --- a/toontown/cogdominium/CogdoElevatorMovie.py +++ b/toontown/cogdominium/CogdoElevatorMovie.py @@ -10,8 +10,8 @@ from toontown.toonbase.ToontownGlobals import * from toontown.toonbase import TTLocalizer from toontown.suit import Suit, SuitDNA from toontown.toon import Toon, ToonHead, ToonDNA -from CogdoUtil import CogdoGameMovie -import CogdoUtil +from .CogdoUtil import CogdoGameMovie +from . import CogdoUtil class CogdoElevatorMovie(CogdoGameMovie): notify = DirectNotifyGlobal.directNotify.newCategory('CogdoElevatorMovie') diff --git a/toontown/cogdominium/CogdoExecutiveSuiteMovies.py b/toontown/cogdominium/CogdoExecutiveSuiteMovies.py index 8c95103..a356f24 100644 --- a/toontown/cogdominium/CogdoExecutiveSuiteMovies.py +++ b/toontown/cogdominium/CogdoExecutiveSuiteMovies.py @@ -10,8 +10,8 @@ from toontown.toonbase.ToontownGlobals import * from toontown.toonbase import TTLocalizer from toontown.suit import Suit, SuitDNA from toontown.toon import Toon, ToonHead, ToonDNA -from CogdoUtil import CogdoGameMovie -import CogdoUtil +from .CogdoUtil import CogdoGameMovie +from . import CogdoUtil class CogdoExecutiveSuiteIntro(CogdoGameMovie): notify = DirectNotifyGlobal.directNotify.newCategory('CogdoExecutiveSuiteIntro') diff --git a/toontown/cogdominium/CogdoFlyingCameraManager.py b/toontown/cogdominium/CogdoFlyingCameraManager.py index 8df291b..4131851 100644 --- a/toontown/cogdominium/CogdoFlyingCameraManager.py +++ b/toontown/cogdominium/CogdoFlyingCameraManager.py @@ -6,7 +6,7 @@ from math import pi, sin, cos from direct.showbase.PythonUtil import bound as clamp from otp.otpbase import OTPGlobals from toontown.toonbase import ToontownGlobals -import CogdoFlyingGameGlobals as Globals +from . import CogdoFlyingGameGlobals as Globals INVERSE_E = 1.0 / math.e def smooth(old, new): @@ -161,11 +161,11 @@ class CogdoFlyingCameraManager: name = entry.getIntoNode().getName() if name.find('col_') >= 0: np = entry.getIntoNodePath().getParent() - if not nodesInBetween.has_key(np): + if np not in nodesInBetween: nodesInBetween[np] = np.getParent() - for np in nodesInBetween.keys(): - if self._betweenCamAndToon.has_key(np): + for np in list(nodesInBetween.keys()): + if np in self._betweenCamAndToon: del self._betweenCamAndToon[np] else: np.setTransparency(True) @@ -175,7 +175,7 @@ class CogdoFlyingCameraManager: elif np.getName().find('platform') >= 0: np.find('**/*Floor').hide() - for np, parent in self._betweenCamAndToon.items(): + for np, parent in list(self._betweenCamAndToon.items()): np.wrtReparentTo(parent) np.setTransparency(False) if np.getName().find('lightFixture') >= 0: diff --git a/toontown/cogdominium/CogdoFlyingGame.py b/toontown/cogdominium/CogdoFlyingGame.py index c46fe74..7e7b08e 100644 --- a/toontown/cogdominium/CogdoFlyingGame.py +++ b/toontown/cogdominium/CogdoFlyingGame.py @@ -5,16 +5,16 @@ from direct.interval.FunctionInterval import Wait from direct.interval.IntervalGlobal import Func from direct.interval.MetaInterval import Sequence, Parallel from toontown.toonbase import TTLocalizer -import CogdoFlyingGameGlobals as Globals -from CogdoFlyingLocalPlayer import CogdoFlyingLocalPlayer -from CogdoGameAudioManager import CogdoGameAudioManager -from CogdoFlyingPlayer import CogdoFlyingPlayer -from CogdoFlyingObjects import CogdoFlyingGatherable -from CogdoFlyingObstacles import CogdoFlyingObstacle -from CogdoFlyingLegalEagle import CogdoFlyingLegalEagle -from CogdoFlyingGuiManager import CogdoFlyingGuiManager -from CogdoFlyingLevel import CogdoFlyingLevelFactory -from CogdoFlyingGameMovies import CogdoFlyingGameIntro, CogdoFlyingGameFinish +from . import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingLocalPlayer import CogdoFlyingLocalPlayer +from .CogdoGameAudioManager import CogdoGameAudioManager +from .CogdoFlyingPlayer import CogdoFlyingPlayer +from .CogdoFlyingObjects import CogdoFlyingGatherable +from .CogdoFlyingObstacles import CogdoFlyingObstacle +from .CogdoFlyingLegalEagle import CogdoFlyingLegalEagle +from .CogdoFlyingGuiManager import CogdoFlyingGuiManager +from .CogdoFlyingLevel import CogdoFlyingLevelFactory +from .CogdoFlyingGameMovies import CogdoFlyingGameIntro, CogdoFlyingGameFinish class CogdoFlyingGame(DirectObject): notify = directNotify.newCategory('CogdoFlyingGame') diff --git a/toontown/cogdominium/CogdoFlyingGameGlobals.py b/toontown/cogdominium/CogdoFlyingGameGlobals.py index 9a808ae..19250c2 100644 --- a/toontown/cogdominium/CogdoFlyingGameGlobals.py +++ b/toontown/cogdominium/CogdoFlyingGameGlobals.py @@ -1,6 +1,6 @@ from direct.showbase import PythonUtil from pandac.PandaModules import VBase4, Vec3, Point3 -from CogdoUtil import VariableContainer, DevVariableContainer +from .CogdoUtil import VariableContainer, DevVariableContainer AI = VariableContainer() AI.GameActions = PythonUtil.Enum(('LandOnWinPlatform', 'WinStateFinished', 'GotoWinState', 'HitWhirlwind', 'HitLegalEagle', 'HitMinion', 'DebuffInvul', 'RequestEnterEagleInterest', 'RequestExitEagleInterest', 'RanOutOfTimePenalty', 'Died', 'Spawn', 'SetBlades', 'BladeLost')) AI.BroadcastPeriod = 0.3 diff --git a/toontown/cogdominium/CogdoFlyingGameGuis.py b/toontown/cogdominium/CogdoFlyingGameGuis.py index f508c66..ac51645 100644 --- a/toontown/cogdominium/CogdoFlyingGameGuis.py +++ b/toontown/cogdominium/CogdoFlyingGameGuis.py @@ -3,8 +3,8 @@ from direct.gui.DirectGui import DirectLabel, DirectFrame, DGG from direct.showbase.PythonUtil import bound as clamp from pandac.PandaModules import TextNode, NodePath from toontown.toonbase import ToontownGlobals -import CogdoUtil -import CogdoFlyingGameGlobals as Globals +from . import CogdoUtil +from . import CogdoFlyingGameGlobals as Globals class CogdoFlyingProgressGui(DirectFrame): @@ -60,7 +60,7 @@ class CogdoFlyingProgressGui(DirectFrame): return self._laffMeterModel.find('**/' + toon.style.getType() + 'head') def update(self): - for toon, marker in self._toonMarkers.items(): + for toon, marker in list(self._toonMarkers.items()): progress = clamp((toon.getY() - self._levelStartY) / self._levelDistance, self._levelStartY, self._levelEndY) marker.setZ(clamp(self._lineStart + self._lineDistance * progress, self._lineStart, self._lineEnd)) diff --git a/toontown/cogdominium/CogdoFlyingGameMovies.py b/toontown/cogdominium/CogdoFlyingGameMovies.py index 1f1b577..6d21e16 100644 --- a/toontown/cogdominium/CogdoFlyingGameMovies.py +++ b/toontown/cogdominium/CogdoFlyingGameMovies.py @@ -6,9 +6,9 @@ from direct.interval.FunctionInterval import Func, Wait from toontown.toonbase import TTLocalizer from toontown.toon import Toon, ToonHead, ToonDNA from toontown.suit import Suit, SuitDNA -import CogdoFlyingGameGlobals as Globals -from CogdoUtil import CogdoGameMovie -import CogdoUtil +from . import CogdoFlyingGameGlobals as Globals +from .CogdoUtil import CogdoGameMovie +from . import CogdoUtil class CogdoFlyingGameIntro(CogdoGameMovie): diff --git a/toontown/cogdominium/CogdoFlyingGuiManager.py b/toontown/cogdominium/CogdoFlyingGuiManager.py index b3b598b..13906c0 100644 --- a/toontown/cogdominium/CogdoFlyingGuiManager.py +++ b/toontown/cogdominium/CogdoFlyingGuiManager.py @@ -1,10 +1,10 @@ from pandac.PandaModules import NodePath from toontown.toonbase import ToontownIntervals from toontown.toonbase.ToontownTimer import ToontownTimer -from CogdoFlyingGameGuis import CogdoFlyingFuelGui, CogdoFlyingProgressGui -from CogdoGameMessageDisplay import CogdoGameMessageDisplay -from CogdoMemoGui import CogdoMemoGui -import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingGameGuis import CogdoFlyingFuelGui, CogdoFlyingProgressGui +from .CogdoGameMessageDisplay import CogdoGameMessageDisplay +from .CogdoMemoGui import CogdoMemoGui +from . import CogdoFlyingGameGlobals as Globals class CogdoFlyingGuiManager: ClearMessageDisplayEventName = 'ClearMessageDisplayEvent' diff --git a/toontown/cogdominium/CogdoFlyingLegalEagle.py b/toontown/cogdominium/CogdoFlyingLegalEagle.py index f7eabef..c28529f 100644 --- a/toontown/cogdominium/CogdoFlyingLegalEagle.py +++ b/toontown/cogdominium/CogdoFlyingLegalEagle.py @@ -11,9 +11,9 @@ from toontown.suit import Suit from toontown.suit import SuitDNA from toontown.toonbase import ToontownGlobals from toontown.battle import BattleProps -from CogdoFlyingUtil import swapAvatarShadowPlacer -import CogdoUtil -import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingUtil import swapAvatarShadowPlacer +from . import CogdoUtil +from . import CogdoFlyingGameGlobals as Globals class CogdoFlyingLegalEagle(DirectObject, FSM): CollSphereName = 'CogdoFlyingLegalEagleSphere' diff --git a/toontown/cogdominium/CogdoFlyingLevel.py b/toontown/cogdominium/CogdoFlyingLevel.py index 3061ab5..1a4f579 100644 --- a/toontown/cogdominium/CogdoFlyingLevel.py +++ b/toontown/cogdominium/CogdoFlyingLevel.py @@ -3,12 +3,12 @@ from pandac.PandaModules import CollisionPlane, CollisionNode from direct.showbase.RandomNumGen import RandomNumGen from direct.showbase.DirectObject import DirectObject from direct.showbase.PythonUtil import bound as clamp -import CogdoUtil -import CogdoFlyingGameGlobals as Globals -from CogdoFlyingLevelQuadrant import CogdoFlyingLevelQuadrant -from CogdoFlyingObjects import CogdoFlyingGatherableFactory, CogdoFlyingPlatform, CogdoFlyingLevelFog -from CogdoFlyingObstacles import CogdoFlyingObtacleFactory -from CogdoGameExit import CogdoGameExit +from . import CogdoUtil +from . import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingLevelQuadrant import CogdoFlyingLevelQuadrant +from .CogdoFlyingObjects import CogdoFlyingGatherableFactory, CogdoFlyingPlatform, CogdoFlyingLevelFog +from .CogdoFlyingObstacles import CogdoFlyingObtacleFactory +from .CogdoGameExit import CogdoGameExit from otp.otpbase import OTPGlobals class CogdoFlyingLevel(DirectObject): @@ -168,7 +168,7 @@ class CogdoFlyingLevel(DirectObject): self.endPlatform.onstage() self._currentQuadNum = quadNum - for i in range(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads): + for i in list(range(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0))) + list(range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads)): self.quadrants[i].offstage() if i == 0: self.startPlatform.offstage() diff --git a/toontown/cogdominium/CogdoFlyingLevelQuadrant.py b/toontown/cogdominium/CogdoFlyingLevelQuadrant.py index 51fadef..e3f6209 100644 --- a/toontown/cogdominium/CogdoFlyingLevelQuadrant.py +++ b/toontown/cogdominium/CogdoFlyingLevelQuadrant.py @@ -1,8 +1,8 @@ import math from direct.directutil import Mopath from pandac.PandaModules import NodePath, Point3, Vec4 -from CogdoFlyingObjects import CogdoFlyingPlatform -import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingObjects import CogdoFlyingPlatform +from . import CogdoFlyingGameGlobals as Globals class CogdoFlyingLevelQuadrant: notify = directNotify.newCategory('CogdoFlyingLevelQuadrant') @@ -11,7 +11,7 @@ class CogdoFlyingLevelQuadrant: self.serialNum = serialNum self._model = model self._level = level - self._root = NodePath('Quadrant' + `serialNum`) + self._root = NodePath('Quadrant' + repr(serialNum)) self._model.reparentTo(self._root) self._root.reparentTo(parent) self._visible = True @@ -64,7 +64,7 @@ class CogdoFlyingLevelQuadrant: self.platforms[platform.getName()] = platform def _destroyPlatforms(self): - for platform in self.platforms.values(): + for platform in list(self.platforms.values()): platform.destroy() del self.platforms @@ -137,7 +137,7 @@ class CogdoFlyingLevelQuadrant: gatherable.removeNode() def generatePowerUps(): - for powerupType, locName in Globals.Level.PowerupType2Loc.iteritems(): + for powerupType, locName in Globals.Level.PowerupType2Loc.items(): if powerupType == Globals.Level.GatherableTypes.LaffPowerup and Globals.Level.IgnoreLaffPowerups: continue gatherables = gatherableModel.findAllMatches('**/%s' % locName) diff --git a/toontown/cogdominium/CogdoFlyingLocalPlayer.py b/toontown/cogdominium/CogdoFlyingLocalPlayer.py index 8f739cf..83c551c 100644 --- a/toontown/cogdominium/CogdoFlyingLocalPlayer.py +++ b/toontown/cogdominium/CogdoFlyingLocalPlayer.py @@ -13,14 +13,14 @@ from otp.otpbase import OTPGlobals from toontown.minigame.OrthoDrive import OrthoDrive from toontown.minigame.OrthoWalk import OrthoWalk from toontown.toonbase import TTLocalizer -from CogdoFlyingCollisions import CogdoFlyingCollisions -from CogdoFlyingPlayer import CogdoFlyingPlayer -from CogdoFlyingGuiManager import CogdoFlyingGuiManager -from CogdoFlyingInputManager import CogdoFlyingInputManager -from CogdoFlyingCameraManager import CogdoFlyingCameraManager -from CogdoFlyingObjects import CogdoFlyingPlatform, CogdoFlyingGatherable -from CogdoFlyingLegalEagle import CogdoFlyingLegalEagle -import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingCollisions import CogdoFlyingCollisions +from .CogdoFlyingPlayer import CogdoFlyingPlayer +from .CogdoFlyingGuiManager import CogdoFlyingGuiManager +from .CogdoFlyingInputManager import CogdoFlyingInputManager +from .CogdoFlyingCameraManager import CogdoFlyingCameraManager +from .CogdoFlyingObjects import CogdoFlyingPlatform, CogdoFlyingGatherable +from .CogdoFlyingLegalEagle import CogdoFlyingLegalEagle +from . import CogdoFlyingGameGlobals as Globals class CogdoFlyingLocalPlayer(CogdoFlyingPlayer): notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingLocalPlayer') diff --git a/toontown/cogdominium/CogdoFlyingObjects.py b/toontown/cogdominium/CogdoFlyingObjects.py index 7f8a4a9..3ffd308 100644 --- a/toontown/cogdominium/CogdoFlyingObjects.py +++ b/toontown/cogdominium/CogdoFlyingObjects.py @@ -3,9 +3,9 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import Sequence, Func, Parallel, Wait, LerpHprInterval, LerpScaleInterval, LerpFunctionInterval from otp.otpbase import OTPGlobals from toontown.toonbase import ToontownGlobals -from CogdoGameGatherable import CogdoGameGatherable, CogdoMemo -import CogdoFlyingGameGlobals as Globals -import CogdoUtil +from .CogdoGameGatherable import CogdoGameGatherable, CogdoMemo +from . import CogdoFlyingGameGlobals as Globals +from . import CogdoUtil from direct.particles import ParticleEffect from direct.particles import Particles from direct.particles import ForceGroup @@ -17,7 +17,7 @@ class CogdoFlyingGatherableFactory: self._memoModel = CogdoUtil.loadModel('memo', 'shared').find('**/memo') self._propellerModel = CogdoUtil.loadFlyingModel('propellers').find('**/mesh') self._powerUpModels = {} - for type, modelName in Globals.Level.PowerupType2Model.items(): + for type, modelName in list(Globals.Level.PowerupType2Model.items()): model = CogdoUtil.loadFlyingModel(modelName).find('**/' + Globals.Level.PowerupType2Node[type]) self._powerUpModels[type] = model model.setTransparency(True) @@ -78,7 +78,7 @@ class CogdoFlyingGatherableFactory: del self._memoModel self._propellerModel.removeNode() del self._propellerModel - for model in self._powerUpModels.values(): + for model in list(self._powerUpModels.values()): model.removeNode() del self._powerUpModels diff --git a/toontown/cogdominium/CogdoFlyingObstacles.py b/toontown/cogdominium/CogdoFlyingObstacles.py index 7cfbd22..4248dff 100644 --- a/toontown/cogdominium/CogdoFlyingObstacles.py +++ b/toontown/cogdominium/CogdoFlyingObstacles.py @@ -9,9 +9,9 @@ from toontown.toonbase import ToontownGlobals from toontown.suit import Suit from toontown.suit import SuitDNA from toontown.battle import BattleProps -import CogdoUtil -import CogdoFlyingGameGlobals as Globals -from CogdoFlyingUtil import swapAvatarShadowPlacer +from . import CogdoUtil +from . import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingUtil import swapAvatarShadowPlacer from direct.particles import ParticleEffect from direct.particles import Particles from direct.particles import ForceGroup diff --git a/toontown/cogdominium/CogdoFlyingPlayer.py b/toontown/cogdominium/CogdoFlyingPlayer.py index 7c61092..eed6293 100644 --- a/toontown/cogdominium/CogdoFlyingPlayer.py +++ b/toontown/cogdominium/CogdoFlyingPlayer.py @@ -7,10 +7,10 @@ from direct.interval.MetaInterval import Sequence, Parallel from direct.distributed.ClockDelta import globalClockDelta from toontown.toonbase import ToontownGlobals from toontown.effects import DustCloud -import CogdoFlyingGameGlobals as Globals -import CogdoUtil -from CogdoFlyingObjects import CogdoFlyingGatherable -from CogdoFlyingUtil import swapAvatarShadowPlacer +from . import CogdoFlyingGameGlobals as Globals +from . import CogdoUtil +from .CogdoFlyingObjects import CogdoFlyingGatherable +from .CogdoFlyingUtil import swapAvatarShadowPlacer class CogdoFlyingPlayer(FSM): notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingPlayer') diff --git a/toontown/cogdominium/CogdoFlyingUtil.py b/toontown/cogdominium/CogdoFlyingUtil.py index e411e2b..8a2a45a 100644 --- a/toontown/cogdominium/CogdoFlyingUtil.py +++ b/toontown/cogdominium/CogdoFlyingUtil.py @@ -1,5 +1,5 @@ from otp.otpbase import OTPGlobals -from CogdoFlyingShadowPlacer import CogdoFlyingShadowPlacer +from .CogdoFlyingShadowPlacer import CogdoFlyingShadowPlacer def loadMockup(fileName, dmodelsAlt = 'coffin'): try: diff --git a/toontown/cogdominium/CogdoGameAudioManager.py b/toontown/cogdominium/CogdoGameAudioManager.py index d8b5d82..ccfc36a 100644 --- a/toontown/cogdominium/CogdoGameAudioManager.py +++ b/toontown/cogdominium/CogdoGameAudioManager.py @@ -42,7 +42,7 @@ class CogdoGameAudioManager: self._cutoff = cutoff self.currentMusic = None self._music = {} - for name, filePath in musicFiles.items(): + for name, filePath in list(musicFiles.items()): self._music[name] = base.loader.loadMusic(filePath) self._audioSounds = [] diff --git a/toontown/cogdominium/CogdoGameExit.py b/toontown/cogdominium/CogdoGameExit.py index 4cd7fa5..af7d0ce 100644 --- a/toontown/cogdominium/CogdoGameExit.py +++ b/toontown/cogdominium/CogdoGameExit.py @@ -4,8 +4,8 @@ from direct.interval.SoundInterval import SoundInterval from direct.interval.FunctionInterval import Wait, Func from toontown.building import ElevatorConstants from toontown.building import ElevatorUtils -import CogdoUtil -import CogdoGameConsts +from . import CogdoUtil +from . import CogdoGameConsts class CogdoGameExit(NodePath): diff --git a/toontown/cogdominium/CogdoGameGatherable.py b/toontown/cogdominium/CogdoGameGatherable.py index ef5ebd4..dd9c671 100644 --- a/toontown/cogdominium/CogdoGameGatherable.py +++ b/toontown/cogdominium/CogdoGameGatherable.py @@ -5,7 +5,7 @@ from direct.interval.MetaInterval import Sequence from direct.interval.FunctionInterval import Func, Wait from direct.interval.IntervalGlobal import LerpFunc from toontown.toonbase import ToontownGlobals -import CogdoUtil +from . import CogdoUtil class CogdoGameGatherable(NodePath, DirectObject): EnterEventName = 'CogdoGameGatherable_Enter' diff --git a/toontown/cogdominium/CogdoGameMessageDisplay.py b/toontown/cogdominium/CogdoGameMessageDisplay.py index af7c2fb..126d470 100644 --- a/toontown/cogdominium/CogdoGameMessageDisplay.py +++ b/toontown/cogdominium/CogdoGameMessageDisplay.py @@ -3,7 +3,7 @@ from direct.interval.LerpInterval import LerpFunc from direct.interval.MetaInterval import Sequence from pandac.PandaModules import TextNode from toontown.toonbase import ToontownGlobals -import CogdoGameConsts +from . import CogdoGameConsts class CogdoGameMessageDisplay: UpdateMessageTaskName = 'MessageDisplay.updateMessage' diff --git a/toontown/cogdominium/CogdoLevelGameBase.py b/toontown/cogdominium/CogdoLevelGameBase.py index cc63b5b..b5805a3 100644 --- a/toontown/cogdominium/CogdoLevelGameBase.py +++ b/toontown/cogdominium/CogdoLevelGameBase.py @@ -12,7 +12,7 @@ class CogdoLevelGameBase: def startHandleEdits(self): fcs = [] Consts = self.getConsts() - for item in Consts.__dict__.itervalues(): + for item in Consts.__dict__.values(): if isinstance(item, EntityStateVarSet): for attribName in item._getAttributeNames(): handler = getattr(self, '_handle%sChanged' % attribName, None) @@ -32,7 +32,7 @@ class CogdoLevelGameBase: return def getEntityTypeReg(self): - import CogdoEntityTypes + from . import CogdoEntityTypes from otp.level import EntityTypeRegistry typeReg = EntityTypeRegistry.EntityTypeRegistry(CogdoEntityTypes) return typeReg diff --git a/toontown/cogdominium/CogdoMaze.py b/toontown/cogdominium/CogdoMaze.py index 281accf..1151886 100644 --- a/toontown/cogdominium/CogdoMaze.py +++ b/toontown/cogdominium/CogdoMaze.py @@ -2,10 +2,10 @@ from pandac.PandaModules import NodePath, VBase4 from direct.showbase.DirectObject import DirectObject from direct.showbase.RandomNumGen import RandomNumGen from toontown.minigame.MazeBase import MazeBase -import CogdoMazeGameGlobals as Globals -from CogdoMazeGameObjects import CogdoMazeWaterCooler -import CogdoMazeData -import CogdoUtil +from . import CogdoMazeGameGlobals as Globals +from .CogdoMazeGameObjects import CogdoMazeWaterCooler +from . import CogdoMazeData +from . import CogdoUtil class CogdoMaze(MazeBase, DirectObject): @@ -100,13 +100,13 @@ class CogdoMazeFactory: def _gatherQuadrantData(self): self.openBarriers = [] - barrierItems = range(Globals.TotalBarriers) + barrierItems = list(range(Globals.TotalBarriers)) self._rng.shuffle(barrierItems) for i in barrierItems[0:len(barrierItems) - Globals.NumBarriers]: self.openBarriers.append(i) self.quadrantData = [] - quadrantKeys = self._cogdoMazeData.QuadrantCollisions.keys() + quadrantKeys = list(self._cogdoMazeData.QuadrantCollisions.keys()) self._rng.shuffle(quadrantKeys) i = 0 for y in range(self.height): diff --git a/toontown/cogdominium/CogdoMazeCameraManager.py b/toontown/cogdominium/CogdoMazeCameraManager.py index 8d48d2d..5820fdb 100644 --- a/toontown/cogdominium/CogdoMazeCameraManager.py +++ b/toontown/cogdominium/CogdoMazeCameraManager.py @@ -1,5 +1,5 @@ from direct.showbase.PythonUtil import bound as clamp -import CogdoMazeGameGlobals as Globals +from . import CogdoMazeGameGlobals as Globals import math import random diff --git a/toontown/cogdominium/CogdoMazeGame.py b/toontown/cogdominium/CogdoMazeGame.py index d950c61..64065a1 100644 --- a/toontown/cogdominium/CogdoMazeGame.py +++ b/toontown/cogdominium/CogdoMazeGame.py @@ -4,16 +4,16 @@ from direct.showbase.PythonUtil import Functor from direct.showbase.RandomNumGen import RandomNumGen from direct.task.Task import Task from toontown.minigame.MazeSuit import MazeSuit -from CogdoGameGatherable import CogdoMemo -from CogdoMazePlayer import CogdoMazePlayer -from CogdoMazeLocalPlayer import CogdoMazeLocalPlayer -from CogdoMazeGuiManager import CogdoMazeGuiManager -from CogdoGameAudioManager import CogdoGameAudioManager -from CogdoMazeGameObjects import CogdoMazeExit, CogdoMazeDrop -from CogdoMazeSuits import CogdoMazeSuit, CogdoMazeSlowMinionSuit, CogdoMazeFastMinionSuit, CogdoMazeBossSuit -from CogdoMazeGameMovies import CogdoMazeGameIntro, CogdoMazeGameFinish -import CogdoMazeGameGlobals as Globals -import CogdoUtil +from .CogdoGameGatherable import CogdoMemo +from .CogdoMazePlayer import CogdoMazePlayer +from .CogdoMazeLocalPlayer import CogdoMazeLocalPlayer +from .CogdoMazeGuiManager import CogdoMazeGuiManager +from .CogdoGameAudioManager import CogdoGameAudioManager +from .CogdoMazeGameObjects import CogdoMazeExit, CogdoMazeDrop +from .CogdoMazeSuits import CogdoMazeSuit, CogdoMazeSlowMinionSuit, CogdoMazeFastMinionSuit, CogdoMazeBossSuit +from .CogdoMazeGameMovies import CogdoMazeGameIntro, CogdoMazeGameFinish +from . import CogdoMazeGameGlobals as Globals +from . import CogdoUtil import math import random @@ -128,7 +128,7 @@ class CogdoMazeGame(DirectObject): suit.destroy() del self.suits - for id in self.drops.keys(): + for id in list(self.drops.keys()): self.cleanupDrop(id) self.__stopUpdateTask() @@ -269,7 +269,7 @@ class CogdoMazeGame(DirectObject): self.players.remove(cPlayer) break - if self.toonId2Player.has_key(player.toon.doId): + if player.toon.doId in self.toonId2Player: del self.toonId2Player[player.toon.doId] self.guiMgr.mazeMapGui.removeToon(player.toon) @@ -377,7 +377,7 @@ class CogdoMazeGame(DirectObject): def randomDrop(self, centerTX, centerTY, radius): dropArray = [] - for i in xrange(1, distance): + for i in range(1, distance): dropArray.append(i) dropArray.append(-1 * i) @@ -401,7 +401,7 @@ class CogdoMazeGame(DirectObject): return drop.getDropIval() def cleanupDrop(self, id): - if id in self.drops.keys(): + if id in list(self.drops.keys()): drop = self.drops[id] drop.destroy() del self.drops[id] @@ -470,7 +470,7 @@ class CogdoMazeGame(DirectObject): self.distGame.b_toonHitByGag(playerId) def toonHitByGag(self, toonId, hitToon, elapsedTime = 0.0): - if toonId not in self.toonId2Player.keys() or hitToon not in self.toonId2Player.keys(): + if toonId not in list(self.toonId2Player.keys()) or hitToon not in list(self.toonId2Player.keys()): return player = self.toonId2Player[hitToon] player.hitByGag() @@ -483,7 +483,7 @@ class CogdoMazeGame(DirectObject): def suitHitByGag(self, toonId, suitType, suitNum, elapsedTime = 0.0): if suitType == Globals.SuitTypes.Boss: self.guiMgr.showBossHit(suitNum) - if suitNum in self.suitsById.keys(): + if suitNum in list(self.suitsById.keys()): suit = self.suitsById[suitNum] suit.hitByGag() @@ -568,13 +568,13 @@ class CogdoMazeGame(DirectObject): for player in self.players: player.removeGag() - elif toonId in self.toonId2Player.keys(): + elif toonId in list(self.toonId2Player.keys()): player = self.toonId2Player[toonId] player.removeGag() def handleToonDisconnected(self, toonId): if toonId == self.localPlayer.toon.doId: pass - elif toonId in self.toonId2Player.keys(): + elif toonId in list(self.toonId2Player.keys()): player = self.toonId2Player[toonId] self._removePlayer(player) diff --git a/toontown/cogdominium/CogdoMazeGameGuis.py b/toontown/cogdominium/CogdoMazeGameGuis.py index 52b20e8..2a53be4 100644 --- a/toontown/cogdominium/CogdoMazeGameGuis.py +++ b/toontown/cogdominium/CogdoMazeGameGuis.py @@ -8,8 +8,8 @@ from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownIntervals from toontown.minigame.MazeMapGui import MazeMapGui -import CogdoMazeGameGlobals as Globals -import CogdoUtil +from . import CogdoMazeGameGlobals as Globals +from . import CogdoUtil class CogdoMazeMapGui(MazeMapGui): @@ -21,7 +21,7 @@ class CogdoMazeMapGui(MazeMapGui): self.setScale(Globals.MapGuiScale) def destroy(self): - for marker in self._suit2marker.values(): + for marker in list(self._suit2marker.values()): marker.removeNode() del self._suit2marker diff --git a/toontown/cogdominium/CogdoMazeGameMovies.py b/toontown/cogdominium/CogdoMazeGameMovies.py index 4057fe3..e2d98ab 100644 --- a/toontown/cogdominium/CogdoMazeGameMovies.py +++ b/toontown/cogdominium/CogdoMazeGameMovies.py @@ -6,9 +6,9 @@ from direct.interval.FunctionInterval import Func, Wait from toontown.toonbase import TTLocalizer from toontown.suit import Suit, SuitDNA from toontown.toon import Toon, ToonHead, ToonDNA -from CogdoUtil import CogdoGameMovie -import CogdoMazeGameGlobals as Globals -import CogdoUtil +from .CogdoUtil import CogdoGameMovie +from . import CogdoMazeGameGlobals as Globals +from . import CogdoUtil class CogdoMazeGameIntro(CogdoGameMovie): diff --git a/toontown/cogdominium/CogdoMazeGameObjects.py b/toontown/cogdominium/CogdoMazeGameObjects.py index 914c7d7..bd17c9c 100644 --- a/toontown/cogdominium/CogdoMazeGameObjects.py +++ b/toontown/cogdominium/CogdoMazeGameObjects.py @@ -6,9 +6,9 @@ from direct.interval.IntervalGlobal import Func, Sequence, Parallel from direct.showbase.DirectObject import DirectObject from direct.task.Task import Task from toontown.toonbase import ToontownGlobals -import CogdoMazeGameGlobals as Globals -from CogdoGameExit import CogdoGameExit -import CogdoUtil +from . import CogdoMazeGameGlobals as Globals +from .CogdoGameExit import CogdoGameExit +from . import CogdoUtil import math import random diff --git a/toontown/cogdominium/CogdoMazeGuiManager.py b/toontown/cogdominium/CogdoMazeGuiManager.py index 8373ad2..d39899a 100644 --- a/toontown/cogdominium/CogdoMazeGuiManager.py +++ b/toontown/cogdominium/CogdoMazeGuiManager.py @@ -3,10 +3,10 @@ from direct.interval.MetaInterval import Sequence from direct.interval.FunctionInterval import Func from toontown.toonbase.ToontownTimer import ToontownTimer from toontown.toonbase import ToontownIntervals -from CogdoMazeGameGuis import CogdoMazeHud, CogdoMazeMapGui, CogdoMazeBossGui -from CogdoGameMessageDisplay import CogdoGameMessageDisplay -import CogdoMazeGameGlobals as Globals -from CogdoMemoGui import CogdoMemoGui +from .CogdoMazeGameGuis import CogdoMazeHud, CogdoMazeMapGui, CogdoMazeBossGui +from .CogdoGameMessageDisplay import CogdoGameMessageDisplay +from . import CogdoMazeGameGlobals as Globals +from .CogdoMemoGui import CogdoMemoGui class CogdoMazeGuiManager: diff --git a/toontown/cogdominium/CogdoMazeLocalPlayer.py b/toontown/cogdominium/CogdoMazeLocalPlayer.py index c5d15b4..a02d539 100644 --- a/toontown/cogdominium/CogdoMazeLocalPlayer.py +++ b/toontown/cogdominium/CogdoMazeLocalPlayer.py @@ -6,10 +6,10 @@ from toontown.toonbase import TTLocalizer from toontown.minigame.OrthoDrive import OrthoDrive from toontown.minigame.OrthoWalk import OrthoWalk from toontown.toonbase import ToontownGlobals -import CogdoGameConsts -import CogdoMazeGameGlobals as Globals -from CogdoMazePlayer import CogdoMazePlayer -from CogdoMazeCameraManager import CogdoMazeCameraManager +from . import CogdoGameConsts +from . import CogdoMazeGameGlobals as Globals +from .CogdoMazePlayer import CogdoMazePlayer +from .CogdoMazeCameraManager import CogdoMazeCameraManager class CogdoMazeLocalPlayer(CogdoMazePlayer): notify = directNotify.newCategory('CogdoMazeLocalPlayer') diff --git a/toontown/cogdominium/CogdoMazePlayer.py b/toontown/cogdominium/CogdoMazePlayer.py index c94dc51..c621189 100644 --- a/toontown/cogdominium/CogdoMazePlayer.py +++ b/toontown/cogdominium/CogdoMazePlayer.py @@ -2,9 +2,9 @@ from pandac.PandaModules import Point3, NodePath from direct.fsm.FSM import FSM from direct.interval.IntervalGlobal import ProjectileInterval, Track, ActorInterval from direct.interval.IntervalGlobal import Func, Sequence, Parallel -from CogdoMazeGameObjects import CogdoMazeSplattable -import CogdoMazeGameGlobals as Globals -import CogdoUtil +from .CogdoMazeGameObjects import CogdoMazeSplattable +from . import CogdoMazeGameGlobals as Globals +from . import CogdoUtil import random class CogdoMazePlayer(FSM, CogdoMazeSplattable): diff --git a/toontown/cogdominium/CogdoMazeSuits.py b/toontown/cogdominium/CogdoMazeSuits.py index cf7f9e5..3b9fa2a 100644 --- a/toontown/cogdominium/CogdoMazeSuits.py +++ b/toontown/cogdominium/CogdoMazeSuits.py @@ -5,8 +5,8 @@ from direct.task.Task import Task from toontown.battle import BattleParticles from toontown.battle import MovieUtil from toontown.minigame.MazeSuit import MazeSuit -from CogdoMazeGameObjects import CogdoMazeSplattable -import CogdoMazeGameGlobals as Globals +from .CogdoMazeGameObjects import CogdoMazeSplattable +from . import CogdoMazeGameGlobals as Globals import random class CogdoMazeSuit(MazeSuit, FSM, CogdoMazeSplattable): @@ -19,7 +19,7 @@ class CogdoMazeSuit(MazeSuit, FSM, CogdoMazeSplattable): MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName) FSM.__init__(self, 'CogdoMazeSuit') CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5) - if data.has_key('scale'): + if 'scale' in data: self.suit.setScale(data['scale']) self.hp = data['hp'] self.type = cogdoSuitType diff --git a/toontown/cogdominium/CogdoMemoGui.py b/toontown/cogdominium/CogdoMemoGui.py index 47cf60c..5002d4f 100644 --- a/toontown/cogdominium/CogdoMemoGui.py +++ b/toontown/cogdominium/CogdoMemoGui.py @@ -3,8 +3,8 @@ from pandac.PandaModules import TextNode from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownIntervals from toontown.toonbase import TTLocalizer -import CogdoUtil -import CogdoGameConsts +from . import CogdoUtil +from . import CogdoGameConsts MEMOICON_SCALE = 0.2 class CogdoMemoGui(DirectFrame): diff --git a/toontown/cogdominium/DistCogdoCraneGame.py b/toontown/cogdominium/DistCogdoCraneGame.py index 98f688a..5f0d499 100644 --- a/toontown/cogdominium/DistCogdoCraneGame.py +++ b/toontown/cogdominium/DistCogdoCraneGame.py @@ -195,17 +195,17 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame): self._gravityForceNode.addForce(self._gravityForce) def _handleEmptyFrictionCoefChanged(self, coef): - for crane in self.cranes.itervalues(): + for crane in self.cranes.values(): crane._handleEmptyFrictionCoefChanged(coef) def _handleRopeLinkMassChanged(self, mass): - for crane in self.cranes.itervalues(): + for crane in self.cranes.values(): crane._handleRopeLinkMassChanged(mass) def _handleMagnetMassChanged(self, mass): - for crane in self.cranes.itervalues(): + for crane in self.cranes.values(): crane._handleMagnetMassChanged(mass) def _handleMoneyBagGrabHeightChanged(self, height): - for moneyBag in self.moneyBags.itervalues(): + for moneyBag in self.moneyBags.values(): moneyBag._handleMoneyBagGrabHeightChanged(height) diff --git a/toontown/cogdominium/DistCogdoCraneGameAI.py b/toontown/cogdominium/DistCogdoCraneGameAI.py index 81b6168..9ecb861 100644 --- a/toontown/cogdominium/DistCogdoCraneGameAI.py +++ b/toontown/cogdominium/DistCogdoCraneGameAI.py @@ -34,23 +34,23 @@ class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, PM.NodePath cs = PM.CollisionInvSphere(0, 0, 0, 42) cn.addSolid(cs) self.attachNewNode(cn) - for i in xrange(CogdoGameConsts.MaxPlayers): + for i in range(CogdoGameConsts.MaxPlayers): crane = DistCogdoCraneAI(self.air, self, i) crane.generateWithRequired(self.zoneId) self._cranes[i] = crane - for i in xrange(len(self._moneyBags)): + for i in range(len(self._moneyBags)): mBag = DistCogdoCraneMoneyBagAI(self.air, self, i) mBag.generateWithRequired(self.zoneId) self._moneyBags[i] = mBag def exitLoaded(self): - for i in xrange(len(self._moneyBags)): + for i in range(len(self._moneyBags)): if self._moneyBags[i]: self._moneyBags[i].requestDelete() self._moneyBags[i] = None - for i in xrange(CogdoGameConsts.MaxPlayers): + for i in range(CogdoGameConsts.MaxPlayers): if self._cranes[i]: self._cranes[i].requestDelete() self._cranes[i] = None @@ -59,10 +59,10 @@ class DistCogdoCraneGameAI(CogdoCraneGameBase, DistCogdoLevelGameAI, PM.NodePath def enterGame(self): DistCogdoLevelGameAI.enterGame(self) - for i in xrange(self.getNumPlayers()): + for i in range(self.getNumPlayers()): self._cranes[i].request('Controlled', self.getToonIds()[i]) - for i in xrange(len(self._moneyBags)): + for i in range(len(self._moneyBags)): if self._moneyBags[i]: self._moneyBags[i].request('Initial') diff --git a/toontown/cogdominium/DistCogdoCraneObject.py b/toontown/cogdominium/DistCogdoCraneObject.py index 8ab8e16..dff1cc2 100644 --- a/toontown/cogdominium/DistCogdoCraneObject.py +++ b/toontown/cogdominium/DistCogdoCraneObject.py @@ -126,12 +126,12 @@ class DistCogdoCraneObject(DistributedSmoothNode.DistributedSmoothNode, FSM.FSM) vel.normalize() impact = vel[1] if impact >= self.getMinImpact(): - print 'hit! %s' % impact + print('hit! %s' % impact) self.hitBossSoundInterval.start() self.doHitBoss(impact) else: self.touchedBossSoundInterval.start() - print '--not hard enough: %s' % impact + print('--not hard enough: %s' % impact) def doHitBoss(self, impact): self.d_hitBoss(impact) @@ -141,7 +141,7 @@ class DistCogdoCraneObject(DistributedSmoothNode.DistributedSmoothNode, FSM.FSM) self.fellOut() def fellOut(self): - raise StandardError, 'fellOut unimplented' + raise Exception('fellOut unimplented') def getMinImpact(self): return 0 @@ -201,7 +201,7 @@ class DistCogdoCraneObject(DistributedSmoothNode.DistributedSmoothNode, FSM.FSM) def defaultFilter(self, request, args): if self.craneGame == None: - raise FSM.RequestDenied, request + raise FSM.RequestDenied(request) return FSM.FSM.defaultFilter(self, request, args) def enterOff(self): diff --git a/toontown/cogdominium/DistCogdoFlyingGame.py b/toontown/cogdominium/DistCogdoFlyingGame.py index 3c49f03..bad7593 100644 --- a/toontown/cogdominium/DistCogdoFlyingGame.py +++ b/toontown/cogdominium/DistCogdoFlyingGame.py @@ -1,9 +1,9 @@ from direct.distributed.ClockDelta import globalClockDelta from toontown.toonbase import TTLocalizer -from CogdoFlyingGame import CogdoFlyingGame -from DistCogdoGame import DistCogdoGame -import CogdoFlyingGameGlobals -import CogdoFlyingGameGlobals as Globals +from .CogdoFlyingGame import CogdoFlyingGame +from .DistCogdoGame import DistCogdoGame +from . import CogdoFlyingGameGlobals +from . import CogdoFlyingGameGlobals as Globals class DistCogdoFlyingGame(DistCogdoGame): notify = directNotify.newCategory('DistCogdoFlyingGame') diff --git a/toontown/cogdominium/DistCogdoFlyingGameAI.py b/toontown/cogdominium/DistCogdoFlyingGameAI.py index 2045e2a..11f3119 100644 --- a/toontown/cogdominium/DistCogdoFlyingGameAI.py +++ b/toontown/cogdominium/DistCogdoFlyingGameAI.py @@ -1,7 +1,7 @@ import random from direct.distributed.ClockDelta import globalClockDelta -from DistCogdoGameAI import DistCogdoGameAI -import CogdoFlyingGameGlobals as Globals +from .DistCogdoGameAI import DistCogdoGameAI +from . import CogdoFlyingGameGlobals as Globals class DistCogdoFlyingGameAI(DistCogdoGameAI): notify = directNotify.newCategory('DistCogdoFlyingGameAI') diff --git a/toontown/cogdominium/DistCogdoGame.py b/toontown/cogdominium/DistCogdoGame.py index e0f87ef..e93249e 100644 --- a/toontown/cogdominium/DistCogdoGame.py +++ b/toontown/cogdominium/DistCogdoGame.py @@ -71,7 +71,7 @@ class DistCogdoGame(DistCogdoGameBase, DistributedObject): return def getToon(self, toonId): - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: return self.cr.doId2do[toonId] else: return None diff --git a/toontown/cogdominium/DistCogdoGameAI.py b/toontown/cogdominium/DistCogdoGameAI.py index aa5bcf1..0cb1625 100644 --- a/toontown/cogdominium/DistCogdoGameAI.py +++ b/toontown/cogdominium/DistCogdoGameAI.py @@ -160,7 +160,7 @@ class DistCogdoGameAI(DistCogdoGameBase, DistributedObjectAI): self.sendUpdate('setToonSad', [ toonId]) if self._sadToken2callback is not None: - callbacks = self._sadToken2callback.values() + callbacks = list(self._sadToken2callback.values()) for callback in callbacks: callback(toonId) diff --git a/toontown/cogdominium/DistCogdoMazeGame.py b/toontown/cogdominium/DistCogdoMazeGame.py index ddd2d34..894f6d8 100644 --- a/toontown/cogdominium/DistCogdoMazeGame.py +++ b/toontown/cogdominium/DistCogdoMazeGame.py @@ -1,11 +1,11 @@ from direct.distributed.ClockDelta import globalClockDelta from toontown.toonbase import TTLocalizer -from DistCogdoGame import DistCogdoGame +from .DistCogdoGame import DistCogdoGame from toontown.cogdominium.DistCogdoMazeGameBase import DistCogdoMazeGameBase -from CogdoMazeGame import CogdoMazeGame -from CogdoMaze import CogdoMazeFactory -import CogdoMazeGameGlobals -import CogdoMazeGameGlobals as Globals +from .CogdoMazeGame import CogdoMazeGame +from .CogdoMaze import CogdoMazeFactory +from . import CogdoMazeGameGlobals +from . import CogdoMazeGameGlobals as Globals class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase): notify = directNotify.newCategory('DistCogdoMazeGame') diff --git a/toontown/cogdominium/DistCogdoMazeGameAI.py b/toontown/cogdominium/DistCogdoMazeGameAI.py index 0af9d21..3e06ac0 100644 --- a/toontown/cogdominium/DistCogdoMazeGameAI.py +++ b/toontown/cogdominium/DistCogdoMazeGameAI.py @@ -3,8 +3,8 @@ from direct.distributed.ClockDelta import globalClockDelta from otp.avatar.SpeedMonitor import SpeedMonitor from toontown.cogdominium.CogdoMaze import CogdoMazeFactory from toontown.cogdominium.DistCogdoMazeGameBase import DistCogdoMazeGameBase -from DistCogdoGameAI import DistCogdoGameAI -import CogdoMazeGameGlobals as Globals +from .DistCogdoGameAI import DistCogdoGameAI +from . import CogdoMazeGameGlobals as Globals cogdoMazeTimeScoreRatio = 0.5 cogdoMazePerfectTime = 90 cogdoMazeMaxTime = 210 @@ -246,7 +246,7 @@ class DistCogdoMazeGameAI(DistCogdoGameAI, DistCogdoMazeGameBase): self.logSuspiciousEvent(senderId, 'CogdoMazeGameAI.requestSuitHitByGag: invalid suit type %s' % suitType) return False - if suitNum not in self.suits.keys(): + if suitNum not in list(self.suits.keys()): self.logSuspiciousEvent(senderId, 'CogdoMazeGameAI.requestSuitHitByGag: invalid suit num %s' % suitNum) return False @@ -273,7 +273,7 @@ class DistCogdoMazeGameAI(DistCogdoGameAI, DistCogdoMazeGameBase): self.logSuspiciousEvent(senderId, 'CogdoMazeGameAI.requestHitBySuit: invalid suit type %s' % suitType) return False - if suitNum not in self.suits.keys(): + if suitNum not in list(self.suits.keys()): self.logSuspiciousEvent(senderId, 'CogdoMazeGameAI.requestHitBySuit: invalid suit num %s' % suitNum) return False @@ -451,7 +451,7 @@ class DistCogdoMazeGameAI(DistCogdoGameAI, DistCogdoMazeGameBase): def exitGame(self): DistCogdoGameAI.exitGame(self) - for (toonId, token) in self._toonId2speedToken.iteritems(): + for (toonId, token) in self._toonId2speedToken.items(): self._speedMonitor.removeNodepath(token) self._toonId2speedToken = {} diff --git a/toontown/cogdominium/DistCogdoMazeGameBase.py b/toontown/cogdominium/DistCogdoMazeGameBase.py index 9b6294b..8f1e891 100644 --- a/toontown/cogdominium/DistCogdoMazeGameBase.py +++ b/toontown/cogdominium/DistCogdoMazeGameBase.py @@ -1,6 +1,6 @@ from direct.showbase.RandomNumGen import RandomNumGen from toontown.cogdominium.CogdoMaze import CogdoMazeFactory -import CogdoMazeGameGlobals as Globals +from . import CogdoMazeGameGlobals as Globals class DistCogdoMazeGameBase: diff --git a/toontown/cogdominium/DistributedCogdoInterior.py b/toontown/cogdominium/DistributedCogdoInterior.py index e905f80..0ba64e4 100644 --- a/toontown/cogdominium/DistributedCogdoInterior.py +++ b/toontown/cogdominium/DistributedCogdoInterior.py @@ -20,8 +20,8 @@ from toontown.cogdominium import CogdoGameConsts from toontown.cogdominium import CogdoBarrelRoom, CogdoBarrelRoomConsts from toontown.distributed import DelayDelete from toontown.toonbase import TTLocalizer -from CogdoExecutiveSuiteMovies import CogdoExecutiveSuiteIntro -from CogdoElevatorMovie import CogdoElevatorMovie +from .CogdoExecutiveSuiteMovies import CogdoExecutiveSuiteIntro +from .CogdoElevatorMovie import CogdoElevatorMovie PAINTING_DICT = {'s': 'tt_m_ara_crg_paintingMoverShaker', 'l': 'tt_m_ara_crg_paintingLegalEagle', 'm': 'tt_m_ara_crg_paintingMoverShaker', @@ -256,13 +256,13 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject): self.ignore(toon.uniqueName('disable')) def __finishInterval(self, name): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: interval = self.activeIntervals[name] if interval.isPlaying(): interval.finish() def __cleanupIntervals(self): - for interval in self.activeIntervals.values(): + for interval in list(self.activeIntervals.values()): interval.finish() self.activeIntervals = {} @@ -305,7 +305,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject): self.toons = [] for toonId in toonIds: if toonId != 0: - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: toon = self.cr.doId2do[toonId] toon.stopSmooth() self.toons.append(toon) @@ -323,7 +323,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject): self.suits = [] self.joiningReserves = [] for suitId in suitIds: - if self.cr.doId2do.has_key(suitId): + if suitId in self.cr.doId2do: suit = self.cr.doId2do[suitId] self.suits.append(suit) suit.fsm.request('Battle') @@ -337,7 +337,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject): self.reserveSuits = [] for index in range(len(reserveIds)): suitId = reserveIds[index] - if self.cr.doId2do.has_key(suitId): + if suitId in self.cr.doId2do: suit = self.cr.doId2do[suitId] self.reserveSuits.append((suit, values[index])) else: diff --git a/toontown/cogdominium/DistributedCogdoInteriorAI.py b/toontown/cogdominium/DistributedCogdoInteriorAI.py index 90575e5..0945124 100644 --- a/toontown/cogdominium/DistributedCogdoInteriorAI.py +++ b/toontown/cogdominium/DistributedCogdoInteriorAI.py @@ -16,10 +16,10 @@ from toontown.toonbase.ToontownBattleGlobals import * from toontown.hood import ZoneUtil from toontown.minigame.MinigameGlobals import SafeZones from toontown.toon import NPCToons -from DistributedCogdoElevatorIntAI import DistributedCogdoElevatorIntAI +from .DistributedCogdoElevatorIntAI import DistributedCogdoElevatorIntAI from toontown.cogdominium import CogdoBarrelRoomConsts from toontown.cogdominium import CogdoBarrelRoomAI -from DistCogdoBoardroomGameAI import DistCogdoBoardroomGameAI +from .DistCogdoBoardroomGameAI import DistCogdoBoardroomGameAI from toontown.cogdominium.DistCogdoCraneGameAI import DistCogdoCraneGameAI from toontown.cogdominium.DistCogdoMazeGameAI import DistCogdoMazeGameAI from toontown.cogdominium.DistCogdoFlyingGameAI import DistCogdoFlyingGameAI @@ -223,7 +223,7 @@ class DistributedCogdoInteriorAI(DistributedObjectAI.DistributedObjectAI): return task.done def __addToon(self, toonId): - if not self.air.doId2do.has_key(toonId): + if toonId not in self.air.doId2do: self.notify.warning('addToon() - no toon for doId: %d' % toonId) return @@ -241,7 +241,7 @@ class DistributedCogdoInteriorAI(DistributedObjectAI.DistributedObjectAI): if self.toonIds.count(toonId): self.toonIds[self.toonIds.index(toonId)] = None - if self.responses.has_key(toonId): + if toonId in self.responses: del self.responses[toonId] event = self.air.getAvatarExitEvent(toonId) @@ -476,7 +476,7 @@ class DistributedCogdoInteriorAI(DistributedObjectAI.DistributedObjectAI): else: name = None while name is None or name in IntGames: - name = random.choice(CogdoGames.keys()) + name = random.choice(list(CogdoGames.keys())) gameCtor = CogdoGames[name] game = gameCtor(self.air, self) game.setExteriorZone(self.extZoneId) @@ -525,12 +525,12 @@ class DistributedCogdoInteriorAI(DistributedObjectAI.DistributedObjectAI): def _gameDone(self): self.__calcLaff() - for (toonId, reward) in self._rewardedLaff.iteritems(): + for (toonId, reward) in self._rewardedLaff.items(): if reward: av = self.air.doId2do.get(toonId) av.toonUp(reward) - for (toonId, penalty) in self._penaltyLaff.iteritems(): + for (toonId, penalty) in self._penaltyLaff.items(): if penalty: av = self.air.doId2do.get(toonId) if config.GetBool('want-cogdo-maze-no-sad', 1): @@ -573,7 +573,7 @@ class DistributedCogdoInteriorAI(DistributedObjectAI.DistributedObjectAI): self._rewardedLaff[toonId] = reward if self._rewardedLaff: - self.air.writeServerEvent('CogdoLaffReward', self._rewardedLaff.keys(), 'Awarded %s Laff for difficulty %s and score %s' % (reward, self._game.getDifficulty(), score)) + self.air.writeServerEvent('CogdoLaffReward', list(self._rewardedLaff.keys()), 'Awarded %s Laff for difficulty %s and score %s' % (reward, self._game.getDifficulty(), score)) penalty = self._game.getDifficulty() * CogdoGameConsts.LaffPenalty for toonId in self.toons: @@ -581,7 +581,7 @@ class DistributedCogdoInteriorAI(DistributedObjectAI.DistributedObjectAI): self._penaltyLaff[toonId] = penalty if self._penaltyLaff: - self.air.writeServerEvent('CogdoLaffPenalty', self._penaltyLaff.keys(), 'Penalized %s Laff for difficulty %s (did not reach exit)' % (penalty, self._game.getDifficulty())) + self.air.writeServerEvent('CogdoLaffPenalty', list(self._penaltyLaff.keys()), 'Penalized %s Laff for difficulty %s (did not reach exit)' % (penalty, self._game.getDifficulty())) def toonBarrelRoomIntroDone(self): avId = self.air.getAvatarIdFromSender() diff --git a/toontown/coghq/BossbotCogHQLoader.py b/toontown/coghq/BossbotCogHQLoader.py index 9c6491b..4f11ce7 100644 --- a/toontown/coghq/BossbotCogHQLoader.py +++ b/toontown/coghq/BossbotCogHQLoader.py @@ -1,6 +1,6 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData -import CogHQLoader +from . import CogHQLoader from toontown.toonbase import ToontownGlobals from direct.gui import DirectGui from toontown.toonbase import TTLocalizer diff --git a/toontown/coghq/BossbotCountryClubFairwayRoom_Battle00_Cogs.py b/toontown/coghq/BossbotCountryClubFairwayRoom_Battle00_Cogs.py index 366237d..8ce75fd 100644 --- a/toontown/coghq/BossbotCountryClubFairwayRoom_Battle00_Cogs.py +++ b/toontown/coghq/BossbotCountryClubFairwayRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110200 BattleCellId = 0 diff --git a/toontown/coghq/BossbotCountryClubKartRoom_Battle00_Cogs.py b/toontown/coghq/BossbotCountryClubKartRoom_Battle00_Cogs.py index d5bb9db..e38456d 100644 --- a/toontown/coghq/BossbotCountryClubKartRoom_Battle00_Cogs.py +++ b/toontown/coghq/BossbotCountryClubKartRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110400 BattleCellId = 0 diff --git a/toontown/coghq/BossbotCountryClubMazeRoom_Battle00_Cogs.py b/toontown/coghq/BossbotCountryClubMazeRoom_Battle00_Cogs.py index fd11c5d..b142083 100644 --- a/toontown/coghq/BossbotCountryClubMazeRoom_Battle00_Cogs.py +++ b/toontown/coghq/BossbotCountryClubMazeRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110000 BattleCellId = 0 diff --git a/toontown/coghq/BossbotCountryClubMazeRoom_Battle01_Cogs.py b/toontown/coghq/BossbotCountryClubMazeRoom_Battle01_Cogs.py index f9262dc..17dc25d 100644 --- a/toontown/coghq/BossbotCountryClubMazeRoom_Battle01_Cogs.py +++ b/toontown/coghq/BossbotCountryClubMazeRoom_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110000 BattleCellId = 0 diff --git a/toontown/coghq/BossbotCountryClubMazeRoom_Battle02_Cogs.py b/toontown/coghq/BossbotCountryClubMazeRoom_Battle02_Cogs.py index 3ae0128..1f23055 100644 --- a/toontown/coghq/BossbotCountryClubMazeRoom_Battle02_Cogs.py +++ b/toontown/coghq/BossbotCountryClubMazeRoom_Battle02_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110000 BattleCellId = 0 diff --git a/toontown/coghq/BossbotCountryClubMazeRoom_Battle03_Cogs.py b/toontown/coghq/BossbotCountryClubMazeRoom_Battle03_Cogs.py index a809961..41872e0 100644 --- a/toontown/coghq/BossbotCountryClubMazeRoom_Battle03_Cogs.py +++ b/toontown/coghq/BossbotCountryClubMazeRoom_Battle03_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110000 BattleCellId = 0 diff --git a/toontown/coghq/BossbotCountryClubPresidentRoom_Battle00_Cogs.py b/toontown/coghq/BossbotCountryClubPresidentRoom_Battle00_Cogs.py index bc62540..7660d47 100644 --- a/toontown/coghq/BossbotCountryClubPresidentRoom_Battle00_Cogs.py +++ b/toontown/coghq/BossbotCountryClubPresidentRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 110400 BattleCellId = 0 diff --git a/toontown/coghq/BossbotOfficeExterior.py b/toontown/coghq/BossbotOfficeExterior.py index 0f6a8a0..1765d3b 100644 --- a/toontown/coghq/BossbotOfficeExterior.py +++ b/toontown/coghq/BossbotOfficeExterior.py @@ -4,7 +4,7 @@ from direct.fsm import State from toontown.toonbase import ToontownGlobals from toontown.building import Elevator from pandac.PandaModules import * -import FactoryExterior +from . import FactoryExterior class BossbotOfficeExterior(FactoryExterior.FactoryExterior): notify = DirectNotifyGlobal.directNotify.newCategory('LawbotOfficeExterior') diff --git a/toontown/coghq/CashbotCogHQLoader.py b/toontown/coghq/CashbotCogHQLoader.py index c5fe58e..4cf468a 100644 --- a/toontown/coghq/CashbotCogHQLoader.py +++ b/toontown/coghq/CashbotCogHQLoader.py @@ -1,13 +1,13 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData -import CogHQLoader, MintInterior +from . import CogHQLoader, MintInterior from toontown.toonbase import ToontownGlobals from direct.gui import DirectGui from toontown.toonbase import TTLocalizer from toontown.toon import Toon from direct.fsm import State -import CashbotHQExterior -import CashbotHQBossBattle +from . import CashbotHQExterior +from . import CashbotHQBossBattle from pandac.PandaModules import DecalEffect class CashbotCogHQLoader(CogHQLoader.CogHQLoader): diff --git a/toontown/coghq/CashbotMintBoilerRoom_Battle00_Cogs.py b/toontown/coghq/CashbotMintBoilerRoom_Battle00_Cogs.py index 991eeca..1147ac8 100644 --- a/toontown/coghq/CashbotMintBoilerRoom_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintBoilerRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 LowerCogParent = 10003 diff --git a/toontown/coghq/CashbotMintBoilerRoom_Battle01_Cogs.py b/toontown/coghq/CashbotMintBoilerRoom_Battle01_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintBoilerRoom_Battle01_Cogs.py +++ b/toontown/coghq/CashbotMintBoilerRoom_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintControlRoom_Battle00_Cogs.py b/toontown/coghq/CashbotMintControlRoom_Battle00_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintControlRoom_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintControlRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintDuctRoom_Battle00_Cogs.py b/toontown/coghq/CashbotMintDuctRoom_Battle00_Cogs.py index 017caac..98e510a 100644 --- a/toontown/coghq/CashbotMintDuctRoom_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintDuctRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintDuctRoom_Battle01_Cogs.py b/toontown/coghq/CashbotMintDuctRoom_Battle01_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintDuctRoom_Battle01_Cogs.py +++ b/toontown/coghq/CashbotMintDuctRoom_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintGearRoom_Battle00_Cogs.py b/toontown/coghq/CashbotMintGearRoom_Battle00_Cogs.py index 218ebaa..f2de943 100644 --- a/toontown/coghq/CashbotMintGearRoom_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintGearRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintGearRoom_Battle01_Cogs.py b/toontown/coghq/CashbotMintGearRoom_Battle01_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintGearRoom_Battle01_Cogs.py +++ b/toontown/coghq/CashbotMintGearRoom_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintLavaRoomFoyer_Battle00_Cogs.py b/toontown/coghq/CashbotMintLavaRoomFoyer_Battle00_Cogs.py index fe40eb3..041a00d 100644 --- a/toontown/coghq/CashbotMintLavaRoomFoyer_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintLavaRoomFoyer_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleParent = 10005 diff --git a/toontown/coghq/CashbotMintLavaRoomFoyer_Battle01_Cogs.py b/toontown/coghq/CashbotMintLavaRoomFoyer_Battle01_Cogs.py index 505d6de..6a8a0bb 100644 --- a/toontown/coghq/CashbotMintLavaRoomFoyer_Battle01_Cogs.py +++ b/toontown/coghq/CashbotMintLavaRoomFoyer_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleParent = 10005 diff --git a/toontown/coghq/CashbotMintLobby_Battle00_Cogs.py b/toontown/coghq/CashbotMintLobby_Battle00_Cogs.py index 768dd1f..ae7b6ec 100644 --- a/toontown/coghq/CashbotMintLobby_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintLobby_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 MidCogParent = 10022 diff --git a/toontown/coghq/CashbotMintLobby_Battle01_Cogs.py b/toontown/coghq/CashbotMintLobby_Battle01_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintLobby_Battle01_Cogs.py +++ b/toontown/coghq/CashbotMintLobby_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintOilRoom_Battle00_Cogs.py b/toontown/coghq/CashbotMintOilRoom_Battle00_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintOilRoom_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintOilRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintPaintMixerReward_Battle00_Cogs.py b/toontown/coghq/CashbotMintPaintMixerReward_Battle00_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintPaintMixerReward_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintPaintMixerReward_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CashbotMintPipeRoom_Battle00_Cogs.py b/toontown/coghq/CashbotMintPipeRoom_Battle00_Cogs.py index 2797752..65617ce 100644 --- a/toontown/coghq/CashbotMintPipeRoom_Battle00_Cogs.py +++ b/toontown/coghq/CashbotMintPipeRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 FrontCogParent = 10002 diff --git a/toontown/coghq/CashbotMintPipeRoom_Battle01_Cogs.py b/toontown/coghq/CashbotMintPipeRoom_Battle01_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/CashbotMintPipeRoom_Battle01_Cogs.py +++ b/toontown/coghq/CashbotMintPipeRoom_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/CogDisguiseGlobals.py b/toontown/coghq/CogDisguiseGlobals.py index 27a3607..ba6fa3f 100644 --- a/toontown/coghq/CogDisguiseGlobals.py +++ b/toontown/coghq/CogDisguiseGlobals.py @@ -516,6 +516,6 @@ def asNumber(bitstring): def dept2deptIndex(dept): - if type(dept) == types.StringType: + if type(dept) == bytes: dept = SuitDNA.suitDepts.index(dept) return dept diff --git a/toontown/coghq/CogHQExterior.py b/toontown/coghq/CogHQExterior.py index ebb17d4..295fa0f 100644 --- a/toontown/coghq/CogHQExterior.py +++ b/toontown/coghq/CogHQExterior.py @@ -101,7 +101,7 @@ class CogHQExterior(BattlePlace.BattlePlace): BattlePlace.BattlePlace.enterTeleportIn(self, requestStatus) def enterTeleportOut(self, requestStatus, callback = None): - if requestStatus.has_key('battle'): + if 'battle' in requestStatus: self.__teleportOutDone(requestStatus) else: BattlePlace.BattlePlace.enterTeleportOut(self, requestStatus, self.__teleportOutDone) diff --git a/toontown/coghq/CogHQLoader.py b/toontown/coghq/CogHQLoader.py index 656f1f2..2c3b2ca 100644 --- a/toontown/coghq/CogHQLoader.py +++ b/toontown/coghq/CogHQLoader.py @@ -2,7 +2,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State -import CogHQLobby +from . import CogHQLobby from toontown.hood import QuietZoneState from toontown.hood import ZoneUtil from toontown.town import TownBattle diff --git a/toontown/coghq/CogSuitManagerAI.py b/toontown/coghq/CogSuitManagerAI.py index c6271f7..37ca35b 100644 --- a/toontown/coghq/CogSuitManagerAI.py +++ b/toontown/coghq/CogSuitManagerAI.py @@ -2,7 +2,7 @@ from otp.ai.AIBaseGlobal import * from direct.directnotify import DirectNotifyGlobal import random from toontown.suit import SuitDNA -import CogDisguiseGlobals +from . import CogDisguiseGlobals class CogSuitManagerAI: notify = DirectNotifyGlobal.directNotify.newCategory('CogSuitManagerAI') diff --git a/toontown/coghq/ConveyorBelt.py b/toontown/coghq/ConveyorBelt.py index f8e2685..4266a46 100644 --- a/toontown/coghq/ConveyorBelt.py +++ b/toontown/coghq/ConveyorBelt.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import MovingPlatform +from . import MovingPlatform from otp.level import BasicEntities class ConveyorBelt(BasicEntities.NodePathEntity): @@ -21,7 +21,7 @@ class ConveyorBelt(BasicEntities.NodePathEntity): self.numTreads = int(self.length / self.treadLength) + 3 self.beltNode = self.attachNewNode('belt') self.treads = [] - for i in xrange(self.numTreads): + for i in range(self.numTreads): mp = MovingPlatform.MovingPlatform() mp.parentingNode = render.attachNewNode('parentTarget') mp.setupCopyModel('conv%s-%s' % (self.getParentToken(), i), treadModel, self.floorName, parentingNode=mp.parentingNode) @@ -47,7 +47,7 @@ class ConveyorBelt(BasicEntities.NodePathEntity): treadsIval = Parallel(name='treads') treadPeriod = self.treadLength / abs(self.speed) startY = -self.treadLength - for i in xrange(self.numTreads): + for i in range(self.numTreads): periodsToEnd = self.numTreads - i periodsFromStart = self.numTreads - periodsToEnd ival = Sequence() diff --git a/toontown/coghq/CountryClubLayout.py b/toontown/coghq/CountryClubLayout.py index 83fb00d..034edfa 100644 --- a/toontown/coghq/CountryClubLayout.py +++ b/toontown/coghq/CountryClubLayout.py @@ -6,33 +6,33 @@ from direct.showbase.PythonUtil import normalDistrib, lerp import random def printAllBossbotInfo(): - print 'roomId: roomName' - for roomId, roomName in CountryClubRoomSpecs.BossbotCountryClubRoomId2RoomName.items(): - print '%s: %s' % (roomId, roomName) + print('roomId: roomName') + for roomId, roomName in list(CountryClubRoomSpecs.BossbotCountryClubRoomId2RoomName.items()): + print('%s: %s' % (roomId, roomName)) - print '\nroomId: numBattles' - for roomId, numBattles in CountryClubRoomSpecs.roomId2numBattles.items(): - print '%s: %s' % (roomId, numBattles) + print('\nroomId: numBattles') + for roomId, numBattles in list(CountryClubRoomSpecs.roomId2numBattles.items()): + print('%s: %s' % (roomId, numBattles)) - print '\ncountryClubId floor roomIds' + print('\ncountryClubId floor roomIds') printCountryClubRoomIds() - print '\ncountryClubId floor numRooms' + print('\ncountryClubId floor numRooms') printNumRooms() - print '\ncountryClubId floor numForcedBattles' + print('\ncountryClubId floor numForcedBattles') printNumBattles() def iterateBossbotCountryClubs(func): from toontown.toonbase import ToontownGlobals for countryClubId in [ToontownGlobals.BossbotCountryClubIntA, ToontownGlobals.BossbotCountryClubIntB, ToontownGlobals.BossbotCountryClubIntC]: - for floorNum in xrange(ToontownGlobals.CountryClubNumFloors[countryClubId]): + for floorNum in range(ToontownGlobals.CountryClubNumFloors[countryClubId]): func(CountryClubLayout(countryClubId, floorNum)) def printCountryClubInfo(): def func(ml): - print ml + print(ml) iterateBossbotCountryClubs(func) @@ -40,7 +40,7 @@ def printCountryClubInfo(): def printCountryClubRoomIds(): def func(ml): - print ml.getCountryClubId(), ml.getFloorNum(), ml.getRoomIds() + print(ml.getCountryClubId(), ml.getFloorNum(), ml.getRoomIds()) iterateBossbotCountryClubs(func) @@ -48,7 +48,7 @@ def printCountryClubRoomIds(): def printCountryClubRoomNames(): def func(ml): - print ml.getCountryClubId(), ml.getFloorNum(), ml.getRoomNames() + print(ml.getCountryClubId(), ml.getFloorNum(), ml.getRoomNames()) iterateBossbotCountryClubs(func) @@ -56,7 +56,7 @@ def printCountryClubRoomNames(): def printNumRooms(): def func(ml): - print ml.getCountryClubId(), ml.getFloorNum(), ml.getNumRooms() + print(ml.getCountryClubId(), ml.getFloorNum(), ml.getNumRooms()) iterateBossbotCountryClubs(func) @@ -64,7 +64,7 @@ def printNumRooms(): def printNumBattles(): def func(ml): - print ml.getCountryClubId(), ml.getFloorNum(), ml.getNumBattles() + print(ml.getCountryClubId(), ml.getFloorNum(), ml.getNumBattles()) iterateBossbotCountryClubs(func) @@ -151,7 +151,7 @@ class CountryClubLayout: self.roomIds = countryClubLayouts[layoutIndex][floorNum] hallwayRng = self.getRng() connectorRoomNames = CountryClubRoomSpecs.BossbotCountryClubConnectorRooms - for i in xrange(self.numHallways): + for i in range(self.numHallways): self.hallways.append(hallwayRng.choice(connectorRoomNames)) def _genFloorLayout(self): @@ -171,7 +171,7 @@ class CountryClubLayout: numBattles2middleRoomIds = invertDictLossless(CountryClubRoomSpecs.middleRoomId2numBattles) allBattleRooms = [] - for num, roomIds in numBattles2middleRoomIds.items(): + for num, roomIds in list(numBattles2middleRoomIds.items()): if num > 0: allBattleRooms.extend(roomIds) while 1: @@ -189,7 +189,7 @@ class CountryClubLayout: if middleRoomsLeft > 0: actionRoomIds = numBattles2middleRoomIds[0] - for i in xrange(middleRoomsLeft): + for i in range(middleRoomsLeft): roomId = rng.choice(actionRoomIds) actionRoomIds.remove(roomId) middleRoomIds.append(roomId) @@ -199,7 +199,7 @@ class CountryClubLayout: roomIds.append(rng.choice(startingRoomIDs)) middleRoomIds.sort() - print 'middleRoomIds=%s' % middleRoomIds + print('middleRoomIds=%s' % middleRoomIds) roomIds.extend(middleRoomIds) roomIds.append(finalRoomId) diff --git a/toontown/coghq/CountryClubManagerAI.py b/toontown/coghq/CountryClubManagerAI.py index 9516156..ea9736f 100644 --- a/toontown/coghq/CountryClubManagerAI.py +++ b/toontown/coghq/CountryClubManagerAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import DistributedCountryClubAI +from . import DistributedCountryClubAI from toontown.toonbase import ToontownGlobals from toontown.coghq import CountryClubLayout from direct.showbase import DirectObject @@ -36,7 +36,7 @@ class CountryClubManagerAI(DirectObject.DirectObject): for avId in players: if bboard.has('countryClubRoom-%s' % avId): roomId = bboard.get('countryClubRoom-%s' % avId) - for i in xrange(numFloors): + for i in range(numFloors): layout = CountryClubLayout.CountryClubLayout(countryClubId, i) if roomId in layout.getRoomIds(): floor = i diff --git a/toontown/coghq/CountryClubRoomBase.py b/toontown/coghq/CountryClubRoomBase.py index 764c0d7..ff40c32 100644 --- a/toontown/coghq/CountryClubRoomBase.py +++ b/toontown/coghq/CountryClubRoomBase.py @@ -18,7 +18,7 @@ class CountryClubRoomBase: if __dev__: def getCountryClubEntityTypeReg(self): - import FactoryEntityTypes + from . import FactoryEntityTypes from otp.level import EntityTypeRegistry typeReg = EntityTypeRegistry.EntityTypeRegistry(FactoryEntityTypes) return typeReg diff --git a/toontown/coghq/CountryClubRoomSpecs.py b/toontown/coghq/CountryClubRoomSpecs.py index d8dbe38..aa1f5c8 100644 --- a/toontown/coghq/CountryClubRoomSpecs.py +++ b/toontown/coghq/CountryClubRoomSpecs.py @@ -42,10 +42,10 @@ BossbotCountryClubFinalRoomIDs = (18,) BossbotCountryClubConnectorRooms = ('phase_12/models/bossbotHQ/Connector_Tunnel_A', 'phase_12/models/bossbotHQ/Connector_Tunnel_B') CashbotMintSpecModules = {} if not isClient(): - print 'EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId + print('EXECWARNING CountryClubRoomSpecs: %s' % BossbotCountryClubRoomName2RoomId) printStack() -for roomName, roomId in BossbotCountryClubRoomName2RoomId.items(): - exec 'from toontown.coghq import %s' % roomName +for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()): + exec('from toontown.coghq import %s' % roomName) CashbotMintSpecModules[roomId] = eval(roomName) CogSpecModules = {'BossbotCountryClubFairwayRoom_Battle00': BossbotCountryClubFairwayRoom_Battle00_Cogs, @@ -55,7 +55,7 @@ CogSpecModules = {'BossbotCountryClubFairwayRoom_Battle00': BossbotCountryClubFa 'BossbotCountryClubKartRoom_Battle00': BossbotCountryClubKartRoom_Battle00_Cogs, 'BossbotCountryClubPresidentRoom_Battle00': BossbotCountryClubPresidentRoom_Battle00_Cogs} roomId2numBattles = {} -for roomName, roomId in BossbotCountryClubRoomName2RoomId.items(): +for roomName, roomId in list(BossbotCountryClubRoomName2RoomId.items()): if roomName not in CogSpecModules: roomId2numBattles[roomId] = 0 else: diff --git a/toontown/coghq/CrusherCell.py b/toontown/coghq/CrusherCell.py index 36a0ee8..c3c303d 100644 --- a/toontown/coghq/CrusherCell.py +++ b/toontown/coghq/CrusherCell.py @@ -1,4 +1,4 @@ -import ActiveCell +from . import ActiveCell from direct.directnotify import DirectNotifyGlobal class CrusherCell(ActiveCell.ActiveCell): diff --git a/toontown/coghq/CrusherCellAI.py b/toontown/coghq/CrusherCellAI.py index ea86425..999dd7e 100644 --- a/toontown/coghq/CrusherCellAI.py +++ b/toontown/coghq/CrusherCellAI.py @@ -1,4 +1,4 @@ -import ActiveCellAI +from . import ActiveCellAI from direct.directnotify import DirectNotifyGlobal class CrusherCellAI(ActiveCellAI.ActiveCellAI): diff --git a/toontown/coghq/DinerStatusIndicator.py b/toontown/coghq/DinerStatusIndicator.py index 15ff9c3..3e578f4 100644 --- a/toontown/coghq/DinerStatusIndicator.py +++ b/toontown/coghq/DinerStatusIndicator.py @@ -105,7 +105,7 @@ class DinerStatusIndicator(NodePath, FSM.FSM): flashDuration = 10 if time > flashDuration: flashingTrack.append(Wait(time - flashDuration)) - for i in xrange(10): + for i in range(10): flashingTrack.append(Parallel(LerpColorScaleInterval(icon, 0.5, VBase4(1, 0, 0, 1)), icon.scaleInterval(0.5, 1.25))) flashingTrack.append(Parallel(LerpColorScaleInterval(icon, 0.5, VBase4(1, 1, 1, 1)), icon.scaleInterval(0.5, 1))) diff --git a/toontown/coghq/DirectionalCell.py b/toontown/coghq/DirectionalCell.py index 33574da..950431f 100644 --- a/toontown/coghq/DirectionalCell.py +++ b/toontown/coghq/DirectionalCell.py @@ -1,4 +1,4 @@ -import ActiveCell +from . import ActiveCell from direct.directnotify import DirectNotifyGlobal class DirectionalCell(ActiveCell.ActiveCell): diff --git a/toontown/coghq/DirectionalCellAI.py b/toontown/coghq/DirectionalCellAI.py index 5a6220f..56c7607 100644 --- a/toontown/coghq/DirectionalCellAI.py +++ b/toontown/coghq/DirectionalCellAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import ActiveCellAI, CrateGlobals +from . import ActiveCellAI, CrateGlobals from direct.task import Task class DirectionalCellAI(ActiveCellAI.ActiveCellAI): diff --git a/toontown/coghq/DistributedBanquetTable.py b/toontown/coghq/DistributedBanquetTable.py index 105364b..fd6f6b7 100644 --- a/toontown/coghq/DistributedBanquetTable.py +++ b/toontown/coghq/DistributedBanquetTable.py @@ -103,11 +103,11 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq DistributedObject.DistributedObject.delete(self) self.boss = None self.ignoreAll() - for indicator in self.dinerStatusIndicators.values(): + for indicator in list(self.dinerStatusIndicators.values()): indicator.delete() self.dinerStatusIndicators = {} - for diner in self.diners.values(): + for diner in list(self.diners.values()): diner.delete() self.diners = {} @@ -156,7 +156,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq def setDinerInfo(self, hungryDurations, eatingDurations, dinerLevels): self.dinerInfo = {} - for i in xrange(len(hungryDurations)): + for i in range(len(hungryDurations)): hungryDur = hungryDurations[i] eatingDur = eatingDurations[i] dinerLevel = dinerLevels[i] @@ -180,7 +180,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq self.pitcherMoveSfx = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_adjust.mp3') def setupDiners(self): - for i in xrange(self.numDiners): + for i in range(self.numDiners): newDiner = self.createDiner(i) self.diners[i] = newDiner self.dinerStatus[i] = self.HUNGRY @@ -226,7 +226,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq return diner def setupChairCols(self): - for i in xrange(self.numDiners): + for i in range(self.numDiners): chairCol = self.tableGroup.find('**/collision_chair_%d' % (i + 1)) colName = 'ChairCol-%d-%d' % (self.index, i) chairCol.setTag('chairIndex', str(i)) @@ -278,7 +278,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq def removeFoodModel(self, chairIndex): serviceLoc = self.serviceLocs.get(chairIndex) if serviceLoc: - for i in xrange(serviceLoc.getNumChildren()): + for i in range(serviceLoc.getNumChildren()): serviceLoc.getChild(0).removeNode() def changeDinerToEating(self, chairIndex): @@ -385,37 +385,37 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq def setAllDinersToSitNeutral(self): startFrame = 0 - for diner in self.diners.values(): + for diner in list(self.diners.values()): if not diner.isHidden(): diner.loop('sit', fromFrame=startFrame) startFrame += 1 def cleanupIntervals(self): - for interval in self.activeIntervals.values(): + for interval in list(self.activeIntervals.values()): interval.finish() self.activeIntervals = {} def clearInterval(self, name, finish = 1): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: ival = self.activeIntervals[name] if finish: ival.finish() else: ival.pause() - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: del self.activeIntervals[name] else: self.notify.debug('interval: %s already cleared' % name) def finishInterval(self, name): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: interval = self.activeIntervals[name] interval.finish() def getNotDeadInfo(self): notDeadList = [] - for i in xrange(self.numDiners): + for i in range(self.numDiners): if self.dinerStatus[i] != self.DEAD: notDeadList.append((self.index, i, 12)) @@ -428,7 +428,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq pass def enterInactive(self): - for chairIndex in xrange(self.numDiners): + for chairIndex in range(self.numDiners): indicator = self.dinerStatusIndicators.get(chairIndex) if indicator: indicator.request('Inactive') @@ -465,17 +465,17 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq def prepareForPhaseFour(self): if not self.preparedForPhaseFour: - for i in xrange(8): + for i in range(8): chair = self.tableGroup.find('**/chair_%d' % (i + 1)) if not chair.isEmpty(): chair.hide() colChairs = self.tableGroup.findAllMatches('**/ChairCol*') - for i in xrange(colChairs.getNumPaths()): + for i in range(colChairs.getNumPaths()): col = colChairs.getPath(i) col.stash() colChairs = self.tableGroup.findAllMatches('**/collision_chair*') - for i in xrange(colChairs.getNumPaths()): + for i in range(colChairs.getNumPaths()): col = colChairs.getPath(i) col.stash() @@ -986,7 +986,7 @@ class DistributedBanquetTable(DistributedObject.DistributedObject, FSM.FSM, Banq def __updateWaterPower(self, task): if not self.powerBar: - print '### no power bar!!!' + print('### no power bar!!!') return task.done newPower = self.__getWaterPower(globalClock.getFrameTime()) self.power = newPower diff --git a/toontown/coghq/DistributedBanquetTableAI.py b/toontown/coghq/DistributedBanquetTableAI.py index be4de53..8316154 100644 --- a/toontown/coghq/DistributedBanquetTableAI.py +++ b/toontown/coghq/DistributedBanquetTableAI.py @@ -17,7 +17,7 @@ class DistributedBanquetTableAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM self.numChairs = 8 self.dinerStatus = {} self.dinerInfo = {} - for i in xrange(self.numDiners): + for i in range(self.numDiners): self.dinerStatus[i] = self.INACTIVE diffSettings = ToontownGlobals.BossbotBossDifficultySettings[self.boss.battleDifficulty] hungryDuration = diffSettings[4] @@ -60,7 +60,7 @@ class DistributedBanquetTableAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM hungryDurations = [] eatingDurations = [] dinerLevels = [] - for i in xrange(self.numDiners): + for i in range(self.numDiners): hungryDurations.append(self.dinerInfo[i][0]) eatingDurations.append(self.dinerInfo[i][1]) dinerLevels.append(self.dinerInfo[i][2]) @@ -157,7 +157,7 @@ class DistributedBanquetTableAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM def getNotDeadInfo(self): notDeadList = [] - for i in xrange(self.numDiners): + for i in range(self.numDiners): if self.dinerStatus[i] != self.DEAD: notDeadList.append((self.index, i, self.dinerInfo[i][2])) @@ -204,7 +204,7 @@ class DistributedBanquetTableAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM return 0 def enterOn(self): - for i in xrange(self.numDiners): + for i in range(self.numDiners): self.b_setDinerStatus(i, self.HUNGRY) def exitOn(slef): @@ -217,7 +217,7 @@ class DistributedBanquetTableAI(DistributedObjectAI.DistributedObjectAI, FSM.FSM pass def enterInactive(self): - for task in self.transitionTasks.values(): + for task in list(self.transitionTasks.values()): self.removeTask(task) self.transitionTasks = {} diff --git a/toontown/coghq/DistributedBattleFactoryAI.py b/toontown/coghq/DistributedBattleFactoryAI.py index 1c41cea..3558d43 100644 --- a/toontown/coghq/DistributedBattleFactoryAI.py +++ b/toontown/coghq/DistributedBattleFactoryAI.py @@ -3,7 +3,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.battle.BattleBase import * -import CogDisguiseGlobals +from . import CogDisguiseGlobals from direct.showbase.PythonUtil import addListsByValue class DistributedBattleFactoryAI(DistributedLevelBattleAI.DistributedLevelBattleAI): diff --git a/toontown/coghq/DistributedBeanBarrel.py b/toontown/coghq/DistributedBeanBarrel.py index b6ad7af..f80ee0f 100644 --- a/toontown/coghq/DistributedBeanBarrel.py +++ b/toontown/coghq/DistributedBeanBarrel.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal -import DistributedBarrelBase +from . import DistributedBarrelBase class DistributedBeanBarrel(DistributedBarrelBase.DistributedBarrelBase): diff --git a/toontown/coghq/DistributedBeanBarrelAI.py b/toontown/coghq/DistributedBeanBarrelAI.py index 12efd86..14e1217 100644 --- a/toontown/coghq/DistributedBeanBarrelAI.py +++ b/toontown/coghq/DistributedBeanBarrelAI.py @@ -1,4 +1,4 @@ -import DistributedBarrelBaseAI +from . import DistributedBarrelBaseAI from direct.directnotify import DirectNotifyGlobal from direct.task import Task diff --git a/toontown/coghq/DistributedButton.py b/toontown/coghq/DistributedButton.py index 15d3a7d..0c8b3d8 100644 --- a/toontown/coghq/DistributedButton.py +++ b/toontown/coghq/DistributedButton.py @@ -2,11 +2,11 @@ from pandac.PandaModules import * from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * -import MovingPlatform +from . import MovingPlatform from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM -import DistributedSwitch +from . import DistributedSwitch from toontown.toonbase import TTLocalizer class DistributedButton(DistributedSwitch.DistributedSwitch): diff --git a/toontown/coghq/DistributedButtonAI.py b/toontown/coghq/DistributedButtonAI.py index b87f684..31b457b 100644 --- a/toontown/coghq/DistributedButtonAI.py +++ b/toontown/coghq/DistributedButtonAI.py @@ -1,6 +1,6 @@ from direct.directnotify import DirectNotifyGlobal from direct.task import Task -import DistributedSwitchBase, DistributedSwitchAI +from . import DistributedSwitchBase, DistributedSwitchAI class DistributedButtonAI(DistributedSwitchAI.DistributedSwitchAI): setColor = DistributedSwitchBase.stubFunction diff --git a/toontown/coghq/DistributedCashbotBossObject.py b/toontown/coghq/DistributedCashbotBossObject.py index c1af7b6..2eeefa6 100644 --- a/toontown/coghq/DistributedCashbotBossObject.py +++ b/toontown/coghq/DistributedCashbotBossObject.py @@ -126,12 +126,12 @@ class DistributedCashbotBossObject(DistributedSmoothNode.DistributedSmoothNode, vel.normalize() impact = vel[1] if impact >= self.getMinImpact(): - print 'hit! %s' % impact + print('hit! %s' % impact) self.hitBossSoundInterval.start() self.doHitBoss(impact) else: self.touchedBossSoundInterval.start() - print '--not hard enough: %s' % impact + print('--not hard enough: %s' % impact) def doHitBoss(self, impact): self.d_hitBoss(impact) @@ -141,7 +141,7 @@ class DistributedCashbotBossObject(DistributedSmoothNode.DistributedSmoothNode, self.fellOut() def fellOut(self): - raise StandardError, 'fellOut unimplented' + raise Exception('fellOut unimplented') def getMinImpact(self): return 0 @@ -201,7 +201,7 @@ class DistributedCashbotBossObject(DistributedSmoothNode.DistributedSmoothNode, def defaultFilter(self, request, args): if self.boss == None: - raise FSM.RequestDenied, request + raise FSM.RequestDenied(request) return FSM.FSM.defaultFilter(self, request, args) def enterOff(self): diff --git a/toontown/coghq/DistributedCashbotBossSafe.py b/toontown/coghq/DistributedCashbotBossSafe.py index f0df111..36e22ae 100644 --- a/toontown/coghq/DistributedCashbotBossSafe.py +++ b/toontown/coghq/DistributedCashbotBossSafe.py @@ -3,7 +3,7 @@ from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from otp.otpbase import OTPGlobals -import DistributedCashbotBossObject +from . import DistributedCashbotBossObject class DistributedCashbotBossSafe(DistributedCashbotBossObject.DistributedCashbotBossObject): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCashbotBossSafe') diff --git a/toontown/coghq/DistributedCashbotBossSafeAI.py b/toontown/coghq/DistributedCashbotBossSafeAI.py index a544977..d15e85e 100644 --- a/toontown/coghq/DistributedCashbotBossSafeAI.py +++ b/toontown/coghq/DistributedCashbotBossSafeAI.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals from otp.otpbase import OTPGlobals -import DistributedCashbotBossObjectAI +from . import DistributedCashbotBossObjectAI class DistributedCashbotBossSafeAI(DistributedCashbotBossObjectAI.DistributedCashbotBossObjectAI): wantsWatchDrift = 0 diff --git a/toontown/coghq/DistributedCogHQDoorAI.py b/toontown/coghq/DistributedCogHQDoorAI.py index 1169d66..afa71d7 100644 --- a/toontown/coghq/DistributedCogHQDoorAI.py +++ b/toontown/coghq/DistributedCogHQDoorAI.py @@ -5,7 +5,7 @@ from direct.fsm import ClassicFSM from toontown.building import DistributedDoorAI from direct.fsm import State from toontown.toonbase import ToontownGlobals -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.building import FADoorCodes from toontown.building import DoorTypes from toontown.toonbase import ToontownAccessAI @@ -45,9 +45,9 @@ class DistributedCogHQDoorAI(DistributedDoorAI.DistributedDoorAI): def requestExit(self): avatarID = self.air.getAvatarIdFromSender() - if self.avatarsWhoAreEntering.has_key(avatarID): + if avatarID in self.avatarsWhoAreEntering: del self.avatarsWhoAreEntering[avatarID] - if not self.avatarsWhoAreExiting.has_key(avatarID): + if avatarID not in self.avatarsWhoAreExiting: dept = ToontownGlobals.cogHQZoneId2deptIndex(self.destinationZone) self.avatarsWhoAreExiting[avatarID] = 1 self.sendUpdate('avatarExit', [avatarID]) diff --git a/toontown/coghq/DistributedCogKart.py b/toontown/coghq/DistributedCogKart.py index 0a80792..9e754ab 100644 --- a/toontown/coghq/DistributedCogKart.py +++ b/toontown/coghq/DistributedCogKart.py @@ -187,7 +187,7 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt): del self.toonRequests[index] if avId == 0: pass - elif not self.cr.doId2do.has_key(avId): + elif avId not in self.cr.doId2do: func = PythonUtil.Functor(self.gotToon, index, avId) self.toonRequests[index] = self.cr.relatedObjectMgr.requestObjects([avId], allCallback=func) elif not self.isSetup: @@ -297,7 +297,7 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt): newSlots.append(slot) self.deferredSlots = newSlots - elif self.cr.doId2do.has_key(avId): + elif avId in self.cr.doId2do: if bailFlag == 1 and hasattr(self, 'clockNode'): if timestamp < self.countdownTime and timestamp >= 0: self.countdown(self.countdownTime - timestamp) @@ -351,7 +351,7 @@ class DistributedCogKart(DistributedElevatorExt.DistributedElevatorExt): self.clock.setH(self.clock.getH() + 180) def rejectBoard(self, avId, reason = 0): - print 'rejectBoard %s' % reason + print('rejectBoard %s' % reason) if hasattr(base.localAvatar, 'elevatorNotifier'): if reason == ElevatorConstants.REJECT_SHUFFLE: base.localAvatar.elevatorNotifier.showMe(TTLocalizer.ElevatorHoppedOff) diff --git a/toontown/coghq/DistributedCountryClub.py b/toontown/coghq/DistributedCountryClub.py index 1cb026b..e7bac0d 100644 --- a/toontown/coghq/DistributedCountryClub.py +++ b/toontown/coghq/DistributedCountryClub.py @@ -222,7 +222,7 @@ class DistributedCountryClub(DistributedObject.DistributedObject): return def warpToRoom(self, roomId): - for i in xrange(len(self.rooms)): + for i in range(len(self.rooms)): room = self.rooms[i] if room.roomId == roomId: break diff --git a/toontown/coghq/DistributedCountryClubAI.py b/toontown/coghq/DistributedCountryClubAI.py index 951fc79..9d46074 100644 --- a/toontown/coghq/DistributedCountryClubAI.py +++ b/toontown/coghq/DistributedCountryClubAI.py @@ -20,7 +20,7 @@ class DistributedCountryClubAI(DistributedObjectAI.DistributedObjectAI): self.elevatorList = [] self.battleExpAggreg = battleExpAggreg self.layout = CountryClubLayout.CountryClubLayout(self.countryClubId, self.floorNum, self.layoutIndex) - for i in xrange(self.layout.getNumRooms()): + for i in range(self.layout.getNumRooms()): if i: self.blockedRooms.append(i) diff --git a/toontown/coghq/DistributedCountryClubBattleAI.py b/toontown/coghq/DistributedCountryClubBattleAI.py index ac867a0..8ef0501 100644 --- a/toontown/coghq/DistributedCountryClubBattleAI.py +++ b/toontown/coghq/DistributedCountryClubBattleAI.py @@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.battle.BattleBase import * -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.toonbase.ToontownBattleGlobals import getCountryClubCreditMultiplier from direct.showbase.PythonUtil import addListsByValue diff --git a/toontown/coghq/DistributedCountryClubRoom.py b/toontown/coghq/DistributedCountryClubRoom.py index 7469702..6493472 100644 --- a/toontown/coghq/DistributedCountryClubRoom.py +++ b/toontown/coghq/DistributedCountryClubRoom.py @@ -5,9 +5,9 @@ from direct.interval.IntervalGlobal import * import random from otp.level import DistributedLevel from direct.directnotify import DirectNotifyGlobal -import CountryClubRoomBase, CountryClubRoom -import FactoryEntityCreator -import CountryClubRoomSpecs +from . import CountryClubRoomBase, CountryClubRoom +from . import FactoryEntityCreator +from . import CountryClubRoomSpecs from otp.level import LevelSpec, LevelConstants from toontown.toonbase import TTLocalizer if __dev__: @@ -151,7 +151,7 @@ class DistributedCountryClubRoom(DistributedLevel.DistributedLevel, CountryClubR pos = base.localAvatar.getPos(thisZone) h = base.localAvatar.getH(thisZone) roomName = CountryClubRoomSpecs.BossbotCountryClubRoomId2RoomName[self.roomId] - print 'countryClub pos: %s, h: %s, room: %s' % (repr(pos), h, roomName) + print('countryClub pos: %s, h: %s, room: %s' % (repr(pos), h, roomName)) if self.countryClub is not None: floorNum = self.countryClub.floorNum else: diff --git a/toontown/coghq/DistributedCrate.py b/toontown/coghq/DistributedCrate.py index c643f85..8ab9a3e 100644 --- a/toontown/coghq/DistributedCrate.py +++ b/toontown/coghq/DistributedCrate.py @@ -1,13 +1,13 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.toonbase.ToontownGlobals import * -from CrateGlobals import * +from .CrateGlobals import * from direct.showbase.PythonUtil import fitSrcAngle2Dest from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal -import MovingPlatform +from . import MovingPlatform from direct.task.Task import Task -import DistributedCrushableEntity +from . import DistributedCrushableEntity class DistributedCrate(DistributedCrushableEntity.DistributedCrushableEntity): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCrate') diff --git a/toontown/coghq/DistributedCrateAI.py b/toontown/coghq/DistributedCrateAI.py index 2487d78..c13c861 100644 --- a/toontown/coghq/DistributedCrateAI.py +++ b/toontown/coghq/DistributedCrateAI.py @@ -1,8 +1,8 @@ -from CrateGlobals import * +from .CrateGlobals import * from direct.directnotify import DirectNotifyGlobal -import DistributedCrushableEntityAI +from . import DistributedCrushableEntityAI from direct.task import Task -import CrateGlobals +from . import CrateGlobals class DistributedCrateAI(DistributedCrushableEntityAI.DistributedCrushableEntityAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCrateAI') diff --git a/toontown/coghq/DistributedDoorEntity.py b/toontown/coghq/DistributedDoorEntity.py index e467ab5..4382c19 100644 --- a/toontown/coghq/DistributedDoorEntity.py +++ b/toontown/coghq/DistributedDoorEntity.py @@ -4,7 +4,7 @@ from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal -import DistributedDoorEntityBase +from . import DistributedDoorEntityBase from direct.fsm import FourState from direct.fsm import ClassicFSM from otp.level import DistributedEntity @@ -38,7 +38,7 @@ class DistributedDoorEntityLock(DistributedDoorEntityBase.LockBase, FourState.Fo if self.track is not None: self.track.pause() self.track = None - for i in self.states.keys(): + for i in list(self.states.keys()): del self.states[i] self.states = [] @@ -144,7 +144,7 @@ class DistributedDoorEntity(DistributedDoorEntityBase.DistributedDoorEntityBase, self.locks = [] self.fsm = None - for i in self.states.keys(): + for i in list(self.states.keys()): del self.states[i] self.states = [] @@ -259,7 +259,7 @@ class DistributedDoorEntity(DistributedDoorEntityBase.DistributedDoorEntityBase, door = doorway.find('doortop') if door.isEmpty(): - print 'doortop hack' + print('doortop hack') door = doorway.attachNewNode('doortop') doorway.find('doortop1').reparentTo(door) doorway.find('doortop2').reparentTo(door) @@ -287,7 +287,7 @@ class DistributedDoorEntity(DistributedDoorEntityBase.DistributedDoorEntityBase, door = doorway.find('doorbottom') if door.isEmpty(): - print 'doorbottom hack' + print('doorbottom hack') door = doorway.attachNewNode('doorbottom') doorway.find('doorbottom1').reparentTo(door) doorway.find('doorbottom2').reparentTo(door) @@ -362,9 +362,9 @@ class DistributedDoorEntity(DistributedDoorEntityBase.DistributedDoorEntityBase, return def openInnerDoors(self): - print 'openInnerDoors' + print('openInnerDoors') if not self.level.complexVis() or self.isOuterDoorOpen and (not self.isVisBlocker or self.isVisReady): - print 'openInnerDoors stage Two' + print('openInnerDoors stage Two') duration = self.duration slideSfx = base.loader.loadSfx('phase_9/audio/sfx/CHQ_FACT_door_open_sliding.mp3') finalSfx = base.loader.loadSfx('phase_9/audio/sfx/CHQ_FACT_door_open_final.mp3') @@ -382,7 +382,7 @@ class DistributedDoorEntity(DistributedDoorEntityBase.DistributedDoorEntityBase, self.isOuterDoorOpen = isOpen def enterState1(self): - print 'doors enter state 1' + print('doors enter state 1') FourState.FourState.enterState1(self) self.isOuterDoorOpen = 0 if self.isVisBlocker: diff --git a/toontown/coghq/DistributedDoorEntityAI.py b/toontown/coghq/DistributedDoorEntityAI.py index 17d9f58..cf67418 100644 --- a/toontown/coghq/DistributedDoorEntityAI.py +++ b/toontown/coghq/DistributedDoorEntityAI.py @@ -1,7 +1,7 @@ from direct.distributed.ClockDelta import * from direct.directnotify import DirectNotifyGlobal from direct.showbase import DirectObject -import DistributedDoorEntityBase +from . import DistributedDoorEntityBase from direct.distributed import DistributedObjectAI from otp.level import DistributedEntityAI from direct.fsm import FourStateAI diff --git a/toontown/coghq/DistributedElevatorMarker.py b/toontown/coghq/DistributedElevatorMarker.py index 16b6799..ab3e404 100644 --- a/toontown/coghq/DistributedElevatorMarker.py +++ b/toontown/coghq/DistributedElevatorMarker.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from StomperGlobals import * +from .StomperGlobals import * from direct.distributed import ClockDelta from direct.showbase.PythonUtil import lerp import math diff --git a/toontown/coghq/DistributedFactory.py b/toontown/coghq/DistributedFactory.py index 10aa96b..30eca7f 100644 --- a/toontown/coghq/DistributedFactory.py +++ b/toontown/coghq/DistributedFactory.py @@ -5,9 +5,9 @@ from direct.interval.IntervalGlobal import * import random from otp.level import DistributedLevel from direct.directnotify import DirectNotifyGlobal -import FactoryBase -import FactoryEntityCreator -import FactorySpecs +from . import FactoryBase +from . import FactoryEntityCreator +from . import FactorySpecs from otp.level import LevelSpec from otp.level import LevelConstants from toontown.toonbase import TTLocalizer @@ -98,7 +98,7 @@ class DistributedFactory(DistributedLevel.DistributedLevel, FactoryBase.FactoryB def printPos(self = self): pos = base.localAvatar.getPos(self.getZoneNode(self.lastToonZone)) h = base.localAvatar.getH(self.getZoneNode(self.lastToonZone)) - print 'factory pos: %s, h: %s, zone %s' % (repr(pos), h, self.lastToonZone) + print('factory pos: %s, h: %s, zone %s' % (repr(pos), h, self.lastToonZone)) posStr = 'X: %.3f' % pos[0] + '\nY: %.3f' % pos[1] + '\nZ: %.3f' % pos[2] + '\nH: %.3f' % h + '\nZone: %s' % str(self.lastToonZone) base.localAvatar.setChatAbsolute(posStr, CFThought | CFTimeout) diff --git a/toontown/coghq/DistributedFactoryAI.py b/toontown/coghq/DistributedFactoryAI.py index 0ef3e43..fe596e7 100644 --- a/toontown/coghq/DistributedFactoryAI.py +++ b/toontown/coghq/DistributedFactoryAI.py @@ -1,10 +1,10 @@ from otp.level import DistributedLevelAI from direct.directnotify import DirectNotifyGlobal -import cPickle, LevelSuitPlannerAI, FactoryBase +import pickle, LevelSuitPlannerAI, FactoryBase from direct.task import Task -import FactoryEntityCreatorAI, FactorySpecs +from . import FactoryEntityCreatorAI, FactorySpecs from otp.level import LevelSpec -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.suit import DistributedFactorySuitAI from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals from toontown.coghq import DistributedBattleFactoryAI diff --git a/toontown/coghq/DistributedFoodBelt.py b/toontown/coghq/DistributedFoodBelt.py index d9de30c..c2b09cf 100644 --- a/toontown/coghq/DistributedFoodBelt.py +++ b/toontown/coghq/DistributedFoodBelt.py @@ -78,26 +78,26 @@ class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBelt def enterOn(self): self.beltSoundInterval.loop() - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): self.doMethodLater(self.foodWaitTimes[i], self.startFoodMoving, 'start-%d-%d' % (self.index, i), extraArgs=[i]) def exitOn(self): self.beltSoundInterval.finish() - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): taskName = 'start-%d-%d' % (self.index, i) self.removeTask(taskName) def enterToonup(self): self.beltSound.setPlayRate(self.ToonupBeltSpeed / self.BeltSpeed) self.beltSoundInterval.loop() - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): self.removeFood(i) self.beltActor.setPlayRate(self.ToonupBeltActorPlayRate, 'idle') self.doMethodLater(self.toonupWaitTimes[i], self.startToonupMoving, 'startToonup-%d-%d' % (self.index, i), extraArgs=[i]) def exitToonup(self): self.beltSoundInterval.finish() - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): taskName = 'startToonup-%d-%d' % (self.index, i) self.removeTask(taskName) @@ -108,7 +108,7 @@ class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBelt for ival in self.toonupIvals: ival.finish() - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): self.removeFood(i) self.removeToonup(i) @@ -171,11 +171,11 @@ class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBelt self.beltSoundInterval = SoundInterval(self.beltSound, node=self.beltModel, listenerNode=base.localAvatar, seamlessLoop=True, volume=0.25, cutOff=100) def cleanup(self): - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): taskName = 'start-%d-%d' % (self.index, i) self.removeTask(taskName) - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): taskName = 'startToonup-%d-%d' % (self.index, i) self.removeTask(taskName) @@ -195,7 +195,7 @@ class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBelt return def setupFoodNodes(self): - for i in xrange(self.NumFoodNodes): + for i in range(self.NumFoodNodes): newPosIndex = self.NumFoodNodes - 1 - i yPos = -(self.beltLength / 2.0) + newPosIndex * self.distBetweenFoodNodes newFoodNode = NodePath('foodNode-%d-%d' % (self.index, i)) @@ -211,7 +211,7 @@ class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBelt return def setupFoodIvals(self): - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): foodIval = self.createOneFoodIval(self.foodNodes[i]) self.foodIvals.append(foodIval) @@ -279,7 +279,7 @@ class DistributedFoodBelt(DistributedObject.DistributedObject, FSM.FSM, FoodBelt self.boss.localToonTouchedBeltFood(beltIndex, foodIndex, foodNum) def setupToonupIvals(self): - for i in xrange(len(self.foodNodes)): + for i in range(len(self.foodNodes)): toonupIval = self.createOneToonupIval(self.foodNodes[i]) self.toonupIvals.append(toonupIval) diff --git a/toontown/coghq/DistributedGagBarrel.py b/toontown/coghq/DistributedGagBarrel.py index fdbd4a8..011d8f1 100644 --- a/toontown/coghq/DistributedGagBarrel.py +++ b/toontown/coghq/DistributedGagBarrel.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal -import DistributedBarrelBase +from . import DistributedBarrelBase class DistributedGagBarrel(DistributedBarrelBase.DistributedBarrelBase): diff --git a/toontown/coghq/DistributedGagBarrelAI.py b/toontown/coghq/DistributedGagBarrelAI.py index c780402..c00f01d 100644 --- a/toontown/coghq/DistributedGagBarrelAI.py +++ b/toontown/coghq/DistributedGagBarrelAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownBattleGlobals import * -import DistributedBarrelBaseAI +from . import DistributedBarrelBaseAI from direct.directnotify import DirectNotifyGlobal from direct.task import Task diff --git a/toontown/coghq/DistributedGolfGreenGame.py b/toontown/coghq/DistributedGolfGreenGame.py index 9cb6e1e..a5d2ff7 100644 --- a/toontown/coghq/DistributedGolfGreenGame.py +++ b/toontown/coghq/DistributedGolfGreenGame.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect -from StomperGlobals import * +from .StomperGlobals import * from direct.distributed import ClockDelta from direct.showbase.PythonUtil import lerp import math @@ -19,11 +19,11 @@ from toontown.golf import BuildGeometry from direct.gui.DirectGui import * import random from direct.showbase import RandomNumGen -import GameSprite3D +from . import GameSprite3D from math import pi import math import random -import cPickle +import pickle from toontown.distributed import DelayDelete from toontown.toon import ToonHeadFrame from toontown.battle import BattleParticles @@ -232,7 +232,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): else: printout += '%s ' % columnIndex - print printout + print(printout) for rowIndex in range(self.gridDimZ - 1, -1, -1): if rowIndex < 10: printout = 'row %s ' % rowIndex @@ -247,18 +247,18 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): else: printout += '%s ' % hasSprite - print printout + print(printout) count = 0 for sprite in self.sprites: - print 'count %s X %s Z %s Color %s' % (count, + print('count %s X %s Z %s Color %s' % (count, sprite.gridPosX, sprite.gridPosZ, - sprite.colorType) + sprite.colorType)) count += 1 def pickLevelPattern(self): - self.boardIndex = random.choice(range(0, len(self.boardData))) + self.boardIndex = random.choice(list(range(0, len(self.boardData)))) self.board = self.boardData[self.boardIndex] self.attackPattern = self.attackPatterns[self.boardIndex] self.attackCounter = 0 @@ -355,7 +355,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): self.arrangeToonHeadPanels() def removeToonHeadPanel(self, avId): - if self.toonPanels.has_key(avId): + if avId in self.toonPanels: self.toonPanels[avId].destroy() del self.toonPanels[avId] self.arrangeToonHeadPanels() @@ -997,7 +997,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): size = self.radiusBall * 2.0 facing = 1 if color == None: - colorChoice = random.choice(range(0, 3)) + colorChoice = random.choice(list(range(0, 3))) else: colorChoice = color newSprite = GameSprite3D.GameSprite(spriteBase, size, colorChoice, found, facing) @@ -1076,7 +1076,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): while self.controlSprite == None and self.attackPattern: if self.attackCounter > len(self.attackPattern) - 1: self.attackCounter = 0 - print 'Pattern %s Place %s Type %s' % (self.attackPattern, self.attackCounter, self.attackPattern[self.attackCounter]) + print('Pattern %s Place %s Type %s' % (self.attackPattern, self.attackCounter, self.attackPattern[self.attackCounter])) if self.standbySprite.holdType != None: color = self.standbySprite.holdType sprite = self.addControlSprite(self.newBallX, self.newBallZ + self.spriteNotchPos * self.cellSizeZ, color) @@ -1338,13 +1338,13 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): self.joinedToons.append(avId) index = self.everJoinedToons.index(avId) if index > 3: - print 'ERROR! green game has had more than 4 players, we are about to crash\n %s' % self.everJoinedToons - print 'Joining Toon is %s index is %s' % (avId, index) + print('ERROR! green game has had more than 4 players, we are about to crash\n %s' % self.everJoinedToons) + print('Joining Toon is %s index is %s' % (avId, index)) toon = base.cr.doId2do.get(avId) selfPos = self.getPos(render) offset = self.toonPoints[index] if index > 3: - print 'odd... we should have crashed by now' + print('odd... we should have crashed by now') standPoint = render.getRelativePoint(self, offset) if toon: toon.stopSmooth() @@ -1416,7 +1416,7 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): for entryIndex in range(len(scoreList)): entry = scoreList[entryIndex] - if self.toonPanels.has_key(entry[0]): + if entry[0] in self.toonPanels: panel = self.toonPanels[entry[0]] panel.extraData['text'] = TTLocalizer.GolfGreenGamePlayerScore % entry[1] @@ -1469,5 +1469,5 @@ class DistributedGolfGreenGame(BattleBlocker.BattleBlocker): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) diff --git a/toontown/coghq/DistributedGolfGreenGameAI.py b/toontown/coghq/DistributedGolfGreenGameAI.py index 0cf3ff7..3a45d81 100644 --- a/toontown/coghq/DistributedGolfGreenGameAI.py +++ b/toontown/coghq/DistributedGolfGreenGameAI.py @@ -8,7 +8,7 @@ from otp.level import BasicEntities from toontown.coghq import BattleBlockerAI from direct.distributed.ClockDelta import * from toontown.toonbase import ToontownBattleGlobals -from GolfGreenGameGlobals import * +from .GolfGreenGameGlobals import * import random, time class DistributedGolfGreenGameAI(BattleBlockerAI.BattleBlockerAI, NodePath, BasicEntities.NodePathAttribs): @@ -58,7 +58,7 @@ class DistributedGolfGreenGameAI(BattleBlockerAI.BattleBlockerAI, NodePath, Basi if hasattr(self, 'level'): numToons = len(self.level.presentAvIds) numBoards = self.puzzleBase + numToons * self.puzzlePerPlayer - boardSelect = range(0, len(gameBoards)) + boardSelect = list(range(0, len(gameBoards))) didGetLast = 1 for index in range(numBoards): choice = random.choice(boardSelect) @@ -91,9 +91,9 @@ class DistributedGolfGreenGameAI(BattleBlockerAI.BattleBlockerAI, NodePath, Basi for ball in attackString: color = self.translateData.get(ball) if color or color == 0: - place = random.choice(range(0, len(attackPattern) + 1)) + place = random.choice(list(range(0, len(attackPattern) + 1))) attackPattern.insert(place, color) - place = random.choice(range(0, len(attackPattern) + 1)) + place = random.choice(list(range(0, len(attackPattern) + 1))) attackPattern.insert(place, color) self.attackPatterns.append(attackPattern) @@ -106,7 +106,7 @@ class DistributedGolfGreenGameAI(BattleBlockerAI.BattleBlockerAI, NodePath, Basi self.sendUpdate('setTimerStart', [self.totalTime, self.startTime]) def __printTime(self, task): - print 'Time Left %s' % self.getTimeLeft() + print('Time Left %s' % self.getTimeLeft()) taskMgr.doMethodLater(1.0, self.__printTime, self.taskName('GolfGreenGameTimeout Print')) return task.done @@ -135,7 +135,7 @@ class DistributedGolfGreenGameAI(BattleBlockerAI.BattleBlockerAI, NodePath, Basi elif boardToAssign == None or len(self.boardList[boardIndex][0]) < len(self.boardList[boardToAssign][0]): boardToAssign = boardIndex elif len(self.boardList[boardIndex][0]) == len(self.boardList[boardToAssign][0]): - choice = random.choice(range(2)) + choice = random.choice(list(range(2))) if choice: boardToAssign = boardIndex diff --git a/toontown/coghq/DistributedGolfSpot.py b/toontown/coghq/DistributedGolfSpot.py index 4c754e6..4afcde7 100644 --- a/toontown/coghq/DistributedGolfSpot.py +++ b/toontown/coghq/DistributedGolfSpot.py @@ -116,7 +116,7 @@ class DistributedGolfSpot(DistributedObject.DistributedObject, FSM.FSM): if self.releaseTrack: self.releaseTrack.finish() self.releaseTrack = None - flyTracks = self.flyBallTracks.values() + flyTracks = list(self.flyBallTracks.values()) for track in flyTracks: track.finish() @@ -458,7 +458,7 @@ class DistributedGolfSpot(DistributedObject.DistributedObject, FSM.FSM): def __updateBallPower(self, task): if not self.powerBar: - print '### no power bar!!!' + print('### no power bar!!!') return task.done newPower = self.__getBallPower(globalClock.getFrameTime()) self.power = newPower @@ -671,20 +671,20 @@ class DistributedGolfSpot(DistributedObject.DistributedObject, FSM.FSM): return self.__flyBallBubble def __flyBallHit(self, entry): - print entry + print(entry) def flyBallFinishedFlying(self, sequence): - if self.flyBallTracks.has_key(sequence): + if sequence in self.flyBallTracks: del self.flyBallTracks[sequence] def __finishFlyBallTrack(self, sequence): - if self.flyBallTracks.has_key(sequence): + if sequence in self.flyBallTracks: flyBallTrack = self.flyBallTracks[sequence] del self.flyBallTracks[sequence] flyBallTrack.finish() def flyBallFinishedSplatting(self, sequence): - if self.splatTracks.has_key(sequence): + if sequence in self.splatTracks: del self.splatTracks[sequence] def __flyBallHit(self, entry): @@ -694,7 +694,7 @@ class DistributedGolfSpot(DistributedObject.DistributedObject, FSM.FSM): return sequence = int(entry.getFromNodePath().getNetTag('pieSequence')) self.__finishFlyBallTrack(sequence) - if self.splatTracks.has_key(sequence): + if sequence in self.splatTracks: splatTrack = self.splatTracks[sequence] del self.splatTracks[sequence] splatTrack.finish() diff --git a/toontown/coghq/DistributedGrid.py b/toontown/coghq/DistributedGrid.py index 02b722c..dfca52c 100644 --- a/toontown/coghq/DistributedGrid.py +++ b/toontown/coghq/DistributedGrid.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.toonbase.ToontownGlobals import * -from CrateGlobals import * +from .CrateGlobals import * from otp.level import BasicEntities from direct.directnotify import DirectNotifyGlobal @@ -48,7 +48,7 @@ class DistributedGrid(BasicEntities.DistributedNodePathEntity): long = self.numRow short = self.numCol h = 90 - self.model.setScale(scale * long, scale * short, 1) + self.model.setScale(scale * int, scale * short, 1) self.model.setHpr(h, 180, 0) self.model.setPos(self.cellSize * self.numCol / 2.0, self.cellSize * self.numRow / 2.0, 0.025) self.model.setColor(0.588, 0.588, 0.459, 0.4) diff --git a/toontown/coghq/DistributedGridAI.py b/toontown/coghq/DistributedGridAI.py index edb5012..8d411a8 100644 --- a/toontown/coghq/DistributedGridAI.py +++ b/toontown/coghq/DistributedGridAI.py @@ -1,4 +1,4 @@ -from CrateGlobals import * +from .CrateGlobals import * from otp.level import DistributedEntityAI from direct.directnotify import DirectNotifyGlobal @@ -245,6 +245,6 @@ class DistributedGridAI(DistributedEntityAI.DistributedEntityAI): else: str += ' . ' - print str + ' : %d' % i + print(str + ' : %d' % i) - print '' + print('') diff --git a/toontown/coghq/DistributedHealBarrel.py b/toontown/coghq/DistributedHealBarrel.py index fc48e65..787dfb1 100644 --- a/toontown/coghq/DistributedHealBarrel.py +++ b/toontown/coghq/DistributedHealBarrel.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal -import DistributedBarrelBase +from . import DistributedBarrelBase class DistributedHealBarrel(DistributedBarrelBase.DistributedBarrelBase): diff --git a/toontown/coghq/DistributedHealBarrelAI.py b/toontown/coghq/DistributedHealBarrelAI.py index 2b1c01a..b89a6c2 100644 --- a/toontown/coghq/DistributedHealBarrelAI.py +++ b/toontown/coghq/DistributedHealBarrelAI.py @@ -1,4 +1,4 @@ -import DistributedBarrelBaseAI +from . import DistributedBarrelBaseAI from direct.directnotify import DirectNotifyGlobal from direct.task import Task diff --git a/toontown/coghq/DistributedInGameEditor.py b/toontown/coghq/DistributedInGameEditor.py index 42e39ba..84e3f1f 100644 --- a/toontown/coghq/DistributedInGameEditor.py +++ b/toontown/coghq/DistributedInGameEditor.py @@ -7,8 +7,8 @@ from otp.level import Level from otp.level import LevelConstants from otp.level import Entity from otp.level import EditMgr -from SpecImports import * -from InGameEditorElements import * +from .SpecImports import * +from .InGameEditorElements import * from toontown.cogdominium import CogdoEntityCreator import string @@ -19,10 +19,10 @@ class InGameEditorEntityBase(InGameEditorElement): def attribChanged(self, attrib, value): Entity.Entity.attribChanged(self, attrib, value) - print 'attribChange: %s %s, %s = %s' % (self.level.getEntityType(self.entId), + print('attribChange: %s %s, %s = %s' % (self.level.getEntityType(self.entId), self.entId, attrib, - repr(value)) + repr(value))) def getTypeName(self): return self.level.getEntityType(self.entId) @@ -123,7 +123,7 @@ def getInGameEditorEntityCreatorClass(level): def __init__(self, editor): EntCreatorClass.__init__(self, editor) - entTypes = self.entType2Ctor.keys() + entTypes = list(self.entType2Ctor.keys()) for type in entTypes: self.entType2Ctor[type] = InGameEditorEntity @@ -206,7 +206,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, self.entTypes = entCreator.getEntityTypes() self.selectedEntity = None base.startTk() - import InGameEditor + from . import InGameEditor doneEvent = self.uniqueName('editorDone') saveAsEvent = self.uniqueName('saveSpec') requestSaveEvent = self.uniqueName('requestSpecSave') @@ -317,7 +317,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, def buildEntityTree(self): self.setChildren([]) - entIds = self.entities.keys() + entIds = list(self.entities.keys()) entIds.sort() for entId in entIds: ent = self.getEntity(entId) @@ -488,7 +488,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, def setEntityCreatorUsername(self, entId, editUsername): Level.Level.setEntityCreatorUsername(self, entId, editUsername) if editUsername == self.getEditUsername(): - print 'entity %s about to be created; we requested it' % entId + print('entity %s about to be created; we requested it' % entId) callback = self.entCreateHandlerQ[0] del self.entCreateHandlerQ[:1] callback(entId) @@ -533,12 +533,12 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, oldAttribs = [] spec = self.levelSpec.getEntitySpecCopy(entId) del spec['type'] - for attrib, value in spec.items(): + for attrib, value in list(spec.items()): oldAttribs.append((attrib, value)) def setNewEntityId(entId, self = self, removeAction = removeAction, oldAttribs = oldAttribs): removeAction[2]['entId'] = entId - for attrib, value in spec.items(): + for attrib, value in list(spec.items()): self.privSendAttribEdit(entId, attrib, value) def setEntCreateHandler(self = self, handler = setNewEntityId): @@ -576,7 +576,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, if oldName[i] != ' ': hasSuffix = False else: - print 'numString: %s' % numString + print('numString: %s' % numString) copyNum = int(numString) + 1 if hasSuffix: newName = oldName[:i] + suffix % copyNum @@ -602,13 +602,13 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, copyAttribs['name'] = self.makeCopyOfEntName(copyAttribs['name']) typeDesc = self.entTypeReg.getTypeDesc(copyAttribs['type']) attribDescs = typeDesc.getAttribDescDict() - for attribName, attribDesc in attribDescs.items(): + for attribName, attribDesc in list(attribDescs.items()): if attribDesc.getDatatype() == 'const': del copyAttribs[attribName] def setNewEntityId(entId, self = self, removeAction = removeAction, copyAttribs = copyAttribs): removeAction[2]['entId'] = entId - for attribName, value in copyAttribs.items(): + for attribName, value in list(copyAttribs.items()): self.privSendAttribEdit(entId, attribName, value) def setEntCreateHandler(self = self, handler = setNewEntityId): @@ -620,13 +620,13 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, self.setUndoableAttribEdit(old2new, new2old) def specPrePickle(self, spec): - for attribName, value in spec.items(): + for attribName, value in list(spec.items()): spec[attribName] = repr(value) return spec def specPostUnpickle(self, spec): - for attribName, value in spec.items(): + for attribName, value in list(spec.items()): spec[attribName] = eval(value) return spec @@ -638,8 +638,8 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, self.editor.showWarning('Please select a valid entity first.', 'error') return - import tkFileDialog - filename = tkFileDialog.askopenfilename(parent=self.editor.parent, defaultextension='.egroup', filetypes=[('Entity Group', '.egroup'), ('All Files', '*')]) + import tkinter.filedialog + filename = tkinter.filedialog.askopenfilename(parent=self.editor.parent, defaultextension='.egroup', filetypes=[('Entity Group', '.egroup'), ('All Files', '*')]) if len(filename) == 0: return try: @@ -647,7 +647,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, f = open(filename, 'r') eTree = pickle.load(f) eGroup = pickle.load(f) - for entId, spec in eGroup.items(): + for entId, spec in list(eGroup.items()): eGroup[entId] = self.specPostUnpickle(spec) except: @@ -657,13 +657,13 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, oldEntId2new = {} def addEntities(treeEntry, parentEntId, eGroup = eGroup): - for entId, children in treeEntry.items(): + for entId, children in list(treeEntry.items()): spec = eGroup[entId] entType = spec['type'] del spec['type'] del spec['parentEntId'] typeDesc = self.entTypeReg.getTypeDesc(entType) - for attribName, attribDesc in typeDesc.getAttribDescDict().items(): + for attribName, attribDesc in list(typeDesc.getAttribDescDict().items()): if attribDesc.getDatatype() == 'const': if attribName in spec: del spec[attribName] @@ -690,14 +690,14 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, self.editor.showWarning('Please select a valid entity first.', 'error') return - import tkFileDialog - filename = tkFileDialog.asksaveasfilename(parent=self.editor.parent, defaultextension='.egroup', filetypes=[('Entity Group', '.egroup'), ('All Files', '*')]) + import tkinter.filedialog + filename = tkinter.filedialog.asksaveasfilename(parent=self.editor.parent, defaultextension='.egroup', filetypes=[('Entity Group', '.egroup'), ('All Files', '*')]) if len(filename) == 0: return eTree = {selectedEntId: {}} eGroup = {} eGroup[selectedEntId] = self.levelSpec.getEntitySpecCopy(selectedEntId) - for entId, spec in eGroup.items(): + for entId, spec in list(eGroup.items()): eGroup[entId] = self.specPrePickle(spec) try: @@ -716,8 +716,8 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, self.editor.showWarning('Please select a valid entity first.', 'error') return - import tkFileDialog - filename = tkFileDialog.asksaveasfilename(parent=self.editor.parent, defaultextension='.egroup', filetypes=[('Entity Group', '.egroup'), ('All Files', '*')]) + import tkinter.filedialog + filename = tkinter.filedialog.asksaveasfilename(parent=self.editor.parent, defaultextension='.egroup', filetypes=[('Entity Group', '.egroup'), ('All Files', '*')]) if len(filename) == 0: return eTree = {} @@ -731,7 +731,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, addEntity(child.entId, treeEntry[entId]) addEntity(selectedEntId, eTree) - for entId, spec in eGroup.items(): + for entId, spec in list(eGroup.items()): eGroup[entId] = self.specPrePickle(spec) try: @@ -767,7 +767,7 @@ class DistributedInGameEditor(DistributedObject.DistributedObject, Level.Level, def setAttribChange(self, entId, attrib, valueStr, username): if username == self.editUsername: - print 'we got our own edit back!' + print('we got our own edit back!') value = eval(valueStr) self.levelSpec.setAttribChange(entId, attrib, value, username) diff --git a/toontown/coghq/DistributedInGameEditorAI.py b/toontown/coghq/DistributedInGameEditorAI.py index 762b742..6485cb7 100644 --- a/toontown/coghq/DistributedInGameEditorAI.py +++ b/toontown/coghq/DistributedInGameEditorAI.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed import DistributedObjectAI from direct.directutil import DistributedLargeBlobSenderAI -from SpecImports import * +from .SpecImports import * class DistributedInGameEditorAI(DistributedObjectAI.DistributedObjectAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedInGameEditorAI') @@ -40,7 +40,7 @@ class DistributedInGameEditorAI(DistributedObjectAI.DistributedObjectAI): return self.levelDoId def requestCurrentLevelSpec(self): - print 'requestCurrentLevelSpec' + print('requestCurrentLevelSpec') spec = self.level.levelSpec specStr = repr(spec) largeBlob = DistributedLargeBlobSenderAI.DistributedLargeBlobSenderAI(self.air, self.zoneId, self.editorAvId, specStr, useDisk=simbase.air._specByDisk) diff --git a/toontown/coghq/DistributedLaserField.py b/toontown/coghq/DistributedLaserField.py index 4d331e4..3a1409f 100644 --- a/toontown/coghq/DistributedLaserField.py +++ b/toontown/coghq/DistributedLaserField.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from StomperGlobals import * +from .StomperGlobals import * from direct.distributed import ClockDelta from direct.showbase.PythonUtil import lerp import math @@ -697,7 +697,7 @@ class DistributedLaserField(BattleBlocker.BattleBlocker): suit.setVirtual() def initCollisionGeom(self): - print 'Laser Field initCollisionGeom' + print('Laser Field initCollisionGeom') self.blockerX = self.gridScaleX * 0.5 self.blockerY = self.gridScaleY self.cSphere = CollisionSphere(0, 0, 0, self.blockerX) diff --git a/toontown/coghq/DistributedLaserFieldAI.py b/toontown/coghq/DistributedLaserFieldAI.py index 95f7b8c..5e55c16 100644 --- a/toontown/coghq/DistributedLaserFieldAI.py +++ b/toontown/coghq/DistributedLaserFieldAI.py @@ -153,13 +153,13 @@ class DistributedLaserFieldAI(BattleBlockerAI.BattleBlockerAI, NodePath, BasicEn self.playedSound = 1 def setBattleFinished(self): - print 'battle Finished' + print('battle Finished') BattleBlockerAI.BattleBlockerAI.setBattleFinished(self) messenger.send(self.getOutputEventName(), [1]) self.switchFire() def switchFire(self): - print 'switchFire' + print('switchFire') if self.switchId != 0: switch = self.level.getEntity(self.switchId) if switch: @@ -213,5 +213,5 @@ class DistributedLaserFieldAI(BattleBlockerAI.BattleBlockerAI, NodePath, BasicEn self.hasShownSuits = 1 def addSuit(self, suit): - print 'Adding Suit %s' % suit.doId + print('Adding Suit %s' % suit.doId) BattleBlockerAI.BattleBlockerAI.addSuit(self, suit) diff --git a/toontown/coghq/DistributedLawOffice.py b/toontown/coghq/DistributedLawOffice.py index 810e603..af1b5a4 100644 --- a/toontown/coghq/DistributedLawOffice.py +++ b/toontown/coghq/DistributedLawOffice.py @@ -5,9 +5,9 @@ from direct.interval.IntervalGlobal import * import random from otp.level import DistributedLevel from direct.directnotify import DirectNotifyGlobal -import LawOfficeBase -import FactoryEntityCreator -import FactorySpecs +from . import LawOfficeBase +from . import FactoryEntityCreator +from . import FactorySpecs from otp.level import LevelSpec from otp.level import LevelConstants from toontown.toonbase import TTLocalizer diff --git a/toontown/coghq/DistributedLawOfficeAI.py b/toontown/coghq/DistributedLawOfficeAI.py index c7d376f..7fc3119 100644 --- a/toontown/coghq/DistributedLawOfficeAI.py +++ b/toontown/coghq/DistributedLawOfficeAI.py @@ -1,10 +1,10 @@ from otp.level import DistributedLevelAI from direct.directnotify import DirectNotifyGlobal -import cPickle, LevelSuitPlannerAI, LawOfficeBase +import pickle, LevelSuitPlannerAI, LawOfficeBase from direct.task import Task -import FactoryEntityCreatorAI, FactorySpecs +from . import FactoryEntityCreatorAI, FactorySpecs from otp.level import LevelSpec -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.suit import DistributedFactorySuitAI from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals from toontown.coghq import DistributedBattleFactoryAI @@ -98,14 +98,14 @@ class DistributedLawOfficeAI(DistributedObjectAI, LawOfficeBase.LawOfficeBase): def startNextFloor(self): if self.avIds: - print self.avIds + print(self.avIds) self.currentFloor += 1 specModule = self.layout.getFloorSpec(self.currentFloor) self.level.requestDelete() self.level = DistributedLawOfficeFloorAI.DistributedLawOfficeFloorAI(self.air, self.lawOfficeId, self.zoneId, self.entranceId, self.avIds, specModule) self.level.setLevelSpec(LevelSpec.LevelSpec(specModule)) self.level.generateWithRequired(self.zoneId) - print 'exchanging elevators' + print('exchanging elevators') self.exchangeElevators() self.startSignal() diff --git a/toontown/coghq/DistributedLawOfficeElevatorIntAI.py b/toontown/coghq/DistributedLawOfficeElevatorIntAI.py index 2ebe47d..8e83f6d 100644 --- a/toontown/coghq/DistributedLawOfficeElevatorIntAI.py +++ b/toontown/coghq/DistributedLawOfficeElevatorIntAI.py @@ -33,7 +33,7 @@ class DistributedLawOfficeElevatorIntAI(DistributedElevatorFloorAI.DistributedEl for avId in self.avIds: if avId not in sittingAvIds: - print 'THIS AV ID %s IS NOT ON BOARD' % avId + print('THIS AV ID %s IS NOT ON BOARD' % avId) self.bldg.startNextFloor() else: @@ -42,7 +42,7 @@ class DistributedLawOfficeElevatorIntAI(DistributedElevatorFloorAI.DistributedEl return def enterClosed(self): - print 'DistributedLawOfficeElevatorIntAI.elevatorClosed %s' % self.doId + print('DistributedLawOfficeElevatorIntAI.elevatorClosed %s' % self.doId) DistributedElevatorFloorAI.DistributedElevatorFloorAI.enterClosed(self) if not self.hasOpenedLocked or not self.isLocked: self.fsm.request('opening') diff --git a/toontown/coghq/DistributedLawOfficeFloor.py b/toontown/coghq/DistributedLawOfficeFloor.py index cf9bb04..612abd5 100644 --- a/toontown/coghq/DistributedLawOfficeFloor.py +++ b/toontown/coghq/DistributedLawOfficeFloor.py @@ -5,9 +5,9 @@ from direct.interval.IntervalGlobal import * import random from otp.level import DistributedLevel from direct.directnotify import DirectNotifyGlobal -import LawOfficeBase -import FactoryEntityCreator -import FactorySpecs +from . import LawOfficeBase +from . import FactoryEntityCreator +from . import FactorySpecs from otp.level import LevelSpec from otp.level import LevelConstants from toontown.toonbase import TTLocalizer @@ -96,7 +96,7 @@ class DistributedLawOfficeFloor(DistributedLevel.DistributedLevel, LawOfficeBase def printPos(self = self): pos = base.localAvatar.getPos(self.getZoneNode(self.lastToonZone)) h = base.localAvatar.getH(self.getZoneNode(self.lastToonZone)) - print 'factory pos: %s, h: %s, zone %s' % (repr(pos), h, self.lastToonZone) + print('factory pos: %s, h: %s, zone %s' % (repr(pos), h, self.lastToonZone)) posStr = 'X: %.3f' % pos[0] + '\nY: %.3f' % pos[1] + '\nZ: %.3f' % pos[2] + '\nH: %.3f' % h + '\nZone: %s' % str(self.lastToonZone) base.localAvatar.setChat(posStr, CFThought, 0) diff --git a/toontown/coghq/DistributedLawOfficeFloorAI.py b/toontown/coghq/DistributedLawOfficeFloorAI.py index 758ebf1..7b08713 100644 --- a/toontown/coghq/DistributedLawOfficeFloorAI.py +++ b/toontown/coghq/DistributedLawOfficeFloorAI.py @@ -1,10 +1,10 @@ from otp.level import DistributedLevelAI from direct.directnotify import DirectNotifyGlobal -import cPickle, LevelSuitPlannerAI, LawOfficeBase +import pickle, LevelSuitPlannerAI, LawOfficeBase from direct.task import Task -import FactoryEntityCreatorAI, FactorySpecs +from . import FactoryEntityCreatorAI, FactorySpecs from otp.level import LevelSpec -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.suit import DistributedFactorySuitAI from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals from toontown.coghq import DistributedBattleFactoryAI diff --git a/toontown/coghq/DistributedLawbotCannon.py b/toontown/coghq/DistributedLawbotCannon.py index 43550ff..f62b413 100644 --- a/toontown/coghq/DistributedLawbotCannon.py +++ b/toontown/coghq/DistributedLawbotCannon.py @@ -232,7 +232,7 @@ class DistributedLawbotCannon(DistributedObject.DistributedObject): camera.setPos(0.5, -2, 2.5) camera.setHpr(0, 0, 0) self.boss.toonEnteredCannon(self.avId, self.index) - if self.cr.doId2do.has_key(self.avId): + if self.avId in self.cr.doId2do: self.av = self.cr.doId2do[self.avId] self.acceptOnce(self.av.uniqueName('disable'), self.__avatarGone) self.av.loop('neutral') @@ -669,10 +669,10 @@ class DistributedLawbotCannon(DistributedObject.DistributedObject): return Task.done flightResults = self.__calcFlightResults(avId, launchTime) if not isClient(): - print 'EXECWARNING DistributedLawbotCannon: %s' % flightResults + print('EXECWARNING DistributedLawbotCannon: %s' % flightResults) printStack() for key in flightResults: - exec "%s = flightResults['%s']" % (key, key) + exec("%s = flightResults['%s']" % (key, key)) self.notify.debug('start position: ' + str(startPos)) self.notify.debug('start velocity: ' + str(startVel)) diff --git a/toontown/coghq/DistributedLevelBattle.py b/toontown/coghq/DistributedLevelBattle.py index cfe135b..d478c9c 100644 --- a/toontown/coghq/DistributedLevelBattle.py +++ b/toontown/coghq/DistributedLevelBattle.py @@ -33,8 +33,8 @@ class DistributedLevelBattle(DistributedBattle.DistributedBattle): spec = self.level.getBattleCellSpec(self.battleCellId) self.level.requestReparent(self, spec['parentEntId']) self.setPos(spec['pos']) - print 'spec = %s' % spec - print 'h = %s' % spec.get('h') + print('spec = %s' % spec) + print('h = %s' % spec.get('h')) self.wrtReparentTo(render) return diff --git a/toontown/coghq/DistributedLevelBattleAI.py b/toontown/coghq/DistributedLevelBattleAI.py index 554d4ce..61ec40d 100644 --- a/toontown/coghq/DistributedLevelBattleAI.py +++ b/toontown/coghq/DistributedLevelBattleAI.py @@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM from toontown.battle.BattleBase import * -import CogDisguiseGlobals +from . import CogDisguiseGlobals from direct.showbase.PythonUtil import addListsByValue class DistributedLevelBattleAI(DistributedBattleAI.DistributedBattleAI): diff --git a/toontown/coghq/DistributedLift.py b/toontown/coghq/DistributedLift.py index 1a75997..9e2d506 100644 --- a/toontown/coghq/DistributedLift.py +++ b/toontown/coghq/DistributedLift.py @@ -5,8 +5,8 @@ from otp.level import BasicEntities from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import LiftConstants -import MovingPlatform +from . import LiftConstants +from . import MovingPlatform class DistributedLift(BasicEntities.DistributedNodePathEntity): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLift') @@ -82,7 +82,7 @@ class DistributedLift(BasicEntities.DistributedNodePathEntity): 'back': '**/wall_back', 'left': '**/wall_left', 'right': '**/wall_right'} - for side in side2srch.values(): + for side in list(side2srch.values()): np = self.platformModel.find(side) if not np.isEmpty(): np.setScale(1.0, 1.0, 2.0) diff --git a/toontown/coghq/DistributedLiftAI.py b/toontown/coghq/DistributedLiftAI.py index a69ed99..52b6a67 100644 --- a/toontown/coghq/DistributedLiftAI.py +++ b/toontown/coghq/DistributedLiftAI.py @@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.task import Task from direct.fsm import ClassicFSM, State from direct.fsm import State -import LiftConstants +from . import LiftConstants class DistributedLiftAI(DistributedEntityAI.DistributedEntityAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLiftAI') diff --git a/toontown/coghq/DistributedMaze.py b/toontown/coghq/DistributedMaze.py index 1d570c9..a77ce54 100644 --- a/toontown/coghq/DistributedMaze.py +++ b/toontown/coghq/DistributedMaze.py @@ -5,7 +5,7 @@ from toontown.toonbase.ToontownGlobals import * import random from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import globalClockDelta -import DistributedBarrelBase +from . import DistributedBarrelBase from otp.level.BasicEntities import DistributedNodePathEntity from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer @@ -70,7 +70,7 @@ class DistributedMaze(DistributedNodePathEntity): 270] self.getRng().shuffle(rotations) self.numSections = 0 - for i in xrange(0, 4): + for i in range(0, 4): maze = room.getGeom().find('**/Maze_Inside_%d' % i) if not maze.isEmpty(): self.numSections += 1 diff --git a/toontown/coghq/DistributedMazeAI.py b/toontown/coghq/DistributedMazeAI.py index 390acd7..d1e405d 100644 --- a/toontown/coghq/DistributedMazeAI.py +++ b/toontown/coghq/DistributedMazeAI.py @@ -1,5 +1,5 @@ from otp.level import DistributedEntityAI -import DistributedBarrelBaseAI +from . import DistributedBarrelBaseAI from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import globalClockDelta from direct.task import Task diff --git a/toontown/coghq/DistributedMint.py b/toontown/coghq/DistributedMint.py index e605c5c..fb625ca 100644 --- a/toontown/coghq/DistributedMint.py +++ b/toontown/coghq/DistributedMint.py @@ -165,7 +165,7 @@ class DistributedMint(DistributedObject.DistributedObject): return def warpToRoom(self, roomId): - for i in xrange(len(self.rooms)): + for i in range(len(self.rooms)): room = self.rooms[i] if room.roomId == roomId: break diff --git a/toontown/coghq/DistributedMintBattleAI.py b/toontown/coghq/DistributedMintBattleAI.py index af88990..9392f8f 100644 --- a/toontown/coghq/DistributedMintBattleAI.py +++ b/toontown/coghq/DistributedMintBattleAI.py @@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.battle.BattleBase import * -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.toonbase.ToontownBattleGlobals import getMintCreditMultiplier from direct.showbase.PythonUtil import addListsByValue diff --git a/toontown/coghq/DistributedMintElevatorExt.py b/toontown/coghq/DistributedMintElevatorExt.py index 5e35bab..572fa1d 100644 --- a/toontown/coghq/DistributedMintElevatorExt.py +++ b/toontown/coghq/DistributedMintElevatorExt.py @@ -11,7 +11,7 @@ from direct.gui import DirectGui from toontown.hood import ZoneUtil from toontown.toonbase import TTLocalizer from toontown.toontowngui import TTDialog -import CogDisguiseGlobals +from . import CogDisguiseGlobals class DistributedMintElevatorExt(DistributedElevatorExt.DistributedElevatorExt): diff --git a/toontown/coghq/DistributedMintElevatorExtAI.py b/toontown/coghq/DistributedMintElevatorExtAI.py index 39ed95e..12d0090 100644 --- a/toontown/coghq/DistributedMintElevatorExtAI.py +++ b/toontown/coghq/DistributedMintElevatorExtAI.py @@ -6,7 +6,7 @@ from toontown.building import DistributedElevatorExtAI from direct.fsm import ClassicFSM from direct.fsm import State from direct.task import Task -import CogDisguiseGlobals +from . import CogDisguiseGlobals class DistributedMintElevatorExtAI(DistributedElevatorExtAI.DistributedElevatorExtAI): diff --git a/toontown/coghq/DistributedMintRoom.py b/toontown/coghq/DistributedMintRoom.py index e85cc05..55a1c60 100644 --- a/toontown/coghq/DistributedMintRoom.py +++ b/toontown/coghq/DistributedMintRoom.py @@ -5,9 +5,9 @@ from direct.interval.IntervalGlobal import * import random from otp.level import DistributedLevel from direct.directnotify import DirectNotifyGlobal -import MintRoomBase, MintRoom -import FactoryEntityCreator -import MintRoomSpecs +from . import MintRoomBase, MintRoom +from . import FactoryEntityCreator +from . import MintRoomSpecs from otp.level import LevelSpec, LevelConstants from toontown.toonbase import TTLocalizer if __dev__: @@ -150,7 +150,7 @@ class DistributedMintRoom(DistributedLevel.DistributedLevel, MintRoomBase.MintRo pos = base.localAvatar.getPos(thisZone) h = base.localAvatar.getH(thisZone) roomName = MintRoomSpecs.CashbotMintRoomId2RoomName[self.roomId] - print 'mint pos: %s, h: %s, room: %s' % (repr(pos), h, roomName) + print('mint pos: %s, h: %s, room: %s' % (repr(pos), h, roomName)) if self.mint is not None: floorNum = self.mint.floorNum else: diff --git a/toontown/coghq/DistributedMoleField.py b/toontown/coghq/DistributedMoleField.py index c60f481..0c3dcce 100644 --- a/toontown/coghq/DistributedMoleField.py +++ b/toontown/coghq/DistributedMoleField.py @@ -44,7 +44,7 @@ class DistributedMoleField(DistributedNodePathEntity, MoleFieldBase.MoleFieldBas def disable(self): self.cleanupTimer() - for ival in self.toonHitTracks.values(): + for ival in list(self.toonHitTracks.values()): ival.finish() self.toonHitTracks = {} @@ -99,8 +99,8 @@ class DistributedMoleField(DistributedNodePathEntity, MoleFieldBase.MoleFieldBas def loadModel(self): moleIndex = 0 self.moleHills = [] - for indexY in xrange(self.numSquaresY): - for indexX in xrange(self.numSquaresX): + for indexY in range(self.numSquaresY): + for indexX in range(self.numSquaresX): xPos = indexX * self.spacingX yPos = indexY * self.spacingY newMoleHill = MoleHill.MoleHill(xPos, yPos, 0, self, moleIndex) @@ -339,7 +339,7 @@ class DistributedMoleField(DistributedNodePathEntity, MoleFieldBase.MoleFieldBas oldTrack.finish() toon.setPos(curPos) toon.setZ(self.getZ()) - parentNode = render.attachNewNode('mazeFlyToonParent-' + `avId`) + parentNode = render.attachNewNode('mazeFlyToonParent-' + repr(avId)) parentNode.setPos(toon.getPos(render)) toon.reparentTo(parentNode) toon.setPos(0, 0, 0) @@ -385,7 +385,7 @@ class DistributedMoleField(DistributedNodePathEntity, MoleFieldBase.MoleFieldBas camera.lookAt(toon) return Task.cont - camTaskName = 'mazeToonFlyCam-' + `avId` + camTaskName = 'mazeToonFlyCam-' + repr(avId) taskMgr.add(camTask, camTaskName, priority=20) def cleanupCamTask(self = self, toon = toon, camTaskName = camTaskName, startCamPos = startCamPos): diff --git a/toontown/coghq/DistributedMoleFieldAI.py b/toontown/coghq/DistributedMoleFieldAI.py index bc0f980..6eb2ca2 100644 --- a/toontown/coghq/DistributedMoleFieldAI.py +++ b/toontown/coghq/DistributedMoleFieldAI.py @@ -56,7 +56,7 @@ class DistributedMoleFieldAI(DistributedEntityAI.DistributedEntityAI, MoleFieldB def whackedMole(self, moleIndex, popupNum): validMoleWhack = False - if self.whackedMoles.has_key(moleIndex): + if moleIndex in self.whackedMoles: if self.whackedMoles[moleIndex] < popupNum: validMoleWhack = True else: diff --git a/toontown/coghq/DistributedMover.py b/toontown/coghq/DistributedMover.py index 9f01daf..4b0ece9 100644 --- a/toontown/coghq/DistributedMover.py +++ b/toontown/coghq/DistributedMover.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from StomperGlobals import * +from .StomperGlobals import * from direct.distributed import ClockDelta from direct.showbase.PythonUtil import lerp import math diff --git a/toontown/coghq/DistributedSecurityCamera.py b/toontown/coghq/DistributedSecurityCamera.py index 565ddff..de5a448 100644 --- a/toontown/coghq/DistributedSecurityCamera.py +++ b/toontown/coghq/DistributedSecurityCamera.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from StomperGlobals import * +from .StomperGlobals import * from direct.distributed import ClockDelta from direct.showbase.PythonUtil import lerp import math diff --git a/toontown/coghq/DistributedSellbotHQDoor.py b/toontown/coghq/DistributedSellbotHQDoor.py index fc17ca1..158497b 100644 --- a/toontown/coghq/DistributedSellbotHQDoor.py +++ b/toontown/coghq/DistributedSellbotHQDoor.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from toontown.coghq import DistributedCogHQDoor from toontown.toonbase import TTLocalizer -import CogDisguiseGlobals +from . import CogDisguiseGlobals class DistributedSellbotHQDoor(DistributedCogHQDoor.DistributedCogHQDoor): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSellbotHQDoor') diff --git a/toontown/coghq/DistributedSellbotHQDoorAI.py b/toontown/coghq/DistributedSellbotHQDoorAI.py index 86ab66a..991c7c1 100644 --- a/toontown/coghq/DistributedSellbotHQDoorAI.py +++ b/toontown/coghq/DistributedSellbotHQDoorAI.py @@ -3,7 +3,7 @@ from toontown.coghq import DistributedCogHQDoorAI from toontown.building import FADoorCodes, DoorTypes from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownAccessAI -import CogDisguiseGlobals +from . import CogDisguiseGlobals from otp.otpbase import OTPGlobals class DistributedSellbotHQDoorAI(DistributedCogHQDoorAI.DistributedCogHQDoorAI): diff --git a/toontown/coghq/DistributedSinkingPlatform.py b/toontown/coghq/DistributedSinkingPlatform.py index 1691d20..9efc6bf 100644 --- a/toontown/coghq/DistributedSinkingPlatform.py +++ b/toontown/coghq/DistributedSinkingPlatform.py @@ -4,9 +4,9 @@ from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State from direct.fsm import State from otp.level import BasicEntities -import MovingPlatform +from . import MovingPlatform from direct.distributed import DistributedObject -import SinkingPlatformGlobals +from . import SinkingPlatformGlobals from direct.directnotify import DirectNotifyGlobal class DistributedSinkingPlatform(BasicEntities.DistributedNodePathEntity): diff --git a/toontown/coghq/DistributedSinkingPlatformAI.py b/toontown/coghq/DistributedSinkingPlatformAI.py index cb33c45..a2da2a6 100644 --- a/toontown/coghq/DistributedSinkingPlatformAI.py +++ b/toontown/coghq/DistributedSinkingPlatformAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from direct.directnotify import DirectNotifyGlobal from otp.level import DistributedEntityAI -import SinkingPlatformGlobals +from . import SinkingPlatformGlobals class DistributedSinkingPlatformAI(DistributedEntityAI.DistributedEntityAI): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSinkingPlatformAI') diff --git a/toontown/coghq/DistributedStage.py b/toontown/coghq/DistributedStage.py index f28a216..e7fcbed 100644 --- a/toontown/coghq/DistributedStage.py +++ b/toontown/coghq/DistributedStage.py @@ -117,8 +117,8 @@ class DistributedStage(DistributedObject.DistributedObject): DistributedLevel.notify.warning('Invalid zone floor collision node: %s' % name) else: self.camEnterRoom(roomNum) - print collEntry - print + print(collEntry) + print() self.accept('on-floor', handleCameraRayFloorCollision) if bboard.has('stageRoom'): @@ -210,7 +210,7 @@ class DistributedStage(DistributedObject.DistributedObject): return def warpToRoom(self, roomId): - for i in xrange(len(self.rooms)): + for i in range(len(self.rooms)): room = self.rooms[i] if room.roomId == roomId: break diff --git a/toontown/coghq/DistributedStageBattleAI.py b/toontown/coghq/DistributedStageBattleAI.py index 11a38e0..fa9849d 100644 --- a/toontown/coghq/DistributedStageBattleAI.py +++ b/toontown/coghq/DistributedStageBattleAI.py @@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import State from direct.fsm import ClassicFSM, State from toontown.battle.BattleBase import * -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.toonbase.ToontownBattleGlobals import getStageCreditMultiplier from direct.showbase.PythonUtil import addListsByValue from otp.otpbase.PythonUtil import enumerate diff --git a/toontown/coghq/DistributedStageRoom.py b/toontown/coghq/DistributedStageRoom.py index 3aefd71..f67e8ab 100644 --- a/toontown/coghq/DistributedStageRoom.py +++ b/toontown/coghq/DistributedStageRoom.py @@ -5,9 +5,9 @@ from direct.interval.IntervalGlobal import * import random from otp.level import DistributedLevel from direct.directnotify import DirectNotifyGlobal -import StageRoomBase, StageRoom -import FactoryEntityCreator -import StageRoomSpecs +from . import StageRoomBase, StageRoom +from . import FactoryEntityCreator +from . import StageRoomSpecs from otp.level import LevelSpec, LevelConstants from toontown.toonbase import TTLocalizer if __dev__: @@ -150,7 +150,7 @@ class DistributedStageRoom(DistributedLevel.DistributedLevel, StageRoomBase.Stag pos = base.localAvatar.getPos(thisZone) h = base.localAvatar.getH(thisZone) roomName = StageRoomSpecs.CashbotStageRoomId2RoomName[self.roomId] - print 'stage pos: %s, h: %s, room: %s' % (repr(pos), h, roomName) + print('stage pos: %s, h: %s, room: %s' % (repr(pos), h, roomName)) if self.stage is not None: floorNum = self.stage.floorNum else: diff --git a/toontown/coghq/DistributedStomper.py b/toontown/coghq/DistributedStomper.py index 127127d..9284b02 100644 --- a/toontown/coghq/DistributedStomper.py +++ b/toontown/coghq/DistributedStomper.py @@ -1,11 +1,11 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from StomperGlobals import * +from .StomperGlobals import * from direct.distributed import ClockDelta from direct.showbase.PythonUtil import lerp import math -import DistributedCrusherEntity -import MovingPlatform +from . import DistributedCrusherEntity +from . import MovingPlatform from direct.directnotify import DirectNotifyGlobal from direct.task import Task from toontown.toonbase import ToontownGlobals diff --git a/toontown/coghq/DistributedStomperAI.py b/toontown/coghq/DistributedStomperAI.py index 47f6f93..456fd24 100644 --- a/toontown/coghq/DistributedStomperAI.py +++ b/toontown/coghq/DistributedStomperAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal -import DistributedCrusherEntityAI, StomperGlobals +from . import DistributedCrusherEntityAI, StomperGlobals from direct.distributed import ClockDelta class DistributedStomperAI(DistributedCrusherEntityAI.DistributedCrusherEntityAI): diff --git a/toontown/coghq/DistributedStomperPair.py b/toontown/coghq/DistributedStomperPair.py index 84e0acc..197e8fb 100644 --- a/toontown/coghq/DistributedStomperPair.py +++ b/toontown/coghq/DistributedStomperPair.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * import math -import StomperGlobals +from . import StomperGlobals from direct.directnotify import DirectNotifyGlobal from otp.level import BasicEntities @@ -37,7 +37,7 @@ class DistributedStomperPair(BasicEntities.DistributedNodePathEntity): def checkSquashedToon(self): tPos = base.localAvatar.getPos(self) - print 'tpos = %s' % tPos + print('tpos = %s' % tPos) yRange = 3.0 xRange = 3.0 if tPos[1] < yRange and tPos[1] > -yRange and tPos[0] < xRange and tPos[0] > -xRange: diff --git a/toontown/coghq/DistributedStomperPairAI.py b/toontown/coghq/DistributedStomperPairAI.py index 5ea9204..9e9b916 100644 --- a/toontown/coghq/DistributedStomperPairAI.py +++ b/toontown/coghq/DistributedStomperPairAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from direct.directnotify import DirectNotifyGlobal from otp.level import DistributedEntityAI -import StomperGlobals +from . import StomperGlobals from direct.distributed import ClockDelta class DistributedStomperPairAI(DistributedEntityAI.DistributedEntityAI): diff --git a/toontown/coghq/DistributedSwitch.py b/toontown/coghq/DistributedSwitch.py index 5fd98bf..02ab50e 100644 --- a/toontown/coghq/DistributedSwitch.py +++ b/toontown/coghq/DistributedSwitch.py @@ -3,8 +3,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from otp.level import BasicEntities -import DistributedSwitchBase -import MovingPlatform +from . import DistributedSwitchBase +from . import MovingPlatform from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State diff --git a/toontown/coghq/DistributedSwitchAI.py b/toontown/coghq/DistributedSwitchAI.py index 9b810e5..f9c637f 100644 --- a/toontown/coghq/DistributedSwitchAI.py +++ b/toontown/coghq/DistributedSwitchAI.py @@ -1,6 +1,6 @@ from direct.distributed.ClockDelta import * from direct.directnotify import DirectNotifyGlobal -import DistributedSwitchBase +from . import DistributedSwitchBase from direct.task import Task from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/coghq/DistributedTrigger.py b/toontown/coghq/DistributedTrigger.py index 9bc0ae9..ebcde38 100644 --- a/toontown/coghq/DistributedTrigger.py +++ b/toontown/coghq/DistributedTrigger.py @@ -2,11 +2,11 @@ from pandac.PandaModules import * from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * -import MovingPlatform +from . import MovingPlatform from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM -import DistributedSwitch +from . import DistributedSwitch from toontown.toonbase import TTLocalizer class DistributedTrigger(DistributedSwitch.DistributedSwitch): diff --git a/toontown/coghq/DistributedTriggerAI.py b/toontown/coghq/DistributedTriggerAI.py index a5d80cc..e523689 100644 --- a/toontown/coghq/DistributedTriggerAI.py +++ b/toontown/coghq/DistributedTriggerAI.py @@ -1,6 +1,6 @@ from direct.directnotify import DirectNotifyGlobal from direct.task import Task -import DistributedSwitchAI +from . import DistributedSwitchAI class DistributedTriggerAI(DistributedSwitchAI.DistributedSwitchAI): pass diff --git a/toontown/coghq/FactoryBase.py b/toontown/coghq/FactoryBase.py index ae84085..52fae8b 100644 --- a/toontown/coghq/FactoryBase.py +++ b/toontown/coghq/FactoryBase.py @@ -1,4 +1,4 @@ -import FactorySpecs +from . import FactorySpecs from otp.level import LevelSpec from toontown.toonbase import ToontownGlobals @@ -21,7 +21,7 @@ class FactoryBase: if __dev__: def getEntityTypeReg(self): - import FactoryEntityTypes + from . import FactoryEntityTypes from otp.level import EntityTypeRegistry typeReg = EntityTypeRegistry.EntityTypeRegistry(FactoryEntityTypes) return typeReg diff --git a/toontown/coghq/FactoryEntityCreator.py b/toontown/coghq/FactoryEntityCreator.py index 4ad3092..e97a2cd 100644 --- a/toontown/coghq/FactoryEntityCreator.py +++ b/toontown/coghq/FactoryEntityCreator.py @@ -1,15 +1,15 @@ from otp.level import EntityCreator -import FactoryLevelMgr -import PlatformEntity -import ConveyorBelt -import GearEntity -import PaintMixer -import GoonClipPlane -import MintProduct -import MintProductPallet -import MintShelf -import PathMasterEntity -import RenderingEntity +from . import FactoryLevelMgr +from . import PlatformEntity +from . import ConveyorBelt +from . import GearEntity +from . import PaintMixer +from . import GoonClipPlane +from . import MintProduct +from . import MintProductPallet +from . import MintShelf +from . import PathMasterEntity +from . import RenderingEntity class FactoryEntityCreator(EntityCreator.EntityCreator): diff --git a/toontown/coghq/FactoryEntityCreatorAI.py b/toontown/coghq/FactoryEntityCreatorAI.py index e8640ed..6804aea 100644 --- a/toontown/coghq/FactoryEntityCreatorAI.py +++ b/toontown/coghq/FactoryEntityCreatorAI.py @@ -1,9 +1,9 @@ from otp.level import EntityCreatorAI from direct.showbase.PythonUtil import Functor -import DistributedBeanBarrelAI, DistributedButtonAI, DistributedCrateAI, DistributedLiftAI, DistributedDoorEntityAI, DistributedGagBarrelAI, DistributedGridAI +from . import DistributedBeanBarrelAI, DistributedButtonAI, DistributedCrateAI, DistributedLiftAI, DistributedDoorEntityAI, DistributedGagBarrelAI, DistributedGridAI from toontown.suit import DistributedGridGoonAI from toontown.suit import DistributedGoonAI -import DistributedHealBarrelAI, DistributedStomperPairAI, DistributedTriggerAI, DistributedStomperAI, DistributedLaserFieldAI, DistributedSecurityCameraAI, DistributedMoverAI, DistributedElevatorMarkerAI, DistributedSinkingPlatformAI, ActiveCellAI, CrusherCellAI, DirectionalCellAI, FactoryLevelMgrAI, BattleBlockerAI, DistributedGolfGreenGameAI +from . import DistributedHealBarrelAI, DistributedStomperPairAI, DistributedTriggerAI, DistributedStomperAI, DistributedLaserFieldAI, DistributedSecurityCameraAI, DistributedMoverAI, DistributedElevatorMarkerAI, DistributedSinkingPlatformAI, ActiveCellAI, CrusherCellAI, DirectionalCellAI, FactoryLevelMgrAI, BattleBlockerAI, DistributedGolfGreenGameAI from toontown.coghq import DistributedMoleFieldAI from toontown.coghq import DistributedMazeAI diff --git a/toontown/coghq/FactoryLevelMgr.py b/toontown/coghq/FactoryLevelMgr.py index 39c37ee..3ec7ad4 100644 --- a/toontown/coghq/FactoryLevelMgr.py +++ b/toontown/coghq/FactoryLevelMgr.py @@ -1,5 +1,5 @@ from otp.level import LevelMgr -import FactoryUtil +from . import FactoryUtil from direct.showbase.PythonUtil import Functor from toontown.toonbase import ToontownGlobals diff --git a/toontown/coghq/FactoryManagerAI.py b/toontown/coghq/FactoryManagerAI.py index 1b5cc81..9281a5f 100644 --- a/toontown/coghq/FactoryManagerAI.py +++ b/toontown/coghq/FactoryManagerAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import DistributedFactoryAI +from . import DistributedFactoryAI from toontown.toonbase import ToontownGlobals from direct.showbase import DirectObject diff --git a/toontown/coghq/FactoryMockupCogs.py b/toontown/coghq/FactoryMockupCogs.py index 78bd47e..aee992c 100644 --- a/toontown/coghq/FactoryMockupCogs.py +++ b/toontown/coghq/FactoryMockupCogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * BattleCells = {} CogData = [] ReserveCogData = [] diff --git a/toontown/coghq/FactoryMockupSpec.py b/toontown/coghq/FactoryMockupSpec.py index 7312425..a5b5795 100644 --- a/toontown/coghq/FactoryMockupSpec.py +++ b/toontown/coghq/FactoryMockupSpec.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * GlobalEntities = {1000: {'type': 'levelMgr', 'name': 'LevelMgr', 'comment': '', diff --git a/toontown/coghq/FactorySpecs.py b/toontown/coghq/FactorySpecs.py index f61a504..7b2a5be 100644 --- a/toontown/coghq/FactorySpecs.py +++ b/toontown/coghq/FactorySpecs.py @@ -1,8 +1,8 @@ from toontown.toonbase import ToontownGlobals -import SellbotLegFactorySpec -import SellbotLegFactoryCogs -import LawbotLegFactorySpec -import LawbotLegFactoryCogs +from . import SellbotLegFactorySpec +from . import SellbotLegFactoryCogs +from . import LawbotLegFactorySpec +from . import LawbotLegFactoryCogs def getFactorySpecModule(factoryId): return FactorySpecModules[factoryId] @@ -17,7 +17,7 @@ FactorySpecModules = {ToontownGlobals.SellbotFactoryInt: SellbotLegFactorySpec, CogSpecModules = {ToontownGlobals.SellbotFactoryInt: SellbotLegFactoryCogs, ToontownGlobals.LawbotOfficeInt: LawbotLegFactoryCogs} if __dev__: - import FactoryMockupSpec + from . import FactoryMockupSpec FactorySpecModules[ToontownGlobals.MockupFactoryId] = FactoryMockupSpec - import FactoryMockupCogs + from . import FactoryMockupCogs CogSpecModules[ToontownGlobals.MockupFactoryId] = FactoryMockupCogs diff --git a/toontown/coghq/FactoryUtil.py b/toontown/coghq/FactoryUtil.py index 39e305f..5b623f1 100644 --- a/toontown/coghq/FactoryUtil.py +++ b/toontown/coghq/FactoryUtil.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.showbase import DirectObject from direct.interval.IntervalGlobal import * from toontown.toonbase import ToontownGlobals -import MovingPlatform +from . import MovingPlatform from direct.task.Task import Task from toontown.suit import Suit from toontown.suit import SuitDNA diff --git a/toontown/coghq/GearEntity.py b/toontown/coghq/GearEntity.py index 126f435..a114821 100644 --- a/toontown/coghq/GearEntity.py +++ b/toontown/coghq/GearEntity.py @@ -1,6 +1,6 @@ from direct.interval.IntervalGlobal import * from otp.level import BasicEntities -import MovingPlatform +from . import MovingPlatform from pandac.PandaModules import Vec3 class GearEntity(BasicEntities.NodePathEntity): diff --git a/toontown/coghq/InGameEditor.py b/toontown/coghq/InGameEditor.py index dd96eb0..936437e 100644 --- a/toontown/coghq/InGameEditor.py +++ b/toontown/coghq/InGameEditor.py @@ -3,12 +3,12 @@ from direct.tkwidgets.AppShell import * from direct.showbase.TkGlobal import * from direct.tkwidgets.Tree import * from direct.tkwidgets import Slider, Floater -from tkSimpleDialog import askstring -from tkMessageBox import showwarning, askyesno -from Tkinter import * +from tkinter.simpledialog import askstring +from tkinter.messagebox import showwarning, askyesno +from tkinter import * from direct.showbase.PythonUtil import Functor, list2dict from direct.gui.DirectGui import DGG -import tkFileDialog +import tkinter.filedialog from direct.showbase import DirectObject import math import operator @@ -89,7 +89,7 @@ class InGameEditor(AppShell): menuBar.addmenuitem('Entity', 'separator') permanentTypes = self.level.entTypeReg.getPermanentTypeNames() entTypes = list(self.level.entTypes) - map(entTypes.remove, permanentTypes) + list(map(entTypes.remove, permanentTypes)) entTypes.sort() numEntities = len(entTypes) cascadeMenu = '' @@ -359,7 +359,7 @@ class InGameEditor(AppShell): attribDesc = typeDesc.getAttribDescDict()[attribName] attributeValue = attribDesc.getDefaultValue() valueDict = params.get('valueDict', {}) - for key, value in valueDict.items(): + for key, value in list(valueDict.items()): if value == attributeValue: attributeValue = key break @@ -375,10 +375,10 @@ class InGameEditor(AppShell): label = Label(frame, text=attribName, width=15, anchor=W, justify=LEFT) label.pack(side=LEFT, expand=0) for choice in params.get('choiceSet', []): - if type(choice) is types.StringType: + if type(choice) is bytes: choiceStr = choice else: - choiceStr = `choice` + choiceStr = repr(choice) if choiceStr not in valueDict: valueDict[choiceStr] = choice choiceButton = Radiobutton(frame, text=choiceStr, value=choiceStr, variable=radioVar, command=radioCommand) @@ -388,7 +388,7 @@ class InGameEditor(AppShell): self.attribWidgets.append(frame) def setRadioVar(attributeValue): - for key, value in valueDict.items(): + for key, value in list(valueDict.items()): if value == attributeValue: attributeValue = key break @@ -414,22 +414,22 @@ class InGameEditor(AppShell): def cbCommand(var, trueValue = trueValue): vd = self.cbDict[attribName] - print vd + print(vd) if var.get(): - print 'got it', trueValue, vd + print('got it', trueValue, vd) vd[trueValue] = 1 else: - print 'not it', trueValue, vd + print('not it', trueValue, vd) if trueValue in vd: del vd[trueValue] - value = vd.keys() - print 'SENDING', value + value = list(vd.keys()) + print('SENDING', value) self.level.setAttribEdit(entId, attribName, value) - if type(choice) is types.StringType: + if type(choice) is bytes: labelStr = choice else: - labelStr = `choice` + labelStr = repr(choice) func = Functor(cbCommand, cbVar) choiceButton = Checkbutton(frame, text=labelStr, variable=cbVar, command=lambda : func()) choiceButton.pack(side=LEFT, expand=0) @@ -439,8 +439,8 @@ class InGameEditor(AppShell): self.attribWidgets.append(frame) def setCheckbuttonVar(attributeValueList): - print 'COMING BACK', attributeValueList - for attributeValue, cb in checkbuttonDict.items(): + print('COMING BACK', attributeValueList) + for attributeValue, cb in list(checkbuttonDict.items()): if attributeValue in attributeValueList: cb.set(1) else: @@ -546,7 +546,7 @@ class InGameEditor(AppShell): initialDir = Filename.expandFrom('$TTMODELS/built/').toOsSpecific() else: initialDir = Filename.expandFrom('$TTMODELS/built/%s' % text.get()[1:-1]).toOsSpecific() - print text, text.get()[1:-1], initialDir + print(text, text.get()[1:-1], initialDir) rawFilename = askopenfilename(defaultextension='*', initialdir=initialDir, filetypes=(('Bam Files', '*.bam'), ('Egg Files', '*.egg'), ('Maya Binaries', '*.mb'), @@ -554,7 +554,7 @@ class InGameEditor(AppShell): if rawFilename != '': filename = Filename.fromOsSpecific(rawFilename) filename.findOnSearchpath(getModelPath().getValue()) - text.set("'%s'" % `filename`) + text.set("'%s'" % repr(filename)) handleReturn(None) return @@ -661,10 +661,10 @@ class InGameEditor(AppShell): idDict[eType] = self.level.entType2ids.get(eType, []) else: - for eType in self.level.entType2ids.keys(): + for eType in list(self.level.entType2ids.keys()): idDict[eType] = self.level.entType2ids.get(eType, []) - typeKeys = idDict.keys() + typeKeys = list(idDict.keys()) typeKeys.sort() def getChildEntIds(entity): @@ -791,7 +791,7 @@ class InGameEditor(AppShell): self.ignore('DIRECT_manipulateObjectCleanup') self.ignore('DIRECT_undo') self.ignore('DIRECT_redo') - print 'InGameEditor.onDestroy()' + print('InGameEditor.onDestroy()') if self.visZonesEditor: self.visZonesEditor.destroy() self.explorer._node.destroy() @@ -802,7 +802,7 @@ class InGameEditor(AppShell): messenger.send(self.requestSaveEvent) def handleSaveAs(self): - filename = tkFileDialog.asksaveasfilename(parent=self.parent, defaultextension='.py', filetypes=[('Python Source Files', '.py'), ('All Files', '*')]) + filename = tkinter.filedialog.asksaveasfilename(parent=self.parent, defaultextension='.py', filetypes=[('Python Source Files', '.py'), ('All Files', '*')]) if len(filename) > 0: messenger.send(self.saveAsEvent, [filename]) diff --git a/toontown/coghq/InGameEditorDCImports.py b/toontown/coghq/InGameEditorDCImports.py index fd5f750..86b4eb3 100644 --- a/toontown/coghq/InGameEditorDCImports.py +++ b/toontown/coghq/InGameEditorDCImports.py @@ -1,3 +1,3 @@ if __dev__: from direct.directutil import DistributedLargeBlobSender - import DistributedInGameEditor + from . import DistributedInGameEditor diff --git a/toontown/coghq/InGameEditorDCImportsAI.py b/toontown/coghq/InGameEditorDCImportsAI.py index 9ce0941..6368bcf 100644 --- a/toontown/coghq/InGameEditorDCImportsAI.py +++ b/toontown/coghq/InGameEditorDCImportsAI.py @@ -1,3 +1,3 @@ if __dev__: from direct.directutil import DistributedLargeBlobSenderAI - import DistributedInGameEditorAI + from . import DistributedInGameEditorAI diff --git a/toontown/coghq/LawOfficeBase.py b/toontown/coghq/LawOfficeBase.py index 9252a00..6ec851c 100644 --- a/toontown/coghq/LawOfficeBase.py +++ b/toontown/coghq/LawOfficeBase.py @@ -1,4 +1,4 @@ -import FactorySpecs +from . import FactorySpecs from otp.level import LevelSpec from toontown.toonbase import ToontownGlobals @@ -21,7 +21,7 @@ class LawOfficeBase: if __dev__: def getEntityTypeReg(self): - import FactoryEntityTypes + from . import FactoryEntityTypes from otp.level import EntityTypeRegistry typeReg = EntityTypeRegistry.EntityTypeRegistry(FactoryEntityTypes) return typeReg diff --git a/toontown/coghq/LawOfficeLayout.py b/toontown/coghq/LawOfficeLayout.py index 46a10da..98d5ab5 100644 --- a/toontown/coghq/LawOfficeLayout.py +++ b/toontown/coghq/LawOfficeLayout.py @@ -11,8 +11,8 @@ Index2Spec = { 0: 'LawOffice_Spec_Tier0_a', 1: 'LawOffice_Spec_Tier0_b'} LawbotFloorSpecs = {} -for (floorIndex, floorSpec) in Index2Spec.items(): - exec 'from toontown.coghq import %s' % floorSpec +for (floorIndex, floorSpec) in list(Index2Spec.items()): + exec('from toontown.coghq import %s' % floorSpec) LawbotFloorSpecs[floorIndex] = eval(floorSpec) diff --git a/toontown/coghq/LawOfficeManagerAI.py b/toontown/coghq/LawOfficeManagerAI.py index eff2e82..1aa4b62 100644 --- a/toontown/coghq/LawOfficeManagerAI.py +++ b/toontown/coghq/LawOfficeManagerAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import DistributedLawOfficeAI, DistributedStageAI +from . import DistributedLawOfficeAI, DistributedStageAI from toontown.coghq import StageLayout from toontown.toonbase import ToontownGlobals from direct.showbase import DirectObject @@ -29,7 +29,7 @@ class LawOfficeManagerAI(DirectObject.DirectObject): if bboard.has('stageRoom-%s' % avId): roomId = bboard.get('stageRoom-%s' % avId) for lt in StageId2Layouts[StageId]: - for i in xrange(StageLayout.getNumFloors(lt)): + for i in range(StageLayout.getNumFloors(lt)): layout = StageLayout.StageLayout(StageId, i, stageLayout=lt) if roomId in layout.getRoomIds(): layoutIndex = lt diff --git a/toontown/coghq/LawbotCogHQLoader.py b/toontown/coghq/LawbotCogHQLoader.py index b5f01b9..38f8b51 100644 --- a/toontown/coghq/LawbotCogHQLoader.py +++ b/toontown/coghq/LawbotCogHQLoader.py @@ -1,15 +1,15 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData -import CogHQLoader +from . import CogHQLoader from toontown.toonbase import ToontownGlobals from direct.gui import DirectGui from toontown.toonbase import TTLocalizer from toontown.toon import Toon from direct.fsm import State -import StageInterior -import LawbotHQExterior -import LawbotHQBossBattle -import LawbotOfficeExterior +from . import StageInterior +from . import LawbotHQExterior +from . import LawbotHQBossBattle +from . import LawbotOfficeExterior aspectSF = 0.7227 class LawbotCogHQLoader(CogHQLoader.CogHQLoader): diff --git a/toontown/coghq/LawbotLegFactoryCogs.py b/toontown/coghq/LawbotLegFactoryCogs.py index eadb991..0209c75 100644 --- a/toontown/coghq/LawbotLegFactoryCogs.py +++ b/toontown/coghq/LawbotLegFactoryCogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * LobbyParent = 10014 LobbyCell = 0 BattleCells = {} diff --git a/toontown/coghq/LawbotOfficeBoilerRoom_Battle00_Cogs.py b/toontown/coghq/LawbotOfficeBoilerRoom_Battle00_Cogs.py index 991eeca..1147ac8 100644 --- a/toontown/coghq/LawbotOfficeBoilerRoom_Battle00_Cogs.py +++ b/toontown/coghq/LawbotOfficeBoilerRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 LowerCogParent = 10003 diff --git a/toontown/coghq/LawbotOfficeBoilerRoom_Trap00_Cogs.py b/toontown/coghq/LawbotOfficeBoilerRoom_Trap00_Cogs.py index 384552a..1de51bb 100644 --- a/toontown/coghq/LawbotOfficeBoilerRoom_Trap00_Cogs.py +++ b/toontown/coghq/LawbotOfficeBoilerRoom_Trap00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 100001 BattleCellId = 0 diff --git a/toontown/coghq/LawbotOfficeDiamondRoom_Battle00_Cogs.py b/toontown/coghq/LawbotOfficeDiamondRoom_Battle00_Cogs.py index c10ac73..c38a073 100644 --- a/toontown/coghq/LawbotOfficeDiamondRoom_Battle00_Cogs.py +++ b/toontown/coghq/LawbotOfficeDiamondRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattlePlace1 = 10000 diff --git a/toontown/coghq/LawbotOfficeDiamondRoom_Trap00_Cogs.py b/toontown/coghq/LawbotOfficeDiamondRoom_Trap00_Cogs.py index 177b36a..3c77d50 100644 --- a/toontown/coghq/LawbotOfficeDiamondRoom_Trap00_Cogs.py +++ b/toontown/coghq/LawbotOfficeDiamondRoom_Trap00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 100007 CogParent1 = 100009 diff --git a/toontown/coghq/LawbotOfficeExterior.py b/toontown/coghq/LawbotOfficeExterior.py index 75ebc31..0ec31eb 100644 --- a/toontown/coghq/LawbotOfficeExterior.py +++ b/toontown/coghq/LawbotOfficeExterior.py @@ -4,7 +4,7 @@ from direct.fsm import State from toontown.toonbase import ToontownGlobals from toontown.building import Elevator from pandac.PandaModules import * -import FactoryExterior +from . import FactoryExterior class LawbotOfficeExterior(FactoryExterior.FactoryExterior): notify = DirectNotifyGlobal.directNotify.newCategory('LawbotOfficeExterior') diff --git a/toontown/coghq/LawbotOfficeGearRoom_Battle00_Cogs.py b/toontown/coghq/LawbotOfficeGearRoom_Battle00_Cogs.py index c10ac73..c38a073 100644 --- a/toontown/coghq/LawbotOfficeGearRoom_Battle00_Cogs.py +++ b/toontown/coghq/LawbotOfficeGearRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattlePlace1 = 10000 diff --git a/toontown/coghq/LawbotOfficeLobby_Trap00_Cogs.py b/toontown/coghq/LawbotOfficeLobby_Trap00_Cogs.py index 157e76f..94f6b27 100644 --- a/toontown/coghq/LawbotOfficeLobby_Trap00_Cogs.py +++ b/toontown/coghq/LawbotOfficeLobby_Trap00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 CogParent1 = 100021 diff --git a/toontown/coghq/LawbotOfficeOilRoom_Battle00_Cogs.py b/toontown/coghq/LawbotOfficeOilRoom_Battle00_Cogs.py index ceb3cfc..95379bc 100644 --- a/toontown/coghq/LawbotOfficeOilRoom_Battle00_Cogs.py +++ b/toontown/coghq/LawbotOfficeOilRoom_Battle00_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/LawbotOfficeOilRoom_Battle01_Cogs.py b/toontown/coghq/LawbotOfficeOilRoom_Battle01_Cogs.py index 61883ec..b63aece 100644 --- a/toontown/coghq/LawbotOfficeOilRoom_Battle01_Cogs.py +++ b/toontown/coghq/LawbotOfficeOilRoom_Battle01_Cogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * from toontown.toonbase import ToontownGlobals CogParent = 10000 BattleCellId = 0 diff --git a/toontown/coghq/LevelBattleManagerAI.py b/toontown/coghq/LevelBattleManagerAI.py index b3a2b69..7f84ab8 100644 --- a/toontown/coghq/LevelBattleManagerAI.py +++ b/toontown/coghq/LevelBattleManagerAI.py @@ -16,11 +16,11 @@ class LevelBattleManagerAI(BattleManagerAI.BattleManagerAI): return def destroyBattleMgr(self): - battles = self.cellId2battle.values() + battles = list(self.cellId2battle.values()) for battle in battles: self.destroy(battle) - for cellId, battleBlocker in self.battleBlockers.items(): + for cellId, battleBlocker in list(self.battleBlockers.items()): if battleBlocker is not None: battleBlocker.deactivate() diff --git a/toontown/coghq/LevelSuitPlannerAI.py b/toontown/coghq/LevelSuitPlannerAI.py index 651ad6b..974b46f 100644 --- a/toontown/coghq/LevelSuitPlannerAI.py +++ b/toontown/coghq/LevelSuitPlannerAI.py @@ -20,7 +20,7 @@ class LevelSuitPlannerAI(DirectObject.DirectObject): self.__genSuitInfos(self.level.getCogLevel(), self.level.getCogTrack()) self.battleMgr = LevelBattleManagerAI.LevelBattleManagerAI(self.air, self.level, battleCtor, battleExpAggreg) self.battleCellId2suits = {} - for id in self.battleCellSpecs.keys(): + for id in list(self.battleCellSpecs.keys()): self.battleCellId2suits[id] = [] def destroy(self): @@ -195,7 +195,7 @@ class LevelSuitPlannerAI(DirectObject.DirectObject): if oldCell in self.battleCellId2suits: self.battleCellId2suits[oldCell].remove(suit) else: - self.notify.warning('FIXME crash bandaid suitBattleCellChange suit.doId =%s, oldCell=%s not in battleCellId2Suits.keys %s' % (suit.doId, oldCell, self.battleCellId2suits.keys())) + self.notify.warning('FIXME crash bandaid suitBattleCellChange suit.doId =%s, oldCell=%s not in battleCellId2Suits.keys %s' % (suit.doId, oldCell, list(self.battleCellId2suits.keys()))) blocker = self.battleMgr.battleBlockers.get(oldCell) if blocker: blocker.removeSuit(suit) diff --git a/toontown/coghq/MintLayout.py b/toontown/coghq/MintLayout.py index 32a3f67..01bf864 100644 --- a/toontown/coghq/MintLayout.py +++ b/toontown/coghq/MintLayout.py @@ -6,33 +6,33 @@ from direct.showbase.PythonUtil import normalDistrib, lerp import random def printAllCashbotInfo(): - print 'roomId: roomName' - for roomId, roomName in MintRoomSpecs.CashbotMintRoomId2RoomName.items(): - print '%s: %s' % (roomId, roomName) + print('roomId: roomName') + for roomId, roomName in list(MintRoomSpecs.CashbotMintRoomId2RoomName.items()): + print('%s: %s' % (roomId, roomName)) - print '\nroomId: numBattles' - for roomId, numBattles in MintRoomSpecs.roomId2numBattles.items(): - print '%s: %s' % (roomId, numBattles) + print('\nroomId: numBattles') + for roomId, numBattles in list(MintRoomSpecs.roomId2numBattles.items()): + print('%s: %s' % (roomId, numBattles)) - print '\nmintId floor roomIds' + print('\nmintId floor roomIds') printMintRoomIds() - print '\nmintId floor numRooms' + print('\nmintId floor numRooms') printNumRooms() - print '\nmintId floor numForcedBattles' + print('\nmintId floor numForcedBattles') printNumBattles() def iterateCashbotMints(func): from toontown.toonbase import ToontownGlobals for mintId in [ToontownGlobals.CashbotMintIntA, ToontownGlobals.CashbotMintIntB, ToontownGlobals.CashbotMintIntC]: - for floorNum in xrange(ToontownGlobals.MintNumFloors[mintId]): + for floorNum in range(ToontownGlobals.MintNumFloors[mintId]): func(MintLayout(mintId, floorNum)) def printMintInfo(): def func(ml): - print ml + print(ml) iterateCashbotMints(func) @@ -40,7 +40,7 @@ def printMintInfo(): def printMintRoomIds(): def func(ml): - print ml.getMintId(), ml.getFloorNum(), ml.getRoomIds() + print(ml.getMintId(), ml.getFloorNum(), ml.getRoomIds()) iterateCashbotMints(func) @@ -48,7 +48,7 @@ def printMintRoomIds(): def printMintRoomNames(): def func(ml): - print ml.getMintId(), ml.getFloorNum(), ml.getRoomNames() + print(ml.getMintId(), ml.getFloorNum(), ml.getRoomNames()) iterateCashbotMints(func) @@ -56,7 +56,7 @@ def printMintRoomNames(): def printNumRooms(): def func(ml): - print ml.getMintId(), ml.getFloorNum(), ml.getNumRooms() + print(ml.getMintId(), ml.getFloorNum(), ml.getNumRooms()) iterateCashbotMints(func) @@ -64,7 +64,7 @@ def printNumRooms(): def printNumBattles(): def func(ml): - print ml.getMintId(), ml.getFloorNum(), ml.getNumBattles() + print(ml.getMintId(), ml.getFloorNum(), ml.getNumBattles()) iterateCashbotMints(func) @@ -723,7 +723,7 @@ class MintLayout: self.roomIds = self._genFloorLayout() hallwayRng = self.getRng() connectorRoomNames = MintRoomSpecs.CashbotMintConnectorRooms - for i in xrange(self.numHallways): + for i in range(self.numHallways): self.hallways.append(hallwayRng.choice(connectorRoomNames)) def _genFloorLayout(self): @@ -743,7 +743,7 @@ class MintLayout: numBattles2middleRoomIds = invertDictLossless(MintRoomSpecs.middleRoomId2numBattles) allBattleRooms = [] - for num, roomIds in numBattles2middleRoomIds.items(): + for num, roomIds in list(numBattles2middleRoomIds.items()): if num > 0: allBattleRooms.extend(roomIds) while 1: @@ -761,7 +761,7 @@ class MintLayout: if middleRoomsLeft > 0: actionRoomIds = numBattles2middleRoomIds[0] - for i in xrange(middleRoomsLeft): + for i in range(middleRoomsLeft): roomId = rng.choice(actionRoomIds) actionRoomIds.remove(roomId) middleRoomIds.append(roomId) diff --git a/toontown/coghq/MintManagerAI.py b/toontown/coghq/MintManagerAI.py index 3b5fcbd..7e51b7f 100644 --- a/toontown/coghq/MintManagerAI.py +++ b/toontown/coghq/MintManagerAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import DistributedMintAI +from . import DistributedMintAI from toontown.toonbase import ToontownGlobals from toontown.coghq import MintLayout from direct.showbase import DirectObject @@ -34,7 +34,7 @@ class MintManagerAI(DirectObject.DirectObject): for avId in players: if bboard.has('mintRoom-%s' % avId): roomId = bboard.get('mintRoom-%s' % avId) - for i in xrange(numFloors): + for i in range(numFloors): layout = MintLayout.MintLayout(mintId, i) if roomId in layout.getRoomIds(): floor = i diff --git a/toontown/coghq/MintRoomBase.py b/toontown/coghq/MintRoomBase.py index 9cc523a..2742852 100644 --- a/toontown/coghq/MintRoomBase.py +++ b/toontown/coghq/MintRoomBase.py @@ -18,7 +18,7 @@ class MintRoomBase: if __dev__: def getEntityTypeReg(self): - import FactoryEntityTypes + from . import FactoryEntityTypes from otp.level import EntityTypeRegistry typeReg = EntityTypeRegistry.EntityTypeRegistry(FactoryEntityTypes) return typeReg diff --git a/toontown/coghq/MintRoomSpecs.py b/toontown/coghq/MintRoomSpecs.py index 431ee8d..c917ddf 100644 --- a/toontown/coghq/MintRoomSpecs.py +++ b/toontown/coghq/MintRoomSpecs.py @@ -63,10 +63,10 @@ CashbotMintFinalRoomIDs = (17, 18, 19, 20, 21, 22, 23, 24, 25) CashbotMintConnectorRooms = ('phase_10/models/cashbotHQ/connector_7cubeL2', 'phase_10/models/cashbotHQ/connector_7cubeR2') CashbotMintSpecModules = {} if not isClient(): - print 'EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId + print('EXECWARNING MintRoomSpecs: %s' % CashbotMintRoomName2RoomId) printStack() -for roomName, roomId in CashbotMintRoomName2RoomId.items(): - exec 'from toontown.coghq import %s' % roomName +for roomName, roomId in list(CashbotMintRoomName2RoomId.items()): + exec('from toontown.coghq import %s' % roomName) CashbotMintSpecModules[roomId] = eval(roomName) CogSpecModules = {'CashbotMintBoilerRoom_Battle00': CashbotMintBoilerRoom_Battle00_Cogs, @@ -85,7 +85,7 @@ CogSpecModules = {'CashbotMintBoilerRoom_Battle00': CashbotMintBoilerRoom_Battle 'CashbotMintPipeRoom_Battle00': CashbotMintPipeRoom_Battle00_Cogs, 'CashbotMintPipeRoom_Battle01': CashbotMintPipeRoom_Battle01_Cogs} roomId2numBattles = {} -for roomName, roomId in CashbotMintRoomName2RoomId.items(): +for roomName, roomId in list(CashbotMintRoomName2RoomId.items()): if roomName not in CogSpecModules: roomId2numBattles[roomId] = 0 else: diff --git a/toontown/coghq/MoleFieldBase.py b/toontown/coghq/MoleFieldBase.py index 275e09b..3bb2d52 100644 --- a/toontown/coghq/MoleFieldBase.py +++ b/toontown/coghq/MoleFieldBase.py @@ -31,7 +31,7 @@ class MoleFieldBase: curTimeBetweenPopup = self.TimeBetweenPopupMax curStayUpTime = self.StayUpTimeMax curTime = 3 - eligibleMoles = range(self.numMoles) + eligibleMoles = list(range(self.numMoles)) self.getRng().shuffle(eligibleMoles) usedMoles = [] self.notify.debug('eligibleMoles=%s' % eligibleMoles) diff --git a/toontown/coghq/MovingPlatform.py b/toontown/coghq/MovingPlatform.py index 936181f..2e7585a 100644 --- a/toontown/coghq/MovingPlatform.py +++ b/toontown/coghq/MovingPlatform.py @@ -16,7 +16,7 @@ class MovingPlatform(DirectObject.DirectObject, NodePath): def setupCopyModel(self, parentToken, model, floorNodeName = None, parentingNode = None): if floorNodeName is None: floorNodeName = 'floor' - if type(parentToken) == types.IntType: + if type(parentToken) == int: parentToken = ToontownGlobals.SPDynamic + parentToken self.parentToken = parentToken self.name = 'MovingPlatform-%s' % parentToken diff --git a/toontown/coghq/NullCogs.py b/toontown/coghq/NullCogs.py index 78bd47e..aee992c 100644 --- a/toontown/coghq/NullCogs.py +++ b/toontown/coghq/NullCogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * BattleCells = {} CogData = [] ReserveCogData = [] diff --git a/toontown/coghq/PaintMixer.py b/toontown/coghq/PaintMixer.py index 1bd9357..dc2e5dd 100644 --- a/toontown/coghq/PaintMixer.py +++ b/toontown/coghq/PaintMixer.py @@ -1,4 +1,4 @@ -import PlatformEntity +from . import PlatformEntity class PaintMixer(PlatformEntity.PlatformEntity): diff --git a/toontown/coghq/PlatformEntity.py b/toontown/coghq/PlatformEntity.py index 87a1ef8..df8aaea 100644 --- a/toontown/coghq/PlatformEntity.py +++ b/toontown/coghq/PlatformEntity.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from otp.level import BasicEntities -import MovingPlatform +from . import MovingPlatform class PlatformEntity(BasicEntities.NodePathEntity): diff --git a/toontown/coghq/PromotionManagerAI.py b/toontown/coghq/PromotionManagerAI.py index 4bc4c67..de61c9c 100644 --- a/toontown/coghq/PromotionManagerAI.py +++ b/toontown/coghq/PromotionManagerAI.py @@ -2,8 +2,9 @@ from otp.ai.AIBaseGlobal import * from direct.directnotify import DirectNotifyGlobal import random from toontown.suit import SuitDNA -import CogDisguiseGlobals +from . import CogDisguiseGlobals from toontown.toonbase.ToontownBattleGlobals import getInvasionMultiplier +from functools import reduce MeritMultiplier = 0.5 class PromotionManagerAI: diff --git a/toontown/coghq/SellbotCogHQLoader.py b/toontown/coghq/SellbotCogHQLoader.py index 8b43c90..96bcb55 100644 --- a/toontown/coghq/SellbotCogHQLoader.py +++ b/toontown/coghq/SellbotCogHQLoader.py @@ -1,15 +1,15 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData -import CogHQLoader +from . import CogHQLoader from toontown.toonbase import ToontownGlobals from direct.gui import DirectGui from toontown.toonbase import TTLocalizer from toontown.toon import Toon from direct.fsm import State -import FactoryExterior -import FactoryInterior -import SellbotHQExterior -import SellbotHQBossBattle +from . import FactoryExterior +from . import FactoryInterior +from . import SellbotHQExterior +from . import SellbotHQBossBattle from pandac.PandaModules import DecalEffect aspectSF = 0.7227 diff --git a/toontown/coghq/SellbotLegFactoryCogs.py b/toontown/coghq/SellbotLegFactoryCogs.py index 4089e00..6637acb 100644 --- a/toontown/coghq/SellbotLegFactoryCogs.py +++ b/toontown/coghq/SellbotLegFactoryCogs.py @@ -1,4 +1,4 @@ -from SpecImports import * +from .SpecImports import * LobbyParent = 10014 BoilerParent = 10030 PipeLeftParent = 10023 diff --git a/toontown/coghq/StageLayout.py b/toontown/coghq/StageLayout.py index 23c0e79..b057dcb 100644 --- a/toontown/coghq/StageLayout.py +++ b/toontown/coghq/StageLayout.py @@ -6,33 +6,33 @@ from direct.showbase.PythonUtil import normalDistrib, lerp import random def printAllCashbotInfo(): - print 'roomId: roomName' - for roomId, roomName in StageRoomSpecs.CashbotStageRoomId2RoomName.items(): - print '%s: %s' % (roomId, roomName) + print('roomId: roomName') + for roomId, roomName in list(StageRoomSpecs.CashbotStageRoomId2RoomName.items()): + print('%s: %s' % (roomId, roomName)) - print '\nroomId: numBattles' - for roomId, numBattles in StageRoomSpecs.roomId2numBattles.items(): - print '%s: %s' % (roomId, numBattles) + print('\nroomId: numBattles') + for roomId, numBattles in list(StageRoomSpecs.roomId2numBattles.items()): + print('%s: %s' % (roomId, numBattles)) - print '\nstageId floor roomIds' + print('\nstageId floor roomIds') printStageRoomIds() - print '\nstageId floor numRooms' + print('\nstageId floor numRooms') printNumRooms() - print '\nstageId floor numForcedBattles' + print('\nstageId floor numForcedBattles') printNumBattles() def iterateLawbotStages(func): from toontown.toonbase import ToontownGlobals - for layoutId in xrange(len(stageLayouts)): - for floorNum in xrange(getNumFloors(layoutId)): + for layoutId in range(len(stageLayouts)): + for floorNum in range(getNumFloors(layoutId)): func(StageLayout(0, floorNum, layoutId)) def printStageInfo(): def func(sl): - print sl + print(sl) iterateLawbotStages(func) @@ -46,26 +46,26 @@ def printRoomUsage(): usage[roomId] += 1 iterateLawbotStages(func) - roomIds = usage.keys() + roomIds = list(usage.keys()) roomIds.sort() for roomId in roomIds: - print '%s: %s' % (roomId, usage[roomId]) + print('%s: %s' % (roomId, usage[roomId])) def printRoomInfo(): - roomIds = StageRoomSpecs.roomId2numCogs.keys() + roomIds = list(StageRoomSpecs.roomId2numCogs.keys()) roomIds.sort() for roomId in roomIds: - print 'room %s: %s cogs, %s cogLevels, %s merit cogLevels' % (roomId, + print('room %s: %s cogs, %s cogLevels, %s merit cogLevels' % (roomId, StageRoomSpecs.roomId2numCogs[roomId], StageRoomSpecs.roomId2numCogLevels[roomId], - StageRoomSpecs.roomId2numMeritCogLevels[roomId]) + StageRoomSpecs.roomId2numMeritCogLevels[roomId])) def printStageRoomIds(): def func(ml): - print ml.getStageId(), ml.getFloorNum(), ml.getRoomIds() + print(ml.getStageId(), ml.getFloorNum(), ml.getRoomIds()) iterateCashbotStages(func) @@ -73,7 +73,7 @@ def printStageRoomIds(): def printStageRoomNames(): def func(ml): - print ml.getStageId(), ml.getFloorNum(), ml.getRoomNames() + print(ml.getStageId(), ml.getFloorNum(), ml.getRoomNames()) iterateCashbotStages(func) @@ -81,7 +81,7 @@ def printStageRoomNames(): def printNumRooms(): def func(ml): - print ml.getStageId(), ml.getFloorNum(), ml.getNumRooms() + print(ml.getStageId(), ml.getFloorNum(), ml.getNumRooms()) iterateCashbotStages(func) @@ -89,7 +89,7 @@ def printNumRooms(): def printNumBattles(): def func(ml): - print ml.getStageId(), ml.getFloorNum(), ml.getNumBattles() + print(ml.getStageId(), ml.getFloorNum(), ml.getNumBattles()) iterateCashbotStages(func) @@ -627,7 +627,7 @@ class StageLayout: self.numHallways = self.numRooms - 1 hallwayRng = self.getRng() connectorRoomNames = StageRoomSpecs.CashbotStageConnectorRooms - for i in xrange(self.numHallways): + for i in range(self.numHallways): self.hallways.append(hallwayRng.choice(connectorRoomNames)) def getNumRooms(self): diff --git a/toontown/coghq/StageManagerAI.py b/toontown/coghq/StageManagerAI.py index 666e201..57dfaae 100644 --- a/toontown/coghq/StageManagerAI.py +++ b/toontown/coghq/StageManagerAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import DistributedStageAI +from . import DistributedStageAI from toontown.toonbase import ToontownGlobals from toontown.coghq import StageLayout from direct.showbase import DirectObject @@ -34,7 +34,7 @@ class StageManagerAI(DirectObject.DirectObject): for avId in players: if bboard.has('stageRoom-%s' % avId): roomId = bboard.get('stageRoom-%s' % avId) - for i in xrange(numFloors): + for i in range(numFloors): layout = StageLayout.StageLayout(stageId, i) if roomId in layout.getRoomIds(): floor = i diff --git a/toontown/coghq/StageRoomBase.py b/toontown/coghq/StageRoomBase.py index e51923f..ded0973 100644 --- a/toontown/coghq/StageRoomBase.py +++ b/toontown/coghq/StageRoomBase.py @@ -18,7 +18,7 @@ class StageRoomBase: if __dev__: def getEntityTypeReg(self): - import FactoryEntityTypes + from . import FactoryEntityTypes from otp.level import EntityTypeRegistry typeReg = EntityTypeRegistry.EntityTypeRegistry(FactoryEntityTypes) return typeReg diff --git a/toontown/coghq/StageRoomSpecs.py b/toontown/coghq/StageRoomSpecs.py index 290f705..1be4686 100644 --- a/toontown/coghq/StageRoomSpecs.py +++ b/toontown/coghq/StageRoomSpecs.py @@ -49,10 +49,10 @@ CashbotStageFinalRoomIDs = (2,) CashbotStageConnectorRooms = ('phase_11/models/lawbotHQ/LB_connector_7cubeL2', 'phase_11/models/lawbotHQ/LB_connector_7cubeLR') CashbotStageSpecModules = {} if not isClient(): - print 'EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId + print('EXECWARNING StageRoomSpecs: %s' % CashbotStageRoomName2RoomId) printStack() -for roomName, roomId in CashbotStageRoomName2RoomId.items(): - exec 'from toontown.coghq import %s' % roomName +for roomName, roomId in list(CashbotStageRoomName2RoomId.items()): + exec('from toontown.coghq import %s' % roomName) CashbotStageSpecModules[roomId] = eval(roomName) CogSpecModules = {'LawbotOfficeOilRoom_Battle00': LawbotOfficeOilRoom_Battle00_Cogs, @@ -64,7 +64,7 @@ CogSpecModules = {'LawbotOfficeOilRoom_Battle00': LawbotOfficeOilRoom_Battle00_C 'LawbotOfficeDiamondRoom_Battle00': LawbotOfficeDiamondRoom_Battle00_Cogs, 'LawbotOfficeGearRoom_Battle00': LawbotOfficeGearRoom_Battle00_Cogs} roomId2numBattles = {} -for roomName, roomId in CashbotStageRoomName2RoomId.items(): +for roomName, roomId in list(CashbotStageRoomName2RoomId.items()): if roomName not in CogSpecModules: roomId2numBattles[roomId] = 0 else: @@ -72,7 +72,7 @@ for roomName, roomId in CashbotStageRoomName2RoomId.items(): roomId2numBattles[roomId] = len(cogSpecModule.BattleCells) roomId2numCogs = {} -for roomName, roomId in CashbotStageRoomName2RoomId.items(): +for roomName, roomId in list(CashbotStageRoomName2RoomId.items()): if roomName not in CogSpecModules: roomId2numCogs[roomId] = 0 else: @@ -80,7 +80,7 @@ for roomName, roomId in CashbotStageRoomName2RoomId.items(): roomId2numCogs[roomId] = len(cogSpecModule.CogData) roomId2numCogLevels = {} -for roomName, roomId in CashbotStageRoomName2RoomId.items(): +for roomName, roomId in list(CashbotStageRoomName2RoomId.items()): if roomName not in CogSpecModules: roomId2numCogLevels[roomId] = 0 else: @@ -92,7 +92,7 @@ for roomName, roomId in CashbotStageRoomName2RoomId.items(): roomId2numCogLevels[roomId] = levels roomId2numMeritCogLevels = {} -for roomName, roomId in CashbotStageRoomName2RoomId.items(): +for roomName, roomId in list(CashbotStageRoomName2RoomId.items()): if roomName not in CogSpecModules or roomId in (8, 10): roomId2numMeritCogLevels[roomId] = 0 else: diff --git a/toontown/distributed/DelayDeletable.py b/toontown/distributed/DelayDeletable.py index 5b3782f..b4aca0e 100644 --- a/toontown/distributed/DelayDeletable.py +++ b/toontown/distributed/DelayDeletable.py @@ -13,7 +13,7 @@ class DelayDeletable: self.notify.error('cannot acquire DelayDelete "%s" on %s because it is in state %s' % (name, self.__class__.__name__, ESNum2Str[self.activeState])) if self.getDelayDeleteCount() == 0: self.cr._addDelayDeletedDO(self) - token = DelayDeletable.DelayDeleteSerialGen.next() + token = next(DelayDeletable.DelayDeleteSerialGen) self._token2delayDeleteName[token] = name return token @@ -25,7 +25,7 @@ class DelayDeletable: self.disableAnnounceAndDelete() def getDelayDeleteNames(self): - return self._token2delayDeleteName.values() + return list(self._token2delayDeleteName.values()) def forceAllowDelayDelete(self): self._delayDeleteForceAllow = True diff --git a/toontown/distributed/DistributedTimer.py b/toontown/distributed/DistributedTimer.py index bc39268..22187e2 100644 --- a/toontown/distributed/DistributedTimer.py +++ b/toontown/distributed/DistributedTimer.py @@ -22,7 +22,7 @@ class DistributedTimer(DistributedObject.DistributedObject): def setStartTime(self, time): self.startTime = time - print 'TIMER startTime %s' % time + print('TIMER startTime %s' % time) def getStartTime(self): return self.startTime diff --git a/toontown/distributed/HoodMgr.py b/toontown/distributed/HoodMgr.py index 6eeadec..985a14d 100644 --- a/toontown/distributed/HoodMgr.py +++ b/toontown/distributed/HoodMgr.py @@ -834,7 +834,7 @@ class HoodMgr(DirectObject.DirectObject): def getZonesInPhase(self, phase): p = [] - for i in ToontownGlobals.phaseMap.items(): + for i in list(ToontownGlobals.phaseMap.items()): if i[1] == phase: p.append(i[0]) diff --git a/toontown/distributed/NonRepeatableRandomSourceAI.py b/toontown/distributed/NonRepeatableRandomSourceAI.py index a3de26b..2f3655f 100644 --- a/toontown/distributed/NonRepeatableRandomSourceAI.py +++ b/toontown/distributed/NonRepeatableRandomSourceAI.py @@ -12,7 +12,7 @@ class NonRepeatableRandomSourceAI(DistributedObjectAI): def announceGenerate(self): DistributedObjectAI.announceGenerate(self) - self._contextGen = SerialMaskedGen((1L << 32) - 1) + self._contextGen = SerialMaskedGen((1 << 32) - 1) self._requests = {} self._sampleTask = self.doMethodLater(3 * 60, self._sampleRandomTask, self.uniqueName('sampleRandom')) self._sampleRandom() @@ -28,7 +28,7 @@ class NonRepeatableRandomSourceAI(DistributedObjectAI): return Task.again def _sampleRandom(self): - self.air.sendUpdateToDoId('NonRepeatableRandomSource', 'randomSample', OtpDoGlobals.OTP_DO_ID_TOONTOWN_NON_REPEATABLE_RANDOM_SOURCE, [self.doId, int(random.randrange(1L << 32))]) + self.air.sendUpdateToDoId('NonRepeatableRandomSource', 'randomSample', OtpDoGlobals.OTP_DO_ID_TOONTOWN_NON_REPEATABLE_RANDOM_SOURCE, [self.doId, int(random.randrange(1 << 32))]) def randomSampleAck(self): self._sampleRandom() @@ -36,7 +36,7 @@ class NonRepeatableRandomSourceAI(DistributedObjectAI): def getRandomSamples(self, callback, num = None): if num is None: num = 1 - context = self._contextGen.next() + context = next(self._contextGen) self._requests[context] = (callback,) self.air.sendUpdateToDoId('NonRepeatableRandomSource', 'getRandomSamples', OtpDoGlobals.OTP_DO_ID_TOONTOWN_NON_REPEATABLE_RANDOM_SOURCE, [self.doId, 'NonRepeatableRandomSource', diff --git a/toontown/distributed/NonRepeatableRandomSourceUD.py b/toontown/distributed/NonRepeatableRandomSourceUD.py index 1dc148d..2af96d7 100644 --- a/toontown/distributed/NonRepeatableRandomSourceUD.py +++ b/toontown/distributed/NonRepeatableRandomSourceUD.py @@ -44,8 +44,8 @@ class NonRepeatableRandomSourceUD(DistributedObjectGlobalUD): if needed > 0: numRandoms = min(needed, len(self._randoms)) if self._fakeIt: - for i in xrange(numRandoms): - request.randoms.append(random.random() * 4294967295L) + for i in range(numRandoms): + request.randoms.append(random.random() * 4294967295) else: request.randoms += self._randoms[:numRandoms] diff --git a/toontown/distributed/PlayGame.py b/toontown/distributed/PlayGame.py index 37a131f..3ec5141 100644 --- a/toontown/distributed/PlayGame.py +++ b/toontown/distributed/PlayGame.py @@ -6,7 +6,7 @@ from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task.Task import Task -from ToontownMsgTypes import * +from .ToontownMsgTypes import * from toontown.toonbase import ToontownGlobals from toontown.hood import TTHood from toontown.hood import DDHood diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index 6aa9ebc..db9434d 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -56,9 +56,9 @@ from toontown.distributed import ToontownDistrictStats from toontown.makeatoon import TTPickANamePattern from toontown.parties import ToontownTimeManager from toontown.toon import Toon, DistributedToon -from ToontownMsgTypes import * -import HoodMgr -import PlayGame +from .ToontownMsgTypes import * +from . import HoodMgr +from . import PlayGame from toontown.toontowngui import ToontownLoadingBlocker from toontown.hood import StreetSign @@ -139,11 +139,11 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): for torso in ToonDNA.toonTorsoTypes: for legs in ToonDNA.toonLegTypes: for gender in ('m', 'f'): - print 'species: %s, head: %s, torso: %s, legs: %s, gender: %s' % (species, + print('species: %s, head: %s, torso: %s, legs: %s, gender: %s' % (species, head, torso, legs, - gender) + gender)) dna = ToonDNA.ToonDNA() dna.newToon((head, torso, @@ -152,8 +152,8 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): toon = Toon.Toon() try: toon.setDNA(dna) - except Exception, e: - print e + except Exception as e: + print(e) return @@ -437,7 +437,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): def cancelAvatarDetailsRequest(self, avatar): avId = avatar.doId - if self.__queryAvatarMap.has_key(avId): + if avId in self.__queryAvatarMap: pad = self.__queryAvatarMap.pop(avId) pad.delayDelete.destroy() @@ -467,10 +467,10 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): dclass = self.dclassesByName[dclassName] pad.avatar.updateAllRequiredFields(dclass, di) gotData = 1 - if isinstance(pad.func, types.StringType): + if isinstance(pad.func, bytes): messenger.send(pad.func, list((gotData, pad.avatar) + pad.args)) else: - apply(pad.func, (gotData, pad.avatar) + pad.args) + pad.func(*(gotData, pad.avatar) + pad.args) pad.delayDelete.destroy() def enterPlayingGame(self, *args, **kArgs): @@ -680,12 +680,12 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): ignoredClasses = ('MagicWordManager', 'TimeManager', 'DistributedDistrict', 'FriendManager', 'NewsManager', 'ToontownMagicWordManager', 'WelcomeValleyManager', 'DistributedTrophyMgr', 'CatalogManager', 'DistributedBankMgr', 'EstateManager', 'RaceManager', 'SafeZoneManager', 'DeleteManager', 'TutorialManager', 'ToontownDistrict', 'DistributedDeliveryManager', 'DistributedPartyManager', 'AvatarFriendsManager', 'InGameNewsMgr', 'WhitelistMgr', 'TTCodeRedemptionMgr') messenger.send('clientCleanup') - for avId, pad in self.__queryAvatarMap.items(): + for avId, pad in list(self.__queryAvatarMap.items()): pad.delayDelete.destroy() self.__queryAvatarMap = {} delayDeleted = [] - doIds = self.doId2do.keys() + doIds = list(self.doId2do.keys()) for doId in doIds: obj = self.doId2do[doId] if isNotLive: @@ -715,7 +715,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.notify.error(s) if isNotLive: - self.notify.info('dumpAllSubShardObjects: doIds left: %s' % self.doId2do.keys()) + self.notify.info('dumpAllSubShardObjects: doIds left: %s' % list(self.doId2do.keys())) def _removeCurrentShardInterest(self, callback): if self.old_setzone_interest_handle is None: @@ -745,7 +745,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): return False def _wantShardListComplete(self): - print self.activeDistrictMap + print(self.activeDistrictMap) if self._shardsAreReady(): self.acceptOnce(ToontownDistrictStats.EventName(), self.shardDetailStatsComplete) ToontownDistrictStats.refresh() @@ -791,17 +791,17 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): return 0 def isFriendOnline(self, doId): - return self.friendsOnline.has_key(doId) + return doId in self.friendsOnline def addAvatarToFriendsList(self, avatar): self.friendsMap[avatar.doId] = avatar def identifyFriend(self, doId, source = None): - if self.friendsMap.has_key(doId): + if doId in self.friendsMap: teleportNotify.debug('friend %s in friendsMap' % doId) return self.friendsMap[doId] avatar = None - if self.doId2do.has_key(doId): + if doId in self.doId2do: teleportNotify.debug('found friend %s in doId2do' % doId) avatar = self.doId2do[doId] elif self.cache.contains(doId): @@ -834,7 +834,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): return base.cr.playerFriendsManager.getFriendInfo(pId) def identifyAvatar(self, doId): - if self.doId2do.has_key(doId): + if doId in self.doId2do: return self.doId2do[doId] else: return self.identifyFriend(doId) @@ -845,9 +845,9 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): return 0 if base.wantPets and base.localAvatar.hasPet(): - print str(self.friendsMap) - print str(self.friendsMap.has_key(base.localAvatar.getPetId())) - if self.friendsMap.has_key(base.localAvatar.getPetId()) == None: + print(str(self.friendsMap)) + print(str(base.localAvatar.getPetId() in self.friendsMap)) + if (base.localAvatar.getPetId() in self.friendsMap) == None: return 0 return 1 @@ -872,7 +872,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): def sendGetFriendsListRequest(self): if self.astronSupport: - print 'sendGetFriendsListRequest TODO' + print('sendGetFriendsListRequest TODO') else: self.friendsMapPending = 1 self.friendsListError = 0 @@ -881,20 +881,20 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.send(datagram) def cleanPetsFromFriendsMap(self): - for objId, obj in self.friendsMap.items(): + for objId, obj in list(self.friendsMap.items()): from toontown.pets import DistributedPet if isinstance(obj, DistributedPet.DistributedPet): - print 'Removing %s reference from the friendsMap' % obj.getName() + print('Removing %s reference from the friendsMap' % obj.getName()) del self.friendsMap[objId] def removePetFromFriendsMap(self): doId = base.localAvatar.getPetId() - if doId and self.friendsMap.has_key(doId): + if doId and doId in self.friendsMap: del self.friendsMap[doId] def addPetToFriendsMap(self, callback = None): doId = base.localAvatar.getPetId() - if not doId or self.friendsMap.has_key(doId): + if not doId or doId in self.friendsMap: if callback: callback() return @@ -927,9 +927,9 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): petId = di.getUint32() handle = FriendHandle.FriendHandle(doId, name, dna, petId) self.friendsMap[doId] = handle - if self.friendsOnline.has_key(doId): + if doId in self.friendsOnline: self.friendsOnline[doId] = handle - if self.friendPendingChatSettings.has_key(doId): + if doId in self.friendPendingChatSettings: self.notify.debug('calling setCommonAndWL %s' % str(self.friendPendingChatSettings[doId])) handle.setCommonAndWhitelistChatFlags(*self.friendPendingChatSettings[doId]) @@ -980,7 +980,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): if di.getRemainingSize() > 0: whitelistChatFlags = di.getUint8() self.notify.debug('Friend %d now online. common=%d whitelist=%d' % (doId, commonChatFlags, whitelistChatFlags)) - if not self.friendsOnline.has_key(doId): + if doId not in self.friendsOnline: self.friendsOnline[doId] = self.identifyFriend(doId) messenger.send('friendOnline', [doId, commonChatFlags, whitelistChatFlags]) if not self.friendsOnline[doId]: @@ -997,7 +997,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): def getFirstBattle(self): from toontown.battle import DistributedBattleBase - for dobj in self.doId2do.values(): + for dobj in list(self.doId2do.values()): if isinstance(dobj, DistributedBattleBase.DistributedBattleBase): return dobj @@ -1177,7 +1177,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.deleteObject(doId) def deleteObject(self, doId, ownerView = False): - if self.doId2do.has_key(doId): + if doId in self.doId2do: obj = self.doId2do[doId] del self.doId2do[doId] obj.deleteOrDelay() @@ -1189,7 +1189,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): ClientRepository.notify.warning('Asked to delete non-existent DistObj ' + str(doId)) def _abandonShard(self): - for doId, obj in self.doId2do.items(): + for doId, obj in list(self.doId2do.items()): if obj.parentId == localAvatar.defaultShard and obj is not localAvatar: self.deleteObject(doId) @@ -1222,7 +1222,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): taskMgr.doMethodLater(0.1, self.sendAvatarInfoRequests, 'avatarRequestQueueTask') def sendAvatarInfoRequests(self, task = None): - print 'Sending request Queue for AV Handles' + print('Sending request Queue for AV Handles') if not hasattr(self, 'avatarInfoRequests'): return if len(self.avatarInfoRequests) == 0: diff --git a/toontown/distributed/ToontownDistrictStats.py b/toontown/distributed/ToontownDistrictStats.py index 7cda422..e0ab4fd 100644 --- a/toontown/distributed/ToontownDistrictStats.py +++ b/toontown/distributed/ToontownDistrictStats.py @@ -82,11 +82,11 @@ class ToontownDistrictStats(DistributedObject.DistributedObject): self.toontownDistrictId = value def setAvatarCount(self, avatarCount): - if self.cr.activeDistrictMap.has_key(self.toontownDistrictId): + if self.toontownDistrictId in self.cr.activeDistrictMap: self.cr.activeDistrictMap[self.toontownDistrictId].avatarCount = avatarCount def setNewAvatarCount(self, newAvatarCount): - if self.cr.activeDistrictMap.has_key(self.toontownDistrictId): + if self.toontownDistrictId in self.cr.activeDistrictMap: self.cr.activeDistrictMap[self.toontownDistrictId].newAvatarCount = newAvatarCount def setStats(self, avatarCount, newAvatarCount): diff --git a/toontown/effects/BlastEffect.py b/toontown/effects/BlastEffect.py index c1407f5..086c747 100644 --- a/toontown/effects/BlastEffect.py +++ b/toontown/effects/BlastEffect.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from EffectController import EffectController +from .EffectController import EffectController class BlastEffect(NodePath, EffectController): diff --git a/toontown/effects/ChrysanthemumEffect.py b/toontown/effects/ChrysanthemumEffect.py index 72a8a57..1c616f0 100644 --- a/toontown/effects/ChrysanthemumEffect.py +++ b/toontown/effects/ChrysanthemumEffect.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from EffectController import EffectController +from .EffectController import EffectController class ChrysanthemumEffect(NodePath, EffectController): diff --git a/toontown/effects/DistributedFireworkShowAI.py b/toontown/effects/DistributedFireworkShowAI.py index da2f54b..c305233 100644 --- a/toontown/effects/DistributedFireworkShowAI.py +++ b/toontown/effects/DistributedFireworkShowAI.py @@ -2,8 +2,8 @@ from otp.ai.AIBaseGlobal import * from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from direct.distributed import ClockDelta -from FireworkShow import FireworkShow -from FireworkShows import getShowDuration +from .FireworkShow import FireworkShow +from .FireworkShows import getShowDuration import random from direct.task import Task diff --git a/toontown/effects/EffectController.py b/toontown/effects/EffectController.py index e348e1f..f6ac881 100644 --- a/toontown/effects/EffectController.py +++ b/toontown/effects/EffectController.py @@ -37,7 +37,7 @@ class EffectController: if lod != None: try: self.createTrack(lod) - except TypeError, e: + except TypeError as e: raise TypeError('Error loading %s effect.' % self.__class__.__name__) else: @@ -74,7 +74,7 @@ class EffectController: if lod != None: try: self.createTrack(lod) - except TypeError, e: + except TypeError as e: raise TypeError('Error loading %s effect.' % self.__class__.__name__) else: diff --git a/toontown/effects/FireworkShow.py b/toontown/effects/FireworkShow.py index f884bdb..6723558 100644 --- a/toontown/effects/FireworkShow.py +++ b/toontown/effects/FireworkShow.py @@ -1084,7 +1084,7 @@ class FireworkShow(NodePath): @classmethod def isValidShowType(cls, showType = -1): - if showType in cls.showData.keys(): + if showType in list(cls.showData.keys()): return True else: return False diff --git a/toontown/effects/FireworkShowMixin.py b/toontown/effects/FireworkShowMixin.py index d39dab9..aa13895 100644 --- a/toontown/effects/FireworkShowMixin.py +++ b/toontown/effects/FireworkShowMixin.py @@ -5,9 +5,9 @@ from toontown.toonbase.ToontownGlobals import * from toontown.toonbase import TTLocalizer from toontown.parties import PartyGlobals from toontown.hood import * -import Fireworks -import FireworkShows -from FireworkGlobals import skyTransitionDuration, preShowPauseDuration, postShowPauseDuration, preNormalMusicPauseDuration +from . import Fireworks +from . import FireworkShows +from .FireworkGlobals import skyTransitionDuration, preShowPauseDuration, postShowPauseDuration, preNormalMusicPauseDuration from toontown.effects.FireworkShow import FireworkShow class FireworkShowMixin: diff --git a/toontown/effects/FireworkShows.py b/toontown/effects/FireworkShows.py index 2c4c1c5..231864e 100644 --- a/toontown/effects/FireworkShows.py +++ b/toontown/effects/FireworkShows.py @@ -1,4 +1,4 @@ -from FireworkGlobals import * +from .FireworkGlobals import * from toontown.toonbase import ToontownGlobals from toontown.parties import PartyGlobals shows = {ToontownGlobals.JULY4_FIREWORKS: [((2, diff --git a/toontown/effects/FireworkSparkles.py b/toontown/effects/FireworkSparkles.py index afbe043..c7a0480 100644 --- a/toontown/effects/FireworkSparkles.py +++ b/toontown/effects/FireworkSparkles.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect import random class FireworkSparkles(PooledEffect, EffectController): diff --git a/toontown/effects/Fireworks.py b/toontown/effects/Fireworks.py index adf3b78..68531fb 100644 --- a/toontown/effects/Fireworks.py +++ b/toontown/effects/Fireworks.py @@ -4,7 +4,7 @@ from direct.particles import Particles from direct.particles import ForceGroup from pandac.PandaModules import * import random -from FireworkGlobals import * +from .FireworkGlobals import * colors = {WHITE: Vec4(1, 1, 1, 1), RED: Vec4(1, 0.2, 0.2, 1), BLUE: Vec4(0.2, 0.2, 1, 1), diff --git a/toontown/effects/FlashEffect.py b/toontown/effects/FlashEffect.py index 87664d7..10e99a3 100644 --- a/toontown/effects/FlashEffect.py +++ b/toontown/effects/FlashEffect.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from EffectController import EffectController +from .EffectController import EffectController class FlashEffect(NodePath, EffectController): diff --git a/toontown/effects/Glow.py b/toontown/effects/Glow.py index 8ee5831..00440da 100644 --- a/toontown/effects/Glow.py +++ b/toontown/effects/Glow.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect class Glow(PooledEffect, EffectController): diff --git a/toontown/effects/GlowTrail.py b/toontown/effects/GlowTrail.py index 475e11e..7d69f65 100644 --- a/toontown/effects/GlowTrail.py +++ b/toontown/effects/GlowTrail.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from PooledEffect import PooledEffect -from EffectController import EffectController +from .PooledEffect import PooledEffect +from .EffectController import EffectController class GlowTrail(PooledEffect, EffectController): diff --git a/toontown/effects/IceCream.py b/toontown/effects/IceCream.py index 9e8cce3..0d3253c 100644 --- a/toontown/effects/IceCream.py +++ b/toontown/effects/IceCream.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect class IceCream(PooledEffect, EffectController): diff --git a/toontown/effects/NoiseSparkles.py b/toontown/effects/NoiseSparkles.py index 6f97d55..b00e109 100644 --- a/toontown/effects/NoiseSparkles.py +++ b/toontown/effects/NoiseSparkles.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect import random class NoiseSparkles(PooledEffect, EffectController): diff --git a/toontown/effects/PeonyEffect.py b/toontown/effects/PeonyEffect.py index 3c54ab7..fb8d813 100644 --- a/toontown/effects/PeonyEffect.py +++ b/toontown/effects/PeonyEffect.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.showbase.DirectObject import * from direct.interval.IntervalGlobal import * -from PooledEffect import PooledEffect -from EffectController import EffectController +from .PooledEffect import PooledEffect +from .EffectController import EffectController class PeonyEffect(PooledEffect, EffectController): diff --git a/toontown/effects/RayBurst.py b/toontown/effects/RayBurst.py index ce17750..92cca11 100644 --- a/toontown/effects/RayBurst.py +++ b/toontown/effects/RayBurst.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from EffectController import EffectController +from .EffectController import EffectController class RayBurst(NodePath, EffectController): diff --git a/toontown/effects/RingEffect.py b/toontown/effects/RingEffect.py index a182c93..b080efb 100644 --- a/toontown/effects/RingEffect.py +++ b/toontown/effects/RingEffect.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect import random class RingEffect(PooledEffect, EffectController): diff --git a/toontown/effects/ScavengerHuntEffects.py b/toontown/effects/ScavengerHuntEffects.py index 1b690c4..0d0b19d 100644 --- a/toontown/effects/ScavengerHuntEffects.py +++ b/toontown/effects/ScavengerHuntEffects.py @@ -22,7 +22,7 @@ class ScavengerHuntEffect: def countUp(t, startVal, endVal): beanCountStr = startVal + t * (endVal - startVal) - self.countLabel['text'] = '+' + `(int(beanCountStr))` + self.countLabel['text'] = '+' + repr((int(beanCountStr))) def setCountColor(color): self.countLabel['text_fg'] = color diff --git a/toontown/effects/SimpleSparkles.py b/toontown/effects/SimpleSparkles.py index 3910c7d..21531ba 100644 --- a/toontown/effects/SimpleSparkles.py +++ b/toontown/effects/SimpleSparkles.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect import random class SimpleSparkles(PooledEffect, EffectController): diff --git a/toontown/effects/SkullBurst.py b/toontown/effects/SkullBurst.py index f82030f..66189d5 100644 --- a/toontown/effects/SkullBurst.py +++ b/toontown/effects/SkullBurst.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.showbase.DirectObject import * from direct.interval.IntervalGlobal import * -from PooledEffect import PooledEffect -from EffectController import EffectController +from .PooledEffect import PooledEffect +from .EffectController import EffectController class SkullBurst(PooledEffect, EffectController): diff --git a/toontown/effects/SkullFlash.py b/toontown/effects/SkullFlash.py index 746cafc..1d987b6 100644 --- a/toontown/effects/SkullFlash.py +++ b/toontown/effects/SkullFlash.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.showbase.DirectObject import * from direct.interval.IntervalGlobal import * -from PooledEffect import PooledEffect -from EffectController import EffectController +from .PooledEffect import PooledEffect +from .EffectController import EffectController class SkullFlash(PooledEffect, EffectController): diff --git a/toontown/effects/SparksTrail.py b/toontown/effects/SparksTrail.py index f1bf0e8..f00095a 100644 --- a/toontown/effects/SparksTrail.py +++ b/toontown/effects/SparksTrail.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from PooledEffect import PooledEffect -from EffectController import EffectController +from .PooledEffect import PooledEffect +from .EffectController import EffectController class SparksTrail(PooledEffect, EffectController): diff --git a/toontown/effects/SparksTrailLong.py b/toontown/effects/SparksTrailLong.py index 4760274..b4867b3 100644 --- a/toontown/effects/SparksTrailLong.py +++ b/toontown/effects/SparksTrailLong.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from PooledEffect import PooledEffect -from EffectController import EffectController +from .PooledEffect import PooledEffect +from .EffectController import EffectController class SparksTrailLong(PooledEffect, EffectController): diff --git a/toontown/effects/Splash.py b/toontown/effects/Splash.py index 1f89af6..6f74c84 100644 --- a/toontown/effects/Splash.py +++ b/toontown/effects/Splash.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from Ripples import * +from .Ripples import * from toontown.battle.BattleProps import globalPropPool from toontown.battle import BattleParticles diff --git a/toontown/effects/StarBurst.py b/toontown/effects/StarBurst.py index 6d500b6..91598cb 100644 --- a/toontown/effects/StarBurst.py +++ b/toontown/effects/StarBurst.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.particles import ParticleEffect, Particles, ForceGroup -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect class StarBurst(PooledEffect, EffectController): diff --git a/toontown/effects/TrailExplosion.py b/toontown/effects/TrailExplosion.py index 552872b..8a3ca28 100644 --- a/toontown/effects/TrailExplosion.py +++ b/toontown/effects/TrailExplosion.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from EffectController import EffectController -from PooledEffect import PooledEffect +from .EffectController import EffectController +from .PooledEffect import PooledEffect from toontown.effects.SparksTrailLong import SparksTrailLong import random diff --git a/toontown/estate/ClosetGUI.py b/toontown/estate/ClosetGUI.py index 65117d1..955ba21 100644 --- a/toontown/estate/ClosetGUI.py +++ b/toontown/estate/ClosetGUI.py @@ -2,7 +2,7 @@ from direct.showbase.PythonUtil import Functor from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.makeatoon import ClothesGUI -import ClosetGlobals +from . import ClosetGlobals from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog diff --git a/toontown/estate/DistributedBank.py b/toontown/estate/DistributedBank.py index 23626fe..d2d8103 100644 --- a/toontown/estate/DistributedBank.py +++ b/toontown/estate/DistributedBank.py @@ -6,10 +6,10 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from toontown.toonbase import ToontownGlobals -import DistributedFurnitureItem +from . import DistributedFurnitureItem from toontown.toonbase import TTLocalizer -import BankGUI -from BankGlobals import * +from . import BankGUI +from .BankGlobals import * from toontown.toontowngui import TTDialog from toontown.catalog.CatalogFurnitureItem import FurnitureTypes from toontown.catalog.CatalogFurnitureItem import FTScale diff --git a/toontown/estate/DistributedCannon.py b/toontown/estate/DistributedCannon.py index 44124db..cc060f9 100644 --- a/toontown/estate/DistributedCannon.py +++ b/toontown/estate/DistributedCannon.py @@ -14,7 +14,7 @@ from toontown.toon import ToonHead from toontown.effects import Splash from toontown.effects import DustCloud from toontown.minigame import CannonGameGlobals -import CannonGlobals +from . import CannonGlobals from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer @@ -263,7 +263,7 @@ class DistributedCannon(DistributedObject.DistributedObject): self.curPinballScore = 0 self.curPinballMultiplier = 1 self.incrementPinballInfo(0, 0) - if self.cr.doId2do.has_key(self.avId): + if self.avId in self.cr.doId2do: self.av = self.cr.doId2do[self.avId] self.acceptOnce(self.av.uniqueName('disable'), self.__avatarGone) self.av.stopSmooth() @@ -717,7 +717,7 @@ class DistributedCannon(DistributedObject.DistributedObject): self.cannonMoving = 0 self.sndCannonMove.stop() self.__broadcastLocalCannonPosition() - print 'Cannon Rot:%s Angle:%s' % (pos[0], pos[1]) + print('Cannon Rot:%s Angle:%s' % (pos[0], pos[1])) return Task.cont def __broadcastLocalCannonPosition(self): @@ -786,10 +786,10 @@ class DistributedCannon(DistributedObject.DistributedObject): return Task.done flightResults = self.__calcFlightResults(avId, launchTime) if not isClient(): - print 'EXECWARNING DistributedCannon: %s' % flightResults + print('EXECWARNING DistributedCannon: %s' % flightResults) printStack() for key in flightResults: - exec "%s = flightResults['%s']" % (key, key) + exec("%s = flightResults['%s']" % (key, key)) self.notify.debug('start position: ' + str(startPos)) self.notify.debug('start velocity: ' + str(startVel)) @@ -808,7 +808,7 @@ class DistributedCannon(DistributedObject.DistributedObject): head.reparentTo(hidden) av = self.toonModel av.reparentTo(render) - print 'start Pos%s Hpr%s' % (startPos, startHpr) + print('start Pos%s Hpr%s' % (startPos, startHpr)) av.setPos(startPos) barrelHpr = self.barrel.getHpr(render) place = base.cr.playGame.getPlace() @@ -849,7 +849,7 @@ class DistributedCannon(DistributedObject.DistributedObject): flyTask.info = info seqTask = Task.sequence(shootTask, smokeTask, flyTask) if self.av == base.localAvatar: - print 'disable controls' + print('disable controls') base.localAvatar.disableAvatarControls() taskMgr.add(seqTask, self.taskName('flyingToon') + '-' + str(avId)) self.acceptOnce(self.uniqueName('stopFlyTask'), self.__stopFlyTask) @@ -871,13 +871,13 @@ class DistributedCannon(DistributedObject.DistributedObject): def removeAvFromCannon(self): place = base.cr.playGame.getPlace() - print 'removeAvFromCannon' + print('removeAvFromCannon') self.notify.debug('self.inWater = %s' % self.inWater) if place: if not hasattr(place, 'fsm'): return placeState = place.fsm.getCurrentState().getName() - print placeState + print(placeState) if (self.inWater or place.toonSubmerged) and placeState != 'fishing': if self.av != None: self.av.startSmooth() @@ -900,7 +900,7 @@ class DistributedCannon(DistributedObject.DistributedObject): self.av.startSmooth() self.av.setScale(1, 1, 1) if self.av == base.localAvatar: - print 'enable controls' + print('enable controls') base.localAvatar.enableAvatarControls() self.ignore(self.av.uniqueName('disable')) self.__destroyToonModels() @@ -1168,7 +1168,7 @@ class DistributedCannon(DistributedObject.DistributedObject): if hitP[2] > ToontownGlobals.EstateWakeWaterHeight: self.notify.debug('we hit the ground before we hit water') self.__hitGround(avatar, pos, extraArgs) - print 'but not really' + print('but not really') return self.inWater = 1 self.notify.debug('hit water') diff --git a/toontown/estate/DistributedCannonAI.py b/toontown/estate/DistributedCannonAI.py index d11cf3e..a299411 100644 --- a/toontown/estate/DistributedCannonAI.py +++ b/toontown/estate/DistributedCannonAI.py @@ -6,7 +6,7 @@ from direct.task import Task from toontown.minigame import CannonGameGlobals from direct.distributed import DistributedObjectAI from toontown.minigame import Trajectory -import CannonGlobals +from . import CannonGlobals class DistributedCannonAI(DistributedObjectAI.DistributedObjectAI): notify = directNotify.newCategory('DistributedCannonAI') diff --git a/toontown/estate/DistributedChangingStatuary.py b/toontown/estate/DistributedChangingStatuary.py index e963322..5a57289 100644 --- a/toontown/estate/DistributedChangingStatuary.py +++ b/toontown/estate/DistributedChangingStatuary.py @@ -41,7 +41,7 @@ class DistributedChangingStatuary(DistributedStatuary.DistributedStatuary): if stage == -1: stage = len(growthThresholds) self.notify.debug('growth Stage=%d' % stage) - for index in xrange(len(growthThresholds) + 1): + for index in range(len(growthThresholds) + 1): if index != stage: partName = '**/growthStage_%d' % index self.notify.debug('trying to remove %s' % partName) diff --git a/toontown/estate/DistributedCloset.py b/toontown/estate/DistributedCloset.py index 5fe965f..167139b 100644 --- a/toontown/estate/DistributedCloset.py +++ b/toontown/estate/DistributedCloset.py @@ -9,10 +9,10 @@ from toontown.toonbase import ToontownGlobals from direct.showbase import DirectObject from toontown.toon import ToonDNA from direct.fsm import ClassicFSM, State, StateData -import ClosetGUI +from . import ClosetGUI from direct.task.Task import Task -import ClosetGlobals -import DistributedFurnitureItem +from . import ClosetGlobals +from . import DistributedFurnitureItem from toontown.toonbase import TTLocalizer class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): @@ -211,9 +211,9 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): self.botList = botList self.oldTopList = self.topList[0:] self.oldBotList = self.botList[0:] - print '-----------Starting closet interaction-----------' + print('-----------Starting closet interaction-----------') self.printInfo() - print '-------------------------------------------------' + print('-------------------------------------------------') if not self.isOwner: self.__popupNotOwnerPanel() else: @@ -366,15 +366,15 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): return def printInfo(self): - print 'avid: %s, gender: %s' % (self.av.doId, self.av.style.gender) - print 'current top = %s,%s,%s,%s and bot = %s,%s,' % (self.av.style.topTex, + print('avid: %s, gender: %s' % (self.av.doId, self.av.style.gender)) + print('current top = %s,%s,%s,%s and bot = %s,%s,' % (self.av.style.topTex, self.av.style.topTexColor, self.av.style.sleeveTex, self.av.style.sleeveTexColor, self.av.style.botTex, - self.av.style.botTexColor) - print 'topsList = %s' % self.av.getClothesTopsList() - print 'bottomsList = %s' % self.av.getClothesBottomsList() + self.av.style.botTexColor)) + print('topsList = %s' % self.av.getClothesTopsList()) + print('bottomsList = %s' % self.av.getClothesBottomsList()) def setMovie(self, mode, avId, timestamp): self.isLocalToon = avId == base.localAvatar.doId @@ -386,9 +386,9 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): elif mode == ClosetGlobals.CLOSET_MOVIE_COMPLETE: if self.isLocalToon: self._revertGender() - print '-----------ending trunk interaction-----------' + print('-----------ending trunk interaction-----------') self.printInfo() - print '-------------------------------------------------' + print('-------------------------------------------------') self.resetCloset() self.freeAvatar() return diff --git a/toontown/estate/DistributedEstate.py b/toontown/estate/DistributedEstate.py index fe96309..bc98e3e 100644 --- a/toontown/estate/DistributedEstate.py +++ b/toontown/estate/DistributedEstate.py @@ -15,18 +15,18 @@ from direct.showbase import RandomNumGen from direct.task.Task import Task from toontown.toonbase import TTLocalizer import random -import cPickle +import pickle import time from direct.showbase import PythonUtil from toontown.hood import Place -import Estate -import HouseGlobals +from . import Estate +from . import HouseGlobals from toontown.estate import GardenGlobals from toontown.estate import DistributedFlower from toontown.estate import DistributedGagTree from toontown.estate import DistributedStatuary -import GardenDropGame -import GardenProgressMeter +from . import GardenDropGame +from . import GardenProgressMeter from toontown.estate import FlowerSellGUI from toontown.toontowngui import TTDialog @@ -181,7 +181,7 @@ class DistributedEstate(DistributedObject.DistributedObject): def setHouseInfo(self, houseInfo): self.notify.debug('setHouseInfo') - houseType, housePos = cPickle.loads(houseInfo) + houseType, housePos = pickle.loads(houseInfo) self.loadEstate(houseType, housePos) def loadEstate(self, indexList, posList): @@ -253,11 +253,11 @@ class DistributedEstate(DistributedObject.DistributedObject): curTime = time.time() % HouseGlobals.DAY_NIGHT_PERIOD dawnTime = self.dawnTime dT = (curTime - dawnTime - self.deltaTime) % HouseGlobals.DAY_NIGHT_PERIOD - print 'getDeltaTime = %s. curTime=%s. dawnTime=%s. serverTime=%s. deltaTime=%s' % (dT, + print('getDeltaTime = %s. curTime=%s. dawnTime=%s. serverTime=%s. deltaTime=%s' % (dT, curTime, dawnTime, self.serverTime, - self.deltaTime) + self.deltaTime)) return dT def __initDaytimeTask(self): @@ -279,7 +279,7 @@ class DistributedEstate(DistributedObject.DistributedObject): ts = 0 if hasattr(task, 'ts'): ts = task.ts - print 'ts=%s' % ts + print('ts=%s' % ts) self.dayTrack.start(ts) taskMgr.doMethodLater(HouseGlobals.DAY_NIGHT_PERIOD - ts, self.__dayTimeTask, self.taskName('daytime')) return Task.done @@ -312,7 +312,7 @@ class DistributedEstate(DistributedObject.DistributedObject): else: self.__stopCrickets() self.__startBirds() - print 'ts(sun)=%s' % ts + print('ts(sun)=%s' % ts) self.sunTrack.start(ts) taskMgr.doMethodLater(HouseGlobals.DAY_NIGHT_PERIOD - ts, self.__sunTask, self.taskName('sunTask')) return Task.done diff --git a/toontown/estate/DistributedFireworksCannon.py b/toontown/estate/DistributedFireworksCannon.py index 5572794..94287be 100644 --- a/toontown/estate/DistributedFireworksCannon.py +++ b/toontown/estate/DistributedFireworksCannon.py @@ -1,13 +1,13 @@ from toontown.toonbase.ToontownGlobals import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * -from HouseGlobals import * +from .HouseGlobals import * from toontown.effects import DistributedFireworkShow from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from pandac.PandaModules import CollisionSphere from pandac.PandaModules import CollisionNode -import FireworksGui +from . import FireworksGui class DistributedFireworksCannon(DistributedFireworkShow.DistributedFireworkShow): notify = directNotify.newCategory('DistributedFireworksCannon') @@ -105,5 +105,5 @@ class DistributedFireworksCannon(DistributedFireworkShow.DistributedFireworkShow dummy.setPos(0, 100, 60) pos = dummy.getPos(render) dummy.removeNode() - print 'lauFirework: %s, col=%s' % (index, col1) + print('lauFirework: %s, col=%s' % (index, col1)) self.d_requestFirework(pos[0], pos[1], pos[2], style, col1, col2) diff --git a/toontown/estate/DistributedFurnitureItem.py b/toontown/estate/DistributedFurnitureItem.py index 73b7df8..b4fac97 100644 --- a/toontown/estate/DistributedFurnitureItem.py +++ b/toontown/estate/DistributedFurnitureItem.py @@ -5,10 +5,10 @@ from toontown.catalog import CatalogItem from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObject from toontown.toonbase import TTLocalizer -import DistributedHouseItem +from . import DistributedHouseItem from direct.distributed import DistributedSmoothNode from direct.task import Task -import HouseGlobals +from . import HouseGlobals class DistributedFurnitureItem(DistributedHouseItem.DistributedHouseItem, DistributedSmoothNode.DistributedSmoothNode): notify = directNotify.newCategory('DistributedFurnitureItem') diff --git a/toontown/estate/DistributedFurnitureManager.py b/toontown/estate/DistributedFurnitureManager.py index b947e7c..f1ad12c 100644 --- a/toontown/estate/DistributedFurnitureManager.py +++ b/toontown/estate/DistributedFurnitureManager.py @@ -34,7 +34,7 @@ class DistributedFurnitureManager(DistributedObject.DistributedObject): if self.ownerId == base.localAvatar.doId: self.cr.furnitureManager = self if self.cr.objectManager == None: - import houseDesign + from . import houseDesign self.cr.objectManager = houseDesign.ObjectManager() return diff --git a/toontown/estate/DistributedGagTree.py b/toontown/estate/DistributedGagTree.py index e53973e..0226374 100644 --- a/toontown/estate/DistributedGagTree.py +++ b/toontown/estate/DistributedGagTree.py @@ -6,8 +6,8 @@ from toontown.toonbase import ToontownBattleGlobals from toontown.toontowngui import TTDialog from toontown.toontowngui.TeaserPanel import TeaserPanel from toontown.toonbase import TTLocalizer -import GardenGlobals -import HouseGlobals +from . import GardenGlobals +from . import HouseGlobals from direct.task import Task from pandac.PandaModules import * from otp.otpbase import OTPGlobals diff --git a/toontown/estate/DistributedGarden.py b/toontown/estate/DistributedGarden.py index e52a5a7..2fa6f04 100644 --- a/toontown/estate/DistributedGarden.py +++ b/toontown/estate/DistributedGarden.py @@ -13,11 +13,11 @@ from direct.showbase import RandomNumGen from toontown.toonbase import TTLocalizer import random import random -import cPickle +import pickle from direct.showbase import PythonUtil from toontown.hood import Place -import Estate -import HouseGlobals +from . import Estate +from . import HouseGlobals class DistributedGarden(DistributedObject.DistributedObject): notify = directNotify.newCategory('DistributedGarden') @@ -63,10 +63,10 @@ class DistributedGarden(DistributedObject.DistributedObject): def sendNewProp(self, prop, x, y, z): self.notify.debug('sendNewProp') - print 'new prop (%d) = %s,%s,%s' % (prop, + print('new prop (%d) = %s,%s,%s' % (prop, x, y, - z) + z)) if prop == HouseGlobals.PROP_ICECUBE: model = loader.loadModel('phase_8/models/props/icecube.bam') elif prop == HouseGlobals.PROP_FLOWER: diff --git a/toontown/estate/DistributedGardenBox.py b/toontown/estate/DistributedGardenBox.py index ad9cb9b..57b4247 100644 --- a/toontown/estate/DistributedGardenBox.py +++ b/toontown/estate/DistributedGardenBox.py @@ -1,7 +1,7 @@ -import DistributedLawnDecor +from . import DistributedLawnDecor from direct.directnotify import DirectNotifyGlobal from direct.showbase.ShowBase import * -import GardenGlobals +from . import GardenGlobals from toontown.toonbase import TTLocalizer from toontown.estate import PlantingGUI from toontown.estate import PlantTreeGUI diff --git a/toontown/estate/DistributedGardenPlot.py b/toontown/estate/DistributedGardenPlot.py index 043f170..2363f95 100644 --- a/toontown/estate/DistributedGardenPlot.py +++ b/toontown/estate/DistributedGardenPlot.py @@ -1,8 +1,8 @@ -import DistributedLawnDecor +from . import DistributedLawnDecor from direct.directnotify import DirectNotifyGlobal from direct.showbase.ShowBase import * from direct.interval.IntervalGlobal import * -import GardenGlobals +from . import GardenGlobals from toontown.toonbase import TTLocalizer from toontown.estate import PlantingGUI from toontown.estate import PlantTreeGUI @@ -64,7 +64,7 @@ class DistributedGardenPlot(DistributedLawnDecor.DistributedLawnDecor): self.model = None if self.defaultModel: self.model = loader.loadModel(self.defaultModel) - if type(self.plotScale) == types.TupleType: + if type(self.plotScale) == tuple: self.model.setScale(*self.plotScale) else: self.model.setScale(self.plotScale) diff --git a/toontown/estate/DistributedHouse.py b/toontown/estate/DistributedHouse.py index d8b26ef..f4a0109 100644 --- a/toontown/estate/DistributedHouse.py +++ b/toontown/estate/DistributedHouse.py @@ -16,7 +16,7 @@ from toontown.toonbase import TTLocalizer import random from direct.showbase import PythonUtil from toontown.hood import Place -import HouseGlobals +from . import HouseGlobals from toontown.building import ToonInteriorColors from direct.showbase.MessengerGlobal import messenger diff --git a/toontown/estate/DistributedHouseDoor.py b/toontown/estate/DistributedHouseDoor.py index 7695728..2823361 100644 --- a/toontown/estate/DistributedHouseDoor.py +++ b/toontown/estate/DistributedHouseDoor.py @@ -57,7 +57,7 @@ class DistributedHouseDoor(DistributedDoor.DistributedDoor): self.zoneDoneLoading = 0 def getBuilding(self, allowEmpty = False): - if not self.__dict__.has_key('building'): + if 'building' not in self.__dict__: if self.doorType == DoorTypes.INT_STANDARD: door = render.find('**/leftDoor;+s') self.building = door.getParent() diff --git a/toontown/estate/DistributedHouseInterior.py b/toontown/estate/DistributedHouseInterior.py index 7094e1e..bab99dc 100644 --- a/toontown/estate/DistributedHouseInterior.py +++ b/toontown/estate/DistributedHouseInterior.py @@ -5,7 +5,7 @@ from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from direct.directnotify import DirectNotifyGlobal from direct.distributed import DistributedObject -import HouseGlobals +from . import HouseGlobals from toontown.catalog import CatalogItemList from toontown.catalog import CatalogItem from toontown.catalog import CatalogSurfaceItem diff --git a/toontown/estate/DistributedLawnDecor.py b/toontown/estate/DistributedLawnDecor.py index 23113d8..bf755bd 100644 --- a/toontown/estate/DistributedLawnDecor.py +++ b/toontown/estate/DistributedLawnDecor.py @@ -266,7 +266,7 @@ class DistributedLawnDecor(DistributedNode.DistributedNode, NodePath, ShadowCast return toonTrack def unprint(self, string): - print string + print(string) def startInteraction(self): place = base.cr.playGame.getPlace() diff --git a/toontown/estate/DistributedMailbox.py b/toontown/estate/DistributedMailbox.py index 128f5cb..3c545fd 100644 --- a/toontown/estate/DistributedMailbox.py +++ b/toontown/estate/DistributedMailbox.py @@ -1,6 +1,6 @@ from direct.distributed import DistributedObject from toontown.toonbase import ToontownGlobals -import MailboxGlobals +from . import MailboxGlobals from toontown.catalog import CatalogItem from toontown.catalog import CatalogItemList from toontown.toontowngui import TTDialog @@ -225,7 +225,7 @@ class DistributedMailbox(DistributedObject.DistributedObject): def acceptItemResponse(self, context, retcode): DistributedMailbox.notify.debug('acceptItemResponse') if retcode == ToontownGlobals.P_UserCancelled: - print 'DistributedMailbox User Canceled' + print('DistributedMailbox User Canceled') self.doCallbackContext(context, [retcode]) def discardItem(self, item, index, callback, optional = -1): diff --git a/toontown/estate/DistributedPhone.py b/toontown/estate/DistributedPhone.py index bd04793..6617595 100644 --- a/toontown/estate/DistributedPhone.py +++ b/toontown/estate/DistributedPhone.py @@ -1,12 +1,12 @@ from toontown.toonbase import ToontownGlobals -import PhoneGlobals +from . import PhoneGlobals from toontown.catalog import CatalogScreen from toontown.catalog import CatalogItem from toontown.toontowngui import TTDialog from toontown.toonbase import TTLocalizer -import DistributedHouseInterior +from . import DistributedHouseInterior from direct.actor import Actor -import DistributedFurnitureItem +from . import DistributedFurnitureItem from direct.distributed import ClockDelta from direct.showbase import PythonUtil from direct.showutil import Rope @@ -266,7 +266,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem): self.sendUpdate('requestPurchaseMessage', [context, blob, optional]) def requestGiftPurchase(self, item, targetDoID, callback, optional = -1): - print 'in the client phone' + print('in the client phone') blob = item.getBlob(store=CatalogItem.Customization) context = self.getCallbackContext(callback, [item]) self.sendUpdate('requestGiftPurchaseMessage', [context, diff --git a/toontown/estate/DistributedPlantBase.py b/toontown/estate/DistributedPlantBase.py index fc9e487..15db1f8 100644 --- a/toontown/estate/DistributedPlantBase.py +++ b/toontown/estate/DistributedPlantBase.py @@ -1,8 +1,8 @@ -import DistributedLawnDecor +from . import DistributedLawnDecor from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal from direct.showbase.ShowBase import * -import GardenGlobals +from . import GardenGlobals from toontown.toonbase import TTLocalizer class DistributedPlantBase(DistributedLawnDecor.DistributedLawnDecor): @@ -17,7 +17,7 @@ class DistributedPlantBase(DistributedLawnDecor.DistributedLawnDecor): def delete(self): self.notify.debug('delete') - for waterTrack in self.waterTrackDict.values(): + for waterTrack in list(self.waterTrackDict.values()): if waterTrack: waterTrack.finish() diff --git a/toontown/estate/DistributedStatuary.py b/toontown/estate/DistributedStatuary.py index 4af314d..ddad537 100644 --- a/toontown/estate/DistributedStatuary.py +++ b/toontown/estate/DistributedStatuary.py @@ -1,7 +1,7 @@ -import DistributedLawnDecor +from . import DistributedLawnDecor from direct.directnotify import DirectNotifyGlobal from direct.showbase.ShowBase import * -import GardenGlobals +from . import GardenGlobals from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog @@ -43,10 +43,10 @@ class DistributedStatuary(DistributedLawnDecor.DistributedLawnDecor): self.plantType = GardenGlobals.PlantAttributes[typeIndex]['plantType'] self.modelPath = GardenGlobals.PlantAttributes[typeIndex]['model'] self.pinballScore = None - if GardenGlobals.PlantAttributes[typeIndex].has_key('pinballScore'): + if 'pinballScore' in GardenGlobals.PlantAttributes[typeIndex]: self.pinballScore = GardenGlobals.PlantAttributes[typeIndex]['pinballScore'] self.worldScale = 1.0 - if GardenGlobals.PlantAttributes[typeIndex].has_key('worldScale'): + if 'worldScale' in GardenGlobals.PlantAttributes[typeIndex]: self.worldScale = GardenGlobals.PlantAttributes[typeIndex]['worldScale'] return diff --git a/toontown/estate/DistributedToonStatuary.py b/toontown/estate/DistributedToonStatuary.py index 4449a2d..c3e5264 100644 --- a/toontown/estate/DistributedToonStatuary.py +++ b/toontown/estate/DistributedToonStatuary.py @@ -5,7 +5,7 @@ from direct.showbase.ShowBase import * from pandac.PandaModules import * from toontown.toon import Toon from toontown.toon import ToonDNA -import GardenGlobals +from . import GardenGlobals from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from pandac.PandaModules import NodePath diff --git a/toontown/estate/DistributedTrunk.py b/toontown/estate/DistributedTrunk.py index 3c99b4e..ed081a8 100644 --- a/toontown/estate/DistributedTrunk.py +++ b/toontown/estate/DistributedTrunk.py @@ -2,9 +2,9 @@ from pandac.PandaModules import * from direct.gui.DirectGui import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -import DistributedCloset -import ClosetGlobals -import TrunkGUI +from . import DistributedCloset +from . import ClosetGlobals +from . import TrunkGUI from toontown.toon import ToonDNA from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -34,15 +34,15 @@ class DistributedTrunk(DistributedCloset.DistributedCloset): self.isFreePlayer = 0 def printInfo(self): - print 'avid: %s, gender: %s' % (self.av.doId, self.av.style.gender) - print 'current hat = %s, glasses = %s, backpack = %s, shoes = %s' % (self.av.getHat(), + print('avid: %s, gender: %s' % (self.av.doId, self.av.style.gender)) + print('current hat = %s, glasses = %s, backpack = %s, shoes = %s' % (self.av.getHat(), self.av.getGlasses(), self.av.getBackpack(), - self.av.getShoes()) - print 'hatList = %s' % self.av.getHatList() - print 'glassesList = %s' % self.av.getGlassesList() - print 'backpackList = %s' % self.av.getBackpackList() - print 'shoesList = %s' % self.av.getShoesList() + self.av.getShoes())) + print('hatList = %s' % self.av.getHatList()) + print('glassesList = %s' % self.av.getGlassesList()) + print('backpackList = %s' % self.av.getBackpackList()) + print('shoesList = %s' % self.av.getShoesList()) def setState(self, mode, avId, ownerId, gender, hatList, glassesList, backpackList, shoesList): self.notify.debug('setState, mode=%s, avId=%s, ownerId=%d' % (mode, avId, ownerId)) @@ -70,9 +70,9 @@ class DistributedTrunk(DistributedCloset.DistributedCloset): self.oldGlassesList = self.glassesList[0:] self.oldBackpackList = self.backpackList[0:] self.oldShoesList = self.shoesList[0:] - print '-----------Starting trunk interaction-----------' + print('-----------Starting trunk interaction-----------') self.printInfo() - print '-------------------------------------------------' + print('-------------------------------------------------') if not self.isOwner: self.__popupNotOwnerPanel() else: diff --git a/toontown/estate/Estate.py b/toontown/estate/Estate.py index 857a1ba..6368bcb 100644 --- a/toontown/estate/Estate.py +++ b/toontown/estate/Estate.py @@ -16,7 +16,7 @@ from toontown.hood import SkyUtil from toontown.pets import PetTutorial from direct.controls.GravityWalker import GravityWalker from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs, TLNull -import HouseGlobals +from . import HouseGlobals class Estate(Place.Place): notify = DirectNotifyGlobal.directNotify.newCategory('Estate') diff --git a/toontown/estate/EstateLoader.py b/toontown/estate/EstateLoader.py index 2bb4e64..0375bac 100644 --- a/toontown/estate/EstateLoader.py +++ b/toontown/estate/EstateLoader.py @@ -5,9 +5,9 @@ from direct.fsm import ClassicFSM, State from toontown.safezone import SafeZoneLoader import random from toontown.launcher import DownloadForceAcknowledge -import House -import Estate -import HouseGlobals +from . import House +from . import Estate +from . import HouseGlobals import random import math from toontown.coghq import MovingPlatform @@ -51,8 +51,8 @@ class EstateLoader(SafeZoneLoader.SafeZoneLoader): self.underwaterSound = base.loader.loadSfx('phase_4/audio/sfx/AV_ambient_water.mp3') self.swimSound = base.loader.loadSfx('phase_4/audio/sfx/AV_swim_single_stroke.mp3') self.submergeSound = base.loader.loadSfx('phase_5.5/audio/sfx/AV_jump_in_water.mp3') - self.birdSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) - self.cricketSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) + self.birdSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) + self.cricketSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) if base.goonsEnabled: invModel = loader.loadModel('phase_3.5/models/gui/inventory_icons') self.invModels = [] @@ -286,15 +286,15 @@ class EstateLoader(SafeZoneLoader.SafeZoneLoader): return track def debugGeom(self, decomposed): - print 'numPrimitives = %d' % decomposed.getNumPrimitives() + print('numPrimitives = %d' % decomposed.getNumPrimitives()) for primIndex in range(decomposed.getNumPrimitives()): prim = decomposed.getPrimitive(primIndex) - print 'prim = %s' % prim - print 'isIndexed = %d' % prim.isIndexed() - print 'prim.getNumPrimitives = %d' % prim.getNumPrimitives() + print('prim = %s' % prim) + print('isIndexed = %d' % prim.isIndexed()) + print('prim.getNumPrimitives = %d' % prim.getNumPrimitives()) for basicPrim in range(prim.getNumPrimitives()): - print '%d start=%d' % (basicPrim, prim.getPrimitiveStart(basicPrim)) - print '%d end=%d' % (basicPrim, prim.getPrimitiveEnd(basicPrim)) + print('%d start=%d' % (basicPrim, prim.getPrimitiveStart(basicPrim))) + print('%d end=%d' % (basicPrim, prim.getPrimitiveEnd(basicPrim))) def loadOnePlatform(self, version, radius, zOffset, score, multiplier): self.notify.debug('loadOnePlatform version=%d' % version) diff --git a/toontown/estate/EstateManager.py b/toontown/estate/EstateManager.py index df12ad2..4b809bb 100644 --- a/toontown/estate/EstateManager.py +++ b/toontown/estate/EstateManager.py @@ -6,8 +6,8 @@ import random from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import HouseGlobals -import Estate +from . import HouseGlobals +from . import Estate class EstateManager(DistributedObject.DistributedObject): notify = DirectNotifyGlobal.directNotify.newCategory('EstateManager') diff --git a/toontown/estate/FireworkItemPanel.py b/toontown/estate/FireworkItemPanel.py index 1e0384a..26dca1d 100644 --- a/toontown/estate/FireworkItemPanel.py +++ b/toontown/estate/FireworkItemPanel.py @@ -4,7 +4,7 @@ from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.effects import FireworkGlobals from toontown.effects import Fireworks -import FireworksGui +from . import FireworksGui class FireworkItemPanel(DirectFrame): diff --git a/toontown/estate/FireworksGui.py b/toontown/estate/FireworksGui.py index 2e8ec85..c150018 100644 --- a/toontown/estate/FireworksGui.py +++ b/toontown/estate/FireworksGui.py @@ -2,7 +2,7 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.gui.DirectScrolledList import * from toontown.toonbase import ToontownGlobals -import FireworkItemPanel +from . import FireworkItemPanel from direct.directnotify import DirectNotifyGlobal from toontown.effects import FireworkGlobals from toontown.effects import Fireworks @@ -48,7 +48,7 @@ class FireworksGui(DirectFrame): self.hilightColor = VBase4(1, 1, 1, 1) self.bgColor = VBase4(0.8, 0.8, 0.8, 1) self.colorButtons = [] - for i in Fireworks.colors.keys(): + for i in list(Fireworks.colors.keys()): color = Fireworks.colors[i] height = 0.07 paddedHeight = 0.1 diff --git a/toontown/estate/FlowerBase.py b/toontown/estate/FlowerBase.py index bb12d1a..8e9699c 100644 --- a/toontown/estate/FlowerBase.py +++ b/toontown/estate/FlowerBase.py @@ -1,4 +1,4 @@ -import GardenGlobals +from . import GardenGlobals from toontown.toonbase import TTLocalizer from direct.directnotify import DirectNotifyGlobal @@ -8,8 +8,8 @@ class FlowerBase: def __init__(self, species, variety): self.species = species self.variety = variety - if self.species not in GardenGlobals.PlantAttributes.keys(): - print 'remove me when everyone is updated' + if self.species not in list(GardenGlobals.PlantAttributes.keys()): + print('remove me when everyone is updated') self.species = 56 species = 56 diff --git a/toontown/estate/FlowerBasket.py b/toontown/estate/FlowerBasket.py index 0dd9495..2842e58 100644 --- a/toontown/estate/FlowerBasket.py +++ b/toontown/estate/FlowerBasket.py @@ -1,6 +1,6 @@ -import GardenGlobals +from . import GardenGlobals from direct.directnotify import DirectNotifyGlobal -import FlowerBase +from . import FlowerBase class FlowerBasket: notify = DirectNotifyGlobal.directNotify.newCategory('FlowerBasket') diff --git a/toontown/estate/FlowerBrowser.py b/toontown/estate/FlowerBrowser.py index dcdc018..d594a85 100644 --- a/toontown/estate/FlowerBrowser.py +++ b/toontown/estate/FlowerBrowser.py @@ -3,8 +3,8 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import FlowerSpeciesPanel -import GardenGlobals +from . import FlowerSpeciesPanel +from . import GardenGlobals class FlowerBrowser(DirectScrolledList): notify = DirectNotifyGlobal.directNotify.newCategory('FlowerBrowser') @@ -31,7 +31,7 @@ class FlowerBrowser(DirectScrolledList): ('decButton_pos', (0, 0, 0.525), None), ('decButton_image3_color', Vec4(0.8, 0.8, 0.8, 0.5), None), ('numItemsVisible', 1, None), - ('items', map(str, GardenGlobals.getFlowerSpecies()), None), + ('items', list(map(str, GardenGlobals.getFlowerSpecies())), None), ('scrollSpeed', 4, None), ('itemMakeFunction', FlowerSpeciesPanel.FlowerSpeciesPanel, None), ('itemMakeExtraArgs', base.localAvatar.flowerCollection, None)) diff --git a/toontown/estate/FlowerCollection.py b/toontown/estate/FlowerCollection.py index ce8ad26..ba4b55e 100644 --- a/toontown/estate/FlowerCollection.py +++ b/toontown/estate/FlowerCollection.py @@ -1,6 +1,6 @@ -import GardenGlobals +from . import GardenGlobals from direct.directnotify import DirectNotifyGlobal -import FlowerBase +from . import FlowerBase class FlowerCollection: notify = DirectNotifyGlobal.directNotify.newCategory('FlowerCollection') diff --git a/toontown/estate/FlowerPanel.py b/toontown/estate/FlowerPanel.py index 7c5aeaa..ab52810 100644 --- a/toontown/estate/FlowerPanel.py +++ b/toontown/estate/FlowerPanel.py @@ -4,8 +4,8 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer from direct.interval.IntervalGlobal import * -import GardenGlobals -import FlowerPhoto +from . import GardenGlobals +from . import FlowerPhoto class FlowerPanel(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('FlowerPanel') @@ -78,8 +78,8 @@ class FlowerPanel(DirectFrame): def show(self, code = GardenGlobals.FlowerItem): messenger.send('wakeup') - apply(self.photo.setSwimBounds, self.swimBounds) - apply(self.photo.setSwimColor, self.swimColor) + self.photo.setSwimBounds(*self.swimBounds) + self.photo.setSwimColor(*self.swimColor) if code == GardenGlobals.FlowerItem: self.extraLabel.hide() elif code == GardenGlobals.FlowerItemNewEntry: diff --git a/toontown/estate/FlowerPhoto.py b/toontown/estate/FlowerPhoto.py index 956327b..b8cabae 100644 --- a/toontown/estate/FlowerPhoto.py +++ b/toontown/estate/FlowerPhoto.py @@ -2,7 +2,7 @@ from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.fishing import FishGlobals -import GardenGlobals +from . import GardenGlobals from direct.actor import Actor class DirectRegion(NodePath): @@ -42,9 +42,9 @@ class DirectRegion(NodePath): self.cCamNode.setScene(self.cRender) self.fishSwimCam = self.fishSwimCamera.attachNewNode(self.cCamNode) cm = CardMaker('displayRegionCard') - apply(cm.setFrame, self.bounds) + cm.setFrame(*self.bounds) self.card = card = self.attachNewNode(cm.generate()) - apply(card.setColor, self.color) + card.setColor(*self.color) newBounds = card.getTightBounds() ll = render2d.getRelativePoint(card, newBounds[0]) ur = render2d.getRelativePoint(card, newBounds[1]) @@ -52,7 +52,7 @@ class DirectRegion(NodePath): ur.getX(), ll.getZ(), ur.getZ()] - newBounds = map(lambda x: max(0.0, min(1.0, (x + 1.0) / 2.0)), newBounds) + newBounds = [max(0.0, min(1.0, (x + 1.0) / 2.0)) for x in newBounds] self.cDr = base.win.makeDisplayRegion(*newBounds) self.cDr.setSort(10) self.cDr.setClearColor(card.getColor()) @@ -115,8 +115,8 @@ class FlowerPhoto(NodePath): actor.setDepthWrite(1) if not hasattr(self, 'flowerDisplayRegion'): self.flowerDisplayRegion = DirectRegion(parent=self) - apply(self.flowerDisplayRegion.setBounds, self.swimBounds) - apply(self.flowerDisplayRegion.setColor, self.swimColor) + self.flowerDisplayRegion.setBounds(*self.swimBounds) + self.flowerDisplayRegion.setColor(*self.swimColor) frame = self.flowerDisplayRegion.load() pitch = frame.attachNewNode('pitch') rotate = pitch.attachNewNode('rotate') @@ -126,7 +126,7 @@ class FlowerPhoto(NodePath): center = (bMin + bMax) / 2.0 actor.setPos(-center[0], -center[1], -center[2]) attrib = GardenGlobals.PlantAttributes[self.species] - if attrib.has_key('photoPos'): + if 'photoPos' in attrib: self.notify.debug('oldPos = %s' % actor.getPos()) photoPos = attrib['photoPos'] self.notify.debug('newPos = %s' % str(photoPos)) diff --git a/toontown/estate/FlowerPicker.py b/toontown/estate/FlowerPicker.py index 1ed4f5b..dddb2b9 100644 --- a/toontown/estate/FlowerPicker.py +++ b/toontown/estate/FlowerPicker.py @@ -3,7 +3,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import FlowerPanel +from . import FlowerPanel class FlowerPicker(DirectScrolledList): notify = DirectNotifyGlobal.directNotify.newCategory('FlowerPicker') diff --git a/toontown/estate/FlowerSellGUI.py b/toontown/estate/FlowerSellGUI.py index ae457dc..ad48c79 100644 --- a/toontown/estate/FlowerSellGUI.py +++ b/toontown/estate/FlowerSellGUI.py @@ -4,8 +4,8 @@ from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from direct.task import Task -import FlowerBase -import FlowerPicker +from . import FlowerBase +from . import FlowerPicker class FlowerSellGUI(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('FlowerGui') diff --git a/toontown/estate/FlowerSpeciesPanel.py b/toontown/estate/FlowerSpeciesPanel.py index 104098f..9c9bd24 100644 --- a/toontown/estate/FlowerSpeciesPanel.py +++ b/toontown/estate/FlowerSpeciesPanel.py @@ -3,8 +3,8 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import GardenGlobals -import FlowerPhoto +from . import GardenGlobals +from . import FlowerPhoto from toontown.estate import BeanRecipeGui class FlowerSpeciesPanel(DirectFrame): diff --git a/toontown/estate/GardenDropGame.py b/toontown/estate/GardenDropGame.py index 2d9e760..88b1d3b 100644 --- a/toontown/estate/GardenDropGame.py +++ b/toontown/estate/GardenDropGame.py @@ -17,11 +17,11 @@ from direct.showbase import RandomNumGen from toontown.toonbase import TTLocalizer import random import random -import cPickle +import pickle from direct.showbase import PythonUtil -import GameSprite +from . import GameSprite from math import pi -import GardenProgressMeter +from . import GardenProgressMeter class GardenDropGame(DirectObject.DirectObject): @@ -62,7 +62,7 @@ class GardenDropGame(DirectObject.DirectObject): self.controlOffsetX = 0.0 self.controlOffsetZ = 0.0 self.queExtent = 3 - print 'Grid Dimensions X%s Z%s' % (gX, gZ) + print('Grid Dimensions X%s Z%s' % (gX, gZ)) self.grid = [] self.gridDimX = gX self.gridDimZ = gZ @@ -248,7 +248,7 @@ class GardenDropGame(DirectObject.DirectObject): tileDimZ = rangeZ / self.gridDimZ tileX = int(framedX / tileDimX) tileZ = int(framedZ / tileDimZ) - print 'find Grid tileX%s tileZ%s' % (tileX, tileZ) + print('find Grid tileX%s tileZ%s' % (tileX, tileZ)) return (tileX, tileZ) def findPos(self, x, z): @@ -258,7 +258,7 @@ class GardenDropGame(DirectObject.DirectObject): tileDimZ = rangeZ / self.gridDimZ posX = tileDimX * x + self.minX posZ = tileDimZ * z + self.minZ - print 'find Pos X%s Z%s' % (posX, posZ) + print('find Pos X%s Z%s' % (posX, posZ)) return (posX, posZ) def placeIntoGrid(self, sprite, x, z): @@ -268,7 +268,7 @@ class GardenDropGame(DirectObject.DirectObject): newX, newZ = self.findPos(x, z) sprite.setX(newX) sprite.setZ(newZ) - print 'Setting Final Pos X%s Z%s' % (newX, newZ) + print('Setting Final Pos X%s Z%s' % (newX, newZ)) else: self.placeIntoGrid(sprite, x + 1, z - 1) return @@ -336,7 +336,7 @@ class GardenDropGame(DirectObject.DirectObject): def addSprite(self, image, size = 0.5, posX = 0, posZ = 0, found = 0): nodeObj = DirectLabel(parent=self.frame, relief=None, image=image, pos=(posX, 0.0, posZ), scale=size, image_color=(1.0, 1.0, 1.0, 1)) - colorChoice = random.choice(range(0, 3)) + colorChoice = random.choice(list(range(0, 3))) newSprite = GameSprite.GameSprite(nodeObj, colorChoice, found) self.sprites.append(newSprite) if found: diff --git a/toontown/estate/GardenGlobals.py b/toontown/estate/GardenGlobals.py index dfe4ff6..91fa458 100644 --- a/toontown/estate/GardenGlobals.py +++ b/toontown/estate/GardenGlobals.py @@ -52,7 +52,7 @@ def getWateringCanPower(wateringCan, wateringCanSkill): def getMaxWateringCanPower(): retval = 0 - for wateringCanAttrib in WateringCanAttributes.values(): + for wateringCanAttrib in list(WateringCanAttributes.values()): retval += wateringCanAttrib['numBoxes'] return retval * WateringMult @@ -74,9 +74,9 @@ FLOWER_PINK = 4 FLOWER_YELLOW = 5 FLOWER_WHITE = 6 FLOWER_GREEN = 7 -ToonStatuaryTypeIndices = xrange(205, 209) -ChangingStatuaryTypeIndices = xrange(230, 232) -AnimatedStatuaryTypeIndices = xrange(234, 238) +ToonStatuaryTypeIndices = range(205, 209) +ChangingStatuaryTypeIndices = range(230, 232) +AnimatedStatuaryTypeIndices = range(234, 238) PlantAttributes = {49: {'name': TTLocalizer.FlowerSpeciesNames[49], 'plantType': FLOWER_TYPE, 'growthThresholds': (1, 1, 1), @@ -457,7 +457,7 @@ Recipes = {0: {'beans': 'RRR', def getRecipeKey(beans, special): testDict = {'beans': beans, 'special': special} - for key in Recipes.keys(): + for key in list(Recipes.keys()): recipe = Recipes[key] if testDict == recipe: return key @@ -466,7 +466,7 @@ def getRecipeKey(beans, special): def getRecipeKeyUsingSpecial(special): - for key in Recipes.keys(): + for key in list(Recipes.keys()): recipe = Recipes[key] if recipe['special'] == special: return key @@ -518,7 +518,7 @@ def getMaxShovelSkill(): def getNumberOfShovelBoxes(): retVal = 0 - for attrib in ShovelAttributes.values(): + for attrib in list(ShovelAttributes.values()): retVal += attrib['numBoxes'] return retVal @@ -526,7 +526,7 @@ def getNumberOfShovelBoxes(): def getNumberOfWateringCanBoxes(): retVal = 0 - for attrib in WateringCanAttributes.values(): + for attrib in list(WateringCanAttributes.values()): retVal += attrib['numBoxes'] return retVal @@ -534,7 +534,7 @@ def getNumberOfWateringCanBoxes(): def getNumberOfFlowerVarieties(): retVal = 0 - for attrib in PlantAttributes.values(): + for attrib in list(PlantAttributes.values()): if attrib['plantType'] == FLOWER_TYPE: retVal += len(attrib['varieties']) @@ -543,7 +543,7 @@ def getNumberOfFlowerVarieties(): def getNumberOfFlowerSpecies(): retVal = 0 - for attrib in PlantAttributes.values(): + for attrib in list(PlantAttributes.values()): if attrib['plantType'] == FLOWER_TYPE: retVal += 1 @@ -552,7 +552,7 @@ def getNumberOfFlowerSpecies(): def getFlowerVarieties(species): retval = () - if species in PlantAttributes.keys(): + if species in list(PlantAttributes.keys()): attrib = PlantAttributes[species] if attrib['plantType'] == FLOWER_TYPE: retval = attrib['varieties'] @@ -561,7 +561,7 @@ def getFlowerVarieties(species): def getFlowerSpecies(): retVal = [] - for key in PlantAttributes.keys(): + for key in list(PlantAttributes.keys()): attrib = PlantAttributes[key] if attrib['plantType'] == FLOWER_TYPE: retVal.append(key) @@ -577,7 +577,7 @@ def getRandomFlower(): def getFlowerVarietyName(species, variety): retVal = TTLocalizer.FlowerUnknown - if species in PlantAttributes.keys(): + if species in list(PlantAttributes.keys()): attrib = PlantAttributes[species] if variety < len(attrib['varieties']): funnySpeciesNameList = TTLocalizer.FlowerFunnyNames.get(species) @@ -592,11 +592,11 @@ def getFlowerVarietyName(species, variety): def getSpeciesVarietyGivenRecipe(recipeKey): - for species in PlantAttributes.keys(): + for species in list(PlantAttributes.keys()): attrib = PlantAttributes[species] if attrib['plantType'] == GAG_TREE_TYPE: continue - if attrib.has_key('varieties'): + if 'varieties' in attrib: for variety in range(len(attrib['varieties'])): if attrib['varieties'][variety][0] == recipeKey: return (species, variety) @@ -608,14 +608,14 @@ def getNumBeansRequired(species, variety): retval = -1 if not PlantAttributes.get(species): return retval - if not PlantAttributes[species].has_key('varieties'): + if 'varieties' not in PlantAttributes[species]: return retval if variety >= len(PlantAttributes[species]['varieties']): return -1 recipeKey = PlantAttributes[species]['varieties'][variety][0] recipe = Recipes.get(recipeKey) if recipe: - if recipe.has_key('beans'): + if 'beans' in recipe: retval = len(recipe['beans']) return retval @@ -625,7 +625,7 @@ def validateRecipes(notify): uniqueBeans = [] numBoxes = getNumberOfShovelBoxes() uniqueSpecials = [] - for key in Recipes.keys(): + for key in list(Recipes.keys()): recipe = Recipes[key] beans = recipe['beans'] if len(beans) > numBoxes: @@ -655,7 +655,7 @@ def validatePlantAttributes(notify): for i in range(getNumberOfShovelBoxes() + 1): flowerRecipeDistribution.append([]) - for key in PlantAttributes.keys(): + for key in list(PlantAttributes.keys()): plant = PlantAttributes[key] notify.debug('now validating %s' % plant['name']) if plant['plantType'] in (GAG_TREE_TYPE, FLOWER_TYPE): @@ -1474,7 +1474,7 @@ def getPlantItWithString(special): return retval -for specialKey in Specials.keys(): +for specialKey in list(Specials.keys()): recipeKey = getRecipeKeyUsingSpecial(specialKey) if not recipeKey == -1: Specials[specialKey]['description'] = getPlantItWithString(specialKey) diff --git a/toontown/estate/GardenProgressMeter.py b/toontown/estate/GardenProgressMeter.py index ff9917c..56d299a 100644 --- a/toontown/estate/GardenProgressMeter.py +++ b/toontown/estate/GardenProgressMeter.py @@ -16,9 +16,9 @@ from direct.showbase import RandomNumGen from toontown.toonbase import TTLocalizer import random import random -import cPickle +import pickle from direct.showbase import PythonUtil -import GameSprite +from . import GameSprite from math import pi from toontown.estate import GardenGlobals SHOVEL = 0 @@ -35,7 +35,7 @@ class GardenProgressMeter(DirectObject.DirectObject): elif typePromotion == 'game': self.typePromotion == GAMEWIN else: - print 'No type of %s' % typePromotion + print('No type of %s' % typePromotion) self.level = level self.acceptErrorDialog = None self.doneEvent = 'game Done' diff --git a/toontown/estate/SpecialsPhoto.py b/toontown/estate/SpecialsPhoto.py index 6fd3813..1180a03 100644 --- a/toontown/estate/SpecialsPhoto.py +++ b/toontown/estate/SpecialsPhoto.py @@ -2,7 +2,7 @@ from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.fishing import FishGlobals -import GardenGlobals +from . import GardenGlobals from direct.actor import Actor import random @@ -43,9 +43,9 @@ class DirectRegion(NodePath): self.cCamNode.setScene(self.cRender) self.fishSwimCam = self.fishSwimCamera.attachNewNode(self.cCamNode) cm = CardMaker('displayRegionCard') - apply(cm.setFrame, self.bounds) + cm.setFrame(*self.bounds) self.card = card = self.attachNewNode(cm.generate()) - apply(card.setColor, self.color) + card.setColor(*self.color) newBounds = card.getTightBounds() ll = render2d.getRelativePoint(card, newBounds[0]) ur = render2d.getRelativePoint(card, newBounds[1]) @@ -53,7 +53,7 @@ class DirectRegion(NodePath): ur.getX(), ll.getZ(), ur.getZ()] - newBounds = map(lambda x: max(0.0, min(1.0, (x + 1.0) / 2.0)), newBounds) + newBounds = [max(0.0, min(1.0, (x + 1.0) / 2.0)) for x in newBounds] self.cDr = base.win.makeDisplayRegion(*newBounds) self.cDr.setSort(10) self.cDr.setClearColor(card.getColor()) @@ -120,8 +120,8 @@ class SpecialsPhoto(NodePath): actor.setDepthWrite(1) if not hasattr(self, 'specialsDisplayRegion'): self.specialsDisplayRegion = DirectRegion(parent=self) - apply(self.specialsDisplayRegion.setBounds, self.backBounds) - apply(self.specialsDisplayRegion.setColor, self.backColor) + self.specialsDisplayRegion.setBounds(*self.backBounds) + self.specialsDisplayRegion.setColor(*self.backColor) frame = self.specialsDisplayRegion.load() pitch = frame.attachNewNode('pitch') rotate = pitch.attachNewNode('rotate') diff --git a/toontown/estate/ToonStatueSelectionGUI.py b/toontown/estate/ToonStatueSelectionGUI.py index 0bf5e6b..589bbd5 100644 --- a/toontown/estate/ToonStatueSelectionGUI.py +++ b/toontown/estate/ToonStatueSelectionGUI.py @@ -133,7 +133,7 @@ class ToonStatueSelectionGUI(DirectFrame): if self.checkFamily(friendId): if friendId == base.localAvatar.doId: self.createPreviewToon(base.localAvatar.style) - elif self.doId2Dna.has_key(friendId): + elif friendId in self.doId2Dna: self.createPreviewToon(self.doId2Dna[friendId]) else: familyAvatar = DistributedToon.DistributedToon(base.cr) diff --git a/toontown/estate/TrunkGUI.py b/toontown/estate/TrunkGUI.py index 11f0b5f..eedce9d 100644 --- a/toontown/estate/TrunkGUI.py +++ b/toontown/estate/TrunkGUI.py @@ -4,7 +4,7 @@ from pandac.PandaModules import * from direct.distributed import ClockDelta from direct.fsm import StateData from direct.task.Task import Task -import ClosetGlobals +from . import ClosetGlobals from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TTDialog diff --git a/toontown/estate/houseDesign.py b/toontown/estate/houseDesign.py index 6d156c7..e8c5e08 100644 --- a/toontown/estate/houseDesign.py +++ b/toontown/estate/houseDesign.py @@ -539,7 +539,7 @@ class ObjectManager(NodePath, DirectObject): self.selectedObject.wrtReparentTo(self.targetNodePath) self.selectedObject.collisionNodePath.unstash() self.selectedObject.dfitem.stopAdjustPosHpr() - for object in self.objectDict.values(): + for object in list(self.objectDict.values()): object.unstashBuiltInCollisionNodes() self.centerMarker['image'] = [self.grabUp, self.grabDown, self.grabRollover] @@ -553,7 +553,7 @@ class ObjectManager(NodePath, DirectObject): def moveObjectContinue(self, *args): messenger.send('wakeup') if self.selectedObject: - for object in self.objectDict.values(): + for object in list(self.objectDict.values()): object.stashBuiltInCollisionNodes() self.selectedObject.collisionNodePath.stash() @@ -648,7 +648,7 @@ class ObjectManager(NodePath, DirectObject): entry = self.iSegment.findNextCollisionEntry(skipFlags=SKIP_CAMERA | SKIP_UNPICKABLE) if offsetDict: - keys = offsetDict.keys() + keys = list(offsetDict.keys()) ortho1 = offsetDict[keys[0]] ortho2 = Vec3(0) v1 = Vec3(ortho1) @@ -820,7 +820,7 @@ class ObjectManager(NodePath, DirectObject): self.selectedObject.wrtReparentTo(self.collisionOffsetNP) def resetFurniture(self): - for o in self.objectDict.values(): + for o in list(self.objectDict.values()): o.resetMovableObject() self.objectDict = {} @@ -1045,7 +1045,7 @@ class ObjectManager(NodePath, DirectObject): def createInRoomPicker(self): self.inRoomPanels = [] - for objectId, object in self.objectDict.items(): + for objectId, object in list(self.objectDict.items()): panel = FurnitureItemPanel(object.dfitem.item, objectId, command=self.requestReturnToAttic, deleteMode=self.deleteMode, withinFunc=self.pickInRoom, helpCategory='FurnitureItemPanelRoom') self.inRoomPanels.append(panel) @@ -1265,14 +1265,14 @@ class ObjectManager(NodePath, DirectObject): if abs(pos[0]) > 3000 or abs(pos[1]) > 3000 or abs(pos[2]) > 300: self.notify.warning('bringItemFromAttic extreme pos targetNodePath=%s avatar=%s %s' % (repr(self.targetNodePath.getPos(render)), repr(base.localAvatar.getPos(render)), repr(pos))) if item.getFlags() & CatalogFurnitureItem.FLPainting: - for object in self.objectDict.values(): + for object in list(self.objectDict.values()): object.stashBuiltInCollisionNodes() self.gridSnapNP.setPosHpr(0, 0, 0, 0, 0, 0) target = self.targetNodePath self.iRay.setParentNP(base.localAvatar) entry = self.iRay.pickBitMask3D(bitMask=ToontownGlobals.WallBitmask, targetNodePath=target, origin=Point3(0, 0, 6), dir=Vec3(0, 1, 0), skipFlags=SKIP_BACKFACE | SKIP_CAMERA | SKIP_UNPICKABLE) - for object in self.objectDict.values(): + for object in list(self.objectDict.values()): object.unstashBuiltInCollisionNodes() if entry: @@ -1645,7 +1645,7 @@ class ObjectManager(NodePath, DirectObject): self.helpText['text'] = helpText self.helpText.show() else: - print 'category: %s not found' + print('category: %s not found') taskMgr.doMethodLater(0.75, showIt, 'showHelpTextDoLater') diff --git a/toontown/fishing/BingoCardBase.py b/toontown/fishing/BingoCardBase.py index 4fe0763..9b58dbb 100644 --- a/toontown/fishing/BingoCardBase.py +++ b/toontown/fishing/BingoCardBase.py @@ -24,7 +24,7 @@ class BingoCardBase: fishList = FishGlobals.getPondGeneraList(zoneId) emptyCells = self.cardSize - 1 - len(fishList) rodId = 0 - for i in xrange(emptyCells): + for i in range(emptyCells): fish = FishGlobals.getRandomFishVitals(zoneId, rodId, rng) while not fish[0]: fish = FishGlobals.getRandomFishVitals(zoneId, rodId, rng) @@ -34,7 +34,7 @@ class BingoCardBase: if rodId > 4: rodId = 0 - for index in xrange(self.cardSize): + for index in range(self.cardSize): if index != self.cardSize / 2: choice = rng.randrange(0, len(fishList)) self.cellList.append(fishList.pop(choice)) @@ -84,14 +84,14 @@ class BingoCardBase: pass def rowCheck(self, rowId): - for colId in xrange(self.colSize): + for colId in range(self.colSize): if not self.gameState & 1 << self.rowSize * rowId + colId: return 0 return 1 def colCheck(self, colId): - for rowId in xrange(self.rowSize): + for rowId in range(self.rowSize): if not self.gameState & 1 << self.rowSize * rowId + colId: return 0 @@ -100,7 +100,7 @@ class BingoCardBase: def fDiagCheck(self, id): checkNum = self.rowSize + 1 if not id % checkNum: - for i in xrange(self.rowSize): + for i in range(self.rowSize): if not self.gameState & 1 << i * checkNum: return 0 @@ -111,7 +111,7 @@ class BingoCardBase: def bDiagCheck(self, id): checkNum = self.rowSize - 1 if not id % checkNum and not id == self.cardSize - 1: - for i in xrange(self.rowSize): + for i in range(self.rowSize): if not self.gameState & 1 << i * checkNum + checkNum: return 0 diff --git a/toontown/fishing/BingoCardGui.py b/toontown/fishing/BingoCardGui.py index e557d62..630658e 100644 --- a/toontown/fishing/BingoCardGui.py +++ b/toontown/fishing/BingoCardGui.py @@ -149,7 +149,7 @@ class BingoCardGui(DirectFrame): def loadCard(self): cardSize = self.game.getCardSize() - for index in xrange(cardSize): + for index in range(cardSize): self.cellGuiList[index].generateLogo() if index == cardSize / 2: self.cellGuiList[index].generateMarkedLogo() @@ -158,13 +158,13 @@ class BingoCardGui(DirectFrame): def disableCard(self): self.stopCellBlinking() - for index in xrange(self.game.getCardSize()): + for index in range(self.game.getCardSize()): self.cellGuiList[index].disable() def enableCard(self, callback = None): self.notify.info('enable Bingo card') self.stopCellBlinking() - for index in xrange(len(self.cellGuiList)): + for index in range(len(self.cellGuiList)): if index != self.game.getCardSize() / 2: self.cellGuiList[index].enable(callback) @@ -172,7 +172,7 @@ class BingoCardGui(DirectFrame): rng = RandomNumGen.RandomNumGen(tileSeed) rowSize = self.game.getRowSize() fishList = FishGlobals.getPondGeneraList(zoneId) - for i in xrange(len(fishList)): + for i in range(len(fishList)): fishTuple = fishList.pop(0) weight = FishGlobals.getRandomWeight(fishTuple[0], fishTuple[1]) fish = FishBase.FishBase(fishTuple[0], fishTuple[1], weight) @@ -180,7 +180,7 @@ class BingoCardGui(DirectFrame): emptyCells = self.game.getCardSize() - 1 - len(fishList) rodId = 0 - for i in xrange(emptyCells): + for i in range(emptyCells): fishVitals = FishGlobals.getRandomFishVitals(zoneId, rodId, rng) while not fishVitals[0]: fishVitals = FishGlobals.getRandomFishVitals(zoneId, rodId, rng) @@ -191,8 +191,8 @@ class BingoCardGui(DirectFrame): if rodId > 4: rodId = 0 - for i in xrange(rowSize): - for j in xrange(self.game.getColSize()): + for i in range(rowSize): + for j in range(self.game.getColSize()): color = self.getCellColor(i * rowSize + j) if i * rowSize + j == self.game.getCardSize() / 2: tmpFish = 'Free' diff --git a/toontown/fishing/BingoGlobals.py b/toontown/fishing/BingoGlobals.py index e05932e..5f1ff49 100644 --- a/toontown/fishing/BingoGlobals.py +++ b/toontown/fishing/BingoGlobals.py @@ -48,17 +48,17 @@ def getJackpot(typeId): def getColor(typeId): - float_color = map(lambda x: x / 255.0, CardTypeDict[typeId][0][0]) + float_color = [x / 255.0 for x in CardTypeDict[typeId][0][0]] return float_color def getButtonColor(typeId): - float_color = map(lambda x: x / 255.0, CardTypeDict[typeId][0][1]) + float_color = [x / 255.0 for x in CardTypeDict[typeId][0][1]] return float_color def getButtonRolloverColor(typeId): - float_color = map(lambda x: x / 255.0, CardTypeDict[typeId][0][2]) + float_color = [x / 255.0 for x in CardTypeDict[typeId][0][2]] return float_color diff --git a/toontown/fishing/BlockoutBingo.py b/toontown/fishing/BlockoutBingo.py index 0d7b109..b5d8afb 100644 --- a/toontown/fishing/BlockoutBingo.py +++ b/toontown/fishing/BlockoutBingo.py @@ -10,7 +10,7 @@ class BlockoutBingo(BingoCardBase.BingoCardBase): self.gameType = BingoGlobals.BLOCKOUT_CARD def checkForWin(self, id = 0): - for i in xrange(self.rowSize): + for i in range(self.rowSize): if not self.rowCheck(i): return BingoGlobals.NO_UPDATE diff --git a/toontown/fishing/DistributedFishingPond.py b/toontown/fishing/DistributedFishingPond.py index 6faaee5..026e974 100644 --- a/toontown/fishing/DistributedFishingPond.py +++ b/toontown/fishing/DistributedFishingPond.py @@ -2,7 +2,7 @@ from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer -import FishGlobals +from . import FishGlobals from toontown.fishing import DistributedPondBingoManager from pandac.PandaModules import Vec3 from direct.task import Task @@ -60,7 +60,7 @@ class DistributedFishingPond(DistributedObject.DistributedObject): def checkTargets(self, task = None): self.notify.debug('checkTargets') if self.localToonSpot != None: - for target in self.targets.values(): + for target in list(self.targets.values()): targetPos = target.getPos(render) distVec = Vec3(targetPos - self.localToonBobPos) dist = distVec.length() @@ -106,7 +106,7 @@ class DistributedFishingPond(DistributedObject.DistributedObject): def setLocalToonSpot(self, spot = None): self.localToonSpot = spot - if spot is not None and not self.visitedSpots.has_key(spot.getDoId()): + if spot is not None and spot.getDoId() not in self.visitedSpots: self.visitedSpots[spot.getDoId()] = spot return @@ -118,9 +118,9 @@ class DistributedFishingPond(DistributedObject.DistributedObject): return self.localToonSpot def resetSpotGui(self): - for spot in self.visitedSpots.values(): + for spot in list(self.visitedSpots.values()): spot.resetCastGui() def setSpotGui(self): - for spot in self.visitedSpots.values(): + for spot in list(self.visitedSpots.values()): spot.setCastGui() diff --git a/toontown/fishing/DistributedFishingTarget.py b/toontown/fishing/DistributedFishingTarget.py index 210ee97..c89f49d 100644 --- a/toontown/fishing/DistributedFishingTarget.py +++ b/toontown/fishing/DistributedFishingTarget.py @@ -8,7 +8,7 @@ from direct.fsm import State from direct.directutil import Mopath from toontown.toonbase import ToontownGlobals from direct.actor import Actor -import FishingTargetGlobals +from . import FishingTargetGlobals import random import math from toontown.effects import Bubbles diff --git a/toontown/fishing/FishBase.py b/toontown/fishing/FishBase.py index 58dd800..a339117 100644 --- a/toontown/fishing/FishBase.py +++ b/toontown/fishing/FishBase.py @@ -1,4 +1,4 @@ -import FishGlobals +from . import FishGlobals from toontown.toonbase import TTLocalizer from direct.directnotify import DirectNotifyGlobal diff --git a/toontown/fishing/FishBrowser.py b/toontown/fishing/FishBrowser.py index 71e65ea..226e080 100644 --- a/toontown/fishing/FishBrowser.py +++ b/toontown/fishing/FishBrowser.py @@ -3,8 +3,8 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import GenusPanel -import FishGlobals +from . import GenusPanel +from . import FishGlobals class FishBrowser(DirectScrolledList): notify = DirectNotifyGlobal.directNotify.newCategory('FishBrowser') @@ -31,7 +31,7 @@ class FishBrowser(DirectScrolledList): ('decButton_pos', (0, 0, 0.525), None), ('decButton_image3_color', Vec4(0.8, 0.8, 0.8, 0.5), None), ('numItemsVisible', 1, None), - ('items', map(str, FishGlobals.getGenera()), None), + ('items', list(map(str, FishGlobals.getGenera())), None), ('scrollSpeed', 4, None), ('itemMakeFunction', GenusPanel.GenusPanel, None), ('itemMakeExtraArgs', None, None)) diff --git a/toontown/fishing/FishCollection.py b/toontown/fishing/FishCollection.py index 31566f3..60d863f 100644 --- a/toontown/fishing/FishCollection.py +++ b/toontown/fishing/FishCollection.py @@ -1,5 +1,5 @@ -import FishBase -import FishGlobals +from . import FishBase +from . import FishGlobals class FishCollection: diff --git a/toontown/fishing/FishGlobals.py b/toontown/fishing/FishGlobals.py index 6c02d1e..62f1b6c 100644 --- a/toontown/fishing/FishGlobals.py +++ b/toontown/fishing/FishGlobals.py @@ -22,7 +22,7 @@ BingoBoot = (BootItem, 99) ProbabilityDict = {93: FishItem, 94: JellybeanItem, 100: BootItem} -SortedProbabilityCutoffs = ProbabilityDict.keys() +SortedProbabilityCutoffs = list(ProbabilityDict.keys()) SortedProbabilityCutoffs.sort() Rod2JellybeanDict = {0: 10, 1: 20, @@ -596,7 +596,7 @@ def getSpecies(genus): def getGenera(): - return __fishDict.keys() + return list(__fishDict.keys()) ROD_WEIGHT_MIN_INDEX = 0 @@ -719,7 +719,7 @@ for rodIndex in __rodDict: __anywhereDict = copy.deepcopy(__emptyRodDict) __pondInfoDict = {} -for genus, speciesList in __fishDict.items(): +for genus, speciesList in list(__fishDict.items()): for species in range(len(speciesList)): __totalNumFish += 1 speciesDesc = speciesList[species] @@ -729,7 +729,7 @@ for genus, speciesList in __fishDict.items(): zone = zoneList[zoneIndex] effectiveRarity = getEffectiveRarity(rarity, zoneIndex) if zone == Anywhere: - for rodIndex, rarityDict in __anywhereDict.items(): + for rodIndex, rarityDict in list(__anywhereDict.items()): if canBeCaughtByRod(genus, species, rodIndex): fishList = rarityDict.setdefault(effectiveRarity, []) fishList.append((genus, species)) @@ -740,25 +740,25 @@ for genus, speciesList in __fishDict.items(): if subZones: pondZones.extend(subZones) for pondZone in pondZones: - if __pondInfoDict.has_key(pondZone): + if pondZone in __pondInfoDict: rodDict = __pondInfoDict[pondZone] else: rodDict = copy.deepcopy(__emptyRodDict) __pondInfoDict[pondZone] = rodDict - for rodIndex, rarityDict in rodDict.items(): + for rodIndex, rarityDict in list(rodDict.items()): if canBeCaughtByRod(genus, species, rodIndex): fishList = rarityDict.setdefault(effectiveRarity, []) fishList.append((genus, species)) -for zone, rodDict in __pondInfoDict.items(): - for rodIndex, anywhereRarityDict in __anywhereDict.items(): - for rarity, anywhereFishList in anywhereRarityDict.items(): +for zone, rodDict in list(__pondInfoDict.items()): + for rodIndex, anywhereRarityDict in list(__anywhereDict.items()): + for rarity, anywhereFishList in list(anywhereRarityDict.items()): rarityDict = rodDict[rodIndex] fishList = rarityDict.setdefault(rarity, []) fishList.extend(anywhereFishList) def getPondDict(zoneId): - print __pondInfoDict[zoneId] + print(__pondInfoDict[zoneId]) def getTotalNumFish(): @@ -780,15 +780,15 @@ def testRarity(rodId = 0, numIter = 100000): v = __rollRarityDice(rodId) d[v] += 1 - for rarity, count in d.items(): + for rarity, count in list(d.items()): percentage = count / float(numIter) * 100 d[rarity] = percentage - print d + print(d) def getRandomFish(): - genus = random.choice(__fishDict.keys()) + genus = random.choice(list(__fishDict.keys())) species = random.randint(0, len(__fishDict[genus]) - 1) return (genus, species) @@ -799,10 +799,10 @@ def getPondInfo(): def getSimplePondInfo(): info = {} - for pondId, pondInfo in __pondInfoDict.items(): + for pondId, pondInfo in list(__pondInfoDict.items()): pondFishList = [] - for rodId, rodInfo in pondInfo.items(): - for rarity, fishList in rodInfo.items(): + for rodId, rodInfo in list(pondInfo.items()): + for rarity, fishList in list(rodInfo.items()): for fish in fishList: if fish not in pondFishList: pondFishList.append(fish) @@ -827,13 +827,13 @@ def getPondGeneraList(pondId): def printNumGeneraPerPond(): pondInfo = getSimplePondInfo() - for pondId, fishList in pondInfo.items(): + for pondId, fishList in list(pondInfo.items()): generaList = [] for fish in fishList: if fish[0] not in generaList: generaList.append(fish[0]) - print 'Pond %s has %s Genera' % (pondId, len(generaList)) + print('Pond %s has %s Genera' % (pondId, len(generaList))) def generateFishingReport(numCasts = 10000, hitRate = 0.8): @@ -868,22 +868,22 @@ def generateFishingReport(numCasts = 10000, hitRate = 0.8): totalRodMoney[rod] += value numPonds = len(totalPondMoney) - for pond, money in totalPondMoney.items(): + for pond, money in list(totalPondMoney.items()): baitCost = 0 for rod in range(MaxRodId + 1): baitCost += getCastCost(rod) totalCastCost = baitCost * numCasts - print ('pond: %s totalMoney: %s profit: %s perCast: %s' % (pond, + print(('pond: %s totalMoney: %s profit: %s perCast: %s' % (pond, money, money - totalCastCost, - (money - totalCastCost) / float(numCasts * (MaxRodId + 1))),) + (money - totalCastCost) / float(numCasts * (MaxRodId + 1))),)) - for rod, money in totalRodMoney.items(): + for rod, money in list(totalRodMoney.items()): baitCost = getCastCost(rod) totalCastCost = baitCost * (numCasts * numPonds) - print ('rod: %s totalMoney: %s castCost: %s profit: %s perCast: %s' % (rod, + print(('rod: %s totalMoney: %s castCost: %s profit: %s perCast: %s' % (rod, money, totalCastCost, money - totalCastCost, - (money - totalCastCost) / float(numCasts * numPonds)),) + (money - totalCastCost) / float(numCasts * numPonds)),)) diff --git a/toontown/fishing/FishPanel.py b/toontown/fishing/FishPanel.py index 3df3478..63450f1 100644 --- a/toontown/fishing/FishPanel.py +++ b/toontown/fishing/FishPanel.py @@ -4,8 +4,8 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer from direct.interval.IntervalGlobal import * -import FishGlobals -import FishPhoto +from . import FishGlobals +from . import FishPhoto class FishPanel(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('FishPanel') @@ -91,8 +91,8 @@ class FishPanel(DirectFrame): def show(self, code = FishGlobals.FishItem): messenger.send('wakeup') - apply(self.photo.setSwimBounds, self.swimBounds) - apply(self.photo.setSwimColor, self.swimColor) + self.photo.setSwimBounds(*self.swimBounds) + self.photo.setSwimColor(*self.swimColor) if code == FishGlobals.FishItem: self.extraLabel.hide() elif code == FishGlobals.FishItemNewEntry: diff --git a/toontown/fishing/FishPhoto.py b/toontown/fishing/FishPhoto.py index 56bf11b..c4c053d 100644 --- a/toontown/fishing/FishPhoto.py +++ b/toontown/fishing/FishPhoto.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import FishGlobals +from . import FishGlobals class DirectRegion(NodePath): notify = DirectNotifyGlobal.directNotify.newCategory('DirectRegion') @@ -38,9 +38,9 @@ class DirectRegion(NodePath): self.cCamNode.setScene(self.cRender) self.fishSwimCam = self.fishSwimCamera.attachNewNode(self.cCamNode) cm = CardMaker('displayRegionCard') - apply(cm.setFrame, self.bounds) + cm.setFrame(*self.bounds) self.card = card = self.attachNewNode(cm.generate()) - apply(card.setColor, self.color) + card.setColor(*self.color) newBounds = card.getTightBounds() ll = render2d.getRelativePoint(card, newBounds[0]) ur = render2d.getRelativePoint(card, newBounds[1]) @@ -48,7 +48,7 @@ class DirectRegion(NodePath): ur.getX(), ll.getZ(), ur.getZ()] - newBounds = map(lambda x: max(0.0, min(1.0, (x + 1.0) / 2.0)), newBounds) + newBounds = [max(0.0, min(1.0, (x + 1.0) / 2.0)) for x in newBounds] self.cDr = base.win.makeDisplayRegion(*newBounds) self.cDr.setSort(10) self.cDr.setClearColor(card.getColor()) @@ -108,8 +108,8 @@ class FishPhoto(NodePath): actor.setDepthWrite(1) if not hasattr(self, 'fishDisplayRegion'): self.fishDisplayRegion = DirectRegion(parent=self) - apply(self.fishDisplayRegion.setBounds, self.swimBounds) - apply(self.fishDisplayRegion.setColor, self.swimColor) + self.fishDisplayRegion.setBounds(*self.swimBounds) + self.fishDisplayRegion.setColor(*self.swimColor) frame = self.fishDisplayRegion.load() pitch = frame.attachNewNode('pitch') rotate = pitch.attachNewNode('rotate') diff --git a/toontown/fishing/FishPicker.py b/toontown/fishing/FishPicker.py index 9396f9c..a8766ea 100644 --- a/toontown/fishing/FishPicker.py +++ b/toontown/fishing/FishPicker.py @@ -3,7 +3,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import FishPanel +from . import FishPanel class FishPicker(DirectScrolledList): notify = DirectNotifyGlobal.directNotify.newCategory('FishPicker') diff --git a/toontown/fishing/FishSellGUI.py b/toontown/fishing/FishSellGUI.py index 4cc538f..bbb2dab 100644 --- a/toontown/fishing/FishSellGUI.py +++ b/toontown/fishing/FishSellGUI.py @@ -4,8 +4,8 @@ from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from direct.task import Task -import FishBase -import FishPicker +from . import FishBase +from . import FishPicker class FishSellGUI(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('FishGui') diff --git a/toontown/fishing/FishTank.py b/toontown/fishing/FishTank.py index 3bb2e1e..5ff7aad 100644 --- a/toontown/fishing/FishTank.py +++ b/toontown/fishing/FishTank.py @@ -1,5 +1,5 @@ -import FishBase -import FishGlobals +from . import FishBase +from . import FishGlobals class FishTank: diff --git a/toontown/fishing/GenusPanel.py b/toontown/fishing/GenusPanel.py index 94e30d3..4d2b074 100644 --- a/toontown/fishing/GenusPanel.py +++ b/toontown/fishing/GenusPanel.py @@ -3,9 +3,9 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import FishBase -import FishGlobals -import FishPhoto +from . import FishBase +from . import FishGlobals +from . import FishPhoto class GenusPanel(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('GenusPanel') diff --git a/toontown/fishing/NormalBingo.py b/toontown/fishing/NormalBingo.py index f2b7cf7..5633b37 100644 --- a/toontown/fishing/NormalBingo.py +++ b/toontown/fishing/NormalBingo.py @@ -27,7 +27,7 @@ class NormalBingo(BingoCardBase.BingoCardBase): id = self.cardSize / 2 if self.checkForWin(id): return BingoGlobals.WIN - for i in xrange(BingoGlobals.CARD_ROWS): + for i in range(BingoGlobals.CARD_ROWS): if i != BingoGlobals.CARD_ROWS / 2: rowResult = self.rowCheck(i) colResult = self.colCheck(i) diff --git a/toontown/friends/FriendInvitee.py b/toontown/friends/FriendInvitee.py index c05e3e5..5093645 100644 --- a/toontown/friends/FriendInvitee.py +++ b/toontown/friends/FriendInvitee.py @@ -59,12 +59,12 @@ class FriendInvitee(ToonHeadDialog.ToonHeadDialog): return def __handleButton(self, value): - print 'handleButton' + print('handleButton') if value == DGG.DIALOG_OK: if base.friendMode == 0: base.cr.friendManager.up_inviteeFriendResponse(1, self.context) elif base.friendMode == 1: - print 'sending Request Invite' + print('sending Request Invite') base.cr.avatarFriendsManager.sendRequestInvite(self.avId) elif base.friendMode == 0: base.cr.friendManager.up_inviteeFriendResponse(0, self.context) diff --git a/toontown/friends/FriendInviter.py b/toontown/friends/FriendInviter.py index 9324645..b2242fe 100644 --- a/toontown/friends/FriendInviter.py +++ b/toontown/friends/FriendInviter.py @@ -219,10 +219,10 @@ class FriendInviter(DirectFrame): def enterCheckAvailability(self): self.accept(self.avDisableName, self.__handleDisableAvatar) if not self.playerFriend: - if not base.cr.doId2do.has_key(self.avId): + if self.avId not in base.cr.doId2do: self.fsm.request('wentAway') return - if not base.cr.doId2do.has_key(self.avId): + if self.avId not in base.cr.doId2do: self.fsm.request('wentAway') return else: @@ -363,7 +363,7 @@ class FriendInviter(DirectFrame): base.cr.removeFriend(self.avId) self['text'] = OTPLocalizer.FriendInviterFriendsNoMore % self.getName() self.bOk.show() - if not base.cr.doId2do.has_key(self.avId): + if self.avId not in base.cr.doId2do: messenger.send(self.avDisableName) def exitFriendsNoMore(self): diff --git a/toontown/friends/FriendNotifier.py b/toontown/friends/FriendNotifier.py index 61982fe..8510f98 100644 --- a/toontown/friends/FriendNotifier.py +++ b/toontown/friends/FriendNotifier.py @@ -40,7 +40,7 @@ class FriendNotifier(ToonHeadDialog.ToonHeadDialog): return def cleanup(self): - print 'cleanup calling!' + print('cleanup calling!') ToonHeadDialog.ToonHeadDialog.cleanup(self) def __handleButton(self, value): diff --git a/toontown/friends/FriendsListManager.py b/toontown/friends/FriendsListManager.py index eabeec7..597d11e 100644 --- a/toontown/friends/FriendsListManager.py +++ b/toontown/friends/FriendsListManager.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * from libotp import * -import FriendsListPanel -import FriendInviter -import FriendInvitee -import FriendNotifier +from . import FriendsListPanel +from . import FriendInviter +from . import FriendInvitee +from . import FriendNotifier from direct.directnotify import DirectNotifyGlobal from toontown.toon import ToonTeleportPanel from toontown.friends import ToontownFriendSecret @@ -16,7 +16,7 @@ from toontown.toon import ToonAvatarDetailPanel from toontown.toon import PlayerDetailPanel from toontown.toonbase import ToontownGlobals from toontown.toon import Toon -import FriendHandle +from . import FriendHandle from otp.otpbase import OTPGlobals class FriendsListManager: @@ -182,7 +182,7 @@ class FriendsListManager: else: friendToon = base.cr.doId2do.get(avId) if friendToon: - print 'got toon' + print('got toon') dna = friendToon.getStyle() FriendNotifier.FriendNotifier(avId, friendToon.getName(), dna, None) return diff --git a/toontown/friends/FriendsListPanel.py b/toontown/friends/FriendsListPanel.py index eab9d65..1f34dd1 100644 --- a/toontown/friends/FriendsListPanel.py +++ b/toontown/friends/FriendsListPanel.py @@ -217,7 +217,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData): if showType == 1 and playerId: if not playerName: return - print 'ABORTING!!!' + print('ABORTING!!!') friendName = playerName rolloverName = toonName else: @@ -365,7 +365,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData): if self.panelType == FLPPlayers: playerFriendList = base.cr.playerFriendsManager.playerFriendsList for playerFriendId in playerFriendList: - if base.cr.playerFriendsManager.playerId2Info.has_key(playerFriendId): + if playerFriendId in base.cr.playerFriendsManager.playerId2Info: playerFriendInfo = base.cr.playerFriendsManager.playerId2Info.get(playerFriendId) if playerFriendInfo.onlineYesNo: if playerFriendInfo.understandableYesNo: @@ -403,7 +403,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData): if self.panelType == FLPOnlinePlayers: playerFriendList = base.cr.playerFriendsManager.playerFriendsList for playerFriendId in playerFriendList: - if base.cr.playerFriendsManager.playerId2Info.has_key(playerFriendId): + if playerFriendId in base.cr.playerFriendsManager.playerId2Info: playerFriendInfo = base.cr.playerFriendsManager.playerId2Info.get(playerFriendId) if playerFriendInfo.onlineYesNo: if playerFriendInfo.understandableYesNo: @@ -555,7 +555,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData): 0)) if self.panelType == FLPPets: - for objId, obj in base.cr.doId2do.items(): + for objId, obj in list(base.cr.doId2do.items()): from toontown.pets import DistributedPet if isinstance(obj, DistributedPet.DistributedPet): friendPair = (objId, 0) @@ -568,7 +568,7 @@ class FriendsListPanel(DirectFrame, StateData.StateData): if self.panelType == FLPAll or self.panelType == FLPOnline: if base.wantPets and base.localAvatar.hasPet(): petFriends.insert(0, (base.localAvatar.getPetId(), 0)) - for friendPair in self.friends.keys(): + for friendPair in list(self.friends.keys()): friendButton = self.friends[friendPair] self.scrollList.removeItem(friendButton, refresh=0) friendButton.destroy() @@ -582,49 +582,49 @@ class FriendsListPanel(DirectFrame, StateData.StateData): speedChatDouble.sort(compareFriends) offlineFriends.sort(compareFriends) for friendPair in newFriends: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair) if friendButton: self.scrollList.addItem(friendButton, refresh=0) self.friends[friendPair] = friendButton for friendPair in petFriends: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair, ToontownGlobals.ColorNoChat, 0) if friendButton: self.scrollList.addItem(friendButton, refresh=0) self.friends[friendPair] = friendButton for friendPair in freeChatDouble: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair, ToontownGlobals.ColorFreeChat, 1) if friendButton: self.scrollList.addItem(friendButton, refresh=0) self.friends[friendPair] = friendButton for friendPair in freeChatOneRef: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair, ToontownGlobals.ColorFreeChat, 0) if friendButton: self.scrollList.addItem(friendButton, refresh=0) self.friends[friendPair] = friendButton for friendPair in speedChatDouble: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair, ToontownGlobals.ColorSpeedChat, 1) if friendButton: self.scrollList.addItem(friendButton, refresh=0) self.friends[friendPair] = friendButton for friendPair in speedChatOneRef: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair, ToontownGlobals.ColorSpeedChat, 0) if friendButton: self.scrollList.addItem(friendButton, refresh=0) self.friends[friendPair] = friendButton for friendPair in offlineFriends: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair, ToontownGlobals.ColorNoChat, 0) if friendButton: self.scrollList.addItem(friendButton, refresh=0) diff --git a/toontown/golf/DistributedGolfCourse.py b/toontown/golf/DistributedGolfCourse.py index e009a7c..a347885 100644 --- a/toontown/golf/DistributedGolfCourse.py +++ b/toontown/golf/DistributedGolfCourse.py @@ -84,7 +84,7 @@ class DistributedGolfCourse(DistributedObject.DistributedObject, FSM, DelayDelet return def delete(self): - print 'GOLF COURSE DELETE' + print('GOLF COURSE DELETE') self.ignore('clientCleanup') if self.scoreBoard: self.scoreBoard.delete() @@ -257,7 +257,7 @@ class DistributedGolfCourse(DistributedObject.DistributedObject, FSM, DelayDelet pass def enterCleanup(self): - print 'GOLF COURSE CLEANUP' + print('GOLF COURSE CLEANUP') base.localAvatar.stopSleepWatch() for action in self.cleanupActions: action() diff --git a/toontown/golf/DistributedGolfCourseAI.py b/toontown/golf/DistributedGolfCourseAI.py index bc0183d..f9ec4aa 100644 --- a/toontown/golf/DistributedGolfCourseAI.py +++ b/toontown/golf/DistributedGolfCourseAI.py @@ -283,7 +283,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): allAvatarsInCourse() self.__barrier = ToonBarrier('WaitReadyCourse', self.uniqueName('WaitReadyCourse'), self.avIdList, READY_TIMEOUT, allAvatarsInCourse, handleTimeout) - for avId in self.avStateDict.keys(): + for avId in list(self.avStateDict.keys()): if self.avStateDict[avId] == READY: self.__barrier.clear(avId) @@ -319,7 +319,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): stillPlaying = self.getStillPlayingAvIds() self.__barrier = ToonBarrier('WaitReadyHole', self.uniqueName('WaitReadyHole'), stillPlaying, READY_TIMEOUT, allAvatarsInHole, handleTimeout) - for avId in self.avStateDict.keys(): + for avId in list(self.avStateDict.keys()): if self.avStateDict[avId] == ONHOLE: self.__barrier.clear(avId) @@ -335,7 +335,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): for avId in self.avIdList: av = simbase.air.doId2do.get(avId) if av: - if self.avStateDict.has_key(avId) and not self.avStateDict[avId] == EXITED: + if avId in self.avStateDict and not self.avStateDict[avId] == EXITED: retval.append(avId) return retval @@ -381,7 +381,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): self.recordHoleInOne() self.recordCourseUnderPar() trophiesList = [] - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] if avId in self.newTrophies: oneTrophyList = self.newTrophies[avId] @@ -393,7 +393,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): trophiesList.append([]) holeBestList = [] - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] if avId in self.newHoleBest: oneTrophyList = self.newHoleBest[avId] @@ -405,7 +405,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): holeBestList.append([]) courseBestList = [] - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] if avId in self.newCourseBest: oneTrophyList = self.newCourseBest[avId] @@ -417,7 +417,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): courseBestList.append([]) cupList = [] - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] if avId in self.newCups: oneCupList = self.newCups[avId] @@ -478,7 +478,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): retval = True else: retval = True - for state in self.avStateDict.values(): + for state in list(self.avStateDict.values()): if not (state == BALLIN or state == EXITED): retval = False break @@ -488,7 +488,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): def areAllBallsInHole(self): self.notify.debug('areAllBallsInHole, self.avStateDict=%s' % self.avStateDict) allBallsInHole = True - for state in self.avStateDict.values(): + for state in list(self.avStateDict.values()): if state != BALLIN: allBallsInHole = False @@ -543,7 +543,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): return def incrementEndingHistory(self, avId, historyIndex): - if self.endingHistory.has_key(avId) and GolfGlobals.TrophyRequirements.has_key(historyIndex): + if avId in self.endingHistory and historyIndex in GolfGlobals.TrophyRequirements: maximumAmount = GolfGlobals.TrophyRequirements[historyIndex][-1] if self.endingHistory[avId][historyIndex] < maximumAmount: self.endingHistory[avId][historyIndex] += 1 @@ -724,7 +724,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): winnerAvId = random.choice(tiedForFirst) winnerIndex = self.avIdList.index(winnerAvId) self.winnerByTieBreak = winnerAvId - for index in xrange(len(self.rankings)): + for index in range(len(self.rankings)): if self.rankings[index] > 0 and index != winnerIndex: self.rankings[index] += 1 @@ -747,7 +747,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): endingTrophies = GolfGlobals.calcTrophyListFromHistory(endingHistory) av.b_setGolfHistory(endingHistory) newTrophies = [] - for index in xrange(len(oldTrophies)): + for index in range(len(oldTrophies)): if not oldTrophies[index] and endingTrophies[index]: self.notify.debug('New Trophy %d' % index) self.air.writeServerEvent('golf_trophy', avId, '%s' % index) @@ -768,7 +768,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): oldCups = GolfGlobals.calcCupListFromHistory(oldHistory) endingCups = GolfGlobals.calcCupListFromHistory(endingHistory) newCups = [] - for index in xrange(len(oldCups)): + for index in range(len(oldCups)): if not oldCups[index] and endingCups[index]: self.notify.debug('New Trophy %d' % index) newCups.append(True) @@ -791,7 +791,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): av.b_setGolfHoleBest(endingHoleBest) newHoleBest = [] longestHoleBestList = 0 - for index in xrange(len(oldHoleBest)): + for index in range(len(oldHoleBest)): if endingHoleBest[index] < oldHoleBest[index]: self.notify.debug('New HoleBest %d' % index) newHoleBest.append(True) @@ -813,7 +813,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): av.b_setGolfCourseBest(endingCourseBest) newCourseBest = [] longestCourseBestList = 0 - for index in xrange(len(oldCourseBest)): + for index in range(len(oldCourseBest)): if endingCourseBest[index] < oldCourseBest[index]: self.notify.debug('New CourseBest %d' % index) newCourseBest.append(True) @@ -853,7 +853,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): def getTotalScore(self, avId): retval = 0 - if self.scores.has_key(avId): + if avId in self.scores: for holeScore in self.scores[avId]: retval += holeScore @@ -951,7 +951,7 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM): stillPlaying = self.getStillPlayingAvIds() for avId in stillPlaying: scoreList = self.scores[avId] - for holeIndex in xrange(len(scoreList)): + for holeIndex in range(len(scoreList)): strokes = scoreList[holeIndex] if strokes == 1: holeId = self.holeIds[holeIndex] diff --git a/toontown/golf/DistributedGolfHole.py b/toontown/golf/DistributedGolfHole.py index 6ce1b14..4cbb1c0 100644 --- a/toontown/golf/DistributedGolfHole.py +++ b/toontown/golf/DistributedGolfHole.py @@ -312,7 +312,7 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM, self.crowdBuildupSfx = [] self.crowdApplauseSfx = [] self.crowdMissSfx = [] - for i in xrange(4): + for i in range(4): self.crowdBuildupSfx.append(loader.loadSfx('phase_6/audio/sfx/Golf_Crowd_Buildup.mp3')) self.crowdApplauseSfx.append(loader.loadSfx('phase_6/audio/sfx/Golf_Crowd_Applause.mp3')) self.crowdMissSfx.append(loader.loadSfx('phase_6/audio/sfx/Golf_Crowd_Miss.mp3')) @@ -354,7 +354,7 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM, camera.setHpr(self.camHprBallFollow) if self.holeBottomNodePath.isEmpty(): holePositions = self.holePositions - for index in xrange(len(holePositions)): + for index in range(len(holePositions)): holePos = holePositions[index] targetNodePathGeom, t1, t2 = BuildGeometry.addCircleGeom(self.targets, 16, 1) targetNodePathGeom.setPos(holePos) @@ -1291,7 +1291,7 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM, self.currentGolferActive = True if avId in self.ballDict: self.ballDict[avId]['golfBallOdeGeom'].setCollideBits(BitMask32(16777215)) - self.ballDict[avId]['golfBallOdeGeom'].setCategoryBits(BitMask32(4278190080L)) + self.ballDict[avId]['golfBallOdeGeom'].setCategoryBits(BitMask32(4278190080)) else: self.currentGolferActive = False @@ -1401,7 +1401,7 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM, def __updateGolfPower(self, task): if not self.powerBar: - print '### no power bar!!!' + print('### no power bar!!!') return Task.done newPower = self.__getGolfPower(globalClock.getFrameTime()) self.power = newPower @@ -1525,7 +1525,7 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM, cameraAnimFullPath = path + cameraName try: self.flyOverActor = Actor.Actor(camModelFullPath, {'camera': cameraAnimFullPath}) - except StandardError: + except Exception: self.notify.debug("Couldn't find flyover %s" % camModelFullPath) return False @@ -1535,7 +1535,7 @@ class DistributedGolfHole(DistributedPhysicsWorld.DistributedPhysicsWorld, FSM, flyOverJoint = self.flyOverActor.find('**/camera1') children = flyOverJoint.getChildren() numChild = children.getNumPaths() - for i in xrange(numChild): + for i in range(numChild): childNodePath = children.getPath(i) childNodePath.removeNode() diff --git a/toontown/golf/DistributedGolfHoleAI.py b/toontown/golf/DistributedGolfHoleAI.py index 41f4842..41206a9 100644 --- a/toontown/golf/DistributedGolfHoleAI.py +++ b/toontown/golf/DistributedGolfHoleAI.py @@ -2,7 +2,7 @@ from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from pandac.PandaModules import * -import DistributedPhysicsWorldAI +from . import DistributedPhysicsWorldAI from direct.fsm.FSM import FSM from toontown.ai.ToonBarrier import * from toontown.golf import GolfGlobals @@ -395,10 +395,10 @@ class DistributedGolfHoleAI(DistributedPhysicsWorldAI.DistributedPhysicsWorldAI, def parseLocators(self, objectCollection, optional = 0): if optional and objectCollection.getNumPaths(): - if self.holeInfo.has_key('optionalMovers'): + if 'optionalMovers' in self.holeInfo: for optionalMoverId in self.holeInfo['optionalMovers']: searchStr = 'optional_mover_' + str(optionalMoverId) - for objIndex in xrange(objectCollection.getNumPaths()): + for objIndex in range(objectCollection.getNumPaths()): object = objectCollection.getPath(objIndex) if searchStr in object.getName(): self.fillLocator(objectCollection, objIndex) diff --git a/toontown/golf/DistributedPhysicsWorld.py b/toontown/golf/DistributedPhysicsWorld.py index 9ba099c..b682852 100644 --- a/toontown/golf/DistributedPhysicsWorld.py +++ b/toontown/golf/DistributedPhysicsWorld.py @@ -10,7 +10,7 @@ from direct.showbase import PythonUtil from direct.showutil import Rope from direct.task import Task from direct.distributed.ClockDelta import * -import BuildGeometry +from . import BuildGeometry from toontown.golf import GolfGlobals from toontown.golf import PhysicsWorldBase import random, time diff --git a/toontown/golf/DistributedPhysicsWorldAI.py b/toontown/golf/DistributedPhysicsWorldAI.py index 6086d8d..e602dab 100644 --- a/toontown/golf/DistributedPhysicsWorldAI.py +++ b/toontown/golf/DistributedPhysicsWorldAI.py @@ -2,7 +2,7 @@ from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from pandac.PandaModules import * -import BuildGeometry +from . import BuildGeometry import random, time from math import * import math @@ -42,8 +42,8 @@ class DistributedPhysicsWorldAI(DistributedObjectAI.DistributedObjectAI, Physics self.sendUpdate('setCommonObjects', [self.getCommonObjectData()]) def doAction(self): - print 'doing Action' - print 'before performReadyAction' + print('doing Action') + print('before performReadyAction') self.performReadyAction() self.storeAction = None self.commonHoldData = None @@ -56,14 +56,14 @@ class DistributedPhysicsWorldAI(DistributedObjectAI.DistributedObjectAI, Physics self.doAction() def setupCommonObjects(self): - print 'setupCommonObjects' - print self.commonHoldData + print('setupCommonObjects') + print(self.commonHoldData) if not self.commonHoldData: return elif self.commonHoldData[0][1] == 99: - print 'no common objects' + print('no common objects') else: self.useCommonObjectData(self.commonHoldData, 0) def performReadyAction(self): - print 'Wrong performReadyAction' + print('Wrong performReadyAction') diff --git a/toontown/golf/GolfGlobals.py b/toontown/golf/GolfGlobals.py index a481a64..579fa18 100644 --- a/toontown/golf/GolfGlobals.py +++ b/toontown/golf/GolfGlobals.py @@ -343,7 +343,7 @@ for holeId in HoleInfo: if type(HoleInfo[holeId]['blockers']) == type(0): blockerNum = HoleInfo[holeId]['blockers'] HoleInfo[holeId]['blockers'] = (blockerNum,) - if HoleInfo[holeId].has_key('optionalMovers'): + if 'optionalMovers' in HoleInfo[holeId]: if type(HoleInfo[holeId]['optionalMovers']) == type(0): blockerNum = HoleInfo[holeId]['optionalMovers'] HoleInfo[holeId]['optionalMovers'] = (blockerNum,) @@ -403,7 +403,7 @@ TrophiesPerCup = NumTrophies / NumCups def calcTrophyListFromHistory(history): retval = [] historyIndex = 0 - for trophyIndex in xrange(NumHistory): + for trophyIndex in range(NumHistory): requirements = TrophyRequirements[trophyIndex] for amountNeeded in requirements: if history[historyIndex] >= amountNeeded: @@ -424,7 +424,7 @@ def calcCupListFromHistory(history): if gotTrophy: numTrophiesWon += 1 - for cupIndex in xrange(len(retval)): + for cupIndex in range(len(retval)): threshold = (cupIndex + 1) * TrophiesPerCup if threshold <= numTrophiesWon: retval[cupIndex] = True diff --git a/toontown/golf/GolfHoleBase.py b/toontown/golf/GolfHoleBase.py index ab9292b..c61c8c1 100644 --- a/toontown/golf/GolfHoleBase.py +++ b/toontown/golf/GolfHoleBase.py @@ -2,7 +2,7 @@ from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from pandac.PandaModules import * -import DistributedPhysicsWorldAI +from . import DistributedPhysicsWorldAI from direct.fsm.FSM import FSM from toontown.ai.ToonBarrier import * from toontown.golf import GolfGlobals @@ -45,7 +45,7 @@ class GolfHoleBase: self.meshDataList.append(terrainDataOde) terrainGeomOde = OdeTriMeshGeom(self.space, terrainDataOde) self.geomDataList.append(terrainGeomOde) - terrainGeomOde.setCollideBits(BitMask32(4026531840L)) + terrainGeomOde.setCollideBits(BitMask32(4026531840)) terrainGeomOde.setCategoryBits(BitMask32(240)) self.space.setSurfaceType(terrainGeomOde, GolfGlobals.GRASS_SURFACE) self.space.setCollideId(terrainGeomOde, 2) @@ -58,7 +58,7 @@ class GolfHoleBase: self.meshDataList.append(terrainDataOde) terrainGeomOde = OdeTriMeshGeom(self.space, terrainDataOde) self.geomDataList.append(terrainGeomOde) - terrainGeomOde.setCollideBits(BitMask32(4026531840L)) + terrainGeomOde.setCollideBits(BitMask32(4026531840)) terrainGeomOde.setCategoryBits(BitMask32(240)) self.space.setSurfaceType(terrainGeomOde, GolfGlobals.SLICK_SURFACE) self.space.setCollideId(terrainGeomOde, GolfGlobals.SLICK_COLLIDE_ID) @@ -68,7 +68,7 @@ class GolfHoleBase: self.meshDataList.append(cupData) cupGeom = OdeTriMeshGeom(self.space, cupData) self.geomDataList.append(cupGeom) - cupGeom.setCollideBits(BitMask32(4026531840L)) + cupGeom.setCollideBits(BitMask32(4026531840)) cupGeom.setCategoryBits(BitMask32(240)) self.space.setSurfaceType(cupGeom, GolfGlobals.HOLE_SURFACE) self.space.setCollideId(cupGeom, GolfGlobals.HOLE_CUP_COLLIDE_ID) @@ -76,7 +76,7 @@ class GolfHoleBase: self.golfBarrier = self.terrainModel.find('**/collision1') if not self.golfBarrier.isEmpty(): golfBarrierCollection = self.terrainModel.findAllMatches('**/collision?') - for i in xrange(golfBarrierCollection.getNumPaths()): + for i in range(golfBarrierCollection.getNumPaths()): oneBarrier = golfBarrierCollection.getPath(i) if oneBarrier != self.golfBarrier: oneBarrier.wrtReparentTo(self.golfBarrier) @@ -92,7 +92,7 @@ class GolfHoleBase: self.meshDataList.append(hardData) hardGeom = OdeTriMeshGeom(self.space, hardData) self.geomDataList.append(hardGeom) - hardGeom.setCollideBits(BitMask32(4026531840L)) + hardGeom.setCollideBits(BitMask32(4026531840)) hardGeom.setCategoryBits(BitMask32(240)) self.space.setCollideId(hardGeom, 3) hardSurface = self.space.getSurfaceType(hardGeom) @@ -128,7 +128,7 @@ class GolfHoleBase: self.ballRay.setOffsetRotation(Mat3(1, 0, 0, 0, -1, 0, 0, 0, -1)) self.ballRay.setOffsetPosition(0, 0, 0.0) self.ballRay.setCollideBits(BitMask32(16773375)) - self.ballRay.setCategoryBits(BitMask32(4278190080L)) + self.ballRay.setCategoryBits(BitMask32(4278190080)) self.ballRayBody = body self.space.setCollideId(self.ballRay, GolfGlobals.OOB_RAY_COLLIDE_ID) self.rayList.append(self.ballRay) @@ -271,7 +271,7 @@ class GolfHoleBase: self.notify.debug('renable limit passed') elif self.frame > 2100 + checkFrames: self.comObjNeedPass = 0 - print 'recording limit passed comObj' + print('recording limit passed comObj') if ball.isEnabled(): lastFrameEnabled = self.frame diff --git a/toontown/golf/GolfRewardDialog.py b/toontown/golf/GolfRewardDialog.py index da5f3e4..d0f259f 100644 --- a/toontown/golf/GolfRewardDialog.py +++ b/toontown/golf/GolfRewardDialog.py @@ -33,7 +33,7 @@ class GolfRewardDialog: if av and avId in self.avIdList: playerIndex = self.avIdList.index(avId) name = av.getName() - for trophyIndex in xrange(len(self.trophyList[playerIndex])): + for trophyIndex in range(len(self.trophyList[playerIndex])): wonTrophy = self.trophyList[playerIndex][trophyIndex] if wonTrophy: trophyName = TTLocalizer.GolfTrophyDescriptions[trophyIndex] diff --git a/toontown/golf/PhysicsWorldBase.py b/toontown/golf/PhysicsWorldBase.py index acea0da..e517693 100644 --- a/toontown/golf/PhysicsWorldBase.py +++ b/toontown/golf/PhysicsWorldBase.py @@ -9,7 +9,7 @@ from toontown.minigame import ArrowKeys from direct.showbase import PythonUtil from direct.task import Task from direct.distributed.ClockDelta import * -import BuildGeometry +from . import BuildGeometry from toontown.golf import GolfGlobals import random, time @@ -155,7 +155,7 @@ class PhysicsWorldBase: def getCycleTime(self, doprint = 0): cycleTime = (globalClock.getRealTime() + self.timingCycleOffset) % self.timingCycleLength if doprint: - print 'Get Cycle Time %s' % cycleTime + print('Get Cycle Time %s' % cycleTime) return cycleTime def setTimeIntoCycle(self, time, doprint = 0): @@ -481,22 +481,22 @@ class PhysicsWorldBase: if ballIndex == 1: self.notify.debug('1') geom.setCollideBits(BitMask32(16777215)) - geom.setCategoryBits(BitMask32(4278190080L)) + geom.setCategoryBits(BitMask32(4278190080)) elif ballIndex == 2: self.notify.debug('2') geom.setCollideBits(BitMask32(16777215)) - geom.setCategoryBits(BitMask32(4278190080L)) + geom.setCategoryBits(BitMask32(4278190080)) elif ballIndex == 3: self.notify.debug('3') geom.setCollideBits(BitMask32(16777215)) - geom.setCategoryBits(BitMask32(4278190080L)) + geom.setCategoryBits(BitMask32(4278190080)) elif ballIndex == 4: self.notify.debug('4') geom.setCollideBits(BitMask32(16777215)) - geom.setCategoryBits(BitMask32(4278190080L)) + geom.setCategoryBits(BitMask32(4278190080)) else: - geom.setCollideBits(BitMask32(4294967295L)) - geom.setCategoryBits(BitMask32(4294967295L)) + geom.setCollideBits(BitMask32(4294967295)) + geom.setCategoryBits(BitMask32(4294967295)) geom.setBody(body) if self.notify.getDebug(): self.notify.debug('golf ball geom id') diff --git a/toontown/hood/BRHood.py b/toontown/hood/BRHood.py index e5a5df0..18aebfd 100644 --- a/toontown/hood/BRHood.py +++ b/toontown/hood/BRHood.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.town import BRTownLoader from toontown.safezone import BRSafeZoneLoader from toontown.toonbase.ToontownGlobals import * diff --git a/toontown/hood/BRHoodDataAI.py b/toontown/hood/BRHoodDataAI.py index 9b86a96..2e2b8fd 100644 --- a/toontown/hood/BRHoodDataAI.py +++ b/toontown/hood/BRHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.safezone import DistributedTrolleyAI from toontown.safezone import BRTreasurePlannerAI diff --git a/toontown/hood/BossbotHQ.py b/toontown/hood/BossbotHQ.py index 24b1a3d..9dbf095 100644 --- a/toontown/hood/BossbotHQ.py +++ b/toontown/hood/BossbotHQ.py @@ -1,4 +1,4 @@ -import CogHood +from . import CogHood from toontown.toonbase import ToontownGlobals from toontown.coghq import BossbotCogHQLoader from toontown.hood import ZoneUtil diff --git a/toontown/hood/BossbotHQDataAI.py b/toontown/hood/BossbotHQDataAI.py index ed048e5..ad3a3fe 100644 --- a/toontown/hood/BossbotHQDataAI.py +++ b/toontown/hood/BossbotHQDataAI.py @@ -1,6 +1,6 @@ from pandac.PandaModules import Point3 from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.coghq import DistributedCogHQDoorAI from toontown.building import DistributedDoorAI @@ -69,7 +69,7 @@ class BossbotHQDataAI(HoodDataAI.HoodDataAI): hprList = ((110.815, 0, 0), (61.231, 0, 0), (-105.481, 0, 0)) mins = ToontownGlobals.FactoryLaffMinimums[3] kartIdList = [] - for cogCourse in xrange(len(posList)): + for cogCourse in range(len(posList)): pos = posList[cogCourse] hpr = hprList[cogCourse] cogKart = DistributedCogKartAI.DistributedCogKartAI(self.air, cogCourse, pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2], self.air.countryClubMgr, minLaff=mins[cogCourse]) diff --git a/toontown/hood/CSHoodDataAI.py b/toontown/hood/CSHoodDataAI.py index 772fe78..6e85ec0 100644 --- a/toontown/hood/CSHoodDataAI.py +++ b/toontown/hood/CSHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.coghq import DistributedFactoryElevatorExtAI from toontown.coghq import DistributedCogHQDoorAI diff --git a/toontown/hood/CashbotHQ.py b/toontown/hood/CashbotHQ.py index e00cd8f..8d0e39c 100644 --- a/toontown/hood/CashbotHQ.py +++ b/toontown/hood/CashbotHQ.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -import CogHood +from . import CogHood from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.hood import ZoneUtil from toontown.coghq import CashbotCogHQLoader diff --git a/toontown/hood/CashbotHQDataAI.py b/toontown/hood/CashbotHQDataAI.py index b50f337..d665b69 100644 --- a/toontown/hood/CashbotHQDataAI.py +++ b/toontown/hood/CashbotHQDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.coghq import DistributedMintElevatorExtAI from toontown.coghq import DistributedCogHQDoorAI diff --git a/toontown/hood/CogHood.py b/toontown/hood/CogHood.py index f64e2bc..6a3b1a2 100644 --- a/toontown/hood/CogHood.py +++ b/toontown/hood/CogHood.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import Hood +from . import Hood class CogHood(Hood.Hood): notify = DirectNotifyGlobal.directNotify.newCategory('CogHood') diff --git a/toontown/hood/DDHood.py b/toontown/hood/DDHood.py index 9bd96ca..3009c06 100644 --- a/toontown/hood/DDHood.py +++ b/toontown/hood/DDHood.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.town import DDTownLoader from toontown.safezone import DDSafeZoneLoader from toontown.toonbase.ToontownGlobals import * diff --git a/toontown/hood/DDHoodDataAI.py b/toontown/hood/DDHoodDataAI.py index c008abc..23b83c6 100644 --- a/toontown/hood/DDHoodDataAI.py +++ b/toontown/hood/DDHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DDTreasurePlannerAI diff --git a/toontown/hood/DGHood.py b/toontown/hood/DGHood.py index 3077e19..a1c5a9f 100644 --- a/toontown/hood/DGHood.py +++ b/toontown/hood/DGHood.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.town import DGTownLoader from toontown.safezone import DGSafeZoneLoader from toontown.toonbase.ToontownGlobals import * -import SkyUtil +from . import SkyUtil class DGHood(ToonHood.ToonHood): diff --git a/toontown/hood/DGHoodDataAI.py b/toontown/hood/DGHoodDataAI.py index cbae15c..771e3ca 100644 --- a/toontown/hood/DGHoodDataAI.py +++ b/toontown/hood/DGHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DGTreasurePlannerAI diff --git a/toontown/hood/DLHood.py b/toontown/hood/DLHood.py index f547a81..a6e574f 100644 --- a/toontown/hood/DLHood.py +++ b/toontown/hood/DLHood.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.town import DLTownLoader from toontown.safezone import DLSafeZoneLoader from toontown.toonbase.ToontownGlobals import * diff --git a/toontown/hood/DLHoodDataAI.py b/toontown/hood/DLHoodDataAI.py index 14270ce..eed8d9b 100644 --- a/toontown/hood/DLHoodDataAI.py +++ b/toontown/hood/DLHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.safezone import DistributedTrolleyAI from toontown.safezone import DLTreasurePlannerAI diff --git a/toontown/hood/EstateHood.py b/toontown/hood/EstateHood.py index 69069ec..47d94d0 100644 --- a/toontown/hood/EstateHood.py +++ b/toontown/hood/EstateHood.py @@ -7,12 +7,12 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.minigame import Purchase from otp.avatar import DistributedAvatar -import SkyUtil +from . import SkyUtil from direct.task.Task import Task -import Hood +from . import Hood from toontown.estate import EstateLoader from toontown.estate import HouseGlobals -import ZoneUtil +from . import ZoneUtil class EstateHood(Hood.Hood): notify = DirectNotifyGlobal.directNotify.newCategory('EstateHood') diff --git a/toontown/hood/FishAnimatedProp.py b/toontown/hood/FishAnimatedProp.py index 3152635..2d71609 100644 --- a/toontown/hood/FishAnimatedProp.py +++ b/toontown/hood/FishAnimatedProp.py @@ -1,4 +1,4 @@ -import AnimatedProp +from . import AnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import * from toontown.effects.Splash import * diff --git a/toontown/hood/GSHood.py b/toontown/hood/GSHood.py index 06eea54..f30cead 100644 --- a/toontown/hood/GSHood.py +++ b/toontown/hood/GSHood.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.safezone import GSSafeZoneLoader from toontown.toonbase.ToontownGlobals import * from toontown.racing import DistributedVehicle -import SkyUtil +from . import SkyUtil class GSHood(ToonHood.ToonHood): diff --git a/toontown/hood/GSHoodDataAI.py b/toontown/hood/GSHoodDataAI.py index 7dcf368..4ab00cb 100644 --- a/toontown/hood/GSHoodDataAI.py +++ b/toontown/hood/GSHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI, ZoneUtil +from . import HoodDataAI, ZoneUtil from toontown.toonbase import ToontownGlobals from toontown.racing import DistributedStartingBlockAI from pandac.PandaModules import * diff --git a/toontown/hood/GZHood.py b/toontown/hood/GZHood.py index 6425018..37e36ed 100644 --- a/toontown/hood/GZHood.py +++ b/toontown/hood/GZHood.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.safezone import GZSafeZoneLoader from toontown.toonbase.ToontownGlobals import * from toontown.racing import DistributedVehicle -import SkyUtil +from . import SkyUtil class GZHood(ToonHood.ToonHood): diff --git a/toontown/hood/GZHoodDataAI.py b/toontown/hood/GZHoodDataAI.py index 90834c9..8f80b70 100644 --- a/toontown/hood/GZHoodDataAI.py +++ b/toontown/hood/GZHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI, ZoneUtil +from . import HoodDataAI, ZoneUtil from toontown.toonbase import ToontownGlobals from toontown.racing import DistributedStartingBlockAI from pandac.PandaModules import * @@ -151,7 +151,7 @@ class GZHoodDataAI(HoodDataAI.HoodDataAI): self.golfKarts += foundKarts self.golfKartGroups += foundKartGroups - print self.golfKarts, self.golfKartGroups + print(self.golfKarts, self.golfKartGroups) for golfKart in self.golfKarts: golfKart.start() self.addDistObj(golfKart) diff --git a/toontown/hood/GenericAnimatedProp.py b/toontown/hood/GenericAnimatedProp.py index 7e3014a..d2f009e 100644 --- a/toontown/hood/GenericAnimatedProp.py +++ b/toontown/hood/GenericAnimatedProp.py @@ -1,4 +1,4 @@ -import AnimatedProp +from . import AnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal @@ -86,7 +86,7 @@ class GenericAnimatedProp(AnimatedProp.AnimatedProp): self.visId = visId self.hoodId = ZoneUtil.getCanonicalHoodId(visId) self.notify.debug('calcHoodId %d from %s' % (self.hoodId, fullString)) - except Exception, generic: + except Exception as generic: if 'Editor' not in fullString: self.notify.warning("calcHoodId couldn't parse %s using 0" % fullString) self.hoodId = 0 diff --git a/toontown/hood/HQPeriscopeAnimatedProp.py b/toontown/hood/HQPeriscopeAnimatedProp.py index f8e75e8..a861b8b 100644 --- a/toontown/hood/HQPeriscopeAnimatedProp.py +++ b/toontown/hood/HQPeriscopeAnimatedProp.py @@ -1,4 +1,4 @@ -import AnimatedProp +from . import AnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import * diff --git a/toontown/hood/HQTelescopeAnimatedProp.py b/toontown/hood/HQTelescopeAnimatedProp.py index b80587f..69b2505 100644 --- a/toontown/hood/HQTelescopeAnimatedProp.py +++ b/toontown/hood/HQTelescopeAnimatedProp.py @@ -1,4 +1,4 @@ -import AnimatedProp +from . import AnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import * diff --git a/toontown/hood/Hood.py b/toontown/hood/Hood.py index 381c122..da7a247 100644 --- a/toontown/hood/Hood.py +++ b/toontown/hood/Hood.py @@ -8,8 +8,8 @@ from direct.task.Task import Task from toontown.minigame import Purchase from direct.gui import OnscreenText from toontown.building import SuitInterior -import QuietZoneState -import ZoneUtil +from . import QuietZoneState +from . import ZoneUtil from toontown.toonbase import TTLocalizer from toontown.toon.Toon import teleportDebug from direct.interval.IntervalGlobal import * @@ -175,7 +175,7 @@ class Hood(StateData.StateData): elif loaderName == 'minigame': pass elif loaderName == 'cogHQLoader': - print 'should be loading HQ' + print('should be loading HQ') def handleLeftQuietZone(self): status = self.quietZoneStateData.getRequestStatus() diff --git a/toontown/hood/HoodDataAI.py b/toontown/hood/HoodDataAI.py index e0fe744..139a4d7 100644 --- a/toontown/hood/HoodDataAI.py +++ b/toontown/hood/HoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import ZoneUtil +from . import ZoneUtil from toontown.building import DistributedBuildingMgrAI from toontown.suit import DistributedSuitPlannerAI from toontown.safezone import ButterflyGlobals @@ -49,7 +49,7 @@ class HoodDataAI: self.buildingManagers = [] ButterflyGlobals.clearIndexes(self.zoneId) del self.fishingPonds - for distObj in self.doId2do.values(): + for distObj in list(self.doId2do.values()): distObj.requestDelete() del self.doId2do diff --git a/toontown/hood/InteractiveAnimatedProp.py b/toontown/hood/InteractiveAnimatedProp.py index af0b93a..34e35bb 100644 --- a/toontown/hood/InteractiveAnimatedProp.py +++ b/toontown/hood/InteractiveAnimatedProp.py @@ -1,6 +1,6 @@ import math import random -import GenericAnimatedProp +from . import GenericAnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import Sequence, ActorInterval, Wait, Func, SoundInterval, Parallel from direct.fsm import FSM @@ -77,7 +77,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.trashcan.reparentTo(node) animDict = {} animDict['anim'] = '%s/%s' % (self.path, anim) - for i in xrange(self.numIdles): + for i in range(self.numIdles): baseAnim = self.ZoneToIdles[self.hoodId][i] if isinstance(baseAnim, tuple): baseAnim = baseAnim[0] @@ -90,7 +90,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): settleKey = 'settle%d' % i animDict[settleKey] = settleStr - for i in xrange(self.numFightAnims): + for i in range(self.numFightAnims): animStr = self.path + '/' + self.ZoneToFightAnims[self.hoodId][i] animKey = 'fight%d' % i animDict[animKey] = animStr @@ -120,8 +120,8 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = Sequence() if self.numIdles >= 3: numberOfAnimsAbove2 = self.numIdles - 2 - for rareIdle in xrange(2, self.numIdles): - for i in xrange(2): + for rareIdle in range(2, self.numIdles): + for i in range(2): result.append(ActorInterval(self.node, 'idle0')) result.append(Wait(self.IdlePauseTime)) result.append(ActorInterval(self.node, 'idle1')) @@ -131,7 +131,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result.append(Wait(self.IdlePauseTime)) else: - for i in xrange(self.numIdles): + for i in range(self.numIdles): result.append(ActorInterval(self.node, 'idle%d' % i)) self.notify.debug('idle interval=%s' % result) @@ -157,7 +157,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def createBattleCheerInterval(self): result = Sequence() - for i in xrange(self.numFightAnims): + for i in range(self.numFightAnims): animKey = 'fight%d' % i animAndSoundIval = self.createAnimAndSoundIval(animKey) origAnimName = self.node.getAnimFilename(animKey).split('/')[-1] @@ -264,7 +264,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = self.numIdles - 1 if base.config.GetBool('randomize-interactive-idles', True): pairs = [] - for i in xrange(self.numIdles): + for i in range(self.numIdles): reversedChance = self.numIdles - i - 1 pairs.append((math.pow(2, reversedChance), i)) @@ -332,7 +332,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): numberOfLoops = random.randrange(minLoop, maxLoop + 1) pauseTime = random.randrange(minPauseTime, maxPauseTime + 1) result = Sequence() - for i in xrange(numberOfLoops): + for i in range(numberOfLoops): result.append(idleAnimAndSound) if self.getSettleName(whichIdleAnim): @@ -497,7 +497,7 @@ class InteractiveAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): baseAnimName = animName.split('/')[-1] if localAvatar.zoneId == self.visId: self.notify.info('playing %s' % baseAnimName) - except Exception, e: + except Exception as e: self.notify.warning('Unknown error in printAnimIfClose, giving up:\n%s' % str(e)) def clearCurIval(self): diff --git a/toontown/hood/LawbotHQ.py b/toontown/hood/LawbotHQ.py index 588fc7e..80d3ac2 100644 --- a/toontown/hood/LawbotHQ.py +++ b/toontown/hood/LawbotHQ.py @@ -1,4 +1,4 @@ -import CogHood +from . import CogHood from toontown.toonbase import ToontownGlobals from toontown.coghq import LawbotCogHQLoader diff --git a/toontown/hood/LawbotHQDataAI.py b/toontown/hood/LawbotHQDataAI.py index 2110383..f642dd3 100644 --- a/toontown/hood/LawbotHQDataAI.py +++ b/toontown/hood/LawbotHQDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.coghq import DistributedLawOfficeElevatorExtAI from toontown.coghq import DistributedCogHQDoorAI diff --git a/toontown/hood/MMHood.py b/toontown/hood/MMHood.py index 16549fc..31b26ae 100644 --- a/toontown/hood/MMHood.py +++ b/toontown/hood/MMHood.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.town import MMTownLoader from toontown.safezone import MMSafeZoneLoader from toontown.toonbase.ToontownGlobals import * diff --git a/toontown/hood/MMHoodDataAI.py b/toontown/hood/MMHoodDataAI.py index 2173597..483cf49 100644 --- a/toontown/hood/MMHoodDataAI.py +++ b/toontown/hood/MMHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.safezone import DistributedTrolleyAI from toontown.safezone import MMTreasurePlannerAI diff --git a/toontown/hood/OZHood.py b/toontown/hood/OZHood.py index 0bc31eb..f82fd3a 100644 --- a/toontown/hood/OZHood.py +++ b/toontown/hood/OZHood.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.safezone import OZSafeZoneLoader from toontown.toonbase.ToontownGlobals import * from toontown.racing import DistributedVehicle -import SkyUtil +from . import SkyUtil class OZHood(ToonHood.ToonHood): diff --git a/toontown/hood/OZHoodDataAI.py b/toontown/hood/OZHoodDataAI.py index 4a755bf..6606624 100644 --- a/toontown/hood/OZHoodDataAI.py +++ b/toontown/hood/OZHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI, ZoneUtil +from . import HoodDataAI, ZoneUtil from toontown.toonbase import ToontownGlobals from toontown.safezone import OZTreasurePlannerAI from toontown.racing import DistributedStartingBlockAI diff --git a/toontown/hood/PetShopFishAnimatedProp.py b/toontown/hood/PetShopFishAnimatedProp.py index c4cab52..ffe7d4e 100644 --- a/toontown/hood/PetShopFishAnimatedProp.py +++ b/toontown/hood/PetShopFishAnimatedProp.py @@ -1,4 +1,4 @@ -import AnimatedProp +from . import AnimatedProp from direct.actor import Actor from direct.interval.IntervalGlobal import * diff --git a/toontown/hood/Place.py b/toontown/hood/Place.py index a7abcb0..dbc160e 100644 --- a/toontown/hood/Place.py +++ b/toontown/hood/Place.py @@ -5,8 +5,8 @@ from direct.fsm import StateData from direct.showbase.PythonUtil import PriorityCallbacks from toontown.safezone import PublicWalk from toontown.launcher import DownloadForceAcknowledge -import TrialerForceAcknowledge -import ZoneUtil +from . import TrialerForceAcknowledge +from . import ZoneUtil from toontown.friends import FriendsListManager from toontown.toonbase import ToontownGlobals from toontown.toon.Toon import teleportDebug @@ -16,7 +16,7 @@ from otp.otpbase import OTPLocalizer from otp.avatar import Emote from otp.avatar.Avatar import teleportNotify from direct.task import Task -import QuietZoneState +from . import QuietZoneState from toontown.distributed import ToontownDistrictStats class Place(StateData.StateData, FriendsListManager.FriendsListManager): @@ -426,7 +426,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): zoneId = 0 ToontownDistrictStats.refresh('shardInfoUpdated') curShardTuples = base.cr.listActiveShards() - lowestPop = 100000000000000000L + lowestPop = 100000000000000000 shardId = None for shardInfo in curShardTuples: pop = shardInfo[2] @@ -509,7 +509,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): elif doneStatus['mode'] == 'incomplete': self.fsm.request('DFAReject') else: - Place.notify.error('Unknown done status for DownloadForceAcknowledge: ' + `doneStatus`) + Place.notify.error('Unknown done status for DownloadForceAcknowledge: ' + repr(doneStatus)) def enterDFAReject(self): self.fsm.request('walk') @@ -711,7 +711,7 @@ class Place(StateData.StateData, FriendsListManager.FriendsListManager): base.localAvatar.obscureMoveFurnitureButton(1) avId = requestStatus.get('avId', -1) if avId != -1: - if base.cr.doId2do.has_key(avId): + if avId in base.cr.doId2do: teleportDebug(requestStatus, 'teleport to avatar') avatar = base.cr.doId2do[avId] avatar.forceToTruePosition() diff --git a/toontown/hood/QuietZoneState.py b/toontown/hood/QuietZoneState.py index 34de2d4..08782d1 100644 --- a/toontown/hood/QuietZoneState.py +++ b/toontown/hood/QuietZoneState.py @@ -7,7 +7,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State -import ZoneUtil +from . import ZoneUtil class QuietZoneState(StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('QuietZoneState') @@ -317,7 +317,7 @@ class QuietZoneState(StateData.StateData): if base.placeBeforeObjects: self._leftQuietZoneCallbacks() self._leftQuietZoneCallbacks = None - fdcs = self._leftQuietZoneLocalCallbacks.values() + fdcs = list(self._leftQuietZoneLocalCallbacks.values()) self._leftQuietZoneLocalCallbacks = {} for fdc in fdcs: if not fdc.isFinished(): @@ -358,7 +358,7 @@ class QuietZoneState(StateData.StateData): requestStatus = self._requestStatus self._setZoneCompleteCallbacks() self._setZoneCompleteCallbacks = None - fdcs = self._setZoneCompleteLocalCallbacks.values() + fdcs = list(self._setZoneCompleteLocalCallbacks.values()) self._setZoneCompleteLocalCallbacks = {} for fdc in fdcs: if not fdc.isFinished(): diff --git a/toontown/hood/SellbotHQ.py b/toontown/hood/SellbotHQ.py index 8d81561..efc9f7d 100644 --- a/toontown/hood/SellbotHQ.py +++ b/toontown/hood/SellbotHQ.py @@ -1,4 +1,4 @@ -import CogHood +from . import CogHood from toontown.toonbase import ToontownGlobals from toontown.coghq import SellbotCogHQLoader diff --git a/toontown/hood/SleepingHydrantAnimatedProp.py b/toontown/hood/SleepingHydrantAnimatedProp.py index 0b6845b..0a4b1cd 100644 --- a/toontown/hood/SleepingHydrantAnimatedProp.py +++ b/toontown/hood/SleepingHydrantAnimatedProp.py @@ -1,4 +1,4 @@ -import AnimatedProp +from . import AnimatedProp from direct.interval.IntervalGlobal import * from direct.task import Task import math diff --git a/toontown/hood/TTHood.py b/toontown/hood/TTHood.py index d87f79c..3a72a00 100644 --- a/toontown/hood/TTHood.py +++ b/toontown/hood/TTHood.py @@ -1,10 +1,10 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import ToonHood +from . import ToonHood from toontown.town import TTTownLoader from toontown.safezone import TTSafeZoneLoader from toontown.toonbase.ToontownGlobals import * -import SkyUtil +from . import SkyUtil from direct.directnotify import DirectNotifyGlobal class TTHood(ToonHood.ToonHood): diff --git a/toontown/hood/TTHoodDataAI.py b/toontown/hood/TTHoodDataAI.py index e26851b..6a3b6b7 100644 --- a/toontown/hood/TTHoodDataAI.py +++ b/toontown/hood/TTHoodDataAI.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import HoodDataAI +from . import HoodDataAI from toontown.toonbase import ToontownGlobals from toontown.safezone import DistributedTrolleyAI from toontown.safezone import TTTreasurePlannerAI diff --git a/toontown/hood/ToonHood.py b/toontown/hood/ToonHood.py index ed86084..89d5d6e 100644 --- a/toontown/hood/ToonHood.py +++ b/toontown/hood/ToonHood.py @@ -7,7 +7,7 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.minigame import Purchase from otp.avatar import DistributedAvatar -import Hood +from . import Hood from toontown.building import SuitInterior from toontown.cogdominium import CogdoInterior from toontown.toon.Toon import teleportDebug diff --git a/toontown/hood/TrialerForceAcknowledge.py b/toontown/hood/TrialerForceAcknowledge.py index f4f3a84..e259c98 100644 --- a/toontown/hood/TrialerForceAcknowledge.py +++ b/toontown/hood/TrialerForceAcknowledge.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import ZoneUtil +from . import ZoneUtil from toontown.toonbase import ToontownGlobals from toontown.toontowngui import TeaserPanel diff --git a/toontown/hood/TutorialHood.py b/toontown/hood/TutorialHood.py index f840702..5151fc1 100644 --- a/toontown/hood/TutorialHood.py +++ b/toontown/hood/TutorialHood.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * -import ToonHood +from . import ToonHood from toontown.town import TutorialTownLoader from toontown.toonbase.ToontownGlobals import * -import SkyUtil +from . import SkyUtil class TutorialHood(ToonHood.ToonHood): diff --git a/toontown/hood/ZeroAnimatedProp.py b/toontown/hood/ZeroAnimatedProp.py index ab7070f..fa13688 100644 --- a/toontown/hood/ZeroAnimatedProp.py +++ b/toontown/hood/ZeroAnimatedProp.py @@ -32,8 +32,8 @@ class ZeroAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): def loadPhaseAnims(self): animDict = {} - for key, info in self.phaseInfo.iteritems(): - if type(info[0]) == types.TupleType: + for key, info in self.phaseInfo.items(): + if type(info[0]) == tuple: for index, anims in enumerate(info[0]): fullPath = self.path + '/' + anims animName = 'phase%d_%d' % (key, index) @@ -51,9 +51,9 @@ class ZeroAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): self.notify.debug('not creating phase ivals again') return self.phaseIvals = [] - for key, info in self.phaseInfo.iteritems(): + for key, info in self.phaseInfo.items(): self.notify.debug('key=%s' % key) - if type(info[0]) == types.TupleType: + if type(info[0]) == tuple: ival = Sequence() for index, anims in enumerate(info[0]): animName = 'phase%d_%d' % (key, index) @@ -97,7 +97,7 @@ class ZeroAnimatedProp(GenericAnimatedProp.GenericAnimatedProp, FSM.FSM): result = self.curPhase if base.config.GetBool('anim-props-randomized', True): pairs = [] - for i in xrange(self.curPhase + 1): + for i in range(self.curPhase + 1): pairs.append((math.pow(2, i), i)) sum = math.pow(2, self.curPhase + 1) - 1 diff --git a/toontown/launcher/QuickLauncher.py b/toontown/launcher/QuickLauncher.py index e54eff2..3ada36a 100644 --- a/toontown/launcher/QuickLauncher.py +++ b/toontown/launcher/QuickLauncher.py @@ -55,7 +55,7 @@ class QuickLauncher(LauncherBase): PatchExt = 'pch' def __init__(self): - print 'Running: ToontownQuickLauncher' + print('Running: ToontownQuickLauncher') self.toontownBlueKey = 'TOONTOWN_BLUE' self.launcherMessageKey = 'LAUNCHER_MESSAGE' self.game1DoneKey = 'GAME1_DONE' @@ -67,7 +67,7 @@ class QuickLauncher(LauncherBase): self.toontownPlayTokenKey = 'LOGIN_TOKEN' else: self.toontownPlayTokenKey = 'PLAYTOKEN' - print 'useTTSpecificLogin=%s' % self.useTTSpecificLogin + print('useTTSpecificLogin=%s' % self.useTTSpecificLogin) self.contentDir = '/' self.serverDbFileHash = HashVal() self.launcherFileDbHash = HashVal() @@ -182,7 +182,7 @@ class QuickLauncher(LauncherBase): messenger.send('launcherAllPhasesComplete') self.cleanup() return - raise StandardError, 'Some phases not listed in LauncherPhases: %s' % self.requiredInstallFiles + raise Exception('Some phases not listed in LauncherPhases: %s' % self.requiredInstallFiles) def getDecompressMultifile(self, mfname): if not self.DecompressMultifiles: @@ -256,10 +256,10 @@ class QuickLauncher(LauncherBase): def decompressMultifileDone(self): self.finalizePhase() - self.notify.info('Done updating multifiles in phase: ' + `(self.currentPhase)`) + self.notify.info('Done updating multifiles in phase: ' + repr((self.currentPhase))) self.progressSoFar += int(round(self.phaseOverallMap[self.currentPhase] * 100)) - self.notify.info('progress so far ' + `(self.progressSoFar)`) - messenger.send('phaseComplete-' + `(self.currentPhase)`) + self.notify.info('progress so far ' + repr((self.progressSoFar))) + messenger.send('phaseComplete-' + repr((self.currentPhase))) self.resumeInstall() def finalizePhase(self): @@ -305,13 +305,13 @@ class QuickLauncher(LauncherBase): name, value = args dict[name] = int(value) - if dict.has_key('secretsNeedsParentPassword') and 1: + if 'secretsNeedsParentPassword' in dict and 1: self.secretNeedsParentPasswordKey = dict['secretsNeedsParentPassword'] self.notify.info('secretNeedsParentPassword = %d' % self.secretNeedsParentPasswordKey) else: self.notify.warning('no secretNeedsParentPassword token in webAcctParams') - if dict.has_key('chatEligible'): + if 'chatEligible' in dict: self.chatEligibleKey = dict['chatEligible'] self.notify.info('chatEligibleKey = %d' % self.chatEligibleKey) else: diff --git a/toontown/launcher/ToontownDummyLauncher.py b/toontown/launcher/ToontownDummyLauncher.py index 5aefe7f..19fd6b9 100644 --- a/toontown/launcher/ToontownDummyLauncher.py +++ b/toontown/launcher/ToontownDummyLauncher.py @@ -44,7 +44,7 @@ class ToontownDummyLauncher(DummyLauncherBase, ToontownLauncher): return None def setRegistry(self, name, value): - print 'setRegistry[%s] = %s' % (name, value) + print('setRegistry[%s] = %s' % (name, value)) self.reg[name] = value def getRegistry(self, name, defaultValue = None): @@ -52,7 +52,7 @@ class ToontownDummyLauncher(DummyLauncherBase, ToontownLauncher): value = self.reg[name] else: value = defaultValue - print 'getRegistry[%s] = %s' % (name, value) + print('getRegistry[%s] = %s' % (name, value)) return value def getGame2Done(self): diff --git a/toontown/launcher/ToontownLauncher.py b/toontown/launcher/ToontownLauncher.py index d478d89..11fc0e9 100644 --- a/toontown/launcher/ToontownLauncher.py +++ b/toontown/launcher/ToontownLauncher.py @@ -33,9 +33,9 @@ sys.stderr = logErr print('\n\nStarting Toontown...') if 1: - print 'Current time: ' + time.asctime(time.localtime(time.time())) + ' ' + time.tzname[0] - print 'sys.path = ', sys.path - print 'sys.argv = ', sys.argv + print('Current time: ' + time.asctime(time.localtime(time.time())) + ' ' + time.tzname[0]) + print('sys.path = ', sys.path) + print('sys.argv = ', sys.argv) from otp.launcher.LauncherBase import LauncherBase from otp.otpbase import OTPLauncherGlobals @@ -61,7 +61,7 @@ class ToontownLauncher(LauncherBase): self.accountServer = sys.argv[3] self.testServerFlag = int(sys.argv[4]) else: - print 'Error: Launcher: incorrect number of parameters' + print('Error: Launcher: incorrect number of parameters') sys.exit() self.toontownBlueKey = 'TOONTOWN_BLUE' @@ -118,14 +118,14 @@ class ToontownLauncher(LauncherBase): dict[name] = int(value) self.secretNeedsParentPasswordKey = 1 - if dict.has_key('secretsNeedsParentPassword'): + if 'secretsNeedsParentPassword' in dict: self.secretNeedsParentPasswordKey = dict['secretsNeedsParentPassword'] else: self.notify.warning('no secretNeedsParentPassword token in webAcctParams') self.notify.info('secretNeedsParentPassword = %d' % self.secretNeedsParentPasswordKey) self.chatEligibleKey = 0 - if dict.has_key('chatEligible'): + if 'chatEligible' in dict: self.chatEligibleKey = dict['chatEligible'] else: self.notify.warning('no chatEligible token in webAcctParams') @@ -150,12 +150,12 @@ class ToontownLauncher(LauncherBase): return t = type(value) - if t == types.IntType: + if t == int: WindowsRegistry.setIntValue(self.toontownRegistryKey, name, value) - elif t == types.StringType: + elif t == bytes: WindowsRegistry.setStringValue(self.toontownRegistryKey, name, value) else: - self.notify.warning('setRegistry: Invalid type for registry value: ' + `value`) + self.notify.warning('setRegistry: Invalid type for registry value: ' + repr(value)) def getRegistry(self, name, missingValue=None): self.notify.info('getRegistry%s' % ((name, missingValue),)) diff --git a/toontown/login/AccountServerDate.py b/toontown/login/AccountServerDate.py index eed9ee3..a193db2 100644 --- a/toontown/login/AccountServerDate.py +++ b/toontown/login/AccountServerDate.py @@ -2,8 +2,8 @@ from pandac.PandaModules import * from otp.login.HTTPUtil import * from direct.directnotify import DirectNotifyGlobal from otp.login import TTAccount -import DateObject -import TTDateObject +from . import DateObject +from . import TTDateObject import time class AccountServerDate: @@ -28,12 +28,12 @@ class AccountServerDate: response = getHTTPResponse(url, http) if response[0] != 'ACCOUNT SERVER DATE': self.notify.debug('invalid response header') - raise UnexpectedResponse, 'unexpected response, response=%s' % response + raise UnexpectedResponse('unexpected response, response=%s' % response) try: epoch = int(response[1]) - except ValueError, e: + except ValueError as e: self.notify.debug(str(e)) - raise UnexpectedResponse, 'unexpected response, response=%s' % response + raise UnexpectedResponse('unexpected response, response=%s' % response) timeTuple = time.gmtime(epoch) self.year = timeTuple[0] diff --git a/toontown/login/AvatarChooser.py b/toontown/login/AvatarChooser.py index 8311ae8..b1c3057 100644 --- a/toontown/login/AvatarChooser.py +++ b/toontown/login/AvatarChooser.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals -import AvatarChoice +from . import AvatarChoice from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/login/TTDateObject.py b/toontown/login/TTDateObject.py index 5abaac2..bf6b001 100644 --- a/toontown/login/TTDateObject.py +++ b/toontown/login/TTDateObject.py @@ -1,4 +1,4 @@ -import DateObject +from . import DateObject class TTDateObject(DateObject.DateObject): diff --git a/toontown/makeatoon/BodyShop.py b/toontown/makeatoon/BodyShop.py index d04a5ed..2f3663d 100644 --- a/toontown/makeatoon/BodyShop.py +++ b/toontown/makeatoon/BodyShop.py @@ -2,12 +2,12 @@ from pandac.PandaModules import * from toontown.toon import ToonDNA from direct.fsm import StateData from direct.gui.DirectGui import * -from MakeAToonGlobals import * +from .MakeAToonGlobals import * import random from toontown.toonbase import TTLocalizer from direct.directnotify import DirectNotifyGlobal from toontown.toontowngui import TeaserPanel -import ShuffleButton +from . import ShuffleButton class BodyShop(StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('BodyShop') diff --git a/toontown/makeatoon/ClothesGUI.py b/toontown/makeatoon/ClothesGUI.py index 5433484..5f21b43 100644 --- a/toontown/makeatoon/ClothesGUI.py +++ b/toontown/makeatoon/ClothesGUI.py @@ -3,10 +3,10 @@ from toontown.toon import ToonDNA from direct.fsm import StateData from direct.gui.DirectGui import * from pandac.PandaModules import * -from MakeAToonGlobals import * +from .MakeAToonGlobals import * from toontown.toonbase import TTLocalizer from direct.directnotify import DirectNotifyGlobal -import ShuffleButton +from . import ShuffleButton import random CLOTHES_MAKETOON = 0 CLOTHES_TAILOR = 1 diff --git a/toontown/makeatoon/ColorShop.py b/toontown/makeatoon/ColorShop.py index fe6f752..4f00250 100644 --- a/toontown/makeatoon/ColorShop.py +++ b/toontown/makeatoon/ColorShop.py @@ -3,9 +3,9 @@ from toontown.toon import ToonDNA from direct.fsm import StateData from direct.gui.DirectGui import * from pandac.PandaModules import * -from MakeAToonGlobals import * +from .MakeAToonGlobals import * from toontown.toonbase import TTLocalizer -import ShuffleButton +from . import ShuffleButton import random from direct.directnotify import DirectNotifyGlobal @@ -63,7 +63,7 @@ class ColorShop(StateData.StateData): try: del self.toon except: - print 'ColorShop: toon not found' + print('ColorShop: toon not found') self.hideButtons() diff --git a/toontown/makeatoon/GenderShop.py b/toontown/makeatoon/GenderShop.py index 79934b8..38051ef 100644 --- a/toontown/makeatoon/GenderShop.py +++ b/toontown/makeatoon/GenderShop.py @@ -5,7 +5,7 @@ from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toon import ToonDNA from toontown.toon import Toon -from MakeAToonGlobals import * +from .MakeAToonGlobals import * from direct.directnotify import DirectNotifyGlobal import random diff --git a/toontown/makeatoon/MakeAToon.py b/toontown/makeatoon/MakeAToon.py index 9ad0a4b..dcd61a1 100644 --- a/toontown/makeatoon/MakeAToon.py +++ b/toontown/makeatoon/MakeAToon.py @@ -14,15 +14,15 @@ from direct.actor.Actor import Actor from direct.task import Task from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer -from MakeAToonGlobals import * +from .MakeAToonGlobals import * from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal from toontown.toontowngui import TTDialog -import GenderShop -import BodyShop -import ColorShop -import MakeClothesGUI -import NameShop +from . import GenderShop +from . import BodyShop +from . import ColorShop +from . import MakeClothesGUI +from . import NameShop import random class MakeAToon(StateData.StateData): diff --git a/toontown/makeatoon/MakeClothesGUI.py b/toontown/makeatoon/MakeClothesGUI.py index 4cfe39b..b6394b3 100644 --- a/toontown/makeatoon/MakeClothesGUI.py +++ b/toontown/makeatoon/MakeClothesGUI.py @@ -1,4 +1,4 @@ -import ClothesGUI +from . import ClothesGUI from toontown.toon import ToonDNA class MakeClothesGUI(ClothesGUI.ClothesGUI): diff --git a/toontown/makeatoon/NameGenerator.py b/toontown/makeatoon/NameGenerator.py index 07fdad9..760e3ac 100644 --- a/toontown/makeatoon/NameGenerator.py +++ b/toontown/makeatoon/NameGenerator.py @@ -60,7 +60,7 @@ class NameGenerator: self.capPrefixes, self.lastPrefixes, self.lastSuffixes] - for tu in self.nameDictionary.values(): + for tu in list(self.nameDictionary.values()): masterList[tu[0]].append(tu[1]) return 1 @@ -70,7 +70,7 @@ class NameGenerator: {}, {}, {}] - for id, tpl in self.nameDictionary.iteritems(): + for id, tpl in self.nameDictionary.items(): cat, str = tpl if cat in cat2part: nameParts[cat2part[cat]][str] = id @@ -113,7 +113,7 @@ class NameGenerator: newtu[1] = (7, name) else: newtu[0] = (8, name) - for tu in self.nameDictionary.items(): + for tu in list(self.nameDictionary.items()): for g in newtu: if tu[1] == g: return tu[0] @@ -129,7 +129,7 @@ class NameGenerator: maxWidth = text.calcWidth(name) maxName = name - print maxName + ' ' + str(maxWidth) + print(maxName + ' ' + str(maxWidth)) return maxName def findWidestName(self): @@ -181,13 +181,13 @@ class NameGenerator: name = self.findWidestName() width = self.text.calcWidth(name) widthStr = str(width) - print 'The widest name is: ' + name + ' (' + widthStr + ' units)' + print('The widest name is: ' + name + ' (' + widthStr + ' units)') def printWidestLastName(self): name = self.findWidestLastName() width = self.text.calcWidth(name) widthStr = str(width) - print 'The widest last name is: ' + name + ' (' + widthStr + ' units)' + print('The widest last name is: ' + name + ' (' + widthStr + ' units)') def randomName(self, boy = 0, girl = 0): if boy and girl: @@ -316,9 +316,9 @@ class NameGenerator: width = self.text.calcWidth(name) widthStr = str(width) if boy: - print 'Boy: ' + name + ' (' + widthStr + ' units)' + print('Boy: ' + name + ' (' + widthStr + ' units)') if girl: - print 'Girl: ' + name + ' (' + widthStr + ' units)' + print('Girl: ' + name + ' (' + widthStr + ' units)') i += 1 def percentOver(self, limit = 9.0, samples = 1000): @@ -332,32 +332,32 @@ class NameGenerator: i += 1 percent = float(over) / float(samples) * 100 - print 'Samples: ' + str(samples) + ' Over: ' + str(over) + ' Percent: ' + str(percent) + print('Samples: ' + str(samples) + ' Over: ' + str(over) + ' Percent: ' + str(percent)) def totalNames(self): firsts = len(self.boyFirsts) + len(self.girlFirsts) + len(self.neutralFirsts) - print 'Total firsts: ' + str(firsts) + print('Total firsts: ' + str(firsts)) lasts = len(self.lastPrefixes) * len(self.lastSuffixes) - print 'Total lasts: ' + str(lasts) + print('Total lasts: ' + str(lasts)) neutralTitleFirsts = len(self.neutralTitles) * len(self.neutralFirsts) boyTitleFirsts = len(self.boyTitles) * (len(self.neutralFirsts) + len(self.boyFirsts)) + len(self.neutralTitles) * len(self.boyFirsts) girlTitleFirsts = len(self.girlTitles) * (len(self.neutralFirsts) + len(self.girlFirsts)) + len(self.neutralTitles) * len(self.girlFirsts) totalTitleFirsts = neutralTitleFirsts + boyTitleFirsts + girlTitleFirsts - print 'Total title firsts: ' + str(totalTitleFirsts) + print('Total title firsts: ' + str(totalTitleFirsts)) neutralTitleLasts = len(self.neutralTitles) * lasts boyTitleLasts = len(self.boyTitles) * lasts girlTitleLasts = len(self.girlTitles) * lasts totalTitleLasts = neutralTitleLasts + boyTitleFirsts + girlTitleLasts - print 'Total title lasts: ' + str(totalTitleLasts) + print('Total title lasts: ' + str(totalTitleLasts)) neutralFirstLasts = len(self.neutralFirsts) * lasts boyFirstLasts = len(self.boyFirsts) * lasts girlFirstLasts = len(self.girlFirsts) * lasts totalFirstLasts = neutralFirstLasts + boyFirstLasts + girlFirstLasts - print 'Total first lasts: ' + str(totalFirstLasts) + print('Total first lasts: ' + str(totalFirstLasts)) neutralTitleFirstLasts = neutralTitleFirsts * lasts boyTitleFirstLasts = boyTitleFirsts * lasts girlTitleFirstLasts = girlTitleFirsts * lasts totalTitleFirstLasts = neutralTitleFirstLasts + boyTitleFirstLasts + girlTitleFirstLasts - print 'Total title first lasts: ' + str(totalTitleFirstLasts) + print('Total title first lasts: ' + str(totalTitleFirstLasts)) totalNames = firsts + lasts + totalTitleFirsts + totalTitleLasts + totalFirstLasts + totalTitleFirstLasts - print 'Total Names: ' + str(totalNames) + print('Total Names: ' + str(totalNames)) diff --git a/toontown/makeatoon/NameShop.py b/toontown/makeatoon/NameShop.py index 625d6ad..196770b 100644 --- a/toontown/makeatoon/NameShop.py +++ b/toontown/makeatoon/NameShop.py @@ -15,7 +15,7 @@ from toontown.toontowngui import TTDialog import re import string from toontown.toonbase import TTLocalizer -import NameGenerator +from . import NameGenerator import random from otp.distributed import PotentialAvatar from otp.namepanel import NameCheck @@ -155,7 +155,7 @@ class NameShop(StateData.StateData): k = self.allFirsts.index('Von') self.allFirsts[k] = 'von' except: - print "NameShop: Couldn't find von" + print("NameShop: Couldn't find von") if not self.addedGenderSpecific: nameShopGui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_nameShop') @@ -478,7 +478,7 @@ class NameShop(StateData.StateData): try: x.show() except: - print 'NameShop: Tried to show already removed object' + print('NameShop: Tried to show already removed object') if base.cr.productName in ['DE', 'BR']: self.typeANameButton.hide() @@ -493,7 +493,7 @@ class NameShop(StateData.StateData): try: x.hide() except: - print 'NameShop: Tried to hide already removed object' + print('NameShop: Tried to hide already removed object') def uberdestroy(self, guiObjectsToDestroy): self.notify.debug('uberdestroy %s' % str(guiObjectsToDestroy)) @@ -502,7 +502,7 @@ class NameShop(StateData.StateData): x.destroy() del x except: - print 'NameShop: Tried to destroy already removed object' + print('NameShop: Tried to destroy already removed object') def getNameIndices(self): return self.nameIndices @@ -540,7 +540,7 @@ class NameShop(StateData.StateData): name = string.strip(name) return TextEncoder.upper(npcName) == TextEncoder.upper(name) - for npcId in NPCToons.NPCToonDict.keys(): + for npcId in list(NPCToons.NPCToonDict.keys()): npcName = NPCToons.NPCToonDict[npcId][1] if match(npcName): self.notify.info('name matches NPC name "%s"' % npcName) @@ -668,16 +668,16 @@ class NameShop(StateData.StateData): self.nameIndices[0] = self.nameGen.returnUniqueID(uberReturn[3], 0) self.nameFlags[0] = 1 except: - print 'NameShop : Should have found title, uh oh!' - print uberReturn + print('NameShop : Should have found title, uh oh!') + print(uberReturn) try: self.firstIndex = self.allFirsts.index(uberReturn[4]) self.nameIndices[1] = self.nameGen.returnUniqueID(uberReturn[4], 1) self.nameFlags[1] = 1 except: - print 'NameShop : Should have found first name, uh oh!' - print uberReturn + print('NameShop : Should have found first name, uh oh!') + print(uberReturn) try: self.prefixIndex = self.allPrefixes.index(uberReturn[5]) @@ -689,8 +689,8 @@ class NameShop(StateData.StateData): else: self.nameFlags[3] = 0 except: - print 'NameShop : Some part of last name not found, uh oh!' - print uberReturn + print('NameShop : Some part of last name not found, uh oh!') + print(uberReturn) self.updateCheckBoxes() self.updateLists() @@ -938,7 +938,7 @@ class NameShop(StateData.StateData): self.fsm.request('PickAName') flags = [pattern[0] != -1, pattern[1] != -1, pattern[2] != -1] names = [] - for i in xrange(len(pattern)): + for i in range(len(pattern)): if pattern[i] != -1: names.append(pnp.getNamePartString(self.toon.style.gender, i, pattern[i])) else: diff --git a/toontown/makeatoon/ShuffleButton.py b/toontown/makeatoon/ShuffleButton.py index 4f0cf66..c0ff666 100644 --- a/toontown/makeatoon/ShuffleButton.py +++ b/toontown/makeatoon/ShuffleButton.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals -from MakeAToonGlobals import * +from .MakeAToonGlobals import * from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import * import random diff --git a/toontown/minigame/CatchGameGlobals.py b/toontown/minigame/CatchGameGlobals.py index f326074..5bd697e 100644 --- a/toontown/minigame/CatchGameGlobals.py +++ b/toontown/minigame/CatchGameGlobals.py @@ -25,7 +25,7 @@ for type in DropObjectTypes: Name2DropObjectType[type.name] = type Name2DOTypeId = {} -names = Name2DropObjectType.keys() +names = list(Name2DropObjectType.keys()) names.sort() for i in range(len(names)): Name2DOTypeId[names[i]] = i diff --git a/toontown/minigame/CatchGameToonSD.py b/toontown/minigame/CatchGameToonSD.py index 300f10f..139c43b 100644 --- a/toontown/minigame/CatchGameToonSD.py +++ b/toontown/minigame/CatchGameToonSD.py @@ -7,7 +7,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State -import CatchGameGlobals +from . import CatchGameGlobals from direct.task.Task import Task class CatchGameToonSD(StateData.StateData): diff --git a/toontown/minigame/ClerkPurchase.py b/toontown/minigame/ClerkPurchase.py index 5e4a901..d319b44 100644 --- a/toontown/minigame/ClerkPurchase.py +++ b/toontown/minigame/ClerkPurchase.py @@ -1,4 +1,4 @@ -from PurchaseBase import * +from .PurchaseBase import * from toontown.toonbase import ToontownTimer COUNT_UP_RATE = 0.15 DELAY_BEFORE_COUNT_UP = 1.25 diff --git a/toontown/minigame/CogThief.py b/toontown/minigame/CogThief.py index 79758db..1623e6f 100644 --- a/toontown/minigame/CogThief.py +++ b/toontown/minigame/CogThief.py @@ -217,7 +217,7 @@ class CogThief(DirectObject): return if not hasattr(self.game, 'barrels'): return - if self.goalId not in xrange(len(self.game.barrels)): + if self.goalId not in range(len(self.game.barrels)): return if not self.lastThinkTime: self.lastThinkTime = globalClock.getFrameTime() @@ -396,7 +396,7 @@ class CogThief(DirectObject): def seeFriends(self): self.clearVisibleList() - for cogIndex in self.game.cogInfo.keys(): + for cogIndex in list(self.game.cogInfo.keys()): if cogIndex == self.cogIndex: continue if self.sameGoal(cogIndex): diff --git a/toontown/minigame/DistributedCannonGame.py b/toontown/minigame/DistributedCannonGame.py index ee7d14a..9b5626e 100644 --- a/toontown/minigame/DistributedCannonGame.py +++ b/toontown/minigame/DistributedCannonGame.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State @@ -9,12 +9,12 @@ from direct.fsm import State from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownTimer from direct.task.Task import Task -import Trajectory +from . import Trajectory import math from toontown.toon import ToonHead from toontown.effects import Splash from toontown.effects import DustCloud -import CannonGameGlobals +from . import CannonGameGlobals from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer @@ -189,7 +189,7 @@ class DistributedCannonGame(DistributedMinigame): del self.downButton del self.leftButton del self.rightButton - for avId in self.toonHeadDict.keys(): + for avId in list(self.toonHeadDict.keys()): head = self.toonHeadDict[avId] head.stopBlink() head.stopLookAroundNow() @@ -201,12 +201,12 @@ class DistributedCannonGame(DistributedMinigame): head.delete() del self.toonHeadDict - for model in self.toonModelDict.values(): + for model in list(self.toonModelDict.values()): model.removeNode() del self.toonModelDict del self.toonScaleDict - for interval in self.toonIntervalDict.values(): + for interval in list(self.toonIntervalDict.values()): interval.finish() del self.toonIntervalDict @@ -253,7 +253,7 @@ class DistributedCannonGame(DistributedMinigame): self.tower.reparentTo(hidden) for avId in self.avIdList: self.cannonDict[avId][0].reparentTo(hidden) - if self.dropShadowDict.has_key(avId): + if avId in self.dropShadowDict: self.dropShadowDict[avId].reparentTo(hidden) av = self.getAvatar(avId) if av: @@ -706,10 +706,10 @@ class DistributedCannonGame(DistributedMinigame): self.notify.debug('FIRING CANNON FOR AVATAR ' + str(avId)) flightResults = self.__calcFlightResults(avId, launchTime) if not isClient(): - print 'EXECWARNING DistributedCannonGame: %s' % flightResults + print('EXECWARNING DistributedCannonGame: %s' % flightResults) printStack() for key in flightResults: - exec "%s = flightResults['%s']" % (key, key) + exec("%s = flightResults['%s']" % (key, key)) self.notify.debug('start position: ' + str(startPos)) self.notify.debug('start velocity: ' + str(startVel)) diff --git a/toontown/minigame/DistributedCannonGameAI.py b/toontown/minigame/DistributedCannonGameAI.py index 5350f14..cf34f15 100644 --- a/toontown/minigame/DistributedCannonGameAI.py +++ b/toontown/minigame/DistributedCannonGameAI.py @@ -1,9 +1,9 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task -import CannonGameGlobals +from . import CannonGameGlobals class DistributedCannonGameAI(DistributedMinigameAI): diff --git a/toontown/minigame/DistributedCatchGame.py b/toontown/minigame/DistributedCatchGame.py index ca9ec0e..4a9346e 100644 --- a/toontown/minigame/DistributedCatchGame.py +++ b/toontown/minigame/DistributedCatchGame.py @@ -1,31 +1,32 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.interval.IntervalGlobal import * -from OrthoWalk import * +from .OrthoWalk import * from direct.showbase.PythonUtil import Functor, bound, lineupPos, lerp from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import TTLocalizer -import CatchGameGlobals +from . import CatchGameGlobals from direct.task.Task import Task from toontown.toon import Toon from toontown.suit import Suit -import MinigameAvatarScorePanel +from . import MinigameAvatarScorePanel from toontown.toonbase import ToontownTimer from toontown.toonbase import ToontownGlobals -import CatchGameToonSD -import Trajectory +from . import CatchGameToonSD +from . import Trajectory import math from direct.distributed import DistributedSmoothNode from direct.showbase.RandomNumGen import RandomNumGen -import MinigameGlobals +from . import MinigameGlobals from toontown.toon import ToonDNA from toontown.suit import SuitDNA -from CatchGameGlobals import DropObjectTypes -from CatchGameGlobals import Name2DropObjectType -from DropPlacer import * -from DropScheduler import * +from .CatchGameGlobals import DropObjectTypes +from .CatchGameGlobals import Name2DropObjectType +from .DropPlacer import * +from .DropScheduler import * +from functools import reduce class DistributedCatchGame(DistributedMinigame): DropTaskName = 'dropSomething' @@ -80,7 +81,7 @@ class DistributedCatchGame(DistributedMinigame): 'coconut': 0.7, 'watermelon': 0.6, 'pineapple': 0.45} - if modelScales.has_key(objType.name): + if objType.name in modelScales: model.setScale(modelScales[objType.name]) if objType == Name2DropObjectType['pear']: model.setZ(-.6) @@ -132,7 +133,7 @@ class DistributedCatchGame(DistributedMinigame): self.introMovie.finish() del self.introMovie del self.__textGen - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): toonSD = self.toonSDs[avId] toonSD.unload() @@ -146,7 +147,7 @@ class DistributedCatchGame(DistributedMinigame): del self.ground self.dropShadow.removeNode() del self.dropShadow - for model in self.dropObjModels.values(): + for model in list(self.dropObjModels.values()): model.removeNode() del self.dropObjModels @@ -205,8 +206,8 @@ class DistributedCatchGame(DistributedMinigame): self.DropPeriod /= scaledNumPlayers typeProbs = {'fruit': 3, 'anvil': 1} - probSum = reduce(lambda x, y: x + y, typeProbs.values()) - for key in typeProbs.keys(): + probSum = reduce(lambda x, y: x + y, list(typeProbs.values())) + for key in list(typeProbs.keys()): typeProbs[key] = float(typeProbs[key]) / probSum scheduler = DropScheduler(CatchGameGlobals.GameDuration, self.FirstDropDelay, self.DropPeriod, self.MaxDropDuration, self.FasterDropDelay, self.FasterDropPeriodMult) @@ -306,8 +307,8 @@ class DistributedCatchGame(DistributedMinigame): def showDropGrid(self): self.hideDropGrid() self.dropMarkers = [] - print 'dropRows: %s' % self.DropRows - print 'dropCols: %s' % self.DropColumns + print('dropRows: %s' % self.DropRows) + print('dropCols: %s' % self.DropColumns) for row in range(self.DropRows): self.dropMarkers.append([]) rowList = self.dropMarkers[row] @@ -390,7 +391,7 @@ class DistributedCatchGame(DistributedMinigame): self.notify.debug('offstage') DistributedSmoothNode.activateSmoothing(1, 0) self.introMovie.finish() - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): self.toonSDs[avId].exit() self.hidePosts() @@ -478,7 +479,7 @@ class DistributedCatchGame(DistributedMinigame): self.scores = [0] * self.numPlayers spacing = 0.4 - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): avId = self.avIdList[i] avName = self.getAvatarName(avId) scorePanel = MinigameAvatarScorePanel.MinigameAvatarScorePanel(avId, avName) @@ -519,7 +520,7 @@ class DistributedCatchGame(DistributedMinigame): self.ignore(self.uniqueName('enter' + suit.collSphereName)) suit.collNodePath.removeNode() - for ival in self.dropIntervals.values(): + for ival in list(self.dropIntervals.values()): ival.finish() del self.dropIntervals @@ -544,7 +545,7 @@ class DistributedCatchGame(DistributedMinigame): objName = self.droppedObjNames[objNum] objType = Name2DropObjectType[objName] if objType.good: - if not self.droppedObjCaught.has_key(objNum): + if objNum not in self.droppedObjCaught: if isLocal: base.playSfx(self.sndGoodCatch) fruit = self.getObjModel(objName) @@ -574,7 +575,7 @@ class DistributedCatchGame(DistributedMinigame): self.fruitsCaught += 1 def finishDropInterval(self, objNum): - if self.dropIntervals.has_key(objNum): + if objNum in self.dropIntervals: self.dropIntervals[objNum].finish() def scheduleDrops(self): @@ -778,7 +779,7 @@ class DistributedCatchGame(DistributedMinigame): suit.lookAt(stopPos) def cleanup(self = self, data = data, lerpNP = lerpNP): - if data.has_key('suit'): + if 'suit' in data: suit = data['suit'] suit.reparentTo(hidden) self.suits.append(suit) diff --git a/toontown/minigame/DistributedCatchGameAI.py b/toontown/minigame/DistributedCatchGameAI.py index 704a8a7..4acd7cd 100644 --- a/toontown/minigame/DistributedCatchGameAI.py +++ b/toontown/minigame/DistributedCatchGameAI.py @@ -1,9 +1,9 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from toontown.ai.ToonBarrier import * from direct.fsm import ClassicFSM, State from direct.fsm import State -import CatchGameGlobals -import MinigameGlobals +from . import CatchGameGlobals +from . import MinigameGlobals class DistributedCatchGameAI(DistributedMinigameAI): diff --git a/toontown/minigame/DistributedCogThiefGame.py b/toontown/minigame/DistributedCogThiefGame.py index a7e7148..e1f5f7e 100644 --- a/toontown/minigame/DistributedCogThiefGame.py +++ b/toontown/minigame/DistributedCogThiefGame.py @@ -145,7 +145,7 @@ class DistributedCogThiefGame(DistributedMinigame): barrel.removeNode() del self.barrels - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): toonSD = self.toonSDs[avId] toonSD.unload() @@ -171,7 +171,7 @@ class DistributedCogThiefGame(DistributedMinigame): toonSD.enter() toonSD.fsm.request('normal') self.stopGameWalk() - for cogIndex in xrange(self.getNumCogs()): + for cogIndex in range(self.getNumCogs()): suit = self.cogInfo[cogIndex]['suit'].suit pos = self.cogInfo[cogIndex]['pos'] suit.reparentTo(self.gameBoard) @@ -181,12 +181,12 @@ class DistributedCogThiefGame(DistributedMinigame): self.toonHitTracks[avId] = Wait(0.1) self.toonRNGs = [] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen)) self.sndTable = {'hitBySuit': [None] * self.numPlayers, 'falling': [None] * self.numPlayers} - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): self.sndTable['hitBySuit'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_Tag_C.mp3') self.sndTable['falling'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.mp3') @@ -202,7 +202,7 @@ class DistributedCogThiefGame(DistributedMinigame): for barrel in self.barrels: barrel.hide() - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): self.toonSDs[avId].exit() for avId in self.avIdList: @@ -350,7 +350,7 @@ class DistributedCogThiefGame(DistributedMinigame): base.mouseInterfaceNode.setRotateSpeed(ToontownGlobals.ToonRotateSpeed * 4) def initCogInfo(self): - for cogIndex in xrange(self.getNumCogs()): + for cogIndex in range(self.getNumCogs()): self.cogInfo[cogIndex] = {'pos': Point3(CTGG.CogStartingPositions[cogIndex]), 'goal': CTGG.NoGoal, 'goalId': CTGG.InvalidGoalId, @@ -363,7 +363,7 @@ class DistributedCogThiefGame(DistributedMinigame): 'ac', 'bc', 'ms'] - for suitIndex in xrange(self.getNumCogs()): + for suitIndex in range(self.getNumCogs()): st = self.randomNumGen.choice(suitTypes) suit = CogThief.CogThief(suitIndex, st, self, self.getCogSpeed()) self.cogInfo[suitIndex]['suit'] = suit @@ -403,7 +403,7 @@ class DistributedCogThiefGame(DistributedMinigame): return if self.gameIsEnding: return - self.notify.debug('avatar ' + `avId` + ' hit by a suit') + self.notify.debug('avatar ' + repr(avId) + ' hit by a suit') if avId != self.localAvId: self.showToonHitBySuit(avId, timestamp) self.makeSuitRespondToToonHit(timestamp, suitNum) @@ -419,7 +419,7 @@ class DistributedCogThiefGame(DistributedMinigame): oldTrack.finish() toon.setPos(curPos) toon.setZ(self.TOON_Z) - parentNode = render.attachNewNode('mazeFlyToonParent-' + `avId`) + parentNode = render.attachNewNode('mazeFlyToonParent-' + repr(avId)) parentNode.setPos(toon.getPos()) toon.reparentTo(parentNode) toon.setPos(0, 0, 0) @@ -649,7 +649,7 @@ class DistributedCogThiefGame(DistributedMinigame): if self.gameFSM.getCurrentState().getName() not in ['play']: self.notify.warning('ignoring msg: av %s hit by suit' % avId) return - self.notify.debug('avatar ' + `avId` + ' throwing pie') + self.notify.debug('avatar ' + repr(avId) + ' throwing pie') if avId != self.localAvId: pos = Point3(x, y, z) self.showToonThrowingPie(avId, timestamp, heading, pos) @@ -745,7 +745,7 @@ class DistributedCogThiefGame(DistributedMinigame): return if self.gameIsEnding: return - self.notify.debug('avatar ' + `avId` + ' hit by a suit') + self.notify.debug('avatar ' + repr(avId) + ' hit by a suit') if avId != self.localAvId: self.makeSuitRespondToPieHit(timestamp, suitNum) diff --git a/toontown/minigame/DistributedCogThiefGameAI.py b/toontown/minigame/DistributedCogThiefGameAI.py index d3dd853..3972489 100644 --- a/toontown/minigame/DistributedCogThiefGameAI.py +++ b/toontown/minigame/DistributedCogThiefGameAI.py @@ -89,14 +89,14 @@ class DistributedCogThiefGameAI(DistributedMinigameAI.DistributedMinigameAI): pass def initCogInfo(self): - for cogIndex in xrange(self.getNumCogs()): + for cogIndex in range(self.getNumCogs()): self.cogInfo[cogIndex] = {'pos': Point3(CogThiefGameGlobals.CogStartingPositions[cogIndex]), 'goal': CTGG.NoGoal, 'goalId': CTGG.InvalidGoalId, 'barrel': CTGG.NoBarrelCarried} def initBarrelInfo(self): - for barrelIndex in xrange(CogThiefGameGlobals.NumBarrels): + for barrelIndex in range(CogThiefGameGlobals.NumBarrels): self.barrelInfo[barrelIndex] = {'pos': Point3(CogThiefGameGlobals.BarrelStartingPositions[barrelIndex]), 'carriedBy': CTGG.BarrelOnGround, 'stolen': False} @@ -163,11 +163,11 @@ class DistributedCogThiefGameAI(DistributedMinigameAI.DistributedMinigameAI): def startSuitGoals(self): delayTimes = [] - for cogIndex in xrange(self.getNumCogs()): + for cogIndex in range(self.getNumCogs()): delayTimes.append(cogIndex * 1.0) random.shuffle(delayTimes) - for cogIndex in xrange(self.getNumCogs()): + for cogIndex in range(self.getNumCogs()): self.doMethodLater(delayTimes[cogIndex], self.chooseSuitGoal, self.uniqueName('choseSuitGoal-%d-' % cogIndex), extraArgs=[cogIndex]) def chaseToon(self, suitNum, avId): @@ -279,7 +279,7 @@ class DistributedCogThiefGameAI(DistributedMinigameAI.DistributedMinigameAI): def chooseReturnPos(self, cogIndex, cogPos): shortestDistance = 10000 shortestReturnIndex = -1 - for retIndex in xrange(len(CTGG.CogReturnPositions)): + for retIndex in range(len(CTGG.CogReturnPositions)): retPos = CTGG.CogReturnPositions[retIndex] distance = (cogPos - retPos).length() if distance < shortestDistance: @@ -360,7 +360,7 @@ class DistributedCogThiefGameAI(DistributedMinigameAI.DistributedMinigameAI): def getNumBarrelsStolen(self): numStolen = 0 - for barrel in self.barrelInfo.values(): + for barrel in list(self.barrelInfo.values()): if barrel['stolen']: numStolen += 1 diff --git a/toontown/minigame/DistributedDivingGame.py b/toontown/minigame/DistributedDivingGame.py index b3dd78e..4abd274 100644 --- a/toontown/minigame/DistributedDivingGame.py +++ b/toontown/minigame/DistributedDivingGame.py @@ -2,7 +2,7 @@ from direct.showbase.ShowBaseGlobal import * from toontown.toonbase.ToonBaseGlobal import * from direct.interval.IntervalGlobal import * from toontown.toonbase import ToontownTimer -from DistributedMinigame import * +from .DistributedMinigame import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM from direct.fsm import State @@ -10,18 +10,18 @@ from direct.task import Task from direct.actor import Actor from toontown.toon import LaffMeter from direct.distributed import DistributedSmoothNode -import ArrowKeys -import Ring -import RingTrack -import DivingGameGlobals -import RingGroup -import RingTrackGroups +from . import ArrowKeys +from . import Ring +from . import RingTrack +from . import DivingGameGlobals +from . import RingGroup +from . import RingTrackGroups import random -import DivingGameToonSD -import DivingFishSpawn -import DivingTreasure +from . import DivingGameToonSD +from . import DivingFishSpawn +from . import DivingTreasure import math -import TreasureScorePanel +from . import TreasureScorePanel from otp.distributed.TelemetryLimiter import TelemetryLimiter, TLGatherAllAvs from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer @@ -150,7 +150,7 @@ class DistributedDivingGame(DistributedMinigame): self.environModel.removeNode() del self.environModel self.removeChildGameFSM(self.gameFSM) - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): toonSD = self.toonSDs[avId] toonSD.unload() @@ -168,7 +168,7 @@ class DistributedDivingGame(DistributedMinigame): else: spawnerId = int(name[2]) spawnId = int(name[3:len(name)]) - if self.spawners[spawnerId].fishArray.has_key(spawnId): + if spawnId in self.spawners[spawnerId].fishArray: self.sendUpdate('handleFishCollision', [avId, spawnId, spawnerId, @@ -290,7 +290,7 @@ class DistributedDivingGame(DistributedMinigame): self.boatTilt.finish() self.mapModel.hide() DistributedSmoothNode.activateSmoothing(1, 0) - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): self.toonSDs[avId].exit() base.camLens.setFar(ToontownGlobals.DefaultCameraFar) @@ -334,7 +334,7 @@ class DistributedDivingGame(DistributedMinigame): self.cSphereNodePath2.removeNode() del self.cSphereNodePath2 if hasattr(self, 'remoteToonCollNPs'): - for np in self.remoteToonCollNPs.values(): + for np in list(self.remoteToonCollNPs.values()): np.removeNode() del self.remoteToonCollNPs @@ -707,7 +707,7 @@ class DistributedDivingGame(DistributedMinigame): self.localLerp.finish() self.localLerp = Sequence(Func(toonSD.fsm.request, 'freeze'), Wait(3.0), Func(toonSD.fsm.request, 'normal')) self.localLerp.start(ts) - if self.spawners[spawnerId].fishArray.has_key(spawnId): + if spawnId in self.spawners[spawnerId].fishArray: fish = self.spawners[spawnerId].fishArray[spawnId] endX = self.spawners[spawnerId].position.getX() if fish.name == 'clown': @@ -760,7 +760,7 @@ class DistributedDivingGame(DistributedMinigame): def fishRemove(self, code): spawnId = int(code[1:len(code)]) spawnerId = int(code[0]) - if self.spawners[spawnerId].fishArray.has_key(spawnId): + if spawnId in self.spawners[spawnerId].fishArray: fish = self.spawners[spawnerId].fishArray[spawnId] fish.specialLerp.finish() fish.moveLerp.finish() diff --git a/toontown/minigame/DistributedDivingGameAI.py b/toontown/minigame/DistributedDivingGameAI.py index b70f323..f653f22 100644 --- a/toontown/minigame/DistributedDivingGameAI.py +++ b/toontown/minigame/DistributedDivingGameAI.py @@ -1,10 +1,10 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM from direct.fsm import State from direct.actor import Actor -import DivingGameGlobals +from . import DivingGameGlobals import random import random import types @@ -262,7 +262,7 @@ class DistributedDivingGameAI(DistributedMinigameAI): def setGameReady(self): self.notify.debug('setGameReady') self.sendUpdate('setTrolleyZone', [self.trolleyZone]) - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): self.scoreDict[avId] = 0 self.SPAWNTIME = self.difficultyPatternsAI[self.getSafezoneId()][0] @@ -279,7 +279,7 @@ class DistributedDivingGameAI(DistributedMinigameAI): DistributedMinigameAI.setGameStart(self, timestamp) self.gameFSM.request('swimming') self.scoreTracking = {} - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): self.scoreTracking[avId] = [0, 0, 0, @@ -307,10 +307,10 @@ class DistributedDivingGameAI(DistributedMinigameAI): timestamp = globalClockDelta.getFrameNetworkTime() newSpot = int(random.random() * 30) self.scoreTracking[avId][4] += 1 - for someAvId in self.scoreDict.keys(): + for someAvId in list(self.scoreDict.keys()): if someAvId == avId: self.scoreDict[avId] += 10 * (self.REWARDMOD * 0.25) - self.scoreDict[someAvId] += 10 * (self.REWARDMOD * 0.75 / float(len(self.scoreDict.keys()))) + self.scoreDict[someAvId] += 10 * (self.REWARDMOD * 0.75 / float(len(list(self.scoreDict.keys())))) self.sendUpdate('incrementScore', [avId, newSpot, timestamp]) @@ -330,7 +330,7 @@ class DistributedDivingGameAI(DistributedMinigameAI): DistributedMinigameAI.gameOver(self) trackingString = 'MiniGame Stats : Diving Game' trackingString += '\nDistrict:%s' % self.getSafezoneId() - for avId in self.scoreTracking.keys(): + for avId in list(self.scoreTracking.keys()): trackingString = trackingString + '\navId:%s fishHits:%s crabHits:%s treasureCatches:%s treasureDrops:%s treasureRecoveries:%s Score: %s' % (avId, self.scoreTracking[avId][0], self.scoreTracking[avId][1], @@ -358,7 +358,7 @@ class DistributedDivingGameAI(DistributedMinigameAI): def timerExpired(self, task): self.notify.debug('timer expired') - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): if self.scoreDict[avId] < 5: self.scoreDict[avId] = 5 diff --git a/toontown/minigame/DistributedIceGame.py b/toontown/minigame/DistributedIceGame.py index 2ffc71e..1c2e81f 100644 --- a/toontown/minigame/DistributedIceGame.py +++ b/toontown/minigame/DistributedIceGame.py @@ -126,7 +126,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.setupForceArrow(avId) index += 1 - for index in xrange(len(self.avIdList), 4): + for index in range(len(self.avIdList), 4): self.setupTire(-index, index) self.setupForceArrow(-index) @@ -171,7 +171,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.treasureGrabSound = loader.loadSfx('phase_4/audio/sfx/MG_sfx_vine_game_bananas.mp3') self.penaltyGrabSound = loader.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.mp3') self.tireSounds = [] - for tireIndex in xrange(4): + for tireIndex in range(4): tireHit = loader.loadSfx('phase_4/audio/sfx/Golf_Hit_Barrier_1.mp3') wallHit = loader.loadSfx('phase_4/audio/sfx/MG_maze_pickup.mp3') obstacleHit = loader.loadSfx('phase_4/audio/sfx/Golf_Hit_Barrier_2.mp3') @@ -190,7 +190,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce del self.music self.gameBoard.removeNode() del self.gameBoard - for forceArrow in self.forceArrowDict.values(): + for forceArrow in list(self.forceArrowDict.values()): forceArrow.removeNode() del self.forceArrowDict @@ -250,7 +250,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.notify.debug('setGameReady') if DistributedMinigame.DistributedMinigame.setGameReady(self): return - for index in xrange(self.numPlayers): + for index in range(self.numPlayers): avId = self.avIdList[index] toon = self.getAvatar(avId) if toon: @@ -279,7 +279,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.scores = [0] * self.numPlayers spacing = 0.4 - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): avId = self.avIdList[i] avName = self.getAvatarName(avId) scorePanel = MinigameAvatarScorePanel.MinigameAvatarScorePanel(avId, avName) @@ -375,7 +375,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce body.setAngularVel(0, 0, 0) body.setLinearVel(0, 0, 0) - for index in xrange(len(self.allTireInputs)): + for index in range(len(self.allTireInputs)): input = self.allTireInputs[index] avId = self.avIdList[index] body = self.getTireBody(avId) @@ -436,7 +436,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.scoreCircle.show() self.notify.debug('newScores = %s' % self.newScores) circleStartTime = 0 - for index in xrange(len(sortedByDistance)): + for index in range(len(sortedByDistance)): distance = sortedByDistance[index][1] avId = sortedByDistance[index][0] scorePanelIndex = self.avIdList.index(avId) @@ -490,7 +490,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce (lX, bY), (rX, bY))) scorePanelLocs = scorePanelLocs[self.numPlayers - 1] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): panel = self.scorePanels[i] pos = scorePanelLocs[i] lerpTrack.append(Parallel(LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 2.0, blendType='easeInOut'))) @@ -558,7 +558,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.forceArrowDict[avId] = arrow def hideForceArrows(self): - for forceArrow in self.forceArrowDict.values(): + for forceArrow in list(self.forceArrowDict.values()): forceArrow.hide() def showForceArrows(self, realPlayersOnly = True): @@ -588,7 +588,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce taskMgr.remove(self.debugTaskName) def debugTask(self, task): - if self.canDrive and self.tireDict.has_key(localAvatar.doId): + if self.canDrive and localAvatar.doId in self.tireDict: dt = globalClock.getDt() forceMove = 25000 forceMoveDt = forceMove @@ -787,15 +787,15 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.gameFSM.request('moveTires') def enableAllTireBodies(self): - for avId in self.tireDict.keys(): + for avId in list(self.tireDict.keys()): self.tireDict[avId]['tireBody'].enable() def disableAllTireBodies(self): - for avId in self.tireDict.keys(): + for avId in list(self.tireDict.keys()): self.tireDict[avId]['tireBody'].disable() def areAllTiresDisabled(self): - for avId in self.tireDict.keys(): + for avId in list(self.tireDict.keys()): if self.tireDict[avId]['tireBody'].isEnabled(): return False @@ -810,13 +810,13 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce def sendTirePositions(self): tirePositions = [] - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] tire = self.getTireBody(avId) pos = Point3(tire.getPosition()) tirePositions.append([pos[0], pos[1], pos[2]]) - for index in xrange(len(self.avIdList), 4): + for index in range(len(self.avIdList), 4): avId = -index tire = self.getTireBody(avId) pos = Point3(tire.getPosition()) @@ -827,7 +827,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce def setFinalPositions(self, finalPos): if not self.hasLocalToon: return - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] tire = self.getTireBody(avId) np = self.getTireNp(avId) @@ -835,7 +835,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce tire.setPosition(pos[0], pos[1], pos[2]) np.setPos(pos[0], pos[1], pos[2]) - for index in xrange(len(self.avIdList), 4): + for index in range(len(self.avIdList), 4): avId = -index tire = self.getTireBody(avId) np = self.getTireNp(avId) @@ -870,7 +870,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce self.gameFSM.request(state) def putAllTiresInStartingPositions(self): - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] np = self.tireDict[avId]['tireNodePath'] np.setPos(IceGameGlobals.StartingPositions[index]) @@ -881,7 +881,7 @@ class DistributedIceGame(DistributedMinigame.DistributedMinigame, DistributedIce body.setPosition(IceGameGlobals.StartingPositions[index]) body.setQuaternion(quat) - for index in xrange(len(self.avIdList), 4): + for index in range(len(self.avIdList), 4): avId = -index np = self.tireDict[avId]['tireNodePath'] np.setPos(IceGameGlobals.StartingPositions[index]) diff --git a/toontown/minigame/DistributedIceGameAI.py b/toontown/minigame/DistributedIceGameAI.py index 0b9f7a5..1d6e61a 100644 --- a/toontown/minigame/DistributedIceGameAI.py +++ b/toontown/minigame/DistributedIceGameAI.py @@ -126,11 +126,11 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): Point3(0, 0, 0), Point3(0, 0, 0)] divisor = 0 - for avId in self.avatarEndingPositions.keys(): + for avId in list(self.avatarEndingPositions.keys()): divisor += 1 oneClientEndingPositions = self.avatarEndingPositions[avId] avIndex = self.avIdList.index(avId) - for index in xrange(len(oneClientEndingPositions)): + for index in range(len(oneClientEndingPositions)): pos = oneClientEndingPositions[index] averagePos[index] += Point3(pos[0], pos[1], pos[2]) self.notify.debug('index = %d averagePos = %s' % (index, averagePos)) @@ -177,7 +177,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): sortedByDistance.sort(cmp=compareDistance) self.scoresAsList = [] totalPointsAdded = 0 - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): pos = Point3(*self.finalEndingPositions[index]) pos.setZ(0) length = pos.length() @@ -186,7 +186,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): self.notify.debug('length = %s points=%s avId=%d' % (length, points, avId)) avId = self.avIdList[index] bonusIndex = 0 - for sortIndex in xrange(len(sortedByDistance)): + for sortIndex in range(len(sortedByDistance)): if sortedByDistance[sortIndex][0] == avId: bonusIndex = sortIndex @@ -239,7 +239,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): def waitClientsChoicesTimeout(self, task): self.notify.debug('waitClientsChoicesTimeout: did not hear from all clients') - for avId in self.avatarChoices.keys(): + for avId in list(self.avatarChoices.keys()): if self.avatarChoices[avId] == (-1, 0): self.avatarChoices[avId] = (0, 0) @@ -270,7 +270,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): return (retForce, retDir) def allAvatarsChosen(self): - for avId in self.avatarChoices.keys(): + for avId in list(self.avatarChoices.keys()): choice = self.avatarChoices[avId] if choice[0] == -1 and not self.stateDict[avId] == DistributedMinigameAI.EXITED: return False @@ -307,7 +307,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): if not self.gameFSM or not self.gameFSM.getCurrentState() or self.gameFSM.getCurrentState().getName() != 'waitEndingPositions': return avId = self.air.getAvatarIdFromSender() - if not self.scoreDict.has_key(avId): + if avId not in self.scoreDict: self.notify.warning('PROBLEM: avatar %s called claimTreasure(%s) but he is not in the scoreDict: %s. avIdList is: %s' % (avId, treasureNum, self.scoreDict, @@ -328,7 +328,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): if not self.gameFSM or not self.gameFSM.getCurrentState() or self.gameFSM.getCurrentState().getName() != 'waitEndingPositions': return avId = self.air.getAvatarIdFromSender() - if not self.scoreDict.has_key(avId): + if avId not in self.scoreDict: self.notify.warning('PROBLEM: avatar %s called claimPenalty(%s) but he is not in the scoreDict: %s. avIdList is: %s' % (avId, penaltyNum, self.scoreDict, @@ -347,7 +347,7 @@ class DistributedIceGameAI(DistributedMinigameAI.DistributedMinigameAI): def checkScores(self): self.scoresAsList = [] - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] if self.scoreDict[avId] < 0: self.scoreDict[avId] = 1 diff --git a/toontown/minigame/DistributedMazeGame.py b/toontown/minigame/DistributedMazeGame.py index 9b9c1ed..763aead 100644 --- a/toontown/minigame/DistributedMazeGame.py +++ b/toontown/minigame/DistributedMazeGame.py @@ -11,17 +11,17 @@ from direct.distributed.ClockDelta import globalClockDelta from pandac.PandaModules import Point3, Vec3 from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownTimer -from DistributedMinigame import DistributedMinigame -from MazeSuit import MazeSuit -from OrthoWalk import OrthoWalk -from OrthoDrive import OrthoDrive -import MazeGameGlobals -import MazeData -import MazeTreasure -import Trajectory -import Maze -import MinigameAvatarScorePanel -import MinigameGlobals +from .DistributedMinigame import DistributedMinigame +from .MazeSuit import MazeSuit +from .OrthoWalk import OrthoWalk +from .OrthoDrive import OrthoDrive +from . import MazeGameGlobals +from . import MazeData +from . import MazeTreasure +from . import Trajectory +from . import Maze +from . import MinigameAvatarScorePanel +from . import MinigameGlobals class DistributedMazeGame(DistributedMinigame): notify = directNotify.newCategory('DistributedMazeGame') @@ -565,11 +565,11 @@ class DistributedMazeGame(DistributedMinigame): camera.setPos(self.camOffset) self.__spawnCameraTask() self.toonRNGs = [] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): self.toonRNGs.append(RandomNumGen.RandomNumGen(self.randomNumGen)) self.treasures = [] - for i in xrange(self.maze.numTreasures): + for i in range(self.maze.numTreasures): self.treasures.append(MazeTreasure.MazeTreasure(self.treasureModel, self.maze.treasurePosList[i], i, self.doId)) self.__loadSuits() @@ -578,12 +578,12 @@ class DistributedMazeGame(DistributedMinigame): self.sndTable = {'hitBySuit': [None] * self.numPlayers, 'falling': [None] * self.numPlayers} - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): self.sndTable['hitBySuit'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_Tag_C.mp3') self.sndTable['falling'][i] = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.mp3') self.grabSounds = [] - for i in xrange(5): + for i in range(5): self.grabSounds.append(base.loader.loadSfx('phase_4/audio/sfx/MG_maze_pickup.mp3')) self.grabSoundIndex = 0 @@ -606,7 +606,7 @@ class DistributedMazeGame(DistributedMinigame): if self.introTrack.isPlaying(): self.introTrack.finish() del self.introTrack - for avId in self.toonHitTracks.keys(): + for avId in list(self.toonHitTracks.keys()): track = self.toonHitTracks[avId] if track.isPlaying(): track.finish() @@ -690,7 +690,7 @@ class DistributedMazeGame(DistributedMinigame): def enterPlay(self): self.notify.debug('enterPlay') - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): avId = self.avIdList[i] avName = self.getAvatarName(avId) scorePanel = MinigameAvatarScorePanel.MinigameAvatarScorePanel(avId, avName) @@ -767,7 +767,7 @@ class DistributedMazeGame(DistributedMinigame): if self.gameFSM.getCurrentState().getName() not in ['play', 'showScores']: self.notify.warning('ignoring msg: av %s hit by suit' % avId) return - self.notify.debug('avatar ' + `avId` + ' hit by a suit') + self.notify.debug('avatar ' + repr(avId) + ' hit by a suit') if avId != self.localAvId: self.__showToonHitBySuit(avId, timestamp) @@ -782,7 +782,7 @@ class DistributedMazeGame(DistributedMinigame): oldTrack.finish() toon.setPos(curPos) toon.setZ(self.TOON_Z) - parentNode = render.attachNewNode('mazeFlyToonParent-' + `avId`) + parentNode = render.attachNewNode('mazeFlyToonParent-' + repr(avId)) parentNode.setPos(toon.getPos()) toon.reparentTo(parentNode) toon.setPos(0,0,0) @@ -823,7 +823,7 @@ class DistributedMazeGame(DistributedMinigame): camera.setPos(startCamPos + camOffset*u) camera.lookAt(toon) return Task.cont - camTaskName = 'mazeToonFlyCam-' + `avId` + camTaskName = 'mazeToonFlyCam-' + repr(avId) taskMgr.add(camTask, camTaskName, priority=20) def cleanupCamTask(self = self, toon = toon, camTaskName = camTaskName, startCamPos = startCamPos): taskMgr.remove(camTaskName) @@ -1004,9 +1004,9 @@ class DistributedMazeGame(DistributedMinigame): fasterTable = self.fasterSuitPeriodsCurve fasterPeriods = fasterTable[safeZone][self.numSuits] suitPeriods = slowerPeriods + fasterPeriods - self.notify.debug('suit periods: ' + `suitPeriods`) + self.notify.debug('suit periods: ' + repr(suitPeriods)) self.randomNumGen.shuffle(suitPeriods) - for i in xrange(self.numSuits): + for i in range(self.numSuits): self.suits.append(MazeSuit(i, self.maze, self.randomNumGen, suitPeriods[i], self.getDifficulty())) def __unloadSuits(self): @@ -1034,14 +1034,14 @@ class DistributedMazeGame(DistributedMinigame): curT = globalClock.getFrameTime() - self.gameStartTime curTic = int(curT * float(MazeGameGlobals.SUIT_TIC_FREQ)) suitUpdates = [] - for i in xrange(len(self.suits)): + for i in range(len(self.suits)): updateTics = self.suits[i].getThinkTimestampTics(curTic) - suitUpdates.extend(zip(updateTics, [i] * len(updateTics))) + suitUpdates.extend(list(zip(updateTics, [i] * len(updateTics)))) suitUpdates.sort(lambda a, b: a[0] - b[0]) if len(suitUpdates) > 0: curTic = 0 - for i in xrange(len(suitUpdates)): + for i in range(len(suitUpdates)): update = suitUpdates[i] tic = update[0] suitIndex = update[1] @@ -1056,10 +1056,10 @@ class DistributedMazeGame(DistributedMinigame): j += 1 unwalkables = [] - for si in xrange(suitIndex): + for si in range(suitIndex): unwalkables.extend(self.suits[si].occupiedTiles) - for si in xrange(suitIndex + 1, len(self.suits)): + for si in range(suitIndex + 1, len(self.suits)): unwalkables.extend(self.suits[si].occupiedTiles) suit.think(curTic, curT, unwalkables) @@ -1084,7 +1084,7 @@ class DistributedMazeGame(DistributedMinigame): (lX, bY), (rX, bY))) scorePanelLocs = scorePanelLocs[self.numPlayers - 1] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): panel = self.scorePanels[i] pos = scorePanelLocs[i] lerpTrack.append(Parallel(LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 2.0, blendType='easeInOut'))) diff --git a/toontown/minigame/DistributedMazeGameAI.py b/toontown/minigame/DistributedMazeGameAI.py index dc0567c..fee0c80 100644 --- a/toontown/minigame/DistributedMazeGameAI.py +++ b/toontown/minigame/DistributedMazeGameAI.py @@ -1,10 +1,10 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State -import PatternGameGlobals +from . import PatternGameGlobals from direct.task.Task import Task -import MazeGameGlobals -import MazeData +from . import MazeGameGlobals +from . import MazeData class DistributedMazeGameAI(DistributedMinigameAI): @@ -33,7 +33,7 @@ class DistributedMazeGameAI(DistributedMinigameAI): self.numTreasures = len(mData['treasurePosList']) self.numTreasuresTaken = 0 self.takenTable = [0] * self.numTreasures - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): self.scoreDict[avId] = 0 def setGameStart(self, timestamp): @@ -72,7 +72,7 @@ class DistributedMazeGameAI(DistributedMinigameAI): if self.gameFSM.getCurrentState() is None or self.gameFSM.getCurrentState().getName() != 'play': return avId = self.air.getAvatarIdFromSender() - if not self.scoreDict.has_key(avId): + if avId not in self.scoreDict: self.notify.warning('PROBLEM: avatar %s called claimTreasure(%s) but he is not in the scoreDict: %s. avIdList is: %s' % (avId, treasureNum, self.scoreDict, @@ -107,11 +107,11 @@ class DistributedMazeGameAI(DistributedMinigameAI): def __doneShowingScores(self, task): self.notify.debug('doneShowingScores') - for key in self.scoreDict.keys(): + for key in list(self.scoreDict.keys()): self.scoreDict[key] = max(1, self.scoreDict[key] / 12) if self.numTreasuresTaken >= self.numTreasures: - for key in self.scoreDict.keys(): + for key in list(self.scoreDict.keys()): self.scoreDict[key] += 8 self.gameOver() diff --git a/toontown/minigame/DistributedMinigame.py b/toontown/minigame/DistributedMinigame.py index 1be9dce..4f3866b 100644 --- a/toontown/minigame/DistributedMinigame.py +++ b/toontown/minigame/DistributedMinigame.py @@ -8,13 +8,13 @@ from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import MinigameRulesPanel +from . import MinigameRulesPanel from direct.task.Task import Task from toontown.toon import Toon from direct.showbase import RandomNumGen from toontown.toonbase import TTLocalizer import random -import MinigameGlobals +from . import MinigameGlobals from direct.showbase import PythonUtil from toontown.toon import TTEmote from otp.avatar import Emote @@ -97,7 +97,7 @@ class DistributedMinigame(DistributedObject.DistributedObject): return self.notify.debug('BASE: handleAnnounceGenerate: send setAvatarJoined') if base.randomMinigameNetworkPlugPull and random.random() < 1.0 / 25: - print '*** DOING RANDOM MINIGAME NETWORK-PLUG-PULL BEFORE SENDING setAvatarJoined ***' + print('*** DOING RANDOM MINIGAME NETWORK-PLUG-PULL BEFORE SENDING setAvatarJoined ***') base.cr.pullNetworkPlug() self.sendUpdate('setAvatarJoined', []) self.normalExit = 1 @@ -172,17 +172,17 @@ class DistributedMinigame(DistributedObject.DistributedObject): taskMgr.doMethodLater(self.randomNetPlugPullDelay, self.doRandomNetworkPlugPull, self.uniqueName('random-netplugpull')) def doRandomAbort(self, task): - print '*** DOING RANDOM MINIGAME ABORT AFTER %.2f SECONDS ***' % self.randomAbortDelay + print('*** DOING RANDOM MINIGAME ABORT AFTER %.2f SECONDS ***' % self.randomAbortDelay) self.d_requestExit() return Task.done def doRandomDisconnect(self, task): - print '*** DOING RANDOM MINIGAME DISCONNECT AFTER %.2f SECONDS ***' % self.randomDisconnectDelay + print('*** DOING RANDOM MINIGAME DISCONNECT AFTER %.2f SECONDS ***' % self.randomDisconnectDelay) self.sendUpdate('setGameReady') return Task.done def doRandomNetworkPlugPull(self, task): - print '*** DOING RANDOM MINIGAME NETWORK-PLUG-PULL AFTER %.2f SECONDS ***' % self.randomNetPlugPullDelay + print('*** DOING RANDOM MINIGAME NETWORK-PLUG-PULL AFTER %.2f SECONDS ***' % self.randomNetPlugPullDelay) base.cr.pullNetworkPlug() return Task.done @@ -236,7 +236,7 @@ class DistributedMinigame(DistributedObject.DistributedObject): self.notify.debug('difficulty: %s' % self.getDifficulty()) self.__serverFinished = 0 for avId in self.remoteAvIdList: - if not self.cr.doId2do.has_key(avId): + if avId not in self.cr.doId2do: self.notify.warning('BASE: toon %s already left or has not yet arrived; waiting for server to abort the game' % avId) return 1 @@ -289,7 +289,7 @@ class DistributedMinigame(DistributedObject.DistributedObject): self.frameworkFSM.request('frameworkWaitServerFinish') def getAvatar(self, avId): - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: return self.cr.doId2do[avId] else: self.notify.warning('BASE: getAvatar: No avatar in doId2do with id: ' + str(avId)) @@ -367,15 +367,15 @@ class DistributedMinigame(DistributedObject.DistributedObject): self.frameworkFSM.request('frameworkCleanup') def setGameExit(self): - print 'setGameExit' + print('setGameExit') if not self.hasLocalToon: return self.notify.debug('BASE: setGameExit: now safe to exit game') if self.frameworkFSM.getCurrentState().getName() != 'frameworkWaitServerFinish': - print 'not waiting' + print('not waiting') self.__serverFinished = 1 else: - print 'waiting' + print('waiting') self.frameworkFSM.request('frameworkCleanup') def exitFrameworkWaitServerFinish(self): @@ -389,7 +389,7 @@ class DistributedMinigame(DistributedObject.DistributedObject): def enterFrameworkCleanup(self): self.notify.debug('BASE: enterFrameworkCleanup') - print 'cleanup' + print('cleanup') for action in self.cleanupActions: action() diff --git a/toontown/minigame/DistributedMinigameAI.py b/toontown/minigame/DistributedMinigameAI.py index 44ef1c8..2461fb4 100644 --- a/toontown/minigame/DistributedMinigameAI.py +++ b/toontown/minigame/DistributedMinigameAI.py @@ -6,12 +6,12 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.shtiker import PurchaseManagerAI from toontown.shtiker import NewbiePurchaseManagerAI -import MinigameCreatorAI +from . import MinigameCreatorAI from direct.task import Task import random -import MinigameGlobals +from . import MinigameGlobals from direct.showbase import PythonUtil -import TravelGameGlobals +from . import TravelGameGlobals from toontown.toonbase import ToontownGlobals EXITED = 0 EXPECTED = 1 @@ -226,7 +226,7 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI): self.setGameAbort() self.__barrier = ToonBarrier('waitClientsReady', self.uniqueName('waitClientsReady'), self.avIdList, READY_TIMEOUT, allAvatarsReady, handleTimeout) - for avId in self.stateDict.keys(): + for avId in list(self.stateDict.keys()): if self.stateDict[avId] == READY: self.__barrier.clear(avId) @@ -269,7 +269,7 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI): self.frameworkFSM.request('frameworkCleanup') self.__barrier = ToonBarrier('waitClientsExit', self.uniqueName('waitClientsExit'), self.avIdList, EXIT_TIMEOUT, allAvatarsExited, handleTimeout) - for avId in self.stateDict.keys(): + for avId in list(self.stateDict.keys()): if self.stateDict[avId] == EXITED: self.__barrier.clear(avId) @@ -334,7 +334,7 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI): votesToUse = self.currentVotes votesArray = [] for avId in self.avIdList: - if votesToUse.has_key(avId): + if avId in votesToUse: votesArray.append(votesToUse[avId]) else: self.notify.warning('votesToUse=%s does not have avId=%d' % (votesToUse, avId)) @@ -371,7 +371,7 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI): else: self.notify.debug('last minigame, handling newbies') if ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY in simbase.air.holidayManager.currentHolidays or ToontownGlobals.JELLYBEAN_TROLLEY_HOLIDAY_MONTH in simbase.air.holidayManager.currentHolidays: - votesArray = map(lambda x: MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier * x, votesArray) + votesArray = [MinigameGlobals.JellybeanTrolleyHolidayScoreMultiplier * x for x in votesArray] for id in self.newbieIdList: pm = NewbiePurchaseManagerAI.NewbiePurchaseManagerAI(self.air, id, self.avIdList, scoreList, self.minigameId, self.trolleyZone) MinigameCreatorAI.acquireMinigameZone(self.zoneId) @@ -432,7 +432,7 @@ class DistributedMinigameAI(DistributedObjectAI.DistributedObjectAI): def getStartingVotes(self): retval = [] for avId in self.avIdList: - if self.startingVotes.has_key(avId): + if avId in self.startingVotes: retval.append(self.startingVotes[avId]) else: self.notify.warning('how did this happen? avId=%d not in startingVotes %s' % (avId, self.startingVotes)) diff --git a/toontown/minigame/DistributedMinigameTemplate.py b/toontown/minigame/DistributedMinigameTemplate.py index c6c018d..4858118 100644 --- a/toontown/minigame/DistributedMinigameTemplate.py +++ b/toontown/minigame/DistributedMinigameTemplate.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import TTLocalizer diff --git a/toontown/minigame/DistributedMinigameTemplateAI.py b/toontown/minigame/DistributedMinigameTemplateAI.py index 9d38daa..c7e4c6b 100644 --- a/toontown/minigame/DistributedMinigameTemplateAI.py +++ b/toontown/minigame/DistributedMinigameTemplateAI.py @@ -1,4 +1,4 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/minigame/DistributedPairingGame.py b/toontown/minigame/DistributedPairingGame.py index c955fa5..075c3e9 100644 --- a/toontown/minigame/DistributedPairingGame.py +++ b/toontown/minigame/DistributedPairingGame.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import TTLocalizer, ToontownTimer @@ -9,8 +9,8 @@ from toontown.minigame import PlayingCardGlobals from toontown.minigame import PairingGameCard from toontown.minigame import PlayingCardDeck from toontown.minigame import PairingGameGlobals -from OrthoWalk import OrthoWalk -from OrthoDrive import OrthoDrive +from .OrthoWalk import OrthoWalk +from .OrthoDrive import OrthoDrive from direct.interval.IntervalGlobal import Sequence, Parallel, Func, LerpColorScaleInterval, LerpScaleInterval, LerpFunctionInterval, Wait, SoundInterval from toontown.toonbase.ToontownGlobals import GlobalDialogColor @@ -87,7 +87,7 @@ class DistributedPairingGame(DistributedMinigame): if not testCard > -1: self.yCardInc *= 1.25 self.cards = [] - for index in xrange(len(self.deck.cards)): + for index in range(len(self.deck.cards)): cardValue = self.deck.cards[index] oneCard = PairingGameCard.PairingGameCard(cardValue) oneCard.load() @@ -101,7 +101,7 @@ class DistributedPairingGame(DistributedMinigame): oneCard.turnDown(doInterval=False) self.cards.append(oneCard) - self.bonusTraversal = range(len(self.cards)) + self.bonusTraversal = list(range(len(self.cards))) self.bonusGlow = render.attachNewNode('bonusGlow') sign = loader.loadModel('phase_4/models/minigames/garden_sign_memory') sign.find('**/sign1').removeNode() @@ -192,7 +192,7 @@ class DistributedPairingGame(DistributedMinigame): self.notify.debug('setGameReady') if DistributedMinigame.setGameReady(self): return - for index in xrange(self.numPlayers): + for index in range(self.numPlayers): avId = self.avIdList[index] toon = self.getAvatar(avId) if toon: @@ -297,7 +297,7 @@ class DistributedPairingGame(DistributedMinigame): return newPos def getDeckOrderFromValue(self, value): - for index in xrange(len(self.cards)): + for index in range(len(self.cards)): if self.cards[index].value == value: return index @@ -523,10 +523,10 @@ class DistributedPairingGame(DistributedMinigame): halfRow = self.cardsPerRow / 2 if self.cardsPerRow % 2: halfRow += 1 - for i in xrange(halfRow): - for j in xrange(2): + for i in range(halfRow): + for j in range(2): col = i + j * halfRow - for row in xrange(self.cardsPerCol): + for row in range(self.cardsPerCol): card = self.getDeckOrderIndex(row, col) if card > -1: self.bonusTraversal.append(card) diff --git a/toontown/minigame/DistributedPairingGameAI.py b/toontown/minigame/DistributedPairingGameAI.py index b4de770..c8ac764 100644 --- a/toontown/minigame/DistributedPairingGameAI.py +++ b/toontown/minigame/DistributedPairingGameAI.py @@ -1,4 +1,4 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.minigame import PlayingCardGlobals @@ -51,7 +51,7 @@ class DistributedPairingGameAI(DistributedMinigameAI): self.faceUpDict[avId] = [] self.deck = PairingGameGlobals.createDeck(self.deckSeed, self.numPlayers) - for index in xrange(len(self.deck.cards)): + for index in range(len(self.deck.cards)): cardValue = self.deck.cards[index] oneCard = PlayingCardBase(cardValue) self.cards.append(oneCard) @@ -134,7 +134,7 @@ class DistributedPairingGameAI(DistributedMinigameAI): def isCardFaceUp(self, deckOrderIndex): retval = False - for key in self.faceUpDict.keys(): + for key in list(self.faceUpDict.keys()): if deckOrderIndex in self.faceUpDict[key]: retval = True break @@ -146,7 +146,7 @@ class DistributedPairingGameAI(DistributedMinigameAI): def checkForMatch(self): faceUpList = [] - for oneToonFaceUpList in self.faceUpDict.values(): + for oneToonFaceUpList in list(self.faceUpDict.values()): faceUpList += oneToonFaceUpList for i in range(len(faceUpList)): @@ -160,7 +160,7 @@ class DistributedPairingGameAI(DistributedMinigameAI): def handleMatch(self, cardA, cardB): self.notify.debug('we got a match %d %d' % (cardA, cardB)) - for key in self.faceUpDict.keys(): + for key in list(self.faceUpDict.keys()): if cardA in self.faceUpDict[key]: self.faceUpDict[key].remove(cardA) if cardB in self.faceUpDict[key]: @@ -171,7 +171,7 @@ class DistributedPairingGameAI(DistributedMinigameAI): def turnDownCard(self, cardA): self.notify.debug('turning down card %d' % cardA) - for key in self.faceUpDict.keys(): + for key in list(self.faceUpDict.keys()): if cardA in self.faceUpDict[key]: self.faceUpDict[key].remove(cardA) diff --git a/toontown/minigame/DistributedPatternGame.py b/toontown/minigame/DistributedPatternGame.py index 3f675bf..69cd239 100644 --- a/toontown/minigame/DistributedPatternGame.py +++ b/toontown/minigame/DistributedPatternGame.py @@ -1,17 +1,17 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.interval.IntervalGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import ToontownTimer -import PatternGameGlobals +from . import PatternGameGlobals from toontown.toon import ToonHead from toontown.char import CharDNA from toontown.char import Char -import ArrowKeys +from . import ArrowKeys import random from toontown.toonbase import ToontownGlobals import string @@ -164,7 +164,7 @@ class DistributedPatternGame(DistributedMinigame): del self.waitingText self.roundText.destroy() del self.roundText - for x in self.arrowDict.values(): + for x in list(self.arrowDict.values()): x[0].removeNode() x[1].removeNode() if len(x) == 3: @@ -810,7 +810,7 @@ class DistributedPatternGame(DistributedMinigame): def enterCleanup(self): self.notify.debug('enterCleanup') - for track in self.animTracks.values(): + for track in list(self.animTracks.values()): if track and track.isPlaying(): track.pause() diff --git a/toontown/minigame/DistributedPatternGameAI.py b/toontown/minigame/DistributedPatternGameAI.py index 198660a..a06799e 100644 --- a/toontown/minigame/DistributedPatternGameAI.py +++ b/toontown/minigame/DistributedPatternGameAI.py @@ -1,9 +1,9 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from toontown.ai.ToonBarrier import * from direct.fsm import ClassicFSM, State from direct.fsm import State import random -import PatternGameGlobals +from . import PatternGameGlobals import copy class DistributedPatternGameAI(DistributedMinigameAI): diff --git a/toontown/minigame/DistributedPhotoGame.py b/toontown/minigame/DistributedPhotoGame.py index 16be18c..dc09675 100644 --- a/toontown/minigame/DistributedPhotoGame.py +++ b/toontown/minigame/DistributedPhotoGame.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State @@ -11,7 +11,7 @@ from toontown.toonbase import ToontownTimer from direct.task.Task import Task import math from toontown.toon import ToonHead -import PhotoGameGlobals +from . import PhotoGameGlobals from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer @@ -295,7 +295,7 @@ class DistributedPhotoGame(DistributedMinigame, PhotoGameBase.PhotoGameBase): vRange = (GOODROWS - BADROWS) / 2 for row in range(-(GOODROWS / 2), GOODROWS / 2 + 1): for column in range(-(GOODROWS / 2), GOODROWS / 2 + 1): - goodRange = range(-((GOODROWS - BADROWS) / 2), (GOODROWS - BADROWS) / 2 + 1) + goodRange = list(range(-((GOODROWS - BADROWS) / 2), (GOODROWS - BADROWS) / 2 + 1)) rayQuality = 'g' if row not in goodRange or column not in goodRange: rayQuality = 'l' @@ -434,7 +434,7 @@ class DistributedPhotoGame(DistributedMinigame, PhotoGameBase.PhotoGameBase): newEntry = (entry.getFromNode(), object) distance = Vec3(entry.getSurfacePoint(self.tripod)).lengthSquared() name = entry.getFromNode().getName() - if not distDict.has_key(name): + if name not in distDict: distDict[name] = distance hitDict[name] = (entry.getFromNode(), object, marker) elif distance < distDict[name]: @@ -462,7 +462,7 @@ class DistributedPhotoGame(DistributedMinigame, PhotoGameBase.PhotoGameBase): else: quality = 1 onCenter = 1 - if not centerDict.has_key(superParent): + if superParent not in centerDict: centerDict[superParent] = (onCenter, overB, overT, @@ -986,7 +986,7 @@ class DistributedPhotoGame(DistributedMinigame, PhotoGameBase.PhotoGameBase): def printAD(self): for assignment in self.assignmentDataDict: data = self.assignmentDataDict[assignment] - print 'Key:%s\nData:%s\n' % (str(assignment), data) + print('Key:%s\nData:%s\n' % (str(assignment), data)) def updateScorePanel(self): teamScore = 0.0 diff --git a/toontown/minigame/DistributedPhotoGameAI.py b/toontown/minigame/DistributedPhotoGameAI.py index 7521130..d49331a 100644 --- a/toontown/minigame/DistributedPhotoGameAI.py +++ b/toontown/minigame/DistributedPhotoGameAI.py @@ -1,9 +1,9 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task -import PhotoGameGlobals +from . import PhotoGameGlobals from toontown.minigame import PhotoGameBase import random diff --git a/toontown/minigame/DistributedRaceGame.py b/toontown/minigame/DistributedRaceGame.py index 384ad49..1e6ff22 100644 --- a/toontown/minigame/DistributedRaceGame.py +++ b/toontown/minigame/DistributedRaceGame.py @@ -1,14 +1,14 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.distributed.ClockDelta import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task.Task import Task from toontown.toonbase import ToontownTimer -import RaceGameGlobals +from . import RaceGameGlobals from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer @@ -474,7 +474,7 @@ class DistributedRaceGame(DistributedMinigame): return 0 def anyAvatarWon(self): - for position in self.avatarPositions.values(): + for position in list(self.avatarPositions.values()): if position >= RaceGameGlobals.NumberToWin: self.notify.debug('anyAvatarWon: Somebody won') return 1 @@ -665,10 +665,10 @@ class DistributedRaceGame(DistributedMinigame): return Task.done def moveCamera(self): - bestPosIdx = self.avatarPositions.values()[0] + bestPosIdx = list(self.avatarPositions.values())[0] best_lane = 0 cur_lane = 0 - for pos in self.avatarPositions.values(): + for pos in list(self.avatarPositions.values()): if pos > bestPosIdx: bestPosIdx = pos best_lane = cur_lane diff --git a/toontown/minigame/DistributedRaceGameAI.py b/toontown/minigame/DistributedRaceGameAI.py index 23b6234..11ee6aa 100644 --- a/toontown/minigame/DistributedRaceGameAI.py +++ b/toontown/minigame/DistributedRaceGameAI.py @@ -1,11 +1,11 @@ from math import * -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State import random from direct.task.Task import Task -import RaceGameGlobals +from . import RaceGameGlobals class DistributedRaceGameAI(DistributedMinigameAI): @@ -53,7 +53,7 @@ class DistributedRaceGameAI(DistributedMinigameAI): DistributedMinigameAI.gameOver(self) def anyAvatarWon(self, positionDict): - for avId, position in positionDict.items(): + for avId, position in list(positionDict.items()): if position >= RaceGameGlobals.NumberToWin: self.notify.debug('anyAvatarWon: Somebody won') return 1 @@ -62,7 +62,7 @@ class DistributedRaceGameAI(DistributedMinigameAI): return 0 def allAvatarsChosen(self): - for choice in self.avatarChoices.values(): + for choice in list(self.avatarChoices.values()): if choice == -1: return 0 @@ -121,7 +121,7 @@ class DistributedRaceGameAI(DistributedMinigameAI): def waitClientsChoicesTimeout(self, task): self.notify.debug('waitClientsChoicesTimeout: did not hear from all clients') - for avId in self.avatarChoices.keys(): + for avId in list(self.avatarChoices.keys()): if self.avatarChoices[avId] == -1: self.avatarChoices[avId] = 0 @@ -135,7 +135,7 @@ class DistributedRaceGameAI(DistributedMinigameAI): self.rewardArray = [] for avId in self.avIdList: choice = self.avatarChoices[avId] - freq = self.avatarChoices.values().count(choice) + freq = list(self.avatarChoices.values()).count(choice) self.processChoice(avId, choice, freq) masterList = [] @@ -229,7 +229,7 @@ class DistributedRaceGameAI(DistributedMinigameAI): choice = self.avatarChoices[avId] reward = -1 if choice != 0: - freq = self.avatarChoices.values().count(choice) + freq = list(self.avatarChoices.values()).count(choice) if recurse or freq == 1: self.avatarPositions[avId] += choice if self.avatarPositions[avId] < 0: diff --git a/toontown/minigame/DistributedRingGame.py b/toontown/minigame/DistributedRingGame.py index 49b5081..c21790b 100644 --- a/toontown/minigame/DistributedRingGame.py +++ b/toontown/minigame/DistributedRingGame.py @@ -1,19 +1,20 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.interval.IntervalGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task -import ArrowKeys -import Ring -import RingTrack -import RingGameGlobals -import RingGroup -import RingTrackGroups +from . import ArrowKeys +from . import Ring +from . import RingTrack +from . import RingGameGlobals +from . import RingGroup +from . import RingTrackGroups from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer +from functools import reduce class DistributedRingGame(DistributedMinigame): UPDATE_ENVIRON_TASK = 'RingGameUpdateEnvironTask' @@ -364,7 +365,7 @@ class DistributedRingGame(DistributedMinigame): ToontownGlobals.MinniesMelodyland: [4, 8, 4], ToontownGlobals.TheBrrrgh: [4, 6, 6], ToontownGlobals.DonaldsDreamland: [2, 6, 8]} - for distr in difficultyDistributions.values(): + for distr in list(difficultyDistributions.values()): sum = reduce(lambda x, y: x + y, distr) difficultyPatterns = {ToontownGlobals.ToontownCentral: [[0] * 14 + [1] * 2 + [2] * 0, [0, @@ -515,15 +516,15 @@ class DistributedRingGame(DistributedMinigame): numGroupsPerDifficulty = difficultyDistributions[safezone] def patternsAreValid(difficultyPatterns = difficultyPatterns, difficultyDistributions = difficultyDistributions): - for sz in difficultyPatterns.keys(): + for sz in list(difficultyPatterns.keys()): for pattern in difficultyPatterns[sz]: for difficulty in [0, 1, 2]: numGroupsPerDifficulty = difficultyDistributions[sz] if numGroupsPerDifficulty[difficulty] != pattern.count(difficulty): - print 'safezone:', sz - print 'pattern:', pattern - print 'difficulty:', difficulty - print 'expected %s %ss, found %s' % (numGroupsPerDifficulty[difficulty], difficulty, pattern.count(difficulty)) + print('safezone:', sz) + print('pattern:', pattern) + print('difficulty:', difficulty) + print('expected %s %ss, found %s' % (numGroupsPerDifficulty[difficulty], difficulty, pattern.count(difficulty))) return 0 return 1 @@ -619,7 +620,7 @@ class DistributedRingGame(DistributedMinigame): def enterCleanup(self): self.notify.debug('enterCleanup') if not self.isSinglePlayer(): - for np in self.remoteToonCollNPs.values(): + for np in list(self.remoteToonCollNPs.values()): np.removeNode() del self.remoteToonCollNPs diff --git a/toontown/minigame/DistributedRingGameAI.py b/toontown/minigame/DistributedRingGameAI.py index cdabddc..87668ae 100644 --- a/toontown/minigame/DistributedRingGameAI.py +++ b/toontown/minigame/DistributedRingGameAI.py @@ -1,8 +1,8 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State -import RingGameGlobals +from . import RingGameGlobals import random import types @@ -65,7 +65,7 @@ class DistributedRingGameAI(DistributedMinigameAI): for i in range(0, 4): c = random.choice(chooseFrom) chooseFrom.remove(c) - if isinstance(c, types.TupleType): + if isinstance(c, tuple): c = random.choice(c) self.colorIndices[i] = c diff --git a/toontown/minigame/DistributedTagGame.py b/toontown/minigame/DistributedTagGame.py index 4d58ece..c344966 100644 --- a/toontown/minigame/DistributedTagGame.py +++ b/toontown/minigame/DistributedTagGame.py @@ -1,20 +1,20 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.safezone import Walk from toontown.toonbase import ToontownTimer from direct.gui import OnscreenText -import MinigameAvatarScorePanel +from . import MinigameAvatarScorePanel from direct.distributed import DistributedSmoothNode import random from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from otp.otpbase import OTPGlobals -import TagGameGlobals -import Trajectory +from . import TagGameGlobals +from . import Trajectory class DistributedTagGame(DistributedMinigame): DURATION = TagGameGlobals.DURATION diff --git a/toontown/minigame/DistributedTagGameAI.py b/toontown/minigame/DistributedTagGameAI.py index 952fe9b..c943545 100644 --- a/toontown/minigame/DistributedTagGameAI.py +++ b/toontown/minigame/DistributedTagGameAI.py @@ -1,10 +1,10 @@ -from DistributedMinigameAI import * -from TagTreasurePlannerAI import * +from .DistributedMinigameAI import * +from .TagTreasurePlannerAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task import random -import TagGameGlobals +from . import TagGameGlobals class DistributedTagGameAI(DistributedMinigameAI): DURATION = TagGameGlobals.DURATION diff --git a/toontown/minigame/DistributedTargetGame.py b/toontown/minigame/DistributedTargetGame.py index 29e056b..0e9020d 100644 --- a/toontown/minigame/DistributedTargetGame.py +++ b/toontown/minigame/DistributedTargetGame.py @@ -1,21 +1,21 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.interval.IntervalGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task -import ArrowKeys -import TargetGameGlobals +from . import ArrowKeys +from . import TargetGameGlobals from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer import math from math import * import random import random -import RubberBand -import FogOverlay +from . import RubberBand +from . import FogOverlay def circleX(angle, radius, centerX, centerY): x = radius * cos(angle) + centerX @@ -408,7 +408,7 @@ class DistributedTargetGame(DistributedMinigame): return random.seed(targetSeed) self.pattern = TargetGameGlobals.difficultyPatterns[self.getSafezoneId()] - print 'seed %s' % targetSeed + print('seed %s' % targetSeed) self.setupTargets() def setupTargets(self): @@ -1028,7 +1028,7 @@ class DistributedTargetGame(DistributedMinigame): def enterCleanup(self): self.notify.debug('enterCleanup') if not self.isSinglePlayer(): - for np in self.remoteToonCollNPs.values(): + for np in list(self.remoteToonCollNPs.values()): np.removeNode() del self.remoteToonCollNPs diff --git a/toontown/minigame/DistributedTargetGameAI.py b/toontown/minigame/DistributedTargetGameAI.py index 0550452..de8499e 100644 --- a/toontown/minigame/DistributedTargetGameAI.py +++ b/toontown/minigame/DistributedTargetGameAI.py @@ -1,8 +1,8 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.distributed.ClockDelta import * from direct.fsm import ClassicFSM, State from direct.fsm import State -import TargetGameGlobals +from . import TargetGameGlobals import random import types @@ -94,7 +94,7 @@ class DistributedTargetGameAI(DistributedMinigameAI): def setGameStart(self, timestamp): self.notify.debug('setGameStart') - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): self.scoreDict[avId] = 0 DistributedMinigameAI.setGameStart(self, timestamp) @@ -173,7 +173,7 @@ class DistributedTargetGameAI(DistributedMinigameAI): 0, 0] scoreIndex = 0 - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): scoreList[scoreIndex] = self.scoreDict[avId] avList[scoreIndex] = avId scoreIndex += 1 @@ -207,7 +207,7 @@ class DistributedTargetGameAI(DistributedMinigameAI): return avId = self.air.getAvatarIdFromSender() self.barrierScore.clear(avId) - for avId in self.stateDict.keys(): + for avId in list(self.stateDict.keys()): if self.stateDict[avId] == EXITED: self.barrierScore.clear(avId) @@ -220,7 +220,7 @@ class DistributedTargetGameAI(DistributedMinigameAI): self.scoreDict[entry] = 1 self.scoreTrack.append(self.getScoreList()) - statMessage = 'MiniGame Stats : Target Game' + '\nScores' + '%s' % self.scoreTrack + '\nAvIds' + '%s' % self.scoreDict.keys() + '\nSafeZone' + '%s' % self.getSafezoneId() + statMessage = 'MiniGame Stats : Target Game' + '\nScores' + '%s' % self.scoreTrack + '\nAvIds' + '%s' % list(self.scoreDict.keys()) + '\nSafeZone' + '%s' % self.getSafezoneId() self.air.writeServerEvent('MiniGame Stats', None, statMessage) self.sendUpdate('setGameDone', []) self.gameFSM.request('cleanup') diff --git a/toontown/minigame/DistributedTravelGame.py b/toontown/minigame/DistributedTravelGame.py index bae9b22..275bbaf 100644 --- a/toontown/minigame/DistributedTravelGame.py +++ b/toontown/minigame/DistributedTravelGame.py @@ -1,18 +1,18 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from toontown.toonbase.ToontownGlobals import GlobalDialogColor -from DistributedMinigame import * +from .DistributedMinigame import * from direct.fsm import ClassicFSM, State from direct.fsm import State from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownTimer -import TravelGameGlobals +from . import TravelGameGlobals import math from pandac.PandaModules import rad2Deg from toontown.toontowngui import TTDialog from direct.interval.IntervalGlobal import * -import VoteResultsPanel -import VoteResultsTrolleyPanel +from . import VoteResultsPanel +from . import VoteResultsTrolleyPanel IconDict = {ToontownGlobals.RaceGameId: 'mg_trolley_sign_race', ToontownGlobals.CannonGameId: 'mg_trolley_sign_cannon', ToontownGlobals.TagGameId: 'mg_trolley_sign_tag', @@ -74,9 +74,9 @@ def map3dToAspect2d(node, point): def invertTable(table): index = {} - for key in table.keys(): + for key in list(table.keys()): value = table[key] - if not index.has_key(value): + if value not in index: index[value] = key return index @@ -152,7 +152,7 @@ class DistributedTravelGame(DistributedMinigame): for i in range(self.numKeys): key = self.keys[i] key.setTwoSided(1) - ref = self.trolleyCar.attachNewNode('key' + `i` + 'ref') + ref = self.trolleyCar.attachNewNode('key' + repr(i) + 'ref') ref.setPosHpr(key, 0, 0, 0, 0, 0, 0) self.keyRef.append(ref) self.keyInit.append(key.getTransform()) @@ -163,7 +163,7 @@ class DistributedTravelGame(DistributedMinigame): self.frontWheelRef = [] for i in range(self.numFrontWheels): wheel = self.frontWheels[i] - ref = self.trolleyCar.attachNewNode('frontWheel' + `i` + 'ref') + ref = self.trolleyCar.attachNewNode('frontWheel' + repr(i) + 'ref') ref.setPosHpr(wheel, 0, 0, 0, 0, 0, 0) self.frontWheelRef.append(ref) self.frontWheelInit.append(wheel.getTransform()) @@ -174,7 +174,7 @@ class DistributedTravelGame(DistributedMinigame): self.backWheelRef = [] for i in range(self.numBackWheels): wheel = self.backWheels[i] - ref = self.trolleyCar.attachNewNode('backWheel' + `i` + 'ref') + ref = self.trolleyCar.attachNewNode('backWheel' + repr(i) + 'ref') ref.setPosHpr(wheel, 0, 0, 0, 0, 0, 0) self.backWheelRef.append(ref) self.backWheelInit.append(wheel.getTransform()) @@ -189,7 +189,7 @@ class DistributedTravelGame(DistributedMinigame): maxPoint = Point3(0, 0, 0) turnTable.calcTightBounds(minPoint, maxPoint) self.fullLength = maxPoint[0] - for key in TravelGameGlobals.BoardLayouts[self.boardIndex].keys(): + for key in list(TravelGameGlobals.BoardLayouts[self.boardIndex].keys()): info = TravelGameGlobals.BoardLayouts[self.boardIndex][key] switchModel = turnTable.find('**/turntable1').copyTo(render) switchModel.setPos(*info['pos']) @@ -212,7 +212,7 @@ class DistributedTravelGame(DistributedMinigame): trainTrack = self.loadTrainTrack(startX, rootY, rootX, rootY) self.extraTrainTracks.append(trainTrack) tunnelX = None - for key in TravelGameGlobals.BoardLayouts[self.boardIndex].keys(): + for key in list(TravelGameGlobals.BoardLayouts[self.boardIndex].keys()): if self.isLeaf(key): info = TravelGameGlobals.BoardLayouts[self.boardIndex][key] switchX, switchY, switchZ = info['pos'] @@ -308,17 +308,17 @@ class DistributedTravelGame(DistributedMinigame): del self.sky self.trolleyCar.removeNode() del self.trolleyCar - for key in self.trainSwitches.keys(): + for key in list(self.trainSwitches.keys()): self.trainSwitches[key].removeNode() del self.trainSwitches[key] self.trainSwitches = {} - for key in self.tunnels.keys(): + for key in list(self.tunnels.keys()): self.tunnels[key].removeNode() del self.tunnels[key] self.tunnels = {} - for key in self.trainTracks.keys(): + for key in list(self.trainTracks.keys()): self.trainTracks[key].removeNode() del self.trainTracks[key] @@ -378,10 +378,10 @@ class DistributedTravelGame(DistributedMinigame): self.sky.reparentTo(render) self.moveCameraToTop() self.trolleyCar.reparentTo(render) - for key in self.trainSwitches.keys(): + for key in list(self.trainSwitches.keys()): self.trainSwitches[key].reparentTo(render) - for key in self.trainTracks.keys(): + for key in list(self.trainTracks.keys()): self.trainTracks[key].reparentTo(render) for trainTrack in self.extraTrainTracks: @@ -402,10 +402,10 @@ class DistributedTravelGame(DistributedMinigame): self.trolleyCar.hide() self.gui.hide() self.hideMinigamesAndBonuses() - for key in self.trainSwitches.keys(): + for key in list(self.trainSwitches.keys()): self.trainSwitches[key].hide() - for key in self.trainTracks.keys(): + for key in list(self.trainTracks.keys()): self.trainTracks[key].hide() for trainTrack in self.extraTrainTracks: @@ -639,7 +639,7 @@ class DistributedTravelGame(DistributedMinigame): localAvatarWon = False localAvatarLost = False noWinner = True - for avId in self.avIdBonuses.keys(): + for avId in list(self.avIdBonuses.keys()): name = '' avatar = self.getAvatar(avId) if avatar: @@ -705,7 +705,7 @@ class DistributedTravelGame(DistributedMinigame): for index in range(len(self.avIdList)): avId = self.avIdList[index] self.startingVotes[avId] = startingVotesArray[index] - if not self.currentVotes.has_key(avId): + if avId not in self.currentVotes: self.currentVotes[avId] = startingVotesArray[index] self.notify.debug('starting votes = %s' % self.startingVotes) @@ -757,7 +757,7 @@ class DistributedTravelGame(DistributedMinigame): retval = 0 if hasattr(self, 'scrollList'): selectedIndex = self.scrollList.getSelectedIndex() - if self.indexToVotes.has_key(selectedIndex): + if selectedIndex in self.indexToVotes: retval = self.indexToVotes[selectedIndex] return retval @@ -870,13 +870,13 @@ class DistributedTravelGame(DistributedMinigame): def loadMinigameIcons(self): self.mg_icons = loader.loadModel('phase_4/models/minigames/mg_icons') - for switch in self.switchToMinigameDict.keys(): + for switch in list(self.switchToMinigameDict.keys()): minigame = self.switchToMinigameDict[switch] switchPos = self.trainSwitches[switch].getPos() labelPos = map3dToAspect2d(render, switchPos) useText = True iconName = None - if minigame in IconDict.keys(): + if minigame in list(IconDict.keys()): iconName = IconDict[minigame] icon = None if self.mg_icons: @@ -929,7 +929,7 @@ class DistributedTravelGame(DistributedMinigame): def loadBonuses(self): self.switchToBonusLabelDict = {} - for avId in self.avIdBonuses.keys(): + for avId in list(self.avIdBonuses.keys()): if avId == self.localAvId: switch = self.avIdBonuses[avId][0] beans = self.avIdBonuses[avId][1] diff --git a/toontown/minigame/DistributedTravelGameAI.py b/toontown/minigame/DistributedTravelGameAI.py index ebac2c4..3128e3f 100644 --- a/toontown/minigame/DistributedTravelGameAI.py +++ b/toontown/minigame/DistributedTravelGameAI.py @@ -1,7 +1,7 @@ from toontown.minigame.DistributedMinigameAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State -import TravelGameGlobals +from . import TravelGameGlobals from toontown.toonbase import ToontownGlobals class DistributedTravelGameAI(DistributedMinigameAI): @@ -24,7 +24,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): self.destSwitch = 0 self.gotBonus = {} self.desiredNextGame = -1 - self.boardIndex = random.choice(range(len(TravelGameGlobals.BoardLayouts))) + self.boardIndex = random.choice(list(range(len(TravelGameGlobals.BoardLayouts)))) def generate(self): self.notify.debug('generate') @@ -156,7 +156,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): def waitClientsChoicesTimeout(self, task): self.notify.debug('waitClientsChoicesTimeout: did not hear from all clients') - for avId in self.avatarChoices.keys(): + for avId in list(self.avatarChoices.keys()): if self.avatarChoices[avId] == (-1, 0): self.avatarChoices[avId] = (0, 0) @@ -194,7 +194,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): return (retVotes, retDir) def allAvatarsChosen(self): - for avId in self.avatarChoices.keys(): + for avId in list(self.avatarChoices.keys()): choice = self.avatarChoices[avId] if choice[0] == -1 and not self.stateDict[avId] == EXITED: return False @@ -210,7 +210,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): def giveBonusBeans(self, endingSwitch): noOneGotBonus = True - for avId in self.avIdBonuses.keys(): + for avId in list(self.avIdBonuses.keys()): self.scoreDict[avId] = 0 if self.avIdBonuses[avId][0] == endingSwitch and not self.stateDict[avId] == EXITED: noOneGotBonus = False @@ -218,7 +218,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): self.gotBonus[avId] = self.avIdBonuses[avId][1] if noOneGotBonus: - for avId in self.avIdBonuses.keys(): + for avId in list(self.avIdBonuses.keys()): self.scoreDict[avId] = 1 def checkForEndGame(self): @@ -256,7 +256,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): from toontown.minigame import MinigameCreatorAI allowedGames = MinigameCreatorAI.removeUnreleasedMinigames(allowedGames) self.switchToMinigameDict = {} - for switch in TravelGameGlobals.BoardLayouts[self.boardIndex].keys(): + for switch in list(TravelGameGlobals.BoardLayouts[self.boardIndex].keys()): if self.isLeaf(switch): if len(allowedGames) == 0: allowedGames = list(ToontownGlobals.MinigamePlayerMatrix[numPlayers]) @@ -267,7 +267,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): switches = [] minigames = [] - for key in self.switchToMinigameDict.keys(): + for key in list(self.switchToMinigameDict.keys()): switches.append(key) minigames.append(self.switchToMinigameDict[key]) @@ -275,7 +275,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): def calcBonusBeans(self): possibleLeaves = [] - for switch in TravelGameGlobals.BoardLayouts[self.boardIndex].keys(): + for switch in list(TravelGameGlobals.BoardLayouts[self.boardIndex].keys()): if self.isLeaf(switch): possibleLeaves.append(switch) @@ -308,7 +308,7 @@ class DistributedTravelGameAI(DistributedMinigameAI): self.stateDict[avId] = EXITED allExited = True for avId in self.avIdList: - if avId in self.stateDict.keys() and self.stateDict[avId] != EXITED: + if avId in list(self.stateDict.keys()) and self.stateDict[avId] != EXITED: allExited = False break diff --git a/toontown/minigame/DistributedTugOfWarGame.py b/toontown/minigame/DistributedTugOfWarGame.py index 56cf0aa..df005a6 100644 --- a/toontown/minigame/DistributedTugOfWarGame.py +++ b/toontown/minigame/DistributedTugOfWarGame.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.interval.IntervalGlobal import * -from DistributedMinigame import * +from .DistributedMinigame import * from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.fsm import ClassicFSM, State @@ -11,17 +11,17 @@ from toontown.toon import ToonHead from toontown.suit import SuitDNA from toontown.suit import Suit from toontown.char import Char -import ArrowKeys +from . import ArrowKeys import random from toontown.toonbase import ToontownGlobals import string from toontown.toonbase import TTLocalizer -import TugOfWarGameGlobals +from . import TugOfWarGameGlobals from direct.showutil import Rope from toontown.effects import Splash from toontown.effects import Ripples from toontown.toonbase import TTLocalizer -import MinigamePowerMeter +from . import MinigamePowerMeter from direct.task.Task import Task class DistributedTugOfWarGame(DistributedMinigame): @@ -280,7 +280,7 @@ class DistributedTugOfWarGame(DistributedMinigame): self.introTrack.finish() del self.introTrack self.introTrack = None - for track in self.animTracks.values(): + for track in list(self.animTracks.values()): if track: track.finish() del track @@ -327,10 +327,10 @@ class DistributedTugOfWarGame(DistributedMinigame): if self.suit: self.suit.reparentTo(hidden) for avId in self.avIdList: - if self.dropShadowDict.has_key(avId): + if avId in self.dropShadowDict: self.dropShadowDict[avId].reparentTo(hidden) - if self.dropShadowDict.has_key(self.suitId): + if self.suitId in self.dropShadowDict: self.dropShadowDict[self.suitId].reparentTo(hidden) return @@ -980,7 +980,7 @@ class DistributedTugOfWarGame(DistributedMinigame): exitSeq.append(Wait(2.5)) exitSeq.append(Func(self.gameOver)) self.showTrack = Parallel(reactSeq, exitSeq) - for x in self.animTracks.values(): + for x in list(self.animTracks.values()): if x != None: x.finish() diff --git a/toontown/minigame/DistributedTugOfWarGameAI.py b/toontown/minigame/DistributedTugOfWarGameAI.py index 1d43803..3db008e 100644 --- a/toontown/minigame/DistributedTugOfWarGameAI.py +++ b/toontown/minigame/DistributedTugOfWarGameAI.py @@ -1,10 +1,10 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State import random from direct.task.Task import Task import copy -import TugOfWarGameGlobals +from . import TugOfWarGameGlobals import math class DistributedTugOfWarGameAI(DistributedMinigameAI): @@ -188,7 +188,7 @@ class DistributedTugOfWarGameAI(DistributedMinigameAI): def calculateOffsets(self): f = [0, 0] for i in [0, 1]: - for x in self.forceDict[i].values(): + for x in list(self.forceDict[i].values()): f[i] += x if self.gameType == TugOfWarGameGlobals.TOON_VS_COG: @@ -211,7 +211,7 @@ class DistributedTugOfWarGameAI(DistributedMinigameAI): def reportCurrentKeyRate(self, keyRate, force): avId = self.air.getAvatarIdFromSender() - if not self.side.has_key(avId): + if avId not in self.side: self.notify.warning('Avatar %s sent reportCurrentKeyRate too early %s' % (avId, self.side)) return self.keyRateDict[avId] = keyRate @@ -221,7 +221,7 @@ class DistributedTugOfWarGameAI(DistributedMinigameAI): if self.howManyReported == self.numPlayers: self.howManyReported = 0 self.calculateOffsets() - self.sendUpdate('sendCurrentPosition', [self.offsetDict.keys(), self.offsetDict.values()]) + self.sendUpdate('sendCurrentPosition', [list(self.offsetDict.keys()), list(self.offsetDict.values())]) if self.gameType == TugOfWarGameGlobals.TOON_VS_COG: self.sendUpdate('sendSuitPosition', [self.suitOffset]) diff --git a/toontown/minigame/DistributedTwoDGame.py b/toontown/minigame/DistributedTwoDGame.py index 90e7e34..f5e2cab 100644 --- a/toontown/minigame/DistributedTwoDGame.py +++ b/toontown/minigame/DistributedTwoDGame.py @@ -7,12 +7,12 @@ from direct.gui.DirectGui import DGG from direct.task.Task import Task from direct.fsm import ClassicFSM, State from direct.directnotify import DirectNotifyGlobal -from DistributedMinigame import * -import MinigameAvatarScorePanel, ArrowKeys, ToonBlitzAssetMgr, TwoDCamera -import TwoDSectionMgr, ToonBlitzGlobals, TwoDGameToonSD +from .DistributedMinigame import * +from . import MinigameAvatarScorePanel, ArrowKeys, ToonBlitzAssetMgr, TwoDCamera +from . import TwoDSectionMgr, ToonBlitzGlobals, TwoDGameToonSD from toontown.toonbase import ToontownTimer -from TwoDWalk import * -from TwoDDrive import * +from .TwoDWalk import * +from .TwoDDrive import * COLOR_RED = VBase4(1, 0, 0, 0.3) class DistributedTwoDGame(DistributedMinigame): @@ -70,7 +70,7 @@ class DistributedTwoDGame(DistributedMinigame): self.notify.debug('unload') DistributedMinigame.unload(self) taskMgr.remove(self.UpdateLocalToonTask) - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): toonSD = self.toonSDs[avId] toonSD.destroy() @@ -111,7 +111,7 @@ class DistributedTwoDGame(DistributedMinigame): def offstage(self): self.notify.debug('offstage') self.assetMgr.offstage() - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): self.toonSDs[avId].exit() base.localAvatar.setTransparency(0) @@ -154,7 +154,7 @@ class DistributedTwoDGame(DistributedMinigame): self.twoDWalk = TwoDWalk(self.twoDDrive, broadcast=not self.isSinglePlayer()) self.scores = [0] * self.numPlayers spacing = 0.4 - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): avId = self.avIdList[i] avName = self.getAvatarName(avId) scorePanel = MinigameAvatarScorePanel.MinigameAvatarScorePanel(avId, avName) @@ -232,7 +232,7 @@ class DistributedTwoDGame(DistributedMinigame): (lX, bY), (rX, bY))) scorePanelLocs = scorePanelLocs[self.numPlayers - 1] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): panel = self.scorePanels[i] pos = scorePanelLocs[i] lerpTrack.append(Parallel(LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 1.5, blendType='easeInOut'))) @@ -292,7 +292,7 @@ class DistributedTwoDGame(DistributedMinigame): base.localAvatar.setY(0) if base.localAvatar.getZ() < -2.0: self.localToonFellDown() - for avId in self.toonSDs.keys(): + for avId in list(self.toonSDs.keys()): self.toonSDs[avId].update() return task.cont diff --git a/toontown/minigame/DistributedTwoDGameAI.py b/toontown/minigame/DistributedTwoDGameAI.py index 5c80063..1fc2b92 100644 --- a/toontown/minigame/DistributedTwoDGameAI.py +++ b/toontown/minigame/DistributedTwoDGameAI.py @@ -1,4 +1,4 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from toontown.ai.ToonBarrier import * from direct.fsm import ClassicFSM, State from direct.directnotify import DirectNotifyGlobal @@ -47,7 +47,7 @@ class DistributedTwoDGameAI(DistributedMinigameAI): self.numEnemies = ToonBlitzGlobals.NumEnemies self.numTreasuresTaken = 0 self.numEnemiesKilled = 0 - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): self.scoreDict[avId] = 0 self.finishedBonusDict[avId] = 0 self.finishedTimeLeftDict[avId] = -1 @@ -59,27 +59,27 @@ class DistributedTwoDGameAI(DistributedMinigameAI): 0, 0] - for i in xrange(len(self.sectionsSelected)): + for i in range(len(self.sectionsSelected)): sectionIndex = self.sectionsSelected[i][0] attribs = ToonBlitzGlobals.SectionTypes[sectionIndex] enemiesPool = attribs[3] self.enemyHealthTable += [[]] enemyIndicesSelected = self.sectionsSelected[i][1] - for j in xrange(len(enemyIndicesSelected)): + for j in range(len(enemyIndicesSelected)): enemyIndex = enemyIndicesSelected[j] enemyType = enemiesPool[enemyIndex][0] self.enemyHealthTable[i] += [ToonBlitzGlobals.EnemyBaseHealth] self.enemyHealthTable[i][j] *= self.numPlayers - if ToonBlitzGlobals.EnemyHealthMultiplier.has_key(enemyType): + if enemyType in ToonBlitzGlobals.EnemyHealthMultiplier: self.enemyHealthTable[i][j] *= ToonBlitzGlobals.EnemyHealthMultiplier[enemyType] self.treasureTakenTable += [[]] treasureIndicesSelected = self.sectionsSelected[i][2] - for j in xrange(len(treasureIndicesSelected)): + for j in range(len(treasureIndicesSelected)): self.treasureTakenTable[i] += [0] enemyIndicesSelected = self.sectionsSelected[i][1] - for j in xrange(len(enemyIndicesSelected)): + for j in range(len(enemyIndicesSelected)): self.treasureTakenTable[i] += [0] def setGameStart(self, timestamp): @@ -221,7 +221,7 @@ class DistributedTwoDGameAI(DistributedMinigameAI): self.notify.warning('suspicious: ' + str(avId) + ' ' + msg) self.air.writeServerEvent('suspicious: ', avId, msg) return - if avId not in self.scoreDict.keys(): + if avId not in list(self.scoreDict.keys()): self.notify.warning('Avatar %s not in list.' % avId) self.air.writeServerEvent('suspicious: ', avId, 'TwoDGameAI.toonVictory toon not in list.') return @@ -241,7 +241,7 @@ class DistributedTwoDGameAI(DistributedMinigameAI): return def toonFellDown(self, avId, timestamp): - if avId not in self.scoreDict.keys(): + if avId not in list(self.scoreDict.keys()): self.notify.warning('Avatar %s not in list.' % avId) self.air.writeServerEvent('warning', avId, 'TwoDGameAI.toonFellDown toon not in list.') return @@ -249,7 +249,7 @@ class DistributedTwoDGameAI(DistributedMinigameAI): self.scoreDict[avId] += ToonBlitzGlobals.ScoreLossPerFallDown[self.getSafezoneId()] def toonHitByEnemy(self, avId, timestamp): - if avId not in self.scoreDict.keys(): + if avId not in list(self.scoreDict.keys()): self.notify.warning('Avatar %s not in list.' % avId) self.air.writeServerEvent('warning', avId, 'TwoDGameAI.toonHitByEnemy toon not in list.') return @@ -257,7 +257,7 @@ class DistributedTwoDGameAI(DistributedMinigameAI): self.scoreDict[avId] += ToonBlitzGlobals.ScoreLossPerEnemyCollision[self.getSafezoneId()] def toonSquished(self, avId, timestamp): - if avId not in self.scoreDict.keys(): + if avId not in list(self.scoreDict.keys()): self.notify.warning('Avatar %s not in list.' % avId) self.air.writeServerEvent('warning', avId, 'TwoDGameAI.toonSquished toon not in list.') return @@ -289,7 +289,7 @@ class DistributedTwoDGameAI(DistributedMinigameAI): difficulty, probability = weight difficultyPool += [difficulty] * probability - for i in xrange(numSections): + for i in range(numSections): difficulty = random.choice(difficultyPool) difficultyList.append(difficulty) @@ -316,11 +316,11 @@ class DistributedTwoDGameAI(DistributedMinigameAI): if whileCount > 1: self.notify.debug('We need more sections than we have choices. We have to now repeat.') - for i in xrange(len(sectionsSelectedByDifficulty)): - for j in xrange(len(sectionsSelectedByDifficulty[i])): + for i in range(len(sectionsSelectedByDifficulty)): + for j in range(len(sectionsSelectedByDifficulty[i])): sectionIndicesSelected.append(sectionsSelectedByDifficulty[i][j]) - for i in xrange(len(sectionIndicesSelected)): + for i in range(len(sectionIndicesSelected)): sectionIndex = sectionIndicesSelected[i] self.sectionIndexList.append(sectionIndex) attribs = sectionTypes[sectionIndex] @@ -335,12 +335,12 @@ class DistributedTwoDGameAI(DistributedMinigameAI): enemyIndicesSelected = [] if enemiesPool != None: minEnemies, maxEnemies = attribs[7] - for i in xrange(len(enemiesPool)): + for i in range(len(enemiesPool)): enemyIndicesPool += [i] numEnemies = maxEnemies * ToonBlitzGlobals.PercentMaxEnemies[szId] / 100 numEnemies = max(numEnemies, minEnemies) - for j in xrange(int(numEnemies)): + for j in range(int(numEnemies)): if len(enemyIndicesPool) == 0: break enemyIndex = random.choice(enemyIndicesPool) @@ -356,12 +356,12 @@ class DistributedTwoDGameAI(DistributedMinigameAI): treasureIndicesSelected = [] if treasuresPool != None: minTreasures, maxTreasures = attribs[8] - for i in xrange(len(treasuresPool)): + for i in range(len(treasuresPool)): treasureIndicesPool += [i] numTreasures = maxTreasures * ToonBlitzGlobals.PercentMaxTreasures[szId] / 100 numTreasures = max(numTreasures, minTreasures) - for i in xrange(int(numTreasures)): + for i in range(int(numTreasures)): if len(treasureIndicesPool) == 0: break treasureIndex = random.choice(treasureIndicesPool) @@ -375,12 +375,12 @@ class DistributedTwoDGameAI(DistributedMinigameAI): spawnPointIndicesSelected = [] if spawnPointsPool != None: minSpawnPoints, maxSpawnPoints = attribs[9] - for i in xrange(len(spawnPointsPool)): + for i in range(len(spawnPointsPool)): spawnPointIndicesPool += [i] numSpawnPoints = maxSpawnPoints * ToonBlitzGlobals.PercentMaxSpawnPoints[szId] / 100 numSpawnPoints = max(numSpawnPoints, minSpawnPoints) - for i in xrange(int(numSpawnPoints)): + for i in range(int(numSpawnPoints)): if len(spawnPointIndicesPool) == 0: break spawnPoint = random.choice(spawnPointIndicesPool) @@ -392,12 +392,12 @@ class DistributedTwoDGameAI(DistributedMinigameAI): stomperIndicesSelected = [] if stompersPool != None: minStompers, maxStompers = attribs[10] - for i in xrange(len(stompersPool)): + for i in range(len(stompersPool)): stomperIndicesPool += [i] numStompers = maxStompers * ToonBlitzGlobals.PercentMaxStompers[szId] / 100 numStompers = max(numStompers, minStompers) - for i in xrange(int(numStompers)): + for i in range(int(numStompers)): if len(stomperIndicesPool) == 0: break stomper = random.choice(stomperIndicesPool) diff --git a/toontown/minigame/DistributedVineGame.py b/toontown/minigame/DistributedVineGame.py index f2e7254..dfdc061 100644 --- a/toontown/minigame/DistributedVineGame.py +++ b/toontown/minigame/DistributedVineGame.py @@ -70,7 +70,7 @@ class DistributedVineGame(DistributedMinigame): def getClimbDir(self, avId): retval = 0 - if self.toonInfo.has_key(avId): + if avId in self.toonInfo: retval = self.toonInfo[avId][5] return retval @@ -182,7 +182,7 @@ class DistributedVineGame(DistributedMinigame): self.arrowKeys.setPressHandlers(handlers) self.numTreasures = len(self.vines) - 1 self.treasures = [] - for i in xrange(self.numTreasures): + for i in range(self.numTreasures): height = self.randomNumGen.randrange(10, 25) xPos = self.randomNumGen.randrange(12, 18) pos = Point3(self.vines[i].getX() + 15, 0, height) @@ -317,7 +317,7 @@ class DistributedVineGame(DistributedMinigame): newVelZ = velZ newFallingInfo = fallingInfo oldInfo = None - if self.toonInfo.has_key(avId): + if avId in self.toonInfo: oldInfo = self.toonInfo[avId] if vineIndex == None: newVineIndex = oldInfo[0] @@ -423,11 +423,11 @@ class DistributedVineGame(DistributedMinigame): def sanityCheck(self): if not self.isInPlayState(): return - for avId in self.toonInfo.keys(): + for avId in list(self.toonInfo.keys()): myVineIndex = self.toonInfo[avId][0] foundVines = [] foundVineIndex = -1 - for curVine in xrange(len(self.vines)): + for curVine in range(len(self.vines)): curInfo = self.vines[curVine].getAttachedToonInfo(avId) if curInfo: foundVines.append(curVine) @@ -441,7 +441,7 @@ class DistributedVineGame(DistributedMinigame): def getVineAndVineInfo(self, avId): retVine = -1 retInfo = None - for curVine in xrange(len(self.vines)): + for curVine in range(len(self.vines)): curInfo = self.vines[curVine].getAttachedToonInfo(avId) if curInfo: retVine = curVine @@ -460,7 +460,7 @@ class DistributedVineGame(DistributedMinigame): return self.toonOffsets = {} self.toonOffsetsFalling = {} - for index in xrange(self.numPlayers): + for index in range(self.numPlayers): avId = self.avIdList[index] toon = self.getAvatar(avId) if toon: @@ -505,7 +505,7 @@ class DistributedVineGame(DistributedMinigame): self.createRadar() self.scores = [0] * self.numPlayers spacing = 0.4 - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): avId = self.avIdList[i] avName = self.getAvatarName(avId) scorePanel = MinigameAvatarScorePanel.MinigameAvatarScorePanel(avId, avName) @@ -572,7 +572,7 @@ class DistributedVineGame(DistributedMinigame): (lX, bY), (rX, bY))) scorePanelLocs = scorePanelLocs[self.numPlayers - 1] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): panel = self.scorePanels[i] pos = scorePanelLocs[i] lerpTrack.append(Parallel(LerpPosInterval(panel, lerpDur, Point3(pos[0], 0, pos[1]), blendType='easeInOut'), LerpScaleInterval(panel, lerpDur, Vec3(panel.getScale()) * 2.0, blendType='easeInOut'))) @@ -662,7 +662,7 @@ class DistributedVineGame(DistributedMinigame): camera.setX(minX) def __updateOtherToonsClimbing(self): - for avId in self.toonInfo.keys(): + for avId in list(self.toonInfo.keys()): if avId == self.localAvId: continue toonInfo = self.toonInfo[avId] @@ -704,13 +704,13 @@ class DistributedVineGame(DistributedMinigame): self.handleLocalToonFellDown() avId = self.localAvId curInfo = None - for vineIndex in xrange(len(self.vines)): + for vineIndex in range(len(self.vines)): curInfo = self.vines[vineIndex].getAttachedToonInfo(avId) if curInfo: break if not curInfo: - if not self.endingTracks.has_key(avId): + if avId not in self.endingTracks: self.makeCameraFollowJumpingToon() if self.localPhysicsNP: pos = self.localPhysicsNP.getPos(render) @@ -923,7 +923,7 @@ class DistributedVineGame(DistributedMinigame): self.setupAttachingToVineCamIval(vineIndex, self.lastJumpFacingRight) def makeOtherToonJump(self, avId, posX, posZ, velX, velZ): - if not self.otherToonPhysics.has_key(avId): + if avId not in self.otherToonPhysics: an = ActorNode('other-physics%s' % avId) anp = render.attachNewNode(an) base.physicsMgr.attachPhysicalNode(an) @@ -944,7 +944,7 @@ class DistributedVineGame(DistributedMinigame): physObject.setVelocity(velX, 0, velZ) def makeOtherToonFallFromMidair(self, avId, posX, posZ, velX, velZ): - if not self.otherToonPhysics.has_key(avId): + if avId not in self.otherToonPhysics: an = ActorNode('other-physics%s' % avId) anp = render.attachNewNode(an) base.physicsMgr.attachPhysicalNode(an) @@ -1045,7 +1045,7 @@ class DistributedVineGame(DistributedMinigame): def rightArrowKeyHandler(self): curInfo = None - for vineIndex in xrange(len(self.vines)): + for vineIndex in range(len(self.vines)): curInfo = self.vines[vineIndex].getAttachedToonInfo(base.localAvatar.doId) if curInfo: break @@ -1069,7 +1069,7 @@ class DistributedVineGame(DistributedMinigame): def leftArrowKeyHandler(self): curInfo = None - for vineIndex in xrange(len(self.vines)): + for vineIndex in range(len(self.vines)): curInfo = self.vines[vineIndex].getAttachedToonInfo(base.localAvatar.doId) if curInfo: break @@ -1380,7 +1380,7 @@ class DistributedVineGame(DistributedMinigame): def createBatIvals(self): self.batIvals = [] - for batIndex in xrange(len(self.bats)): + for batIndex in range(len(self.bats)): newBatIval = self.createBatIval(batIndex) self.batIvals.append(newBatIval) @@ -1430,7 +1430,7 @@ class DistributedVineGame(DistributedMinigame): retval = Sequence() toonTakeoffs = Parallel() didCameraMove = False - for index in xrange(len(self.avIdList)): + for index in range(len(self.avIdList)): avId = self.avIdList[index] if avId != self.localAvId: continue @@ -1487,7 +1487,7 @@ class DistributedVineGame(DistributedMinigame): def doEndingTrackTask(self, avId): taskName = 'VineGameEnding-%s' % avId - if not self.endingTracks.has_key(avId): + if avId not in self.endingTracks: taskMgr.doMethodLater(0.5, self.setupEndingTrack, taskName, extraArgs=(avId,)) self.endingTrackTaskNames.append(taskName) @@ -1495,7 +1495,7 @@ class DistributedVineGame(DistributedMinigame): self.notify.debug('cameraPos = %s' % base.camera.getPos()) def setupEndingTrack(self, avId): - if self.endingTracks.has_key(avId): + if avId in self.endingTracks: self.notify.warning('setupEndingTrack duplicate call avId=%d' % avId) return if len(self.vines) == 0: @@ -1532,7 +1532,7 @@ class DistributedVineGame(DistributedMinigame): for taskName in self.endingTrackTaskNames: taskMgr.remove(taskName) - for endingTrack in self.endingTracks.values(): + for endingTrack in list(self.endingTracks.values()): endingTrack.finish del endingTrack diff --git a/toontown/minigame/DistributedVineGameAI.py b/toontown/minigame/DistributedVineGameAI.py index 86a6eec..6b3fbe5 100644 --- a/toontown/minigame/DistributedVineGameAI.py +++ b/toontown/minigame/DistributedVineGameAI.py @@ -1,7 +1,7 @@ -from DistributedMinigameAI import * +from .DistributedMinigameAI import * from direct.fsm import ClassicFSM, State from direct.fsm import State -import VineGameGlobals +from . import VineGameGlobals class DistributedVineGameAI(DistributedMinigameAI): @@ -48,7 +48,7 @@ class DistributedVineGameAI(DistributedMinigameAI): self.numTreasures = VineGameGlobals.NumVines - 1 self.numTreasuresTaken = 0 self.takenTable = [0] * self.numTreasures - for avId in self.scoreDict.keys(): + for avId in list(self.scoreDict.keys()): self.scoreDict[avId] = 0 self.finishedBonus[avId] = 0 self.finishedTimeLeft[avId] = -1 @@ -118,7 +118,7 @@ class DistributedVineGameAI(DistributedMinigameAI): if not self._playing(): return avId = self.air.getAvatarIdFromSender() - if not self.scoreDict.has_key(avId): + if avId not in self.scoreDict: self.notify.warning('PROBLEM: avatar %s called claimTreasure(%s) but he is not in the scoreDict: %s. avIdList is: %s' % (avId, treasureNum, self.scoreDict, @@ -199,7 +199,7 @@ class DistributedVineGameAI(DistributedMinigameAI): curTime = self.getCurrentGameTime() timeLeft = VineGameGlobals.GameDuration - curTime self.notify.debug('curTime =%s timeLeft = %s' % (curTime, timeLeft)) - if not self.scoreDict.has_key(avId): + if avId not in self.scoreDict: self.notify.warning('PROBLEM: avatar %s called claimTreasure(%s) but he is not in the scoreDict: %s. avIdList is: %s' % (avId, treasureNum, self.scoreDict, @@ -225,7 +225,7 @@ class DistributedVineGameAI(DistributedMinigameAI): newVelX = velX newVelZ = velZ oldInfo = None - if self.toonInfo.has_key(avId): + if avId in self.toonInfo: oldInfo = self.toonInfo[avId] if vineIndex == None: newVineIndex = oldInfo[0] @@ -315,6 +315,6 @@ class DistributedVineGameAI(DistributedMinigameAI): vineIndex = self.toonInfo[avId][0] if not vineIndex == VineGameGlobals.NumVines - 1: partialBeans = int(vineIndex / 5.0) - if self.scoreDict.has_key(avId): + if avId in self.scoreDict: self.scoreDict[avId] += partialBeans self.sendUpdate('setScore', [avId, self.scoreDict[avId]]) diff --git a/toontown/minigame/DivingFishSpawn.py b/toontown/minigame/DivingFishSpawn.py index 9a1830f..84bdcef 100644 --- a/toontown/minigame/DivingFishSpawn.py +++ b/toontown/minigame/DivingFishSpawn.py @@ -4,7 +4,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import * from direct.actor import Actor import random -import DivingGameGlobals +from . import DivingGameGlobals class DivingFishSpawn(DirectObject): RADIUS = 0.7 @@ -103,7 +103,7 @@ class DivingFishSpawn(DirectObject): def destroy(self): self.ignoreAll() - for fish in self.fishArray.values(): + for fish in list(self.fishArray.values()): fish.moveLerp.pause() fish.specialLerp.finish() if hasattr(fish, 'sound'): diff --git a/toontown/minigame/DivingGameToonSD.py b/toontown/minigame/DivingGameToonSD.py index 9278f55..d535062 100644 --- a/toontown/minigame/DivingGameToonSD.py +++ b/toontown/minigame/DivingGameToonSD.py @@ -6,7 +6,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData from direct.fsm import ClassicFSM from direct.fsm import State -import CatchGameGlobals +from . import CatchGameGlobals class DivingGameToonSD(StateData.StateData): notify = DirectNotifyGlobal.directNotify.newCategory('DivingGameToonSD') diff --git a/toontown/minigame/DivingTreasure.py b/toontown/minigame/DivingTreasure.py index fbb219a..cd71cd4 100644 --- a/toontown/minigame/DivingTreasure.py +++ b/toontown/minigame/DivingTreasure.py @@ -2,7 +2,7 @@ from direct.showbase.DirectObject import DirectObject from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import * -import DivingGameGlobals +from . import DivingGameGlobals class DivingTreasure(DirectObject): diff --git a/toontown/minigame/DropPlacer.py b/toontown/minigame/DropPlacer.py index c857847..4a02789 100644 --- a/toontown/minigame/DropPlacer.py +++ b/toontown/minigame/DropPlacer.py @@ -1,6 +1,6 @@ from direct.showbase.RandomNumGen import RandomNumGen -import CatchGameGlobals -import DropScheduler +from . import CatchGameGlobals +from . import DropScheduler from toontown.parties.PartyGlobals import CatchActivityDuration as PartyCatchDuration class DropPlacer: @@ -51,7 +51,7 @@ class DropPlacer: return [col, row] def getNextDrop(self): - raise RuntimeError, 'DropPlacer.getNextDrop should never be called' + raise RuntimeError('DropPlacer.getNextDrop should never be called') class RandomDropPlacer(DropPlacer): @@ -889,11 +889,11 @@ class RegionDropPlacer(DropPlacer): rowList = self.DropRegionTable[row] for column in range(len(rowList)): region = rowList[column] - if not self.DropRegion2GridCoordList.has_key(region): + if region not in self.DropRegion2GridCoordList: self.DropRegion2GridCoordList[region] = [] self.DropRegion2GridCoordList[region].append([row, column]) - self.DropRegions = self.DropRegion2GridCoordList.keys() + self.DropRegions = list(self.DropRegion2GridCoordList.keys()) self.DropRegions.sort() self.emptyDropRegions = self.DropRegions[:] self.fallingObjs = [] @@ -949,7 +949,7 @@ class PathDropPlacer(DropPlacer): [-1, 0], [-1, -1]] self.paths = [] - for i in xrange(self.numPlayers): + for i in range(self.numPlayers): dir = self.rng.randrange(0, len(self.moves)) col, row = self.getRandomColRow() path = {'direction': dir, diff --git a/toontown/minigame/Maze.py b/toontown/minigame/Maze.py index f431bc8..26ecf68 100644 --- a/toontown/minigame/Maze.py +++ b/toontown/minigame/Maze.py @@ -1,5 +1,5 @@ -from MazeBase import MazeBase -import MazeData +from .MazeBase import MazeBase +from . import MazeData class Maze(MazeBase): diff --git a/toontown/minigame/MazeMapGui.py b/toontown/minigame/MazeMapGui.py index 74b54e1..877261b 100644 --- a/toontown/minigame/MazeMapGui.py +++ b/toontown/minigame/MazeMapGui.py @@ -196,13 +196,13 @@ class MazeMapGui(DirectFrame): self._toon2marker[toon] = marker def removeToon(self, toon): - if not self._toon2marker.has_key(toon): + if toon not in self._toon2marker: return self._toon2marker[toon].removeNode() del self._toon2marker[toon] def updateToon(self, toon, tX, tY): - if not self._toon2marker.has_key(toon): + if toon not in self._toon2marker: return x, y = self.tile2gui(tX, tY) self._toon2marker[toon].setPos(*self.gui2pos(x, y)) diff --git a/toontown/minigame/MazeSuit.py b/toontown/minigame/MazeSuit.py index cfb768e..05bdb3d 100644 --- a/toontown/minigame/MazeSuit.py +++ b/toontown/minigame/MazeSuit.py @@ -7,7 +7,7 @@ from pandac.PandaModules import CollisionSphere, CollisionNode from toontown.suit import Suit from toontown.suit import SuitDNA from toontown.toonbase import ToontownGlobals -import MazeGameGlobals +from . import MazeGameGlobals class MazeSuit(DirectObject): COLL_SPHERE_NAME = 'MazeSuitSphere' @@ -58,7 +58,7 @@ class MazeSuit(DirectObject): self.suit.delete() def uniqueName(self, str): - return str + `(self.serialNum)` + return str + repr((self.serialNum)) def gameStart(self, gameStartTime): self.gameStartTime = gameStartTime @@ -187,7 +187,7 @@ class MazeSuit(DirectObject): if curTic < self.nextThinkTic: return [] else: - r = range(self.nextThinkTic, curTic + 1, self.ticPeriod) + r = list(range(self.nextThinkTic, curTic + 1, self.ticPeriod)) self.lastTicBeforeRender = r[-1] return r @@ -229,14 +229,14 @@ class MazeSuit(DirectObject): curT = globalClock.getFrameTime() - startTime curTic = int(curT * float(ticFreq)) suitUpdates = [] - for i in xrange(len(suitList)): + for i in range(len(suitList)): updateTics = suitList[i].getThinkTimestampTics(curTic) - suitUpdates.extend(zip(updateTics, [i] * len(updateTics))) + suitUpdates.extend(list(zip(updateTics, [i] * len(updateTics)))) suitUpdates.sort(lambda a, b: a[0] - b[0]) if len(suitUpdates) > 0: curTic = 0 - for i in xrange(len(suitUpdates)): + for i in range(len(suitUpdates)): update = suitUpdates[i] tic = update[0] suitIndex = update[1] @@ -251,10 +251,10 @@ class MazeSuit(DirectObject): j += 1 unwalkables = [] - for si in xrange(suitIndex): + for si in range(suitIndex): unwalkables.extend(suitList[si].occupiedTiles) - for si in xrange(suitIndex + 1, len(suitList)): + for si in range(suitIndex + 1, len(suitList)): unwalkables.extend(suitList[si].occupiedTiles) suit.think(curTic, curT, unwalkables) diff --git a/toontown/minigame/MinigameAvatarScorePanel.py b/toontown/minigame/MinigameAvatarScorePanel.py index f609d18..7536c69 100644 --- a/toontown/minigame/MinigameAvatarScorePanel.py +++ b/toontown/minigame/MinigameAvatarScorePanel.py @@ -8,7 +8,7 @@ class MinigameAvatarScorePanel(DirectFrame): def __init__(self, avId, avName): self.avId = avId - if base.cr.doId2do.has_key(self.avId): + if self.avId in base.cr.doId2do: self.avatar = base.cr.doId2do[self.avId] else: self.avatar = None diff --git a/toontown/minigame/MinigameCreatorAI.py b/toontown/minigame/MinigameCreatorAI.py index c5bc3e1..dd6f1b1 100644 --- a/toontown/minigame/MinigameCreatorAI.py +++ b/toontown/minigame/MinigameCreatorAI.py @@ -2,25 +2,25 @@ import copy import random import time from toontown.toonbase import ToontownGlobals -import DistributedMinigameTemplateAI -import DistributedRaceGameAI -import DistributedCannonGameAI -import DistributedTagGameAI -import DistributedPatternGameAI -import DistributedRingGameAI -import DistributedMazeGameAI -import DistributedTugOfWarGameAI -import DistributedCatchGameAI -import DistributedDivingGameAI -import DistributedTargetGameAI -import DistributedPairingGameAI -import DistributedPhotoGameAI -import DistributedVineGameAI -import DistributedIceGameAI -import DistributedCogThiefGameAI -import DistributedTwoDGameAI -import DistributedTravelGameAI -import TravelGameGlobals +from . import DistributedMinigameTemplateAI +from . import DistributedRaceGameAI +from . import DistributedCannonGameAI +from . import DistributedTagGameAI +from . import DistributedPatternGameAI +from . import DistributedRingGameAI +from . import DistributedMazeGameAI +from . import DistributedTugOfWarGameAI +from . import DistributedCatchGameAI +from . import DistributedDivingGameAI +from . import DistributedTargetGameAI +from . import DistributedPairingGameAI +from . import DistributedPhotoGameAI +from . import DistributedVineGameAI +from . import DistributedIceGameAI +from . import DistributedCogThiefGameAI +from . import DistributedTwoDGameAI +from . import DistributedTravelGameAI +from . import TravelGameGlobals ALLOW_TEMP_MINIGAMES = simbase.config.GetBool('allow-temp-minigames', False) if ALLOW_TEMP_MINIGAMES: from toontown.minigame.TempMinigameAI import * @@ -88,14 +88,14 @@ def createMinigame(air, playerArray, trolleyZone, minigameZone = None, previousG ToontownGlobals.TravelGameId: DistributedTravelGameAI.DistributedTravelGameAI, ToontownGlobals.PhotoGameId: DistributedPhotoGameAI.DistributedPhotoGameAI} if ALLOW_TEMP_MINIGAMES: - from TempMinigameAI import TempMgCtors - for key, value in TempMgCtors.items(): + from .TempMinigameAI import TempMgCtors + for key, value in list(TempMgCtors.items()): mgCtors[key] = value try: mg = mgCtors[mgId](air, mgId) except KeyError: - raise Exception, 'unknown minigame ID: %s' % mgId + raise Exception('unknown minigame ID: %s' % mgId) mg.setExpectedAvatars(playerArray) mg.setNewbieIds(newbieIds) @@ -110,7 +110,7 @@ def createMinigame(air, playerArray, trolleyZone, minigameZone = None, previousG avId = playerArray[index] votes = startingVotes[index] if votes < 0: - print 'createMinigame negative votes, avId=%s votes=%s' % (avId, votes) + print('createMinigame negative votes, avId=%s votes=%s' % (avId, votes)) votes = 0 mg.setStartingVote(avId, votes) diff --git a/toontown/minigame/MinigameRulesPanel.py b/toontown/minigame/MinigameRulesPanel.py index 6854a04..68ced54 100644 --- a/toontown/minigame/MinigameRulesPanel.py +++ b/toontown/minigame/MinigameRulesPanel.py @@ -5,7 +5,7 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import ToontownTimer from toontown.toonbase import TTLocalizer -import MinigameGlobals +from . import MinigameGlobals class MinigameRulesPanel(StateData.StateData): diff --git a/toontown/minigame/OrthoDrive.py b/toontown/minigame/OrthoDrive.py index 3a26913..0b3a904 100644 --- a/toontown/minigame/OrthoDrive.py +++ b/toontown/minigame/OrthoDrive.py @@ -2,7 +2,7 @@ from direct.interval.IntervalGlobal import * from direct.task.Task import Task from otp.otpbase import OTPGlobals from toontown.toonbase.ToonBaseGlobal import * -import ArrowKeys +from . import ArrowKeys class OrthoDrive: notify = DirectNotifyGlobal.directNotify.newCategory('OrthoDrive') diff --git a/toontown/minigame/OrthoWalk.py b/toontown/minigame/OrthoWalk.py index 1ac10f0..af00736 100644 --- a/toontown/minigame/OrthoWalk.py +++ b/toontown/minigame/OrthoWalk.py @@ -1,7 +1,7 @@ from toontown.toonbase.ToonBaseGlobal import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from OrthoDrive import * +from .OrthoDrive import * from direct.directnotify import DirectNotifyGlobal class OrthoWalk: diff --git a/toontown/minigame/PairingGameCard.py b/toontown/minigame/PairingGameCard.py index 5df8793..913b8bf 100644 --- a/toontown/minigame/PairingGameCard.py +++ b/toontown/minigame/PairingGameCard.py @@ -1,5 +1,5 @@ -from PlayingCard import PlayingCardNodePath -import PlayingCardGlobals +from .PlayingCard import PlayingCardNodePath +from . import PlayingCardGlobals from pandac.PandaModules import NodePath, Vec3 from direct.interval.IntervalGlobal import LerpHprInterval, Parallel, SoundInterval diff --git a/toontown/minigame/PairingGameGlobals.py b/toontown/minigame/PairingGameGlobals.py index 618cbda..b4ad7cf 100644 --- a/toontown/minigame/PairingGameGlobals.py +++ b/toontown/minigame/PairingGameGlobals.py @@ -1,4 +1,4 @@ -import PlayingCardDeck +from . import PlayingCardDeck EasiestGameDuration = 120 HardestGameDuration = 90 EndlessGame = config.GetBool('endless-pairing-game', 0) diff --git a/toontown/minigame/PatternGameGlobals.py b/toontown/minigame/PatternGameGlobals.py index 22e7d27..f96c6bd 100644 --- a/toontown/minigame/PatternGameGlobals.py +++ b/toontown/minigame/PatternGameGlobals.py @@ -1,4 +1,4 @@ -import MinigameGlobals +from . import MinigameGlobals INITIAL_ROUND_LENGTH = 2 ROUND_LENGTH_INCREMENT = 2 NUM_ROUNDS = 4 diff --git a/toontown/minigame/PhotoGameBase.py b/toontown/minigame/PhotoGameBase.py index ba8b074..1be0ff6 100644 --- a/toontown/minigame/PhotoGameBase.py +++ b/toontown/minigame/PhotoGameBase.py @@ -1,4 +1,4 @@ -import PhotoGameGlobals +from . import PhotoGameGlobals import random class PhotoGameBase: @@ -17,7 +17,7 @@ class PhotoGameBase: if numPathes == 0: return assignmentTemplates while len(assignmentTemplates) < numAssignments: - subjectIndex = random.choice(range(numPathes)) + subjectIndex = random.choice(list(range(numPathes))) pose = (None, None) while pose[0] == None: animSetIndex = self.data['PATHANIMREL'][subjectIndex] diff --git a/toontown/minigame/PlayingCard.py b/toontown/minigame/PlayingCard.py index 290a528..6dd8365 100644 --- a/toontown/minigame/PlayingCard.py +++ b/toontown/minigame/PlayingCard.py @@ -2,7 +2,7 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.task import Task from toontown.toonbase import TTLocalizer -import PlayingCardGlobals +from . import PlayingCardGlobals class PlayingCardBase: diff --git a/toontown/minigame/PlayingCardDeck.py b/toontown/minigame/PlayingCardDeck.py index a8bc582..905acc0 100644 --- a/toontown/minigame/PlayingCardDeck.py +++ b/toontown/minigame/PlayingCardDeck.py @@ -1,5 +1,5 @@ import random -import PlayingCardGlobals +from . import PlayingCardGlobals from toontown.minigame.PlayingCard import PlayingCardBase class PlayingCardDeck: @@ -8,13 +8,13 @@ class PlayingCardDeck: self.shuffle() def shuffle(self): - self.cards = range(0, PlayingCardGlobals.MaxSuit * PlayingCardGlobals.MaxRank) + self.cards = list(range(0, PlayingCardGlobals.MaxSuit * PlayingCardGlobals.MaxRank)) random.shuffle(self.cards) def shuffleWithSeed(self, seed): generator = random.Random() generator.seed(seed) - self.cards = range(0, PlayingCardGlobals.MaxSuit * PlayingCardGlobals.MaxRank) + self.cards = list(range(0, PlayingCardGlobals.MaxSuit * PlayingCardGlobals.MaxRank)) generator.shuffle(self.cards) def dealCard(self): diff --git a/toontown/minigame/Purchase.py b/toontown/minigame/Purchase.py index abfcda9..ce24caf 100644 --- a/toontown/minigame/Purchase.py +++ b/toontown/minigame/Purchase.py @@ -1,4 +1,4 @@ -from PurchaseBase import * +from .PurchaseBase import * from direct.task.Task import Task from toontown.toon import ToonHead from toontown.toonbase import ToontownTimer @@ -8,7 +8,7 @@ from direct.showbase.PythonUtil import Functor from toontown.minigame import TravelGameGlobals from toontown.distributed import DelayDelete from toontown.toonbase import ToontownGlobals -import MinigameGlobals +from . import MinigameGlobals COUNT_UP_RATE = 0.15 COUNT_UP_DURATION = 0.5 DELAY_BEFORE_COUNT_UP = 1.0 @@ -101,7 +101,7 @@ class Purchase(PurchaseBase): avId = self.ids[index] if self.states[index] != PURCHASE_NO_CLIENT_STATE and self.states[index] != PURCHASE_DISCONNECTED_STATE: if avId != base.localAvatar.doId: - if base.cr.doId2do.has_key(avId): + if avId in base.cr.doId2do: self.avInfoArray.append((avId, headFramePosList[layout[pos]], index)) pos = pos + 1 @@ -366,7 +366,7 @@ class Purchase(PurchaseBase): for i in range(len(task.ids)): if task.pointsArray[i] == winningPoints: avId = task.ids[i] - if base.cr.doId2do.has_key(avId): + if avId in base.cr.doId2do: toon = base.cr.doId2do[avId] toon.setAnimState('jump', 1.0) @@ -682,7 +682,7 @@ class Purchase(PurchaseBase): return self.metagamePlayAgainResult numToons = 0 for avId in self.ids: - if base.cr.doId2do.has_key(avId) and avId not in self.unexpectedExits: + if avId in base.cr.doId2do and avId not in self.unexpectedExits: numToons += 1 self.metagamePlayAgainResult = False @@ -693,7 +693,7 @@ class Purchase(PurchaseBase): def setupUnexpectedExitHooks(self): for avId in self.ids: - if base.cr.doId2do.has_key(avId): + if avId in base.cr.doId2do: toon = base.cr.doId2do[avId] eventName = toon.uniqueName('disable') self.accept(eventName, self.__handleUnexpectedExit, extraArgs=[avId]) diff --git a/toontown/minigame/Ring.py b/toontown/minigame/Ring.py index 28c6908..594b8ed 100644 --- a/toontown/minigame/Ring.py +++ b/toontown/minigame/Ring.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from pandac.PandaModules import NodePath -import RingTrack +from . import RingTrack class Ring(NodePath): diff --git a/toontown/minigame/RingAction.py b/toontown/minigame/RingAction.py index 7913cc7..0df5fce 100644 --- a/toontown/minigame/RingAction.py +++ b/toontown/minigame/RingAction.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import RingTrack +from . import RingTrack class RingAction: notify = DirectNotifyGlobal.directNotify.newCategory('RingAction') diff --git a/toontown/minigame/RingGroup.py b/toontown/minigame/RingGroup.py index e9e8e6b..65a69e5 100644 --- a/toontown/minigame/RingGroup.py +++ b/toontown/minigame/RingGroup.py @@ -1,10 +1,10 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from pandac.PandaModules import NodePath -import Ring -import RingTrack -import RingTrackGroup -import RingGameGlobals +from . import Ring +from . import RingTrack +from . import RingTrackGroup +from . import RingGameGlobals class RingGroup(NodePath): diff --git a/toontown/minigame/RingTrack.py b/toontown/minigame/RingTrack.py index 6836b34..1e21069 100644 --- a/toontown/minigame/RingTrack.py +++ b/toontown/minigame/RingTrack.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import RingAction +from . import RingAction class RingTrack: notify = DirectNotifyGlobal.directNotify.newCategory('RingTrack') diff --git a/toontown/minigame/RingTrackGroups.py b/toontown/minigame/RingTrackGroups.py index 3811857..4bce67d 100644 --- a/toontown/minigame/RingTrackGroups.py +++ b/toontown/minigame/RingTrackGroups.py @@ -1,9 +1,9 @@ import math -import RingGameGlobals -import RingAction -import RingTracks -import RingTrack -import RingTrackGroup +from . import RingGameGlobals +from . import RingAction +from . import RingTracks +from . import RingTrack +from . import RingTrackGroup from direct.showbase import PythonUtil STATIC = 0 SIMPLE = 1 @@ -144,7 +144,7 @@ def __get_Slots(numRings, rng, vertical = 1): offset = 1 - fpTab[-1] offset = rng.random() * (offset * 2) - offset - fpTab = map(lambda x: x + offset, fpTab) + fpTab = [x + offset for x in fpTab] for i in range(0, numRings): if vertical: getActionsFunc = RingTracks.getVerticalSlotActions diff --git a/toontown/minigame/RingTracks.py b/toontown/minigame/RingTracks.py index 3836124..85a309a 100644 --- a/toontown/minigame/RingTracks.py +++ b/toontown/minigame/RingTracks.py @@ -1,6 +1,6 @@ import math -import RingTrack -import RingAction +from . import RingTrack +from . import RingAction center = (0, 0) up = (0, 1) down = (0, -1) diff --git a/toontown/minigame/SwingVine.py b/toontown/minigame/SwingVine.py index cd9010f..5451f41 100644 --- a/toontown/minigame/SwingVine.py +++ b/toontown/minigame/SwingVine.py @@ -6,8 +6,8 @@ from direct.distributed import DistributedObject from direct.showutil import Rope import math from toontown.toonbase import ToontownGlobals -import VineGameGlobals -import VineSpider +from . import VineGameGlobals +from . import VineSpider class SwingVine(NodePath): notify = DirectNotifyGlobal.directNotify.newCategory('SwingVine') @@ -89,7 +89,7 @@ class SwingVine(NodePath): if self.hasSpider: self.spider.destroy() del self.spider - for toonInfo in self.attachedToons.values(): + for toonInfo in list(self.attachedToons.values()): attachNode = toonInfo[4] if attachNode: attachNode.removeNode() @@ -104,7 +104,7 @@ class SwingVine(NodePath): self.links = [] self.links.append((self.topLink, Point3(0, 0, 0))) anchor = self.topLink - for linkNum in xrange(self.numLinks): + for linkNum in range(self.numLinks): anchor = self.__makeLink(anchor, linkNum) self.bottomLink = self.links[-1][0] @@ -153,7 +153,7 @@ class SwingVine(NodePath): self.tubes = [] self.tubes2 = [] radius = 0.5 - for tubeIndex in xrange(self.numTubes): + for tubeIndex in range(self.numTubes): az = self.tubeLength / 2.0 bz = -self.tubeLength / 2.0 ct = CollisionTube(0, 0, az, 0, 0, bz, radius) @@ -187,16 +187,16 @@ class SwingVine(NodePath): def makeSpline(self): rope = Rope.Rope() - for i in xrange(len(self.links)): + for i in range(len(self.links)): pass rope.setup(min(len(self.links), 4), self.links) - for i in xrange(len(self.links)): + for i in range(len(self.links)): pass rope.curve.normalizeKnots() self.notify.debug('after normalize Knots') - for i in xrange(len(self.links)): + for i in range(len(self.links)): pass rn = rope.ropeNode @@ -282,7 +282,7 @@ class SwingVine(NodePath): def getAttachNode(self, toonId): retval = None - if self.attachedToons.has_key(toonId): + if toonId in self.attachedToons: existingAttachNode = self.attachedToons[toonId][4] if existingAttachNode: retval = existingAttachNode @@ -306,7 +306,7 @@ class SwingVine(NodePath): return offset def doubleCheckOffset(self, toonId): - if self.attachedToons.has_key(toonId): + if toonId in self.attachedToons: curOffset = self.attachedToons[toonId][3] if curOffset == Point3.zero(): newOffset = self.calcOffset(toonId) @@ -349,7 +349,7 @@ class SwingVine(NodePath): return def changeAttachedToonT(self, toonId, t): - if self.attachedToons.has_key(toonId): + if toonId in self.attachedToons: oldT = self.attachedToons[toonId][0] self.attachedToons[toonId][0] = t oldSwingType = self.calcSwingAnimType(oldT) @@ -361,7 +361,7 @@ class SwingVine(NodePath): self.attachToon(toonId, t, 1) def changeAttachedToonFacing(self, toonId, facing): - if self.attachedToons.has_key(toonId): + if toonId in self.attachedToons: curT = self.attachedToons[toonId][0] self.detachToon(toonId) self.attachToon(toonId, curT, facing) @@ -371,7 +371,7 @@ class SwingVine(NodePath): def detachToon(self, toonId): self.notify.debug('detachToon toonId=%d vineIndex=%d' % (toonId, self.vineIndex)) - if self.attachedToons.has_key(toonId): + if toonId in self.attachedToons: self.attachedToons[toonId][4].removeNode() swingIval = self.attachedToons[toonId][6] if swingIval: @@ -383,7 +383,7 @@ class SwingVine(NodePath): return def getAttachedToonInfo(self, toonId): - if self.attachedToons.has_key(toonId): + if toonId in self.attachedToons: return self.attachedToons[toonId] else: return None @@ -396,7 +396,7 @@ class SwingVine(NodePath): def updateTubes(self): newPoint = Vec3(0, 0, 0) curve = self.rope.ropeNode.getCurve().evaluate() - for tubeIndex in xrange(self.numTubes): + for tubeIndex in range(self.numTubes): tube = self.tubes[tubeIndex] t = self.getCenterTForTube(tubeIndex) curve.evalPoint(t, newPoint) @@ -409,7 +409,7 @@ class SwingVine(NodePath): rAngle = -90 - degrees tube.setR(rAngle) - for tubeIndex in xrange(self.numTubes): + for tubeIndex in range(self.numTubes): tube = self.tubes2[tubeIndex] t = self.getCenterTForTube(tubeIndex) curve.evalPoint(t, newPoint) @@ -448,7 +448,7 @@ class SwingVine(NodePath): def updateAttachedToons(self): curve = self.rope.ropeNode.getCurve().evaluate() - for avId in self.attachedToons.keys(): + for avId in list(self.attachedToons.keys()): self.doubleCheckOffset(avId) t = self.attachedToons[avId][0] newPoint = Vec3(0, 0, 0) @@ -621,7 +621,7 @@ class SwingVine(NodePath): swingInterval.start() def setupSwingAnim(self, avId): - if not self.attachedToons.has_key(avId): + if avId not in self.attachedToons: return av = base.cr.doId2do.get(avId) if not av: @@ -653,5 +653,5 @@ class SwingVine(NodePath): def updateSwingAnims(self): if self.unloading: return - for avId in self.attachedToons.keys(): + for avId in list(self.attachedToons.keys()): self.setupSwingAnim(avId) diff --git a/toontown/minigame/TagTreasurePlannerAI.py b/toontown/minigame/TagTreasurePlannerAI.py index 429a017..2ce2436 100644 --- a/toontown/minigame/TagTreasurePlannerAI.py +++ b/toontown/minigame/TagTreasurePlannerAI.py @@ -1,7 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from toontown.toonbase.ToontownGlobals import * from toontown.safezone import RegenTreasurePlannerAI -import DistributedTagTreasureAI +from . import DistributedTagTreasureAI class TagTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): notify = DirectNotifyGlobal.directNotify.newCategory('TagTreasurePlannerAI') diff --git a/toontown/minigame/TempMinigameAI.py b/toontown/minigame/TempMinigameAI.py index c524284..c4afd16 100644 --- a/toontown/minigame/TempMinigameAI.py +++ b/toontown/minigame/TempMinigameAI.py @@ -4,7 +4,7 @@ TEMP_MG_ID_COUNTER = ToontownGlobals.TravelGameId - 1 TempMgCtors = {} def _printMessage(message): - print '\n\n!!!', message, '\n\n' + print('\n\n!!!', message, '\n\n') def _registerTempMinigame(name, Class, id, minPlayers = 1, maxPlayers = 4): diff --git a/toontown/minigame/ToonBlitzAssetMgr.py b/toontown/minigame/ToonBlitzAssetMgr.py index 6a0dd7b..e35ee0f 100644 --- a/toontown/minigame/ToonBlitzAssetMgr.py +++ b/toontown/minigame/ToonBlitzAssetMgr.py @@ -36,7 +36,7 @@ class ToonBlitzAssetMgr(DirectObject): self.treasureModelList.append(corpIcon) self.particleGlow = loader.loadModel('phase_4/models/minigames/particleGlow') self.blockTypes = [] - for i in xrange(4): + for i in range(4): blockType = loader.loadModel('phase_4/models/minigames/toonblitz_game_block0' + str(i)) self.blockTypes.append(blockType) @@ -68,7 +68,7 @@ class ToonBlitzAssetMgr(DirectObject): self.progressLine.setScale(self.faceEndPos[0] - self.faceStartPos[0], 1, 0.01) self.progressLine.setPos(0, 0, self.faceStartPos[2]) self.cardMaker.setName('RaceProgressLineHash') - for n in xrange(ToonBlitzGlobals.NumSections[self.game.getSafezoneId()] + 1): + for n in range(ToonBlitzGlobals.NumSections[self.game.getSafezoneId()] + 1): hash = self.aspect2dRoot.attachNewNode(self.cardMaker.generate()) hash.setScale(self.progressLine.getScale()[2], 1, self.progressLine.getScale()[2] * 5) t = float(n) / ToonBlitzGlobals.NumSections[self.game.getSafezoneId()] diff --git a/toontown/minigame/TwoDDrive.py b/toontown/minigame/TwoDDrive.py index 7cedc8b..0fc34f1 100644 --- a/toontown/minigame/TwoDDrive.py +++ b/toontown/minigame/TwoDDrive.py @@ -1,7 +1,7 @@ from toontown.toonbase.ToonBaseGlobal import * from otp.otpbase import OTPGlobals from direct.interval.IntervalGlobal import * -import ArrowKeys +from . import ArrowKeys from direct.task.Task import Task class TwoDDrive: diff --git a/toontown/minigame/TwoDEnemyMgr.py b/toontown/minigame/TwoDEnemyMgr.py index 76eb567..a1ad4ce 100644 --- a/toontown/minigame/TwoDEnemyMgr.py +++ b/toontown/minigame/TwoDEnemyMgr.py @@ -27,7 +27,7 @@ class TwoDEnemyMgr(DirectObject): self.enemiesNP = NodePath('Enemies') self.enemiesNP.reparentTo(self.section.sectionNP) self.enemies = [] - for index in xrange(len(self.enemyList)): + for index in range(len(self.enemyList)): enemyId = self.section.getSectionizedId(index) suitAttribs = self.enemyList[index] newEnemy = TwoDEnemy.TwoDEnemy(self, enemyId, suitAttribs) diff --git a/toontown/minigame/TwoDGameToonSD.py b/toontown/minigame/TwoDGameToonSD.py index 9c6e687..4ae1b69 100644 --- a/toontown/minigame/TwoDGameToonSD.py +++ b/toontown/minigame/TwoDGameToonSD.py @@ -6,7 +6,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State -import ToonBlitzGlobals +from . import ToonBlitzGlobals from otp.otpbase import OTPGlobals from direct.task.Task import Task from toontown.minigame import TwoDBattleMgr diff --git a/toontown/minigame/TwoDSectionMgr.py b/toontown/minigame/TwoDSectionMgr.py index 2a3cabe..6eb8d44 100644 --- a/toontown/minigame/TwoDSectionMgr.py +++ b/toontown/minigame/TwoDSectionMgr.py @@ -56,7 +56,7 @@ class TwoDSectionMgr(DirectObject): self.startPipe.setPos(12, 0, 44) self.startArrow = self.game.assetMgr.arrow.copyTo(self.startSectionNP) self.startArrow.setPos(23, 1.5, 12.76) - for index in xrange(len(ToonBlitzGlobals.BlockListStart)): + for index in range(len(ToonBlitzGlobals.BlockListStart)): blockAttribs = ToonBlitzGlobals.BlockListStart[index] fileName = ToonBlitzGlobals.BlockTypes[blockAttribs[0]][0] blockIndex = int(fileName[-1]) diff --git a/toontown/minigame/TwoDStomper.py b/toontown/minigame/TwoDStomper.py index cc1283b..d7fe278 100644 --- a/toontown/minigame/TwoDStomper.py +++ b/toontown/minigame/TwoDStomper.py @@ -71,7 +71,7 @@ class TwoDStomper(DirectObject): self.range = self.headEndZ - self.headStartZ self.collSolids = [] self.collSolids.append(originalColl) - for i in xrange(self.numCollSolids - 1): + for i in range(self.numCollSolids - 1): newColl = originalColl.copyTo(self.model) self.collSolids.append(newColl) diff --git a/toontown/minigame/TwoDStomperMgr.py b/toontown/minigame/TwoDStomperMgr.py index c8860cd..b0e58e3 100644 --- a/toontown/minigame/TwoDStomperMgr.py +++ b/toontown/minigame/TwoDStomperMgr.py @@ -27,7 +27,7 @@ class TwoDStomperMgr(DirectObject): self.stompersNP = NodePath('Stompers') self.stompersNP.reparentTo(self.section.sectionNP) self.stompers = [] - for index in xrange(len(self.stomperList)): + for index in range(len(self.stomperList)): stomperAttribs = self.stomperList[index] self.createNewStomper(stomperAttribs) diff --git a/toontown/minigame/TwoDTreasureMgr.py b/toontown/minigame/TwoDTreasureMgr.py index 75415ab..ecd1880 100644 --- a/toontown/minigame/TwoDTreasureMgr.py +++ b/toontown/minigame/TwoDTreasureMgr.py @@ -29,7 +29,7 @@ class TwoDTreasureMgr(DirectObject): self.treasuresNP = NodePath('Treasures') self.treasuresNP.reparentTo(self.section.sectionNP) self.treasures = [] - for index in xrange(len(self.treasureList)): + for index in range(len(self.treasureList)): treasureAttribs = self.treasureList[index][0] treasureValue = self.treasureList[index][1] self.createNewTreasure(treasureAttribs, treasureValue) @@ -37,7 +37,7 @@ class TwoDTreasureMgr(DirectObject): self.enemyTreasures = [] numPlayers = self.section.sectionMgr.game.numPlayers pos = Point3(-1, -1, -1) - for index in xrange(len(self.enemyList)): + for index in range(len(self.enemyList)): self.createNewTreasure([pos], numPlayers, isEnemyGenerated=True) def createNewTreasure(self, attrib, value, isEnemyGenerated = False, model = None): diff --git a/toontown/minigame/TwoDWalk.py b/toontown/minigame/TwoDWalk.py index e160dea..589eebc 100644 --- a/toontown/minigame/TwoDWalk.py +++ b/toontown/minigame/TwoDWalk.py @@ -1,4 +1,4 @@ -from OrthoWalk import * +from .OrthoWalk import * class TwoDWalk(OrthoWalk): notify = DirectNotifyGlobal.directNotify.newCategory('TwoDWalk') diff --git a/toontown/minigame/VineBat.py b/toontown/minigame/VineBat.py index 9c9de09..7f2bab2 100644 --- a/toontown/minigame/VineBat.py +++ b/toontown/minigame/VineBat.py @@ -2,7 +2,7 @@ from direct.showbase.DirectObject import DirectObject from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * -import VineGameGlobals +from . import VineGameGlobals from direct.interval.SoundInterval import SoundInterval class VineBat(NodePath, DirectObject): diff --git a/toontown/minigame/VineHeadFrame.py b/toontown/minigame/VineHeadFrame.py index d3f57f3..fadec24 100644 --- a/toontown/minigame/VineHeadFrame.py +++ b/toontown/minigame/VineHeadFrame.py @@ -12,7 +12,7 @@ class VineHeadFrame(DirectFrame): 'geom_scale': (0.5, 1, 0.5), 'pos': (0, 0, 0)} opts.update(kwargs) - apply(DirectFrame.__init__, (self,) + args, opts) + DirectFrame.__init__(*(self,) + args, **opts) self.initialiseoptions(VineHeadFrame) if av: self.setAv(av) diff --git a/toontown/minigame/VineSpider.py b/toontown/minigame/VineSpider.py index 87a2b3d..c8eeb78 100644 --- a/toontown/minigame/VineSpider.py +++ b/toontown/minigame/VineSpider.py @@ -2,7 +2,7 @@ from direct.showbase.DirectObject import DirectObject from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * -import VineGameGlobals +from . import VineGameGlobals class VineSpider(NodePath, DirectObject): RADIUS = 1.7 @@ -56,8 +56,8 @@ class VineSpider(NodePath, DirectObject): self.removeNode() def __handleEnterSphere(self, collEntry): - print 'VineSpider.__handleEnterSphere' - print collEntry + print('VineSpider.__handleEnterSphere') + print(collEntry) self.ignoreAll() self.notify.debug('treasuerGrabbed') messenger.send('VineSpiderGrabbed', [self.serialNum]) diff --git a/toontown/minigame/VoteResultsTrolleyPanel.py b/toontown/minigame/VoteResultsTrolleyPanel.py index 7e29e8f..54fef55 100644 --- a/toontown/minigame/VoteResultsTrolleyPanel.py +++ b/toontown/minigame/VoteResultsTrolleyPanel.py @@ -168,7 +168,7 @@ class VoteResultsTrolleyPanel(DirectFrame): label['text'] = str(int(t * additionalVotes + startVotes)) track.append(LerpFunc(totalTicker, duration=duration, name='countTotal %d' % index)) - if self.avVotesLabel.has_key(index): + if index in self.avVotesLabel: def avVotesTicker(t, label = self.avVotesLabel[index], startVotes = 0, endVotes = numVotes, direction = direction): oldValue = label['text'] @@ -186,7 +186,7 @@ class VoteResultsTrolleyPanel(DirectFrame): label = self.avVotesLabel[index] track.append(Func(self.avVotesLabel[index].show, name='showName %d' % index)) - if self.avArrows.has_key(index): + if index in self.avArrows: track.append(Func(self.avArrows[index].show, name='showArrow %d' % index)) if direction == 0 and numVotes: pass diff --git a/toontown/parties/CalendarGuiMonth.py b/toontown/parties/CalendarGuiMonth.py index 8aec1f0..9465cc3 100644 --- a/toontown/parties/CalendarGuiMonth.py +++ b/toontown/parties/CalendarGuiMonth.py @@ -29,7 +29,7 @@ class CalendarGuiMonth(DirectFrame): self.monthLocator = self.attachNewNode('monthLocator') self.monthLocator.setZ(0.6) self.weekDayLocators = [] - for i in xrange(7): + for i in range(7): self.weekDayLocators.append(self.attachNewNode('weekDayLocator-%d' % i)) self.weekDayLocators[i].setZ(0.5) self.weekDayLocators[i].setX(i * 0.24 + -0.75) @@ -37,9 +37,9 @@ class CalendarGuiMonth(DirectFrame): dayTopLeftX = -0.8 dayTopLeftZ = 0.4 self.dayLocators = [] - for row in xrange(6): + for row in range(6): oneWeek = [] - for col in xrange(7): + for col in range(7): newDayLoc = self.attachNewNode('dayLocator-row-%d-col-%d' % (row, col)) newDayLoc.setX(col * 0.24 + dayTopLeftX) newDayLoc.setZ(row * -0.18 + dayTopLeftZ) @@ -71,9 +71,9 @@ class CalendarGuiMonth(DirectFrame): self.attachMarker(weekDayLoc) self.dayLocators = [] - for row in xrange(6): + for row in range(6): oneWeek = [] - for col in xrange(7): + for col in range(7): newDayLoc = self.find('**/loc_box_%s_%s' % (row, col)) oneWeek.append(newDayLoc) @@ -97,7 +97,7 @@ class CalendarGuiMonth(DirectFrame): 246 / 255.0, 1.0)) self.weekdayLabels = [] - for posIndex in xrange(7): + for posIndex in range(7): adjustedNameIndex = (posIndex - 1) % 7 self.weekdayLabels.append(DirectLabel(parent=self.weekDayLocators[posIndex], relief=None, text=TTLocalizer.DayNamesAbbrev[adjustedNameIndex], text_font=ToontownGlobals.getInterfaceFont(), text_fg=(255 / 255.0, 146 / 255.0, diff --git a/toontown/parties/Decoration.py b/toontown/parties/Decoration.py index 2466a85..ecccb64 100644 --- a/toontown/parties/Decoration.py +++ b/toontown/parties/Decoration.py @@ -205,7 +205,7 @@ class Decoration(NodePath): self.decorationModels = loader.loadModel('phase_4/models/parties/partyDecorations') self.decorationModels.copyTo(self) decors = self.findAllMatches('**/partyDecoration_*') - for i in xrange(decors.getNumPaths()): + for i in range(decors.getNumPaths()): decPiece = decors.getPath(i) n = decPiece.getName() if n.endswith('shadow') or n.endswith('base') or n.endswith('collision') or n.endswith(name): diff --git a/toontown/parties/DistributedParty.py b/toontown/parties/DistributedParty.py index 161cbdf..f896260 100644 --- a/toontown/parties/DistributedParty.py +++ b/toontown/parties/DistributedParty.py @@ -12,7 +12,7 @@ from toontown.toonbase import TTLocalizer from toontown.toon import Toon from toontown.parties import PartyGlobals from toontown.parties.Decoration import Decoration -import PartyUtils +from . import PartyUtils class DistributedParty(DistributedObject.DistributedObject): notify = directNotify.newCategory('DistributedParty') @@ -426,7 +426,7 @@ class DistributedParty(DistributedObject.DistributedObject): def getClearSquarePos(self): clearPositions = self.getClearSquarePositions() if len(clearPositions) == 0: - raise StandardError, 'Party %s has no empty grid squares.' % self.doId + raise Exception('Party %s has no empty grid squares.' % self.doId) return random.choice(clearPositions) def getClearSquarePositions(self): diff --git a/toontown/parties/DistributedPartyActivity.py b/toontown/parties/DistributedPartyActivity.py index 96accd0..26e9b04 100644 --- a/toontown/parties/DistributedPartyActivity.py +++ b/toontown/parties/DistributedPartyActivity.py @@ -202,7 +202,7 @@ class DistributedPartyActivity(DistributedObject.DistributedObject): def disable(self): self.notify.debug('BASE: disable') DistributedObject.DistributedObject.disable(self) - rorToonIds = self._toonId2ror.keys() + rorToonIds = list(self._toonId2ror.keys()) for toonId in rorToonIds: self.cr.relatedObjectMgr.abortRequest(self._toonId2ror[toonId]) del self._toonId2ror[toonId] @@ -464,7 +464,7 @@ class DistributedPartyActivity(DistributedObject.DistributedObject): avatar.stopLookAround() def getAvatar(self, toonId): - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: return self.cr.doId2do[toonId] else: self.notify.warning('BASE: getAvatar: No avatar in doId2do with id: ' + str(toonId)) diff --git a/toontown/parties/DistributedPartyCannon.py b/toontown/parties/DistributedPartyCannon.py index 2212402..9d12350 100644 --- a/toontown/parties/DistributedPartyCannon.py +++ b/toontown/parties/DistributedPartyCannon.py @@ -185,7 +185,7 @@ class DistributedPartyCannon(DistributedObject, Cannon): else: self.__enableCannonControl() self.controllingToonAvId = avId - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: self.toonInsideAvId = avId self.notify.debug('enterCannon self.toonInsideAvId=%d' % self.toonInsideAvId) toon = base.cr.doId2do[avId] @@ -256,12 +256,12 @@ class DistributedPartyCannon(DistributedObject, Cannon): def removeAvFromCannon(self, avId): place = base.cr.playGame.getPlace() av = base.cr.doId2do.get(avId) - print 'removeAvFromCannon' + print('removeAvFromCannon') if place: if not hasattr(place, 'fsm'): return placeState = place.fsm.getCurrentState().getName() - print placeState + print(placeState) if placeState != 'fishing': if av != None: av.startSmooth() diff --git a/toontown/parties/DistributedPartyCannonActivity.py b/toontown/parties/DistributedPartyCannonActivity.py index 19efbff..c1f2213 100644 --- a/toontown/parties/DistributedPartyCannonActivity.py +++ b/toontown/parties/DistributedPartyCannonActivity.py @@ -263,10 +263,10 @@ class DistributedPartyCannonActivity(DistributedPartyActivity): self.inWater = 0 flightResults = self.__calcFlightResults(cannon, toonId, launchTime) if not isClient(): - print 'EXECWARNING DistributedPartyCannonActivity: %s' % flightResults + print('EXECWARNING DistributedPartyCannonActivity: %s' % flightResults) printStack() for key in flightResults: - exec "%s = flightResults['%s']" % (key, key) + exec("%s = flightResults['%s']" % (key, key)) self.notify.debug('start position: ' + str(startPos)) self.notify.debug('start velocity: ' + str(startVel)) @@ -342,7 +342,7 @@ class DistributedPartyCannonActivity(DistributedPartyActivity): def _remoteToonFlyTask(self, task = None): ids2del = [] frameTime = globalClock.getFrameTime() - for avId, trajInfo in self._avId2trajectoryInfo.iteritems(): + for avId, trajInfo in self._avId2trajectoryInfo.items(): trajectory = trajInfo.trajectory startTime = trajInfo.startT groundTime = trajectory.calcTimeOfImpactOnPlane(0.0) / self.TimeFactor + startTime @@ -951,5 +951,5 @@ class DistributedPartyCannonActivity(DistributedPartyActivity): def handleToonExited(self, toonId): self.notify.debug('DistributedPartyCannonActivity handleToonExited( toonId=%s ) ' % toonId) - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: self.notify.warning('handleToonExited is not defined') diff --git a/toontown/parties/DistributedPartyCatchActivity.py b/toontown/parties/DistributedPartyCatchActivity.py index aa8f9c9..fd7abd2 100644 --- a/toontown/parties/DistributedPartyCatchActivity.py +++ b/toontown/parties/DistributedPartyCatchActivity.py @@ -119,23 +119,23 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa DistributedPartyCatchActivity.notify.debug('PartyCatch: load') self.activityFSM = CatchActivityFSM(self) if __dev__: - for o in xrange(3): - print {0: 'SPOTS PER PLAYER', + for o in range(3): + print({0: 'SPOTS PER PLAYER', 1: 'DROPS PER MINUTE PER SPOT DURING NORMAL DROP PERIOD', - 2: 'DROPS PER MINUTE PER PLAYER DURING NORMAL DROP PERIOD'}[o] - for i in xrange(1, self.FallRateCap_Players + 10): + 2: 'DROPS PER MINUTE PER PLAYER DURING NORMAL DROP PERIOD'}[o]) + for i in range(1, self.FallRateCap_Players + 10): self.defineConstants(forceNumPlayers=i) numDropLocations = self.DropRows * self.DropColumns numDropsPerMin = 60.0 / self.DropPeriod if o == 0: spotsPerPlayer = numDropLocations / float(i) - print '%2d PLAYERS: %s' % (i, spotsPerPlayer) + print('%2d PLAYERS: %s' % (i, spotsPerPlayer)) elif o == 1: numDropsPerMinPerSpot = numDropsPerMin / numDropLocations - print '%2d PLAYERS: %s' % (i, numDropsPerMinPerSpot) + print('%2d PLAYERS: %s' % (i, numDropsPerMinPerSpot)) elif i > 0: numDropsPerMinPerPlayer = numDropsPerMin / i - print '%2d PLAYERS: %s' % (i, numDropsPerMinPerPlayer) + print('%2d PLAYERS: %s' % (i, numDropsPerMinPerPlayer)) self.defineConstants() self.treesAndFence = loader.loadModel('phase_13/models/parties/%s' % arenaModel) @@ -192,7 +192,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa 'coconut': 0.7, 'watermelon': 0.6, 'pineapple': 0.45} - if modelScales.has_key(objType.name): + if objType.name in modelScales: model.setScale(modelScales[objType.name]) if objType == PartyGlobals.Name2DropObjectType['pear']: model.setZ(-.6) @@ -215,8 +215,8 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa self.stopDropTask() del self.activityFSM del self.__textGen - for avId in self.toonSDs.keys(): - if self.toonSDs.has_key(avId): + for avId in list(self.toonSDs.keys()): + if avId in self.toonSDs: toonSD = self.toonSDs[avId] toonSD.unload() @@ -226,7 +226,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa self.dropShadow.removeNode() del self.dropShadow base.cr.parentMgr.unregisterParent(self._avatarNodePathParentToken) - for model in self.dropObjModels.values(): + for model in list(self.dropObjModels.values()): model.removeNode() del self.dropObjModels @@ -250,26 +250,26 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa base.cr.playGame.getPlace().fsm.request('walk') def handleToonJoined(self, toonId): - if not self.toonSDs.has_key(toonId): + if toonId not in self.toonSDs: toonSD = PartyCatchActivityToonSD(toonId, self) self.toonSDs[toonId] = toonSD toonSD.load() self.notify.debug('handleToonJoined : currentState = %s' % self.activityFSM.state) self.cr.doId2do[toonId].useLOD(500) if self.activityFSM.state == 'Active': - if self.toonSDs.has_key(toonId): + if toonId in self.toonSDs: self.toonSDs[toonId].enter() if base.localAvatar.doId == toonId: base.localAvatar.b_setParent(self._avatarNodePathParentToken) self.putLocalAvatarInActivity() - if self.toonSDs.has_key(toonId): + if toonId in self.toonSDs: self.toonSDs[toonId].fsm.request('rules') def handleToonExited(self, toonId): self.notify.debug('handleToonExited( toonId=%s )' % toonId) - if self.cr.doId2do.has_key(toonId): + if toonId in self.cr.doId2do: self.cr.doId2do[toonId].resetLOD() - if self.toonSDs.has_key(toonId): + if toonId in self.toonSDs: self.toonSDs[toonId].fsm.request('notPlaying') self.toonSDs[toonId].exit() self.toonSDs[toonId].unload() @@ -331,7 +331,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa self.notify.debug('_toonExitedTree : avid = %s' % base.localAvatar.doId) self._enteredTree = False if hasattr(base.cr.playGame.getPlace(), 'fsm') and self.activityFSM.state == 'Active' and self.isLocalToonInActivity(): - if self.toonSDs.has_key(base.localAvatar.doId): + if base.localAvatar.doId in self.toonSDs: self.takeLocalAvatarOutOfActivity() self.toonSDs[base.localAvatar.doId].fsm.request('notPlaying') self.d_toonExitDemand() @@ -340,7 +340,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa self.notify.info('setToonsPlaying(%s)' % (toonIds,)) DistributedPartyActivity.setToonsPlaying(self, toonIds) if self.isLocalToonInActivity() and base.localAvatar.doId not in toonIds: - if self.toonSDs.has_key(base.localAvatar.doId): + if base.localAvatar.doId in self.toonSDs: self.takeLocalAvatarOutOfActivity() self.toonSDs[base.localAvatar.doId].fsm.request('notPlaying') @@ -443,7 +443,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa def handleToonDisabled(self, avId): DistributedPartyCatchActivity.notify.debug('handleToonDisabled') DistributedPartyCatchActivity.notify.debug('avatar ' + str(avId) + ' disabled') - if self.toonSDs.has_key(avId): + if avId in self.toonSDs: self.toonSDs[avId].exit(unexpectedExit=True) del self.toonSDs[avId] @@ -543,7 +543,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa self.finishDropInterval(generation, objNum) def showCatch(self, avId, generation, objNum): - if not self.toonSDs.has_key(avId): + if avId not in self.toonSDs: return isLocal = avId == base.localAvatar.doId if generation not in self._id2gen: @@ -553,7 +553,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa objName = self._id2gen[generation].droppedObjNames[objNum] objType = PartyGlobals.Name2DropObjectType[objName] if objType.good: - if not self._id2gen[generation].droppedObjCaught.has_key(objNum): + if objNum not in self._id2gen[generation].droppedObjCaught: if isLocal: base.playSfx(self.sndGoodCatch) fruit = self.getObjModel(objName) @@ -584,12 +584,12 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa def finishDropInterval(self, generation, objNum): if hasattr(self, 'dropIntervals'): - if self.dropIntervals.has_key((generation, objNum)): + if (generation, objNum) in self.dropIntervals: self.dropIntervals[generation, objNum].finish() def finishAllDropIntervals(self): if hasattr(self, 'dropIntervals'): - for dropInterval in self.dropIntervals.values(): + for dropInterval in list(self.dropIntervals.values()): dropInterval.finish() def setGenerations(self, generations): @@ -602,7 +602,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa gen2nt[id] = timestamp32 gen2np[id] = numPlayers - ids = self._id2gen.keys() + ids = list(self._id2gen.keys()) for id in ids: if id not in gen2t: self._removeGeneration(id) @@ -799,7 +799,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa def startActive(self): DistributedPartyCatchActivity.notify.debug('startActive') for avId in self.toonIds: - if self.toonSDs.has_key(avId): + if avId in self.toonSDs: toonSD = self.toonSDs[avId] toonSD.enter() toonSD.fsm.request('normal') @@ -818,7 +818,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa del self.finishIval if base.localAvatar.doId in self.toonIds: self.takeLocalAvatarOutOfActivity() - for ival in self.dropIntervals.values(): + for ival in list(self.dropIntervals.values()): ival.finish() del self.dropIntervals @@ -826,7 +826,7 @@ class DistributedPartyCatchActivity(DistributedPartyActivity, DistributedPartyCa def startConclusion(self): DistributedPartyCatchActivity.notify.debug('startConclusion') for avId in self.toonIds: - if self.toonSDs.has_key(avId): + if avId in self.toonSDs: toonSD = self.toonSDs[avId] toonSD.fsm.request('notPlaying') diff --git a/toontown/parties/DistributedPartyCatchActivityBase.py b/toontown/parties/DistributedPartyCatchActivityBase.py index 66730f0..0ea760f 100644 --- a/toontown/parties/DistributedPartyCatchActivityBase.py +++ b/toontown/parties/DistributedPartyCatchActivityBase.py @@ -2,6 +2,7 @@ import math from direct.directnotify import DirectNotifyGlobal from toontown.minigame.DropScheduler import ThreePhaseDropScheduler from toontown.parties import PartyGlobals +from functools import reduce class DistributedPartyCatchActivityBase: notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPartyCatchActivityBase') @@ -45,8 +46,8 @@ class DistributedPartyCatchActivityBase: self.DropPeriod /= scaledNumPlayers typeProbs = {'fruit': 3, 'anvil': 1} - probSum = reduce(lambda x, y: x + y, typeProbs.values()) - for key in typeProbs.keys(): + probSum = reduce(lambda x, y: x + y, list(typeProbs.values())) + for key in list(typeProbs.keys()): typeProbs[key] = float(typeProbs[key]) / probSum scheduler = ThreePhaseDropScheduler(PartyGlobals.CatchActivityDuration, self.FirstDropDelay, self.DropPeriod, self.MaxDropDuration, self.SlowerDropPeriodMult, self.NormalDropDelay, self.FasterDropDelay, self.FasterDropPeriodMult) diff --git a/toontown/parties/DistributedPartyCogActivity.py b/toontown/parties/DistributedPartyCogActivity.py index 3937983..673450f 100644 --- a/toontown/parties/DistributedPartyCogActivity.py +++ b/toontown/parties/DistributedPartyCogActivity.py @@ -1,9 +1,9 @@ from direct.distributed.ClockDelta import globalClockDelta from pandac.PandaModules import Point3 from toontown.toonbase import TTLocalizer -import PartyGlobals -from DistributedPartyTeamActivity import DistributedPartyTeamActivity -from PartyCogActivity import PartyCogActivity +from . import PartyGlobals +from .DistributedPartyTeamActivity import DistributedPartyTeamActivity +from .PartyCogActivity import PartyCogActivity class DistributedPartyCogActivity(DistributedPartyTeamActivity): notify = directNotify.newCategory('DistributedPartyCogActivity') diff --git a/toontown/parties/DistributedPartyDance20Activity.py b/toontown/parties/DistributedPartyDance20Activity.py index 5721f6e..72385da 100644 --- a/toontown/parties/DistributedPartyDance20Activity.py +++ b/toontown/parties/DistributedPartyDance20Activity.py @@ -20,7 +20,7 @@ class DistributedPartyDance20Activity(DistributedPartyDanceActivityBase): correctBall = self.danceFloor.find('**/discoBall_20') if not correctBall.isEmpty(): numChildren = parentGroup.getNumChildren() - for i in xrange(numChildren): + for i in range(numChildren): child = parentGroup.getChild(i) if child != correctBall: child.hide() diff --git a/toontown/parties/DistributedPartyDanceActivity.py b/toontown/parties/DistributedPartyDanceActivity.py index dfb243d..cbafaec 100644 --- a/toontown/parties/DistributedPartyDanceActivity.py +++ b/toontown/parties/DistributedPartyDanceActivity.py @@ -21,7 +21,7 @@ class DistributedPartyDanceActivity(DistributedPartyDanceActivityBase): origBall = self.danceFloor.find('**/discoBall_mesh_orig') if not correctBall.isEmpty(): numChildren = parentGroup.getNumChildren() - for i in xrange(numChildren): + for i in range(numChildren): child = parentGroup.getChild(i) if child != correctBall: child.hide() diff --git a/toontown/parties/DistributedPartyDanceActivityBase.py b/toontown/parties/DistributedPartyDanceActivityBase.py index fa8242f..235f0a6 100644 --- a/toontown/parties/DistributedPartyDanceActivityBase.py +++ b/toontown/parties/DistributedPartyDanceActivityBase.py @@ -42,7 +42,7 @@ class DistributedPartyDanceActivityBase(DistributedPartyActivity): def generateInit(self): self.notify.debug('generateInit') DistributedPartyActivity.generateInit(self) - self.keyCodes = KeyCodes(patterns=self.dancePatternToAnims.keys()) + self.keyCodes = KeyCodes(patterns=list(self.dancePatternToAnims.keys())) self.gui = KeyCodesGui(self.keyCodes) self.__initOrthoWalk() self.activityFSM = DanceActivityFSM(self) @@ -83,7 +83,7 @@ class DistributedPartyDanceActivityBase(DistributedPartyActivity): self.danceFloor.removeNode() self.danceFloor = None self.__destroyOrthoWalk() - for toonId in self.dancingToonFSMs.keys(): + for toonId in list(self.dancingToonFSMs.keys()): self.dancingToonFSMs[toonId].destroy() del self.dancingToonFSMs[toonId] @@ -100,7 +100,7 @@ class DistributedPartyDanceActivityBase(DistributedPartyActivity): def handleToonDisabled(self, toonId): self.notify.debug('handleToonDisabled avatar ' + str(toonId) + ' disabled') - if self.dancingToonFSMs.has_key(toonId): + if toonId in self.dancingToonFSMs: self.dancingToonFSMs[toonId].request('cleanup') self.dancingToonFSMs[toonId].destroy() del self.dancingToonFSMs[toonId] @@ -191,7 +191,7 @@ class DistributedPartyDanceActivityBase(DistributedPartyActivity): def handleToonJoined(self, toonId, h): self.notify.debug('handleToonJoined( toonId=%d, h=%.2f )' % (toonId, h)) - if base.cr.doId2do.has_key(toonId): + if toonId in base.cr.doId2do: toonFSM = PartyDanceActivityToonFSM(toonId, self, h) toonFSM.request('Init') self.dancingToonFSMs[toonId] = toonFSM @@ -216,7 +216,7 @@ class DistributedPartyDanceActivityBase(DistributedPartyActivity): self.finishRules() def __localEnableControls(self): - if not self.dancingToonFSMs.has_key(base.localAvatar.doId): + if base.localAvatar.doId not in self.dancingToonFSMs: self.notify.debug('no dancing FSM for local avatar, not enabling controls') return self.accept(KeyCodes.PATTERN_MATCH_EVENT, self.__doDanceMove) @@ -321,11 +321,11 @@ class DistributedPartyDanceActivityBase(DistributedPartyActivity): self.sendUpdate('updateDancingToon', [state, anim]) def setDancingToonState(self, toonId, state, anim): - if toonId != base.localAvatar.doId and self.dancingToonFSMs.has_key(toonId): + if toonId != base.localAvatar.doId and toonId in self.dancingToonFSMs: self._requestToonState(toonId, state, anim) def _requestToonState(self, toonId, state, anim): - if self.dancingToonFSMs.has_key(toonId): + if toonId in self.dancingToonFSMs: state = ToonDancingStates.getString(state) curState = self.dancingToonFSMs[toonId].getCurrentOrNextState() try: diff --git a/toontown/parties/DistributedPartyFireworksActivity.py b/toontown/parties/DistributedPartyFireworksActivity.py index 804a191..04f8f14 100644 --- a/toontown/parties/DistributedPartyFireworksActivity.py +++ b/toontown/parties/DistributedPartyFireworksActivity.py @@ -8,17 +8,17 @@ from direct.distributed.ClockDelta import globalClockDelta from toontown.effects.FireworkShowMixin import FireworkShowMixin from toontown.effects.RocketExplosion import RocketExplosion from toontown.toonbase import TTLocalizer -from PartyGlobals import FireworkShows -from PartyGlobals import ActivityIds -from PartyGlobals import ActivityTypes -from PartyGlobals import FireworksStartedEvent -from PartyGlobals import FireworksFinishedEvent -from PartyGlobals import FireworksPostLaunchDelay -from PartyGlobals import RocketSoundDelay -from PartyGlobals import RocketDirectionDelay -from DistributedPartyActivity import DistributedPartyActivity -from activityFSMs import FireworksActivityFSM -import PartyGlobals +from .PartyGlobals import FireworkShows +from .PartyGlobals import ActivityIds +from .PartyGlobals import ActivityTypes +from .PartyGlobals import FireworksStartedEvent +from .PartyGlobals import FireworksFinishedEvent +from .PartyGlobals import FireworksPostLaunchDelay +from .PartyGlobals import RocketSoundDelay +from .PartyGlobals import RocketDirectionDelay +from .DistributedPartyActivity import DistributedPartyActivity +from .activityFSMs import FireworksActivityFSM +from . import PartyGlobals class DistributedPartyFireworksActivity(DistributedPartyActivity, FireworkShowMixin): notify = directNotify.newCategory('DistributedPartyFireworksActivity') diff --git a/toontown/parties/DistributedPartyTrampolineActivity.py b/toontown/parties/DistributedPartyTrampolineActivity.py index 018e19c..767dd13 100644 --- a/toontown/parties/DistributedPartyTrampolineActivity.py +++ b/toontown/parties/DistributedPartyTrampolineActivity.py @@ -343,7 +343,7 @@ class DistributedPartyTrampolineActivity(DistributedPartyActivity): guiBean, beanAnim)) - self.beansToCollect = range(self.numJellyBeans) + self.beansToCollect = list(range(self.numJellyBeans)) def cleanupJellyBeans(self): for bean in self.beans: diff --git a/toontown/parties/DistributedPartyTugOfWarActivity.py b/toontown/parties/DistributedPartyTugOfWarActivity.py index aa0ee5b..027342a 100644 --- a/toontown/parties/DistributedPartyTugOfWarActivity.py +++ b/toontown/parties/DistributedPartyTugOfWarActivity.py @@ -19,9 +19,9 @@ from toontown.toonbase import ToontownGlobals from toontown.effects import Splash from toontown.minigame.MinigamePowerMeter import MinigamePowerMeter from toontown.minigame.ArrowKeys import ArrowKeys -import PartyGlobals -import PartyUtils -from DistributedPartyTeamActivity import DistributedPartyTeamActivity +from . import PartyGlobals +from . import PartyUtils +from .DistributedPartyTeamActivity import DistributedPartyTeamActivity class DistributedPartyTugOfWarActivity(DistributedPartyTeamActivity): notify = directNotify.newCategory('DistributedPartyTugOfWarActivity') @@ -128,7 +128,7 @@ class DistributedPartyTugOfWarActivity(DistributedPartyTeamActivity): return def handleToonDisabled(self, toonId): - if self.toonIdsToAnimIntervals.has_key(toonId): + if toonId in self.toonIdsToAnimIntervals: if self.toonIdsToAnimIntervals[toonId]: if self.toonIdsToAnimIntervals[toonId].isPlaying(): self.toonIdsToAnimIntervals[toonId].finish() @@ -430,7 +430,7 @@ class DistributedPartyTugOfWarActivity(DistributedPartyTeamActivity): if self.getAvatar(toonId): self.getAvatar(toonId).loop('victory') - for ival in self.toonIdsToAnimIntervals.values(): + for ival in list(self.toonIdsToAnimIntervals.values()): if ival is not None: ival.finish() @@ -484,9 +484,9 @@ class DistributedPartyTugOfWarActivity(DistributedPartyTeamActivity): for i in range(numToons - 1, 0, -1): toon1 = self.toonIds[currTeam][i] toon2 = self.toonIds[currTeam][i - 1] - if not self.toonIdsToRightHands.has_key(toon1): + if toon1 not in self.toonIdsToRightHands: self.notify.warning('Toon in tug of war activity but not properly setup: %s' % toon1) - elif not self.toonIdsToRightHands.has_key(toon2): + elif toon2 not in self.toonIdsToRightHands: self.notify.warning('Toon in tug of war activity but not properly setup: %s' % toon2) else: self.notify.debug('Connecting rope between toon %d and toon %d of team %d.' % (i, i - 1, currTeam)) @@ -579,7 +579,7 @@ class DistributedPartyTugOfWarActivity(DistributedPartyTeamActivity): if self.activityFSM.state != 'Active': return toon = self.getAvatar(toonId) - if not self.toonIdsToIsPullingFlags.has_key(toonId): + if toonId not in self.toonIdsToIsPullingFlags: if self.getTeam(toonId) == None: self.notify.warning("setAnimState called with toonId (%d) that wasn't in self.toonIds" % toonId) return @@ -671,7 +671,7 @@ class DistributedPartyTugOfWarActivity(DistributedPartyTeamActivity): if fallenPosIndex < 0 or fallenPosIndex >= 4: fallenPosIndex = 0 newPos = self.fallenPositions[fallenPosIndex] - if self.toonIdsToAnimIntervals.has_key(toonId) and self.toonIdsToAnimIntervals[toonId] is not None: + if toonId in self.toonIdsToAnimIntervals and self.toonIdsToAnimIntervals[toonId] is not None: if self.toonIdsToAnimIntervals[toonId].isPlaying(): self.toonIdsToAnimIntervals[toonId].finish() if toon: diff --git a/toontown/parties/DistributedPartyValentineDance20Activity.py b/toontown/parties/DistributedPartyValentineDance20Activity.py index 47399e1..7b5db74 100644 --- a/toontown/parties/DistributedPartyValentineDance20Activity.py +++ b/toontown/parties/DistributedPartyValentineDance20Activity.py @@ -20,7 +20,7 @@ class DistributedPartyValentineDance20Activity(DistributedPartyDanceActivityBase correctBall = self.danceFloor.find('**/discoBall_20') if not correctBall.isEmpty(): numChildren = parentGroup.getNumChildren() - for i in xrange(numChildren): + for i in range(numChildren): child = parentGroup.getChild(i) if child != correctBall: child.hide() diff --git a/toontown/parties/DistributedPartyValentineDanceActivity.py b/toontown/parties/DistributedPartyValentineDanceActivity.py index d61d5e4..7652d1f 100644 --- a/toontown/parties/DistributedPartyValentineDanceActivity.py +++ b/toontown/parties/DistributedPartyValentineDanceActivity.py @@ -21,7 +21,7 @@ class DistributedPartyValentineDanceActivity(DistributedPartyDanceActivityBase): origBall = self.danceFloor.find('**/discoBall_mesh_orig') if not correctBall.isEmpty(): numChildren = parentGroup.getNumChildren() - for i in xrange(numChildren): + for i in range(numChildren): child = parentGroup.getChild(i) if child != correctBall: child.hide() diff --git a/toontown/parties/DistributedPartyWinterCatchActivity.py b/toontown/parties/DistributedPartyWinterCatchActivity.py index 5ba2ab0..9089012 100644 --- a/toontown/parties/DistributedPartyWinterCatchActivity.py +++ b/toontown/parties/DistributedPartyWinterCatchActivity.py @@ -30,17 +30,17 @@ class DistributedPartyWinterCatchActivity(DistributedPartyCatchActivity): return def handleToonJoined(self, toonId): - if not self.toonSDs.has_key(toonId): + if toonId not in self.toonSDs: toonSD = WinterPartyCatchActivityToonSD.WinterPartyCatchActivityToonSD(toonId, self) self.toonSDs[toonId] = toonSD toonSD.load() self.notify.debug('handleToonJoined : currentState = %s' % self.activityFSM.state) self.cr.doId2do[toonId].useLOD(500) if self.activityFSM.state == 'Active': - if self.toonSDs.has_key(toonId): + if toonId in self.toonSDs: self.toonSDs[toonId].enter() if base.localAvatar.doId == toonId: base.localAvatar.b_setParent(self._avatarNodePathParentToken) self.putLocalAvatarInActivity() - if self.toonSDs.has_key(toonId): + if toonId in self.toonSDs: self.toonSDs[toonId].fsm.request('rules') diff --git a/toontown/parties/JukeboxGui.py b/toontown/parties/JukeboxGui.py index 028720a..2d24650 100644 --- a/toontown/parties/JukeboxGui.py +++ b/toontown/parties/JukeboxGui.py @@ -56,13 +56,13 @@ class JukeboxGui(DirectObject): self.load() phase = 13 tunes = self.phaseToMusicData[13] - for filename, info in tunes.items(): + for filename, info in list(tunes.items()): self.addToSongList(info[0], phase, filename, info[1]) - for phase, tunes in self.phaseToMusicData.items(): + for phase, tunes in list(self.phaseToMusicData.items()): if phase == 13: continue - for filename, info in tunes.items(): + for filename, info in list(tunes.items()): self.addToSongList(info[0], phase, filename, info[1]) self._windowFrame.show() diff --git a/toontown/parties/KeyCodes.py b/toontown/parties/KeyCodes.py index c18ffba..977654c 100644 --- a/toontown/parties/KeyCodes.py +++ b/toontown/parties/KeyCodes.py @@ -80,7 +80,7 @@ class KeyCodes(DirectObject): return def __enableControls(self): - for key in self._keyMap.keys(): + for key in list(self._keyMap.keys()): self.__acceptKeyDown(key) self.__acceptKeyUp(key) diff --git a/toontown/parties/Party.py b/toontown/parties/Party.py index edef0fc..697ba8a 100644 --- a/toontown/parties/Party.py +++ b/toontown/parties/Party.py @@ -204,7 +204,7 @@ class Party(Place.Place): def __setPartyHat(self, doId = None): if hasattr(base, 'distributedParty'): - if base.cr.doId2do.has_key(base.distributedParty.partyInfo.hostId): + if base.distributedParty.partyInfo.hostId in base.cr.doId2do: host = base.cr.doId2do[base.distributedParty.partyInfo.hostId] if hasattr(host, 'gmIcon') and host.gmIcon: host.removeGMIcon() @@ -214,7 +214,7 @@ class Party(Place.Place): def __removePartyHat(self): if hasattr(base, 'distributedParty'): - if base.cr.doId2do.has_key(base.distributedParty.partyInfo.hostId): + if base.distributedParty.partyInfo.hostId in base.cr.doId2do: host = base.cr.doId2do[base.distributedParty.partyInfo.hostId] if hasattr(host, 'gmIcon') and host.gmIcon: host.removeGMIcon() diff --git a/toontown/parties/PartyCog.py b/toontown/parties/PartyCog.py index 97da98a..7907ff5 100644 --- a/toontown/parties/PartyCog.py +++ b/toontown/parties/PartyCog.py @@ -13,7 +13,7 @@ from pandac.PandaModules import Point3, Vec4, NodePath, TextNode, Mat4 from toontown.toonbase import ToontownGlobals from toontown.battle.BattleProps import globalPropPool from toontown.battle.BattleSounds import globalBattleSoundCache -import PartyGlobals +from . import PartyGlobals class PartyCogManager: diff --git a/toontown/parties/PartyCogActivity.py b/toontown/parties/PartyCogActivity.py index 65375fc..247284d 100644 --- a/toontown/parties/PartyCogActivity.py +++ b/toontown/parties/PartyCogActivity.py @@ -11,12 +11,12 @@ from pandac.PandaModules import CollisionSphere, CollisionNode, CollisionHandler from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.toonbase.ToontownTimer import ToontownTimer -import PartyGlobals -import PartyCogUtils -from PartyCog import PartyCogManager -from PartyCogActivityPlayer import PartyCogActivityPlayer -from PartyCogActivityPlayer import PartyCogActivityLocalPlayer -from StretchingArrow import StretchingArrow +from . import PartyGlobals +from . import PartyCogUtils +from .PartyCog import PartyCogManager +from .PartyCogActivityPlayer import PartyCogActivityPlayer +from .PartyCogActivityPlayer import PartyCogActivityLocalPlayer +from .StretchingArrow import StretchingArrow class PartyCogActivity(DirectObject): notify = directNotify.newCategory('PartyCogActivity') @@ -202,7 +202,7 @@ class PartyCogActivity(DirectObject): self.distanceLabels = None if len(self.players): - for player in self.players.values(): + for player in list(self.players.values()): player.disable() player.destroy() @@ -219,11 +219,11 @@ class PartyCogActivity(DirectObject): self._destroyArenaDoors() self.arena.removeNode() self.arena = None - for ival in self.toonPieTracks.values(): + for ival in list(self.toonPieTracks.values()): if ival is not None and ival.isPlaying(): try: ival.finish() - except Exception, theException: + except Exception as theException: self.notify.warning('Ival could not finish:\n %s \nException %s ' % (str(ival), str(theException))) self.toonPieTracks = {} @@ -231,12 +231,12 @@ class PartyCogActivity(DirectObject): if ival is not None and ival.isPlaying(): try: ival.finish() - except Exception, theException: + except Exception as theException: self.notify.warning('Ival could not finish:\n %s \nException %s ' % (str(ival), str(theException))) self.pieIvals = [] self.toonIdsToAnimIntervals = {} - for eventName in self.toonPieEventNames.values(): + for eventName in list(self.toonPieEventNames.values()): self.ignore(eventName) self.toonPieEventNames = {} @@ -370,7 +370,7 @@ class PartyCogActivity(DirectObject): def handleToonShifted(self, toon): toonId = toon.doId - if self.players.has_key(toonId): + if toonId in self.players: player = self.players[toonId] spot = self.activity.getIndex(toonId, player.team) pos = self.getPlayerStartPos(player.team, spot) @@ -423,7 +423,7 @@ class PartyCogActivity(DirectObject): if self.player is not None: self.player.resetScore() self.hideTeamFlags(self.player.team) - for player in self.players.values(): + for player in list(self.players.values()): self.finishToonIval(player.toon.doId) player.enable() @@ -438,10 +438,10 @@ class PartyCogActivity(DirectObject): return def stopActivity(self): - for player in self.players.values(): + for player in list(self.players.values()): player.disable() - for eventName in self.toonPieEventNames.values(): + for eventName in list(self.toonPieEventNames.values()): self.ignore(eventName) self.toonPieEventNames.clear() diff --git a/toontown/parties/PartyCogActivityGui.py b/toontown/parties/PartyCogActivityGui.py index bf719f0..74d1af9 100644 --- a/toontown/parties/PartyCogActivityGui.py +++ b/toontown/parties/PartyCogActivityGui.py @@ -9,7 +9,7 @@ from pandac.PandaModules import TextNode from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownIntervals from toontown.toonbase import TTLocalizer -import PartyGlobals +from . import PartyGlobals class PartyCogTrackerGui: diff --git a/toontown/parties/PartyCogActivityPlayer.py b/toontown/parties/PartyCogActivityPlayer.py index 483b587..3a60bd3 100644 --- a/toontown/parties/PartyCogActivityPlayer.py +++ b/toontown/parties/PartyCogActivityPlayer.py @@ -11,11 +11,11 @@ from toontown.minigame.OrthoDrive import OrthoDrive from toontown.minigame.OrthoWalk import OrthoWalk from toontown.battle.BattleProps import globalPropPool from toontown.battle.BattleSounds import globalBattleSoundCache -import PartyGlobals -from PartyCogActivityInput import PartyCogActivityInput -from PartyCogActivityGui import PartyCogActivityGui -from PartyCogUtils import CameraManager -from PartyCogUtils import StrafingControl +from . import PartyGlobals +from .PartyCogActivityInput import PartyCogActivityInput +from .PartyCogActivityGui import PartyCogActivityGui +from .PartyCogUtils import CameraManager +from .PartyCogUtils import StrafingControl UPDATE_TASK_NAME = 'PartyCogActivityLocalPlayer_UpdateTask' THROW_PIE_LIMIT_TIME = 0.2 diff --git a/toontown/parties/PartyCogUtils.py b/toontown/parties/PartyCogUtils.py index f847601..752a523 100644 --- a/toontown/parties/PartyCogUtils.py +++ b/toontown/parties/PartyCogUtils.py @@ -1,6 +1,6 @@ import math from pandac.PandaModules import NodePath, Point3 -import PartyGlobals +from . import PartyGlobals inverse_e = 1.0 / math.e def getCogDistanceUnitsFromCenter(distance): diff --git a/toontown/parties/PartyGlobals.py b/toontown/parties/PartyGlobals.py index 57b1b78..4ab0b96 100644 --- a/toontown/parties/PartyGlobals.py +++ b/toontown/parties/PartyGlobals.py @@ -643,7 +643,7 @@ for type in DropObjectTypes: Name2DropObjectType[type.name] = type Name2DOTypeId = {} -names = Name2DropObjectType.keys() +names = list(Name2DropObjectType.keys()) names.sort() for i in range(len(names)): Name2DOTypeId[names[i]] = i @@ -804,12 +804,12 @@ def countMusic(): for key in PhaseToMusicData: numMusic += len(PhaseToMusicData[key]) - print 'PhaseToMusicData %d' % numMusic + print('PhaseToMusicData %d' % numMusic) numMusic = 0 for key in PhaseToMusicData40: numMusic += len(PhaseToMusicData40[key]) - print 'PhaseToMusicData40 %d' % numMusic + print('PhaseToMusicData40 %d' % numMusic) def getMusicRepeatTimes(length, minLength = MUSIC_MIN_LENGTH_SECONDS): diff --git a/toontown/parties/PartyLoader.py b/toontown/parties/PartyLoader.py index c6bcf65..a752862 100644 --- a/toontown/parties/PartyLoader.py +++ b/toontown/parties/PartyLoader.py @@ -43,8 +43,8 @@ class PartyLoader(SafeZoneLoader.SafeZoneLoader): self.underwaterSound = base.loader.loadSfx('phase_4/audio/sfx/AV_ambient_water.mp3') self.swimSound = base.loader.loadSfx('phase_4/audio/sfx/AV_swim_single_stroke.mp3') self.submergeSound = base.loader.loadSfx('phase_5.5/audio/sfx/AV_jump_in_water.mp3') - self.birdSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) - self.cricketSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) + self.birdSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) + self.cricketSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) def unload(self): self.ignoreAll() @@ -206,15 +206,15 @@ class PartyLoader(SafeZoneLoader.SafeZoneLoader): return track def debugGeom(self, decomposed): - print 'numPrimitives = %d' % decomposed.getNumPrimitives() + print('numPrimitives = %d' % decomposed.getNumPrimitives()) for primIndex in range(decomposed.getNumPrimitives()): prim = decomposed.getPrimitive(primIndex) - print 'prim = %s' % prim - print 'isIndexed = %d' % prim.isIndexed() - print 'prim.getNumPrimitives = %d' % prim.getNumPrimitives() + print('prim = %s' % prim) + print('isIndexed = %d' % prim.isIndexed()) + print('prim.getNumPrimitives = %d' % prim.getNumPrimitives()) for basicPrim in range(prim.getNumPrimitives()): - print '%d start=%d' % (basicPrim, prim.getPrimitiveStart(basicPrim)) - print '%d end=%d' % (basicPrim, prim.getPrimitiveEnd(basicPrim)) + print('%d start=%d' % (basicPrim, prim.getPrimitiveStart(basicPrim))) + print('%d end=%d' % (basicPrim, prim.getPrimitiveEnd(basicPrim))) def loadCloud(self, version, radius, zOffset): self.notify.debug('loadOnePlatform version=%d' % version) diff --git a/toontown/parties/PartyPlanner.py b/toontown/parties/PartyPlanner.py index d943fab..9c75524 100644 --- a/toontown/parties/PartyPlanner.py +++ b/toontown/parties/PartyPlanner.py @@ -580,7 +580,7 @@ class PartyPlanner(DirectFrame, FSM): return page def __handleHolidays(self): - self.inviteThemes = range(len(PartyGlobals.InviteTheme)) + self.inviteThemes = list(range(len(PartyGlobals.InviteTheme))) if hasattr(base.cr, 'newsManager') and base.cr.newsManager: holidayIds = base.cr.newsManager.getHolidayIdList() if ToontownGlobals.VALENTINES_DAY not in holidayIds: diff --git a/toontown/parties/WinterPartyCatchActivityToonSD.py b/toontown/parties/WinterPartyCatchActivityToonSD.py index b50f085..e0e2aa7 100644 --- a/toontown/parties/WinterPartyCatchActivityToonSD.py +++ b/toontown/parties/WinterPartyCatchActivityToonSD.py @@ -1,4 +1,4 @@ -import PartyCatchActivityToonSD +from . import PartyCatchActivityToonSD from pandac.PandaModules import Vec4 from direct.directnotify import DirectNotifyGlobal from direct.interval.IntervalGlobal import Sequence, Parallel, Wait, Func diff --git a/toontown/parties/activityFSMMixins.py b/toontown/parties/activityFSMMixins.py index f9ce286..44b2949 100644 --- a/toontown/parties/activityFSMMixins.py +++ b/toontown/parties/activityFSMMixins.py @@ -1,4 +1,4 @@ -from BaseActivityFSM import BaseActivityFSM +from .BaseActivityFSM import BaseActivityFSM class IdleMixin: diff --git a/toontown/parties/activityFSMs.py b/toontown/parties/activityFSMs.py index a90e953..94027e2 100644 --- a/toontown/parties/activityFSMs.py +++ b/toontown/parties/activityFSMs.py @@ -1,14 +1,14 @@ from direct.directnotify import DirectNotifyGlobal -from BaseActivityFSM import BaseActivityFSM -from activityFSMMixins import IdleMixin -from activityFSMMixins import RulesMixin -from activityFSMMixins import ActiveMixin -from activityFSMMixins import DisabledMixin -from activityFSMMixins import ConclusionMixin -from activityFSMMixins import WaitForEnoughMixin -from activityFSMMixins import WaitToStartMixin -from activityFSMMixins import WaitClientsReadyMixin -from activityFSMMixins import WaitForServerMixin +from .BaseActivityFSM import BaseActivityFSM +from .activityFSMMixins import IdleMixin +from .activityFSMMixins import RulesMixin +from .activityFSMMixins import ActiveMixin +from .activityFSMMixins import DisabledMixin +from .activityFSMMixins import ConclusionMixin +from .activityFSMMixins import WaitForEnoughMixin +from .activityFSMMixins import WaitToStartMixin +from .activityFSMMixins import WaitClientsReadyMixin +from .activityFSMMixins import WaitForServerMixin class FireworksActivityFSM(BaseActivityFSM, IdleMixin, ActiveMixin, DisabledMixin): notify = DirectNotifyGlobal.directNotify.newCategory('FireworksActivityFSM') diff --git a/toontown/pets/DistributedPet.py b/toontown/pets/DistributedPet.py index 138a52a..5af2ccb 100644 --- a/toontown/pets/DistributedPet.py +++ b/toontown/pets/DistributedPet.py @@ -108,7 +108,7 @@ class DistributedPet(DistributedSmoothNode.DistributedSmoothNode, Pet.Pet, PetBa self.safeZone = safeZone def __generateDistTraitFuncs(self): - for i in xrange(PetTraits.PetTraits.NumTraits): + for i in range(PetTraits.PetTraits.NumTraits): traitName = PetTraits.getTraitNames()[i] setterName = self.getSetterName(traitName) @@ -207,7 +207,7 @@ class DistributedPet(DistributedSmoothNode.DistributedSmoothNode, Pet.Pet, PetBa Pet.Pet.setName(self, self.petName) self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone) self.mood = PetMood.PetMood(self) - for mood, value in self.requiredMoodComponents.items(): + for mood, value in list(self.requiredMoodComponents.items()): self.mood.setComponent(mood, value, announce=0) self.requiredMoodComponents = {} @@ -468,15 +468,15 @@ class DistributedPet(DistributedSmoothNode.DistributedSmoothNode, Pet.Pet, PetBa try: self.movieTrack = Sequence(Func(self._petMovieStart, av), Parallel(av.getCallPetIval(), Sequence(Wait(0.54), SoundInterval(self.callSfx))), self._getPetMovieCompleteIval(av)) self.movieTrack.start() - except StandardError, error: - print str(error) + except Exception as error: + print(str(error)) if mode == PetConstants.PET_MOVIE_SCRATCH: try: self.movieTrack = Sequence(Func(self._petMovieStart, av), Func(self.holdPetDownForMovie), Parallel(self.getInteractIval(self.Interactions.SCRATCH), av.getScratchPetIval(), SoundInterval(self.petSfx)), Func(self.releasePetFromHoldDown), self._getPetMovieCompleteIval(av)) self.movieTrack.start() - except StandardError, error: - print str(error) + except Exception as error: + print(str(error)) if mode == PetConstants.PET_MOVIE_FEED: self.bean = loader.loadModel('phase_4/models/props/jellybean4') diff --git a/toontown/pets/DistributedPetAI.py b/toontown/pets/DistributedPetAI.py index 14b7361..8b6cc22 100644 --- a/toontown/pets/DistributedPetAI.py +++ b/toontown/pets/DistributedPetAI.py @@ -141,7 +141,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke else: self.inEstate = 0 self.estateZones = [] - PetObserve.send(broadcastZones.keys(), PetObserve.PetActionObserve(PetObserve.Actions.CHANGE_ZONE, self.doId, (oldZoneId, newZoneId))) + PetObserve.send(list(broadcastZones.keys()), PetObserve.PetActionObserve(PetObserve.Actions.CHANGE_ZONE, self.doId, (oldZoneId, newZoneId))) def getOwnerId(self): return self.ownerId @@ -214,7 +214,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke self.traitList = traitList def __generateDistTraitFuncs(self): - for i in xrange(PetTraits.PetTraits.NumTraits): + for i in range(PetTraits.PetTraits.NumTraits): traitName = PetTraits.getTraitNames()[i] getterName = self.getSetterName(traitName, 'get') b_setterName = self.getSetterName(traitName, 'b_set') @@ -490,7 +490,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke self.scratchLogger = ServerEventBuffer.ServerEventAccumulator(self.air, 'petScratchings', self.doId) self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone) if not hasattr(self, '_beingCreatedInDB'): - for i in xrange(len(self.traitList)): + for i in range(len(self.traitList)): value = self.traitList[i] if value == 0.0: traitName = PetTraits.getTraitNames()[i] @@ -512,7 +512,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke self.setH(randFloat(360)) if self.initialDNA: self.setDNA(self.initialDNA) - for mood, value in self.requiredMoodComponents.items(): + for mood, value in list(self.requiredMoodComponents.items()): self.mood.setComponent(mood, value, announce=0) self.requiredMoodComponents = {} @@ -734,11 +734,11 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke self.setMoodComponent(component, lerp(curVal, 1.0, factor)) def addToMoods(self, mood2delta): - for mood, delta in mood2delta.items(): + for mood, delta in list(mood2delta.items()): self.addToMood(mood, delta) def lerpMoods(self, mood2factor): - for mood, factor in mood2factor.items(): + for mood, factor in list(mood2factor.items()): self.lerpMood(mood, factor) def handleMoodChange(self, components = [], distribute = 1): @@ -898,25 +898,25 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke nearbyToonDict = self._getFullNearbyToonDict() if not len(nearbyToonDict): return None - return nearbyToonDict[random.choice(nearbyToonDict.keys())] + return nearbyToonDict[random.choice(list(nearbyToonDict.keys()))] def _getNearbyToonNonOwner(self): nearbyToonDict = self._getNearbyToonDict() if not len(nearbyToonDict): return None - return nearbyToonDict[random.choice(nearbyToonDict.keys())] + return nearbyToonDict[random.choice(list(nearbyToonDict.keys()))] def _getNearbyPet(self): nearbyPetDict = self._getNearbyPetDict() if not len(nearbyPetDict): return None - return nearbyPetDict[random.choice(nearbyPetDict.keys())] + return nearbyPetDict[random.choice(list(nearbyPetDict.keys()))] def _getNearbyAvatar(self): nearbyAvDict = self._getNearbyAvatarDict() if not len(nearbyAvDict): return None - return nearbyAvDict[random.choice(nearbyAvDict.keys())] + return nearbyAvDict[random.choice(list(nearbyAvDict.keys()))] def isBusy(self): return self.busy > 0 @@ -1005,7 +1005,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke return sum / 3.0 def __lockPetMoveTask(self, avId): - if not hasattr(self, 'air') or not self.air.doId2do.has_key(avId): + if not hasattr(self, 'air') or avId not in self.air.doId2do: self.notify.warning('avId: %s gone or self deleted!' % avId) return Task.done av = self.air.doId2do.get(avId) @@ -1013,7 +1013,7 @@ class DistributedPetAI(DistributedSmoothNodeAI.DistributedSmoothNodeAI, PetLooke self.distList.append(dist) if len(self.distList) > 3: self.distList.pop(0) - if self.movieDistSwitch.has_key(self.movieMode): + if self.movieMode in self.movieDistSwitch: dist_Callable = self.movieDistSwitch.get(self.movieMode) movieDist = dist_Callable(av.getStyle().getLegSize()) else: diff --git a/toontown/pets/DistributedPetProxy.py b/toontown/pets/DistributedPetProxy.py index 0e5a693..97c9e4c 100644 --- a/toontown/pets/DistributedPetProxy.py +++ b/toontown/pets/DistributedPetProxy.py @@ -43,7 +43,7 @@ class DistributedPetProxy(DistributedObject.DistributedObject): self.safeZone = safeZone def __generateDistTraitFuncs(self): - for i in xrange(PetTraits.PetTraits.NumTraits): + for i in range(PetTraits.PetTraits.NumTraits): traitName = PetTraits.getTraitNames()[i] setterName = self.getSetterName(traitName) @@ -133,10 +133,10 @@ class DistributedPetProxy(DistributedObject.DistributedObject): def announceGenerate(self): DistributedObject.DistributedObject.announceGenerate(self) self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone) - print self.traits.traits + print(self.traits.traits) self.mood = PetMood.PetMood(self) self.lastKnownMood = self.mood.makeCopy() - for mood, value in self.requiredMoodComponents.items(): + for mood, value in list(self.requiredMoodComponents.items()): self.mood.setComponent(mood, value, announce=0) self.requiredMoodComponents = {} diff --git a/toontown/pets/DistributedPetProxyAI.py b/toontown/pets/DistributedPetProxyAI.py index 0e9f998..156eef1 100644 --- a/toontown/pets/DistributedPetProxyAI.py +++ b/toontown/pets/DistributedPetProxyAI.py @@ -107,7 +107,7 @@ class DistributedPetProxyAI(DistributedObjectAI.DistributedObjectAI): self.traitList = traitList def __generateDistTraitFuncs(self): - for i in xrange(PetTraits.PetTraits.NumTraits): + for i in range(PetTraits.PetTraits.NumTraits): traitName = PetTraits.getTraitNames()[i] getterName = self.getSetterName(traitName, 'get') b_setterName = self.getSetterName(traitName, 'b_set') @@ -357,8 +357,8 @@ class DistributedPetProxyAI(DistributedObjectAI.DistributedObjectAI): def generate(self): DistributedObjectAI.DistributedObjectAI.generate(self) self.traits = PetTraits.PetTraits(self.traitSeed, self.safeZone) - print self.traits.traits - for i in xrange(len(self.traitList)): + print(self.traits.traits) + for i in range(len(self.traitList)): value = self.traitList[i] if value == 0.0: traitName = PetTraits.getTraitNames()[i] @@ -371,7 +371,7 @@ class DistributedPetProxyAI(DistributedObjectAI.DistributedObjectAI): self.__dict__[setterName](traitValue) self.mood = PetMood.PetMood(self) - for mood, value in self.requiredMoodComponents.items(): + for mood, value in list(self.requiredMoodComponents.items()): self.mood.setComponent(mood, value, announce=0) self.requiredMoodComponents = {} @@ -408,11 +408,11 @@ class DistributedPetProxyAI(DistributedObjectAI.DistributedObjectAI): self.setMoodComponent(component, lerp(curVal, 1.0, factor)) def addToMoods(self, mood2delta): - for mood, delta in mood2delta.items(): + for mood, delta in list(mood2delta.items()): self.addToMood(mood, delta) def lerpMoods(self, mood2factor): - for mood, factor in mood2factor.items(): + for mood, factor in list(mood2factor.items()): self.lerpMood(mood, factor) def isContented(self): diff --git a/toontown/pets/Pet.py b/toontown/pets/Pet.py index 1c0acc3..c8170fd 100644 --- a/toontown/pets/Pet.py +++ b/toontown/pets/Pet.py @@ -8,7 +8,7 @@ from otp.avatar import Avatar from direct.actor import Actor from direct.task import Task from toontown.pets import PetDNA -from PetDNA import HeadParts, EarParts, NoseParts, TailParts, BodyTypes, BodyTextures, AllPetColors, getColors, ColorScales, PetEyeColors, EarTextures, TailTextures, getFootTexture, getEarTexture, GiraffeTail, LeopardTail, PetGenders +from .PetDNA import HeadParts, EarParts, NoseParts, TailParts, BodyTypes, BodyTextures, AllPetColors, getColors, ColorScales, PetEyeColors, EarTextures, TailTextures, getFootTexture, getEarTexture, GiraffeTail, LeopardTail, PetGenders from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from direct.showbase import PythonUtil @@ -417,7 +417,7 @@ class Pet(Avatar.Avatar): def enterNeutral(self): anim = 'neutral' - self.pose(anim, random.choice(range(0, self.getNumFrames(anim)))) + self.pose(anim, random.choice(list(range(0, self.getNumFrames(anim))))) self.loop(anim, restart=0) def exitNeutral(self): @@ -425,7 +425,7 @@ class Pet(Avatar.Avatar): def enterNeutralHappy(self): anim = 'neutralHappy' - self.pose(anim, random.choice(range(0, self.getNumFrames(anim)))) + self.pose(anim, random.choice(list(range(0, self.getNumFrames(anim))))) self.loop(anim, restart=0) def exitNeutralHappy(self): @@ -433,7 +433,7 @@ class Pet(Avatar.Avatar): def enterNeutralSad(self): anim = 'neutralSad' - self.pose(anim, random.choice(range(0, self.getNumFrames(anim)))) + self.pose(anim, random.choice(list(range(0, self.getNumFrames(anim))))) self.loop(anim, restart=0) def exitNeutralSad(self): @@ -633,7 +633,7 @@ class Pet(Avatar.Avatar): def getInteractIval(self, interactId): anims = self.InteractAnims[interactId] - if type(anims) == types.StringType: + if type(anims) == bytes: animIval = ActorInterval(self, anims) else: animIval = Sequence() @@ -652,15 +652,15 @@ def gridPets(): colors = getColors(body) for color in colors: p = Pet() - p.setDNA([random.choice(range(-1, len(HeadParts))), - random.choice(range(-1, len(EarParts))), - random.choice(range(-1, len(NoseParts))), - random.choice(range(-1, len(TailParts))), + p.setDNA([random.choice(list(range(-1, len(HeadParts)))), + random.choice(list(range(-1, len(EarParts)))), + random.choice(list(range(-1, len(NoseParts)))), + random.choice(list(range(-1, len(TailParts)))), body, color, - random.choice(range(-1, len(ColorScales))), - random.choice(range(0, len(PetEyeColors))), - random.choice(range(0, len(PetGenders)))]) + random.choice(list(range(-1, len(ColorScales)))), + random.choice(list(range(0, len(PetEyeColors)))), + random.choice(list(range(0, len(PetGenders))))]) p.setPos(startPos[0] + offsetX, startPos[1] + offsetY, startPos[2]) p.animFSM.request('neutral') p.reparentTo(render) diff --git a/toontown/pets/PetBrain.py b/toontown/pets/PetBrain.py index 6c42e5e..6f938d9 100644 --- a/toontown/pets/PetBrain.py +++ b/toontown/pets/PetBrain.py @@ -47,8 +47,8 @@ class PetBrain(DirectObject.DirectObject, CPetBrain): del self.focus del self.pet if self.doId2goals: - self.notify.warning('destroy(): self.doId2goals is not empty: %s' % self.doId2goals.keys()) - for goalList in self.doId2goals.values(): + self.notify.warning('destroy(): self.doId2goals is not empty: %s' % list(self.doId2goals.keys())) + for goalList in list(self.doId2goals.values()): for goal in goalList: goal.destroy() @@ -135,7 +135,7 @@ class PetBrain(DirectObject.DirectObject, CPetBrain): self.pscAware.start() if len(self.nearbyAvs) > PetConstants.MaxAvatarAwareness: self.nextAwarenessIndex %= len(self.nearbyAvs) - self._considerBecomeAwareOf(self.nearbyAvs.keys()[self.nextAwarenessIndex]) + self._considerBecomeAwareOf(list(self.nearbyAvs.keys())[self.nextAwarenessIndex]) self.nextAwarenessIndex += 1 if __dev__: self.pscAware.stop() diff --git a/toontown/pets/PetCollider.py b/toontown/pets/PetCollider.py index 61e950f..7f8d1d8 100644 --- a/toontown/pets/PetCollider.py +++ b/toontown/pets/PetCollider.py @@ -61,7 +61,7 @@ class PetCollider(Impulse.Impulse): return 'petFeeler-%s' % self._getSerialNum() def handleCollision(self, collEntry): - print 'collision!' + print('collision!') cPoint = collEntry.getSurfacePoint(self.cLineNodePath) cNormal = collEntry.getSurfaceNormal(self.cLineNodePath) messenger.send(self.mover.getCollisionEventName(), [cPoint, cNormal]) diff --git a/toontown/pets/PetDCImports.py b/toontown/pets/PetDCImports.py index 09d5b9e..e4c3a90 100644 --- a/toontown/pets/PetDCImports.py +++ b/toontown/pets/PetDCImports.py @@ -1,2 +1,2 @@ if hasattr(base, 'wantPets') and base.wantPets: - import DistributedPet + from . import DistributedPet diff --git a/toontown/pets/PetDCImportsAI.py b/toontown/pets/PetDCImportsAI.py index fb2b5c8..a1e3633 100644 --- a/toontown/pets/PetDCImportsAI.py +++ b/toontown/pets/PetDCImportsAI.py @@ -1,2 +1,2 @@ if hasattr(simbase, 'wantPets') and simbase.wantPets: - import DistributedPetAI + from . import DistributedPetAI diff --git a/toontown/pets/PetDNA.py b/toontown/pets/PetDNA.py index 3395464..3de514e 100644 --- a/toontown/pets/PetDNA.py +++ b/toontown/pets/PetDNA.py @@ -181,15 +181,15 @@ PetGenders = [0, 1] def getRandomPetDNA(zoneId = ToontownGlobals.DonaldsDreamland): from random import choice - head = choice(range(-1, len(HeadParts))) - ears = choice(range(-1, len(EarParts))) - nose = choice(range(-1, len(NoseParts))) - tail = choice(range(-1, len(TailParts))) + head = choice(list(range(-1, len(HeadParts)))) + ears = choice(list(range(-1, len(EarParts)))) + nose = choice(list(range(-1, len(NoseParts)))) + tail = choice(list(range(-1, len(TailParts)))) body = getSpecies(zoneId) - color = choice(range(0, len(getColors(body)))) - colorScale = choice(range(0, len(ColorScales))) - eyes = choice(range(0, len(PetEyeColors))) - gender = choice(range(0, len(PetGenders))) + color = choice(list(range(0, len(getColors(body))))) + colorScale = choice(list(range(0, len(ColorScales)))) + eyes = choice(list(range(0, len(PetEyeColors)))) + gender = choice(list(range(0, len(PetGenders)))) return [head, ears, nose, @@ -240,7 +240,7 @@ def getBodyRarity(bodyIndex): for zoneId in PetRarities['body']: for body in PetRarities['body'][zoneId]: totalWeight += PetRarities['body'][zoneId][body] - if weight.has_key(body): + if body in weight: weight[body] += PetRarities['body'][zoneId][body] else: weight[body] = PetRarities['body'][zoneId][body] diff --git a/toontown/pets/PetDetailPanel.py b/toontown/pets/PetDetailPanel.py index 5e1b3c4..5077b9e 100644 --- a/toontown/pets/PetDetailPanel.py +++ b/toontown/pets/PetDetailPanel.py @@ -46,7 +46,7 @@ class PetDetailPanel(DirectFrame): def update(self, pet): if not pet: return - for trickId in PetTricks.TrickId2scIds.keys(): + for trickId in list(PetTricks.TrickId2scIds.keys()): trickText = TTLocalizer.PetTrickStrings[trickId] if trickId < len(pet.trickAptitudes): aptitude = pet.trickAptitudes[trickId] diff --git a/toontown/pets/PetGoalMgr.py b/toontown/pets/PetGoalMgr.py index cf1f275..7571082 100644 --- a/toontown/pets/PetGoalMgr.py +++ b/toontown/pets/PetGoalMgr.py @@ -25,7 +25,7 @@ class PetGoalMgr(DirectObject.DirectObject): del self.pscSetup del self.pscFindPrimary del self.pscSetPrimary - goals = self.goals.keys() + goals = list(self.goals.keys()) for goal in goals: self.removeGoal(goal) goal.destroy() diff --git a/toontown/pets/PetLookerAI.py b/toontown/pets/PetLookerAI.py index 6cbdd42..5ef86dc 100644 --- a/toontown/pets/PetLookerAI.py +++ b/toontown/pets/PetLookerAI.py @@ -32,7 +32,7 @@ class PetLookerAI: if self.__active: self.exitPetLook() if len(self.others): - PetLookerAI.notify.warning('%s: self.others not empty: %s' % (self.doId, self.others.keys())) + PetLookerAI.notify.warning('%s: self.others not empty: %s' % (self.doId, list(self.others.keys()))) self.others = {} def _getPetLookerBodyNode(self): @@ -47,7 +47,7 @@ class PetLookerAI: PetLookerAI.notify.warning('enterPetLook: %s already active!' % self.doId) return if len(self.others): - PetLookerAI.notify.warning('%s: len(self.others) != 0: %s' % (self.doId, self.others.keys())) + PetLookerAI.notify.warning('%s: len(self.others) != 0: %s' % (self.doId, list(self.others.keys()))) self.others = {} self.__active = 1 self.__collNode = self._getPetLookerBodyNode().attachNewNode('PetLookerCollNode') @@ -59,13 +59,13 @@ class PetLookerAI: PetLookerAI.notify.warning('exitPetLook: %s not active!' % self.doId) return if len(self.others): - otherIds = self.others.keys() + otherIds = list(self.others.keys()) PetLookerAI.notify.warning('%s: still in otherIds: %s' % (self.doId, otherIds)) for otherId in otherIds: self._handleLookingAtOtherStop(otherId) if len(self.others): - PetLookerAI.notify.warning('%s: self.others still not empty: %s' % (self.doId, self.others.keys())) + PetLookerAI.notify.warning('%s: self.others still not empty: %s' % (self.doId, list(self.others.keys()))) self.others = {} self._destroyPetLookSphere() self.__collNode.removeNode() diff --git a/toontown/pets/PetNameGenerator.py b/toontown/pets/PetNameGenerator.py index f496764..5d910ea 100644 --- a/toontown/pets/PetNameGenerator.py +++ b/toontown/pets/PetNameGenerator.py @@ -44,7 +44,7 @@ class PetNameGenerator: currentLine = input.readline() masterList = [self.boyFirsts, self.girlFirsts, self.neutralFirsts] - for tu in self.nameDictionary.values(): + for tu in list(self.nameDictionary.values()): masterList[tu[0]].append(tu[1]) return 1 @@ -60,7 +60,7 @@ class PetNameGenerator: newtu[0] = (0, name) newtu[1] = (1, name) newtu[2] = (2, name) - for tu in self.nameDictionary.items(): + for tu in list(self.nameDictionary.items()): for g in newtu: if tu[1] == g: return tu[0] diff --git a/toontown/pets/PetObserve.py b/toontown/pets/PetObserve.py index e502118..9373082 100644 --- a/toontown/pets/PetObserve.py +++ b/toontown/pets/PetObserve.py @@ -10,7 +10,7 @@ def getEventName(zoneId): def send(zoneIds, petObserve): if petObserve.isValid(): - if type(zoneIds) not in (types.ListType, types.TupleType): + if type(zoneIds) not in (list, tuple): zoneIds = [zoneIds] for zoneId in zoneIds: messenger.send(getEventName(zoneId), [petObserve]) diff --git a/toontown/pets/PetTraits.py b/toontown/pets/PetTraits.py index 538b1ec..413e71d 100644 --- a/toontown/pets/PetTraits.py +++ b/toontown/pets/PetTraits.py @@ -182,7 +182,7 @@ class PetTraits: self.safeZoneId = safeZoneId self.rng = random.Random(self.traitSeed) self.traits = {} - for i in xrange(len(PetTraits.TraitDescs)): + for i in range(len(PetTraits.TraitDescs)): if i < len(traitValueList) and traitValueList[i] > 0.0: trait = PetTraits.Trait(i, self, traitValueList[i]) else: @@ -191,7 +191,7 @@ class PetTraits: self.__dict__[trait.name] = trait.value extremeTraits = [] - for trait in self.traits.values(): + for trait in list(self.traits.values()): if not trait.hasWorth: continue if trait.quality == TraitDistribution.TraitQuality.AVERAGE: @@ -223,7 +223,7 @@ class PetTraits: def getOverallValue(self): total = 0 numUsed = 0 - for trait in self.traits.values(): + for trait in list(self.traits.values()): if trait.hasWorth: if trait.higherIsBetter: value = trait.value @@ -232,7 +232,7 @@ class PetTraits: total += value numUsed += 1 - value = total / len(self.traits.values()) + value = total / len(list(self.traits.values())) return value def getExtremeTraitDescriptions(self): diff --git a/toontown/pets/PetTricks.py b/toontown/pets/PetTricks.py index c1ae1fa..adff0df 100644 --- a/toontown/pets/PetTricks.py +++ b/toontown/pets/PetTricks.py @@ -62,7 +62,7 @@ TrickSounds = {Tricks.BACKFLIP: 'phase_5/audio/sfx/backflip.mp3', def getSoundIval(trickId): sounds = TrickSounds.get(trickId, None) if sounds: - if type(sounds) == types.StringType: + if type(sounds) == bytes: sound = loader.loadSfx(sounds) return SoundInterval(sound) else: @@ -79,7 +79,7 @@ def getTrickIval(pet, trickId): anims = TrickAnims[trickId] animRate = random.uniform(0.9, 1.1) waitTime = random.uniform(0.0, 1.0) - if type(anims) == types.StringType: + if type(anims) == bytes: if trickId == Tricks.JUMP: animIval = Parallel() animIval.append(ActorInterval(pet, anims, playRate=animRate)) diff --git a/toontown/quest/QuestBookPoster.py b/toontown/quest/QuestBookPoster.py index ea9bea1..52f5739 100644 --- a/toontown/quest/QuestBookPoster.py +++ b/toontown/quest/QuestBookPoster.py @@ -1,4 +1,4 @@ -from QuestPoster import * +from .QuestPoster import * IMAGE_SCALE_LARGE = 0.15 IMAGE_SCALE_SMALL = 0.1 POSTER_WIDTH = 0.7 diff --git a/toontown/quest/QuestChoiceGui.py b/toontown/quest/QuestChoiceGui.py index 635d1f7..fd3eac1 100644 --- a/toontown/quest/QuestChoiceGui.py +++ b/toontown/quest/QuestChoiceGui.py @@ -1,6 +1,6 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * -import QuestPoster +from . import QuestPoster from toontown.toonbase import ToontownTimer from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer @@ -44,7 +44,7 @@ class QuestChoiceGui(DirectFrame): self.timer.setPos(-0.2, 0, -0.6) elif len(quests) == 3 * 3: self['geom_scale'] = (1.85, 1, 0.9) - map(lambda x: x.setScale(0.95), self.questChoicePosters) + list(map(lambda x: x.setScale(0.95), self.questChoicePosters)) self.questChoicePosters[0].setPos(0, 0, -0.4) self.questChoicePosters[1].setPos(0, 0, 0.125) self.questChoicePosters[2].setPos(0, 0, 0.65) diff --git a/toontown/quest/QuestMap.py b/toontown/quest/QuestMap.py index 2ed98ee..68897af 100644 --- a/toontown/quest/QuestMap.py +++ b/toontown/quest/QuestMap.py @@ -7,7 +7,7 @@ from toontown.hood import ZoneUtil from toontown.toonbase import ToontownGlobals from toontown.quest import Quests from toontown.suit import SuitPlannerBase -import QuestMapGlobals +from . import QuestMapGlobals class QuestMap(DirectFrame): @@ -128,7 +128,7 @@ class QuestMap(DirectFrame): self.buildingMarkers = [] dnaStore = base.cr.playGame.dnaStore - for questIndex in self.av.questPage.quests.keys(): + for questIndex in list(self.av.questPage.quests.keys()): questDesc = self.av.questPage.quests.get(questIndex) if questDesc is None: continue diff --git a/toontown/quest/QuestParser.py b/toontown/quest/QuestParser.py index 3424db8..21be84e 100644 --- a/toontown/quest/QuestParser.py +++ b/toontown/quest/QuestParser.py @@ -6,7 +6,7 @@ from direct.interval.IntervalGlobal import * from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from direct.showbase import DirectObject -import BlinkingArrows +from . import BlinkingArrows from toontown.toon import ToonHeadFrame from toontown.char import CharDNA from toontown.suit import SuitDNA @@ -69,7 +69,7 @@ def readFile(filename): def getLineOfTokens(gen): tokens = [] nextNeg = 0 - token = gen.next() + token = next(gen) if token[0] == tokenize.ENDMARKER: return None while token[0] != tokenize.NEWLINE and token[0] != tokenize.NL: @@ -89,7 +89,7 @@ def getLineOfTokens(gen): tokens.append(token[1]) else: notify.warning('Ignored token type: %s on line: %s' % (tokenize.tok_name[token[0]], token[2][0])) - token = gen.next() + token = next(gen) return tokens @@ -105,7 +105,7 @@ def parseId(line): def questDefined(scriptId): - return lineDict.has_key(scriptId) + return scriptId in lineDict class NPCMoviePlayer(DirectObject.DirectObject): @@ -128,9 +128,9 @@ class NPCMoviePlayer(DirectObject.DirectObject): return def getVar(self, varName): - if self.privateVarDict.has_key(varName): + if varName in self.privateVarDict: return self.privateVarDict[varName] - elif globalVarDict.has_key(varName): + elif varName in globalVarDict: return globalVarDict[varName] elif varName.find('tomDialogue') > -1 or varName.find('harryDialogue') > -1: notify.warning('%s getting referenced. Tutorial Ack: %d Place: %s' % (varName, base.localAvatar.tutorialAck, base.cr.playGame.hood)) @@ -140,9 +140,9 @@ class NPCMoviePlayer(DirectObject.DirectObject): return None def delVar(self, varName): - if self.privateVarDict.has_key(varName): + if varName in self.privateVarDict: del self.privateVarDict[varName] - elif globalVarDict.has_key(varName): + elif varName in globalVarDict: del globalVarDict[varName] else: notify.warning('Variable not defined: %s' % varName) @@ -156,7 +156,7 @@ class NPCMoviePlayer(DirectObject.DirectObject): self.currentTrack = None self.ignoreAll() taskMgr.remove(self.uniqueId) - for toonHeadFrame in self.toonHeads.values(): + for toonHeadFrame in list(self.toonHeads.values()): toonHeadFrame.destroy() while self.chars: diff --git a/toontown/quest/QuestPoster.py b/toontown/quest/QuestPoster.py index 784192f..ff30cef 100644 --- a/toontown/quest/QuestPoster.py +++ b/toontown/quest/QuestPoster.py @@ -1,6 +1,6 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * -import Quests +from . import Quests from toontown.toon import NPCToons from toontown.toon import ToonHead from toontown.toon import ToonDNA @@ -322,7 +322,7 @@ class QuestPoster(DirectFrame): auxTextPos = Vec3(0, 0, 0.12) headlineString = quest.getHeadlineString() objectiveStrings = quest.getObjectiveStrings() - captions = map(string.capwords, quest.getObjectiveStrings()) + captions = list(map(string.capwords, quest.getObjectiveStrings())) imageColor = Vec4(*self.colors['white']) if quest.getType() == Quests.DeliverGagQuest or quest.getType() == Quests.DeliverItemQuest: frameBgColor = 'red' @@ -467,7 +467,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -500,7 +500,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -533,7 +533,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -566,7 +566,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogPartQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -599,7 +599,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -632,7 +632,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -665,7 +665,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -694,7 +694,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsRescueQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -752,7 +752,7 @@ class QuestPoster(DirectFrame): infoText = TTLocalizer.QuestPosterPlayground if not fComplete: captions = [TTLocalizer.QuestsMinigameNewbieQuestCaption % quest.getNewbieLevel()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsMinigameNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -806,7 +806,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) @@ -850,7 +850,7 @@ class QuestPoster(DirectFrame): if not fComplete: headlineString = TTLocalizer.QuestsNewbieQuestHeadline captions = [quest.getCaption()] - captions.append(map(string.capwords, quest.getObjectiveStrings())) + captions.append(list(map(string.capwords, quest.getObjectiveStrings()))) auxText = TTLocalizer.QuestsCogNewbieQuestAux lPos.setX(-0.18) self.laffMeter = self.createLaffMeter(quest.getNewbieLevel()) diff --git a/toontown/quest/QuestRewardCounter.py b/toontown/quest/QuestRewardCounter.py index ce6fd47..72d68b1 100644 --- a/toontown/quest/QuestRewardCounter.py +++ b/toontown/quest/QuestRewardCounter.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -import Quests +from . import Quests from toontown.toonbase import ToontownGlobals from toontown.fishing import FishGlobals from toontown.suit import SuitDNA diff --git a/toontown/quest/Quests.py b/toontown/quest/Quests.py index fa5fbea..7a842bb 100644 --- a/toontown/quest/Quests.py +++ b/toontown/quest/Quests.py @@ -146,9 +146,9 @@ def simulateRecoveryVar(numNeeded, baseChance, list = 0, cap = 1): else: currentFail += 1 - print 'Test results: %s tries, %s longest failure chain, %s cap hits' % (numTries, greatestFailChain, capHits) + print('Test results: %s tries, %s longest failure chain, %s cap hits' % (numTries, greatestFailChain, capHits)) if list: - print 'failures for each succes %s' % attemptList + print('failures for each succes %s' % attemptList) def simulateRecoveryFix(numNeeded, baseChance, list = 0): @@ -173,9 +173,9 @@ def simulateRecoveryFix(numNeeded, baseChance, list = 0): else: currentFail += 1 - print 'Test results: %s tries, %s longest failure chain' % (numTries, greatestFailChain) + print('Test results: %s tries, %s longest failure chain' % (numTries, greatestFailChain)) if list: - print 'failures for each succes %s' % attemptList + print('failures for each succes %s' % attemptList) class Quest: @@ -194,7 +194,7 @@ class Quest: pass def checkLocation(self, location): - locations = [Anywhere] + TTLocalizer.GlobalStreetNames.keys() + locations = [Anywhere] + list(TTLocalizer.GlobalStreetNames.keys()) self.check(location in locations, 'invalid location: %s' % location) def checkNumCogs(self, num): @@ -204,7 +204,7 @@ class Quest: self.check(1, 'invalid newbie level: %s' % level) def checkCogType(self, type): - types = [Any] + SuitBattleGlobals.SuitAttributes.keys() + types = [Any] + list(SuitBattleGlobals.SuitAttributes.keys()) self.check(type in types, 'invalid cog type: %s' % type) def checkCogTrack(self, track): @@ -268,13 +268,13 @@ class Quest: self.check(item >= ToontownBattleGlobals.MIN_LEVEL_INDEX and item <= ToontownBattleGlobals.MAX_LEVEL_INDEX, 'invalid gag item: %s' % item) def checkDeliveryItem(self, item): - self.check(ItemDict.has_key(item), 'invalid delivery item: %s' % item) + self.check(item in ItemDict, 'invalid delivery item: %s' % item) def checkNumItems(self, num): self.check(1, 'invalid num items: %s' % num) def checkRecoveryItem(self, item): - self.check(ItemDict.has_key(item), 'invalid recovery item: %s' % item) + self.check(item in ItemDict, 'invalid recovery item: %s' % item) def checkPercentChance(self, chance): self.check(chance > 0 and chance <= 100, 'invalid percent chance: %s' % chance) @@ -283,7 +283,7 @@ class Quest: holderTypes = ['type', 'level', 'track'] self.check(holderType in holderTypes, 'invalid recovery item holderType: %s' % holderType) if holderType == 'type': - holders = [Any, AnyFish] + SuitBattleGlobals.SuitAttributes.keys() + holders = [Any, AnyFish] + list(SuitBattleGlobals.SuitAttributes.keys()) self.check(holder in holders, 'invalid recovery item holder: %s for holderType: %s' % (holder, holderType)) elif holderType == 'level': pass @@ -1561,7 +1561,7 @@ class RecoverItemQuest(LocationBasedQuest): def testDone(self, progress): numberDone = progress & pow(2, 16) - 1 - print 'Quest number done %s' % numberDone + print('Quest number done %s' % numberDone) if numberDone >= self.getNumItems(): return 1 else: @@ -17670,10 +17670,10 @@ QuestDict = { TTLocalizer.QuestDialogDict[12032])} Tier2QuestsDict = {} -for questId, questDesc in QuestDict.items(): +for questId, questDesc in list(QuestDict.items()): if questDesc[QuestDictStartIndex] == Start: tier = questDesc[QuestDictTierIndex] - if Tier2QuestsDict.has_key(tier): + if tier in Tier2QuestsDict: Tier2QuestsDict[tier].append(questId) else: Tier2QuestsDict[tier] = [questId] @@ -17684,11 +17684,11 @@ Quest2RemainingStepsDict = {} def getAllRewardIdsForReward(rewardId): if rewardId is AnyCashbotSuitPart: - return range(4000, 4011 + 1) + return list(range(4000, 4011 + 1)) if rewardId is AnyLawbotSuitPart: - return range(4100, 4113 + 1) + return list(range(4100, 4113 + 1)) if rewardId is AnyBossbotSuitPart: - return range(4200, 4216 + 1) + return list(range(4200, 4216 + 1)) return (rewardId,) @@ -17700,7 +17700,7 @@ def findFinalRewardId(questId): try: questDesc = QuestDict[questId] except KeyError: - print 'findFinalRewardId: Quest ID: %d not found' % questId + print('findFinalRewardId: Quest ID: %d not found' % questId) return -1 nextQuestId = questDesc[QuestDictNextQuestIndex] @@ -17732,12 +17732,12 @@ def findFinalRewardId(questId): return (finalRewardId, remainingSteps) -for questId in QuestDict.keys(): +for questId in list(QuestDict.keys()): findFinalRewardId(questId) def getStartingQuests(tier = None): startingQuests = [] - for questId in QuestDict.keys(): + for questId in list(QuestDict.keys()): if isStartingQuest(questId): if tier is None: startingQuests.append(questId) @@ -17814,7 +17814,7 @@ def filterQuests(entireQuestPool, currentNpc, av): notify.debug('filterQuests: entireQuestPool: %s' % entireQuestPool) validQuestPool = dict([ (questId, 1) for questId in entireQuestPool ]) if isLoopingFinalTier(av.getRewardTier()): - history = map(lambda questDesc: questDesc[0], av.quests) + history = [questDesc[0] for questDesc in av.quests] else: history = av.getQuestHistory() if notify.getDebug(): @@ -17852,7 +17852,7 @@ def filterQuests(entireQuestPool, currentNpc, av): notify.debug('filterQuests: Removed %s because npc involved' % questId) break - finalQuestPool = filter(lambda key: validQuestPool[key], validQuestPool.keys()) + finalQuestPool = [key for key in list(validQuestPool.keys()) if validQuestPool[key]] if notify.getDebug(): notify.debug('filterQuests: finalQuestPool: %s' % finalQuestPool) return finalQuestPool @@ -17995,7 +17995,7 @@ def transformReward(baseRewardId, av): def chooseBestQuests(tier, currentNpc, av): if isLoopingFinalTier(tier): - rewardHistory = map(lambda questDesc: questDesc[3], av.quests) + rewardHistory = [questDesc[3] for questDesc in av.quests] else: rewardHistory = av.getRewardHistory()[1] seedRandomGen(currentNpc.getNpcId(), av.getDoId(), tier, rewardHistory) @@ -18045,7 +18045,7 @@ def chooseBestQuests(tier, currentNpc, av): def questExists(id): - return QuestDict.has_key(id) + return id in QuestDict def getQuest(id): @@ -18608,7 +18608,7 @@ def getNextRewards(numChoices, tier, av): if av.getGameAccess() == OTPGlobals.AccessFull and tier == TT_TIER + 3: optRewards = [] if isLoopingFinalTier(tier): - rewardHistory = map(lambda questDesc: questDesc[3], av.quests) + rewardHistory = [questDesc[3] for questDesc in av.quests] if notify.getDebug(): notify.debug('getNextRewards: current rewards (history): %s' % rewardHistory) else: @@ -19229,7 +19229,7 @@ def getNumRewardsInTier(tier): def rewardTierExists(tier): - return RequiredRewardTrackDict.has_key(tier) + return tier in RequiredRewardTrackDict def getOptionalRewardsInTier(tier): @@ -19694,7 +19694,7 @@ OptionalRewardTrackDict = {TT_TIER: (), 2971)} def isRewardOptional(tier, rewardId): - return OptionalRewardTrackDict.has_key(tier) and rewardId in OptionalRewardTrackDict[tier] + return tier in OptionalRewardTrackDict and rewardId in OptionalRewardTrackDict[tier] def getItemName(itemId): @@ -19808,7 +19808,7 @@ def avatarHasAllRequiredRewards(av, tier): def nextQuestList(nextQuest): if nextQuest == NA: return None - seqTypes = (types.ListType, types.TupleType) + seqTypes = (list, tuple) if type(nextQuest) in seqTypes: return nextQuest else: @@ -19821,12 +19821,12 @@ def checkReward(questId, forked = 0): reward = quest[5] nextQuests = nextQuestList(quest[6]) if nextQuests is None: - validRewards = RewardDict.keys() + [Any, + validRewards = list(RewardDict.keys()) + [Any, AnyCashbotSuitPart, AnyLawbotSuitPart, OBSOLETE] if reward is OBSOLETE: - print 'warning: quest %s is obsolete' % questId + print('warning: quest %s is obsolete' % questId) return reward else: forked = forked or len(nextQuests) > 1 @@ -19839,16 +19839,16 @@ def checkReward(questId, forked = 0): def assertAllQuestsValid(): - print 'checking quests...' - for questId in QuestDict.keys(): + print('checking quests...') + for questId in list(QuestDict.keys()): try: quest = getQuest(questId) - except AssertionError, e: + except AssertionError as e: err = 'invalid quest: %s' % questId - print err + print(err) raise - for questId in QuestDict.keys(): + for questId in list(QuestDict.keys()): quest = QuestDict[questId] tier, start, questDesc, fromNpc, toNpc, reward, nextQuest, dialog = quest if start: diff --git a/toontown/racing/DistributedGag.py b/toontown/racing/DistributedGag.py index 4d284a2..515af14 100644 --- a/toontown/racing/DistributedGag.py +++ b/toontown/racing/DistributedGag.py @@ -4,7 +4,7 @@ from direct.interval.ProjectileInterval import * from direct.interval.IntervalGlobal import * from direct.distributed.ClockDelta import * from toontown.racing.DistributedVehicle import DistributedVehicle -from DroppedGag import * +from .DroppedGag import * class DistributedGag(DistributedObject.DistributedObject): diff --git a/toontown/racing/DistributedLeaderBoard.py b/toontown/racing/DistributedLeaderBoard.py index 020df0f..aa72a4e 100644 --- a/toontown/racing/DistributedLeaderBoard.py +++ b/toontown/racing/DistributedLeaderBoard.py @@ -7,7 +7,7 @@ from toontown.toonbase.ToonBaseGlobal import * from pandac.PandaModules import * from toontown.toonbase.ToontownGlobals import * import random -import cPickle +import pickle class DistributedLeaderBoard(DistributedObject.DistributedObject): notify = DirectNotifyGlobal.directNotify.newCategory('DisributedLeaderBoard') @@ -52,7 +52,7 @@ class DistributedLeaderBoard(DistributedObject.DistributedObject): def setDisplay(self, pData): self.notify.debug('setDisplay: changing leaderboard text on local side') - trackName, recordTitle, scores = cPickle.loads(pData) + trackName, recordTitle, scores = pickle.loads(pData) self.display(trackName, recordTitle, scores) def buildListParts(self): diff --git a/toontown/racing/DistributedLeaderBoardAI.py b/toontown/racing/DistributedLeaderBoardAI.py index 9b4cb0c..206c2bc 100644 --- a/toontown/racing/DistributedLeaderBoardAI.py +++ b/toontown/racing/DistributedLeaderBoardAI.py @@ -1,4 +1,4 @@ -import cPickle +import pickle from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectAI import DistributedObjectAI @@ -45,4 +45,4 @@ class DistributedLeaderBoardAI(DistributedObjectAI): trackName = TTLocalizer.KartRace_TrackNames[self.subscriptions[self.currentIndex][0]] periodName = TTLocalizer.RecordPeriodStrings[self.subscriptions[self.currentIndex][1]] leaderList = self.records[self.subscriptions[self.currentIndex][0]][self.subscriptions[self.currentIndex][1]] - self.sendUpdate('setDisplay', [cPickle.dumps((trackName, periodName, leaderList))]) + self.sendUpdate('setDisplay', [pickle.dumps((trackName, periodName, leaderList))]) diff --git a/toontown/racing/DistributedRace.py b/toontown/racing/DistributedRace.py index 29801c3..d15ed74 100644 --- a/toontown/racing/DistributedRace.py +++ b/toontown/racing/DistributedRace.py @@ -8,7 +8,7 @@ from direct.showbase import BulletinBoardWatcher from direct.interval.IntervalGlobal import * from otp.otpbase import OTPGlobals from direct.interval.IntervalGlobal import * -from RaceGag import RaceGag +from .RaceGag import RaceGag from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toon import ToonHeadFrame from toontown.racing.KartDNA import InvalidEntry, getAccessory, getDefaultColor @@ -16,8 +16,8 @@ from pandac.PandaModules import CardMaker, OrthographicLens, LineSegs from direct.distributed import DistributedSmoothNode from math import fmod from math import sqrt -from RaceGUI import RaceGUI -import RaceGlobals +from .RaceGUI import RaceGUI +from . import RaceGlobals from direct.task.Task import Task from toontown.hood import SkyUtil from direct.fsm import ClassicFSM, State @@ -251,7 +251,7 @@ class DistributedRace(DistributedObject.DistributedObject): return def setCircuitPlace(self, avId, place, entryFee, winnings, bonus, trophies): - print 'setting cicruit place' + print('setting cicruit place') if self.fsm.getCurrentState().getName() == 'leaving': return if avId == localAvatar.doId: @@ -264,13 +264,13 @@ class DistributedRace(DistributedObject.DistributedObject): self.placeFixup.append([oldPlace - 1, place - 1]) avatar = base.cr.doId2do.get(avId, None) if avatar: - print 'circuit trophies %s' % trophies - print 'winnings %s' % winnings + print('circuit trophies %s' % trophies) + print('winnings %s' % winnings) self.gui.racerFinishedCircuit(avId, oldPlace, entryFee, winnings, bonus, trophies) return def endCircuitRace(self): - print self.placeFixup + print(self.placeFixup) self.gui.circuitFinished(self.placeFixup) def prepForRace(self): @@ -900,7 +900,7 @@ class DistributedRace(DistributedObject.DistributedObject): dict = self.innerBarricadeDict elif side == 'outersidest': dict = self.outerBarricadeDict - if dict.has_key(segmentInd): + if segmentInd in dict: self.currBldgGroups[side] = dict[segmentInd] for i in self.currBldgGroups[side]: self.buildingGroups[side][i].unstash() @@ -981,7 +981,7 @@ class DistributedRace(DistributedObject.DistributedObject): dict = self.outerBarricadeDict else: self.notify.error('unhandled side') - if dict.has_key(i): + if i in dict: if bldgGroupIndex not in dict[i]: dict[i].append(bldgGroupIndex) else: @@ -999,7 +999,7 @@ class DistributedRace(DistributedObject.DistributedObject): dict = self.outerBarricadeDict else: self.notify.error('unhandled side') - if dict.has_key(i): + if i in dict: if bldgGroupIndex not in dict[i]: dict[i].append(bldgGroupIndex) else: @@ -1193,7 +1193,7 @@ class DistributedRace(DistributedObject.DistributedObject): idStr = into.getTag('boostId') arrowVec = self.boostDir.get(idStr) if arrowVec == None: - print 'Unknown boost arrow %s' % idStr + print('Unknown boost arrow %s' % idStr) return fvec = self.localKart.forward.getPos(self.geom) - self.localKart.getPos(self.geom) fvec.normalize() diff --git a/toontown/racing/DistributedRaceAI.py b/toontown/racing/DistributedRaceAI.py index f24ee59..2af7280 100644 --- a/toontown/racing/DistributedRaceAI.py +++ b/toontown/racing/DistributedRaceAI.py @@ -2,7 +2,7 @@ from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from otp.otpbase.PythonUtil import nonRepeatingRandomList -import DistributedGagAI, DistributedProjectileAI +from . import DistributedGagAI, DistributedProjectileAI from direct.task import Task import random, time, Racer, RaceGlobals from direct.distributed.ClockDelta import * @@ -238,7 +238,7 @@ class DistributedRaceAI(DistributedObjectAI.DistributedObjectAI): self.kickSlowRacersTask = None if self.isDeleted(): return - for racer in self.racers.values(): + for racer in list(self.racers.values()): avId = racer.avId av = simbase.air.doId2do.get(avId, None) if av and not av.allowRaceTimeout: @@ -328,7 +328,7 @@ class DistributedRaceAI(DistributedObjectAI.DistributedObjectAI): def racerLeft(self, avIdFromClient): avId = self.air.getAvatarIdFromSender() - if self.racers.has_key(avId) and avId == avIdFromClient: + if avId in self.racers and avId == avIdFromClient: self.notify.debug('Removing %d from race %d' % (avId, self.doId)) racer = self.racers[avId] taskMgr.doMethodLater(10, self.removeObject, racer.kart.uniqueName('removeIt'), extraArgs=[racer.kart]) @@ -389,7 +389,7 @@ class DistributedRaceAI(DistributedObjectAI.DistributedObjectAI): taskMgr.remove('make %s invincible' % id) me.anvilTarget = True someoneIsClose = False - for racer in self.racers.values(): + for racer in list(self.racers.values()): if not racer.exited and not racer.finished: if me.lapT - racer.lapT < 0.15: someoneIsClose = True @@ -469,7 +469,7 @@ class DistributedRaceAI(DistributedObjectAI.DistributedObjectAI): def everyoneDone(self): done = True - for racer in self.racers.values(): + for racer in list(self.racers.values()): if not racer.exited and racer.avId not in self.playersFinished and racer.avId not in self.kickedAvIds: done = False break diff --git a/toontown/racing/DistributedVehicle.py b/toontown/racing/DistributedVehicle.py index 0abd40d..076dcdd 100644 --- a/toontown/racing/DistributedVehicle.py +++ b/toontown/racing/DistributedVehicle.py @@ -426,7 +426,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, sides = {0: 'right', 1: 'left'} if side == None: - for x in sides.keys(): + for x in list(sides.keys()): self.sparks[x].effect.getParticlesNamed('particles-1').setBirthRate(1000) taskMgr.doMethodLater(0.75, self.sparks[x].stop, 'stopSparks-' + sides[x], extraArgs=[]) @@ -1199,7 +1199,7 @@ class DistributedVehicle(DistributedSmoothNode.DistributedSmoothNode, Kart.Kart, self.wipeOut.start() def hitPie(self): - print 'yar, got Me with pi!' + print('yar, got Me with pi!') self.splatPie() if self.wipeOut: self.wipeOut.pause() diff --git a/toontown/racing/Kart.py b/toontown/racing/Kart.py index 95f20b2..a0fb717 100644 --- a/toontown/racing/Kart.py +++ b/toontown/racing/Kart.py @@ -134,7 +134,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): self.toonNode[level].setPos(pos) def resetGeomPos(self): - for level in self.geom.keys(): + for level in list(self.geom.keys()): self.geom[level].setPos(0, 0, 0.025) def __update(self): @@ -154,7 +154,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): self.__applyDecals() self.__applyAccessoryColor() else: - raise StandardError, 'Kart::__update - Has this method been called before generateKart?' + raise Exception('Kart::__update - Has this method been called before generateKart?') elif field == KartDNA.bodyColor: self.__applyBodyColor() elif field == KartDNA.accColor: @@ -162,7 +162,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): elif field == KartDNA.ebType: if self.kartAccessories[KartDNA.ebType] != None: name = self.kartAccessories[KartDNA.ebType].getName() - for key in self.geom.keys(): + for key in list(self.geom.keys()): self.geom[key].find('**/%s' % name).removeNode() self.kartAccessories[KartDNA.ebType].removeNode() @@ -171,7 +171,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): elif field == KartDNA.spType: if self.kartAccessories[KartDNA.spType] != None: name = self.kartAccessories[KartDNA.spType].getName() - for key in self.geom.keys(): + for key in list(self.geom.keys()): self.geom[key].find('**/%s' % name).removeNode() self.kartAccessories[KartDNA.spType].removeNode() @@ -180,7 +180,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): elif field == KartDNA.fwwType: if self.kartAccessories[KartDNA.fwwType] != (None, None): left, right = self.kartAccessories[KartDNA.fwwType] - for key in self.geom.keys(): + for key in list(self.geom.keys()): self.geom[key].find('**/%s' % left.getName()).removeNode() self.geom[key].find('**/%s' % right.getName()).removeNode() @@ -191,7 +191,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): elif field == KartDNA.bwwType: if self.kartAccessories[KartDNA.bwwType] != (None, None): left, right = self.kartAccessories[KartDNA.bwwType] - for key in self.geom.keys(): + for key in list(self.geom.keys()): self.geom[key].find('**/%s' % left.getName()).removeNode() self.geom[key].find('**/%s' % right.getName()).removeNode() @@ -436,7 +436,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): def setDNA(self, dna): if self.kartDNA != [-1] * getNumFields(): - for field in xrange(len(self.kartDNA)): + for field in range(len(self.kartDNA)): if dna[field] != self.kartDNA[field]: self.updateDNAField(field, dna[field]) @@ -527,7 +527,7 @@ class Kart(NodePath, ShadowCaster.ShadowCaster): length = self.kartStartSfx.length() def printVol(): - print self.kartLoopSfx.getVolume() + print(self.kartLoopSfx.getVolume()) track = Parallel(SoundInterval(self.kartStartSfx), Func(self.kartLoopSfx.play), LerpFunctionInterval(self.kartLoopSfx.setVolume, fromData=0, toData=0.4, duration=length)) return Sequence(track, Func(printVol)) diff --git a/toontown/racing/KartDNA.py b/toontown/racing/KartDNA.py index 50455e5..c2f2ca8 100644 --- a/toontown/racing/KartDNA.py +++ b/toontown/racing/KartDNA.py @@ -2,7 +2,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.showbase import PythonUtil from toontown.toonbase import TTLocalizer from pandac.PandaModules import * -from KartShopGlobals import * +from .KartShopGlobals import * import types if (__debug__): import pdb @@ -517,9 +517,9 @@ def getTexCardNode(accId): def checkKartDNAValidity(dna): if not checkNumFieldsValidity(len(dna)): return 0 - for field in xrange(len(dna)): + for field in range(len(dna)): if field == KartDNA.bodyType: - if dna[field] not in KartDict.keys(): + if dna[field] not in list(KartDict.keys()): return 0 elif field == KartDNA.bodyColor or field == KartDNA.accColor: accList = [InvalidEntry] + AccessoryTypeDict.get(KartDNA.bodyColor) @@ -555,19 +555,19 @@ def getAccessoryItemList(accessoryType): def getKartTypeInfo(type): - if type in KartDict.keys(): + if type in list(KartDict.keys()): return KartDict[type] return InvalidEntry def getAccessoryInfo(index): - if index in AccessoryDict.keys(): + if index in list(AccessoryDict.keys()): return AccessoryDict[index] return InvalidEntry def getAccessoryType(accessoryId): - for key in AccessoryTypeDict.keys(): + for key in list(AccessoryTypeDict.keys()): if accessoryId in AccessoryTypeDict[key]: return key @@ -590,21 +590,21 @@ def getAccessoryDictFromOwned(accessoryOwnedList, pType = -1): def getAccessDictByType(accessoryOwnedList): accessDict = {} - if type(accessoryOwnedList) == types.ListType: + if type(accessoryOwnedList) == list: for accOwnedId in accessoryOwnedList: accType = getAccessoryType(accOwnedId) if accType != InvalidEntry: - if not accessDict.has_key(accType): + if accType not in accessDict: accessDict[accType] = [] accessDict[accType].append(accOwnedId) else: - print 'KartDNA: getAccessDictByType: bad accessory list: ', accessoryOwnedList + print('KartDNA: getAccessDictByType: bad accessory list: ', accessoryOwnedList) return accessDict def getKartCost(kartID): - if KartDict.has_key(kartID): + if kartID in KartDict: return KartDict[kartID][KartInfo.cost] else: return 'key error' diff --git a/toontown/racing/KartShopGui.py b/toontown/racing/KartShopGui.py index be26fe6..859854c 100644 --- a/toontown/racing/KartShopGui.py +++ b/toontown/racing/KartShopGui.py @@ -8,10 +8,10 @@ from direct.showbase import DirectObject, PythonUtil from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownTimer -from KartShopGlobals import * +from .KartShopGlobals import * from toontown.racing.Kart import Kart from toontown.shtiker.KartPage import KartViewer -from KartDNA import * +from .KartDNA import * from toontown.toontowngui.TeaserPanel import TeaserPanel if (__debug__): import pdb @@ -88,7 +88,7 @@ class KartShopGuiMgr(object, DirectObject.DirectObject): def __init__(self, doneEvent): self.modelScale = 1 model = loader.loadModel('phase_6/models/gui/BuyKartPanel') - self.unownedKartList = KartDict.keys() + self.unownedKartList = list(KartDict.keys()) if base.localAvatar.hasKart(): k = base.localAvatar.getKartBodyType() if k in self.unownedKartList: @@ -818,7 +818,7 @@ class KartShopGuiMgr(object, DirectObject.DirectObject): self.ignoreAll() self.timer.destroy() del self.timer - for event in self.dialogEventDict.values(): + for event in list(self.dialogEventDict.values()): self.ignore(event) self.dialogEventDict = None diff --git a/toontown/racing/Piejectile.py b/toontown/racing/Piejectile.py index 5929a1e..2013044 100644 --- a/toontown/racing/Piejectile.py +++ b/toontown/racing/Piejectile.py @@ -43,7 +43,7 @@ class Piejectile(DirectObject, FlyingGag): self.rotH = randFloat(-360, 360) self.rotP = randFloat(-90, 90) self.rotR = randFloat(-90, 90) - print 'generating Pie %s' % self.name + print('generating Pie %s' % self.name) self.ownerKart = base.cr.doId2do.get(base.race.kartMap.get(sourceId, None), None) if targetId != 0: self.targetKart = base.cr.doId2do.get(base.race.kartMap.get(targetId, None), None) @@ -67,7 +67,7 @@ class Piejectile(DirectObject, FlyingGag): return def delete(self): - print 'removing piejectile' + print('removing piejectile') taskMgr.remove(self.taskName) self.__undoCollisions() self.physicsMgr.clearLinearForces() diff --git a/toontown/racing/RaceEndPanels.py b/toontown/racing/RaceEndPanels.py index 0bc06a0..21d8da9 100644 --- a/toontown/racing/RaceEndPanels.py +++ b/toontown/racing/RaceEndPanels.py @@ -34,7 +34,7 @@ class RaceResultsPanel(DirectFrame): for x in range(self.numRacers): frame = DirectFrame(parent=self, relief=None, pos=self.getRowPos(x)) self.rowFrame.append(frame) - pLabel = DirectLabel(parent=frame, relief=None, pos=(0.0, 0.0, -0.01), text=`(x + 1)` + ' -', text_fg=(0.5, 0.5, 0.5, 1.0), text_scale=TTLocalizer.REPlargeLabel, text_align=TextNode.ARight, text_font=DGG.getDefaultFont()) + pLabel = DirectLabel(parent=frame, relief=None, pos=(0.0, 0.0, -0.01), text=repr((x + 1)) + ' -', text_fg=(0.5, 0.5, 0.5, 1.0), text_scale=TTLocalizer.REPlargeLabel, text_align=TextNode.ARight, text_font=DGG.getDefaultFont()) fFrame = DirectFrame(parent=frame, relief=None, pos=(0.1, -0.01, 0.01)) nLabel = DirectLabel(parent=frame, relief=None, pos=(0.46, 0.0, 0.0), text='', text_fg=(0.0, 0.0, 0.0, 1.0), text_scale=TTLocalizer.REPsmallLabel, text_align=TextNode.ACenter, text_font=DGG.getDefaultFont()) tLabel = DirectLabel(parent=frame, relief=None, pos=(0.9, 0.0, 0.0), text="--'--''--", text_fg=(0.5, 0.5, 0.5, 1.0), text_scale=TTLocalizer.REPsmallLabel, text_font=DGG.getDefaultFont()) @@ -284,7 +284,7 @@ class RaceWinningsPanel(DirectFrame): bonusType = None if ticBonus > 0: if not endOfCircuitRace: - bonusType = RaceGlobals.PeriodDict.values().index(ticBonus) + bonusType = list(RaceGlobals.PeriodDict.values()).index(ticBonus) else: ticBonus = 0 if endOfCircuitRace: @@ -374,7 +374,7 @@ class RaceEndPanel(DirectFrame): self.results.updateWinnings(place, winnings) def updateWinningsFromCircuit(self, place, entryFee, winnings, bonus, trophies = ()): - print 'updateWinningsFromCircuit' + print('updateWinningsFromCircuit') self.seq.finish() totalTickets = winnings + entryFee + bonus self.results.updateWinnings(place, totalTickets) diff --git a/toontown/racing/RaceGUI.py b/toontown/racing/RaceGUI.py index 25f360d..f055201 100644 --- a/toontown/racing/RaceGUI.py +++ b/toontown/racing/RaceGUI.py @@ -223,7 +223,7 @@ class RaceGUI: def waitingOnGag(self, cycleTime): if self.gag: numTextures = len(self.gagTextures) - startOffset = random.choice(range(0, numTextures)) + startOffset = random.choice(list(range(0, numTextures))) self.gag.show() self.gagCycleInterval = Parallel(LerpFunc(self.showNextGag, fromData=startOffset, toData=numTextures * 2 * cycleTime + startOffset, blendType='easeOut', duration=cycleTime), LerpHprInterval(self.gag, duration=cycleTime, hpr=Point3(0, 180 * numTextures * 2 * cycleTime - 90, 0), blendType='easeOut', startHpr=Point3(0, 0, 0)), SoundInterval(self.gagCycleSound, loop=1, duration=cycleTime, startTime=0), name='gagCycleInterval') self.gagCycleInterval.start() @@ -322,7 +322,7 @@ class RaceGUI: def update(self, time): placeSorter = [] placeCount = 0 - for key in self.racerDict.keys(): + for key in list(self.racerDict.keys()): racer = self.racerDict[key] curvetime = racer.curvetime face = racer.face @@ -369,13 +369,13 @@ class RaceGUI: 3: TTLocalizer.KartRace_ThirdSuffix, 4: TTLocalizer.KartRace_FourthSuffix} placeSorter.sort() - for x, p in zip(placeSorter, xrange(len(placeSorter), 0, -1)): + for x, p in zip(placeSorter, range(len(placeSorter), 0, -1)): self.racerDict[x[1]].update(place=p + placeCount - len(placeSorter)) localRacer = self.racerDict[localAvatar.doId] nearDiff, farDiff = RaceGlobals.TrackDict[self.race.trackId][8] if not localRacer.finished and self.faceEndPos[0] - localRacer.face.getX() < nearDiff: - for racerId in self.racerDict.keys(): + for racerId in list(self.racerDict.keys()): racer = self.racerDict[racerId] if not racer.enabled or racerId == localAvatar.doId or racer.face.getX() >= self.faceEndPos[0]: continue @@ -407,7 +407,7 @@ class RaceGUI: self.wrongWaySeq.finish() def updateRacerInfo(self, avId, curvetime = None, maxlaphit = None): - if avId in self.racerDict.keys(): + if avId in list(self.racerDict.keys()): self.racerDict[avId].update(curvetime=curvetime, maxlaphit=maxlaphit) def racerEntered(self, avId): @@ -434,7 +434,7 @@ class RaceGUI: mapspot.reparentTo(self.mapLines) mapspot.setHpr(self.mapScene, 0, 0, 0) self.racerDict[avId] = self.RacerInfo(headframe, mapspot) - for key, i in zip(self.racerDict.keys(), range(len(self.racerDict.keys()))): + for key, i in zip(list(self.racerDict.keys()), list(range(len(list(self.racerDict.keys()))))): face = self.racerDict[key].face mapspot = self.racerDict[key].mapspot face.setX(self.faceStartPos[0]) diff --git a/toontown/racing/RaceGag.py b/toontown/racing/RaceGag.py index 9cdcd65..37c80a5 100644 --- a/toontown/racing/RaceGag.py +++ b/toontown/racing/RaceGag.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from direct.showbase import DirectObject -from DroppedGag import * +from .DroppedGag import * types = ['', 'Pie', 'Banana', diff --git a/toontown/racing/RaceGlobals.py b/toontown/racing/RaceGlobals.py index 0865293..051c53c 100644 --- a/toontown/racing/RaceGlobals.py +++ b/toontown/racing/RaceGlobals.py @@ -356,7 +356,7 @@ TrackDict = {RT_Speedway_1: (TrackPath + 'RT_SpeedwayA', 1.0, 'GS_Race_CC.mid', (0.002, 0.003))} -TrackIds = TrackDict.keys() +TrackIds = list(TrackDict.keys()) TrackIds.sort() def getEntryFee(trackId, raceType): @@ -386,7 +386,7 @@ AllTime = 2 PeriodDict = {Daily: 10, Weekly: 100, AllTime: 1000} -PeriodIds = PeriodDict.keys() +PeriodIds = list(PeriodDict.keys()) NumRecordPeriods = len(PeriodIds) NumRecordsPerPeriod = 10 Winnings = [3.0, @@ -540,7 +540,7 @@ def getCircuitLoop(startingTrack): circuitLoop = [startingTrack] for loop in CircuitLoops: if startingTrack in loop: - print loop + print(loop) numTracks = len(loop) tempLoop = loop * 2 startingIndex = tempLoop.index(startingTrack) diff --git a/toontown/racing/RaceHeadFrame.py b/toontown/racing/RaceHeadFrame.py index 060448e..040fd6c 100644 --- a/toontown/racing/RaceHeadFrame.py +++ b/toontown/racing/RaceHeadFrame.py @@ -13,7 +13,7 @@ class RaceHeadFrame(DirectFrame): 'geom_scale': (1, 1, 0.5), 'pos': (0, 0, 0)} opts.update(kwargs) - apply(DirectFrame.__init__, (self,) + args, opts) + DirectFrame.__init__(*(self,) + args, **opts) self.initialiseoptions(RaceHeadFrame) if av: self.setAv(av) diff --git a/toontown/racing/RaceManagerAI.py b/toontown/racing/RaceManagerAI.py index f665ee0..ceacceb 100644 --- a/toontown/racing/RaceManagerAI.py +++ b/toontown/racing/RaceManagerAI.py @@ -1,10 +1,10 @@ from direct.directnotify import DirectNotifyGlobal -import DistributedRaceAI +from . import DistributedRaceAI from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.coghq import MintLayout from toontown.ai import HolidayBaseAI from direct.showbase import DirectObject -import RaceGlobals, random, os, cPickle +import RaceGlobals, random, os, pickle class RaceManagerAI(DirectObject.DirectObject): notify = DirectNotifyGlobal.directNotify.newCategory('RaceManagerAI') @@ -88,7 +88,7 @@ class RaceManagerAI(DirectObject.DirectObject): if trophies: self.updateTrophiesFromList(playerInfo.avId, trophies) bonus = self.checkTimeRecord(race.trackId, totalTime, race.raceType, race.toonCount, playerInfo.avId) - if race.circuitTotalBonusTickets.has_key(playerInfo.avId): + if playerInfo.avId in race.circuitTotalBonusTickets: race.circuitTotalBonusTickets[playerInfo.avId] += bonus else: race.circuitTotalBonusTickets[playerInfo.avId] = bonus @@ -166,7 +166,7 @@ class RaceManagerAI(DirectObject.DirectObject): av = self.air.doId2do.get(avId) if av and avId in race.playersFinished: self.air.writeServerEvent('kartingCircuitFinished', avId, '%s|%s' % (place, places)) - print 'kartingCircuitFinished', avId, '%s|%s' % (place, places) + print('kartingCircuitFinished', avId, '%s|%s' % (place, places)) entryFee = RaceGlobals.getEntryFee(race.trackId, race.raceType) placeMultiplier = RaceGlobals.Winnings[place - 1 + (RaceGlobals.MaxRacers - places)] winnings = int(entryFee * placeMultiplier) @@ -192,7 +192,7 @@ class RaceManagerAI(DirectObject.DirectObject): self.notify.debug('bonus: %s' % bonus) av.b_setTickets(newTickets) finalBonus = 0 - if race.circuitTotalBonusTickets.has_key(avId): + if avId in race.circuitTotalBonusTickets: finalBonus = race.circuitTotalBonusTickets[avId] race.d_setCircuitPlace(avId, place, entryFee, winnings, finalBonus, trophies) @@ -611,7 +611,7 @@ class RaceManagerAI(DirectObject.DirectObject): os.rename(self.filename, backup) file = open(self.filename, 'w') file.seek(0) - cPickle.dump(self.trackRecords, file) + pickle.dump(self.trackRecords, file) file.close() if os.path.exists(backup): os.remove(backup) @@ -636,7 +636,7 @@ class RaceManagerAI(DirectObject.DirectObject): records = self.loadFrom(file) file.close() for trackId in RaceGlobals.TrackIds: - if not records.has_key(trackId): + if trackId not in records: records[trackId] = {} for i in RaceGlobals.PeriodIds: records[trackId][i] = [] @@ -650,7 +650,7 @@ class RaceManagerAI(DirectObject.DirectObject): records = {} try: while 1: - records = cPickle.load(file) + records = pickle.load(file) except EOFError: pass diff --git a/toontown/safezone/BRPlayground.py b/toontown/safezone/BRPlayground.py index 360f0f4..09e2a51 100644 --- a/toontown/safezone/BRPlayground.py +++ b/toontown/safezone/BRPlayground.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import Playground +from . import Playground from direct.task.Task import Task import random from toontown.hood import Place diff --git a/toontown/safezone/BRSafeZoneLoader.py b/toontown/safezone/BRSafeZoneLoader.py index 76771dd..ae08b1f 100644 --- a/toontown/safezone/BRSafeZoneLoader.py +++ b/toontown/safezone/BRSafeZoneLoader.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -import SafeZoneLoader -import BRPlayground +from . import SafeZoneLoader +from . import BRPlayground from toontown.battle import BattleParticles class BRSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): diff --git a/toontown/safezone/BRTreasurePlannerAI.py b/toontown/safezone/BRTreasurePlannerAI.py index c2307c0..62c214e 100644 --- a/toontown/safezone/BRTreasurePlannerAI.py +++ b/toontown/safezone/BRTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedBRTreasureAI +from . import RegenTreasurePlannerAI, DistributedBRTreasureAI class BRTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/safezone/ButterflyGlobals.py b/toontown/safezone/ButterflyGlobals.py index d185f86..26ade71 100644 --- a/toontown/safezone/ButterflyGlobals.py +++ b/toontown/safezone/ButterflyGlobals.py @@ -190,14 +190,14 @@ def generateIndexes(doId, playground): usedI = [] unusedI = [] for area in ButterflyPoints[playground]: - usedI.append(range(0, len(area))) + usedI.append(list(range(0, len(area)))) unusedI.append([]) allocatedIndexes[doId] = (usedI, unusedI) def clearIndexes(doId): - if allocatedIndexes.has_key(doId): + if doId in allocatedIndexes: del allocatedIndexes[doId] @@ -212,7 +212,7 @@ def getFirstRoute(playground, area, doId): def __getCurrentPos(playground, area, doId): - if allocatedIndexes.has_key(doId): + if doId in allocatedIndexes: unusedI = allocatedIndexes[doId][0][area] usedI = allocatedIndexes[doId][1][area] else: @@ -227,7 +227,7 @@ def __getCurrentPos(playground, area, doId): def getNextPos(currentPos, playground, area, doId): - if allocatedIndexes.has_key(doId): + if doId in allocatedIndexes: unusedI = allocatedIndexes[doId][0][area] usedI = allocatedIndexes[doId][1][area] else: @@ -250,7 +250,7 @@ def getNextPos(currentPos, playground, area, doId): def recycleIndex(index, playground, area, doId): - if allocatedIndexes.has_key(doId): + if doId in allocatedIndexes: unusedI = allocatedIndexes[doId][0][area] usedI = allocatedIndexes[doId][1][area] else: diff --git a/toontown/safezone/DDPlayground.py b/toontown/safezone/DDPlayground.py index dbba771..3ca1996 100644 --- a/toontown/safezone/DDPlayground.py +++ b/toontown/safezone/DDPlayground.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import Playground +from . import Playground from direct.task.Task import Task import random from direct.fsm import ClassicFSM, State diff --git a/toontown/safezone/DDSafeZoneLoader.py b/toontown/safezone/DDSafeZoneLoader.py index f4cef08..b9ccc14 100644 --- a/toontown/safezone/DDSafeZoneLoader.py +++ b/toontown/safezone/DDSafeZoneLoader.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * -import SafeZoneLoader -import DDPlayground +from . import SafeZoneLoader +from . import DDPlayground from direct.fsm import State from toontown.char import CharDNA from toontown.char import Char diff --git a/toontown/safezone/DDTreasurePlannerAI.py b/toontown/safezone/DDTreasurePlannerAI.py index 6367272..31b1502 100644 --- a/toontown/safezone/DDTreasurePlannerAI.py +++ b/toontown/safezone/DDTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedDDTreasureAI +from . import RegenTreasurePlannerAI, DistributedDDTreasureAI class DDTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/safezone/DGPlayground.py b/toontown/safezone/DGPlayground.py index 8e859de..582c074 100644 --- a/toontown/safezone/DGPlayground.py +++ b/toontown/safezone/DGPlayground.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import Playground +from . import Playground import random from direct.task import Task diff --git a/toontown/safezone/DGSafeZoneLoader.py b/toontown/safezone/DGSafeZoneLoader.py index 2ff03cc..0777d36 100644 --- a/toontown/safezone/DGSafeZoneLoader.py +++ b/toontown/safezone/DGSafeZoneLoader.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * -import SafeZoneLoader -import DGPlayground +from . import SafeZoneLoader +from . import DGPlayground class DGSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): diff --git a/toontown/safezone/DGTreasurePlannerAI.py b/toontown/safezone/DGTreasurePlannerAI.py index 14eb7eb..d5aa084 100644 --- a/toontown/safezone/DGTreasurePlannerAI.py +++ b/toontown/safezone/DGTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedDGTreasureAI +from . import RegenTreasurePlannerAI, DistributedDGTreasureAI class DGTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/safezone/DLPlayground.py b/toontown/safezone/DLPlayground.py index 1948075..507d09f 100644 --- a/toontown/safezone/DLPlayground.py +++ b/toontown/safezone/DLPlayground.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import Playground +from . import Playground import random class DLPlayground(Playground.Playground): diff --git a/toontown/safezone/DLSafeZoneLoader.py b/toontown/safezone/DLSafeZoneLoader.py index 943d419..0376775 100644 --- a/toontown/safezone/DLSafeZoneLoader.py +++ b/toontown/safezone/DLSafeZoneLoader.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * -import SafeZoneLoader -import DLPlayground +from . import SafeZoneLoader +from . import DLPlayground class DLSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): diff --git a/toontown/safezone/DLTreasurePlannerAI.py b/toontown/safezone/DLTreasurePlannerAI.py index 13710b6..58b2868 100644 --- a/toontown/safezone/DLTreasurePlannerAI.py +++ b/toontown/safezone/DLTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedDLTreasureAI +from . import RegenTreasurePlannerAI, DistributedDLTreasureAI class DLTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/safezone/DistributedBRTreasure.py b/toontown/safezone/DistributedBRTreasure.py index ee64e42..faa8802 100644 --- a/toontown/safezone/DistributedBRTreasure.py +++ b/toontown/safezone/DistributedBRTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedBRTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedBRTreasureAI.py b/toontown/safezone/DistributedBRTreasureAI.py index 51dcfe9..109c04a 100644 --- a/toontown/safezone/DistributedBRTreasureAI.py +++ b/toontown/safezone/DistributedBRTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedBRTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedButterfly.py b/toontown/safezone/DistributedButterfly.py index 55fdeea..c35ce87 100644 --- a/toontown/safezone/DistributedButterfly.py +++ b/toontown/safezone/DistributedButterfly.py @@ -9,7 +9,7 @@ from pandac.PandaModules import NodePath from direct.directutil import Mopath from toontown.toonbase import ToontownGlobals from direct.actor import Actor -import ButterflyGlobals +from . import ButterflyGlobals from direct.showbase import RandomNumGen import random diff --git a/toontown/safezone/DistributedCheckers.py b/toontown/safezone/DistributedCheckers.py index 179b803..4caeec4 100644 --- a/toontown/safezone/DistributedCheckers.py +++ b/toontown/safezone/DistributedCheckers.py @@ -2,12 +2,12 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer from direct.distributed import DistributedNode from direct.distributed.ClockDelta import globalClockDelta -from CheckersBoard import CheckersBoard +from .CheckersBoard import CheckersBoard from direct.fsm import ClassicFSM, State from direct.fsm import StateData from toontown.toonbase.ToontownTimer import ToontownTimer diff --git a/toontown/safezone/DistributedChineseCheckers.py b/toontown/safezone/DistributedChineseCheckers.py index 2c00fa8..304f080 100644 --- a/toontown/safezone/DistributedChineseCheckers.py +++ b/toontown/safezone/DistributedChineseCheckers.py @@ -2,12 +2,12 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer from direct.distributed import DistributedNode from direct.distributed.ClockDelta import globalClockDelta -from ChineseCheckersBoard import ChineseCheckersBoard +from .ChineseCheckersBoard import ChineseCheckersBoard from direct.fsm import ClassicFSM, State from direct.fsm import StateData from toontown.distributed import DelayDelete diff --git a/toontown/safezone/DistributedDDTreasure.py b/toontown/safezone/DistributedDDTreasure.py index d6c0c4d..686cd9f 100644 --- a/toontown/safezone/DistributedDDTreasure.py +++ b/toontown/safezone/DistributedDDTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedDDTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedDDTreasureAI.py b/toontown/safezone/DistributedDDTreasureAI.py index e25df11..0ec1376 100644 --- a/toontown/safezone/DistributedDDTreasureAI.py +++ b/toontown/safezone/DistributedDDTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedDDTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedDGTreasure.py b/toontown/safezone/DistributedDGTreasure.py index 148bbbd..224e2d2 100644 --- a/toontown/safezone/DistributedDGTreasure.py +++ b/toontown/safezone/DistributedDGTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedDGTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedDGTreasureAI.py b/toontown/safezone/DistributedDGTreasureAI.py index a16bef6..4006ab9 100644 --- a/toontown/safezone/DistributedDGTreasureAI.py +++ b/toontown/safezone/DistributedDGTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedDGTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedDLTreasure.py b/toontown/safezone/DistributedDLTreasure.py index db74763..b630e16 100644 --- a/toontown/safezone/DistributedDLTreasure.py +++ b/toontown/safezone/DistributedDLTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedDLTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedDLTreasureAI.py b/toontown/safezone/DistributedDLTreasureAI.py index a60caa7..6247ddc 100644 --- a/toontown/safezone/DistributedDLTreasureAI.py +++ b/toontown/safezone/DistributedDLTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedDLTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedEFlyingTreasure.py b/toontown/safezone/DistributedEFlyingTreasure.py index 47c53c1..74ba8db 100644 --- a/toontown/safezone/DistributedEFlyingTreasure.py +++ b/toontown/safezone/DistributedEFlyingTreasure.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * -import DistributedSZTreasure +from . import DistributedSZTreasure from direct.task.Task import Task import math import random diff --git a/toontown/safezone/DistributedETreasure.py b/toontown/safezone/DistributedETreasure.py index f303465..3aebfa4 100644 --- a/toontown/safezone/DistributedETreasure.py +++ b/toontown/safezone/DistributedETreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedETreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedFindFour.py b/toontown/safezone/DistributedFindFour.py index ab86802..688abaf 100644 --- a/toontown/safezone/DistributedFindFour.py +++ b/toontown/safezone/DistributedFindFour.py @@ -2,12 +2,12 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer from direct.distributed import DistributedNode from direct.distributed.ClockDelta import globalClockDelta -from ChineseCheckersBoard import ChineseCheckersBoard +from .ChineseCheckersBoard import ChineseCheckersBoard from direct.fsm import ClassicFSM, State from direct.fsm import StateData from toontown.toonbase.ToontownTimer import ToontownTimer @@ -534,7 +534,7 @@ class DistributedFindFour(DistributedNode.DistributedNode): elif winDirection == 2: blinkList = self.findDiagonal(x, y, playerNum) if blinkList != []: - print blinkList + print(blinkList) val0 = x * 7 + y x = blinkList[0][0] y = blinkList[0][1] diff --git a/toontown/safezone/DistributedGolfKart.py b/toontown/safezone/DistributedGolfKart.py index 4505d6d..bb00e6b 100644 --- a/toontown/safezone/DistributedGolfKart.py +++ b/toontown/safezone/DistributedGolfKart.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from toontown.golf import GolfGlobals from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObject @@ -174,7 +174,7 @@ class DistributedGolfKart(DistributedObject.DistributedObject): self.localToonOnBoard = 1 if avId == base.localAvatar.getDoId(): self.loader.place.trolley.fsm.request('boarded') - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] toon.stopSmooth() toon.wrtReparentTo(self.golfKart) @@ -212,7 +212,7 @@ class DistributedGolfKart(DistributedObject.DistributedObject): pass else: self.avIds[index] = 0 - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] toon.stopSmooth() sitStartDuration = toon.getDuration('sit-start') @@ -341,7 +341,7 @@ class DistributedGolfKart(DistributedObject.DistributedObject): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) def setGolfCourse(self, golfCourse): diff --git a/toontown/safezone/DistributedGolfKartAI.py b/toontown/safezone/DistributedGolfKartAI.py index 47f0498..61225e9 100644 --- a/toontown/safezone/DistributedGolfKartAI.py +++ b/toontown/safezone/DistributedGolfKartAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from toontown.toonbase.ToontownGlobals import * from direct.distributed.ClockDelta import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/safezone/DistributedMMTreasure.py b/toontown/safezone/DistributedMMTreasure.py index 25f1058..b72eab1 100644 --- a/toontown/safezone/DistributedMMTreasure.py +++ b/toontown/safezone/DistributedMMTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedMMTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedMMTreasureAI.py b/toontown/safezone/DistributedMMTreasureAI.py index 1ed2fea..f63998e 100644 --- a/toontown/safezone/DistributedMMTreasureAI.py +++ b/toontown/safezone/DistributedMMTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedMMTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedOZTreasure.py b/toontown/safezone/DistributedOZTreasure.py index 5c14fcc..6d02f6f 100644 --- a/toontown/safezone/DistributedOZTreasure.py +++ b/toontown/safezone/DistributedOZTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedOZTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedOZTreasureAI.py b/toontown/safezone/DistributedOZTreasureAI.py index 726b390..2a3d709 100644 --- a/toontown/safezone/DistributedOZTreasureAI.py +++ b/toontown/safezone/DistributedOZTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedOZTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedPartyGate.py b/toontown/safezone/DistributedPartyGate.py index 819af71..815f76a 100644 --- a/toontown/safezone/DistributedPartyGate.py +++ b/toontown/safezone/DistributedPartyGate.py @@ -74,7 +74,7 @@ class DistributedPartyGate(DistributedObject.DistributedObject): def announceGenerate(self): DistributedObject.DistributedObject.announceGenerate(self) - if ToontownGlobals.dnaMap.has_key(self.zoneId): + if self.zoneId in ToontownGlobals.dnaMap: playground = ToontownGlobals.dnaMap[self.zoneId] else: playground = ToontownGlobals.dnaMap[2000] diff --git a/toontown/safezone/DistributedPicnicBasket.py b/toontown/safezone/DistributedPicnicBasket.py index 54d7cb2..20c7f12 100644 --- a/toontown/safezone/DistributedPicnicBasket.py +++ b/toontown/safezone/DistributedPicnicBasket.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from toontown.golf import GolfGlobals from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObject @@ -149,7 +149,7 @@ class DistributedPicnicBasket(DistributedObject.DistributedObject): if hasattr(self.loader.place, 'trolley'): self.loader.place.trolley.fsm.request('boarded') self.loader.place.trolley.exitButton.hide() - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] toon.stopSmooth() toon.wrtReparentTo(self.tablecloth) @@ -216,7 +216,7 @@ class DistributedPicnicBasket(DistributedObject.DistributedObject): track.start() else: self.fullSeat[index] = self.seatState.Empty - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: if avId == base.localAvatar.getDoId(): if self.clockNode: self.clockNode.hide() @@ -302,7 +302,7 @@ class DistributedPicnicBasket(DistributedObject.DistributedObject): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) def doneExit(self, avId): diff --git a/toontown/safezone/DistributedPicnicBasketAI.py b/toontown/safezone/DistributedPicnicBasketAI.py index 782923f..5271060 100644 --- a/toontown/safezone/DistributedPicnicBasketAI.py +++ b/toontown/safezone/DistributedPicnicBasketAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from toontown.toonbase.ToontownGlobals import * from direct.distributed.ClockDelta import * -from TrolleyConstants import * +from .TrolleyConstants import * from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State diff --git a/toontown/safezone/DistributedPicnicTable.py b/toontown/safezone/DistributedPicnicTable.py index c1df80f..faed7ea 100644 --- a/toontown/safezone/DistributedPicnicTable.py +++ b/toontown/safezone/DistributedPicnicTable.py @@ -2,14 +2,14 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer from direct.distributed import DistributedNode from direct.distributed.ClockDelta import globalClockDelta -from ChineseCheckersBoard import ChineseCheckersBoard -from GameTutorials import * -from GameMenu import GameMenu +from .ChineseCheckersBoard import ChineseCheckersBoard +from .GameTutorials import * +from .GameMenu import GameMenu from direct.fsm import ClassicFSM, State from direct.fsm import StateData from toontown.distributed import DelayDelete @@ -177,14 +177,14 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): def setTableState(self, tableStateList, isplaying): y = 0 - print 'SET TABLE STATE' + print('SET TABLE STATE') if isplaying == 0: self.isPlaying = False else: self.isPlaying = True for x in tableStateList: if x != 0: - if x not in self.tableState and self.cr.doId2do.has_key(x) and x not in self.haveAnimated: + if x not in self.tableState and x in self.cr.doId2do and x not in self.haveAnimated: seatIndex = tableStateList.index(x) toon = self.cr.doId2do[x] toon.stopSmooth() @@ -212,10 +212,10 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): if x != None: numPlayers += 1 - print ' GETTING 2', self.gameMenu, numPlayers + print(' GETTING 2', self.gameMenu, numPlayers) if self.gameMenu: if numPlayers > 2: - print ' GETTING HERE!!' + print(' GETTING HERE!!') self.gameMenu.FindFour.setColor(0.7, 0.7, 0.7, 0.7) self.gameMenu.FindFour['command'] = self.doNothing self.gameMenu.findFourText['fg'] = (0.7, 0.7, 0.7, 0.7) @@ -241,7 +241,7 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): whisper = WhisperPopup(TTLocalizer.RegularCheckersYouWon, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Find Four': whisper = WhisperPopup('You won a game of Find Four!', OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) - elif self.cr.doId2do.has_key(avId): + elif avId in self.cr.doId2do: stateString = self.fsm.getCurrentState().getName() if stateString == 'sitting' or stateString == 'observing': base.cr.playGame.getPlace().setState('walk') @@ -252,7 +252,7 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): whisper = WhisperPopup(av.getName() + TTLocalizer.RegularCheckersGameOf + TTLocalizer.RegularCheckers, OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) elif winString == 'Find Four': whisper = WhisperPopup(av.getName() + ' has won a game of' + ' Find Four!', OTPGlobals.getInterfaceFont(), WhisperPopup.WTNormal) - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] self.winTrack = Sequence(autoFinish=1) if self.outTrack.isPlaying(): @@ -411,7 +411,7 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): else: self.inGame = True self.seatPos = index - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] toon.stopSmooth() toon.wrtReparentTo(self.tableCloth) @@ -436,7 +436,7 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): return if avId in self.haveAnimated: self.haveAnimated.remove(avId) - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: if avId == base.localAvatar.getDoId(): if self.gameZone: base.cr.removeInterest(self.gameZone) @@ -644,7 +644,7 @@ class DistributedPicnicTable(DistributedNode.DistributedNode): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) def doNothing(self): diff --git a/toontown/safezone/DistributedSZTreasure.py b/toontown/safezone/DistributedSZTreasure.py index 00f88ba..5b1c989 100644 --- a/toontown/safezone/DistributedSZTreasure.py +++ b/toontown/safezone/DistributedSZTreasure.py @@ -1,4 +1,4 @@ -import DistributedTreasure +from . import DistributedTreasure from pandac.PandaModules import VBase3, VBase4 from direct.interval.IntervalGlobal import Sequence, Wait, Func, LerpColorScaleInterval, LerpScaleInterval from toontown.toonbase import ToontownGlobals diff --git a/toontown/safezone/DistributedSZTreasureAI.py b/toontown/safezone/DistributedSZTreasureAI.py index c6dd0e1..cf804fd 100644 --- a/toontown/safezone/DistributedSZTreasureAI.py +++ b/toontown/safezone/DistributedSZTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedTreasureAI +from . import DistributedTreasureAI from toontown.toonbase import ToontownGlobals class DistributedSZTreasureAI(DistributedTreasureAI.DistributedTreasureAI): @@ -12,12 +12,12 @@ class DistributedSZTreasureAI(DistributedTreasureAI.DistributedTreasureAI): def d_setGrab(self, avId): DistributedTreasureAI.DistributedTreasureAI.d_setGrab(self, avId) - if self.air.doId2do.has_key(avId): + if avId in self.air.doId2do: av = self.air.doId2do[avId] if self.validAvatar(av): if av.hp == -1: av.hp = 0 - if simbase.air.holidayManager.currentHolidays.has_key(ToontownGlobals.VALENTINES_DAY): + if ToontownGlobals.VALENTINES_DAY in simbase.air.holidayManager.currentHolidays: av.toonUp(self.healAmount * 2) else: av.toonUp(self.healAmount) diff --git a/toontown/safezone/DistributedTTTreasure.py b/toontown/safezone/DistributedTTTreasure.py index 80a66e7..8d3e765 100644 --- a/toontown/safezone/DistributedTTTreasure.py +++ b/toontown/safezone/DistributedTTTreasure.py @@ -1,4 +1,4 @@ -import DistributedSZTreasure +from . import DistributedSZTreasure class DistributedTTTreasure(DistributedSZTreasure.DistributedSZTreasure): diff --git a/toontown/safezone/DistributedTTTreasureAI.py b/toontown/safezone/DistributedTTTreasureAI.py index 23ab220..ef096d4 100644 --- a/toontown/safezone/DistributedTTTreasureAI.py +++ b/toontown/safezone/DistributedTTTreasureAI.py @@ -1,4 +1,4 @@ -import DistributedSZTreasureAI +from . import DistributedSZTreasureAI class DistributedTTTreasureAI(DistributedSZTreasureAI.DistributedSZTreasureAI): diff --git a/toontown/safezone/DistributedTreasure.py b/toontown/safezone/DistributedTreasure.py index 88b4af4..05c2752 100644 --- a/toontown/safezone/DistributedTreasure.py +++ b/toontown/safezone/DistributedTreasure.py @@ -120,7 +120,7 @@ class DistributedTreasure(DistributedObject.DistributedObject): def handleGrab(self, avId): self.collNodePath.stash() self.avId = avId - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: av = self.cr.doId2do[avId] self.av = av else: diff --git a/toontown/safezone/DistributedTrolley.py b/toontown/safezone/DistributedTrolley.py index 410d90d..010b0de 100644 --- a/toontown/safezone/DistributedTrolley.py +++ b/toontown/safezone/DistributedTrolley.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from toontown.toonbase import ToontownGlobals from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal @@ -61,7 +61,7 @@ class DistributedTrolley(DistributedObject.DistributedObject): for i in range(self.numKeys): key = self.keys[i] key.setTwoSided(1) - ref = self.trolleyCar.attachNewNode('key' + `i` + 'ref') + ref = self.trolleyCar.attachNewNode('key' + repr(i) + 'ref') ref.setPosHpr(key, 0, 0, 0, 0, 0, 0) self.keyRef.append(ref) self.keyInit.append(key.getTransform()) @@ -72,7 +72,7 @@ class DistributedTrolley(DistributedObject.DistributedObject): self.frontWheelRef = [] for i in range(self.numFrontWheels): wheel = self.frontWheels[i] - ref = self.trolleyCar.attachNewNode('frontWheel' + `i` + 'ref') + ref = self.trolleyCar.attachNewNode('frontWheel' + repr(i) + 'ref') ref.setPosHpr(wheel, 0, 0, 0, 0, 0, 0) self.frontWheelRef.append(ref) self.frontWheelInit.append(wheel.getTransform()) @@ -83,7 +83,7 @@ class DistributedTrolley(DistributedObject.DistributedObject): self.backWheelRef = [] for i in range(self.numBackWheels): wheel = self.backWheels[i] - ref = self.trolleyCar.attachNewNode('backWheel' + `i` + 'ref') + ref = self.trolleyCar.attachNewNode('backWheel' + repr(i) + 'ref') ref.setPosHpr(wheel, 0, 0, 0, 0, 0, 0) self.backWheelRef.append(ref) self.backWheelInit.append(wheel.getTransform()) @@ -218,7 +218,7 @@ class DistributedTrolley(DistributedObject.DistributedObject): else: self.notify.warning("Can't board the trolley because it doesn't exist") self.sendUpdate('requestExit') - if self.cr.doId2do.has_key(avId): + if avId in self.cr.doId2do: toon = self.cr.doId2do[avId] toon.stopSmooth() toon.wrtReparentTo(self.trolleyCar) @@ -256,7 +256,7 @@ class DistributedTrolley(DistributedObject.DistributedObject): def emptySlot(self, index, avId, timestamp): if avId == 0: pass - elif self.cr.doId2do.has_key(avId): + elif avId in self.cr.doId2do: toon = self.cr.doId2do[avId] toon.setHpr(self.trolleyCar, 90, 0, 0) toon.wrtReparentTo(render) @@ -402,5 +402,5 @@ class DistributedTrolley(DistributedObject.DistributedObject): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) diff --git a/toontown/safezone/DistributedTrolleyAI.py b/toontown/safezone/DistributedTrolleyAI.py index 2388480..37d62a9 100644 --- a/toontown/safezone/DistributedTrolleyAI.py +++ b/toontown/safezone/DistributedTrolleyAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBase import * from toontown.toonbase.ToontownGlobals import * from direct.distributed.ClockDelta import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.distributed import DistributedObjectAI from direct.fsm import ClassicFSM, State from direct.fsm import State diff --git a/toontown/safezone/GSPlayground.py b/toontown/safezone/GSPlayground.py index 1c37620..8a45cab 100644 --- a/toontown/safezone/GSPlayground.py +++ b/toontown/safezone/GSPlayground.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals -import Playground +from . import Playground from toontown.launcher import DownloadForceAcknowledge from toontown.building import Elevator from toontown.toontowngui import TTDialog @@ -104,7 +104,7 @@ class GSPlayground(Playground.Playground): elif where == 'exit': self.fsm.request('walk') elif where == 'racetrack': - print 'Entering Racetrack' + print('Entering Racetrack') self.doneStatus = doneStatus messenger.send(self.doneEvent) else: diff --git a/toontown/safezone/GSSafeZoneLoader.py b/toontown/safezone/GSSafeZoneLoader.py index 8871162..19b175d 100644 --- a/toontown/safezone/GSSafeZoneLoader.py +++ b/toontown/safezone/GSSafeZoneLoader.py @@ -36,7 +36,7 @@ class GSSafeZoneLoader(SafeZoneLoader): holidayIds = base.cr.newsManager.getDecorationHolidayId() if ToontownGlobals.CRASHED_LEADERBOARD in holidayIds: self.startSmokeEffect() - self.birdSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) + self.birdSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) def unload(self): del self.birdSound @@ -86,7 +86,7 @@ class GSSafeZoneLoader(SafeZoneLoader): del self.trackId def handleRaceOver(self): - print 'you done!!' + print('you done!!') def handleLeftRace(self): req = {'loader': 'safeZoneLoader', diff --git a/toontown/safezone/GZPlayground.py b/toontown/safezone/GZPlayground.py index 035c5f9..106209f 100644 --- a/toontown/safezone/GZPlayground.py +++ b/toontown/safezone/GZPlayground.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals -import Playground +from . import Playground from toontown.launcher import DownloadForceAcknowledge from toontown.building import Elevator from toontown.toontowngui import TTDialog @@ -115,7 +115,7 @@ class GZPlayground(Playground.Playground): elif where == 'exit': self.fsm.request('walk') elif where == 'racetrack': - print 'Entering Racetrack' + print('Entering Racetrack') self.doneStatus = doneStatus messenger.send(self.doneEvent) else: diff --git a/toontown/safezone/GZSafeZoneLoader.py b/toontown/safezone/GZSafeZoneLoader.py index 2d5bc4d..6be9c98 100644 --- a/toontown/safezone/GZSafeZoneLoader.py +++ b/toontown/safezone/GZSafeZoneLoader.py @@ -31,7 +31,7 @@ class GZSafeZoneLoader(SafeZoneLoader): def load(self): SafeZoneLoader.load(self) - self.birdSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) + self.birdSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) def unload(self): del self.birdSound @@ -84,7 +84,7 @@ class GZSafeZoneLoader(SafeZoneLoader): return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId def enterGolfCourse(self, requestStatus): - if requestStatus.has_key('curseId'): + if 'curseId' in requestStatus: self.golfCourseId = requestStatus['courseId'] else: self.golfCourseId = 0 @@ -96,7 +96,7 @@ class GZSafeZoneLoader(SafeZoneLoader): del self.golfCourseId def handleRaceOver(self): - print 'you done!!' + print('you done!!') def handleLeftGolf(self): req = {'loader': 'safeZoneLoader', diff --git a/toontown/safezone/GameMenu.py b/toontown/safezone/GameMenu.py index 6a880df..5582e4a 100644 --- a/toontown/safezone/GameMenu.py +++ b/toontown/safezone/GameMenu.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.distributed.ClockDelta import * from direct.task.Task import Task from direct.interval.IntervalGlobal import * -from TrolleyConstants import * +from .TrolleyConstants import * from direct.gui.DirectGui import * from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals diff --git a/toontown/safezone/MMPlayground.py b/toontown/safezone/MMPlayground.py index c5a195d..b58b726 100644 --- a/toontown/safezone/MMPlayground.py +++ b/toontown/safezone/MMPlayground.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import Playground +from . import Playground import random from direct.fsm import ClassicFSM, State from direct.actor import Actor diff --git a/toontown/safezone/MMSafeZoneLoader.py b/toontown/safezone/MMSafeZoneLoader.py index c6aa8e7..994a771 100644 --- a/toontown/safezone/MMSafeZoneLoader.py +++ b/toontown/safezone/MMSafeZoneLoader.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * -import SafeZoneLoader -import MMPlayground +from . import SafeZoneLoader +from . import MMPlayground from toontown.toonbase import ToontownGlobals class MMSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): @@ -14,7 +14,7 @@ class MMSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): self.safeZoneStorageDNAFile = 'phase_6/dna/storage_MM_sz.dna' def load(self): - print 'loading MM safezone' + print('loading MM safezone') SafeZoneLoader.SafeZoneLoader.load(self) self.piano = self.geom.find('**/center_icon') if self.piano.isEmpty(): diff --git a/toontown/safezone/MMTreasurePlannerAI.py b/toontown/safezone/MMTreasurePlannerAI.py index d89184b..d1ec0e3 100644 --- a/toontown/safezone/MMTreasurePlannerAI.py +++ b/toontown/safezone/MMTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedMMTreasureAI +from . import RegenTreasurePlannerAI, DistributedMMTreasureAI class MMTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/safezone/OZPlayground.py b/toontown/safezone/OZPlayground.py index 1166e42..383137b 100644 --- a/toontown/safezone/OZPlayground.py +++ b/toontown/safezone/OZPlayground.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals -import Playground +from . import Playground from toontown.launcher import DownloadForceAcknowledge from toontown.building import Elevator from toontown.toontowngui import TTDialog diff --git a/toontown/safezone/OZSafeZoneLoader.py b/toontown/safezone/OZSafeZoneLoader.py index a92ce51..0e3df16 100644 --- a/toontown/safezone/OZSafeZoneLoader.py +++ b/toontown/safezone/OZSafeZoneLoader.py @@ -40,7 +40,7 @@ class OZSafeZoneLoader(SafeZoneLoader): self.done = 0 self.geyserTrack = None SafeZoneLoader.load(self) - self.birdSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) + self.birdSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) self.underwaterSound = base.loader.loadSfx('phase_4/audio/sfx/AV_ambient_water.mp3') self.swimSound = base.loader.loadSfx('phase_4/audio/sfx/AV_swim_single_stroke.mp3') self.submergeSound = base.loader.loadSfx('phase_5.5/audio/sfx/AV_jump_in_water.mp3') @@ -198,7 +198,7 @@ class OZSafeZoneLoader(SafeZoneLoader): base.holder = holder toonPos = av.getPos(render) toonHpr = av.getHpr(render) - print 'av Pos %s' % av.getPos() + print('av Pos %s' % av.getPos()) base.toonPos = toonPos holder.setPos(toonPos) av.reparentTo(holder) @@ -210,7 +210,7 @@ class OZSafeZoneLoader(SafeZoneLoader): lookIn = Vec3(0 + lookAt, -30, 0) else: lookIn = Vec3(360 + lookAt, -30, 0) - print 'Camera Hprs toon %s; lookIn %s; final %s' % (newHpr, lookIn, lookIn - newHpr) + print('Camera Hprs toon %s; lookIn %s; final %s' % (newHpr, lookIn, lookIn - newHpr)) if local == 1: camPosOriginal = camera.getPos() camHprOriginal = camera.getHpr() @@ -272,7 +272,7 @@ class OZSafeZoneLoader(SafeZoneLoader): def doPrint(self, thing): return 0 - print thing + print(thing) def unload(self): del self.birdSound @@ -335,7 +335,7 @@ class OZSafeZoneLoader(SafeZoneLoader): return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId def enterGolfCourse(self, requestStatus): - if requestStatus.has_key('curseId'): + if 'curseId' in requestStatus: self.golfCourseId = requestStatus['courseId'] else: self.golfCourseId = 0 @@ -347,7 +347,7 @@ class OZSafeZoneLoader(SafeZoneLoader): del self.golfCourseId def handleRaceOver(self): - print 'you done!!' + print('you done!!') def handleLeftGolf(self): req = {'loader': 'safeZoneLoader', @@ -379,5 +379,5 @@ class OZSafeZoneLoader(SafeZoneLoader): keyList.append(key) for key in keyList: - if self.__toonTracks.has_key(key): + if key in self.__toonTracks: self.clearToonTrack(key) diff --git a/toontown/safezone/OZTreasurePlannerAI.py b/toontown/safezone/OZTreasurePlannerAI.py index ea0f77f..3b34a3f 100644 --- a/toontown/safezone/OZTreasurePlannerAI.py +++ b/toontown/safezone/OZTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedOZTreasureAI +from . import RegenTreasurePlannerAI, DistributedOZTreasureAI class OZTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/safezone/Playground.py b/toontown/safezone/Playground.py index 51753f0..93328d6 100644 --- a/toontown/safezone/Playground.py +++ b/toontown/safezone/Playground.py @@ -304,7 +304,7 @@ class Playground(Place.Place): lines = LineSegs() lines.setColor(1, 0, 0, 1) from toontown.classicchars import CCharPaths - for name, pointDef in paths.items(): + for name, pointDef in list(paths.items()): self.showDebugPointText(name, pointDef[0]) for connectTo in pointDef[1]: toDef = paths[connectTo] @@ -408,7 +408,7 @@ class Playground(Place.Place): elif ds == 'incomplete': self.fsm.request('DFAReject') else: - self.notify.error('Unknown done status for DownloadForceAcknowledge: ' + `doneStatus`) + self.notify.error('Unknown done status for DownloadForceAcknowledge: ' + repr(doneStatus)) def enterHFA(self, requestStatus): self.acceptOnce(self.hfaDoneEvent, self.enterHFACallback, [requestStatus]) @@ -432,7 +432,7 @@ class Playground(Place.Place): elif doneStatus['mode'] == 'incomplete': self.fsm.request('HFAReject') else: - self.notify.error('Unknown done status for HealthForceAcknowledge: ' + `doneStatus`) + self.notify.error('Unknown done status for HealthForceAcknowledge: ' + repr(doneStatus)) def enterHFAReject(self): self.fsm.request('walk') @@ -456,7 +456,7 @@ class Playground(Place.Place): elif doneStatus['mode'] == 'incomplete': self.fsm.request('NPCFAReject') else: - self.notify.error('Unknown done status for NPCForceAcknowledge: ' + `doneStatus`) + self.notify.error('Unknown done status for NPCForceAcknowledge: ' + repr(doneStatus)) def enterNPCFAReject(self): self.fsm.request('walk') diff --git a/toontown/safezone/PublicWalk.py b/toontown/safezone/PublicWalk.py index 4951f1e..8adba1b 100644 --- a/toontown/safezone/PublicWalk.py +++ b/toontown/safezone/PublicWalk.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal -import Walk +from . import Walk class PublicWalk(Walk.Walk): notify = DirectNotifyGlobal.directNotify.newCategory('PublicWalk') diff --git a/toontown/safezone/RegenTreasurePlannerAI.py b/toontown/safezone/RegenTreasurePlannerAI.py index 72b5d32..f7da0ca 100644 --- a/toontown/safezone/RegenTreasurePlannerAI.py +++ b/toontown/safezone/RegenTreasurePlannerAI.py @@ -3,7 +3,7 @@ from direct.showbase import DirectObject from direct.directnotify import DirectNotifyGlobal from direct.task import Task import random -import TreasurePlannerAI +from . import TreasurePlannerAI class RegenTreasurePlannerAI(TreasurePlannerAI.TreasurePlannerAI): notify = DirectNotifyGlobal.directNotify.newCategory('RegenTreasurePlannerAI') diff --git a/toontown/safezone/SafeZoneLoader.py b/toontown/safezone/SafeZoneLoader.py index 6d459dd..3e5fd62 100644 --- a/toontown/safezone/SafeZoneLoader.py +++ b/toontown/safezone/SafeZoneLoader.py @@ -84,7 +84,7 @@ class SafeZoneLoader(StateData.StateData): npl = self.geom.findAllMatches('**/=DNARoot=holiday_prop') for i in range(npl.getNumPaths()): np = npl.getPath(i) - np.setTag('transformIndex', `i`) + np.setTag('transformIndex', repr(i)) self.holidayPropTransforms[i] = np.getNetTransform() self.geom.flattenMedium() @@ -234,7 +234,7 @@ class SafeZoneLoader(StateData.StateData): return def deleteAnimatedProps(self): - for zoneNode, animPropList in self.animPropDict.items(): + for zoneNode, animPropList in list(self.animPropDict.items()): for animProp in animPropList: animProp.delete() diff --git a/toontown/safezone/TTPlayground.py b/toontown/safezone/TTPlayground.py index ebad592..eed2c71 100644 --- a/toontown/safezone/TTPlayground.py +++ b/toontown/safezone/TTPlayground.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals -import Playground +from . import Playground import random from toontown.launcher import DownloadForceAcknowledge from direct.task.Task import Task diff --git a/toontown/safezone/TTSafeZoneLoader.py b/toontown/safezone/TTSafeZoneLoader.py index cc0eeea..0e18af7 100644 --- a/toontown/safezone/TTSafeZoneLoader.py +++ b/toontown/safezone/TTSafeZoneLoader.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * -import SafeZoneLoader -import TTPlayground +from . import SafeZoneLoader +from . import TTPlayground import random from toontown.launcher import DownloadForceAcknowledge @@ -16,7 +16,7 @@ class TTSafeZoneLoader(SafeZoneLoader.SafeZoneLoader): def load(self): SafeZoneLoader.SafeZoneLoader.load(self) - self.birdSound = map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3']) + self.birdSound = list(map(base.loader.loadSfx, ['phase_4/audio/sfx/SZ_TC_bird1.mp3', 'phase_4/audio/sfx/SZ_TC_bird2.mp3', 'phase_4/audio/sfx/SZ_TC_bird3.mp3'])) def unload(self): del self.birdSound diff --git a/toontown/safezone/TTTreasurePlannerAI.py b/toontown/safezone/TTTreasurePlannerAI.py index 85cf3b4..ad129ce 100644 --- a/toontown/safezone/TTTreasurePlannerAI.py +++ b/toontown/safezone/TTTreasurePlannerAI.py @@ -1,5 +1,5 @@ from toontown.toonbase.ToontownGlobals import * -import RegenTreasurePlannerAI, DistributedTTTreasureAI +from . import RegenTreasurePlannerAI, DistributedTTTreasureAI class TTTreasurePlannerAI(RegenTreasurePlannerAI.RegenTreasurePlannerAI): diff --git a/toontown/shtiker/DirectNewsFrame.py b/toontown/shtiker/DirectNewsFrame.py index 088b009..0c89a9c 100644 --- a/toontown/shtiker/DirectNewsFrame.py +++ b/toontown/shtiker/DirectNewsFrame.py @@ -354,12 +354,12 @@ class DirectNewsFrame(DirectObject.DirectObject): cacheIndexFilename = Filename(self.newsDir, self.CacheIndexFilename) try: file = open(cacheIndexFilename.toOsSpecific(), 'w') - except IOError, e: + except IOError as e: self.notify.warning('error opening news cache file %s: %s' % (cacheIndexFilename, str(e))) return - for filename, (size, date) in self.newsCache.items(): - print >> file, '%s\t%s\t%s' % (filename, size, date) + for filename, (size, date) in list(self.newsCache.items()): + print('%s\t%s\t%s' % (filename, size, date), file=file) def handleNewIssueOut(self): if hasattr(self, 'createdTime') and base.cr.inGameNewsMgr.getLatestIssue() < self.createdTime: diff --git a/toontown/shtiker/DisguisePage.py b/toontown/shtiker/DisguisePage.py index bc485bf..37ed60e 100644 --- a/toontown/shtiker/DisguisePage.py +++ b/toontown/shtiker/DisguisePage.py @@ -1,4 +1,4 @@ -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals diff --git a/toontown/shtiker/EventsPage.py b/toontown/shtiker/EventsPage.py index 8c2cebf..31ae4d7 100644 --- a/toontown/shtiker/EventsPage.py +++ b/toontown/shtiker/EventsPage.py @@ -1,4 +1,4 @@ -import urllib +import urllib.request, urllib.parse, urllib.error from pandac.PandaModules import Vec4, Vec3, TextNode, PNMImage, StringStream, Texture, HTTPClient, DocumentSpec, Ramfile, Point3 from direct.task.Task import Task from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DirectCheckButton, OnscreenText @@ -14,7 +14,7 @@ from toontown.parties.CalendarGuiMonth import CalendarGuiMonth from toontown.parties.PartyUtils import getPartyActivityIcon from toontown.parties.Party import Party from toontown.parties.ServerTimeGui import ServerTimeGui -import ShtikerPage +from . import ShtikerPage EventsPage_Host = 0 EventsPage_Invited = 1 EventsPage_Calendar = 2 @@ -675,7 +675,7 @@ class EventsPage(ShtikerPage.ShtikerPage): def makeButton(itemName, itemNum, *extraArgs): def buttonCommand(): - print itemName, itemNum + print(itemName, itemNum) return DirectLabel(text=itemName, relief=None, text_align=TextNode.ALeft, scale=0.06) @@ -770,7 +770,7 @@ class EventsPage(ShtikerPage.ShtikerPage): self.articleImages = {} self.articleText = {} try: - urlfile = urllib.urlopen(self.getNewsUrl()) + urlfile = urllib.request.urlopen(self.getNewsUrl()) except IOError: self.notify.warning('Could not open %s' % self.getNewsUrl()) self.newsStatusLabel['text'] = TTLocalizer.EventsPageNewsUnavailable @@ -779,14 +779,14 @@ class EventsPage(ShtikerPage.ShtikerPage): urlStrings = urlfile.read() urlfile.close() urls = urlStrings.split('\r\n') - for index in xrange(len(urls) / 2): + for index in range(len(urls) / 2): imageUrl = urls[index * 2] textUrl = urls[index * 2 + 1] img = PNMImage() self.articleImages[index] = img try: self.notify.info('opening %s' % imageUrl) - imageFile = urllib.urlopen(imageUrl) + imageFile = urllib.request.urlopen(imageUrl) data = imageFile.read() img.read(StringStream(data)) imageFile.close() @@ -797,7 +797,7 @@ class EventsPage(ShtikerPage.ShtikerPage): self.articleText[index] = text try: self.notify.info('opening %s' % textUrl) - textFile = urllib.urlopen(textUrl) + textFile = urllib.request.urlopen(textUrl) data = textFile.read() data = data.replace('\\1', '\x01') data = data.replace('\\2', '\x02') @@ -1007,7 +1007,7 @@ class EventsPage(ShtikerPage.ShtikerPage): result = True urlStrings = '' try: - urlfile = urllib.urlopen(fileUrl) + urlfile = urllib.request.urlopen(fileUrl) urlStrings = urlfile.read() urlfile.close() except IOError: diff --git a/toontown/shtiker/FishPage.py b/toontown/shtiker/FishPage.py index e341ff3..f5d17bf 100644 --- a/toontown/shtiker/FishPage.py +++ b/toontown/shtiker/FishPage.py @@ -1,5 +1,5 @@ from toontown.toonbase import ToontownGlobals -import ShtikerPage +from . import ShtikerPage from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * @@ -86,7 +86,7 @@ class FishPage(ShtikerPage.ShtikerPage): self.trophies = [] hOffset = -0.5 vOffset = 0.4 - for level, trophyDesc in FishGlobals.TrophyDict.items(): + for level, trophyDesc in list(FishGlobals.TrophyDict.items()): trophy = FishingTrophy(-1) trophy.nameLabel['text'] = trophyDesc[0] trophy.reparentTo(self.trophyFrame) diff --git a/toontown/shtiker/GardenPage.py b/toontown/shtiker/GardenPage.py index 2a72aaa..bcebd92 100644 --- a/toontown/shtiker/GardenPage.py +++ b/toontown/shtiker/GardenPage.py @@ -1,5 +1,5 @@ from direct.directnotify import DirectNotifyGlobal -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer @@ -197,7 +197,7 @@ class GardenPage(ShtikerPage.ShtikerPage): self.specialsInfo['text'] = GardenGlobals.Specials[entry[0]]['description'] self.selectedSpecial = type specialInfo = GardenGlobals.Specials[entry[0]] - if specialInfo.has_key('useFromShtiker') and specialInfo['useFromShtiker']: + if 'useFromShtiker' in specialInfo and specialInfo['useFromShtiker']: self.useSpecialButton.show() else: self.useSpecialButton.hide() @@ -230,7 +230,7 @@ class GardenPage(ShtikerPage.ShtikerPage): self.trophies = [] hOffset = -0.5 vOffset = 0.4 - for level, trophyDesc in GardenGlobals.TrophyDict.items(): + for level, trophyDesc in list(GardenGlobals.TrophyDict.items()): trophy = GardenTrophy(-1) trophy.nameLabel['text'] = trophyDesc[0] trophy.reparentTo(self.trophyFrame) @@ -261,7 +261,7 @@ class GardenPage(ShtikerPage.ShtikerPage): 0.1), borderWidth=(0.025, 0.025), scale=0.45, frameColor=(0.8, 0.8, 0.7, 1), barColor=(0.4, 0.6, 1.0, 1), range=self.barLength + self.FUDGE_FACTOR, value=self.barLength * 0.5 + self.FUDGE_FACTOR, text=' ' + TTLocalizer.Laff, text_scale=0.11, text_fg=(0.05, 0.14, 0.2, 1), text_align=TextNode.ALeft, text_pos=(-0.57, -0.035)) def unload(self): - print 'gardenPage Unloading' + print('gardenPage Unloading') if hasattr(self, 'specialsPhoto'): del self.specialsPhoto if hasattr(self, 'trophies'): @@ -302,7 +302,7 @@ class GardenPage(ShtikerPage.ShtikerPage): self.wateringCanBar['text'] = textToUse self.wateringCanBar['value'] = float(curWateringCanSkill) / float(maxWateringCanSkill) * self.barLength + self.FUDGE_FACTOR else: - print 'no shovel bar' + print('no shovel bar') if self.mode == GardenPage_Collection: if hasattr(self, 'browser'): self.browser.update() diff --git a/toontown/shtiker/GolfPage.py b/toontown/shtiker/GolfPage.py index 35e4096..95a3023 100644 --- a/toontown/shtiker/GolfPage.py +++ b/toontown/shtiker/GolfPage.py @@ -6,7 +6,7 @@ from direct.task import Task from toontown.fishing.FishPhoto import DirectRegion from toontown.shtiker.ShtikerPage import ShtikerPage from toontown.toonbase import ToontownGlobals, TTLocalizer -from FishPage import FishingTrophy +from .FishPage import FishingTrophy from toontown.golf import GolfGlobals if (__debug__): import pdb @@ -83,7 +83,7 @@ class GolfPage(ShtikerPage): self.recordsTab['state'] = DGG.NORMAL self.trophyTab['state'] = DGG.DISABLED else: - raise StandardError, 'GolfPage::setMode - Invalid Mode %s' % mode + raise Exception('GolfPage::setMode - Invalid Mode %s' % mode) self.updatePage() def updatePage(self): @@ -94,7 +94,7 @@ class GolfPage(ShtikerPage): self.golfTrophies.show() self.golfRecords.hide() else: - raise StandardError, 'GolfPage::updatePage - Invalid Mode %s' % self.mode + raise Exception('GolfPage::updatePage - Invalid Mode %s' % self.mode) class GolfingRecordsUI(DirectFrame): @@ -161,16 +161,16 @@ class GolfingRecordsUI(DirectFrame): bestHoles = self.avatar.getGolfHoleBest() bestCourses = self.avatar.getGolfCourseBest() if bestHoles != self.lastHoleBest or bestCourses != self.lastCourseBest: - numCourse = len(GolfGlobals.CourseInfo.keys()) - numHoles = len(GolfGlobals.HoleInfo.keys()) - for i in xrange(numCourse): + numCourse = len(list(GolfGlobals.CourseInfo.keys())) + numHoles = len(list(GolfGlobals.HoleInfo.keys())) + for i in range(numCourse): score = bestCourses[i] if score != 0: self.bestDisplayList[i]['text'] = (str(score),) else: self.bestDisplayList[i]['text'] = TTLocalizer.KartRace_Unraced - for i in xrange(numHoles): + for i in range(numHoles): score = bestHoles[i] if score != 0: self.bestDisplayList[i + numCourse]['text'] = str(score) @@ -182,7 +182,7 @@ class GolfingRecordsUI(DirectFrame): DirectFrame.show(self) def regenerateScrollList(self): - print '### regen scroll' + print('### regen scroll') selectedIndex = 0 if self.scrollList: selectedIndex = self.scrollList.getSelectedIndex() diff --git a/toontown/shtiker/HtmlView.py b/toontown/shtiker/HtmlView.py index ab300f6..e05228e 100644 --- a/toontown/shtiker/HtmlView.py +++ b/toontown/shtiker/HtmlView.py @@ -38,14 +38,14 @@ class HtmlView(DirectObject): else: GlobalWebcore = AwWebCore(AwWebCore.LOGVERBOSE, True, AwWebCore.PFBGRA) GlobalWebcore.setBaseDirectory('.') - for errResponse in xrange(400, 600): + for errResponse in range(400, 600): GlobalWebcore.setCustomResponsePage(errResponse, 'error.html') self.webView = GlobalWebcore.createWebView(WEB_WIDTH, WEB_HEIGHT, self.transparency, False, 70) frameName = '' inGameNewsUrl = self.getInGameNewsUrl() self.imgBuffer = array.array('B') - for i in xrange(WEB_WIDTH * WEB_HEIGHT): + for i in range(WEB_WIDTH * WEB_HEIGHT): self.imgBuffer.append(0) self.imgBuffer.append(0) self.imgBuffer.append(0) @@ -53,14 +53,14 @@ class HtmlView(DirectObject): if self.useHalfTexture: self.leftBuffer = array.array('B') - for i in xrange(WEB_HALF_WIDTH * WEB_HEIGHT): + for i in range(WEB_HALF_WIDTH * WEB_HEIGHT): self.leftBuffer.append(0) self.leftBuffer.append(0) self.leftBuffer.append(0) self.leftBuffer.append(255) self.rightBuffer = array.array('B') - for i in xrange(WEB_HALF_WIDTH * WEB_HEIGHT): + for i in range(WEB_HALF_WIDTH * WEB_HEIGHT): self.rightBuffer.append(0) self.rightBuffer.append(0) self.rightBuffer.append(0) diff --git a/toontown/shtiker/InventoryPage.py b/toontown/shtiker/InventoryPage.py index 49c2b83..84bb903 100644 --- a/toontown/shtiker/InventoryPage.py +++ b/toontown/shtiker/InventoryPage.py @@ -1,4 +1,4 @@ -import ShtikerPage +from . import ShtikerPage from toontown.toonbase import ToontownBattleGlobals from direct.gui.DirectGui import * from pandac.PandaModules import * diff --git a/toontown/shtiker/IssueFrame.py b/toontown/shtiker/IssueFrame.py index 8687761..11eee88 100644 --- a/toontown/shtiker/IssueFrame.py +++ b/toontown/shtiker/IssueFrame.py @@ -186,7 +186,7 @@ class IssueFrame(DirectFrame): image_scale = float(desiredXSize) / xSize image_scale *= float(69) / 70 self.sectionBtns = [] - for section in xrange(1, len(self.SectionIdents)): + for section in range(1, len(self.SectionIdents)): image = self.gui.find('**/%s' % buttonNames[section]) rolloverImage = self.gui.find('**/%s' % rolloverButtonNames[section]) if image.isEmpty(): @@ -310,7 +310,7 @@ class IssueFrame(DirectFrame): frameSize2, frameSize2) self.sectionBtns = [] - for section in xrange(0, len(self.SectionIdents)): + for section in range(0, len(self.SectionIdents)): image = self.guiNav.find('**/%s' % buttonNames[section]) rolloverImage = self.guiNav.find('**/%s' % rolloverButtonNames[section]) if image.isEmpty(): diff --git a/toontown/shtiker/KartPage.py b/toontown/shtiker/KartPage.py index 0deb99f..a5bc99f 100644 --- a/toontown/shtiker/KartPage.py +++ b/toontown/shtiker/KartPage.py @@ -9,7 +9,7 @@ from toontown.racing.Kart import Kart from toontown.racing import RaceGlobals from toontown.shtiker.ShtikerPage import ShtikerPage from toontown.toonbase import ToontownGlobals, TTLocalizer -from FishPage import FishingTrophy +from .FishPage import FishingTrophy if (__debug__): import pdb PageMode = PythonUtil.Enum('Customize, Records, Trophy') @@ -93,7 +93,7 @@ class KartPage(ShtikerPage): self.recordsTab['state'] = DGG.NORMAL self.trophyTab['state'] = DGG.DISABLED else: - raise StandardError, 'KartPage::setMode - Invalid Mode %s' % mode + raise Exception('KartPage::setMode - Invalid Mode %s' % mode) self.updatePage() def updatePage(self): @@ -110,7 +110,7 @@ class KartPage(ShtikerPage): self.racingTrophies.show() self.racingRecords.hide() else: - raise StandardError, 'KartPage::updatePage - Invalid Mode %s' % self.mode + raise Exception('KartPage::updatePage - Invalid Mode %s' % self.mode) class KartCustomizeUI(DirectFrame): @@ -344,7 +344,7 @@ class ItemSelector(DirectFrame): def setUpdatedDNA(self): currKartDNA = self.avatar.getKartDNA() - for i in xrange(len(self.updatedDNA)): + for i in range(len(self.updatedDNA)): if self.updatedDNA[i] != currKartDNA[i]: self.avatar.requestKartDNAFieldUpdate(i, self.updatedDNA[i]) @@ -622,11 +622,11 @@ class ItemSelector(DirectFrame): return def destroy(self): - for key in self.buttonDict.keys(): + for key in list(self.buttonDict.keys()): self.buttonDict[key].destroy() del self.buttonDict[key] - for key in self.itemViewers.keys(): + for key in list(self.itemViewers.keys()): self.itemViewers[key].destroy() del self.itemViewers[key] @@ -697,7 +697,7 @@ class ItemSelector(DirectFrame): self.__changeItemCategory(self.state) def resetAccessoryIcons(self): - for key in self.buttonDict.keys(): + for key in list(self.buttonDict.keys()): self.buttonDict[key].setProp('state', DGG.NORMAL) self.itemViewers['main'].show() @@ -742,7 +742,7 @@ class ItemSelector(DirectFrame): self.itemViewers['main'].setViewerText(TTLocalizer.KartShtikerSelect) self.itemViewers['main'].setupViewer(buttonType) else: - raise StandardError, 'KartPage.py::__changeItemCategory - INVALID Category Type!' + raise Exception('KartPage.py::__changeItemCategory - INVALID Category Type!') if self.state != buttonType and self.state != InvalidEntry: self.buttonDict[self.state]['state'] = DGG.NORMAL self.buttonDict[self.state].setColorScale(1, 1, 1, 1) @@ -829,8 +829,8 @@ class KartViewer(DirectFrame): self.kart = None if not hasattr(self, 'kartDisplayRegion'): self.kartDisplayRegion = DirectRegion(parent=self) - apply(self.kartDisplayRegion.setBounds, self.bounds) - apply(self.kartDisplayRegion.setColor, self.colors) + self.kartDisplayRegion.setBounds(*self.bounds) + self.kartDisplayRegion.setColor(*self.colors) frame = self.kartDisplayRegion.load() if self.dna: self.kart = Kart() diff --git a/toontown/shtiker/MapPage.py b/toontown/shtiker/MapPage.py index e022839..3bab03a 100644 --- a/toontown/shtiker/MapPage.py +++ b/toontown/shtiker/MapPage.py @@ -1,4 +1,4 @@ -import ShtikerPage +from . import ShtikerPage from toontown.toonbase import ToontownGlobals from direct.showbase import PythonUtil from otp.otpbase import PythonUtil as OTPPythonUtil diff --git a/toontown/shtiker/NPCFriendPage.py b/toontown/shtiker/NPCFriendPage.py index db3ff09..a12f0cc 100644 --- a/toontown/shtiker/NPCFriendPage.py +++ b/toontown/shtiker/NPCFriendPage.py @@ -1,4 +1,4 @@ -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toon import NPCFriendPanel diff --git a/toontown/shtiker/NewbiePurchaseManager.py b/toontown/shtiker/NewbiePurchaseManager.py index f4b48f5..94a9a01 100644 --- a/toontown/shtiker/NewbiePurchaseManager.py +++ b/toontown/shtiker/NewbiePurchaseManager.py @@ -1,4 +1,4 @@ -import PurchaseManager +from . import PurchaseManager from toontown.quest import QuestParser from toontown.toon import NPCToons diff --git a/toontown/shtiker/NewbiePurchaseManagerAI.py b/toontown/shtiker/NewbiePurchaseManagerAI.py index 6d8cc66..bab8ac3 100644 --- a/toontown/shtiker/NewbiePurchaseManagerAI.py +++ b/toontown/shtiker/NewbiePurchaseManagerAI.py @@ -1,4 +1,4 @@ -import PurchaseManagerAI +from . import PurchaseManagerAI class NewbiePurchaseManagerAI(PurchaseManagerAI.PurchaseManagerAI): diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index 449e58a..41afdfe 100644 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -1,11 +1,11 @@ from pandac.PandaModules import * from libotp import * -import ShtikerPage +from . import ShtikerPage from toontown.toontowngui import TTDialog from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import DisplaySettingsDialog +from . import DisplaySettingsDialog from direct.task import Task from otp.speedchat import SpeedChat from otp.speedchat import SCColorScheme @@ -114,7 +114,7 @@ class OptionsPage(ShtikerPage.ShtikerPage): self.codesTab['state'] = DGG.DISABLED self.codesTabPage.enter() else: - raise StandardError, 'OptionsPage::setMode - Invalid Mode %s' % mode + raise Exception('OptionsPage::setMode - Invalid Mode %s' % mode) class OptionsTabPage(DirectFrame): diff --git a/toontown/shtiker/PhotoAlbumPage.py b/toontown/shtiker/PhotoAlbumPage.py index 6b0923f..24cf619 100644 --- a/toontown/shtiker/PhotoAlbumPage.py +++ b/toontown/shtiker/PhotoAlbumPage.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import TTLocalizer @@ -89,7 +89,7 @@ class PhotoAlbumPage(ShtikerPage.ShtikerPage): def renameDialog(self, str): separator = '_' validChars = string.letters + string.digits + ' -' - str = filter(lambda s: s in validChars, str) + str = [s for s in str if s in validChars] if not str: self.renameCleanup() return 0 @@ -124,7 +124,7 @@ class PhotoAlbumPage(ShtikerPage.ShtikerPage): chatEntry = base.localAvatar.chatMgr.chatInputNormal.chatEntry chatEntry['backgroundFocus'] = 0 self.renameEntry['focus'] = 1 - print self.selectedFileName + print(self.selectedFileName) def deleteConfirm(self): os.remove(self.selectedFileName) @@ -192,7 +192,7 @@ class PhotoAlbumPage(ShtikerPage.ShtikerPage): def updateScrollList(self): newPhotos = self.getPhotos() - for photo in self.photos.keys(): + for photo in list(self.photos.keys()): if photo not in newPhotos: photoButton = self.photos[photo] self.scrollList.removeItem(photoButton) @@ -200,13 +200,13 @@ class PhotoAlbumPage(ShtikerPage.ShtikerPage): del self.photos[photo] for photo in newPhotos: - if not self.photos.has_key(photo): + if photo not in self.photos: photoButton = self.makePhotoButton(photo) self.scrollList.addItem(photoButton) self.photos[photo] = photoButton - if self.photos.keys(): - self.chosePhoto(self.photos.keys()[0]) + if list(self.photos.keys()): + self.chosePhoto(list(self.photos.keys())[0]) else: self.chosePhoto(None) return diff --git a/toontown/shtiker/PurchaseManager.py b/toontown/shtiker/PurchaseManager.py index 6707bfd..c67e8eb 100644 --- a/toontown/shtiker/PurchaseManager.py +++ b/toontown/shtiker/PurchaseManager.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -from PurchaseManagerConstants import * +from .PurchaseManagerConstants import * from direct.distributed.ClockDelta import * from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal diff --git a/toontown/shtiker/PurchaseManagerAI.py b/toontown/shtiker/PurchaseManagerAI.py index 8f932e9..ac5e33d 100644 --- a/toontown/shtiker/PurchaseManagerAI.py +++ b/toontown/shtiker/PurchaseManagerAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * from direct.distributed.ClockDelta import * -from PurchaseManagerConstants import * +from .PurchaseManagerConstants import * import copy from direct.task.Task import Task from direct.distributed import DistributedObjectAI @@ -50,7 +50,7 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI): if avId <= 3: self.playerStates[i] = PURCHASE_NO_CLIENT_STATE self.playersReported[i] = PURCHASE_CANTREPORT_STATE - elif self.air.doId2do.has_key(avId): + elif avId in self.air.doId2do: if avId not in self.getInvolvedPlayerIds(): self.playerStates[i] = PURCHASE_EXIT_STATE self.playersReported[i] = PURCHASE_REPORTED_STATE @@ -62,7 +62,7 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI): self.playersReported[i] = PURCHASE_CANTREPORT_STATE for avId in self.getInvolvedPlayerIds(): - if avId > 3 and self.air.doId2do.has_key(avId): + if avId > 3 and avId in self.air.doId2do: self.acceptOnce(self.air.getAvatarExitEvent(avId), self.__handleUnexpectedExit, extraArgs=[avId]) av = self.air.doId2do[avId] avIndex = self.findAvIndex(avId) @@ -143,7 +143,7 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI): self.air.writeServerEvent('suspicious', avId, 'PurchaseManager.requestExit: unknown avatar: %s' % (avId,)) return if self.receivingButtons: - if self.air.doId2do.has_key(avId): + if avId in self.air.doId2do: av = self.air.doId2do[avId] if avIndex == None: self.air.writeServerEvent('suspicious', avId, 'PurchaseManager.requestExit not on list') @@ -176,7 +176,7 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI): self.air.writeServerEvent('suspicious', avId, 'PurchaseManager.requestPlayAgain: unknown avatar') return if self.receivingButtons: - if self.air.doId2do.has_key(avId): + if avId in self.air.doId2do: av = self.air.doId2do[avId] avIndex = self.findAvIndex(avId) if avIndex == None: @@ -208,7 +208,7 @@ class PurchaseManagerAI(DistributedObjectAI.DistributedObjectAI): def setInventory(self, blob, newMoney, done): avId = self.air.getAvatarIdFromSender() if self.receivingInventory: - if self.air.doId2do.has_key(avId): + if avId in self.air.doId2do: av = self.air.doId2do[avId] avIndex = self.findAvIndex(avId) if avIndex == None: diff --git a/toontown/shtiker/QuestPage.py b/toontown/shtiker/QuestPage.py index 1df830a..0b90c5e 100644 --- a/toontown/shtiker/QuestPage.py +++ b/toontown/shtiker/QuestPage.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.quest import Quests @@ -100,17 +100,17 @@ class QuestPage(ShtikerPage.ShtikerPage): else: self.questFrames[i].hide() - for index, questDesc in self.quests.items(): + for index, questDesc in list(self.quests.items()): if questDesc is not None and list(questDesc) not in newQuests: self.clearQuestFrame(index) for questDesc in newQuests: newQuestDesc = tuple(questDesc) - if newQuestDesc not in self.quests.values(): + if newQuestDesc not in list(self.quests.values()): index = self.getLowestUnusedIndex() self.fillQuestFrame(newQuestDesc, index) - for i, questDesc in self.quests.iteritems(): + for i, questDesc in self.quests.items(): if questDesc: if self.canDeleteQuest(questDesc): self.questFrames[i].setDeleteCallback(self.__deleteQuest) diff --git a/toontown/shtiker/ShardPage.py b/toontown/shtiker/ShardPage.py index 00ee82f..01063d2 100644 --- a/toontown/shtiker/ShardPage.py +++ b/toontown/shtiker/ShardPage.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ShtikerPage +from . import ShtikerPage from direct.task.Task import Task from direct.gui.DirectGui import * from pandac.PandaModules import * @@ -223,7 +223,7 @@ class ShardPage(ShtikerPage.ShtikerPage): buttonTuple[1]['state'] = DGG.NORMAL buttonTuple[2]['state'] = DGG.NORMAL - for shardId, buttonTuple in self.shardButtonMap.items(): + for shardId, buttonTuple in list(self.shardButtonMap.items()): if shardId not in currentMap: buttonTuple[0].destroy() del self.shardButtonMap[shardId] diff --git a/toontown/shtiker/ShtikerBook.py b/toontown/shtiker/ShtikerBook.py index 5bc2445..ffab316 100644 --- a/toontown/shtiker/ShtikerBook.py +++ b/toontown/shtiker/ShtikerBook.py @@ -90,7 +90,7 @@ class ShtikerBook(DirectFrame, StateData.StateData): self.pages[self.currPageIndex].exit() base.render.show() setBlackBackground = 0 - for obj in base.cr.doId2do.values(): + for obj in list(base.cr.doId2do.values()): if isinstance(obj, DistributedFireworkShow.DistributedFireworkShow) or isinstance(obj, DistributedPartyFireworksActivity.DistributedPartyFireworksActivity): setBlackBackground = 1 diff --git a/toontown/shtiker/ShtikerPage.py b/toontown/shtiker/ShtikerPage.py index 6a48845..f09ffa9 100644 --- a/toontown/shtiker/ShtikerPage.py +++ b/toontown/shtiker/ShtikerPage.py @@ -1,4 +1,4 @@ -import ShtikerBook +from . import ShtikerBook from direct.fsm import StateData from direct.gui.DirectGui import * from pandac.PandaModules import * diff --git a/toontown/shtiker/SuitPage.py b/toontown/shtiker/SuitPage.py index 9a0583d..64976a5 100644 --- a/toontown/shtiker/SuitPage.py +++ b/toontown/shtiker/SuitPage.py @@ -1,6 +1,6 @@ -import ShtikerPage +from . import ShtikerPage from direct.task.Task import Task -import SummonCogDialog +from . import SummonCogDialog from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals @@ -8,7 +8,7 @@ from toontown.toonbase import TTLocalizer from toontown.suit import SuitDNA from toontown.suit import Suit from toontown.battle import SuitBattleGlobals -from CogPageGlobals import * +from .CogPageGlobals import * SCALE_FACTOR = 1.5 RADAR_DELAY = 0.2 BUILDING_RADAR_POS = (0.375, @@ -267,11 +267,11 @@ class SuitPage(ShtikerPage.ShtikerPage): def grow(self, panel, pos): if self.bigPanel: - print 'setting next panel - ' + str(panel) + print('setting next panel - ' + str(panel)) self.nextPanel = panel self.nextPanelPos = pos return - print 'big panel - ' + str(panel) + print('big panel - ' + str(panel)) self.bigPanel = panel panel.reparentTo(self.enlargedPanelNode) panel.setScale(panel.getScale() * SCALE_FACTOR) @@ -280,11 +280,11 @@ class SuitPage(ShtikerPage.ShtikerPage): panel.summonButton['state'] = DGG.NORMAL def shrink(self, panel, pos): - print 'trying to shrink - ' + str(panel) + print('trying to shrink - ' + str(panel)) if panel != self.bigPanel: self.nextPanel = None return - print 'shrink panel - ' + str(panel) + print('shrink panel - ' + str(panel)) self.bigPanel = None panel.setScale(panel.scale) panel.reparentTo(self.panelNode) @@ -491,11 +491,11 @@ class SuitPage(ShtikerPage.ShtikerPage): def updateCogStatus(self, dept, type, status): if dept < 0 or dept > len(SuitDNA.suitDepts): - print 'ucs: bad cog dept: ', dept + print('ucs: bad cog dept: ', dept) elif type < 0 or type > SuitDNA.suitsPerDept: - print 'ucs: bad cog type: ', type + print('ucs: bad cog type: ', type) elif status < COG_UNSEEN or status > COG_COMPLETE2: - print 'ucs: bad status: ', status + print('ucs: bad status: ', status) else: self.resetPanel(dept, type) panel = self.panels[dept * SuitDNA.suitsPerDept + type] diff --git a/toontown/shtiker/TIPPage.py b/toontown/shtiker/TIPPage.py index 630b8f1..24c3e7d 100644 --- a/toontown/shtiker/TIPPage.py +++ b/toontown/shtiker/TIPPage.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toon import NPCToons diff --git a/toontown/shtiker/TrackPage.py b/toontown/shtiker/TrackPage.py index 57693e0..8e05946 100644 --- a/toontown/shtiker/TrackPage.py +++ b/toontown/shtiker/TrackPage.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -import ShtikerPage +from . import ShtikerPage from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.quest import Quests diff --git a/toontown/speedchat/TTSCAprilToonsMenu.py b/toontown/speedchat/TTSCAprilToonsMenu.py index f2c6e71..fbdd8df 100644 --- a/toontown/speedchat/TTSCAprilToonsMenu.py +++ b/toontown/speedchat/TTSCAprilToonsMenu.py @@ -47,7 +47,7 @@ class TTSCAprilToonsMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link April Toons phrase %s which does not seem to exist' % phrase + print('warning: tried to link April Toons phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -55,7 +55,7 @@ class TTSCAprilToonsMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link April Toons phrase %s which does not seem to exist' % phrase + print('warning: tried to link April Toons phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCBoardingMenu.py b/toontown/speedchat/TTSCBoardingMenu.py index de84ae7..a3846e5 100644 --- a/toontown/speedchat/TTSCBoardingMenu.py +++ b/toontown/speedchat/TTSCBoardingMenu.py @@ -50,12 +50,12 @@ class TTSCBoardingMenu(SCMenu): except: return - for count in xrange(len(BoardingMenuGuide)): + for count in range(len(BoardingMenuGuide)): section = BoardingMenuGuide[count] if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link boarding phrase %s which does not seem to exist' % phrase + print('warning: tried to link boarding phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -64,7 +64,7 @@ class TTSCBoardingMenu(SCMenu): phrases = ZoneIdsToMsgs[zoneId][count] for phrase in phrases: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link boarding phrase %s which does not seem to exist' % phrase + print('warning: tried to link boarding phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCDecoders.py b/toontown/speedchat/TTSCDecoders.py index 2bd89c3..8180c4c 100644 --- a/toontown/speedchat/TTSCDecoders.py +++ b/toontown/speedchat/TTSCDecoders.py @@ -1,2 +1,2 @@ -from TTSCToontaskTerminal import decodeTTSCToontaskMsg -from TTSCResistanceTerminal import decodeTTSCResistanceMsg +from .TTSCToontaskTerminal import decodeTTSCToontaskMsg +from .TTSCResistanceTerminal import decodeTTSCResistanceMsg diff --git a/toontown/speedchat/TTSCGolfMenu.py b/toontown/speedchat/TTSCGolfMenu.py index c300af1..7f8cd0f 100644 --- a/toontown/speedchat/TTSCGolfMenu.py +++ b/toontown/speedchat/TTSCGolfMenu.py @@ -52,7 +52,7 @@ class TTSCGolfMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link golf phrase %s which does not seem to exist' % phrase + print('warning: tried to link golf phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -60,7 +60,7 @@ class TTSCGolfMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link golf phrase %s which does not seem to exist' % phrase + print('warning: tried to link golf phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCHalloweenMenu.py b/toontown/speedchat/TTSCHalloweenMenu.py index f55a9e3..ea34848 100644 --- a/toontown/speedchat/TTSCHalloweenMenu.py +++ b/toontown/speedchat/TTSCHalloweenMenu.py @@ -28,7 +28,7 @@ class TTSCHalloweenMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Halloween phrase %s which does not seem to exist' % phrase + print('warning: tried to link Halloween phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -36,7 +36,7 @@ class TTSCHalloweenMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Halloween phrase %s which does not seem to exist' % phrase + print('warning: tried to link Halloween phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCIdesOfMarchMenu.py b/toontown/speedchat/TTSCIdesOfMarchMenu.py index d3f802c..8abb43a 100644 --- a/toontown/speedchat/TTSCIdesOfMarchMenu.py +++ b/toontown/speedchat/TTSCIdesOfMarchMenu.py @@ -28,7 +28,7 @@ class TTSCIdesOfMarchMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link IdesOfMarch phrase %s which does not seem to exist' % phrase + print('warning: tried to link IdesOfMarch phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -36,7 +36,7 @@ class TTSCIdesOfMarchMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link IdesOfMarch phrase %s which does not seem to exist' % phrase + print('warning: tried to link IdesOfMarch phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCJellybeanJamMenu.py b/toontown/speedchat/TTSCJellybeanJamMenu.py index ec60150..b11ad1d 100644 --- a/toontown/speedchat/TTSCJellybeanJamMenu.py +++ b/toontown/speedchat/TTSCJellybeanJamMenu.py @@ -23,7 +23,7 @@ class TTSCJellybeanJamMenu(SCMenu): if phase in JellybeanJamPhases: self.__messagesChanged(phase) else: - print 'warning: tried to add Jellybean Jam phase %s which does not seem to exist' % phase + print('warning: tried to add Jellybean Jam phase %s which does not seem to exist' % phase) def destroy(self): SCMenu.destroy(self) @@ -42,7 +42,7 @@ class TTSCJellybeanJamMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Jellybean Jam phrase %s which does not seem to exist' % phrase + print('warning: tried to link Jellybean Jam phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -50,7 +50,7 @@ class TTSCJellybeanJamMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Jellybean Jam phrase %s which does not seem to exist' % phrase + print('warning: tried to link Jellybean Jam phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCKartRacingMenu.py b/toontown/speedchat/TTSCKartRacingMenu.py index 29a61d0..40deea5 100644 --- a/toontown/speedchat/TTSCKartRacingMenu.py +++ b/toontown/speedchat/TTSCKartRacingMenu.py @@ -90,7 +90,7 @@ class TTSCKartRacingMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link kart phrase %s which does not seem to exist' % phrase + print('warning: tried to link kart phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -98,7 +98,7 @@ class TTSCKartRacingMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link kart phrase %s which does not seem to exist' % phrase + print('warning: tried to link kart phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCResistanceMenu.py b/toontown/speedchat/TTSCResistanceMenu.py index ac03983..d68b273 100644 --- a/toontown/speedchat/TTSCResistanceMenu.py +++ b/toontown/speedchat/TTSCResistanceMenu.py @@ -2,7 +2,7 @@ from direct.showbase import PythonUtil from otp.speedchat.SCMenu import SCMenu from otp.speedchat.SCMenuHolder import SCMenuHolder from toontown.chat import ResistanceChat -from TTSCResistanceTerminal import TTSCResistanceTerminal +from .TTSCResistanceTerminal import TTSCResistanceTerminal class TTSCResistanceMenu(SCMenu): diff --git a/toontown/speedchat/TTSCSellbotFieldOfficeMenu.py b/toontown/speedchat/TTSCSellbotFieldOfficeMenu.py index 2579806..3a4d527 100644 --- a/toontown/speedchat/TTSCSellbotFieldOfficeMenu.py +++ b/toontown/speedchat/TTSCSellbotFieldOfficeMenu.py @@ -5,7 +5,7 @@ from otp.speedchat.SCStaticTextTerminal import SCStaticTextTerminal from toontown.speedchat.TTSCIndexedTerminal import TTSCIndexedTerminal from otp.otpbase import OTPLocalizer from toontown.cogdominium import CogdoInterior -SellbotFieldOfficeMenu = [(OTPLocalizer.SellbotFieldOfficeMenuSections[0], range(30404, 30409)), (OTPLocalizer.SellbotFieldOfficeMenuSections[1], range(30409, 30419))] +SellbotFieldOfficeMenu = [(OTPLocalizer.SellbotFieldOfficeMenuSections[0], list(range(30404, 30409))), (OTPLocalizer.SellbotFieldOfficeMenuSections[1], list(range(30409, 30419)))] class TTSCSellbotFieldOfficeMenu(SCMenu): @@ -31,7 +31,7 @@ class TTSCSellbotFieldOfficeMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase + print('warning: tried to link Winter phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -39,7 +39,7 @@ class TTSCSellbotFieldOfficeMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Halloween phrase %s which does not seem to exist' % phrase + print('warning: tried to link Halloween phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSellbotInvasionMenu.py b/toontown/speedchat/TTSCSellbotInvasionMenu.py index 8c00026..def6bc2 100644 --- a/toontown/speedchat/TTSCSellbotInvasionMenu.py +++ b/toontown/speedchat/TTSCSellbotInvasionMenu.py @@ -4,7 +4,7 @@ from otp.speedchat.SCMenuHolder import SCMenuHolder from otp.speedchat.SCStaticTextTerminal import SCStaticTextTerminal from toontown.speedchat.TTSCIndexedTerminal import TTSCIndexedTerminal from otp.otpbase import OTPLocalizer -SellbotInvasionMenu = [(OTPLocalizer.SellbotInvasionMenuSections[0], range(30400, 30404))] +SellbotInvasionMenu = [(OTPLocalizer.SellbotInvasionMenuSections[0], list(range(30400, 30404)))] class TTSCSellbotInvasionMenu(SCMenu): @@ -29,7 +29,7 @@ class TTSCSellbotInvasionMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase + print('warning: tried to link Winter phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -37,7 +37,7 @@ class TTSCSellbotInvasionMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Halloween phrase %s which does not seem to exist' % phrase + print('warning: tried to link Halloween phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSellbotNerfMenu.py b/toontown/speedchat/TTSCSellbotNerfMenu.py index 825a543..7a81491 100644 --- a/toontown/speedchat/TTSCSellbotNerfMenu.py +++ b/toontown/speedchat/TTSCSellbotNerfMenu.py @@ -51,7 +51,7 @@ class TTSCSellbotNerfMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Sellbot Nerf phrase %s which does not seem to exist' % phrase + print('warning: tried to link Sellbot Nerf phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -59,7 +59,7 @@ class TTSCSellbotNerfMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Sellbot Nerf phrase %s which does not seem to exist' % phrase + print('warning: tried to link Sellbot Nerf phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSillyPhaseFiveMenu.py b/toontown/speedchat/TTSCSillyPhaseFiveMenu.py index 2b86973..957d4fc 100644 --- a/toontown/speedchat/TTSCSillyPhaseFiveMenu.py +++ b/toontown/speedchat/TTSCSillyPhaseFiveMenu.py @@ -33,7 +33,7 @@ class TTSCSillyPhaseFiveMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseFive phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseFive phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -41,7 +41,7 @@ class TTSCSillyPhaseFiveMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseFive phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseFive phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSillyPhaseFourMenu.py b/toontown/speedchat/TTSCSillyPhaseFourMenu.py index c32afae..c4de52f 100644 --- a/toontown/speedchat/TTSCSillyPhaseFourMenu.py +++ b/toontown/speedchat/TTSCSillyPhaseFourMenu.py @@ -32,7 +32,7 @@ class TTSCSillyPhaseFourMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseFour phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseFour phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -40,7 +40,7 @@ class TTSCSillyPhaseFourMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseFour phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseFour phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSillyPhaseOneMenu.py b/toontown/speedchat/TTSCSillyPhaseOneMenu.py index 6eb3ac8..e12d81d 100644 --- a/toontown/speedchat/TTSCSillyPhaseOneMenu.py +++ b/toontown/speedchat/TTSCSillyPhaseOneMenu.py @@ -32,7 +32,7 @@ class TTSCSillyPhaseOneMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseOne phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseOne phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -40,7 +40,7 @@ class TTSCSillyPhaseOneMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseOne phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseOne phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSillyPhaseThreeMenu.py b/toontown/speedchat/TTSCSillyPhaseThreeMenu.py index 52672ba..2993720 100644 --- a/toontown/speedchat/TTSCSillyPhaseThreeMenu.py +++ b/toontown/speedchat/TTSCSillyPhaseThreeMenu.py @@ -37,7 +37,7 @@ class TTSCSillyPhaseThreeMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseThree phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseThree phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -45,7 +45,7 @@ class TTSCSillyPhaseThreeMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseThree phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseThree phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSillyPhaseTwoMenu.py b/toontown/speedchat/TTSCSillyPhaseTwoMenu.py index e4a25d9..9a7fb4e 100644 --- a/toontown/speedchat/TTSCSillyPhaseTwoMenu.py +++ b/toontown/speedchat/TTSCSillyPhaseTwoMenu.py @@ -34,7 +34,7 @@ class TTSCSillyPhaseTwoMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseTwo phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseTwo phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -42,7 +42,7 @@ class TTSCSillyPhaseTwoMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Silly PhaseTwo phrase %s which does not seem to exist' % phrase + print('warning: tried to link Silly PhaseTwo phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCSingingMenu.py b/toontown/speedchat/TTSCSingingMenu.py index ec001d1..99a59c0 100644 --- a/toontown/speedchat/TTSCSingingMenu.py +++ b/toontown/speedchat/TTSCSingingMenu.py @@ -1,7 +1,7 @@ from direct.showbase import PythonUtil from otp.speedchat.SCMenu import SCMenu from otp.speedchat.SCMenuHolder import SCMenuHolder -from TTSCSingingTerminal import TTSCSingingTerminal +from .TTSCSingingTerminal import TTSCSingingTerminal from otp.otpbase import OTPLocalizer SingingMenuGuide = [(OTPLocalizer.SingingMenuSections[0], [{9000: 25}, {9001: 26}, @@ -32,17 +32,17 @@ class TTSCSingingMenu(SCMenu): except: return - for count in xrange(len(SingingMenuGuide)): + for count in range(len(SingingMenuGuide)): section = SingingMenuGuide[count] if section[0] == -1: for phrase in section[1]: emote = None if type(phrase) == type({}): - item = phrase.keys()[0] + item = list(phrase.keys())[0] emote = phrase[item] phrase = item if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link a singing phrase %s which does not seem to exist' % phrase + print('warning: tried to link a singing phrase %s which does not seem to exist' % phrase) break terminal = TTSCSingingTerminal(phrase) if emote is not None: diff --git a/toontown/speedchat/TTSCToontaskMenu.py b/toontown/speedchat/TTSCToontaskMenu.py index 2e6ec68..24829b4 100644 --- a/toontown/speedchat/TTSCToontaskMenu.py +++ b/toontown/speedchat/TTSCToontaskMenu.py @@ -1,5 +1,5 @@ from otp.speedchat.SCMenu import SCMenu -from TTSCToontaskTerminal import TTSCToontaskTerminal +from .TTSCToontaskTerminal import TTSCToontaskTerminal from otp.speedchat.SCStaticTextTerminal import SCStaticTextTerminal from toontown.quest import Quests @@ -36,7 +36,7 @@ class TTSCToontaskMenu(SCMenu): msgs = q.getSCStrings(toNpcId, toonProgress) if type(msgs) != type([]): msgs = [msgs] - for i in xrange(len(msgs)): + for i in range(len(msgs)): addTerminal(TTSCToontaskTerminal(msgs[i], taskId, toNpcId, toonProgress, i)) needToontask = 1 diff --git a/toontown/speedchat/TTSCVictoryPartiesMenu.py b/toontown/speedchat/TTSCVictoryPartiesMenu.py index 4c89498..362af7e 100644 --- a/toontown/speedchat/TTSCVictoryPartiesMenu.py +++ b/toontown/speedchat/TTSCVictoryPartiesMenu.py @@ -41,7 +41,7 @@ class TTSCVictoryPartiesMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Victory Parties phrase %s which does not seem to exist' % phrase + print('warning: tried to link Victory Parties phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) @@ -49,7 +49,7 @@ class TTSCVictoryPartiesMenu(SCMenu): menu = SCMenu() for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Victory Parties phrase %s which does not seem to exist' % phrase + print('warning: tried to link Victory Parties phrase %s which does not seem to exist' % phrase) break menu.append(SCStaticTextTerminal(phrase)) diff --git a/toontown/speedchat/TTSCWinterMenu.py b/toontown/speedchat/TTSCWinterMenu.py index d2c0572..53578d3 100644 --- a/toontown/speedchat/TTSCWinterMenu.py +++ b/toontown/speedchat/TTSCWinterMenu.py @@ -38,16 +38,16 @@ class TTSCWinterMenu(SCMenu): if section[0] == -1: for phrase in section[1]: if phrase not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase + print('warning: tried to link Winter phrase %s which does not seem to exist' % phrase) break self.append(SCStaticTextTerminal(phrase)) else: menu = SCMenu() - for phrase in section[1].keys(): + for phrase in list(section[1].keys()): blatherTxt = section[1][phrase] if blatherTxt not in OTPLocalizer.SpeedChatStaticText: - print 'warning: tried to link Winter phrase %s which does not seem to exist' % phrase + print('warning: tried to link Winter phrase %s which does not seem to exist' % phrase) break menu.append(TTSCIndexedTerminal(OTPLocalizer.SpeedChatStaticText.get(phrase, None), blatherTxt)) diff --git a/toontown/speedchat/TTSpeedChatGlobals.py b/toontown/speedchat/TTSpeedChatGlobals.py index 21a588d..58780d8 100644 --- a/toontown/speedchat/TTSpeedChatGlobals.py +++ b/toontown/speedchat/TTSpeedChatGlobals.py @@ -1,2 +1,2 @@ -from TTSCToontaskTerminal import TTSCToontaskMsgEvent -from TTSCResistanceTerminal import TTSCResistanceMsgEvent +from .TTSCToontaskTerminal import TTSCToontaskMsgEvent +from .TTSCResistanceTerminal import TTSCResistanceMsgEvent diff --git a/toontown/speedchat/TTSpeedChatTypes.py b/toontown/speedchat/TTSpeedChatTypes.py index f32871b..c2a24dd 100644 --- a/toontown/speedchat/TTSpeedChatTypes.py +++ b/toontown/speedchat/TTSpeedChatTypes.py @@ -1,27 +1,27 @@ -from TTSCToontaskMenu import TTSCToontaskMenu -from TTSCFactoryMenu import TTSCFactoryMenu -from TTSCCogMenu import TTSCCogMenu +from .TTSCToontaskMenu import TTSCToontaskMenu +from .TTSCFactoryMenu import TTSCFactoryMenu +from .TTSCCogMenu import TTSCCogMenu if hasattr(base, 'wantPets') and base.wantPets: - from TTSCPetTrickMenu import TTSCPetTrickMenu -from TTSCPromotionalMenu import TTSCPromotionalMenu -from TTSCToontaskTerminal import TTSCToontaskTerminal -from TTSCResistanceMenu import TTSCResistanceMenu -from TTSCResistanceTerminal import TTSCResistanceTerminal -from TTSCKartRacingMenu import TTSCKartRacingMenu -from TTSCGolfMenu import TTSCGolfMenu -from TTSCBoardingMenu import TTSCBoardingMenu -from TTSCSingingMenu import TTSCSingingMenu -from TTSCAprilToonsMenu import TTSCAprilToonsMenu -from TTSCSillyPhaseOneMenu import TTSCSillyPhaseOneMenu -from TTSCSillyPhaseTwoMenu import TTSCSillyPhaseTwoMenu -from TTSCSillyPhaseThreeMenu import TTSCSillyPhaseThreeMenu -from TTSCSillyPhaseFourMenu import TTSCSillyPhaseFourMenu -from TTSCSillyPhaseFiveMenu import TTSCSillyPhaseFiveMenu -from TTSCVictoryPartiesMenu import TTSCVictoryPartiesMenu -from TTSCSellbotNerfMenu import TTSCSellbotNerfMenu -from TTSCJellybeanJamMenu import TTSCJellybeanJamMenu -from TTSCHalloweenMenu import TTSCHalloweenMenu -from TTSCWinterMenu import TTSCWinterMenu -from TTSCSellbotInvasionMenu import TTSCSellbotInvasionMenu -from TTSCSellbotFieldOfficeMenu import TTSCSellbotFieldOfficeMenu -from TTSCIdesOfMarchMenu import TTSCIdesOfMarchMenu + from .TTSCPetTrickMenu import TTSCPetTrickMenu +from .TTSCPromotionalMenu import TTSCPromotionalMenu +from .TTSCToontaskTerminal import TTSCToontaskTerminal +from .TTSCResistanceMenu import TTSCResistanceMenu +from .TTSCResistanceTerminal import TTSCResistanceTerminal +from .TTSCKartRacingMenu import TTSCKartRacingMenu +from .TTSCGolfMenu import TTSCGolfMenu +from .TTSCBoardingMenu import TTSCBoardingMenu +from .TTSCSingingMenu import TTSCSingingMenu +from .TTSCAprilToonsMenu import TTSCAprilToonsMenu +from .TTSCSillyPhaseOneMenu import TTSCSillyPhaseOneMenu +from .TTSCSillyPhaseTwoMenu import TTSCSillyPhaseTwoMenu +from .TTSCSillyPhaseThreeMenu import TTSCSillyPhaseThreeMenu +from .TTSCSillyPhaseFourMenu import TTSCSillyPhaseFourMenu +from .TTSCSillyPhaseFiveMenu import TTSCSillyPhaseFiveMenu +from .TTSCVictoryPartiesMenu import TTSCVictoryPartiesMenu +from .TTSCSellbotNerfMenu import TTSCSellbotNerfMenu +from .TTSCJellybeanJamMenu import TTSCJellybeanJamMenu +from .TTSCHalloweenMenu import TTSCHalloweenMenu +from .TTSCWinterMenu import TTSCWinterMenu +from .TTSCSellbotInvasionMenu import TTSCSellbotInvasionMenu +from .TTSCSellbotFieldOfficeMenu import TTSCSellbotFieldOfficeMenu +from .TTSCIdesOfMarchMenu import TTSCIdesOfMarchMenu diff --git a/toontown/suit/BossCog.py b/toontown/suit/BossCog.py index 35426cb..0c216dc 100644 --- a/toontown/suit/BossCog.py +++ b/toontown/suit/BossCog.py @@ -8,9 +8,9 @@ from direct.fsm import FSM from direct.fsm import State from toontown.toonbase import TTLocalizer from toontown.battle import BattleParticles -import Suit +from . import Suit from direct.task.Task import Task -import SuitDNA +from . import SuitDNA from toontown.battle import BattleProps from direct.showbase.PythonUtil import Functor import string @@ -535,7 +535,7 @@ class BossCog(Avatar.Avatar): self.raised = 1 elif anim == 'Fb_fall': ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), SoundInterval(self.deathSfx))) - elif isinstance(anim, types.StringType): + elif isinstance(anim, bytes): ival = ActorInterval(self, anim) else: ival = anim diff --git a/toontown/suit/DistributedBossCog.py b/toontown/suit/DistributedBossCog.py index 94f96bf..8e34a89 100644 --- a/toontown/suit/DistributedBossCog.py +++ b/toontown/suit/DistributedBossCog.py @@ -7,8 +7,8 @@ from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals from toontown.battle import BattleExperience from toontown.battle import BattleBase -import BossCog -import SuitDNA +from . import BossCog +from . import SuitDNA from toontown.coghq import CogDisguiseGlobals from direct.showbase import Transitions from toontown.hood import ZoneUtil @@ -171,27 +171,27 @@ class DistributedBossCog(DistributedAvatar.DistributedAvatar, BossCog.BossCog): self.activeIntervals[name] = interval def cleanupIntervals(self): - for interval in self.activeIntervals.values(): + for interval in list(self.activeIntervals.values()): interval.finish() DelayDelete.cleanupDelayDeletes(interval) self.activeIntervals = {} def clearInterval(self, name, finish = 1): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: ival = self.activeIntervals[name] if finish: ival.finish() else: ival.pause() - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: DelayDelete.cleanupDelayDeletes(ival) del self.activeIntervals[name] else: self.notify.debug('interval: %s already cleared' % name) def finishInterval(self, name): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: interval = self.activeIntervals[name] interval.finish() diff --git a/toontown/suit/DistributedBossCogAI.py b/toontown/suit/DistributedBossCogAI.py index 01bffa4..5d386c6 100644 --- a/toontown/suit/DistributedBossCogAI.py +++ b/toontown/suit/DistributedBossCogAI.py @@ -233,8 +233,8 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): def formatLaffLevels(self): try: - return map(lambda id: simbase.air.doId2do.get(id).getMaxHp(), self.involvedToons) - except Exception, e: + return [simbase.air.doId2do.get(id).getMaxHp() for id in self.involvedToons] + except Exception as e: self.notify.warning(e) return [] @@ -247,8 +247,8 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): else: return 0 - return map(hasSuit, self.involvedToons) - except Exception, e: + return list(map(hasSuit, self.involvedToons)) + except Exception as e: self.notify.warning(e) return [] @@ -562,7 +562,7 @@ class DistributedBossCogAI(DistributedAvatarAI.DistributedAvatarAI): return suits def generateSuits(self, battleNumber): - raise StandardError, 'generateSuits unimplemented' + raise Exception('generateSuits unimplemented') def handleRoundDone(self, battle, suits, activeSuits, toonIds, totalHp, deadSuits): totalMaxHp = 0 diff --git a/toontown/suit/DistributedBossbotBoss.py b/toontown/suit/DistributedBossbotBoss.py index 736a27f..6c35aa0 100644 --- a/toontown/suit/DistributedBossbotBoss.py +++ b/toontown/suit/DistributedBossbotBoss.py @@ -178,7 +178,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): if belt: belt.cleanup() - for spot in self.golfSpots.values(): + for spot in list(self.golfSpots.values()): if spot: spot.cleanup() @@ -543,7 +543,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def calcNotDeadList(self): if not self.notDeadList: self.notDeadList = [] - for tableIndex in xrange(len(self.tables)): + for tableIndex in range(len(self.tables)): table = self.tables[tableIndex] tableInfo = table.getNotDeadInfo() self.notDeadList += tableInfo @@ -581,7 +581,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def enterBattleThree(self): self.cleanupIntervals() self.calcNotDeadList() - for table in self.tables.values(): + for table in list(self.tables.values()): table.setAllDinersToSitNeutral() self.battleANode.setPosHpr(*ToontownGlobals.DinerBattleAPosHpr) @@ -1230,7 +1230,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def getToonTableIndex(self, toonId): tableIndex = -1 - for table in self.tables.values(): + for table in list(self.tables.values()): if table.avId == toonId: tableIndex = table.index break @@ -1239,7 +1239,7 @@ class DistributedBossbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def getToonGolfSpotIndex(self, toonId): golfSpotIndex = -1 - for golfSpot in self.golfSpots.values(): + for golfSpot in list(self.golfSpots.values()): if golfSpot.avId == toonId: golfSpotIndex = golfSpot.index break diff --git a/toontown/suit/DistributedBossbotBossAI.py b/toontown/suit/DistributedBossbotBossAI.py index ea9dafc..cd9a6a2 100644 --- a/toontown/suit/DistributedBossbotBossAI.py +++ b/toontown/suit/DistributedBossbotBossAI.py @@ -207,7 +207,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS def createFoodBelts(self): if self.foodBelts: return - for i in xrange(2): + for i in range(2): newBelt = DistributedFoodBeltAI.DistributedFoodBeltAI(self.air, self, i) self.foodBelts.append(newBelt) newBelt.generateWithRequired(self.zoneId) @@ -227,7 +227,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS self.numTables = diffInfo[0] self.numDinersPerTable = diffInfo[1] dinerLevel = diffInfo[2] - for i in xrange(self.numTables): + for i in range(self.numTables): newTable = DistributedBanquetTableAI.DistributedBanquetTableAI(self.air, self, i, self.numDinersPerTable, dinerLevel) self.tables.append(newTable) newTable.generateWithRequired(self.zoneId) @@ -268,7 +268,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS grantRequest = False else: if ( - beltIndex, foodNum) not in self.toonFoodStatus.values(): + beltIndex, foodNum) not in list(self.toonFoodStatus.values()): if avId not in self.toonFoodStatus: grantRequest = True elif self.toonFoodStatus[avId] == None: @@ -328,7 +328,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS def generateDinerSuits(self): diners = [] - for i in xrange(len(self.notDeadList)): + for i in range(len(self.notDeadList)): if simbase.config.GetBool('bossbot-boss-cheat', 0): suit = self.__genSuitObject(self.zoneId, 2, 'c', 2, 0) else: @@ -339,7 +339,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS diners.append((suit, 100)) active = [] - for i in xrange(2): + for i in range(2): if simbase.config.GetBool('bossbot-boss-cheat', 0): suit = self.__genSuitObject(self.zoneId, 2, 'c', 2, 0) else: @@ -506,7 +506,7 @@ class DistributedBossbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS def createGolfSpots(self): if self.golfSpots: return - for i in xrange(self.numGolfSpots): + for i in range(self.numGolfSpots): newGolfSpot = DistributedGolfSpotAI.DistributedGolfSpotAI(self.air, self, i) self.golfSpots.append(newGolfSpot) newGolfSpot.generateWithRequired(self.zoneId) diff --git a/toontown/suit/DistributedCashbotBoss.py b/toontown/suit/DistributedCashbotBoss.py index b898e11..5e5a618 100644 --- a/toontown/suit/DistributedCashbotBoss.py +++ b/toontown/suit/DistributedCashbotBoss.py @@ -2,10 +2,10 @@ from direct.interval.IntervalGlobal import * from direct.task.TaskManagerGlobal import * from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import TTLocalizer -import DistributedBossCog +from . import DistributedBossCog from direct.task.Task import Task -import DistributedCashbotBossGoon -import SuitDNA +from . import DistributedCashbotBossGoon +from . import SuitDNA from toontown.toon import Toon from toontown.toon import ToonDNA from direct.fsm import FSM @@ -156,7 +156,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): goon.request('Off') def __showFakeGoons(self, state): - print self.fakeGoons + print(self.fakeGoons) if self.fakeGoons: for goon in self.fakeGoons: goon.request(state) @@ -382,7 +382,7 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): VBase3(231, 0, 0)]] mainGoon = self.fakeGoons[0] goonLoop = Parallel() - print self.fakeGoons + print(self.fakeGoons) for i in range(1, self.numFakeGoons): goon = self.fakeGoons[i] goonLoop.append(Sequence(goon.posHprInterval(8, goonPosHprs[i][0], goonPosHprs[i][1]), goon.posHprInterval(8, goonPosHprs[i][2], goonPosHprs[i][3]))) @@ -594,17 +594,17 @@ class DistributedCashbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): goon.b_destroyGoon() def deactivateCranes(self): - for crane in self.cranes.values(): + for crane in list(self.cranes.values()): crane.demand('Free') def hideBattleThreeObjects(self): for goon in self.goons: goon.demand('Off') - for safe in self.safes.values(): + for safe in list(self.safes.values()): safe.demand('Off') - for crane in self.cranes.values(): + for crane in list(self.cranes.values()): crane.demand('Off') def __doPhysics(self, task): diff --git a/toontown/suit/DistributedCashbotBossAI.py b/toontown/suit/DistributedCashbotBossAI.py index f62c4c8..6b20075 100644 --- a/toontown/suit/DistributedCashbotBossAI.py +++ b/toontown/suit/DistributedCashbotBossAI.py @@ -213,16 +213,16 @@ class DistributedCashbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS treasure.d_setReject() def __recycleTreasure(self, treasure): - if self.grabbingTreasures.has_key(treasure.doId): + if treasure.doId in self.grabbingTreasures: del self.grabbingTreasures[treasure.doId] self.recycledTreasures.append(treasure) def deleteAllTreasures(self): - for treasure in self.treasures.values(): + for treasure in list(self.treasures.values()): treasure.requestDelete() self.treasures = {} - for treasure in self.grabbingTreasures.values(): + for treasure in list(self.grabbingTreasures.values()): taskMgr.remove(treasure.uniqueName('recycleTreasure')) treasure.requestDelete() diff --git a/toontown/suit/DistributedCashbotBossGoon.py b/toontown/suit/DistributedCashbotBossGoon.py index d87e5b0..07bb339 100644 --- a/toontown/suit/DistributedCashbotBossGoon.py +++ b/toontown/suit/DistributedCashbotBossGoon.py @@ -3,13 +3,13 @@ from direct.interval.IntervalGlobal import * from direct.task.TaskManagerGlobal import * from direct.distributed.ClockDelta import * from direct.directnotify import DirectNotifyGlobal -import GoonGlobals +from . import GoonGlobals from direct.task.Task import Task from toontown.toonbase import ToontownGlobals from otp.otpbase import OTPGlobals from toontown.coghq import DistributedCashbotBossObject from direct.showbase import PythonUtil -import DistributedGoon +from . import DistributedGoon class DistributedCashbotBossGoon(DistributedGoon.DistributedGoon, DistributedCashbotBossObject.DistributedCashbotBossObject): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCashbotBossGoon') diff --git a/toontown/suit/DistributedCashbotBossGoonAI.py b/toontown/suit/DistributedCashbotBossGoonAI.py index 1bd123c..f45f173 100644 --- a/toontown/suit/DistributedCashbotBossGoonAI.py +++ b/toontown/suit/DistributedCashbotBossGoonAI.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.task.TaskManagerGlobal import * from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * -import GoonGlobals +from . import GoonGlobals from direct.task.Task import Task from toontown.toonbase import ToontownGlobals from otp.otpbase import OTPGlobals diff --git a/toontown/suit/DistributedFactorySuit.py b/toontown/suit/DistributedFactorySuit.py index 39cc715..53bc743 100644 --- a/toontown/suit/DistributedFactorySuit.py +++ b/toontown/suit/DistributedFactorySuit.py @@ -3,7 +3,7 @@ from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.directnotify import DirectNotifyGlobal -import DistributedSuitBase +from . import DistributedSuitBase from direct.task.Task import Task import random from toontown.toonbase import ToontownGlobals diff --git a/toontown/suit/DistributedFactorySuitAI.py b/toontown/suit/DistributedFactorySuitAI.py index 31d1bea..30f6714 100644 --- a/toontown/suit/DistributedFactorySuitAI.py +++ b/toontown/suit/DistributedFactorySuitAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from direct.directnotify import DirectNotifyGlobal from toontown.battle import SuitBattleGlobals -import DistributedSuitBaseAI, SuitDialog +from . import DistributedSuitBaseAI, SuitDialog from direct.showbase.PythonUtil import StackTrace class DistributedFactorySuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI): @@ -22,7 +22,7 @@ class DistributedFactorySuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI): if not self.factoryGone: try: self.setBattleCellIndex(None) - except Exception, e: + except Exception as e: simbase.air.writeServerEvent('avoid_crash', self.doId, 'DistributedFactorySuitAI.delete, factoryIsNotGone, got Exception %s' % str(e)) self.notify.warning('delete, factoryIsNotGone, got Exception %s' % str(e)) self.notify.warning('stackTrace=%s' % StackTrace().compact()) diff --git a/toontown/suit/DistributedGoon.py b/toontown/suit/DistributedGoon.py index f04febc..ad13f32 100644 --- a/toontown/suit/DistributedGoon.py +++ b/toontown/suit/DistributedGoon.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.battle.BattleProps import * -from GoonGlobals import * +from .GoonGlobals import * from direct.fsm import FSM from direct.distributed import ClockDelta from otp.level import BasicEntities @@ -10,10 +10,10 @@ from direct.directnotify import DirectNotifyGlobal from toontown.coghq import DistributedCrushableEntity from toontown.toonbase import ToontownGlobals from toontown.coghq import MovingPlatform -import Goon +from . import Goon from direct.task.Task import Task from otp.level import PathEntity -import GoonDeath +from . import GoonDeath import random class DistributedGoon(DistributedCrushableEntity.DistributedCrushableEntity, Goon.Goon, FSM.FSM): diff --git a/toontown/suit/DistributedGoonAI.py b/toontown/suit/DistributedGoonAI.py index 0ca48f7..d7803bc 100644 --- a/toontown/suit/DistributedGoonAI.py +++ b/toontown/suit/DistributedGoonAI.py @@ -1,9 +1,9 @@ from otp.ai.AIBaseGlobal import * -from GoonGlobals import * +from .GoonGlobals import * from direct.directnotify import DirectNotifyGlobal from toontown.battle import SuitBattleGlobals from toontown.coghq import DistributedCrushableEntityAI -import GoonPathData +from . import GoonPathData from direct.distributed import ClockDelta import random from direct.task import Task @@ -62,7 +62,7 @@ class DistributedGoonAI(DistributedCrushableEntityAI.DistributedCrushableEntityA if not hasattr(self.level, 'goonStunRequests'): self.level.goonStunRequests = {} if taskMgr.hasTaskNamed(self.taskName('GoonBombCheck')): - if self.level.goonStunRequests.has_key(avId): + if avId in self.level.goonStunRequests: self.level.goonStunRequests[avId] = self.level.goonStunRequests[avId] + 1 else: self.level.goonStunRequests[avId] = 1 diff --git a/toontown/suit/DistributedGridGoon.py b/toontown/suit/DistributedGridGoon.py index 476c232..6746618 100644 --- a/toontown/suit/DistributedGridGoon.py +++ b/toontown/suit/DistributedGridGoon.py @@ -2,7 +2,7 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.battle.BattleProps import * from direct.directnotify import DirectNotifyGlobal -import DistributedGoon +from . import DistributedGoon from toontown.toonbase import ToontownGlobals from toontown.coghq import MovingPlatform diff --git a/toontown/suit/DistributedGridGoonAI.py b/toontown/suit/DistributedGridGoonAI.py index 830a92b..7694883 100644 --- a/toontown/suit/DistributedGridGoonAI.py +++ b/toontown/suit/DistributedGridGoonAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from direct.directnotify import DirectNotifyGlobal from toontown.battle import SuitBattleGlobals -import DistributedGoonAI +from . import DistributedGoonAI from direct.task.Task import Task from toontown.coghq import DistributedCrushableEntityAI import random diff --git a/toontown/suit/DistributedLawbotBoss.py b/toontown/suit/DistributedLawbotBoss.py index 2161d83..5efbf65 100644 --- a/toontown/suit/DistributedLawbotBoss.py +++ b/toontown/suit/DistributedLawbotBoss.py @@ -12,9 +12,9 @@ from direct.fsm import State from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals -import DistributedBossCog +from . import DistributedBossCog from toontown.toonbase import TTLocalizer -import SuitDNA +from . import SuitDNA from toontown.toon import Toon from toontown.battle import BattleBase from direct.directutil import Mopath @@ -798,7 +798,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): for toonId in self.involvedToons: toon = self.cr.doId2do.get(toonId) if toon: - if self.cannons.has_key(index): + if index in self.cannons: cannon = self.cannons[index] cannonSeq = cannon.generateCannonAppearTrack(toon) multiCannons.append(cannonSeq) @@ -870,7 +870,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): self.juryTimer.destroy() del self.juryTimer self.juryTimer = None - for chair in self.chairs.values(): + for chair in list(self.chairs.values()): chair.stopCogsFlying() return @@ -1667,7 +1667,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): index = 0 self.involvedToons.sort() for toonId in self.involvedToons: - if self.cannons.has_key(index): + if index in self.cannons: cannon = self.cannons[index] toon = self.cr.doId2do.get(toonId) self.notify.debug('cannonId = %d' % cannon.doId) @@ -1724,7 +1724,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def countToonJurors(self): self.numToonJurorsSeated = 0 - for key in self.chairs.keys(): + for key in list(self.chairs.keys()): chair = self.chairs[key] if chair.state == 'ToonJuror' or chair.state == None and chair.newState == 'ToonJuror': self.numToonJurorsSeated += 1 @@ -1772,7 +1772,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): gotError = True if gotError: st = StackTrace() - print st + print(st) return chatString = TTLocalizer.LawbotBossTaunts[1] if tauntIndex == 0: @@ -1821,7 +1821,7 @@ class DistributedLawbotBoss(DistributedBossCog.DistributedBossCog, FSM.FSM): def numJurorsSeatedByCannon(self, cannonIndex): retVal = 0 - for chair in self.chairs.values(): + for chair in list(self.chairs.values()): if chair.state == 'ToonJuror': if chair.toonJurorIndex == cannonIndex: retVal += 1 diff --git a/toontown/suit/DistributedLawbotBossAI.py b/toontown/suit/DistributedLawbotBossAI.py index 41795a5..a24b457 100644 --- a/toontown/suit/DistributedLawbotBossAI.py +++ b/toontown/suit/DistributedLawbotBossAI.py @@ -1,9 +1,9 @@ from otp.ai.AIBaseGlobal import * from direct.distributed.ClockDelta import * -import DistributedBossCogAI +from . import DistributedBossCogAI from direct.directnotify import DirectNotifyGlobal from otp.avatar import DistributedAvatarAI -import DistributedSuitAI +from . import DistributedSuitAI from toontown.battle import BattleExperienceAI from direct.fsm import FSM from toontown.toonbase import ToontownGlobals @@ -33,7 +33,7 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM self.cannons = None self.chairs = None self.gavels = None - self.cagedToonNpcId = random.choice(NPCToons.npcFriends.keys()) + self.cagedToonNpcId = random.choice(list(NPCToons.npcFriends.keys())) self.bossMaxDamage = ToontownGlobals.LawbotBossMaxDamage self.recoverRate = 0 self.recoverStartTime = 0 @@ -387,14 +387,14 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM self.__deleteChairs() def getCannonBallsLeft(self, avId): - if self.cannonBallsLeft.has_key(avId): + if avId in self.cannonBallsLeft: return self.cannonBallsLeft[avId] else: self.notify.warning('getCannonBalsLeft invalid avId: %d' % avId) return 0 def decrementCannonBallsLeft(self, avId): - if self.cannonBallsLeft.has_key(avId): + if avId in self.cannonBallsLeft: self.cannonBallsLeft[avId] -= 1 if self.cannonBallsLeft[avId] < 0: self.notify.warning('decrementCannonBallsLeft <0 cannonballs for %d' % avId) @@ -661,8 +661,8 @@ class DistributedLawbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FSM foundOne = True break - possibleCogLevel = range(SuitDNA.suitsPerDept) - possibleDeptIndex = range(len(SuitDNA.suitDepts)) + possibleCogLevel = list(range(SuitDNA.suitsPerDept)) + possibleDeptIndex = list(range(len(SuitDNA.suitDepts))) possibleSummonType = ['single', 'building', 'invasion'] typeWeights = [ 'single'] * 70 + ['building'] * 27 + ['invasion'] * 3 diff --git a/toontown/suit/DistributedLawbotBossSuit.py b/toontown/suit/DistributedLawbotBossSuit.py index b4aaf8e..22281d4 100644 --- a/toontown/suit/DistributedLawbotBossSuit.py +++ b/toontown/suit/DistributedLawbotBossSuit.py @@ -3,7 +3,7 @@ from direct.interval.IntervalGlobal import * from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.directnotify import DirectNotifyGlobal -import DistributedSuitBase +from . import DistributedSuitBase from toontown.toonbase import ToontownGlobals from toontown.battle import MovieUtil @@ -271,19 +271,19 @@ class DistributedLawbotBossSuit(DistributedSuitBase.DistributedSuitBase): return model def cleanupIntervals(self): - for interval in self.activeIntervals.values(): + for interval in list(self.activeIntervals.values()): interval.finish() self.activeIntervals = {} def clearInterval(self, name, finish = 1): - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: ival = self.activeIntervals[name] if finish: ival.finish() else: ival.pause() - if self.activeIntervals.has_key(name): + if name in self.activeIntervals: del self.activeIntervals[name] else: self.notify.debug('interval: %s already cleared' % name) @@ -306,7 +306,7 @@ class DistributedLawbotBossSuit(DistributedSuitBase.DistributedSuitBase): def exitPreThrowProsecute(self): throwName = self.uniqueName('preThrowProsecute') - if self.activeIntervals.has_key(throwName): + if throwName in self.activeIntervals: self.activeIntervals[throwName].pause() del self.activeIntervals[throwName] @@ -324,7 +324,7 @@ class DistributedLawbotBossSuit(DistributedSuitBase.DistributedSuitBase): def exitPostThrowProsecute(self): throwName = self.uniqueName('postThrowProsecute') - if self.activeIntervals.has_key(throwName): + if throwName in self.activeIntervals: self.activeIntervals[throwName].finish() del self.activeIntervals[throwName] @@ -346,7 +346,7 @@ class DistributedLawbotBossSuit(DistributedSuitBase.DistributedSuitBase): def exitPreThrowAttack(self): throwName = self.uniqueName('preThrowAttack') - if self.activeIntervals.has_key(throwName): + if throwName in self.activeIntervals: self.activeIntervals[throwName].pause() del self.activeIntervals[throwName] @@ -368,7 +368,7 @@ class DistributedLawbotBossSuit(DistributedSuitBase.DistributedSuitBase): def exitPostThrowAttack(self): throwName = self.uniqueName('postThrowAttack') - if self.activeIntervals.has_key(throwName): + if throwName in self.activeIntervals: self.activeIntervals[throwName].finish() del self.activeIntervals[throwName] diff --git a/toontown/suit/DistributedSellbotBoss.py b/toontown/suit/DistributedSellbotBoss.py index b9825ec..868d3d4 100644 --- a/toontown/suit/DistributedSellbotBoss.py +++ b/toontown/suit/DistributedSellbotBoss.py @@ -11,9 +11,9 @@ from direct.fsm import State from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals -import DistributedBossCog +from . import DistributedBossCog from toontown.toonbase import TTLocalizer -import SuitDNA +from . import SuitDNA from toontown.toon import Toon from toontown.battle import BattleBase from direct.directutil import Mopath diff --git a/toontown/suit/DistributedSellbotBossAI.py b/toontown/suit/DistributedSellbotBossAI.py index 831cb86..8294faf 100644 --- a/toontown/suit/DistributedSellbotBossAI.py +++ b/toontown/suit/DistributedSellbotBossAI.py @@ -1,9 +1,9 @@ from otp.ai.AIBaseGlobal import * from direct.distributed.ClockDelta import * -import DistributedBossCogAI +from . import DistributedBossCogAI from direct.directnotify import DirectNotifyGlobal from otp.avatar import DistributedAvatarAI -import DistributedSuitAI +from . import DistributedSuitAI from toontown.battle import BattleExperienceAI from direct.fsm import FSM from toontown.toonbase import ToontownGlobals @@ -55,7 +55,7 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS def __setCagedToonNpcId(self): def npcFriendsMaxStars(stars): - return [ id for id in NPCToons.npcFriends.keys() if NPCToons.getNPCTrackLevelHpRarity(id)[3] <= stars ] + return [ id for id in list(NPCToons.npcFriends.keys()) if NPCToons.getNPCTrackLevelHpRarity(id)[3] <= stars ] if self.numRentalDiguises >= 4: self.cagedToonNpcId = random.choice(NPCToons.npcFriendsMinMaxStars(3, 3)) @@ -438,7 +438,7 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS def createEasyModeBarrels(self): self.barrels = [] - for entId, entDef in SellbotBossGlobals.BarrelDefs.iteritems(): + for entId, entDef in SellbotBossGlobals.BarrelDefs.items(): barrelType = entDef['type'] barrel = barrelType(self.air, entId) SellbotBossGlobals.setBarrelAttr(barrel, entId) diff --git a/toontown/suit/DistributedStageSuit.py b/toontown/suit/DistributedStageSuit.py index 4652a27..9bc3594 100644 --- a/toontown/suit/DistributedStageSuit.py +++ b/toontown/suit/DistributedStageSuit.py @@ -3,7 +3,7 @@ from toontown.suit.Suit import * from direct.directnotify import DirectNotifyGlobal from direct.actor import Actor from otp.avatar import Avatar -import SuitDNA +from . import SuitDNA from toontown.toonbase import ToontownGlobals from pandac.PandaModules import * from toontown.battle import SuitBattleGlobals diff --git a/toontown/suit/DistributedSuit.py b/toontown/suit/DistributedSuit.py index ca8cc97..6b917de 100644 --- a/toontown/suit/DistributedSuit.py +++ b/toontown/suit/DistributedSuit.py @@ -6,21 +6,21 @@ from direct.distributed.ClockDelta import * from direct.directtools.DirectGeometry import CLAMP from direct.task import Task from otp.avatar import DistributedAvatar -import Suit +from . import Suit from toontown.toonbase import ToontownGlobals from toontown.battle import DistributedBattle from direct.fsm import ClassicFSM, State from direct.fsm import State -import SuitTimings -import SuitBase -import DistributedSuitPlanner +from . import SuitTimings +from . import SuitBase +from . import DistributedSuitPlanner from direct.directnotify import DirectNotifyGlobal -import SuitDialog +from . import SuitDialog from toontown.battle import BattleProps from toontown.distributed.DelayDeletable import DelayDeletable import math import copy -import DistributedSuitBase +from . import DistributedSuitBase from otp.otpbase import OTPLocalizer import random STAND_OUTSIDE_DOOR = 2.5 @@ -256,15 +256,15 @@ class DistributedSuit(DistributedSuitBase.DistributedSuitBase, DelayDeletable): chug = globalClock.getRealTime() - now messageAge = now - globalClockDelta.networkToLocalTime(timestamp, now) if messageAge < -(chug + 0.5) or messageAge > chug + 1.0: - print 'Apparently out of sync with AI by %0.2f seconds. Suggest resync!' % messageAge + print('Apparently out of sync with AI by %0.2f seconds. Suggest resync!' % messageAge) return localElapsed = now - self.pathStartTime timeDiff = localElapsed - (elapsed + messageAge) if abs(timeDiff) > 0.2: - print "%s (%d) appears to be %0.2f seconds out of sync along its path. Suggest '~cogs sync'." % (self.getName(), self.getDoId(), timeDiff) + print("%s (%d) appears to be %0.2f seconds out of sync along its path. Suggest '~cogs sync'." % (self.getName(), self.getDoId(), timeDiff)) return if self.legList == None: - print "%s (%d) doesn't have a legList yet." % (self.getName(), self.getDoId()) + print("%s (%d) doesn't have a legList yet." % (self.getName(), self.getDoId())) return netPos = Point3(x, y, 0.0) leg = self.legList.getLeg(currentLeg) @@ -273,23 +273,23 @@ class DistributedSuit(DistributedSuitBase.DistributedSuitBase, DelayDeletable): calcDelta = Vec3(netPos - calcPos) diff = calcDelta.length() if diff > 4.0: - print '%s (%d) is %0.2f feet from the AI computed path!' % (self.getName(), self.getDoId(), diff) - print 'Probably your DNA files are out of sync.' + print('%s (%d) is %0.2f feet from the AI computed path!' % (self.getName(), self.getDoId(), diff)) + print('Probably your DNA files are out of sync.') return localPos = Point3(self.getX(), self.getY(), 0.0) localDelta = Vec3(netPos - localPos) diff = localDelta.length() if diff > 10.0: - print '%s (%d) in state %s is %0.2f feet from its correct position!' % (self.getName(), + print('%s (%d) in state %s is %0.2f feet from its correct position!' % (self.getName(), self.getDoId(), self.fsm.getCurrentState().getName(), - diff) - print 'Should be at (%0.2f, %0.2f), but is at (%0.2f, %0.2f).' % (x, + diff)) + print('Should be at (%0.2f, %0.2f), but is at (%0.2f, %0.2f).' % (x, y, localPos[0], - localPos[1]) + localPos[1])) return - print '%s (%d) is in the correct position.' % (self.getName(), self.getDoId()) + print('%s (%d) is in the correct position.' % (self.getName(), self.getDoId())) return def denyBattle(self): diff --git a/toontown/suit/DistributedSuitAI.py b/toontown/suit/DistributedSuitAI.py index 218288d..3895962 100644 --- a/toontown/suit/DistributedSuitAI.py +++ b/toontown/suit/DistributedSuitAI.py @@ -3,13 +3,13 @@ from pandac.PandaModules import * from libtoontown import * from direct.distributed.ClockDelta import * from otp.avatar import DistributedAvatarAI -import SuitTimings +from . import SuitTimings from direct.task import Task -import SuitPlannerBase, SuitBase, SuitDialog, SuitDNA +from . import SuitPlannerBase, SuitBase, SuitDialog, SuitDNA from direct.directnotify import DirectNotifyGlobal from toontown.battle import SuitBattleGlobals from toontown.building import FADoorCodes -import DistributedSuitBaseAI +from . import DistributedSuitBaseAI from toontown.hood import ZoneUtil import random @@ -194,7 +194,7 @@ class DistributedSuitAI(DistributedSuitBaseAI.DistributedSuitBaseAI): self.makeLegList() if self.notify.getDebug(): self.notify.debug('Leg list:') - print self.legList + print(self.legList) idx1 = self.startPoint.getIndex() idx2 = self.endPoint.getIndex() self.pathStartTime = globalClock.getFrameTime() diff --git a/toontown/suit/DistributedSuitBase.py b/toontown/suit/DistributedSuitBase.py index 45e21f7..13a366c 100644 --- a/toontown/suit/DistributedSuitBase.py +++ b/toontown/suit/DistributedSuitBase.py @@ -7,19 +7,19 @@ from direct.controls.ControlManager import CollisionHandlerRayStart from direct.task import Task from otp.otpbase import OTPGlobals from otp.avatar import DistributedAvatar -import Suit +from . import Suit from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals from toontown.toonbase import TTLocalizer from toontown.battle import DistributedBattle from direct.fsm import ClassicFSM from direct.fsm import State -import SuitTimings -import SuitBase -import DistributedSuitPlanner -import SuitDNA +from . import SuitTimings +from . import SuitBase +from . import DistributedSuitPlanner +from . import SuitDNA from direct.directnotify import DirectNotifyGlobal -import SuitDialog +from . import SuitDialog from toontown.battle import BattleProps import math import copy diff --git a/toontown/suit/DistributedSuitBaseAI.py b/toontown/suit/DistributedSuitBaseAI.py index 03719c2..3ca34dd 100644 --- a/toontown/suit/DistributedSuitBaseAI.py +++ b/toontown/suit/DistributedSuitBaseAI.py @@ -1,6 +1,6 @@ from otp.ai.AIBaseGlobal import * from otp.avatar import DistributedAvatarAI -import SuitPlannerBase, SuitBase, SuitDNA +from . import SuitPlannerBase, SuitBase, SuitDNA from direct.directnotify import DirectNotifyGlobal from toontown.battle import SuitBattleGlobals diff --git a/toontown/suit/DistributedSuitPlanner.py b/toontown/suit/DistributedSuitPlanner.py index 209fa34..18057ef 100644 --- a/toontown/suit/DistributedSuitPlanner.py +++ b/toontown/suit/DistributedSuitPlanner.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from direct.distributed import DistributedObject -import SuitPlannerBase +from . import SuitPlannerBase from toontown.toonbase import ToontownGlobals class DistributedSuitPlanner(DistributedObject.DistributedObject, SuitPlannerBase.SuitPlannerBase): @@ -59,7 +59,7 @@ class DistributedSuitPlanner(DistributedObject.DistributedObject, SuitPlannerBas cnode = CollisionNode('battleCells') cnode.setCollideMask(BitMask32.allOff()) - for zoneId, cellPos in self.battlePosDict.items(): + for zoneId, cellPos in list(self.battlePosDict.items()): cnode.addSolid(CollisionSphere(cellPos, 9)) text = '%s' % zoneId self.__makePathVizText(text, cellPos[0], cellPos[1], cellPos[2] + 9, (1, 1, 1, 1)) diff --git a/toontown/suit/DistributedSuitPlannerAI.py b/toontown/suit/DistributedSuitPlannerAI.py index 23b6fce..beeb7aa 100644 --- a/toontown/suit/DistributedSuitPlannerAI.py +++ b/toontown/suit/DistributedSuitPlannerAI.py @@ -1,13 +1,13 @@ from libtoontown import * from otp.ai.AIBaseGlobal import * from direct.distributed import DistributedObjectAI -import SuitPlannerBase, DistributedSuitAI +from . import SuitPlannerBase, DistributedSuitAI from toontown.battle import BattleManagerAI from direct.task import Task from direct.directnotify import DirectNotifyGlobal -import SuitDNA +from . import SuitDNA from toontown.battle import SuitBattleGlobals -import SuitTimings +from . import SuitTimings from toontown.toon import NPCToons from toontown.building import HQBuildingAI from toontown.hood import ZoneUtil @@ -92,7 +92,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if simbase.air.wantCogdominiums: if not hasattr(self.__class__, 'CogdoPopAdjusted'): self.__class__.CogdoPopAdjusted = True - for index in xrange(len(self.SuitHoodInfo)): + for index in range(len(self.SuitHoodInfo)): hoodInfo = self.SuitHoodInfo[index] hoodInfo[self.SUIT_HOOD_INFO_BMIN] = int(0.5 + self.CogdoPopFactor * hoodInfo[self.SUIT_HOOD_INFO_BMIN]) hoodInfo[self.SUIT_HOOD_INFO_BMAX] = int(0.5 + self.CogdoPopFactor * hoodInfo[self.SUIT_HOOD_INFO_BMAX]) @@ -186,7 +186,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan blockNumber = p.getLandmarkBuildingIndex() if p < 0: self.notify.warning('No landmark building for (%s) in zone %d' % (repr(p), self.zoneId)) - elif self.buildingFrontDoors.has_key(blockNumber): + elif blockNumber in self.buildingFrontDoors: self.notify.warning('Multiple front doors for building %d in zone %d' % (blockNumber, self.zoneId)) else: self.buildingFrontDoors[blockNumber] = p @@ -195,7 +195,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan blockNumber = p.getLandmarkBuildingIndex() if p < 0: self.notify.warning('No landmark building for (%s) in zone %d' % (repr(p), self.zoneId)) - elif self.buildingSideDoors.has_key(blockNumber): + elif blockNumber in self.buildingSideDoors: self.buildingSideDoors[blockNumber].append(p) else: self.buildingSideDoors[blockNumber] = [ @@ -205,14 +205,14 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if isinstance(bldg, HQBuildingAI.HQBuildingAI): continue blockNumber = bldg.getBlock()[0] - if not self.buildingFrontDoors.has_key(blockNumber): + if blockNumber not in self.buildingFrontDoors: self.notify.warning('No front door for building %d in zone %d' % (blockNumber, self.zoneId)) - if not self.buildingSideDoors.has_key(blockNumber): + if blockNumber not in self.buildingSideDoors: self.notify.warning('No side door for building %d in zone %d' % (blockNumber, self.zoneId)) def countNumSuitsPerTrack(self, count): for suit in self.suitList: - if count.has_key(suit.track): + if suit.track in count: count[suit.track] += 1 else: count[suit.track] = 1 @@ -221,7 +221,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if self.buildingMgr: for building in self.buildingMgr.getBuildings(): if building.isSuitBuilding(): - if count.has_key(building.track): + if building.track in count: count[building.track] += 1 else: count[building.track] = 1 @@ -231,14 +231,14 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan for building in self.buildingMgr.getBuildings(): if building.isSuitBuilding(): height = building.numFloors - 1 - if count.has_key(height): + if height in count: count[height] += 1 else: count[height] = 1 def formatNumSuitsPerTrack(self, count): result = ' ' - for track, num in count.items(): + for track, num in list(count.items()): result += ' %s:%d' % (track, num) return result[2:] @@ -269,7 +269,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan i -= 1 zoneName = self.dnaStore.getSuitEdgeZone(point.getIndex(), p.getIndex()) zoneId = int(self.extractGroupName(zoneName)) - if self.zoneIdToPointMap.has_key(zoneId): + if zoneId in self.zoneIdToPointMap: self.zoneIdToPointMap[zoneId].append(point) else: self.zoneIdToPointMap[zoneId] = [ @@ -279,7 +279,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan def getStreetPointsForBuilding(self, blockNumber): pointList = [] - if self.buildingSideDoors.has_key(blockNumber): + if blockNumber in self.buildingSideDoors: for doorPoint in self.buildingSideDoors[blockNumber]: points = self.dnaStore.getAdjacentPoints(doorPoint) i = points.getNumPoints() - 1 @@ -290,7 +290,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan pointList.append(point) i -= 1 - if self.buildingFrontDoors.has_key(blockNumber): + if blockNumber in self.buildingFrontDoors: doorPoint = self.buildingFrontDoors[blockNumber] points = self.dnaStore.getAdjacentPoints(doorPoint) i = points.getNumPoints() - 1 @@ -309,7 +309,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan while startPoint == None and len(blockNumbers) > 0: bn = random.choice(blockNumbers) blockNumbers.remove(bn) - if self.buildingSideDoors.has_key(bn): + if bn in self.buildingSideDoors: for doorPoint in self.buildingSideDoors[bn]: points = self.dnaStore.getAdjacentPoints(doorPoint) i = points.getNumPoints() - 1 @@ -449,21 +449,21 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if toonBlockTakeover != None: suit.attemptingTakeover = 1 blockNumber = toonBlockTakeover - if self.buildingFrontDoors.has_key(blockNumber): + if blockNumber in self.buildingFrontDoors: possibles.append((blockNumber, self.buildingFrontDoors[blockNumber])) elif suit.attemptingTakeover: for blockNumber in self.buildingMgr.getToonBlocks(): building = self.buildingMgr.getBuilding(blockNumber) extZoneId, intZoneId = building.getExteriorAndInteriorZoneId() if not NPCToons.isZoneProtected(intZoneId): - if self.buildingFrontDoors.has_key(blockNumber): + if blockNumber in self.buildingFrontDoors: possibles.append((blockNumber, self.buildingFrontDoors[blockNumber])) else: if self.buildingMgr: for blockNumber in self.buildingMgr.getSuitBlocks(): track = self.buildingMgr.getBuildingTrack(blockNumber) - if track == suit.track and self.buildingSideDoors.has_key(blockNumber): + if track == suit.track and blockNumber in self.buildingSideDoors: for doorPoint in self.buildingSideDoors[blockNumber]: possibles.append((blockNumber, doorPoint)) @@ -689,7 +689,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan actualSuitBuildings = 0 targetCogdos = 0 actualCogdos = 0 - for sp in self.air.suitPlanners.values(): + for sp in list(self.air.suitPlanners.values()): totalBuildings += len(sp.frontdoorPointList) targetSuitBuildings += sp.targetNumSuitBuildings targetCogdos += sp.targetNumCogdos @@ -707,7 +707,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan self.notify.debug('Want %d out of %d total suit buildings; we currently have %d assigned, %d actual.' % (wantedSuitBuildings, totalBuildings, targetSuitBuildings, actualSuitBuildings)) if actualSuitBuildings > 0: numReassigned = 0 - for sp in self.air.suitPlanners.values(): + for sp in list(self.air.suitPlanners.values()): if sp.buildingMgr: numBuildings = len(sp.buildingMgr.getSuitBlocks()) - len(sp.buildingMgr.getCogdoBlocks()) else: @@ -723,7 +723,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if simbase.air.wantCogdominiums: if actualCogdos > 0: numReassigned = 0 - for sp in self.air.suitPlanners.values(): + for sp in list(self.air.suitPlanners.values()): if sp.buildingMgr: numCogdos = len(sp.buildingMgr.getCogdoBlocks()) else: @@ -757,7 +757,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan totalWeightPerTrack = self.TOTAL_BWEIGHT_PER_TRACK[:] totalWeightPerHeight = self.TOTAL_BWEIGHT_PER_HEIGHT[:] numPerTrack = {'c': 0, 'l': 0, 'm': 0, 's': 0} - for sp in self.air.suitPlanners.values(): + for sp in list(self.air.suitPlanners.values()): sp.countNumBuildingsPerTrack(numPerTrack) numPerTrack['c'] += sp.pendingBuildingTracks.count('c') numPerTrack['l'] += sp.pendingBuildingTracks.count('l') @@ -765,7 +765,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan numPerTrack['s'] += sp.pendingBuildingTracks.count('s') numPerHeight = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0} - for sp in self.air.suitPlanners.values(): + for sp in list(self.air.suitPlanners.values()): sp.countNumBuildingsPerHeight(numPerHeight) numPerHeight[0] += sp.pendingBuildingHeights.count(0) numPerHeight[1] += sp.pendingBuildingHeights.count(1) @@ -817,7 +817,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan repeat = 0 currHoodInfo = self.chooseStreetWithPreference(hoodInfo, buildingTrackIndex, buildingHeight) zoneId = currHoodInfo[self.SUIT_HOOD_INFO_ZONE] - if self.air.suitPlanners.has_key(zoneId): + if zoneId in self.air.suitPlanners: sp = self.air.suitPlanners[zoneId] numCogdos = sp.targetNumCogdos numBldgs = sp.targetNumSuitBuildings @@ -871,7 +871,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan repeat = 0 currHoodInfo = self.chooseStreetNoPreference(hoodInfo, totalWeight) zoneId = currHoodInfo[self.SUIT_HOOD_INFO_ZONE] - if self.air.suitPlanners.has_key(zoneId): + if zoneId in self.air.suitPlanners: sp = self.air.suitPlanners[zoneId] numCogdos = sp.targetNumCogdos numBldgs = sp.targetNumSuitBuildings @@ -902,7 +902,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan return currHoodInfo = self.chooseStreetNoPreference(hoodInfo, totalWeight) zoneId = currHoodInfo[self.SUIT_HOOD_INFO_ZONE] - if self.air.suitPlanners.has_key(zoneId): + if zoneId in self.air.suitPlanners: sp = self.air.suitPlanners[zoneId] numCogdos = sp.targetNumCogdos numBldgs = sp.targetNumSuitBuildings @@ -931,7 +931,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan while 1: currHoodInfo = self.chooseStreetNoPreference(hoodInfo, totalWeight) zoneId = currHoodInfo[self.SUIT_HOOD_INFO_ZONE] - if self.air.suitPlanners.has_key(zoneId): + if zoneId in self.air.suitPlanners: sp = self.air.suitPlanners[zoneId] numCogdos = sp.targetNumCogdos numBldgs = sp.targetNumSuitBuildings @@ -1008,7 +1008,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan def requestBattle(self, zoneId, suit, toonId): self.notify.debug('requestBattle() - zone: %d suit: %d toon: %d' % (zoneId, suit.doId, toonId)) canonicalZoneId = ZoneUtil.getCanonicalZoneId(zoneId) - if not self.battlePosDict.has_key(canonicalZoneId): + if canonicalZoneId not in self.battlePosDict: return 0 toon = self.air.doId2do.get(toonId) if toon.getBattleId() > 0: @@ -1016,12 +1016,12 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan return 0 if toon: if hasattr(toon, 'doId'): - print ( - 'Setting toonID ', toonId) + print(( + 'Setting toonID ', toonId)) toon.b_setBattleId(toonId) pos = self.battlePosDict[canonicalZoneId] interactivePropTrackBonus = -1 - if simbase.config.GetBool('props-buff-battles', True) and self.cellToGagBonusDict.has_key(canonicalZoneId): + if simbase.config.GetBool('props-buff-battles', True) and canonicalZoneId in self.cellToGagBonusDict: tentativeBonusTrack = self.cellToGagBonusDict[canonicalZoneId] trackToHolidayDict = {ToontownBattleGlobals.SQUIRT_TRACK: ToontownGlobals.HYDRANTS_BUFF_BATTLES, ToontownBattleGlobals.THROW_TRACK: ToontownGlobals.MAILBOXES_BUFF_BATTLES, ToontownBattleGlobals.HEAL_TRACK: ToontownGlobals.TRASHCANS_BUFF_BATTLES} if tentativeBonusTrack in trackToHolidayDict: @@ -1108,10 +1108,10 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan return 1 def zoneChange(self, suit, oldZone, newZone=None): - if self.zoneInfo.has_key(oldZone) and suit in self.zoneInfo[oldZone]: + if oldZone in self.zoneInfo and suit in self.zoneInfo[oldZone]: self.zoneInfo[oldZone].remove(suit) if newZone != None: - if not self.zoneInfo.has_key(newZone): + if newZone not in self.zoneInfo: self.zoneInfo[newZone] = [] self.zoneInfo[newZone].append(suit) return @@ -1134,7 +1134,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan self.countNumBuildingsPerTrack(buildingDict) buildingList = [0, 0, 0, 0] for dept in SuitDNA.suitDepts: - if buildingDict.has_key(dept): + if dept in buildingDict: buildingList[SuitDNA.suitDepts.index(dept)] = buildingDict[dept] self.sendUpdateToAvatarId(self.air.getAvatarIdFromSender(), 'buildingListResponse', [buildingList]) @@ -1143,7 +1143,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan if level == None: level = random.choice(self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_LVL]) if type == None: - typeChoices = range(max(level - 4, 1), min(level, self.MAX_SUIT_TYPES) + 1) + typeChoices = list(range(max(level - 4, 1), min(level, self.MAX_SUIT_TYPES) + 1)) type = random.choice(typeChoices) else: level = min(max(level, type), type + 4) @@ -1179,4 +1179,4 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan header = '%s\n' % (cls.__name__,) header += ' %s/%s buildings, %s/%s cogdos\n' % (totalBldgs, targetTotalBldgs, totalCogdos, targetTotalCogdos) s = header + s - print s + print(s) diff --git a/toontown/suit/DistributedTutorialSuit.py b/toontown/suit/DistributedTutorialSuit.py index 6444be6..9d7ba46 100644 --- a/toontown/suit/DistributedTutorialSuit.py +++ b/toontown/suit/DistributedTutorialSuit.py @@ -3,7 +3,7 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.directnotify import DirectNotifyGlobal from toontown.distributed.DelayDeletable import DelayDeletable -import DistributedSuitBase +from . import DistributedSuitBase class DistributedTutorialSuit(DistributedSuitBase.DistributedSuitBase, DelayDeletable): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTutorialSuit') diff --git a/toontown/suit/Goon.py b/toontown/suit/Goon.py index b22e56f..dc88bfe 100644 --- a/toontown/suit/Goon.py +++ b/toontown/suit/Goon.py @@ -4,8 +4,8 @@ from otp.avatar import Avatar from toontown.toonbase import ToontownGlobals from pandac.PandaModules import * from toontown.toonbase import TTLocalizer -import GoonGlobals -import SuitDNA +from . import GoonGlobals +from . import SuitDNA import math AnimDict = {'pg': (('walk', '-walk'), ('collapse', '-collapse'), ('recovery', '-recovery')), 'sg': (('walk', '-walk'), ('collapse', '-collapse'), ('recovery', '-recovery'))} diff --git a/toontown/suit/RoguesGallery.py b/toontown/suit/RoguesGallery.py index b3c04f3..f22b69c 100644 --- a/toontown/suit/RoguesGallery.py +++ b/toontown/suit/RoguesGallery.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from direct.fsm import StateData -import Suit -import SuitDNA +from . import Suit +from . import SuitDNA from toontown.toonbase import ToontownGlobals import random @@ -91,7 +91,7 @@ class RoguesGallery(StateData.StateData): self.text.setTextColor(0.0, 0.0, 0.0, 1.0) self.rowHeight = 0.0 self.minXScale = None - print "rognamestr='", self.rognamestr, "'\n" + print("rognamestr='", self.rognamestr, "'\n") if self.rognamestr == None or len(self.rognamestr) == 0: for dept in SuitDNA.suitDepts: self.__makeDept(dept) diff --git a/toontown/suit/SellbotBossGlobals.py b/toontown/suit/SellbotBossGlobals.py index dcbba9e..c6deb11 100644 --- a/toontown/suit/SellbotBossGlobals.py +++ b/toontown/suit/SellbotBossGlobals.py @@ -40,7 +40,7 @@ BarrelDefs = {8000: {'type': DistributedHealBarrelAI.DistributedHealBarrelAI, 'rewardPerGrabMax': 0}} def setBarrelAttr(barrel, entId): - for defAttr, defValue in BarrelDefs[entId].iteritems(): + for defAttr, defValue in BarrelDefs[entId].items(): setattr(barrel, defAttr, defValue) diff --git a/toontown/suit/Suit.py b/toontown/suit/Suit.py index 9dcc510..b0a3e7a 100644 --- a/toontown/suit/Suit.py +++ b/toontown/suit/Suit.py @@ -1,6 +1,6 @@ from direct.actor import Actor from otp.avatar import Avatar -import SuitDNA +from . import SuitDNA from toontown.toonbase import ToontownGlobals from pandac.PandaModules import * from libotp import * @@ -185,7 +185,7 @@ def unloadSuits(level): def loadSuitModelsAndAnims(level, flag = 0): - for key in ModelDict.keys(): + for key in list(ModelDict.keys()): model, phase = ModelDict[key] if base.config.GetBool('want-new-cogs', 0): headModel, headPhase = HeadModelDict[key] @@ -232,7 +232,7 @@ def loadSuitAnims(suit, flag = 1): animList = () else: - print 'Invalid suit name: ', suit + print('Invalid suit name: ', suit) return -1 for anim in animList: phase = 'phase_' + str(anim[2]) diff --git a/toontown/suit/SuitAvatarPanel.py b/toontown/suit/SuitAvatarPanel.py index 6942aac..77674e6 100644 --- a/toontown/suit/SuitAvatarPanel.py +++ b/toontown/suit/SuitAvatarPanel.py @@ -4,7 +4,7 @@ from pandac.PandaModules import * from direct.showbase import DirectObject from otp.avatar import Avatar from direct.distributed import DistributedObject -import SuitDNA +from . import SuitDNA from toontown.toonbase import TTLocalizer from otp.avatar import AvatarPanel from toontown.friends import FriendsListPanel diff --git a/toontown/suit/SuitBase.py b/toontown/suit/SuitBase.py index 399d107..4f0511e 100644 --- a/toontown/suit/SuitBase.py +++ b/toontown/suit/SuitBase.py @@ -6,8 +6,8 @@ import random from pandac.PandaModules import Point3 from direct.directnotify import DirectNotifyGlobal from toontown.battle import SuitBattleGlobals -import SuitTimings -import SuitDNA +from . import SuitTimings +from . import SuitDNA from toontown.toonbase import TTLocalizer TIME_BUFFER_PER_WPT = 0.25 TIME_DIVISOR = 100 @@ -75,10 +75,10 @@ class SuitBase: return self.path def printPath(self): - print '%d points in path' % self.pathLength + print('%d points in path' % self.pathLength) for currPathPt in range(self.pathLength): indexVal = self.path.getPointIndex(currPathPt) - print '\t', self.sp.dnaStore.getSuitPointWithIndex(indexVal) + print('\t', self.sp.dnaStore.getSuitPointWithIndex(indexVal)) def makeLegList(self): self.legList = SuitLegList(self.path, self.sp.dnaStore, self.sp.suitWalkSpeed, SuitTimings.fromSky, SuitTimings.toSky, SuitTimings.fromSuitBuilding, SuitTimings.toSuitBuilding, SuitTimings.toToonBuilding) diff --git a/toontown/suit/SuitDNA.py b/toontown/suit/SuitDNA.py index e25e1d0..eda8a1c 100644 --- a/toontown/suit/SuitDNA.py +++ b/toontown/suit/SuitDNA.py @@ -106,7 +106,7 @@ def getSuitBodyType(name): elif name in suitCTypes: return 'c' else: - print 'Unknown body type for suit name: ', name + print('Unknown body type for suit name: ', name) def getSuitDept(name): @@ -120,7 +120,7 @@ def getSuitDept(name): elif index < suitsPerDept * 4: return suitDepts[3] else: - print 'Unknown dept for suit name: ', name + print('Unknown dept for suit name: ', name) return None return None @@ -229,7 +229,7 @@ class SuitDNA(AvatarDNA.AvatarDNA): def newSuitRandom(self, level = None, dept = None): self.type = 's' if level == None: - level = random.choice(range(1, len(suitsPerLevel))) + level = random.choice(list(range(1, len(suitsPerLevel)))) elif level < 0 or level > len(suitsPerLevel): notify.error('Invalid suit level: %d' % level) if dept == None: @@ -244,7 +244,7 @@ class SuitDNA(AvatarDNA.AvatarDNA): bottom = base + offset top = bottom + suitsPerLevel[level - 1] - self.name = suitHeadTypes[random.choice(range(bottom, top))] + self.name = suitHeadTypes[random.choice(list(range(bottom, top)))] self.body = getSuitBodyType(self.name) return diff --git a/toontown/suit/SuitDialog.py b/toontown/suit/SuitDialog.py index 80606f8..cc33956 100644 --- a/toontown/suit/SuitDialog.py +++ b/toontown/suit/SuitDialog.py @@ -5,7 +5,7 @@ from toontown.toonbase import TTLocalizer notify = DirectNotifyGlobal.directNotify.newCategory('SuitDialog') def getBrushOffIndex(suitName): - if SuitBrushOffs.has_key(suitName): + if suitName in SuitBrushOffs: brushoffs = SuitBrushOffs[suitName] else: brushoffs = SuitBrushOffs[None] @@ -23,7 +23,7 @@ def getBrushOffIndex(suitName): def getBrushOffText(suitName, index): - if SuitBrushOffs.has_key(suitName): + if suitName in SuitBrushOffs: brushoffs = SuitBrushOffs[suitName] else: brushoffs = SuitBrushOffs[None] diff --git a/toontown/suit/SuitPlannerBase.py b/toontown/suit/SuitPlannerBase.py index ebaf252..ebc08f0 100644 --- a/toontown/suit/SuitPlannerBase.py +++ b/toontown/suit/SuitPlannerBase.py @@ -547,7 +547,7 @@ class SuitPlannerBase: if battleCellId == -1: self.notify.warning('interactive prop %s at %s not associated with a a battle' % (childDnaGroup, zoneId)) elif battleCellId == 0: - if self.cellToGagBonusDict.has_key(zoneId): + if zoneId in self.cellToGagBonusDict: self.notify.error('FIXME battle cell at zone %s has two props %s %s linked to it' % (zoneId, self.cellToGagBonusDict[zoneId], childDnaGroup)) else: name = childDnaGroup.getName() @@ -591,7 +591,7 @@ class SuitPlannerBase: for i in range(numPathPoints - 1): zone = self.dnaStore.getSuitEdgeZone(path.getPointIndex(i), path.getPointIndex(i + 1)) travelTime = self.dnaStore.getSuitEdgeTravelTime(path.getPointIndex(i), path.getPointIndex(i + 1), self.suitWalkSpeed) - self.notify.debug('edge from point ' + `i` + ' to point ' + `(i + 1)` + ' is in zone: ' + `zone` + ' and will take ' + `travelTime` + ' seconds to walk.') + self.notify.debug('edge from point ' + repr(i) + ' to point ' + repr((i + 1)) + ' is in zone: ' + repr(zone) + ' and will take ' + repr(travelTime) + ' seconds to walk.') return None diff --git a/toontown/toon/BoardingGroupInviterPanels.py b/toontown/toon/BoardingGroupInviterPanels.py index aeedf24..1f33910 100644 --- a/toontown/toon/BoardingGroupInviterPanels.py +++ b/toontown/toon/BoardingGroupInviterPanels.py @@ -142,7 +142,7 @@ class BoardingGroupInvitingPanel(BoardingGroupInviterPanelBase): BoardingGroupInviterPanelBase.cleanup(self) def setupUnexpectedExitHooks(self): - if base.cr.doId2do.has_key(self.avId): + if self.avId in base.cr.doId2do: toon = base.cr.doId2do[self.avId] self.unexpectedExitEventName = toon.uniqueName('disable') self.accept(self.unexpectedExitEventName, self.forceCleanup) diff --git a/toontown/toon/DeathForceAcknowledge.py b/toontown/toon/DeathForceAcknowledge.py index 9b8eb31..c9e39c8 100644 --- a/toontown/toon/DeathForceAcknowledge.py +++ b/toontown/toon/DeathForceAcknowledge.py @@ -4,7 +4,7 @@ from toontown.toonbase import TTLocalizer from direct.showbase import Transitions from direct.gui.DirectGui import * from pandac.PandaModules import * -import LaffMeter +from . import LaffMeter class DeathForceAcknowledge: @@ -21,7 +21,7 @@ class DeathForceAcknowledge: self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX) fadeModel.removeNode() else: - print 'Problem loading fadeModel.' + print('Problem loading fadeModel.') self.fade = None self.dialog = TTDialog.TTGlobalDialog( message=TTLocalizer.PlaygroundDeathAckMessage, diff --git a/toontown/toon/DistributedNPCBlocker.py b/toontown/toon/DistributedNPCBlocker.py index 30d65fd..975985e 100644 --- a/toontown/toon/DistributedNPCBlocker.py +++ b/toontown/toon/DistributedNPCBlocker.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from direct.gui.DirectGui import * from pandac.PandaModules import * -import NPCToons +from . import NPCToons from toontown.toonbase import TTLocalizer from direct.distributed import DistributedObject from toontown.quest import QuestParser diff --git a/toontown/toon/DistributedNPCBlockerAI.py b/toontown/toon/DistributedNPCBlockerAI.py index 9789baf..c8f42aa 100644 --- a/toontown/toon/DistributedNPCBlockerAI.py +++ b/toontown/toon/DistributedNPCBlockerAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * -import NPCToons +from .DistributedNPCToonBaseAI import * +from . import NPCToons from direct.task.Task import Task class DistributedNPCBlockerAI(DistributedNPCToonBaseAI): diff --git a/toontown/toon/DistributedNPCClerk.py b/toontown/toon/DistributedNPCClerk.py index 08e9fb5..e42a428 100644 --- a/toontown/toon/DistributedNPCClerk.py +++ b/toontown/toon/DistributedNPCClerk.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from toontown.minigame import ClerkPurchase from toontown.shtiker.PurchaseManagerConstants import * -import NPCToons +from . import NPCToons from direct.task.Task import Task from toontown.toonbase import TTLocalizer from toontown.hood import ZoneUtil diff --git a/toontown/toon/DistributedNPCClerkAI.py b/toontown/toon/DistributedNPCClerkAI.py index 2ef86f8..0659ffe 100644 --- a/toontown/toon/DistributedNPCClerkAI.py +++ b/toontown/toon/DistributedNPCClerkAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from direct.task.Task import Task from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * +from .DistributedNPCToonBaseAI import * class DistributedNPCClerkAI(DistributedNPCToonBaseAI): @@ -83,7 +83,7 @@ class DistributedNPCClerkAI(DistributedNPCToonBaseAI): self.air.writeServerEvent('suspicious', avId, 'DistributedNPCClerkAI.setInventory busy with %s' % self.busy) self.notify.warning('setInventory from unknown avId: %s busy: %s' % (avId, self.busy)) return - if self.air.doId2do.has_key(avId): + if avId in self.air.doId2do: av = self.air.doId2do[avId] newInventory = av.inventory.makeFromNetString(blob) currentMoney = av.getMoney() diff --git a/toontown/toon/DistributedNPCFisherman.py b/toontown/toon/DistributedNPCFisherman.py index c7c7354..bd99fbf 100644 --- a/toontown/toon/DistributedNPCFisherman.py +++ b/toontown/toon/DistributedNPCFisherman.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from direct.gui.DirectGui import * from pandac.PandaModules import * -import NPCToons +from . import NPCToons from toontown.toonbase import TTLocalizer from toontown.fishing import FishSellGUI from direct.task.Task import Task diff --git a/toontown/toon/DistributedNPCFishermanAI.py b/toontown/toon/DistributedNPCFishermanAI.py index 0ff1f27..2b5d32b 100644 --- a/toontown/toon/DistributedNPCFishermanAI.py +++ b/toontown/toon/DistributedNPCFishermanAI.py @@ -1,6 +1,6 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * +from .DistributedNPCToonBaseAI import * from toontown.fishing import FishGlobals from toontown.toonbase import TTLocalizer from toontown.fishing import FishGlobals @@ -20,7 +20,7 @@ class DistributedNPCFishermanAI(DistributedNPCToonBaseAI): def avatarEnter(self): avId = self.air.getAvatarIdFromSender() - if not self.air.doId2do.has_key(avId): + if avId not in self.air.doId2do: self.notify.warning('Avatar: %s not found' % avId) return if self.isBusy(): diff --git a/toontown/toon/DistributedNPCFlippyInToonHall.py b/toontown/toon/DistributedNPCFlippyInToonHall.py index fcd8170..06bb30d 100644 --- a/toontown/toon/DistributedNPCFlippyInToonHall.py +++ b/toontown/toon/DistributedNPCFlippyInToonHall.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -from DistributedNPCToon import * +from .DistributedNPCToon import * class DistributedNPCFlippyInToonHall(DistributedNPCToon): diff --git a/toontown/toon/DistributedNPCFlippyInToonHallAI.py b/toontown/toon/DistributedNPCFlippyInToonHallAI.py index bf53074..9c450a0 100644 --- a/toontown/toon/DistributedNPCFlippyInToonHallAI.py +++ b/toontown/toon/DistributedNPCFlippyInToonHallAI.py @@ -1,4 +1,4 @@ -from DistributedNPCToonAI import * +from .DistributedNPCToonAI import * class DistributedNPCFlippyInToonHallAI(DistributedNPCToonAI): diff --git a/toontown/toon/DistributedNPCKartClerk.py b/toontown/toon/DistributedNPCKartClerk.py index 820404f..f86b5a5 100644 --- a/toontown/toon/DistributedNPCKartClerk.py +++ b/toontown/toon/DistributedNPCKartClerk.py @@ -1,7 +1,7 @@ -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from direct.gui.DirectGui import * from pandac.PandaModules import * -import NPCToons +from . import NPCToons from direct.task.Task import Task from toontown.toonbase import TTLocalizer from toontown.racing.KartShopGui import * diff --git a/toontown/toon/DistributedNPCKartClerkAI.py b/toontown/toon/DistributedNPCKartClerkAI.py index dde21b9..45c2090 100644 --- a/toontown/toon/DistributedNPCKartClerkAI.py +++ b/toontown/toon/DistributedNPCKartClerkAI.py @@ -1,6 +1,6 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * +from .DistributedNPCToonBaseAI import * from toontown.toonbase import TTLocalizer from direct.task import Task from toontown.racing.KartShopGlobals import * @@ -20,7 +20,7 @@ class DistributedNPCKartClerkAI(DistributedNPCToonBaseAI): def avatarEnter(self): avId = self.air.getAvatarIdFromSender() - if not self.air.doId2do.has_key(avId): + if avId not in self.air.doId2do: self.notify.warning('Avatar: %s not found' % avId) return if self.isBusy(): diff --git a/toontown/toon/DistributedNPCPartyPerson.py b/toontown/toon/DistributedNPCPartyPerson.py index 3575515..2064bc7 100644 --- a/toontown/toon/DistributedNPCPartyPerson.py +++ b/toontown/toon/DistributedNPCPartyPerson.py @@ -1,4 +1,4 @@ -from DistributedNPCToonBase import DistributedNPCToonBase +from .DistributedNPCToonBase import DistributedNPCToonBase from direct.distributed.DistributedObject import DistributedObject from toontown.toon import NPCToons from toontown.toonbase import TTLocalizer diff --git a/toontown/toon/DistributedNPCPartyPersonAI.py b/toontown/toon/DistributedNPCPartyPersonAI.py index 3dd489c..f14de22 100644 --- a/toontown/toon/DistributedNPCPartyPersonAI.py +++ b/toontown/toon/DistributedNPCPartyPersonAI.py @@ -1,4 +1,4 @@ -from DistributedNPCToonBaseAI import DistributedNPCToonBaseAI +from .DistributedNPCToonBaseAI import DistributedNPCToonBaseAI from toontown.toonbase import TTLocalizer from direct.task import Task from toontown.toonbase import ToontownGlobals @@ -20,7 +20,7 @@ class DistributedNPCPartyPersonAI(DistributedNPCToonBaseAI): def avatarEnter(self): avId = self.air.getAvatarIdFromSender() - if not self.air.doId2do.has_key(avId): + if avId not in self.air.doId2do: self.notify.warning('Avatar: %s not found' % avId) return if self.isBusy(): diff --git a/toontown/toon/DistributedNPCPetclerk.py b/toontown/toon/DistributedNPCPetclerk.py index feefeb8..07ed766 100644 --- a/toontown/toon/DistributedNPCPetclerk.py +++ b/toontown/toon/DistributedNPCPetclerk.py @@ -1,8 +1,8 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from direct.gui.DirectGui import * from pandac.PandaModules import * -import NPCToons +from . import NPCToons from direct.task.Task import Task from toontown.toonbase import TTLocalizer from toontown.pets import PetshopGUI @@ -99,7 +99,7 @@ class DistributedNPCPetclerk(DistributedNPCToonBase): return Task.done def ignoreEventDict(self): - for event in self.eventDict.values(): + for event in list(self.eventDict.values()): self.ignore(event) def setPetSeeds(self, petSeeds): diff --git a/toontown/toon/DistributedNPCPetclerkAI.py b/toontown/toon/DistributedNPCPetclerkAI.py index 7e64c8d..07c875f 100644 --- a/toontown/toon/DistributedNPCPetclerkAI.py +++ b/toontown/toon/DistributedNPCPetclerkAI.py @@ -1,6 +1,6 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * +from .DistributedNPCToonBaseAI import * from toontown.toonbase import TTLocalizer from direct.task import Task from toontown.fishing import FishGlobals @@ -20,7 +20,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): def avatarEnter(self): avId = self.air.getAvatarIdFromSender() - if not self.air.doId2do.has_key(avId): + if avId not in self.air.doId2do: self.notify.warning('Avatar: %s not found' % avId) return if self.isBusy(): @@ -92,7 +92,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if av: from toontown.hood import ZoneUtil zoneId = ZoneUtil.getCanonicalSafeZoneId(self.zoneId) - if petNum not in range(0, len(self.petSeeds)): + if petNum not in list(range(0, len(self.petSeeds))): self.air.writeServerEvent('suspicious', avId, 'DistributedNPCPetshopAI.petAdopted and no such pet!') self.notify.warning('somebody called petAdopted on a non-existent pet! avId: %s' % avId) return @@ -104,7 +104,7 @@ class DistributedNPCPetclerkAI(DistributedNPCToonBaseAI): if av.petId != 0: simbase.air.petMgr.deleteToonsPet(avId) gender = petNum % len(PetDNA.PetGenders) - if nameIndex not in range(0, TTLocalizer.PetNameIndexMAX): + if nameIndex not in list(range(0, TTLocalizer.PetNameIndexMAX)): self.air.writeServerEvent('avoid_crash', avId, "DistributedNPCPetclerkAI.petAdopted and didn't have valid nameIndex!") self.notify.warning("somebody called petAdopted and didn't have valid nameIndex to adopt! avId: %s" % avId) return diff --git a/toontown/toon/DistributedNPCScientist.py b/toontown/toon/DistributedNPCScientist.py index 381b137..96ae63e 100644 --- a/toontown/toon/DistributedNPCScientist.py +++ b/toontown/toon/DistributedNPCScientist.py @@ -1,6 +1,6 @@ from pandac.PandaModules import * from toontown.toonbase import TTLocalizer, ToontownGlobals -import DistributedNPCToonBase +from . import DistributedNPCToonBase class DistributedNPCScientist(DistributedNPCToonBase.DistributedNPCToonBase): diff --git a/toontown/toon/DistributedNPCScientistAI.py b/toontown/toon/DistributedNPCScientistAI.py index d3ff9ea..4b2fe52 100644 --- a/toontown/toon/DistributedNPCScientistAI.py +++ b/toontown/toon/DistributedNPCScientistAI.py @@ -1,4 +1,4 @@ -import DistributedNPCToonBaseAI +from . import DistributedNPCToonBaseAI from toontown.toonbase import TTLocalizer, ToontownGlobals from direct.fsm import ClassicFSM, State from direct.task.Task import Task diff --git a/toontown/toon/DistributedNPCSpecialQuestGiver.py b/toontown/toon/DistributedNPCSpecialQuestGiver.py index 4beda67..35e3a53 100644 --- a/toontown/toon/DistributedNPCSpecialQuestGiver.py +++ b/toontown/toon/DistributedNPCSpecialQuestGiver.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from toontown.quest import QuestParser from toontown.quest import QuestChoiceGui from toontown.quest import TrackChoiceGui @@ -19,7 +19,7 @@ class DistributedNPCSpecialQuestGiver(DistributedNPCToonBase): def announceGenerate(self): self.setAnimState('neutral', 0.9, None, None) - npcOrigin = self.cr.playGame.hood.loader.geom.find('**/npc_origin_' + `(self.posIndex)`) + npcOrigin = self.cr.playGame.hood.loader.geom.find('**/npc_origin_' + repr((self.posIndex))) if not npcOrigin.isEmpty(): self.reparentTo(npcOrigin) self.clearMat() diff --git a/toontown/toon/DistributedNPCSpecialQuestGiverAI.py b/toontown/toon/DistributedNPCSpecialQuestGiverAI.py index d440985..3f6d01f 100644 --- a/toontown/toon/DistributedNPCSpecialQuestGiverAI.py +++ b/toontown/toon/DistributedNPCSpecialQuestGiverAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from direct.task.Task import Task from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * +from .DistributedNPCToonBaseAI import * from toontown.quest import Quests class DistributedNPCSpecialQuestGiverAI(DistributedNPCToonBaseAI): diff --git a/toontown/toon/DistributedNPCTailor.py b/toontown/toon/DistributedNPCTailor.py index 7ddeb67..3d3cb85 100644 --- a/toontown/toon/DistributedNPCTailor.py +++ b/toontown/toon/DistributedNPCTailor.py @@ -1,12 +1,12 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from direct.gui.DirectGui import * from pandac.PandaModules import * -import NPCToons +from . import NPCToons from direct.task.Task import Task -import TailorClothesGUI +from . import TailorClothesGUI from toontown.toonbase import TTLocalizer -import ToonDNA +from . import ToonDNA from toontown.estate import ClosetGlobals class DistributedNPCTailor(DistributedNPCToonBase): @@ -142,31 +142,31 @@ class DistributedNPCTailor(DistributedNPCToonBase): self.setChatAbsolute(TTLocalizer.STOREOWNER_BROWSING, CFSpeech | CFTimeout) if self.isLocalToon: taskMgr.doMethodLater(3.0, self.popupPurchaseGUI, self.uniqueName('popupPurchaseGUI')) - print '-----------Starting tailor interaction-----------' - print 'avid: %s, gender: %s' % (self.av.doId, self.av.style.gender) - print 'current top = %s,%s,%s,%s and bot = %s,%s,' % (self.av.style.topTex, + print('-----------Starting tailor interaction-----------') + print('avid: %s, gender: %s' % (self.av.doId, self.av.style.gender)) + print('current top = %s,%s,%s,%s and bot = %s,%s,' % (self.av.style.topTex, self.av.style.topTexColor, self.av.style.sleeveTex, self.av.style.sleeveTexColor, self.av.style.botTex, - self.av.style.botTexColor) - print 'topsList = %s' % self.av.getClothesTopsList() - print 'bottomsList = %s' % self.av.getClothesBottomsList() - print '-------------------------------------------------' + self.av.style.botTexColor)) + print('topsList = %s' % self.av.getClothesTopsList()) + print('bottomsList = %s' % self.av.getClothesBottomsList()) + print('-------------------------------------------------') elif mode == NPCToons.PURCHASE_MOVIE_COMPLETE: self.setChatAbsolute(TTLocalizer.STOREOWNER_GOODBYE, CFSpeech | CFTimeout) if self.av and self.isLocalToon: - print '-----------ending tailor interaction-----------' - print 'avid: %s, gender: %s' % (self.av.doId, self.av.style.gender) - print 'current top = %s,%s,%s,%s and bot = %s,%s,' % (self.av.style.topTex, + print('-----------ending tailor interaction-----------') + print('avid: %s, gender: %s' % (self.av.doId, self.av.style.gender)) + print('current top = %s,%s,%s,%s and bot = %s,%s,' % (self.av.style.topTex, self.av.style.topTexColor, self.av.style.sleeveTex, self.av.style.sleeveTexColor, self.av.style.botTex, - self.av.style.botTexColor) - print 'topsList = %s' % self.av.getClothesTopsList() - print 'bottomsList = %s' % self.av.getClothesBottomsList() - print '-------------------------------------------------' + self.av.style.botTexColor)) + print('topsList = %s' % self.av.getClothesTopsList()) + print('bottomsList = %s' % self.av.getClothesBottomsList()) + print('-------------------------------------------------') self.resetTailor() elif mode == NPCToons.PURCHASE_MOVIE_NO_MONEY: self.notify.warning('PURCHASE_MOVIE_NO_MONEY should not be called') @@ -214,7 +214,7 @@ class DistributedNPCTailor(DistributedNPCToonBase): which = which | ClosetGlobals.SHIRT if self.clothesGUI.bottomChoice != -1: which = which | ClosetGlobals.SHORTS - print 'setDNA: which = %d, top = %d, bot = %d' % (which, self.clothesGUI.topChoice, self.clothesGUI.bottomChoice) + print('setDNA: which = %d, top = %d, bot = %d' % (which, self.clothesGUI.topChoice, self.clothesGUI.bottomChoice)) if self.roomAvailable == 0: if self.isLocalToon: if self.av.isClosetFull() or which & ClosetGlobals.SHIRT and which & ClosetGlobals.SHORTS: diff --git a/toontown/toon/DistributedNPCTailorAI.py b/toontown/toon/DistributedNPCTailorAI.py index 3a16b6d..611a905 100644 --- a/toontown/toon/DistributedNPCTailorAI.py +++ b/toontown/toon/DistributedNPCTailorAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * -import ToonDNA +from .DistributedNPCToonBaseAI import * +from . import ToonDNA from direct.task.Task import Task from toontown.ai import DatabaseObject from toontown.estate import ClosetGlobals @@ -31,7 +31,7 @@ class DistributedNPCTailorAI(DistributedNPCToonBaseAI): def avatarEnter(self): avId = self.air.getAvatarIdFromSender() - if not self.air.doId2do.has_key(avId): + if avId not in self.air.doId2do: self.notify.warning('Avatar: %s not found' % avId) return if self.isBusy(): @@ -121,7 +121,7 @@ class DistributedNPCTailorAI(DistributedNPCToonBaseAI): if not testDNA.isValidNetString(blob): self.air.writeServerEvent('suspicious', avId, 'DistributedNPCTailorAI.setDNA: invalid dna: %s' % blob) return - if self.air.doId2do.has_key(avId): + if avId in self.air.doId2do: av = self.air.doId2do[avId] if finished == 2 and which > 0: if self.air.questManager.removeClothingTicket(av, self) == 1 or self.freeClothes: diff --git a/toontown/toon/DistributedNPCToon.py b/toontown/toon/DistributedNPCToon.py index 4b46b14..848ff4a 100644 --- a/toontown/toon/DistributedNPCToon.py +++ b/toontown/toon/DistributedNPCToon.py @@ -1,5 +1,5 @@ from pandac.PandaModules import * -from DistributedNPCToonBase import * +from .DistributedNPCToonBase import * from toontown.quest import QuestParser from toontown.quest import QuestChoiceGui from toontown.quest import TrackChoiceGui diff --git a/toontown/toon/DistributedNPCToonAI.py b/toontown/toon/DistributedNPCToonAI.py index 4956adc..f547567 100644 --- a/toontown/toon/DistributedNPCToonAI.py +++ b/toontown/toon/DistributedNPCToonAI.py @@ -1,7 +1,7 @@ from otp.ai.AIBaseGlobal import * from direct.task.Task import Task from pandac.PandaModules import * -from DistributedNPCToonBaseAI import * +from .DistributedNPCToonBaseAI import * from toontown.quest import Quests class DistributedNPCToonAI(DistributedNPCToonBaseAI): diff --git a/toontown/toon/DistributedNPCToonBase.py b/toontown/toon/DistributedNPCToonBase.py index a9b5ea1..59d5c09 100644 --- a/toontown/toon/DistributedNPCToonBase.py +++ b/toontown/toon/DistributedNPCToonBase.py @@ -4,9 +4,9 @@ from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State from toontown.toonbase import ToontownGlobals -import DistributedToon +from . import DistributedToon from direct.distributed import DistributedObject -import NPCToons +from . import NPCToons from toontown.quest import Quests from direct.distributed import ClockDelta from toontown.quest import QuestParser @@ -69,7 +69,7 @@ class DistributedNPCToonBase(DistributedToon.DistributedToon): def initToonState(self): self.setAnimState('neutral', 0.9, None, None) - npcOrigin = render.find('**/npc_origin_' + `(self.posIndex)`) + npcOrigin = render.find('**/npc_origin_' + repr((self.posIndex))) if not npcOrigin.isEmpty(): self.reparentTo(npcOrigin) self.initPos() diff --git a/toontown/toon/DistributedNPCToonBaseAI.py b/toontown/toon/DistributedNPCToonBaseAI.py index 3b6c3f2..2ce8894 100644 --- a/toontown/toon/DistributedNPCToonBaseAI.py +++ b/toontown/toon/DistributedNPCToonBaseAI.py @@ -1,11 +1,11 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * -import DistributedToonAI +from . import DistributedToonAI from direct.fsm import ClassicFSM from direct.fsm import State from direct.distributed import ClockDelta from toontown.toonbase import ToontownGlobals -import NPCToons +from . import NPCToons from direct.task import Task from toontown.quest import Quests diff --git a/toontown/toon/DistributedToon.py b/toontown/toon/DistributedToon.py index b73c08b..3010d10 100644 --- a/toontown/toon/DistributedToon.py +++ b/toontown/toon/DistributedToon.py @@ -10,7 +10,7 @@ from otp.avatar import DistributedPlayer from otp.avatar import Avatar, DistributedAvatar from otp.speedchat import SCDecoders from otp.chat import TalkAssistant -import Toon +from . import Toon from direct.task.Task import Task from direct.distributed import DistributedSmoothNode from direct.distributed import DistributedObject @@ -21,15 +21,15 @@ from toontown.distributed.DelayDeletable import DelayDeletable from direct.showbase import PythonUtil from toontown.catalog import CatalogItemList from toontown.catalog import CatalogItem -import TTEmote +from . import TTEmote from toontown.shtiker.OptionsPage import speedChatStyles from toontown.fishing import FishCollection from toontown.fishing import FishTank from toontown.suit import SuitDNA from toontown.coghq import CogDisguiseGlobals from toontown.toonbase import TTLocalizer -import Experience -import InventoryNew +from . import Experience +from . import InventoryNew from toontown.speedchat import TTSCDecoders from toontown.chat import ToonChatGarbler from toontown.chat import ResistanceChat @@ -225,7 +225,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute self.tunnelTrack = None self.setTrophyScore(0) self.removeGMIcon() - if self.cr.toons.has_key(self.doId): + if self.doId in self.cr.toons: del self.cr.toons[self.doId] DistributedPlayer.DistributedPlayer.disable(self) return @@ -371,7 +371,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def getNearbyPlayers(self, radius, includeSelf = True): nearbyToons = [] toonIds = self.cr.getObjectsOfExactClass(DistributedToon) - for toonId, toon in toonIds.items(): + for toonId, toon in list(toonIds.items()): if toon is not self: dist = toon.getDistance(self) if dist < radius: @@ -433,7 +433,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def updateGMNameTag(self, tagString, color, state): try: - unicode(tagString, 'utf-8') + str(tagString, 'utf-8') except UnicodeDecodeError: self.sendUpdate('logSuspiciousEvent', ['invalid GM name tag: %s from %s' % (tagString, self.doId)]) return @@ -1138,7 +1138,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute if self.isLocal(): self.gotCatalogNotify = 1 self.refreshOnscreenButtons() - print 'local' + print('local') def setDeliverySchedule(self, onOrder): self.onOrder = CatalogItemList.CatalogItemList(onOrder, store=CatalogItem.Customization | CatalogItem.DeliveryDate) @@ -1230,8 +1230,8 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return [self.trackProgressId, self.trackProgress] def getTrackProgressAsArray(self, maxLength = 15): - shifts = map(operator.rshift, maxLength * [self.trackProgress], range(maxLength - 1, -1, -1)) - digits = map(operator.mod, shifts, maxLength * [2]) + shifts = list(map(operator.rshift, maxLength * [self.trackProgress], list(range(maxLength - 1, -1, -1)))) + digits = list(map(operator.mod, shifts, maxLength * [2])) digits.reverse() return digits @@ -1417,7 +1417,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute lastTossTrack = self.tossTrack tossTrack = None lastPieTrack = Sequence() - if self.pieTracks.has_key(sequence): + if sequence in self.pieTracks: lastPieTrack = self.pieTracks[sequence] del self.pieTracks[sequence] ts = globalClockDelta.localElapsedTime(timestamp32, bits=32) @@ -1441,11 +1441,11 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return def pieFinishedFlying(self, sequence): - if self.pieTracks.has_key(sequence): + if sequence in self.pieTracks: del self.pieTracks[sequence] def pieFinishedSplatting(self, sequence): - if self.splatTracks.has_key(sequence): + if sequence in self.splatTracks: del self.splatTracks[sequence] def pieSplat(self, x, y, z, sequence, pieCode, timestamp32): @@ -1457,10 +1457,10 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute if not launcher.getPhaseComplete(5): return lastPieTrack = Sequence() - if self.pieTracks.has_key(sequence): + if sequence in self.pieTracks: lastPieTrack = self.pieTracks[sequence] del self.pieTracks[sequence] - if self.splatTracks.has_key(sequence): + if sequence in self.splatTracks: lastSplatTrack = self.splatTracks[sequence] del self.splatTracks[sequence] lastSplatTrack.finish() @@ -1479,11 +1479,11 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute splat.start(startTime) def cleanupPies(self): - for track in self.pieTracks.values(): + for track in list(self.pieTracks.values()): track.finish() self.pieTracks = {} - for track in self.splatTracks.values(): + for track in list(self.splatTracks.values()): track.finish() self.splatTracks = {} @@ -1936,7 +1936,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def getMyTrees(self): treeDict = self.cr.getObjectsOfClass(DistributedGagTree.DistributedGagTree) trees = [] - for tree in treeDict.values(): + for tree in list(treeDict.values()): if tree.getOwnerId() == self.doId: trees.append(tree) @@ -1999,7 +1999,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return self.gardenStarted def sendToGolfCourse(self, zoneId): - print 'sending to golfCourse' + print('sending to golfCourse') hoodId = self.cr.playGame.hood.hoodId golfRequest = {'loader': 'safeZoneLoader', 'where': 'golfcourse', @@ -2218,7 +2218,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def setMail(self, mail): DistributedToon.partyNotify.debug('setMail called with %d mail items' % len(mail)) self.mail = [] - for i in xrange(len(mail)): + for i in range(len(mail)): oneMailItem = mail[i] newMail = SimpleMailBase(*oneMailItem) self.mail.append(newMail) @@ -2240,7 +2240,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def setInvites(self, invites): DistributedToon.partyNotify.debug('setInvites called passing in %d invites.' % len(invites)) self.invites = [] - for i in xrange(len(invites)): + for i in range(len(invites)): oneInvite = invites[i] newInvite = InviteInfo(*oneInvite) self.invites.append(newInvite) @@ -2296,7 +2296,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def setHostedParties(self, hostedParties): DistributedToon.partyNotify.debug('setHostedParties called passing in %d parties.' % len(hostedParties)) self.hostedParties = [] - for i in xrange(len(hostedParties)): + for i in range(len(hostedParties)): hostedInfo = hostedParties[i] newParty = PartyInfo(*hostedInfo) self.hostedParties.append(newParty) @@ -2304,7 +2304,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def setPartiesInvitedTo(self, partiesInvitedTo): DistributedToon.partyNotify.debug('setPartiesInvitedTo called passing in %d parties.' % len(partiesInvitedTo)) self.partiesInvitedTo = [] - for i in xrange(len(partiesInvitedTo)): + for i in range(len(partiesInvitedTo)): partyInfo = partiesInvitedTo[i] newParty = PartyInfo(*partyInfo) self.partiesInvitedTo.append(newParty) @@ -2313,7 +2313,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def getOnePartyInvitedTo(self, partyId): result = None - for i in xrange(len(self.partiesInvitedTo)): + for i in range(len(self.partiesInvitedTo)): partyInfo = self.partiesInvitedTo[i] if partyInfo.partyId == partyId: result = partyInfo @@ -2333,7 +2333,7 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute def setPartyReplies(self, replies): DistributedToon.partyNotify.debug('setPartyReplies called passing in %d parties.' % len(replies)) self.partyReplyInfoBases = [] - for i in xrange(len(replies)): + for i in range(len(replies)): partyReply = replies[i] repliesForOneParty = PartyReplyInfoBase(*partyReply) self.partyReplyInfoBases.append(repliesForOneParty) @@ -2600,13 +2600,13 @@ class DistributedToon(DistributedPlayer.DistributedPlayer, Toon.Toon, Distribute return self.uniqueName('zombieCheck') def _doZombieCheck(self, task = None): - self._lastZombieContext = self._zombieCheckSerialGen.next() + self._lastZombieContext = next(self._zombieCheckSerialGen) self.cr.timeManager.checkAvOnDistrict(self, self._lastZombieContext) taskMgr.doMethodLater(60.0, self._doZombieCheck, self._getZombieCheckTaskName()) def _zombieCheckResult(self, context, present): if context == self._lastZombieContext: - print '_zombieCheckResult[%s]: %s' % (self.doId, present) + print('_zombieCheckResult[%s]: %s' % (self.doId, present)) if not present: self.notify.warning('hiding av %s because they are not on the district!' % self.doId) self.setParent(OTPGlobals.SPHidden) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 9e99a6e..5755865 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -2,10 +2,10 @@ from otp.ai.AIBaseGlobal import * from pandac.PandaModules import * from otp.otpbase import OTPGlobals from direct.directnotify import DirectNotifyGlobal -import ToonDNA +from . import ToonDNA from toontown.suit import SuitDNA -import InventoryBase -import Experience +from . import InventoryBase +from . import Experience from otp.avatar import DistributedAvatarAI from otp.avatar import DistributedPlayerAI from direct.distributed import DistributedSmoothNodeAI @@ -24,7 +24,7 @@ import types from toontown.fishing import FishGlobals from toontown.fishing import FishCollection from toontown.fishing import FishTank -from NPCToons import npcFriends, isZoneProtected +from .NPCToons import npcFriends, isZoneProtected from toontown.coghq import CogDisguiseGlobals import random import re @@ -45,7 +45,8 @@ from toontown.toonbase import ToontownAccessAI from toontown.toonbase import TTLocalizer from toontown.catalog import CatalogAccessoryItem from toontown.minigame import MinigameCreatorAI -import ModuleListAI +from . import ModuleListAI +from functools import reduce if simbase.wantPets: from toontown.pets import PetLookerAI, PetObserve else: @@ -355,7 +356,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo messenger.send('avatarExited', [self]) if simbase.wantPets: if self.isInEstate(): - print 'ToonAI - Exit estate toonId:%s' % self.doId + print('ToonAI - Exit estate toonId:%s' % self.doId) self.exitEstate() if self.zoneId != ToontownGlobals.QuietZone: self.announceZoneChange(ToontownGlobals.QuietZone, self.zoneId) @@ -457,9 +458,9 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo else: return 0 try: - styleStr = stylesDict.keys()[stylesDict.values().index([idx, textureIdx, colorIdx])] + styleStr = list(stylesDict.keys())[list(stylesDict.values()).index([idx, textureIdx, colorIdx])] accessoryItemId = 0 - for itemId in CatalogAccessoryItem.AccessoryTypes.keys(): + for itemId in list(CatalogAccessoryItem.AccessoryTypes.keys()): if styleStr == CatalogAccessoryItem.AccessoryTypes[itemId][CatalogAccessoryItem.ATString]: accessoryItemId = itemId break @@ -744,7 +745,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def d_setNPCFriendsDict(self, NPCFriendsDict): NPCFriendsList = [] - for friend in NPCFriendsDict.keys(): + for friend in list(NPCFriendsDict.keys()): NPCFriendsList.append((friend, NPCFriendsDict[friend])) self.sendUpdate('setNPCFriendsDict', [NPCFriendsList]) @@ -771,10 +772,10 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo if numCalls <= 0: self.notify.warning('invalid numCalls: %d' % numCalls) return 0 - if self.NPCFriendsDict.has_key(npcFriend): + if npcFriend in self.NPCFriendsDict: self.NPCFriendsDict[npcFriend] += numCalls - elif npcFriends.has_key(npcFriend): - if len(self.NPCFriendsDict.keys()) >= self.maxNPCFriends: + elif npcFriend in npcFriends: + if len(list(self.NPCFriendsDict.keys())) >= self.maxNPCFriends: return 0 self.NPCFriendsDict[npcFriend] = numCalls else: @@ -788,7 +789,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return 1 def attemptSubtractNPCFriend(self, npcFriend): - if not self.NPCFriendsDict.has_key(npcFriend): + if npcFriend not in self.NPCFriendsDict: self.notify.warning('attemptSubtractNPCFriend: invalid NPC %s' % npcFriend) return 0 if hasattr(self, 'autoRestockSOS') and self.autoRestockSOS: @@ -973,7 +974,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo raise 'invalid accessory type %s' % accessoryType if cur == (geomIdx, texIdx, colorIdx): return True - for i in xrange(0, len(itemList), 3): + for i in range(0, len(itemList), 3): if itemList[i] == geomIdx and itemList[i + 1] == texIdx and itemList[i + 2] == colorIdx: return True @@ -1020,12 +1021,12 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo styles = ToonDNA.ShoesStyles descDict = TTLocalizer.ShoesStylesDescriptions styleName = 'none' - for style in styles.items(): + for style in list(styles.items()): if style[1] == [geomIdx, texIdx, colorIdx]: styleName = style[0] break - if styleName == 'none' or not descDict.has_key(styleName): + if styleName == 'none' or styleName not in descDict: self.air.writeServerEvent('suspicious', self.doId, ' tried to remove wrong accessory code %d %d %d' % (geomIdx, texIdx, colorIdx)) else: self.air.writeServerEvent('accessory', self.doId, ' removed accessory %s' % descDict[styleName]) @@ -1451,7 +1452,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo loseCount = random.randrange(CogDisguiseGlobals.MinPartLoss, CogDisguiseGlobals.MaxPartLoss + 1) parts = self.getCogParts() partBitmask = parts[dept] - partList = range(17) + partList = list(range(17)) while loseCount > 0 and partList: losePart = random.choice(partList) partList.remove(losePart) @@ -2574,14 +2575,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def addEmblems(self, emblemsToAdd): newEmblems = self.emblems[:] - for i in xrange(ToontownGlobals.NumEmblemTypes): + for i in range(ToontownGlobals.NumEmblemTypes): newEmblems[i] += emblemsToAdd[i] self.b_setEmblems(newEmblems) def subtractEmblems(self, emblemsToSubtract): newEmblems = self.emblems[:] - for i in xrange(ToontownGlobals.NumEmblemTypes): + for i in range(ToontownGlobals.NumEmblemTypes): newEmblems[i] -= emblemsToSubtract[i] self.b_setEmblems(newEmblems) @@ -2986,8 +2987,8 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return owned def addOwnedAccessory(self, accessoryId): - print 'in add owned accessory' - if AccessoryDict.has_key(accessoryId): + print('in add owned accessory') + if accessoryId in AccessoryDict: if self.accessories.count(accessoryId) > 0: self.air.writeServerEvent('suspicious', self.doId, 'attempt to add accessory %s which is already owned!' % accessoryId) return @@ -3004,7 +3005,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return def removeOwnedAccessory(self, accessoryId): - if AccessoryDict.has_key(accessoryId): + if accessoryId in AccessoryDict: if self.accessories.count(accessoryId) == 0: self.air.writeServerEvent('suspicious', self.doId, 'attempt to remove accessory %s which is not currently owned!' % accessoryId) return @@ -3023,7 +3024,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo self.air.writeServerEvent('suspicious', self.doId, 'attempt to update to dna value %s in the invalid field %s' % (fieldValue, dnaField)) return if dnaField == KartDNA.bodyType: - if fieldValue not in KartDict.keys() and fieldValue != InvalidEntry: + if fieldValue not in list(KartDict.keys()) and fieldValue != InvalidEntry: self.air.writeServerEvent('suspicious', self.doId, 'attempt to update kart body to invalid body %s.' % fieldValue) return self.b_setKartBodyType(fieldValue) @@ -3271,13 +3272,13 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return ['badIndex', suitIndex, 0] suitName = SuitDNA.suitHeadTypes[suitIndex] streetId = ZoneUtil.getBranchZone(self.zoneId) - if not self.air.suitPlanners.has_key(streetId): + if streetId not in self.air.suitPlanners: return ['badlocation', suitIndex, 0] sp = self.air.suitPlanners[streetId] map = sp.getZoneIdToPointMap() zones = [self.zoneId, self.zoneId - 1, self.zoneId + 1] for zoneId in zones: - if map.has_key(zoneId): + if zoneId in map: points = map[zoneId][:] suit = sp.createNewSuit([], points, suitName=suitName) if suit: @@ -3287,7 +3288,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def doBuildingTakeover(self, suitIndex): streetId = ZoneUtil.getBranchZone(self.zoneId) - if not self.air.suitPlanners.has_key(streetId): + if streetId not in self.air.suitPlanners: self.notify.warning('Street %d is not known.' % streetId) return ['badlocation', suitIndex, 0] sp = self.air.suitPlanners[streetId] @@ -3387,10 +3388,10 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return curSetting def hasParticularCogSummons(self, deptIndex, level, type): - if deptIndex not in range(len(SuitDNA.suitDepts)): + if deptIndex not in list(range(len(SuitDNA.suitDepts))): self.notify.warning('invalid parameter deptIndex %s' % deptIndex) return False - if level not in range(SuitDNA.suitsPerDept): + if level not in list(range(SuitDNA.suitsPerDept)): self.notify.warning('invalid parameter level %s' % level) return False suitIndex = deptIndex * SuitDNA.suitsPerDept + level @@ -3673,7 +3674,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo return trackBonus >= level def giveMeSpecials(self, id = None): - print 'Specials Go!!' + print('Specials Go!!') self.b_setGardenSpecials([(0, 3), (1, 2), (2, 3), @@ -3863,7 +3864,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo paidStatus = simbase.config.GetString('force-paid-status', 'none') if paidStatus == 'unpaid': access = 1 - print 'Setting Access %s' % access + print('Setting Access %s' % access) if access == OTPGlobals.AccessInvalid: if not __dev__: self.air.writeServerEvent('Setting Access', self.doId, 'setAccess not being sent by the OTP Server, changing access to unpaid') @@ -3894,7 +3895,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def logMessage(self, message): avId = self.air.getAvatarIdFromSender() if __dev__: - print 'CLIENT LOG MESSAGE %s %s' % (avId, message) + print('CLIENT LOG MESSAGE %s %s' % (avId, message)) try: self.air.writeServerEvent('clientLog', avId, message) except: @@ -3921,7 +3922,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def setInvites(self, invites): self.invites = [] - for i in xrange(len(invites)): + for i in range(len(invites)): oneInvite = invites[i] newInvite = InviteInfoBase(*oneInvite) self.invites.append(newInvite) @@ -3949,7 +3950,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getNumNonResponseInvites(self): count = 0 - for i in xrange(len(self.invites)): + for i in range(len(self.invites)): if self.invites[i].status == InviteStatus.NotRead or self.invites[i].status == InviteStatus.ReadButNotReplied: count += 1 @@ -3984,14 +3985,14 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def setHostedParties(self, hostedParties): self.hostedParties = [] - for i in xrange(len(hostedParties)): + for i in range(len(hostedParties)): hostedInfo = hostedParties[i] newParty = PartyInfoAI(*hostedInfo) self.hostedParties.append(newParty) def setPartiesInvitedTo(self, partiesInvitedTo): self.partiesInvitedTo = [] - for i in xrange(len(partiesInvitedTo)): + for i in range(len(partiesInvitedTo)): partyInfo = partiesInvitedTo[i] newParty = PartyInfoAI(*partyInfo) self.partiesInvitedTo.append(newParty) @@ -4001,7 +4002,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def getOnePartyInvitedTo(self, partyId): result = None - for i in xrange(len(self.partiesInvitedTo)): + for i in range(len(self.partiesInvitedTo)): partyInfo = self.partiesInvitedTo[i] if partyInfo.partyId == partyId: result = partyInfo @@ -4011,7 +4012,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def setPartyReplyInfoBases(self, replies): self.partyReplyInfoBases = [] - for i in xrange(len(replies)): + for i in range(len(replies)): partyReply = replies[i] repliesForOneParty = PartyReplyInfoBase(*partyReply) self.partyReplyInfoBases.append(repliesForOneParty) @@ -4299,9 +4300,9 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo DistributedToonAI.flagCounts = {} avPairKey = str(min(av.doId, otherAv.doId)) + '+' + str(max(av.doId, otherAv.doId)) prevCount = DistributedToonAI.flagCounts.setdefault(avPairKey, [{}, globalClock.getFrameTime(), {}]) - if not prevCount[2].has_key(av.doId): + if av.doId not in prevCount[2]: prevCount[2][av.doId] = [None, None] - if not prevCount[0].has_key(av.doId): + if av.doId not in prevCount[0]: prevCount[0][av.doId] = 0 self.notify.debug('moving av %s, newPos: %s oldPos: %s' % (av.doId, prevCount[2][av.doId], avPos)) if prevCount[2][av.doId][0] == None or prevCount[2][av.doId][1] == None: @@ -4359,7 +4360,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo from toontown.toon.DistributedNPCToonBaseAI import DistributedNPCToonBaseAI if isinstance(av, DistributedNPCToonBaseAI): return - if isinstance(av, DistributedToonAI) and not DistributedToonAI.pingedAvs.has_key(avId): + if isinstance(av, DistributedToonAI) and avId not in DistributedToonAI.pingedAvs: av.sendPing() return Task.again @@ -4389,7 +4390,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def pingresp(self, resp): senderId = self.air.getAvatarIdFromSender() - if not DistributedToonAI.pingedAvs.has_key(senderId) or self.air == None: + if senderId not in DistributedToonAI.pingedAvs or self.air == None: self.cleanupPing() return val = DistributedToonAI.pingedAvs[senderId][1] @@ -4413,7 +4414,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo def cleanupPing(self): taskMgr.remove('pingverify-' + str(self.doId)) - if DistributedToonAI.pingedAvs.has_key(self.doId): + if self.doId in DistributedToonAI.pingedAvs: del DistributedToonAI.pingedAvs[self.doId] def startPing(self): diff --git a/toontown/toon/GroupPanel.py b/toontown/toon/GroupPanel.py index 1ce6a97..d89473c 100644 --- a/toontown/toon/GroupPanel.py +++ b/toontown/toon/GroupPanel.py @@ -222,7 +222,7 @@ class GroupPanel(DirectObject.DirectObject): return def __addDestNames(self): - for i in xrange(len(self.elevatorIdList)): + for i in range(len(self.elevatorIdList)): destName = self.__getDestName(i) self.destScrollList.addItem(destName, refresh=0) @@ -291,7 +291,7 @@ class GroupPanel(DirectObject.DirectObject): messenger.send('clickedNametag', [avatar]) def __addTestNames(self, num): - for i in xrange(num): + for i in range(num): avatarButton = self.__getAvatarButton(localAvatar.doId) self.scrollList.addItem(avatarButton, refresh=0) diff --git a/toontown/toon/InventoryBase.py b/toontown/toon/InventoryBase.py index ba5c1ea..5179a7b 100644 --- a/toontown/toon/InventoryBase.py +++ b/toontown/toon/InventoryBase.py @@ -224,8 +224,8 @@ class InventoryBase(DirectObject.DirectObject): tempInv = self.makeFromNetString(newInventory) else: tempInv = newInventory - for track in xrange(len(Tracks)): - for level in xrange(len(Levels[track])): + for track in range(len(Tracks)): + for level in range(len(Levels[track])): if tempInv[track][level] > self.inventory[track][level]: if Levels[track][level] > UnpaidMaxSkills[track]: return 0 diff --git a/toontown/toon/InventoryNew.py b/toontown/toon/InventoryNew.py index 56bdc5c..3d867da 100644 --- a/toontown/toon/InventoryNew.py +++ b/toontown/toon/InventoryNew.py @@ -1,7 +1,7 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * from toontown.toonbase.ToontownBattleGlobals import * -import InventoryBase +from . import InventoryBase from toontown.toonbase import TTLocalizer from toontown.quest import BlinkingArrows from direct.interval.IntervalGlobal import * diff --git a/toontown/toon/LaffMeter.py b/toontown/toon/LaffMeter.py index 160ec47..40ef7d4 100644 --- a/toontown/toon/LaffMeter.py +++ b/toontown/toon/LaffMeter.py @@ -53,7 +53,7 @@ class LaffMeter(DirectFrame): elif hType == 'pig': headModel = gui.find('**/pighead') else: - raise StandardError('unknown toon species: ', hType) + raise Exception('unknown toon species: ', hType) self.color = self.style.getHeadColor() self.container['image'] = headModel self.container['image_color'] = self.color diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index f091e3f..93df073 100644 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -49,9 +49,9 @@ from toontown.battle import Fanfare from toontown.parties import PartyGlobals from toontown.toon import ElevatorNotifier from toontown.toon import ToonDNA -import DistributedToon -import Toon -import LaffMeter +from . import DistributedToon +from . import Toon +from . import LaffMeter from toontown.quest import QuestMap from toontown.toon.DistributedNPCToonBase import DistributedNPCToonBase WantNewsPage = base.config.GetBool('want-news-page', ToontownGlobals.DefaultWantNewsPageSetting) @@ -228,7 +228,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): if self.ticker >= 10: self.ticker = 0 if self.glitchCount >= 7: - print 'GLITCH MAXED!!! resetting pos' + print('GLITCH MAXED!!! resetting pos') self.setX(self.glitchX - 1 * (self.getX() - self.glitchX)) self.setY(self.glitchY - 1 * (self.getY() - self.glitchY)) self.glitchCount = 0 @@ -243,11 +243,11 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): from otp.friends import FriendInfo def toonPosCheck(self, task = None): - toon = random.choice(self.cr.toons.values()) + toon = random.choice(list(self.cr.toons.values())) if toon and toon is not self and not isinstance(toon, DistributedNPCToonBase): self.notify.debug('checking position for %s' % toon.doId) realTimeStart = globalClock.getRealTime() - numOtherToons = len(self.cr.toons.values()) + numOtherToons = len(list(self.cr.toons.values())) for otherToonIdxBase in range(numOtherToons): otherToonIdx = otherToonIdxBase + self.prevToonIdx if otherToonIdx >= numOtherToons: @@ -256,7 +256,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.notify.debug('too much time, exiting at index %s' % otherToonIdx) self.prevToonIdx = otherToonIdx break - otherToon = self.cr.toons.values()[otherToonIdx] + otherToon = list(self.cr.toons.values())[otherToonIdx] self.notify.debug('comparing with toon %s at index %s' % (otherToon.doId, otherToonIdx)) if otherToon and otherToon is not toon and otherToon is not self and not isinstance(otherToon, DistributedNPCToonBase): toonPos = toon.getPos(render) @@ -284,7 +284,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): return Task.again def tmdcc(self, task = None): - toon = random.choice(self.cr.toons.values()) + toon = random.choice(list(self.cr.toons.values())) result = self._tmdcc(toon) if task: if result: @@ -352,7 +352,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.sendUpdate('requestPing', [toon.doId]) if not checks: numChecks = 6 - checks = [random.choice(range(1, numChecks + 1))] + checks = [random.choice(list(range(1, numChecks + 1)))] def findParentAv(node): avId = 0 @@ -426,7 +426,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): if 1 in checks: if base.config.GetBool('tmdcc-headcheck', 1): headNodes = toon.findAllMatches('**/__Actor_head') - if len(headNodes) != 3 or not toon.getGeomNode().isHidden() and filter(lambda x: x.isHidden(), headNodes): + if len(headNodes) != 3 or not toon.getGeomNode().isHidden() and [x for x in headNodes if x.isHidden()]: sendT(msgHeader, 'missing head node', toon) result = toon if base.config.GetBool('tmdcc-chatcheck', 1): @@ -509,15 +509,12 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): torsoPieces = toon.getPieces(('torso', ('arms', 'neck'))) legPieces = toon.getPieces(('legs', ('legs', 'feet'))) headPieces = toon.getPieces(('head', '*head*')) - if (filter(lambda x: x.hasColor() and x.getColor() not in ToonDNA.allowedColors, - torsoPieces) or - filter(lambda x: x.hasColor() and x.getColor() not in ToonDNA.allowedColors, - legPieces) or - filter(lambda x: x.hasColor() and x.getColor() not in ToonDNA.allowedColors, - headPieces)) and toon.cheesyEffect == ToontownGlobals.CENormal: - torsoColors = str(map(lambda x: not x.hasColor() and 'clear' or x.getColor() in ToonDNA.allowedColors and 'ok' or x.getColor(), torsoPieces)) - legColors = str(map(lambda x: not x.hasColor() and 'clear' or x.getColor() in ToonDNA.allowedColors and 'ok' or x.getColor(), legPieces)) - headColors = str(map(lambda x: not x.hasColor() and 'clear' or x.getColor() in ToonDNA.allowedColors and 'ok' or x.getColor(), headPieces)) + if ([x for x in torsoPieces if x.hasColor() and x.getColor() not in ToonDNA.allowedColors] or + [x for x in legPieces if x.hasColor() and x.getColor() not in ToonDNA.allowedColors] or + [x for x in headPieces if x.hasColor() and x.getColor() not in ToonDNA.allowedColors]) and toon.cheesyEffect == ToontownGlobals.CENormal: + torsoColors = str([not x.hasColor() and 'clear' or x.getColor() in ToonDNA.allowedColors and 'ok' or x.getColor() for x in torsoPieces]) + legColors = str([not x.hasColor() and 'clear' or x.getColor() in ToonDNA.allowedColors and 'ok' or x.getColor() for x in legPieces]) + headColors = str([not x.hasColor() and 'clear' or x.getColor() in ToonDNA.allowedColors and 'ok' or x.getColor() for x in headPieces]) sendT(msgHeader, 'invalid color...arm: %s leg: %s head: %s' % (torsoColors, legColors, headColors), toon) result = toon else: @@ -955,7 +952,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): return def localPresentPie(self, time): - import TTEmote + from . import TTEmote from otp.avatar import Emote self.__stopPresentPie() if self.tossTrack: @@ -991,7 +988,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): def __stopPresentPie(self): if self.__presentingPie: - import TTEmote + from . import TTEmote from otp.avatar import Emote Emote.globalEmote.releaseBody(self) messenger.send('end-pie') @@ -1043,11 +1040,11 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): tossTrack = self.tossTrack self.tossTrack = None tossTrack.finish() - if self.pieTracks.has_key(sequence): + if sequence in self.pieTracks: pieTrack = self.pieTracks[sequence] del self.pieTracks[sequence] pieTrack.finish() - if self.splatTracks.has_key(sequence): + if sequence in self.splatTracks: splatTrack = self.splatTracks[sequence] del self.splatTracks[sequence] splatTrack.finish() @@ -1088,7 +1085,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): self.__piePowerMeter.hide() def __finishPieTrack(self, sequence): - if self.pieTracks.has_key(sequence): + if sequence in self.pieTracks: pieTrack = self.pieTracks[sequence] del self.pieTracks[sequence] pieTrack.finish() @@ -1100,7 +1097,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): return sequence = int(entry.getFromNodePath().getNetTag('pieSequence')) self.__finishPieTrack(sequence) - if self.splatTracks.has_key(sequence): + if sequence in self.splatTracks: splatTrack = self.splatTracks[sequence] del self.splatTracks[sequence] splatTrack.finish() @@ -1415,7 +1412,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): else: zoneId = '?' strPos = '(%.3f' % pos[0] + '\n %.3f' % pos[1] + '\n %.3f)' % pos[2] + '\nH: %.3f' % hpr[0] + '\nZone: %s' % str(zoneId) + ',\nVer: %s, ' % serverVersion + '\nDistrict: %s' % districtName - print 'Current position=', strPos.replace('\n', ', ') + print('Current position=', strPos.replace('\n', ', ')) self.setChatAbsolute(strPos, CFThought | CFTimeout) return @@ -1739,7 +1736,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): if place: state = place.fsm.getCurrentState() if state.getName() != self.lastPlaceState: - print 'Place State Change From %s to %s' % (self.lastPlaceState, state.getName()) + print('Place State Change From %s to %s' % (self.lastPlaceState, state.getName())) self.lastPlaceState = state.getName() return Task.cont @@ -2059,7 +2056,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): def b_setAnimState(self, animName, animMultiplier = 1.0, callback = None, extraArgs = []): if self.wantStatePrint: - print 'Local Toon Anim State %s' % animName + print('Local Toon Anim State %s' % animName) DistributedToon.DistributedToon.b_setAnimState(self, animName, animMultiplier, callback, extraArgs) def swimTimeoutAction(self): @@ -2074,13 +2071,13 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): base.cr.gameFSM.request('closeShard', ['afkTimeout']) def sbFriendAdd(self, id, info): - print 'sbFriendAdd' + print('sbFriendAdd') def sbFriendUpdate(self, id, info): - print 'sbFriendUpdate' + print('sbFriendUpdate') def sbFriendRemove(self, id): - print 'sbFriendRemove' + print('sbFriendRemove') def addGolfPage(self): if self.hasPlayedGolf(): @@ -2181,7 +2178,7 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): maze = base.cr.doFind('DistCogdoMazeGame') if maze: if kindOfCheat == 0: - for suitNum in maze.game.suitsById.keys(): + for suitNum in list(maze.game.suitsById.keys()): suit = maze.game.suitsById[suitNum] maze.sendUpdate('requestSuitHitByGag', [suit.type, suitNum]) diff --git a/toontown/toon/Motion.py b/toontown/toon/Motion.py index 32f2bfe..ff3dc84 100644 --- a/toontown/toon/Motion.py +++ b/toontown/toon/Motion.py @@ -3,7 +3,7 @@ from toontown.toonbase import ToontownGlobals from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM, State from direct.fsm import State -import TTEmote +from . import TTEmote from otp.avatar import Emote class Motion(StateData.StateData): diff --git a/toontown/toon/NPCFriendPanel.py b/toontown/toon/NPCFriendPanel.py index 59eafe5..dfdb158 100644 --- a/toontown/toon/NPCFriendPanel.py +++ b/toontown/toon/NPCFriendPanel.py @@ -1,9 +1,9 @@ from direct.gui.DirectGui import * from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * -import NPCToons -import ToonHead -import ToonDNA +from . import NPCToons +from . import ToonHead +from . import ToonDNA from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownBattleGlobals @@ -22,7 +22,7 @@ class NPCFriendPanel(DirectFrame): return None def update(self, friendDict, fCallable = 0): - friendList = friendDict.keys() + friendList = list(friendDict.keys()) for i in range(self.maxNPCFriends): card = self.cardList[i] try: diff --git a/toontown/toon/NPCToons.py b/toontown/toon/NPCToons.py index 6e6dce5..7cc3745 100644 --- a/toontown/toon/NPCToons.py +++ b/toontown/toon/NPCToons.py @@ -3,7 +3,7 @@ from libotp import * from toontown.toonbase import ToontownGlobals import random from toontown.hood import ZoneUtil -import ToonDNA +from . import ToonDNA from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownBattleGlobals import sys, os @@ -72,17 +72,17 @@ def getRandomDNA(seed, gender): def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None): - import DistributedNPCToonAI - import DistributedNPCClerkAI - import DistributedNPCTailorAI - import DistributedNPCBlockerAI - import DistributedNPCFishermanAI - import DistributedNPCPetclerkAI - import DistributedNPCKartClerkAI - import DistributedNPCPartyPersonAI - import DistributedNPCSpecialQuestGiverAI - import DistributedNPCFlippyInToonHallAI - import DistributedNPCScientistAI + from . import DistributedNPCToonAI + from . import DistributedNPCClerkAI + from . import DistributedNPCTailorAI + from . import DistributedNPCBlockerAI + from . import DistributedNPCFishermanAI + from . import DistributedNPCPetclerkAI + from . import DistributedNPCKartClerkAI + from . import DistributedNPCPartyPersonAI + from . import DistributedNPCSpecialQuestGiverAI + from . import DistributedNPCFlippyInToonHallAI + from . import DistributedNPCScientistAI canonicalZoneId, name, dnaType, gender, protected, type = desc if type == NPC_REGULAR: npc = DistributedNPCToonAI.DistributedNPCToonAI(air, npcId, questCallback=questCallback) @@ -109,7 +109,7 @@ def createNPC(air, npcId, desc, zoneId, posIndex = 0, questCallback = None): elif type == NPC_SCIENTIST: npc = DistributedNPCScientistAI.DistributedNPCScientistAI(air, npcId) else: - print 'createNPC() error!!!' + print('createNPC() error!!!') npc.setName(name) dna = ToonDNA.ToonDNA() if dnaType == 'r': @@ -167,8 +167,8 @@ def createNpcsInZone(air, zoneId): def createLocalNPC(npcId): - import Toon - if not NPCToonDict.has_key(npcId): + from . import Toon + if npcId not in NPCToonDict: return None desc = NPCToonDict[npcId] canonicalZoneId, name, dnaType, gender, protected, type = desc @@ -11533,9 +11533,9 @@ BlockerPositions = {TTLocalizer.Flippy: (Point3(207.4, 18.81, -0.475), 90.0)} zone2NpcDict = {} def generateZone2NpcDict(): - for id, npcDesc in NPCToonDict.items(): + for id, npcDesc in list(NPCToonDict.items()): zoneId = npcDesc[0] - if zone2NpcDict.has_key(zoneId): + if zoneId in zone2NpcDict: zone2NpcDict[zoneId].append(id) else: zone2NpcDict[zoneId] = [id] @@ -11735,36 +11735,36 @@ npcFriends = dict(HQnpcFriends) npcFriends.update(FOnpcFriends) def getNPCName(npcId): - if NPCToonDict.has_key(npcId): + if npcId in NPCToonDict: return NPCToonDict[npcId][1] return None def npcFriendsMinMaxStars(minStars, maxStars): - return [ id for id in npcFriends.keys() if getNPCTrackLevelHpRarity(id)[3] >= minStars and getNPCTrackLevelHpRarity(id)[3] <= maxStars ] + return [ id for id in list(npcFriends.keys()) if getNPCTrackLevelHpRarity(id)[3] >= minStars and getNPCTrackLevelHpRarity(id)[3] <= maxStars ] def getNPCTrack(npcId): - if npcFriends.has_key(npcId): + if npcId in npcFriends: return npcFriends[npcId][0] return None def getNPCTrackHp(npcId): - if npcFriends.has_key(npcId): + if npcId in npcFriends: track, level, hp, rarity = npcFriends[npcId] return (track, hp) return (None, None) def getNPCTrackLevelHp(npcId): - if npcFriends.has_key(npcId): + if npcId in npcFriends: track, level, hp, rarity = npcFriends[npcId] return (track, level, hp) return (None, None, None) def getNPCTrackLevelHpRarity(npcId): - if npcFriends.has_key(npcId): + if npcId in npcFriends: return npcFriends[npcId] return (None, None, None, None) diff --git a/toontown/toon/PlayerDetailPanel.py b/toontown/toon/PlayerDetailPanel.py index 0593141..7b7b1cc 100644 --- a/toontown/toon/PlayerDetailPanel.py +++ b/toontown/toon/PlayerDetailPanel.py @@ -6,9 +6,9 @@ from direct.showbase import DirectObject from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.directnotify import DirectNotifyGlobal -import DistributedToon +from . import DistributedToon from toontown.friends import FriendInviter -import ToonTeleportPanel +from . import ToonTeleportPanel from toontown.toonbase import TTLocalizer from toontown.hood import ZoneUtil from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels @@ -48,7 +48,7 @@ class PlayerDetailPanel(DirectFrame): self.playerInfo = None if playerId: self.isPlayer = 1 - if base.cr.playerFriendsManager.playerId2Info.has_key(playerId): + if playerId in base.cr.playerFriendsManager.playerId2Info: self.playerInfo = base.cr.playerFriendsManager.playerId2Info[playerId] if not self.playerInfo.onlineYesNo: avId = None diff --git a/toontown/toon/PlayerInfoPanel.py b/toontown/toon/PlayerInfoPanel.py index f8ed642..0d928c0 100644 --- a/toontown/toon/PlayerInfoPanel.py +++ b/toontown/toon/PlayerInfoPanel.py @@ -9,9 +9,9 @@ from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.friends import ToontownFriendSecret -import ToonAvatarDetailPanel -import AvatarPanelBase -import PlayerDetailPanel +from . import ToonAvatarDetailPanel +from . import AvatarPanelBase +from . import PlayerDetailPanel from otp.otpbase import OTPGlobals GAME_LOGO_NAMES = {'Default': 'GameLogo_Unknown', 'Disney XD': 'GameLogo_XD', @@ -77,7 +77,7 @@ class PlayerInfoPanel(AvatarPanelBase.AvatarPanelBase): logoImageName = GAME_LOGO_NAMES['Default'] if not self.playerInfo.onlineYesNo: logoImageName = GAME_LOGO_NAMES['Default'] - elif GAME_LOGO_NAMES.has_key(self.playerInfo.location): + elif self.playerInfo.location in GAME_LOGO_NAMES: logoImageName = GAME_LOGO_NAMES[self.playerInfo.location] model = loader.loadModel(GAME_LOGO_FILE) logoImage = model.find('**/' + logoImageName) diff --git a/toontown/toon/TTEmote.py b/toontown/toon/TTEmote.py index c6694e9..86bffae 100644 --- a/toontown/toon/TTEmote.py +++ b/toontown/toon/TTEmote.py @@ -1,4 +1,4 @@ -import Toon, ToonDNA +from . import Toon, ToonDNA from direct.interval.IntervalGlobal import * from otp.otpbase import OTPLocalizer from toontown.toonbase import TTLocalizer @@ -502,7 +502,7 @@ class TTEmote(Emote.Emote): def unlockStateChangeMsg(self): if self.stateChangeMsgLocks <= 0: - print PythonUtil.lineTag() + ': someone unlocked too many times' + print(PythonUtil.lineTag() + ': someone unlocked too many times') return self.stateChangeMsgLocks -= 1 if self.stateChangeMsgLocks == 0 and self.stateHasChanged: @@ -518,12 +518,12 @@ class TTEmote(Emote.Emote): def disableAll(self, toon, msg = None): if toon != base.localAvatar: return - self.disableGroup(range(len(self.emoteFunc)), toon) + self.disableGroup(list(range(len(self.emoteFunc))), toon) def releaseAll(self, toon, msg = None): if toon != base.localAvatar: return - self.enableGroup(range(len(self.emoteFunc)), toon) + self.enableGroup(list(range(len(self.emoteFunc))), toon) def disableBody(self, toon, msg = None): if toon != base.localAvatar: @@ -563,7 +563,7 @@ class TTEmote(Emote.Emote): self.unlockStateChangeMsg() def disable(self, index, toon): - if isinstance(index, types.StringType): + if isinstance(index, bytes): index = OTPLocalizer.EmoteFuncDict[index] self.emoteFunc[index][1] = self.emoteFunc[index][1] + 1 if toon is base.localAvatar: @@ -571,7 +571,7 @@ class TTEmote(Emote.Emote): self.emoteEnableStateChanged() def enable(self, index, toon): - if isinstance(index, types.StringType): + if isinstance(index, bytes): index = OTPLocalizer.EmoteFuncDict[index] self.emoteFunc[index][1] = self.emoteFunc[index][1] - 1 if toon is base.localAvatar: @@ -582,7 +582,7 @@ class TTEmote(Emote.Emote): try: func = self.emoteFunc[emoteIndex][0] except: - print 'Error in finding emote func %s' % emoteIndex + print('Error in finding emote func %s' % emoteIndex) return (None, None) def clearEmoteTrack(): diff --git a/toontown/toon/TailorClothesGUI.py b/toontown/toon/TailorClothesGUI.py index ebf6f5b..9e02a62 100644 --- a/toontown/toon/TailorClothesGUI.py +++ b/toontown/toon/TailorClothesGUI.py @@ -1,5 +1,5 @@ from toontown.makeatoon import ClothesGUI -import ToonDNA +from . import ToonDNA class TailorClothesGUI(ClothesGUI.ClothesGUI): notify = directNotify.newCategory('MakeClothesGUI') diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index e644a63..7568312 100644 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -1,11 +1,11 @@ from otp.avatar import Avatar from otp.avatar.Avatar import teleportNotify -import ToonDNA +from . import ToonDNA from direct.task.Task import Task from toontown.suit import SuitDNA from direct.actor import Actor import string -from ToonHead import * +from .ToonHead import * from pandac.PandaModules import * from libotp import * from direct.interval.IntervalGlobal import * @@ -15,23 +15,24 @@ from otp.otpbase import OTPLocalizer from toontown.toonbase import TTLocalizer import random from toontown.effects import Wake -import TTEmote +from . import TTEmote from otp.avatar import Emote -import Motion +from . import Motion from toontown.hood import ZoneUtil from toontown.battle import SuitBattleGlobals from otp.otpbase import OTPGlobals from toontown.effects import DustCloud from direct.showbase.PythonUtil import Functor from toontown.distributed import DelayDelete -import AccessoryGlobals +from . import AccessoryGlobals import types +import importlib def teleportDebug(requestStatus, msg, onlyIfToAv = True): if teleportNotify.getDebug(): teleport = 'teleport' - if requestStatus.has_key('how') and requestStatus['how'][:len(teleport)] == teleport: - if not onlyIfToAv or requestStatus.has_key('avId') and requestStatus['avId'] > 0: + if 'how' in requestStatus and requestStatus['how'][:len(teleport)] == teleport: + if not onlyIfToAv or 'avId' in requestStatus and requestStatus['avId'] > 0: teleportNotify.debug(msg) @@ -213,7 +214,7 @@ def loadModels(): for bottom in ToonDNA.GirlBottoms: loadTex(bottom[0]) - for key in LegDict.keys(): + for key in list(LegDict.keys()): fileRoot = LegDict[key] model = loader.loadModel('phase_3' + fileRoot + '1000').node() Preloaded.append(model) @@ -222,7 +223,7 @@ def loadModels(): model = loader.loadModel('phase_3' + fileRoot + '250').node() Preloaded.append(model) - for key in TorsoDict.keys(): + for key in list(TorsoDict.keys()): fileRoot = TorsoDict[key] model = loader.loadModel('phase_3' + fileRoot + '1000').node() Preloaded.append(model) @@ -232,7 +233,7 @@ def loadModels(): model = loader.loadModel('phase_3' + fileRoot + '250').node() Preloaded.append(model) - for key in HeadDict.keys(): + for key in list(HeadDict.keys()): fileRoot = HeadDict[key] model = loader.loadModel('phase_3' + fileRoot + '1000').node() Preloaded.append(model) @@ -319,28 +320,28 @@ def loadPhaseAnims(phaseStr = 'phase_3', loadFlag = 1): animList = Phase12AnimList else: self.notify.error('Unknown phase string %s' % phaseStr) - for key in LegDict.keys(): + for key in list(LegDict.keys()): for anim in animList: if loadFlag: pass - elif LegsAnimDict[key].has_key(anim[0]): + elif anim[0] in LegsAnimDict[key]: if base.localAvatar.style.legs == key: base.localAvatar.unloadAnims([anim[0]], 'legs', None) - for key in TorsoDict.keys(): + for key in list(TorsoDict.keys()): for anim in animList: if loadFlag: pass - elif TorsoAnimDict[key].has_key(anim[0]): + elif anim[0] in TorsoAnimDict[key]: if base.localAvatar.style.torso == key: base.localAvatar.unloadAnims([anim[0]], 'torso', None) - for key in HeadDict.keys(): + for key in list(HeadDict.keys()): if string.find(key, 'd') >= 0: for anim in animList: if loadFlag: pass - elif HeadAnimDict[key].has_key(anim[0]): + elif anim[0] in HeadAnimDict[key]: if base.localAvatar.style.head == key: base.localAvatar.unloadAnims([anim[0]], 'head', None) @@ -368,19 +369,19 @@ def compileGlobalAnimList(): 'phase_12'] for animList in phaseList: phaseStr = phaseStrList[phaseList.index(animList)] - for key in LegDict.keys(): + for key in list(LegDict.keys()): LegsAnimDict.setdefault(key, {}) for anim in animList: file = phaseStr + LegDict[key] + anim[1] LegsAnimDict[key][anim[0]] = file - for key in TorsoDict.keys(): + for key in list(TorsoDict.keys()): TorsoAnimDict.setdefault(key, {}) for anim in animList: file = phaseStr + TorsoDict[key] + anim[1] TorsoAnimDict[key][anim[0]] = file - for key in HeadDict.keys(): + for key in list(HeadDict.keys()): if string.find(key, 'd') >= 0: HeadAnimDict.setdefault(key, {}) for anim in animList: @@ -1043,7 +1044,7 @@ class Toon(Avatar.Avatar, ToonHead): tex.setMagfilter(Texture.FTLinear) hatGeom.setTexture(tex, 1) if fromRTM: - reload(AccessoryGlobals) + importlib.reload(AccessoryGlobals) transOffset = None if AccessoryGlobals.ExtendedHatTransTable.get(hat[0]): transOffset = AccessoryGlobals.ExtendedHatTransTable[hat[0]].get(self.style.head[:2]) @@ -1088,7 +1089,7 @@ class Toon(Avatar.Avatar, ToonHead): tex.setMagfilter(Texture.FTLinear) glassesGeom.setTexture(tex, 1) if fromRTM: - reload(AccessoryGlobals) + importlib.reload(AccessoryGlobals) transOffset = None if AccessoryGlobals.ExtendedGlassesTransTable.get(glasses[0]): transOffset = AccessoryGlobals.ExtendedGlassesTransTable[glasses[0]].get(self.style.head[:2]) @@ -1130,7 +1131,7 @@ class Toon(Avatar.Avatar, ToonHead): tex.setMagfilter(Texture.FTLinear) geom.setTexture(tex, 1) if fromRTM: - reload(AccessoryGlobals) + importlib.reload(AccessoryGlobals) transOffset = None if AccessoryGlobals.ExtendedBackpackTransTable.get(backpack[0]): transOffset = AccessoryGlobals.ExtendedBackpackTransTable[backpack[0]].get(self.style.torso[:1]) @@ -1288,7 +1289,7 @@ class Toon(Avatar.Avatar, ToonHead): self.lerpLookAt(Point3(x, 1.5, y), blink=1) return nodePathList = [] - for id, obj in self.cr.doId2do.items(): + for id, obj in list(self.cr.doId2do.items()): if hasattr(obj, 'getStareAtNodeAndOffset') and obj != self: node, offset = obj.getStareAtNodeAndOffset() if node.getY(self) > 0.0: @@ -2019,12 +2020,12 @@ class Toon(Avatar.Avatar, ToonHead): self.setPlayRate(animMultiplier * 0.4, 'neutral') self.setChatAbsolute(SLEEP_STRING, CFThought) if self == base.localAvatar: - print 'adding timeout task' + print('adding timeout task') taskMgr.doMethodLater(self.afkTimeout, self.__handleAfkTimeout, self.uniqueName('afkTimeout')) self.setActiveShadow(0) def __handleAfkTimeout(self, task): - print 'handling timeout' + print('handling timeout') self.ignore('wakeup') self.takeOffSuit() base.cr.playGame.getPlace().fsm.request('final') @@ -2191,7 +2192,7 @@ class Toon(Avatar.Avatar, ToonHead): for partName, pieceNames in pieces: part = self.getPart(partName, lodName) if part: - if type(pieceNames) == types.StringType: + if type(pieceNames) == bytes: pieceNames = (pieceNames,) for pieceName in pieceNames: npc = part.findAllMatches('**/%s;+s' % pieceName) @@ -2770,9 +2771,9 @@ class Toon(Avatar.Avatar, ToonHead): self.stopTrackAnimToSpeed() self.startTrackAnimToSpeed() self.controlManager.disableAvatarJump() - indices = range(OTPLocalizer.SCMenuCommonCogIndices[0], OTPLocalizer.SCMenuCommonCogIndices[1] + 1) + indices = list(range(OTPLocalizer.SCMenuCommonCogIndices[0], OTPLocalizer.SCMenuCommonCogIndices[1] + 1)) customIndices = OTPLocalizer.SCMenuCustomCogIndices[suitType] - indices += range(customIndices[0], customIndices[1] + 1) + indices += list(range(customIndices[0], customIndices[1] + 1)) self.chatMgr.chatInputSpeedChat.addCogMenu(indices) self.suit.loop('neutral') self.isDisguised = 1 diff --git a/toontown/toon/ToonAvatarDetailPanel.py b/toontown/toon/ToonAvatarDetailPanel.py index 908e196..ac087eb 100644 --- a/toontown/toon/ToonAvatarDetailPanel.py +++ b/toontown/toon/ToonAvatarDetailPanel.py @@ -6,9 +6,9 @@ from direct.showbase import DirectObject from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.directnotify import DirectNotifyGlobal -import DistributedToon +from . import DistributedToon from toontown.friends import FriendInviter -import ToonTeleportPanel +from . import ToonTeleportPanel from toontown.toonbase import TTLocalizer from toontown.hood import ZoneUtil from toontown.toonbase.ToontownBattleGlobals import Tracks, Levels @@ -44,7 +44,7 @@ class ToonAvatarDetailPanel(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('ToonAvatarDetailPanel') def __init__(self, avId, avName, playerId = None, parent = aspect2dp, **kw): - print 'ToonAvatarDetailPanel %s' % playerId + print('ToonAvatarDetailPanel %s' % playerId) buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') gui = loader.loadModel('phase_3.5/models/gui/avatar_panel_gui') detailPanel = gui.find('**/avatarInfoPanel') diff --git a/toontown/toon/ToonAvatarPanel.py b/toontown/toon/ToonAvatarPanel.py index 6bfde77..8b6e639 100644 --- a/toontown/toon/ToonAvatarPanel.py +++ b/toontown/toon/ToonAvatarPanel.py @@ -2,17 +2,17 @@ from pandac.PandaModules import * from direct.gui.DirectGui import * from pandac.PandaModules import * from direct.showbase import DirectObject -import ToonHead +from . import ToonHead from toontown.friends import FriendHandle -import LaffMeter +from . import LaffMeter from otp.avatar import Avatar from direct.distributed import DistributedObject from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.friends import ToontownFriendSecret -import ToonAvatarDetailPanel -import AvatarPanelBase +from . import ToonAvatarDetailPanel +from . import AvatarPanelBase from toontown.toontowngui import TTDialog from otp.otpbase import OTPGlobals @@ -130,7 +130,7 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase): - if base.cr.playerFriendsManager.askTransientFriend(self.avId) and not base.cr.doId2do.has_key(self.avId): + if base.cr.playerFriendsManager.askTransientFriend(self.avId) and self.avId not in base.cr.doId2do: self.friendButton['state'] = DGG.DISABLED diff --git a/toontown/toon/ToonDNA.py b/toontown/toon/ToonDNA.py index 2d3c22a..4507efc 100644 --- a/toontown/toon/ToonDNA.py +++ b/toontown/toon/ToonDNA.py @@ -1758,10 +1758,10 @@ def getRandomBottom(gender, tailorId = MAKE_A_TOON, generator = None, girlBottom elif girlBottomType is None: style = generator.choice(collection[GIRL_BOTTOMS]) elif girlBottomType == SKIRT: - skirtCollection = filter(lambda style: GirlBottoms[BottomStyles[style][0]][1] == SKIRT, collection[GIRL_BOTTOMS]) + skirtCollection = [style for style in collection[GIRL_BOTTOMS] if GirlBottoms[BottomStyles[style][0]][1] == SKIRT] style = generator.choice(skirtCollection) elif girlBottomType == SHORTS: - shortsCollection = filter(lambda style: GirlBottoms[BottomStyles[style][0]][1] == SHORTS, collection[GIRL_BOTTOMS]) + shortsCollection = [style for style in collection[GIRL_BOTTOMS] if GirlBottoms[BottomStyles[style][0]][1] == SHORTS] style = generator.choice(shortsCollection) else: notify.error('Bad girlBottomType: %s' % girlBottomType) @@ -1787,7 +1787,7 @@ def getRandomGirlBottomAndColor(type): typeStr = 'gsh' else: typeStr = 'gsk' - for bottom in BottomStyles.keys(): + for bottom in list(BottomStyles.keys()): if bottom.find(typeStr) >= 0: bottoms.append(bottom) @@ -1854,7 +1854,7 @@ def getTops(gender, tailorId = MAKE_A_TOON): def getAllTops(gender): tops = [] - for style in ShirtStyles.keys(): + for style in list(ShirtStyles.keys()): if gender == 'm': if style[0] == 'g' or style[:3] == 'c_g': continue @@ -1884,7 +1884,7 @@ def getBottoms(gender, tailorId = MAKE_A_TOON): def getAllBottoms(gender, output = 'both'): bottoms = [] - for style in BottomStyles.keys(): + for style in list(BottomStyles.keys()): if gender == 'm': if style[0] == 'g' or style[:3] == 'c_g' or style[:4] == 'vd_g' or style[:4] == 'sd_g' or style[:4] == 'j4_g' or style[:4] == 'pj_g' or style[:4] == 'wh_g' or style[:4] == 'sa_g' or style[:4] == 'sc_g' or style[:5] == 'sil_g' or style[:4] == 'hw_g': continue @@ -1977,8 +1977,8 @@ defaultGirlColorList = [1, 22, 23, 24] -allColorsListApproximations = map(lambda x: VBase4(round(x[0], 3), round(x[1], 3), round(x[2], 3), round(x[3], 3)), allColorsList) -allowedColors = set(map(lambda x: allColorsListApproximations[x], set(defaultBoyColorList + defaultGirlColorList + [26]))) +allColorsListApproximations = [VBase4(round(x[0], 3), round(x[1], 3), round(x[2], 3), round(x[3], 3)) for x in allColorsList] +allowedColors = set([allColorsListApproximations[x] for x in set(defaultBoyColorList + defaultGirlColorList + [26])]) HatModels = [None, 'phase_4/models/accessories/tt_m_chr_avt_acc_hat_baseball', 'phase_4/models/accessories/tt_m_chr_avt_acc_hat_safari', @@ -2353,7 +2353,7 @@ ShoesStyles = {'none': [0, 0, 0], 'smj4': [2, 29, 0]} def isValidHat(itemIdx, textureIdx, colorIdx): - for style in HatStyles.values(): + for style in list(HatStyles.values()): if itemIdx == style[0] and textureIdx == style[1] and colorIdx == style[2]: return True @@ -2361,7 +2361,7 @@ def isValidHat(itemIdx, textureIdx, colorIdx): def isValidGlasses(itemIdx, textureIdx, colorIdx): - for style in GlassesStyles.values(): + for style in list(GlassesStyles.values()): if itemIdx == style[0] and textureIdx == style[1] and colorIdx == style[2]: return True @@ -2369,7 +2369,7 @@ def isValidGlasses(itemIdx, textureIdx, colorIdx): def isValidBackpack(itemIdx, textureIdx, colorIdx): - for style in BackpackStyles.values(): + for style in list(BackpackStyles.values()): if itemIdx == style[0] and textureIdx == style[1] and colorIdx == style[2]: return True @@ -2377,7 +2377,7 @@ def isValidBackpack(itemIdx, textureIdx, colorIdx): def isValidShoes(itemIdx, textureIdx, colorIdx): - for style in ShoesStyles.values(): + for style in list(ShoesStyles.values()): if itemIdx == style[0] and textureIdx == style[1] and colorIdx == style[2]: return True diff --git a/toontown/toon/ToonHead.py b/toontown/toon/ToonHead.py index 611683b..9e04ee0 100644 --- a/toontown/toon/ToonHead.py +++ b/toontown/toon/ToonHead.py @@ -638,7 +638,7 @@ class ToonHead(Actor.Actor): lp = self.__eyes.find('**/joint_pupilL*') rp = self.__eyes.find('**/joint_pupilR*') if lp.isEmpty() or rp.isEmpty(): - print 'Unable to locate pupils.' + print('Unable to locate pupils.') else: leye = self.__eyes.attachNewNode('leye') reye = self.__eyes.attachNewNode('reye') diff --git a/toontown/toon/ToonHeadFrame.py b/toontown/toon/ToonHeadFrame.py index 9cd83e1..af6d50e 100644 --- a/toontown/toon/ToonHeadFrame.py +++ b/toontown/toon/ToonHeadFrame.py @@ -1,6 +1,6 @@ from direct.gui.DirectGui import * from pandac.PandaModules import * -import ToonHead +from . import ToonHead from toontown.distributed import DelayDelete from toontown.toonbase import ToontownGlobals diff --git a/toontown/toon/ToonTeleportPanel.py b/toontown/toon/ToonTeleportPanel.py index 067feee..ec6b5a1 100644 --- a/toontown/toon/ToonTeleportPanel.py +++ b/toontown/toon/ToonTeleportPanel.py @@ -7,7 +7,7 @@ from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.directnotify import DirectNotifyGlobal from otp.avatar.Avatar import teleportNotify -import ToonAvatarDetailPanel +from . import ToonAvatarDetailPanel from toontown.toonbase import TTLocalizer from toontown.hood import ZoneUtil globalTeleport = None @@ -121,7 +121,7 @@ class ToonTeleportPanel(DirectFrame): hasManager = hasattr(base.cr, 'playerFriendsManager') if self.avId == myId: self.fsm.request('self') - elif base.cr.doId2do.has_key(self.avId): + elif self.avId in base.cr.doId2do: self.fsm.request('checkAvailability') elif base.cr.isFriend(self.avId): if base.cr.isFriendOnline(self.avId): @@ -248,7 +248,7 @@ class ToonTeleportPanel(DirectFrame): teleportNotify.debug('enterTeleport: unknownHood') self.fsm.request('unknownHood', [hoodId]) elif canonicalHoodId not in base.cr.hoodMgr.getAvailableZones(): - print 'hoodId %d not ready' % hoodId + print('hoodId %d not ready' % hoodId) self.fsm.request('unavailableHood', [hoodId]) else: if shardId == base.localAvatar.defaultShard: diff --git a/toontown/toonbase/TTLocalizer.py b/toontown/toonbase/TTLocalizer.py index ab54c80..2e9c279 100644 --- a/toontown/toonbase/TTLocalizer.py +++ b/toontown/toonbase/TTLocalizer.py @@ -13,34 +13,34 @@ def getLanguage(): return language -print 'TTLocalizer: Running in language: %s' % language +print('TTLocalizer: Running in language: %s' % language) if language == 'english': _languageModule = 'toontown.toonbase.TTLocalizer' + string.capitalize(language) else: checkLanguage = 1 _languageModule = 'toontown.toonbase.TTLocalizer_' + language -print 'from ' + _languageModule + ' import *' +print('from ' + _languageModule + ' import *') from toontown.toonbase.TTLocalizerEnglish import * if checkLanguage: l = {} g = {} englishModule = __import__('toontown.toonbase.TTLocalizerEnglish', g, l) foreignModule = __import__(_languageModule, g, l) - for key, val in englishModule.__dict__.items(): - if not foreignModule.__dict__.has_key(key): - print 'WARNING: Foreign module: %s missing key: %s' % (_languageModule, key) + for key, val in list(englishModule.__dict__.items()): + if key not in foreignModule.__dict__: + print('WARNING: Foreign module: %s missing key: %s' % (_languageModule, key)) locals()[key] = val - elif isinstance(val, types.DictType): + elif isinstance(val, dict): fval = foreignModule.__dict__.get(key) - for dkey, dval in val.items(): - if not fval.has_key(dkey): - print 'WARNING: Foreign module: %s missing key: %s.%s' % (_languageModule, key, dkey) + for dkey, dval in list(val.items()): + if dkey not in fval: + print('WARNING: Foreign module: %s missing key: %s.%s' % (_languageModule, key, dkey)) fval[dkey] = dval - for dkey in fval.keys(): - if not val.has_key(dkey): - print 'WARNING: Foreign module: %s extra key: %s.%s' % (_languageModule, key, dkey) + for dkey in list(fval.keys()): + if dkey not in val: + print('WARNING: Foreign module: %s extra key: %s.%s' % (_languageModule, key, dkey)) - for key in foreignModule.__dict__.keys(): - if not englishModule.__dict__.has_key(key): - print 'WARNING: Foreign module: %s extra key: %s' % (_languageModule, key) + for key in list(foreignModule.__dict__.keys()): + if key not in englishModule.__dict__: + print('WARNING: Foreign module: %s extra key: %s' % (_languageModule, key)) diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 7d44b3f..edc2bd4 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -2,7 +2,7 @@ from toontown.toonbase.TTLocalizerEnglishProperty import * from toontown.catalog import CatalogAccessoryItemGlobals from otp.otpbase import OTPLocalizer as OL OL.SpeedChatStaticText = OL.SpeedChatStaticTextToontown.copy() -for key in OL.SpeedChatStaticTextCommon.iterkeys(): +for key in OL.SpeedChatStaticTextCommon.keys(): OL.SpeedChatStaticText[key] = OL.SpeedChatStaticTextCommon[key] commitmantst = 'kptmptest - removable' @@ -5922,7 +5922,7 @@ AccessoryNamePrefix = {0: 'hat unisex ', 11: 'shoes girl '} AwardManagerAccessoryNames = {} AccessoryTypeNames = {} -for accessoryId in CatalogAccessoryItemGlobals.AccessoryTypes.keys(): +for accessoryId in list(CatalogAccessoryItemGlobals.AccessoryTypes.keys()): accessoryInfo = CatalogAccessoryItemGlobals.AccessoryTypes[accessoryId] if accessoryInfo[0] % 4 == 0: accessoryStyleDescription = HatStylesDescriptions diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index d2476d4..2fb280b 100644 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -2,9 +2,9 @@ from otp.otpbase import OTPBase from otp.otpbase import OTPLauncherGlobals from otp.otpbase import OTPGlobals from direct.showbase.PythonUtil import * -import ToontownGlobals +from . import ToontownGlobals from direct.directnotify import DirectNotifyGlobal -import ToontownLoader +from . import ToontownLoader from direct.gui import DirectGuiGlobals from direct.gui.DirectGui import * from pandac.PandaModules import * @@ -76,7 +76,7 @@ class ToonBase(OTPBase.OTPBase): self.transitions.IrisModelName = 'phase_3/models/misc/iris' self.transitions.FadeModelName = 'phase_3/models/misc/fade' self.exitFunc = self.userExit - if __builtins__.has_key('launcher') and launcher: + if 'launcher' in __builtins__ and launcher: launcher.setPandaErrorCode(11) globalClock.setMaxDt(0.2) if self.config.GetBool('want-particles', 1) == 1: @@ -341,7 +341,7 @@ class ToonBase(OTPBase.OTPBase): def removeGlitchMessage(self): self.ignore('InputState-forward') - print 'ignoring InputState-forward' + print('ignoring InputState-forward') def exitShow(self, errorCode = None): self.notify.info('Exiting Toontown: errorCode = %s' % errorCode) diff --git a/toontown/toonbase/ToonBaseGlobal.py b/toontown/toonbase/ToonBaseGlobal.py index f593a0c..d10c337 100644 --- a/toontown/toonbase/ToonBaseGlobal.py +++ b/toontown/toonbase/ToonBaseGlobal.py @@ -1 +1 @@ -from ToonBase import * +from .ToonBase import * diff --git a/toontown/toonbase/ToontownBattleGlobals.py b/toontown/toonbase/ToontownBattleGlobals.py index 7e1398f..39ba608 100644 --- a/toontown/toonbase/ToontownBattleGlobals.py +++ b/toontown/toonbase/ToontownBattleGlobals.py @@ -1,6 +1,6 @@ -from ToontownGlobals import * +from .ToontownGlobals import * import math -import TTLocalizer +from . import TTLocalizer BattleCamFaceOffFov = 30.0 BattleCamFaceOffPos = Point3(0, -10, 4) BattleCamDefaultPos = Point3(0, -8.6, 16.5) diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index d3c0ce8..11e1689 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1,4 +1,4 @@ -import TTLocalizer +from . import TTLocalizer from otp.otpbase.OTPGlobals import * from direct.showbase.PythonUtil import Enum, invertDict from pandac.PandaModules import BitMask32, Vec4 @@ -296,7 +296,7 @@ factoryId2factoryType = {MockupFactoryId: FT_FullSuit, SellbotFactoryInt: FT_FullSuit, LawbotOfficeInt: FT_FullSuit} StreetNames = TTLocalizer.GlobalStreetNames -StreetBranchZones = StreetNames.keys() +StreetBranchZones = list(StreetNames.keys()) Hoods = (DonaldsDock, ToontownCentral, TheBrrrgh, diff --git a/toontown/toonbase/ToontownStart.py b/toontown/toonbase/ToontownStart.py index c7f0a55..ea60287 100644 --- a/toontown/toonbase/ToontownStart.py +++ b/toontown/toonbase/ToontownStart.py @@ -3,34 +3,34 @@ from panda3d.core import * if __debug__: loadPrcFile('etc/Configrc.prc') -import __builtin__ +import builtins class game: name = 'toontown' process = 'client' -__builtin__.game = game() +builtins.game = game() import time import os import sys import random -import __builtin__ +import builtins try: launcher except: from toontown.launcher.ToontownDummyLauncher import ToontownDummyLauncher launcher = ToontownDummyLauncher() - __builtin__.launcher = launcher + builtins.launcher = launcher launcher.setRegistry('EXIT_PAGE', 'normal') pollingDelay = 0.5 -print 'ToontownStart: Polling for game2 to finish...' +print('ToontownStart: Polling for game2 to finish...') while not launcher.getGame2Done(): time.sleep(pollingDelay) -print 'ToontownStart: Game2 is finished.' -print 'ToontownStart: Starting the game.' +print('ToontownStart: Game2 is finished.') +print('ToontownStart: Starting the game.') if launcher.isDummy(): http = HTTPClient() else: @@ -38,14 +38,14 @@ else: tempLoader = Loader() backgroundNode = tempLoader.loadSync(Filename('phase_3/models/gui/loading-background')) from direct.gui import DirectGuiGlobals -print 'ToontownStart: setting default font' -import ToontownGlobals +print('ToontownStart: setting default font') +from . import ToontownGlobals DirectGuiGlobals.setDefaultFontFunc(ToontownGlobals.getInterfaceFont) launcher.setPandaErrorCode(7) -import ToonBase +from . import ToonBase ToonBase.ToonBase() if base.win == None: - print 'Unable to open window; aborting.' + print('Unable to open window; aborting.') sys.exit() launcher.setPandaErrorCode(0) launcher.setPandaWindowOpen() @@ -60,7 +60,7 @@ base.graphicsEngine.renderFrame() DirectGuiGlobals.setDefaultRolloverSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_rollover.mp3')) DirectGuiGlobals.setDefaultClickSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.mp3')) DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel('phase_3/models/gui/dialog_box_gui')) -import TTLocalizer +from . import TTLocalizer from otp.otpbase import OTPGlobals OTPGlobals.setDefaultProductPrefix(TTLocalizer.ProductPrefix) if base.musicManagerIsValid: @@ -69,18 +69,18 @@ if base.musicManagerIsValid: music.setLoop(1) music.setVolume(0.9) music.play() - print 'ToontownStart: Loading default gui sounds' + print('ToontownStart: Loading default gui sounds') DirectGuiGlobals.setDefaultRolloverSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_rollover.mp3')) DirectGuiGlobals.setDefaultClickSound(base.loader.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.mp3')) else: music = None -import ToontownLoader +from . import ToontownLoader from direct.gui.DirectGui import * serverVersion = base.config.GetString('server-version', 'no_version_set') -print 'ToontownStart: serverVersion: ', serverVersion +print('ToontownStart: serverVersion: ', serverVersion) version = OnscreenText(serverVersion, pos=(-1.3, -0.975), scale=0.06, fg=Vec4(0, 0, 1, 0.6), align=TextNode.ALeft) loader.beginBulkLoad('init', TTLocalizer.LoaderLabel, 138, 0, TTLocalizer.TIP_NONE) -from ToonBaseGlobal import * +from .ToonBaseGlobal import * from direct.showbase.MessengerGlobal import * from toontown.distributed import ToontownClientRepository cr = ToontownClientRepository.ToontownClientRepository(serverVersion, launcher) @@ -104,7 +104,7 @@ del tempLoader version.cleanup() del version base.loader = base.loader -__builtin__.loader = base.loader +builtins.loader = base.loader autoRun = ConfigVariableBool('toontown-auto-run', 1) if autoRun and launcher.isDummy() and (not Thread.isTrueThreads() or __name__ == '__main__'): try: @@ -113,5 +113,5 @@ if autoRun and launcher.isDummy() and (not Thread.isTrueThreads() or __name__ == raise except: from otp.otpbase import PythonUtil - print PythonUtil.describeException() + print(PythonUtil.describeException()) raise diff --git a/toontown/toonbase/UserFunnel.py b/toontown/toonbase/UserFunnel.py index d930029..89183a1 100644 --- a/toontown/toonbase/UserFunnel.py +++ b/toontown/toonbase/UserFunnel.py @@ -1,5 +1,5 @@ import os, sys, socket, random -from urllib import quote_plus +from urllib.parse import quote_plus from pandac.PandaModules import HTTPClient from pandac.PandaModules import HTTPCookie from pandac.PandaModules import URLSpec @@ -236,7 +236,7 @@ class UserFunnel: self.setTheHTTPCookie(self.pandaHTTPClientVarWSS) except IndexError: - print 'UserFunnel(Warning): Cookie Data file bad' + print('UserFunnel(Warning): Cookie Data file bad') del thedata @@ -351,7 +351,7 @@ class HitBoxCookie: try: sdir = os.listdir(self.ieCookieDir) except WindowsError: - print 'Dir does not exist, do nothing' + print('Dir does not exist, do nothing') return while sdir: @@ -400,7 +400,7 @@ class HitBoxCookie: while x < len(iecData): if iecData[x].find(self.hitboxAcct) != -1: iecData.pop(x) - print 'Removed it from the list' + print('Removed it from the list') break x += 1 @@ -500,7 +500,7 @@ class HitBoxCookie: def convertHitBoxIEtoPython(): if sys.platform != 'win32': - print 'Cookie Converter: Warning: System is not MS-Windows. I have not been setup to work with other systems yet. Sorry ' + sys.platform + ' user. The game client will create a cookie.' + print('Cookie Converter: Warning: System is not MS-Windows. I have not been setup to work with other systems yet. Sorry ' + sys.platform + ' user. The game client will create a cookie.') return if __dev__: return @@ -512,7 +512,7 @@ def convertHitBoxIEtoPython(): def convertHitBoxPythontoIE(): if sys.platform != 'win32': - print 'System is not MS-Windows. I have not been setup to work with other systems yet. Sorry ' + sys.platform + ' user.' + print('System is not MS-Windows. I have not been setup to work with other systems yet. Sorry ' + sys.platform + ' user.') return if os.path.isfile('cf.txt') == True: return @@ -524,7 +524,7 @@ def convertHitBoxPythontoIE(): def getreg(regVar): if sys.platform != 'win32': - print "System is not MS-Windows. I haven't been setup yet to work with systems other than MS-Win using MS-Internet Explorer Cookies" + print("System is not MS-Windows. I haven't been setup yet to work with systems other than MS-Win using MS-Internet Explorer Cookies") return '' siteName = 'toontown.online.disney' cookiedir = os.getenv('USERPROFILE') + '\\Cookies' @@ -537,7 +537,7 @@ def getreg(regVar): break if wholeCookie == None: - print 'Cookie not found for site name: ' + siteName + print('Cookie not found for site name: ' + siteName) return '' CompleteCookiePath = cookiedir + '\\' + wholeCookie cf = open(CompleteCookiePath, 'r') @@ -583,7 +583,7 @@ def getMAC(staticMAC = [None]): result = staticMAC[0] return result if sys.platform != 'darwin' and sys.platform != 'win32': - print 'System is not running OSX or MS-Windows.' + print('System is not running OSX or MS-Windows.') return '-2' else: return staticMAC[0] @@ -670,7 +670,7 @@ def reportMemoryLeaks(): try: baseURL = patcherVer()[0].split('/lo')[0] except IndexError: - print 'Base URL not available for leak submit' + print('Base URL not available for leak submit') return basePort = 80 diff --git a/toontown/toontowngui/TeaserPanel.py b/toontown/toontowngui/TeaserPanel.py index de466a3..21ba569 100644 --- a/toontown/toontowngui/TeaserPanel.py +++ b/toontown/toontowngui/TeaserPanel.py @@ -3,7 +3,7 @@ from direct.gui.DirectGui import * from direct.gui import DirectGuiGlobals from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal -import TTDialog +from . import TTDialog from toontown.toonbase import TTLocalizer from direct.showbase import PythonUtil from direct.showbase.DirectObject import DirectObject diff --git a/toontown/toontowngui/ToonHeadDialog.py b/toontown/toontowngui/ToonHeadDialog.py index f943e55..a6929c7 100644 --- a/toontown/toontowngui/ToonHeadDialog.py +++ b/toontown/toontowngui/ToonHeadDialog.py @@ -1,7 +1,7 @@ from pandac.PandaModules import * from toontown.toonbase.ToontownGlobals import * from direct.directnotify import DirectNotifyGlobal -import TTDialog +from . import TTDialog from toontown.toon import ToonHead class ToonHeadDialog(TTDialog.TTDialog): diff --git a/toontown/town/BRStreet.py b/toontown/town/BRStreet.py index 5043ff7..9bade86 100644 --- a/toontown/town/BRStreet.py +++ b/toontown/town/BRStreet.py @@ -1,4 +1,4 @@ -import Street +from . import Street class BRStreet(Street.Street): diff --git a/toontown/town/BRTownLoader.py b/toontown/town/BRTownLoader.py index 24ef145..1c4931c 100644 --- a/toontown/town/BRTownLoader.py +++ b/toontown/town/BRTownLoader.py @@ -1,5 +1,5 @@ -import TownLoader -import BRStreet +from . import TownLoader +from . import BRStreet from toontown.suit import Suit class BRTownLoader(TownLoader.TownLoader): diff --git a/toontown/town/DDStreet.py b/toontown/town/DDStreet.py index 66594c7..643fc87 100644 --- a/toontown/town/DDStreet.py +++ b/toontown/town/DDStreet.py @@ -1,4 +1,4 @@ -import Street +from . import Street class DDStreet(Street.Street): diff --git a/toontown/town/DDTownLoader.py b/toontown/town/DDTownLoader.py index 99e9f11..937c260 100644 --- a/toontown/town/DDTownLoader.py +++ b/toontown/town/DDTownLoader.py @@ -1,5 +1,5 @@ -import TownLoader -import DDStreet +from . import TownLoader +from . import DDStreet from toontown.suit import Suit class DDTownLoader(TownLoader.TownLoader): diff --git a/toontown/town/DGStreet.py b/toontown/town/DGStreet.py index 729eff7..2be8cb2 100644 --- a/toontown/town/DGStreet.py +++ b/toontown/town/DGStreet.py @@ -1,4 +1,4 @@ -import Street +from . import Street class DGStreet(Street.Street): diff --git a/toontown/town/DGTownLoader.py b/toontown/town/DGTownLoader.py index 69bd83f..0ba4c39 100644 --- a/toontown/town/DGTownLoader.py +++ b/toontown/town/DGTownLoader.py @@ -1,5 +1,5 @@ -import TownLoader -import DGStreet +from . import TownLoader +from . import DGStreet from toontown.suit import Suit class DGTownLoader(TownLoader.TownLoader): diff --git a/toontown/town/DLStreet.py b/toontown/town/DLStreet.py index 782731d..98c046c 100644 --- a/toontown/town/DLStreet.py +++ b/toontown/town/DLStreet.py @@ -1,4 +1,4 @@ -import Street +from . import Street class DLStreet(Street.Street): diff --git a/toontown/town/DLTownLoader.py b/toontown/town/DLTownLoader.py index 2cca7da..061fe45 100644 --- a/toontown/town/DLTownLoader.py +++ b/toontown/town/DLTownLoader.py @@ -1,5 +1,5 @@ -import TownLoader -import DLStreet +from . import TownLoader +from . import DLStreet from toontown.suit import Suit class DLTownLoader(TownLoader.TownLoader): diff --git a/toontown/town/MMStreet.py b/toontown/town/MMStreet.py index ca7a8f5..cdc4d63 100644 --- a/toontown/town/MMStreet.py +++ b/toontown/town/MMStreet.py @@ -1,4 +1,4 @@ -import Street +from . import Street class MMStreet(Street.Street): diff --git a/toontown/town/MMTownLoader.py b/toontown/town/MMTownLoader.py index fb31ee4..2bcd621 100644 --- a/toontown/town/MMTownLoader.py +++ b/toontown/town/MMTownLoader.py @@ -1,5 +1,5 @@ -import TownLoader -import MMStreet +from . import TownLoader +from . import MMStreet from toontown.suit import Suit class MMTownLoader(TownLoader.TownLoader): diff --git a/toontown/town/Street.py b/toontown/town/Street.py index f3e905f..ec9af21 100644 --- a/toontown/town/Street.py +++ b/toontown/town/Street.py @@ -240,7 +240,7 @@ class Street(BattlePlace.BattlePlace): hoodId = requestStatus['hoodId'] zoneId = requestStatus['zoneId'] if avId != -1: - if not base.cr.doId2do.has_key(avId): + if avId not in base.cr.doId2do: teleportDebug(requestStatus, "couldn't find friend %s" % avId) handle = base.cr.identifyFriend(avId) requestStatus = {'how': 'teleportIn', @@ -261,7 +261,7 @@ class Street(BattlePlace.BattlePlace): return def enterTeleportOut(self, requestStatus): - if requestStatus.has_key('battle'): + if 'battle' in requestStatus: self.__teleportOutDone(requestStatus) else: BattlePlace.BattlePlace.enterTeleportOut(self, requestStatus, self.__teleportOutDone) diff --git a/toontown/town/TTStreet.py b/toontown/town/TTStreet.py index 1df1bb5..1c34cb8 100644 --- a/toontown/town/TTStreet.py +++ b/toontown/town/TTStreet.py @@ -1,4 +1,4 @@ -import Street +from . import Street class TTStreet(Street.Street): diff --git a/toontown/town/TTTownLoader.py b/toontown/town/TTTownLoader.py index 9107d49..9ad48fe 100644 --- a/toontown/town/TTTownLoader.py +++ b/toontown/town/TTTownLoader.py @@ -1,5 +1,5 @@ -import TownLoader -import TTStreet +from . import TownLoader +from . import TTStreet from toontown.suit import Suit class TTTownLoader(TownLoader.TownLoader): diff --git a/toontown/town/TownBattle.py b/toontown/town/TownBattle.py index d4bee0b..ee417f9 100644 --- a/toontown/town/TownBattle.py +++ b/toontown/town/TownBattle.py @@ -3,13 +3,13 @@ import types from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State -import TownBattleAttackPanel -import TownBattleWaitPanel -import TownBattleChooseAvatarPanel -import TownBattleSOSPanel -import TownBattleSOSPetSearchPanel -import TownBattleSOSPetInfoPanel -import TownBattleToonPanel +from . import TownBattleAttackPanel +from . import TownBattleWaitPanel +from . import TownBattleChooseAvatarPanel +from . import TownBattleSOSPanel +from . import TownBattleSOSPetSearchPanel +from . import TownBattleSOSPetInfoPanel +from . import TownBattleToonPanel from toontown.toontowngui import TTDialog from direct.directnotify import DirectNotifyGlobal from toontown.battle import BattleBase @@ -162,7 +162,7 @@ class TownBattle(StateData.StateData): self.parentFSMState.addChild(self.fsm) if not self.isLoaded: self.load() - print 'Battle Event %s' % event + print('Battle Event %s' % event) self.battleEvent = event self.fsm.enterInitialState() base.localAvatar.laffMeter.start() @@ -430,7 +430,7 @@ class TownBattle(StateData.StateData): self.notify.debug('adjustCogsAndToons() numCogs: %s self.numCogs: %s' % (numCogs, self.numCogs)) self.notify.debug('adjustCogsAndToons() luredIndices: %s self.luredIndices: %s' % (luredIndices, self.luredIndices)) self.notify.debug('adjustCogsAndToons() trappedIndices: %s self.trappedIndices: %s' % (trappedIndices, self.trappedIndices)) - toonIds = map(lambda toon: toon.doId, toons) + toonIds = [toon.doId for toon in toons] self.notify.debug('adjustCogsAndToons() toonIds: %s self.toons: %s' % (toonIds, self.toons)) maxSuitLevel = 0 cogFireCostIndex = 0 diff --git a/toontown/town/TownBattleSOSPanel.py b/toontown/town/TownBattleSOSPanel.py index 546042b..5cd0eb6 100644 --- a/toontown/town/TownBattleSOSPanel.py +++ b/toontown/town/TownBattleSOSPanel.py @@ -91,7 +91,7 @@ class TownBattleSOSPanel(DirectFrame, StateData.StateData): return DirectButton(relief=None, text=friendName, text_scale=0.04, text_align=TextNode.ALeft, text_fg=fg, text1_bg=self.textDownColor, text2_bg=self.textRolloverColor, text3_fg=self.textDisabledColor, command=com, extraArgs=[friendId, friendName]) def makeNPCFriendButton(self, NPCFriendId, numCalls): - if not TTLocalizer.NPCToonNames.has_key(NPCFriendId): + if NPCFriendId not in TTLocalizer.NPCToonNames: return None friendName = TTLocalizer.NPCToonNames[NPCFriendId] friendName += ' %d' % numCalls @@ -174,7 +174,7 @@ class TownBattleSOSPanel(DirectFrame, StateData.StateData): if not base.cr.playerFriendsManager.askAvatarKnownElseWhere(avatarId): newFriends.append((avatarId, 0)) - for friendPair in self.friends.keys(): + for friendPair in list(self.friends.keys()): if friendPair not in newFriends: friendButton = self.friends[friendPair] self.scrollList.removeItem(friendButton) @@ -183,7 +183,7 @@ class TownBattleSOSPanel(DirectFrame, StateData.StateData): del self.friends[friendPair] for friendPair in newFriends: - if not self.friends.has_key(friendPair): + if friendPair not in self.friends: friendButton = self.makeFriendButton(friendPair) if friendButton: self.scrollList.addItem(friendButton) @@ -193,7 +193,7 @@ class TownBattleSOSPanel(DirectFrame, StateData.StateData): def __updateNPCFriendsPanel(self): self.NPCFriends = {} - for friend, count in base.localAvatar.NPCFriendsDict.items(): + for friend, count in list(base.localAvatar.NPCFriendsDict.items()): track = NPCToons.getNPCTrack(friend) if track == ToontownBattleGlobals.LURE_TRACK and self.canLure == 0 or track == ToontownBattleGlobals.TRAP_TRACK and self.canTrap == 0: self.NPCFriends[friend] = 0 diff --git a/toontown/town/TownBattleSOSPetInfoPanel.py b/toontown/town/TownBattleSOSPetInfoPanel.py index 25e6761..af62b05 100644 --- a/toontown/town/TownBattleSOSPetInfoPanel.py +++ b/toontown/town/TownBattleSOSPetInfoPanel.py @@ -86,7 +86,7 @@ class TownBattleSOSPetInfoPanel(StateData.StateData): def enter(self, petProxyId): self.petProxyId = petProxyId - if not base.cr.doId2do.has_key(petProxyId): + if petProxyId not in base.cr.doId2do: self.notify.warning('petProxyId %s not in doId2do!' % petProxyId) return self.petProxy = base.cr.doId2do[petProxyId] @@ -109,7 +109,7 @@ class TownBattleSOSPetInfoPanel(StateData.StateData): return def __handleTrickMenuEvent(self, textId): - if PetTricks.ScId2trickId.has_key(textId): + if textId in PetTricks.ScId2trickId: trickId = PetTricks.ScId2trickId[textId] doneStatus = {'mode': 'OK', 'trickId': trickId} diff --git a/toontown/town/TownBattleToonPanel.py b/toontown/town/TownBattleToonPanel.py index 26387bf..04b516a 100644 --- a/toontown/town/TownBattleToonPanel.py +++ b/toontown/town/TownBattleToonPanel.py @@ -124,7 +124,7 @@ class TownBattleToonPanel(DirectFrame): def determineWhichText(self, numTargets, targetIndex, localNum, index): returnStr = '' - targetList = range(numTargets) + targetList = list(range(numTargets)) targetList.reverse() for i in targetList: if targetIndex == -1: diff --git a/toontown/town/TownLoader.py b/toontown/town/TownLoader.py index 5bf3953..c67b080 100644 --- a/toontown/town/TownLoader.py +++ b/toontown/town/TownLoader.py @@ -11,7 +11,7 @@ from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.fsm import State from direct.task import Task -import TownBattle +from . import TownBattle from toontown.toon import Toon from toontown.toon.Toon import teleportDebug from toontown.battle import BattleParticles @@ -205,7 +205,7 @@ class TownLoader(StateData.StateData): npl = self.geom.findAllMatches('**/=DNARoot=holiday_prop') for i in range(npl.getNumPaths()): np = npl.getPath(i) - np.setTag('transformIndex', `i`) + np.setTag('transformIndex', repr(i)) self.holidayPropTransforms[i] = np.getNetTransform() self.notify.info('skipping self.geom.flattenMedium') @@ -358,7 +358,7 @@ class TownLoader(StateData.StateData): return def deleteAnimatedProps(self): - for zoneNode, animPropList in self.animPropDict.items(): + for zoneNode, animPropList in list(self.animPropDict.items()): for animProp in animPropList: animProp.delete() diff --git a/toontown/town/TutorialStreet.py b/toontown/town/TutorialStreet.py index 1385f1d..e30f5af 100644 --- a/toontown/town/TutorialStreet.py +++ b/toontown/town/TutorialStreet.py @@ -1,4 +1,4 @@ -import TTStreet +from . import TTStreet class TutorialStreet(TTStreet.TTStreet): diff --git a/toontown/town/TutorialTownLoader.py b/toontown/town/TutorialTownLoader.py index fc8baec..808930c 100644 --- a/toontown/town/TutorialTownLoader.py +++ b/toontown/town/TutorialTownLoader.py @@ -1,6 +1,6 @@ -import TownLoader -import TTTownLoader -import TutorialStreet +from . import TownLoader +from . import TTTownLoader +from . import TutorialStreet from toontown.suit import Suit from toontown.toon import Toon from toontown.hood import ZoneUtil diff --git a/toontown/uberdog/DataStore.py b/toontown/uberdog/DataStore.py index 3f33689..2d5ec9d 100644 --- a/toontown/uberdog/DataStore.py +++ b/toontown/uberdog/DataStore.py @@ -2,22 +2,22 @@ from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import ConfigVariableBool from direct.task import Task from string import maketrans -import cPickle +import pickle import os import sys -import anydbm +import dbm import time class DataStore: QueryTypes = [] - QueryTypes = dict(zip(QueryTypes, range(len(QueryTypes)))) + QueryTypes = dict(list(zip(QueryTypes, list(range(len(QueryTypes)))))) @classmethod def addQueryTypes(cls, typeStrings): - superTypes = zip(cls.QueryTypes.values(), cls.QueryTypes.keys()) + superTypes = list(zip(list(cls.QueryTypes.values()), list(cls.QueryTypes.keys()))) superTypes.sort() newTypes = [ item[1] for item in superTypes ] + typeStrings - newTypes = dict(zip(newTypes, range(1 + len(newTypes)))) + newTypes = dict(list(zip(newTypes, list(range(1 + len(newTypes)))))) return newTypes notify = DirectNotifyGlobal.directNotify.newCategory('DataStore') @@ -32,7 +32,7 @@ class DataStore: self.className = self.__class__.__name__ if self.wantAnyDbm: self.filepath += '-anydbm' - self.notify.debug('anydbm default module used: %s ' % anydbm._defaultmod.__name__) + self.notify.debug('anydbm default module used: %s ' % dbm._defaultmod.__name__) self.open() return @@ -40,12 +40,12 @@ class DataStore: if self.wantAnyDbm: try: if os.path.exists(self.filepath): - self.data = anydbm.open(self.filepath, 'w') + self.data = dbm.open(self.filepath, 'w') self.notify.debug('Opening existing anydbm database at: %s.' % (self.filepath,)) else: - self.data = anydbm.open(self.filepath, 'c') + self.data = dbm.open(self.filepath, 'c') self.notify.debug('Creating new anydbm database at: %s.' % (self.filepath,)) - except anydbm.error: + except dbm.error: self.notify.warning('Cannot open anydbm database at: %s.' % (self.filepath,)) else: @@ -63,7 +63,7 @@ class DataStore: self.notify.debug('New pickle data file will be written to %s.' % (self.filepath,)) if file: - data = cPickle.load(file) + data = pickle.load(file) file.close() self.data = data else: @@ -81,7 +81,7 @@ class DataStore: if os.path.exists(self.filepath): os.rename(self.filepath, backuppath) outfile = open(self.filepath, 'w') - cPickle.dump(self.data, outfile) + pickle.dump(self.data, outfile) outfile.close() if os.path.exists(backuppath): os.remove(backuppath) @@ -166,12 +166,12 @@ class DataStore: def query(self, query): if self.data is not None: - qData = cPickle.loads(query) + qData = pickle.loads(query) results = self.handleQuery(qData) - qResults = cPickle.dumps(results) + qResults = pickle.dumps(results) else: results = None - qResults = cPickle.dumps(results) + qResults = pickle.dumps(results) return qResults def handleQuery(self, query): diff --git a/toontown/uberdog/DistributedDeliveryManager.py b/toontown/uberdog/DistributedDeliveryManager.py index 819caf4..7132509 100644 --- a/toontown/uberdog/DistributedDeliveryManager.py +++ b/toontown/uberdog/DistributedDeliveryManager.py @@ -10,10 +10,10 @@ class DistributedDeliveryManager(DistributedObject): self.sendUpdate('hello', [message]) def rejectHello(self, message): - print 'rejected', message + print('rejected', message) def helloResponse(self, message): - print 'accepted', message + print('accepted', message) def sendAck(self): self.sendUpdate('requestAck', []) @@ -22,4 +22,4 @@ class DistributedDeliveryManager(DistributedObject): messenger.send('DeliveryManagerAck') def test(self): - print 'Distributed Delviery Manager Stub Test' + print('Distributed Delviery Manager Stub Test') diff --git a/toontown/uberdog/UDStart.py b/toontown/uberdog/UDStart.py index 7f3a86e..9192c3e 100644 --- a/toontown/uberdog/UDStart.py +++ b/toontown/uberdog/UDStart.py @@ -1,4 +1,4 @@ -import __builtin__ +import builtins class game: @@ -6,7 +6,7 @@ class game: process = 'server' -__builtin__.game = game +builtins.game = game from panda3d.core import * @@ -39,5 +39,5 @@ except SystemExit: raise except Exception: from otp.otpbase import PythonUtil - print PythonUtil.describeException() + print(PythonUtil.describeException()) raise