general: fix a bunch of crashes
This commit is contained in:
parent
9b6676ebc7
commit
5e0d895680
7 changed files with 26 additions and 25 deletions
|
@ -3,7 +3,6 @@ from libotp import *
|
||||||
from direct.gui.DirectGui import *
|
from direct.gui.DirectGui import *
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.fsm import StateData
|
from direct.fsm import StateData
|
||||||
import string
|
|
||||||
from otp.otpbase import OTPLocalizer
|
from otp.otpbase import OTPLocalizer
|
||||||
from otp.otpbase import OTPGlobals
|
from otp.otpbase import OTPGlobals
|
||||||
from otp.uberdog import RejectCode
|
from otp.uberdog import RejectCode
|
||||||
|
@ -449,7 +448,7 @@ class FriendSecret(DirectFrame, StateData.StateData):
|
||||||
|
|
||||||
def __enterSecret(self, secret):
|
def __enterSecret(self, secret):
|
||||||
self.enterSecret.set('')
|
self.enterSecret.set('')
|
||||||
secret = string.strip(secret)
|
secret = secret.strip()
|
||||||
if not secret:
|
if not secret:
|
||||||
self.exit()
|
self.exit()
|
||||||
return
|
return
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DelayDeletable:
|
||||||
self.notify.error('cannot acquire DelayDelete "%s" on %s because it is in state %s' % (name, self.__class__.__name__, ESNum2Str[self.activeState]))
|
self.notify.error('cannot acquire DelayDelete "%s" on %s because it is in state %s' % (name, self.__class__.__name__, ESNum2Str[self.activeState]))
|
||||||
if self.getDelayDeleteCount() == 0:
|
if self.getDelayDeleteCount() == 0:
|
||||||
self.cr._addDelayDeletedDO(self)
|
self.cr._addDelayDeletedDO(self)
|
||||||
token = next(DelayDeletable.DelayDeleteSerialGen)
|
token = DelayDeletable.DelayDeleteSerialGen.next()
|
||||||
self._token2delayDeleteName[token] = name
|
self._token2delayDeleteName[token] = name
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from toontown.friends import ToontownFriendSecret
|
||||||
from toontown.toonbase import ToontownGlobals
|
from toontown.toonbase import ToontownGlobals
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
from otp.otpbase import OTPGlobals
|
from otp.otpbase import OTPGlobals
|
||||||
|
import functools
|
||||||
FLPPets = 1
|
FLPPets = 1
|
||||||
FLPOnline = 2
|
FLPOnline = 2
|
||||||
FLPAll = 3
|
FLPAll = 3
|
||||||
|
@ -574,13 +575,13 @@ class FriendsListPanel(DirectFrame, StateData.StateData):
|
||||||
friendButton.destroy()
|
friendButton.destroy()
|
||||||
del self.friends[friendPair]
|
del self.friends[friendPair]
|
||||||
|
|
||||||
newFriends.sort(compareFriends)
|
newFriends.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
petFriends.sort(compareFriends)
|
petFriends.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
freeChatOneRef.sort(compareFriends)
|
freeChatOneRef.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
speedChatOneRef.sort(compareFriends)
|
speedChatOneRef.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
freeChatDouble.sort(compareFriends)
|
freeChatDouble.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
speedChatDouble.sort(compareFriends)
|
speedChatDouble.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
offlineFriends.sort(compareFriends)
|
offlineFriends.sort(key=functools.cmp_to_key(compareFriends))
|
||||||
for friendPair in newFriends:
|
for friendPair in newFriends:
|
||||||
if friendPair not in self.friends:
|
if friendPair not in self.friends:
|
||||||
friendButton = self.makeFriendButton(friendPair)
|
friendButton = self.makeFriendButton(friendPair)
|
||||||
|
|
|
@ -5,7 +5,7 @@ from toontown.battle import SuitBattleGlobals
|
||||||
from toontown.coghq import CogDisguiseGlobals
|
from toontown.coghq import CogDisguiseGlobals
|
||||||
import random
|
import random
|
||||||
from toontown.toon import NPCToons
|
from toontown.toon import NPCToons
|
||||||
import copy, string
|
import copy
|
||||||
from toontown.hood import ZoneUtil
|
from toontown.hood import ZoneUtil
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from toontown.toonbase import TTLocalizer
|
from toontown.toonbase import TTLocalizer
|
||||||
|
@ -18164,7 +18164,7 @@ def getNpcLocationDialog(fromNpcId, toNpcId):
|
||||||
def fillInQuestNames(text, avName = None, fromNpcId = None, toNpcId = None):
|
def fillInQuestNames(text, avName = None, fromNpcId = None, toNpcId = None):
|
||||||
text = copy.deepcopy(text)
|
text = copy.deepcopy(text)
|
||||||
if avName != None:
|
if avName != None:
|
||||||
text = string.replace(text, '_avName_', avName)
|
text = text.replace('_avName_', avName)
|
||||||
if toNpcId:
|
if toNpcId:
|
||||||
if toNpcId == ToonHQ:
|
if toNpcId == ToonHQ:
|
||||||
toNpcName = TTLocalizer.QuestsHQOfficerFillin
|
toNpcName = TTLocalizer.QuestsHQOfficerFillin
|
||||||
|
@ -18179,10 +18179,10 @@ def fillInQuestNames(text, avName = None, fromNpcId = None, toNpcId = None):
|
||||||
else:
|
else:
|
||||||
toNpcName = str(NPCToons.getNPCName(toNpcId))
|
toNpcName = str(NPCToons.getNPCName(toNpcId))
|
||||||
where, buildingName, streetDesc = getNpcLocationDialog(fromNpcId, toNpcId)
|
where, buildingName, streetDesc = getNpcLocationDialog(fromNpcId, toNpcId)
|
||||||
text = string.replace(text, '_toNpcName_', toNpcName)
|
text = text.replace('_toNpcName_', toNpcName)
|
||||||
text = string.replace(text, '_where_', where)
|
text = text.replace('_where_', where)
|
||||||
text = string.replace(text, '_buildingName_', buildingName)
|
text = text.replace('_buildingName_', buildingName)
|
||||||
text = string.replace(text, '_streetDesc_', streetDesc)
|
text = text.replace('_streetDesc_', streetDesc)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
|
import functools
|
||||||
from pandac.PandaModules import Filename, DSearchPath, TextNode
|
from pandac.PandaModules import Filename, DSearchPath, TextNode
|
||||||
from pandac.PandaModules import HTTPClient, Ramfile, DocumentSpec
|
from pandac.PandaModules import HTTPClient, Ramfile, DocumentSpec
|
||||||
from direct.showbase import DirectObject
|
from direct.showbase import DirectObject
|
||||||
|
@ -123,7 +124,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
|
||||||
return fileA.getFilename().compareTo(fileB.getFilename())
|
return fileA.getFilename().compareTo(fileB.getFilename())
|
||||||
|
|
||||||
homeFileNames = list(homeFileNames)
|
homeFileNames = list(homeFileNames)
|
||||||
homeFileNames.sort(cmp=fileCmp)
|
homeFileNames.sort(key=functools.cmp_to_key(fileCmp))
|
||||||
self.notify.debug('returned homeFileNames=%s' % homeFileNames)
|
self.notify.debug('returned homeFileNames=%s' % homeFileNames)
|
||||||
return homeFileNames
|
return homeFileNames
|
||||||
|
|
||||||
|
@ -391,8 +392,8 @@ class DirectNewsFrame(DirectObject.DirectObject):
|
||||||
majorVer = 1
|
majorVer = 1
|
||||||
minorVer = 0
|
minorVer = 0
|
||||||
for entry in self.newsIndexEntries:
|
for entry in self.newsIndexEntries:
|
||||||
if 'aaver' in entry and dateStr in entry:
|
if b'aaver' in entry and dateStr.encode('utf-8') in entry:
|
||||||
parts = entry.split('_')
|
parts = entry.split(b'_')
|
||||||
if len(parts) > 5:
|
if len(parts) > 5:
|
||||||
try:
|
try:
|
||||||
majorVer = int(parts[5])
|
majorVer = int(parts[5])
|
||||||
|
|
|
@ -132,7 +132,7 @@ class DistributedNPCSpecialQuestGiver(DistributedNPCToonBase):
|
||||||
return
|
return
|
||||||
if mode == NPCToons.QUEST_MOVIE_REJECT:
|
if mode == NPCToons.QUEST_MOVIE_REJECT:
|
||||||
rejectString = Quests.chooseQuestDialogReject()
|
rejectString = Quests.chooseQuestDialogReject()
|
||||||
rejectString = Quests.fillInQuestNames(rejectString, avName=av.name)
|
rejectString = Quests.fillInQuestNames(rejectString, avName=av._name)
|
||||||
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
||||||
if isLocalToon:
|
if isLocalToon:
|
||||||
base.localAvatar.posCamera(0, 0)
|
base.localAvatar.posCamera(0, 0)
|
||||||
|
@ -140,7 +140,7 @@ class DistributedNPCSpecialQuestGiver(DistributedNPCToonBase):
|
||||||
return
|
return
|
||||||
if mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE:
|
if mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE:
|
||||||
rejectString = Quests.chooseQuestDialogTierNotDone()
|
rejectString = Quests.chooseQuestDialogTierNotDone()
|
||||||
rejectString = Quests.fillInQuestNames(rejectString, avName=av.name)
|
rejectString = Quests.fillInQuestNames(rejectString, avName=av._name)
|
||||||
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
||||||
if isLocalToon:
|
if isLocalToon:
|
||||||
base.localAvatar.posCamera(0, 0)
|
base.localAvatar.posCamera(0, 0)
|
||||||
|
@ -226,7 +226,7 @@ class DistributedNPCSpecialQuestGiver(DistributedNPCToonBase):
|
||||||
self.acceptOnce('chooseTrack', self.sendChooseTrack)
|
self.acceptOnce('chooseTrack', self.sendChooseTrack)
|
||||||
self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(tracks, ChoiceTimeout)
|
self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(tracks, ChoiceTimeout)
|
||||||
return
|
return
|
||||||
fullString = Quests.fillInQuestNames(fullString, avName=av.name, fromNpcId=npcId, toNpcId=toNpcId)
|
fullString = Quests.fillInQuestNames(fullString, avName=av._name, fromNpcId=npcId, toNpcId=toNpcId)
|
||||||
self.acceptOnce(self.uniqueName('doneChatPage'), self.finishMovie, extraArgs=[av, isLocalToon])
|
self.acceptOnce(self.uniqueName('doneChatPage'), self.finishMovie, extraArgs=[av, isLocalToon])
|
||||||
self.clearChat()
|
self.clearChat()
|
||||||
self.setPageChat(avId, 0, fullString, 1)
|
self.setPageChat(avId, 0, fullString, 1)
|
||||||
|
|
|
@ -121,7 +121,7 @@ class DistributedNPCToon(DistributedNPCToonBase):
|
||||||
return
|
return
|
||||||
if mode == NPCToons.QUEST_MOVIE_REJECT:
|
if mode == NPCToons.QUEST_MOVIE_REJECT:
|
||||||
rejectString = Quests.chooseQuestDialogReject()
|
rejectString = Quests.chooseQuestDialogReject()
|
||||||
rejectString = Quests.fillInQuestNames(rejectString, avName=av.name)
|
rejectString = Quests.fillInQuestNames(rejectString, avName=av._name)
|
||||||
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
||||||
if isLocalToon:
|
if isLocalToon:
|
||||||
base.localAvatar.posCamera(0, 0)
|
base.localAvatar.posCamera(0, 0)
|
||||||
|
@ -129,7 +129,7 @@ class DistributedNPCToon(DistributedNPCToonBase):
|
||||||
return
|
return
|
||||||
if mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE:
|
if mode == NPCToons.QUEST_MOVIE_TIER_NOT_DONE:
|
||||||
rejectString = Quests.chooseQuestDialogTierNotDone()
|
rejectString = Quests.chooseQuestDialogTierNotDone()
|
||||||
rejectString = Quests.fillInQuestNames(rejectString, avName=av.name)
|
rejectString = Quests.fillInQuestNames(rejectString, avName=av._name)
|
||||||
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
self.setChatAbsolute(rejectString, CFSpeech | CFTimeout)
|
||||||
if isLocalToon:
|
if isLocalToon:
|
||||||
base.localAvatar.posCamera(0, 0)
|
base.localAvatar.posCamera(0, 0)
|
||||||
|
@ -215,7 +215,7 @@ class DistributedNPCToon(DistributedNPCToonBase):
|
||||||
self.acceptOnce('chooseTrack', self.sendChooseTrack)
|
self.acceptOnce('chooseTrack', self.sendChooseTrack)
|
||||||
self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(tracks, ChoiceTimeout)
|
self.trackChoiceGui = TrackChoiceGui.TrackChoiceGui(tracks, ChoiceTimeout)
|
||||||
return
|
return
|
||||||
fullString = Quests.fillInQuestNames(fullString, avName=av.name, fromNpcId=npcId, toNpcId=toNpcId)
|
fullString = Quests.fillInQuestNames(fullString, avName=av._name, fromNpcId=npcId, toNpcId=toNpcId)
|
||||||
self.acceptOnce(self.uniqueName('doneChatPage'), self.finishMovie, extraArgs=[av, isLocalToon])
|
self.acceptOnce(self.uniqueName('doneChatPage'), self.finishMovie, extraArgs=[av, isLocalToon])
|
||||||
self.clearChat()
|
self.clearChat()
|
||||||
self.setPageChat(avId, 0, fullString, 1)
|
self.setPageChat(avId, 0, fullString, 1)
|
||||||
|
|
Loading…
Reference in a new issue