Esempio n. 1
0
def getKeyFromAction(action):
    if action in (BATTLE_CHAT_COMMAND_NAMES.DEFEND_BASE,
                  BATTLE_CHAT_COMMAND_NAMES.ATTACK_BASE,
                  BATTLE_CHAT_COMMAND_NAMES.HELPME,
                  BATTLE_CHAT_COMMAND_NAMES.ATTENTION_TO_POSITION,
                  BATTLE_CHAT_COMMAND_NAMES.ATTACK_OBJECTIVE,
                  BATTLE_CHAT_COMMAND_NAMES.DEFEND_OBJECTIVE,
                  BATTLE_CHAT_COMMAND_NAMES.ATTACK_ENEMY,
                  BATTLE_CHAT_COMMAND_NAMES.REPLY,
                  BATTLE_CHAT_COMMAND_NAMES.CANCEL_REPLY):
        shortcut = CommandMapping.g_instance.getName(
            CommandMapping.CMD_CHAT_SHORTCUT_CONTEXT_COMMAND)
        scaleFormKey = getScaleformKey(CommandMapping.g_instance.get(shortcut))
    elif action in (BATTLE_CHAT_COMMAND_NAMES.DEFENDING_BASE,
                    BATTLE_CHAT_COMMAND_NAMES.ATTACKING_BASE,
                    BATTLE_CHAT_COMMAND_NAMES.ATTACKING_OBJECTIVE,
                    BATTLE_CHAT_COMMAND_NAMES.DEFENDING_OBJECTIVE,
                    BATTLE_CHAT_COMMAND_NAMES.ATTACKING_ENEMY_WITH_SPG,
                    BATTLE_CHAT_COMMAND_NAMES.ATTACKING_ENEMY,
                    BATTLE_CHAT_COMMAND_NAMES.SUPPORTING_ALLY,
                    BATTLE_CHAT_COMMAND_NAMES.SPG_AIM_AREA,
                    BATTLE_CHAT_COMMAND_NAMES.GOING_THERE):
        shortcut = CommandMapping.g_instance.getName(
            CommandMapping.CMD_CHAT_SHORTCUT_CONTEXT_COMMIT)
        scaleFormKey = getScaleformKey(CommandMapping.g_instance.get(shortcut))
    elif action in KB_MAPPING:
        cmd = KB_MAPPING[action]
        shortcut = CommandMapping.g_instance.getName(cmd)
        scaleFormKey = getScaleformKey(CommandMapping.g_instance.get(shortcut))
    else:
        return 0
    return scaleFormKey
Esempio n. 2
0
def new_updateMenu(base, self):
    data = []
    mapName = BigWorld.player().arena.arenaType.geometryName
    menuConf, menuType = g_config.findBestFitConf(mapName)
    if menuConf is None:
        return base(self)
    for state in SHORTCUT_STATES.ALL:
        stateData = [{
            'title': x.title,
            'action': x.action,
            'icon': x.icon,
            'key': getKeyFromAction(x.action, state)
        } for x in SHORTCUT_SETS[state]]
        data.append({'state': state, 'data': stateData})
        state = state.replace('_spg', '')
        if state not in menuConf:
            continue
        for idx in xrange(min(len(menuConf[state]), len(stateData))):
            command = menuConf[state][idx]
            if not command:
                continue
            hotkey = 0
            keys = command.hotKeys
            if keys:
                hotKeys = [x for x in keys if not isinstance(x, list)]
                if not hotKeys:
                    hotKeys = keys[0]
                hotkey = hotKeys[0] if len(hotKeys) == 1 else 0
            stateData[idx] = {
                'title': command.title,
                'icon': command.icon,
                'key': getScaleformKey(hotkey),
                'action': '.'.join((menuType, state, '%s' % idx))
            }
    self.as_buildDataS(data)
Esempio n. 3
0
def getKeyFromAction(action):
    cmd = KB_MAPPING.get(action, None)
    if action in DENIED_ACTIONS or cmd is None:
        return 0
    else:
        shortcut = CommandMapping.g_instance.getName(cmd)
        return getScaleformKey(CommandMapping.g_instance.get(shortcut))
Esempio n. 4
0
def getKeyFromAction(action):
    cmd = KB_MAPPING.get(action, None)
    if action in DENIED_ACTIONS or cmd is None:
        return 0
    else:
        shortcut = CommandMapping.g_instance.getName(cmd)
        return getScaleformKey(CommandMapping.g_instance.get(shortcut))
Esempio n. 5
0
    def handleKey(self, key, isDown, offset):
        cmdMap = CommandMapping.g_instance
        if cmdMap.isFired(CommandMapping.CMD_RADIAL_MENU_SHOW, key):
            if isDown:
                if self.__currentVehicleDesc is None:
                    self.__currentVehicleDesc = self.__getCurrentVehicleDesc()
                if self.__currentVehicleDesc is not None:
                    self.__currentTarget = BigWorld.target()
                    mouseUsedForShow = getScaleformKey(key) <= BW_TO_SCALEFORM[
                        Keys.KEY_MOUSE7]
                    self.__onMenuShow(offset, mouseUsedForShow)
            else:
                self.__onMenuHide()
        elif isDown:
            if not self.__ingameMenuIsVisible():
                if self.__currentVehicleDesc is None:
                    self.__currentVehicleDesc = self.__getCurrentVehicleDesc()
                if not self.__showed:
                    self.__currentTarget = BigWorld.target()
                for command in self.KEYB_MAPPINGS:
                    shortcut = self.KEYB_CMDS_MAPPINGS[command]
                    if cmdMap.isFired(getattr(CommandMapping, shortcut), key):
                        action = self.__getMappedCommand(command)
                        if action not in self.DENIED_KEYB_CMDS:
                            self.onAction(action)

        return
Esempio n. 6
0
    def handleKey(self, key, isDown, offset):
        cmdMap = CommandMapping.g_instance
        if cmdMap.isFired(CommandMapping.CMD_RADIAL_MENU_SHOW, key):
            if isDown:
                if self.__currentVehicleDesc is None:
                    self.__currentVehicleDesc = self.__getCurrentVehicleDesc()
                if self.__currentVehicleDesc is not None:
                    self.__currentTarget = BigWorld.target()
                    mouseUsedForShow = getScaleformKey(key) <= BW_TO_SCALEFORM[Keys.KEY_MOUSE7]
                    self.__onMenuShow(offset, mouseUsedForShow)
            else:
                self.__onMenuHide()
        elif isDown:
            if not self.__ingameMenuIsVisible():
                if self.__currentVehicleDesc is None:
                    self.__currentVehicleDesc = self.__getCurrentVehicleDesc()
                if not self.__showed:
                    self.__currentTarget = BigWorld.target()
                for command in self.KEYB_MAPPINGS:
                    shortcut = self.KEYB_CMDS_MAPPINGS[command]
                    if cmdMap.isFired(getattr(CommandMapping, shortcut), key):
                        action = self.__getMappedCommand(command)
                        if action not in self.DENIED_KEYB_CMDS:
                            self.onAction(action)

        return
Esempio n. 7
0
 def __genKey(self, idx):
     if not -1 < idx < PANEL_MAX_LENGTH - 1:
         raise AssertionError
         cmdMappingKey = COMMAND_AMMO_CHOICE_MASK.format(idx + 1 if idx < 9 else 0)
         bwKey = CommandMapping.g_instance.get(cmdMappingKey)
         sfKey = 0
         sfKey = bwKey is not None and bwKey != 0 and getScaleformKey(bwKey)
     return (bwKey, sfKey)
Esempio n. 8
0
 def __genKey(self, idx):
     assert -1 < idx < PANEL_MAX_LENGTH - 1
     cmdMappingKey = COMMAND_AMMO_CHOICE_MASK.format(idx + 1 if idx < 9 else 0)
     bwKey = CommandMapping.g_instance.get(cmdMappingKey)
     sfKey = 0
     if bwKey is not None and bwKey != 0:
         sfKey = getScaleformKey(bwKey)
     return (bwKey, sfKey)
Esempio n. 9
0
 def __genKey(self, idx):
     cmdMappingKey = COMMAND_AMMO_CHOICE_MASK.format(idx +
                                                     1 if idx < 9 else 0)
     bwKey = CommandMapping.g_instance.get(cmdMappingKey)
     sfKey = 0
     if bwKey is not None:
         sfKey = getScaleformKey(bwKey)
     return (bwKey, sfKey)
Esempio n. 10
0
 def __genKey(self, idx):
     if not -1 < idx < PANEL_MAX_LENGTH - 1:
         raise AssertionError
         cmdMappingKey = COMMAND_AMMO_CHOICE_MASK.format(idx + 1 if idx < 9 else 0)
         bwKey = CommandMapping.g_instance.get(cmdMappingKey)
         sfKey = 0
         sfKey = bwKey is not None and bwKey != 0 and getScaleformKey(bwKey)
     return (bwKey, sfKey)
Esempio n. 11
0
 def __genKey(self, idx):
     assert -1 < idx < PANEL_MAX_LENGTH - 1
     cmdMappingKey = COMMAND_AMMO_CHOICE_MASK.format(idx +
                                                     1 if idx < 9 else 0)
     bwKey = CommandMapping.g_instance.get(cmdMappingKey)
     sfKey = 0
     if bwKey is not None and bwKey != 0:
         sfKey = getScaleformKey(bwKey)
     return (bwKey, sfKey)
Esempio n. 12
0
 def clearExCallbackToKey(self, key, command, function = None):
     try:
         gfx_key = getScaleformKey(key)
         if gfx_key != voidSymbol:
             self.movie.invoke(('clearExCallbackToKey', [gfx_key]))
             self.removeExternalCallback(command, function=function)
         else:
             LOG_ERROR("Can't convert key:", key)
     except:
         LOG_CURRENT_EXCEPTION()
Esempio n. 13
0
 def clearExCallbackToKey(self, key, command, function=None):
     try:
         gfx_key = getScaleformKey(key)
         if gfx_key != voidSymbol:
             self.movie.invoke(('clearExCallbackToKey', [gfx_key]))
             self.removeExternalCallback(command, function=function)
         else:
             LOG_ERROR("Can't convert key:", key)
     except:
         LOG_CURRENT_EXCEPTION()
Esempio n. 14
0
def new_updateMenu(_, self):
    data = []
    menuConf = None
    menuType = ''
    mapName = BigWorld.player().arena.arenaType.geometryName
    commandConf = _config.commands.get(
        _config.activeConfigs[_config.data['selectedConfig']], {})
    if PYmodsCore.checkKeys(_config.data['mapMenu_key']):
        menuConf = commandConf.get('Map_' + mapName)
        menuType = 'Map_' + mapName
        if menuConf is None:
            menuConf = commandConf.get('Map_default')
            menuType = 'Map_default'
    if menuConf is None:
        menuConf, menuType = findBestFitConf(commandConf)
    for state in SHORTCUT_STATES.ALL:
        stateData = map(
            lambda x: {
                'title':
                x.title,
                'action':
                x.action,
                'icon':
                x.icon,
                'key':
                getKeyFromAction(*((x.action, ) +
                                   (()
                                    if '16' in BigWorld.curCV else (state, ))))
            }, SHORTCUT_SETS[state])
        if menuConf is not None:
            menuState = state.replace('_spg', '')
            for idx in xrange(
                    min(len(menuConf.get(menuState, [])), len(stateData))):
                if not menuConf[menuState][idx]:
                    continue
                keys = menuConf[menuState][idx].hotKeys
                if keys:
                    hotKeys = filter(lambda x: not isinstance(x, list), keys)
                    if not hotKeys:
                        hotKeys = keys[0]
                    hotkey = hotKeys[0] if len(hotKeys) == 1 else 0
                else:
                    hotkey = 0
                stateData[idx] = {
                    'title': menuConf[menuState][idx].title,
                    'action': '.'.join((menuType, menuState, '%s' % idx)),
                    'icon': menuConf[menuState][idx].icon,
                    'key': getScaleformKey(hotkey)
                }
        data.append({'state': state, 'data': stateData})

    self.as_buildDataS(data)
def getKeyFromAction(action, cut=SHORTCUT_STATES.DEFAULT):
    if action in TARGET_ACTIONS and cut != SHORTCUT_STATES.DEFAULT:
        for targetAction, targeData in TARGET_TRANSLATION_MAPPING.iteritems():
            if cut in targeData and action == targeData[cut]:
                action = targetAction
                break

    if action in KB_MAPPING:
        cmd = KB_MAPPING[action]
    else:
        return 0
    shortcut = CommandMapping.g_instance.getName(cmd)
    return getScaleformKey(CommandMapping.g_instance.get(shortcut))
Esempio n. 16
0
    def __getKeysList(self, crosshairType):
        if crosshairType != '':
            keys = []
            need_shortcuts = self.ALL_SHORTCUTS[crosshairType]
            for i, shortcut_key in enumerate(self.KEYB_MAPPINGS):
                index = self.INDEX_REFERENCES[i]
                action = need_shortcuts['commands'][index]
                if action not in self.DENIED_KEYB_CMDS:
                    shortcut = self.KEYB_CMDS_MAPPINGS[self.KEYB_MAPPINGS[index]]
                    keyCode = getScaleformKey(CommandMapping.g_instance.get(shortcut))
                    keys.append(keyCode)
                else:
                    keys.append(0)

            return keys
        LOG_ERROR('Unknown vehicle type under crosshair target')
Esempio n. 17
0
    def __getKeysList(self, crosshairType):
        if crosshairType != '':
            keys = []
            need_shortcuts = self.ALL_SHORTCUTS[crosshairType]
            for i, shortcut_key in enumerate(self.KEYB_MAPPINGS):
                index = self.INDEX_REFERENCES[i]
                action = need_shortcuts['commands'][index]
                if action not in self.DENIED_KEYB_CMDS:
                    shortcut = self.KEYB_CMDS_MAPPINGS[self.KEYB_MAPPINGS[index]]
                    keyCode = getScaleformKey(CommandMapping.g_instance.get(shortcut))
                    keys.append(keyCode)
                else:
                    keys.append(0)

            return keys
        LOG_ERROR('Unknown vehicle type under crosshair target')
Esempio n. 18
0
def getKeyFromAction(action, cut=SHORTCUT_STATES.DEFAULT):
    """
    Gets the key buy given chat action and shortcut. Target actions
    use their base action.
    Args:
        action: chact action
        cut: chat short cut
    
    Returns:
        chat's Scaleform key
    """
    if action in TARGET_ACTIONS and cut != SHORTCUT_STATES.DEFAULT:
        for targetAction, targeData in TARGET_TRANSLATION_MAPPING.iteritems():
            if cut in targeData and action == targeData[cut]:
                action = targetAction
                break

    if action in KB_MAPPING:
        cmd = KB_MAPPING[action]
    else:
        return 0
    shortcut = CommandMapping.g_instance.getName(cmd)
    return getScaleformKey(CommandMapping.g_instance.get(shortcut))
Esempio n. 19
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
Esempio n. 20
0
 def __getFireKeyCode(self):
     fireKey = self.__settings.KEYBOARD_MAPPING_COMMANDS['firing']['fire']
     return getScaleformKey(fireKey)
Esempio n. 21
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')
        }
        datetimeIdx = g_settingsCore.getSetting(
            'showDateMessage') << 0 | g_settingsCore.getSetting(
                'showTimeMessage') << 1
        zoomOption = g_settingsCore.options.getSetting('increasedZoom')
        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,
            'masterVolumeToggle':
            g_settingsCore.getSetting(SOUND.MASTER_TOGGLE),
            'soundQuality':
            g_settingsCore.getSetting(SOUND.SOUND_QUALITY),
            'soundQualityVisible':
            g_settingsCore.getSetting(SOUND.SOUND_QUALITY_VISIBLE),
            'masterVolume':
            round(SoundGroups.g_instance.getMasterVolume() * 100),
            'musicVolume':
            round(SoundGroups.g_instance.getVolume('music') * 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),
            'dynamicRange':
            g_settingsCore.options.getSetting('dynamicRange').pack(),
            'soundDevice':
            g_settingsCore.options.getSetting('soundDevice').pack(),
            'captureDevice':
            g_settingsCore.options.getSetting(SOUND.CAPTURE_DEVICES).pack(),
            'voiceChatNotSupported':
            not g_settingsCore.getSetting(SOUND.VOIP_SUPPORTED),
            'datetimeIdx':
            datetimeIdx,
            'enableOlFilter':
            g_settingsCore.getSetting('enableOlFilter'),
            'enableSpamFilter':
            g_settingsCore.getSetting('enableSpamFilter'),
            'receiveFriendshipRequest':
            g_settingsCore.getSetting('receiveFriendshipRequest'),
            'receiveInvitesInBattle':
            g_settingsCore.getSetting('receiveInvitesInBattle'),
            'invitesFromFriendsOnly':
            g_settingsCore.getSetting('invitesFromFriendsOnly'),
            'disableBattleChat':
            g_settingsCore.getSetting('disableBattleChat'),
            'chatContactsListOnly':
            g_settingsCore.getSetting('chatContactsListOnly'),
            'receiveClanInvitesNotifications':
            g_settingsCore.getSetting('receiveClanInvitesNotifications'),
            'dynamicCamera':
            g_settingsCore.getSetting('dynamicCamera'),
            'horStabilizationSnp':
            g_settingsCore.getSetting('horStabilizationSnp'),
            'increasedZoom':
            zoomOption.get(),
            'sniperModeByShift':
            g_settingsCore.getSetting('sniperModeByShift'),
            'enableVoIP':
            g_settingsCore.getSetting('enableVoIP'),
            'enablePostMortemEffect':
            g_settingsCore.getSetting('enablePostMortemEffect'),
            'enablePostMortemDelay':
            g_settingsCore.getSetting('enablePostMortemDelay'),
            'isColorBlind':
            g_settingsCore.getSetting('isColorBlind'),
            'graphicsQualityHDSD':
            g_settingsCore.getSetting('graphicsQualityHDSD'),
            'useServerAim':
            g_settingsCore.getSetting('useServerAim'),
            'showVehiclesCounter':
            g_settingsCore.getSetting('showVehiclesCounter'),
            'showMarksOnGun':
            g_settingsCore.getSetting('showMarksOnGun'),
            'simplifiedTTC':
            g_settingsCore.getSetting('simplifiedTTC'),
            'showBattleEfficiencyRibbons':
            g_settingsCore.getSetting('showBattleEfficiencyRibbons'),
            'minimapAlpha':
            g_settingsCore.getSetting('minimapAlpha'),
            'showVectorOnMap':
            g_settingsCore.getSetting('showVectorOnMap'),
            'showSectorOnMap':
            g_settingsCore.getSetting('showSectorOnMap'),
            'showVehModelsOnMap':
            g_settingsCore.options.getSetting('showVehModelsOnMap').pack(),
            'minimapViewRange':
            g_settingsCore.getSetting('minimapViewRange'),
            'minimapMaxViewRange':
            g_settingsCore.getSetting('minimapMaxViewRange'),
            'minimapDrawRange':
            g_settingsCore.getSetting('minimapDrawRange'),
            'battleLoadingInfo':
            g_settingsCore.options.getSetting('battleLoadingInfo').pack(),
            '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':
            g_settingsCore.getSetting('ppShowTypes'),
            'replayEnabled':
            g_settingsCore.options.getSetting('replayEnabled').pack(),
            'fpsPerfomancer':
            g_settingsCore.getSetting('fpsPerfomancer'),
            'dynamicRenderer':
            g_settingsCore.getSetting('dynamicRenderer'),
            'colorFilterIntensity':
            g_settingsCore.getSetting('colorFilterIntensity'),
            'colorFilterImages':
            g_settingsCore.getSetting('colorFilterImages'),
            'fov':
            g_settingsCore.getSetting('fov'),
            'dynamicFov':
            g_settingsCore.getSetting('dynamicFov'),
            'enableOpticalSnpEffect':
            g_settingsCore.getSetting('enableOpticalSnpEffect'),
            '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
            }
        for name in ('ctf', 'domination', 'assault', 'nations'):
            key = self.GAMEPLAY_KEY_FORMAT.format(name)
            config[key] = g_settingsCore.getSetting(key)

        settings.append(config)
        if KeyboardSettings.isGroupHidden('logitech_keyboard'):
            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)
        extraData = {
            'increasedZoom':
            zoomOption.getExtraData(),
            'keyboardImportantBinds':
            g_settingsCore.getSetting('keyboardImportantBinds')
        }
        settings.append(extraData)
        g_windowsStoredData.stop()
        return settings
