예제 #1
0
 def _makePriceBlock(self, price, text, currencyType, neededValue = None, oldPrice = None, percent = 0):
     needFormatted = ''
     oldPriceText = ''
     hasAction = percent != 0
     if currencyType == ICON_TEXT_FRAMES.CREDITS:
         valueFormatted = text_styles.credits(_int(price))
         icon = icons.credits()
         if neededValue is not None:
             needFormatted = text_styles.credits(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icons.credits(), text_styles.credits(_int(oldPrice)))
     elif currencyType == ICON_TEXT_FRAMES.GOLD:
         valueFormatted = text_styles.gold(_int(price))
         icon = icons.gold()
         if neededValue is not None:
             needFormatted = text_styles.gold(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icons.gold(), text_styles.gold(_int(oldPrice)))
     elif currencyType == ICON_TEXT_FRAMES.XP:
         valueFormatted = text_styles.expText(_int(price))
         icon = icons.xp()
         if neededValue is not None:
             needFormatted = text_styles.expText(_int(neededValue))
     else:
         LOG_ERROR('Unsupported currency type "' + currencyType + '"!')
         return
     neededText = ''
     if neededValue is not None:
         neededText = text_styles.concatStylesToSingleLine(text_styles.main('( '), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(' )'))
     text = text_styles.concatStylesWithSpace(text_styles.main(text), neededText)
     if hasAction:
         actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText))
         text = text_styles.concatStylesToMultiLine(text, actionText)
     return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=currencyType, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=20))
예제 #2
0
 def __getConfirmator(self, withoutBenefits, period, price):
     if withoutBenefits:
         return plugins.HtmlMessageConfirmator(
             'buyPremWithoutBenefitsConfirmation',
             'html_templates:lobby/dialogs',
             'confirmBuyPremWithoutBenefeits', {
                 'days':
                 text_styles.stats(period),
                 Currency.GOLD:
                 text_styles.concatStylesWithSpace(
                     text_styles.gold(BigWorld.wg_getGoldFormat(price)),
                     icons.makeImageTag(
                         RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2))
             })
     localKey = 'premiumContinueConfirmation' if self.wasPremium else 'premiumBuyConfirmation'
     return plugins.MessageConfirmator(
         localKey,
         ctx={
             'days':
             text_styles.stats(period),
             Currency.GOLD:
             text_styles.concatStylesWithSpace(
                 text_styles.gold(BigWorld.wg_getGoldFormat(price)),
                 icons.makeImageTag(
                     RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2))
         })
 def __init__(self, tankman, firstNameID, firstNameGroup, lastNameID,
              lastNameGroup, iconID, iconGroup):
     hasUniqueData = self.__hasUniqueData(tankman, firstNameID, lastNameID,
                                          iconID)
     isFemale = tankman.descriptor.isFemale
     if isFemale:
         price = self.itemsCache.items.shop.passportFemaleChangeCost
     else:
         price = self.itemsCache.items.shop.passportChangeCost
     super(TankmanChangePassport, self).__init__(
         tankman,
         (plugins.TankmanChangePassportValidator(tankman),
          plugins.MessageConfirmator(
              'replacePassport/unique'
              if hasUniqueData else 'replacePassportConfirmation',
              ctx={
                  Currency.GOLD:
                  text_styles.concatStylesWithSpace(
                      text_styles.gold(BigWorld.wg_getGoldFormat(price)),
                      icons.makeImageTag(
                          RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2))
              })))
     self.firstNameID = firstNameID
     self.firstNameGroup = firstNameGroup
     self.lastNameID = lastNameID
     self.lastNameGroup = lastNameGroup
     self.iconID = iconID
     self.iconGroup = iconGroup
     self.isFemale = isFemale
     self.isPremium = tankman.descriptor.isPremium
     self.price = price
예제 #4
0
 def __init__(self, showConfirm=True, showWarning=True):
     self.__hasDiscounts = bool(
         self.itemsCache.items.shop.personalSlotDiscounts)
     self.__frozenSlotPrice = None
     slotCost = self.__getSlotPrice()
     if self.__hasDiscounts and not slotCost:
         confirmationType = 'freeSlotConfirmation'
         ctx = {}
     else:
         confirmationType = 'buySlotConfirmation'
         ctx = {
             'goldCost':
             text_styles.concatStylesWithSpace(
                 text_styles.gold(str(slotCost.gold)),
                 icons.makeImageTag(
                     RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2))
         }
     super(VehicleSlotBuyer, self).__init__(
         (proc_plugs.MessageInformator(
             'buySlotNotEnoughCredits',
             activeHandler=lambda: not proc_plugs.MoneyValidator(
                 slotCost).validate().success,
             isEnabled=showWarning),
          proc_plugs.MessageConfirmator(confirmationType,
                                        isEnabled=showConfirm,
                                        ctx=ctx),
          proc_plugs.MoneyValidator(slotCost)))
     return
예제 #5
0
 def __getItemRentInfo(self, item):
     """
     Get formatted vehicle rent info
     :param item: <Vehicle>
     :return:  <str>
     """
     if item.isRented:
         formatter = RentLeftFormatter(item.rentInfo, item.isPremiumIGR)
         return formatter.getRentLeftStr(
             '#tooltips:vehicle/rentLeft/%s',
             formatter=lambda key, countType, count, _=None: ''.join(
                 [makeString(key % countType), ': ',
                  str(count)]))
     elif item.isRentable and item.isRentAvailable:
         minRentPricePackage = item.getRentPackage()
         priceText = ''
         discountText = ''
         if minRentPricePackage:
             minRentPriceValue = minRentPricePackage['rentPrice']
             actionPrc = item.getRentPackageActionPrc(
                 minRentPricePackage['days'])
             currency = minRentPriceValue.getCurrency()
             price = minRentPriceValue.getSignValue(currency)
             priceText = makeHtmlString(
                 'html_templates:lobby/quests/actions', currency,
                 {'value': price})
             if actionPrc != 0:
                 discountText = makeString(
                     '#menu:shop/menu/vehicle/rent/discount',
                     discount=text_styles.gold('{} %'.format(actionPrc)))
         rentText = makeString('#menu:shop/menu/vehicle/rent/available',
                               price=priceText)
         return '{}  {}'.format(rentText, discountText)
     else:
         return ''
예제 #6
0
 def __setBottomPanelData(self, *args):
     if self.__isCarouselHidden:
         occupiedSlotsNum, totalSlotsNum = self.__controller.slots.getSummary()
         label = text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.TYPESWITCHSCREEN_SLOTSUMMARY, occupiedSlotsNum=occupiedSlotsNum, totalSlotsNum=totalSlotsNum))
     else:
         label = text_styles.middleTitle(_ms('#vehicle_customization:typeSwitchScreen/typeName/plural/{0}'.format(self.__controller.slots.currentType)))
     totalGold = self.__controller.cart.totalPriceGold
     totalCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = self.itemsCache.items.stats.gold >= totalGold
     enoughCredits = self.itemsCache.items.stats.credits >= totalCredits
     if not enoughGold:
         diff = text_styles.gold(totalGold - self.itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(totalCredits - self.itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits())))
     self.as_setBottomPanelHeaderS({'newHeaderText': label,
      'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(self.__controller.cart.items)),
      'pricePanel': {'totalPriceCredits': formatPriceCredits(totalCredits),
                     'totalPriceGold': formatPriceGold(totalGold),
                     'enoughGold': enoughGold,
                     'enoughCredits': enoughCredits,
                     'notEnoughGoldTooltip': notEnoughGoldTooltip,
                     'notEnoughCreditsTooltip': notEnoughCreditsTooltip}})
예제 #7
0
    def __getPurchaseItemVO(self, items):
        purchaseItems = []
        for item in items:
            if item['currencyIcon'] == RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2:
                price = text_styles.credits(item['price'])
            else:
                price = text_styles.gold(item['price'])
            data = {
                'name': text_styles.main(item['name']),
                'idx': item['idx'],
                'type': item['type'],
                'isTitle': False,
                'currencyIcon': item['currencyIcon'],
                'itemID': item['itemID'],
                'price': price,
                'removeItemIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS
            }
            if shared.isSale(item['type'], item['duration']):
                isGold = item[
                    'currencyIcon'] != RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2
                data['salePrice'] = shared.getSalePriceString(
                    isGold, item['price'])
            purchaseItems.append(data)

        return {
            'title':
            text_styles.highTitle(
                _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATIONPURCHASESPOPOVER_TITLE,
                    count=len(purchaseItems))),
            'popoverRenderers':
            purchaseItems
        }
