Exemple #1
0
 def __packHeaderSettings(self, club):
     isInStaff = club.hasMember(self.__viewerDbID)
     isEnoughPlayers = club.isStaffed()
     profile = self.clubsCtrl.getProfile()
     limits = self.clubsState.getLimits()
     canSendInvite = limits.canSendInvite(profile, club).success
     canSeeApplicants = limits.canSeeApplicants(profile, club).success
     if isEnoughPlayers:
         btnInviteTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_INVITEBTNDIS
     else:
         btnInviteTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_INVITEBTN
     removeBtnVisible = limits.canDestroyClub(profile, club).success or limits.canLeaveClub(profile, club).success
     return {
         "lblDescriptionVisible": not isInStaff,
         "lblStaffedVisible": isEnoughPlayers and isInStaff,
         "btnRemoveVisible": removeBtnVisible,
         "btnInviteVisible": canSendInvite,
         "btnInviteEnable": not isEnoughPlayers,
         "showInviteBtnAnimation": not isEnoughPlayers
         and AccountSettings.getFilter(SHOW_INVITE_COMMAND_BTN_ANIMATION)
         and canSendInvite,
         "btnInviteTooltip": btnInviteTooltip,
         "isRecruitmentOpened": club.getState().isOpened(),
         "btnRecruitmentVisible": canSeeApplicants,
         "isCheckBoxPressed": not AccountSettings.getFilter(JOIN_COMMAND_PRESSED),
         "cbOpenedVisible": limits.canOpenClub(profile, club).success,
     }
Exemple #2
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 _populate(self):
     super(AccountPopover, self)._populate()
     self.__populateUserInfo()
     self.startGlobalListening()
     self.startMyClubListening()
     AccountSettings.setFilter(BOOSTERS, {'wasShown': True})
     g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
 def __switchToMode(self, mode):
     if mode != self.__currentMode:
         storedValue = AccountSettings.getFilter(FORT_MEMBER_TUTORIAL)
         notCommanderHelpShown = storedValue['wasShown']
         if self.fortCtrl.getPermissions().canViewNotCommanderHelp() and not notCommanderHelpShown:
             self.fireEvent(events.LoadViewEvent(FORTIFICATION_ALIASES.FORT_NOT_COMMANDER_FIRST_ENTER_WINDOW_ALIAS), scope=EVENT_BUS_SCOPE.LOBBY)
             AccountSettings.setFilter(FORT_MEMBER_TUTORIAL, {'wasShown': True})
         if self.fortCtrl.getFort().isStartingScriptNotStarted() and not self.__commanderHelpShown:
             self.as_toggleCommanderHelpS(True)
             self.__commanderHelpShown = True
         if mode == FORTIFICATION_ALIASES.MODE_COMMON_TUTORIAL:
             self.fireEvent(events.LoadViewEvent(FORTIFICATION_ALIASES.FORT_CREATION_CONGRATULATIONS_WINDOW_ALIAS), scope=EVENT_BUS_SCOPE.LOBBY)
             self.__makeSystemMessages()
         if mode in (FORTIFICATION_ALIASES.MODE_TRANSPORTING_FIRST_STEP,
          FORTIFICATION_ALIASES.MODE_TRANSPORTING_NEXT_STEP,
          FORTIFICATION_ALIASES.MODE_TRANSPORTING_NOT_AVAILABLE,
          FORTIFICATION_ALIASES.MODE_TRANSPORTING_TUTORIAL,
          FORTIFICATION_ALIASES.MODE_TRANSPORTING_TUTORIAL_FIRST_STEP,
          FORTIFICATION_ALIASES.MODE_TRANSPORTING_TUTORIAL_NEXT_STEP):
             g_fortSoundController.setTransportingMode(True)
         else:
             g_fortSoundController.setTransportingMode(False)
         LOG_DEBUG('%s -> %s' % (self.__currentMode, mode))
         state = FortificationEffects.STATES[self.__currentMode][mode].copy()
         STATE_TEXTS_KEY = 'stateTexts'
         if not self.fortCtrl.getPermissions().canTransport():
             state['transportToggle'] = FortificationEffects.INVISIBLE
         if not self.fortCtrl.getPermissions().canChangeSettings():
             state['settingBtn'] = FortificationEffects.INVISIBLE
         state[STATE_TEXTS_KEY] = FortificationEffects.TEXTS[mode]
         state['mode'] = mode
         self.as_switchModeS(state)
         self.__currentModeIsDirty = False
         self.__currentMode = mode
 def setDialogSettings(self, isOpened):
     """
     Saving given dialog settings. Called from flash.
     @param isOpened: <bool> is dialog opened by default
     """
     settings = self.getDialogSettings()
     settings['isOpened'] = isOpened
     AccountSettings.setSettings('vehicleSellDialog', settings)
