Exemple #1
0
 def __init__(self, windowType = None):
     self.wantEnviroDR = False
     ShowBase.__init__(self, windowType=windowType)
     self.settings = Settings(config.GetString('preferences-filename', 'preferences.gz'))
     if config.GetBool('want-phase-checker', 0):
         from direct.showbase import Loader
         Loader.phaseChecker = self.loaderPhaseChecker
         self.errorAccumulatorBuffer = ''
         taskMgr.add(self.delayedErrorCheck, 'delayedErrorCheck', priority=10000)
     self.idTags = config.GetBool('want-id-tags', 0)
     if not self.idTags:
         del self.idTags
     self.wantNametags = self.config.GetBool('want-nametags', 1)
     self.slowCloseShard = self.config.GetBool('slow-close-shard', 0)
     self.slowCloseShardDelay = self.config.GetFloat('slow-close-shard-delay', 10.0)
     self.fillShardsToIdealPop = self.config.GetBool('fill-shards-to-ideal-pop', 1)
     self.logPrivateInfo = self.config.GetBool('log-private-info', __dev__)
     self.wantDynamicShadows = 1
     self.stereoEnabled = False
     self.enviroDR = None
     self.enviroCam = None
     self.pixelZoomSetup = False
     self.gameOptionsCode = ''
     self.locationCode = ''
     self.locationCodeChanged = time.time()
     if base.cam:
         if self.wantEnviroDR:
             base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
         else:
             base.cam.node().setCameraMask(OTPRender.MainCameraBitmask | OTPRender.EnviroCameraBitmask)
     taskMgr.setupTaskChain('net')
     return
Exemple #2
0
 def __init__(self):
     self.settings = Settings('config/server.json')