예제 #8
0
 def __setBottomPanelData(self, *args):
     if self.__isCarouselHidden:
         occupiedSlotsNum, totalSlotsNum = self.__controller.slots.getSummary()
         label = text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.TYPESWITCHSCREEN_SLOTSUMMARY, occupiedSlotsNum=occupiedSlotsNum, totalSlotsNum=totalSlotsNum))
     else:
         label = text_styles.middleTitle(_ms('#vehicle_customization:typeSwitchScreen/typeName/plural/{0}'.format(self.__controller.slots.currentType)))
     totalGold = self.__controller.cart.totalPriceGold
     totalCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= totalGold
     enoughCredits = g_itemsCache.items.stats.credits >= totalCredits
     if not enoughGold:
         diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits())))
     self.as_setBottomPanelHeaderS({'newHeaderText': label,
      'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(self.__controller.cart.items)),
      'pricePanel': {'totalPriceCredits': formatPriceCredits(totalCredits),
                     'totalPriceGold': formatPriceGold(totalGold),
                     'enoughGold': enoughGold,
                     'enoughCredits': enoughCredits,
                     'notEnoughGoldTooltip': notEnoughGoldTooltip,
                     'notEnoughCreditsTooltip': notEnoughCreditsTooltip}})
 def __getGoldToExchangeTxt(self, resToExchange):
     if resToExchange > 0:
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = ''.join(
             (text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)),
              icons.gold()))
         return text_styles.main(
             self._makeString(I18N_NEEDGOLDTEXT_KEY, {'gold': fmtGold}))
예제 #10
0
 def __packStepsBlock(self):
     stepsNumber = self.item.getStepsCountToAchieve()
     stepsNumberStr = text_styles.gold(stepsNumber)
     if self.item.getID() == 1:
         locKey = TOOLTIPS.BATTLETYPES_RANKED_RANK_CONDITIONS_FIRST
     else:
         locKey = TOOLTIPS.BATTLETYPES_RANKED_RANK_CONDITIONS
     return text_styles.main(_ms(locKey, stepsNumber=stepsNumberStr))
 def __packStepsBlock(self):
     stepsNumber = self.item.getStepsCountToAchieve()
     stepsNumberStr = text_styles.gold(stepsNumber)
     if self.item.isFirstInDivision():
         locKey = R.strings.tooltips.battleTypes.ranked.rank.conditions.first()
     else:
         locKey = R.strings.tooltips.battleTypes.ranked.rank.conditions()
     return text_styles.main(backport.text(locKey, stepsNumber=stepsNumberStr))
 def _getState(self, resToExchange):
     if resToExchange <= 0:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE, text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)))
     if not self._isEnoughGold(resToExchange):
         goldToExchange = self._getGoldToExchange(resToExchange)
         fmtGold = ''.join((text_styles.gold(backport.getGoldFormat(goldToExchange)), icons.gold()))
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE, text_styles.error(self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY, {'gold': fmtGold})))
     return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, '')
예제 #13
0
 def _getBottom(self):
     if self.__rank > 0:
         rankSettings = self.__frontLine.getPlayerRanksInfo()
         exp, bonus = rankSettings.get(self.__rank, (0, 0))
         blocks = [
             formatters.packTextBlockData(
                 text=_ms(text_styles.main(TOOLTIPS.FRONTLINERANK_EXP),
                          exp=text_styles.gold(exp))),
             formatters.packTextBlockData(
                 text=_ms(text_styles.main(TOOLTIPS.FRONTLINERANK_EXPBONUS),
                          bonus=text_styles.gold('+%d%%' % bonus)))
         ]
         bottomBlocks = formatters.packBuildUpBlockData(
             blocks=blocks, layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_VERTICAL)
     else:
         bottomBlocks = formatters.packTextBlockData(text=_ms(
             text_styles.main(TOOLTIPS.FRONTLINERANK_FIRSTRANKDESCR)))
     return bottomBlocks
예제 #14
0
 def __setTotalData(self, *args):
     if self.__controller.cart.processingMultiplePurchase:
         return
     priceGold = self.__controller.cart.totalPriceGold
     priceCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = self.itemsCache.items.stats.gold >= priceGold
     enoughCredits = self.itemsCache.items.stats.credits >= priceCredits
     state = g_currentVehicle.getViewState()
     canBuy = bool(
         priceGold or priceCredits
     ) and enoughGold and enoughCredits and state.isCustomizationEnabled()
     if not enoughGold:
         diff = text_styles.gold(priceGold -
                                 self.itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(priceCredits -
                                    self.itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.credits())))
     inFormationAlert = text_styles.concatStylesWithSpace(
         icons.markerBlocked(),
         text_styles.error(
             VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT)
     ) if not state.isCustomizationEnabled() else ''
     self.as_setTotalDataS({
         'credits':
         formatPriceCredits(priceCredits),
         'gold':
         formatPriceGold(priceGold),
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=len(self.__searchDP.selectedItems),
                 total=len(self.__searchDP.items))),
         'enoughGold':
         enoughGold,
         'enoughCredits':
         enoughCredits,
         'notEnoughGoldTooltip':
         notEnoughGoldTooltip,
         'notEnoughCreditsTooltip':
         notEnoughCreditsTooltip,
         'inFormationAlert':
         inFormationAlert
     })
     self.as_setBuyBtnEnabledS(canBuy)
예제 #15
0
 def _packBlocks(self, btnType=None, *args, **kwargs):
     tooltipBlocks = super(GoldToolTipData, self)._packBlocks(*args, **kwargs)
     if self._btnType is None:
         _logger.error('HeaderMoneyAndXpTooltipData empty btnType!')
         return tooltipBlocks
     else:
         valueBlock = formatters.packMoneyAndXpValueBlock(value=text_styles.gold(backport.getIntegralFormat(self._itemsCache.items.stats.money.gold)), icon=self._btnType, iconYoffset=self._ICON_Y_OFFSET)
         return formatters.packMoneyAndXpBlocks(tooltipBlocks, btnType=self._btnType, valueBlocks=[valueBlock], alternativeData={'btnClickDesc': 'goldAlternative',
          'btnClickDescAlign': BLOCKS_TOOLTIP_TYPES.ALIGN_LEFT})
예제 #16
0
 def __getGoldToExchangeTxt(self, resToExchange):
     """
     :param resToExchange: <int> resource for exchange
     :return: formatted needed gold to exchange text
     """
     if resToExchange > 0:
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = "".join((text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)), icons.gold()))
         return text_styles.main(self._makeString(I18N_NEEDGOLDTEXT_KEY, {"gold": fmtGold}))
     return ""
예제 #17
0
 def __checkMoney(self):
     changeRoleCost = self.__items.shop.changeRoleCost
     formattedPrice = BigWorld.wg_getIntegralFormat(changeRoleCost)
     actualGold = self.__items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     if enoughGold:
         priceString = text_styles.gold(formattedPrice)
     else:
         priceString = text_styles.error(formattedPrice)
     priceString += icons.gold()
     self.as_setPriceS(priceString, enoughGold)
예제 #18
0
 def __checkMoney(self):
     changeRoleCost = self.__items.shop.changeRoleCost
     formattedPrice = BigWorld.wg_getIntegralFormat(changeRoleCost)
     actualGold = self.__items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     if enoughGold:
         priceString = text_styles.gold(formattedPrice)
     else:
         priceString = text_styles.error(formattedPrice)
     priceString += icons.gold()
     self.as_setPriceS(priceString, enoughGold)
 def _makeVO(self, province):
     result = {'front': '%s %s' % (self.__getFront(province), text_styles.standard(formatField(province.getFrontLevel, formatter=fort_formatters.getTextLevel))),
      'province': self.__getProvinceName(province),
      'map': self.__getMap(province),
      'primeTime': text_styles.main(province.getUserPrimeTime()),
      'days': text_styles.main(BigWorld.wg_getIntegralFormat(self.__getDays(province)))}
     if self.__showTreasuryData:
         result.update({'income': text_styles.gold(BigWorld.wg_getIntegralFormat(self.__getIncome(province))),
          'noIncomeIconVisible': not province.isHqConnected(),
          'noIncomeTooltip': CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP})
     return result
