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
Example #2
0
def configureShopForVehicleTradeIn():
    AccountSettings.setFilter('shop_current', (-1, STORE_CONSTANTS.VEHICLE, True))
    vehFilter = AccountSettings.getFilter('shop_vehicle')
    vehFilter['obtainingType'] = STORE_CONSTANTS.TRADE_IN_VEHICLE
    vehFilter['selectedTypes'] = DEFAULT_VEHICLE_TYPES_FILTER
    vehFilter['selectedLevels'] = DEFAULT_LEVELS_FILTERS
    AccountSettings.setFilter('shop_vehicle', vehFilter)
Example #3
0
 def _populate(self):
     super(AccountPopover, self)._populate()
     self.__populateUserInfo()
     self.startGlobalListening()
     self.startMyClubListening()
     AccountSettings.setFilter(BOOSTERS, {'wasShown': True})
     g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
Example #4
0
 def _populate(self):
     super(AccountPopover, self)._populate()
     self.__populateUserInfo()
     self.startGlobalListening()
     self.startMyClubListening()
     AccountSettings.setFilter(BOOSTERS, {'wasShown': True})
     g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected
Example #5
0
 def buyTankClick(self):
     AccountSettings.setFilter(STORE_TAB, 0)
     shopFilter = list(AccountSettings.getFilter('shop_current'))
     shopFilter[1] = 'vehicle'
     AccountSettings.setFilter('shop_current', tuple(shopFilter))
     self.fireEvent(events.LoadViewEvent(VIEW_ALIAS.LOBBY_STORE),
                    EVENT_BUS_SCOPE.LOBBY)
Example #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()
Example #7
0
 def changeFilter(self, hideUnavailable, hideDone):
     newData = {HIDE_DONE: hideDone, HIDE_UNAVAILABLE: hideUnavailable}
     if self.__filterData != newData:
         self.__filterData = newData
         AccountSettings.setFilter(MISSIONS_PAGE, self.__filterData)
         self.fireEvent(
             MissionsEvent(MissionsEvent.ON_FILTER_CHANGED,
                           ctx=self.__filterData), EVENT_BUS_SCOPE.LOBBY)
Example #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()
Example #9
0
def configureShopForVehicleRent():
    AccountSettings.setFilter('shop_current', (-1, STORE_CONSTANTS.VEHICLE, True))
    vehFilter = AccountSettings.getFilter('shop_vehicle')
    vehFilter['obtainingType'] = STORE_CONSTANTS.VEHICLE
    vehFilter['selectedTypes'] = DEFAULT_VEHICLE_TYPES_FILTER
    vehFilter['selectedLevels'] = DEFAULT_LEVELS_FILTERS
    vehFilter['extra'] = [STORE_CONSTANTS.RENTALS_EXTRA_NAME]
    AccountSettings.setFilter('shop_vehicle', vehFilter)
Example #10
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()
Example #11
0
 def __callback(self, result):
     deviceSetting = self.settingsCore.options.getSetting(SOUND.SOUND_DEVICE)
     if result:
         deviceSetting.apply(deviceSetting.SYSTEMS.SPEAKERS)
         self.soundsCtrl.system.setUserSpeakersPresetID(SPEAKERS_CONFIG.AUTO_DETECTION)
     else:
         _, currentDeviceID = deviceSetting.getSystemState()
         AccountSettings.setFilter(SPEAKERS_DEVICE, currentDeviceID)
Example #12
0
 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)
Example #13
0
 def save(self):
     self._saveToServer()
     for section in self._clientSections:
         defaultFilter = AccountSettings.getFilterDefault(section)
         filtersToSave = {
             key: self._filters.get(key, defaultFilter[key])
             for key in defaultFilter
         }
         AccountSettings.setFilter(section, filtersToSave)
Example #14
0
def configureShopForShells():
    AccountSettings.setFilter('shop_current', (-1, STORE_CONSTANTS.SHELL, True))
    shellsFilter = AccountSettings.getFilter('shop_shell')
    shellsFilter['fitsType'] = STORE_CONSTANTS.OTHER_VEHICLES_SHELL_FIT
    shellsFilter['itemTypes'] = [STORE_CONSTANTS.ARMOR_PIERCING_SHELL,
     STORE_CONSTANTS.ARMOR_PIERCING_CR_SHELL,
     STORE_CONSTANTS.HOLLOW_CHARGE_SHELL,
     STORE_CONSTANTS.HIGH_EXPLOSIVE_SHELL]
    AccountSettings.setFilter('shop_shell', shellsFilter)
Example #15
0
 def onWindowClose(self):
     if isGoldFishActionActive():
         AccountSettings.setFilter(GOLD_FISH_LAST_SHOW_TIME,
                                   getCurrentTimestamp())
         self.fireEvent(
             events.CloseWindowEvent(
                 events.CloseWindowEvent.GOLD_FISH_CLOSED),
             EVENT_BUS_SCOPE.LOBBY)
     self.destroy()
Example #16
0
 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()
Example #17
0
    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
Example #19
0
 def _dispose(self):
     self.removeListener(HideWindowEvent.HIDE_VEHICLE_SELECTOR_WINDOW, self.onWindowForceClose)
     currentFilters = self.getFilters()
     if currentFilters:
         self.only_ = {'nation': currentFilters['nation'],
          'vehicleType': currentFilters['vehicleType'],
          'isMain': currentFilters['isMain'],
          'level': currentFilters['level'],
          'compatibleOnly': currentFilters['compatibleOnly']}
         filters = self.only_
         AccountSettings.setFilter(self.__section, filters)
     super(VehicleSelectorPopup, self)._dispose()