Exemple #6
0
 def setFilter(self, nation, role, tankType, location, nationID):
     self.filter["nation"] = nation
     self.filter["role"] = role
     self.filter["tankType"] = tankType
     self.filter["location"] = location
     self.filter["nationID"] = nationID
     AccountSettings.setFilter(BARRACKS_FILTER, self.filter)
     self.__updateTankmen()
Exemple #7
0
 def triggerEffect(self):
     setting = self.getTarget()
     if setting is None:
         LOG_ERROR('Tutorial setting is not found', self._effect.getTargetID())
         return
     else:
         AccountSettings.setSettings(setting.getSettingName(), setting.getSettingValue())
         return
Exemple #8
0
 def setFilter(self, nation, role, tankType, location, nationID):
     self.filter['nation'] = nation
     self.filter['role'] = role
     self.filter['tankType'] = tankType
     self.filter['location'] = location
     self.filter['nationID'] = nationID
     AccountSettings.setFilter(BARRACKS_FILTER, self.filter)
     self.__updateTankmen()
Exemple #9
0
 def fini(self):
     self.options.dump()
     self.__storages = None
     self.__options = None
     self.__serverSettings = None
     self.interfaceScale.fini()
     AccountSettings.onSettingsChanging -= self.__onAccountSettingsChanging
     AccountSettings.clearCache()
     LOG_DEBUG("SettingsCore is destroyed")
 def _disbandClub(self, club):
     if len(club.getMembers()) > 1:
         i18nKey = 'discontinuingFormationConfirmation'
     else:
         i18nKey = 'discontinuingEmptyFormationConfirmation'
     sysMsg = club_fmts.getDestroyClubSysMsg(self.clubsCtrl.getClub(self._clubDbID))
     self._doExitAction(DestroyClubCtx(self._clubDbID), I18nConfirmDialogMeta('staticFormation/staffView/%s' % i18nKey, focusedID=DIALOG_BUTTON_ID.CLOSE), WAITING.CLUBS_DESTROYCLUB, sysMsg)
     inviteAnimationDefaultValue = AccountSettings.getFilterDefault(SHOW_INVITE_COMMAND_BTN_ANIMATION)
     AccountSettings.setFilter(SHOW_INVITE_COMMAND_BTN_ANIMATION, inviteAnimationDefaultValue)
 def _selectVehicle(self, vehInvID):
     if vehInvID == self.__vehInvID:
         return
     Waiting.show('updateCurrentVehicle', isSingle=True)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     self._setChangeCallback()
Exemple #12
0
 def __selectVehicle(self, vehInvID):
     if vehInvID == self.__vehInvID:
         return
     Waiting.show("updateCurrentVehicle", isSingle=True)
     self.onChangeStarted()
     self.__vehInvID = vehInvID
     AccountSettings.setFavorites(CURRENT_VEHICLE, vehInvID)
     self.refreshModel()
     if not self.__changeCallbackID:
         self.__changeCallbackID = BigWorld.callback(0.1, self.__changeDone)
Exemple #13
0
 def moveSelectedVehicle(self, vehInvID):
     vehicles = self.getSelectedSlots()
     currentIndex = vehicles.index(vehInvID)
     if currentIndex == 0:
         newIndex = self._proxy.getConfig().maxVehiclesPerPlayer - 1
     else:
         newIndex = currentIndex - 1
     vehicles.insert(newIndex, vehicles.pop(currentIndex))
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
 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
Exemple #15
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)
 def _dispose(self):
     self.removeListener(HideWindowEvent.HIDE_VEHICLE_SELECTOR_WINDOW, self.onWindowForceClose)
     currentFilters = self.getFilters()
     if currentFilters:
         filters = {'nation': currentFilters['nation'],
          'vehicleType': currentFilters['vehicleType'],
          'isMain': currentFilters['isMain'],
          'level': currentFilters['level'],
          'compatibleOnly': currentFilters['compatibleOnly']}
         AccountSettings.setFilter(self.__section, filters)
     super(VehicleSelectorPopup, self)._dispose()
    def __setFilters(self, filterState):
        self.__qualities = []
        self.__boosterTypes = []
        for quality, param in FILTER_STATE.BOOSTER_QUALITIES:
            if filterState & quality:
                self.__qualities.append(param)

        for bType, param in FILTER_STATE.BOOSTER_TYPES:
            if filterState & bType:
                self.__boosterTypes.append(param)

        AccountSettings.setFilter(BOOSTERS_FILTER, filterState)
 def _dispose(self):
     currentFilters = self.getFilters()
     if currentFilters:
         filters = {'nation': currentFilters['nation'],
          'vehicleType': currentFilters['vehicleType'],
          'isMain': currentFilters['isMain'],
          'level': currentFilters['level'],
          'compatibleOnly': currentFilters['compatibleOnly']}
         AccountSettings.setFilter(self.__section, filters)
     super(RosterSlotSettingsWindow, self)._dispose()
     self.currentSlot = None
     self.slotSettings = None
