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 ''
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)) ]
def getFractionalFormat(cls, value): return backport.getFractionalFormat(value)
def _getValue(self, value): return backport.getFractionalFormat(float(value))
def getFractionalFormatIfNoEmpty(value): return backport.getFractionalFormat(value) if value else markValueAsEmpty( value)
def _convert(self, value, reusable): converted = backport.getFractionalFormat(value / 1000.0) if not value: converted = markValueAsEmpty(converted) return converted
def makeAOGASFactorValue(value): formatted = ''.join( (i18n.makeString(BATTLE_RESULTS.COMMON_XPMULTIPLIERSIGN), backport.getFractionalFormat(value))) formatted = markValueAsError(formatted) return formatted