def __makeColumnParamValues(self, level, isCurrentLevel = False, isShowSeparator = True):
     battleOrder = FortOrder(self.__orderID, level=level)
     if isCurrentLevel:
         paramsStyle, levelStyle = text_styles.stats, text_styles.neutral
     else:
         paramsStyle = levelStyle = text_styles.disabled
     levelStr = _ms('#fortifications:fortConsumableOrder/levelLbl', level=fort_formatters.getTextLevel(level))
     return {'params': paramsStyle(_newLine(2).join(map(str, dict(battleOrder.getParams()).values()))),
      'orderLevel': levelStyle(levelStr),
      'isShowSeparator': isShowSeparator}
 def __makeColumnParamValues(self, level, isCurrentLevel = False, isShowSeparator = True):
     battleOrder = FortOrder(self.__orderID, level=level)
     if isCurrentLevel:
         paramsStyle, levelStyle = text_styles.stats, text_styles.neutral
     else:
         paramsStyle = levelStyle = text_styles.disabled
     levelStr = _ms('#fortifications:fortConsumableOrder/levelLbl', level=fort_formatters.getTextLevel(level))
     return {'params': paramsStyle(_newLine(2).join(map(str, dict(battleOrder.getParams()).values()))),
      'orderLevel': levelStyle(levelStr),
      'isShowSeparator': isShowSeparator}
    def __updateSlots(self):
        if not self._isConsumablesAvailable():
            return
        else:
            extra = self.unitFunctional.getExtra()
            consumablesVisible = self.fortCtrl.getPermissions(
            ).canActivateConsumable() and self.unitFunctional.getPermissions(
            ).canChangeConsumables()
            consumablesDisabled = not g_lobbyContext.getServerSettings(
            ).isFortsEnabled()
            result = []
            if extra is not None:
                activeConsumes = extra.getConsumables()
                for slotIdx in xrange(
                        fortified_regions.g_cache.consumablesSlotCount):
                    if slotIdx in activeConsumes:
                        orderTypeID, level = activeConsumes[slotIdx]
                        orderItem = FortOrder(orderTypeID)
                        building = FortBuilding(typeID=orderItem.buildingID)
                        result.append(
                            _makeSlotVO(
                                self.getOrderUIDbyID(orderTypeID), slotIdx,
                                building.userName, level, orderItem.icon,
                                orderTypeID, not consumablesVisible
                                or consumablesDisabled))
                    elif consumablesVisible:
                        result.append(
                            _makeEmptySlotVO(slotIdx, consumablesDisabled))

            self.as_setPanelPropsS(dict(self._getSlotsProps()))
            self.as_setSlotsS(result)
            return
 def __prepareOrderInfo(self, increment = False, orderCount = 0, orderLevel = 1):
     result = {}
     if self.intBuildingID == FORT_BUILDING_TYPE.MILITARY_BASE:
         if increment:
             building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(min(self.__baseBuildingLevel + 1, MAX_FORTIFICATION_LEVEL)))
             defresDescr = self.app.utilsManager.textManager.concatStyles(((TEXT_MANAGER_STYLES.NEUTRAL_TEXT, building_bonus + ' '), (TEXT_MANAGER_STYLES.MAIN_TEXT, i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
         else:
             building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel))
             defresDescr = self.app.utilsManager.textManager.concatStyles(((TEXT_MANAGER_STYLES.STANDARD_TEXT, building_bonus + ' '), (TEXT_MANAGER_STYLES.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
     else:
         orderTypeID = self.fortCtrl.getFort().getBuildingOrder(self.intBuildingID)
         _, _, foundedLevel, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID)
         if increment:
             bodyTextColor = TEXT_MANAGER_STYLES.MAIN_TEXT
             bonusTextColor = TEXT_MANAGER_STYLES.NEUTRAL_TEXT
             foundedLevel += 1
             _, _, _, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID, foundedLevel)
             textPadding = '     '
         else:
             bodyTextColor = TEXT_MANAGER_STYLES.STANDARD_TEXT
             bonusTextColor = TEXT_MANAGER_STYLES.STANDARD_TEXT
             textPadding = ''
         if orderTypeID == FORT_ORDER_TYPE.SPECIAL_MISSION:
             awardText = textPadding + i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_POSSIBLEAWARD) + ' '
             bonusDescr = i18n.makeString(FORTIFICATIONS.orders_specialmission_possibleaward_description_level(foundedLevel))
             defresDescr = self.app.utilsManager.textManager.concatStyles(((bonusTextColor, awardText), (bodyTextColor, bonusDescr)))
         elif orderTypeID in FORT_ORDER_TYPE.CONSUMABLES:
             colorStyle = (bonusTextColor, bodyTextColor)
             battleOrder = FortOrder(orderTypeID, level=orderLevel)
             defresDescr = fort_formatters.getBonusText(textPadding, self.__uid, ctx=dict(battleOrder.getParams()), textsStyle=colorStyle)
         else:
             colorStyle = (bonusTextColor, bodyTextColor)
             bonus = str(abs(orderData.effectValue))
             defresDescr = fort_formatters.getBonusText('%s+%s%%' % (textPadding, bonus), self.__uid, colorStyle)
     result['ordersCount'] = orderCount
     result['description'] = defresDescr
     result['buildingType'] = self.__uid
     result['showAlertIcon'] = False
     isCombatOrderBuilding = self.__uid in [FORTIFICATION_ALIASES.FORT_ARTILLERY_SHOP_BUILDING, FORTIFICATION_ALIASES.FORT_BOMBER_SHOP_BUILDING]
     result['descriptionLink'] = increment and isCombatOrderBuilding
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = self.fortCtrl.getFort().getOrder(self._buildingDescr.typeRef.orderType)
         result['iconSource'] = order.icon
         result['iconLevel'] = order.level if not increment else order.level + 1
     if increment and self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         result['infoIconSource'] = RES_ICONS.MAPS_ICONS_LIBRARY_INFORMATIONICON
         toolTipData = {}
         toolTipData['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_HEADER)
         toolTipData['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_BODY, testData='test py var')
         result['infoIconToolTipData'] = toolTipData
     return result
 def __prepareOrderInfo(self, increment = False, orderCount = 0, orderLevel = 1):
     result = {}
     if self.intBuildingID == FORT_BUILDING_TYPE.MILITARY_BASE:
         if increment:
             building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(min(self.__baseBuildingLevel + 1, MAX_FORTIFICATION_LEVEL)))
             defresDescr = ''.join((text_styles.neutral(building_bonus + ' '), text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
         else:
             building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel))
             defresDescr = ''.join((text_styles.standard(building_bonus + ' '), text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
     else:
         orderTypeID = self.fortCtrl.getFort().getBuildingOrder(self.intBuildingID)
         _, _, foundedLevel, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID)
         if increment:
             bodyStyle = text_styles.main
             bonusStyle = text_styles.neutral
             foundedLevel += 1
             _, _, _, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID, foundedLevel)
             textPadding = '     '
         else:
             bodyStyle = text_styles.standard
             bonusStyle = text_styles.standard
             textPadding = ''
         if orderTypeID == FORT_ORDER_TYPE.SPECIAL_MISSION:
             awardText = textPadding + i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_POSSIBLEAWARD) + ' '
             bonusDescr = i18n.makeString(FORTIFICATIONS.orders_specialmission_possibleaward_description_level(foundedLevel))
             defresDescr = ''.join((bonusStyle(awardText), bodyStyle(bonusDescr)))
         elif orderTypeID in FORT_ORDER_TYPE.CONSUMABLES:
             battleOrder = FortOrder(orderTypeID, level=orderLevel)
             defresDescr = fort_formatters.getBonusText(textPadding, self.__uid, ctx=dict(battleOrder.getParams()), textsStyle=(bonusStyle, bodyStyle))
         else:
             colorStyle = (bonusStyle, bodyStyle)
             bonus = str(abs(orderData.effectValue))
             defresDescr = fort_formatters.getBonusText('%s+%s%%' % (textPadding, bonus), self.__uid, colorStyle)
     result['ordersCount'] = orderCount
     result['description'] = defresDescr
     result['buildingType'] = self.__uid
     result['showAlertIcon'] = False
     isCombatOrderBuilding = self.__uid in [FORTIFICATION_ALIASES.FORT_ARTILLERY_SHOP_BUILDING, FORTIFICATION_ALIASES.FORT_BOMBER_SHOP_BUILDING]
     result['descriptionLink'] = increment and isCombatOrderBuilding
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = self.fortCtrl.getFort().getOrder(self._buildingDescr.typeRef.orderType)
         result['iconSource'] = order.icon
         result['iconLevel'] = order.level if not increment else order.level + 1
     if increment and self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         result['infoIconSource'] = RES_ICONS.MAPS_ICONS_LIBRARY_INFORMATIONICON
         result['infoIconToolTip'] = makeTooltip(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_HEADER, TOOLTIPS.FORTIFICATION_DEFRESICONINFO_BODY)
     return result
Example #6
0
 def buildItem(self, fortOrderTypeID, level):
     return FortOrder(int(fortOrderTypeID), level=int(level))
Example #7
0
 def getOrder(self, orderID):
     return FortOrder(orderID, self)
 def __prepareOrderInfo(self, increment=False, orderCount=0, orderLevel=1):
     result = {}
     if self.intBuildingID == FORT_BUILDING_TYPE.MILITARY_BASE:
         if increment:
             building_bonus = i18n.makeString(
                 FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL,
                 buildLevel=fort_formatters.getTextLevel(
                     min(self.__baseBuildingLevel + 1,
                         MAX_FORTIFICATION_LEVEL)))
             defresDescr = ''.join(
                 (text_styles.neutral(building_bonus + ' '),
                  text_styles.main(
                      i18n.makeString(
                          FORTIFICATIONS.
                          BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
         else:
             building_bonus = i18n.makeString(
                 FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL,
                 buildLevel=fort_formatters.getTextLevel(
                     self.__baseBuildingLevel))
             defresDescr = ''.join(
                 (text_styles.standard(building_bonus + ' '),
                  text_styles.standard(
                      i18n.makeString(
                          FORTIFICATIONS.
                          BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
     else:
         orderTypeID = self.fortCtrl.getFort().getBuildingOrder(
             self.intBuildingID)
         _, _, foundedLevel, orderData = self.fortCtrl.getFort(
         ).getOrderData(orderTypeID)
         if increment:
             bodyStyle = text_styles.main
             bonusStyle = text_styles.neutral
             foundedLevel += 1
             _, _, _, orderData = self.fortCtrl.getFort().getOrderData(
                 orderTypeID, foundedLevel)
             textPadding = '     '
         else:
             bodyStyle = text_styles.standard
             bonusStyle = text_styles.standard
             textPadding = ''
         if orderTypeID == FORT_ORDER_TYPE.SPECIAL_MISSION:
             awardText = textPadding + i18n.makeString(
                 FORTIFICATIONS.ORDERS_SPECIALMISSION_POSSIBLEAWARD) + ' '
             bonusDescr = i18n.makeString(
                 FORTIFICATIONS.
                 orders_specialmission_possibleaward_description_level(
                     foundedLevel))
             defresDescr = ''.join(
                 (bonusStyle(awardText), bodyStyle(bonusDescr)))
         elif orderTypeID in FORT_ORDER_TYPE.CONSUMABLES:
             battleOrder = FortOrder(orderTypeID, level=orderLevel)
             defresDescr = fort_formatters.getBonusText(
                 textPadding,
                 self.__uid,
                 ctx=dict(battleOrder.getParams()),
                 textsStyle=(bonusStyle, bodyStyle))
         else:
             colorStyle = (bonusStyle, bodyStyle)
             bonus = str(abs(orderData.effectValue))
             defresDescr = fort_formatters.getBonusText(
                 '%s+%s%%' % (textPadding, bonus), self.__uid, colorStyle)
     result['ordersCount'] = orderCount
     result['description'] = defresDescr
     result['buildingType'] = self.__uid
     result['showAlertIcon'] = False
     isCombatOrderBuilding = self.__uid in [
         FORTIFICATION_ALIASES.FORT_ARTILLERY_SHOP_BUILDING,
         FORTIFICATION_ALIASES.FORT_BOMBER_SHOP_BUILDING
     ]
     result['descriptionLink'] = increment and isCombatOrderBuilding
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = self.fortCtrl.getFort().getOrder(
             self._buildingDescr.typeRef.orderType)
         result['iconSource'] = order.icon
         result[
             'iconLevel'] = order.level if not increment else order.level + 1
     if increment and self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         result[
             'infoIconSource'] = RES_ICONS.MAPS_ICONS_LIBRARY_INFORMATIONICON
         result['infoIconToolTip'] = makeTooltip(
             TOOLTIPS.FORTIFICATION_DEFRESICONINFO_HEADER,
             TOOLTIPS.FORTIFICATION_DEFRESICONINFO_BODY)
     return result