예제 #20
0
 def requestMissionData(self, index):
     isObtained = not self._bootcamp.needAwarding()
     vehicleSelector = self.getComponent(QUESTS_ALIASES.MISSIONS_VEHICLE_SELECTOR_ALIAS)
     if vehicleSelector is not None:
         criteria = REQ_CRITERIA.VEHICLE.LEVELS([self._TANK_LEVEL]) | REQ_CRITERIA.IN_OWNERSHIP
         vehicleSelector.setCriteria(criteria, [])
     bTypesData = formatters.packMissionBonusTypeElements([ARENA_BONUS_TYPE.REGULAR])
     bTypes = self._COMMA.join([ iconData.iconLabel for iconData in bTypesData ])
     tooltipBody = makeString(QUESTS.MISSIONDETAILS_CONDITIONS_BATTLEBONUSTYPE_BODY, battleBonusTypes=bTypes)
     missionData = {'title': text_styles.promoSubTitle(backport.text(R.strings.bootcamp.quest.title())),
      'battleConditions': [{'rendererLinkage': MISSIONS_ALIASES.BATTLE_CONDITION,
                            'linkageBig': MISSIONS_ALIASES.ANG_GROUP_BIG_LINKAGE,
                            'isDetailed': True,
                            'data': [{'title': text_styles.promoSubTitle(backport.text(R.strings.bootcamp.quest.name())),
                                      'description': text_styles.highlightText(backport.text(R.strings.bootcamp.quest.condition())),
                                      'state': MISSIONS_ALIASES.NONE,
                                      'icon': backport.image(R.images.gui.maps.icons.quests.battleCondition.c_128.icon_battle_condition_battles_128x128()),
                                      'maxDescLines': self._LINES_IN_DESCR}],
                            'linkage': MISSIONS_ALIASES.ANG_GROUP_DETAILED_LINKAGE}],
      'statusLabel': text_styles.concatStylesWithSpace(icons.inProgress(), text_styles.standard(backport.text(R.strings.quests.missionDetails.missionsComplete(), count=text_styles.stats(self._MISSIONS_DONE), total=text_styles.standard(self._MISSIONS_COUNT)))),
      'awards': [{'label': text_styles.gold(backport.text(R.strings.menu.premium.packet.days3())),
                  'padding': self._AWARD_LABEL_PADDING,
                  'imgSource': backport.image(R.images.gui.maps.icons.quests.bonuses.big.premium_3()),
                  'align': LABEL_ALIGN.RIGHT,
                  'tooltip': TOOLTIPS.AWARDITEM_PREMIUM,
                  'obtainedImage': backport.image(R.images.gui.maps.icons.library.awardObtained()),
                  'isObtained': isObtained,
                  'obtainedImageOffset': self._OBTAINED_IMAGE_OFFSET}, {'label': text_styles.gold(self._GOLD_LABEL),
                  'padding': self._AWARD_LABEL_PADDING,
                  'imgSource': backport.image(R.images.gui.maps.icons.quests.bonuses.big.gold()),
                  'align': LABEL_ALIGN.RIGHT,
                  'tooltip': TOOLTIPS.AWARDITEM_GOLD,
                  'obtainedImage': backport.image(R.images.gui.maps.icons.library.awardObtained()),
                  'isObtained': isObtained,
                  'obtainedImageOffset': self._OBTAINED_IMAGE_OFFSET}],
      'background': 'default',
      'prebattleConditions': [formatters.packMissionPrebattleCondition(text_styles.main(bTypesData[0].iconLabel), ''.join([ iconData.icon for iconData in bTypesData ]), makeTooltip(QUESTS.MISSIONDETAILS_CONDITIONS_BATTLEBONUSTYPE, tooltipBody))],
      'uiDecoration': backport.image(R.images.gui.maps.icons.quests.decorations.default_750x264()),
      'statusTooltipData': {}}
     self.as_setMissionDataS(missionData)
     return
예제 #21
0
    def _packWayToBuyBlock(self, item):
        subBlocks = [
            formatters.packTextBlockData(
                text=text_styles.middleTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_TOOLTIP_WAYTOBUY_TITLE)),
                padding={"bottom": 6},
            )
        ]
        padding = {"left": 0}
        for buyItem in item["buyItems"]:
            buyItemDesc = text_styles.main(buyItem["desc"])
            if buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
                if buyItem["isSale"]:
                    subBlocks.append(
                        formatters.packSaleTextParameterBlockData(
                            name=buyItemDesc, saleData={"newPrice": (0, buyItem["value"])}, padding=padding
                        )
                    )
                else:
                    price = text_styles.concatStylesWithSpace(
                        text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem["value"]))), icons.gold()
                    )
                    subBlocks.append(
                        formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)
                    )
            elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP:
                if buyItem["isSale"]:
                    subBlocks.append(
                        formatters.packSaleTextParameterBlockData(
                            name=buyItemDesc, saleData={"newPrice": (buyItem["value"], 0)}, padding=padding
                        )
                    )
                else:
                    price = text_styles.concatStylesWithSpace(
                        text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem["value"]))), icons.credits()
                    )
                    subBlocks.append(
                        formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70)
                    )
            elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR:
                subBlocks.append(
                    formatters.packTextParameterBlockData(
                        name=buyItemDesc, value=icons.premiumIgrSmall(), padding=padding
                    )
                )
            elif buyItem["type"] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION:
                subBlocks.append(
                    formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.quest(), padding=padding)
                )

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {"left": 3}
        )
예제 #22
0
 def __getGoldToExchangeTxt(self, resToExchange):
     """
     :param resToExchange: <int> resource for exchange
     :return: formatted needed gold to exchange text
     """
     if resToExchange > 0:
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = ''.join(
             (text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)),
              icons.gold()))
         return text_styles.main(
             self._makeString(I18N_NEEDGOLDTEXT_KEY, {'gold': fmtGold}))
     return ''
예제 #23
0
 def _makeVO(self, province):
     isRobbed = self.__isRobbed(province)
     result = {
         'front':
         '%s %s' %
         (self.__getFront(province),
          text_styles.standard(
              formatField(province.getFrontLevel,
                          formatter=fort_formatters.getTextLevel))),
         'province':
         self.__getProvinceName(province),
         'map':
         self.__getMap(province),
         'primeTime':
         text_styles.main(province.getUserPrimeTime()),
         'days':
         text_styles.main(
             BigWorld.wg_getIntegralFormat(self.__getDays(province))),
         'isRobbed':
         isRobbed
     }
     if isRobbed:
         restoreTime = province.getPillageEndDatetime()
         result.update({
             'robbedTooltip':
             makeTooltip(
                 None,
                 text_styles.concatStylesToMultiLine(
                     text_styles.main(
                         _ms(CLANS.
                             GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_NOINCOME
                             )),
                     text_styles.neutral(
                         _ms(CLANS.
                             GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_RESTORETIME,
                             date=text_styles.main(
                                 formatters.formatShortDateShortTimeString(
                                     restoreTime))))))
         })
     if self.__showTreasuryData:
         result.update({
             'income':
             text_styles.gold(
                 BigWorld.wg_getIntegralFormat(self.__getIncome(province))),
             'noIncomeIconVisible':
             not province.isHqConnected() or isRobbed,
             'noIncomeTooltip':
             CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP
         })
     return result
 def getPremiumPanelLabels(self):
     vehicleLabel = backport.text(
         R.strings.menu.techtree.premiumPanel.btnLabel(),
         count=text_styles.gold(
             backport.text(
                 R.strings.menu.techtree.premiumPanel.btnLabel.count())))
     labels = {
         'panelTitle':
         backport.text(R.strings.menu.techtree.premiumPanel.title()),
         'vehicleLabel':
         vehicleLabel.split(
             backport.text(
                 R.strings.menu.techtree.premiumPanel.btnLabel.count()))
     }
     return labels
예제 #25
0
    def __packGiftNameBlocks(cls, shortName, giftsNames, isOfferEnabled):
        rOffer = R.strings.tooltips.battlePassOffer
        blocks = [
            formatters.packTextBlockData(text=text_styles.highTitle(
                backport.text(rOffer.title.dyn(shortName)())))
        ]
        if isOfferEnabled:
            if shortName in ('brochure_gift', 'guide_gift', 'blueprint_gift'):
                blocks.append(
                    formatters.packTextBlockData(text=text_styles.gold(
                        backport.text(rOffer.allNations()))))
                if shortName == 'blueprint_gift':
                    information = backport.text(rOffer.blueprintInfo())
                else:
                    experience = first(giftsNames)
                    experienceText = text_styles.expText(
                        backport.getIntegralFormat(experience))
                    information = backport.text(rOffer.crewBookInfo(),
                                                exp=experienceText)
                blocks.append(
                    formatters.packTextBlockData(
                        text=text_styles.main(information)))
            else:
                insertEtc = False
                if len(giftsNames) > cls._MAX_GIFTS_COUNT:
                    giftsNames = giftsNames[:cls._MAX_GIFTS_COUNT - 1]
                    insertEtc = True
                for gift in giftsNames:
                    giftName = backport.text(rOffer.point(), item=gift)
                    blocks.append(
                        formatters.packTextBlockData(
                            text=text_styles.main(giftName)))

                if insertEtc:
                    blocks.append(
                        formatters.packTextBlockData(text=text_styles.stats(
                            backport.text(rOffer.etc()))))
        else:
            blocks.append(
                formatters.packImageTextBlockData(
                    title=text_styles.main(backport.text(rOffer.error())),
                    img=backport.image(
                        R.images.gui.maps.icons.library.alertIcon1())))
        return formatters.packBuildUpBlockData(
            blocks,
            padding=formatters.packPadding(left=-1),
            linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
        )
 def _makeVO(self, province):
     isRobbed = self.__isRobbed(province)
     result = {'front': '%s %s' % (self.__getFront(province), text_styles.standard(formatField(province.getFrontLevel, formatter=fort_formatters.getTextLevel))),
      'province': self.__getProvinceName(province),
      'map': self.__getMap(province),
      'primeTime': text_styles.main(province.getUserPrimeTime()),
      'days': text_styles.main(BigWorld.wg_getIntegralFormat(self.__getDays(province))),
      'isRobbed': isRobbed}
     if isRobbed:
         restoreTime = province.getPillageEndDatetime()
         result.update({'robbedTooltip': makeTooltip(None, text_styles.concatStylesToMultiLine(text_styles.main(_ms(CLANS.GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_NOINCOME)), text_styles.neutral(_ms(CLANS.GLOBALMAPVIEW_TABLE_PROVINCEROBBED_TOOLTIP_RESTORETIME, date=text_styles.main(formatters.formatShortDateShortTimeString(restoreTime))))))})
     if self.__showTreasuryData:
         result.update({'income': text_styles.gold(BigWorld.wg_getIntegralFormat(self.__getIncome(province))),
          'noIncomeIconVisible': not province.isHqConnected() or isRobbed,
          'noIncomeTooltip': CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP})
     return result