Example #20
0
 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)
             if self.__currentMode == FORTIFICATION_ALIASES.MODE_DIRECTIONS_TUTORIAL:
                 self.__makeSystemMessages()
         isInTransportingMode = 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)
         self.fireEvent(events.FortEvent(
             events.FortEvent.IS_IN_TRANSPORTING_MODE,
             ctx={'isInTransportingMode': isInTransportingMode}),
                        scope=EVENT_BUS_SCOPE.FORT)
         LOG_DEBUG('Fort mode has been changed: %s -> %s' %
                   (self.__currentMode, mode))
         state = FortificationEffects.getStates()[
             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
         if self.__defenceHourArrowVisible:
             self.__setTutorialArrowToDefenseHourSettingsVisibility()
         if self.__intelligenceArrowVisible:
             self.__setTutorialArrowToIntelligenceVisibility()
Example #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('updateInventory')
     AccountSettings.setFilter('inventory_current', (nation, type))
     filter = flashObject2Dict(filter)
     AccountSettings.setFilter('inventory_' + type, filter)
     self._setTableData(filter, nation, type)
     Waiting.hide('updateInventory')
Example #22
0
    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)
        self.__tabsContainer.setFilters(self.__qualities, self.__boosterTypes)
Example #23
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")
Example #24
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')
Example #25
0
 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
Example #26
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))
Example #27
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))
Example #28
0
 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)
