def getWinChance(): player = BigWorld.player() vehicles = player.arena.vehicles if player.playerVehicleID not in vehicles: return curVeh = vehicles[player.playerVehicleID] Statistics.getInfos(curVeh['accountDBID']) vehicles[player.playerVehicleID]['team'] ally_balance_weight = 0 enemy_balance_weight = 0 for accountDBID, entityObj in Statistics.getEmo().getAll().iteritems(): vID = g_sessionProvider.getCtx().getVehIDByAccDBID(accountDBID) if vID in vehicles: v_info = vehicles[vID] if v_info['isAlive']: if not BattleUtils.isMyTeam(v_info['team']): enemy_balance_weight += Statistics.getBalanceWeight( v_info, entityObj) else: ally_balance_weight += Statistics.getBalanceWeight( v_info, entityObj) if enemy_balance_weight == 0 or enemy_balance_weight == 0: return f = eval(Statistics.myConf['win_chance_formula']) f = int(round(f * 100)) return max(0, min(f, 100))
def new__getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx, player_name): Statistics.updatePowerBar() tmp = old__getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx, player_name) tmp = list(tmp) if not Statistics.okCw() or not Statistics.myConf['panels_enable']: return tuple(tmp) uid = vInfoVO.player.accountDBID isAlive = vInfoVO.isAlive() cacheId = str(uid) + str(isAlive) if Statistics.cache.has_key('panels') and Statistics.cache['panels'].has_key(cacheId): fullPlayerName_built, shortName_built = Statistics.cache['panels'][cacheId] else: player = BigWorld.player() pr, lang, wr, bt = Statistics.getInfos(uid) tank_name = vInfoVO.vehicleType.shortName clan_name = vInfoVO.player.clanAbbrev player_name = vInfoVO.player.name isCompatriot = Statistics.isMyCompatriot(uid,player); if BattleUtils.isMyTeam(vInfoVO.team): fullPlayerName_template = Statistics.myConf['left'] shortName_template = Statistics.myConf['left_2'] else: fullPlayerName_template = Statistics.myConf['right'] shortName_template = Statistics.myConf['right_2'] formatz= Statistics.getFormat('panels',pr, wr, bt, lang, player_name, tank_name, clan_name, isAlive,isCompatriot) fullPlayerName_built = fullPlayerName_template.format(**formatz) shortName_built = shortName_template.format(**formatz) if not Statistics.cache.has_key('panels'): Statistics.cache['panels'] = {} Statistics.cache['panels'][cacheId] = (fullPlayerName_built, shortName_built) tmp[0] = fullPlayerName_built tmp[2] = shortName_built return tuple(tmp)
def new_makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, userGetter, isSpeaking, isMenuEnabled, regionGetter, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited): tmp = old_makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, userGetter, isSpeaking, isMenuEnabled, regionGetter, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited) if not Statistics.myConf['tab_enable'] or not Statistics.okCw(): return tmp dbID = vInfoVO.player.accountDBID userName = vInfoVO.player.getPlayerLabel() region = regionGetter(dbID) player = BigWorld.player() if region is None: region = '' if tmp['clanAbbrev']: userName +='['+tmp['clanAbbrev']+']'+region pr,lang,wr,bt = Statistics.getInfos(dbID) if BattleUtils.isMyTeam(vInfoVO.team): if Statistics.isMyCompatriot(dbID,player): f = Statistics.myConf['tab_left_c'] else: f =Statistics.myConf['tab_left'] else: if Statistics.isMyCompatriot(dbID,player): f = Statistics.myConf['tab_right_c'] else: f = Statistics.myConf['tab_right'] formatz= Statistics.getFormat('tab',pr, wr, bt, lang, userName) userName = f.format(**formatz) tmp['region'] = '' tmp['userName'] = userName tmp['clanAbbrev'] = '' return tmp
def new__getFormattedStrings(self, vInfoVO, vStatsVO, ctx, fullPlayerName): Statistics.updatePowerBar() if not Statistics.okCw() or not Statistics.myConf['panels_enable']: return old__getFormattedStrings(self, vInfoVO, vStatsVO, ctx, fullPlayerName) player = BigWorld.player() uid = vInfoVO.player.accountDBID pr,lang,wr,bt = Statistics.getInfos(uid) player_name = fullPlayerName tank_name = vInfoVO.vehicleType.shortName fullPlayerName, fragsString, shortName = old__getFormattedStrings(self, vInfoVO, vStatsVO, ctx, fullPlayerName) if BattleUtils.isMyTeam(vInfoVO.team): if Statistics.isMyCompatriot(uid,player): fullPlayerName = Statistics.myConf['left_c'] shortName = Statistics.myConf['left_c_2'] else: fullPlayerName = Statistics.myConf['left'] shortName = Statistics.myConf['left_2'] else: if Statistics.isMyCompatriot(uid,player): fullPlayerName = Statistics.myConf['right_c'] shortName = Statistics.myConf['right_c_2'] else: fullPlayerName = Statistics.myConf['right'] shortName = Statistics.myConf['right_2'] formatz= Statistics.getFormat('panels',pr, wr, bt, lang, player_name, tank_name,vInfoVO.isAlive()) fullPlayerName = fullPlayerName.format(**formatz) shortName = shortName.format(**formatz) return (fullPlayerName, fragsString, shortName)
def new_makeItem(self, vInfoVO, viStatsVO, userGetter, isSpeaking, actionGetter, regionGetter, playerTeam, isEnemy, squadIdx, isFallout=False): tmp = old_makeItem(self, vInfoVO, viStatsVO, userGetter, isSpeaking, actionGetter, regionGetter, playerTeam, isEnemy, squadIdx, isFallout) if Statistics.myConf['battle_loading_enable'] and Statistics.okCw(): pr, lang, wr, bt = Statistics.getInfos(vInfoVO.player.accountDBID) player_name = tmp['playerName'] tank_name = tmp['vehicleName'] region = tmp['region'] clan_name = tmp['clanAbbrev'] if region: player_name += " " + region formatz = Statistics.getFormat('battle_loading', pr, wr, bt, lang, player_name, tank_name, clan_name) if BattleUtils.isMyTeam(vInfoVO.team): playerName_template = Statistics.myConf[ 'battle_loading_string_left'] else: playerName_template = Statistics.myConf[ 'battle_loading_string_right'] playerName_built = playerName_template.format(**formatz) tmp['playerName'] = playerName_built tmp['region'] = '' tmp['clanAbbrev'] = '' return tmp
def getVehicleTypeAmount(self): from Statistics import Statistics player = BigWorld.player() vehicles = player.arena.vehicles if player.playerVehicleID not in vehicles: return curVeh = vehicles[player.playerVehicleID] Statistics.getInfos(curVeh['accountDBID']) vehicles[player.playerVehicleID]['team'] amounts = {VEHICLE_CLASS_NAME.HEAVY_TANK:{'ally':0,'enemy':0}, VEHICLE_CLASS_NAME.MEDIUM_TANK:{'ally':0,'enemy':0}, VEHICLE_CLASS_NAME.LIGHT_TANK:{'ally':0,'enemy':0}, VEHICLE_CLASS_NAME.AT_SPG:{'ally':0,'enemy':0}, VEHICLE_CLASS_NAME.SPG:{'ally':0,'enemy':0}} tiers = [] for accountDBID,entityObj in Statistics.getEmo().getAll().iteritems(): vID = g_sessionProvider.getCtx().getVehIDByAccDBID(accountDBID) if vID in vehicles: v_info = vehicles[vID] tiers.append(v_info['vehicleType'].level) if not BattleUtils.isMyTeam(v_info['team']): tag = 'enemy' else: tag = 'ally' for vehicleType in VEHICLE_TYPES_ORDER: if vehicleType in v_info['vehicleType'].type.tags: amounts[vehicleType][tag] += 1 currentTier = curVeh['vehicleType'].level return (amounts,tiers,currentTier)
def new_makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited, isEnemy): tmp = old_makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited, isEnemy) if not Statistics.myConf['tab_enable'] or not Statistics.okCw(): return tmp dbID = tmp['uid'] player_name = tmp['userName'] tank_name = tmp['vehicle'] region = tmp['region'] clan_name = tmp['clanAbbrev'] if Statistics.cache.has_key('tab') and Statistics.cache['tab'].has_key( dbID): userName_built, vehicle_built = Statistics.cache['tab'][dbID] else: player = BigWorld.player() if region: player_name += ' ' + region pr, lang, wr, bt = Statistics.getInfos(dbID) if BattleUtils.isMyTeam(vInfoVO.team): if Statistics.isMyCompatriot(dbID, player): userName_template = Statistics.myConf['tab_left_c'] vehicle_template = Statistics.myConf['tab_left_c_2'] else: userName_template = Statistics.myConf['tab_left'] vehicle_template = Statistics.myConf['tab_left_2'] else: if Statistics.isMyCompatriot(dbID, player): userName_template = Statistics.myConf['tab_right_c'] vehicle_template = Statistics.myConf['tab_right_c_2'] else: userName_template = Statistics.myConf['tab_right'] vehicle_template = Statistics.myConf['tab_right_2'] formatz = Statistics.getFormat('battle_loading', pr, wr, bt, lang, player_name, tank_name, clan_name) userName_built = userName_template.format(**formatz) vehicle_built = vehicle_template.format(**formatz) if not Statistics.cache.has_key('tab'): Statistics.cache['tab'] = {} Statistics.cache['tab'][dbID] = (userName_built, vehicle_built) tmp['region'] = '' tmp['userName'] = userName_built tmp['vehicle'] = vehicle_built tmp['clanAbbrev'] = '' return tmp
def getVehicleTypeAmount(self): from Statistics import Statistics player = BigWorld.player() vehicles = player.arena.vehicles if player.playerVehicleID not in vehicles: return curVeh = vehicles[player.playerVehicleID] Statistics.getInfos(curVeh['accountDBID']) vehicles[player.playerVehicleID]['team'] amounts = { VEHICLE_CLASS_NAME.HEAVY_TANK: { 'ally': 0, 'enemy': 0 }, VEHICLE_CLASS_NAME.MEDIUM_TANK: { 'ally': 0, 'enemy': 0 }, VEHICLE_CLASS_NAME.LIGHT_TANK: { 'ally': 0, 'enemy': 0 }, VEHICLE_CLASS_NAME.AT_SPG: { 'ally': 0, 'enemy': 0 }, VEHICLE_CLASS_NAME.SPG: { 'ally': 0, 'enemy': 0 } } tiers = [] for accountDBID, entityObj in Statistics.getEmo().getAll().iteritems(): vID = g_sessionProvider.getCtx().getVehIDByAccDBID(accountDBID) if vID in vehicles: v_info = vehicles[vID] tiers.append(v_info['vehicleType'].level) if not BattleUtils.isMyTeam(v_info['team']): tag = 'enemy' else: tag = 'ally' for vehicleType in VEHICLE_TYPES_ORDER: if vehicleType in v_info['vehicleType'].type.tags: amounts[vehicleType][tag] += 1 currentTier = curVeh['vehicleType'].level return (amounts, tiers, currentTier)
def new__getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx, player_name): Statistics.updatePowerBar() tmp = old__getFormattedStrings(self, vInfoVO, vStatsVO, viStatsVO, ctx, player_name) if not Statistics.okCw() or not Statistics.myConf['panels_enable']: return tmp uid = vInfoVO.player.accountDBID if Statistics.cache.has_key( 'panels') and Statistics.cache['panels'].has_key(uid): fullPlayerName_built, shortName_built = Statistics.cache['panels'][ uid] else: player = BigWorld.player() pr, lang, wr, bt = Statistics.getInfos(uid) tank_name = vInfoVO.vehicleType.shortName clan_name = vInfoVO.player.clanAbbrev player_name = vInfoVO.player.name if BattleUtils.isMyTeam(vInfoVO.team): if Statistics.isMyCompatriot(uid, player): fullPlayerName_template = Statistics.myConf['left_c'] shortName_template = Statistics.myConf['left_c_2'] else: fullPlayerName_template = Statistics.myConf['left'] shortName_template = Statistics.myConf['left_2'] else: if Statistics.isMyCompatriot(uid, player): fullPlayerName_template = Statistics.myConf['right_c'] shortName_template = Statistics.myConf['right_c_2'] else: fullPlayerName_template = Statistics.myConf['right'] shortName_template = Statistics.myConf['right_2'] formatz = Statistics.getFormat('panels', pr, wr, bt, lang, player_name, tank_name, clan_name) fullPlayerName_built = fullPlayerName_template.format(**formatz) shortName_built = shortName_template.format(**formatz) if not Statistics.cache.has_key('panels'): Statistics.cache['panels'] = {} Statistics.cache['panels'][uid] = (fullPlayerName_built, shortName_built) tmp[0] = fullPlayerName_built tmp[2] = shortName_built return tmp
def new_makeItem(self, vInfoVO, userGetter, isSpeaking, actionGetter, regionGetter, playerTeam, isEnemy): old_return = old_makeItem(self, vInfoVO, userGetter, isSpeaking, actionGetter, regionGetter, playerTeam,isEnemy) if Statistics.myConf['battle_loading_enable'] and Statistics.okCw(): pr,lang,wr,bt = Statistics.getInfos(vInfoVO.player.accountDBID) userName = old_return['playerName'] region = old_return['region'] clan = old_return['clanAbbrev'] if clan: userName += '['+clan+']' if region: userName += region formatz= Statistics.getFormat('battle_loading',pr, wr, bt, lang, userName) if BattleUtils.isMyTeam(vInfoVO.team): old_return['playerName'] = Statistics.myConf['battle_loading_string_left'].format(**formatz) else: old_return['playerName'] = Statistics.myConf['battle_loading_string_right'].format(**formatz) old_return['region'] = '' old_return['clanAbbrev'] = '' return old_return
def new_makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited, isEnemy): tmp = old_makeHash(self, index, playerFullName, vInfoVO, vStatsVO, viStatsVO, ctx, playerAccountID, inviteSendingProhibited, invitesReceivingProhibited, isEnemy) if not Statistics.myConf['tab_enable'] or not Statistics.okCw(): return tmp dbID = tmp['uid'] player_name = tmp['userName'] tank_name = tmp['vehicle'] region = tmp['region'] clan_name = tmp['clanAbbrev'] if Statistics.cache.has_key('tab') and Statistics.cache['tab'].has_key(dbID): userName_built,vehicle_built = Statistics.cache['tab'][dbID] else: player = BigWorld.player() if region: player_name +=' '+region pr, lang, wr, bt = Statistics.getInfos(dbID) if BattleUtils.isMyTeam(vInfoVO.team): if Statistics.isMyCompatriot(dbID,player): userName_template = Statistics.myConf['tab_left_c'] vehicle_template = Statistics.myConf['tab_left_c_2'] else: userName_template =Statistics.myConf['tab_left'] vehicle_template = Statistics.myConf['tab_left_2'] else: if Statistics.isMyCompatriot(dbID,player): userName_template = Statistics.myConf['tab_right_c'] vehicle_template = Statistics.myConf['tab_right_c_2'] else: userName_template = Statistics.myConf['tab_right'] vehicle_template = Statistics.myConf['tab_right_2'] formatz= Statistics.getFormat('battle_loading',pr, wr, bt, lang, player_name, tank_name, clan_name) userName_built = userName_template.format(**formatz) vehicle_built = vehicle_template.format(**formatz) if not Statistics.cache.has_key('tab'): Statistics.cache['tab'] = {} Statistics.cache['tab'][dbID] = (userName_built,vehicle_built) tmp['region'] = '' tmp['userName'] = userName_built tmp['vehicle'] = vehicle_built tmp['clanAbbrev'] = '' return tmp
def new_makeItem(self, vInfoVO, viStatsVO, userGetter, isSpeaking, actionGetter, regionGetter, playerTeam, isEnemy, squadIdx, isFallout = False): tmp = old_makeItem(self, vInfoVO, viStatsVO, userGetter, isSpeaking, actionGetter, regionGetter, playerTeam, isEnemy, squadIdx, isFallout) if Statistics.myConf['battle_loading_enable'] and Statistics.okCw(): pr, lang, wr, bt = Statistics.getInfos(vInfoVO.player.accountDBID) player_name = tmp['playerName'] tank_name = tmp['vehicleName'] region = tmp['region'] clan_name = tmp['clanAbbrev'] if region: player_name += " "+region formatz= Statistics.getFormat('battle_loading',pr, wr, bt, lang, player_name, tank_name, clan_name) if BattleUtils.isMyTeam(vInfoVO.team): playerName_template = Statistics.myConf['battle_loading_string_left'] else: playerName_template = Statistics.myConf['battle_loading_string_right'] playerName_built = playerName_template.format(**formatz) tmp['playerName'] = playerName_built tmp['region'] = '' tmp['clanAbbrev'] = '' return tmp
def getWinChance(): player = BigWorld.player() vehicles = player.arena.vehicles if player.playerVehicleID not in vehicles: return curVeh = vehicles[player.playerVehicleID] Statistics.getInfos(curVeh['accountDBID']) vehicles[player.playerVehicleID]['team'] ally_balance_weight = 0 enemy_balance_weight = 0 for accountDBID,entityObj in Statistics.getEmo().getAll().iteritems(): vID = g_sessionProvider.getCtx().getVehIDByAccDBID(accountDBID) if vID in vehicles: v_info = vehicles[vID] if v_info['isAlive']: if not BattleUtils.isMyTeam(v_info['team']): enemy_balance_weight += Statistics.getBalanceWeight(v_info,entityObj) else: ally_balance_weight += Statistics.getBalanceWeight(v_info,entityObj) if ally_balance_weight == 0 or enemy_balance_weight == 0: return return max(0, min(100, int(round(ally_balance_weight / enemy_balance_weight * 50))))