Пример #1
0
 def getLabels(self):
     return [
         self.__getButtonInfoObject(
             DIALOG_BUTTON_ID.SUBMIT,
             DIALOGS.all(I18N_SUBMIT_KEY.format(self._i18nKey)),
             self._focusedIndex == DIALOG_BUTTON_ID.SUBMIT
             if self._focusedIndex is not None else True),
         self.__getButtonInfoObject(
             DIALOG_BUTTON_ID.CLOSE,
             DIALOGS.all(I18N_CANCEL_KEY.format(self._i18nKey)),
             self._focusedIndex == DIALOG_BUTTON_ID.CLOSE
             if self._focusedIndex is not None else False)
     ]
Пример #2
0
 def _showAward(self, ctx):
     _, message = ctx
     arenaTypeID = message.data.get('arenaTypeID', 0)
     if arenaTypeID > 0 and arenaTypeID in ArenaType.g_cache:
         arenaType = ArenaType.g_cache[arenaTypeID]
     else:
         arenaType = None
     arenaCreateTime = message.data.get('arenaCreateTime', None)
     fairplayViolations = message.data.get('fairplayViolations', None)
     if arenaCreateTime and arenaType and fairplayViolations is not None and fairplayViolations[:2] != (
             0, 0):
         penaltyType = None
         violation = None
         if fairplayViolations[1] != 0:
             penaltyType = 'penalty'
             violation = fairplayViolations[1]
         elif fairplayViolations[0] != 0:
             penaltyType = 'warning'
             violation = fairplayViolations[0]
         showDialog(
             I18PunishmentDialogMeta(
                 'punishmentWindow', None, {
                     'penaltyType':
                     penaltyType,
                     'arenaName':
                     i18n.makeString(arenaType.name),
                     'time':
                     TimeFormatter.getActualMsgTimeStr(arenaCreateTime),
                     'reason':
                     i18n.makeString(
                         DIALOGS.all('punishmentWindow/reason/%s' %
                                     getFairPlayViolationName(violation)))
                 }), lambda *args: None)
     return
    def changeNation(self, nationID):
        Waiting.show('updating')
        self.__selectedNation = nationID
        modulesAll = g_itemsCache.items.getVehicles(
            self.__getClassesCriteria(nationID)).values()
        classes = []
        data = [self.__getVehicleClassEmptyRow()]
        modulesAll.sort()
        for module in modulesAll:
            if module.type in classes:
                continue
            classes.append(module.type)
            data.append({
                'id':
                module.type,
                'label':
                DIALOGS.recruitwindow_vehicleclassdropdown(module.type)
            })

        self.as_setVehicleClassDataS(
            self.__getSendingData(data,
                                  len(data) > 1, 0))
        self.as_setVehicleDataS(
            self.__getSendingData([self.__getVehicleEmptyRow()], False, 0))
        self.as_setTankmanRoleDataS(
            self.__getSendingData([self.__getTankmanRoleEmptyRow()], False, 0))
        Waiting.hide('updating')
        self.onDataChange(self.__selectedNation, self.__selectedVehClass,
                          self.__selectedVehicle, self.__selectedTmanRole)
Пример #4
0
    def updateAllDropdowns(self, nationID, tankType, typeID, roleType):
        nationsDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}, {'id': nationID,
          'label': MENU.nations(nations.NAMES[int(nationID)])}]
        classesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}, {'id': tankType,
          'label': DIALOGS.recruitwindow_vehicleclassdropdown(tankType)}]
        typesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        rolesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        modulesAll = g_itemsCache.items.getVehicles(self.__getRoleCriteria(nationID, tankType, typeID)).values()
        modulesAll.sort()
        for module in modulesAll:
            typesDP.append({'id': module.innationID,
             'label': module.shortUserName})
            for role in module.descriptor.type.crewRoles:
                if role[0] == roleType:
                    rolesDP.append({'id': role[0],
                     'label': convert(getSkillsConfig()[role[0]]['userString'])})

            break

        self.flashObject.as_setAllDropdowns(nationsDP, classesDP, typesDP, rolesDP)
        return
Пример #5
0
    def updateAllDropdowns(self, nationID, tankType, typeID, roleType):
        nationsDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}, {'id': nationID,
          'label': MENU.nations(nations.NAMES[int(nationID)])}]
        classesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}, {'id': tankType,
          'label': DIALOGS.recruitwindow_vehicleclassdropdown(tankType)}]
        typesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        rolesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        modulesAll = g_itemsCache.items.getVehicles(self.__getRoleCriteria(nationID, tankType, typeID)).values()
        modulesAll.sort()
        for module in modulesAll:
            typesDP.append({'id': module.innationID,
             'label': module.shortUserName})
            for role in module.descriptor.type.crewRoles:
                if role[0] == roleType:
                    rolesDP.append({'id': role[0],
                     'label': convert(getSkillsConfig()[role[0]]['userString'])})

            break

        self.flashObject.as_setAllDropdowns(nationsDP, classesDP, typesDP, rolesDP)
        return
Пример #6
0
    def _showAward(self, ctx):
        _, message = ctx
        for dataForVehicle in message.data.values():
            arenaTypeID = dataForVehicle.get('arenaTypeID', 0)
            if arenaTypeID > 0 and arenaTypeID in ArenaType.g_cache:
                arenaType = ArenaType.g_cache[arenaTypeID]
            else:
                arenaType = None
            arenaCreateTime = dataForVehicle.get('arenaCreateTime', None)
            fairplayViolations = dataForVehicle.get('fairplayViolations', None)
            if arenaCreateTime and arenaType and fairplayViolations is not None and fairplayViolations[:2] != (0, 0):
                penaltyType = None
                violation = None
                if fairplayViolations[1] != 0:
                    penaltyType = 'penalty'
                    violation = fairplayViolations[1]
                elif fairplayViolations[0] != 0:
                    penaltyType = 'warning'
                    violation = fairplayViolations[0]
                from gui.DialogsInterface import showDialog
                showDialog(I18PunishmentDialogMeta('punishmentWindow', None, {'penaltyType': penaltyType,
                 'arenaName': i18n.makeString(arenaType.name),
                 'time': TimeFormatter.getActualMsgTimeStr(arenaCreateTime),
                 'reason': i18n.makeString(DIALOGS.all('punishmentWindow/reason/%s' % getFairPlayViolationName(violation)))}), lambda *args: None)

        return
