general: loads to playground

This commit is contained in:
John Cote 2019-12-30 19:17:24 -05:00
parent 7200c5bbcd
commit 28da462e52
10 changed files with 16 additions and 15 deletions

View file

@ -8,7 +8,7 @@ class WhiteList:
def __init__(self, wordlist): def __init__(self, wordlist):
self.words = [] self.words = []
for line in wordlist: for line in wordlist:
self.words.append(line.strip('\n\r').lower()) self.words.append(line.strip(b'\n\r').lower())
self.words.sort() self.words.sort()
self.numWords = len(self.words) self.numWords = len(self.words)

View file

@ -4,7 +4,7 @@ class TelemetryLimited:
Sng = SerialNumGen() Sng = SerialNumGen()
def __init__(self): def __init__(self):
self._telemetryLimiterId = next(self.Sng) self._telemetryLimiterId = self.Sng.next()
self._limits = set() self._limits = set()
def getTelemetryLimiterId(self): def getTelemetryLimiterId(self):

View file

@ -607,7 +607,7 @@ class LoadAvatarOperation(AvatarOperation):
cleanupDatagram.addUint32(self.avId) cleanupDatagram.addUint32(self.avId)
datagram = PyDatagram() datagram = PyDatagram()
datagram.addServerHeader(channel, self.loginManager.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE) datagram.addServerHeader(channel, self.loginManager.air.ourChannel, CLIENTAGENT_ADD_POST_REMOVE)
datagram.addString(cleanupDatagram.getMessage()) datagram.appendData(cleanupDatagram.getMessage())
self.loginManager.air.send(datagram) self.loginManager.air.send(datagram)
self.loginManager.air.sendActivate(self.avId, 0, 0, self.loginManager.air.dclassesByName['DistributedToonUD']) self.loginManager.air.sendActivate(self.avId, 0, 0, self.loginManager.air.dclassesByName['DistributedToonUD'])

View file

@ -28,7 +28,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
if not found: if not found:
self.notify.info("Couldn't find whitelist data file!") self.notify.info("Couldn't find whitelist data file!")
data = vfs.readFile(filename, 1) data = vfs.readFile(filename, 1)
lines = data.split('\n') lines = data.split(b'\n')
WhiteList.__init__(self, lines) WhiteList.__init__(self, lines)
self.redownloadWhitelist() self.redownloadWhitelist()
self.defaultWord = TTLocalizer.ChatGarblerDefault[0] self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
@ -145,10 +145,10 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
if not localFilename.exists(): if not localFilename.exists():
return return
data = vfs.readFile(localFilename, 1) data = vfs.readFile(localFilename, 1)
lines = data.split('\n') lines = data.split(b'\n')
self.words = [] self.words = []
for line in lines: for line in lines:
self.words.append(line.strip('\n\r').lower()) self.words.append(line.strip(b'\n\r').lower())
self.words.sort() self.words.sort()
self.numWords = len(self.words) self.numWords = len(self.words)

View file

@ -2,7 +2,6 @@ from pandac.PandaModules import *
from direct.showbase import DirectObject from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from toontown.launcher import DownloadForceAcknowledge from toontown.launcher import DownloadForceAcknowledge
import string
import random import random
from toontown.toonbase import ToontownGlobals from toontown.toonbase import ToontownGlobals
from toontown.hood import ZoneUtil from toontown.hood import ZoneUtil
@ -926,7 +925,7 @@ class HoodMgr(DirectObject.DirectObject):
return tunnelOriginList return tunnelOriginList
def extractGroupName(self, groupFullName): def extractGroupName(self, groupFullName):
return string.split(groupFullName, ':', 1)[0] return groupFullName.split(':', 1)[0]
def makeLinkTunnelName(self, hoodId, currentZone): def makeLinkTunnelName(self, hoodId, currentZone):
return '**/toph_' + self.getNameFromId(hoodId) + '_' + str(currentZone) return '**/toph_' + self.getNameFromId(hoodId) + '_' + str(currentZone)

View file

@ -1,4 +1,5 @@
import datetime import datetime
import functools
import time import time
from pandac.PandaModules import TextNode, Vec3, Vec4, PlaneNode, Plane, Point3 from pandac.PandaModules import TextNode, Vec3, Vec4, PlaneNode, Plane, Point3
from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG from direct.gui.DirectGui import DirectFrame, DirectLabel, DirectButton, DirectScrolledList, DGG
@ -287,7 +288,7 @@ class CalendarGuiDay(DirectFrame):
else: else:
return 1 return 1
self.timedEvents.sort(cmp=timedEventCompare) self.timedEvents.sort(key=functools.cmp_to_key(timedEventCompare))
for timedEvent in self.timedEvents: for timedEvent in self.timedEvents:
if isinstance(timedEvent[1], PartyInfo): if isinstance(timedEvent[1], PartyInfo):
self.addPartyToScrollList(timedEvent[1]) self.addPartyToScrollList(timedEvent[1])