예제 #27
0
 def __setTotalData(self, *args):
     priceGold = self.__controller.cart.totalPriceGold
     priceCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= priceGold
     enoughCredits = g_itemsCache.items.stats.credits >= priceCredits
     canBuy = bool(priceGold
                   or priceCredits) and enoughGold and enoughCredits
     if not enoughGold:
         diff = text_styles.gold(priceGold - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(priceCredits -
                                    g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(VEHICLE_CUSTOMIZATION.
                 CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.credits())))
     self.as_setTotalDataS({
         'credits':
         formatPriceCredits(priceCredits),
         'gold':
         formatPriceGold(priceGold),
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=len(self.__searchDP.selectedItems),
                 total=len(self.__searchDP.items))),
         'buyEnabled':
         canBuy,
         'enoughGold':
         enoughGold,
         'enoughCredits':
         enoughCredits,
         'notEnoughGoldTooltip':
         notEnoughGoldTooltip,
         'notEnoughCreditsTooltip':
         notEnoughCreditsTooltip
     })
예제 #28
0
 def __getRentButtonLabel(rootNode):
     btnLabel = ''
     if NODE_STATE.isRentAvailable(rootNode.getState()):
         minRentPrice, currency = rootNode.getRentInfo()
         if currency == Currency.CREDITS:
             btnLabel = text_styles.concatStylesWithSpace(
                 backport.text(
                     R.strings.menu.research.labels.button.rent()),
                 text_styles.credits(
                     backport.getIntegralFormat(minRentPrice.credits)),
                 icons.credits())
         elif currency == Currency.GOLD:
             btnLabel = text_styles.concatStylesWithSpace(
                 backport.text(
                     R.strings.menu.research.labels.button.rent()),
                 text_styles.gold(backport.getGoldFormat(
                     minRentPrice.gold)), icons.gold())
     return btnLabel
예제 #29
0
 def __setBuyingPanelData(self):
     totalGold = g_customizationController.carousel.slots.cart.totalPriceGold
     totalCredits = g_customizationController.carousel.slots.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= totalGold
     enoughCredits = g_itemsCache.items.stats.credits >= totalCredits
     if not enoughGold:
         diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits())))
     self.as_setBuyingPanelDataS({'totalPriceCredits': formatPriceCredits(totalCredits),
      'totalPriceGold': formatPriceGold(totalGold),
      'enoughGold': enoughGold,
      'enoughCredits': enoughCredits,
      'notEnoughGoldTooltip': notEnoughGoldTooltip,
      'notEnoughCreditsTooltip': notEnoughCreditsTooltip})
예제 #30
0
 def __init__(self, berthsPrice, berthsCount):
     super(TankmanBerthsBuyer, self).__init__(
         (plugins.MessageInformator(
             'barracksExpandNotEnoughMoney',
             activeHandler=lambda: not plugins.MoneyValidator(
                 berthsPrice).validate().success),
          plugins.MessageConfirmator(
              'barracksExpand',
              ctx={
                  'price':
                  text_styles.concatStylesWithSpace(
                      text_styles.gold(str(berthsPrice.gold)),
                      icons.makeImageTag(
                          RES_ICONS.MAPS_ICONS_LIBRARY_GOLDICON_2)),
                  'count':
                  text_styles.stats(berthsCount)
              }), plugins.MoneyValidator(berthsPrice)))
     self.berthsPrice = berthsPrice
예제 #31
0
 def __setTotalData(self):
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= self.__totalPrice['gold']
     enoughCredits = g_itemsCache.items.stats.credits >= self.__totalPrice['credits']
     buyEnabled = bool(self.__totalPrice['credits'] + self.__totalPrice['gold']) and enoughGold and enoughCredits
     if not enoughGold:
         diff = text_styles.gold(self.__totalPrice['gold'] - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(self.__totalPrice['credits'] - g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits())))
     self.as_setTotalDataS({'credits': formatPriceCredits(self.__totalPrice['credits']),
      'gold': formatPriceGold(self.__totalPrice['gold']),
      'totalLabel': text_styles.highTitle(_ms(CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.getSelected()), total=len(self.__searchDP.getTotal()))),
      'buyEnabled': buyEnabled,
      'enoughGold': enoughGold,
      'enoughCredits': enoughCredits,
      'notEnoughGoldTooltip': notEnoughGoldTooltip,
      'notEnoughCreditsTooltip': notEnoughCreditsTooltip})
예제 #32
0
 def __setTotalData(self):
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= self.__totalPrice['gold']
     enoughCredits = g_itemsCache.items.stats.credits >= self.__totalPrice[
         'credits']
     buyEnabled = bool(
         self.__totalPrice['credits'] +
         self.__totalPrice['gold']) and enoughGold and enoughCredits
     if not enoughGold:
         diff = text_styles.gold(self.__totalPrice['gold'] -
                                 g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(self.__totalPrice['credits'] -
                                    g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.credits())))
     self.as_setTotalDataS({
         'credits':
         formatPriceCredits(self.__totalPrice['credits']),
         'gold':
         formatPriceGold(self.__totalPrice['gold']),
         'totalLabel':
         text_styles.highTitle(
             _ms(CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=len(self.__searchDP.getSelected()),
                 total=len(self.__searchDP.getTotal()))),
         'buyEnabled':
         buyEnabled,
         'enoughGold':
         enoughGold,
         'enoughCredits':
         enoughCredits,
         'notEnoughGoldTooltip':
         notEnoughGoldTooltip,
         'notEnoughCreditsTooltip':
         notEnoughCreditsTooltip
     })
 def __checkMoney(self):
     changeRoleCost = self.itemsCache.items.shop.changeRoleCost
     defaultChangeRoleCost = self.itemsCache.items.shop.defaults.changeRoleCost
     if changeRoleCost != defaultChangeRoleCost:
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS,
                                          'changeRoleCost', True,
                                          Money(gold=changeRoleCost),
                                          Money(gold=defaultChangeRoleCost))
     else:
         discount = None
     formattedPrice = BigWorld.wg_getIntegralFormat(changeRoleCost)
     actualGold = self.itemsCache.items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     if enoughGold:
         priceString = text_styles.gold(formattedPrice)
     else:
         priceString = text_styles.error(formattedPrice)
     priceString += icons.gold()
     self.as_setPriceS(priceString, enoughGold, discount)
     return
예제 #34
0
 def __getState(self, resToExchange):
     """
     Gets state and reason for exchange possibility
     :param resToExchange: <int> resource for exchange
     :return: <tuple(state:<int>, reason<str>)>
     """
     if resToExchange <= 0:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE,
                 text_styles.success(
                     self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)))
     if not self.__isEnoughGold(resToExchange):
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = ''.join(
             (text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)),
              icons.gold()))
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE,
                 text_styles.error(
                     self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY,
                                      {'gold': fmtGold})))
     return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, '')
예제 #35
0
 def __getState(self, resToExchange):
     """
     Gets state and reason for exchange possibility
     :param resToExchange: <int> resource for exchange
     :return: <tuple(state:<int>, reason<str>)>
     """
     if resToExchange <= 0:
         return (
             CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE,
             text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)),
         )
     elif not self.__isEnoughGold(resToExchange):
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = "".join((text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)), icons.gold()))
         return (
             CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE,
             text_styles.error(self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY, {"gold": fmtGold})),
         )
     else:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, "")
 def __packMainBlock(cls, item):
     strPath = R.strings.tooltips.selectableCrewbook
     blocks = [
         formatters.packTextBlockData(text=text_styles.highTitle(
             backport.text(strPath.dyn(item.name).title())))
     ]
     blocks.append(
         formatters.packTextBlockData(
             text=text_styles.gold(backport.text(strPath.allNations()))))
     crewbook, _ = first(item.options.getItems())
     experienceText = text_styles.expText(
         backport.getIntegralFormat(crewbook.getXP()))
     information = backport.text(strPath.info(), exp=experienceText)
     blocks.append(
         formatters.packTextBlockData(text=text_styles.main(information)))
     return formatters.packBuildUpBlockData(
         blocks,
         padding=formatters.packPadding(left=-1),
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE
     )
