Esempio n. 1
0
 def __makeBoosterSlotVO(self, booster, qBoosterCount):
     boosterCount = qBoosterCount or booster.count
     return {'icon': booster.icon,
      'countText': text_styles.counter(str(boosterCount)),
      'showCount': boosterCount > 1,
      'qualityIconSrc': booster.getQualityIcon(),
      'slotLinkage': BOOSTER_CONSTANTS.SLOT_UI,
      'showLeftTime': False}
def _makeBoosterSlotVO(booster, count):
    return {'boosterId': booster.boosterID,
     'icon': booster.icon,
     'countText': text_styles.counter(getGuiCount(count)),
     'showCount': count > 1,
     'qualityIconSrc': booster.getQualityIcon(),
     'slotLinkage': BOOSTER_CONSTANTS.SLOT_UI,
     'showLeftTime': False}
Esempio n. 3
0
def _makeBoosterSlotVO(booster, count):
    return {'boosterId': booster.boosterID,
     'icon': booster.icon,
     'countText': text_styles.counter(getGuiCount(count)),
     'showCount': count > 1,
     'qualityIconSrc': booster.getQualityIcon(),
     'slotLinkage': BOOSTER_CONSTANTS.SLOT_UI,
     'showLeftTime': False}
Esempio n. 4
0
def _makeBoosterSlotVO(booster, count):
    return {
        "boosterId": booster.boosterID,
        "icon": booster.icon,
        "countText": text_styles.counter(getGuiCount(count)),
        "showCount": count > 1,
        "qualityIconSrc": booster.getQualityIcon(),
        "slotLinkage": BOOSTER_CONSTANTS.SLOT_UI,
        "showLeftTime": False,
    }
Esempio n. 5
0
 def __makeBoosterSlotVO(self, booster, qBoosterCount):
     boosterCount = qBoosterCount or booster.count
     return {
         "boosterId": booster.boosterID,
         "icon": booster.icon,
         "countText": text_styles.counter(str(boosterCount)),
         "showCount": boosterCount > 1,
         "qualityIconSrc": booster.getQualityIcon(),
         "slotLinkage": BOOSTER_CONSTANTS.SLOT_UI,
         "showLeftTime": False,
     }
Esempio n. 6
0
def getOperations(branch, currOperationID):
    _eventsCache = dependency.instance(IEventsCache)
    operations = []
    for oID, o in sorted(_eventsCache.getPersonalMissions().getOperationsForBranch(branch).iteritems(), key=operator.itemgetter(0)):
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
        descr = text_styles.stats(PERSONAL_MISSIONS.OPERATIONS_UNLOCKED_DESC)
        title = text_styles.highTitle(o.getShortUserName())
        if o.isDisabled():
            state, _ = getPostponedOperationState(oID)
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif not o.isUnlocked():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif o.isFullCompleted():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            descr = text_styles.bonusAppliedText(PERSONAL_MISSIONS.OPERATIONS_FULLYCOMPLETED_DESC)
        elif o.isAwardAchieved():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            descr = text_styles.bonusAppliedText(PERSONAL_MISSIONS.OPERATIONS_COMPLETED_DESC)
        elif o.isInProgress():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            descr = text_styles.neutral(PERSONAL_MISSIONS.OPERATIONS_CURRENT_DESC)
        elif not o.hasRequiredVehicles():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        if state != PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE:
            iconStateSource = RES_ICONS.getPersonalMissionOperationState(state)
        else:
            iconStateSource = None
        freeSheetIcon = ''
        freeSheetCounter = ''
        tokensPawned = o.getTokensPawnedCount()
        if tokensPawned:
            freeSheetIcon = AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.X_16, o.getBranch())
            freeSheetCounter = text_styles.counter('x%d' % tokensPawned)
        if state == PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE:
            tooltipAlias = TOOLTIPS_CONSTANTS.OPERATION_POSTPONED
        else:
            tooltipAlias = TOOLTIPS_CONSTANTS.OPERATION
        operationVO = {'title': title,
         'desc': descr,
         'iconSource': RES_ICONS.getPersonalMissionOperationImage(oID),
         'iconStateSource': iconStateSource,
         'freeSheetIconSource': freeSheetIcon,
         'freeSheetCounter': freeSheetCounter,
         'state': state,
         'isSelected': oID == currOperationID,
         'id': oID,
         'tooltipAlias': tooltipAlias}
        operations.append(operationVO)

    return operations
