Ejemplo n.º 1
0
 def __makeUnlockModuleVO(self, item, unlockProps):
     return {'title': _ms(BATTLE_RESULTS.COMMON_FITTING_RESEARCH),
      'description': text_styles.main(item.userName),
      'fittingType': item.getGUIEmblemID(),
      'lvlIcon': getLevelIconPath(item.level),
      'price': getItemUnlockPricesVO(unlockProps),
      'linkEvent': PROGRESS_ACTION.RESEARCH_UNLOCK_TYPE,
      'linkId': unlockProps.parentID}
Ejemplo n.º 2
0
 def getItemPrices(self):
     item = self.__item
     unlockProps = self.getUnlockProps()
     if item.canTradeIn:
         return getItemPricesVO(self.__tradeIn.getTradeInPrice(item))
     elif not item.isUnlocked and unlockProps is not None and not item.isCollectible:
         return getItemUnlockPricesVO(unlockProps)
     else:
         return getItemRestorePricesVO(item.restorePrice) if item.isRestoreAvailable() else getItemPricesVO(item.getBuyPrice())
Ejemplo n.º 3
0
 def __makeUnlockVehicleVO(self, item, unlockProps, avgBattlesTillUnlock):
     prediction = ''
     if avgBattlesTillUnlock > 0:
         prediction = _ms(BATTLE_RESULTS.COMMON_RESEARCHPREDICTION, battles=avgBattlesTillUnlock)
     return {'title': _ms(BATTLE_RESULTS.COMMON_VEHICLE_RESEARCH),
      'description': self.__makeVehicleDescription(item),
      'vehicleIcon': item.iconSmall,
      'lvlIcon': getLevelIconPath(item.level),
      'prediction': prediction,
      'price': getItemUnlockPricesVO(unlockProps),
      'linkEvent': PROGRESS_ACTION.RESEARCH_UNLOCK_TYPE,
      'linkId': unlockProps.parentID}
 def __getBtnDataLockedVehicle(self, vehicle):
     stats = self._itemsCache.items.stats
     tooltip = ''
     buttonIcon = None
     buttonIconAlign = None
     nodeCD = vehicle.intCD
     _, isXpEnough = g_techTreeDP.isVehicleAvailableToUnlock(
         nodeCD, self._vehicleLevel)
     unlocks = self._itemsCache.items.stats.unlocks
     isNext2Unlock, unlockProps = g_techTreeDP.isNext2Unlock(
         nodeCD,
         unlocked=set(unlocks),
         xps=stats.vehiclesXPs,
         freeXP=stats.freeXP,
         level=self._vehicleLevel)
     isAvailableToUnlock = isXpEnough and isNext2Unlock
     if not isAvailableToUnlock:
         if not isXpEnough:
             tooltip = _buildBuyButtonTooltip('notEnoughXp')
         elif any((bool(cd in unlocks)
                   for cd in g_techTreeDP.getTopLevel(nodeCD))):
             tooltip = _buildBuyButtonTooltip('parentModuleIsLocked')
         else:
             tooltip = _buildBuyButtonTooltip('parentVehicleIsLocked')
     specialData = getHeroTankPreviewParams() if self.__isHeroTank else None
     if specialData is not None and specialData.buyButtonLabel:
         buyLabel = backport.text(specialData.buyButtonLabel)
     else:
         buyLabel = backport.text(
             R.strings.vehicle_preview.buyingPanel.buyBtn.label.research())
     return _ButtonState(enabled=isAvailableToUnlock,
                         itemPrice=getItemUnlockPricesVO(unlockProps),
                         label=buyLabel,
                         icon=buttonIcon,
                         iconAlign=buttonIconAlign,
                         isAction=unlockProps.discount > 0,
                         actionTooltip=None,
                         tooltip=tooltip,
                         title=self.__title,
                         isMoneyEnough=isXpEnough,
                         isUnlock=True,
                         isPrevItemsUnlock=isNext2Unlock,
                         customOffer=None,
                         isShowSpecial=False)