Exemple #3
0
class ServerSettings:
    notify = DirectNotifyGlobal.directNotify.newCategory('ServerSettings')
    notify.setInfo(True)

    def __init__(self):
        self.settings = Settings('config/server.json')

    def loadFromSettings(self):
        self.notify.info('Loading settings...')
        self.uberDogBaseChannel = 1000000
        uberDogMaxChannels = self.settings.getInt('uberdog', 'max-channels',
                                                  999999)
        self.settings.updateSetting('uberdog', 'max-channels',
                                    uberDogMaxChannels)
        self.uberDogMaxChannels = uberDogMaxChannels
        uberDogStateServer = self.settings.getInt('uberdog', 'stateserver',
                                                  4002)
        self.settings.updateSetting('uberdog', 'stateserver',
                                    uberDogStateServer)
        self.uberDogStateServer = uberDogStateServer
        uberDogAstronIP = self.settings.getString('uberdog', 'astron-ip',
                                                  '127.0.0.1:7199')
        self.settings.updateSetting('uberdog', 'astron-ip', uberDogAstronIP)
        self.uberDogAstronIP = uberDogAstronIP
        uberDogEventLoggerIP = self.settings.getString('uberdog',
                                                       'eventlogger-ip',
                                                       '127.0.0.1:7197')
        self.settings.updateSetting('uberdog', 'eventlogger-ip',
                                    uberDogEventLoggerIP)
        self.uberDogEventLoggerIP = uberDogEventLoggerIP
        self.uberDogExpectedBuiltin = ''
        self.uberDogExpectedLocals = []
        uberDogConfigs = self.settings.getList(
            'uberdog', 'configs', ['config/general.prc', 'config/prod.prc'])
        self.settings.updateSetting('uberdog', 'configs', uberDogConfigs)
        self.uberDogConfigs = uberDogConfigs
        uberDogServerPassword = self.settings.getString(
            'uberdog', 'server-password', '')
        self.settings.updateSetting('uberdog', 'server-password',
                                    uberDogServerPassword)
        self.uberDogServerPassword = uberDogServerPassword
        uberDogWhitelistedUsernames = self.settings.getList(
            'uberdog', 'whitelisted-usernames', [], -1)
        self.settings.updateSetting('uberdog', 'whitelisted-usernames',
                                    uberDogWhitelistedUsernames)
        self.uberDogWhitelistedUsernames = uberDogWhitelistedUsernames
        uberDogDefaultAccessLevel = self.settings.getString(
            'uberdog', 'default-access-level', 'USER')
        self.settings.updateSetting('uberdog', 'default-access-level',
                                    uberDogDefaultAccessLevel)
        self.uberDogDefaultAccessLevel = uberDogDefaultAccessLevel
        self.aiBaseChannel = 401000000
        aiMaxChannels = self.settings.getInt('ai', 'max-channels', 999999)
        self.settings.updateSetting('ai', 'max-channels', aiMaxChannels)
        self.aiMaxChannels = aiMaxChannels
        aiStateServer = self.settings.getInt('ai', 'stateserver', 4002)
        self.settings.updateSetting('ai', 'stateserver', aiStateServer)
        self.aiStateServer = aiStateServer
        aiDistrictName = self.settings.getString('ai', 'district-name',
                                                 'Toon Valley')
        self.settings.updateSetting('ai', 'district-name', aiDistrictName)
        self.aiDistrictName = aiDistrictName
        aiAstronIP = self.settings.getString('ai', 'astron-ip',
                                             '127.0.0.1:7199')
        self.settings.updateSetting('ai', 'astron-ip', aiAstronIP)
        self.aiAstronIP = aiAstronIP
        aiEventLoggerIP = self.settings.getString('ai', 'eventlogger-ip',
                                                  '127.0.0.1:7197')
        self.settings.updateSetting('ai', 'eventlogger-ip', aiEventLoggerIP)
        self.aiEventLoggerIP = aiEventLoggerIP
        aiConfigs = self.settings.getList(
            'ai', 'configs', ['config/general.prc', 'config/prod.prc'])
        self.settings.updateSetting('ai', 'configs', aiConfigs)
        self.aiConfigs = aiConfigs
        expMultiplier = self.settings.getFloat('ai', 'exp-multiplier', 1.0)
        self.settings.updateSetting('ai', 'exp-multiplier', expMultiplier)
        self.expMultiplier = expMultiplier
        meritMultiplier = self.settings.getFloat('ai', 'merit-multiplier', 1.0)
        self.settings.updateSetting('ai', 'merit-multiplier', meritMultiplier)
        self.meritMultiplier = meritMultiplier
        doodleMultiplier = self.settings.getFloat('ai', 'doodle-multiplier',
                                                  1.0)
        self.settings.updateSetting('ai', 'doodle-multiplier',
                                    doodleMultiplier)
        self.doodleMultiplier = doodleMultiplier
        defaultMaxToon = self.settings.getBool('ai', 'default-max-toon', False)
        self.settings.updateSetting('ai', 'default-max-toon', defaultMaxToon)
        self.defaultMaxToon = defaultMaxToon
        defaultZone = self.settings.getString('ai', 'default-zone', 'TTC')
        self.settings.updateSetting('ai', 'default-zone', defaultZone)
        self.defaultZone = defaultZone
        aiDistrictLimit = self.settings.getInt('ai', 'district-limit', 16)
        self.settings.updateSetting('ai', 'district-limit', aiDistrictLimit)
        self.aiDistrictLimit = aiDistrictLimit
        aiDistrictDescription = self.settings.getString(
            'ai', 'district-description', 'A Toontown Offline Mini-Server.')
        self.settings.updateSetting('ai', 'district-description',
                                    aiDistrictDescription)
        self.aiDistrictDescription = aiDistrictDescription
        aiDistrictId = self.settings.getString('ai', 'district-id', '')
        self.settings.updateSetting('ai', 'district-id', aiDistrictId)
        self.aiDistrictId = aiDistrictId
        aiEventId = self.settings.getString('ai', 'event-id', '')
        self.settings.updateSetting('ai', 'event-id', aiEventId)
        self.aiEventId = aiEventId
        self.notify.info('Loaded.')
Exemple #4
0
if __debug__:
    loadPrcFile('config/general.prc')
    loadPrcFile('config/release/dev.prc')

from direct.directnotify.DirectNotifyGlobal import directNotify

notify = directNotify.newCategory('ClientStart')
notify.setInfo(True)

from otp.settings.Settings import Settings

preferencesFilename = ConfigVariableString('preferences-filename',
                                           'preferences.json').getValue()
notify.info('Reading %s...' % preferencesFilename)
__builtin__.settings = Settings(preferencesFilename)
if 'fullscreen' not in settings:
    settings['fullscreen'] = False
if 'music' not in settings:
    settings['music'] = True
if 'sfx' not in settings:
    settings['sfx'] = True