View file

@ -273,7 +273,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
return self.downloadNextFile(task) return self.downloadNextFile(task)
def downloadNextFile(self, task): def downloadNextFile(self, task):
while self.nextNewsFile < len(self.newsFiles) and 'aaver' in self.newsFiles[self.nextNewsFile]: while self.nextNewsFile < len(self.newsFiles) and b'aaver' in self.newsFiles[self.nextNewsFile]:
self.nextNewsFile += 1 self.nextNewsFile += 1
if self.nextNewsFile >= len(self.newsFiles): if self.nextNewsFile >= len(self.newsFiles):
@ -294,7 +294,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
self.percentDownloaded = float(self.nextNewsFile) / float(len(self.newsFiles)) self.percentDownloaded = float(self.nextNewsFile) / float(len(self.newsFiles))
self.filename = self.newsFiles[self.nextNewsFile] self.filename = self.newsFiles[self.nextNewsFile]
self.nextNewsFile += 1 self.nextNewsFile += 1
self.url = self.newsUrl + self.filename self.url = self.newsUrl + self.filename.decode('utf-8')
localFilename = Filename(self.newsDir, self.filename) localFilename = Filename(self.newsDir, self.filename)
self.notify.info('testing for %s' % localFilename.getFullpath()) self.notify.info('testing for %s' % localFilename.getFullpath())
doc = DocumentSpec(self.url) doc = DocumentSpec(self.url)
@ -322,7 +322,7 @@ class DirectNewsFrame(DirectObject.DirectObject):
del self.newsCache[self.filename] del self.newsCache[self.filename]
self.saveNewsCache() self.saveNewsCache()
return self.downloadNextFile(task) return self.downloadNextFile(task)
self.notify.info('downloaded %s' % self.filename) self.notify.info('downloaded %s' % self.filename.decode('utf-8'))
size = self.ch.getFileSize() size = self.ch.getFileSize()
doc = self.ch.getDocumentSpec() doc = self.ch.getDocumentSpec()
date = '' date = ''

View file

@ -110,7 +110,7 @@ class TrackPage(ShtikerPage.ShtikerPage):
for index in range(1, MAX_FRAMES + 1): for index in range(1, MAX_FRAMES + 1):
frame = self.trackFrames[index - 1] frame = self.trackFrames[index - 1]
col = (index - 1) % 6 col = (index - 1) % 6
row = (index - 1) / 6 row = int((index - 1) / 6)
frame.setPos(colPos[col], 0, rowPos[row]) frame.setPos(colPos[col], 0, rowPos[row])
frame.setScale(0.39) frame.setScale(0.39)

View file

@ -2348,7 +2348,7 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
nextTime = nextGiftTime nextTime = nextGiftTime
if nextGiftTime == None: if nextGiftTime == None:
nextGiftTime = nextTime nextGiftTime = nextTime
if nextGiftTime < nextTime: if nextGiftTime is not None and nextTime is not None and nextGiftTime < nextTime:
nextTime = nextGiftTime nextTime = nextGiftTime
existingDuration = None existingDuration = None
checkTaskList = taskMgr.getTasksNamed(taskName) checkTaskList = taskMgr.getTasksNamed(taskName)

View file

@ -27,6 +27,7 @@ from toontown.distributed import DelayDelete
from . import AccessoryGlobals from . import AccessoryGlobals
import types import types
import importlib import importlib
import functools
def teleportDebug(requestStatus, msg, onlyIfToAv = True): def teleportDebug(requestStatus, msg, onlyIfToAv = True):
if teleportNotify.getDebug(): if teleportNotify.getDebug():
@ -1296,7 +1297,7 @@ class Toon(Avatar.Avatar, ToonHead):
nodePathList.append((node, offset)) nodePathList.append((node, offset))
if nodePathList: if nodePathList:
nodePathList.sort(lambda x, y: cmp(x[0].getDistance(self), y[0].getDistance(self))) nodePathList.sort(key=functools.cmp_to_key(lambda x, y: cmp(x[0].getDistance(self), y[0].getDistance(self))))
if len(nodePathList) >= 2: if len(nodePathList) >= 2:
if self.randGen.random() < 0.9: if self.randGen.random() < 0.9:
chosenNodePath = nodePathList[0] chosenNodePath = nodePathList[0]