Example #29
0
 def _updateRallyData(self):
     functional = self.unitFunctional
     data = vo_converters.makeUnitVO(functional, unitIdx=functional.getUnitIdx(), app=self.app, isFallout=self.__isFallout)
     self.as_updateRallyS(data)
     falloutFilter = AccountSettings.getFilter(FALLOUT)
     wasShown = falloutFilter['wasShown']
     isNew = False
     isEventEnabled = g_eventsCache.isEventEnabled()
     if isEventEnabled:
         battleTypeName = i18n.makeString(MENU.HEADERBUTTONS_BATTLE_MENU_STANDART) + '\n' + i18n.makeString(MENU.HEADERBUTTONS_BATTLE_MENU_DOMINATION)
         tooltipStr = makeTooltip(body=TOOLTIPS.SQUADWINDOW_EVENT_DOMINATION, note=alert(i18n.makeString(TOOLTIPS.SQUADWINDOW_EVENT_DOMINATION_NOTE, vehicles=self._getEventVehiclesNamesStr())))
         isNew = not wasShown
     else:
         battleTypeName = i18n.makeString(MENU.HEADERBUTTONS_BATTLE_MENU_STANDART)
         tooltipStr = ''
     self.as_updateBattleTypeInfoS(tooltipStr, isEventEnabled)
     self.as_updateBattleTypeS(battleTypeName, isEventEnabled, isNew)
     if isNew:
         falloutFilter['wasShown'] = True
         AccountSettings.setFilter(FALLOUT, falloutFilter)
 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)
             if self.__currentMode == FORTIFICATION_ALIASES.MODE_DIRECTIONS_TUTORIAL:
                 self.__makeSystemMessages()
         isInTransportingMode = 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)
         self.fireEvent(events.FortEvent(events.FortEvent.IS_IN_TRANSPORTING_MODE, ctx={'isInTransportingMode': isInTransportingMode}), scope=EVENT_BUS_SCOPE.FORT)
         LOG_DEBUG('Fort mode has been changed: %s -> %s' % (self.__currentMode, mode))
         state = FortificationEffects.getStates()[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
         if self.__defenceHourArrowVisible:
             self.__setTutorialArrowToDefenseHourSettingsVisibility()
         if self.__intelligenceArrowVisible:
             self.__setTutorialArrowToIntelligenceVisibility()
 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
Example #32
0
 def requestTableData(self, nation, actionsSelected, type, filter):
     """
     Request table data for selected tab
     :param type: <str> tab ID
     :param nation: <int> gui nation
     :param actionsSelected: <bool> discount's checkbox value
     :param filter: <obj> filter data
     """
     Waiting.show('updateInventory')
     filter = flashObject2Dict(filter)
     itemCD = AccountSettings.getFilter('scroll_to_item')
     AccountSettings.setFilter('inventory_current',
                               (nation, type, actionsSelected))
     AccountSettings.setFilter('inventory_' + type, filter)
     AccountSettings.setFilter('scroll_to_item', None)
     self._setTableData(filter, nation, type, actionsSelected, itemCD)
     Waiting.hide('updateInventory')
     return
Example #33
0
 def onSelectOrderSelector(self, value):
     filters = AccountSettings.getFilter(ORDERS_FILTER)
     filters['isSelected'] = value
     AccountSettings.setFilter(ORDERS_FILTER, filters)
Example #34
0
 def triggerEffect(self):
     AccountSettings.setFilter(self._effect.getTargetID(), self._effect.getValue())
Example #35
0
 def showInviteWindow(self):
     AccountSettings.setFilter(SHOW_INVITE_COMMAND_BTN_ANIMATION, False)
     self.onClubStateChanged(None)
     club_events.showClubInvitesWindow(self._clubDbID)
     return
Example #36
0
 def onWindowClose(self):
     if isGoldFishActionActive():
         AccountSettings.setFilter(GOLD_FISH_LAST_SHOW_TIME, getCurrentTimestamp())
         self.fireEvent(events.CloseWindowEvent(events.CloseWindowEvent.GOLD_FISH_CLOSED), EVENT_BUS_SCOPE.LOBBY)
     self.destroy()
Example #37
0
 def __setNewValue(self, value):
     achievement = AccountSettings.getFilter(AWARDS)
     achievement[self.__key] = value
     AccountSettings.setFilter(AWARDS, achievement)
Example #38
0
 def __onSpaceCreated(self):
     self.__craftPopoverFilter = None
     self.__selectedCraftToy = None
     self.__selectedCollectionLevels = None
     AccountSettings.setFilter(NY_DECORATIONS_POPOVER_FILTER_1, (0, 0))
     return
Example #39
0
 def buyTankClick(self):
     shopFilter = list(AccountSettings.getFilter('shop_current'))
     shopFilter[1] = 'vehicle'
     AccountSettings.setFilter('shop_current', tuple(shopFilter))
     self.fireEvent(events.LoadEvent(events.LoadEvent.LOAD_SHOP), EVENT_BUS_SCOPE.LOBBY)
Example #40
0
 def _dispose(self):
     AccountSettings.setFilter(IGR_PROMO, {'wasShown': True})
     super(PromoPremiumIgrWindow, self)._dispose()
 def onSelectOrderSelector(self, value):
     filters = AccountSettings.getFilter(ORDERS_FILTER)
     filters['isSelected'] = value
     AccountSettings.setFilter(ORDERS_FILTER, filters)
def configureShopForEquipment():
    AccountSettings.setFilter('shop_current',
                              (-1, STORE_CONSTANTS.EQUIPMENT, True))
    eqFilter = AccountSettings.getFilter('shop_equipment')
    eqFilter['fitsType'] = STORE_CONSTANTS.OTHER_VEHICLES_ARTEFACT_FIT
    AccountSettings.setFilter('shop_equipment', eqFilter)
def configureShopForOptionalDevice():
    AccountSettings.setFilter('shop_current',
                              (-1, STORE_CONSTANTS.OPTIONAL_DEVICE, True))
    optDevFilter = AccountSettings.getFilter('shop_optionalDevice')
    optDevFilter['fitsType'] = STORE_CONSTANTS.OTHER_VEHICLES_ARTEFACT_FIT
    AccountSettings.setFilter('shop_optionalDevice', optDevFilter)
Example #44
0
 def requestTableData(self, nation, type, filter):
     Waiting.show('updateShop')
     AccountSettings.setFilter('shop_current', (nation, type))
     AccountSettings.setFilter('shop_' + type, filter)
     self._setTableData(filter, nation, type)
     Waiting.hide('updateShop')
Example #45
0
 def __setNewValue(self, value):
     achievement = AccountSettings.getFilter(AWARDS)
     achievement[self.__key] = value
     AccountSettings.setFilter(AWARDS, achievement)
Example #46
0
 def __savePromoShown(self):
     AccountSettings.setFilter(PROMO, self.__promoShown)
Example #47
0
 def buyTankClick(self):
     AccountSettings.setFilter(STORE_TAB, 0)
     shopFilter = list(AccountSettings.getFilter('shop_current'))
     shopFilter[1] = 'vehicle'
     AccountSettings.setFilter('shop_current', tuple(shopFilter))
     self.fireEvent(events.LoadViewEvent(VIEW_ALIAS.LOBBY_STORE), EVENT_BUS_SCOPE.LOBBY)
Example #48
0
    def requestTableData(self, nation, type, filter):
        Waiting.show('updateShop')
        AccountSettings.setFilter('shop_current', (nation, type))
        AccountSettings.setFilter('shop_' + type, filter)
        nation = int(nation) if nation >= 0 else None
        if nation is not None:
            nation = getNationIndex(nation)
        filter = list(filter)
        itemTypeID, requestCriteria, inventoryVehicles, checkExtra, extra = self._getRequestParameters(nation, type, filter)
        modulesAll = g_itemsCache.items.getItems(itemTypeID, requestCriteria, nation)
        shopRqs = g_itemsCache.items.shop
        isEnabledBuyingGoldShellsForCredits = shopRqs.isEnabledBuyingGoldShellsForCredits
        isEnabledBuyingGoldEqsForCredits = shopRqs.isEnabledBuyingGoldEqsForCredits
        self._clearTableData()
        self.__tableType = type
        dataProviderValues = []
        for module in sorted(modulesAll.itervalues()):
            extraModuleInfo = None
            if module.itemTypeID == GUI_ITEM_TYPE.GUN and module.isClipGun():
                extraModuleInfo = CLIP_ICON_PATH
            inventoryCount = 0
            vehicleCount = 0
            if module.isInInventory:
                inventoryCount = 1
                if type != self._VEHICLE:
                    inventoryCount = module.inventoryCount
            if type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT):
                installedVehicles = module.getInstalledVehicles(inventoryVehicles)
                vehicleCount = len(installedVehicles)
            if checkExtra:
                if 'locked' not in extra and type not in (self._OPTIONAL_DEVICE, self._EQUIPMENT):
                    if not module.isUnlocked:
                        continue
                if 'inHangar' not in extra and type not in (self._OPTIONAL_DEVICE, self._EQUIPMENT):
                    if inventoryCount > 0 and not module.isRented:
                        continue
                if type == self._VEHICLE and 'rentals' not in extra:
                    if module.isRented:
                        continue
                if 'onVehicle' not in extra:
                    if vehicleCount > 0:
                        continue
            disabled = False
            statusMessage = ''
            money = g_itemsCache.items.stats.money
            if type == self._VEHICLE:
                if module.getState()[0] == Vehicle.VEHICLE_STATE.RENTAL_IS_ORVER:
                    statusMessage = '#menu:store/vehicleStates/%s' % module.getState()[0]
                    disabled = not self._isPurchaseEnabled(module, money)
                elif BigWorld.player().isLongDisconnectedFromCenter:
                    statusMessage = MENU.SHOP_ERRORS_CENTERISDOWN
                    disabled = True
                elif inventoryCount > 0:
                    statusMessage = MENU.SHOP_ERRORS_INHANGAR
                    disabled = True
                    if module.isRentable:
                        disabled = not self._isPurchaseEnabled(module, money)
                elif not module.isUnlocked:
                    statusMessage = MENU.SHOP_ERRORS_UNLOCKNEEDED
                    disabled = True
                else:
                    disabled = not self._isPurchaseEnabled(module, money)
            elif type not in (self._SHELL, self._OPTIONAL_DEVICE, self._EQUIPMENT) and not module.isUnlocked:
                statusMessage = MENU.SHOP_ERRORS_UNLOCKNEEDED
                disabled = True
            else:
                disabled = not self._isPurchaseEnabled(module, money)
            dataProviderValues.append((module,
             inventoryCount,
             vehicleCount,
             disabled,
             statusMessage,
             isEnabledBuyingGoldShellsForCredits,
             isEnabledBuyingGoldEqsForCredits,
             extraModuleInfo))

        self._table.setDataProviderValues(dataProviderValues)
        self._table.as_setGoldS(g_itemsCache.items.stats.gold)
        self._table.as_setCreditsS(g_itemsCache.items.stats.credits)
        self._table.as_setTableTypeS(self.__tableType)
        Waiting.hide('updateShop')
        return