예제 #37
0
 def setProxy(self, proxy, clanDossier):
     proxy.showWaiting()
     provinces = yield clanDossier.requestProvinces()
     showTreasury = clanDossier.isMyClan() and self.clanCtrl.getLimits(
     ).canSeeTreasury(clanDossier).success
     hasProvinces = len(provinces) > 0
     if self.isDisposed():
         return
     headers = self._prepareHeaders(showTreasury, hasProvinces)
     if showTreasury:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_SELF_PROVINCE_RENDERER
     else:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_PROVINCE_RENDERER
     data = {
         'rendererLinkage':
         listItemRendererLinkage,
         'headers':
         headers,
         'isListVisible':
         hasProvinces,
         'noDataText':
         text_styles.highTitle(_ms(CLANS.GLOBALMAPVIEW_NOPROVINCE)),
         'isNoDataTextVisible':
         not hasProvinces
     }
     if hasProvinces:
         data['defaultSortField'] = _SORT_IDS.PROVINCE
         data['defaultSortDirection'] = 'ascending'
     self.as_setDataS(data)
     self.__provincesDP = _ClanProfileProvinceDataProvider(showTreasury)
     self.__provincesDP.setFlashObject(self.as_getDPS())
     self.__provincesDP.buildList(provinces)
     self.as_setAdditionalTextS(
         hasProvinces and showTreasury,
         text_styles.standard(
             _ms(CLANS.GLOBALMAPVIEW_TOTALINCOME,
                 icon=icons.gold(),
                 value=text_styles.gold(
                     backport.getIntegralFormat(
                         self.__provincesDP.getCommonRevenue())))))
     proxy.hideWaiting()
예제 #38
0
 def __setTotalData(self, *args):
     priceGold = self.__controller.cart.totalPriceGold
     priceCredits = self.__controller.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= priceGold
     enoughCredits = g_itemsCache.items.stats.credits >= priceCredits
     canBuy = bool(priceGold or priceCredits) and enoughGold and enoughCredits
     if not enoughGold:
         diff = text_styles.gold(priceGold - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(priceCredits - g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits())))
     self.as_setTotalDataS({'credits': formatPriceCredits(priceCredits),
      'gold': formatPriceGold(priceGold),
      'totalLabel': text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST, selected=len(self.__searchDP.selectedItems), total=len(self.__searchDP.items))),
      'buyEnabled': canBuy,
      'enoughGold': enoughGold,
      'enoughCredits': enoughCredits,
      'notEnoughGoldTooltip': notEnoughGoldTooltip,
      'notEnoughCreditsTooltip': notEnoughCreditsTooltip})
예제 #39
0
 def __setBottomPanelData(self):
     if self.__carouselHidden:
         label = g_customizationController.carousel.slots.getSummaryString()
     else:
         label = g_customizationController.carousel.slots.getCurrentTypeLabel(
         )
     totalGold = g_customizationController.carousel.slots.cart.totalPriceGold
     totalCredits = g_customizationController.carousel.slots.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= totalGold
     enoughCredits = g_itemsCache.items.stats.credits >= totalCredits
     if not enoughGold:
         diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(totalCredits -
                                    g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER),
             _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY,
                 count='{0}{1}'.format(diff, icons.credits())))
     self.as_setBottomPanelHeaderS({
         'newHeaderText':
         label,
         'buyBtnLabel':
         _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY,
             count=len(
                 g_customizationController.carousel.slots.cart.items)),
         'pricePanel': {
             'totalPriceCredits': formatPriceCredits(totalCredits),
             'totalPriceGold': formatPriceGold(totalGold),
             'enoughGold': enoughGold,
             'enoughCredits': enoughCredits,
             'notEnoughGoldTooltip': notEnoughGoldTooltip,
             'notEnoughCreditsTooltip': notEnoughCreditsTooltip
         }
     })
    def __getPurchaseItemVO(self, items):
        purchaseItems = []
        for item in items:
            if item['currencyIcon'] == RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2:
                price = text_styles.credits(item['price'])
            else:
                price = text_styles.gold(item['price'])
            data = {'name': text_styles.main(item['name']),
             'idx': item['idx'],
             'type': item['type'],
             'isTitle': False,
             'currencyIcon': item['currencyIcon'],
             'itemID': item['itemID'],
             'price': price,
             'removeItemIcon': RES_ICONS.MAPS_ICONS_LIBRARY_CROSS}
            if shared.isSale(item['type'], item['duration']):
                isGold = item['currencyIcon'] != RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICON_2
                data['salePrice'] = shared.getSalePriceString(isGold, item['price'])
            purchaseItems.append(data)

        return {'title': text_styles.highTitle(_ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATIONPURCHASESPOPOVER_TITLE, count=len(purchaseItems))),
         'popoverRenderers': purchaseItems}
예제 #41
0
def _getValue(base, self):
    valueStr = '0'
    if self._btnType == CURRENCIES_CONSTANTS.GOLD:
        valueStr = text_styles.gold(
            backport.getIntegralFormat(
                max(self.itemsCache.items.stats.actualGold, 0)))
    elif self._btnType == CURRENCIES_CONSTANTS.CREDITS:
        valueStr = text_styles.credits(
            backport.getIntegralFormat(
                max(self.itemsCache.items.stats.actualCredits, 0)))
    elif self._btnType == CURRENCIES_CONSTANTS.CRYSTAL:
        valueStr = text_styles.crystal(
            backport.getIntegralFormat(
                max(self.itemsCache.items.stats.actualCrystal, 0)))
    elif self._btnType == CURRENCIES_CONSTANTS.EVENT_COIN:
        valueStr = text_styles.eventCoin(
            backport.getIntegralFormat(
                max(self.itemsCache.items.stats.actualEventCoin, 0)))
    elif self._btnType == CURRENCIES_CONSTANTS.FREE_XP:
        valueStr = text_styles.expText(
            backport.getIntegralFormat(
                max(self.itemsCache.items.stats.actualFreeXP, 0)))
    return valueStr
예제 #42
0
    def _packWayToBuyBlock(self, data):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms('#vehicle_customization:customization/tooltip/wayToBuy/title')), padding={'bottom': 6})]
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION:
                subBlocks.append(formatters.packImageTextBlockData(desc=buyItemDesc, img=RES_ICONS.MAPS_ICONS_LIBRARY_QUEST_ICON, imgPadding={'left': 53,
                 'top': 3}, txtGap=-4, txtOffset=73))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
                if buyItem['isSale']:
                    subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (0, buyItem['value'])}, padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.gold())
                    subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP:
                if buyItem['isSale']:
                    subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (buyItem['value'], 0)}, padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.credits())
                    subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding={'left': 0}))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
 def setProxy(self, proxy, clanDossier):
     proxy.showWaiting()
     provinces = yield clanDossier.requestProvinces()
     showTreasury = clanDossier.isMyClan() and g_clanCtrl.getLimits().canSeeTreasury(clanDossier).success
     hasProvinces = len(provinces) > 0
     if self.isDisposed():
         return
     headers = self._prepareHeaders(showTreasury, hasProvinces)
     if showTreasury:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_SELF_PROVINCE_RENDERER
     else:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_PROVINCE_RENDERER
     data = {
         "rendererLinkage": listItemRendererLinkage,
         "headers": headers,
         "isListVisible": hasProvinces,
         "noDataText": text_styles.highTitle(_ms(CLANS.GLOBALMAPVIEW_NOPROVINCE)),
         "isNoDataTextVisible": not hasProvinces,
     }
     if hasProvinces:
         data["defaultSortField"] = _SORT_IDS.PROVINCE
         data["defaultSortDirection"] = "ascending"
     self.as_setDataS(data)
     self.__provincesDP = _ClanProfileProvinceDataProvider(showTreasury)
     self.__provincesDP.setFlashObject(self.as_getDPS())
     self.__provincesDP.buildList(provinces)
     self.as_setAdditionalTextS(
         hasProvinces and showTreasury,
         text_styles.standard(
             _ms(
                 CLANS.GLOBALMAPVIEW_TOTALINCOME,
                 icon=icons.gold(),
                 value=text_styles.gold(BigWorld.wg_getIntegralFormat(self.__provincesDP.getCommonRevenue())),
             )
         ),
     )
     proxy.hideWaiting()
