Exemplo n.º 1
0
 def __makeOrderInfoData(self, uid):
     self._buildingID = self.getBuildingIDbyUID(uid)
     self._orderID = self.fortCtrl.getFort().getBuildingOrder(
         self._buildingID)
     orderTitle = text_styles.middleTitle(
         i18n.makeString(
             FORTIFICATIONS.orders_orderpopover_ordertype(
                 self.getOrderUIDbyID(self._orderID))))
     descrMSG = i18n.makeString(
         FORTIFICATIONS.buildings_processorderinfo(uid))
     descrMSG = text_styles.main(descrMSG)
     result = {}
     result['title'] = orderTitle
     result['description'] = descrMSG
     buildingId = self.getBuildingIDbyUID(uid)
     buildingDescr = self.fortCtrl.getFort().getBuilding(
         self.getBuildingIDbyUID(uid), BuildingDescr(typeID=buildingId))
     order = self.fortCtrl.getFort().getOrder(
         buildingDescr.typeRef.orderType)
     result['iconSource'] = order.icon
     showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order)
     result['showAlertIcon'] = showAlertIcon
     result['alertIconTooltip'] = alertIconTooltip
     result['iconLevel'] = None
     return result
Exemplo n.º 2
0
 def getSlotTooltipBody(self, orderID):
     if orderID == ORDER_TYPES.EMPTY_ORDER:
         return makeTooltip(
             i18n.makeString(
                 FORTIFICATIONS.orders_orderpopover_ordertype(orderID)),
             i18n.makeString(
                 TOOLTIPS.FORTORDERSPANELCOMPONENT_EMPTYSLOT_BODY), None)
     return ''
Exemplo n.º 3
0
 def getSlotTooltipBody(self, orderID):
     header = i18n.makeString(
         FORTIFICATIONS.orders_orderpopover_ordertype(orderID))
     note = None
     fort = self.fortCtrl.getFort()
     order = fort.getOrder(self.getOrderIDbyUID(orderID))
     buildingDescr = fort.getBuilding(order.buildingID)
     if order.hasBuilding:
         description = ''
         ordersListStr = i18n.makeString(
             TOOLTIPS.FORTIFICATION_ORDERPOPOVER_CLANPERMISSIONS)
         if order.inCooldown:
             description = self._getCooldownInfo(order)
         elif order.count > 0:
             if self._isProductionInPause(buildingDescr):
                 description = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERSPANEL_CANTUSEORDER)
                 description += '\n' + i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPROCESS_INFO)
             elif not order.isPermanent and not order.isCompatible and fort.hasActivatedContinualOrders(
             ):
                 description = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERSPANEL_CANTUSEORDER)
             else:
                 description = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPOPOVER_ORDERISREADY)
             if not self._canGiveOrder():
                 description += '\n' + ordersListStr
         else:
             if not order.inProgress:
                 description = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPOPOVER_CREATEORDER)
             if not self._canGiveOrder():
                 description = i18n.makeString(
                     TOOLTIPS.
                     FORTIFICATION_ORDERPOPOVER_USEORDERBTN_NOORDERS)
                 description += '\n' + ordersListStr
         if order.inProgress:
             if self._isProductionInPause(buildingDescr):
                 pauseText = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE)
                 if len(description) > 0:
                     description += '\n' + pauseText
                 else:
                     description = pauseText
                 description += '\n' + i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPROCESS_INFO)
             else:
                 description = self._getProgressInfo(description, order)
     else:
         buildingStr = i18n.makeString(
             FORTIFICATIONS.buildings_buildingname(
                 self.getBuildingUIDbyID(order.buildingID)))
         description = i18n.makeString(
             FORTIFICATIONS.ORDERS_ORDERPOPOVER_ORDERNOTREADY,
             building=buildingStr)
     return makeTooltip(header, description, note)
Exemplo n.º 4
0
 def _prepareAndSendData(self):
     resultData = {}
     if self._orderID:
         orderTitle = i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(self._orderID))
         order = self.fortCtrl.getFort().getOrder(self.getOrderIDbyUID(self._orderID))
         building = self.fortCtrl.getFort().getBuilding(order.buildingID)
         defRes = building.storage
         maxPurchase = int(defRes / order.productionCost)
         resultData = {'orderIcon': order.icon,
          'name': orderTitle,
          'description': order.description,
          'productionTime': order.productionTotalTime,
          'productionCost': order.productionCost,
          'level': order.level,
          'defaultValue': -1,
          'maxAvailableCount': min(order.maxCount - order.count, maxPurchase)}
     self.as_setDataS(resultData)
 def __makeOrderInfoData(self, uid):
     self._buildingID = self.getBuildingIDbyUID(uid)
     self._orderID = self.fortCtrl.getFort().getBuildingOrder(self._buildingID)
     orderTitle = text_styles.middleTitle(i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(self.getOrderUIDbyID(self._orderID))))
     descrMSG = i18n.makeString(FORTIFICATIONS.buildings_processorderinfo(uid))
     descrMSG = text_styles.main(descrMSG)
     result = {}
     result['title'] = orderTitle
     result['description'] = descrMSG
     buildingId = self.getBuildingIDbyUID(uid)
     buildingDescr = self.fortCtrl.getFort().getBuilding(self.getBuildingIDbyUID(uid), BuildingDescr(typeID=buildingId))
     order = self.fortCtrl.getFort().getOrder(buildingDescr.typeRef.orderType)
     result['iconSource'] = order.icon
     showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order)
     result['showAlertIcon'] = showAlertIcon
     result['alertIconTooltip'] = alertIconTooltip
     result['iconLevel'] = None
     return result
Exemplo n.º 6
0
 def getSlotTooltipBody(self, orderID):
     header = i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(orderID))
     note = None
     fort = self.fortCtrl.getFort()
     order = fort.getOrder(self.getOrderIDbyUID(orderID))
     buildingDescr = fort.getBuilding(order.buildingID)
     if order.hasBuilding:
         description = ""
         ordersListStr = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPOPOVER_CLANPERMISSIONS)
         if order.inCooldown:
             description = self._getCooldownInfo(order)
         elif order.count > 0:
             if self._isProductionInPause(buildingDescr):
                 description = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERSPANEL_CANTUSEORDER)
                 description += "\n" + i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INFO)
             elif not order.isPermanent and not order.isCompatible and fort.hasActivatedContinualOrders():
                 description = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERSPANEL_CANTUSEORDER)
             else:
                 description = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPOPOVER_ORDERISREADY)
             if not self._canGiveOrder():
                 description += "\n" + ordersListStr
         else:
             if not order.inProgress:
                 description = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPOPOVER_CREATEORDER)
             if not self._canGiveOrder():
                 description = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPOPOVER_USEORDERBTN_NOORDERS)
                 description += "\n" + ordersListStr
         if order.inProgress:
             if self._isProductionInPause(buildingDescr):
                 pauseText = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE)
                 if len(description) > 0:
                     description += "\n" + pauseText
                 else:
                     description = pauseText
                 description += "\n" + i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INFO)
             else:
                 description = self._getProgressInfo(description, order)
     else:
         buildingStr = i18n.makeString(
             FORTIFICATIONS.buildings_buildingname(self.getBuildingUIDbyID(order.buildingID))
         )
         description = i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_ORDERNOTREADY, building=buildingStr)
     return makeTooltip(header, description, note)
Exemplo n.º 7
0
 def _prepareAndSendData(self):
     resultData = {}
     if self._orderID:
         orderTitle = i18n.makeString(
             FORTIFICATIONS.orders_orderpopover_ordertype(self._orderID))
         order = self.fortCtrl.getFort().getOrder(
             self.getOrderIDbyUID(self._orderID))
         building = self.fortCtrl.getFort().getBuilding(order.buildingID)
         defRes = building.storage
         maxPurchase = int(defRes / order.productionCost)
         maxAvailableCount = min(order.maxCount - order.count, maxPurchase,
                                 100)
         resultData = {
             'orderIcon': order.icon,
             'name': orderTitle,
             'description': order.description,
             'productionTime': order.productionTotalTime,
             'productionCost': order.productionCost,
             'level': order.level,
             'defaultValue': -1,
             'maxAvailableCount': maxAvailableCount
         }
     self.as_setDataS(resultData)
