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))
def __makeUnlockModuleVO(self, item, unlockProps): isEnoughXp = self.__vehicleXp - unlockProps.xpCost >= 0 unlockXp = unlockProps.xpCost formatter = text_styles.expText if isEnoughXp else text_styles.error formattedPrice = BigWorld.wg_getIntegralFormat(unlockXp) + icons.xp() return {'title': _ms(BATTLE_RESULTS.COMMON_FITTING_RESEARCH), 'description': text_styles.main(item.userName), 'fittingType': item.itemTypeName, 'lvlIcon': getLevelIconPath(item.level), 'price': formatter(formattedPrice), 'linkEvent': PROGRESS_ACTION.RESEARCH_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __makeUnlockModuleVO(self, item, unlockProps): isEnoughXp = self.__vehicleXp - unlockProps.xpCost >= 0 unlockXp = unlockProps.xpCost formatter = text_styles.expText if isEnoughXp else text_styles.error formattedPrice = BigWorld.wg_getIntegralFormat(unlockXp) + icons.xp() return {'title': _ms(BATTLE_RESULTS.COMMON_FITTING_RESEARCH), 'description': text_styles.main(item.userName), 'fittingType': item.itemTypeName, 'lvlIcon': getLevelIconPath(item.level), 'price': formatter(formattedPrice), 'linkEvent': PROGRESS_ACTION.RESEARCH_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __makeUnlockVehicleVO(self, item, unlockProps, avgBattlesTillUnlock): prediction = '' if avgBattlesTillUnlock > 0: prediction = _ms(BATTLE_RESULTS.COMMON_RESEARCHPREDICTION, battles=avgBattlesTillUnlock) isEnoughXp = self.__vehicleXp - unlockProps.xpCost >= 0 unlockXp = unlockProps.xpCost formatter = text_styles.expText if isEnoughXp else text_styles.error formattedPrice = BigWorld.wg_getIntegralFormat(unlockXp) + icons.xp() return {'title': _ms(BATTLE_RESULTS.COMMON_VEHICLE_RESEARCH), 'description': self.__makeVehicleDescription(item), 'vehicleIcon': item.iconSmall, 'lvlIcon': getLevelIconPath(item.level), 'prediction': prediction, 'price': formatter(formattedPrice), 'linkEvent': PROGRESS_ACTION.RESEARCH_UNLOCK_TYPE, 'linkId': unlockProps.parentID}
def __makeUnlockVehicleVO(self, item, unlockProps, avgBattlesTillUnlock): prediction = '' if avgBattlesTillUnlock > 0: prediction = _ms(BATTLE_RESULTS.COMMON_RESEARCHPREDICTION, battles=avgBattlesTillUnlock) isEnoughXp = self.__vehicleXp - unlockProps.xpCost >= 0 unlockXp = unlockProps.xpCost formatter = text_styles.expText if isEnoughXp else text_styles.error formattedPrice = BigWorld.wg_getIntegralFormat(unlockXp) + icons.xp() return {'title': _ms(BATTLE_RESULTS.COMMON_VEHICLE_RESEARCH), 'description': self.__makeVehicleDescription(item), 'vehicleIcon': item.iconSmall, 'lvlIcon': getLevelIconPath(item.level), 'prediction': prediction, 'price': formatter(formattedPrice), 'linkEvent': PROGRESS_ACTION.RESEARCH_UNLOCK_TYPE, 'linkId': unlockProps.parentID}