Exemple #19
0
 def requestTableData(self, nation, type, filter):
     """
     Request table data for selected tab
     :param type: <str> tab ID
     :param nation: <int> gui nation
     :param filter: <obj> filter data
     """
     Waiting.show('updateInventory')
     AccountSettings.setFilter('inventory_current', (nation, type))
     filter = flashObject2Dict(filter)
     AccountSettings.setFilter('inventory_' + type, filter)
     self._setTableData(filter, nation, type)
     Waiting.hide('updateInventory')
Exemple #20
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
Exemple #21
0
 def requestTableData(self, nation, type, filter):
     """
     Request table data for selected tab
     :param type: <str> tab ID
     :param nation: <int> gui nation
     :param filter: <obj> filter data
     """
     Waiting.show("updateShop")
     AccountSettings.setFilter("shop_current", (nation, type))
     filter = flashObject2Dict(filter)
     AccountSettings.setFilter("shop_" + type, flashObject2Dict(filter))
     self._setTableData(filter, nation, type)
     Waiting.hide("updateShop")
 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
Exemple #23
0
 def addSelectedVehicle(self, vehInvID):
     canSelect, _ = self._proxy.canSelectVehicle(g_itemsCache.items.getVehicle(vehInvID))
     if not canSelect:
         LOG_ERROR('Selected vehicle in invalid!', vehInvID)
         return
     emptySlots = self._proxy.getEmptySlots()
     if not emptySlots:
         LOG_ERROR('No available slots to add new vehicle!', vehInvID)
         return
     firstEmptySlot = emptySlots[0]
     vehicles = self.getSelectedSlots()
     vehicles[firstEmptySlot] = vehInvID
     AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
     self._proxy.onVehiclesChanged()
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)
Exemple #25
0
    def __updateVehicles(self):
        maxVehs = self._proxy.getConfig().maxVehiclesPerPlayer
        valid = [INV_ID_CLEAR_VEHICLE] * maxVehs
        battleType = self.getBattleType()
        vehicles = self.__vehicles.get(battleType, ())
        vehGetter = g_itemsCache.items.getVehicle
        for idx, invID in enumerate(vehicles[:maxVehs]):
            invVehicle = vehGetter(invID)
            if invVehicle is not None:
                valid[idx] = invID

        if valid != vehicles:
            self.__vehicles[battleType] = valid
            AccountSettings.setFavorites(FALLOUT_VEHICLES, self.__vehicles)
 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
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
Exemple #28
0
 def setRecruitmentOpened(self, opened):
     AccountSettings.setFilter(JOIN_COMMAND_PRESSED, True)
     club = self.clubsCtrl.getClub(self._clubDbID)
     if club.getState().isOpened() != opened:
         sendRequest = True
         if not opened and len(club.getApplicants(onlyActive=True)):
             sendRequest = yield DialogsInterface.showDialog(I18nConfirmDialogMeta('staticFormation/staffView/closeClub'))
         if sendRequest:
             waitingID = WAITING.CLUBS_OPENCLUB if opened else WAITING.CLUBS_CLOSECLUB
             self.showWaiting(waitingID)
             result = yield self.clubsCtrl.sendRequest(OpenCloseClubCtx(opened, self._clubDbID))
             if result.isSuccess():
                 SystemMessages.pushMessage(club_fmts.getOpenClubSysMsg(opened))
             self.hideWaiting()
     self.as_updateHeaderDataS(self.__packHeaderSettings(club))
