Example #1
0
 def getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx, fullPlayerName):
     format = self._findPlayerHTMLFormat(vInfoVO, ctx, self._ui.colorManager)
     unicodeStr, _ = unicode_from_utf8(fullPlayerName)
     if len(unicodeStr) > ctx.labelMaxLength:
         fullPlayerName = '{0}..'.format(normalized_unicode_trim(fullPlayerName, ctx.labelMaxLength - 2))
     fragsString = format % ' '
     if vStatsVO.frags or viStatsVO.equipmentKills:
         fragsString = format % str(vStatsVO.frags + viStatsVO.equipmentKills)
     pName = format % fullPlayerName
     frags = fragsString
     vName = format % vInfoVO.vehicleType.shortName
     scoreFormat = self._getHTMLString('textColorGold', self._ui.colorManager)
     regularFormat = self._getHTMLString('textColorFalloutRegular', self._ui.colorManager)
     highlightedDeaths = viStatsVO.stopRespawn
     deathsFormatStyle = 'textColorFalloutHighlightedDeaths' if highlightedDeaths else 'textColorFalloutRegularDeaths'
     deathsFormat = self._getHTMLString(deathsFormatStyle, self._ui.colorManager)
     scoreString = scoreFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.winPoints)
     if viStatsVO.deathCount > 0:
         deathsString = deathsFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.deathCount)
     else:
         deathsString = deathsFormat % ''
     damageString = regularFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.damageDealt + viStatsVO.equipmentDamage)
     if hasResourcePoints():
         specialPointsString = regularFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.resourceAbsorbed)
     else:
         flagsCaptured = viStatsVO.flagActions[FLAG_ACTION.CAPTURED]
         specialPointsString = regularFormat % BigWorld.wg_getNiceNumberFormat(flagsCaptured)
     return (pName,
      frags,
      vName,
      (scoreString,
       damageString,
       deathsString,
       specialPointsString))
Example #2
0
 def getFormattedStrings(self, vInfoVO, vStatsVO, ctx, fullPlayerName):
     format = self.__findHTMLFormat(vInfoVO, ctx)
     unicodeStr, _ = unicode_from_utf8(fullPlayerName)
     if len(unicodeStr) > ctx.labelMaxLength:
         fullPlayerName = '{0}..'.format(normalized_unicode_trim(fullPlayerName, ctx.labelMaxLength - 2))
     fragsString = format % ' '
     if vStatsVO.frags:
         fragsString = format % str(vStatsVO.frags)
     return (format % fullPlayerName, fragsString, format % vInfoVO.vehicleType.shortName)
Example #3
0
 def getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx,
                         fullPlayerName):
     format = self._findPlayerHTMLFormat(vInfoVO, ctx,
                                         self._ui.colorManager)
     unicodeStr, _ = unicode_from_utf8(fullPlayerName)
     if len(unicodeStr) > ctx.labelMaxLength:
         fullPlayerName = '{0}..'.format(
             normalized_unicode_trim(fullPlayerName,
                                     ctx.labelMaxLength - 2))
     fragsString = format % ' '
     if vStatsVO.frags:
         fragsString = format % str(vStatsVO.frags)
     return (format % fullPlayerName, fragsString,
             format % vInfoVO.vehicleType.shortName, ())
Example #4
0
 def getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx, fullPlayerName):
     padding = makeHtmlString('html_templates:battle', 'multiteamPadding', {})
     format = self._findPlayerHTMLFormat(vInfoVO, ctx, self._ui.colorManager)
     formatWithPadding = format + padding
     unicodeStr, _ = unicode_from_utf8(fullPlayerName)
     maxLabelLength = ctx.labelMaxLength
     isIGR = vInfoVO.player.isIGR()
     if isIGR:
         maxLabelLength = maxLabelLength - 2
     if len(unicodeStr) > maxLabelLength:
         fullPlayerName = '{0}..'.format(normalized_unicode_trim(fullPlayerName, maxLabelLength - 2))
     fragsString = formatWithPadding % ' '
     if vStatsVO.frags or viStatsVO.equipmentKills:
         fragsString = formatWithPadding % str(vStatsVO.frags + viStatsVO.equipmentKills)
     pName = format % fullPlayerName
     frags = fragsString
     vName = formatWithPadding % vInfoVO.vehicleType.shortName
     if isIGR:
         igrType = vInfoVO.player.igrType
         icon = makeHtmlString('html_templates:igr/iconSmall', 'premium' if igrType == IGR_TYPE.PREMIUM else 'basic')
         pName += icon
     pName += padding
     scoreFormat = self._getHTMLString('textColorGold', self._ui.colorManager) + padding
     regularFormat = self._getHTMLString('textColorFalloutRegular', self._ui.colorManager) + padding
     highlightedDeaths = viStatsVO.stopRespawn
     deathsFormatStyle = 'textColorFalloutHighlightedDeaths' if highlightedDeaths else 'textColorFalloutRegularDeaths'
     deathsFormat = self._getHTMLString(deathsFormatStyle, self._ui.colorManager) + padding
     scoreString = scoreFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.winPoints)
     if viStatsVO.deathCount > 0:
         deathsString = deathsFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.deathCount)
     else:
         deathsString = deathsFormat % ''
     damageString = regularFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.damageDealt + viStatsVO.equipmentDamage)
     if hasResourcePoints():
         specialPointsString = regularFormat % BigWorld.wg_getNiceNumberFormat(viStatsVO.resourceAbsorbed)
     else:
         flagsCaptured = viStatsVO.flagActions[FLAG_ACTION.CAPTURED]
         specialPointsString = regularFormat % BigWorld.wg_getNiceNumberFormat(flagsCaptured)
     return (pName,
      frags,
      vName,
      (scoreString,
       damageString,
       deathsString,
       specialPointsString))