예제 #44
0
 def __setBottomPanelData(self):
     if self.__carouselHidden:
         label = g_customizationController.carousel.slots.getSummaryString()
     else:
         label = g_customizationController.carousel.slots.getCurrentTypeLabel()
     totalGold = g_customizationController.carousel.slots.cart.totalPriceGold
     totalCredits = g_customizationController.carousel.slots.cart.totalPriceCredits
     notEnoughGoldTooltip = notEnoughCreditsTooltip = ''
     enoughGold = g_itemsCache.items.stats.gold >= totalGold
     enoughCredits = g_itemsCache.items.stats.credits >= totalCredits
     if not enoughGold:
         diff = text_styles.gold(totalGold - g_itemsCache.items.stats.gold)
         notEnoughGoldTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.gold())))
     if not enoughCredits:
         diff = text_styles.credits(totalCredits - g_itemsCache.items.stats.credits)
         notEnoughCreditsTooltip = makeTooltip(_ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_HEADER), _ms(TOOLTIPS.CUSTOMIZATION_NOTENOUGHRESOURCES_BODY, count='{0}{1}'.format(diff, icons.credits())))
     self.as_setBottomPanelHeaderS({'newHeaderText': label,
      'buyBtnLabel': _ms(MENU.CUSTOMIZATION_BUTTONS_APPLY, count=len(g_customizationController.carousel.slots.cart.items)),
      'pricePanel': {'totalPriceCredits': formatPriceCredits(totalCredits),
                     'totalPriceGold': formatPriceGold(totalGold),
                     'enoughGold': enoughGold,
                     'enoughCredits': enoughCredits,
                     'notEnoughGoldTooltip': notEnoughGoldTooltip,
                     'notEnoughCreditsTooltip': notEnoughCreditsTooltip}})
예제 #45
0
 def construct(self):
     xp = self.configuration.xp
     dailyXP = self.configuration.dailyXP
     buyPrice = self.configuration.buyPrice
     sellPrice = self.configuration.sellPrice
     unlockPrice = self.configuration.unlockPrice
     techTreeNode = self.configuration.node
     minRentPrice = self.configuration.minRentPrice
     rentals = self.configuration.rentals
     paddings = formatters.packPadding(left=-4)
     neededValue = 0
     actionPrc = 0
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         block = []
         isUnlocked = self.vehicle.isUnlocked
         isInInventory = self.vehicle.isInInventory
         isNextToUnlock = False
         parentCD = None
         if techTreeNode is not None:
             isNextToUnlock = bool(int(techTreeNode.state) & NODE_STATE.NEXT_2_UNLOCK)
             parentCD = techTreeNode.unlockProps.parentID
         if xp:
             xpValue = self.vehicle.xp
             if xpValue:
                 xPText = text_styles.expText(_int(xpValue))
                 icon = ICON_TEXT_FRAMES.FREE_XP if self.vehicle.isPremium else ICON_TEXT_FRAMES.XP
                 block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_XP), value=xPText, icon=icon, valueWidth=self._valueWidth, padding=paddings))
         if dailyXP:
             attrs = g_itemsCache.items.stats.attributes
             if attrs & constants.ACCOUNT_ATTR.DAILY_MULTIPLIED_XP and self.vehicle.dailyXPFactor > 0:
                 dailyXPText = text_styles.main(text_styles.expText('x' + _int(self.vehicle.dailyXPFactor)))
                 block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_DAILYXPFACTOR), value=dailyXPText, icon=ICON_TEXT_FRAMES.DOUBLE_XP_FACTOR, valueWidth=self._valueWidth, padding=paddings))
         if unlockPrice:
             isAvailable, cost, need = getUnlockPrice(self.vehicle.intCD, parentCD)
             if cost > 0:
                 neededValue = None
                 if isAvailable and not isUnlocked and need > 0 and techTreeNode is not None:
                     neededValue = need
                 block.append(makePriceBlock(cost, CURRENCY_SETTINGS.UNLOCK_PRICE, neededValue, valueWidth=self._valueWidth))
         if buyPrice and not (self.vehicle.isDisabledForBuy or self.vehicle.isPremiumIGR or self.vehicle.isTelecom):
             price = self.vehicle.buyPrice
             money = g_itemsCache.items.stats.money
             actionPrc = self.vehicle.actionPrc
             defaultPrice = self.vehicle.defaultPrice
             currency = price.getCurrency()
             buyPriceText = price.get(currency)
             oldPrice = defaultPrice.get(currency)
             neededValue = price.get(currency) - money.get(currency)
             neededValue = neededValue if neededValue > 0 else None
             if isInInventory or not isInInventory and not isUnlocked and not isNextToUnlock:
                 neededValue = None
             block.append(makePriceBlock(buyPriceText, CURRENCY_SETTINGS.getBuySetting(currency), neededValue, oldPrice, actionPrc, valueWidth=self._valueWidth))
         if sellPrice and not self.vehicle.isTelecom:
             sellPrice = self.vehicle.sellPrice
             if sellPrice.isSet(Currency.GOLD):
                 sellPriceText = text_styles.gold(_int(sellPrice.gold))
                 sellPriceIcon = ICON_TEXT_FRAMES.GOLD
             else:
                 sellPriceText = text_styles.credits(_int(sellPrice.credits))
                 sellPriceIcon = ICON_TEXT_FRAMES.CREDITS
             block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_SELL_PRICE), value=sellPriceText, icon=sellPriceIcon, valueWidth=self._valueWidth, padding=paddings))
         if minRentPrice and not self.vehicle.isPremiumIGR:
             minRentPricePackage = self.vehicle.getRentPackage()
             if minRentPricePackage:
                 minRentPriceValue = Money(*minRentPricePackage['rentPrice'])
                 minDefaultRentPriceValue = Money(*minRentPricePackage['defaultRentPrice'])
                 actionPrc = self.vehicle.getRentPackageActionPrc(minRentPricePackage['days'])
                 money = g_itemsCache.items.stats.money
                 currency = minRentPriceValue.getCurrency()
                 price = minRentPriceValue.get(currency)
                 oldPrice = minDefaultRentPriceValue.get(currency)
                 neededValue = minRentPriceValue.get(currency) - money.get(currency)
                 neededValue = neededValue if neededValue > 0 else None
                 block.append(makePriceBlock(price, CURRENCY_SETTINGS.getRentSetting(currency), neededValue, oldPrice, actionPrc, valueWidth=self._valueWidth))
         if rentals and not self.vehicle.isPremiumIGR:
             rentFormatter = RentLeftFormatter(self.vehicle.rentInfo)
             rentLeftInfo = rentFormatter.getRentLeftStr('#tooltips:vehicle/rentLeft/%s', formatter=lambda key, countType, count, _ = None: {'left': count,
              'descr': i18n.makeString(key % countType)})
             if rentLeftInfo:
                 block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(rentLeftInfo['descr']), value=text_styles.main(rentLeftInfo['left']), icon=ICON_TEXT_FRAMES.RENTALS, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-4, bottom=-16)))
         notEnoughMoney = neededValue > 0
         hasAction = actionPrc > 0
         return (block, notEnoughMoney or hasAction)
