Ejemplo n.º 1
0
def _migrateTo36(core, data, initialized):
    from account_helpers.settings_core.ServerSettingsManager import SETTINGS_SECTIONS
    storedValue = _getSettingsCache().getSectionSettings(SETTINGS_SECTIONS.GAMEPLAY, 0)
    currentMask = storedValue & 65535
    import ArenaType
    newMask = currentMask | ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName('ctf30x30'))
    newnewMask = newMask | ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName('domination30x30'))
    data['gameplayData'][GAME.GAMEPLAY_MASK] = newnewMask
Ejemplo n.º 2
0
def _migrateTo38(core, data, initialized):
    from account_helpers.settings_core.ServerSettingsManager import SETTINGS_SECTIONS
    storedValue = _getSettingsCache().getSectionSettings(SETTINGS_SECTIONS.GAMEPLAY, 0)
    currentGameplayMask = storedValue & 65535
    import ArenaType
    epicCtfEnabled = bool(currentGameplayMask & 1 << ArenaType.getGameplayIDForName('ctf30x30'))
    dominationEnabled = bool(currentGameplayMask & 1 << ArenaType.getGameplayIDForName('domination'))
    if not epicCtfEnabled or not dominationEnabled:
        currentGameplayMask &= ~ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName('domination30x30'))
    data['gameplayData'][GAME.GAMEPLAY_MASK] = currentGameplayMask
def _migrateTo38(core, data, initialized):
    from account_helpers.settings_core.ServerSettingsManager import SETTINGS_SECTIONS
    from account_helpers.AccountSettings import AccountSettings
    default = AccountSettings.getSettingsDefault(GAME.GAMEPLAY_MASK)
    storedValue = _getSettingsCache().getSectionSettings(SETTINGS_SECTIONS.GAMEPLAY, default)
    currentGameplayMask = storedValue & 65535
    import ArenaType
    epicCtfEnabled = bool(currentGameplayMask & 1 << ArenaType.getGameplayIDForName('ctf30x30'))
    dominationEnabled = bool(currentGameplayMask & 1 << ArenaType.getGameplayIDForName('domination'))
    if not epicCtfEnabled or not dominationEnabled:
        currentGameplayMask &= ~ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName('domination30x30'))
    data['gameplayData'][GAME.GAMEPLAY_MASK] = currentGameplayMask
    data['gameData'][GAME.MINIMAP_ALPHA] = 0
    data['gameExtData'][GAME.MINIMAP_ALPHA_ENABLED] = False
Ejemplo n.º 4
0
def _migrateTo6(core, data, initialized):
    from account_helpers.settings_core.ServerSettingsManager import SETTINGS_SECTIONS
    storedValue = _getSettingsCache().getSectionSettings(SETTINGS_SECTIONS.GAME, 0)
    maskOffset = 7168
    currentMask = (storedValue & maskOffset) >> 10
    import ArenaType
    newMask = currentMask | ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName('nations'))
    data['gameplayData'][GAME.GAMEPLAY_MASK] = newMask
    clear = data['clear']
    clear[SETTINGS_SECTIONS.GAME] = clear.get(SETTINGS_SECTIONS.GAME, 0) | maskOffset
Ejemplo n.º 5
0
def _migrateTo6(core, data, initialized):
    from account_helpers.settings_core.ServerSettingsManager import SETTINGS_SECTIONS
    storedValue = g_settingsCache.getSectionSettings(SETTINGS_SECTIONS.GAME, 0)
    maskOffset = 7168
    currentMask = (storedValue & maskOffset) >> 10
    import ArenaType
    newMask = currentMask | ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName('nations'))
    data['gameplayData'][GAME.GAMEPLAY_MASK] = newMask
    clear = data['clear']
    clear[SETTINGS_SECTIONS.GAME] = clear.get(SETTINGS_SECTIONS.GAME, 0) | maskOffset
