diff --git a/toontown/battle/BattleSounds.py b/toontown/battle/BattleSounds.py index 2acff8e..6fb7399 100644 --- a/toontown/battle/BattleSounds.py +++ b/toontown/battle/BattleSounds.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * from direct.directnotify import DirectNotifyGlobal class BattleSounds: @@ -9,7 +9,7 @@ class BattleSounds: self.isValid = 0 if self.mgr != None and self.mgr.isValid(): self.isValid = 1 - limit = base.config.GetInt('battle-sound-cache-size', 15) + limit = ConfigVariableInt('battle-sound-cache-size', 15).value self.mgr.setCacheLimit(limit) base.addSfxManager(self.mgr) self.setupSearchPath() diff --git a/toontown/shtiker/EventsPage.py b/toontown/shtiker/EventsPage.py index 31ae4d7..7178d25 100644 --- a/toontown/shtiker/EventsPage.py +++ b/toontown/shtiker/EventsPage.py @@ -1,5 +1,5 @@ -import urllib.request, urllib.parse, urllib.error -from pandac.PandaModules import Vec4, Vec3, TextNode, PNMImage, StringStream, Texture, HTTPClient, DocumentSpec, Ramfile, Point3 +import urllib.request +from panda3d.core 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 from direct.gui import DirectGuiGlobals @@ -22,17 +22,17 @@ EventsPage_News = 3 class EventsPage(ShtikerPage.ShtikerPage): notify = DirectNotifyGlobal.directNotify.newCategory('EventsPage') - UseNewsTab = base.config.GetBool('want-news-tab', 0) + UseNewsTab = ConfigVariableBool('want-news-tab', 0).value DefaultNewsUrl = '/news/news_urls.txt' - NewsUrl = base.config.GetString('news-url', DefaultNewsUrl) + NewsUrl = ConfigVariableString('news-url', DefaultNewsUrl).value DownloadArticlesTaskName = 'downloadArticlesTask' - NonblockingDownload = base.config.GetBool('news-nonblocking', 1) + NonblockingDownload = ConfigVariableBool('news-nonblocking', 1).value def __init__(self): ShtikerPage.ShtikerPage.__init__(self) self.mode = EventsPage_Calendar self.setMode(self.mode) - self.noTeleport = config.GetBool('Parties-page-disable', 0) + self.noTeleport = ConfigVariableBool('Parties-page-disable', 0).value self.isPrivate = True self.gotRssFeed = False self.gotArticles = False diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index f202b9f..748719c 100644 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * from . import ShtikerPage from toontown.toontowngui import TTDialog from direct.gui.DirectGui import * @@ -118,8 +118,8 @@ class OptionsTabPage(DirectFrame): notify = DirectNotifyGlobal.directNotify.newCategory('OptionsTabPage') DisplaySettingsTaskName = 'save-display-settings' DisplaySettingsDelay = 60 - ChangeDisplaySettings = base.config.GetBool('change-display-settings', 1) - ChangeDisplayAPI = base.config.GetBool('change-display-api', 0) + ChangeDisplaySettings = ConfigVariableBool('change-display-settings', 1).value + ChangeDisplayAPI = ConfigVariableBool('change-display-api', 0).value def __init__(self, parent = aspect2d): self._parent = parent diff --git a/toontown/suit/Suit.py b/toontown/suit/Suit.py index 644b2b3..ee6bce0 100644 --- a/toontown/suit/Suit.py +++ b/toontown/suit/Suit.py @@ -2,15 +2,12 @@ from direct.actor import Actor from otp.avatar import Avatar from . import SuitDNA from toontown.toonbase import ToontownGlobals -from pandac.PandaModules import * +from panda3d.core import * from panda3d.otp import * from toontown.battle import SuitBattleGlobals from direct.task.Task import Task from toontown.battle import BattleProps from toontown.toonbase import TTLocalizer -from pandac.PandaModules import VirtualFileMountHTTP, VirtualFileSystem, Filename, DSearchPath -from direct.showbase import AppRunnerGlobal -import os aSize = 6.06 bSize = 5.29 cSize = 4.14 @@ -150,7 +147,7 @@ bw = (('finger-wag', 'fingerwag', 5), ('magic1', 'magic1', 5), ('throw-object', 'throw-object', 5), ('throw-paper', 'throw-paper', 5)) -if not base.config.GetBool('want-new-cogs', 0): +if not ConfigVariableBool('want-new-cogs', 0).value: ModelDict = {'a': ('/models/char/suitA-', 4), 'b': ('/models/char/suitB-', 4), 'c': ('/models/char/suitC-', 3.5)} @@ -186,12 +183,12 @@ def unloadSuits(level): def loadSuitModelsAndAnims(level, flag = 0): for key in list(ModelDict.keys()): model, phase = ModelDict[key] - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: headModel, headPhase = HeadModelDict[key] else: headModel, headPhase = ModelDict[key] if flag: - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: filepath = 'phase_3.5' + model + 'zero' if cogExists(model + 'zero.bam'): loader.loadModel(filepath).node() @@ -199,7 +196,7 @@ def loadSuitModelsAndAnims(level, flag = 0): loader.loadModel('phase_3.5' + model + 'mod').node() loader.loadModel('phase_' + str(headPhase) + headModel + 'heads').node() else: - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: filepath = 'phase_3.5' + model + 'zero' if cogExists(model + 'zero.bam'): loader.unloadModel(filepath) @@ -210,11 +207,8 @@ def loadSuitModelsAndAnims(level, flag = 0): def cogExists(filePrefix): searchPath = DSearchPath() - if AppRunnerGlobal.appRunner: - searchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5')) - else: - basePath = os.path.expandvars('$TTMODELS') or './ttmodels' - searchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/built/phase_3.5')) + if __debug__: + searchPath.appendDirectory(Filename('resources/phase_3.5')) filePrefix = filePrefix.strip('/') pfile = Filename(filePrefix) found = vfs.resolveFilename(pfile, searchPath) @@ -618,7 +612,7 @@ class Suit(Avatar.Avatar): def generateBody(self): animDict = self.generateAnimDict() filePrefix, bodyPhase = ModelDict[self.style.body] - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: if cogExists(filePrefix + 'zero.bam'): self.loadModel('phase_3.5' + filePrefix + 'zero') else: @@ -644,7 +638,7 @@ class Suit(Avatar.Avatar): for anim in AllSuitsBattle: animDict[anim[0]] = 'phase_5' + filePrefix + anim[1] - if not base.config.GetBool('want-new-cogs', 0): + if not ConfigVariableBool('want-new-cogs', 0).value: if self.style.body == 'a': animDict['neutral'] = 'phase_4/models/char/suitA-neutral' for anim in SuitsCEOBattle: @@ -701,7 +695,7 @@ class Suit(Avatar.Avatar): self.shadowJoint = self.find('**/joint_shadow') self.nametagJoint = self.find('**/joint_nameTag') - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: if dept == 'c': texType = 'bossbot' elif dept == 'm': @@ -759,14 +753,14 @@ class Suit(Avatar.Avatar): modelRoot.find('**/hands').setTexture(handTex, 1) def generateHead(self, headType): - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: filePrefix, phase = HeadModelDict[self.style.body] else: filePrefix, phase = ModelDict[self.style.body] headModel = loader.loadModel('phase_' + str(phase) + filePrefix + 'heads') headReferences = headModel.findAllMatches('**/' + headType) for i in range(0, headReferences.getNumPaths()): - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: headPart = self.instance(headReferences.getPath(i), 'modelRoot', 'to_head') if not headPart: headPart = self.instance(headReferences.getPath(i), 'modelRoot', 'joint_head') @@ -806,7 +800,7 @@ class Suit(Avatar.Avatar): def generateCorporateMedallion(self): icons = loader.loadModel('phase_3/models/gui/cog_icons') dept = self.style.dept - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: chestNull = self.find('**/def_joint_attachMeter') if chestNull.isEmpty(): chestNull = self.find('**/joint_attachMeter') @@ -831,7 +825,7 @@ class Suit(Avatar.Avatar): button.setScale(3.0) button.setH(180.0) button.setColor(self.healthColors[0]) - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: chestNull = self.find('**/def_joint_attachMeter') if chestNull.isEmpty(): chestNull = self.find('**/joint_attachMeter') @@ -909,7 +903,7 @@ class Suit(Avatar.Avatar): return def getLoseActor(self): - if base.config.GetBool('want-new-cogs', 0): + if ConfigVariableBool('want-new-cogs', 0).value: if self.find('**/body'): return self if self.loseActor == None: diff --git a/toontown/town/Street.py b/toontown/town/Street.py index 975b65f..743bcd1 100644 --- a/toontown/town/Street.py +++ b/toontown/town/Street.py @@ -1,26 +1,20 @@ -from pandac.PandaModules import * +from panda3d.core import * from panda3d.otp import * from toontown.battle.BattleProps import * from toontown.battle.BattleSounds import * from toontown.distributed.ToontownMsgTypes import * from direct.gui.DirectGui import cleanupDialog from direct.directnotify import DirectNotifyGlobal -from toontown.hood import Place from toontown.battle import BattlePlace -from direct.showbase import DirectObject -from direct.fsm import StateData from direct.fsm import ClassicFSM, State from direct.task import Task from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs -from toontown.battle import BattleParticles from toontown.building import Elevator from toontown.hood import ZoneUtil from toontown.toonbase import ToontownGlobals from toontown.toon.Toon import teleportDebug -from toontown.estate import HouseGlobals -from toontown.toonbase import TTLocalizer from direct.interval.IntervalGlobal import * -visualizeZones = base.config.GetBool('visualize-zones', 0) +visualizeZones = ConfigVariableBool('visualize-zones', 0).value class Street(BattlePlace.BattlePlace): notify = DirectNotifyGlobal.directNotify.newCategory('Street')