예제 #46
0
 def construct(self):
     xp = self.configuration.xp
     dailyXP = self.configuration.dailyXP
     buyPrice = self.configuration.buyPrice
     sellPrice = self.configuration.sellPrice
     unlockPrice = self.configuration.unlockPrice
     techTreeNode = self.configuration.node
     minRentPrice = self.configuration.minRentPrice
     rentals = self.configuration.rentals
     futureRentals = self.configuration.futureRentals
     paddings = formatters.packPadding(left=-4)
     neededValue = 0
     actionPrc = 0
     if buyPrice and sellPrice:
         LOG_ERROR("You are not allowed to use buyPrice and sellPrice at the same time")
         return
     else:
         block = []
         isUnlocked = self.vehicle.isUnlocked
         isInInventory = self.vehicle.isInInventory
         isNextToUnlock = False
         parentCD = None
         if techTreeNode is not None:
             isNextToUnlock = bool(int(techTreeNode.state) & NODE_STATE_FLAGS.NEXT_2_UNLOCK)
             parentCD = techTreeNode.unlockProps.parentID
         if xp:
             xpValue = self.vehicle.xp
             if xpValue:
                 xPText = text_styles.expText(_int(xpValue))
                 icon = ICON_TEXT_FRAMES.FREE_XP if self.vehicle.isPremium else ICON_TEXT_FRAMES.XP
                 block.append(
                     formatters.packTextParameterWithIconBlockData(
                         name=text_styles.main(TOOLTIPS.VEHICLE_XP),
                         value=xPText,
                         icon=icon,
                         valueWidth=self._valueWidth,
                         padding=paddings,
                     )
                 )
         if dailyXP:
             attrs = g_itemsCache.items.stats.attributes
             if attrs & constants.ACCOUNT_ATTR.DAILY_MULTIPLIED_XP and self.vehicle.dailyXPFactor > 0:
                 dailyXPText = text_styles.main(text_styles.expText("x" + _int(self.vehicle.dailyXPFactor)))
                 block.append(
                     formatters.packTextParameterWithIconBlockData(
                         name=text_styles.main(TOOLTIPS.VEHICLE_DAILYXPFACTOR),
                         value=dailyXPText,
                         icon=ICON_TEXT_FRAMES.DOUBLE_XP_FACTOR,
                         valueWidth=self._valueWidth,
                         padding=paddings,
                     )
                 )
         if unlockPrice:
             isAvailable, cost, need = getUnlockPrice(self.vehicle.intCD, parentCD)
             if cost > 0:
                 neededValue = None
                 if isAvailable and not isUnlocked and need > 0 and techTreeNode is not None:
                     neededValue = need
                 block.append(
                     makePriceBlock(cost, CURRENCY_SETTINGS.UNLOCK_PRICE, neededValue, valueWidth=self._valueWidth)
                 )
         if buyPrice:
             if self.vehicle.isRestorePossible():
                 price = self.vehicle.restorePrice
                 defaultPrice = price
                 currency = price.getCurrency()
                 buyPriceText = price.get(currency)
                 oldPrice = defaultPrice.get(currency)
                 neededValue = _getNeedValue(price, currency)
                 if isInInventory or not isInInventory and not isUnlocked and not isNextToUnlock:
                     neededValue = None
                 block.append(
                     makePriceBlock(
                         buyPriceText,
                         CURRENCY_SETTINGS.RESTORE_PRICE,
                         neededValue,
                         oldPrice,
                         actionPrc,
                         valueWidth=self._valueWidth,
                     )
                 )
                 if self.vehicle.hasLimitedRestore():
                     timeKey, formattedTime = getTimeLeftInfo(self.vehicle.restoreInfo.getRestoreTimeLeft(), None)
                     block.append(
                         formatters.packTextParameterWithIconBlockData(
                             name=text_styles.main("#tooltips:vehicle/restoreLeft/%s" % timeKey),
                             value=text_styles.main(formattedTime),
                             icon=ICON_TEXT_FRAMES.ALERT if timeKey == "hours" else ICON_TEXT_FRAMES.EMPTY,
                             valueWidth=self._valueWidth,
                             padding=formatters.packPadding(left=-4),
                         )
                     )
             elif not (self.vehicle.isDisabledForBuy or self.vehicle.isPremiumIGR or self.vehicle.isTelecom):
                 price = self.vehicle.buyPrice
                 actionPrc = self.vehicle.actionPrc
                 defaultPrice = self.vehicle.defaultPrice
                 currency = price.getCurrency()
                 buyPriceText = price.get(currency)
                 oldPrice = defaultPrice.get(currency)
                 neededValue = _getNeedValue(price, currency)
                 if isInInventory or not isInInventory and not isUnlocked and not isNextToUnlock:
                     neededValue = None
                 block.append(
                     makePriceBlock(
                         buyPriceText,
                         CURRENCY_SETTINGS.getBuySetting(currency),
                         neededValue,
                         oldPrice,
                         0,
                         valueWidth=self._valueWidth,
                     )
                 )
         if sellPrice and not self.vehicle.isTelecom:
             sellPrice = self.vehicle.sellPrice
             if sellPrice.isSet(Currency.GOLD):
                 sellPriceText = text_styles.gold(_int(sellPrice.gold))
                 sellPriceIcon = ICON_TEXT_FRAMES.GOLD
             else:
                 sellPriceText = text_styles.credits(_int(sellPrice.credits))
                 sellPriceIcon = ICON_TEXT_FRAMES.CREDITS
             block.append(
                 formatters.packTextParameterWithIconBlockData(
                     name=text_styles.main(TOOLTIPS.VEHICLE_SELL_PRICE),
                     value=sellPriceText,
                     icon=sellPriceIcon,
                     valueWidth=self._valueWidth,
                     padding=paddings,
                 )
             )
         if minRentPrice and not self.vehicle.isPremiumIGR:
             minRentPricePackage = self.vehicle.getRentPackage()
             if minRentPricePackage:
                 minRentPriceValue = Money(*minRentPricePackage["rentPrice"])
                 minDefaultRentPriceValue = Money(*minRentPricePackage["defaultRentPrice"])
                 actionPrc = self.vehicle.getRentPackageActionPrc(minRentPricePackage["days"])
                 currency = minRentPriceValue.getCurrency()
                 price = minRentPriceValue.get(currency)
                 oldPrice = minDefaultRentPriceValue.get(currency)
                 neededValue = _getNeedValue(minRentPriceValue, currency)
                 block.append(
                     makePriceBlock(
                         price,
                         CURRENCY_SETTINGS.getRentSetting(currency),
                         neededValue,
                         oldPrice,
                         actionPrc,
                         valueWidth=self._valueWidth,
                     )
                 )
                 if not self.vehicle.isRented or self.vehicle.rentalIsOver:
                     block.append(
                         formatters.packTextParameterWithIconBlockData(
                             name=text_styles.main("#tooltips:vehicle/rentAvailable"),
                             value="",
                             icon=ICON_TEXT_FRAMES.RENTALS,
                             valueWidth=self._valueWidth,
                             padding=paddings,
                         )
                     )
         if rentals and not self.vehicle.isPremiumIGR:
             if futureRentals:
                 rentLeftKey = "#tooltips:vehicle/rentLeftFuture/%s"
                 rentInfo = RentalInfoProvider(time=self._rentExpiryTime, isRented=True)
             else:
                 rentLeftKey = "#tooltips:vehicle/rentLeft/%s"
                 rentInfo = self.vehicle.rentInfo
             rentFormatter = RentLeftFormatter(rentInfo)
             rentLeftInfo = rentFormatter.getRentLeftStr(
                 rentLeftKey,
                 formatter=lambda key, countType, count, _=None: {
                     "left": count,
                     "descr": i18n.makeString(key % countType),
                 },
             )
             if rentLeftInfo:
                 block.append(
                     formatters.packTextParameterWithIconBlockData(
                         name=text_styles.main(rentLeftInfo["descr"]),
                         value=text_styles.main(rentLeftInfo["left"]),
                         icon=ICON_TEXT_FRAMES.RENTALS,
                         valueWidth=self._valueWidth,
                         padding=formatters.packPadding(left=-4, bottom=-16),
                     )
                 )
         notEnoughMoney = neededValue > 0
         hasAction = actionPrc > 0
         return (block, notEnoughMoney or hasAction)
예제 #47
0
 def __getGoldValueWithIcon(self, gold):
     return "".join(text_styles.gold(BigWorld.wg_getGoldFormat(gold)) + icons.gold())
