예제 #1
0
 def _getDescription2(self):
     info = self._excelItem.getInfo()
     timeValue = info.getBattleTs()
     date = formatTimeAndDate(timeValue)
     inSquad = info.getIsInSquad()
     squadInfo = _ms(
         EVENT_BOARDS.SUMMARY_FIGHTINSQUAAD) if inSquad else _ms(
             EVENT_BOARDS.SUMMARY_FIGHTNOTINSQUAAD)
     result = _ms(EVENT_BOARDS.summary_result(info.getBattleResult()))
     return '{}. {} {}'.format(result, squadInfo, date)
예제 #2
0
    def _getTableData(self):
        data = []
        items = self.itemsCache.items
        params = self.__getSortedParams()
        infos = self._excelItem.getInfo()
        infos = sorted(infos, key=lambda info: info.getBattleTs())
        for info in infos:
            vehicleCd = info.getVehicleCd()
            vehicle = items.getItemByCD(vehicleCd)
            timeValue = info.getBattleTs()
            date = formatTimeAndDate(timeValue)
            methodType = info.getMethodType()
            if methodType != _cm.SUMMSEQN or methodType == _cm.SUMMSEQN and info.getUsedInCalculations(
            ):
                isEnable = True
                iconAlpha = ICON_ALPHA_USED_IN_CALCULATION
                date = text_styles.main(date)
                technicsName = text_styles.main(vehicle.shortUserName)
                result = text_styles.main(
                    EVENT_BOARDS.summary_result(info.getBattleResult()))
                platoonIcon = RES_ICONS.MAPS_ICONS_EVENTBOARDS_BATTLE_TYPE_PLATOON
            else:
                isEnable = False
                iconAlpha = ICON_ALPHA_NOT_USED_IN_CALCULATION
                date = text_styles.disabled(date)
                technicsName = text_styles.disabled(vehicle.shortUserName)
                result = text_styles.disabled(
                    EVENT_BOARDS.summary_result(info.getBattleResult()))
                platoonIcon = RES_ICONS.MAPS_ICONS_EVENTBOARDS_BATTLE_TYPE_PLATOON_DARK
            icon = platoonIcon if info.getIsInSquad() else None
            technics = formatVehicleNationAndTypeIcon(
                vehicle, 'html_templates:lobby/elen/summary')
            player = {
                'icon': icon,
                'date': date,
                'technics': technics,
                'vehicle': vehicle.iconSmall,
                'technicsName': technicsName,
                'result': result,
                'value1': str(_getParameterValue(params[0], info)),
                'value2': str(_getParameterValue(params[1], info)),
                'value3': str(_getParameterValue(params[2], info)),
                'value4': str(info.getFrags()),
                'rendererLinkage':
                EVENTBOARDS_ALIASES.BASE_PLAYER_BATTLE_RENDERER,
                'isEnable': isEnable,
                'iconAlpha': iconAlpha
            }
            data.append(player)

        return {'tableDP': data}
 def getParticipateInfo(self):
     event = self._event
     playerData = self._playerData
     started = event.isStarted()
     isRegistrationFinished = event.isRegistrationFinished()
     participateTooltip = None
     buttonTooltip = None
     participate = ''
     buttonLabel = ''
     title = ''
     titleTooltip = ''
     isButton = False
     isButtonRegistration = not self._joined and self._canJoin and not isRegistrationFinished
     isButtonEnabled = True
     isButtonRegistrationEnabled = True
     dateTs = event.getParticipantsFreezeDeadlineTs()
     date = formatTimeAndDate(dateTs)
     if event.isFinished():
         return {}
     else:
         if started:
             buttonRegistrationLabel = EVENT_BOARDS.EXCEL_PARTICIPATE_JOIN
             buttonRegistrationTooltip = makeTooltip(
                 TOOLTIPS.ELEN_BUTTON_REGISTRATION_STARTED_HEADER,
                 TOOLTIPS.ELEN_BUTTON_REGISTRATION_STARTED_BODY)
         else:
             buttonRegistrationLabel = EVENT_BOARDS.TABLE_SELECTREGISTRATIONBTN
             buttonRegistrationTooltip = makeTooltip(
                 TOOLTIPS.ELEN_BUTTON_REGISTRATION_NOTSTARTED_HEADER,
                 TOOLTIPS.ELEN_BUTTON_REGISTRATION_NOTSTARTED_BODY)
         if self._joined:
             isButton = True
             buttonLabel = EVENT_BOARDS.HEADER_PARTICIPATE_BUTTON_LEAVE
             if isRegistrationFinished:
                 participate = formatOkTextWithIcon(
                     EVENT_BOARDS.HEADER_PARTICIPATE_STARTED)
                 participateTooltip = makeTooltip(
                     EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION,
                     TOOLTIPS.
                     ELEN_BUTTON_HEADER_PARTICIPATE_CANTLEAVE_HEADER)
                 buttonTooltip = makeTooltip(
                     TOOLTIPS.ELEN_BUTTON_HEADER_PARTICIPATE_LEAVE_HEADER,
                     _ms(TOOLTIPS.
                         ELEN_BUTTON_HEADER_PARTICIPATE_CANTLEAVE_BODY,
                         date=date))
                 isButtonEnabled = False
                 isButtonRegistrationEnabled = False
             elif started:
                 participate = formatOkTextWithIcon(
                     EVENT_BOARDS.HEADER_PARTICIPATE_STARTED)
                 participateTooltip = makeTooltip(
                     TOOLTIPS.ELEN_HEADER_PARTICIPATE_STARTED_HEADER,
                     TOOLTIPS.ELEN_HEADER_PARTICIPATE_STARTED_BODY)
                 buttonTooltip = makeTooltip(
                     TOOLTIPS.ELEN_BUTTON_HEADER_PARTICIPATE_LEAVE_HEADER,
                     _ms(TOOLTIPS.ELEN_BUTTON_HEADER_PARTICIPATE_LEAVE_BODY,
                         date=date))
             else:
                 participate = formatOkTextWithIcon(
                     EVENT_BOARDS.HEADER_PARTICIPATE_NOTSTARTED)
                 participateTooltip = makeTooltip(
                     TOOLTIPS.ELEN_HEADER_PARTICIPATE_NOTSTARTED_HEADER,
                     TOOLTIPS.ELEN_HEADER_PARTICIPATE_NOTSTARTED_BODY)
                 buttonTooltip = makeTooltip(
                     TOOLTIPS.
                     ELEN_HEADER_PARTICIPATE_BUTTON_LEAVENOTSTARTED_HEADER,
                     _ms(TOOLTIPS.
                         ELEN_HEADER_PARTICIPATE_BUTTON_LEAVENOTSTARTED_BODY,
                         date=date))
         elif isRegistrationFinished:
             participate = formatErrorTextWithIcon(
                 EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION)
             participateTooltip = makeTooltip(
                 EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION,
                 EVENT_BOARDS.STATUS_CANTJOIN_REASON_ENDREGISTRATION_TOOLTIP
             )
             isButtonEnabled = False
             isButtonRegistrationEnabled = False
         elif not self._canJoin:
             if self._stateReasons:
                 title, titleTooltip, isButtonRegistration = makeCantJoinReasonTextVO(
                     event, playerData)
                 if _psr.SPECIALACCOUNT in self._stateReasons or _psr.WASUNREGISTERED in self._stateReasons:
                     title = ''
                     titleTooltip = None
                 elif _psr.WASUNREGISTERED in self._stateReasons:
                     participateTooltip = makeTooltip(
                         EVENT_BOARDS.STATUS_CANTJOIN_REASON_LEFTEVENT,
                         EVENT_BOARDS.
                         STATUS_CANTJOIN_REASON_LEFTEVENT_TOOLTIP)
                 isButtonRegistrationEnabled = False
                 reasonText = self._cantJoinReason[self._stateReasons[0]]
                 participate = formatErrorTextWithIcon(reasonText)
         result = {
             'participate': participate,
             'participateTooltip': participateTooltip,
             'buttonLabel': buttonLabel,
             'buttonTooltip': buttonTooltip,
             'isButton': isButton,
             'isButtonEnabled': isButtonEnabled,
             'eventID': event.getEventID(),
             'title': title,
             'isButtonRegistration': isButtonRegistration,
             'isButtonRegistrationEnabled': isButtonRegistrationEnabled,
             'titleTooltip': titleTooltip,
             'buttonRegistrationTooltip': buttonRegistrationTooltip,
             'buttonRegistrationLabel': buttonRegistrationLabel
         }
         return result