def getTooltip(self):
     eventType = self._event.getType()
     limits = self._event.getLimits()
     if eventType == _et.NATION:
         nationsList = limits.getNations()
         full = set(NationNames) == set(nationsList)
         nations = ', \n'.join([
             getNationText(value) for value in GUI_NATIONS
             if value in nationsList
         ])
         result = TOOLTIPS.elen_task_eventtype_full(
             eventType) if full else _ms(
                 TOOLTIPS.elen_task_eventtype_notfull(eventType),
                 nations=nations)
     elif eventType == _et.CLASS:
         typeList = limits.getVehiclesClasses()
         full = set(VEHICLE_CLASS_NAME.ALL()) == set(typeList)
         types = ', \n'.join([vehicleTypeText(value) for value in typeList])
         result = TOOLTIPS.elen_task_eventtype_full(
             eventType) if full else _ms(
                 TOOLTIPS.elen_task_eventtype_notfull(eventType),
                 classes=types)
     elif eventType == _et.LEVEL:
         levelList = limits.getVehiclesLevels()
         full = set(LEVELS_RANGE) == set(limits.getVehiclesLevels())
         levels = ', '.join([int2roman(value) for value in levelList])
         result = TOOLTIPS.elen_task_eventtype_full(
             eventType) if full else _ms(
                 TOOLTIPS.elen_task_eventtype_notfull(eventType),
                 levels=levels)
     else:
         result = _ms(TOOLTIPS.elen_task_eventtype_notfull(eventType))
     return makeTooltip(body=result)
Beispiel #2
0
 def __getTitle(self):
     if self.__eventType == _et.NATION:
         return getNationText(self.__value)
     if self.__eventType == _et.VEHICLE:
         items = self.itemsCache.items
         vehicle = items.getItemByCD(self.__value)
         return formatVehicleNameWithTypeIcon(vehicle, 'html_templates:lobby/elen/top')
     if self.__eventType == _et.CLASS:
         return vehicleTypeText(self.__value)
     return _ms(EVENT_BOARDS.VEHICLES_LEVEL, level=int2roman(self.__value)) if self.__eventType == _et.LEVEL else 'ERROR'
def getChainVehTypeAndLevelRestrictions(operation, chainID):
    _eventsCache = dependency.instance(IEventsCache)
    pmCache = _eventsCache.getPersonalMissions()
    minLevel, maxLevel = pmCache.getVehicleLevelRestrictions(operation.getID())
    vehType = _ms(QUESTS.getAddBottomVehType(operation.getChainClassifier(chainID).classificationAttr))
    if operation.getBranch() == PM_BRANCH.PERSONAL_MISSION_2:
        nations = getNationsForChain(operation, chainID)
        nationsText = []
        for nation in GUI_NATIONS:
            if nation in nations:
                nationsText.append(getNationText(nation))

        vehType = _ms(vehType, nations=', '.join(nationsText))
    return (vehType, int2roman(minLevel), int2roman(maxLevel))