Exemple #29
0
    def _populateFilters(self, init = False):
        vehicles = g_itemsCache.items.getVehicles(REQ_CRITERIA.INVENTORY).values()
        filterVehicle = None
        if g_currentVehicle.isPresent():
            filterVehicle = g_currentVehicle.item.intCD
        filter = self._getCurrentFilter()
        if filter[1] in (self._MODULE, self._SHELL):
            filter = list(AccountSettings.getFilter(self.getName() + '_' + filter[1]))
            typeSize = int(filter.pop(0))
            filterVehicle = filter[typeSize + 1]
        self.__clearSubFilter()
        self.__subFilter = {'current': str(filterVehicle),
         self._DATA_PROVIDER: []}
        vehicles.sort(reverse=True)
        for v in vehicles:
            filterElement = {'id': str(v.intCD),
             'nation': GUI_NATIONS_ORDER_INDEX[nations.NAMES[v.nationID]],
             'name': v.userName}
            self.__subFilter[self._DATA_PROVIDER].append(filterElement)

        if init:
            lang, itemType = self._getCurrentFilter()
            self.__filterHash.update({'language': lang,
             'type': itemType})
            self.as_setFilterTypeS(self.__filterHash)
        self.as_setSubFilterS(self.__subFilter)
        if init:
            self._updateFilterOptions(self.__filterHash['type'])
            self.as_completeInitS()
        return
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)
Exemple #31
0
    def load(self):
        if isStorageSessionTimeout():
            defaultFilters = dict()
            for section in self._clientSections:
                defaultFilters.update(AccountSettings.getSessionSettingsDefault(section))

            self._filters = defaultFilters
            self.update(defaultFilters, save=False)
        else:
            super(StorageCarouselFilter, self).load()
    def reset(self, keys=None, exceptions=None, save=True):
        defaultFilters = {}
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getSessionSettingsDefault(section))

        keys = keys or defaultFilters.iterkeys()
        exceptions = exceptions or []
        keys = [ key for key in keys if key not in exceptions ]
        defaultFilters = _filterDict(defaultFilters, keys)
        self.update(defaultFilters, save)
 def _dispose(self):
     vStateCtrl = self.sessionProvider.shared.vehicleState
     crosshairCtrl = self.sessionProvider.shared.crosshair
     keyboardSetting = self.settingsCore.options.getSetting(
         CONTROLS.KEYBOARD)
     keyboardSetting.onKeyBindingsChanged -= self.__onKeyBindingsChanged
     if crosshairCtrl is not None:
         crosshairCtrl.onCrosshairPositionChanged -= self.__onCrosshairPositionChanged
         crosshairCtrl.onCrosshairScaleChanged -= self.__onCrosshairPositionChanged
     if vStateCtrl is not None:
         vStateCtrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
         vStateCtrl.onVehicleControlling -= self.__onVehicleControlling
         vStateCtrl.onPostMortemSwitched -= self.__onPostMortemSwitched
         vStateCtrl.onRespawnBaseMoving -= self.__onRespawnBaseMoving
     self._switchTimeTable.clear()
     self._siegeComponent.clear()
     self._siegeComponent = None
     AccountSettings.setSettings('siegeModeHintCounter', self._hintsLeft)
     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)
Exemple #35
0
 def setRecruitmentOpened(self, opened):
     AccountSettings.setFilter(LAST_CLUB_OPENED_FOR_APPS, self._clubDbID)
     club = self.clubsCtrl.getClub(self._clubDbID)
     if club.getState().isOpened() != opened:
         sendRequest = True
         if not opened and len(club.getApplicants(onlyActive=True)):
             sendRequest = yield DialogsInterface.showDialog(
                 I18nConfirmDialogMeta(
                     'staticFormation/staffView/closeClub'))
         if sendRequest:
             waitingID = WAITING.CLUBS_OPENCLUB if opened else WAITING.CLUBS_CLOSECLUB
             self.showWaiting(waitingID)
             result = yield self.clubsCtrl.sendRequest(
                 OpenCloseClubCtx(opened, self._clubDbID))
             if result.isSuccess():
                 SystemMessages.pushMessage(
                     club_fmts.getOpenClubSysMsg(opened))
             self.hideWaiting()
     self.as_updateHeaderDataS(self.__packHeaderSettings(club))
Exemple #36
0
 def __checkFreeXPConditions(self):
     from account_helpers.AccountSettings import AccountSettings, GUI_START_BEHAVIOR
     defaults = AccountSettings.getFilterDefault(GUI_START_BEHAVIOR)
     filters = self.settingsCore.serverSettings.getSection(GUI_START_BEHAVIOR, defaults)
     if filters['isFreeXPInfoDialogShowed']:
         return
     self.__weaver = Weaver()
     if self.__weaver.findPointcut(ResearchViewPointcut) == -1:
         self.__weaver.weave(pointcut=ResearchViewPointcut, aspects=[ShowXPInfoDialogAspect(self.cleanWeave)])
     if self.__weaver.findPointcut(ExchangeFreeXPToTankmanPointcut) == -1:
         self.__weaver.weave(pointcut=ExchangeFreeXPToTankmanPointcut, aspects=[ShowXPInfoDialogAspect(self.cleanWeave)])
 def __updateFilterOptions(self, filterType):
     """
     Gets vo class name and filter data from AccountSettings by filterType
     set this data into Flash and call _update
     :param filterType: <str> tab ID
     """
     voClassName, showExtra = self._getTabClass(filterType).getFilterInitData()
     self.as_setFilterOptionsS({'voClassName': voClassName,
      'showExtra': showExtra,
      'voData': AccountSettings.getFilter('%s_%s' % (self.getName(), filterType))})
     self._update()
