From e1c842d2354bcc0a41236447acbb5316d64c93c6 Mon Sep 17 00:00:00 2001 From: Open Toontown <57279094+opentoontown@users.noreply.github.com> Date: Wed, 19 Jan 2022 01:29:37 -0500 Subject: [PATCH] get rid of more DeprecationWarnings --- otp/avatar/Avatar.py | 4 +- otp/chat/ChatManager.py | 8 +- otp/distributed/OTPClientRepository.py | 124 +++++++++--------- otp/launcher/LauncherBase.py | 6 +- otp/speedchat/SCMenu.py | 10 +- .../distributed/ToontownClientRepository.py | 31 +---- toontown/toonbase/ToontownGlobals.py | 2 +- toontown/toonbase/ToontownStart.py | 2 +- 8 files changed, 78 insertions(+), 109 deletions(-) diff --git a/otp/avatar/Avatar.py b/otp/avatar/Avatar.py index 61a8f0e..4ea6bfd 100644 --- a/otp/avatar/Avatar.py +++ b/otp/avatar/Avatar.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * from panda3d.otp import Nametag, NametagGroup from panda3d.otp import CFSpeech, CFThought, CFTimeout, CFPageButton, CFNoQuitButton, CFQuitButton from otp.otpbase import OTPGlobals @@ -12,7 +12,7 @@ from otp.otpbase import OTPRender from otp.otpbase.PythonUtil import recordCreationStack teleportNotify = DirectNotifyGlobal.directNotify.newCategory('Teleport') teleportNotify.showTime = True -if config.GetBool('want-teleport-debug', 1): +if ConfigVariableBool('want-teleport-debug', 1).value: teleportNotify.setDebug(1) def reconsiderAllUnderstandable(): diff --git a/otp/chat/ChatManager.py b/otp/chat/ChatManager.py index 2393133..bd57595 100644 --- a/otp/chat/ChatManager.py +++ b/otp/chat/ChatManager.py @@ -1,7 +1,5 @@ import string -import sys from direct.showbase import DirectObject -from otp.otpbase import OTPGlobals from direct.fsm import ClassicFSM from direct.fsm import State from otp.login import SecretFriendsInfoPanel @@ -10,7 +8,7 @@ from otp.otpbase import OTPLocalizer from direct.directnotify import DirectNotifyGlobal from otp.login import LeaveToPayDialog from direct.gui.DirectGui import * -from pandac.PandaModules import * +from panda3d.core import * ChatEvent = 'ChatEvent' NormalChatEvent = 'NormalChatEvent' SCChatEvent = 'SCChatEvent' @@ -39,7 +37,7 @@ def removeThoughtPrefix(message): class ChatManager(DirectObject.DirectObject): notify = DirectNotifyGlobal.directNotify.newCategory('ChatManager') - execChat = base.config.GetBool('exec-chat', 0) + execChat = ConfigVariableBool('exec-chat', 0).value def __init__(self, cr, localAvatar): self.cr = cr @@ -323,7 +321,7 @@ class ChatManager(DirectObject.DirectObject): if self.wantBackgroundFocus: self.chatInputNormal.chatEntry['backgroundFocus'] = 1 self.acceptOnce('enterNormalChat', self.fsm.request, ['whisperChat', [avatarName, avatarId]]) - if base.cr.config.GetBool('force-typed-whisper-enabled', 0): + if ConfigVariableBool('force-typed-whisper-enabled', 0).value: self.whisperButton['state'] = 'normal' self.enablewhisperButton() return diff --git a/otp/distributed/OTPClientRepository.py b/otp/distributed/OTPClientRepository.py index 1fa6f0e..90a2867 100644 --- a/otp/distributed/OTPClientRepository.py +++ b/otp/distributed/OTPClientRepository.py @@ -1,12 +1,9 @@ import sys import time -import string -import types import random import gc import os -from pandac.PandaModules import * -from pandac.PandaModules import * +from panda3d.core import * from direct.gui.DirectGui import * from otp.distributed.OtpDoGlobals import * from direct.interval.IntervalGlobal import ivalMgr @@ -16,20 +13,17 @@ from direct.fsm.ClassicFSM import ClassicFSM from direct.fsm.State import State from direct.task import Task from direct.distributed import DistributedSmoothNode -from direct.showbase import PythonUtil, GarbageReport, BulletinBoardWatcher +from direct.showbase import PythonUtil, GarbageReport from direct.showbase.ContainerLeakDetector import ContainerLeakDetector from direct.showbase import MessengerLeakDetector from direct.showbase.GarbageReportScheduler import GarbageReportScheduler from direct.showbase import LeakDetectors from direct.distributed.PyDatagram import PyDatagram -from direct.distributed.PyDatagramIterator import PyDatagramIterator -from otp.avatar import Avatar from otp.avatar.DistributedPlayer import DistributedPlayer from otp.login import LoginTTSpecificDevAccount from otp.login.CreateAccountScreen import CreateAccountScreen from otp.login import LoginScreen from otp.otpgui import OTPDialog -from otp.avatar import DistributedAvatar from otp.otpbase import OTPLocalizer from otp.login import LoginGSAccount from otp.login import LoginGoAccount @@ -60,7 +54,7 @@ class OTPClientRepository(ClientRepositoryBase): self.launcher = launcher base.launcher = launcher self.__currentAvId = 0 - self.productName = config.GetString('product-name', 'DisneyOnline-US') + self.productName = ConfigVariableString('product-name', 'DisneyOnline-US').value self.createAvatarClass = None self.systemMessageSfx = None reg_deployment = '' @@ -84,7 +78,7 @@ class OTPClientRepository(ClientRepositoryBase): if self.launcher: self.blue = self.launcher.getBlue() - fakeBlue = config.GetString('fake-blue', '') + fakeBlue = ConfigVariableString('fake-blue', '').value if fakeBlue: self.blue = fakeBlue @@ -92,7 +86,7 @@ class OTPClientRepository(ClientRepositoryBase): if self.launcher: self.playToken = self.launcher.getPlayToken() - fakePlayToken = config.GetString('fake-playtoken', '') + fakePlayToken = ConfigVariableString('fake-playtoken', '').value if fakePlayToken: self.playToken = fakePlayToken @@ -100,8 +94,8 @@ class OTPClientRepository(ClientRepositoryBase): if self.launcher: self.DISLToken = self.launcher.getDISLToken() - fakeDISLToken = config.GetString('fake-DISLToken', '') - fakeDISLPlayerName = config.GetString('fake-DISL-PlayerName', '') + fakeDISLToken = ConfigVariableString('fake-DISLToken', '').value + fakeDISLPlayerName = ConfigVariableString('fake-DISL-PlayerName', '').value if fakeDISLToken: self.DISLToken = fakeDISLToken elif fakeDISLPlayerName: @@ -109,39 +103,39 @@ class OTPClientRepository(ClientRepositoryBase): defaultNumAvatars = 4 defaultNumAvatarSlots = 4 defaultNumConcur = 1 - subCount = config.GetInt('fake-DISL-NumSubscriptions', 1) - playerAccountId = config.GetInt('fake-DISL-PlayerAccountId', defaultId) + subCount = ConfigVariableInt('fake-DISL-NumSubscriptions', 1).value + playerAccountId = ConfigVariableInt('fake-DISL-PlayerAccountId', defaultId).value self.DISLToken = ('ACCOUNT_NAME=%s' % fakeDISLPlayerName + '&ACCOUNT_NUMBER=%s' % playerAccountId + - '&ACCOUNT_NAME_APPROVAL=%s' % config.GetString('fake-DISL-PlayerNameApproved', 'YES') + - '&SWID=%s' % config.GetString('fake-DISL-SWID', '{1763AC36-D73F-41C2-A54A-B579E58B69C8}') + - '&FAMILY_NUMBER=%s' % config.GetString('fake-DISL-FamilyAccountId', '-1') + - '&familyAdmin=%s' % config.GetString('fake-DISL-FamilyAdmin', '1') + - '&PIRATES_ACCESS=%s' % config.GetString('fake-DISL-PiratesAccess', 'FULL') + - '&PIRATES_MAX_NUM_AVATARS=%s' % config.GetInt('fake-DISL-MaxAvatars', defaultNumAvatars) + - '&PIRATES_NUM_AVATAR_SLOTS=%s' % config.GetInt('fake-DISL-MaxAvatarSlots', defaultNumAvatarSlots) + - '&expires=%s' % config.GetString('fake-DISL-expire', '1577898000') + - '&OPEN_CHAT_ENABLED=%s' % config.GetString('fake-DISL-OpenChatEnabled', 'YES') + - '&CREATE_FRIENDS_WITH_CHAT=%s' % config.GetString('fake-DISL-CreateFriendsWithChat', 'YES') + - '&CHAT_CODE_CREATION_RULE=%s' % config.GetString('fake-DISL-ChatCodeCreation', 'YES') + - '&FAMILY_MEMBERS=%s' % config.GetString('fake-DISL-FamilyMembers') + '&PIRATES_SUB_COUNT=%s' % subCount) + '&ACCOUNT_NAME_APPROVAL=%s' % ConfigVariableString('fake-DISL-PlayerNameApproved', 'YES').value + + '&SWID=%s' % ConfigVariableString('fake-DISL-SWID', '{1763AC36-D73F-41C2-A54A-B579E58B69C8}').value + + '&FAMILY_NUMBER=%s' % ConfigVariableString('fake-DISL-FamilyAccountId', '-1').value + + '&familyAdmin=%s' % ConfigVariableString('fake-DISL-FamilyAdmin', '1').value + + '&PIRATES_ACCESS=%s' % ConfigVariableString('fake-DISL-PiratesAccess', 'FULL').value + + '&PIRATES_MAX_NUM_AVATARS=%s' % ConfigVariableInt('fake-DISL-MaxAvatars', defaultNumAvatars).value + + '&PIRATES_NUM_AVATAR_SLOTS=%s' % ConfigVariableInt('fake-DISL-MaxAvatarSlots', defaultNumAvatarSlots).value + + '&expires=%s' % ConfigVariableString('fake-DISL-expire', '1577898000').value + + '&OPEN_CHAT_ENABLED=%s' % ConfigVariableString('fake-DISL-OpenChatEnabled', 'YES').value + + '&CREATE_FRIENDS_WITH_CHAT=%s' % ConfigVariableString('fake-DISL-CreateFriendsWithChat', 'YES').value + + '&CHAT_CODE_CREATION_RULE=%s' % ConfigVariableString('fake-DISL-ChatCodeCreation', 'YES').value + + '&FAMILY_MEMBERS=%s' % ConfigVariableString('fake-DISL-FamilyMembers').value + '&PIRATES_SUB_COUNT=%s' % subCount) for i in range(subCount): - self.DISLToken += ('&PIRATES_SUB_%s_ACCESS=%s' % (i, config.GetString('fake-DISL-Sub-%s-Access' % i, 'FULL')) + - '&PIRATES_SUB_%s_ACTIVE=%s' % (i, config.GetString('fake-DISL-Sub-%s-Active' % i, 'YES')) + - '&PIRATES_SUB_%s_ID=%s' % (i, config.GetInt('fake-DISL-Sub-%s-Id' % i, playerAccountId) + config.GetInt('fake-DISL-Sub-Id-Offset', 0)) + - '&PIRATES_SUB_%s_LEVEL=%s' % (i, config.GetInt('fake-DISL-Sub-%s-Level' % i, 3)) + - '&PIRATES_SUB_%s_NAME=%s' % (i, config.GetString('fake-DISL-Sub-%s-Name' % i, fakeDISLPlayerName)) + - '&PIRATES_SUB_%s_NUM_AVATARS=%s' % (i, config.GetInt('fake-DISL-Sub-%s-NumAvatars' % i, defaultNumAvatars)) + - '&PIRATES_SUB_%s_NUM_CONCUR=%s' % (i, config.GetInt('fake-DISL-Sub-%s-NumConcur' % i, defaultNumConcur)) + - '&PIRATES_SUB_%s_OWNERID=%s' % (i, config.GetInt('fake-DISL-Sub-%s-OwnerId' % i, playerAccountId)) + - '&PIRATES_SUB_%s_FOUNDER=%s' % (i, config.GetString('fake-DISL-Sub-%s-Founder' % i, 'YES'))) + self.DISLToken += ('&PIRATES_SUB_%s_ACCESS=%s' % (i, ConfigVariableString('fake-DISL-Sub-%s-Access' % i, 'FULL').value) + + '&PIRATES_SUB_%s_ACTIVE=%s' % (i, ConfigVariableString('fake-DISL-Sub-%s-Active' % i, 'YES').value) + + '&PIRATES_SUB_%s_ID=%s' % (i, ConfigVariableInt('fake-DISL-Sub-%s-Id' % i, playerAccountId).value + ConfigVariableInt('fake-DISL-Sub-Id-Offset', 0).value) + + '&PIRATES_SUB_%s_LEVEL=%s' % (i, ConfigVariableInt('fake-DISL-Sub-%s-Level' % i, 3).value) + + '&PIRATES_SUB_%s_NAME=%s' % (i, ConfigVariableString('fake-DISL-Sub-%s-Name' % i, fakeDISLPlayerName).value) + + '&PIRATES_SUB_%s_NUM_AVATARS=%s' % (i, ConfigVariableInt('fake-DISL-Sub-%s-NumAvatars' % i, defaultNumAvatars).value) + + '&PIRATES_SUB_%s_NUM_CONCUR=%s' % (i, ConfigVariableInt('fake-DISL-Sub-%s-NumConcur' % i, defaultNumConcur).value) + + '&PIRATES_SUB_%s_OWNERID=%s' % (i, ConfigVariableInt('fake-DISL-Sub-%s-OwnerId' % i, playerAccountId).value) + + '&PIRATES_SUB_%s_FOUNDER=%s' % (i, ConfigVariableString('fake-DISL-Sub-%s-Founder' % i, 'YES').value)) - self.DISLToken += ('&WL_CHAT_ENABLED=%s' % config.GetString('fake-DISL-WLChatEnabled', 'YES') + + self.DISLToken += ('&WL_CHAT_ENABLED=%s' % ConfigVariableString('fake-DISL-WLChatEnabled', 'YES').value + '&valid=true') if base.logPrivateInfo: print(self.DISLToken) - self.requiredLogin = config.GetString('required-login', 'auto') + self.requiredLogin = ConfigVariableString('required-login', 'auto').value if self.requiredLogin == 'auto': self.notify.info('required-login auto.') elif self.requiredLogin == 'green': @@ -167,10 +161,10 @@ class OTPClientRepository(ClientRepositoryBase): else: self.http = HTTPClient() - self.accountOldAuth = config.GetBool('account-old-auth', 0) - self.accountOldAuth = config.GetBool('%s-account-old-auth' % game.name, - self.accountOldAuth) - self.useNewTTDevLogin = base.config.GetBool('use-tt-specific-dev-login', False) + self.accountOldAuth = ConfigVariableBool('account-old-auth', 0).value + self.accountOldAuth = ConfigVariableBool('%s-account-old-auth' % game.name, + self.accountOldAuth).value + self.useNewTTDevLogin = ConfigVariableBool('use-tt-specific-dev-login', False).value if __astron__: self.loginInterface = LoginAstronAccount.LoginAstronAccount(self) self.notify.info('loginInterface: LoginAstronAccount') @@ -193,11 +187,11 @@ class OTPClientRepository(ClientRepositoryBase): self.loginInterface = LoginTTAccount.LoginTTAccount(self) self.notify.info('loginInterface: LoginTTAccount') - self.secretChatAllowed = base.config.GetBool('allow-secret-chat', 0) - self.openChatAllowed = base.config.GetBool('allow-open-chat', 0) - self.secretChatNeedsParentPassword = base.config.GetBool('secret-chat-needs-parent-password', 0) or (self.launcher and self.launcher.getNeedPwForSecretKey()) - self.parentPasswordSet = base.config.GetBool('parent-password-set', 0) or (self.launcher and self.launcher.getParentPasswordSet()) - self.userSignature = base.config.GetString('signature', 'none') + self.secretChatAllowed = ConfigVariableBool('allow-secret-chat', 0).value + self.openChatAllowed = ConfigVariableBool('allow-open-chat', 0).value + self.secretChatNeedsParentPassword = ConfigVariableBool('secret-chat-needs-parent-password', 0).value or (self.launcher and self.launcher.getNeedPwForSecretKey()) + self.parentPasswordSet = ConfigVariableBool('parent-password-set', 0).value or (self.launcher and self.launcher.getParentPasswordSet()) + self.userSignature = ConfigVariableString('signature', 'none').value self.freeTimeExpiresAt = -1 self.__isPaid = 0 self.periodTimerExpired = 0 @@ -206,18 +200,18 @@ class OTPClientRepository(ClientRepositoryBase): self.parentMgr.registerParent(OTPGlobals.SPRender, base.render) self.parentMgr.registerParent(OTPGlobals.SPHidden, NodePath()) self.timeManager = None - if config.GetBool('detect-leaks', 0) or config.GetBool('client-detect-leaks', 0): + if ConfigVariableBool('detect-leaks', 0).value or ConfigVariableBool('client-detect-leaks', 0).value: self.startLeakDetector() - if config.GetBool('detect-messenger-leaks', 0) or config.GetBool('ai-detect-messenger-leaks', 0): + if ConfigVariableBool('detect-messenger-leaks', 0).value or ConfigVariableBool('ai-detect-messenger-leaks', 0).value: self.messengerLeakDetector = MessengerLeakDetector.MessengerLeakDetector('client messenger leak detector') - if config.GetBool('leak-messages', 0): + if ConfigVariableBool('leak-messages', 0).value: MessengerLeakDetector._leakMessengerObject() - if config.GetBool('run-garbage-reports', 0) or config.GetBool('client-run-garbage-reports', 0): + if ConfigVariableBool('run-garbage-reports', 0).value or ConfigVariableBool('client-run-garbage-reports', 0).value: noneValue = -1.0 - reportWait = config.GetFloat('garbage-report-wait', noneValue) - reportWaitScale = config.GetFloat('garbage-report-wait-scale', noneValue) + reportWait = ConfigVariableDouble('garbage-report-wait', noneValue).value + reportWaitScale = ConfigVariableDouble('garbage-report-wait-scale', noneValue).value if reportWait == noneValue: reportWait = 60.0 * 2.0 if reportWaitScale == noneValue: @@ -225,8 +219,8 @@ class OTPClientRepository(ClientRepositoryBase): self.garbageReportScheduler = GarbageReportScheduler(waitBetween=reportWait, waitScale=reportWaitScale) - self._proactiveLeakChecks = config.GetBool('proactive-leak-checks', 1) or config.GetBool('client-proactive-leak-checks', 1) - self._crashOnProactiveLeakDetect = config.GetBool('crash-on-proactive-leak-detect', 1) + self._proactiveLeakChecks = ConfigVariableBool('proactive-leak-checks', 1).value or ConfigVariableBool('client-proactive-leak-checks', 1).value + self._crashOnProactiveLeakDetect = ConfigVariableBool('crash-on-proactive-leak-detect', 1).value self.activeDistrictMap = {} self.telemetryLimiter = TelemetryLimiter() self.serverVersion = serverVersion @@ -415,8 +409,8 @@ class OTPClientRepository(ClientRepositoryBase): self.playGame = playGame(self.gameFSM, self.gameDoneEvent) self.shardListHandle = None self.uberZoneInterest = None - self.wantSwitchboard = config.GetBool('want-switchboard', 0) - self.wantSwitchboardHacks = base.config.GetBool('want-switchboard-hacks', 0) + self.wantSwitchboard = ConfigVariableBool('want-switchboard', 0).value + self.wantSwitchboardHacks = ConfigVariableBool('want-switchboard-hacks', 0).value self.__pendingGenerates = {} self.__pendingMessages = {} self.__doId2pendingInterest = {} @@ -427,7 +421,7 @@ class OTPClientRepository(ClientRepositoryBase): def startLeakDetector(self): if hasattr(self, 'leakDetector'): return False - firstCheckDelay = config.GetFloat('leak-detector-first-check-delay', 2 * 60.0) + firstCheckDelay = ConfigVariableDouble('leak-detector-first-check-delay', 2 * 60.0).value self.leakDetector = ContainerLeakDetector('client container leak detector', firstCheckDelay=firstCheckDelay) self.objectTypesLeakDetector = LeakDetectors.ObjectTypesLeakDetector() self.garbageLeakDetector = LeakDetectors.GarbageLeakDetector() @@ -685,7 +679,7 @@ class OTPClientRepository(ClientRepositoryBase): @report(types=['args', 'deltaStamp'], dConfigParam='teleport') def waitForGetGameListResponse(self): if self.isGameListCorrect(): - if base.config.GetBool('game-server-tests', 0): + if ConfigVariableBool('game-server-tests', 0).value: from otp.distributed import GameServerTestSuite GameServerTestSuite.GameServerTestSuite(self) self.loginFSM.request('waitForShardList') @@ -1207,7 +1201,7 @@ class OTPClientRepository(ClientRepositoryBase): else: logFunc = self.notify.warning allowExit = False - if base.config.GetBool('direct-gui-edit', 0): + if ConfigVariableBool('direct-gui-edit', 0).value: logFunc('There are leaks: %s tasks, %s events, %s ivals, %s garbage cycles\nLeaked Events may be due to direct gui editing' % (leakedTasks, leakedEvents, leakedIvals, @@ -1624,7 +1618,7 @@ class OTPClientRepository(ClientRepositoryBase): avId = self.handlerArgs['avId'] if not self.SupportTutorial or base.localAvatar.tutorialAck: self.gameFSM.request('playGame', [hoodId, zoneId, avId]) - elif base.config.GetBool('force-tutorial', 1): + elif ConfigVariableBool('force-tutorial', 1).value: if hasattr(self, 'skipTutorialRequest') and self.skipTutorialRequest: self.gameFSM.request('playGame', [hoodId, zoneId, avId]) self.gameFSM.request('skipTutorialRequest', [hoodId, zoneId, avId]) @@ -1698,9 +1692,9 @@ class OTPClientRepository(ClientRepositoryBase): def isFreeTimeExpired(self): if self.accountOldAuth: return 0 - if base.config.GetBool('free-time-expired', 0): + if ConfigVariableBool('free-time-expired', 0).value: return 1 - if base.config.GetBool('unlimited-free-time', 0): + if ConfigVariableBool('unlimited-free-time', 0).value: return 0 if self.freeTimeExpiresAt == -1: return 0 @@ -1726,7 +1720,7 @@ class OTPClientRepository(ClientRepositoryBase): return self.blue != None def isPaid(self): - paidStatus = base.config.GetString('force-paid-status', '') + paidStatus = ConfigVariableString('force-paid-status', '').value if not paidStatus: return self.__isPaid elif paidStatus == 'paid': @@ -1744,7 +1738,7 @@ class OTPClientRepository(ClientRepositoryBase): self.__isPaid = isPaid def allowFreeNames(self): - return base.config.GetInt('allow-free-names', 1) + return ConfigVariableInt('allow-free-names', 1).value def allowSecretChat(self): return self.secretChatAllowed or self.productName == 'Terra-DMC' and self.isBlue() and self.secretChatAllowed diff --git a/otp/launcher/LauncherBase.py b/otp/launcher/LauncherBase.py index ee99a22..b10bc7c 100644 --- a/otp/launcher/LauncherBase.py +++ b/otp/launcher/LauncherBase.py @@ -65,15 +65,13 @@ class LauncherBase(DirectObject): print('Current time: ' + time.asctime(time.localtime(time.time())) + ' ' + time.tzname[0]) print('sys.path = ', sys.path) print('sys.argv = ', sys.argv) - launcherConfig = DConfig - builtins.config = launcherConfig - if config.GetBool('log-private-info', 0): + if ConfigVariableBool('log-private-info', 0).value: print('os.environ = ', os.environ) self.miniTaskMgr = MiniTaskManager() self.nout = MultiplexStream() Notify.ptr().setOstreamPtr(self.nout, 0) self.nout.addFile(Filename(logfile)) - if launcherConfig.GetBool('console-output', 0): + if ConfigVariableBool('console-output', 0).value: self.nout.addStandardOutput() sys.stdout.console = True sys.stderr.console = True diff --git a/otp/speedchat/SCMenu.py b/otp/speedchat/SCMenu.py index 7c37760..84e458c 100644 --- a/otp/speedchat/SCMenu.py +++ b/otp/speedchat/SCMenu.py @@ -1,17 +1,15 @@ -from pandac.PandaModules import * +from panda3d.core import * from direct.gui.DirectGui import * from direct.task import Task from .SCConstants import * from direct.interval.IntervalGlobal import * from .SCObject import SCObject from direct.showbase.PythonUtil import makeTuple -import types class SCMenu(SCObject, NodePath): - config = getConfigShowbase() - SpeedChatRolloverTolerance = config.GetFloat('speedchat-rollover-tolerance', 0.08) - WantFade = config.GetBool('want-speedchat-fade', 0) - FadeDuration = config.GetFloat('speedchat-fade-duration', 0.2) + SpeedChatRolloverTolerance = ConfigVariableDouble('speedchat-rollover-tolerance', 0.08).value + WantFade = ConfigVariableBool('want-speedchat-fade', 0).value + FadeDuration = ConfigVariableDouble('speedchat-fade-duration', 0.2).value SerialNum = 0 BackgroundModelName = None GuiModelName = None diff --git a/toontown/distributed/ToontownClientRepository.py b/toontown/distributed/ToontownClientRepository.py index c614745..d2e8764 100644 --- a/toontown/distributed/ToontownClientRepository.py +++ b/toontown/distributed/ToontownClientRepository.py @@ -1,31 +1,14 @@ -import time -from pandac.PandaModules import * +from panda3d.core import * from direct.distributed.ClockDelta import * from direct.gui.DirectGui import * -from pandac.PandaModules import * from direct.interval.IntervalGlobal import ivalMgr -from direct.directnotify import DirectNotifyGlobal -from direct.distributed import DistributedSmoothNode from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagramIterator import PyDatagramIterator -from direct.task import Task -from direct.fsm import ClassicFSM from direct.fsm import State from direct.showbase.PythonUtil import Functor, ScratchPad -from direct.showbase.InputStateGlobal import inputState from otp.avatar import Avatar -from otp.avatar import DistributedAvatar -from otp.friends import FriendManager -from otp.login import LoginScreen -from otp.login import LoginGSAccount -from otp.login import LoginGoAccount -from otp.login import LoginWebPlayTokenAccount -from otp.login import LoginTTAccount -from otp.login import HTTPUtil from otp.distributed import OTPClientRepository from otp.distributed import PotentialAvatar -from otp.distributed import PotentialShard -from otp.distributed import DistributedDistrict from otp.distributed.OtpDoGlobals import * from otp.distributed import OtpDoGlobals from otp.otpbase import OTPGlobals @@ -39,7 +22,6 @@ from toontown.distributed import DelayDelete from toontown.friends import FriendHandle from toontown.friends import FriendsListPanel from toontown.friends import ToontownFriendSecret -from toontown.uberdog import TTSpeedchatRelay from toontown.login import DateObject from toontown.login import AvatarChooser from toontown.makeatoon import MakeAToon @@ -49,7 +31,6 @@ from toontown.toontowngui import TTDialog from toontown.toon import LocalToon from toontown.toon import ToonDNA from toontown.distributed import ToontownDistrictStats -from toontown.makeatoon import TTPickANamePattern from toontown.parties import ToontownTimeManager from toontown.toon import Toon, DistributedToon from .ToontownMsgTypes import * @@ -101,7 +82,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.playerFriendsManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_PLAYER_FRIENDS_MANAGER, 'TTPlayerFriendsManager') self.speedchatRelay = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_SPEEDCHAT_RELAY, 'TTSpeedchatRelay') self.deliveryManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_DELIVERY_MANAGER, 'DistributedDeliveryManager') - if config.GetBool('want-code-redemption', 1): + if ConfigVariableBool('want-code-redemption', 1).value: self.codeRedemptionManager = self.generateGlobalObject(OtpDoGlobals.OTP_DO_ID_TOONTOWN_CODE_REDEMPTION_MANAGER, 'TTCodeRedemptionMgr') self.streetSign = None self.furnitureManager = None @@ -127,9 +108,9 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): state.addTransition('skipTutorialRequest') state = self.gameFSM.getStateNamed('playGame') state.addTransition('skipTutorialRequest') - self.wantCogdominiums = base.config.GetBool('want-cogdominiums', 1) - self.wantEmblems = base.config.GetBool('want-emblems', 0) - if base.config.GetBool('tt-node-check', 0): + self.wantCogdominiums = ConfigVariableBool('want-cogdominiums', 1).value + self.wantEmblems = ConfigVariableBool('want-emblems', 0).value + if ConfigVariableBool('tt-node-check', 0).value: for species in ToonDNA.toonSpeciesTypes: for head in ToonDNA.getHeadList(species): for torso in ToonDNA.toonTorsoTypes: @@ -231,7 +212,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository): self.avChoice.load(self.isPaid()) self.avChoice.enter() self.accept(self.avChoiceDoneEvent, self.__handleAvatarChooserDone, [avList]) - if config.GetBool('want-gib-loader', 1): + if ConfigVariableBool('want-gib-loader', 1).value: self.loadingBlocker = ToontownLoadingBlocker.ToontownLoadingBlocker(avList) return diff --git a/toontown/toonbase/ToontownGlobals.py b/toontown/toonbase/ToontownGlobals.py index 11e1689..e5ea232 100644 --- a/toontown/toonbase/ToontownGlobals.py +++ b/toontown/toonbase/ToontownGlobals.py @@ -1,7 +1,7 @@ from . import TTLocalizer from otp.otpbase.OTPGlobals import * from direct.showbase.PythonUtil import Enum, invertDict -from pandac.PandaModules import BitMask32, Vec4 +from panda3d.core import BitMask32, Vec4 MapHotkeyOn = 'alt' MapHotkeyOff = 'alt-up' MapHotkey = 'alt' diff --git a/toontown/toonbase/ToontownStart.py b/toontown/toonbase/ToontownStart.py index ef358d1..6ecda03 100644 --- a/toontown/toonbase/ToontownStart.py +++ b/toontown/toonbase/ToontownStart.py @@ -71,7 +71,7 @@ if base.musicManagerIsValid: else: music = None from direct.gui.DirectGui import * -serverVersion = base.config.GetString('server-version', 'no_version_set') +serverVersion = ConfigVariableString('server-version', 'no_version_set').value 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)