From 140f520d6525f09ded3b89183845671ffff7cee9 Mon Sep 17 00:00:00 2001 From: Open Toontown Date: Sun, 10 Nov 2019 21:32:17 -0500 Subject: [PATCH] makeatoon: it loads --- otp/login/AstronLoginManager.py | 4 ++++ otp/login/AstronLoginManagerUD.py | 28 +++++++++++++++++++++++++++- toontown/makeatoon/MakeAToon.py | 2 +- toontown/makeatoon/NameGenerator.py | 10 ++-------- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/otp/login/AstronLoginManager.py b/otp/login/AstronLoginManager.py index 5eac322..447d08e 100644 --- a/otp/login/AstronLoginManager.py +++ b/otp/login/AstronLoginManager.py @@ -15,3 +15,7 @@ class AstronLoginManager(DistributedObjectGlobal): def sendRequestLogin(self, playToken): self.sendUpdate('requestLogin', [playToken]) + + def loginResponse(self, responseBlob): + # TODO HANDLE THIS PROPERLY + messenger.send(self.doneEvent, [{'mode': 'success'}]) diff --git a/otp/login/AstronLoginManagerUD.py b/otp/login/AstronLoginManagerUD.py index 07ce524..dd05b3f 100644 --- a/otp/login/AstronLoginManagerUD.py +++ b/otp/login/AstronLoginManagerUD.py @@ -1,8 +1,34 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectGlobalUD import DistributedObjectGlobalUD +from direct.distributed.PyDatagram import * class AstronLoginManagerUD(DistributedObjectGlobalUD): notify = DirectNotifyGlobal.directNotify.newCategory('AstronLoginManagerUD') def requestLogin(self, playToken): - print playToken + # TODO SET THIS UP PROPERLY. + # AT THE MOMENT EVERYTHING IS HARDCODED + # THIS IS JUST TO GET TO THE PICK A TOON SCREEN + + # get the sender + sender = self.air.getMsgSender() + + # add connection to account channel + datagram = PyDatagram() + datagram.addServerHeader(sender, self.air.ourChannel, CLIENTAGENT_OPEN_CHANNEL) + datagram.addChannel(self.GetAccountConnectionChannel(1000000000)) + self.air.send(datagram) + + # set sender channel to represent account affiliation + datagram = PyDatagram() + datagram.addServerHeader(sender, self.air.ourChannel, CLIENTAGENT_SET_CLIENT_ID) + datagram.addChannel(1000000000 << 32) # accountId is in high 32 bits, 0 in low (no avatar). + self.air.send(datagram) + + # set client state to established, thus un-sandboxing the sender + self.air.setClientState(sender, 2) + + # send dummy login response + import json + a = json.dumps({}) + self.sendUpdateToChannel(sender, 'loginResponse', [a]) diff --git a/toontown/makeatoon/MakeAToon.py b/toontown/makeatoon/MakeAToon.py index 3cb2fa3..daeeb4b 100644 --- a/toontown/makeatoon/MakeAToon.py +++ b/toontown/makeatoon/MakeAToon.py @@ -228,7 +228,7 @@ class MakeAToon(StateData.StateData): self.spotlight.setHpr(0, 0, 0) smokeSeqNode = SequenceNode('smoke') smokeModel = loader.loadModel('phase_3/models/makeatoon/tt_m_ara_mat_smoke') - smokeFrameList = smokeModel.findAllMatches('**/smoke_*').asList() + smokeFrameList = list(smokeModel.findAllMatches('**/smoke_*')) smokeFrameList.reverse() for smokeFrame in smokeFrameList: smokeSeqNode.addChild(smokeFrame.node()) diff --git a/toontown/makeatoon/NameGenerator.py b/toontown/makeatoon/NameGenerator.py index 4b2ad42..07fdad9 100644 --- a/toontown/makeatoon/NameGenerator.py +++ b/toontown/makeatoon/NameGenerator.py @@ -5,7 +5,6 @@ import copy from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer import os -from direct.showbase import AppRunnerGlobal from direct.directnotify import DirectNotifyGlobal class NameGenerator: @@ -37,13 +36,8 @@ class NameGenerator: self.lastSuffixes = [] self.nameDictionary = {} searchPath = DSearchPath() - if AppRunnerGlobal.appRunner: - searchPath.appendDirectory(Filename.expandFrom('$TT_3_ROOT/phase_3/etc')) - else: - searchPath.appendDirectory(Filename('phase_3/etc')) - base = os.path.expandvars('$TOONTOWN') or './toontown' - searchPath.appendDirectory(Filename.fromOsSpecific(os.path.expandvars(base + '/src/configfiles'))) - searchPath.appendDirectory(Filename('.')) + if __debug__: + searchPath.appendDirectory(Filename('resources/phase_3/etc')) filename = Filename(TTLocalizer.NameShopNameMaster) found = vfs.resolveFilename(filename, searchPath) if not found: