Example #1
0
 def load(cls):
     try:
         return cls(**AccountSettings.getSettings(cls._getSettingName()))
     except:
         LOG_ERROR('There is error while unpacking quests settings', AccountSettings.getSettings('quests'))
         LOG_CURRENT_EXCEPTION()
         return None
 def __init__(self):
     super(VehicleParameters, self).__init__()
     self._vehParamsDP = None
     self._alreadyShowed = False
     self._expandedGroups = {'relativePower': AccountSettings.getSettings('relativePower'),
      'relativeArmor': AccountSettings.getSettings('relativeArmor'),
      'relativeMobility': AccountSettings.getSettings('relativeMobility'),
      'relativeVisibility': AccountSettings.getSettings('relativeVisibility'),
      'relativeCamouflage': AccountSettings.getSettings('relativeCamouflage')}
     return
Example #3
0
 def setupMinimapSettings(self, diff = None):
     if diff is None or 'minimapSize' in diff:
         self.__parentUI.call('minimap.setupSize', [AccountSettings.getSettings('minimapSize')])
     if diff is None or 'minimapAlpha' in diff:
         from account_helpers.SettingsCore import g_settingsCore
         self.__parentUI.call('minimap.setupAlpha', [g_settingsCore.getSetting('minimapAlpha')])
     return
Example #4
0
 def update(self):
     if AccountSettings.getSettings('isColorBlind'):
         csName = 'colorBlind'
     else:
         csName = 'default'
     for colorScheme in self.__colorsSchemes.itervalues():
         colorScheme.setCurrent(csName)
Example #5
0
def packQuest(q, quests = None, linkUp = False, linkDown = False, noProgressInfo = False, noProgressTooltip = False):
    status = getQuestStatus(q)
    bonusCount = getBonusCount(q)
    qProgCur, qProgTot, qProgLabl, qProgbarType, tooltip = getQuestProgress(q, quests)
    if noProgressInfo:
        bonusCount = -1
        status = QUEST_STATUS.NONE
        qProgCur, qProgTot, qProgLabl, qProgbarType, tooltip = (0,
         0,
         '',
         PROGRESS_BAR_TYPE.NONE,
         None)
    if noProgressTooltip:
        tooltip = None
    return {'questID': q.getID(),
     'isNew': isNewQuest(q, AccountSettings.getSettings('quests')),
     'status': status,
     'IGR': q.isIGR(),
     'taskType': q.getUserType(),
     'description': q.getUserName(),
     'timerDescr': getTimerMsg(q),
     'tasksCount': bonusCount,
     'progrBarType': qProgbarType,
     'progrTooltip': tooltip,
     'maxProgrVal': qProgTot,
     'currentProgrVal': qProgCur,
     'isLock': linkDown,
     'isLocked': linkUp}
Example #6
0
 def __checkDefHourConditions(self):
     canChangeSettings = self.fortCtrl.getPermissions().canChangeSettings()
     if not canChangeSettings or self.__currentMode != FORTIFICATION_ALIASES.MODE_COMMON:
         return
     if self.__settingsClanDB != self.__clanDBID and self.__isClanConditionsSuccess():
         fortSettings = dict(AccountSettings.getSettings('fortSettings'))
         fortSettings['clanDBID'] = self.__clanDBID
         AccountSettings.setSettings('fortSettings', fortSettings)
         self.__settingsClanDB = self.__clanDBID
         if not self.fortCtrl.getFort().isDefenceHourEnabled():
             self.fireEvent(events.LoadViewEvent(FORTIFICATION_ALIASES.FORT_PERIOD_DEFENCE_WINDOW_ALIAS), EVENT_BUS_SCOPE.LOBBY)
Example #7
0
 def __init__(self):
     super(FortMainViewComponent, self).__init__()
     self.__tempToggleHelperFlag = False
     self.__currentMode = FortificationEffects.NONE_STATE
     self.__currentModeIsDirty = True
     self.__commanderHelpShown = False
     self.__transportingProgress = None
     fortSettings = dict(AccountSettings.getSettings('fortSettings'))
     self.__settingsClanDB = fortSettings.get('clanDBID', 0)
     self.__clanDBID = g_clanCache.clanDBID
     return
Example #8
0
    def __init__(self, indicator, shapes, position):
        super(_DirectionIndicatorCtrl, self).__init__()
        self.__shapes = shapes
        shape = self.__shapes[0]
        if AccountSettings.getSettings("isColorBlind"):
            shape = self.__shapes[1]
        self.__indicator = indicator
        self.__indicator.setShape(shape)
        self.__indicator.track(position)
        from account_helpers.SettingsCore import g_settingsCore

        g_settingsCore.onSettingsChanged += self.__as_onSettingsChanged
 def __checkLimitedRestoreNotification(self):
     criteria = REQ_CRITERIA.CUSTOM(lambda item: item.hasLimitedRestore())
     vehicles = g_itemsCache.items.getVehicles(criteria).values()
     lastRestoreNotification = AccountSettings.getSettings(LAST_RESTORE_NOTIFICATION)
     if lastRestoreNotification is None:
         showMessage = True
     else:
         showMessage = time_utils.getTimeDeltaTilNow(lastRestoreNotification) >= time_utils.ONE_DAY
     if len(vehicles) and showMessage and not self.__checkForNotify:
         AccountSettings.setSettings(LAST_RESTORE_NOTIFICATION, time.time())
         SystemMessages.g_instance.pushI18nMessage('#system_messages:restoreController/hasLimitedRestoreVehicles', type=SystemMessages.SM_TYPE.Warning)
     self.__checkForNotify = True
     return
Example #10
0
 def __init__(self):
     super(FortMainViewComponent, self).__init__()
     self.__tempToggleHelperFlag = False
     self.__currentMode = FortificationEffects.NONE_STATE
     self.__currentModeIsDirty = True
     self.__commanderHelpShown = False
     self.__transportingProgress = None
     self.__clanDBID = g_clanCache.clanDBID
     self.__fortSettings = dict(AccountSettings.getSettings('fortSettings'))
     self.__defenceHourArrowVisible = False
     self.__intelligenceArrowVisible = False
     if 'showDefHourArrow' not in self.__fortSettings:
         self.__fortSettings['showDefHourArrow'] = True
Example #11
0
    def _saveNewInventoryItemsOnFileSystem(self, inventoryItems):
        newInventoryItems = AccountSettings.getSettings('customization')
        if newInventoryItems is None or not isinstance(newInventoryItems, tuple):
            newInventoryItems = ({}, {}, {})
        for cType in CUSTOMIZATION_TYPE.ALL:
            for itemID in inventoryItems[cType].keys():
                if self._currentVehicle.item.intCD not in newInventoryItems[cType]:
                    newInventoryItems[cType][self._currentVehicle.item.intCD] = {}
                if itemID not in newInventoryItems[cType][self._currentVehicle.item.intCD]:
                    newInventoryItems[cType][self._currentVehicle.item.intCD][itemID] = True

        AccountSettings.setSettings('customization', newInventoryItems)
        return
def clearStoredCustomizationData():
    storedItems = dict(AccountSettings.getSettings('customization'))
    clearStoredItems = {}
    for key, storedTypedItems in storedItems.iteritems():
        typedNewStoredItems = []
        inventoryItems = getInventoryItemsFor(key)
        for item in inventoryItems:
            for storedItem in storedTypedItems:
                if key == CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE and storedItem[1] == item.get('id') or key != CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE and storedItem[1] == item.get('nationId') and storedItem[2] == item.get('id'):
                    typedNewStoredItems.append(storedItem)

        clearStoredItems[key] = typedNewStoredItems

    AccountSettings.setSettings('customization', clearStoredItems)
Example #13
0
 def swap(self):
     if AccountSettings.getSettings(DEFAULT_QUEUE) == QUEUE_TYPE.SANDBOX:
         isSelected = True
         dossier = g_itemsCache.items.getAccountDossier()
         if dossier is not None:
             isSelected = True
             count = dossier.getRandomStats().getBattlesCount()
             if count >= BATTLES_TO_SELECT_RANDOM_MIN_LIMIT:
                 AccountSettings.setSettings(DEFAULT_QUEUE, QUEUE_TYPE.RANDOMS)
                 isSelected = False
     else:
         isSelected = False
     self._isSelected = isSelected
     return
Example #14
0
def visitQuestsGUI(quest):
    if quest is None:
        return
    else:
        s = dict(AccountSettings.getSettings('quests'))
        settings = ['naVisited']
        if quest.isAvailable():
            settings.append('visited')
        for setting in settings:
            s[setting] = tuple(set(s[setting]) | set([quest.getID()]))

        s['lastVisitTime'] = time.time()
        AccountSettings.setSettings('quests', s)
        g_eventBus.handleEvent(events.LobbySimpleEvent(events.LobbySimpleEvent.QUESTS_UPDATED))
        return
Example #15
0
 def __init__(self, mode, offset):
     Flash.__init__(self, 'crosshair_panel_{0:>s}.swf'.format(mode), self.__FLASH_CLASS)
     self.component.wg_inputKeyMode = 2
     self.component.position.z = DEPTH_OF_Aim
     self.component.focus = False
     self.component.moveFocus = False
     self.component.heightMode = 'PIXEL'
     self.component.widthMode = 'PIXEL'
     self.movie.backgroundAlpha = 0
     self.flashSize = GUI.screenResolution()
     self._offset = offset
     self._isLoaded = False
     self.mode = mode
     self.__timeInterval = _TimeInterval(Aim._UPDATE_INTERVAL, '_update', weakref.proxy(self))
     self.__isColorBlind = AccountSettings.getSettings('isColorBlind')
def updateVisitedItems(customizationName, visitedIds):
    if not g_currentVehicle.isPresent():
        return
    storedItems = dict(AccountSettings.getSettings('customization'))
    if not isinstance(visitedIds, set):
        LOG_WARNING('visitedIds will be in an list')
    updatedVisitedIds = []
    for item in visitedIds:
        if isinstance(item, int):
            updatedVisitedIds.append((g_currentVehicle.item.intCD, item))
        else:
            updatedVisitedIds.append((g_currentVehicle.item.intCD,) + item)

    curItems = {customizationName: updatedVisitedIds}
    curTypeItems = __integrateDicts(curItems, storedItems)
    AccountSettings.setSettings('customization', curTypeItems)
Example #17
0
    def start(self):
        self.__ownUI = GUI.WGMinimapFlash(self.__parentUI.movie)
        self.__ownUI.wg_inputKeyMode = 2
        self.__parentUI.component.addChild(self.__ownUI, 'minimap')
        self.__ownUI.mapSize = Math.Vector2(self.__MINIMAP_SIZE)
        bl, tr = BigWorld.player().arena.arenaType.boundingBox
        self.__ownUI.setArenaBB(bl, tr)
        tex = BigWorld.PyTextureProvider(self.__cfg['texture'])
        if not self.__ownUI.setBackground(tex):
            LOG_ERROR("Failed to set minimap texture: '%s'" % self.__cfg['texture'])
        self.__cameraHandle = None
        self.__resetCamera(MODE_ARCADE)
        BigWorld.player().inputHandler.onCameraChanged += self.__resetCamera
        BigWorld.player().inputHandler.onPostmortemVehicleChanged += self.__clearCamera
        self.__parentUI.addExternalCallbacks({'minimap.onClick': self._onMapClicked,
         'minimap.playAttantion': self._playAttention,
         'minimap.setSize': self.onSetSize,
         'minimap.lightPlayer': self.onLightPlayer})
        player = BigWorld.player()
        self.__playerTeam = player.team
        self.__playerVehicleID = player.playerVehicleID
        arena = player.arena
        arena.onPositionsUpdated += self.__onFarPosUpdated
        arena.onNewVehicleListReceived += self.__validateEntries
        arena.onVehicleKilled += self.__onVehicleKilled
        arena.onVehicleAdded += self.__onVehicleAdded
        arena.onTeamKiller += self.__onTeamKiller
        self.__marks = {}
        if not g_battleContext.isPlayerObserver():
            mp = BigWorld.player().getOwnVehicleMatrix()
            self.__ownEntry['handle'] = self.__ownUI.addEntry(mp, self.zIndexManager.getIndexByName('self'))
            self.__ownEntry['matrix'] = player.getOwnVehicleMatrix()
            self.__ownEntry['location'] = None
        self.__isStarted = True
        for id in self.__vehiclesWaitStart:
            self.notifyVehicleStart(id)

        self.__vehiclesWaitStart = []
        self.__mapSizeIndex = AccountSettings.getSettings('minimapSize')
        from account_helpers.SettingsCore import g_settingsCore
        g_settingsCore.onSettingsChanged += self.setupMinimapSettings
        self.setupMinimapSettings()
        self.setTeamPoints()
        g_repeatKeyHandlers.add(self.handleRepeatKeyEvent)
        return
Example #18
0
 def swap(self):
     if AccountSettings.getSettings(DEFAULT_QUEUE) == QUEUE_TYPE.SANDBOX:
         isSelected = True
         dossier = g_itemsCache.items.getAccountDossier()
         criteria = REQ_CRITERIA.INVENTORY | REQ_CRITERIA.VEHICLE.LEVELS(range(3, 10)) | ~REQ_CRITERIA.VEHICLE.EXPIRED_RENT | ~REQ_CRITERIA.VEHICLE.EVENT_BATTLE
         vehicles = sorted(g_itemsCache.items.getVehicles(criteria=criteria).values(), key=lambda item: item.level)
         vehicle = findFirst(None, vehicles)
         if vehicle is not None:
             AccountSettings.setSettings(DEFAULT_QUEUE, QUEUE_TYPE.RANDOMS)
             isSelected = False
         if dossier is not None and isSelected:
             count = dossier.getRandomStats().getBattlesCount()
             if count >= BATTLES_TO_SELECT_RANDOM_MIN_LIMIT:
                 AccountSettings.setSettings(DEFAULT_QUEUE, QUEUE_TYPE.RANDOMS)
                 isSelected = False
     else:
         isSelected = False
     self._isSelected = isSelected
     return
    def _populate(self):
        super(VehicleBuyWindow, self)._populate()
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE, self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:', self.nationID, 'InNationID:', self.inNationID)
            return
        else:
            tankMenStudyPrice = g_itemsCache.items.shop.tankmanCost
            tankMenCount = len(vehicle.crew)
            ammoPrice = [0, 0]
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice[0] += shell.buyPrice[0] * shell.defaultCount
                ammoPrice[1] += shell.buyPrice[1] * shell.defaultCount

            initData = {'expanded': windowExpanded,
             'name': vehicle.userName,
             'longName': vehicle.longUserName,
             'description': vehicle.fullDescription,
             'type': vehicle.type,
             'icon': vehicle.icon,
             'nation': self.nationID,
             'level': vehicle.level,
             'isElite': vehicle.isElite,
             'tankmenCount': tankMenCount,
             'studyPriceCredits': tankMenStudyPrice[1]['credits'] * tankMenCount,
             'studyPriceGold': tankMenStudyPrice[2]['gold'] * tankMenCount,
             'vehiclePrices': vehicle.buyPrice,
             'ammoPrice': ammoPrice[0],
             'slotPrice': g_itemsCache.items.shop.getVehicleSlotsPrice(stats.vehicleSlots)}
            self.as_setInitDataS(initData)
            g_clientUpdateManager.addCallbacks({'stats.credits': self.__setCreditsCallBack,
             'stats.gold': self.__setGoldCallBack})
            return
Example #20
0
def _initializeDefaultSettings(core, data, initialized):
    LOG_DEBUG('Initializing server settings.')
    from account_helpers.AccountSettings import AccountSettings
    options = core.options
    gameData = data['gameData'] = {
        GAME.DATE_TIME_MESSAGE_INDEX:
        2,
        GAME.ENABLE_OL_FILTER:
        options.getSetting(GAME.ENABLE_OL_FILTER).getDefaultValue(),
        GAME.ENABLE_SPAM_FILTER:
        options.getSetting(GAME.ENABLE_SPAM_FILTER).getDefaultValue(),
        GAME.INVITES_FROM_FRIENDS:
        options.getSetting(GAME.INVITES_FROM_FRIENDS).getDefaultValue(),
        GAME.RECEIVE_FRIENDSHIP_REQUEST:
        core.options.getSetting(
            GAME.RECEIVE_FRIENDSHIP_REQUEST).getDefaultValue(),
        GAME.STORE_RECEIVER_IN_BATTLE:
        core.options.getSetting(
            GAME.STORE_RECEIVER_IN_BATTLE).getDefaultValue(),
        GAME.REPLAY_ENABLED:
        core.getSetting(GAME.REPLAY_ENABLED),
        GAME.ENABLE_SERVER_AIM:
        core.getSetting(GAME.ENABLE_SERVER_AIM),
        GAME.SHOW_VEHICLES_COUNTER:
        core.getSetting(GAME.SHOW_VEHICLES_COUNTER),
        GAME.MINIMAP_ALPHA:
        core.getSetting(GAME.MINIMAP_ALPHA),
        GAME.PLAYERS_PANELS_SHOW_LEVELS:
        core.getSetting(GAME.PLAYERS_PANELS_SHOW_LEVELS),
        GAME.ENABLE_POSTMORTEM:
        core.getSetting(GAME.ENABLE_POSTMORTEM)
    }
    data['gameExtData'][GAME.CHAT_CONTACTS_LIST_ONLY] = options.getSetting(
        GAME.CHAT_CONTACTS_LIST_ONLY).getDefaultValue()
    gameplayData = data['gameplayData'] = {
        GAME.GAMEPLAY_MASK: AccountSettings.getSettingsDefault('gameplayMask')
    }
    aimData = data['aimData'] = {
        'arcade': core.getSetting('arcade'),
        'sniper': core.getSetting('sniper')
    }
    controlsData = data['controlsData'] = {
        CONTROLS.MOUSE_HORZ_INVERSION:
        core.getSetting(CONTROLS.MOUSE_HORZ_INVERSION),
        CONTROLS.MOUSE_VERT_INVERSION:
        core.getSetting(CONTROLS.MOUSE_VERT_INVERSION),
        CONTROLS.BACK_DRAFT_INVERSION:
        core.getSetting(CONTROLS.BACK_DRAFT_INVERSION)
    }
    igrCtrl = dependency.instance(IIGRController)
    if igrCtrl.getRoomType() == constants.IGR_TYPE.NONE:
        import Settings
        section = Settings.g_instance.userPrefs
        if section.has_key(Settings.KEY_MESSENGER_PREFERENCES):
            subSec = section[Settings.KEY_MESSENGER_PREFERENCES]
            tags = subSec.keys()
            _userProps = {
                GAME.DATE_TIME_MESSAGE_INDEX: 'readInt',
                GAME.ENABLE_OL_FILTER: 'readBool',
                GAME.ENABLE_SPAM_FILTER: 'readBool',
                GAME.INVITES_FROM_FRIENDS: 'readBool',
                GAME.RECEIVE_FRIENDSHIP_REQUEST: 'readBool',
                GAME.RECEIVE_INVITES_IN_BATTLE: 'readBool',
                GAME.STORE_RECEIVER_IN_BATTLE: 'readBool',
                GAME.CHAT_CONTACTS_LIST_ONLY: 'readBool'
            }
            for key, reader in _userProps.iteritems():
                if key in tags:
                    gameData[key] = getattr(subSec, reader)(key)

        try:
            value = section['replayPrefs'].readBool('enabled', None)
            if value:
                gameData[GAME.REPLAY_ENABLED] = 2
            elif value is not None:
                gameData[GAME.REPLAY_ENABLED] = 0
        except:
            LOG_DEBUG('Replay preferences is not available.')

        gameData[GAME.ENABLE_SERVER_AIM] = AccountSettings.getSettings(
            'useServerAim')
        gameData[GAME.SHOW_VEHICLES_COUNTER] = AccountSettings.getSettings(
            'showVehiclesCounter')
        gameData[GAME.MINIMAP_ALPHA] = AccountSettings.getSettings(
            'minimapAlpha')
        gameData[
            GAME.PLAYERS_PANELS_SHOW_LEVELS] = AccountSettings.getSettings(
                'players_panel')['showLevels']
        gameplayData[GAME.GAMEPLAY_MASK] = AccountSettings.getSettings(
            'gameplayMask')
        arcade = AccountSettings.getSettings('arcade')
        sniper = AccountSettings.getSettings('sniper')
        aimData['arcade'] = core.options.getSetting(
            'arcade').fromAccountSettings(arcade)
        aimData['sniper'] = core.options.getSetting(
            'sniper').fromAccountSettings(sniper)
        from post_processing import g_postProcessing
        gameData[GAME.ENABLE_POSTMORTEM] = g_postProcessing.getSetting(
            'mortem_post_effect')
        if section.has_key(Settings.KEY_CONTROL_MODE):
            ds = section[Settings.KEY_CONTROL_MODE]
            try:
                controlsData[
                    CONTROLS.MOUSE_HORZ_INVERSION] = ds['arcadeMode'].readBool(
                        'horzInvert', False)
                controlsData[
                    CONTROLS.MOUSE_VERT_INVERSION] = ds['arcadeMode'].readBool(
                        'vertInvert', False)
                controlsData[
                    CONTROLS.MOUSE_VERT_INVERSION] = ds['arcadeMode'].readBool(
                        'backDraftInvert', False)
            except:
                LOG_DEBUG('Controls preferences is not available.')

    data['markersData'] = AccountSettings.getSettings('markers')
    data['graphicsData'] = {
        GAME.LENS_EFFECT: core.getSetting(GAME.LENS_EFFECT)
    }
    data['marksOnGun'] = {
        GAME.SHOW_MARKS_ON_GUN: core.getSetting(GAME.SHOW_MARKS_ON_GUN)
    }
    return
def getVisitedIDs(customizationName):
    result = []
    data = dict(AccountSettings.getSettings('customization'))
    if customizationName in data:
        result = data[customizationName]
    return result
def getRosterIntroWindowSetting(type):
    settings = dict(AccountSettings.getSettings('fortSettings'))
    if ROSTER_INTRO_WINDOW not in settings:
        settings[ROSTER_INTRO_WINDOW] = {}
        AccountSettings.setSettings('fortSettings', settings)
    return settings[ROSTER_INTRO_WINDOW].get(type)
Example #23
0
 def __setViewed(self):
     if not AccountSettings.getSettings(NATION_CHANGE_VIEWED):
         AccountSettings.setSettings(NATION_CHANGE_VIEWED, True)
Example #24
0
    def __update(self):
        newElements = AccountSettings.getSettings("customization")
        newElementsSubset = newElements[self.__currentType].get(self.__currentVehicle.item.intCD, {})
        installedItems = defaultdict(list)
        purchasedItems = defaultdict(list)
        otherItems = defaultdict(list)
        allItems = [installedItems, purchasedItems, otherItems]
        currentSlotElement = self.__slots.getCurrentSlotData()["element"]
        installedSlotElement = self.__slots.getInstalledSlotData()["element"]
        currentCarouselItem = None
        self.__hasAppliedItem = False
        for elementID, element in self.__displayedElements[self.__currentType].iteritems():
            installedInCurrentSlot = False
            if installedSlotElement is not None:
                installedInCurrentSlot = elementID == installedSlotElement.getID()
            if self.__filter.check(element, installedInCurrentSlot):
                appliedToCurrentSlot = False
                if currentSlotElement is not None:
                    appliedToCurrentSlot = elementID == currentSlotElement.getID() and not installedInCurrentSlot
                if not self.__hasAppliedItem and appliedToCurrentSlot:
                    self.__hasAppliedItem = True
                if elementID in newElementsSubset:
                    isNewElement = newElementsSubset[elementID]
                    newElementsSubset[elementID] = False
                else:
                    isNewElement = False
                carouselItem = {
                    "element": element,
                    "appliedToCurrentSlot": appliedToCurrentSlot,
                    "duration": self.__currentDuration,
                    "isNewElement": isNewElement,
                    "installedInCurrentSlot": installedInCurrentSlot,
                }
                if installedInCurrentSlot:
                    group = installedItems[element.getGroup()]
                elif element.isInDossier:
                    group = purchasedItems[element.getGroup()]
                else:
                    group = otherItems[element.getGroup()]
                if element.isFeatured:
                    group.insert(0, carouselItem)
                else:
                    group.append(carouselItem)
                if appliedToCurrentSlot:
                    currentCarouselItem = carouselItem

        AccountSettings.setSettings("customization", newElements)
        previousItemsCount = len(self.__carouselItems)
        del self.__carouselItems[:]
        for groupedItems in allItems:
            self.__carouselItems += chain(*groupedItems.values())

        currentItemsCount = len(self.__carouselItems)
        if currentCarouselItem is not None:
            self.__goToIndex = self.__carouselItems.index(currentCarouselItem)
        else:
            self.__goToIndex = -1 if previousItemsCount == currentItemsCount else 0
        if self.__currentType == CUSTOMIZATION_TYPE.CAMOUFLAGE:
            unfilteredLength = len(self.__carouselItems)
        else:
            unfilteredLength = len(self.__displayedElements[self.__currentType])
        self.__events.onCarouselUpdated(
            {
                "items": self.__carouselItems,
                "rendererWidth": _RENDERER_WIDTH[self.__currentType],
                "goToIndex": self.__goToIndex,
                "unfilteredLength": unfilteredLength,
                "hasAppliedItem": self.__hasAppliedItem,
            }
        )
        return
Example #25
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
Example #26
0
 def _getSetting(self):
     return AccountSettings.getSettings(CheckBoxConfirmator.__ACC_SETT_MAIN_KEY)
def _checkBattleConsumesIntro(fort):
    settings = dict(AccountSettings.getSettings('fortSettings'))
    if not settings.get('battleConsumesIntroShown') and not fort.isStartingScriptNotStarted():
        fort_events.showBattleConsumesIntro()
    settings['battleConsumesIntroShown'] = True
    AccountSettings.setSettings('fortSettings', settings)
Example #28
0
 def getDialogSettings(self):
     return dict(AccountSettings.getSettings('vehicleSellDialog'))
def setRosterIntroWindowSetting(type, value = True):
    settings = dict(AccountSettings.getSettings('fortSettings'))
    if ROSTER_INTRO_WINDOW not in settings:
        settings[ROSTER_INTRO_WINDOW] = {}
    settings[ROSTER_INTRO_WINDOW][type] = value
    AccountSettings.setSettings('fortSettings', settings)
Example #30
0
def _getDialogSettings():
    return dict(AccountSettings.getSettings(_SETTINGS_KEY))
def setBattleTypeAsKnown(bType):
    selectorKnownBattles = set(
        AccountSettings.getSettings(KNOWN_SELECTOR_BATTLES))
    selectorKnownBattles.add(bType)
    AccountSettings.setSettings(KNOWN_SELECTOR_BATTLES, selectorKnownBattles)
def isKnownBattleType(bType):
    selectorKnownBattles = set(
        AccountSettings.getSettings(KNOWN_SELECTOR_BATTLES))
    return bType in selectorKnownBattles
Example #33
0
def updateQuestSettings(quests):
    s = dict(AccountSettings.getSettings('quests'))
    completed = set((q.getID() for q in quests.itervalues() if q.isCompleted()))
    s['visited'] = tuple(set(s.get('visited', [])).difference(completed))
    s['naVisited'] = tuple(set(s.get('naVisited', [])).difference(completed))
    AccountSettings.setSettings('quests', s)
Example #34
0
 def __setCurrentLevelState(self, model=None):
     currentChapter = self.__battlePassController.getCurrentChapter()
     pointsBeforeChapterStart = self.__battlePassController.getFullChapterPoints(
         self.__chosenChapter, False)
     minLevel, maxLevel = self.__battlePassController.getChapterLevelInterval(
         self.__chosenChapter)
     if self.__chosenChapter == currentChapter:
         previousTotalPoints = AccountSettings.getSettings(
             LAST_BATTLE_PASS_POINTS_SEEN)
         currentTotalPoints = self.__battlePassController.getCurrentPoints()
         AccountSettings.setSettings(LAST_BATTLE_PASS_POINTS_SEEN,
                                     currentTotalPoints)
     elif self.__chosenChapter < currentChapter:
         previousTotalPoints = currentTotalPoints = self.__battlePassController.getFullChapterPoints(
             self.__chosenChapter, True)
     else:
         previousTotalPoints = currentTotalPoints = pointsBeforeChapterStart
     _, previousLevel = self.__battlePassController.getLevelByPoints(
         previousTotalPoints)
     previousPoints, _ = self.__battlePassController.getProgressionByPoints(
         previousTotalPoints, previousLevel)
     previousLevel += 1
     _, currentLevel = self.__battlePassController.getLevelByPoints(
         currentTotalPoints)
     currentLevel += 1
     if previousTotalPoints > currentTotalPoints or previousLevel > currentLevel:
         previousLevel = minLevel
         previousTotalPoints = pointsBeforeChapterStart
     previousLevel = min(max(previousLevel, minLevel - 1), maxLevel + 1)
     currentLevel = min(max(currentLevel, minLevel - 1), maxLevel + 1)
     previousTotalPoints = max(
         0, previousTotalPoints - pointsBeforeChapterStart)
     currentTotalPoints -= pointsBeforeChapterStart
     isBattlePassBought = self.__battlePassController.isBought(
         chapter=self.__chosenChapter)
     chapterConfig = self.__battlePassController.getChapterConfig()
     model.setChapterCount(len(chapterConfig))
     model.setChapterStep(first(chapterConfig, default=0))
     model.setChosenChapter(self.__chosenChapter)
     model.setCurrentChapter(currentChapter)
     model.setPointsBeforeStart(pointsBeforeChapterStart)
     chapterText = backport.text(
         _rBattlePass.progression.chapterText(),
         chapter=backport.text(
             _rBattlePass.chapter.name.num(self.__chosenChapter)()),
         chapterName=backport.text(
             _rBattlePass.chapter.fullName.num(self.__chosenChapter)()))
     model.setChapterText(chapterText)
     model.setPreviousAllPoints(previousTotalPoints)
     model.setPreviousPoints(previousPoints)
     model.setPreviousLevel(previousLevel)
     model.setCurrentAllPoints(currentTotalPoints)
     currentPoints, levelPoints = self.__battlePassController.getLevelProgression(
     )
     if self.__chosenChapter != currentChapter:
         currentPoints = 0
         currentLevel = self.__battlePassController.getCurrentLevel() + 1
     currentLevel = min(currentLevel,
                        self.__battlePassController.getMaxLevel())
     model.setCurrentPoints(currentPoints)
     model.setTotalPoints(levelPoints)
     model.setCurrentLevel(currentLevel)
     model.setIsBattlePassPurchased(isBattlePassBought)
     model.setIsPaused(self.__battlePassController.isPaused())
     model.setSeasonTimeLeft(
         getFormattedTimeLeft(
             self.__battlePassController.getSeasonTimeLeft()))
     if self.__battlePassController.isSeasonFinished():
         model.setSeasonText(
             backport.text(_rBattlePass.commonProgression.body.ended()))
     else:
         seasonNum = self.__battlePassController.getSeasonNum()
         timeEnd = self.__battlePassController.getSeasonFinishTime()
         model.setSeasonText(self.__makeSeasonTimeText(timeEnd, seasonNum))
     self.__updateRewardSelectButton(model=model)
 def __updateModuleButtonBubble(self):
     self.__isModuleViewed = AccountSettings.getSettings(
         BATTLE_ROYALE_HANGAR_BOTTOM_PANEL_VIEWED)
     self.viewModel.setIsModuleFirstEnter(not self.__isModuleViewed)
 def __isNewBuilding(cls, buildTypeID):
     fortSettings = dict(AccountSettings.getSettings('fortSettings'))
     if 'visitedBuildings' not in fortSettings:
         fortSettings['visitedBuildings'] = DEFAULT_VALUES['settings']['fortSettings']['visitedBuildings']
     return buildTypeID not in fortSettings['visitedBuildings']
Example #37
0
def getNewQuests(quests):
    storedSettings = AccountSettings.getSettings('quests')
    return filter(lambda q: isNewQuest(q, storedSettings), quests.itervalues())
 def __isHintVisible(self):
     prefSetting = AccountSettings.getSettings(SHOW_OPT_DEVICE_HINT)
     return prefSetting and self.itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY_OR_UNLOCKED | REQ_CRITERIA.VEHICLE.LEVELS(_POPOVER_OVERLAY_VEH_LVL_RANGE))
 def __init__(self, ctx=None):
     super(ColorSettingsTipPanel, self).__init__()
     battlesCount = AccountSettings.getSettings(COLOR_SETTINGS_SHOWS_COUNT)
     self.__isActive = battlesCount <= self.MAX_BATTLES_COUNT and isRendererPipelineDeferred()
     if self.__isActive:
         AccountSettings.setSettings(COLOR_SETTINGS_SHOWS_COUNT, battlesCount + 1)
Example #40
0
 def isRequiredToShow(self):
     playerHelpVersion = int(AccountSettings.getSettings('ingameHelpVersion'))
     return constants.IS_SHOW_INGAME_HELP_FIRST_TIME and self.__version is not -1 and playerHelpVersion is not self.__version
def setBattleTypeAsKnown(bType):
    selectorKnownBattles = set(AccountSettings.getSettings(KNOWN_SELECTOR_BATTLES))
    selectorKnownBattles.add(bType)
    AccountSettings.setSettings(KNOWN_SELECTOR_BATTLES, selectorKnownBattles)
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE, self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:', self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = (tankMenStudyPrice[1]['credits'] * tankMenCount, tankMenStudyPrice[2]['gold'] * tankMenCount)
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = (defTankMenStudyPrice[1]['credits'] * tankMenCount, defTankMenStudyPrice[2]['gold'] * tankMenCount)
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice[0] != defTotalTankMenStudePrice[0]:
                studyPriceCreditsActionData = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                 'key': 'creditsTankmanCost',
                 'isBuying': True,
                 'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                 'newPrice': (totalTankMenStudePrice[0], 0),
                 'oldPrice': (defTotalTankMenStudePrice[0], 0)}
            studyPriceGoldActionData = None
            if totalTankMenStudePrice[1] != defTotalTankMenStudePrice[1]:
                studyPriceGoldActionData = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                 'key': 'goldTankmanCost',
                 'isBuying': True,
                 'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                 'newPrice': (0, totalTankMenStudePrice[1]),
                 'oldPrice': (0, defTotalTankMenStudePrice[1])}
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = getItemActionTooltipData(vehicle)
            ammoPrice = [0, 0]
            defAmmoPrice = [0, 0]
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice[0] += shell.buyPrice[0] * shell.defaultCount
                ammoPrice[1] += shell.buyPrice[1] * shell.defaultCount
                defAmmoPrice[0] += shell.defaultPrice[0] * shell.defaultCount
                defAmmoPrice[1] += shell.defaultPrice[1] * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice[0] != defAmmoPrice[0]:
                ammoActionPriceData = {'type': ACTION_TOOLTIPS_TYPE.AMMO,
                 'key': str(vehicle.intCD),
                 'isBuying': True,
                 'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                 'newPrice': ammoPrice,
                 'oldPrice': defAmmoPrice}
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                 'key': 'slotsPrices',
                 'isBuying': True,
                 'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                 'newPrice': (0, slotPrice),
                 'oldPrice': (0, slotDefaultPrice)}
            tankmenLabel = i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL, count=text_styles.titleFont(i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' + str(tankMenCount)))
            initData = {'expanded': windowExpanded,
             'name': vehicle.userName,
             'longName': vehicle.longUserName,
             'description': vehicle.fullDescription,
             'type': vehicle.type,
             'icon': vehicle.icon,
             'nation': self.nationID,
             'level': vehicle.level,
             'isElite': vehicle.isElite,
             'tankmenLabel': tankmenLabel,
             'studyPriceCredits': totalTankMenStudePrice[0],
             'studyPriceCreditsActionData': studyPriceCreditsActionData,
             'studyPriceGold': totalTankMenStudePrice[1],
             'studyPriceGoldActionData': studyPriceGoldActionData,
             'vehiclePrices': vehicle.buyPrice,
             'vehiclePricesActionData': vehiclePricesActionData,
             'ammoPrice': ammoPrice[0],
             'ammoActionPriceData': ammoActionPriceData,
             'slotPrice': slotPrice,
             'slotActionPriceData': slotActionPriceData,
             'isRentable': vehicle.isRentable,
             'isStudyDisabled': vehicle.hasCrew,
             'isNoAmmo': not vehicle.hasShells,
             'rentDataDD': self._getRentData(vehicle, vehiclePricesActionData)}
            self.as_setInitDataS(initData)
        return
Example #43
0
    def apply(self, restartApproved, callbackId, settings):
        restartClient = False
        import VOIP
        ppSettings = dict(AccountSettings.getSettings('players_panel'))
        ppSettings['showTypes'] = settings['ppShowTypes']
        if (not self.resolutions.isVideoWindowed or settings['fullScreen']
            ) and (settings['monitor'] != self.resolutions.realMonitorIndex
                   or self.resolutions.monitorChanged):
            restartClient = True
        AccountSettings.setSettings('players_panel', ppSettings)
        g_settingsCore.applySetting('ppShowLevels', settings['ppShowLevels'])
        g_settingsCore.applySetting('replayEnabled', settings['replayEnabled'])
        g_settingsCore.applySetting('fpsPerfomancer',
                                    settings['fpsPerfomancer'])
        AccountSettings.setSettings('nationalVoices',
                                    settings['nationalVoices'])
        AccountSettings.setSettings('isColorBlind', settings['isColorBlind'])
        g_settingsCore.applySetting('useServerAim', settings['useServerAim'])
        g_settingsCore.applySetting('showVehiclesCounter',
                                    settings['showVehiclesCounter'])
        g_settingsCore.applySetting('minimapAlpha', settings['minimapAlpha'])
        arcade = g_settingsCore.options.getSetting(
            'arcade').fromAccountSettings(settings['arcade'])
        sniper = g_settingsCore.options.getSetting(
            'sniper').fromAccountSettings(settings['sniper'])
        g_settingsCore.applySetting('arcade', arcade)
        g_settingsCore.applySetting('sniper', sniper)
        g_settingsCore.applySetting('enemy', settings['markers']['enemy'])
        g_settingsCore.applySetting('dead', settings['markers']['dead'])
        g_settingsCore.applySetting('ally', settings['markers']['ally'])
        g_settingsCore.applySetting('dynamicCamera', settings['dynamicCamera'])
        g_settingsCore.applySetting('horStabilizationSnp',
                                    settings['horStabilizationSnp'])
        if self.__altVoiceSetting.isOptionEnabled():
            altVoices = settings.get('alternativeVoices')
            if altVoices is not None:
                self.__altVoiceSetting.apply(altVoices)
        vManager = VibroManager.g_instance
        vManager.setGain(settings['vibroGain'] / 100.0)
        vEffGroups = vManager.getGroupsSettings()
        for groupName, newValue in [
            ('engine', settings['vibroEngine']),
            ('acceleration', settings['vibroAcceleration']),
            ('shots', settings['vibroShots']), ('hits', settings['vibroHits']),
            ('collisions', settings['vibroCollisions']),
            ('damage', settings['vibroDamage']), ('gui', settings['vibroGUI'])
        ]:
            if groupName in vEffGroups:
                vEffGroups[groupName].gain = newValue / 100.0
                vEffGroups[groupName].enabled = newValue > 0

        vManager.setGroupsSettings(vEffGroups)
        self.__voiceChatEnable(settings['enableVoIP'])
        self.__changeCaptureDevice(settings[Settings.KEY_VOIP_DEVICE])
        g_settingsCore.applySetting('enablePostMortemEffect',
                                    settings['enablePostMortemEffect'])
        self.uiHolder.clearCommands()
        keyboard = settings['controls']['keyboard']
        keyboardMapping = {}
        keysLayout = dict(
            g_settingsCore.options.getSetting('keyboard').KEYS_LAYOUT)
        layout = list(itertools.chain(*keysLayout.values()))
        for i in xrange(len(self.KEYBOARD_MAPPING_BLOCKS)):
            group_name = keyboard[i]['id']
            for j in xrange(len(self.KEYBOARD_MAPPING_BLOCKS[group_name])):
                key_name = keyboard[i]['commands'][j]['id']
                value = keyboard[i]['commands'][j]['key']
                cmd = self.KEYBOARD_MAPPING_COMMANDS[group_name][key_name]
                for item in layout:
                    key, command = item[0], item[1]
                    if command == cmd:
                        keyboardMapping[key] = value
                        break

        g_settingsCore.applySetting('keyboard', keyboardMapping)
        self.uiHolder.bindCommands()
        player = BigWorld.player()
        mouse = settings['controls']['mouse']
        if hasattr(player.inputHandler, 'ctrls'):
            player.inputHandler.ctrls['arcade'].camera.setUserConfigValue(
                'sensitivity', mouse['arcadeSens']['value'])
            player.inputHandler.ctrls['sniper'].camera.setUserConfigValue(
                'sensitivity', mouse['sniperSens']['value'])
            player.inputHandler.ctrls['strategic'].camera.setUserConfigValue(
                'sensitivity', mouse['artSens']['value'])
        else:
            ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
            if ds:
                ds['arcadeMode/camera'].writeFloat(
                    'sensitivity', mouse['arcadeSens']['value'])
                ds['sniperMode/camera'].writeFloat(
                    'sensitivity', mouse['sniperSens']['value'])
                ds['strategicMode/camera'].writeFloat(
                    'sensitivity', mouse['artSens']['value'])
        g_settingsCore.applySetting('mouseHorzInvert',
                                    bool(mouse['horInvert']['value']))
        g_settingsCore.applySetting('mouseVertInvert',
                                    bool(mouse['vertInvert']['value']))
        g_settingsCore.applySetting('backDraftInvert',
                                    bool(mouse['backDraftInvert']['value']))
        self.resolutions.applyChanges(
            settings['fullScreen'], settings['vertSync'],
            settings['tripleBuffered'], settings['windowSize']
            if not settings['fullScreen'] else settings['resolution'],
            settings['aspectRatio'], settings['multisampling'],
            settings['customAA'], settings['gamma'], settings['monitor'])
        if round(SoundGroups.g_instance.getVolume('masterVivox') *
                 100) != settings['masterVivoxVolume']:
            VOIP.getVOIPManager().setMasterVolume(
                settings['masterVivoxVolume'])
        if round(SoundGroups.g_instance.getVolume('micVivox') *
                 100) != settings['micVivoxVolume']:
            VOIP.getVOIPManager().setMicrophoneVolume(
                settings['micVivoxVolume'])
        SoundGroups.g_instance.setMasterVolume(
            float(settings['masterVolume']) / 100)
        SoundGroups.g_instance.setVolume('music',
                                         float(settings['musicVolume']) / 100)
        SoundGroups.g_instance.setVolume('voice',
                                         float(settings['voiceVolume']) / 100)
        SoundGroups.g_instance.setVolume(
            'vehicles',
            float(settings['vehiclesVolume']) / 100)
        SoundGroups.g_instance.setVolume(
            'effects',
            float(settings['effectsVolume']) / 100)
        SoundGroups.g_instance.setVolume('gui',
                                         float(settings['guiVolume']) / 100)
        SoundGroups.g_instance.setVolume(
            'ambient',
            float(settings['ambientVolume']) / 100)
        SoundGroups.g_instance.setVolume(
            'masterVivox',
            float(settings['masterVivoxVolume']) / 100)
        SoundGroups.g_instance.setVolume(
            'micVivox',
            float(settings['micVivoxVolume']) / 100)
        SoundGroups.g_instance.setVolume(
            'masterFadeVivox',
            float(settings['masterFadeVivoxVolume']) / 100)
        if len(VOIP.getVOIPManager().captureDevices):
            device = VOIP.getVOIPManager().captureDevices[0]
            if len(VOIP.getVOIPManager().captureDevices
                   ) > settings['captureDevice']:
                device = VOIP.getVOIPManager().captureDevices[
                    settings['captureDevice']]
            VOIP.getVOIPManager().setCaptureDevice(device)
        g_settingsCore.applySetting('showDateMessage',
                                    settings['datetimeIdx'] & 1)
        g_settingsCore.applySetting('showTimeMessage',
                                    settings['datetimeIdx'] & 2)
        g_settingsCore.applySetting('enableOlFilter',
                                    settings['enableOlFilter'])
        g_settingsCore.applySetting('enableSpamFilter',
                                    settings['enableSpamFilter'])
        g_windowsStoredData.start()
        g_settingsCore.applySetting('enableStoreMws',
                                    settings['enableStoreChatMws'])
        g_settingsCore.applySetting('enableStoreCws',
                                    settings['enableStoreChatCws'])
        g_windowsStoredData.stop()
        g_settingsCore.applySetting('invitesFromFriendsOnly',
                                    settings['invitesFromFriendsOnly'])
        g_settingsCore.applySetting('storeReceiverInBattle',
                                    settings['storeReceiverInBattle'])
        gameplayKeys = filter(
            lambda item: item.startswith(self.GAMEPLAY_PREFIX) and bool(
                settings[item]), settings.keys())
        prefixLen = len(self.GAMEPLAY_PREFIX)
        gameplay_ctx.setMaskByNames(
            map(lambda key: str(key[prefixLen:]), gameplayKeys))
        qualitySettings = settings['quality']
        applyPresets = self.graphicsPresets.checkApplyGraphicsPreset(
            int(settings['graphicsQuality']), qualitySettings)
        if applyPresets:
            self.graphicsPresets.applyGraphicsPresets(
                int(settings['graphicsQuality']), qualitySettings)
            if applyPresets == 'restartNeeded':
                BigWorld.commitPendingGraphicsSettings()
                restartClient = True
            elif applyPresets == 'hasPendingSettings':
                BigWorld.commitPendingGraphicsSettings()
        g_settingsCore.applyStorages()
        g_postProcessing.refresh()
        if restartClient:
            BigWorld.savePreferences()
            if restartApproved:
                from BattleReplay import g_replayCtrl
                if g_replayCtrl.isPlaying and g_replayCtrl.playbackSpeed == 0:
                    g_replayCtrl.setPlaybackSpeedIdx(5)
                BigWorld.callback(0.3, BigWorld.restartGame)
            else:
                BigWorld.callback(
                    0.0,
                    partial(BigWorld.changeVideoMode, -1,
                            BigWorld.isVideoWindowed()))
        return
Example #44
0
 def _convert(self, value, reusable):
     return bool(AccountSettings.getSettings(ENABLE_RANKED_ANIMATIONS))
Example #45
0
 def update(self):
     prbDispatcher = g_prbLoader.getDispatcher()
     if not prbDispatcher:
         return
     else:
         prbFunctional = prbDispatcher.getPrbFunctional()
         hasModalEntity, prbType = prbDispatcher.getFunctionalState()
         inPrebattle = prbType is not 0
         isTraining = prbType is PREBATTLE_TYPE.TRAINING
         disableHint = None
         disabled = False
         if self.__isActionsLocked:
             disabled = True
         else:
             canDo, restriction = prbDispatcher.canPlayerDoAction()
             if not canDo:
                 disabled = True
                 disableHint = getActionDisabledTooltip(
                     restriction, functional=prbFunctional)
         self.__disableFightButton(disabled, disableHint)
         label = MENU.HEADERBUTTONS_BATTLE
         isCreator = prbFunctional.isCreator()
         if not isTraining and not isCreator:
             playerInfo = prbFunctional.getPlayerInfo()
             if inPrebattle and playerInfo is not None:
                 if playerInfo.isReady():
                     label = MENU.HEADERBUTTONS_NOTREADY
                 else:
                     label = MENU.HEADERBUTTONS_READY
         if prbDispatcher.getUnitFunctional().hasEntity():
             menu = MENU.HEADERBUTTONS_BATTLE_MENU_UNIT
         else:
             menu = self.__menuLabels.get(
                 prbType, MENU.HEADERBUTTONS_BATTLE_MENU_STANDART)
         fightTypes = list()
         if self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART,
                 'data':
                 PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE,
                 'disabled':
                 True,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_STANDART,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_STANDARTLEAVE_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE,
                 'active':
                 True
             })
         else:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART,
                 'data':
                 PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE,
                 'disabled':
                 disabled or hasModalEntity,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_STANDART,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_STANDART_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.JOIN_RANDOM_QUEUE,
                 'active':
                 False
             })
         if prbType is PREBATTLE_TYPE.SQUAD:
             fightTypes.append({
                 'label':
                 '#menu:headerButtons/battle/types/squadLeave%s' %
                 ('Owner' if isCreator else ''),
                 'data':
                 PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE,
                 'disabled':
                 self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_SQUADLEAVE,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_SQUADLEAVE_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.SQUAD,
                 'active':
                 True
             })
         else:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_SQUAD,
                 'data':
                 PREBATTLE_ACTION_NAME.SQUAD,
                 'disabled':
                 disabled or hasModalEntity,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_SQUAD,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_SQUAD_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.SQUAD,
                 'active':
                 False
             })
         units = AccountSettings.getSettings('unitWindow')
         if prbType is PREBATTLE_TYPE.UNIT:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_UNITLEAVE,
                 'data':
                 PREBATTLE_ACTION_NAME.UNIT_LEAVE,
                 'disabled':
                 False,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_LEAVEUNIT,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVEUNIT_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.UNIT,
                 'active':
                 True,
                 'isUnitOpened':
                 units['isOpened']
             })
         else:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_UNIT,
                 'data':
                 PREBATTLE_ACTION_NAME.UNIT,
                 'disabled':
                 disabled or inPrebattle,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_UNIT,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_UNIT_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.UNIT,
                 'active':
                 False,
                 'isUnitOpened':
                 units['isOpened']
             })
         if prbType is PREBATTLE_TYPE.COMPANY:
             fightTypes.append({
                 'label':
                 '#menu:headerButtons/battle/types/companyLeave%s' %
                 ('Owner' if isCreator else ''),
                 'data':
                 PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE,
                 'disabled':
                 self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_LEAVECOMPANY,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVECOMPANY_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.COMPANY_LIST,
                 'active':
                 True
             })
         else:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_COMPANY,
                 'data':
                 PREBATTLE_ACTION_NAME.COMPANY_LIST,
                 'disabled':
                 disabled or hasModalEntity,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_COMPANY,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_COMPANY_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.COMPANY_LIST,
                 'active':
                 False
             })
         if GUI_SETTINGS.specPrebatlesVisible:
             if prbType in [PREBATTLE_TYPE.CLAN, PREBATTLE_TYPE.TOURNAMENT]:
                 fightTypes.append({
                     'label':
                     MENU.HEADERBUTTONS_BATTLE_TYPES_SPECLEAVE,
                     'data':
                     PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE,
                     'disabled':
                     False,
                     'tooltip':
                     TOOLTIPS.BATTLETYPES_LEAVESPEC,
                     'description':
                     i18n.makeString(
                         MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVESPEC_DESCR),
                     'icon':
                     PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST,
                     'active':
                     True
                 })
             else:
                 fightTypes.append({
                     'label':
                     MENU.HEADERBUTTONS_BATTLE_TYPES_SPEC,
                     'data':
                     PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST,
                     'disabled':
                     disabled or hasModalEntity or areSpecBattlesHidden(),
                     'tooltip':
                     TOOLTIPS.BATTLETYPES_SPEC,
                     'description':
                     i18n.makeString(
                         MENU.HEADERBUTTONS_BATTLE_TYPES_SPEC_DESCR),
                     'icon':
                     PREBATTLE_ACTION_NAME.SPEC_BATTLE_LIST,
                     'active':
                     False
                 })
         if isTraining:
             fightTypes.append({
                 'label':
                 '#menu:headerButtons/battle/types/trainingLeave%s' %
                 ('Owner' if isCreator else ''),
                 'data':
                 PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE,
                 'disabled':
                 False,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_LEAVETRAINING,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVETRAINING_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.TRAINING_LIST,
                 'active':
                 True
             })
         elif self.__currentLockedView == VIEW_ALIAS.LOBBY_TRAININGS:
             menu = MENU.HEADERBUTTONS_BATTLE_MENU_TRAINING
             fightTypes.append({
                 'label':
                 '#menu:headerButtons/battle/types/trainingLeave',
                 'data':
                 PREBATTLE_ACTION_NAME.LEAVE_TRAINING_LIST,
                 'disabled':
                 False,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_LEAVETRAINING,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_LEAVETRAINING_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.TRAINING_LIST,
                 'active':
                 True
             })
         else:
             fightTypes.append({
                 'label':
                 MENU.HEADERBUTTONS_BATTLE_TYPES_TRAINING,
                 'data':
                 PREBATTLE_ACTION_NAME.TRAINING_LIST,
                 'disabled':
                 disabled or hasModalEntity,
                 'tooltip':
                 TOOLTIPS.BATTLETYPES_TRAINING,
                 'description':
                 i18n.makeString(
                     MENU.HEADERBUTTONS_BATTLE_TYPES_TRAINING_DESCR),
                 'icon':
                 PREBATTLE_ACTION_NAME.TRAINING_LIST,
                 'active':
                 False
             })
         disableDropDown = self.__currentLockedView == VIEW_ALIAS.BATTLE_QUEUE
         self.__onFightButtonSet(label, menu, fightTypes, disableDropDown)
         self.fireEvent(events.LobbySimpleEvent(
             events.LobbySimpleEvent.UPDATE_TANK_PARAMS),
                        scope=EVENT_BUS_SCOPE.LOBBY)
         return