Example #49
0
    def requestTableData(self, nation, type, filter):
        Waiting.show('updateShop')
        AccountSettings.setFilter('shop_current', (nation, type))
        AccountSettings.setFilter('shop_' + type, filter)
        nation = int(nation) if nation >= 0 else None
        if nation is not None:
            nation = getNationIndex(nation)
        filter = list(filter)
        requestType = [type]
        checkFits = None
        checkFitsArtefacts = None
        checkExtra = False
        modulesFits = {}
        vehicleFits = []
        extra = []
        modulesAllVehicle = []
        if type == self._MODULE:
            typeSize = int(filter.pop(0))
            requestType = filter[0:typeSize]
            filter = filter[typeSize:]
            fitsType = filter.pop(0)
            compact = filter.pop(0)
            if compact == '0':
                LOG_ERROR('compact value has invalid value: ', compact)
                Waiting.hide('updateShop')
                return
            fitsVehicle = getItemByCompact(compact)
            checkExtra = True
            extra = filter[:]
            checkFits = True if fitsType != 'otherVehicles' else None
            myVehicles = yield Requester(self._VEHICLE).getFromInventory()
            modulesAllVehicle = VehicleItemsRequester(myVehicles).getItems(requestType)
            if fitsType == 'myVehicle':
                for rType in requestType:
                    modulesFits.update(_getComponentsByType(fitsVehicle, ITEM_TYPE_INDICES[rType]))

            elif fitsType != 'otherVehicles':
                for vehicle in myVehicles:
                    for rType in requestType:
                        modulesFits.update(_getComponentsByType(vehicle, ITEM_TYPE_INDICES[rType]))

            filter = requestType
        elif type == self._SHELL:
            filterSize = int(filter.pop(0))
            fitsType = filter.pop(filterSize)
            compact = filter.pop(filterSize)
            if compact == '0':
                LOG_ERROR('compact value has invalid value: ', compact)
                Waiting.hide('updateShop')
                return
            fitsVehicle = getItemByCompact(compact)
            checkFits = True if fitsType != 'otherGuns' else None
            if fitsType == 'myVehicleGun':
                for shoot in fitsVehicle.descriptor.gun['shots']:
                    modulesFits[shoot[self._SHELL]['compactDescr']] = True

            elif fitsType == 'myInventoryGuns':
                myGuns = yield Requester('vehicleGun').getFromInventory()
                for gun in myGuns:
                    for shoot in gun.descriptor['shots']:
                        modulesFits[shoot[self._SHELL]['compactDescr']] = True

            elif fitsType != 'otherGuns':
                myGuns = yield Requester('vehicleGun').getFromInventory()
                for gun in myGuns:
                    for shoot in gun.descriptor['shots']:
                        modulesFits[shoot[self._SHELL]['compactDescr']] = True

                myVehicles = yield Requester(self._VEHICLE).getFromInventory()
                for vehicle in myVehicles:
                    for shoot in vehicle.descriptor.gun['shots']:
                        modulesFits[shoot[self._SHELL]['compactDescr']] = True

        elif type == self._VEHICLE:
            filterSize = int(filter.pop(0))
            extra = filter[filterSize:]
            checkExtra = True
            filter = filter[0:filterSize]
        else:
            fitsType = filter.pop(0)
            compact = filter.pop(0)
            if compact == '0':
                LOG_ERROR('compact value has invalid value: ', compact)
                Waiting.hide('updateShop')
                return
            fitsVehicle = getItemByCompact(compact)
            extra = filter
            checkExtra = type in (self._OPTIONAL_DEVICE, self._EQUIPMENT)
            checkFitsArtefacts = True if fitsType != 'otherVehicles' else None
            myVehicles = yield Requester(self._VEHICLE).getFromInventory()
            modulesAllVehicle = VehicleItemsRequester(myVehicles).getItems(requestType)
            if fitsType == 'myVehicle':
                vehicleFits = [fitsVehicle]
            elif fitsType != 'otherVehicles':
                vehicleFits = [ v for v in myVehicles if v.nation == nation ] if nation != None else myVehicles
            filter = requestType
        filter = map(lambda w: w.lower(), filter)
        modulesAll = list()
        modulesAllInventory = list()
        for rType in requestType:
            inv = yield Requester(rType).getFromInventory()
            modulesAllInventory.extend(inv)
            shp = yield Requester(rType).getFromShop(nation=nation)
            modulesAll.extend(shp)

        unlocks = yield StatsRequester().getUnlocks()
        shopRqs = yield ShopRequester().request()
        self.__clearTableData()
        self.__tableData = [type]
        modulesAll.sort()
        for module in modulesAll:
            extraModuleInfo = None
            if module.hidden:
                continue
            if module.type.lower() not in filter:
                continue
            if checkFits is not None:
                if (module.compactDescr in modulesFits.keys()) != checkFits:
                    continue
            if checkFitsArtefacts is not None:
                for veh in vehicleFits:
                    if module.descriptor.checkCompatibilityWithVehicle(veh.descriptor)[0] == checkFitsArtefacts:
                        break
                else:
                    continue

            if module.isClipGun():
                extraModuleInfo = CLIP_ICON_PATH
            inventoryCount = 0
            vehicleCount = 0
            installedIn = ''
            if module in modulesAllInventory:
                inventoryCount = 1
                if type != self._VEHICLE:
                    inventoryModule = modulesAllInventory[modulesAllInventory.index(module)]
                    inventoryCount = inventoryModule.count
            if type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT) and module in modulesAllVehicle:
                vehModule = modulesAllVehicle[modulesAllVehicle.index(module)]
                vehicleCount = vehModule.count
                installedIn = ', '.join([ v.shortName for v in vehModule.vehicles ])
            if checkExtra:
                if 'locked' not in extra:
                    if type == self._VEHICLE:
                        compdecs = module.descriptor.type.compactDescr
                        if compdecs not in unlocks:
                            continue
                    elif type not in (self._SHELL, self._OPTIONAL_DEVICE, self._EQUIPMENT) and module.compactDescr not in unlocks:
                        continue
                if 'inHangar' not in extra and type not in (self._OPTIONAL_DEVICE, self._EQUIPMENT):
                    if inventoryCount > 0:
                        continue
                if 'onVehicle' not in extra:
                    if vehicleCount > 0:
                        continue
            disabled = ''
            if type == self._VEHICLE:
                if BigWorld.player().isLongDisconnectedFromCenter:
                    disabled = MENU.SHOP_ERRORS_CENTERISDOWN
                if inventoryCount > 0:
                    disabled = MENU.SHOP_ERRORS_INHANGAR
                else:
                    compdecs = module.descriptor.type.compactDescr
                    if compdecs not in unlocks:
                        disabled = MENU.SHOP_ERRORS_UNLOCKNEEDED
            elif type not in (self._SHELL, self._OPTIONAL_DEVICE, self._EQUIPMENT) and module.compactDescr not in unlocks:
                disabled = MENU.SHOP_ERRORS_UNLOCKNEEDED
            if not (shopRqs.isEnabledBuyingGoldShellsForCredits and module.itemTypeName == 'shell'):
                goldAmmoForCredits = shopRqs.isEnabledBuyingGoldEqsForCredits and module.itemTypeName == 'equipment'
                module.priceOrder = goldAmmoForCredits and (module.priceOrder[0] + module.priceOrder[1] * shopRqs.exchangeRateForShellsAndEqs, module.priceOrder[1])
            valueElement = {'id': compactItem(module),
             'name': module.name if type in (self._OPTIONAL_DEVICE, self._EQUIPMENT) else module.longName,
             'desc': getShortDescr(module.tableName),
             'inventoryId': None,
             'inventoryCount': inventoryCount,
             'vehicleCount': vehicleCount,
             'credits': module.priceOrder[0],
             'gold': module.priceOrder[1],
             'price': module.priceOrder,
             'currency': 'credits' if module.priceOrder[1] == 0 else 'gold',
             'level': module.level,
             'nation': module.nation,
             'type': module.itemTypeName if type not in (self._VEHICLE,
                      self._OPTIONAL_DEVICE,
                      self._SHELL,
                      self._EQUIPMENT) else module.icon,
             'disabled': disabled,
             'statusLevel': InventoryVehicle.STATE_LEVEL.WARNING,
             'removable': module.descriptor['removable'] if type == self._OPTIONAL_DEVICE else True,
             'tankType': module.type if type == self._VEHICLE else type,
             'isPremium': module.isPremium if type == self._VEHICLE else False,
             'isElite': self.app.tooltipManager.isVehicleElite(module) if type == self._VEHICLE else False,
             'itemTypeName': module.itemTypeName,
             'goldShellsForCredits': shopRqs.isEnabledBuyingGoldShellsForCredits,
             'goldEqsForCredits': shopRqs.isEnabledBuyingGoldEqsForCredits,
             EXTRA_MODULE_INFO: extraModuleInfo}
            self.__tableData.append(valueElement)

        requester = yield StatsRequesterr().request()
        self._table.as_setGoldS(requester.gold)
        self._table.as_setCreditsS(requester.credits)
        self._table.as_setTableS(self.__tableData)
        Waiting.hide('updateShop')
        return
