def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal): textStyle = TextType.DEFRES_TEXT if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION: textStyle = TextType.ALERT_TEXT formattedHpValue = TextManager.reference().getText(textStyle, str(BigWorld.wg_getIntegralFormat(hpVal))) hpTotalFormatted = str(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' ' formattedHpTotal = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, hpTotalFormatted), (TextIcons.NUT_ICON,))) formattedDefResValue = TextManager.reference().getText(TextType.DEFRES_TEXT, str(BigWorld.wg_getIntegralFormat(defResVal))) maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' ' formattedDefResTotal = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, maxDefDerFormatted), (TextIcons.NUT_ICON,))) hpProgressLabels = {'currentValue': formattedHpValue, 'totalValue': formattedHpTotal, 'separator': '/'} storeProgressLabels = {'currentValue': formattedDefResValue, 'totalValue': formattedDefResTotal, 'separator': '/'} result = {'hpLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL), 'defResLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL), 'hpCurrentValue': hpVal, 'hpTotalValue': hpTotalVal, 'defResCurrentValue': defResVal, 'defResTotalValue': maxDefResVal, 'hpProgressLabels': hpProgressLabels, 'defResProgressLabels': storeProgressLabels} return result
def getDefRes(value, addIcon = True): valueStr = BigWorld.wg_getIntegralFormat(value) text = TextManager.reference().getText(TEXT_MANAGER_STYLES.DEFRES_TEXT, valueStr) if addIcon: icon = TextManager.reference().getIcon(TextIcons.NUT_ICON) return text + ' ' + icon else: return text
def __getTransportingBuildTooltipData(self, building): state = None headerArgs = {} bodyArgs = {} if building is not None: buildingName = building.userName if building.isInCooldown(): state = 'cooldown' timeStr = TextManager.reference().getTimeDurationStr(building.getEstimatedCooldown()) headerArgs = {'buildingName': buildingName} bodyArgs = {'time': timeStr} elif not building.hasStorageToExport(): state = 'emptyStorage' headerArgs = {'buildingName': buildingName} elif not building.hasSpaceToImport() and self.isOnNextTransportingStep(): state = 'notEmptySpace' headerArgs = {'buildingName': buildingName} elif not building.isReady(): state = 'foundation' else: state = 'foundation' if state == 'foundation': headerArgs = {'buildingName': i18n.makeString(FORTIFICATIONS.BUILDINGS_TROWELLABEL)} if state is not None: header = TOOLTIPS.fortification_transporting(state + '/header') body = TOOLTIPS.fortification_transporting(state + '/body') return [i18n.makeString(header, **headerArgs), i18n.makeString(body, **bodyArgs)] else: return return
def makeSimpleClanListRenderVO(member, intTotalMining, intWeekMining, role, roleID): week = BigWorld.wg_getIntegralFormat(intWeekMining) week = TextManager.reference().getText(TextType.DEFRES_TEXT, week) allTime = BigWorld.wg_getIntegralFormat(intTotalMining) allTime = TextManager.reference().getText(TextType.DEFRES_TEXT, allTime) databaseID = member.getID() return {'dbID': databaseID, 'uid': databaseID, 'himself': bool(BigWorld.player().databaseID == databaseID), 'userName': member.getName(), 'playerRole': role, 'playerRoleID': roleID, 'thisWeek': week, 'allTime': allTime, 'intWeekMining': intWeekMining, 'intTotalMining': intTotalMining, 'fullName': member.getFullName()}
def getBuildingTooltipBody(self, hpVal, maxHpValue, defResVal, maxDefResValue): nutIcon = ' ' + TextManager.reference().getIcon(TextIcons.NUT_ICON) labelOne = i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STRENGTH) labelTwo = i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STORE) fstLine = labelOne + self.__toFormattedStr(hpVal) + '/' + self.__toFormattedStr(maxHpValue) + nutIcon secLine = labelTwo + self.__toFormattedStr(defResVal) + '/' + self.__toFormattedStr(maxDefResValue) + nutIcon toolTipData = fstLine + secLine return toolTipData
def makeSortieShortVO(unitFunctional, unitIdx = None, app = None): fullData = unitFunctional.getUnitFullData(unitIdx=unitIdx) if fullData is None: textMgr = TextManager.reference() title = i18n.makeString(FORTIFICATIONS.SORTIE_LISTVIEW_ALERTTEXT_TITLE) body = i18n.makeString(FORTIFICATIONS.SORTIE_LISTVIEW_ALERTTEXT_BODY) alertView = {'icon': RES_ICONS.MAPS_ICONS_LIBRARY_ALERTICON, 'titleMsg': textMgr.getText(TextType.ALERT_TEXT, title), 'bodyMsg': textMgr.getText(TextType.MAIN_TEXT, body), 'buttonLbl': FORTIFICATIONS.SORTIE_LISTVIEW_ENTERBTN} return {'isShowAlertView': True, 'alertView': alertView} (unit, unitState, unitStats, pInfo, slotsIter,) = fullData division = getDivisionNameByType(unit.getRosterTypeID()) divisionTypeStr = i18n.makeString(FORTIFICATIONS.sortie_division_name(division)) (unit, unitState, _, pInfo, slotsIter,) = fullData return {'isFreezed': unitState.isLocked(), 'hasRestrictions': unit.isRosterSet(ignored=settings.CREATOR_ROSTER_SLOT_INDEXES), 'slots': _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app, unitFunctional.getRosterSettings().getLevelsRange()), 'description': divisionTypeStr if divisionTypeStr else unitFunctional.getCensoredComment(unitIdx=unitIdx)}
def getCommonBuildTooltipData(self, buildingDescr): hpVal = 0 maxHpValue = 0 defResVal = 0 maxDefResValue = 0 orderTooltipData = None if buildingDescr is not None: hpVal = buildingDescr.hp maxHpValue = buildingDescr.levelRef.hp defResVal = buildingDescr.storage maxDefResValue = buildingDescr.levelRef.storage if buildingDescr.orderInProduction: if self._isProductionInPause(buildingDescr): orderTooltipData = '\n' + i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE) else: order = self.fortCtrl.getFort().getOrder(self.fortCtrl.getFort().getBuildingOrder(buildingDescr.typeID)) orderTime = TextManager.reference().getTimeDurationStr(order.getProductionLeftTime()) orderTooltipData = i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_ORDER, order.productionCount, orderTime) toolTipData = self.getBuildingTooltipBody(hpVal, maxHpValue, defResVal, maxDefResValue) if orderTooltipData is not None: toolTipData += orderTooltipData return toolTipData
def makeSortieVO(unitFunctional, unitIdx = None, app = None): fullData = unitFunctional.getUnitFullData(unitIdx=unitIdx) if fullData is None: return {} (unit, unitState, unitStats, pInfo, slotsIter,) = fullData division = getDivisionNameByType(unit.getRosterTypeID()) divisionTypeStr = i18n.makeString(FORTIFICATIONS.sortie_division_name(division)) divisionStr = i18n.makeString(FORTIFICATIONS.SORTIE_ROOM_DIVISION) divisionLbl = TextManager.reference().concatStyles(((TextType.STANDARD_TEXT, divisionStr), (TextType.MAIN_TEXT, divisionTypeStr))) isPlayerCreator = pInfo.isCreator() (canDoAction, restriction,) = unitFunctional.validateLevels(stats=unitStats) sumLevelsStr = makeTotalLevelLabel(unitStats, restriction) return {'isCommander': isPlayerCreator, 'isFreezed': unitState.isLocked(), 'hasRestrictions': unit.isRosterSet(ignored=settings.CREATOR_ROSTER_SLOT_INDEXES), 'statusLbl': makeUnitStateLabel(unitState), 'statusValue': unitState.isOpened(), 'sumLevelsInt': unitStats.curTotalLevel, 'sumLevels': sumLevelsStr, 'sumLevelsError': canDoAction, 'slots': _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app, unitFunctional.getRosterSettings().getLevelsRange()), 'description': unitFunctional.getCensoredComment(unitIdx=unitIdx), 'divisionLbl': divisionLbl}
def getDefResWithText(mainTextValue, defResValue, addIcon): mainText = TextManager.reference().getText(TEXT_MANAGER_STYLES.MAIN_TEXT, mainTextValue) defResText = getDefRes(defResValue, addIcon) return mainText + defResText
def getBonusText(strValue, buildingID, textsStyle = None, ctx = None): ctx = ctx or {} textsStyle = textsStyle or (TEXT_MANAGER_STYLES.NEUTRAL_TEXT, TEXT_MANAGER_STYLES.MAIN_TEXT) descrStr = i18n.makeString(FORTIFICATIONS.buildings_defresinfo(buildingID), **ctx) resultDescr = TextManager.reference().concatStyles(((textsStyle[0], strValue + ' ' if strValue else ''), (textsStyle[1], descrStr))) return resultDescr