Пример #7
0
    def __setVehicleClassesData(self):
        if self.__filteredVehClasses is not None:
            data = self.__filteredVehClasses[self.__selectedNationIdx]
            self.as_setVehicleClassDataS(
                self.__getSendingData(data,
                                      len(data) > 1, 0))
        else:
            modulesAll = self.itemsCache.items.getVehicles(
                self.__getClassesCriteria(self.__selectedNationIdx)).values()
            classes = []
            data = [self.__getVehicleClassEmptyRow()]
            modulesAll.sort()
            for module in modulesAll:
                if module.type in classes:
                    continue
                classes.append(module.type)
                data.append(
                    _packItemVO(
                        module.type,
                        DIALOGS.recruitwindow_vehicleclassdropdown(
                            module.type)))

            self.as_setVehicleClassDataS(
                self.__getSendingData(data,
                                      len(data) > 1, 0))
        return
Пример #8
0
    def updateAllDropdowns(self, nationID, tankType, typeID, roleType):
        nationsDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}, {'id': nationID,
          'label': MENU.nations(nations.NAMES[int(nationID)])}]
        classesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}, {'id': tankType,
          'label': DIALOGS.recruitwindow_vehicleclassdropdown(tankType)}]
        typesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        rolesDP = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        unlocks = yield StatsRequester().getUnlocks()
        modulesAll = yield Requester('vehicle').getFromShop()
        for module in modulesAll:
            compdecs = module.descriptor.type.compactDescr
            if compdecs in unlocks and module.descriptor.type.id[0] == nationID and module.descriptor.type.id[1] == typeID:
                typesDP.append({'id': module.descriptor.type.id[1],
                 'label': module.descriptor.type.shortUserString})
                for role in module.descriptor.type.crewRoles:
                    if role[0] == roleType:
                        rolesDP.append({'id': role[0],
                         'label': convert(getSkillsConfig()[role[0]]['userString'])})

                break

        self.flashObject.as_setAllDropdowns(nationsDP, classesDP, typesDP, rolesDP)
        return
    def __collectPredefinedRoleData(self):
        criteria = self.__getNationsCriteria()
        selectedNationsIds = []
        if self.__hasPredefinedNations():
            selectedNationsIds = self.__predefinedNationsIdxs
        else:
            for nId in nations.INDICES.itervalues():
                selectedNationsIds.append(nId)

        criteria |= REQ_CRITERIA.NATIONS(selectedNationsIds)
        if not constants.IS_IGR_ENABLED:
            criteria |= ~REQ_CRITERIA.VEHICLE.IS_PREMIUM_IGR
        if constants.IS_DEVELOPMENT:
            criteria |= ~REQ_CRITERIA.VEHICLE.IS_BOT
        modulesAll = self.itemsCache.items.getVehicles(
            criteria=criteria).values()
        modulesAll.sort()
        self.__filteredNations = dict()
        self.__filteredVehClasses = dict()
        self.__filteredVehClasses.setdefault(
            DEFAULT_NATION, [self.__getVehicleClassEmptyRow()])
        self.__filteredVehicles = dict()
        filteredVehClassesByNation = dict()
        count = 0
        for module in modulesAll:
            roleFound = False
            for role in module.descriptor.type.crewRoles:
                if not roleFound and role[0] in self.__predefinedTmanRoles:
                    roleFound = True
                    nationID, _ = module.descriptor.type.id
                    self.__filteredNations.setdefault(
                        nationID,
                        _packItemVO(nationID,
                                    MENU.nations(nations.NAMES[nationID])))
                    vehicleClassesSet = filteredVehClassesByNation.setdefault(
                        nationID, set())
                    self.__filteredVehClasses.setdefault(
                        DEFAULT_NATION, [self.__getVehicleClassEmptyRow()])
                    currentType = module.type
                    if currentType not in vehicleClassesSet:
                        vehicleClassesSet.add(module.type)
                        vehClasses = self.__filteredVehClasses.setdefault(
                            nationID, [self.__getVehicleClassEmptyRow()])
                        vehClasses.append(
                            _packItemVO(
                                currentType,
                                DIALOGS.recruitwindow_vehicleclassdropdown(
                                    currentType)))
                    vehicles = self.__filteredVehicles.setdefault(
                        (nationID, currentType), [self.__getVehicleEmptyRow()])
                    vehicles.append(
                        _packItemVO(module.innationID, module.shortUserName))
                    count += 1

        if count < 1:
            _logger.error('Something wrong with recruit tankman default role!')
            self.__clearFilteredData()
