bool IsWon(string player) { foreach (PlayerParticipantStatsSummary p in stats.TeamPlayerParticipantStats) { if (p.SummonerName == player) { RawStatDTO raw = GetRawStat("WIN", p); if (raw != null) { return(raw.Value == 1); } } } foreach (PlayerParticipantStatsSummary p in stats.OtherTeamPlayerParticipantStats) { if (p.SummonerName == player) { RawStatDTO raw = GetRawStat("WIN", p); if (raw != null) { return(raw.Value == 1); } } } return(false); }
bool IsWon(int teamid) { if (teamid == 100) { RawStatDTO raw = null; if (stats.TeamPlayerParticipantStats.Count > 0) { raw = GetRawStat("WIN", stats.TeamPlayerParticipantStats[0]); } if (raw == null) { if (stats.OtherTeamPlayerParticipantStats.Count > 0) { raw = GetRawStat("WIN", stats.OtherTeamPlayerParticipantStats[0]); } if (raw != null) { return(raw.Value != 1); } else { return(false); // default } } else { return(raw.Value == 1); } } else { RawStatDTO raw = null; if (stats.OtherTeamPlayerParticipantStats.Count > 0) { raw = GetRawStat("WIN", stats.OtherTeamPlayerParticipantStats[0]); } if (raw != null) { return(raw.Value == 1); } else { return(false); // default } } }
string GetRawStatString(string name, PlayerParticipantStatsSummary p, string type = "normal") { RawStatDTO dt = GetRawStat(name, p); if (dt == null) { return("-"); } else if (type == "gold") { return(GoldToString(dt.Value)); } else if (type == "time") { TimeSpan ts = new TimeSpan(0, 0, (int)dt.Value); return(string.Format("{0:0}:{1:00}", ts.Minutes, ts.Seconds)); } else { return(dt.Value.ToString("N0")); } }
//TODO: Clean this up public void SimulateEndOfGame() { EndOfGameStats fakeStats = new EndOfGameStats(); fakeStats.TalentPointsGained = 0; fakeStats.Ranked = false; fakeStats.LeveledUp = false; fakeStats.SkinIndex = 6001; fakeStats.QueueBonusEarned = 14; fakeStats.GameType = "MATCHED_GAME"; fakeStats.ExperienceEarned = 0; fakeStats.ImbalancedTeamsNoPoints = false; fakeStats.BasePoints = 32; fakeStats.ReportGameId = 22036662; fakeStats.Difficulty = null; fakeStats.GameLength = 1411; fakeStats.BoostXpEarned = 0; fakeStats.Invalid = false; fakeStats.OtherTeamInfo = null; fakeStats.RoomName = "endGame22036662"; fakeStats.CustomMinutesLeftToday = 120; fakeStats.UserId = 200006292; fakeStats.CoOpVsAiMinutesLeftToday = 180; fakeStats.LoyaltyBoostIpEarned = 0; fakeStats.RpEarned = 0; fakeStats.CompletionBonusPoints = 0; fakeStats.CoOpVsAiMsecsUntilReset = 0; fakeStats.BoostIpEarned = 0; fakeStats.ExperienceTotal = 23; fakeStats.GameId = 125432223; fakeStats.TimeUntilNextFirstWinBonus = 0; fakeStats.LoyaltyBoostXpEarned = 0; fakeStats.RoomPassword = "******"; fakeStats.Elo = 0; fakeStats.IpEarned = 0; fakeStats.FirstWinBonus = 0; fakeStats.SendStatsToTournamentProvider = false; fakeStats.EloChange = 0; fakeStats.GameMode = "ARAM"; fakeStats.QueueType = "ARAM_UNRANKED_5x5"; fakeStats.OdinBonusIp = 0; fakeStats.IpTotal = 295513; fakeStats.CustomMsecsUntilReset = -1; fakeStats.TeamPlayerParticipantStats = new List <PlayerParticipantStatsSummary>(); fakeStats.OtherTeamPlayerParticipantStats = new List <PlayerParticipantStatsSummary>(); for (int i = 0; i < 10; i++) { PlayerParticipantStatsSummary fakePlayer = new PlayerParticipantStatsSummary(); fakePlayer.SkinName = "Urgot"; fakePlayer.GameId = 22035552; fakePlayer.ProfileIconId = 550; fakePlayer.Elo = 0; fakePlayer.Leaver = false; fakePlayer.Leaves = 3; fakePlayer.TeamId = 200; fakePlayer.EloChange = 0; fakePlayer.Level = 30; fakePlayer.BotPlayer = false; fakePlayer.UserId = 331458; fakePlayer.Spell2Id = 4; fakePlayer.Spell1Id = 21; fakePlayer.Losses = 59; fakePlayer.SummonerName = "Snowl"; fakePlayer.Wins = 64; fakePlayer.Statistics = new List <RawStatDTO>(); RawStatDTO Item0 = new RawStatDTO(); Item0.StatTypeName = "ITEM0"; Item0.Value = 3181; fakePlayer.Statistics.Add(Item0); RawStatDTO Item1 = new RawStatDTO(); Item1.StatTypeName = "ITEM1"; Item1.Value = 3046; fakePlayer.Statistics.Add(Item1); RawStatDTO Item2 = new RawStatDTO(); Item2.StatTypeName = "ITEM2"; Item2.Value = 3006; fakePlayer.Statistics.Add(Item2); RawStatDTO Item3 = new RawStatDTO(); Item3.StatTypeName = "ITEM3"; Item3.Value = 3031; fakePlayer.Statistics.Add(Item3); RawStatDTO Item4 = new RawStatDTO(); Item4.StatTypeName = "ITEM4"; Item4.Value = 1055; fakePlayer.Statistics.Add(Item4); RawStatDTO Item5 = new RawStatDTO(); Item5.StatTypeName = "ITEM5"; Item5.Value = 1036; fakePlayer.Statistics.Add(Item5); RawStatDTO Item6 = new RawStatDTO(); Item6.StatTypeName = "ITEM6"; Item6.Value = 0; fakePlayer.Statistics.Add(Item6); RawStatDTO GOLDEARNED = new RawStatDTO(); GOLDEARNED.StatTypeName = "GOLD_EARNED"; GOLDEARNED.Value = 11736; fakePlayer.Statistics.Add(GOLDEARNED); RawStatDTO Assists = new RawStatDTO(); Assists.StatTypeName = "ASSISTS"; Assists.Value = 23; RawStatDTO NUMDEATHS = new RawStatDTO(); NUMDEATHS.StatTypeName = "NUM_DEATHS"; NUMDEATHS.Value = 0; fakePlayer.Statistics.Add(NUMDEATHS); RawStatDTO LEVEL = new RawStatDTO(); LEVEL.StatTypeName = "LEVEL"; LEVEL.Value = 17; fakePlayer.Statistics.Add(LEVEL); RawStatDTO CHAMPIONSKILLED = new RawStatDTO(); CHAMPIONSKILLED.StatTypeName = "CHAMPIONS_KILLED"; CHAMPIONSKILLED.Value = 99; fakePlayer.Statistics.Add(CHAMPIONSKILLED); RawStatDTO MinionsKILLED = new RawStatDTO(); MinionsKILLED.StatTypeName = "MINIONS_KILLED"; MinionsKILLED.Value = 60; fakePlayer.Statistics.Add(MinionsKILLED); RawStatDTO WIN = new RawStatDTO(); WIN.StatTypeName = "WIN"; WIN.Value = 1; fakePlayer.Statistics.Add(WIN); if (i < 5) { fakeStats.OtherTeamPlayerParticipantStats.Add(fakePlayer); } else { fakeStats.TeamPlayerParticipantStats.Add(fakePlayer); } } MessageReceived(fakeStats); }
public void LoadPlayer(PlayerParticipantStatsSummary p, string name, string champion, ref TeamStats ts) { double k, d, a; RawStatDTO rd = GetRawStat("LEVEL", p); if (rd != null) { this.summoner.Text = rd.Value.ToString() + ". " + name; } else { this.summoner.Text = name; } k = GetRawStat("CHAMPIONS_KILLED", p).Value; d = GetRawStat("NUM_DEATHS", p).Value; a = GetRawStat("ASSISTS", p).Value; ts.Kill += (int)k; ts.Deaths += (int)d; ts.Assists += (int)a; KDAlb.Text = k.ToString() + " / " + d.ToString() + " / " + a.ToString(); champplayed = champion; if (File.Exists(Application.StartupPath + @"\Champions\" + champion + ".png")) { this.Champion.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Champions\" + champion + ".png"); } else { this.Champion.BackgroundImage = Ghostblade.Properties.Resources.Unknown; } this.Spell1.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Spells\" + p.Spell1Id.ToString() + ".png"); this.Spell2.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Spells\" + p.Spell2Id.ToString() + ".png"); SetItem(item1, (int)GetRawStat("ITEM0", p).Value); SetItem(item2, (int)GetRawStat("ITEM1", p).Value); SetItem(item3, (int)GetRawStat("ITEM2", p).Value); SetItem(item4, (int)GetRawStat("ITEM3", p).Value); SetItem(item5, (int)GetRawStat("ITEM4", p).Value); SetItem(item6, (int)GetRawStat("ITEM5", p).Value); SetItem(item7, (int)GetRawStat("ITEM6", p).Value); // Gold rd = GetRawStat("GOLD_EARNED", p); if (rd != null) { this.goldlb.Text = GoldToString(rd.Value); } else { this.goldlb.Text = "$ 0"; } // Creeps int totalfarm = 0; rd = GetRawStat("MINIONS_KILLED", p); if (rd != null) { totalfarm += (int)rd.Value; this.creepslb.Text = rd.Value.ToString(); ts.CREEPS += (int)rd.Value; } else { this.creepslb.Text = "0"; } rd = GetRawStat("NEUTRAL_MINIONS_KILLED", p); if (rd != null) { ts.CREEPS += (int)rd.Value; totalfarm += (int)rd.Value; this.creepslb.Text = totalfarm.ToString(); } // Ward placed rd = GetRawStat("WARD_PLACED", p); if (rd != null) { this.wardplacedlb.Text = rd.Value.ToString(); ts.WP += (int)rd.Value; } else { this.wardplacedlb.Text = "0"; } // Ward killed rd = GetRawStat("WARD_KILLED", p); if (rd != null) { this.wardkilledlb.Text = rd.Value.ToString(); ts.WD += (int)rd.Value; } else { this.wardkilledlb.Text = "0"; } // Turrets destoryed rd = GetRawStat("TURRETS_KILLED", p); if (rd != null) { this.Turretdestlb.Text = rd.Value.ToString(); ts.TD += (int)rd.Value; } else { this.Turretdestlb.Text = "0"; } // Dmg taken rd = GetRawStat("TOTAL_DAMAGE_TAKEN", p); if (rd != null) { this.dmgtakenlb.Text = DmgToString(rd.Value); } else { this.dmgtakenlb.Text = "0"; } // Dmg dealt rd = GetRawStat("TOTAL_DAMAGE_DEALT", p); if (rd != null) { this.dmgdealtlb.Text = DmgToString(rd.Value); } else { this.dmgdealtlb.Text = "0"; } // Largest Killing spree double lks = 0; rd = GetRawStat("LARGEST_KILLING_SPREE", p); if (rd != null) { lks = rd.Value; } else { lks = 0; } // Largest Multi Kill double lmk = 0; rd = GetRawStat("LARGEST_MULTI_KILL", p); if (rd != null) { lmk = rd.Value; } else { lmk = 0; } lmkslb.Text = lmk.ToString() + " | " + lks.ToString(); this.Refresh(); }