so many DeprecationWarnings

This commit is contained in:
Open Toontown 2022-01-19 19:50:20 -05:00
parent 59968e3cee
commit 4bdada2816
5 changed files with 28 additions and 40 deletions

View file

@ -1,4 +1,4 @@
from pandac.PandaModules import * from panda3d.core import *
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
class BattleSounds: class BattleSounds:
@ -9,7 +9,7 @@ class BattleSounds:
self.isValid = 0 self.isValid = 0
if self.mgr != None and self.mgr.isValid(): if self.mgr != None and self.mgr.isValid():
self.isValid = 1 self.isValid = 1
limit = base.config.GetInt('battle-sound-cache-size', 15) limit = ConfigVariableInt('battle-sound-cache-size', 15).value
self.mgr.setCacheLimit(limit) self.mgr.setCacheLimit(limit)
base.addSfxManager(self.mgr) base.addSfxManager(self.mgr)
self.setupSearchPath() self.setupSearchPath()

View file

@ -1,5 +1,5 @@
import urllib.request, urllib.parse, urllib.error import urllib.request
from pandac.PandaModules import Vec4, Vec3, TextNode, PNMImage, StringStream, Texture, HTTPClient, DocumentSpec, Ramfile, Point3 from panda3d.core import Vec4, Vec3, TextNode, PNMImage, StringStream, Texture, HTTPClient, DocumentSpec, Ramfile, Point3
from direct.task.Task import Task from direct.task.Task import Task
from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DirectCheckButton, OnscreenText from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DirectCheckButton, OnscreenText
from direct.gui import DirectGuiGlobals from direct.gui import DirectGuiGlobals
@ -22,17 +22,17 @@ EventsPage_News = 3
class EventsPage(ShtikerPage.ShtikerPage): class EventsPage(ShtikerPage.ShtikerPage):
notify = DirectNotifyGlobal.directNotify.newCategory('EventsPage') 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' DefaultNewsUrl = '/news/news_urls.txt'
NewsUrl = base.config.GetString('news-url', DefaultNewsUrl) NewsUrl = ConfigVariableString('news-url', DefaultNewsUrl).value
DownloadArticlesTaskName = 'downloadArticlesTask' DownloadArticlesTaskName = 'downloadArticlesTask'
NonblockingDownload = base.config.GetBool('news-nonblocking', 1) NonblockingDownload = ConfigVariableBool('news-nonblocking', 1).value
def __init__(self): def __init__(self):
ShtikerPage.ShtikerPage.__init__(self) ShtikerPage.ShtikerPage.__init__(self)
self.mode = EventsPage_Calendar self.mode = EventsPage_Calendar
self.setMode(self.mode) self.setMode(self.mode)
self.noTeleport = config.GetBool('Parties-page-disable', 0) self.noTeleport = ConfigVariableBool('Parties-page-disable', 0).value
self.isPrivate = True self.isPrivate = True
self.gotRssFeed = False self.gotRssFeed = False
self.gotArticles = False self.gotArticles = False

View file