Пример #10
0
def _getBattleChartsStatistics(battlesStats, levelDisabledTooltip):
    outcome = []
    tDict = battlesStats[0]
    typesRes = []
    for vehType in VEHICLE_TYPES_ORDER:
        typesRes.append({
            'xField':
            i18n.makeString(DIALOGS.vehicleselldialog_vehicletype(vehType)),
            'icon':
            '../maps/icons/filters/tanks/{0}.png'.format(vehType),
            'yField':
            tDict[vehType],
            'tooltip':
            PROFILE.SECTION_STATISTICS_CHART_TYPE_TOOLTIP
        })

    _setChartDataPercentages(typesRes)
    outcome.append(typesRes)
    tDict = battlesStats[1]
    nationRes = []
    for guiNationIdx, _ in enumerate(GUI_NATIONS):
        nationIdx = getNationIndex(guiNationIdx)
        nationName = nations.NAMES[nationIdx]
        nationRes.append({
            'xField':
            i18n.makeString(MENU.nations(nationName)),
            'icon':
            '../maps/icons/filters/nations/{0}.png'.format(nationName),
            'yField':
            tDict[nationIdx],
            'tooltip':
            PROFILE.SECTION_STATISTICS_CHART_NATION_TOOLTIP
        })

    _setChartDataPercentages(nationRes)
    outcome.append(nationRes)
    tDict = battlesStats[2]
    lvlRes = len(tDict) * [None]
    for level, value in tDict.iteritems():
        tooltip = PROFILE.SECTION_STATISTICS_CHART_LEVEL_TOOLTIP
        if value is None:
            value = -1
            if levelDisabledTooltip is not None:
                tooltip = levelDisabledTooltip
        lvlRes[level - 1] = {
            'xField': str(level),
            'icon': '../maps/icons/levels/tank_level_{0}.png'.format(level),
            'yField': value,
            'tooltip': tooltip
        }

    _setChartDataPercentages(lvlRes)
    outcome.append(lvlRes)
    return {'data': outcome}
def _getVehStatsByTypes(battlesStats):
    tDict = battlesStats[0]
    typesRes = []
    for vehType in VEHICLE_TYPES_ORDER:
        typesRes.append({'xField': i18n.makeString(DIALOGS.vehicleselldialog_vehicletype(vehType)),
         'icon': '../maps/icons/filters/tanks/{0}.png'.format(vehType),
         'yField': tDict[vehType],
         'tooltip': PROFILE.SECTION_STATISTICS_CHART_TYPE_TOOLTIP})

    _setChartDataPercentages(typesRes)
    return typesRes