Exemple #38
0
 def atCall(self, cd):
     from gui import DialogsInterface
     from account_helpers.AccountSettings import AccountSettings, GUI_START_BEHAVIOR
     defaults = AccountSettings.getFilterDefault(GUI_START_BEHAVIOR)
     filters = self.settingsCore.serverSettings.getSection(GUI_START_BEHAVIOR, defaults)
     filters['isFreeXPInfoDialogShowed'] = True
     self.settingsCore.serverSettings.setSectionSettings(GUI_START_BEHAVIOR, filters)
     cd.avoid()
     yield DialogsInterface.showDialog(FreeXPInfoMeta())
     cd.function(*cd._packArgs(), **cd._kwargs)
     self.callback([ExchangeFreeXPToTankmanPointcut, ResearchViewPointcut])
 def reset(self, keys = None, save = True):
     """ Reset filters to their default state.
     
     :param keys: if specified, resets only the filters listed in this parameter.
     :param save: flag that determines whether filters should be saved immediately.
     """
     defaultFilters = AccountSettings.getFilterDefaults(self._sections)
     if keys is not None:
         defaultFilters = _filterDict(defaultFilters, keys)
     self.update(defaultFilters, save)
     return
def _migrateTo36(core, data, initialized):
    from account_helpers.settings_core.ServerSettingsManager import SETTINGS_SECTIONS
    from account_helpers.AccountSettings import AccountSettings
    default = AccountSettings.getSettingsDefault(GAME.GAMEPLAY_MASK)
    storedValue = _getSettingsCache().getSectionSettings(
        SETTINGS_SECTIONS.GAMEPLAY, default)
    currentMask = storedValue & 65535
    import ArenaType
    newMask = currentMask | ArenaType.getGameplaysMask(('ctf30x30', ))
    newnewMask = newMask | ArenaType.getGameplaysMask(('domination30x30', ))
    data['gameplayData'][GAME.GAMEPLAY_MASK] = newnewMask
Exemple #41
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
Exemple #42
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
Exemple #43
0
 def _populate(self):
     super(BoostersWindow, self)._populate()
     self.__tabsContainer.init()
     self.__tabsContainer.onTabsUpdate += self.__onTabsUpdate
     self.__setFilters(AccountSettings.getFilter(BOOSTERS_FILTER))
     self.__setStaticData()
     if self.__defaultTabIdx is None:
         self.__defaultTabIdx = self.__getDefaultTabIdx()
     self.__tabsContainer.setCurrentTabIdx(self.__defaultTabIdx)
     self.__update()
     return
 def playSound(self):
     self.stopSound()
     if self._content.get('voiceovers', False):
         self.__currSound = self._content['voiceovers'].pop(0)
         if self.__currSound.get('voiceover', False):
             self.soundManager.playSound(self.__currSound['voiceover'])
             if self.__currSound.get('subtitle', False) and AccountSettings.getSettings(SUBTITLES):
                 self._asShowSubtitle(self.__currSound['subtitle'])
             self.__subtitlesCallback = BigWorld.callback(self.__STANDARD_DURATION_SEC, lambda : self._update(remainingTime=self.__calcMaxDuration(self.__currSound.get('subtitle', ''))))
             return
     self.onWindowClose()
Exemple #45
0
 def __setClanInfo(self, clanInfo):
     name = BigWorld.player().name
     if clanInfo and len(clanInfo) > 1:
         clanAbbrev = clanInfo[1]
     else:
         clanAbbrev = None
     hasNew = not AccountSettings.getFilter(BOOSTERS)['wasShown']
     hasActiveBooster = len(g_goodiesCache.getBoosters(criteria=REQ_CRITERIA.BOOSTER.ACTIVE)) > 0
     self.as_nameResponseS(g_lobbyContext.getPlayerFullName(name, clanInfo=clanInfo), name, clanAbbrev, g_itemsCache.items.stats.isTeamKiller, g_clanCache.isInClan, hasNew, hasActiveBooster, TOOLTIPS.HEADER_ACCOUNT, TOOLTIP_TYPES.COMPLEX)
     if g_clanCache.clanDBID:
         self.requestClanEmblem32x32(g_clanCache.clanDBID)
