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

View file

@ -3,3 +3,18 @@ from direct.distributed.DistributedObjectAI import DistributedObjectAI
class NewsManagerAI(DistributedObjectAI):
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.ToontownDistrictAI import ToontownDistrictAI
from toontown.ai.HolidayManagerAI import HolidayManagerAI
from toontown.ai.NewsManagerAI import NewsManagerAI
from toontown.catalog.CatalogManagerAI import CatalogManagerAI
from toontown.uberdog.DistributedInGameNewsMgrAI import DistributedInGameNewsMgrAI
@ -17,6 +18,7 @@ class ToontownAIRepository(ToontownInternalRepository):
self.districtId = None
self.district = None
self.holidayManager = None
self.newsManager = None
self.zoneDataStore = None
self.inGameNewsMgr = None
self.catalogManager = None
@ -59,6 +61,10 @@ class ToontownAIRepository(ToontownInternalRepository):
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...
self.inGameNewsMgr = DistributedInGameNewsMgrAI(self)
self.inGameNewsMgr.generateWithRequired(OTP_ZONE_ID_MANAGEMENT)

View file

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

View file

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

View file

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

View file

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

View file

@ -103,7 +103,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
newsDirAsFile = vfs.getFile(Filename(newsDir))
fileList = newsDirAsFile.scanDirectory()
fileNames = fileList.getFiles()
self.notify.debug('filenames=%s' % fileNames)
self.notify.debug('filenames=%s' % str(fileNames))
homeFileNames = set([])
for name in fileNames:
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)
self.hide()
self.accept('newsSnapshot', self.doSnapshot)
self.parent = parent
self.newsDir = newsDir
self.dateStr = dateStr
self.myIssueIndex = myIssueIndex

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
from pandac.PandaModules import *
from libotp import *
from toontown.battle.BattleProps import *
from toontown.battle.BattleSounds import *
from toontown.distributed.ToontownMsgTypes import *