Пример #12
0
    def updateVehicleClassDropdown(self, nationID):
        Waiting.show("updating")
        modulesAll = g_itemsCache.items.getVehicles(self.__getClassesCriteria(nationID)).values()
        classes = []
        data = [{"id": None, "label": DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        modulesAll.sort()
        for module in modulesAll:
            if module.type in classes:
                continue
            classes.append(module.type)
            data.append({"id": module.type, "label": DIALOGS.recruitwindow_vehicleclassdropdown(module.type)})

        self.flashObject.as_setVehicleClassDropdown(data)
        Waiting.hide("updating")
        return
Пример #13
0
    def updateVehicleClassDropdown(self, nationID):
        Waiting.show('updating')
        modulesAll = g_itemsCache.items.getVehicles(self.__getClassesCriteria(nationID)).values()
        classes = []
        data = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        modulesAll.sort()
        for module in modulesAll:
            if module.type in classes:
                continue
            classes.append(module.type)
            data.append({'id': module.type,
             'label': DIALOGS.recruitwindow_vehicleclassdropdown(module.type)})

        self.flashObject.as_setVehicleClassDropdown(data)
        Waiting.hide('updating')
        return
Пример #14
0
 def _getOptainHeaderData(self, vehicle):
     from helpers import int2roman
     levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(vehicle.level)), text_styles.main(i18n.makeString(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
     if vehicle.isElite:
         description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(vehicle.type)
     else:
         description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
     return {'userName': vehicle.userName,
      'levelStr': levelStr,
      'description': description,
      'intCD': vehicle.intCD,
      'icon': vehicle.icon,
      'level': vehicle.level,
      'isElite': vehicle.isElite,
      'isPremium': vehicle.isPremium,
      'type': vehicle.type,
      'nationID': self.nationID}
Пример #15
0
    def updateVehicleClassDropdown(self, nationID):
        Waiting.show('updating')
        unlocks = yield StatsRequester().getUnlocks()
        modulesAll = yield Requester('vehicle').getFromShop()
        classes = []
        data = [{'id': None,
          'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        modulesAll.sort()
        for module in modulesAll:
            compdecs = module.descriptor.type.compactDescr
            if compdecs in unlocks and module.descriptor.type.id[0] == nationID and module.type not in classes:
                classes.append(module.type)
                data.append({'id': module.type,
                 'label': DIALOGS.recruitwindow_vehicleclassdropdown(module.type)})

        self.flashObject.as_setVehicleClassDropdown(data)
        Waiting.hide('updating')
        return
    def changeNation(self, nationID):
        Waiting.show('updating')
        self.__selectedNation = nationID
        modulesAll = g_itemsCache.items.getVehicles(self.__getClassesCriteria(nationID)).values()
        classes = []
        data = [self.__getVehicleClassEmptyRow()]
        modulesAll.sort()
        for module in modulesAll:
            if module.type in classes:
                continue
            classes.append(module.type)
            data.append({'id': module.type,
             'label': DIALOGS.recruitwindow_vehicleclassdropdown(module.type)})

        self.as_setVehicleClassDataS(self.__getSendingData(data, len(data) > 1, 0))
        self.as_setVehicleDataS(self.__getSendingData([self.__getVehicleEmptyRow()], False, 0))
        self.as_setTankmanRoleDataS(self.__getSendingData([self.__getTankmanRoleEmptyRow()], False, 0))
        Waiting.hide('updating')
        self.onDataChange(self.__selectedNation, self.__selectedVehClass, self.__selectedVehicle, self.__selectedTmanRole)
Пример #17
0
    def updateAllDropdowns(self, nationID, tankType, typeID, roleType):
        nationsDP = [{
            'id': None,
            'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW
        }, {
            'id': nationID,
            'label': MENU.nations(nations.NAMES[int(nationID)])
        }]
        classesDP = [{
            'id': None,
            'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW
        }, {
            'id':
            tankType,
            'label':
            DIALOGS.recruitwindow_vehicleclassdropdown(tankType)
        }]
        typesDP = [{'id': None, 'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        rolesDP = [{'id': None, 'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        unlocks = yield StatsRequester().getUnlocks()
        modulesAll = yield Requester('vehicle').getFromShop()
        for module in modulesAll:
            compdecs = module.descriptor.type.compactDescr
            if compdecs in unlocks and module.descriptor.type.id[
                    0] == nationID and module.descriptor.type.id[1] == typeID:
                typesDP.append({
                    'id': module.descriptor.type.id[1],
                    'label': module.descriptor.type.shortUserString
                })
                for role in module.descriptor.type.crewRoles:
                    if role[0] == roleType:
                        rolesDP.append({
                            'id':
                            role[0],
                            'label':
                            convert(getSkillsConfig()[role[0]]['userString'])
                        })

                break

        self.flashObject.as_setAllDropdowns(nationsDP, classesDP, typesDP,
                                            rolesDP)
        return
    def __setVehicleClassesData(self):
        modulesAll = self.itemsCache.items.getVehicles(
            self.__getClassesCriteria(self.__selectedNation)).values()
        classes = []
        data = [self.__getVehicleClassEmptyRow()]
        modulesAll.sort()
        for module in modulesAll:
            if module.type in classes:
                continue
            classes.append(module.type)
            data.append({
                'id':
                module.type,
                'label':
                DIALOGS.recruitwindow_vehicleclassdropdown(module.type)
            })

        self.as_setVehicleClassDataS(
            self.__getSendingData(data,
                                  len(data) > 1, 0))
Пример #19
0
def _getBattleChartsStatistics(battlesStats, levelDisabledTooltip):
    outcome = []
    tDict = battlesStats[0]
    typesRes = []
    for vehType in VEHICLE_TYPES_ORDER:
        typesRes.append({'xField': i18n.makeString(DIALOGS.vehicleselldialog_vehicletype(vehType)),
         'icon': '../maps/icons/filters/tanks/{0}.png'.format(vehType),
         'yField': tDict[vehType],
         'tooltip': PROFILE.SECTION_STATISTICS_CHART_TYPE_TOOLTIP})

    _setChartDataPercentages(typesRes)
    outcome.append(typesRes)
    tDict = battlesStats[1]
    nationRes = []
    for guiNationIdx, _ in enumerate(GUI_NATIONS):
        nationIdx = getNationIndex(guiNationIdx)
        nationName = nations.NAMES[nationIdx]
        nationRes.append({'xField': i18n.makeString(MENU.nations(nationName)),
         'icon': '../maps/icons/filters/nations/{0}.png'.format(nationName),
         'yField': tDict[nationIdx],
         'tooltip': PROFILE.SECTION_STATISTICS_CHART_NATION_TOOLTIP})

    _setChartDataPercentages(nationRes)
    outcome.append(nationRes)
    tDict = battlesStats[2]
    lvlRes = len(tDict) * [None]
    for level, value in tDict.iteritems():
        tooltip = PROFILE.SECTION_STATISTICS_CHART_LEVEL_TOOLTIP
        if value is None:
            value = -1
            if levelDisabledTooltip != None:
                tooltip = levelDisabledTooltip
        lvlRes[level - 1] = {'xField': str(level),
         'icon': '../maps/icons/levels/tank_level_{0}.png'.format(level),
         'yField': value,
         'tooltip': tooltip}

    _setChartDataPercentages(lvlRes)
    outcome.append(lvlRes)
    return {'data': outcome}
Пример #20
0
    def updateVehicleClassDropdown(self, nationID):
        Waiting.show('updating')
        unlocks = yield StatsRequester().getUnlocks()
        modulesAll = yield Requester('vehicle').getFromShop()
        classes = []
        data = [{'id': None, 'label': DIALOGS.RECRUITWINDOW_MENUEMPTYROW}]
        modulesAll.sort()
        for module in modulesAll:
            compdecs = module.descriptor.type.compactDescr
            if compdecs in unlocks and module.descriptor.type.id[
                    0] == nationID and module.type not in classes:
                classes.append(module.type)
                data.append({
                    'id':
                    module.type,
                    'label':
                    DIALOGS.recruitwindow_vehicleclassdropdown(module.type)
                })

        self.flashObject.as_setVehicleClassDropdown(data)
        Waiting.hide('updating')
        return
Пример #21
0
    def _showAward(self, ctx):
        _, message = ctx
        arenaTypeID = message.data.get("arenaTypeID", 0)
        if arenaTypeID > 0 and arenaTypeID in ArenaType.g_cache:
            arenaType = ArenaType.g_cache[arenaTypeID]
        else:
            arenaType = None
        arenaCreateTime = message.data.get("arenaCreateTime", None)
        fairplayViolations = message.data.get("fairplayViolations", None)
        if arenaCreateTime and arenaType and fairplayViolations is not None and fairplayViolations[:2] != (0, 0):
            penaltyType = None
            violation = None
            if fairplayViolations[1] != 0:
                penaltyType = "penalty"
                violation = fairplayViolations[1]
            elif fairplayViolations[0] != 0:
                penaltyType = "warning"
                violation = fairplayViolations[0]
            from gui.DialogsInterface import showDialog

            showDialog(
                I18PunishmentDialogMeta(
                    "punishmentWindow",
                    None,
                    {
                        "penaltyType": penaltyType,
                        "arenaName": i18n.makeString(arenaType.name),
                        "time": TimeFormatter.getActualMsgTimeStr(arenaCreateTime),
                        "reason": i18n.makeString(
                            DIALOGS.all("punishmentWindow/reason/%s" % getFairPlayViolationName(violation))
                        ),
                    },
                ),
                lambda *args: None,
            )
        return
Пример #22
0
 def getLabels(self):
     return [{'id': DIALOG_BUTTON_ID.CLOSE,
       'label': DIALOGS.all(I18N_CANCEL_KEY.format(self._i18nKey)),
       'focused': True}]
Пример #23
0
    def _populate(self):
        super(VehicleSellDialog, self)._populate()
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr})
        g_itemsCache.onSyncCompleted += self.__shopResyncHandler
        items = g_itemsCache.items
        vehicle = items.getVehicle(self.vehInvID)
        sellPrice = vehicle.sellPrice
        sellForGold = sellPrice.gold > 0
        priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR
        priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms(
            BigWorld.wg_getIntegralFormat(
                sellPrice.gold if sellForGold else sellPrice.credits))
        currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS
        invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY)
        if vehicle.isPremium or vehicle.level >= 3:
            self.as_visibleControlBlockS(True)
            self.__initCtrlQuestion()
        else:
            self.as_visibleControlBlockS(False)
        modules = items.getItems(
            criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle])
            | REQ_CRITERIA.INVENTORY).values()
        shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE(
            [vehicle], [GUI_ITEM_TYPE.SHELL])
                                | REQ_CRITERIA.INVENTORY).values()
        otherVehsShells = set()
        for invVeh in invVehs.itervalues():
            if invVeh.invID != self.vehInvID:
                for shot in invVeh.descriptor.gun['shots']:
                    otherVehsShells.add(shot['shell']['compactDescr'])

        vehicleAction = None
        if sellPrice != vehicle.defaultSellPrice:
            vehicleAction = packItemActionTooltipData(vehicle, False)
        if vehicle.isElite:
            description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(
                vehicle.type)
        else:
            description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
        levelStr = text_styles.concatStylesWithSpace(
            text_styles.stats(int2roman(vehicle.level)),
            text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
        tankmenGoingToBuffer, deletedTankmen = self.restore.getTankmenDeletedBySelling(
            vehicle)
        deletedCount = len(deletedTankmen)
        if deletedCount > 0:
            recoveryBufferFull = True
            deletedStr = formatDeletedTankmanStr(deletedTankmen[0])
            maxCount = self.restore.getMaxTankmenBufferLength()
            currCount = len(self.restore.getDismissedTankmen())
            if deletedCount == 1:
                crewTooltip = text_styles.concatStylesToMultiLine(
                    text_styles.middleTitle(
                        _ms(TOOLTIPS.
                            VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)),
                    text_styles.main(
                        _ms(TOOLTIPS.
                            VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY,
                            maxVal=maxCount,
                            curVal=currCount,
                            sourceName=tankmenGoingToBuffer[-1].fullUserName,
                            targetInfo=deletedStr)))
            else:
                crewTooltip = text_styles.concatStylesToMultiLine(
                    text_styles.middleTitle(
                        _ms(TOOLTIPS.
                            VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)),
                    text_styles.main(
                        _ms(TOOLTIPS.
                            DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY,
                            deletedStr=deletedStr,
                            extraCount=deletedCount - 1,
                            maxCount=maxCount,
                            currCount=currCount)))
        else:
            crewTooltip = None
            recoveryBufferFull = False
        barracksDropDownData = [{
            'label': _ms(MENU.BARRACKS_BTNUNLOAD)
        }, {
            'label': _ms(MENU.BARRACKS_BTNDISSMISS)
        }]
        sellVehicleData = {
            'intCD': vehicle.intCD,
            'userName': vehicle.userName,
            'icon': vehicle.icon,
            'level': vehicle.level,
            'isElite': vehicle.isElite,
            'isPremium': vehicle.isPremium,
            'type': vehicle.type,
            'nationID': vehicle.nationID,
            'sellPrice': sellPrice,
            'priceTextValue': priceTextValue,
            'priceTextColor': priceTextColor,
            'currencyIcon': currencyIcon,
            'action': vehicleAction,
            'hasCrew': vehicle.hasCrew,
            'isRented': vehicle.isRented,
            'description': description,
            'levelStr': levelStr,
            'priceLabel':
            _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE),
            'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL),
            'crewTooltip': crewTooltip,
            'barracksDropDownData': barracksDropDownData,
            'crewRecoveryBufferFull': recoveryBufferFull
        }
        onVehicleOptionalDevices = []
        for o in vehicle.optDevices:
            if o is not None:
                action = None
                if o.sellPrice != o.defaultSellPrice:
                    action = packItemActionTooltipData(o, False)
                data = {
                    'intCD': o.intCD,
                    'isRemovable': o.isRemovable,
                    'userName': o.userName,
                    'sellPrice': o.sellPrice,
                    'toInventory': True,
                    'action': action
                }
                onVehicleOptionalDevices.append(data)

        onVehicleoShells = []
        for shell in vehicle.shells:
            if shell is not None:
                action = None
                if shell.sellPrice != shell.defaultSellPrice:
                    action = packItemActionTooltipData(shell, False)
                data = {
                    'intCD': shell.intCD,
                    'count': shell.count,
                    'sellPrice': shell.sellPrice,
                    'userName': shell.userName,
                    'kind': shell.type,
                    'toInventory': shell in otherVehsShells or shell.isPremium,
                    'action': action
                }
                onVehicleoShells.append(data)

        onVehicleEquipments = []
        for equipmnent in vehicle.eqs:
            if equipmnent is not None:
                action = None
                if equipmnent.sellPrice != equipmnent.defaultSellPrice:
                    action = packItemActionTooltipData(equipmnent, False)
                data = {
                    'intCD': equipmnent.intCD,
                    'userName': equipmnent.userName,
                    'sellPrice': equipmnent.sellPrice,
                    'toInventory': True,
                    'action': action
                }
                onVehicleEquipments.append(data)

        inInventoryModules = []
        for m in modules:
            inInventoryModules.append({
                'intCD': m.intCD,
                'inventoryCount': m.inventoryCount,
                'toInventory': True,
                'sellPrice': m.sellPrice
            })

        inInventoryShells = []
        for s in shells:
            action = None
            if s.sellPrice != s.defaultSellPrice:
                action = packItemActionTooltipData(s, False)
            inInventoryShells.append({
                'intCD': s.intCD,
                'count': s.inventoryCount,
                'sellPrice': s.sellPrice,
                'userName': s.userName,
                'kind': s.type,
                'toInventory': s in otherVehsShells or s.isPremium,
                'action': action
            })

        removePrice = items.shop.paidRemovalCost
        removePrices = Money(gold=removePrice)
        defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost)
        removeAction = None
        if removePrices != defRemovePrice:
            removeAction = packActionTooltipData(
                ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True,
                removePrices, defRemovePrice)
        settings = self.getDialogSettings()
        isSlidingComponentOpened = settings['isOpened']
        self.as_setDataS({
            'accountGold': items.stats.gold,
            'sellVehicleVO': sellVehicleData,
            'optionalDevicesOnVehicle': onVehicleOptionalDevices,
            'shellsOnVehicle': onVehicleoShells,
            'equipmentsOnVehicle': onVehicleEquipments,
            'modulesInInventory': inInventoryModules,
            'shellsInInventory': inInventoryShells,
            'removeActionPrice': removeAction,
            'removePrice': removePrice,
            'isSlidingComponentOpened': isSlidingComponentOpened
        })
        return
