string FindParticipant(int cid, int tid)
        {
            string champion = CurrentGame.GetChampion(cid);

            if (tid == 100)
            {
                foreach (PlayerParticipantStatsSummary p in EOG.TeamPlayerParticipantStats)
                {
                    if (p.SkinName == champion)
                    {
                        return(p.SummonerName);
                    }
                }

                return(champion + " in Blue Team");
            }
            else
            {
                foreach (PlayerParticipantStatsSummary p in EOG.OtherTeamPlayerParticipantStats)
                {
                    if (p.SkinName == champion)
                    {
                        return(p.SummonerName);
                    }
                }

                return(champion + " in Blue Team");
            }
        }
Ejemplo n.º 2
0
 private void Champion_Click(object sender, EventArgs e)
 {
     Program.MainFormInstance.ShowChampInfo(CurrentGame.GetChampionID(CurrentChampion));
 }
Ejemplo n.º 3
0
        public ReplayPanel(GhostReplay replay)
            : base(replay.Flags)
        {
            try
            {
                rep   = replay;
                IsPBE = (rep.Platform == "PBE1");
                InitializeComponent();
                metroLabel1.Text = replay.RecordDate.ToShortDateString() + " " + replay.RecordDate.ToShortTimeString();
                stats            = replay.GameStats;

                if (stats != null)
                {
                    bluewins = IsWon(100);
                    string dur = string.Format("{0:0}:{1:00}", rep.GameLength.Minutes, rep.GameLength.Seconds);
                    if (rep.SummonerName != "")
                    {
                        if (IsWon(rep.SummonerName))
                        {
                            GameWon    = true;
                            maplb.Text = stats.GameMode + "  - " + dur + " - Win";
                        }
                        else
                        {
                            GameWon     = false;
                            maplb.Text  = stats.GameMode + "  - " + dur + " - Loss";
                            maplb.Style = MetroColorStyle.Red;
                        }
                    }
                    else
                    {
                        GameWon = false;
                        if (IsWon(100))
                        {
                            maplb.Text = stats.GameMode + "  - " + dur + " - Blue Team Wins";
                        }
                        else
                        {
                            maplb.Text = stats.GameMode + "  - " + dur + " - Red Team Wins";
                        }
                    }
                    if (replay.SummonerName != null)
                    {
                        champion = FindSkinName(replay.SummonerName);
                        if (champion != null)
                        {
                            Replaylb.Text = replay.SummonerName + " - " + champion;
                            cid           = CurrentGame.GetChampionID(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;
                            }
                        }
                        else
                        {
                            Replaylb.Text = replay.SummonerName;
                        }
                    }
                    else
                    {
                        champion = FindSkinName(Program.MainFormInstance.SelectedAccount.SummonerName);
                        if (champion != null)
                        {
                            Replaylb.Text = Program.MainFormInstance.SelectedAccount.SummonerName + " - " + champion;
                            cid           = CurrentGame.GetChampionID(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;
                            }
                        }
                        else
                        {
                            Replaylb.Text = "Unknown";
                        }
                    }
                }
                gameidlb.Text = replay.MetaData.gameKey.gameId.ToString();
                if (replay.Platform == "PBE1" && SettingsManager.Settings.HasPBE)
                {
                    versionlb.Style = MetroColorStyle.Orange;
                    VersionResult vr = RiotTool.Instance.CompareVersions(SettingsManager.Settings.PbeVersion, rep.GameVersion);

                    if (vr == VersionResult.OUTDATED)
                    {
                        versionlb.Style = MetroColorStyle.Red;
                    }
                    else if (vr == VersionResult.PREDATED)
                    {
                        versionlb.Style = MetroColorStyle.Blue;
                    }
                    else if (vr == VersionResult.OK)
                    {
                        versionlb.Style = MetroColorStyle.Green;
                    }
                }
                else
                {
                    versionlb.Style = MetroColorStyle.Orange;
                    VersionResult vr = RiotTool.Instance.CompareVersions(SettingsManager.Settings.GameVersion, rep.GameVersion);

                    if (vr == VersionResult.OUTDATED)
                    {
                        versionlb.Style = MetroColorStyle.Red;
                    }
                    else if (vr == VersionResult.PREDATED)
                    {
                        versionlb.Style = MetroColorStyle.Blue;
                    }
                    else if (vr == VersionResult.OK)
                    {
                        versionlb.Style = MetroColorStyle.Green;
                    }
                }

                versionlb.Text = replay.GameVersion;

                if ((rep.Flags & ReplayInfo.BaronReplays) == ReplayInfo.BaronReplays)
                {
                    Replaylb.Text += " - [BR]";
                }
                else if ((rep.Flags & ReplayInfo.LolReplay) == ReplayInfo.LolReplay)
                {
                    Replaylb.Text += " - [LR]";
                }
                else if ((rep.Flags & ReplayInfo.UnknownRecorder) == ReplayInfo.UnknownRecorder)
                {
                    Replaylb.Text += " - [UR]";
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 4
0
        public void Load(string playername, int champion)
        {
            cid = champion;

            this.Champion.BackgroundImage = Image.FromFile(Application.StartupPath + @"\Champions\" + CurrentGame.GetChampion(champion) + ".png");
            metroLabel1.Text = playername;
        }
Ejemplo n.º 5
0
        public void LoadGame(RootObject gameinfo, RiotSharp.RiotApi api, RiotSharp.Region reg, long sid)
        {
            try
            {
                BluePanel.BeginInvoke(new MethodInvoker(delegate
                {
                    BluePanel.Controls.Clear();
                    RedPanel.Controls.Clear();
                    ginfo.Text = RiotTool.ToMapString(gameinfo.MapType) + ", " + RiotTool.ToQueueString(gameinfo.gameQueueConfigId) + " - " + RiotTool.PlatformToString(gameinfo.platformId);
                    metroProgressSpinner1.Visible = true;


                    B1.Visible = (gameinfo.bannedChampions.Count != 0);
                    B2.Visible = (gameinfo.bannedChampions.Count != 0);
                    B3.Visible = (gameinfo.bannedChampions.Count != 0);
                    B4.Visible = (gameinfo.bannedChampions.Count != 0);
                    B5.Visible = (gameinfo.bannedChampions.Count != 0);
                    B6.Visible = (gameinfo.bannedChampions.Count != 0);


                    foreach (BannedChampion b in gameinfo.bannedChampions)
                    {
                        Image champ = Image.FromFile(Application.StartupPath + @"\Champions\" + CurrentGame.GetChampion(b.ChampionId) + ".png");
                        switch (b.PickTurn)
                        {
                        case 1:
                            B1.BackgroundImage = champ;
                            break;

                        case 3:
                            B2.BackgroundImage = champ;
                            break;

                        case 5:
                            B3.BackgroundImage = champ;
                            break;

                        case 2:
                            B4.BackgroundImage = champ;
                            break;

                        case 4:
                            B5.BackgroundImage = champ;
                            break;

                        case 6:
                            B6.BackgroundImage = champ;
                            break;
                        }
                    }
                }));
                int c = 0;

                frm.AnimationType = AnimatorNS.AnimationType.Mosaic;
                //foreach (Participant p in gameinfo.participants)
                //{
                ParallelLoopResult pr = Parallel.ForEach(gameinfo.participants, p =>
                {
                    Player pl = new Player(p.TeamId == 200);


                    pl.Dock          = DockStyle.Top;
                    LeaguePlayer pls = new LeaguePlayer();
                    pls.LoadPlayer(reg, api, p, CurrentGame.GetChampion(p.ChampionId));
                    if (pls.SummonerName == "Error occured")
                    {
                        pls.SummonerName = p.Name;
                    }
                    pl.LoadSummonerData(pls);
                    MetroPanel panel = null;
                    if (p.TeamId == 100)
                    {
                        panel = BluePanel;
                    }
                    else
                    {
                        panel = RedPanel;
                    }
                    pls.Dispose();
                    panel.Invoke(new MethodInvoker(delegate
                    {
                        //if (panel == BluePanel && p.TeamId != 100)
                        //    panel = RedPanel;
                        c++;
                        metroProgressSpinner1.Value = (int)((double)((double)c / (double)gameinfo.participants.Count) * 100);

                        panel.Controls.Add(pl);
                        //pl.Visible = false;

                        //frm.Show(pl, Program.MainFormInstance.MainTabControl.SelectedTab == Program.MainFormInstance.GameInfoTab);
                    }));

                    //   }
                });
                while (!pr.IsCompleted)
                {
                    Thread.Sleep(100);
                }

                RedPanel.Invoke(new MethodInvoker(delegate
                {
                    this.RedPanel.Controls.Add(this.RedBan);
                    this.BluePanel.Controls.Add(this.BlueBan);
                    metroProgressSpinner1.Visible = false;
                    metroProgressSpinner1.Value   = 1;
                }));

                Program.MainFormInstance.ShowInfo("Game info", "The current game info are ready to be viewed");
                if (SettingsManager.Settings.Speech)
                {
                    SoundPlayer sp = new SoundPlayer(Application.StartupPath + @"\Data\done.wav");
                    sp.Load();
                    sp.PlaySync();
                    sp.Dispose();
                }
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            catch (Exception ex)
            {
                Logger.Instance.Log.Error("Failed to load game", ex);
            }
        }