Esempio n. 22
0
 def _getCurrentChatKey(self):
     return getScaleformKey(CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE'))
Esempio n. 23
0
def getFixedKeysInfo():
    for key, code in _FIXED_KEYS_IN_HELP:
        yield (key, getScaleformKey(code))
Esempio n. 24
0
 def _get(self):
     if KeyboardSettings.USE_SERVER_LAYOUT:
         value = super(KeyboardSetting, self)._get()
     else:
         value = self.getCurrentMapping()
     return getScaleformKey(value)
Esempio n. 25
0
 def _get(self):
     if KeyboardSettings.USE_SERVER_LAYOUT:
         value = super(KeyboardSetting, self)._get()
     else:
         value = self.getCurrentMapping()
     return getScaleformKey(value)
Esempio n. 26
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"),
        }
        datetimeIdx = (
            g_settingsCore.getSetting("showDateMessage") << 0 | g_settingsCore.getSetting("showTimeMessage") << 1
        )
        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": g_settingsCore.options.getSetting(SOUND.CAPTURE_DEVICES).pack(),
            "voiceChatNotSupported": not g_settingsCore.getSetting(SOUND.VOIP_SUPPORTED),
            "datetimeIdx": datetimeIdx,
            "enableOlFilter": g_settingsCore.getSetting("enableOlFilter"),
            "enableSpamFilter": g_settingsCore.getSetting("enableSpamFilter"),
            "receiveFriendshipRequest": g_settingsCore.getSetting("receiveFriendshipRequest"),
            "receiveInvitesInBattle": g_settingsCore.getSetting("receiveInvitesInBattle"),
            "invitesFromFriendsOnly": g_settingsCore.getSetting("invitesFromFriendsOnly"),
            "storeReceiverInBattle": g_settingsCore.getSetting("storeReceiverInBattle"),
            "disableBattleChat": g_settingsCore.getSetting("disableBattleChat"),
            "chatContactsListOnly": g_settingsCore.getSetting("chatContactsListOnly"),
            "receiveClanInvitesNotifications": g_settingsCore.getSetting("receiveClanInvitesNotifications"),
            "dynamicCamera": g_settingsCore.getSetting("dynamicCamera"),
            "horStabilizationSnp": g_settingsCore.getSetting("horStabilizationSnp"),
            "enableVoIP": g_settingsCore.getSetting("enableVoIP"),
            "enablePostMortemEffect": g_settingsCore.getSetting("enablePostMortemEffect"),
            "enablePostMortemDelay": g_settingsCore.getSetting("enablePostMortemDelay"),
            "nationalVoices": g_settingsCore.getSetting("nationalVoices"),
            "isColorBlind": g_settingsCore.getSetting("isColorBlind"),
            "graphicsQualityHDSD": g_settingsCore.getSetting("graphicsQualityHDSD"),
            "useServerAim": g_settingsCore.getSetting("useServerAim"),
            "showVehiclesCounter": g_settingsCore.getSetting("showVehiclesCounter"),
            "showMarksOnGun": g_settingsCore.getSetting("showMarksOnGun"),
            "showBattleEfficiencyRibbons": g_settingsCore.getSetting("showBattleEfficiencyRibbons"),
            "minimapAlpha": g_settingsCore.getSetting("minimapAlpha"),
            "showVectorOnMap": g_settingsCore.getSetting("showVectorOnMap"),
            "showSectorOnMap": g_settingsCore.getSetting("showSectorOnMap"),
            "showVehModelsOnMap": g_settingsCore.options.getSetting("showVehModelsOnMap").pack(),
            "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": g_settingsCore.getSetting("ppShowTypes"),
            "replayEnabled": g_settingsCore.options.getSetting("replayEnabled").pack(),
            "fpsPerfomancer": g_settingsCore.getSetting("fpsPerfomancer"),
            "dynamicRenderer": g_settingsCore.getSetting("dynamicRenderer"),
            "colorFilterIntensity": g_settingsCore.getSetting("colorFilterIntensity"),
            "colorFilterImages": g_settingsCore.getSetting("colorFilterImages"),
            "fov": g_settingsCore.getSetting("fov"),
            "dynamicFov": g_settingsCore.getSetting("dynamicFov"),
            "enableOpticalSnpEffect": g_settingsCore.getSetting("enableOpticalSnpEffect"),
            "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}
        for name in ("ctf", "domination", "assault", "nations"):
            key = self.GAMEPLAY_KEY_FORMAT.format(name)
            config[key] = g_settingsCore.getSetting(key)

        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