Пример #24
0
 def getLabels(self):
     return [{
         'id': DIALOG_BUTTON_ID.CLOSE,
         'label': DIALOGS.all(I18N_CANCEL_KEY.format(self._i18nKey)),
         'focused': True
     }]
Пример #25
0
 def _makeString(self, key, ctx):
     return i18n.makeString(DIALOGS.all(key), **ctx)
Пример #26
0
    def _populate(self):
        super(VehicleSellDialog, self)._populate()
        g_clientUpdateManager.addCurrencyCallback(Currency.GOLD,
                                                  self.onSetGoldHndlr)
        self.itemsCache.onSyncCompleted += self.__shopResyncHandler
        items = self.itemsCache.items
        vehicle = items.getVehicle(self.__vehInvID)
        sellPrice = vehicle.sellPrices.itemPrice.price
        sellCurrency = sellPrice.getCurrency(byWeight=True)
        sellForGold = sellCurrency == Currency.GOLD
        priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR
        priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms(
            BigWorld.wg_getIntegralFormat(
                sellPrice.getSignValue(sellCurrency)))
        currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS
        invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY)
        self.checkControlQuestion(self.__checkUsefulTankman)
        modules = items.getItems(
            criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle])
            | REQ_CRITERIA.INVENTORY).values()
        shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE(
            [vehicle], [GUI_ITEM_TYPE.SHELL])
                                | REQ_CRITERIA.INVENTORY).values()
        otherVehsShells = set()
        for invVeh in invVehs.itervalues():
            if invVeh.invID != self.__vehInvID:
                for shot in invVeh.descriptor.gun.shots:
                    otherVehsShells.add(shot.shell.compactDescr)

        vehicleAction = None
        if vehicle.sellPrices.itemPrice.isActionPrice():
            vehicleAction = packItemActionTooltipData(vehicle, False)
        if vehicle.isElite:
            description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(
                vehicle.type)
        else:
            description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
        levelStr = text_styles.concatStylesWithSpace(
            text_styles.stats(int2roman(vehicle.level)),
            text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
        tankmenGoingToBuffer, deletedTankmen = self.restore.getTankmenDeletedBySelling(
            vehicle)
        deletedCount = len(deletedTankmen)
        if deletedCount > 0:
            deletedStr = formatDeletedTankmanStr(deletedTankmen[0])
            maxCount = self.restore.getMaxTankmenBufferLength()
            currCount = len(self.restore.getDismissedTankmen())
            if deletedCount == 1:
                crewTooltip = text_styles.concatStylesToMultiLine(
                    text_styles.middleTitle(
                        _ms(TOOLTIPS.
                            VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)),
                    text_styles.main(
                        _ms(TOOLTIPS.
                            VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY,
                            maxVal=maxCount,
                            curVal=currCount,
                            sourceName=tankmenGoingToBuffer[-1].fullUserName,
                            targetInfo=deletedStr)))
            else:
                crewTooltip = text_styles.concatStylesToMultiLine(
                    text_styles.middleTitle(
                        _ms(TOOLTIPS.
                            VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)),
                    text_styles.main(
                        _ms(TOOLTIPS.
                            DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY,
                            deletedStr=deletedStr,
                            extraCount=deletedCount - 1,
                            maxCount=maxCount,
                            currCount=currCount)))
        else:
            crewTooltip = None
        if vehicle.isCrewLocked:
            hasCrew = False
        else:
            hasCrew = vehicle.hasCrew
        barracksDropDownData = [{
            'label': _ms(MENU.BARRACKS_BTNUNLOAD)
        }, {
            'label': _ms(MENU.BARRACKS_BTNDISSMISS)
        }]
        sellVehicleData = {
            'intCD': vehicle.intCD,
            'userName': vehicle.userName,
            'icon': vehicle.icon,
            'level': vehicle.level,
            'isElite': vehicle.isElite,
            'isPremium': vehicle.isPremium,
            'type': vehicle.type,
            'nationID': vehicle.nationID,
            'sellPrice': sellPrice.toMoneyTuple(),
            'priceTextValue': priceTextValue,
            'priceTextColor': priceTextColor,
            'currencyIcon': currencyIcon,
            'action': vehicleAction,
            'hasCrew': hasCrew,
            'isRented': vehicle.isRented,
            'description': description,
            'levelStr': levelStr,
            'priceLabel':
            _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE),
            'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL),
            'crewTooltip': crewTooltip,
            'barracksDropDownData': barracksDropDownData
        }
        currentGoldBalance = self.itemsCache.items.stats.money.get(
            Currency.GOLD, 0)
        onVehicleOptionalDevices = []
        for o in vehicle.optDevices:
            if o is not None:
                itemPrice = o.sellPrices.itemPrice
                action = None
                if itemPrice.isActionPrice():
                    action = packItemActionTooltipData(o, False)
                removalPrice = o.getRemovalPrice(items)
                removeAction = None
                if removalPrice.isActionPrice():
                    removeAction = packActionTooltipData(
                        ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost',
                        True, removalPrice.price, removalPrice.defPrice)
                removalPriceInGold = removalPrice.price.get(Currency.GOLD, 0)
                enoughGold = currentGoldBalance >= removalPriceInGold
                if enoughGold:
                    currentGoldBalance -= removalPriceInGold
                data = {
                    'intCD': o.intCD,
                    'isRemovable': o.isRemovable,
                    'userName': o.userName,
                    'sellPrice': itemPrice.price.toMoneyTuple(),
                    'toInventory': enoughGold,
                    'action': action,
                    'removePrice': removalPrice.price.toMoneyTuple(),
                    'removeActionPrice': removeAction
                }
                onVehicleOptionalDevices.append(data)

        onVehicleoShells = []
        for shell in vehicle.shells:
            if shell is not None:
                itemPrice = shell.sellPrices.itemPrice
                action = None
                if itemPrice.isActionPrice():
                    action = packItemActionTooltipData(shell, False)
                data = {
                    'intCD': shell.intCD,
                    'count': shell.count,
                    'sellPrice': itemPrice.price.toMoneyTuple(),
                    'userName': shell.userName,
                    'kind': shell.type,
                    'toInventory': shell in otherVehsShells or shell.isPremium,
                    'action': action
                }
                onVehicleoShells.append(data)

        onVehicleEquipments = []
        for equipmnent in vehicle.equipment.regularConsumables.getInstalledItems(
        ):
            action = None
            if equipmnent.sellPrices.itemPrice.isActionPrice():
                action = packItemActionTooltipData(equipmnent, False)
            data = {
                'intCD': equipmnent.intCD,
                'userName': equipmnent.userName,
                'sellPrice':
                equipmnent.sellPrices.itemPrice.price.toMoneyTuple(),
                'toInventory': True,
                'action': action
            }
            onVehicleEquipments.append(data)

        onVehicleBattleBoosters = []
        for booster in vehicle.equipment.battleBoosterConsumables.getInstalledItems(
        ):
            data = {
                'intCD': booster.intCD,
                'userName': booster.userName,
                'sellPrice': MONEY_UNDEFINED.toMoneyTuple(),
                'onlyToInventory': True
            }
            onVehicleBattleBoosters.append(data)

        inInventoryModules = []
        for m in modules:
            inInventoryModules.append({
                'intCD':
                m.intCD,
                'inventoryCount':
                m.inventoryCount,
                'toInventory':
                True,
                'sellPrice':
                m.sellPrices.itemPrice.price.toMoneyTuple()
            })

        inInventoryShells = []
        for s in shells:
            action = None
            itemPrice = s.sellPrices.itemPrice
            if itemPrice.isActionPrice():
                action = packItemActionTooltipData(s, False)
            inInventoryShells.append({
                'intCD':
                s.intCD,
                'count':
                s.inventoryCount,
                'sellPrice':
                itemPrice.price.toMoneyTuple(),
                'userName':
                s.userName,
                'kind':
                s.type,
                'toInventory':
                s in otherVehsShells or s.isPremium,
                'action':
                action
            })

        customizationOnVehicle = []
        settings = self.getDialogSettings()
        isSlidingComponentOpened = settings['isOpened']
        self.as_setDataS({
            'accountMoney': items.stats.money.toMoneyTuple(),
            'sellVehicleVO': sellVehicleData,
            'optionalDevicesOnVehicle': onVehicleOptionalDevices,
            'shellsOnVehicle': onVehicleoShells,
            'equipmentsOnVehicle': onVehicleEquipments,
            'modulesInInventory': inInventoryModules,
            'shellsInInventory': inInventoryShells,
            'isSlidingComponentOpened': isSlidingComponentOpened,
            'battleBoostersOnVehicle': onVehicleBattleBoosters,
            'customizationOnVehicle': customizationOnVehicle
        })
        return