Example #50
0
    def requestTableData(self, nation, type, filter):
        Waiting.show('updateInventory')
        AccountSettings.setFilter('inventory_current', (nation, type))
        AccountSettings.setFilter('inventory_' + type, filter)
        nation = int(nation) if nation >= 0 else None
        if nation is not None:
            nation = getNationIndex(nation)
        filter = list(filter)
        itemTypeID, requestCriteria, inventoryVehicles, checkExtra, extra = self._getRequestParameters(nation, type, filter)
        modulesAll = g_itemsCache.items.getItems(itemTypeID, requestCriteria, nation)
        shopRqs = g_itemsCache.items.shop
        isEnabledBuyingGoldShellsForCredits = shopRqs.isEnabledBuyingGoldShellsForCredits
        isEnabledBuyingGoldEqsForCredits = shopRqs.isEnabledBuyingGoldEqsForCredits
        self._clearTableData()
        self.__tableType = type
        dataProviderValues = []
        for module in sorted(modulesAll.itervalues()):
            extraModuleInfo = None
            if module.itemTypeID == GUI_ITEM_TYPE.GUN and module.isClipGun():
                extraModuleInfo = CLIP_ICON_PATH
            inventoryCount = 0
            vehicleCount = 0
            if module.isInInventory:
                inventoryCount = 1
                if type != self._VEHICLE:
                    inventoryCount = module.inventoryCount
            if type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT):
                installedVehicles = module.getInstalledVehicles(inventoryVehicles)
                vehicleCount = len(installedVehicles)
            if checkExtra:
                if type == self._VEHICLE and 'brocken' not in extra:
                    if module.repairCost > 0:
                        continue
                if type == self._VEHICLE and 'locked' not in extra:
                    if module.isLocked:
                        continue
                if type == self._VEHICLE and 'premiumIGR' not in extra:
                    if module.isPremiumIGR:
                        continue
                if type == self._VEHICLE and IS_RENTALS_ENABLED and 'rentals' not in extra:
                    if module.isRented and not module.isPremiumIGR:
                        continue
                if 'onVehicle' in extra:
                    if vehicleCount == 0 and inventoryCount == 0:
                        continue
            disable = False
            statusMessage = ''
            if type == self._VEHICLE:
                state = module.getState()[0]
                isStateSuitable = state in (Vehicle.VEHICLE_STATE.RENTAL_IS_ORVER, Vehicle.VEHICLE_STATE.IGR_RENTAL_IS_ORVER)
                isExcludedState = state in (Vehicle.VEHICLE_STATE.UNSUITABLE_TO_UNIT,)
                if isStateSuitable or not isExcludedState and not module.canSell:
                    statusMessage = makeString('#menu:store/vehicleStates/%s' % state)
                    disable = not module.canSell
            elif type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT) and not module.isInInventory:
                if type == self._OPTIONAL_DEVICE:
                    if not module.descriptor['removable']:
                        statusMessage = makeString(MENU.INVENTORY_DEVICE_ERRORS_NOT_REMOVABLE)
                        disable = True
                    else:
                        statusMessage = makeString(MENU.INVENTORY_DEVICE_ERRORS_RESERVED)
                        disable = True
                else:
                    statusMessage = makeString(MENU.INVENTORY_ERRORS_RESERVED)
                    disable = True
            dataProviderValues.append((module,
             inventoryCount,
             vehicleCount,
             disable,
             statusMessage,
             isEnabledBuyingGoldShellsForCredits,
             isEnabledBuyingGoldEqsForCredits,
             extraModuleInfo))

        self._table.setDataProviderValues(dataProviderValues)
        self._table.as_setGoldS(g_itemsCache.items.stats.gold)
        self._table.as_setCreditsS(g_itemsCache.items.stats.credits)
        self._table.as_setTableTypeS(self.__tableType)
        Waiting.hide('updateInventory')
        return