@ -1,4 +1,4 @@
from pandac.PandaModules import * from panda3d.core import *
from . import ShtikerPage from . import ShtikerPage
from toontown.toontowngui import TTDialog from toontown.toontowngui import TTDialog
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
@ -118,8 +118,8 @@ class OptionsTabPage(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('OptionsTabPage') notify = DirectNotifyGlobal.directNotify.newCategory('OptionsTabPage')
DisplaySettingsTaskName = 'save-display-settings' DisplaySettingsTaskName = 'save-display-settings'
DisplaySettingsDelay = 60 DisplaySettingsDelay = 60
ChangeDisplaySettings = base.config.GetBool('change-display-settings', 1) ChangeDisplaySettings = ConfigVariableBool('change-display-settings', 1).value
ChangeDisplayAPI = base.config.GetBool('change-display-api', 0) ChangeDisplayAPI = ConfigVariableBool('change-display-api', 0).value
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self._parent = parent self._parent = parent

View file

@ -2,15 +2,12 @@ from direct.actor import Actor
from otp.avatar import Avatar from otp.avatar import Avatar
from . import SuitDNA from . import SuitDNA
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import * from panda3d.core import *
from panda3d.otp import * from panda3d.otp import *
from toontown.battle import SuitBattleGlobals from toontown.battle import SuitBattleGlobals
from direct.task.Task import Task from direct.task.Task import Task
from toontown.battle import BattleProps from toontown.battle import BattleProps
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer
from pandac.PandaModules import VirtualFileMountHTTP, VirtualFileSystem, Filename, DSearchPath
from direct.showbase import AppRunnerGlobal
import os
aSize = 6.06 aSize = 6.06
bSize = 5.29 bSize = 5.29
cSize = 4.14 cSize = 4.14
@ -150,7 +147,7 @@ bw = (('finger-wag', 'fingerwag', 5),
('magic1', 'magic1', 5), ('magic1', 'magic1', 5),
('throw-object', 'throw-object', 5), ('throw-object', 'throw-object', 5),
('throw-paper', 'throw-paper', 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), ModelDict = {'a': ('/models/char/suitA-', 4),
'b': ('/models/char/suitB-', 4), 'b': ('/models/char/suitB-', 4),
'c': ('/models/char/suitC-', 3.5)} 'c': ('/models/char/suitC-', 3.5)}
@ -186,12 +183,12 @@ def unloadSuits(level):
def loadSuitModelsAndAnims(level, flag = 0): def loadSuitModelsAndAnims(level, flag = 0):
for key in list(ModelDict.keys()): for key in list(ModelDict.keys()):
model, phase = ModelDict[key] model, phase = ModelDict[key]
if base.config.GetBool('want-new-cogs', 0): if ConfigVariableBool('want-new-cogs', 0).value:
headModel, headPhase = HeadModelDict[key] headModel, headPhase = HeadModelDict[key]
else: else:
headModel, headPhase = ModelDict[key] headModel, headPhase = ModelDict[key]
if flag: if flag:
if base.config.GetBool('want-new-cogs', 0): if ConfigVariableBool('want-new-cogs', 0).value:
filepath = 'phase_3.5' + model + 'zero' filepath = 'phase_3.5' + model + 'zero'
if cogExists(model + 'zero.bam'): if cogExists(model + 'zero.bam'):
loader.loadModel(filepath).node() loader.loadModel(filepath).node()
@ -199,7 +196,7 @@ def loadSuitModelsAndAnims(level, flag = 0):
loader.loadModel('phase_3.5' + model + 'mod').node() loader.loadModel('phase_3.5' + model + 'mod').node()
loader.loadModel('phase_' + str(headPhase) + headModel + 'heads').node() loader.loadModel('phase_' + str(headPhase) + headModel + 'heads').node()
else: else:
if base.config.GetBool('want-new-cogs', 0): if ConfigVariableBool('want-new-cogs', 0).value:
filepath = 'phase_3.5' + model + 'zero' filepath = 'phase_3.5' + model + 'zero'
if cogExists(model + 'zero.bam'): if cogExists(model + 'zero.bam'):
loader.unloadModel(filepath) loader.unloadModel(filepath)
@ -210,11 +207,8 @@ def loadSuitModelsAndAnims(level, flag = 0):
def cogExists(filePrefix): def cogExists(filePrefix):
searchPath = DSearchPath() searchPath = DSearchPath()
if AppRunnerGlobal.appRunner: if __debug__:
searchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5')) searchPath.appendDirectory(Filename('resources/phase_3.5'))
else:
basePath = os.path.expandvars('$TTMODELS') or './ttmodels'
searchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/built/phase_3.5'))
filePrefix = filePrefix.strip('/') filePrefix = filePrefix.strip('/')
pfile = Filename(filePrefix) pfile = Filename(filePrefix)
found = vfs.resolveFilename(pfile, searchPath) found = vfs.resolveFilename(pfile, searchPath)
@ -618,7 +612,7 @@ class Suit(Avatar.Avatar):
def generateBody(self): def generateBody(self):
animDict = self.generateAnimDict() animDict = self.generateAnimDict()
filePrefix, bodyPhase = ModelDict[self.style.body] 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'): if cogExists(filePrefix + 'zero.bam'):
self.loadModel('phase_3.5' + filePrefix + 'zero') self.loadModel('phase_3.5' + filePrefix + 'zero')
else: else:
@ -644,7 +638,7 @@ class Suit(Avatar.Avatar):
for anim in AllSuitsBattle: for anim in AllSuitsBattle:
animDict[anim[0]] = 'phase_5' + filePrefix + anim[1] 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': if self.style.body == 'a':
animDict['neutral'] = 'phase_4/models/char/suitA-neutral' animDict['neutral'] = 'phase_4/models/char/suitA-neutral'
for anim in SuitsCEOBattle: for anim in SuitsCEOBattle:
@ -701,7 +695,7 @@ class Suit(Avatar.Avatar):
self.shadowJoint = self.find('**/joint_shadow') self.shadowJoint = self.find('**/joint_shadow')
self.nametagJoint = self.find('**/joint_nameTag') self.nametagJoint = self.find('**/joint_nameTag')
if base.config.GetBool('want-new-cogs', 0): if ConfigVariableBool('want-new-cogs', 0).value:
if dept == 'c': if dept == 'c':
texType = 'bossbot' texType = 'bossbot'
elif dept == 'm': elif dept == 'm':
@ -759,14 +753,14 @@ class Suit(Avatar.Avatar):
modelRoot.find('**/hands').setTexture(handTex, 1) modelRoot.find('**/hands').setTexture(handTex, 1)
def generateHead(self, headType): 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] filePrefix, phase = HeadModelDict[self.style.body]
else: else:
filePrefix, phase = ModelDict[self.style.body] filePrefix, phase = ModelDict[self.style.body]
headModel = loader.loadModel('phase_' + str(phase) + filePrefix + 'heads') headModel = loader.loadModel('phase_' + str(phase) + filePrefix + 'heads')
headReferences = headModel.findAllMatches('**/' + headType) headReferences = headModel.findAllMatches('**/' + headType)
for i in range(0, headReferences.getNumPaths()): 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') headPart = self.instance(headReferences.getPath(i), 'modelRoot', 'to_head')
if not headPart: if not headPart:
headPart = self.instance(headReferences.getPath(i), 'modelRoot', 'joint_head') headPart = self.instance(headReferences.getPath(i), 'modelRoot', 'joint_head')
@ -806,7 +800,7 @@ class Suit(Avatar.Avatar):
def generateCorporateMedallion(self): def generateCorporateMedallion(self):
icons = loader.loadModel('phase_3/models/gui/cog_icons') icons = loader.loadModel('phase_3/models/gui/cog_icons')
dept = self.style.dept 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') chestNull = self.find('**/def_joint_attachMeter')
if chestNull.isEmpty(): if chestNull.isEmpty():
chestNull = self.find('**/joint_attachMeter') chestNull = self.find('**/joint_attachMeter')
@ -831,7 +825,7 @@ class Suit(Avatar.Avatar):
button.setScale(3.0) button.setScale(3.0)
button.setH(180.0) button.setH(180.0)
button.setColor(self.healthColors[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') chestNull = self.find('**/def_joint_attachMeter')
if chestNull.isEmpty(): if chestNull.isEmpty():
chestNull = self.find('**/joint_attachMeter') chestNull = self.find('**/joint_attachMeter')
@ -909,7 +903,7 @@ class Suit(Avatar.Avatar):
return return
def getLoseActor(self): def getLoseActor(self):
if base.config.GetBool('want-new-cogs', 0): if ConfigVariableBool('want-new-cogs', 0).value:
if self.find('**/body'): if self.find('**/body'):
return self return self
if self.loseActor == None: if self.loseActor == None:

View file

@ -1,26 +1,20 @@
from pandac.PandaModules import * from panda3d.core import *
from panda3d.otp import * from panda3d.otp import *
from toontown.battle.BattleProps import * from toontown.battle.BattleProps import *
from toontown.battle.BattleSounds import * from toontown.battle.BattleSounds import *
from toontown.distributed.ToontownMsgTypes import * from toontown.distributed.ToontownMsgTypes import *
from direct.gui.DirectGui import cleanupDialog from direct.gui.DirectGui import cleanupDialog
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.hood import Place
from toontown.battle import BattlePlace from toontown.battle import BattlePlace
from direct.showbase import DirectObject
from direct.fsm import StateData
from direct.fsm import ClassicFSM, State from direct.fsm import ClassicFSM, State
from direct.task import Task from direct.task import Task
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs
from toontown.battle import BattleParticles
from toontown.building import Elevator from toontown.building import Elevator
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.toon.Toon import teleportDebug from toontown.toon.Toon import teleportDebug
from toontown.estate import HouseGlobals
from toontown.toonbase import TTLocalizer
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
visualizeZones = base.config.GetBool('visualize-zones', 0) visualizeZones = ConfigVariableBool('visualize-zones', 0).value
class Street(BattlePlace.BattlePlace): class Street(BattlePlace.BattlePlace):
notify = DirectNotifyGlobal.directNotify.newCategory('Street') notify = DirectNotifyGlobal.directNotify.newCategory('Street')