Пример #27
0
 def getConfirmDialogMeta(self):
     message = DIALOGS.exitcurrentprebattle_custommessage(PREBATTLE_TYPE_NAMES[self.getPrbType()])
     return I18nConfirmDialogMeta('exitCurrentPrebattle', meta=SimpleDialogMeta(message=message))
Пример #28
0
 def _makeString(self, key, ctx):
     return i18n.makeString(DIALOGS.all(key), **ctx)
Пример #29
0
    def _populate(self):
        super(VehicleSellDialog, self)._populate()
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr})
        g_itemsCache.onSyncCompleted += self.__shopResyncHandler
        items = g_itemsCache.items
        vehicle = items.getVehicle(self.vehInvID)
        sellPrice = vehicle.sellPrice
        sellForGold = sellPrice.gold > 0
        priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR
        priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms(BigWorld.wg_getIntegralFormat(sellPrice.gold if sellForGold else sellPrice.credits))
        currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS
        invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY)
        if vehicle.isPremium or vehicle.level >= 3:
            self.as_visibleControlBlockS(True)
            self.__initCtrlQuestion()
        else:
            self.as_visibleControlBlockS(False)
        modules = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle]) | REQ_CRITERIA.INVENTORY).values()
        shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle], [GUI_ITEM_TYPE.SHELL]) | REQ_CRITERIA.INVENTORY).values()
        otherVehsShells = set()
        for invVeh in invVehs.itervalues():
            if invVeh.invID != self.vehInvID:
                for shot in invVeh.descriptor.gun['shots']:
                    otherVehsShells.add(shot['shell']['compactDescr'])

        vehicleAction = None
        if sellPrice != vehicle.defaultSellPrice:
            vehicleAction = packItemActionTooltipData(vehicle, False)
        if vehicle.isElite:
            description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(vehicle.type)
        else:
            description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
        levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(vehicle.level)), text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
        restoreController = getRestoreController()
        tankmenGoingToBuffer, deletedTankmen = restoreController.getTankmenDeletedBySelling(vehicle)
        deletedCount = len(deletedTankmen)
        if deletedCount > 0:
            recoveryBufferFull = True
            deletedStr = formatDeletedTankmanStr(deletedTankmen[0])
            maxCount = restoreController.getMaxTankmenBufferLength()
            currCount = len(restoreController.getDismissedTankmen())
            if deletedCount == 1:
                crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY, maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr)))
            else:
                crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY, deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount)))
        else:
            crewTooltip = None
            recoveryBufferFull = False
        barracksDropDownData = [{'label': _ms(MENU.BARRACKS_BTNUNLOAD)}, {'label': _ms(MENU.BARRACKS_BTNDISSMISS)}]
        sellVehicleData = {'intCD': vehicle.intCD,
         'userName': vehicle.userName,
         'icon': vehicle.icon,
         'level': vehicle.level,
         'isElite': vehicle.isElite,
         'isPremium': vehicle.isPremium,
         'type': vehicle.type,
         'nationID': vehicle.nationID,
         'sellPrice': sellPrice,
         'priceTextValue': priceTextValue,
         'priceTextColor': priceTextColor,
         'currencyIcon': currencyIcon,
         'action': vehicleAction,
         'hasCrew': vehicle.hasCrew,
         'isRented': vehicle.isRented,
         'description': description,
         'levelStr': levelStr,
         'priceLabel': _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE),
         'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL),
         'crewTooltip': crewTooltip,
         'barracksDropDownData': barracksDropDownData,
         'crewRecoveryBufferFull': recoveryBufferFull}
        onVehicleOptionalDevices = []
        for o in vehicle.optDevices:
            if o is not None:
                action = None
                if o.sellPrice != o.defaultSellPrice:
                    action = packItemActionTooltipData(o, False)
                data = {'intCD': o.intCD,
                 'isRemovable': o.isRemovable,
                 'userName': o.userName,
                 'sellPrice': o.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleOptionalDevices.append(data)

        onVehicleoShells = []
        for shell in vehicle.shells:
            if shell is not None:
                action = None
                if shell.sellPrice != shell.defaultSellPrice:
                    action = packItemActionTooltipData(shell, False)
                data = {'intCD': shell.intCD,
                 'count': shell.count,
                 'sellPrice': shell.sellPrice,
                 'userName': shell.userName,
                 'kind': shell.type,
                 'toInventory': shell in otherVehsShells or shell.isPremium,
                 'action': action}
                onVehicleoShells.append(data)

        onVehicleEquipments = []
        for equipmnent in vehicle.eqs:
            if equipmnent is not None:
                action = None
                if equipmnent.sellPrice != equipmnent.defaultSellPrice:
                    action = packItemActionTooltipData(equipmnent, False)
                data = {'intCD': equipmnent.intCD,
                 'userName': equipmnent.userName,
                 'sellPrice': equipmnent.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleEquipments.append(data)

        inInventoryModules = []
        for m in modules:
            inInventoryModules.append({'intCD': m.intCD,
             'inventoryCount': m.inventoryCount,
             'toInventory': True,
             'sellPrice': m.sellPrice})

        inInventoryShells = []
        for s in shells:
            action = None
            if s.sellPrice != s.defaultSellPrice:
                action = packItemActionTooltipData(s, False)
            inInventoryShells.append({'intCD': s.intCD,
             'count': s.inventoryCount,
             'sellPrice': s.sellPrice,
             'userName': s.userName,
             'kind': s.type,
             'toInventory': s in otherVehsShells or s.isPremium,
             'action': action})

        removePrice = items.shop.paidRemovalCost
        removePrices = Money(gold=removePrice)
        defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost)
        removeAction = None
        if removePrices != defRemovePrice:
            removeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removePrices, defRemovePrice)
        settings = self.getDialogSettings()
        isSlidingComponentOpened = settings['isOpened']
        self.as_setDataS({'accountGold': items.stats.gold,
         'sellVehicleVO': sellVehicleData,
         'optionalDevicesOnVehicle': onVehicleOptionalDevices,
         'shellsOnVehicle': onVehicleoShells,
         'equipmentsOnVehicle': onVehicleEquipments,
         'modulesInInventory': inInventoryModules,
         'shellsInInventory': inInventoryShells,
         'removeActionPrice': removeAction,
         'removePrice': removePrice,
         'isSlidingComponentOpened': isSlidingComponentOpened})
        return
Пример #30
0
 def getLabels(self):
     return [self.__getButtonInfoObject(DIALOG_BUTTON_ID.SUBMIT, DIALOGS.all(I18N_SUBMIT_KEY.format(self._i18nKey)), self._focusedIndex == DIALOG_BUTTON_ID.SUBMIT if self._focusedIndex is not None else True), self.__getButtonInfoObject(DIALOG_BUTTON_ID.CLOSE, DIALOGS.all(I18N_CANCEL_KEY.format(self._i18nKey)), self._focusedIndex == DIALOG_BUTTON_ID.CLOSE if self._focusedIndex is not None else False)]