Ejemplo n.º 6
0
 def createTrainingRequest(self):
     settings = EpicTrainingSettingsCtx()
     gameplayID = ArenaType.getGameplayIDForName('epic')
     geometryID = 96
     arenaTypeID = geometryID | gameplayID << 16
     settings.setArenaTypeID(arenaTypeID)
     settings.setRoundLen(190)
     settings.setOpened(True)
     settings._isRequestToCreate = True
     self.fireEvent(events.TrainingSettingsEvent(
         events.TrainingSettingsEvent.UPDATE_EPIC_TRAINING_SETTINGS,
         ctx={'settings': settings}),
                    scope=EVENT_BUS_SCOPE.LOBBY)
Ejemplo n.º 7
0
 def getValue(name):
     return ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName(name))
Ejemplo n.º 8
0
 def getValue(name):
     return ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName(name))
Ejemplo n.º 9
0
    def __getSettings(self):
        settings = [self.graphicsPresets.getGraphicsPresetsData()]
        import VOIP
        rh = VOIP.getVOIPManager()
        g_windowsStoredData.start()
        vManager = VibroManager.g_instance
        vEffGroups = vManager.getGroupsSettings()
        vEffDefGroup = VibroManager.VibroManager.GroupSettings()
        vEffDefGroup.enabled = False
        vEffDefGroup.gain = 0
        markers = {'enemy': g_settingsCore.getSetting('enemy'),
         'dead': g_settingsCore.getSetting('dead'),
         'ally': g_settingsCore.getSetting('ally')}
        config = {'locale': getClientOverride(),
         'aspectRatio': {'current': self.resolutions.aspectRatioIndex,
                         'options': self.resolutions.aspectRatiosList},
         'vertSync': self.resolutions.isVideoVSync,
         'tripleBuffered': self.resolutions.isTripleBuffered,
         'multisampling': {'current': self.resolutions.multisamplingTypeIndex,
                           'options': self.resolutions.multisamplingTypesList},
         'customAA': {'current': self.resolutions.customAAModeIndex,
                      'options': self.resolutions.customAAModesList},
         'gamma': self.resolutions.gamma,
         'masterVolume': round(SoundGroups.g_instance.getMasterVolume() * 100),
         'musicVolume': round(SoundGroups.g_instance.getVolume('music') * 100),
         'voiceVolume': round(SoundGroups.g_instance.getVolume('voice') * 100),
         'vehiclesVolume': round(SoundGroups.g_instance.getVolume('vehicles') * 100),
         'effectsVolume': round(SoundGroups.g_instance.getVolume('effects') * 100),
         'guiVolume': round(SoundGroups.g_instance.getVolume('gui') * 100),
         'ambientVolume': round(SoundGroups.g_instance.getVolume('ambient') * 100),
         'masterVivoxVolume': round(SoundGroups.g_instance.getVolume('masterVivox') * 100),
         'micVivoxVolume': round(SoundGroups.g_instance.getVolume('micVivox') * 100),
         'masterFadeVivoxVolume': round(SoundGroups.g_instance.getVolume('masterFadeVivox') * 100),
         'captureDevice': self.__getCaptureDeviceSettings(),
         'voiceChatNotSupported': rh.vivoxDomain == '' or not VoiceChatInterface.g_instance.ready,
         'datetimeIdx': g_settingsCore.serverSettings.getGameSetting('datetimeIdx', 2),
         'enableOlFilter': g_settingsCore.getSetting('enableOlFilter'),
         'enableSpamFilter': g_settingsCore.getSetting('enableSpamFilter'),
         'enableStoreChatMws': g_settingsCore.getSetting('enableStoreMws'),
         'enableStoreChatCws': g_settingsCore.getSetting('enableStoreCws'),
         'invitesFromFriendsOnly': g_settingsCore.getSetting('invitesFromFriendsOnly'),
         'storeReceiverInBattle': g_settingsCore.getSetting('storeReceiverInBattle'),
         'dynamicCamera': g_settingsCore.getSetting('dynamicCamera'),
         'horStabilizationSnp': g_settingsCore.getSetting('horStabilizationSnp'),
         'enableVoIP': VOIP.getVOIPManager().channelsMgr.enabled,
         'enablePostMortemEffect': g_settingsCore.getSetting('enablePostMortemEffect'),
         'nationalVoices': AccountSettings.getSettings('nationalVoices'),
         'isColorBlind': AccountSettings.getSettings('isColorBlind'),
         'useServerAim': g_settingsCore.getSetting('useServerAim'),
         'showVehiclesCounter': g_settingsCore.getSetting('showVehiclesCounter'),
         'minimapAlpha': g_settingsCore.getSetting('minimapAlpha'),
         'vibroIsConnected': vManager.connect(),
         'vibroGain': vManager.getGain() * 100,
         'vibroEngine': vEffGroups.get('engine', vEffDefGroup).gain * 100,
         'vibroAcceleration': vEffGroups.get('acceleration', vEffDefGroup).gain * 100,
         'vibroShots': vEffGroups.get('shots', vEffDefGroup).gain * 100,
         'vibroHits': vEffGroups.get('hits', vEffDefGroup).gain * 100,
         'vibroCollisions': vEffGroups.get('collisions', vEffDefGroup).gain * 100,
         'vibroDamage': vEffGroups.get('damage', vEffDefGroup).gain * 100,
         'vibroGUI': vEffGroups.get('gui', vEffDefGroup).gain * 100,
         'ppShowLevels': g_settingsCore.getSetting('ppShowLevels'),
         'ppShowTypes': AccountSettings.getSettings('players_panel')['showTypes'],
         'replayEnabled': g_settingsCore.getSetting('replayEnabled'),
         'fpsPerfomancer': g_settingsCore.getSetting('fpsPerfomancer'),
         'arcade': {'values': g_settingsCore.options.getSetting('arcade').toAccountSettings(),
                    'options': SettingsInterface.CURSOR_VALUES},
         'sniper': {'values': g_settingsCore.options.getSetting('sniper').toAccountSettings(),
                    'options': SettingsInterface.SNIPER_VALUES},
         'markers': {'values': markers,
                     'options': SettingsInterface.MARKER_VALUES,
                     'types': SettingsInterface.MARKER_TYPES}}
        if self.__altVoiceSetting.isOptionEnabled():
            altVoices = []
            for idx, desc in enumerate(self.__altVoiceSetting.getOptions()):
                altVoices.append({'data': idx,
                 'label': desc})

            config['alternativeVoices'] = {'current': self.__altVoiceSetting.get(),
             'options': altVoices}
        gameplayMask = gameplay_ctx.getMask()
        for name in ArenaType.g_gameplayNames:
            key = self.GAMEPLAY_KEY_FORMAT.format(name)
            bit = ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName(name))
            config[key] = gameplayMask & bit > 0

        settings.append(config)
        if not LogitechMonitor.isPresentColor():
            if self.KEYBOARD_MAPPING_BLOCKS.has_key('logitech_keyboard'):
                del self.KEYBOARD_MAPPING_BLOCKS['logitech_keyboard']
        else:
            self.KEYBOARD_MAPPING_BLOCKS['logitech_keyboard'] = ('switch_view',)
        cmdMap = CommandMapping.g_instance
        defaults = cmdMap.getDefaults()
        keyboard = []
        for group_name in self.KEYBOARD_MAPPING_BLOCKS_ORDER:
            if group_name in self.KEYBOARD_MAPPING_BLOCKS.keys():
                group = {'id': group_name,
                 'commands': []}
                keyboard.append(group)
                for key_setting in self.KEYBOARD_MAPPING_BLOCKS[group_name]:
                    command = cmdMap.getCommand(self.KEYBOARD_MAPPING_COMMANDS[group_name][key_setting])
                    keyCode = cmdMap.get(self.KEYBOARD_MAPPING_COMMANDS[group_name][key_setting])
                    defaultCode = defaults[command] if defaults.has_key(command) else 0
                    key = {'id': key_setting,
                     'command': command,
                     'key': getScaleformKey(keyCode),
                     'keyDefault': getScaleformKey(defaultCode)}
                    group['commands'].append(key)

        settings.append(keyboard)
        mouse = {}
        player = BigWorld.player()
        if hasattr(player.inputHandler, 'ctrls'):
            for key, path in SettingsInterface.MOUSE_KEYS['ingame'].items():
                if key == 'horInvert':
                    value = g_settingsCore.getSetting('mouseHorzInvert')
                elif key == 'vertInvert':
                    value = g_settingsCore.getSetting('mouseVertInvert')
                elif key == 'backDraftInvert':
                    value = g_settingsCore.getSetting('backDraftInvert')
                else:
                    value = player.inputHandler.ctrls[path[0]].camera.getUserConfigValue(path[1])
                mouse[key] = {'defaultValue': SettingsInterface.MOUSE_KEYS['default'][key],
                 'value': value}

        else:
            ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
            for key, path in SettingsInterface.MOUSE_KEYS['lobby'].items():
                default = SettingsInterface.MOUSE_KEYS['default'][key]
                value = default
                if key == 'horInvert':
                    value = g_settingsCore.getSetting('mouseHorzInvert')
                elif key == 'vertInvert':
                    value = g_settingsCore.getSetting('mouseVertInvert')
                elif key == 'backDraftInvert':
                    value = g_settingsCore.getSetting('backDraftInvert')
                elif ds is not None:
                    if path[2] == 'float':
                        value = ds[path[0]].readFloat(path[1], default)
                    elif path[2] == 'bool':
                        value = ds[path[0]].readBool(path[1], default)
                    else:
                        LOG_DEBUG('Unknown mouse settings type %s %s' % (key, path))
                mouse[key] = {'defaultValue': default,
                 'value': value}

        settings.append(mouse)
        g_windowsStoredData.stop()
        return settings
