def DetailedStatisticsUtils_getStatistics(base, targetData, isCurrentuser): res = base(targetData, isCurrentuser) global _lastVehId if _lastVehId is not None and token.networkServicesSettings['statAwards']: try: battles = targetData.getBattlesCount() dmg = targetData.getDamageDealt() frg = targetData.getFragsCount() ref = vehinfo_xte.getReferenceValues(_lastVehId) if ref is None: ref = {} data = -1 #log('b:{} d:{} f:{}'.format(battles, dmg, frg)) if battles > 0 and dmg > 0 and frg > 0: ref['currentD'] = float(dmg) / battles ref['currentF'] = float(frg) / battles xte = vehinfo_xte.calculateXTE(_lastVehId, float(dmg) / battles, float(frg) / battles) if xte > 0: color = utils.getDynamicColorValue(constants.DYNAMIC_VALUE_TYPE.X, xte) xteStr = 'XX' if xte == 100 else ('0' if xte < 10 else '') + str(xte) data = '<font color="{0}">{1}</font>'.format(color, xteStr) #log("xte={} color={}".format(xteStr, color)) del res[0]['data'][4] res[0]['data'].insert(0, { 'label': 'xTE', 'data': data, 'tooltip': 'xvm_xte', 'tooltipData': {'body': ref, 'header': {}, 'note': None}}) except: err(traceback.format_exc()) return res
def DetailedStatisticsUtils_getStatistics(base, targetData, isCurrentuser, layout): res = base(targetData, isCurrentuser, layout) global _lastVehCD if _lastVehCD is not None and config.networkServicesSettings.statAwards: try: battles = targetData.getBattlesCount() dmg = targetData.getDamageDealt() frg = targetData.getFragsCount() # remove empty lines if res[0]['data'][4] is None: del res[0]['data'][4] #if res[1]['data'][1] is None: # del res[1]['data'][1] #if res[1]['data'][4] is None: # del res[1]['data'][4] # xTE ref = vehinfo_xte.getReferenceValues(_lastVehCD) if ref is None: ref = {} data = -1 #log('vehCD: {} b:{} d:{} f:{}'.format(_lastVehCD, battles, dmg, frg)) if battles > 0 and dmg >= 0 and frg >= 0: ref['currentD'] = float(dmg) / battles ref['currentF'] = float(frg) / battles x = vehinfo_xte.calculateXTE(_lastVehCD, float(dmg) / battles, float(frg) / battles) ref['xte'] = x ref['xte_sup'] = xvm_scale.XvmScaleToSup(x) if x >= 0: color = utils.getDynamicColorValue(consts.DYNAMIC_VALUE_TYPE.X, x) xStr = 'XX' if x == 100 else ('0' if x < 10 else '') + str(x) data = '<font color="#{}" size="12">({} {}%)</font> <font color="{}">{}</font>'.format( XFWCOLORS.UICOLOR_LABEL, l10n('better than'), ref['xte_sup'], color, xStr) #log("xte={} color={}".format(xStr, color)) res[0]['data'].insert(0, { 'label': 'xTE', 'data': data, 'tooltip': 'xvm_xte', 'tooltipData': {'body': ref, 'header': {}, 'note': None}}) # xTDB item = res[1]['data'][2] if battles > 0 and dmg >= 0: x = vehinfo_xtdb.calculateXTDB(_lastVehCD, float(dmg) / battles) sup = xvm_scale.XvmScaleToSup(x) if x >= 0: color = utils.getDynamicColorValue(consts.DYNAMIC_VALUE_TYPE.X, x) item['data'] = '<font color="#{}" size="12">({} {}%)</font> <font color="{}">{}</font>'.format( XFWCOLORS.UICOLOR_LABEL, l10n('better than'), sup, color, item['data']) except: err(traceback.format_exc()) return res
def DetailedStatisticsUtils_getStatistics(base, targetData, isCurrentuser, layout): res = base(targetData, isCurrentuser, layout) global _lastVehCD if _lastVehCD is not None and config.networkServicesSettings.statAwards: try: battles = targetData.getBattlesCount() dmg = targetData.getDamageDealt() frg = targetData.getFragsCount() # remove empty lines if res[0]['data'][4] is None: del res[0]['data'][4] #if res[1]['data'][1] is None: # del res[1]['data'][1] #if res[1]['data'][4] is None: # del res[1]['data'][4] # xTE ref = vehinfo_xte.getReferenceValues(_lastVehCD) if ref is None: ref = {} data = -1 #log('vehCD: {} b:{} d:{} f:{}'.format(_lastVehCD, battles, dmg, frg)) if battles > 0 and dmg >= 0 and frg >= 0: ref['currentD'] = float(dmg) / battles ref['currentF'] = float(frg) / battles x = vehinfo_xte.calculateXTE(_lastVehCD, float(dmg) / battles, float(frg) / battles) ref['xte'] = x ref['xte_sup'] = xvm_scale.XvmScaleToSup(x) if x >= 0: color = utils.getDynamicColorValue( consts.DYNAMIC_VALUE_TYPE.X, x) xStr = 'XX' if x == 100 else ( '0' if x < 10 else '') + str(x) data = '<font color="#{}" size="12">({} {}%)</font> <font color="{}">{}</font>'.format( XFWCOLORS.UICOLOR_LABEL, l10n('better than'), ref['xte_sup'], color, xStr) #log("xte={} color={}".format(xStr, color)) res[0]['data'].insert( 0, { 'label': 'xTE', 'data': data, 'tooltip': 'xvm_xte', 'tooltipData': { 'body': ref, 'header': {}, 'note': None } }) # xTDB item = res[1]['data'][2] if battles > 0 and dmg >= 0: x = vehinfo_xtdb.calculateXTDB(_lastVehCD, float(dmg) / battles) sup = xvm_scale.XvmScaleToSup(x) if x >= 0: color = utils.getDynamicColorValue( consts.DYNAMIC_VALUE_TYPE.X, x) item[ 'data'] = '<font color="#{}" size="12">({} {}%)</font> <font color="{}">{}</font>'.format( XFWCOLORS.UICOLOR_LABEL, l10n('better than'), sup, color, item['data']) except: err(traceback.format_exc()) return res