Пример #1
0
def precisionFormat(value, showIntegerOnly=False):
    if showIntegerOnly:
        if abs(value) >= 1:
            return backport.getIntegralFormat(value)
        return ''
    if abs(value) >= 10:
        return backport.getFractionalFormat(value)
    return '%.*f' % (_INFOTIP_PRECISION, value) if abs(value) >= 10 ** (-_INFOTIP_PRECISION) else ''
Пример #2
0
 def setRecord(self, result, _):
     count = result.stunNum
     assisted = result.damageAssistedStun
     duration = result.stunDuration
     self.stunNum = count
     self.stunDuration = duration
     if count > 0 or assisted > 0 or duration > 0:
         self._isEmpty = False
         self.stunValues = [
             backport.getIntegralFormat(assisted),
             backport.getIntegralFormat(count),
             backport.getFractionalFormat(duration)
         ]
         self.stunNames = [
             i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_STUN_PART1,
                             vals=style.getTooltipParamsStyle()),
             i18n.makeString(BATTLE_RESULTS.COMMON_TOOLTIP_STUN_PART2),
             i18n.makeString(
                 BATTLE_RESULTS.COMMON_TOOLTIP_STUN_PART3,
                 vals=style.getTooltipParamsStyle(
                     BATTLE_RESULTS.COMMON_TOOLTIP_PARAMS_VAL_SECONDS))
         ]
Пример #3
0
 def getFractionalFormat(cls, value):
     return backport.getFractionalFormat(value)
Пример #4
0
 def _getValue(self, value):
     return backport.getFractionalFormat(float(value))
Пример #5
0
def getFractionalFormatIfNoEmpty(value):
    return backport.getFractionalFormat(value) if value else markValueAsEmpty(
        value)
Пример #6
0
 def _convert(self, value, reusable):
     converted = backport.getFractionalFormat(value / 1000.0)
     if not value:
         converted = markValueAsEmpty(converted)
     return converted
Пример #7
0
def makeAOGASFactorValue(value):
    formatted = ''.join(
        (i18n.makeString(BATTLE_RESULTS.COMMON_XPMULTIPLIERSIGN),
         backport.getFractionalFormat(value)))
    formatted = markValueAsError(formatted)
    return formatted