general: fix some more crashes

This commit is contained in:
Open Toontown 2019-11-17 16:57:18 -05:00
parent 4acc9fa914
commit 1c74fac58e
13 changed files with 72 additions and 19 deletions

View file

@ -7,18 +7,34 @@ class Settings:
def readSettings(): def readSettings():
pass # todo pass # todo
@staticmethod
def writeSettings():
pass # lol not yet
@staticmethod @staticmethod
def getWindowedMode(): def getWindowedMode():
return 1 return 1
@staticmethod
def setMusic(_):
pass
@staticmethod @staticmethod
def getMusic(): def getMusic():
return 1 return 1
@staticmethod
def setSfx(_):
pass
@staticmethod @staticmethod
def getSfx(): def getSfx():
return 1 return 1
@staticmethod
def setToonChatSounds(_):
pass
@staticmethod @staticmethod
def getToonChatSounds(): def getToonChatSounds():
return 1 return 1
@ -43,10 +59,18 @@ class Settings:
def doSavedSettingsExist(): def doSavedSettingsExist():
return 0 return 0
@staticmethod
def setAcceptingNewFriends(_):
pass
@staticmethod @staticmethod
def getAcceptingNewFriends(): def getAcceptingNewFriends():
return 1 return 1
@staticmethod
def setAcceptingNonFriendWhispers(_):
pass
@staticmethod @staticmethod
def getAcceptingNonFriendWhispers(): def getAcceptingNonFriendWhispers():
return 1 return 1

View file

@ -3,3 +3,18 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class NewsManagerAI(DistributedObjectAI): class NewsManagerAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('NewsManagerAI') notify = DirectNotifyGlobal.directNotify.newCategory('NewsManagerAI')
def getWeeklyCalendarHolidays(self):
return []
def getYearlyCalendarHolidays(self):
return []
def getOncelyCalendarHolidays(self):
return []
def getRelativelyCalendarHolidays(self):
return []
def getMultipleStartHolidays(self):
return []

View file

@ -4,6 +4,7 @@ from otp.distributed.OtpDoGlobals import *
from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository from toontown.distributed.ToontownInternalRepository import ToontownInternalRepository
from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI from toontown.distributed.ToontownDistrictAI import ToontownDistrictAI
from toontown.ai.HolidayManagerAI import HolidayManagerAI from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI from toontown.catalog.CatalogManagerAI import CatalogManagerAI
from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
@ -17,6 +18,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.districtId = None self.districtId = None
self.district = None self.district = None
self.holidayManager = None self.holidayManager = None
self.newsManager = None
self.zoneDataStore = None self.zoneDataStore = None
self.inGameNewsMgr = None self.inGameNewsMgr = None
self.catalogManager = None self.catalogManager = None
@ -59,6 +61,10 @@ class ToontownAIRepository(ToontownInternalRepository):
Creates "global" (distributed) objects. Creates "global" (distributed) objects.
""" """
# Generate our news manager...
self.newsManager = NewsManagerAI(self)
self.newsManager.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)
# Generate our in-game news manager... # Generate our in-game news manager...
self.inGameNewsMgr = DistributedInGameNewsMgrAI(self) self.inGameNewsMgr = DistributedInGameNewsMgrAI(self)
self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT) self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)

View file

@ -524,6 +524,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
self.handlerArgs = {'hoodId': hoodId, self.handlerArgs = {'hoodId': hoodId,
'zoneId': zoneId, 'zoneId': zoneId,
'avId': avId} 'avId': avId}
if not self.astronSupport:
self.handler = self.handleTutorialQuestion self.handler = self.handleTutorialQuestion
self.__requestSkipTutorial(hoodId, zoneId, avId) self.__requestSkipTutorial(hoodId, zoneId, avId)
@ -551,6 +552,7 @@ class ToontownClientRepository(OTPClientRepository.OTPClientRepository):
return return
def enterTutorialQuestion(self, hoodId, zoneId, avId): def enterTutorialQuestion(self, hoodId, zoneId, avId):
if not self.astronSupport:
self.handler = self.handleTutorialQuestion self.handler = self.handleTutorialQuestion
self.__requestTutorial(hoodId, zoneId, avId) self.__requestTutorial(hoodId, zoneId, avId)

