def handleActivationHotkey(): if SpotMessanger.isActive: BattleUtils.DebugMsg(SpotMessanger.myConf['DisableSystemMsg'], True) else: BattleUtils.DebugMsg(SpotMessanger.myConf['EnableSystemMsg'], True) SpotMessanger.isActive = not SpotMessanger.isActive
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 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_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__createMarker(self, vProxy): if not Statistics.myConf['marker_enable'] or BattleUtils.isCw(): return old_createMarker(self, vProxy) player = BigWorld.player() #----------- original code ------------------ vInfo = dict(vProxy.publicInfo) battleCtx = g_sessionProvider.getCtx() if battleCtx.isObserver(vProxy.id): return -1 isFriend = vInfo['team'] == player.team vehID = vProxy.id vInfoEx = g_sessionProvider.getArenaDP().getVehicleInfo(vehID) vTypeDescr = vProxy.typeDescriptor maxHealth = vTypeDescr.maxHealth mProv = vProxy.model.node('HP_gui') tags = set(vTypeDescr.type.tags & VEHICLE_CLASS_TAGS) vClass = tags.pop() if len(tags) > 0 else '' entityName = battleCtx.getPlayerEntityName(vehID, vInfoEx.team) entityType = 'ally' if player.team == vInfoEx.team else 'enemy' speaking = False if GUI_SETTINGS.voiceChat: speaking = VoiceChatInterface.g_instance.isPlayerSpeaking(vInfoEx.player.accountDBID) hunting = VehicleActions.isHunting(vInfoEx.events) handle = self._MarkersManager__ownUI.addMarker(mProv, 'VehicleMarkerAlly' if isFriend else 'VehicleMarkerEnemy') self._MarkersManager__markers[handle] = _VehicleMarker(vProxy, self._MarkersManager__ownUIProxy(), handle) fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts(vProxy.id) #----- end ------- PR = '' curVeh = player.arena.vehicles[vProxy.id] if curVeh is not None: curID = curVeh['accountDBID'] pr,lang,wr,bt = Statistics.getInfos(curID) formatz= Statistics.getFormat('marker',pr, wr, bt, lang,pName,vehShortName) PR = Statistics.myConf['marker'].format(**formatz) pName = PR #----------- original code ------------------ self.invokeMarker(handle, 'init', [vClass, vInfoEx.vehicleType.iconPath, vehShortName, vInfoEx.vehicleType.level, fullName, pName, clanAbbrev, regionCode, vProxy.health, maxHealth, entityName.name(), speaking, hunting, entityType, self.isVehicleFlagbearer(vehID)]) return handle
def showSixthSenseIndicator(self, isShow): if isShow and SpotMessanger.isActive: player = BattleUtils.getPlayer() position = MinimapUtils.getOwnPos(player) text = SpotMessanger.myconfig['ImSpotted'] controller = SpotMessanger.getController(player) SpotMessanger.mySendMessage(controller,text.replace("{pos}", position+"")) SpotMessanger.myDoPing(controller,position) SpotMessanger.myCallHelp(controller) return oldShowSixthSenseIndicatorFromSpotMessanger(self,isShow)
def showSixthSenseIndicator(self, isShow): if isShow and SpotMessanger.isActive: player = BattleUtils.getPlayer() position = MinimapUtils.getOwnPos(player) text = SpotMessanger.myConf['ImSpotted'] controller = SpotMessanger.getController(player) SpotMessanger.mySendMessage(controller, text.replace("{pos}", position + "")) SpotMessanger.myDoPing(controller, position) SpotMessanger.myCallHelp(controller) return oldShowSixthSenseIndicatorFromSpotMessanger(self, isShow)
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 getInfos(uid): if BattleUtils.isCw(): curtime = BigWorld.time() if (Statistics.t is None or not Statistics.t.isAlive()) and (Statistics.lastime + Statistics.myConf['delay'] < curtime ): Statistics.t = threading.Thread(target=Statistics.updateStats) Statistics.t.start() Statistics.lastime = curtime else: Statistics.updateStats() wins = '' lang = '' wr = 0 battles = 0 if Statistics.getEmo().existEntity(uid): player = Statistics.getEmo().getEntity(uid) wins = player.getPersonalRating() lang = player.getClientLang() wr = player.getWinRate() battles = player.getBattlesAmount() return (wins,lang,wr,battles)
def getInfos(uid): if BattleUtils.isCw(): curtime = BigWorld.time() if (Statistics.t is None or not Statistics.t.isAlive()) and ( Statistics.lastime + Statistics.myConf['delay'] < curtime): Statistics.t = threading.Thread(target=Statistics.updateStats) Statistics.t.start() Statistics.lastime = curtime else: Statistics.updateStats() wins = '' lang = '' wr = 0 battles = 0 if Statistics.getEmo().existEntity(uid): player = Statistics.getEmo().getEntity(uid) wins = player.getPersonalRating() lang = player.getClientLang() wr = player.getWinRate() battles = player.getBattlesAmount() return (wins, lang, wr, battles)
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))))
def okCw(): return not BattleUtils.isCw() or Statistics.myConf['cw']
def getController(player): #battle type checks battleType = player.arena.guiType controller = None battleTypeName = '' if battleType == constants.ARENA_GUI_TYPE.RANDOM: battleTypeName = 'Random' if SpotMessanger.myconfig['TryPlatoonMes']: if IngameMessanger().hasSquadChannelController(): controller = IngameMessanger().getSquadChannelController() elif SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None else: controller = IngameMessanger().getTeamChannelController() elif SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None else: controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.TRAINING: battleTypeName = 'Training' if SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.COMPANY: battleTypeName = 'Company' if SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.CYBERSPORT: battleTypeName = 'CyberSport' if SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.HISTORICAL: battleTypeName = 'Historical' if SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.SORTIE: battleTypeName = 'Fortifications' if SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: return None controller = IngameMessanger().getTeamChannelController() else: battleTypeName = 'ClanWar' if not SpotMessanger.myconfig['Avoid'+battleTypeName+'Mes']: controller = IngameMessanger().getTeamChannelController() else: return None #vehicle type checks vehicleType = BattleUtils.getVehicleType(BattleUtils.getCurrentVehicleDesc(player)) if vehicleType == VEHICLE_CLASS_NAME.SPG and not SpotMessanger.myconfig['OnSPG']: return None elif vehicleType == VEHICLE_CLASS_NAME.LIGHT_TANK and not SpotMessanger.myconfig['OnLT']: return None elif vehicleType == VEHICLE_CLASS_NAME.MEDIUM_TANK and not SpotMessanger.myconfig['OnMD']: return None elif vehicleType == VEHICLE_CLASS_NAME.HEAVY_TANK and not SpotMessanger.myconfig['OnHT']: return None elif vehicleType == VEHICLE_CLASS_NAME.AT_SPG and not SpotMessanger.myconfig['OnTD']: return None #team amount checks maxTeamAmount = SpotMessanger.myconfig['MaxTeamAmountOn'+battleTypeName] if maxTeamAmount > 0: if maxTeamAmount < BattleUtils.getTeamAmount(player): return None return controller
def getController(player): #battle type checks battleType = player.arena.guiType controller = None battleTypeName = '' if battleType == constants.ARENA_GUI_TYPE.RANDOM: battleTypeName = 'Random' if SpotMessanger.myConf['TryPlatoonMes']: if IngameMessanger().hasSquadChannelController(): controller = IngameMessanger().getSquadChannelController() elif SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None else: controller = IngameMessanger().getTeamChannelController() elif SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None else: controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.TRAINING: battleTypeName = 'Training' if SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.COMPANY: battleTypeName = 'Company' if SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.CYBERSPORT: battleTypeName = 'CyberSport' if SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.HISTORICAL: battleTypeName = 'Historical' if SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None controller = IngameMessanger().getTeamChannelController() elif battleType == constants.ARENA_GUI_TYPE.SORTIE: battleTypeName = 'Fortifications' if SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: return None controller = IngameMessanger().getTeamChannelController() else: battleTypeName = 'ClanWar' if not SpotMessanger.myConf['Avoid' + battleTypeName + 'Mes']: controller = IngameMessanger().getTeamChannelController() else: return None #vehicle type checks vehicleType = BattleUtils.getVehicleType( BattleUtils.getCurrentVehicleDesc(player)) if vehicleType == VEHICLE_CLASS_NAME.SPG and not SpotMessanger.myConf[ 'OnSPG']: return None elif vehicleType == VEHICLE_CLASS_NAME.LIGHT_TANK and not SpotMessanger.myConf[ 'OnLT']: return None elif vehicleType == VEHICLE_CLASS_NAME.MEDIUM_TANK and not SpotMessanger.myConf[ 'OnMD']: return None elif vehicleType == VEHICLE_CLASS_NAME.HEAVY_TANK and not SpotMessanger.myConf[ 'OnHT']: return None elif vehicleType == VEHICLE_CLASS_NAME.AT_SPG and not SpotMessanger.myConf[ 'OnTD']: return None #team amount checks maxTeamAmount = SpotMessanger.myConf['MaxTeamAmountOn' + battleTypeName] if maxTeamAmount > 0: if maxTeamAmount < BattleUtils.getTeamAmount(player): return None return controller
def okCw(): return not BattleUtils.isCw() or Statistics.myConf['cw']
def new_addVehicleMarker(self, vProxy, vInfo, guiProps): if not Statistics.myConf['marker_enable'] or BattleUtils.isCw(): return old_addVehicleMarker(self, vProxy, vInfo, guiProps) #----------- original code ------------------ vTypeDescr = vProxy.typeDescriptor maxHealth = vTypeDescr.maxHealth mProv = vProxy.model.node('HP_gui') isAlly = guiProps.isFriend speaking = False if GUI_SETTINGS.voiceChat: speaking = VoiceChatInterface.g_instance.isPlayerSpeaking(vInfo.player.accountDBID) hunting = VehicleActions.isHunting(vInfo.events) markerID = self._MarkersManager__ownUI.addMarker(mProv, 'VehicleMarkerAlly' if isAlly else 'VehicleMarkerEnemy') self._MarkersManager__markers[vInfo.vehicleID] = _VehicleMarker(markerID, vProxy, self._MarkersManager__ownUIProxy) battleCtx = g_sessionProvider.getCtx() fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts(vProxy.id) vType = vInfo.vehicleType squadIcon = '' if arena_info.getIsMultiteam() and vInfo.isSquadMan(): teamIdx = g_sessionProvider.getArenaDP().getMultiTeamsIndexes()[vInfo.team] squadIconTemplate = '%s%d' if guiProps.name() == 'squadman': squadTeam = 'my' elif isAlly: squadTeam = 'ally' else: squadTeam = 'enemy' squadIcon = squadIconTemplate % (squadTeam, teamIdx) #----- end ------- isAlive = vInfo.isAlive() dbID = vInfo.player.accountDBID cacheId = str(dbID) + str(isAlive) if Statistics.cache.has_key('marker') and Statistics.cache['marker'].has_key(cacheId): pName_built = Statistics.cache['marker'][cacheId] else: pr, lang, wr, bt = Statistics.getInfos(dbID) player_name = pName tank_name = vehShortName clan_name = clanAbbrev isCompatriot = Statistics.isMyCompatriot(dbID,BigWorld.player()); formatz= Statistics.getFormat('marker',pr, wr, bt, lang, player_name, tank_name, clan_name, isAlive, isCompatriot) pName_built = Statistics.myConf['marker'].format(**formatz) if not Statistics.cache.has_key('marker'): Statistics.cache['marker'] = {} Statistics.cache['marker'][cacheId] = pName_built #----------- original code ------------------ self.invokeMarker(markerID, 'init', [vType.classTag, vType.iconPath, vehShortName, vType.level, fullName, pName_built, clanAbbrev, regionCode, vProxy.health, maxHealth, guiProps.name(), speaking, hunting, guiProps.base, g_ctfManager.isFlagBearer(vInfo.vehicleID), squadIcon]) return markerID
def new_addVehicleMarker(self, vProxy, vInfo, guiProps): if not Statistics.myConf['marker_enable'] or BattleUtils.isCw(): return old_addVehicleMarker(self, vProxy, vInfo, guiProps) #----------- original code ------------------ vTypeDescr = vProxy.typeDescriptor maxHealth = vTypeDescr.maxHealth mProv = vProxy.model.node('HP_gui') isAlly = guiProps.isFriend speaking = False if GUI_SETTINGS.voiceChat: speaking = VoiceChatInterface.g_instance.isPlayerSpeaking( vInfo.player.accountDBID) hunting = VehicleActions.isHunting(vInfo.events) markerID = self._MarkersManager__ownUI.addMarker( mProv, 'VehicleMarkerAlly' if isAlly else 'VehicleMarkerEnemy') self._MarkersManager__markers[vInfo.vehicleID] = _VehicleMarker( markerID, vProxy, self._MarkersManager__ownUIProxy) battleCtx = g_sessionProvider.getCtx() fullName, pName, clanAbbrev, regionCode, vehShortName = battleCtx.getFullPlayerNameWithParts( vProxy.id) vType = vInfo.vehicleType squadIcon = '' if arena_info.getIsMultiteam() and vInfo.isSquadMan(): teamIdx = g_sessionProvider.getArenaDP().getMultiTeamsIndexes()[ vInfo.team] squadIconTemplate = '%s%d' if guiProps.name() == 'squadman': squadTeam = 'my' elif isAlly: squadTeam = 'ally' else: squadTeam = 'enemy' squadIcon = squadIconTemplate % (squadTeam, teamIdx) #----- end ------- isAlive = vInfo.isAlive() dbID = vInfo.player.accountDBID cacheId = str(dbID) + str(isAlive) if Statistics.cache.has_key( 'marker') and Statistics.cache['marker'].has_key(cacheId): pName_built = Statistics.cache['marker'][cacheId] else: pr, lang, wr, bt = Statistics.getInfos(dbID) player_name = pName tank_name = vehShortName clan_name = clanAbbrev isCompatriot = Statistics.isMyCompatriot(dbID, BigWorld.player()) formatz = Statistics.getFormat('marker', pr, wr, bt, lang, player_name, tank_name, clan_name, isAlive, isCompatriot) pName_built = Statistics.myConf['marker'].format(**formatz) if not Statistics.cache.has_key('marker'): Statistics.cache['marker'] = {} Statistics.cache['marker'][cacheId] = pName_built #----------- original code ------------------ self.invokeMarker(markerID, 'init', [ vType.classTag, vType.iconPath, vehShortName, vType.level, fullName, pName_built, clanAbbrev, regionCode, vProxy.health, maxHealth, guiProps.name(), speaking, hunting, guiProps.base, g_ctfManager.isFlagBearer(vInfo.vehicleID), squadIcon ]) return markerID