Exemple #1
0
    def __update(self):
        freeSheetsQuests = []
        pawnedSheets = 0
        for oID, o in sorted(events_helpers.getPersonalMissionsCache().getOperations().iteritems(), key=operator.itemgetter(0)):
            if o.isUnlocked():
                operationName = _ms(PERSONAL_MISSIONS.OPERATIONTITLE_TITLE, title=o.getShortUserName())
                idx = 1
                for vehicleType in VEHICLE_TYPES_ORDER:
                    _, quests = o.getChainByVehicleType(vehicleType)
                    for quest in sorted(quests.itervalues(), key=lambda q: q.getID()):
                        if quest.areTokensPawned():
                            freeSheetsQuests.append({'taskId': str(quest.getID()),
                             'taskText': text_styles.standard(operationName),
                             'descrText': text_styles.main(quest.getUserName()),
                             'animDelay': self.__ANIMATION_DELAY * idx if self.__playAnimation else -1})
                            idx += 1
                            pawnedSheets += quest.getPawnCost()

        freeSheets = events_helpers.getPersonalMissionsCache().getFreeTokensCount()
        if pawnedSheets == 0:
            pawnedSheetsDescrText = PERSONAL_MISSIONS.FREESHEETPOPOVER_PAWNEDSHEETSINFO_DESCR_NOONE
        else:
            pawnedSheetsDescrText = PERSONAL_MISSIONS.FREESHEETPOPOVER_PAWNEDSHEETSINFO_DESCR
        self.as_setDataS({'titleText': text_styles.highTitle(PERSONAL_MISSIONS.FREESHEETPOPOVER_TITLE),
         'freeSheetsInfo': {'imgSource': RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_FREE_SHEET_SMALL,
                            'titleText': text_styles.middleTitle(_ms(PERSONAL_MISSIONS.FREESHEETPOPOVER_FREESHEETSINFO_TITLE, count=freeSheets)),
                            'descrText': text_styles.standard(PERSONAL_MISSIONS.FREESHEETPOPOVER_FREESHEETSINFO_DESCR)},
         'pawnedSheetsInfo': {'imgSource': RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_PAWNED_SHEET,
                              'titleText': text_styles.middleTitle(_ms(PERSONAL_MISSIONS.FREESHEETPOPOVER_PAWNEDSHEETSINFO_TITLE, count=pawnedSheets)),
                              'descrText': text_styles.standard(pawnedSheetsDescrText)},
         'hasPawnedSheets': pawnedSheets > 0})
        if pawnedSheets > 0:
            self.as_setListDataProviderS(freeSheetsQuests)