Exemple #46
0
 def __setClanInfo(self, clanInfo):
     if not isPlayerAccount():
         return
     else:
         name = BigWorld.player().name
         if clanInfo and len(clanInfo) > 1:
             clanAbbrev = clanInfo[1]
         else:
             clanAbbrev = None
         hasNew = not AccountSettings.getFilter(BOOSTERS)['wasShown']
         activeBoosters = g_goodiesCache.getBoosters(
             criteria=REQ_CRITERIA.BOOSTER.ACTIVE).values()
         hasActiveBooster = len(activeBoosters) > 0
         readyBoosters = g_goodiesCache.getBoosters(
             criteria=REQ_CRITERIA.BOOSTER.IS_READY_TO_ACTIVATE).values()
         boostersAvailable = sum(
             (booster.count for booster in readyBoosters))
         hasAvailableBoosters = boostersAvailable > 0
         boosterIcon, boosterText = (None, None)
         if hasActiveBooster:
             boosterIcon = RES_ICONS.MAPS_ICONS_BOOSTERS_ACTIVEBOOSTERICON
             booster = sorted(activeBoosters,
                              key=lambda x: x.getUsageLeftTime())[0]
             boosterText = booster.getShortLeftTimeStr()
         elif hasAvailableBoosters:
             boosterIcon = RES_ICONS.MAPS_ICONS_BOOSTERS_AVAILABLEBOOSTERICON
             if boostersAvailable <= _MAX_BOOSTERS_TO_DISPLAY:
                 boosterText = str(boostersAvailable)
             else:
                 boosterText = str(_MAX_BOOSTERS_TO_DISPLAY) + '+'
         self.as_nameResponseS({
             'userVO': {
                 'fullName':
                 g_lobbyContext.getPlayerFullName(name, clanInfo=clanInfo),
                 'userName':
                 name,
                 'clanAbbrev':
                 clanAbbrev
             },
             'isTeamKiller': g_itemsCache.items.stats.isTeamKiller,
             'hasNew': hasNew,
             'hasActiveBooster': hasActiveBooster,
             'hasAvailableBoosters': hasAvailableBoosters,
             'tooltip': TOOLTIPS.HEADER_ACCOUNT,
             'tooltipType': TOOLTIP_TYPES.COMPLEX,
             'boosterIcon': boosterIcon,
             'boosterBg': RES_ICONS.MAPS_ICONS_BOOSTERS_ACTIVEBOOSTERBG,
             'boosterText': boosterText
         })
         if g_clanCache.clanDBID:
             self.requestClanEmblem32x32(g_clanCache.clanDBID)
         else:
             self.as_setClanEmblemS(None)
         return
 def _processPromo(self, promo):
     yield lambda callback: callback(True)
     if self.isPatchPromoAvailable() and self.isPatchChanged() and self.isPromoAutoViewsEnabled() and not self._isPromoShown:
         LOG_DEBUG('Showing patchnote promo:', self.__currentVersionPromoUrl)
         AccountSettings.setSettings(LAST_PROMO_PATCH_VERSION, getClientMainVersion())
         self.__currentVersionBrowserShown = True
         self._isPromoShown = True
         self.showCurrentVersionPatchPromo(isAsync=True)
         return
     actionsPromo = [ item for item in promo if item.eventType.startswith(gc_constants.PROMO.TEMPLATE.ACTION) ]
     for actionPromo in actionsPromo:
         promoUrl = yield self.__urlMacros.parse(actionPromo.data)
         promoTitle = actionPromo.text
         if promoUrl not in self.__promoShown and not self._isPromoShown and promoUrl != self.__currentVersionPromoUrl:
             LOG_DEBUG('Showing action promo:', promoUrl)
             self.__promoShown.add(promoUrl)
             self.__savePromoShown()
             self._isPromoShown = True
             yield self.__showPromoBrowser(promoUrl, promoTitle)
             return