View file

@ -10,9 +10,9 @@ class FishBrowser(DirectScrolledList):
notify = DirectNotifyGlobal.directNotify.newCategory('FishBrowser') notify = DirectNotifyGlobal.directNotify.newCategory('FishBrowser')
def __init__(self, parent = aspect2d, **kw): def __init__(self, parent = aspect2d, **kw):
self.parent = parent self._parent = parent
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
optiondefs = (('parent', self.parent, None), optiondefs = (('parent', self._parent, None),
('relief', None, None), ('relief', None, None),
('incButton_image', (gui.find('**/FndsLst_ScrollUp'), ('incButton_image', (gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'), gui.find('**/FndsLst_ScrollDN'),
@ -43,14 +43,14 @@ class FishBrowser(DirectScrolledList):
def destroy(self): def destroy(self):
DirectScrolledList.destroy(self) DirectScrolledList.destroy(self)
self.parent = None self._parent = None
return return
def update(self): def update(self):
pass pass
def show(self): def show(self):
if not self.parent.isHidden(): if not self._parent.isHidden():
self['items'][self.index].show() self['items'][self.index].show()
DirectScrolledList.show(self) DirectScrolledList.show(self)

View file

@ -27,7 +27,7 @@ class FishPanel(DirectFrame):
self.initialiseoptions(FishPanel) self.initialiseoptions(FishPanel)
self.doneEvent = doneEvent self.doneEvent = doneEvent
self.fish = fish self.fish = fish
self.parent = parent self._parent = parent
self.photo = None self.photo = None
return return
@ -37,7 +37,7 @@ class FishPanel(DirectFrame):
self.photo = None self.photo = None
self.fish = None self.fish = None
DirectFrame.destroy(self) DirectFrame.destroy(self)
self.parent = None self._parent = None
return return
def load(self): def load(self):

View file

@ -10,10 +10,10 @@ class FishPicker(DirectScrolledList):
def __init__(self, parent = aspect2d, **kw): def __init__(self, parent = aspect2d, **kw):
self.fishList = [] self.fishList = []
self.parent = parent self._parent = parent
self.shown = 0 self.shown = 0
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
optiondefs = (('parent', self.parent, None), optiondefs = (('parent', self._parent, None),
('relief', None, None), ('relief', None, None),
('incButton_image', (gui.find('**/FndsLst_ScrollUp'), ('incButton_image', (gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'), gui.find('**/FndsLst_ScrollDN'),
@ -58,7 +58,7 @@ class FishPicker(DirectScrolledList):
def destroy(self): def destroy(self):
DirectScrolledList.destroy(self) DirectScrolledList.destroy(self)
self.parent = None self._parent = None
self.fishList = [] self.fishList = []
self.fishPanel = None self.fishPanel = None
return return

View file

@ -103,7 +103,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
newsDirAsFile = vfs.getFile(Filename(newsDir)) newsDirAsFile = vfs.getFile(Filename(newsDir))
fileList = newsDirAsFile.scanDirectory() fileList = newsDirAsFile.scanDirectory()
fileNames = fileList.getFiles() fileNames = fileList.getFiles()
self.notify.debug('filenames=%s' % fileNames) self.notify.debug('filenames=%s' % str(fileNames))
homeFileNames = set([]) homeFileNames = set([])
for name in fileNames: for name in fileNames:
self.notify.debug('processing %s' % name) self.notify.debug('processing %s' % name)

View file

@ -35,7 +35,6 @@ class IssueFrame(DirectFrame):
DirectFrame.__init__(self, frameColor=(1, 1, 1, 0), frameSize=self.FrameDimensions, relief=DGG.FLAT, parent=parent) DirectFrame.__init__(self, frameColor=(1, 1, 1, 0), frameSize=self.FrameDimensions, relief=DGG.FLAT, parent=parent)
self.hide() self.hide()
self.accept('newsSnapshot', self.doSnapshot) self.accept('newsSnapshot', self.doSnapshot)
self.parent = parent
self.newsDir = newsDir self.newsDir = newsDir
self.dateStr = dateStr self.dateStr = dateStr
self.myIssueIndex = myIssueIndex self.myIssueIndex = myIssueIndex

View file

@ -1,6 +1,7 @@
import ShtikerPage import ShtikerPage
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from direct.showbase import PythonUtil from direct.showbase import PythonUtil
from otp.otpbase import PythonUtil as OTPPythonUtil
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
from direct.gui.DirectGui import * from direct.gui.DirectGui import *
from pandac.PandaModules import * from pandac.PandaModules import *
@ -239,7 +240,7 @@ class MapPage(ShtikerPage.ShtikerPage):
messenger.send(self.doneEvent) messenger.send(self.doneEvent)
def __hoverCallback(self, inside, hoodIndex, pos): def __hoverCallback(self, inside, hoodIndex, pos):
alpha = PythonUtil.choice(inside, 0.25, 1.0) alpha = OTPPythonUtil.choice(inside, 0.25, 1.0)
try: try:
clouds = self.clouds[hoodIndex] clouds = self.clouds[hoodIndex]
except ValueError: except ValueError:

View file

@ -128,12 +128,14 @@ class OptionsTabPage(DirectFrame):
'DirectX8': Settings.DX8} 'DirectX8': Settings.DX8}
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self._parent = parent
self.currentSizeIndex = None self.currentSizeIndex = None
DirectFrame.__init__(self, parent=parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0)) DirectFrame.__init__(self, parent=self._parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
self.load() self.load()
return return
def destroy(self): def destroy(self):
self._parent = None
DirectFrame.destroy(self) DirectFrame.destroy(self)
return return
@ -206,7 +208,7 @@ class OptionsTabPage(DirectFrame):
self.speedChatStyleText.enter() self.speedChatStyleText.enter()
self.speedChatStyleIndex = base.localAvatar.getSpeedChatStyleIndex() self.speedChatStyleIndex = base.localAvatar.getSpeedChatStyleIndex()
self.updateSpeedChatStyle() self.updateSpeedChatStyle()
if self.parent.book.safeMode: if self._parent.book.safeMode:
self.exitButton.hide() self.exitButton.hide()
else: else:
self.exitButton.show() self.exitButton.show()
@ -453,7 +455,7 @@ class OptionsTabPage(DirectFrame):
def __handleExitShowWithConfirm(self): def __handleExitShowWithConfirm(self):
self.confirm = TTDialog.TTGlobalDialog(doneEvent='confirmDone', message=TTLocalizer.OptionsPageExitConfirm, style=TTDialog.TwoChoice) self.confirm = TTDialog.TTGlobalDialog(doneEvent='confirmDone', message=TTLocalizer.OptionsPageExitConfirm, style=TTDialog.TwoChoice)
self.confirm.show() self.confirm.show()
self.parent.doneStatus = {'mode': 'exit', self._parent.doneStatus = {'mode': 'exit',
'exitTo': 'closeShard'} 'exitTo': 'closeShard'}
self.accept('confirmDone', self.__handleConfirm) self.accept('confirmDone', self.__handleConfirm)
@ -464,18 +466,20 @@ class OptionsTabPage(DirectFrame):
del self.confirm del self.confirm
if status == 'ok': if status == 'ok':
base.cr._userLoggingOut = True base.cr._userLoggingOut = True
messenger.send(self.parent.doneEvent) messenger.send(self._parent.doneEvent)
class CodesTabPage(DirectFrame): class CodesTabPage(DirectFrame):
notify = DirectNotifyGlobal.directNotify.newCategory('CodesTabPage') notify = DirectNotifyGlobal.directNotify.newCategory('CodesTabPage')
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
DirectFrame.__init__(self, parent=parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0)) self._parent = parent
DirectFrame.__init__(self, parent=self._parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
self.load() self.load()
return return
def destroy(self): def destroy(self):
self._parent = None
DirectFrame.destroy(self) DirectFrame.destroy(self)
return return

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp import *
from toontown.toonbase.ToontownGlobals import * from toontown.toonbase.ToontownGlobals import *
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import * from pandac.PandaModules import *
from libotp 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 *