Exemple #1
0
 def onBecomePlayer(self):
     trace('onBecomePlayer')
     try:
         if config.get('autoReloadConfig', False) == True:
             configwatchdog.startConfigWatchdog()
     except Exception, ex:
         err(traceback.format_exc())
Exemple #2
0
 def onBecomePlayer(self):
     trace('onBecomePlayer')
     try:
         if config.get('autoReloadConfig', False) == True:
             configwatchdog.startConfigWatchdog()
     except Exception, ex:
         err(traceback.format_exc())
Exemple #3
0
 def onAvatarBecomePlayer(self):
     trace('onAvatarBecomePlayer')
     # check version if game restarted after crash or in replay
     if not token.versionChecked:
         token.checkVersion()
         token.initializeXvmToken()
     if config.get('autoReloadConfig', False) == True:
         configwatchdog.startConfigWatchdog()
Exemple #4
0
def load(e):
    global _config
    global config_str
    global lang_str
    global lang_data

    try:
        # TODO: config selection
        filename = e.ctx.get('filename', XVM.CONFIG_FILE)

        configwatchdog.stopConfigWatchdog()

        config_str = None
        lang_str = None
        lang_data = None

        autoreload = get('autoReloadConfig', False)
        _config = _load_xvm_xc(filename, autoreload)

        regionDetected = 'region' not in _config or _config['region'].lower() == XVM.REGION_AUTO_DETECTION
        if regionDetected:
            _config['region'] = GAME_REGION

        languageDetected = 'language' not in _config or _config['language'] == XVM.LOCALE_AUTO_DETECTION
        if languageDetected:
            _config['language'] = GAME_LANGUAGE
        lang_data = _load_locale_file()

        log('Config loaded. Region: {} ({}), Language: {} ({})'.format(
            get('region'),
            'detected' if regionDetected else 'config',
            get('language'),
            'detected' if languageDetected else 'config'))

        config_str = simplejson.dumps(_config)
        lang_str = simplejson.dumps(lang_data)

    except Exception:
        err(traceback.format_exc())

    if get('autoReloadConfig', False) == True:
        configwatchdog.startConfigWatchdog()

    g_eventBus.handleEvent(events.HasCtxEvent(XVM_EVENT.CONFIG_LOADED))
Exemple #5
0
def load(e):
    global config_data
    global lang_data

    try:
        # TODO: config selection
        filename = e.ctx.get('filename', XVM.CONFIG_FILE)

        configwatchdog.stopConfigWatchdog()
        autoreload = get('autoReloadConfig', False)

        config_data = None
        lang_data = None

        config_data = _load_xvm_xc(filename, autoreload)

        regionDetected = 'region' not in config_data or config_data[
            'region'].lower() == XVM.REGION_AUTO_DETECTION
        if regionDetected:
            config_data['region'] = GAME_REGION

        languageDetected = 'language' not in config_data or config_data[
            'language'] == XVM.LOCALE_AUTO_DETECTION
        if languageDetected:
            config_data['language'] = GAME_LANGUAGE
        lang_data = _load_locale_file()

        log('Config loaded. Region: {} ({}), Language: {} ({})'.format(
            get('region'), 'detected' if regionDetected else 'config',
            get('language'), 'detected' if languageDetected else 'config'))

    except Exception:
        err(traceback.format_exc())

    if get('autoReloadConfig', False) == True:
        configwatchdog.startConfigWatchdog()

    g_eventBus.handleEvent(events.HasCtxEvent(XVM_EVENT.CONFIG_LOADED))