Example #51
0
    def requestTableData(self, nation, type, filter):
        Waiting.show('updateInventory')
        AccountSettings.setFilter('inventory_current', (nation, type))
        AccountSettings.setFilter('inventory_' + type, filter)
        nation = int(nation) if nation >= 0 else None
        if nation is not None:
            nation = getNationIndex(nation)
        filter = list(filter)
        requestType = [type]
        checkFits = None
        checkFitsArtefacts = None
        checkExtra = False
        modulesFits = {}
        vehicleFits = []
        extra = []
        modulesAllVehicle = []
        if type == self._MODULE:
            typeSize = int(filter.pop(0))
            requestType = filter[0:typeSize]
            filter = filter[typeSize:]
            fitsType = filter.pop(0)
            fitsVehicle = getItemByCompact(filter.pop(0))
            checkExtra = True
            extra = filter[:]
            checkFits = True if fitsType != 'otherVehicles' else False
            myVehicles = yield Requester(self._VEHICLE).getFromInventory()
            modulesAllVehicle = VehicleItemsRequester(myVehicles).getItems(requestType)
            if fitsType == 'myVehicle':
                if fitsVehicle:
                    for rType in requestType:
                        modulesFits.update(_getComponentsByType(fitsVehicle, ITEM_TYPE_INDICES[rType]))

            else:
                for vehicle in myVehicles:
                    for rType in requestType:
                        modulesFits.update(_getComponentsByType(vehicle, ITEM_TYPE_INDICES[rType]))

            filter = requestType
        elif type == self._SHELL:
            filterSize = int(filter.pop(0))
            fitsType = filter.pop(filterSize)
            fitsVehicle = getItemByCompact(filter.pop(filterSize))
            checkFits = True if fitsType != 'otherGuns' else False
            if fitsType == 'myVehicleGun':
                for shoot in fitsVehicle.descriptor.gun['shots']:
                    modulesFits[shoot[self._SHELL]['compactDescr']] = True

            elif fitsType == 'myInventoryGuns':
                myGuns = yield Requester('vehicleGun').getFromInventory()
                for gun in myGuns:
                    for shoot in gun.descriptor['shots']:
                        modulesFits[shoot[self._SHELL]['compactDescr']] = True

            else:
                myGuns = yield Requester('vehicleGun').getFromInventory()
                for gun in myGuns:
                    for shoot in gun.descriptor['shots']:
                        modulesFits[shoot[self._SHELL]['compactDescr']] = True

                myVehicles = yield Requester(self._VEHICLE).getFromInventory()
                for vehicle in myVehicles:
                    for shoot in vehicle.descriptor.gun['shots']:
                        modulesFits[shoot[self._SHELL]['compactDescr']] = True

        elif type == self._VEHICLE:
            filterSize = int(filter.pop(0))
            extra = filter[filterSize:]
            checkExtra = True
            filter = filter[0:filterSize]
        else:
            fitsType = filter.pop(0)
            compact = filter.pop(0)
            fitsVehicle = getItemByCompact(compact)
            extra = filter
            checkExtra = type in (self._OPTIONAL_DEVICE, self._EQUIPMENT)
            checkFitsArtefacts = True if fitsType != 'otherVehicles' else False
            myVehicles = yield Requester(self._VEHICLE).getFromInventory()
            modulesAllVehicle = VehicleItemsRequester(myVehicles).getItems(requestType)
            if fitsType == 'myVehicle':
                vehicleFits = [fitsVehicle]
            else:
                vehicleFits = myVehicles
            filter = requestType
        filter = map(lambda w: w.lower(), filter)
        modulesAll = list()
        modulesShop = list()
        for rType in requestType:
            inv = yield Requester(rType).getFromInventory()
            shp = yield Requester(rType).getFromShop()
            modulesShop.extend(shp)
            modulesAll.extend(inv)

        vehPrices = {}
        if type == self._VEHICLE:
            compactDescrs = [ v.compactDescr for v in modulesAll ]
            vehPrices = yield StatsRequester().getVehiclesPrices(compactDescrs)
            vehPrices = dict(zip(compactDescrs, vehPrices))
        if type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT):
            for vehModule in modulesAllVehicle:
                if vehModule not in modulesAll:
                    if modulesShop.count(vehModule) != 0:
                        modulesAll.append(vehModule)

        self.__clearTableData()
        self.__tableData = [type]
        excludeModules = []
        for module in modulesAll:
            if modulesShop.count(module) != 0:
                module.priceOrder = modulesShop[modulesShop.index(module)].priceOrder
            elif constants.IS_DEVELOPMENT:
                excludeModules.append(module)
                LOG_ERROR("Not found module %s '%s' (%r) in shop." % (module.type, module.unicName, module.compactDescr))

        modulesAll.sort()
        shopRqs = yield ShopRequester().request()
        for module in modulesAll:
            extraModuleInfo = None
            if module in excludeModules:
                continue
            if nation is not None:
                if module.nation != nation and module.nation != nations.NONE_INDEX:
                    continue
                if module.type.lower() not in filter:
                    continue
                if checkFits is not None:
                    if (module.compactDescr in modulesFits.keys()) != checkFits:
                        continue
                if module.isClipGun():
                    extraModuleInfo = CLIP_ICON_PATH
                if checkFitsArtefacts is not None:
                    compatible = False
                    for veh in vehicleFits:
                        if nation is not None and veh.nation != nation:
                            continue
                        compatible |= module.descriptor.checkCompatibilityWithVehicle(veh.descriptor)[0]

                    if compatible != checkFitsArtefacts:
                        continue
                inventoryCount = 0
                vehicleCount = 0
                if isinstance(module, VehicleItem):
                    vehicleCount = module.count
                else:
                    inventoryCount = module.count
                    if type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT) and module in modulesAllVehicle:
                        vehModule = modulesAllVehicle[modulesAllVehicle.index(module)]
                        vehicleCount = vehModule.count
                if checkExtra:
                    if type == self._VEHICLE and 'brocken' not in extra:
                        if module.repairCost > 0:
                            continue
                    if type == self._VEHICLE and 'locked' not in extra:
                        if module.lock != 0:
                            continue
                    if 'onVehicle' not in extra:
                        if vehicleCount > 0 and inventoryCount == 0:
                            continue
                disable = ''
                if type == self._VEHICLE and not module.canSell:
                    disable = makeString(MENU.tankcarousel_vehiclestates(module.getState()))
                elif type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT) and isinstance(module, VehicleItem):
                    if type == self._OPTIONAL_DEVICE:
                        if not module.descriptor['removable']:
                            disable = makeString(MENU.INVENTORY_DEVICE_ERRORS_NOT_REMOVABLE)
                        else:
                            disable = makeString(MENU.INVENTORY_DEVICE_ERRORS_RESERVED)
                    else:
                        disable = makeString(MENU.INVENTORY_ERRORS_RESERVED)
                sellPrice = isinstance(module, InventoryVehicle) and vehPrices.get(module.compactDescr, (0, 0))
            else:
                sellPrice = (0, 0)
                item = g_itemsCache.items.getItemByCD(module.compactDescr)
                if item is not None:
                    sellPrice = item.sellPrice
            valueElement = {'id': compactItem(module),
             'name': module.name if type in (self._OPTIONAL_DEVICE, self._EQUIPMENT) else module.longName,
             'desc': getShortDescr(module.tableName),
             'inventoryId': module.inventoryId if isinstance(module, InventoryVehicle) else None,
             'inventoryCount': inventoryCount,
             'vehicleCount': vehicleCount,
             'credits': sellPrice[0],
             'gold': sellPrice[1],
             'price': sellPrice,
             'currency': 'credits' if sellPrice[1] == 0 else 'gold',
             'level': module.level,
             'nation': module.nation,
             'type': module.itemTypeName if type not in (self._VEHICLE,
                      self._OPTIONAL_DEVICE,
                      self._SHELL,
                      self._EQUIPMENT) else module.icon,
             'disabled': disable,
             'statusLevel': module.getStateLevel() if isinstance(module, InventoryVehicle) else InventoryVehicle.STATE_LEVEL.INFO,
             'removable': module.descriptor['removable'] if type == self._OPTIONAL_DEVICE else True,
             'tankType': module.type if type == self._VEHICLE else type,
             'isPremium': module.isPremium if type == self._VEHICLE else False,
             'isElite': self.app.tooltipManager.isVehicleElite(module) if type == self._VEHICLE else False,
             'itemTypeName': module.itemTypeName,
             'goldShellsForCredits': shopRqs.isEnabledBuyingGoldShellsForCredits,
             'goldEqsForCredits': shopRqs.isEnabledBuyingGoldEqsForCredits,
             EXTRA_MODULE_INFO: extraModuleInfo}
            self.__tableData.append(valueElement)

        requester = yield StatsRequesterr().request()
        self._table.as_setGoldS(requester.gold)
        self._table.as_setCreditsS(requester.credits)
        self._table.as_setTableS(self.__tableData)
        Waiting.hide('updateInventory')
        return
 def save(self):
     self.settingsCore.serverSettings.setSections(self._serverSections,
                                                  self._filters)
     for section in self._clientSections:
         AccountSettings.setFilter(section, self._filters)