Example #5
0
 def getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx,
                         fullPlayerName):
     format = self._findPlayerHTMLFormat(vInfoVO, ctx,
                                         self._ui.colorManager)
     unicodeStr, _ = unicode_from_utf8(fullPlayerName)
     if len(unicodeStr) > ctx.labelMaxLength:
         fullPlayerName = '{0}..'.format(
             normalized_unicode_trim(fullPlayerName,
                                     ctx.labelMaxLength - 2))
     fragsString = format % ' '
     if vStatsVO.frags or viStatsVO.equipmentKills:
         fragsString = format % str(vStatsVO.frags +
                                    viStatsVO.equipmentKills)
     pName = format % fullPlayerName
     frags = fragsString
     vName = format % vInfoVO.vehicleType.shortName
     scoreFormat = self._getHTMLString('textColorGold',
                                       self._ui.colorManager)
     regularFormat = self._getHTMLString('textColorFalloutRegular',
                                         self._ui.colorManager)
     highlightedDeaths = viStatsVO.stopRespawn
     deathsFormatStyle = 'textColorFalloutHighlightedDeaths' if highlightedDeaths else 'textColorFalloutRegularDeaths'
     deathsFormat = self._getHTMLString(deathsFormatStyle,
                                        self._ui.colorManager)
     scoreString = scoreFormat % BigWorld.wg_getNiceNumberFormat(
         viStatsVO.winPoints)
     if viStatsVO.deathCount > 0:
         deathsString = deathsFormat % BigWorld.wg_getNiceNumberFormat(
             viStatsVO.deathCount)
     else:
         deathsString = deathsFormat % ''
     damageString = regularFormat % BigWorld.wg_getNiceNumberFormat(
         viStatsVO.damageDealt + viStatsVO.equipmentDamage)
     if hasResourcePoints():
         specialPointsString = regularFormat % BigWorld.wg_getNiceNumberFormat(
             viStatsVO.resourceAbsorbed)
     else:
         flagsCaptured = viStatsVO.flagActions[FLAG_ACTION.CAPTURED]
         specialPointsString = regularFormat % BigWorld.wg_getNiceNumberFormat(
             flagsCaptured)
     return (pName, frags, vName, (scoreString, damageString, deathsString,
                                   specialPointsString))
Example #6
0
 def filter(self, message, limits):
     truncated = normalized_unicode_trim(message.strip(), limits.getMessageMaxLength())
     return ' '.join(truncated.split())
Example #7
0
 def _trimLongName(self, name, maxLength):
     unicodeStr, _ = unicode_from_utf8(name)
     if len(unicodeStr) > maxLength:
         name = '{0}..'.format(normalized_unicode_trim(name, maxLength - 2))
     return name
Example #8
0
 def filter(self, message, limits):
     truncated = normalized_unicode_trim(message.strip(), limits.getMessageMaxLength())
     return ' '.join(truncated.split())
Example #9
0
 def filter(self, message, isBattle):
     truncated = normalized_unicode_trim(message.strip(), MESSAGE_MAX_LENGTH_IN_BATTLE if isBattle else MESSAGE_MAX_LENGTH)
     return ' '.join(truncated.split())
Example #10
0
 def _trimLongName(self, name, maxLength):
     unicodeStr, _ = unicode_from_utf8(name)
     if len(unicodeStr) > maxLength:
         name = '{0}..'.format(normalized_unicode_trim(name, maxLength - 2))
     return name