general: PythonUtil.Enum has been deprecated

This commit is contained in:
Open Toontown 2022-09-19 16:47:30 -04:00
parent f1ffad24e1
commit 5cdd7f84af
23 changed files with 83 additions and 79 deletions

View file

@ -39,14 +39,15 @@ from otp.distributed import OtpDoGlobals
from otp.distributed.TelemetryLimiter import TelemetryLimiter from otp.distributed.TelemetryLimiter import TelemetryLimiter
from otp.ai.GarbageLeakServerEventAggregator import GarbageLeakServerEventAggregator from otp.ai.GarbageLeakServerEventAggregator import GarbageLeakServerEventAggregator
from .PotentialAvatar import PotentialAvatar from .PotentialAvatar import PotentialAvatar
from enum import IntEnum
class OTPClientRepository(ClientRepositoryBase): class OTPClientRepository(ClientRepositoryBase):
notify = directNotify.newCategory('OTPClientRepository') notify = directNotify.newCategory('OTPClientRepository')
avatarLimit = 6 avatarLimit = 6
WishNameResult = Enum(['Failure', WishNameResult = IntEnum('WishNameResult', ('Failure',
'PendingApproval', 'PendingApproval',
'Approved', 'Approved',
'Rejected']) 'Rejected'))
def __init__(self, serverVersion, launcher = None, playGame = None): def __init__(self, serverVersion, launcher = None, playGame = None):
ClientRepositoryBase.__init__(self) ClientRepositoryBase.__init__(self)

View file