Example #53
0
 def __savePromoShown(self):
     AccountSettings.setFilter(PROMO, self.__promoShown)
 def _dispose(self):
     AccountSettings.setFilter(IGR_PROMO, {'wasShown': True})
     super(PromoPremiumIgrWindow, self)._dispose()
 def _dispose(self):
     super(LinkedSetVehicleListPopup, self)._dispose()
     AccountSettings.setFilter(self.__section, self.__filters)
Example #56
0
    def requestTableData(self, nation, type, filter):
        Waiting.show('updateShop')
        AccountSettings.setFilter('shop_current', (nation, type))
        AccountSettings.setFilter('shop_' + type, filter)
        nation = int(nation) if nation >= 0 else None
        if nation is not None:
            nation = getNationIndex(nation)
        filter = list(filter)
        itemTypeID, requestCriteria, inventoryVehicles, checkExtra, extra = self._getRequestParameters(nation, type, filter)
        modulesAll = g_itemsCache.items.getItems(itemTypeID, requestCriteria, nation)
        shopRqs = g_itemsCache.items.shop
        isEnabledBuyingGoldShellsForCredits = shopRqs.isEnabledBuyingGoldShellsForCredits
        isEnabledBuyingGoldEqsForCredits = shopRqs.isEnabledBuyingGoldEqsForCredits
        self._clearTableData()
        self.__tableType = type
        dataProviderValues = []
        for module in sorted(modulesAll.itervalues()):
            extraModuleInfo = None
            if module.itemTypeID == GUI_ITEM_TYPE.GUN and module.isClipGun():
                extraModuleInfo = CLIP_ICON_PATH
            inventoryCount = 0
            vehicleCount = 0
            if module.isInInventory:
                inventoryCount = 1
                if type != self._VEHICLE:
                    inventoryCount = module.inventoryCount
            if type in (self._MODULE, self._OPTIONAL_DEVICE, self._EQUIPMENT):
                installedVehicles = module.getInstalledVehicles(inventoryVehicles)
                vehicleCount = len(installedVehicles)
            if checkExtra:
                if 'locked' not in extra and type not in (self._OPTIONAL_DEVICE, self._EQUIPMENT):
                    if not module.isUnlocked:
                        continue
                if 'inHangar' not in extra and type not in (self._OPTIONAL_DEVICE, self._EQUIPMENT):
                    if inventoryCount > 0 and not module.isRented:
                        continue
                if type == self._VEHICLE and 'rentals' not in extra:
                    if module.isRented:
                        continue
                if 'onVehicle' not in extra:
                    if vehicleCount > 0:
                        continue
            disabled = False
            statusMessage = ''
            money = g_itemsCache.items.stats.money
            if type == self._VEHICLE:
                if module.getState()[0] == Vehicle.VEHICLE_STATE.RENTAL_IS_ORVER:
                    statusMessage = '#menu:store/vehicleStates/%s' % module.getState()[0]
                    disabled = not self._isPurchaseEnabled(module, money)
                elif BigWorld.player().isLongDisconnectedFromCenter:
                    statusMessage = MENU.SHOP_ERRORS_CENTERISDOWN
                    disabled = True
                elif inventoryCount > 0:
                    statusMessage = MENU.SHOP_ERRORS_INHANGAR
                    disabled = True
                    if module.isRentable:
                        disabled = not self._isPurchaseEnabled(module, money)
                elif not module.isUnlocked:
                    statusMessage = MENU.SHOP_ERRORS_UNLOCKNEEDED
                    disabled = True
                else:
                    disabled = not self._isPurchaseEnabled(module, money)
            elif type not in (self._SHELL, self._OPTIONAL_DEVICE, self._EQUIPMENT) and not module.isUnlocked:
                statusMessage = MENU.SHOP_ERRORS_UNLOCKNEEDED
                disabled = True
            else:
                disabled = not self._isPurchaseEnabled(module, money)
            dataProviderValues.append((module,
             inventoryCount,
             vehicleCount,
             disabled,
             statusMessage,
             isEnabledBuyingGoldShellsForCredits,
             isEnabledBuyingGoldEqsForCredits,
             extraModuleInfo))

        self._table.setDataProviderValues(dataProviderValues)
        self._table.as_setGoldS(g_itemsCache.items.stats.gold)
        self._table.as_setCreditsS(g_itemsCache.items.stats.credits)
        self._table.as_setTableTypeS(self.__tableType)
        Waiting.hide('updateShop')