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):
self.words = []
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.numWords = len(self.words)

View file

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

View file

@ -607,7 +607,7 @@ class LoadAvatarOperation(AvatarOperation):
cleanupDatagram.addUint32(self.avId)
datagram = PyDatagram()
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.sendActivate(self.avId, 0, 0, self.loginManager.air.dclassesByName['DistributedToonUD'])

View file

@ -28,7 +28,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
if not found:
self.notify.info("Couldn't find whitelist data file!")
data = vfs.readFile(filename, 1)
lines = data.split('\n')
lines = data.split(b'\n')
WhiteList.__init__(self, lines)
self.redownloadWhitelist()
self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
@ -145,10 +145,10 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
if not localFilename.exists():
return
data = vfs.readFile(localFilename, 1)
lines = data.split('\n')
lines = data.split(b'\n')
self.words = []
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.numWords = len(self.words)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,6 +27,7 @@ from toontown.distributed import DelayDelete
from . import AccessoryGlobals
import types
import importlib
import functools
def teleportDebug(requestStatus, msg, onlyIfToAv = True):
if teleportNotify.getDebug():
@ -1296,7 +1297,7 @@ class Toon(Avatar.Avatar, ToonHead):
nodePathList.append((node, offset))
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 self.randGen.random() < 0.9:
chosenNodePath = nodePathList[0]