@ -1,8 +1,8 @@
from direct.showbase import PythonUtil
from pandac.PandaModules import VBase4, Vec3, Point3 from pandac.PandaModules import VBase4, Vec3, Point3
from .CogdoUtil import VariableContainer, DevVariableContainer from .CogdoUtil import VariableContainer, DevVariableContainer
from enum import IntEnum
AI = VariableContainer() 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.BroadcastPeriod = 0.3
AI.SafezoneId2DeathDamage = {2000: 1, AI.SafezoneId2DeathDamage = {2000: 1,
1000: 2, 1000: 2,
@ -106,7 +106,7 @@ Gameplay.DepleteFuelStates = ['FlyingUp']
Gameplay.FuelNormalAmt = 1.0 Gameplay.FuelNormalAmt = 1.0
Gameplay.FuelLowAmt = 0.66 Gameplay.FuelLowAmt = 0.66
Gameplay.FuelVeryLowAmt = 0.33 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.RefuelPropSpeed = 5.0
Gameplay.OverdrivePropSpeed = 2.5 Gameplay.OverdrivePropSpeed = 2.5
Gameplay.NormalPropSpeed = 1.5 Gameplay.NormalPropSpeed = 1.5
@ -116,7 +116,7 @@ Gameplay.TargetedWarningBlinkTime = 3.0
Gameplay.HitKnockbackDist = 15.0 Gameplay.HitKnockbackDist = 15.0
Gameplay.HitKnockbackTime = 0.5 Gameplay.HitKnockbackTime = 0.5
Gameplay.HitCooldownTime = 2.0 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.BackpackRefuelDuration = 4.0
Gameplay.BackpackState2TextureName = {Gameplay.BackpackStates.Normal: 'tt_t_ara_cfg_propellerPack', Gameplay.BackpackState2TextureName = {Gameplay.BackpackStates.Normal: 'tt_t_ara_cfg_propellerPack',
Gameplay.BackpackStates.Targeted: 'tt_t_ara_cfg_propellerPack_eagleTarget', 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', 'cogDialogue': 'phase_3.5/audio/dial/COG_VO_statement.ogg',
'toonDialogue': 'phase_3.5/audio/dial/AV_dog_long.ogg'} 'toonDialogue': 'phase_3.5/audio/dial/AV_dog_long.ogg'}
Level = VariableContainer() Level = VariableContainer()
Level.GatherableTypes = PythonUtil.Enum(('Memo', 'Propeller', 'LaffPowerup', 'InvulPowerup')) Level.GatherableTypes = IntEnum('GatherableTypes', ('Memo', 'Propeller', 'LaffPowerup', 'InvulPowerup'))
Level.ObstacleTypes = PythonUtil.Enum(('Whirlwind', 'Fan', 'Minion')) Level.ObstacleTypes = IntEnum('ObstacleTypes', ('Whirlwind', 'Fan', 'Minion'))
Level.PlatformTypes = PythonUtil.Enum(('Platform', 'StartPlatform', 'EndPlatform')) Level.PlatformTypes = IntEnum('PlatformTypes', ('Platform', 'StartPlatform', 'EndPlatform'))
Level.PlatformType2SpawnOffset = {Level.PlatformTypes.Platform: 2.5, Level.PlatformType2SpawnOffset = {Level.PlatformTypes.Platform: 2.5,
Level.PlatformTypes.StartPlatform: 5.0, Level.PlatformTypes.StartPlatform: 5.0,
Level.PlatformTypes.EndPlatform: 5.0} Level.PlatformTypes.EndPlatform: 5.0}

View file

@ -1,7 +1,6 @@
import math import math
import random import random
from pandac.PandaModules import Vec3 from pandac.PandaModules import Vec3
from direct.showbase import PythonUtil
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.task.Task import Task from direct.task.Task import Task
from direct.interval.FunctionInterval import Wait from direct.interval.FunctionInterval import Wait
@ -21,13 +20,14 @@ from .CogdoFlyingCameraManager import CogdoFlyingCameraManager
from .CogdoFlyingObjects import CogdoFlyingPlatform, CogdoFlyingGatherable from .CogdoFlyingObjects import CogdoFlyingPlatform, CogdoFlyingGatherable
from .CogdoFlyingLegalEagle import CogdoFlyingLegalEagle from .CogdoFlyingLegalEagle import CogdoFlyingLegalEagle
from . import CogdoFlyingGameGlobals as Globals from . import CogdoFlyingGameGlobals as Globals
from enum import IntEnum
class CogdoFlyingLocalPlayer(CogdoFlyingPlayer): class CogdoFlyingLocalPlayer(CogdoFlyingPlayer):
notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingLocalPlayer') notify = DirectNotifyGlobal.directNotify.newCategory('CogdoFlyingLocalPlayer')
BroadcastPosTask = 'CogdoFlyingLocalPlayerBroadcastPos' BroadcastPosTask = 'CogdoFlyingLocalPlayerBroadcastPos'
PlayWaitingMusicEventName = 'PlayWaitingMusicEvent' PlayWaitingMusicEventName = 'PlayWaitingMusicEvent'
RanOutOfTimeEventName = 'RanOutOfTimeEvent' RanOutOfTimeEventName = 'RanOutOfTimeEvent'
PropStates = PythonUtil.Enum(('Normal', 'Overdrive', 'Off')) PropStates = IntEnum('PropStates', ('Normal', 'Overdrive', 'Off'))
def __init__(self, toon, game, level, guiMgr): def __init__(self, toon, game, level, guiMgr):
CogdoFlyingPlayer.__init__(self, toon) CogdoFlyingPlayer.__init__(self, toon)

View file

@ -3,7 +3,6 @@ from direct.showbase.DirectObject import DirectObject
from direct.interval.IntervalGlobal import LerpFunc, ActorInterval, LerpPosInterval from direct.interval.IntervalGlobal import LerpFunc, ActorInterval, LerpPosInterval
from direct.interval.MetaInterval import Sequence from direct.interval.MetaInterval import Sequence
from direct.directutil import Mopath from direct.directutil import Mopath
from direct.showbase import PythonUtil
from pandac.PandaModules import * from pandac.PandaModules import *
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.suit import Suit from toontown.suit import Suit
@ -15,6 +14,7 @@ from .CogdoFlyingUtil import swapAvatarShadowPlacer
from direct.particles import ParticleEffect from direct.particles import ParticleEffect
from direct.particles import Particles from direct.particles import Particles
from direct.particles import ForceGroup from direct.particles import ForceGroup
from enum import IntEnum
class CogdoFlyingObtacleFactory: class CogdoFlyingObtacleFactory:
@ -90,7 +90,7 @@ class CogdoFlyingObtacleFactory:
class CogdoFlyingObstacle(DirectObject): class CogdoFlyingObstacle(DirectObject):
EnterEventName = 'CogdoFlyingObstacle_Enter' EnterEventName = 'CogdoFlyingObstacle_Enter'
ExitEventName = 'CogdoFlyingObstacle_Exit' 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): def __init__(self, type, index, model, collSolid, motionPath = None, motionPattern = None, blendMotion = True, instanceModel = True):
self.type = type self.type = type

View file

@ -1,6 +1,6 @@
from direct.showbase import PythonUtil
from pandac.PandaModules import VBase4 from pandac.PandaModules import VBase4
GameActions = PythonUtil.Enum(('EnterDoor', from enum import IntEnum
GameActions = IntEnum('GameActions', ('EnterDoor',
'RevealDoor', 'RevealDoor',
'OpenDoor', 'OpenDoor',
'Countdown', 'Countdown',
@ -81,7 +81,7 @@ PickupsUntilDoorOpens = int(NumPickups * 0.6)
SuitCollisionName = 'CogdoMazeSuit_Collision' SuitCollisionName = 'CogdoMazeSuit_Collision'
SuitWalkSameDirectionProb = 1 SuitWalkSameDirectionProb = 1
SuitWalkTurnAroundProb = 100 SuitWalkTurnAroundProb = 100
SuitTypes = PythonUtil.Enum(('Boss', 'FastMinion', 'SlowMinion')) SuitTypes = IntEnum('SuitTypes', ('Boss', 'FastMinion', 'SlowMinion'))
SuitData = {} SuitData = {}
SuitData[SuitTypes.Boss] = {'dnaName': 'ms', SuitData[SuitTypes.Boss] = {'dnaName': 'ms',
'cellWalkPeriod': 192, 'cellWalkPeriod': 192,

View file

@ -1,7 +1,7 @@
from toontown.suit import SuitDNA from toontown.suit import SuitDNA
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from direct.showbase import PythonUtil
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from enum import IntEnum
PartsPerSuit = (17, PartsPerSuit = (17,
14, 14,
12, 12,
@ -428,7 +428,7 @@ PartsQueryNames = ({1: PartNameStrings[0],
16384: PartNameStrings[14], 16384: PartNameStrings[14],
32768: PartNameStrings[15], 32768: PartNameStrings[15],
65536: PartNameStrings[15]}) 65536: PartNameStrings[15]})
suitTypes = PythonUtil.Enum(('NoSuit', 'NoMerits', 'FullSuit')) suitTypes = IntEnum('suitTypes', ('NoSuit', 'NoMerits', 'FullSuit'))
def getNextPart(parts, partIndex, dept): def getNextPart(parts, partIndex, dept):
dept = dept2deptIndex(dept) dept = dept2deptIndex(dept)

View file

@ -1,9 +1,9 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.showbase import PythonUtil
from toontown.battle.BattleProps import globalPropPool from toontown.battle.BattleProps import globalPropPool
from direct.directnotify import DirectNotifyGlobal 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', SFXPATHS = {SFX.poof: 'phase_4/audio/sfx/firework_distance_02.ogg',
SFX.magic: 'phase_4/audio/sfx/SZ_DD_treasure.ogg'} SFX.magic: 'phase_4/audio/sfx/SZ_DD_treasure.ogg'}

View file

@ -1,12 +1,12 @@
from direct.showbase.PythonUtil import Enum
from direct.gui.DirectGui import DirectFrame, DGG from direct.gui.DirectGui import DirectFrame, DGG
from pandac.PandaModules import Vec2, VBase4F from pandac.PandaModules import Vec2, VBase4F
from pandac.PandaModules import CardMaker, NodePath from pandac.PandaModules import CardMaker, NodePath
from pandac.PandaModules import Texture, PNMImage from pandac.PandaModules import Texture, PNMImage
from enum import IntEnum
DEFAULT_MASK_RESOLUTION = 32 DEFAULT_MASK_RESOLUTION = 32
DEFAULT_RADIUS_RATIO = 0.05 DEFAULT_RADIUS_RATIO = 0.05
MAP_RESOLUTION = 320 MAP_RESOLUTION = 320
MazeRevealType = Enum(('SmoothCircle', 'HardCircle', 'Square')) MazeRevealType = IntEnum('MazeRevealType', ('SmoothCircle', 'HardCircle', 'Square'))
MAZE_REVEAL_TYPE = MazeRevealType.SmoothCircle MAZE_REVEAL_TYPE = MazeRevealType.SmoothCircle
class MazeMapGui(DirectFrame): class MazeMapGui(DirectFrame):

View file

@ -2,7 +2,6 @@ import random
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.interval.FunctionInterval import Wait, Func from direct.interval.FunctionInterval import Wait, Func
from direct.interval.MetaInterval import Sequence, Parallel from direct.interval.MetaInterval import Sequence, Parallel
from direct.showbase.PythonUtil import lerp, Enum
from direct.fsm import FSM from direct.fsm import FSM
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
@ -17,8 +16,9 @@ from toontown.parties.PartyDanceActivityToonFSM import ToonDancingStates
from toontown.parties.KeyCodes import KeyCodes from toontown.parties.KeyCodes import KeyCodes
from toontown.parties.KeyCodesGui import KeyCodesGui from toontown.parties.KeyCodesGui import KeyCodesGui
from toontown.parties import PartyGlobals from toontown.parties import PartyGlobals
from enum import IntEnum
DANCE_FLOOR_COLLISION = 'danceFloor_collision' DANCE_FLOOR_COLLISION = 'danceFloor_collision'
DanceViews = Enum(('Normal', 'Dancing', 'Isometric')) DanceViews = IntEnum('DanceViews', ('Normal', 'Dancing', 'Isometric'))
class DistributedPartyDanceActivityBase(DistributedPartyActivity): class DistributedPartyDanceActivityBase(DistributedPartyActivity):
notify = directNotify.newCategory('DistributedPartyDanceActivity') notify = directNotify.newCategory('DistributedPartyDanceActivity')

View file

@ -1,7 +1,7 @@
from pandac.PandaModules import BitMask32 from pandac.PandaModules import BitMask32
from pandac.PandaModules import Point3, VBase4 from pandac.PandaModules import Point3, VBase4
from direct.showbase import PythonUtil
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from enum import IntEnum
KICK_TO_PLAYGROUND_EVENT = 'parties_kickToPlayground' KICK_TO_PLAYGROUND_EVENT = 'parties_kickToPlayground'
MaxSetInvites = 1000 MaxSetInvites = 1000
MaxSetPartiesInvitedTo = 100 MaxSetPartiesInvitedTo = 100
@ -41,36 +41,36 @@ AvailableGridSquares = 202
TrashCanPosition = (-0.24, 0.0, -0.65) TrashCanPosition = (-0.24, 0.0, -0.65)
TrashCanScale = 0.7 TrashCanScale = 0.7
PartyEditorTrashBounds = ((-0.16, -0.38), (-0.05, -0.56)) PartyEditorTrashBounds = ((-0.16, -0.38), (-0.05, -0.56))
ActivityRequestStatus = PythonUtil.Enum(('Joining', 'Exiting')) ActivityRequestStatus = IntEnum('ActivityRequestStatus', ('Joining', 'Exiting'))
InviteStatus = PythonUtil.Enum(('NotRead', InviteStatus = IntEnum('InviteStatus', ('NotRead',
'ReadButNotReplied', 'ReadButNotReplied',
'Accepted', 'Accepted',
'Rejected')) 'Rejected'))
InviteTheme = PythonUtil.Enum(('Birthday', InviteTheme = IntEnum('InviteTheme', ('Birthday',
'GenericMale', 'GenericMale',
'GenericFemale', 'GenericFemale',
'Racing', 'Racing',
'Valentoons', 'Valentoons',
'VictoryParty', 'VictoryParty',
'Winter')) 'Winter'))
PartyStatus = PythonUtil.Enum(('Pending', PartyStatus = IntEnum('PartyStatus', ('Pending',
'Cancelled', 'Cancelled',
'Finished', 'Finished',
'CanStart', 'CanStart',
'Started', 'Started',
'NeverStarted')) 'NeverStarted'))
AddPartyErrorCode = PythonUtil.Enum(('AllOk', AddPartyErrorCode = IntEnum('AddPartyErrorCode', ('AllOk',
'ValidationError', 'ValidationError',
'DatabaseError', 'DatabaseError',
'TooManyHostedParties')) 'TooManyHostedParties'))
ChangePartyFieldErrorCode = PythonUtil.Enum(('AllOk', ChangePartyFieldErrorCode = IntEnum('ChangePartyFieldErrorCode', ('AllOk',
'ValidationError', 'ValidationError',
'DatabaseError', 'DatabaseError',
'AlreadyStarted', 'AlreadyStarted',
'AlreadyRefunded')) 'AlreadyRefunded'))
ActivityTypes = PythonUtil.Enum(('HostInitiated', 'GuestInitiated', 'Continuous')) ActivityTypes = IntEnum('ActivityTypes', ('HostInitiated', 'GuestInitiated', 'Continuous'))
PartyGateDenialReasons = PythonUtil.Enum(('Unavailable', 'Full')) PartyGateDenialReasons = IntEnum('PartyGateDenialReasons', ('Unavailable', 'Full'))
ActivityIds = PythonUtil.Enum(('PartyJukebox', ActivityIds = IntEnum('ActivityIds', ('PartyJukebox',
'PartyCannon', 'PartyCannon',
'PartyTrampoline', 'PartyTrampoline',
'PartyCatch', 'PartyCatch',
@ -129,7 +129,7 @@ ValentinePartyReplacementActivityIds = frozenset([ActivityIds.PartyDance,
ActivityIds.PartyJukebox, ActivityIds.PartyJukebox,
ActivityIds.PartyJukebox40, ActivityIds.PartyJukebox40,
ActivityIds.PartyTrampoline]) ActivityIds.PartyTrampoline])
DecorationIds = PythonUtil.Enum(('BalloonAnvil', DecorationIds = IntEnum('DecorationIds', ('BalloonAnvil',
'BalloonStage', 'BalloonStage',
'Bow', 'Bow',
'Cake', 'Cake',
@ -177,7 +177,7 @@ ValentinePartyDecorationIds = frozenset([DecorationIds.BalloonAnvilValentine,
DecorationIds.FlyingHeart]) DecorationIds.FlyingHeart])
ValentinePartyReplacementDecorationIds = frozenset([DecorationIds.BalloonAnvil, DecorationIds.BannerJellyBean]) ValentinePartyReplacementDecorationIds = frozenset([DecorationIds.BalloonAnvil, DecorationIds.BannerJellyBean])
UnreleasedDecorationIds = () UnreleasedDecorationIds = ()
GoToPartyStatus = PythonUtil.Enum(('AllowedToGo', GoToPartyStatus = IntEnum('GoToPartyStatus', ('AllowedToGo',
'PartyFull', 'PartyFull',
'PrivateParty', 'PrivateParty',
'PartyOver', 'PartyOver',
@ -500,8 +500,8 @@ DecorationInformationDict = {DecorationIds.BalloonAnvil: {'cost': int(10 * Party
'paidOnly': False, 'paidOnly': False,
'gridAsset': 'decoration_1x1'}} 'gridAsset': 'decoration_1x1'}}
DefaultRulesTimeout = 10.0 DefaultRulesTimeout = 10.0
DenialReasons = PythonUtil.Enum(('Default', 'Full', 'SilentFail'), start=0) DenialReasons = IntEnum('DenialReasons', ('Default', 'Full', 'SilentFail'), start=0)
FireworkShows = PythonUtil.Enum(('Summer',), start=200) FireworkShows = IntEnum('FireworkShows', ('Summer',), start=200)
FireworksGlobalXOffset = 160.0 FireworksGlobalXOffset = 160.0
FireworksGlobalYOffset = -20.0 FireworksGlobalYOffset = -20.0
FireworksPostLaunchDelay = 5.0 FireworksPostLaunchDelay = 5.0
@ -510,7 +510,7 @@ RocketDirectionDelay = 2.0
FireworksStartedEvent = 'PartyFireworksStarted' FireworksStartedEvent = 'PartyFireworksStarted'
FireworksFinishedEvent = 'PartyFireworksFinished' FireworksFinishedEvent = 'PartyFireworksFinished'
FireworksTransitionToDisabledDelay = 3.0 FireworksTransitionToDisabledDelay = 3.0
TeamActivityTeams = PythonUtil.Enum(('LeftTeam', 'RightTeam'), start=0) TeamActivityTeams = IntEnum('TeamActivityTeams', ('LeftTeam', 'RightTeam'), start=0)
TeamActivityNeitherTeam = 3 TeamActivityNeitherTeam = 3
TeamActivityTextScale = 0.135 TeamActivityTextScale = 0.135
TeamActivityStartDelay = 8.0 TeamActivityStartDelay = 8.0
@ -730,7 +730,7 @@ DanceReverseLoopAnims = ['left',
'up', 'up',
'down', 'down',
'good-putt'] 'good-putt']
ToonDancingStates = PythonUtil.Enum(('Init', ToonDancingStates = IntEnum('ToonDancingStates', ('Init',
'DanceMove', 'DanceMove',
'Run', 'Run',
'Cleanup')) 'Cleanup'))

View file

@ -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 .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 TTLocalizer
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.showbase import PythonUtil from enum import IntEnum
import random import random
Component2IconDict = {'boredom': 'Bored', Component2IconDict = {'boredom': 'Bored',
'restlessness': None, 'restlessness': None,
@ -29,7 +29,7 @@ Component2IconDict = {'boredom': 'Bored',
class Pet(Avatar.Avatar): class Pet(Avatar.Avatar):
notify = DirectNotifyGlobal.directNotify.newCategory('Pet') notify = DirectNotifyGlobal.directNotify.newCategory('Pet')
SerialNum = 0 SerialNum = 0
Interactions = PythonUtil.Enum('SCRATCH, BEG, EAT, NEUTRAL') Interactions = IntEnum('Interactions', ('SCRATCH, BEG, EAT, NEUTRAL'))
InteractAnims = {Interactions.SCRATCH: ('toPet', 'pet', 'fromPet'), InteractAnims = {Interactions.SCRATCH: ('toPet', 'pet', 'fromPet'),
Interactions.BEG: ('toBeg', 'beg', 'fromBeg'), Interactions.BEG: ('toBeg', 'beg', 'fromBeg'),
Interactions.EAT: ('eat', 'swallow', 'neutral'), Interactions.EAT: ('eat', 'swallow', 'neutral'),

View file

@ -1,7 +1,6 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.showbase.PythonUtil import Enum, invertDictLossless
import math
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from enum import IntEnum
OurPetsMoodChangedKey = 'OurPetsMoodChanged' OurPetsMoodChangedKey = 'OurPetsMoodChanged'
ThinkPeriod = 1.5 ThinkPeriod = 1.5
MoodDriftPeriod = 300.0 MoodDriftPeriod = 300.0
@ -25,7 +24,7 @@ HungerChaseToonScale = 1.2
FleeFromOwnerScale = 0.5 FleeFromOwnerScale = 0.5
GettingAttentionGoalScale = 1.2 GettingAttentionGoalScale = 1.2
GettingAttentionGoalScaleDur = 7.0 GettingAttentionGoalScaleDur = 7.0
AnimMoods = Enum('EXCITED, SAD, NEUTRAL') AnimMoods = IntEnum('AnimMoods', ('EXCITED, SAD, NEUTRAL'))
FwdSpeed = 12.0 FwdSpeed = 12.0
RotSpeed = 360.0 RotSpeed = 360.0
_HappyMult = 1.0 _HappyMult = 1.0

View file

@ -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 direct.showbase.PythonUtil import clampScalar
from toontown.toonbase import TTLocalizer, ToontownGlobals from toontown.toonbase import TTLocalizer, ToontownGlobals
import random, copy import random, copy
from enum import IntEnum
TraitDivisor = 10000 TraitDivisor = 10000
def getTraitNames(): def getTraitNames():
@ -23,8 +24,8 @@ def gaussian(min, max, rng):
class TraitDistribution: class TraitDistribution:
TraitQuality = Enum('VERY_BAD, BAD, AVERAGE, GOOD, VERY_GOOD') TraitQuality = IntEnum('TraitQuality', ('VERY_BAD, BAD, AVERAGE, GOOD, VERY_GOOD'))
TraitTypes = Enum('INCREASING, DECREASING') TraitTypes = IntEnum('TraitTypes', ('INCREASING, DECREASING'))
Sz2MinMax = None Sz2MinMax = None
TraitType = None TraitType = None
TraitCutoffs = {TraitTypes.INCREASING: {TraitQuality.VERY_BAD: 0.1, TraitCutoffs = {TraitTypes.INCREASING: {TraitQuality.VERY_BAD: 0.1,

View file

@ -1,7 +1,8 @@
from direct.showbase.PythonUtil import Enum, invertDictLossless from direct.showbase.PythonUtil import invertDictLossless
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
import random 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 NonHappyMinActualTrickAptitude = 0.1
NonHappyMaxActualTrickAptitude = 0.6 NonHappyMaxActualTrickAptitude = 0.6
MinActualTrickAptitude = 0.5 MinActualTrickAptitude = 0.5

View file

@ -1,16 +1,15 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.showbase import PythonUtil
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from pandac.PandaModules import * from pandac.PandaModules import *
from .KartShopGlobals import * from .KartShopGlobals import *
import types from enum import IntEnum
if (__debug__): if (__debug__):
import pdb import pdb
import copy 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 InvalidEntry = -1
KartInfo = PythonUtil.Enum('name, model, cost, viewDist, decalId, LODmodel1, LODmodel2') KartInfo = IntEnum('KartInfo', ('name, model, cost, viewDist, decalId, LODmodel1, LODmodel2'))
AccInfo = PythonUtil.Enum('name, model, cost, texCard, attach') AccInfo = IntEnum('KartInfo', ('name, model, cost, texCard, attach'))
kNames = TTLocalizer.KartDNA_KartNames kNames = TTLocalizer.KartDNA_KartNames
KartDict = {0: (kNames[0], KartDict = {0: (kNames[0],
'phase_6/models/karting/Kart1_Final', 'phase_6/models/karting/Kart1_Final',

View file

@ -1,4 +1,4 @@
from direct.showbase import PythonUtil from enum import IntEnum
class KartShopGlobals: class KartShopGlobals:
EVENTDICT = {'guiDone': 'guiDone', EVENTDICT = {'guiDone': 'guiDone',
@ -15,7 +15,7 @@ class KartGlobals:
COUNTDOWN_TIME = 30 COUNTDOWN_TIME = 30
BOARDING_TIME = 10.0 BOARDING_TIME = 10.0
ENTER_RACE_TIME = 6.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_LEFT_SPOT = 0
FRONT_RIGHT_SPOT = 1 FRONT_RIGHT_SPOT = 1
REAR_LEFT_SPOT = 2 REAR_LEFT_SPOT = 2

View file

@ -4,7 +4,7 @@ from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules 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 ToontownGlobals, TTLocalizer
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownTimer from toontown.toonbase import ToontownTimer
@ -13,17 +13,18 @@ from toontown.racing.Kart import Kart
from toontown.shtiker.KartPage import KartViewer from toontown.shtiker.KartPage import KartViewer
from .KartDNA import * from .KartDNA import *
from toontown.toontowngui.TeaserPanel import TeaserPanel from toontown.toontowngui.TeaserPanel import TeaserPanel
from enum import IntEnum
if (__debug__): if (__debug__):
import pdb import pdb
MENUS = PythonUtil.Enum('MainMenu, BuyKart, BuyAccessory, ReturnKart, ConfirmBuyAccessory, ConfirmBuyKart, BoughtKart, BoughtAccessory, TeaserPanel') MENUS = IntEnum('MENUS', ('MainMenu, BuyKart, BuyAccessory, ReturnKart, ConfirmBuyAccessory, ConfirmBuyKart, BoughtKart, BoughtAccessory, TeaserPanel'))
MM_OPTIONS = PythonUtil.Enum('Cancel, BuyAccessory, BuyKart', -1) MM_OPTIONS = IntEnum('MM_OPTIONS', ('Cancel, BuyAccessory, BuyKart'), start=-1)
BK_OPTIONS = PythonUtil.Enum('Cancel, BuyKart', -1) BK_OPTIONS = IntEnum('BK_OPTIONS', ('Cancel, BuyKart'), start=-1)
BA_OPTIONS = PythonUtil.Enum('Cancel, BuyAccessory', -1) BA_OPTIONS = IntEnum('BA_OPTIONS', ('Cancel, BuyAccessory'), start=-1)
RK_OPTIONS = PythonUtil.Enum('Cancel, ReturnKart', -1) RK_OPTIONS = IntEnum('RK_OPTIONS', ('Cancel, ReturnKart'), start=-1)
CBK_OPTIONS = PythonUtil.Enum('Cancel, BuyKart', -1) CBK_OPTIONS = IntEnum('CBK_OPTIONS', ('Cancel, BuyKart'), start=-1)
CBA_OPTIONS = PythonUtil.Enum('Cancel, BuyAccessory', -1) CBA_OPTIONS = IntEnum('CBA_OPTIONS', ('Cancel, BuyAccessory'), start=-1)
BTK_OPTIONS = PythonUtil.Enum('Ok', -1) BTK_OPTIONS = IntEnum('BTK_OPTIONS', ('Ok'), start=-1)
BTA_OPTIONS = PythonUtil.Enum('Ok', -1) BTA_OPTIONS = IntEnum('BTA_OPTIONS', ('Ok'), start=-1)
KS_TEXT_SIZE_BIG = TTLocalizer.KSGtextSizeBig KS_TEXT_SIZE_BIG = TTLocalizer.KSGtextSizeBig
KS_TEXT_SIZE_SMALL = TTLocalizer.KSGtextSizeSmall KS_TEXT_SIZE_SMALL = TTLocalizer.KSGtextSizeSmall

View file

@ -16,9 +16,10 @@ from direct.showbase import PythonUtil
from toontown.toon import ToonDNA from toontown.toon import ToonDNA
from direct.showbase import RandomNumGen from direct.showbase import RandomNumGen
from toontown.battle.BattleSounds import * from toontown.battle.BattleSounds import *
from enum import IntEnum
class DistributedPicnicBasket(DistributedObject.DistributedObject): class DistributedPicnicBasket(DistributedObject.DistributedObject):
seatState = Enum('Empty, Full, Eating') seatState = IntEnum('seatState', ('Empty, Full, Eating'))
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPicnicBasket') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedPicnicBasket')
def __init__(self, cr): def __init__(self, cr):

View file

@ -1,16 +1,16 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.showbase import PythonUtil
from direct.task import Task from direct.task import Task
from toontown.fishing.FishPhoto import DirectRegion from toontown.fishing.FishPhoto import DirectRegion
from toontown.shtiker.ShtikerPage import ShtikerPage from toontown.shtiker.ShtikerPage import ShtikerPage
from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import ToontownGlobals, TTLocalizer
from .FishPage import FishingTrophy from .FishPage import FishingTrophy
from toontown.golf import GolfGlobals from toontown.golf import GolfGlobals
from enum import IntEnum
if (__debug__): if (__debug__):
import pdb import pdb
PageMode = PythonUtil.Enum('Records, Trophy') PageMode = IntEnum('PageMode', ('Records, Trophy'))
class GolfPage(ShtikerPage): class GolfPage(ShtikerPage):
notify = DirectNotifyGlobal.directNotify.newCategory('GolfPage') notify = DirectNotifyGlobal.directNotify.newCategory('GolfPage')

View file

@ -1,7 +1,6 @@
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
from direct.showbase import PythonUtil
from direct.task import Task from direct.task import Task
from toontown.fishing.FishPhoto import DirectRegion from toontown.fishing.FishPhoto import DirectRegion
from toontown.racing.KartDNA import * from toontown.racing.KartDNA import *
@ -10,9 +9,10 @@ from toontown.racing import RaceGlobals
from toontown.shtiker.ShtikerPage import ShtikerPage from toontown.shtiker.ShtikerPage import ShtikerPage
from toontown.toonbase import ToontownGlobals, TTLocalizer from toontown.toonbase import ToontownGlobals, TTLocalizer
from .FishPage import FishingTrophy from .FishPage import FishingTrophy
from enum import IntEnum
if (__debug__): if (__debug__):
import pdb import pdb
PageMode = PythonUtil.Enum('Customize, Records, Trophy') PageMode = IntEnum('PageMode', ('Customize, Records, Trophy'))
class KartPage(ShtikerPage): class KartPage(ShtikerPage):
notify = DirectNotifyGlobal.directNotify.newCategory('KartPage') notify = DirectNotifyGlobal.directNotify.newCategory('KartPage')

View file

@ -8,8 +8,8 @@ from direct.task import Task
from otp.speedchat import SpeedChat from otp.speedchat import SpeedChat
from otp.speedchat import SCColorScheme from otp.speedchat import SCColorScheme
from otp.speedchat import SCStaticTextTerminal from otp.speedchat import SCStaticTextTerminal
from direct.showbase import PythonUtil
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from enum import IntEnum
speedChatStyles = ((2000, speedChatStyles = ((2000,
(200 / 255.0, 60 / 255.0, 229 / 255.0), (200 / 255.0, 60 / 255.0, 229 / 255.0),
(200 / 255.0, 135 / 255.0, 255 / 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), (170 / 255.0, 120 / 255.0, 20 / 255.0),
(165 / 255.0, 120 / 255.0, 50 / 255.0), (165 / 255.0, 120 / 255.0, 50 / 255.0),
(210 / 255.0, 200 / 255.0, 180 / 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): class OptionsPage(ShtikerPage.ShtikerPage):
notify = DirectNotifyGlobal.directNotify.newCategory('OptionsPage') notify = DirectNotifyGlobal.directNotify.newCategory('OptionsPage')

View file

@ -1,8 +1,8 @@
from direct.showbase import PythonUtil
from otp.speedchat.SCMenu import SCMenu from otp.speedchat.SCMenu import SCMenu
from otp.speedchat.SCMenuHolder import SCMenuHolder from otp.speedchat.SCMenuHolder import SCMenuHolder
from otp.speedchat.SCStaticTextTerminal import SCStaticTextTerminal from otp.speedchat.SCStaticTextTerminal import SCStaticTextTerminal
from otp.otpbase import OTPLocalizer from otp.otpbase import OTPLocalizer
from enum import IntEnum
JellybeanJamMenu = [(OTPLocalizer.JellybeanJamMenuSections[0], [30180, JellybeanJamMenu = [(OTPLocalizer.JellybeanJamMenuSections[0], [30180,
30181, 30181,
30182, 30182,
@ -13,7 +13,7 @@ JellybeanJamMenu = [(OTPLocalizer.JellybeanJamMenuSections[0], [30180,
30188, 30188,
30189, 30189,
30190])] 30190])]
JellybeanJamPhases = PythonUtil.Enum('TROLLEY, FISHING, PARTIES') JellybeanJamPhases = IntEnum('JellybeanJamPhases', ('TROLLEY, FISHING, PARTIES'))
PhaseSpecifPhrases = [30180, 30181, 30182] PhaseSpecifPhrases = [30180, 30181, 30182]
class TTSCJellybeanJamMenu(SCMenu): class TTSCJellybeanJamMenu(SCMenu):

View file

@ -1,7 +1,8 @@
from . import TTLocalizer from . import TTLocalizer
from otp.otpbase.OTPGlobals import * 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 panda3d.core import BitMask32, Vec4
from enum import IntEnum
MapHotkeyOn = 'alt' MapHotkeyOn = 'alt'
MapHotkeyOff = 'alt-up' MapHotkeyOff = 'alt-up'
MapHotkey = 'alt' MapHotkey = 'alt'
@ -1609,11 +1610,11 @@ gmMagicWordList = ['restock',
'who', 'who',
'who all'] 'who all']
NewsPageScaleAdjust = 0.85 NewsPageScaleAdjust = 0.85
AnimPropTypes = Enum(('Unknown', AnimPropTypes = IntEnum('AnimPropTypes', ('Unknown',
'Hydrant', 'Hydrant',
'Mailbox', 'Mailbox',
'Trashcan'), start=-1) 'Trashcan'), start=-1)
EmblemTypes = Enum(('Silver', 'Gold')) EmblemTypes = IntEnum('EmblemTypes', ('Silver', 'Gold'))
NumEmblemTypes = 2 NumEmblemTypes = 2
DefaultMaxBankMoney = 12000 DefaultMaxBankMoney = 12000
DefaultBankItemId = 1350 DefaultBankItemId = 1350