Esempio n. 27
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')}
        datetimeIdx = g_settingsCore.getSetting('showDateMessage') << 0 | g_settingsCore.getSetting('showTimeMessage') << 1
        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': g_settingsCore.options.getSetting(SOUND.CAPTURE_DEVICES).pack(),
         'voiceChatNotSupported': not g_settingsCore.getSetting(SOUND.VOIP_SUPPORTED),
         'datetimeIdx': datetimeIdx,
         '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'),
         'disableBattleChat': g_settingsCore.getSetting('disableBattleChat'),
         'dynamicCamera': g_settingsCore.getSetting('dynamicCamera'),
         'horStabilizationSnp': g_settingsCore.getSetting('horStabilizationSnp'),
         'enableVoIP': VOIP.getVOIPManager().isEnabled(),
         'enablePostMortemEffect': g_settingsCore.getSetting('enablePostMortemEffect'),
         'enablePostMortemDelay': g_settingsCore.getSetting('enablePostMortemDelay'),
         'nationalVoices': g_settingsCore.getSetting('nationalVoices'),
         'isColorBlind': g_settingsCore.getSetting('isColorBlind'),
         'useServerAim': g_settingsCore.getSetting('useServerAim'),
         'showVehiclesCounter': g_settingsCore.getSetting('showVehiclesCounter'),
         'showMarksOnGun': g_settingsCore.getSetting('showMarksOnGun'),
         'minimapAlpha': g_settingsCore.getSetting('minimapAlpha'),
         'showVectorOnMap': g_settingsCore.getSetting('showVectorOnMap'),
         'showSectorOnMap': g_settingsCore.getSetting('showSectorOnMap'),
         'showVehModelsOnMap': g_settingsCore.options.getSetting('showVehModelsOnMap').pack(),
         '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': g_settingsCore.getSetting('ppShowTypes'),
         'replayEnabled': g_settingsCore.options.getSetting('replayEnabled').pack(),
         'fpsPerfomancer': g_settingsCore.getSetting('fpsPerfomancer'),
         'dynamicRenderer': g_settingsCore.getSetting('dynamicRenderer'),
         'colorFilterIntensity': g_settingsCore.getSetting('colorFilterIntensity'),
         'colorFilterImages': g_settingsCore.getSetting('colorFilterImages'),
         'fov': g_settingsCore.getSetting('fov'),
         'dynamicFov': g_settingsCore.getSetting('dynamicFov'),
         'enableOpticalSnpEffect': g_settingsCore.getSetting('enableOpticalSnpEffect'),
         '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}
        for name in ('ctf', 'domination', 'assault', 'nations'):
            key = self.GAMEPLAY_KEY_FORMAT.format(name)
            config[key] = g_settingsCore.getSetting(key)

        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
Esempio n. 28
0
 def _getDefault(self):
     command = CommandMapping.g_instance.getCommand(self.settingName)
     return getScaleformKey(CommandMapping.g_instance.getDefaults().get(
         command, Keys.KEY_NONE))
 def _getCurrentChatKey(self):
     return getScaleformKey(
         CommandMapping.g_instance.get('CMD_VOICECHAT_MUTE'))
Esempio n. 30
0
def getFixedKeysInfo():
    for key, code in _FIXED_KEYS_IN_HELP:
        yield (key, getScaleformKey(code))
Esempio n. 31
0
 def _getDefault(self):
     command = CommandMapping.g_instance.getCommand(self.settingName)
     return getScaleformKey(CommandMapping.g_instance.getDefaults().get(command, Keys.KEY_NONE))
Esempio n. 32
0
 def __getCommandStr(self):
     command = CommandMapping.CMD_CM_VEHICLE_ACTIVATE_RADAR
     bwKey, _ = CommandMapping.g_instance.getCommandKeys(command)
     sfKey = getScaleformKey(bwKey)
     return (bwKey, sfKey)
Esempio n. 33
0
 def __getFireKeyCode(self):
     fireKey = self.__settings.KEYBOARD_MAPPING_COMMANDS['firing']['fire']
     return getScaleformKey(fireKey)
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/managers/GameInputMgr.py
import typing
import Keys
import CommandMapping
from Event import Event
from debug_utils import LOG_DEBUG
from gui.Scaleform.framework.entities.abstract.GameInputManagerMeta import GameInputManagerMeta
from gui.shared.utils.key_mapping import getScaleformKey
from messenger.m_constants import PROTO_TYPE
from messenger.proto import proto_getter
if typing.TYPE_CHECKING:
    from typing import Callable

_KEY_ESCAPE = getScaleformKey(Keys.KEY_ESCAPE)
_KEY_DOWN = 'keyDown'
_KEY_UP = 'keyUp'


class GameInputMgr(GameInputManagerMeta):
    def __init__(self):
        super(GameInputMgr, self).__init__()
        self.__voiceChatKey = self._getCurrentChatKey()
        self.onEscape = Event()

    @proto_getter(PROTO_TYPE.BW_CHAT2)
    def bwProto(self):
        return None

    def handleGlobalKeyEvent(self, keyCode, eventType):
        LOG_DEBUG('GameInputMgr.handleGlobalKeyEvent', keyCode, eventType)