public MapStatsBox(string Map) { // Read all lines from the txt file and store each line as a string in a list string[] lines = File.ReadAllLines(System.IO.Path.GetFullPath(@"..\..\TextFiles\MapInfos\") + Map + "Info.txt"); InitializeComponent(); // Create a new character stats model and assign info to its members statsModel = new MapStats() { Name = Map, PortraitImage = new BitmapImage(new Uri(System.IO.Path.GetFullPath(@"..\..\Images\Maps\MapPortraits\") + Map + ".jpg")), Type = lines[0], Location = lines[1], Terrain = lines[2], }; // Set the data context to our character statistics model this.DataContext = statsModel; }
public Match(string id, Matches.Attribute att, Matches.Relationship rel, List <Included> inc) { Type = "Match"; Id = id; CreatedAt = att.CreatedAt; Duration = att.Duration; GameMode = att.GameMode; PatchVersion = att.PatchVersion; ShardId = att.ShardId; TitleId = att.TitleId; Stats = new MapStats(att.Stats.MapID, att.Stats.Type); var participants = new List <Participant>(); foreach (var included in inc) { if (included.Type.ToLower().Contains("participant")) { participants.Add(new Participant(included)); } } foreach (var asset in rel.Assets.Data) { var a = inc.Find(x => x.Id == asset.Id); Assets.Add(new Asset(a)); } foreach (var roster in rel.Rosters.Data) { var r = inc.Find(x => x.Id == roster.Id); Rosters.Add(new Roster(r, participants)); } foreach (var rounds in rel.Rounds.Data) { var r = inc.Find(x => x.Id == rounds.Id); Rounds.Add(new Round(r, Rosters)); } foreach (var spectator in rel.Spectators.Data) { var s = inc.Find(x => x.Id == spectator.Id); Spectators.Add(new Participant(s)); } }
public MapEntity(String newpath, HexCoord newPos, Stats entityStats, Map m, bool friendly) { _path = newpath; mstats = new MapStats(entityStats); map = m; _idx = map.mapEntities.Count; gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load(baseDirectory + path)); gameObject.transform.parent = map.transform; gameObject.renderer.sortingLayerName = "AboveMap"; gameObject.name = _path + map.mapEntities.Count; gameObject.transform.GetChild(0).gameObject.GetComponent <Animator>().SetBool("friendly", friendly); gameObject.GetComponent <UnitNetwork>().mapEntity = this; MoveTo(newPos); if (Network.isServer) { NetworkViewID newid = Network.AllocateViewID(); NetworkView network = gameObject.GetComponent <NetworkView>(); network.RPC("SetID", RPCMode.AllBuffered, newid); } }
private async Task LoadDatas() { IsBusy = true; NotificationMessage = "Loading..."; MapStats datas = await _demosService.GetMapStatsAsync(); Dust2PieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.Dust2WinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.Dust2LossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.Dust2DrawCount } }; InfernoPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.InfernoWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.InfernoLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.InfernoDrawCount } }; MiragePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.MirageWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.MirageLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.MirageDrawCount } }; NukePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.NukeWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.NukeLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.NukeDrawCount } }; TrainPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.TrainWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.TrainLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.TrainDrawCount } }; OverpassPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.OverpassWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.OverpassLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.OverpassDrawCount } }; CachePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.CacheWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.CacheLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.CacheDrawCount } }; CobblestonePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Win", Value = datas.CobblestoneWinCount }, new GenericDoubleChart { Label = "Loss", Value = datas.CobblestoneLossCount }, new GenericDoubleChart { Label = "Draw", Value = datas.CobblestoneDrawCount } }; Dust2PercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Dust2", Value = (float)datas.Dust2WinPercentage } }; MiragePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Mirage", Value = (float)datas.MirageWinPercentage } }; InfernoPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Inferno", Value = (float)datas.InfernoWinPercentage } }; NukePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Nuke", Value = (float)datas.NukeWinPercentage } }; OverpassPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Overpass", Value = (float)datas.OverpassWinPercentage } }; CobblestonePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Cobblestone", Value = (float)datas.CobblestoneWinPercentage } }; CachePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Cache", Value = (float)datas.CacheWinPercentage } }; TrainPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Train", Value = (float)datas.TrainWinPercentage } }; IsBusy = false; }
private async Task LoadDatas() { IsBusy = true; Notification = Properties.Resources.NotificationLoading; List <Demo> demos = await _cacheService.GetFilteredDemoListAsync(); MapStats datas = await _accountStatsService.GetMapStatsAsync(demos); Dust2PieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.Dust2WinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.Dust2LossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.Dust2DrawCount } }; InfernoPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.InfernoWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.InfernoLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.InfernoDrawCount } }; MiragePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.MirageWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.MirageLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.MirageDrawCount } }; NukePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.NukeWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.NukeLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.NukeDrawCount } }; TrainPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.TrainWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.TrainLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.TrainDrawCount } }; OverpassPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.OverpassWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.OverpassLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.OverpassDrawCount } }; CachePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.CacheWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.CacheLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.CacheDrawCount } }; CobblestonePieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.CobblestoneWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.CobblestoneLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.CobblestoneDrawCount } }; VertigoPieDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = Properties.Resources.Win, Value = datas.VertigoWinCount }, new GenericDoubleChart { Label = Properties.Resources.Loss, Value = datas.VertigoLossCount }, new GenericDoubleChart { Label = Properties.Resources.Draw, Value = datas.VertigoDrawCount } }; Dust2PercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Dust2", Value = (float)datas.Dust2WinPercentage } }; MiragePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Mirage", Value = (float)datas.MirageWinPercentage } }; InfernoPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Inferno", Value = (float)datas.InfernoWinPercentage } }; NukePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Nuke", Value = (float)datas.NukeWinPercentage } }; OverpassPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Overpass", Value = (float)datas.OverpassWinPercentage } }; CobblestonePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Cobblestone", Value = (float)datas.CobblestoneWinPercentage } }; VertigoPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Vertigo", Value = (float)datas.VertigoWinPercentage } }; CachePercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Cache", Value = (float)datas.CacheWinPercentage } }; TrainPercentDatas = new List <GenericDoubleChart> { new GenericDoubleChart { Label = "Train", Value = (float)datas.TrainWinPercentage } }; IsBusy = false; }
public async Task <MapStats> GetMapStatsAsync() { MapStats stats = new MapStats(); List <Demo> demos = await _cacheService.GetDemoListAsync(); if (demos.Any()) { List <Demo> demosPlayerList = demos.Where(demo => demo.Players.FirstOrDefault(p => p.SteamId == Settings.Default.SelectedStatsAccountSteamID) != null).ToList(); if (demosPlayerList.Any()) { stats.Dust2WinCount = demosPlayerList.Count(d => d.MapName == "de_dust2" && d.MatchVerdictSelectedAccountCount == 1); stats.Dust2LossCount = demosPlayerList.Count(d => d.MapName == "de_dust2" && d.MatchVerdictSelectedAccountCount == -1); stats.Dust2DrawCount = demosPlayerList.Count(d => d.MapName == "de_dust2" && d.MatchVerdictSelectedAccountCount == 0); int matchCount = stats.Dust2WinCount + stats.Dust2LossCount + stats.Dust2DrawCount; if (matchCount > 0) { stats.Dust2WinPercentage = Math.Round((stats.Dust2WinCount / (double)matchCount * 100), 2); } stats.MirageWinCount = demosPlayerList.Count(d => d.MapName == "de_mirage" && d.MatchVerdictSelectedAccountCount == 1); stats.MirageLossCount = demosPlayerList.Count(d => d.MapName == "de_mirage" && d.MatchVerdictSelectedAccountCount == -1); stats.MirageDrawCount = demosPlayerList.Count(d => d.MapName == "de_mirage" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.MirageWinCount + stats.MirageLossCount + stats.MirageDrawCount; if (matchCount > 0) { stats.MirageWinPercentage = Math.Round((stats.MirageWinCount / (double)matchCount * 100), 2); } stats.InfernoWinCount = demosPlayerList.Count(d => d.MapName == "de_inferno" && d.MatchVerdictSelectedAccountCount == 1); stats.InfernoLossCount = demosPlayerList.Count(d => d.MapName == "de_inferno" && d.MatchVerdictSelectedAccountCount == -1); stats.InfernoDrawCount = demosPlayerList.Count(d => d.MapName == "de_inferno" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.InfernoWinCount + stats.InfernoLossCount + stats.InfernoDrawCount; if (matchCount > 0) { stats.InfernoWinPercentage = Math.Round((stats.InfernoWinCount / (double)matchCount * 100), 2); } stats.TrainWinCount = demosPlayerList.Count(d => d.MapName == "de_train" && d.MatchVerdictSelectedAccountCount == 1); stats.TrainLossCount = demosPlayerList.Count(d => d.MapName == "de_train" && d.MatchVerdictSelectedAccountCount == -1); stats.TrainDrawCount = demosPlayerList.Count(d => d.MapName == "de_train" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.TrainWinCount + stats.TrainLossCount + stats.TrainDrawCount; if (matchCount > 0) { stats.TrainWinPercentage = Math.Round((stats.TrainWinCount / (double)matchCount * 100), 2); } stats.OverpassWinCount = demosPlayerList.Count(d => d.MapName == "de_overpass" && d.MatchVerdictSelectedAccountCount == 1); stats.OverpassLossCount = demosPlayerList.Count(d => d.MapName == "de_overpass" && d.MatchVerdictSelectedAccountCount == -1); stats.OverpassDrawCount = demosPlayerList.Count(d => d.MapName == "de_overpass" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.OverpassWinCount + stats.OverpassLossCount + stats.OverpassDrawCount; if (matchCount > 0) { stats.OverpassWinPercentage = Math.Round((stats.OverpassWinCount / (double)matchCount * 100), 2); } stats.CacheWinCount = demosPlayerList.Count(d => d.MapName == "de_cache" && d.MatchVerdictSelectedAccountCount == 1); stats.CacheLossCount = demosPlayerList.Count(d => d.MapName == "de_cache" && d.MatchVerdictSelectedAccountCount == -1); stats.CacheDrawCount = demosPlayerList.Count(d => d.MapName == "de_cache" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.CacheWinCount + stats.CacheLossCount + stats.CacheDrawCount; if (matchCount > 0) { stats.CacheWinPercentage = Math.Round((stats.CacheWinCount / (double)matchCount * 100), 2); } stats.CobblestoneWinCount = demosPlayerList.Count(d => d.MapName == "de_cbble" && d.MatchVerdictSelectedAccountCount == 1); stats.CobblestoneLossCount = demosPlayerList.Count(d => d.MapName == "de_cbble" && d.MatchVerdictSelectedAccountCount == -1); stats.CobblestoneDrawCount = demosPlayerList.Count(d => d.MapName == "de_cbble" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.CobblestoneWinCount + stats.CobblestoneLossCount + stats.CobblestoneDrawCount; if (matchCount > 0) { stats.CobblestoneWinPercentage = Math.Round((stats.CobblestoneWinCount / (double)matchCount * 100), 2); } stats.NukeWinCount = demosPlayerList.Count(d => d.MapName == "de_nuke" && d.MatchVerdictSelectedAccountCount == 1); stats.NukeLossCount = demosPlayerList.Count(d => d.MapName == "de_nuke" && d.MatchVerdictSelectedAccountCount == -1); stats.NukeDrawCount = demosPlayerList.Count(d => d.MapName == "de_nuke" && d.MatchVerdictSelectedAccountCount == 0); matchCount = stats.NukeWinCount + stats.NukeLossCount + stats.NukeDrawCount; if (matchCount > 0) { stats.NukeWinPercentage = Math.Round((stats.NukeWinCount / (double)matchCount * 100), 2); } } } return(stats); }
public async Task Add(CommandContext ctx, [Description("Player ID")][RemainingText] string playerId) { if (string.IsNullOrEmpty(playerId)) { await ctx.Channel.SendMessageAsync("Error finding user! Make sure to include the tag (eg. Valorant#123)").ConfigureAwait(false); return; } string playerTag = playerId.Replace('#', '-'); HttpClient client = _httpClientFactory.CreateClient(); HttpResponseMessage response = await client.GetAsync($"https://hackathon.devsite.in/api/player/{playerTag.ToLower()}"); if (!response.IsSuccessStatusCode) { await ctx.Channel.SendMessageAsync("Error finding user! Make sure to include the tag (eg. Valorant#123)").ConfigureAwait(false); return; } JsonSerializerOptions options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, }; Player player = JsonSerializer.Deserialize <Player>(await response.Content.ReadAsStringAsync(), options); AgentStats bestAgent = player.LifetimeStats.AgentStats.OrderByDescending(agent => agent.Kills).First(); WeaponStats bestWeapon = player.LifetimeStats.WeaponStats.OrderByDescending(weapon => weapon.Kills).First(); MapStats bestMap = player.LifetimeStats.MapStats.OrderByDescending(map => map.RoundsWon).First(); AggregatedWeaponStats aggregatedWeaponStats = player.LifetimeStats.WeaponStats .Aggregate(new AggregatedWeaponStats(), (aggregated, current) => { aggregated.TotalDamage += current.Damage; aggregated.TotalHeadshots += current.Headshots; aggregated.TotalBodyshots += current.Bodyshots; aggregated.TotalLegshots += current.Legshots; return(aggregated); }); AggregatedMapStats aggregatedMapStats = player.LifetimeStats.MapStats .Aggregate(new AggregatedMapStats(), (aggregated, current) => { aggregated.TotalMatches += current.Matches; aggregated.TotalRoundsPlayed += current.RoundsPlayed; aggregated.TotalRoundsWonOnAttack += current.AttackingWon; aggregated.TotalRoundsWonOnDefence += current.DefendingWon; return(aggregated); }); int totalKills = player.LifetimeStats.Kills; int totalDeaths = player.LifetimeStats.Deaths; int roundsPlayed = player.LifetimeStats.RoundsPlayed; int roundsWon = player.LifetimeStats.RoundsWon; int roundsLost = roundsPlayed - roundsWon; double roundRatio = (double)roundsWon / roundsLost; double killDeathRatio = (double)totalKills / (double)totalDeaths; DiscordEmbedBuilder embed = new DiscordEmbedBuilder() { Title = player.Name, Color = DiscordColor.DarkRed, ThumbnailUrl = player.RankImage }; embed.AddField("**General Info**", @$ "**Current Rank**: {player.Rank} **Top Agent**: {bestAgent.AgentName.CapitalizeFirstLetter()} **Top Weapon**: {bestWeapon.WeaponName.CapitalizeFirstLetter()} **Top Map**: {bestMap.MapName.CapitalizeFirstLetter()}", inline: true); embed.AddField("Kill / Death", @$ "**Kills**: {totalKills} **Deaths**: {totalDeaths} **K/D**: {killDeathRatio:F2} **Assists**: {player.LifetimeStats.Assists}", inline: true); var embed2 = new DiscordEmbedBuilder() { Color = DiscordColor.DarkRed, Footer = new DiscordEmbedBuilder.EmbedFooter() { Text = "Visit our GitHub! https://github.com/cshivers/Hackathon", IconUrl = "https://cdn.discordapp.com/attachments/732928999839367249/733638171547402250/valorant.png" } }; string agentPlayedNumbers = string.Join("\n", player.LifetimeStats.AgentStats.Select(agent => $"**{agent.AgentName}**: {agent.Kills}/{agent.Deaths}/{agent.Assists}")); embed2.AddField("**Agent K/D/A**", agentPlayedNumbers, inline: true); embed2.AddField("**Weapon Stats**", @$ "**Damage**: {aggregatedWeaponStats.TotalDamage} **Headshots**: {aggregatedWeaponStats.TotalHeadshots} **Bodyshots**: {aggregatedWeaponStats.TotalBodyshots} **Legshots**: {aggregatedWeaponStats.TotalLegshots}", inline: true); embed2.AddField("**Map Stats**", @$ "**Matches Played**: {aggregatedMapStats.TotalMatches} **Rounds Played**: {aggregatedMapStats.TotalRoundsPlayed} **Attacking Won**: {aggregatedMapStats.TotalRoundsWonOnAttack} **Defending Won**: {aggregatedMapStats.TotalRoundsWonOnDefence}", inline: true); await ctx.Channel.SendMessageAsync(embed : embed.Build()).ConfigureAwait(false); await ctx.Channel.SendMessageAsync(embed : embed2.Build()).ConfigureAwait(false); }
public int SACC(MapStats other) { return(SSPD - other.SSPD); }
public int MACC(MapStats other) { return(MSPD - other.MSPD); }
public int PACC(MapStats other) { return(PSPD - other.PSPD); }
void Start() { mapStats = GameObject.FindObjectOfType<MapStats> (); mapStats.battleContainer = this.gameObject; StartCoroutine(mapStats.WaitToKill ()); }