Exemple #2
0
 def _declineMission(self, eventID):
     result = yield events_helpers.getPersonalMissionsRefuseProcessor()(
         events_helpers.getPersonalMissionsCache().getQuests()[int(
             eventID)],
         events_helpers.getPersonalMissionsCache()).request()
     if result.userMsg:
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Exemple #3
0
 def _processMission(self, eventID):
     quest = events_helpers.getPersonalMissionsCache().getQuests()[int(
         eventID)]
     result = yield events_helpers.getPersonalMissionsSelectProcessor()(
         quest, events_helpers.getPersonalMissionsCache()).request()
     if result and result.userMsg:
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Exemple #4
0
    def __update(self):
        operations = []
        blinkDelay = BLINK_DELAY
        selectedOperation = -1
        areAllOperationsPassed = True
        sortedOperations = sorted(events_helpers.getPersonalMissionsCache().getOperations().iteritems(), key=operator.itemgetter(0))
        for oID, o in sortedOperations:
            title = text_styles.main(o.getShortUserName())
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
            isAwardAchieved = o.isAwardAchieved()
            if o.isUnlocked() and not isAwardAchieved:
                selectedOperation = oID
            if not isAwardAchieved:
                areAllOperationsPassed = False
            if o.isFullCompleted():
                state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            elif isAwardAchieved:
                state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            elif o.isInProgress():
                state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            operationVO = {'title': title,
             'id': oID,
             'state': state,
             'showDelay': blinkDelay}
            blinkDelay += BLINK_DELAY_STEP
            operations.append(operationVO)

        self.as_setDataS({'operationTitle': {'title': text_styles.promoTitle(PERSONAL_MISSIONS.OPERATIONINFO_TITLE)},
         'operations': operations,
         'selectedOperation': selectedOperation,
         'areAllOperationsPassed': areAllOperationsPassed})
        self.soundManager.setRTPC(SOUNDS.RTCP_MISSIONS_ZOOM, SOUNDS.MAX_MISSIONS_ZOOM)
        self.soundManager.setRTPC(SOUNDS.RTCP_DEBRIS_CONTROL, SOUNDS.MAX_MISSIONS_ZOOM)
    def __update(self):
        tankwomenQuests = []
        for _, o in sorted(events_helpers.getPersonalMissionsCache().
                           getOperations().iteritems(),
                           key=operator.itemgetter(0)):
            if o.isUnlocked():
                operationName = _ms('#personal_missions:operations/title%d' %
                                    o.getID())
                for vehicleType in VEHICLE_TYPES_ORDER:
                    _, quests = o.getChainByVehicleType(vehicleType)
                    for _, q in sorted(quests.iteritems(),
                                       key=operator.itemgetter(0)):
                        tankman, isMainBonus = q.getTankmanBonus()
                        needToGetTankman = q.needToGetAddReward(
                        ) and not isMainBonus or q.needToGetMainReward(
                        ) and isMainBonus
                        if needToGetTankman and tankman is not None:
                            tankwomenQuests.append({
                                'id':
                                str(q.getID()),
                                'operationLabel':
                                text_styles.standard(operationName),
                                'missionLabel':
                                text_styles.main(q.getShortUserName()),
                                'recruitBtnLabel':
                                PERSONAL_MISSIONS.
                                PERSONALMISSIONS_TANKGIRLSPOPOVER_RECRUITBTN
                            })

        self.as_setListDataProviderS(tankwomenQuests)
        return
 def _getMissionAward(self, eventID):
     quest = events_helpers.getPersonalMissionsCache().getQuests()[int(
         eventID)]
     if quest.needToGetReward():
         result = yield events_helpers.getPersonalMissionAward(quest)
         if result and result.userMsg:
             SystemMessages.pushMessage(result.userMsg,
                                        type=result.sysMsgType)
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 _packBlocks(self, *args, **kwargs):
     eventID = args[0]
     quest = events_helpers.getPersonalMissionsCache().getQuests()[int(
         eventID)]
     description = '\n\n'.join(
         [quest.getUserDescription(),
          quest.getUserAdvice()])
     blocks = [
         formatters.packTextBlockData(
             text_styles.concatStylesToMultiLine(
                 text_styles.highTitle(
                     PERSONAL_MISSIONS.DETAILEDVIEW_INFOPANEL_HEADER),
                 text_styles.main(description)))
     ]
     return blocks
Exemple #9
0
 def __getUnlockedStatusFields(self):
     quest = self.event
     operations = events_helpers.getPersonalMissionsCache().getOperations()
     operationID = quest.getOperationID()
     operation = operations.get(operationID)
     if not operation.isUnlocked():
         prevOperationID = max(operationID - 1, 0)
         prevOperation = operations.get(prevOperationID)
         statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVOPERATION_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVOPERATION_BODY)}
         statusLabel = text_styles.error(icons.markerBlocked() + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYPREVOPERATION, prevCampaign=prevOperation.getShortUserName()))
     else:
         statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVMISSIONS_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVMISSIONS_BODY)}
         statusLabel = text_styles.error(icons.markerBlocked() + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYPREVMISSIONS))
     return {'addBottomStatusText': statusLabel,
      'status': MISSIONS_STATES.NOT_AVAILABLE,
      'bottomStatusTooltipData': statusTooltipData}
 def buildItem(self, tileID):
     return events_helpers.getPersonalMissionsCache().getOperations().get(
         tileID)