Exemple #48
0
 def __packHeaderSettings(self, club):
     isInStaff = club.hasMember(self.__viewerDbID)
     isEnoughPlayers = club.isStaffed()
     profile = self.clubsCtrl.getProfile()
     limits = self.clubsState.getLimits()
     canSendInvite = limits.canSendInvite(profile, club).success
     canSeeApplicants = limits.canSeeApplicants(profile, club).success
     if isEnoughPlayers:
         btnInviteTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_INVITEBTNDIS
     else:
         btnInviteTooltip = TOOLTIPS.STATICFORMATIONSTAFFVIEW_INVITEBTN
     removeBtnVisible = limits.canDestroyClub(
         profile, club).success or limits.canLeaveClub(profile,
                                                       club).success
     return {
         'lblDescriptionVisible':
         not isInStaff,
         'lblStaffedVisible':
         isEnoughPlayers and isInStaff,
         'btnRemoveVisible':
         removeBtnVisible,
         'btnInviteVisible':
         canSendInvite,
         'btnInviteEnable':
         not isEnoughPlayers,
         'showInviteBtnAnimation':
         not isEnoughPlayers
         and AccountSettings.getFilter(SHOW_INVITE_COMMAND_BTN_ANIMATION)
         and canSendInvite,
         'btnInviteTooltip':
         btnInviteTooltip,
         'isRecruitmentOpened':
         club.getState().isOpened(),
         'btnRecruitmentVisible':
         canSeeApplicants,
         'isCheckBoxPressed':
         AccountSettings.getFilter(LAST_CLUB_OPENED_FOR_APPS) !=
         self._clubDbID,
         'cbOpenedVisible':
         limits.canOpenClub(profile, club).success
     }
 def requestTableData(self, nation, actionsSelected, tabID, f):
     Waiting.show('updateInventory')
     f = flashObject2Dict(f)
     itemCD = AccountSettings.getFilter('scroll_to_item')
     AccountSettings.setFilter('inventory_current', (nation, tabID, actionsSelected))
     AccountSettings.setFilter('inventory_' + tabID, f)
     AccountSettings.setFilter('scroll_to_item', None)
     self._setTableData(f, nation, tabID, actionsSelected, itemCD)
     Waiting.hide('updateInventory')
     return
Exemple #50
0
 def __processWelcome(self):
     """
     Processes state and display welcome view if wasn't shown before
     :return: process functional flag result
     """
     defaults = AccountSettings.getFilterDefault(GUI_START_BEHAVIOR)
     filters = self.settingsCore.serverSettings.getSection(
         GUI_START_BEHAVIOR, defaults)
     if not filters['isRankedWelcomeViewShowed']:
         g_eventDispatcher.loadRanked()
         return FUNCTIONAL_FLAG.LOAD_PAGE
     return FUNCTIONAL_FLAG.UNDEFINED
Exemple #51
0
    def _updatePromo(self, promosData):
        yield lambda callback: callback(True)
        for item in filter(lambda item: item.eventType == gc_constants.PROMO.TEMPLATE.ACTION, promosData):
            promoUrl = yield self.__urlMacros.parse(item.data)
            self.__availablePromo.add(promoUrl)

        if self.__currentVersionPromoUrl is None:
            self.__currentVersionPromoUrl = yield self.__urlMacros.parse(GUI_SETTINGS.currentVersionPromo)
        promoShownSource = AccountSettings.getFilter(PROMO)
        self.__promoShown = {url for url in promoShownSource if url in self.__availablePromo}
        self.__savePromoShown()
        return
Exemple #52
0
 def __init__(self, ctx=None):
     super(ColorSettingsView, self).__init__(ColorSettingsView)
     self.fireEvent(GameEvent(GameEvent.HIDE_EXTERNAL_COMPONENTS), scope=EVENT_BUS_SCOPE.GLOBAL)
     self.__selectedTabIdx = AccountSettings.getSettings(COLOR_SETTINGS_TAB_IDX)
     self.__componentWidth = 0
     self.__isColorPreviewFilterActive = False
     self.__initSettings = self.__getSettings()
     self.__tabsPreviewSettings = self.__getLastAppliedTabsSettings()
     if self.__selectedTabIdx == TABS.CUSTOM:
         self.__showColorPreviewFilter()
     self.__blur = None
     return
 def init(self):
     g_clientUpdateManager.addCallbacks({
         'inventory': self.onInventoryUpdate,
         'cache.vehsLock': self.onLocksUpdate
     })
     game_control.g_instance.igr.onIgrTypeChanged += self.onIgrTypeChanged
     game_control.g_instance.rentals.onRentChangeNotify += self.onRentChange
     game_control.getFalloutCtrl(
     ).onSettingsChanged += self.__onFalloutChanged
     prbVehicle = self.__checkPrebattleLockedVehicle()
     storedVehInvID = AccountSettings.getFavorites(CURRENT_VEHICLE)
     self.selectVehicle(prbVehicle or storedVehInvID)
    def isDefault(self, keys=None):
        defaultFilters = {}
        for section in self._clientSections:
            defaultFilters.update(AccountSettings.getSessionSettingsDefault(section))

        if keys is None:
            keys = defaultFilters.keys()
        for key in keys:
            if self._filters[key] != defaultFilters[key]:
                return False

        return True
    def __checkConflicts(self):
        localConfig = AccountSettings.getSettings(BATTLE_PASS_VIDEOS_CONFIG)
        localVideosIDs = self.__getVideoIndexAndIDFromConfig(localConfig)
        serverVideosIDs = self.__getVideoIndexAndIDFromConfig(
            self.__videosConfig)
        if not localConfig:
            AccountSettings.setSettings(BATTLE_PASS_VIDEOS_CONFIG,
                                        self.__videosConfig)
            localVideosIDs = self.__getVideoIndexAndIDFromConfig(
                self.__videosConfig)
        for videoIdx in serverVideosIDs.keys():
            localVideoID = localVideosIDs.get(videoIdx)
            serverVideoID = serverVideosIDs[videoIdx]
            if localVideoID is None or localVideoID != serverVideoID:
                self.__resetShownVideoInStorage(serverVideoID)
                localConfig.pop(localVideoID, None)
                localConfig[serverVideoID] = self.__videosConfig[serverVideoID]
                AccountSettings.setSettings(BATTLE_PASS_VIDEOS_CONFIG,
                                            localConfig)

        return
