def findNewsDir(self): """Returns the directory string for news content. Returns None if it cant find the directory """ if self.NewsOverHttp: # If we're running news-over-http, we dump the news into a # staging directory. return self.NewsStageDir searchPath = DSearchPath() if AppRunnerGlobal.appRunner: # In the web-publish runtime, it will always be here: searchPath.appendDirectory( Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/models/news')) else: # In the launcher or dev environment, look here: basePath = os.path.expandvars('$TTMODELS') or './ttmodels' searchPath.appendDirectory( Filename.fromOsSpecific(basePath + '/built/' + self.NewsBaseDir)) searchPath.appendDirectory(Filename(self.NewsBaseDir)) pfile = Filename(self.NewsIndexFilename) found = vfs.resolveFilename(pfile, searchPath) if not found: self.notify.warning('findNewsDir - no path: %s' % self.NewsIndexFilename) self.setErrorMessage(TTLocalizer.NewsPageErrorDownloadingFile % self.NewsIndexFilename) return None self.notify.debug("found index file %s" % pfile) realDir = pfile.getDirname() return realDir
def cogExists(filePrefix): searchPath = DSearchPath() if AppRunnerGlobal.appRunner: searchPath.appendDirectory( Filename.expandFrom('$TT_3_5_ROOT/phase_3.5')) else: basePath = os.path.expandvars("$TTMODELS") or "./ttmodels" searchPath.appendDirectory( Filename.fromOsSpecific(basePath + "/built/phase_3.5")) filePrefix = filePrefix.strip("/") pfile = Filename(filePrefix) found = vfs.resolveFilename(pfile, searchPath) if not found: return False return True
import os import sys # Initialize ihooks importer On the production servers, we run genPyCode -n # meaning no squeeze, so nobody else does this. When we squeeze, the # unpacker does this for us and it does not hurt to do in either case. import ihooks ihooks.install() if os.getenv('TTMODELS'): from toontown.toonbase.ToontownModules import getModelPath, Filename # In the publish environment, TTMODELS won't be on the model # path by default, so we always add it there. In the dev # environment, it'll be on the model path already, but it # doesn't hurt to add it again. getModelPath().appendDirectory(Filename.expandFrom("$TTMODELS/built")) from direct.showbase.PythonUtil import * from otp.uberdog.UberDogGlobal import * from toontown.coderedemption import TTCodeRedemptionConsts from toontown.uberdog.ToontownUberDog import ToontownUberDog from toontown.uberdog import PartiesUdConfig print( "Initializing the Toontown UberDog (Uber Distributed Object Globals server)..." ) uber.mdip = uber.config.GetString("msg-director-ip", "localhost") uber.mdport = uber.config.GetInt("msg-director-port", 6666) uber.esip = uber.config.GetString("event-server-ip", "localhost")