Exemplo n.º 8
0
 def _getTitle(self):
     orderTitle = ''
     if self._orderID:
         orderTitle = i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(self._orderID))
     return orderTitle
 def __prepareActionData(self):
     result = {}
     enableActionBtn = False
     if self._isBaseBuilding:
         if self.__isCommander:
             result['currentState'] = self.ACTION_STATES.BASE_COMMANDER
             resultConcat = ''.join((text_styles.main(i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESACTIONS_DIRECTIONOPENED)), text_styles.neutral(self.__directionOpened)))
             result['generalLabel'] = resultConcat
             result['actionButtonLbl'] = i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESACTIONS_MANAGEMENT)
             enableActionBtn = True
         else:
             result['currentState'] = self.ACTION_STATES.BASE_NOT_COMMANDER
             resultConcat = ''.join((text_styles.main(i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESACTIONS_DIRECTIONOPENED)), text_styles.neutral(self.__directionOpened)))
             result['generalLabel'] = resultConcat
     elif self.__isCommander:
         if self.__buildingDescr.orderInProduction:
             orderCount = self.__buildingDescr.orderInProduction.get('count', 0)
             result['currentState'] = self.ACTION_STATES.NOT_BASE_COMMANDER_ORDERED
             if self._isProductionInPause(self.__buildingDescr):
                 result['productionInPause'] = True
                 title = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE_HEADER)
                 body = i18n.makeString(TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE_BODY)
                 result['pauseReasonTooltip'] = [title, body]
                 overTime = i18n.makeString(FORT.BUILDINGPOPOVER_ORDERPROCESS_INPAUSE)
                 orderTimeIcon = icons.alert()
                 orderTimeMsg = text_styles.alert(overTime)
                 orderTime = i18n.makeString(orderTimeIcon + ' ' + orderTimeMsg)
             else:
                 overTime = i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESACTIONS_PREPARETIMEOVER)
                 overTime = overTime + self.__orderTime
                 orderTime = text_styles.neutral(overTime)
             orderTimer = ''.join((text_styles.main(i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESACTIONS_PREPARINGDEFRES)), text_styles.neutral(orderCount)))
             result['orderTimer'] = orderTimer
             result['timeOver'] = orderTime
             result['generalLabel'] = self.__makeGeneralActionLabel()
         else:
             result['currentState'] = self.ACTION_STATES.NOT_BASE_COMMANDER_NOT_ORDERED
             result['generalLabel'] = self.__makeGeneralActionLabel()
             result['actionButtonLbl'] = i18n.makeString(FORT.BUILDINGPOPOVER_DEFRESACTIONS_REQUESTDEFRES)
             enableActionBtn = True
             order = self.fortCtrl.getFort().getOrder(self.__orderID)
             if self.__defResVal < order.productionCost:
                 enableActionBtn = False
                 result['toolTipData'] = TOOLTIPS.FORTIFICATION_POPOVER_PREPAREORDERDISABLE
             if order.maxCount <= order.count:
                 enableActionBtn = False
                 result['toolTipData'] = TOOLTIPS.FORTIFICATION_POPOVER_PREPAREORDEROVERLOAD
             if self._isBuildingDamaged(self.__buildingDescr) or self._isBaseBuildingDamaged() or self._isFortFrozen():
                 enableActionBtn = False
                 header = TOOLTIPS.FORTIFICATION_ORDERPROCESS_NOTAVAILABLE_HEADER
                 body = TOOLTIPS.FORTIFICATION_ORDERPROCESS_NOTAVAILABLE_BODY
                 result['toolTipData'] = makeTooltip(header, body)
             if enableActionBtn:
                 orderName = i18n.makeString(FORT.orders_orderpopover_ordertype(self.getOrderUIDbyID(self.__orderID)))
                 result['toolTipData'] = i18n.makeString(TOOLTIPS.FORTIFICATION_POPOVER_PREPAREORDERENABLE, orderName=orderName)
     else:
         result['currentState'] = self.ACTION_STATES.NOT_BASE_NOT_COMMANDER
         result['generalLabel'] = 'unVISIBLE'
         result['actionButtonLbl'] = 'unVISIBLE'
     result['enableActionButton'] = enableActionBtn and not self.__isTutorial
     return result
Exemplo n.º 10
0
 def __makeOrderInfoData(self, uid):
     self._buildingID = self.getBuildingIDbyUID(uid)
     self._orderID = self.fortCtrl.getFort().getBuildingOrder(self._buildingID)
     orderTitle = self.app.utilsManager.textManager.getText(TextType.MIDDLE_TITLE, i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(self.getOrderUIDbyID(self._orderID))))
     descrMSG = i18n.makeString(FORTIFICATIONS.buildings_processorderinfo(uid))
     descrMSG = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, descrMSG)
     result = {}
     result['title'] = orderTitle
     result['description'] = descrMSG
     buildingId = self.getBuildingIDbyUID(uid)
     buildingDescr = self.fortCtrl.getFort().getBuilding(self.getBuildingIDbyUID(uid), BuildingDescr(typeID=buildingId))
     order = self.fortCtrl.getFort().getOrder(buildingDescr.typeRef.orderType)
     result['iconSource'] = order.icon
     isCombatOrderBuilding = self._isCombatOrderBuilding(buildingId)
     result['showAlertIcon'] = True if isCombatOrderBuilding else self._showOrderAlertIcon(order)
     if isCombatOrderBuilding:
         result['alertIconTooltip'] = TOOLTIPS.FORTIFICATION_BUILDINGPROCESS_ALERT_ONLYUSEDINCOMBAT
     result['iconLevel'] = None
     return result
 def getSlotTooltipBody(self, orderID):
     if orderID == ORDER_TYPES.EMPTY_ORDER:
         return makeTooltip(i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(orderID)), i18n.makeString(TOOLTIPS.FORTORDERSPANELCOMPONENT_EMPTYSLOT_BODY), None)
     else:
         return ''
 def __makeOrderInfoData(self, uid):
     self._buildingID = self.getBuildingIDbyUID(uid)
     self._orderID = self.fortCtrl.getFort().getBuildingOrder(self._buildingID)
     orderTitle = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.MIDDLE_TITLE, i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(self.getOrderUIDbyID(self._orderID))))
     descrMSG = i18n.makeString(FORTIFICATIONS.buildings_processorderinfo(uid))
     descrMSG = self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT, descrMSG)
     result = {}
     result['title'] = orderTitle
     result['description'] = descrMSG
     buildingId = self.getBuildingIDbyUID(uid)
     buildingDescr = self.fortCtrl.getFort().getBuilding(self.getBuildingIDbyUID(uid), BuildingDescr(typeID=buildingId))
     order = self.fortCtrl.getFort().getOrder(buildingDescr.typeRef.orderType)
     result['iconSource'] = order.icon
     showAlertIcon, alertIconTooltip = self._showOrderAlertIcon(order)
     result['showAlertIcon'] = showAlertIcon
     result['alertIconTooltip'] = alertIconTooltip
     result['iconLevel'] = None
     return result
Exemplo n.º 13
0
 def _getTitle(self):
     orderTitle = ''
     if self._orderID:
         orderTitle = i18n.makeString(FORTIFICATIONS.orders_orderpopover_ordertype(self._orderID))
     return orderTitle
 def __prepareActionData(self):
     result = {}
     enableActionBtn = False
     if self._isBaseBuilding:
         if self.__isCommander:
             result['currentState'] = self.ACTION_STATES.BASE_COMMANDER
             resultConcat = ''.join((text_styles.main(
                 i18n.makeString(
                     FORT.BUILDINGPOPOVER_DEFRESACTIONS_DIRECTIONOPENED)),
                                     text_styles.neutral(
                                         self.__directionOpened)))
             result['generalLabel'] = resultConcat
             result['actionButtonLbl'] = i18n.makeString(
                 FORT.BUILDINGPOPOVER_DEFRESACTIONS_MANAGEMENT)
             enableActionBtn = True
         else:
             result['currentState'] = self.ACTION_STATES.BASE_NOT_COMMANDER
             resultConcat = ''.join((text_styles.main(
                 i18n.makeString(
                     FORT.BUILDINGPOPOVER_DEFRESACTIONS_DIRECTIONOPENED)),
                                     text_styles.neutral(
                                         self.__directionOpened)))
             result['generalLabel'] = resultConcat
     elif self.__isCommander:
         if self.__buildingDescr.orderInProduction:
             orderCount = self.__buildingDescr.orderInProduction.get(
                 'count', 0)
             result[
                 'currentState'] = self.ACTION_STATES.NOT_BASE_COMMANDER_ORDERED
             if self._isProductionInPause(self.__buildingDescr):
                 result['productionInPause'] = True
                 title = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE_HEADER)
                 body = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_ORDERPROCESS_INPAUSE_BODY)
                 result['pauseReasonTooltip'] = [title, body]
                 overTime = i18n.makeString(
                     FORT.BUILDINGPOPOVER_ORDERPROCESS_INPAUSE)
                 orderTimeIcon = icons.alert()
                 orderTimeMsg = text_styles.alert(overTime)
                 orderTime = i18n.makeString(orderTimeIcon + ' ' +
                                             orderTimeMsg)
             else:
                 overTime = i18n.makeString(
                     FORT.BUILDINGPOPOVER_DEFRESACTIONS_PREPARETIMEOVER)
                 overTime = overTime + self.__orderTime
                 orderTime = text_styles.neutral(overTime)
             orderTimer = ''.join((text_styles.main(
                 i18n.makeString(
                     FORT.BUILDINGPOPOVER_DEFRESACTIONS_PREPARINGDEFRES)),
                                   text_styles.neutral(orderCount)))
             result['orderTimer'] = orderTimer
             result['timeOver'] = orderTime
             result['generalLabel'] = self.__makeGeneralActionLabel()
         else:
             result[
                 'currentState'] = self.ACTION_STATES.NOT_BASE_COMMANDER_NOT_ORDERED
             result['generalLabel'] = self.__makeGeneralActionLabel()
             result['actionButtonLbl'] = i18n.makeString(
                 FORT.BUILDINGPOPOVER_DEFRESACTIONS_REQUESTDEFRES)
             enableActionBtn = True
             order = self.fortCtrl.getFort().getOrder(self.__orderID)
             if self.__defResVal < order.productionCost:
                 enableActionBtn = False
                 result[
                     'toolTipData'] = TOOLTIPS.FORTIFICATION_POPOVER_PREPAREORDERDISABLE
             if order.maxCount <= order.count:
                 enableActionBtn = False
                 result[
                     'toolTipData'] = TOOLTIPS.FORTIFICATION_POPOVER_PREPAREORDEROVERLOAD
             if self._isBuildingDamaged(
                     self.__buildingDescr) or self._isBaseBuildingDamaged(
                     ) or self._isFortFrozen():
                 enableActionBtn = False
                 header = TOOLTIPS.FORTIFICATION_ORDERPROCESS_NOTAVAILABLE_HEADER
                 body = TOOLTIPS.FORTIFICATION_ORDERPROCESS_NOTAVAILABLE_BODY
                 result['toolTipData'] = makeTooltip(header, body)
             if enableActionBtn:
                 orderName = i18n.makeString(
                     FORT.orders_orderpopover_ordertype(
                         self.getOrderUIDbyID(self.__orderID)))
                 result['toolTipData'] = i18n.makeString(
                     TOOLTIPS.FORTIFICATION_POPOVER_PREPAREORDERENABLE,
                     orderName=orderName)
     else:
         result['currentState'] = self.ACTION_STATES.NOT_BASE_NOT_COMMANDER
         result['generalLabel'] = 'unVISIBLE'
         result['actionButtonLbl'] = 'unVISIBLE'
     result[
         'enableActionButton'] = enableActionBtn and not self.__isTutorial
     return result