def isKnownBattleType(bType):
    selectorKnownBattles = set(AccountSettings.getSettings(KNOWN_SELECTOR_BATTLES))
    return bType in selectorKnownBattles
Example #47
0
 def __getSettings(self):
     return AccountSettings.getSettings(self.settingName)
Example #48
0
 def isOn(self):
     var = self.getVar()
     if var:
         return var['value'] == AccountSettings.getSettings(var['key'])
     return False
 def __isNewBuilding(cls, buildTypeID):
     fortSettings = dict(AccountSettings.getSettings('fortSettings'))
     if 'visitedBuildings' not in fortSettings:
         fortSettings['visitedBuildings'] = DEFAULT_VALUES['settings']['fortSettings']['visitedBuildings']
     return buildTypeID not in fortSettings['visitedBuildings']
 def __markAsVisited(cls, buildTypeID):
     fortSettings = dict(AccountSettings.getSettings('fortSettings'))
     if 'visitedBuildings' not in fortSettings:
         fortSettings['visitedBuildings'] = DEFAULT_VALUES['settings']['fortSettings']['visitedBuildings']
     fortSettings['visitedBuildings'].add(buildTypeID)
     AccountSettings.setSettings('fortSettings', fortSettings)
def saveBattlePassStateForItem(modeSelectorItem, value):
    bpSettings = AccountSettings.getSettings(MODE_SELECTOR_BATTLE_PASS_SHOWN)
    bpSettings[modeSelectorItem] = value
    AccountSettings.setSettings(MODE_SELECTOR_BATTLE_PASS_SHOWN, bpSettings)