Ejemplo n.º 10
0
 def __init__(self, settingName, gameplayName, storage):
     super(GameplaySetting, self).__init__(settingName, storage)
     self.gameplayName = gameplayName
     self.bit = ArenaType.getVisibilityMask(ArenaType.getGameplayIDForName(self.gameplayName))
Ejemplo n.º 11
0
 def __init__(self, settingName, gameplayName, storage):
     super(GameplaySetting, self).__init__(settingName, storage)
     self.gameplayName = gameplayName
     self.bit = ArenaType.getVisibilityMask(
         ArenaType.getGameplayIDForName(self.gameplayName))
Ejemplo n.º 12
0
    def __getSettings(self):
        settings = [self.graphicsPresets.getGraphicsPresetsData()]
        import VOIP
        rh = VOIP.getVOIPManager()
        g_windowsStoredData.start()
        vManager = VibroManager.g_instance
        vEffGroups = vManager.getGroupsSettings()
        vEffDefGroup = VibroManager.VibroManager.GroupSettings()
        vEffDefGroup.enabled = False
        vEffDefGroup.gain = 0
        markers = {
            'enemy': g_settingsCore.getSetting('enemy'),
            'dead': g_settingsCore.getSetting('dead'),
            'ally': g_settingsCore.getSetting('ally')
        }
        config = {
            'locale':
            getClientOverride(),
            'aspectRatio': {
                'current': self.resolutions.aspectRatioIndex,
                'options': self.resolutions.aspectRatiosList
            },
            'vertSync':
            self.resolutions.isVideoVSync,
            'tripleBuffered':
            self.resolutions.isTripleBuffered,
            'multisampling': {
                'current': self.resolutions.multisamplingTypeIndex,
                'options': self.resolutions.multisamplingTypesList
            },
            'customAA': {
                'current': self.resolutions.customAAModeIndex,
                'options': self.resolutions.customAAModesList
            },
            'gamma':
            self.resolutions.gamma,
            'masterVolume':
            round(SoundGroups.g_instance.getMasterVolume() * 100),
            'musicVolume':
            round(SoundGroups.g_instance.getVolume('music') * 100),
            'voiceVolume':
            round(SoundGroups.g_instance.getVolume('voice') * 100),
            'vehiclesVolume':
            round(SoundGroups.g_instance.getVolume('vehicles') * 100),
            'effectsVolume':
            round(SoundGroups.g_instance.getVolume('effects') * 100),
            'guiVolume':
            round(SoundGroups.g_instance.getVolume('gui') * 100),
            'ambientVolume':
            round(SoundGroups.g_instance.getVolume('ambient') * 100),
            'masterVivoxVolume':
            round(SoundGroups.g_instance.getVolume('masterVivox') * 100),
            'micVivoxVolume':
            round(SoundGroups.g_instance.getVolume('micVivox') * 100),
            'masterFadeVivoxVolume':
            round(SoundGroups.g_instance.getVolume('masterFadeVivox') * 100),
            'captureDevice':
            self.__getCaptureDeviceSettings(),
            'voiceChatNotSupported':
            rh.vivoxDomain == '' or not VoiceChatInterface.g_instance.ready,
            'datetimeIdx':
            g_settingsCore.serverSettings.getGameSetting('datetimeIdx', 2),
            'enableOlFilter':
            g_settingsCore.getSetting('enableOlFilter'),
            'enableSpamFilter':
            g_settingsCore.getSetting('enableSpamFilter'),
            'enableStoreChatMws':
            g_settingsCore.getSetting('enableStoreMws'),
            'enableStoreChatCws':
            g_settingsCore.getSetting('enableStoreCws'),
            'invitesFromFriendsOnly':
            g_settingsCore.getSetting('invitesFromFriendsOnly'),
            'storeReceiverInBattle':
            g_settingsCore.getSetting('storeReceiverInBattle'),
            'dynamicCamera':
            g_settingsCore.getSetting('dynamicCamera'),
            'horStabilizationSnp':
            g_settingsCore.getSetting('horStabilizationSnp'),
            'enableVoIP':
            VOIP.getVOIPManager().channelsMgr.enabled,
            'enablePostMortemEffect':
            g_settingsCore.getSetting('enablePostMortemEffect'),
            'nationalVoices':
            AccountSettings.getSettings('nationalVoices'),
            'isColorBlind':
            AccountSettings.getSettings('isColorBlind'),
            'useServerAim':
            g_settingsCore.getSetting('useServerAim'),
            'showVehiclesCounter':
            g_settingsCore.getSetting('showVehiclesCounter'),
            'minimapAlpha':
            g_settingsCore.getSetting('minimapAlpha'),
            'vibroIsConnected':
            vManager.connect(),
            'vibroGain':
            vManager.getGain() * 100,
            'vibroEngine':
            vEffGroups.get('engine', vEffDefGroup).gain * 100,
            'vibroAcceleration':
            vEffGroups.get('acceleration', vEffDefGroup).gain * 100,
            'vibroShots':
            vEffGroups.get('shots', vEffDefGroup).gain * 100,
            'vibroHits':
            vEffGroups.get('hits', vEffDefGroup).gain * 100,
            'vibroCollisions':
            vEffGroups.get('collisions', vEffDefGroup).gain * 100,
            'vibroDamage':
            vEffGroups.get('damage', vEffDefGroup).gain * 100,
            'vibroGUI':
            vEffGroups.get('gui', vEffDefGroup).gain * 100,
            'ppShowLevels':
            g_settingsCore.getSetting('ppShowLevels'),
            'ppShowTypes':
            AccountSettings.getSettings('players_panel')['showTypes'],
            'replayEnabled':
            g_settingsCore.getSetting('replayEnabled'),
            'fpsPerfomancer':
            g_settingsCore.getSetting('fpsPerfomancer'),
            'arcade': {
                'values':
                g_settingsCore.options.getSetting(
                    'arcade').toAccountSettings(),
                'options':
                SettingsInterface.CURSOR_VALUES
            },
            'sniper': {
                'values':
                g_settingsCore.options.getSetting(
                    'sniper').toAccountSettings(),
                'options':
                SettingsInterface.SNIPER_VALUES
            },
            'markers': {
                'values': markers,
                'options': SettingsInterface.MARKER_VALUES,
                'types': SettingsInterface.MARKER_TYPES
            }
        }
        if self.__altVoiceSetting.isOptionEnabled():
            altVoices = []
            for idx, desc in enumerate(self.__altVoiceSetting.getOptions()):
                altVoices.append({'data': idx, 'label': desc})

            config['alternativeVoices'] = {
                'current': self.__altVoiceSetting.get(),
                'options': altVoices
            }
        gameplayMask = gameplay_ctx.getMask()
        for name in ArenaType.g_gameplayNames:
            key = self.GAMEPLAY_KEY_FORMAT.format(name)
            bit = ArenaType.getVisibilityMask(
                ArenaType.getGameplayIDForName(name))
            config[key] = gameplayMask & bit > 0

        settings.append(config)
        if not LogitechMonitor.isPresentColor():
            if self.KEYBOARD_MAPPING_BLOCKS.has_key('logitech_keyboard'):
                del self.KEYBOARD_MAPPING_BLOCKS['logitech_keyboard']
        else:
            self.KEYBOARD_MAPPING_BLOCKS['logitech_keyboard'] = (
                'switch_view', )
        cmdMap = CommandMapping.g_instance
        defaults = cmdMap.getDefaults()
        keyboard = []
        for group_name in self.KEYBOARD_MAPPING_BLOCKS_ORDER:
            if group_name in self.KEYBOARD_MAPPING_BLOCKS.keys():
                group = {'id': group_name, 'commands': []}
                keyboard.append(group)
                for key_setting in self.KEYBOARD_MAPPING_BLOCKS[group_name]:
                    command = cmdMap.getCommand(
                        self.KEYBOARD_MAPPING_COMMANDS[group_name]
                        [key_setting])
                    keyCode = cmdMap.get(
                        self.KEYBOARD_MAPPING_COMMANDS[group_name]
                        [key_setting])
                    defaultCode = defaults[command] if defaults.has_key(
                        command) else 0
                    key = {
                        'id': key_setting,
                        'command': command,
                        'key': getScaleformKey(keyCode),
                        'keyDefault': getScaleformKey(defaultCode)
                    }
                    group['commands'].append(key)

        settings.append(keyboard)
        mouse = {}
        player = BigWorld.player()
        if hasattr(player.inputHandler, 'ctrls'):
            for key, path in SettingsInterface.MOUSE_KEYS['ingame'].items():
                if key == 'horInvert':
                    value = g_settingsCore.getSetting('mouseHorzInvert')
                elif key == 'vertInvert':
                    value = g_settingsCore.getSetting('mouseVertInvert')
                elif key == 'backDraftInvert':
                    value = g_settingsCore.getSetting('backDraftInvert')
                else:
                    value = player.inputHandler.ctrls[
                        path[0]].camera.getUserConfigValue(path[1])
                mouse[key] = {
                    'defaultValue':
                    SettingsInterface.MOUSE_KEYS['default'][key],
                    'value': value
                }

        else:
            ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
            for key, path in SettingsInterface.MOUSE_KEYS['lobby'].items():
                default = SettingsInterface.MOUSE_KEYS['default'][key]
                value = default
                if key == 'horInvert':
                    value = g_settingsCore.getSetting('mouseHorzInvert')
                elif key == 'vertInvert':
                    value = g_settingsCore.getSetting('mouseVertInvert')
                elif key == 'backDraftInvert':
                    value = g_settingsCore.getSetting('backDraftInvert')
                elif ds is not None:
                    if path[2] == 'float':
                        value = ds[path[0]].readFloat(path[1], default)
                    elif path[2] == 'bool':
                        value = ds[path[0]].readBool(path[1], default)
                    else:
                        LOG_DEBUG('Unknown mouse settings type %s %s' %
                                  (key, path))
                mouse[key] = {'defaultValue': default, 'value': value}

        settings.append(mouse)
        g_windowsStoredData.stop()
        return settings