def getOperations(currOperationID):
    operations = []
    for oID, o in sorted(events_helpers.getPersonalMissionsCache().
                         getOperations().iteritems(),
                         key=operator.itemgetter(0)):
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
        descr = text_styles.stats(PERSONAL_MISSIONS.OPERATIONS_UNLOCKED_DESC)
        title = text_styles.highTitle(o.getShortUserName())
        if not o.isUnlocked():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif o.isFullCompleted():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            descr = text_styles.bonusAppliedText(
                PERSONAL_MISSIONS.OPERATIONS_FULLYCOMPLETED_DESC)
        elif o.isAwardAchieved():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            descr = text_styles.bonusAppliedText(
                PERSONAL_MISSIONS.OPERATIONS_COMPLETED_DESC)
        elif o.isInProgress():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            descr = text_styles.neutral(
                PERSONAL_MISSIONS.OPERATIONS_CURRENT_DESC)
        elif not o.hasRequiredVehicles():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        if state != PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE:
            iconStateSource = RES_ICONS.getPersonalMissionOperationState(state)
        else:
            iconStateSource = None
        freeSheetIcon = ''
        freeSheetCounter = ''
        tokensPawned = o.getTokensPawnedCount()
        if tokensPawned:
            freeSheetIcon = RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL
            freeSheetCounter = text_styles.counter('x%d' % tokensPawned)
        operationVO = {
            'title': title,
            'desc': descr,
            'iconSource': RES_ICONS.getPersonalMissionOperationImage(oID),
            'iconStateSource': iconStateSource,
            'freeSheetIconSource': freeSheetIcon,
            'freeSheetCounter': freeSheetCounter,
            'state': state,
            'isSelected': oID == currOperationID,
            'id': oID
        }
        operations.append(operationVO)

    return operations
def _packNotRecruitedTankman(recruitInfo):
    expiryTime = recruitInfo.getExpiryTime()
    recruitBeforeStr = _ms(MENU.BARRACKS_NOTRECRUITEDACTIVATEBEFORE,
                           date=expiryTime) if expiryTime else ''
    availableRoles = recruitInfo.getRoles()
    roleType = availableRoles[0] if len(availableRoles) == 1 else ''
    result = {
        'firstName': i18n.convert(recruitInfo.getFirstName()),
        'lastName': i18n.convert(recruitInfo.getLastName()),
        'rank': recruitBeforeStr,
        'specializationLevel': recruitInfo.getRoleLevel(),
        'role': text_styles.counter(recruitInfo.getLabel()),
        'vehicleType': '',
        'iconFile': recruitInfo.getBarracksIcon(),
        'roleIconFile':
        Tankman.getRoleBigIconPath(roleType) if roleType else '',
        'rankIconFile': '',
        'contourIconFile': '',
        'tankmanID': -1,
        'nationID': -1,
        'typeID': -1,
        'roleType': roleType,
        'tankType': '',
        'inTank': False,
        'compact': '',
        'lastSkillLevel': recruitInfo.getLastSkillLevel(),
        'actionBtnEnabled': True,
        'inCurrentTank': False,
        'vehicleID': None,
        'slot': None,
        'locked': False,
        'lockMessage': '',
        'isInSelfVehicleClass': True,
        'isInSelfVehicleType': True,
        'notRecruited': True,
        'isRankNameVisible': True,
        'recoveryPeriodText': None,
        'actionBtnLabel': MENU.BARRACKS_BTNRECRUITNOTRECRUITED,
        'actionBtnTooltip': TOOLTIPS.BARRACKS_TANKMEN_RECRUIT,
        'skills': [],
        'isSkillsVisible': False,
        'recruitID': str(recruitInfo.getRecruitID())
    }
    return result
Esempio n. 9
0
 def __packLeagueAwardsRow(self, cohortData):
     cohortNumber = cohortData['cohortNumber']
     icon = RES_ICONS.getRankedLeagueCohortIcon(cohortNumber)
     if cohortNumber > 0:
         count = '{}%'.format(cohortData['playersPercent'])
         if cohortNumber == 1:
             description = _ms(
                 RANKED_BATTLES.RANKEDBATTLESCYCLESVIEW_FINAL_FIRST,
                 count=count)
         else:
             description = _ms(
                 RANKED_BATTLES.RANKEDBATTLESCYCLESVIEW_FINAL_INTERMEDIATE,
                 count=count)
     else:
         description = _ms(
             RANKED_BATTLES.RANKEDBATTLESCYCLESVIEW_FINAL_LAST)
     result = {
         'icon': icon,
         'iconDescr': _ts.counter(description),
         'awards': cohortData['awards']
     }
     if cohortNumber == 0:
         result['noLeagueText'] = _ts.main(
             RANKED_BATTLES.RANKEDBATTLESCYCLESVIEW_FINAL_LASTCOMMENT)
     if self.__leagueDataReceived and self.__leagueData is not None:
         if self.__leagueData['league'] == cohortNumber:
             result.update({
                 'highlighted':
                 True,
                 'ladderBtn':
                 _ms(RANKED_BATTLES.RANKEDBATTLESCYCLESVIEW_FINAL_BTNLADDER
                     ),
                 'ladderBtnTooltip':
                 makeTooltip(
                     RANKED_BATTLES.
                     RANKEDBATTLESCYCLESVIEW_FINAL_BTNLADDERTOOLTIP_HEADER,
                     RANKED_BATTLES.
                     RANKEDBATTLESCYCLESVIEW_FINAL_BTNLADDERTOOLTIP_BODY)
             })
     return result