Example #52
0
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE, self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:', self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = tankMenCount * Money(credits=tankMenStudyPrice[1]['credits'], gold=tankMenStudyPrice[2]['gold'])
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = tankMenCount * Money(credits=defTankMenStudyPrice[1]['credits'], gold=defTankMenStudyPrice[2]['gold'])
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceCreditsActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True, totalTankMenStudePrice, defTotalTankMenStudePrice)
            studyPriceGoldActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceGoldActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True, totalTankMenStudePrice, defTotalTankMenStudePrice)
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = packItemActionTooltipData(vehicle)
            ammoPrice = ZERO_MONEY
            defAmmoPrice = ZERO_MONEY
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice += shell.buyPrice * shell.defaultCount
                defAmmoPrice += shell.defaultPrice * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice != defAmmoPrice:
                ammoActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.AMMO, str(vehicle.intCD), True, ammoPrice, defAmmoPrice)
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=slotDefaultPrice))
            tankmenLabel = i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL, count=text_styles.titleFont(i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' + str(tankMenCount)))
            initData = {'expanded': windowExpanded,
             'name': vehicle.userName,
             'shortName': vehicle.shortUserName,
             'longName': vehicle.longUserName,
             'description': vehicle.fullDescription,
             'type': vehicle.type,
             'icon': vehicle.icon,
             'nation': self.nationID,
             'level': vehicle.level,
             'isElite': vehicle.isElite,
             'tankmenLabel': tankmenLabel,
             'studyPriceCredits': totalTankMenStudePrice.credits,
             'studyPriceCreditsActionData': studyPriceCreditsActionData,
             'studyPriceGold': totalTankMenStudePrice.gold,
             'studyPriceGoldActionData': studyPriceGoldActionData,
             'vehiclePrices': vehicle.buyPrice,
             'vehiclePricesActionData': vehiclePricesActionData,
             'ammoPrice': ammoPrice.credits,
             'ammoActionPriceData': ammoActionPriceData,
             'slotPrice': slotPrice,
             'slotActionPriceData': slotActionPriceData,
             'isRentable': vehicle.isRentable,
             'isStudyDisabled': vehicle.hasCrew,
             'isNoAmmo': not vehicle.hasShells,
             'rentDataDD': self._getRentData(vehicle, vehiclePricesActionData)}
            self.as_setInitDataS(initData)
        return
Example #53
0
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(
            VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE,
                                             self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:',
                      self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = (tankMenStudyPrice[1]['credits'] *
                                      tankMenCount,
                                      tankMenStudyPrice[2]['gold'] *
                                      tankMenCount)
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = (defTankMenStudyPrice[1]['credits'] *
                                         tankMenCount,
                                         defTankMenStudyPrice[2]['gold'] *
                                         tankMenCount)
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice[0] != defTotalTankMenStudePrice[0]:
                studyPriceCreditsActionData = {
                    'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                    'key': 'creditsTankmanCost',
                    'isBuying': True,
                    'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                    'newPrice': (totalTankMenStudePrice[0], 0),
                    'oldPrice': (defTotalTankMenStudePrice[0], 0)
                }
            studyPriceGoldActionData = None
            if totalTankMenStudePrice[1] != defTotalTankMenStudePrice[1]:
                studyPriceGoldActionData = {
                    'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                    'key': 'goldTankmanCost',
                    'isBuying': True,
                    'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                    'newPrice': (0, totalTankMenStudePrice[1]),
                    'oldPrice': (0, defTotalTankMenStudePrice[1])
                }
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = getItemActionTooltipData(vehicle)
            ammoPrice = [0, 0]
            defAmmoPrice = [0, 0]
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice[0] += shell.buyPrice[0] * shell.defaultCount
                ammoPrice[1] += shell.buyPrice[1] * shell.defaultCount
                defAmmoPrice[0] += shell.defaultPrice[0] * shell.defaultCount
                defAmmoPrice[1] += shell.defaultPrice[1] * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice[0] != defAmmoPrice[0]:
                ammoActionPriceData = {
                    'type': ACTION_TOOLTIPS_TYPE.AMMO,
                    'key': str(vehicle.intCD),
                    'isBuying': True,
                    'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                    'newPrice': ammoPrice,
                    'oldPrice': defAmmoPrice
                }
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(
                stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = {
                    'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                    'key': 'slotsPrices',
                    'isBuying': True,
                    'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                    'newPrice': (0, slotPrice),
                    'oldPrice': (0, slotDefaultPrice)
                }
            tankmenLabel = i18n.makeString(
                DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL,
                count=text_styles.titleFont(
                    i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' +
                    str(tankMenCount)))
            initData = {
                'expanded': windowExpanded,
                'name': vehicle.userName,
                'longName': vehicle.longUserName,
                'description': vehicle.fullDescription,
                'type': vehicle.type,
                'icon': vehicle.icon,
                'nation': self.nationID,
                'level': vehicle.level,
                'isElite': vehicle.isElite,
                'tankmenLabel': tankmenLabel,
                'studyPriceCredits': totalTankMenStudePrice[0],
                'studyPriceCreditsActionData': studyPriceCreditsActionData,
                'studyPriceGold': totalTankMenStudePrice[1],
                'studyPriceGoldActionData': studyPriceGoldActionData,
                'vehiclePrices': vehicle.buyPrice,
                'vehiclePricesActionData': vehiclePricesActionData,
                'ammoPrice': ammoPrice[0],
                'ammoActionPriceData': ammoActionPriceData,
                'slotPrice': slotPrice,
                'slotActionPriceData': slotActionPriceData,
                'isRentable': vehicle.isRentable,
                'isStudyDisabled': vehicle.hasCrew,
                'isNoAmmo': not vehicle.hasShells,
                'rentDataDD': self._getRentData(vehicle,
                                                vehiclePricesActionData)
            }
            self.as_setInitDataS(initData)
Example #54
0
def getVisitedIDs(customizationName):
    result = []
    data = dict(AccountSettings.getSettings('customization'))
    if customizationName in data:
        result = data[customizationName]
    return result
Example #55
0
 def isPatchChanged(self):
     mainVersion = getClientMainVersion()
     return mainVersion is not None and AccountSettings.getSettings(
         LAST_PROMO_PATCH_VERSION) != mainVersion
 def __markAsVisited(cls, buildTypeID):
     fortSettings = dict(AccountSettings.getSettings('fortSettings'))
     if 'visitedBuildings' not in fortSettings:
         fortSettings['visitedBuildings'] = DEFAULT_VALUES['settings']['fortSettings']['visitedBuildings']
     fortSettings['visitedBuildings'].add(buildTypeID)
     AccountSettings.setSettings('fortSettings', fortSettings)
Example #57
0
 def isRequiredToShow(self):
     playerHelpVersion = int(
         AccountSettings.getSettings('ingameHelpVersion'))
     return constants.IS_SHOW_INGAME_HELP_FIRST_TIME and self.__version is not -1 and playerHelpVersion is not self.__version
Example #58
0
 def getDialogSettings(self):
     return dict(AccountSettings.getSettings('vehicleSellDialog'))
Example #59
0
 def __setCurrentLevelState(self, model=None):
     previousTotalPoints = AccountSettings.getSettings(
         LAST_BATTLE_PASS_POINTS_SEEN)
     previousState, previousLevel = self.__battlePassController.getLevelByPoints(
         previousTotalPoints)
     previousPoints, _ = self.__battlePassController.getProgressionByPoints(
         previousTotalPoints, previousState, previousLevel)
     previousLevel += 1
     currentTotalPoints = self.__battlePassController.getCurrentPoints()
     currentState = self.__battlePassController.getState()
     currentLevel = self.__battlePassController.getCurrentLevel() + 1
     AccountSettings.setSettings(LAST_BATTLE_PASS_POINTS_SEEN,
                                 currentTotalPoints)
     if previousState != currentState:
         if not (previousState == BattlePassState.POST
                 and currentState == BattlePassState.COMPLETED):
             previousLevel = 1
             previousTotalPoints = 0
     if previousTotalPoints > currentTotalPoints or previousLevel > currentLevel:
         previousState = BattlePassState.BASE
         previousLevel = 1
         previousTotalPoints = 0
     previousLevel = min(
         previousLevel,
         self.__battlePassController.getMaxLevel(
             previousState == BattlePassState.BASE))
     currentLevel = min(
         currentLevel,
         self.__battlePassController.getMaxLevel(
             currentState == BattlePassState.BASE))
     if previousTotalPoints > 0:
         if previousState == BattlePassState.POST:
             previousTotalPoints -= self.__battlePassController.getMaxPoints(
             )
         elif previousState == BattlePassState.COMPLETED:
             previousTotalPoints = self.__battlePassController.getMaxPoints(
                 False)
     if currentState == BattlePassState.POST:
         currentTotalPoints -= self.__battlePassController.getMaxPoints()
     elif currentState == BattlePassState.COMPLETED:
         currentTotalPoints = self.__battlePassController.getMaxPoints(
             False)
     currentPoints, levelPoints = self.__battlePassController.getLevelProgression(
     )
     isBattlePassBought = self.__battlePassController.isBought()
     model.setTitle(
         backport.text(R.strings.battle_pass_2020.progression.title()))
     model.setPreviousAllPoints(previousTotalPoints)
     model.setPreviousPoints(previousPoints)
     model.setPreviousLevel(previousLevel)
     model.setCurrentAllPoints(currentTotalPoints)
     model.setCurrentPoints(currentPoints)
     model.setTotalPoints(levelPoints)
     model.setCurrentLevel(currentLevel)
     model.setMaxLevelBase(self.__battlePassController.getMaxLevel())
     model.setMaxLevelPost(self.__battlePassController.getMaxLevel(False))
     model.setIsPostProgression(currentState != BattlePassState.BASE)
     model.setIsBattlePassPurchased(isBattlePassBought)
     isPaused = self.__battlePassController.isPaused()
     canBuy = self.__battlePassController.isActive(
     ) or currentLevel > 0 and not isPaused
     model.setIsPaused(isPaused)
     model.setCanBuy(canBuy)
     model.setSeasonTimeLeft(
         getFormattedTimeLeft(
             self.__battlePassController.getSeasonTimeLeft()))
     model.setCanPlayerParticipate(
         self.__battlePassController.canPlayerParticipate())
     if self.__battlePassController.isSeasonFinished():
         model.setSeasonTime(
             backport.text(
                 R.strings.battle_pass_2020.commonProgression.body.ended()))
     else:
         timeStart = self.__battlePassController.getSeasonStartTime()
         timeEnd = self.__battlePassController.getSeasonFinishTime()
         timePeriod = '{} - {}'.format(self.__makeSeasonTimeText(timeStart),
                                       self.__makeSeasonTimeText(timeEnd))
         model.setSeasonTime(timePeriod)