From 5cdd7f84afaa9775839f2137bb00704bfaa33135 Mon Sep 17 00:00:00 2001 From: Open Toontown <57279094+opentoontown@users.noreply.github.com> Date: Mon, 19 Sep 2022 16:47:30 -0400 Subject: [PATCH] general: PythonUtil.Enum has been deprecated --- otp/distributed/OTPClientRepository.py | 5 +-- .../cogdominium/CogdoFlyingGameGlobals.py | 14 ++++---- .../cogdominium/CogdoFlyingLocalPlayer.py | 4 +-- toontown/cogdominium/CogdoFlyingObstacles.py | 4 +-- toontown/cogdominium/CogdoMazeGameGlobals.py | 6 ++-- toontown/coghq/CogDisguiseGlobals.py | 4 +-- toontown/effects/DustCloud.py | 4 +-- toontown/minigame/MazeMapGui.py | 4 +-- .../DistributedPartyDanceActivityBase.py | 4 +-- toontown/parties/PartyGlobals.py | 32 +++++++++---------- toontown/pets/Pet.py | 4 +-- toontown/pets/PetConstants.py | 5 ++- toontown/pets/PetTraits.py | 7 ++-- toontown/pets/PetTricks.py | 5 +-- toontown/racing/KartDNA.py | 9 +++--- toontown/racing/KartShopGlobals.py | 4 +-- toontown/racing/KartShopGui.py | 21 ++++++------ toontown/safezone/DistributedPicnicBasket.py | 3 +- toontown/shtiker/GolfPage.py | 4 +-- toontown/shtiker/KartPage.py | 4 +-- toontown/shtiker/OptionsPage.py | 4 +-- toontown/speedchat/TTSCJellybeanJamMenu.py | 4 +-- toontown/toonbase/ToontownGlobals.py | 7 ++-- 23 files changed, 83 insertions(+), 79 deletions(-) diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 4b14f20..23240b1 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -39,14 +39,15 @@ from otp.distributed import OtpDoGlobals from otp.distributed.TelemetryLimiter import TelemetryLimiter from otp.ai.GarbageLeakServerEventAggregator import GarbageLeakServerEventAggregator from .PotentialAvatar import PotentialAvatar +from enum import IntEnum class OTPClientRepository(ClientRepositoryBase): notify = directNotify.newCategory('OTPClientRepository') avatarLimit = 6 - WishNameResult = Enum(['Failure', + WishNameResult = IntEnum('WishNameResult', ('Failure', 'PendingApproval', 'Approved', - 'Rejected']) + 'Rejected')) def __init__(self, serverVersion, launcher = None, playGame = None): ClientRepositoryBase.__init__(self) diff --git a/toontown/cogdominium/CogdoFlyingGameGlobals.py b/toontown/cogdominium/CogdoFlyingGameGlobals.py index bf0759d..4b5ee1b 100644 --- a/toontown/cogdominium/CogdoFlyingGameGlobals.py +++ b/toontown/cogdominium/CogdoFlyingGameGlobals.py @@ -1,8 +1,8 @@ -from direct.showbase import PythonUtil from pandac.PandaModules import VBase4, Vec3, Point3 from .CogdoUtil import VariableContainer, DevVariableContainer +from enum import IntEnum AI = VariableContainer() -AI.GameActions = PythonUtil.Enum(('LandOnWinPlatform', 'WinStateFinished', 'GotoWinState', 'HitWhirlwind', 'HitLegalEagle', 'HitMinion', 'DebuffInvul', 'RequestEnterEagleInterest', 'RequestExitEagleInterest', 'RanOutOfTimePenalty', 'Died', 'Spawn', 'SetBlades', 'BladeLost')) +AI.GameActions = IntEnum('GameActions', ('LandOnWinPlatform', 'WinStateFinished', 'GotoWinState', 'HitWhirlwind', 'HitLegalEagle', 'HitMinion', 'DebuffInvul', 'RequestEnterEagleInterest', 'RequestExitEagleInterest', 'RanOutOfTimePenalty', 'Died', 'Spawn', 'SetBlades', 'BladeLost')) AI.BroadcastPeriod = 0.3 AI.SafezoneId2DeathDamage = {2000: 1, 1000: 2, @@ -106,7 +106,7 @@ Gameplay.DepleteFuelStates = ['FlyingUp'] Gameplay.FuelNormalAmt = 1.0 Gameplay.FuelLowAmt = 0.66 Gameplay.FuelVeryLowAmt = 0.33 -Gameplay.FuelStates = PythonUtil.Enum(('FuelNoPropeller', 'FuelEmpty', 'FuelVeryLow', 'FuelLow', 'FuelNormal')) +Gameplay.FuelStates = IntEnum('FuelStates', ('FuelNoPropeller', 'FuelEmpty', 'FuelVeryLow', 'FuelLow', 'FuelNormal')) Gameplay.RefuelPropSpeed = 5.0 Gameplay.OverdrivePropSpeed = 2.5 Gameplay.NormalPropSpeed = 1.5 @@ -116,7 +116,7 @@ Gameplay.TargetedWarningBlinkTime = 3.0 Gameplay.HitKnockbackDist = 15.0 Gameplay.HitKnockbackTime = 0.5 Gameplay.HitCooldownTime = 2.0 -Gameplay.BackpackStates = PythonUtil.Enum(('Normal', 'Targeted', 'Attacked', 'Refuel')) +Gameplay.BackpackStates = IntEnum('BackpackStates', ('Normal', 'Targeted', 'Attacked', 'Refuel')) Gameplay.BackpackRefuelDuration = 4.0 Gameplay.BackpackState2TextureName = {Gameplay.BackpackStates.Normal: 'tt_t_ara_cfg_propellerPack', Gameplay.BackpackStates.Targeted: 'tt_t_ara_cfg_propellerPack_eagleTarget', @@ -200,9 +200,9 @@ Audio.SfxFiles = {'propeller': 'phase_4/audio/sfx/TB_propeller.ogg', 'cogDialogue': 'phase_3.5/audio/dial/COG_VO_statement.ogg', 'toonDialogue': 'phase_3.5/audio/dial/AV_dog_long.ogg'} Level = VariableContainer() -Level.GatherableTypes = PythonUtil.Enum(('Memo', 'Propeller', 'LaffPowerup', 'InvulPowerup')) -Level.ObstacleTypes = PythonUtil.Enum(('Whirlwind', 'Fan', 'Minion')) -Level.PlatformTypes = PythonUtil.Enum(('Platform', 'StartPlatform', 'EndPlatform')) +Level.GatherableTypes = IntEnum('GatherableTypes', ('Memo', 'Propeller', 'LaffPowerup', 'InvulPowerup')) +Level.ObstacleTypes = IntEnum('ObstacleTypes', ('Whirlwind', 'Fan', 'Minion')) +Level.PlatformTypes = IntEnum('PlatformTypes', ('Platform', 'StartPlatform', 'EndPlatform')) Level.PlatformType2SpawnOffset = {Level.PlatformTypes.Platform: 2.5, Level.PlatformTypes.StartPlatform: 5.0, Level.PlatformTypes.EndPlatform: 5.0} diff --git a/toontown/cogdominium/CogdoFlyingLocalPlayer.py b/toontown/cogdominium/CogdoFlyingLocalPlayer.py index 83c551c..65740c9 100644 --- a/toontown/cogdominium/CogdoFlyingLocalPlayer.py +++ b/toontown/cogdominium/CogdoFlyingLocalPlayer.py @@ -1,7 +1,6 @@ import math import random from pandac.PandaModules import Vec3 -from direct.showbase import PythonUtil from direct.directnotify import DirectNotifyGlobal from direct.task.Task import Task from direct.interval.FunctionInterval import Wait @@ -21,13 +20,14 @@ from .CogdoFlyingCameraManager import CogdoFlyingCameraManager from .CogdoFlyingObjects import CogdoFlyingPlatform, CogdoFlyingGatherable from .CogdoFlyingLegalEagle import CogdoFlyingLegalEagle from . import CogdoFlyingGameGlobals as Globals +from enum import IntEnum class CogdoFlyingLocalPlayer(CogdoFlyingPlayer): notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingLocalPlayer') BroadcastPosTask = 'CogdoFlyingLocalPlayerBroadcastPos' PlayWaitingMusicEventName = 'PlayWaitingMusicEvent' RanOutOfTimeEventName = 'RanOutOfTimeEvent' - PropStates = PythonUtil.Enum(('Normal', 'Overdrive', 'Off')) + PropStates = IntEnum('PropStates', ('Normal', 'Overdrive', 'Off')) def __init__(self, toon, game, level, guiMgr): CogdoFlyingPlayer.__init__(self, toon) diff --git a/toontown/cogdominium/CogdoFlyingObstacles.py b/toontown/cogdominium/CogdoFlyingObstacles.py index 4248dff..9c77b92 100644 --- a/toontown/cogdominium/CogdoFlyingObstacles.py +++ b/toontown/cogdominium/CogdoFlyingObstacles.py @@ -3,7 +3,6 @@ from direct.showbase.DirectObject import DirectObject from direct.interval.IntervalGlobal import LerpFunc, ActorInterval, LerpPosInterval from direct.interval.MetaInterval import Sequence from direct.directutil import Mopath -from direct.showbase import PythonUtil from pandac.PandaModules import * from toontown.toonbase import ToontownGlobals from toontown.suit import Suit @@ -15,6 +14,7 @@ from .CogdoFlyingUtil import swapAvatarShadowPlacer from direct.particles import ParticleEffect from direct.particles import Particles from direct.particles import ForceGroup +from enum import IntEnum class CogdoFlyingObtacleFactory: @@ -90,7 +90,7 @@ class CogdoFlyingObtacleFactory: class CogdoFlyingObstacle(DirectObject): EnterEventName = 'CogdoFlyingObstacle_Enter' ExitEventName = 'CogdoFlyingObstacle_Exit' - MotionTypes = PythonUtil.Enum(('BackForth', 'Loop')) + MotionTypes = IntEnum('MotionTypes', ('BackForth', 'Loop')) def __init__(self, type, index, model, collSolid, motionPath = None, motionPattern = None, blendMotion = True, instanceModel = True): self.type = type diff --git a/toontown/cogdominium/CogdoMazeGameGlobals.py b/toontown/cogdominium/CogdoMazeGameGlobals.py index 221c24b..0ae41c4 100644 --- a/toontown/cogdominium/CogdoMazeGameGlobals.py +++ b/toontown/cogdominium/CogdoMazeGameGlobals.py @@ -1,6 +1,6 @@ -from direct.showbase import PythonUtil from pandac.PandaModules import VBase4 -GameActions = PythonUtil.Enum(('EnterDoor', +from enum import IntEnum +GameActions = IntEnum('GameActions', ('EnterDoor', 'RevealDoor', 'OpenDoor', 'Countdown', @@ -81,7 +81,7 @@ PickupsUntilDoorOpens = int(NumPickups * 0.6) SuitCollisionName = 'CogdoMazeSuit_Collision' SuitWalkSameDirectionProb = 1 SuitWalkTurnAroundProb = 100 -SuitTypes = PythonUtil.Enum(('Boss', 'FastMinion', 'SlowMinion')) +SuitTypes = IntEnum('SuitTypes', ('Boss', 'FastMinion', 'SlowMinion')) SuitData = {} SuitData[SuitTypes.Boss] = {'dnaName': 'ms', 'cellWalkPeriod': 192, diff --git a/toontown/coghq/CogDisguiseGlobals.py b/toontown/coghq/CogDisguiseGlobals.py index 46838eb..f3c8ac3 100644 --- a/toontown/coghq/CogDisguiseGlobals.py +++ b/toontown/coghq/CogDisguiseGlobals.py @@ -1,7 +1,7 @@ from toontown.suit import SuitDNA from toontown.toonbase import TTLocalizer -from direct.showbase import PythonUtil from otp.otpbase import OTPGlobals +from enum import IntEnum PartsPerSuit = (17, 14, 12, @@ -428,7 +428,7 @@ PartsQueryNames = ({1: PartNameStrings[0], 16384: PartNameStrings[14], 32768: PartNameStrings[15], 65536: PartNameStrings[15]}) -suitTypes = PythonUtil.Enum(('NoSuit', 'NoMerits', 'FullSuit')) +suitTypes = IntEnum('suitTypes', ('NoSuit', 'NoMerits', 'FullSuit')) def getNextPart(parts, partIndex, dept): dept = dept2deptIndex(dept) diff --git a/toontown/effects/DustCloud.py b/toontown/effects/DustCloud.py index 2cf8d2d..02a5cf9 100644 --- a/toontown/effects/DustCloud.py +++ b/toontown/effects/DustCloud.py @@ -1,9 +1,9 @@ from pandac.PandaModules import * from direct.interval.IntervalGlobal import * -from direct.showbase import PythonUtil from toontown.battle.BattleProps import globalPropPool from direct.directnotify import DirectNotifyGlobal -SFX = PythonUtil.Enum('poof, magic') +from enum import IntEnum +SFX = IntEnum('SFX', ('poof, magic')) SFXPATHS = {SFX.poof: 'phase_4/audio/sfx/firework_distance_02.ogg', SFX.magic: 'phase_4/audio/sfx/SZ_DD_treasure.ogg'} diff --git a/toontown/minigame/MazeMapGui.py b/toontown/minigame/MazeMapGui.py index 877261b..626143d 100644 --- a/toontown/minigame/MazeMapGui.py +++ b/toontown/minigame/MazeMapGui.py @@ -1,12 +1,12 @@ -from direct.showbase.PythonUtil import Enum from direct.gui.DirectGui import DirectFrame, DGG from pandac.PandaModules import Vec2, VBase4F from pandac.PandaModules import CardMaker, NodePath from pandac.PandaModules import Texture, PNMImage +from enum import IntEnum DEFAULT_MASK_RESOLUTION = 32 DEFAULT_RADIUS_RATIO = 0.05 MAP_RESOLUTION = 320 -MazeRevealType = Enum(('SmoothCircle', 'HardCircle', 'Square')) +MazeRevealType = IntEnum('MazeRevealType', ('SmoothCircle', 'HardCircle', 'Square')) MAZE_REVEAL_TYPE = MazeRevealType.SmoothCircle class MazeMapGui(DirectFrame): diff --git a/toontown/parties/DistributedPartyDanceActivityBase.py b/toontown/parties/DistributedPartyDanceActivityBase.py index 235f0a6..3963e0b 100644 --- a/toontown/parties/DistributedPartyDanceActivityBase.py +++ b/toontown/parties/DistributedPartyDanceActivityBase.py @@ -2,7 +2,6 @@ import random from pandac.PandaModules import * from direct.interval.FunctionInterval import Wait, Func from direct.interval.MetaInterval import Sequence, Parallel -from direct.showbase.PythonUtil import lerp, Enum from direct.fsm import FSM from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals @@ -17,8 +16,9 @@ from toontown.parties.PartyDanceActivityToonFSM import ToonDancingStates from toontown.parties.KeyCodes import KeyCodes from toontown.parties.KeyCodesGui import KeyCodesGui from toontown.parties import PartyGlobals +from enum import IntEnum DANCE_FLOOR_COLLISION = 'danceFloor_collision' -DanceViews = Enum(('Normal', 'Dancing', 'Isometric')) +DanceViews = IntEnum('DanceViews', ('Normal', 'Dancing', 'Isometric')) class DistributedPartyDanceActivityBase(DistributedPartyActivity): notify = directNotify.newCategory('DistributedPartyDanceActivity') diff --git a/toontown/parties/PartyGlobals.py b/toontown/parties/PartyGlobals.py index 9018cf6..f821da3 100644 --- a/toontown/parties/PartyGlobals.py +++ b/toontown/parties/PartyGlobals.py @@ -1,7 +1,7 @@ from pandac.PandaModules import BitMask32 from pandac.PandaModules import Point3, VBase4 -from direct.showbase import PythonUtil from toontown.toonbase import TTLocalizer +from enum import IntEnum KICK_TO_PLAYGROUND_EVENT = 'parties_kickToPlayground' MaxSetInvites = 1000 MaxSetPartiesInvitedTo = 100 @@ -41,36 +41,36 @@ AvailableGridSquares = 202 TrashCanPosition = (-0.24, 0.0, -0.65) TrashCanScale = 0.7 PartyEditorTrashBounds = ((-0.16, -0.38), (-0.05, -0.56)) -ActivityRequestStatus = PythonUtil.Enum(('Joining', 'Exiting')) -InviteStatus = PythonUtil.Enum(('NotRead', +ActivityRequestStatus = IntEnum('ActivityRequestStatus', ('Joining', 'Exiting')) +InviteStatus = IntEnum('InviteStatus', ('NotRead', 'ReadButNotReplied', 'Accepted', 'Rejected')) -InviteTheme = PythonUtil.Enum(('Birthday', +InviteTheme = IntEnum('InviteTheme', ('Birthday', 'GenericMale', 'GenericFemale', 'Racing', 'Valentoons', 'VictoryParty', 'Winter')) -PartyStatus = PythonUtil.Enum(('Pending', +PartyStatus = IntEnum('PartyStatus', ('Pending', 'Cancelled', 'Finished', 'CanStart', 'Started', 'NeverStarted')) -AddPartyErrorCode = PythonUtil.Enum(('AllOk', +AddPartyErrorCode = IntEnum('AddPartyErrorCode', ('AllOk', 'ValidationError', 'DatabaseError', 'TooManyHostedParties')) -ChangePartyFieldErrorCode = PythonUtil.Enum(('AllOk', +ChangePartyFieldErrorCode = IntEnum('ChangePartyFieldErrorCode', ('AllOk', 'ValidationError', 'DatabaseError', 'AlreadyStarted', 'AlreadyRefunded')) -ActivityTypes = PythonUtil.Enum(('HostInitiated', 'GuestInitiated', 'Continuous')) -PartyGateDenialReasons = PythonUtil.Enum(('Unavailable', 'Full')) -ActivityIds = PythonUtil.Enum(('PartyJukebox', +ActivityTypes = IntEnum('ActivityTypes', ('HostInitiated', 'GuestInitiated', 'Continuous')) +PartyGateDenialReasons = IntEnum('PartyGateDenialReasons', ('Unavailable', 'Full')) +ActivityIds = IntEnum('ActivityIds', ('PartyJukebox', 'PartyCannon', 'PartyTrampoline', 'PartyCatch', @@ -129,7 +129,7 @@ ValentinePartyReplacementActivityIds = frozenset([ActivityIds.PartyDance, ActivityIds.PartyJukebox, ActivityIds.PartyJukebox40, ActivityIds.PartyTrampoline]) -DecorationIds = PythonUtil.Enum(('BalloonAnvil', +DecorationIds = IntEnum('DecorationIds', ('BalloonAnvil', 'BalloonStage', 'Bow', 'Cake', @@ -177,7 +177,7 @@ ValentinePartyDecorationIds = frozenset([DecorationIds.BalloonAnvilValentine, DecorationIds.FlyingHeart]) ValentinePartyReplacementDecorationIds = frozenset([DecorationIds.BalloonAnvil, DecorationIds.BannerJellyBean]) UnreleasedDecorationIds = () -GoToPartyStatus = PythonUtil.Enum(('AllowedToGo', +GoToPartyStatus = IntEnum('GoToPartyStatus', ('AllowedToGo', 'PartyFull', 'PrivateParty', 'PartyOver', @@ -500,8 +500,8 @@ DecorationInformationDict = {DecorationIds.BalloonAnvil: {'cost': int(10 * Party 'paidOnly': False, 'gridAsset': 'decoration_1x1'}} DefaultRulesTimeout = 10.0 -DenialReasons = PythonUtil.Enum(('Default', 'Full', 'SilentFail'), start=0) -FireworkShows = PythonUtil.Enum(('Summer',), start=200) +DenialReasons = IntEnum('DenialReasons', ('Default', 'Full', 'SilentFail'), start=0) +FireworkShows = IntEnum('FireworkShows', ('Summer',), start=200) FireworksGlobalXOffset = 160.0 FireworksGlobalYOffset = -20.0 FireworksPostLaunchDelay = 5.0 @@ -510,7 +510,7 @@ RocketDirectionDelay = 2.0 FireworksStartedEvent = 'PartyFireworksStarted' FireworksFinishedEvent = 'PartyFireworksFinished' FireworksTransitionToDisabledDelay = 3.0 -TeamActivityTeams = PythonUtil.Enum(('LeftTeam', 'RightTeam'), start=0) +TeamActivityTeams = IntEnum('TeamActivityTeams', ('LeftTeam', 'RightTeam'), start=0) TeamActivityNeitherTeam = 3 TeamActivityTextScale = 0.135 TeamActivityStartDelay = 8.0 @@ -730,7 +730,7 @@ DanceReverseLoopAnims = ['left', 'up', 'down', 'good-putt'] -ToonDancingStates = PythonUtil.Enum(('Init', +ToonDancingStates = IntEnum('ToonDancingStates', ('Init', 'DanceMove', 'Run', 'Cleanup')) diff --git a/toontown/pets/Pet.py b/toontown/pets/Pet.py index aec1233..0931f90 100644 --- a/toontown/pets/Pet.py +++ b/toontown/pets/Pet.py @@ -11,7 +11,7 @@ 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 toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownGlobals -from direct.showbase import PythonUtil +from enum import IntEnum import random Component2IconDict = {'boredom': 'Bored', 'restlessness': None, @@ -29,7 +29,7 @@ Component2IconDict = {'boredom': 'Bored', class Pet(Avatar.Avatar): notify = DirectNotifyGlobal.directNotify.newCategory('Pet') SerialNum = 0 - Interactions = PythonUtil.Enum('SCRATCH, BEG, EAT, NEUTRAL') + Interactions = IntEnum('Interactions', ('SCRATCH, BEG, EAT, NEUTRAL')) InteractAnims = {Interactions.SCRATCH: ('toPet', 'pet', 'fromPet'), Interactions.BEG: ('toBeg', 'beg', 'fromBeg'), Interactions.EAT: ('eat', 'swallow', 'neutral'), diff --git a/toontown/pets/PetConstants.py b/toontown/pets/PetConstants.py index 72c4c9e..dcc58a3 100644 --- a/toontown/pets/PetConstants.py +++ b/toontown/pets/PetConstants.py @@ -1,7 +1,6 @@ from pandac.PandaModules import * -from direct.showbase.PythonUtil import Enum, invertDictLossless -import math from toontown.toonbase import ToontownGlobals +from enum import IntEnum OurPetsMoodChangedKey = 'OurPetsMoodChanged' ThinkPeriod = 1.5 MoodDriftPeriod = 300.0 @@ -25,7 +24,7 @@ HungerChaseToonScale = 1.2 FleeFromOwnerScale = 0.5 GettingAttentionGoalScale = 1.2 GettingAttentionGoalScaleDur = 7.0 -AnimMoods = Enum('EXCITED, SAD, NEUTRAL') +AnimMoods = IntEnum('AnimMoods', ('EXCITED, SAD, NEUTRAL')) FwdSpeed = 12.0 RotSpeed = 360.0 _HappyMult = 1.0 diff --git a/toontown/pets/PetTraits.py b/toontown/pets/PetTraits.py index 413e71d..413f61b 100644 --- a/toontown/pets/PetTraits.py +++ b/toontown/pets/PetTraits.py @@ -1,7 +1,8 @@ -from direct.showbase.PythonUtil import randFloat, normalDistrib, Enum +from direct.showbase.PythonUtil import randFloat, normalDistrib from direct.showbase.PythonUtil import clampScalar from toontown.toonbase import TTLocalizer, ToontownGlobals import random, copy +from enum import IntEnum TraitDivisor = 10000 def getTraitNames(): @@ -23,8 +24,8 @@ def gaussian(min, max, rng): class TraitDistribution: - TraitQuality = Enum('VERY_BAD, BAD, AVERAGE, GOOD, VERY_GOOD') - TraitTypes = Enum('INCREASING, DECREASING') + TraitQuality = IntEnum('TraitQuality', ('VERY_BAD, BAD, AVERAGE, GOOD, VERY_GOOD')) + TraitTypes = IntEnum('TraitTypes', ('INCREASING, DECREASING')) Sz2MinMax = None TraitType = None TraitCutoffs = {TraitTypes.INCREASING: {TraitQuality.VERY_BAD: 0.1, diff --git a/toontown/pets/PetTricks.py b/toontown/pets/PetTricks.py index 9d46ba2..951ee4e 100644 --- a/toontown/pets/PetTricks.py +++ b/toontown/pets/PetTricks.py @@ -1,7 +1,8 @@ -from direct.showbase.PythonUtil import Enum, invertDictLossless +from direct.showbase.PythonUtil import invertDictLossless from direct.interval.IntervalGlobal import * import random -Tricks = Enum('JUMP, BEG, PLAYDEAD, ROLLOVER, BACKFLIP, DANCE, SPEAK, BALK,') +from enum import IntEnum +Tricks = IntEnum('Tricks', ('JUMP, BEG, PLAYDEAD, ROLLOVER, BACKFLIP, DANCE, SPEAK, BALK,')) NonHappyMinActualTrickAptitude = 0.1 NonHappyMaxActualTrickAptitude = 0.6 MinActualTrickAptitude = 0.5 diff --git a/toontown/racing/KartDNA.py b/toontown/racing/KartDNA.py index c2f2ca8..a20245a 100644 --- a/toontown/racing/KartDNA.py +++ b/toontown/racing/KartDNA.py @@ -1,16 +1,15 @@ from direct.directnotify import DirectNotifyGlobal -from direct.showbase import PythonUtil from toontown.toonbase import TTLocalizer from pandac.PandaModules import * from .KartShopGlobals import * -import types +from enum import IntEnum if (__debug__): import pdb import copy -KartDNA = PythonUtil.Enum('bodyType, bodyColor, accColor, ebType, spType, fwwType, bwwType, rimsType, decalType') +KartDNA = IntEnum('KartDNA', ('bodyType, bodyColor, accColor, ebType, spType, fwwType, bwwType, rimsType, decalType')) InvalidEntry = -1 -KartInfo = PythonUtil.Enum('name, model, cost, viewDist, decalId, LODmodel1, LODmodel2') -AccInfo = PythonUtil.Enum('name, model, cost, texCard, attach') +KartInfo = IntEnum('KartInfo', ('name, model, cost, viewDist, decalId, LODmodel1, LODmodel2')) +AccInfo = IntEnum('KartInfo', ('name, model, cost, texCard, attach')) kNames = TTLocalizer.KartDNA_KartNames KartDict = {0: (kNames[0], 'phase_6/models/karting/Kart1_Final', diff --git a/toontown/racing/KartShopGlobals.py b/toontown/racing/KartShopGlobals.py index e3037d7..78e14d6 100644 --- a/toontown/racing/KartShopGlobals.py +++ b/toontown/racing/KartShopGlobals.py @@ -1,4 +1,4 @@ -from direct.showbase import PythonUtil +from enum import IntEnum class KartShopGlobals: EVENTDICT = {'guiDone': 'guiDone', @@ -15,7 +15,7 @@ class KartGlobals: COUNTDOWN_TIME = 30 BOARDING_TIME = 10.0 ENTER_RACE_TIME = 6.0 - ERROR_CODE = PythonUtil.Enum('success, eGeneric, eTickets, eBoardOver, eNoKart, eOccupied, eTrackClosed, eTooLate, eUnpaid') + ERROR_CODE = IntEnum('ERROR_CODE', ('success, eGeneric, eTickets, eBoardOver, eNoKart, eOccupied, eTrackClosed, eTooLate, eUnpaid')) FRONT_LEFT_SPOT = 0 FRONT_RIGHT_SPOT = 1 REAR_LEFT_SPOT = 2 diff --git a/toontown/racing/KartShopGui.py b/toontown/racing/KartShopGui.py index 42642a6..947ada9 100644 --- a/toontown/racing/KartShopGui.py +++ b/toontown/racing/KartShopGui.py @@ -4,7 +4,7 @@ from pandac.PandaModules import * from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * -from direct.showbase import DirectObject, PythonUtil +from direct.showbase import DirectObject from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import TTLocalizer from toontown.toonbase import ToontownTimer @@ -13,17 +13,18 @@ from toontown.racing.Kart import Kart from toontown.shtiker.KartPage import KartViewer from .KartDNA import * from toontown.toontowngui.TeaserPanel import TeaserPanel +from enum import IntEnum if (__debug__): import pdb -MENUS = PythonUtil.Enum('MainMenu, BuyKart, BuyAccessory, ReturnKart, ConfirmBuyAccessory, ConfirmBuyKart, BoughtKart, BoughtAccessory, TeaserPanel') -MM_OPTIONS = PythonUtil.Enum('Cancel, BuyAccessory, BuyKart', -1) -BK_OPTIONS = PythonUtil.Enum('Cancel, BuyKart', -1) -BA_OPTIONS = PythonUtil.Enum('Cancel, BuyAccessory', -1) -RK_OPTIONS = PythonUtil.Enum('Cancel, ReturnKart', -1) -CBK_OPTIONS = PythonUtil.Enum('Cancel, BuyKart', -1) -CBA_OPTIONS = PythonUtil.Enum('Cancel, BuyAccessory', -1) -BTK_OPTIONS = PythonUtil.Enum('Ok', -1) -BTA_OPTIONS = PythonUtil.Enum('Ok', -1) +MENUS = IntEnum('MENUS', ('MainMenu, BuyKart, BuyAccessory, ReturnKart, ConfirmBuyAccessory, ConfirmBuyKart, BoughtKart, BoughtAccessory, TeaserPanel')) +MM_OPTIONS = IntEnum('MM_OPTIONS', ('Cancel, BuyAccessory, BuyKart'), start=-1) +BK_OPTIONS = IntEnum('BK_OPTIONS', ('Cancel, BuyKart'), start=-1) +BA_OPTIONS = IntEnum('BA_OPTIONS', ('Cancel, BuyAccessory'), start=-1) +RK_OPTIONS = IntEnum('RK_OPTIONS', ('Cancel, ReturnKart'), start=-1) +CBK_OPTIONS = IntEnum('CBK_OPTIONS', ('Cancel, BuyKart'), start=-1) +CBA_OPTIONS = IntEnum('CBA_OPTIONS', ('Cancel, BuyAccessory'), start=-1) +BTK_OPTIONS = IntEnum('BTK_OPTIONS', ('Ok'), start=-1) +BTA_OPTIONS = IntEnum('BTA_OPTIONS', ('Ok'), start=-1) KS_TEXT_SIZE_BIG = TTLocalizer.KSGtextSizeBig KS_TEXT_SIZE_SMALL = TTLocalizer.KSGtextSizeSmall diff --git a/toontown/safezone/DistributedPicnicBasket.py b/toontown/safezone/DistributedPicnicBasket.py index d599905..3e115b2 100644 --- a/toontown/safezone/DistributedPicnicBasket.py +++ b/toontown/safezone/DistributedPicnicBasket.py @@ -16,9 +16,10 @@ from direct.showbase import PythonUtil from toontown.toon import ToonDNA from direct.showbase import RandomNumGen from toontown.battle.BattleSounds import * +from enum import IntEnum class DistributedPicnicBasket(DistributedObject.DistributedObject): - seatState = Enum('Empty, Full, Eating') + seatState = IntEnum('seatState', ('Empty, Full, Eating')) notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPicnicBasket') def __init__(self, cr): diff --git a/toontown/shtiker/GolfPage.py b/toontown/shtiker/GolfPage.py index 95a3023..0b0722a 100644 --- a/toontown/shtiker/GolfPage.py +++ b/toontown/shtiker/GolfPage.py @@ -1,16 +1,16 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * -from direct.showbase import PythonUtil 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 toontown.golf import GolfGlobals +from enum import IntEnum if (__debug__): import pdb -PageMode = PythonUtil.Enum('Records, Trophy') +PageMode = IntEnum('PageMode', ('Records, Trophy')) class GolfPage(ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('GolfPage') diff --git a/toontown/shtiker/KartPage.py b/toontown/shtiker/KartPage.py index 15b473d..bb830e7 100644 --- a/toontown/shtiker/KartPage.py +++ b/toontown/shtiker/KartPage.py @@ -1,7 +1,6 @@ from direct.directnotify import DirectNotifyGlobal from direct.gui.DirectGui import * from pandac.PandaModules import * -from direct.showbase import PythonUtil from direct.task import Task from toontown.fishing.FishPhoto import DirectRegion from toontown.racing.KartDNA import * @@ -10,9 +9,10 @@ from toontown.racing import RaceGlobals from toontown.shtiker.ShtikerPage import ShtikerPage from toontown.toonbase import ToontownGlobals, TTLocalizer from .FishPage import FishingTrophy +from enum import IntEnum if (__debug__): import pdb -PageMode = PythonUtil.Enum('Customize, Records, Trophy') +PageMode = IntEnum('PageMode', ('Customize, Records, Trophy')) class KartPage(ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('KartPage') diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index 748719c..dd71b2c 100644 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -8,8 +8,8 @@ from direct.task import Task from otp.speedchat import SpeedChat from otp.speedchat import SCColorScheme from otp.speedchat import SCStaticTextTerminal -from direct.showbase import PythonUtil from direct.directnotify import DirectNotifyGlobal +from enum import IntEnum speedChatStyles = ((2000, (200 / 255.0, 60 / 255.0, 229 / 255.0), (200 / 255.0, 135 / 255.0, 255 / 255.0), @@ -50,7 +50,7 @@ speedChatStyles = ((2000, (170 / 255.0, 120 / 255.0, 20 / 255.0), (165 / 255.0, 120 / 255.0, 50 / 255.0), (210 / 255.0, 200 / 255.0, 180 / 255.0))) -PageMode = PythonUtil.Enum('Options, Codes') +PageMode = IntEnum('PageMode', ('Options, Codes')) class OptionsPage(ShtikerPage.ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('OptionsPage') diff --git a/toontown/speedchat/TTSCJellybeanJamMenu.py b/toontown/speedchat/TTSCJellybeanJamMenu.py index b11ad1d..683f09c 100644 --- a/toontown/speedchat/TTSCJellybeanJamMenu.py +++ b/toontown/speedchat/TTSCJellybeanJamMenu.py @@ -1,8 +1,8 @@ -from direct.showbase import PythonUtil from otp.speedchat.SCMenu import SCMenu from otp.speedchat.SCMenuHolder import SCMenuHolder from otp.speedchat.SCStaticTextTerminal import SCStaticTextTerminal from otp.otpbase import OTPLocalizer +from enum import IntEnum JellybeanJamMenu = [(OTPLocalizer.JellybeanJamMenuSections[0], [30180, 30181, 30182, @@ -13,7 +13,7 @@ JellybeanJamMenu = [(OTPLocalizer.JellybeanJamMenuSections[0], [30180, 30188, 30189, 30190])] -JellybeanJamPhases = PythonUtil.Enum('TROLLEY, FISHING, PARTIES') +JellybeanJamPhases = IntEnum('JellybeanJamPhases', ('TROLLEY, FISHING, PARTIES')) PhaseSpecifPhrases = [30180, 30181, 30182] class TTSCJellybeanJamMenu(SCMenu): diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index e5ea232..53bae0c 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1,7 +1,8 @@ from . import TTLocalizer from otp.otpbase.OTPGlobals import * -from direct.showbase.PythonUtil import Enum, invertDict +from direct.showbase.PythonUtil import invertDict from panda3d.core import BitMask32, Vec4 +from enum import IntEnum MapHotkeyOn = 'alt' MapHotkeyOff = 'alt-up' MapHotkey = 'alt' @@ -1609,11 +1610,11 @@ gmMagicWordList = ['restock', 'who', 'who all'] NewsPageScaleAdjust = 0.85 -AnimPropTypes = Enum(('Unknown', +AnimPropTypes = IntEnum('AnimPropTypes', ('Unknown', 'Hydrant', 'Mailbox', 'Trashcan'), start=-1) -EmblemTypes = Enum(('Silver', 'Gold')) +EmblemTypes = IntEnum('EmblemTypes', ('Silver', 'Gold')) NumEmblemTypes = 2 DefaultMaxBankMoney = 12000 DefaultBankItemId = 1350