if 'musicVol' not in settings:
    settings['musicVol'] = 1.0
if 'sfxVol' not in settings:
    settings['sfxVol'] = 1.0
if 'loadDisplay' not in settings:
    settings['loadDisplay'] = 'pandagl'
if 'toonChatSounds' not in settings:
    settings['toonChatSounds'] = True
loadPrcFileData('Settings: res',
from pandac.PandaModules import *
import __builtin__

if __debug__:
    loadPrcFile('config/config_dev.prc')

from otp.settings.Settings import Settings

preferencesFilename = ConfigVariableString('preferences-filename',
                                           'preferences.gz').getValue()
print 'ToontownStart: Reading {0}...'.format(preferencesFilename)
settings = Settings(preferencesFilename)
res = settings.get('res', (800, 600))
fullscreen = settings.get('fullscreen', False)
if 'fullscreen' not in settings.all():
    settings.set('fullscreen', fullscreen)
music = settings.get('music', True)
if 'music' not in settings.all():
    settings.set('music', music)
sfx = settings.get('sfx', True)
if 'sfx' not in settings.all():
    settings.set('sfx', sfx)
toonChatSounds = settings.get('toonChatSounds', True)
if 'toonChatSounds' not in settings.all():
    settings.set('toonChatSounds', toonChatSounds)
musicVol = settings.get('musicVol', 1.0)
if 'musicVol' not in settings.all():
    settings.set('musicVol', musicVol)
sfxVol = settings.get('sfxVol', 1.0)
if 'sfxVol' not in settings.all():
    settings.set('sfxVol', sfxVol)
from pandac.PandaModules import *
import __builtin__

if __debug__:
    loadPrcFile('config/config_dev.prc')

from otp.settings.Settings import Settings
preferencesFilename = ConfigVariableString('preferences-filename', 'preferences.gz').getValue()
print 'ToontownStart: Reading {0}...'.format(preferencesFilename)
settings = Settings(preferencesFilename)
res = settings.get('res', (800, 600))
fullscreen = settings.get('fullscreen', False)
if 'fullscreen' not in settings.all():
    settings.set('fullscreen', fullscreen)
music = settings.get('music', True)
if 'music' not in settings.all():
    settings.set('music', music)
sfx = settings.get('sfx', True)
if 'sfx' not in settings.all():
    settings.set('sfx', sfx)
toonChatSounds = settings.get('toonChatSounds', True)
if 'toonChatSounds' not in settings.all():
    settings.set('toonChatSounds', toonChatSounds)
musicVol = settings.get('musicVol', 1.0)
if 'musicVol' not in settings.all():
    settings.set('musicVol', musicVol)
sfxVol = settings.get('sfxVol', 1.0)
if 'sfxVol' not in settings.all():
    settings.set('sfxVol', sfxVol)
loadDisplay = settings.get('loadDisplay', 'pandagl')
if 'loadDisplay' not in settings.all():
Exemple #7
0
from direct.extensions_native import VBase3_extensions
from direct.extensions_native import VBase4_extensions
from direct.extensions_native import NodePath_extensions
from panda3d.core import loadPrcFile
import sys
from panda3d.core import *
import glob
from direct.directnotify.DirectNotifyGlobal import directNotify
from otp.settings.Settings import Settings
loadPrcFile('config/general.prc')
notify = directNotify.newCategory('AltisClient')
notify.setInfo(True)
preferencesFilename = ConfigVariableString('preferences-filename',
                                           'user/settings.json').getValue()
notify.info('Reading %s...' % preferencesFilename)
__builtin__.settings = Settings()
from toontown.settings import ToontownSettings
__builtin__.ttsettings = ToontownSettings
for setting in ttsettings.DefaultSettings:
    if setting not in settings:
        settings[setting] = ttsettings.DefaultSettings[setting]

loadPrcFileData('Settings: res',
                'win-size %d %d' % tuple(settings.get('res', (1280, 720))))
loadPrcFileData('Settings: fullscreen',
                'fullscreen %s' % settings['fullscreen'])
loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music'])
loadPrcFileData('Settings: sfx', 'audio-sfx-active %s' % settings['sfx'])
loadPrcFileData('Settings: musicVol',
                'audio-master-music-volume %s' % settings['musicVol'])
loadPrcFileData('Settings: sfxVol',