Exemple #56
0
 def getRecruitedTankmen(self, level):
     """
     Provides tank woman that was recruited during NY event.
     :param level: NY atmosphere level
     :return gui.shared.gui_items.Tankman:
     """
     saved = AccountSettings.getSettings(CHRISTMAS_TMANS_INV_IDS)
     if level in saved:
         tManInvID = saved[level]
         if tManInvID:
             tankman = self._itemsCache.items.getTankman(tManInvID)
             return tankman
     return None
Exemple #57
0
 def start(self):
     arenaDP = self.sessionProvider.getArenaDP()
     crosshairCtrl = self.sessionProvider.shared.crosshair
     vehicleCtrl = self.sessionProvider.shared.vehicleState
     vInfo = arenaDP.getVehicleInfo()
     self.__isObserver = vInfo.isObserver()
     crosshairCtrl.onCrosshairViewChanged += self.__onCrosshairViewChanged
     crosshairCtrl.onStrategicCameraChanged += self.__onStrategicCameraChanged
     vehicleCtrl.onVehicleStateUpdated += self.__onVehicleStateUpdated
     CommandMapping.g_instance.onMappingChanged += self.__onMappingChanged
     self.__hintsLeft = AccountSettings.getSettings(
         TRAJECTORY_VIEW_HINT_COUNTER)
     self.__setup(crosshairCtrl, vehicleCtrl)
 def _getCustomData(self):
     fort = self.fortCtrl.getFort()
     level = fort.level
     levelTxt = fort_formatters.getTextLevel(level)
     defResQuantity = fort.getTotalDefRes()
     defResPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_COMMON_TOTALDEPOTQUANTITYTEXT))
     return {'clanName': g_clanCache.clanTag,
      'levelTitle': i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_LEVELSLBL, buildLevel=levelTxt),
      'defResText': defResPrefix + fort_formatters.getDefRes(defResQuantity, True),
      'clanProfileBtnLbl': CLANS.FORT_HEADER_CLANPROFILEBTNLBL,
      'clanListBtnTooltip': makeTooltip(i18n.makeString(TOOLTIPS.FORTIFICATION_HEADER_CLANLIST_HEADER, clanName=g_clanCache.clanTag), i18n.makeString(TOOLTIPS.FORTIFICATION_HEADER_CLANLIST_BODY)),
      'orderSelectorVO': {'isSelected': AccountSettings.getFilter(ORDERS_FILTER)['isSelected'],
                          'icon': RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_AIM}}
Exemple #59
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
 def onApply(self, diff):
     diff = flashObject2Dict(diff)
     AccountSettings.setSettings(COLOR_SETTINGS_TAB_IDX,
                                 self.__selectedTabIdx)
     if self.__selectedTabIdx == TABS.CUSTOM:
         if self.__hasChangesInSettings(
                 settings_constants.GRAPHICS.getCustomColorSettings(),
                 diff):
             diff.update({
                 settings_constants.GRAPHICS.COLOR_GRADING_TECHNIQUE:
                 COLOR_GRADING_TECHNIQUE_DEFAULT
             })
         diff[COLOR_SETTINGS.COLOR_GRADING_TECHNIQUE] = 0
         diff[COLOR_SETTINGS.COLOR_FILTER_INTENSITY] = 25
     self.settingsCore.applySettings(diff)
     lastAppliedSettings = AccountSettings.getSettings(
         APPLIED_COLOR_SETTINGS)
     lastAppliedSettings[self.__selectedTabIdx] = diff
     AccountSettings.setSettings(APPLIED_COLOR_SETTINGS,
                                 lastAppliedSettings)
     BigWorld.commitPendingGraphicsSettings()
     self.destroy()