예제 #48
0
 def construct(self):
     xp = self.configuration.xp
     dailyXP = self.configuration.dailyXP
     buyPrice = self.configuration.buyPrice
     sellPrice = self.configuration.sellPrice
     unlockPrice = self.configuration.unlockPrice
     techTreeNode = self.configuration.node
     minRentPrice = self.configuration.minRentPrice
     rentals = self.configuration.rentals
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         priceBlock = []
         isUnlocked = self.vehicle.isUnlocked
         isInInventory = self.vehicle.isInInventory
         isRented = self.vehicle.isRented
         isNextToUnlock = False
         parentCD = None
         if techTreeNode is not None:
             isNextToUnlock = bool(int(techTreeNode.state) & NODE_STATE.NEXT_2_UNLOCK)
             parentCD = techTreeNode.unlockProps.parentID
         if xp:
             xpValue = self.vehicle.xp
             if xpValue:
                 xPText = text_styles.expText(_int(xpValue))
                 icon = ICON_TEXT_FRAMES.FREE_XP if self.vehicle.isPremium else ICON_TEXT_FRAMES.XP
                 priceBlock.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(_ms(TOOLTIPS.VEHICLE_XP)), value=xPText, icon=icon, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
         if dailyXP:
             attrs = g_itemsCache.items.stats.attributes
             if attrs & constants.ACCOUNT_ATTR.DAILY_MULTIPLIED_XP and self.vehicle.dailyXPFactor > 0:
                 dailyXPText = text_styles.main(text_styles.expText('x' + _int(self.vehicle.dailyXPFactor)))
                 priceBlock.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(_ms(TOOLTIPS.VEHICLE_DAILYXPFACTOR)), value=dailyXPText, icon=ICON_TEXT_FRAMES.DOUBLE_XP_FACTOR, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
         if unlockPrice:
             isAvailable, cost, need = getUnlockPrice(self.vehicle.intCD, parentCD)
             if cost > 0:
                 neededValue = None
                 if isAvailable and not isUnlocked and need > 0 and techTreeNode is not None:
                     neededValue = need
                 block = self._makePriceBlock(cost, _ms(TOOLTIPS.VEHICLE_UNLOCK_PRICE), ICON_TEXT_FRAMES.XP, neededValue)
                 priceBlock.append(block)
         if buyPrice and not (self.vehicle.isDisabledForBuy or self.vehicle.isPremiumIGR or self.vehicle.isTelecom):
             price = self.vehicle.buyPrice
             credits, gold = g_itemsCache.items.stats.money
             creditsBuyPrice = price[0]
             goldBuyPrice = price[1]
             creditsNeeded = creditsBuyPrice - credits if creditsBuyPrice else 0
             goldNeeded = goldBuyPrice - gold if goldBuyPrice else 0
             neededValue = None
             actionPrc = self.vehicle.actionPrc
             defaultPrice = self.vehicle.defaultPrice
             if goldBuyPrice == 0:
                 currencyType = ICON_TEXT_FRAMES.CREDITS
                 buyPriceText = creditsBuyPrice
                 oldPrice = defaultPrice[0]
                 if creditsNeeded > 0:
                     neededValue = creditsNeeded
             else:
                 currencyType = ICON_TEXT_FRAMES.GOLD
                 buyPriceText = goldBuyPrice
                 oldPrice = defaultPrice[1]
                 if goldNeeded > 0:
                     neededValue = goldNeeded
             text = _ms(TOOLTIPS.VEHICLE_BUY_PRICE)
             if isInInventory or not isInInventory and not isUnlocked and not isNextToUnlock:
                 neededValue = None
             block = self._makePriceBlock(buyPriceText, text, currencyType, neededValue, oldPrice, actionPrc)
             priceBlock.append(block)
         if sellPrice and not self.vehicle.isTelecom:
             creditsPrice = self.vehicle.sellPrice[0]
             goldPrice = self.vehicle.sellPrice[1]
             if goldPrice == 0:
                 sellPriceText = text_styles.credits(_int(creditsPrice))
                 sellPriceIcon = ICON_TEXT_FRAMES.CREDITS
             else:
                 sellPriceText = text_styles.gold(_int(goldPrice))
                 sellPriceIcon = ICON_TEXT_FRAMES.GOLD
             priceBlock.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(_ms(TOOLTIPS.VEHICLE_SELL_PRICE)), value=sellPriceText, icon=sellPriceIcon, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
         if minRentPrice and not self.vehicle.isPremiumIGR:
             minRentPricePackage = self.vehicle.getRentPackage()
             if minRentPricePackage:
                 minRentPriceValue = minRentPricePackage['rentPrice']
                 minDefaultRentPriceValue = minRentPricePackage['defaultRentPrice']
                 rentActionPrc = self.vehicle.getRentPackageActionPrc(minRentPricePackage['days'])
                 credits, gold = g_itemsCache.items.stats.money
                 creditsPrice = minRentPriceValue[0]
                 goldPrice = minRentPriceValue[1]
                 enoughCreditsForRent = credits - creditsPrice >= 0
                 enoughGoldForRent = gold - goldPrice >= 0
                 neededValue = None
                 if goldPrice == 0:
                     price = creditsPrice
                     oldPrice = minDefaultRentPriceValue[0]
                     currencyType = ICON_TEXT_FRAMES.CREDITS
                     if not enoughCreditsForRent:
                         neededValue = credits - creditsPrice
                 else:
                     price = goldPrice
                     oldPrice = minDefaultRentPriceValue[1]
                     currencyType = ICON_TEXT_FRAMES.GOLD
                     if not enoughGoldForRent:
                         neededValue = gold - goldPrice
                 text = _ms(TOOLTIPS.VEHICLE_MINRENTALSPRICE)
                 block = self._makePriceBlock(price, text, currencyType, neededValue, oldPrice, rentActionPrc)
                 priceBlock.append(block)
         if rentals and not self.vehicle.isPremiumIGR:
             rentFormatter = RentLeftFormatter(self.vehicle.rentInfo)
             rentLeftInfo = rentFormatter.getRentLeftStr('#tooltips:vehicle/rentLeft/%s', formatter=lambda key, countType, count, _ = None: {'left': count,
              'descr': i18n.makeString(key % countType)})
             if rentLeftInfo:
                 priceBlock.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(rentLeftInfo['descr']), value=text_styles.main(rentLeftInfo['left']), icon=ICON_TEXT_FRAMES.RENTALS, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=self.rightPadding)))
         return priceBlock
 def setProxy(self, proxy, clanDossier):
     proxy.showWaiting()
     provinces = yield clanDossier.requestProvinces()
     isMyClan = clanDossier.isMyClan()
     hasProvinces = len(provinces) > 0
     if self.isDisposed():
         return
     headers = self._prepareHeaders(clanDossier.isMyClan(), hasProvinces)
     if isMyClan:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_SELF_PROVINCE_RENDERER
     else:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_PROVINCE_RENDERER
     data = {'rendererLinkage': listItemRendererLinkage,
      'headers': headers,
      'isListVisible': hasProvinces,
      'additionalText': text_styles.standard(_ms(CLANS.GLOBALMAPVIEW_TOTALINCOME, icon=icons.gold(), value=text_styles.gold(BigWorld.wg_getIntegralFormat(sum(map(operator.methodcaller('getRevenue'), provinces)))))),
      'isAdditionalTextVisible': hasProvinces and isMyClan,
      'noDataText': text_styles.highTitle(_ms(CLANS.GLOBALMAPVIEW_NOPROVINCE)),
      'isNoDataTextVisible': not hasProvinces}
     if hasProvinces:
         data['defaultSortField'] = _SORT_IDS.PROVINCE
         data['defaultSortDirection'] = 'ascending'
     self.as_setDataS(data)
     self.__provincesDP = _ClanProfileProvinceDataProvider(isMyClan)
     self.__provincesDP.setFlashObject(self.as_getDPS())
     self.__provincesDP.buildList(provinces)
     proxy.hideWaiting()
예제 #50
0
    def __populateSeasonsData(self):
        seasons = []
        pqType = self.__navInfo.selectedPQType
        for seasonID, season in _getQuestsCache().getSeasons().iteritems():
            tiles = []
            for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')):
                isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked()
                iconID = tile.getIconID()
                if isCompleted:
                    bgImgUp = event_items.getTileNormalUpIconPath(iconID)
                    bgImgOver = event_items.getTileNormalOverIconPath(iconID)
                else:
                    bgImgUp = event_items.getTileGrayUpIconPath(iconID)
                    bgImgOver = event_items.getTileGrayOverIconPath(iconID)
                vehicleBonus = tile.getVehicleBonus()
                if vehicleBonus is not None:
                    vehLevelStr = icons.makeImageTag(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0)
                    vehTypeStr = icons.makeImageTag(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0)
                    vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName)
                else:
                    vehicleBonusLabel = ''
                tokenIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0)
                if isUnlocked and not isCompleted and pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    gottenTokensCount, totalTokensCount = tile.getTokensCount()
                    progress = text_styles.standard(i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=text_styles.gold(str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon))
                else:
                    progress = ''
                if tile.isFullCompleted():
                    animation = event_items.getTileAnimationPath(iconID)
                else:
                    animation = None
                if pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_TILE
                else:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_FALLOUT_TILE
                tiles.append({'id': tile.getID(),
                 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID()),
                 'label': text_styles.standard(vehicleBonusLabel),
                 'progress': progress,
                 'isCompleted': isUnlocked and isCompleted,
                 'enabled': isUnlocked,
                 'image': bgImgUp,
                 'imageOver': bgImgOver,
                 'animation': animation,
                 'tooltipType': tooltipType})

            seasons.append({'id': seasonID,
             'title': quests_fmts.getFullSeasonUserName(season),
             'tiles': tiles})

        self.as_setSeasonsDataS({'seasons': seasons})
        return
예제 #51
0
 def construct(self):
     block = []
     paddingTop = 8
     block.append(formatters.packImageTextBlockData(title=text_styles.alert(TOOLTIPS.MODULEFITS_NOT_REMOVABLE_BODY), img=RES_ICONS.MAPS_ICONS_TOOLTIP_COMPLEX_EQUIPMENT, imgPadding=formatters.packPadding(left=2, top=3), txtOffset=20))
     block.append(formatters.packTextBlockData(text=text_styles.main(TOOLTIPS.MODULEFITS_NOT_REMOVABLE_NOTE), padding=formatters.packPadding(top=paddingTop)))
     block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.MODULEFITS_NOT_REMOVABLE_DISMANTLING_PRICE), value=text_styles.gold(g_itemsCache.items.shop.paidRemovalCost), icon=ICON_TEXT_FRAMES.GOLD, valueWidth=60, padding=formatters.packPadding(left=43, top=paddingTop)))
     return block