Beispiel #1
0
 void RunTest(List <string> arguments)
 {
     string         summonerName   = GetSummonerName(arguments[0]);
     PublicSummoner publicSummoner = RPC.GetSummonerByName(summonerName);
     //SummonerLeaguesDTO league = RPC.GetAllLeaguesForPlayer(publicSummoner.summonerId);
     AllSummonerData data = RPC.GetAllSummonerDataByAccount(publicSummoner.acctId);
 }
Beispiel #2
0
        private async void GotPlayerData(LoginDataPacket packet)
        {
            Client.RtmpConnection.MessageReceived += OnMessageReceived;
            AllSummonerData PlayerData = packet.AllSummonerData;

            SummonerNameLabel.Content = PlayerData.Summoner.Name;
            if (Client.LoginPacket.AllSummonerData.SummonerLevel.Level < 30)
            {
                PlayerProgressBar.Value            = (PlayerData.SummonerLevelAndPoints.ExpPoints / PlayerData.SummonerLevel.ExpToNextLevel) * 100;
                PlayerProgressLabel.Content        = String.Format("Level {0}", PlayerData.SummonerLevel.Level);
                PlayerCurrentProgressLabel.Content = String.Format("{0}XP", PlayerData.SummonerLevelAndPoints.ExpPoints);
                PlayerAimProgressLabel.Content     = String.Format("{0}XP", PlayerData.SummonerLevel.ExpToNextLevel);
            }
            else
            {
                SummonerLeaguesDTO MyLeagues = await RiotCalls.GetAllLeaguesForPlayer(PlayerData.Summoner.SumId);

                GotLeaguesForPlayer(MyLeagues);
            }

            if (packet.BroadcastNotification.broadcastMessages != null)
            {
                Dictionary <string, object> Message = packet.BroadcastNotification.broadcastMessages[0] as Dictionary <string, object>;
                BroadcastMessage.Text = Convert.ToString(Message["content"]);
            }

            foreach (PlayerStatSummary x in packet.PlayerStatSummaries.PlayerStatSummarySet)
            {
                if (x.PlayerStatSummaryTypeString == "Unranked")
                {
                    Client.IsRanked     = false;
                    Client.AmountOfWins = x.Wins;
                }
                if (x.PlayerStatSummaryTypeString == "RankedSolo5x5")
                {
                    Client.IsRanked     = true;
                    Client.AmountOfWins = x.Wins;
                    break;
                }
            }

            if (packet.ReconnectInfo != null)
            {
                ;
            }

            Client.InfoLabel.Content = "IP: " + Client.LoginPacket.IpBalance + " ∙ RP: " + Client.LoginPacket.RpBalance;
            int    ProfileIconID = Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId;
            string uriSource     = Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconID + ".png");

            ProfileImage.Source         = Client.GetImage(uriSource);
            Client.MainPageProfileImage = ProfileImage;

            RefreshTimer          = new System.Windows.Forms.Timer();
            RefreshTimer.Tick    += new EventHandler(RefreshTimer_Tick);
            RefreshTimer.Interval = 300000; // 5 minutes
            RefreshTimer.Start();
        }
Beispiel #3
0
        internal async void UpdateSummonerInformation()
        {
            AllSummonerData playerData =
                await Client.PVPNet.GetAllSummonerDataByAccount(Client.LoginPacket.AllSummonerData.Summoner.AcctId);

            SummonerNameLabel.Content = playerData.Summoner.Name;
            if (Client.LoginPacket.AllSummonerData.SummonerLevel.Level < 30)
            {
                PlayerProgressBar.Value = (playerData.SummonerLevelAndPoints.ExpPoints /
                                           playerData.SummonerLevel.ExpToNextLevel) * 100;
                PlayerProgressLabel.Content        = String.Format("Level {0}", playerData.SummonerLevel.Level);
                PlayerCurrentProgressLabel.Content = String.Format("{0}XP", playerData.SummonerLevelAndPoints.ExpPoints);
                PlayerAimProgressLabel.Content     = String.Format("{0}XP", playerData.SummonerLevel.ExpToNextLevel);
            }
            else
            {
                Client.PVPNet.GetAllLeaguesForPlayer(playerData.Summoner.SumId, GotLeaguesForPlayer);
            }

            if (Client.LoginPacket.BroadcastNotification.BroadcastMessages != null)
            {
                var message =
                    Client.LoginPacket.BroadcastNotification.BroadcastMessages[0] as Dictionary <string, object>;
                if (message != null)
                {
                    BroadcastMessage.Text = Convert.ToString(message["content"]);
                }
            }

            foreach (PlayerStatSummary x in Client.LoginPacket.PlayerStatSummaries.PlayerStatSummarySet)
            {
                if (x.PlayerStatSummaryTypeString == "Unranked")
                {
                    Client.IsRanked     = false;
                    Client.AmountOfWins = x.Wins;
                }
                if (x.PlayerStatSummaryTypeString != "RankedSolo5x5")
                {
                    continue;
                }

                Client.IsRanked     = true;
                Client.AmountOfWins = x.Wins;
                break;
            }

            Client.InfoLabel.Content = "IP: " + Client.LoginPacket.IpBalance + " ∙ RP: " + Client.LoginPacket.RpBalance;
            int profileIconId = Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId;
            var uriSource     =
                new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", profileIconId + ".png"),
                        UriKind.RelativeOrAbsolute);

            ProfileImage.Source         = new BitmapImage(uriSource);
            Client.MainPageProfileImage = ProfileImage;
        }
Beispiel #4
0
        private void GotPlayerData(LoginDataPacket packet)
        {
            Client.PVPNet.OnMessageReceived += PVPNet_OnMessageReceived;
            AllSummonerData PlayerData = packet.AllSummonerData;

            SummonerNameLabel.Content = PlayerData.Summoner.Name;
            if (Client.LoginPacket.AllSummonerData.SummonerLevel.Level < 30)
            {
                PlayerProgressBar.Value            = (PlayerData.SummonerLevelAndPoints.ExpPoints / PlayerData.SummonerLevel.ExpToNextLevel) * 100;
                PlayerProgressLabel.Content        = String.Format("Level {0}", PlayerData.SummonerLevel.Level);
                PlayerCurrentProgressLabel.Content = String.Format("{0}XP", PlayerData.SummonerLevelAndPoints.ExpPoints);
                PlayerAimProgressLabel.Content     = String.Format("{0}XP", PlayerData.SummonerLevel.ExpToNextLevel);
            }
            else
            {
                Client.PVPNet.GetAllLeaguesForPlayer(PlayerData.Summoner.SumId, new SummonerLeaguesDTO.Callback(GotLeaguesForPlayer));
            }

            if (packet.BroadcastNotification.BroadcastMessages != null)
            {
                Dictionary <string, object> Message = packet.BroadcastNotification.BroadcastMessages[0] as Dictionary <string, object>;
                BroadcastMessage.Text = Convert.ToString(Message["content"]);
            }

            foreach (PlayerStatSummary x in packet.PlayerStatSummaries.PlayerStatSummarySet)
            {
                if (x.PlayerStatSummaryTypeString == "Unranked")
                {
                    Client.IsRanked     = false;
                    Client.AmountOfWins = x.Wins;
                }
                if (x.PlayerStatSummaryTypeString == "RankedSolo5x5")
                {
                    Client.IsRanked     = true;
                    Client.AmountOfWins = x.Wins;
                    break;
                }
            }

            if (packet.ReconnectInfo != null)
            {
                ;
            }

            //Client.InfoLabel.Content = "IP: " + Client.LoginPacket.IpBalance + " ∙ RP: " + Client.LoginPacket.RpBalance;
            int ProfileIconID = Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId;
            var uriSource     = new Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", ProfileIconID + ".png"), UriKind.RelativeOrAbsolute);

            ProfileImage.Source         = new BitmapImage(uriSource);
            Client.MainPageProfileImage = ProfileImage;
        }
Beispiel #5
0
        public async Task <AllSummonerData> GetAllSummonerDataByAccount(Double accountId)
        {
            int Id = Invoke("summonerService", "getAllSummonerDataByAccount", new object[] { accountId });

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }
            TypedObject     messageBody = results[Id].GetTO("data").GetTO("body");
            AllSummonerData result      = new AllSummonerData(messageBody);

            results.Remove(Id);
            return(result);
        }
Beispiel #6
0
        public async Task <AllSummonerData> CreateDefaultSummoner(String summonerName)
        {
            int Id = Invoke("summonerService", "createDefaultSummoner", new object[] { summonerName });

            while (!results.ContainsKey(Id))
            {
                await Task.Delay(10);
            }
            TypedObject     messageBody = results[Id].GetTO("data").GetTO("body");
            AllSummonerData result      = new AllSummonerData(messageBody);

            results.Remove(Id);
            return(result);
        }
Beispiel #7
0
        /// 14.)
        public void GetAllSummonerDataByAccount(Double accountId, AllSummonerData.Callback callback)
        {
            AllSummonerData cb = new AllSummonerData(callback);

            InvokeWithCallback("summonerService", "getAllSummonerDataByAccount", new object[] { accountId }, cb);
        }
Beispiel #8
0
        private void connection_OnLogin(object sender, string username, string ipAddress)
        {
            new Thread((ThreadStart)(async() =>
            {
                Tools.ConsoleMessage("Logging onto account...", ConsoleColor.White);
                RegisterNotifications();
                loginPacket = await this.connection.GetLoginDataPacketForUser();
                if (loginPacket.AllSummonerData == null)
                {
                    Tools.ConsoleMessage("Summoner not found in account.", ConsoleColor.Red);
                    Tools.ConsoleMessage("Creating Summoner...", ConsoleColor.Red);
                    Random rnd = new Random();
                    String summonerName = Accountname;
                    if (summonerName.Length > 16)
                    {
                        summonerName = summonerName.Substring(0, 12) + new Random().Next(1000, 9999).ToString();
                    }
                    AllSummonerData sumData = await connection.CreateDefaultSummoner(summonerName);
                    loginPacket.AllSummonerData = sumData;
                    Tools.ConsoleMessage("Created Summoner: " + summonerName, ConsoleColor.White);
                }
                sumLevel = loginPacket.AllSummonerData.SummonerLevel.Level;
                string sumName = loginPacket.AllSummonerData.Summoner.Name;
                double sumId = loginPacket.AllSummonerData.Summoner.SumId;
                rpBalance = loginPacket.RpBalance;
                ipBalance = loginPacket.IpBalance;
                if (sumLevel >= Program.maxLevel)
                {
                    Tools.ConsoleMessage("Summoner: " + sumName + " is already max level.", ConsoleColor.White);
                    Tools.ConsoleMessage("Log into new account.", ConsoleColor.White);
                    connection.Disconnect();
                    Program.LognNewAccount();
                    return;
                }

                if (rpBalance == 400.0 && Program.buyExpBoost)
                {
                    Tools.ConsoleMessage("Buying XP Boost", ConsoleColor.White);
                    try
                    {
                        Task t = new Task(OnBuyBoost);
                        t.Start();
                    }
                    catch (Exception exception)
                    {
                        Tools.ConsoleMessage("Couldn't buy RP Boost.\n" + exception.Message.ToString(), ConsoleColor.White);
                    }
                }

                if (sumLevel < 3.0 && queueType == QueueTypes.NORMAL_5x5)
                {
                    Tools.ConsoleMessage("Need to be Level 3 before NORMAL_5x5 queue.", ConsoleColor.White);
                    Tools.ConsoleMessage("Joins Co-Op vs AI (Beginner) queue until 3", ConsoleColor.White);
                    queueType = QueueTypes.BOT_BEGINNER;
                    actualQueueType = QueueTypes.NORMAL_5x5;
                }
                else if (sumLevel < 6.0 && queueType == QueueTypes.ARAM)
                {
                    Tools.ConsoleMessage("Need to be Level 6 before ARAM queue.", ConsoleColor.White);
                    Tools.ConsoleMessage("Joins Co-Op vs AI (Beginner) queue until 6", ConsoleColor.White);
                    queueType = QueueTypes.BOT_BEGINNER;
                    actualQueueType = QueueTypes.ARAM;
                }
                else if (sumLevel < 7.0 && queueType == QueueTypes.NORMAL_3x3)
                {
                    Tools.ConsoleMessage("Need to be Level 7 before NORMAL_3x3 queue.", ConsoleColor.White);
                    Tools.ConsoleMessage("Joins Co-Op vs AI (Beginner) queue until 7", ConsoleColor.White);
                    queueType = QueueTypes.BOT_BEGINNER;
                    actualQueueType = QueueTypes.NORMAL_3x3;
                }

                Tools.ConsoleMessage("Welcome " + loginPacket.AllSummonerData.Summoner.Name + " - lvl (" + loginPacket.AllSummonerData.SummonerLevel.Level + ") IP: (" + ipBalance.ToString() + ")", ConsoleColor.White);
                PlayerDTO player = await connection.CreatePlayer();
                if (this.loginPacket.ReconnectInfo != null && this.loginPacket.ReconnectInfo.Game != null)
                {
                    this.connection_OnMessageReceived(sender, (object)this.loginPacket.ReconnectInfo.PlayerCredentials);
                }
                else
                {
                    this.connection_OnMessageReceived(sender, (object)new EndOfGameStats());
                }
            })).Start();
        }
Beispiel #9
0
        internal async void UpdateSummonerInformation()
        {
            if (Client.IsLoggedIn)
            {
                AllSummonerData playerData =
                    await RiotCalls.GetAllSummonerDataByAccount(Client.LoginPacket.AllSummonerData.Summoner.AcctId);

                SummonerNameLabel.Content = playerData.Summoner.Name;


                SummonerActiveBoostsDTO activeBoost = await RiotCalls.GetSummonerActiveBoosts();

                string xpBoostTime = ConvertBoostTime(activeBoost.XpBoostEndDate);
                if (xpBoostTime != string.Empty && activeBoost.XpBoostEndDate > 0)
                {
                    XPBoost.Content = "XP Boost " + ConvertBoostTime(activeBoost.XpBoostEndDate) + ". " + activeBoost.XpBoostPerWinCount + " Win.";
                }
                else if (xpBoostTime != string.Empty)
                {
                    XPBoost.Content = "XP Boost " + ConvertBoostTime(activeBoost.XpBoostEndDate) + ".";
                }
                else if (activeBoost.XpBoostPerWinCount > 0)
                {
                    XPBoost.Content = "XP Boost " + activeBoost.XpBoostPerWinCount + ".";
                }
                else
                {
                    XPBoost.Visibility = Visibility.Hidden;
                }

                string ipBoostTime = ConvertBoostTime(activeBoost.IpBoostEndDate);
                if (ipBoostTime != string.Empty && activeBoost.IpBoostEndDate > 0)
                {
                    IPBoost.Content = "IP Boost " + ipBoostTime + ". " + activeBoost.IpBoostPerWinCount + " Win.";
                }
                else if (ipBoostTime != string.Empty)
                {
                    IPBoost.Content = "IP Boost " + ipBoostTime + ".";
                }
                else if (activeBoost.IpBoostPerWinCount > 0)
                {
                    IPBoost.Content = "IP Boost " + activeBoost.IpBoostPerWinCount + ".";
                }
                else
                {
                    IPBoost.Visibility = Visibility.Hidden;
                }

                Sha1 sha1 = new Sha1();
                if (!CheckedDev)
                {
                    if (DevUsers.getDevelopers().Contains(sha1.Hash(playerData.Summoner.Name + " " + Client.Region.RegionName)))
                    {
                        Client.Dev = true;
                    }
                    CheckedDev = true;
                }

                if (Client.Dev)
                {
                    Client.UserTitleBarLabel.Content = "Dev ∙ " + playerData.Summoner.Name;
                }
                else
                {
                    Client.UserTitleBarLabel.Content = playerData.Summoner.Name;
                }

                if (Client.LoginPacket.AllSummonerData.SummonerLevel.Level < 30)
                {
                    PlayerProgressBar.Value = (playerData.SummonerLevelAndPoints.ExpPoints /
                                               playerData.SummonerLevel.ExpToNextLevel) * 100;
                    PlayerProgressLabel.Content        = string.Format("Level {0}", playerData.SummonerLevel.Level);
                    PlayerCurrentProgressLabel.Content = string.Format("{0}XP", playerData.SummonerLevelAndPoints.ExpPoints);
                    PlayerAimProgressLabel.Content     = string.Format("{0}XP", playerData.SummonerLevel.ExpToNextLevel);
                    Client.UserTitleBarLabel.Content   = Client.UserTitleBarLabel.Content + string.Format(" ∙ Level: {0}", playerData.SummonerLevel.Level);
                }
                else
                {
                    GotLeaguesForPlayer(await RiotCalls.GetAllLeaguesForPlayer(playerData.Summoner.SumId));
                }

                if (Client.LoginPacket.BroadcastNotification.broadcastMessages != null)
                {
                    var message = Client.LoginPacket.BroadcastNotification.broadcastMessages[0];
                    if (message != null)
                    {
                        //BroadcastMessage.Text = message.Content;
                    }
                }

                foreach (PlayerStatSummary x in Client.LoginPacket.PlayerStatSummaries.PlayerStatSummarySet)
                {
                    if (x.PlayerStatSummaryTypeString == "Unranked")
                    {
                        Client.IsRanked     = false;
                        Client.AmountOfWins = x.Wins;
                    }
                    if (x.PlayerStatSummaryTypeString != "RankedSolo5x5")
                    {
                        continue;
                    }

                    if (x.Rating != 0)
                    {
                        Client.IsRanked     = true;
                        Client.AmountOfWins = x.Wins;
                    }
                    break;
                }

                Client.InfoLabel.Content = "IP: " + Client.LoginPacket.IpBalance + " ∙ RP: " + Client.LoginPacket.RpBalance;
                int profileIconId = Client.LoginPacket.AllSummonerData.Summoner.ProfileIconId;
                var UriSource     =
                    new System.Uri(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon", profileIconId + ".png"),
                                   UriKind.RelativeOrAbsolute);
                try
                {
                    ProfileImage.Source             = new BitmapImage(UriSource);
                    Client.UserTitleBarImage.Source = new BitmapImage(UriSource);
                }
                catch
                {
                    Client.Log("Can't load profile image.", "ERROR");
                }
                Client.MainPageProfileImage = ProfileImage;
            }
        }
        public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e)
        {
            object[]       body           = e.Body as object[];
            SummonerClient summonerSender = sender as SummonerClient;
            int            creds          = Convert.ToInt32(body[0]);

            Console.WriteLine("Tries to get ALlSummonerDataByAccount from ID: " + creds);

            AllSummonerData allSD = new AllSummonerData()
            {
                SpellBook = new SpellBookDTO()
                {
                    BookPagesJson = null,
                    BookPages     = null,
                    DateString    = "Tue Dec 02 03:23:04 UTC 2014",
                    SummonerId    = summonerSender._sumId
                },
                SummonerDefaultSpells = new SummonerDefaultSpells()
                {
                    SummonerDefaultSpellsJson = null,
                    SummonerDefaultSpellMap   = null,
                    SummonerId = summonerSender._sumId
                },
                SummonerTalentsAndPoints = new SummonerTalentsAndPoints()
                {
                    TalentPoints = 30,
                    ModifyDate   = new DateTime(2016, 08, 11, 12, 00, 00),
                    CreateDate   = new DateTime(2016, 08, 11, 12, 00, 00),
                    SummonerId   = summonerSender._sumId
                },
                Summoner = new Summoner()
                {
                    InternalName = summonerSender._session.Summary.InternalName,
                    PreviousSeasonHighestTier = "CHALLENGER",
                    AcctId                          = summonerSender._session.Summary.AccountId,
                    HelpFlag                        = false,
                    SumId                           = summonerSender._sumId,
                    ProfileIconId                   = Convert.ToInt32(summonerSender._sumIcon),
                    DisplayEloQuestionaire          = false,
                    LastGameDate                    = new DateTime(2016, 08, 11, 12, 00, 00),
                    PreviousSeasonHighestTeamReward = 0,
                    RevisionDate                    = new DateTime(2016, 08, 11, 12, 00, 00),
                    AdvancedTutorialFlag            = false,
                    RevisionId                      = 0,
                    Name           = summonerSender._session.Summary.SummonerName,
                    NameChangeFlag = false,
                    TutorialFlag   = false
                },
                MasteryBook = new MasteryBookDTO()
                {
                    BookPagesJson = null,
                    BookPages     = null,
                    DateString    = "Tue Dec 02 03:23:04 UTC 2014",
                    SummonerId    = summonerSender._sumId
                },
                SummonerLevelAndPoints = new SummonerLevelAndPoints()
                {
                    InfPoints     = 69974,
                    ExpPoints     = 44,
                    SummonerLevel = summonerSender._sumLvl,
                    SummonerId    = summonerSender._sumId
                },
                SummonerLevel = new SummonerLevel()
                {
                    ExpTierMod     = 1,
                    GrantRp        = 0,
                    ExpForLoss     = 0,
                    SummonerTier   = 1,
                    InfTierMod     = 1,
                    ExpToNextLevel = 1250,
                    ExpForWin      = 0,
                    Level          = summonerSender._sumLvl
                }
            };

            e.ReturnRequired = true;
            e.Data           = allSD;
            return(e);
        }
Beispiel #11
0
        public static async void doMainStuff(string[] args)
        {
            // add this to your code before you make your web service call.
            System.Net.ServicePointManager.ServerCertificateValidationCallback +=
                delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslError)
            {
                bool validationResult = true;
                return(validationResult);
            };

            //Init parameters
            userName = args[1].ToLower();
            string password = args[2];

            Client.botType = args[3];
            roomName       = args[4];
            roomNameTwo    = args[5];
            hostName       = args[6].ToLower();
            hostNameTwo    = args[7].ToLower();
            botLevelLimit  = args[8];
            platform       = args[9];
            lvlGroupType   = args[10];

            //So the ControlPanel knows who we are.
            Console.Title = userName;

            //Console.WriteLine(userName + ":" + password + " - " + roomName);

            handlersRegistered = false;
            inGame             = false;
            gameState          = "NULL";
            SerializationContext context;

            try
            {
                //Init struct for login
                AuthenticationCredentials newCredentials = new AuthenticationCredentials();

                newCredentials.Username        = userName;
                newCredentials.Password        = password;
                newCredentials.ClientVersion   = "4.21.14_12_08_11_36";
                newCredentials.IpAddress       = "10.20.52.244";
                newCredentials.Locale          = "en_GB";
                newCredentials.Domain          = "lolclient.lol.riotgames.com";
                newCredentials.OperatingSystem = "Windows XP";

                Console.Write("Log in! ... | ");

                //Login Queue here!
                try
                {
                    string loginQueueLink = "";

                    if (platform == "eune")
                    {
                        loginQueueLink = "https://lq.eun1.lol.riotgames.com/";
                    }

                    if (platform == "euw")
                    {
                        loginQueueLink = "https://lq.euw1.lol.riotgames.com/";
                    }

                    newCredentials.AuthToken = RiotCalls.GetAuthKey(userName, password, loginQueueLink);
                }
                catch (Exception e)
                {
                    if (e.Message.Contains("The remote name could not be resolved"))
                    {
                        Console.WriteLine("Please make sure you are connected the internet!");
                    }
                    else if (e.Message.Contains("(403) Forbidden"))
                    {
                        Console.WriteLine("Your username or password is incorrect!");
                    }
                    else
                    {
                        //if(botLevelLimit == "LEVEL_30" && e.Message.Contains("403"))
                        //{
                        //    Console.WriteLine("Got caught by LeaveBust - BANNED TEMPORARY! | Sleeping 1/2 Hour");
                        //    Thread.Sleep(3600000 / 2);
                        //    restart();
                        //}

                        Console.WriteLine("Unable to get Auth Key - " + e.Message);
                    }

                    System.Threading.Thread.Sleep(5000);
                    restart();
                }

                //Console.WriteLine(newCredentials.AuthToken);

                //Init Rtmp Connection here
                try
                {
                    string rtmpLink = "";

                    if (platform == "eune")
                    {
                        rtmpLink = "rtmps://prod.eun1.lol.riotgames.com:2099";
                    }
                    else if (platform == "euw")
                    {
                        rtmpLink = "rtmps://prod.euw1.lol.riotgames.com:2099";
                    }
                    else
                    {
                        Console.WriteLine("Unknown platform: " + platform);
                        Console.ReadKey();
                    }

                    context = RiotCalls.RegisterObjects();
                    Client.RtmpConnection = new RtmpClient(new Uri(rtmpLink), context, ObjectEncoding.Amf3);
                    Client.RtmpConnection.Disconnected += DisconnectedHandler;
                    Client.summonerName          = userName.ToLower();
                    RiotCalls.OnInvocationError += OnInvocationException;

                    Random rnd      = new Random();
                    int    waitTime = rnd.Next(1, 61);
                    Console.Write("Waiting " + waitTime.ToString() + "s | ");
                    Thread.Sleep(waitTime * 1000);

                    await Client.RtmpConnection.ConnectAsync();
                }
                catch (Exception e)
                {
                    Console.WriteLine("FAILED");
                    System.Threading.Thread.Sleep(15000);
                    restart();
                }

                //Now login into the RTMP Server and register to message services
                //Console.WriteLine("[STEP 2]Loggin in...");
                Client.PlayerSession = await RiotCalls.Login(newCredentials);

                //await Client.RtmpConnection.SubscribeAsync("my-rtmps", "messagingDestination", "bc", "bc-" + Client.PlayerSession.AccountSummary.AccountId.ToString());
                //await Client.RtmpConnection.SubscribeAsync("my-rtmps", "messagingDestination", "gn-" + Client.PlayerSession.AccountSummary.AccountId.ToString(), "gn-" + Client.PlayerSession.AccountSummary.AccountId.ToString());
                //await Client.RtmpConnection.SubscribeAsync("my-rtmps", "messagingDestination", "cn-" + Client.PlayerSession.AccountSummary.AccountId.ToString(), "cn-" + Client.PlayerSession.AccountSummary.AccountId.ToString());
                bool loginSuccess = await Client.RtmpConnection.LoginAsync(userName, Client.PlayerSession.Token);

                //Console.WriteLine("Full Access " + loginSuccess.ToString());

                //Start heartbeat timer here
                try
                {
                    Client.StartHeartbeat();
                }
                catch (Exception e)
                { }
            }
            catch (Exception e)
            {
                if (e.Message.Contains("Wrong client version"))
                {
                    Console.WriteLine("NEW LOL UPDATE, WAIT FOR UPDATE FROM OMDIHAR! | " + e.Message);
                    Console.ReadKey();
                    System.Environment.Exit(0);
                }

                Console.WriteLine("FAILED : " + e.Message);

                System.Threading.Thread.Sleep(5000);
                restart();
            }

            //Console.WriteLine("LOGIN | UH YEAH => " + Client.PlayerSession.AccountSummary.AccountId.ToString());
            Console.WriteLine("SUCCESS!");

            try
            {
                Client.accId = Client.PlayerSession.AccountSummary.AccountId;
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not assign accId :" + e.Message);
            }

            try
            {
                await RiotCalls.CreateDefaultSummoner(userName);
            }
            catch (Exception e)
            {
                Console.WriteLine("CreateDefaultSummoner: " + userName);
            }
            //Console.WriteLine("Creating summoner...");

            AllSummonerData summonerData = await RiotCalls.GetAllSummonerDataByAccount(Client.accId);

            try
            {
                //Console.WriteLine("Setting profile icon...");
                RiotCalls.UpdateProfileIconId(28);
            }
            catch (Exception e)
            {
            }

            try
            {
                //Console.WriteLine("Processing Elo...");
                await RiotCalls.ProcessEloQuestionaire("BEGINNER");
            }
            catch (Exception e)
            {
            }

            try
            {
                //Console.WriteLine("Skip Tutorial...");
                await RiotCalls.SaveSeenTutorialFlag();
            }
            catch (Exception e)
            {
            }

            try
            {
                Console.WriteLine("Lvl" + summonerData.SummonerLevel.Level.ToString() + " Exp:" + summonerData.SummonerLevelAndPoints.ExpPoints.ToString() + "/" + summonerData.SummonerLevel.ExpToNextLevel.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not display LEVEL : " + e.Message);

                for (int i = 0; i < 10; ++i)
                {
                    Console.WriteLine("ACCOUNT BUGGED!!!!!!!!!");
                }

                Console.ReadKey();
            }

            if (summonerData.SummonerLevel.Level == 3)
            {
                Console.WriteLine("Buying EXP Boost!");
                BuyExpBoost(await RiotCalls.GetStoreUrl());
            }

            if ((botLevelLimit == "LEVEL_5" && summonerData.SummonerLevel.Level >= 5) || (botLevelLimit == "LEVEL_10" && summonerData.SummonerLevel.Level >= 10) || (botLevelLimit == "LEVEL_30" && summonerData.SummonerLevel.Level >= 30))
            {
                System.IO.File.WriteAllText(@"Logs/" + userName + ".finished", "1");
            }

            try
            {
                dynamic infoFile = Config.Load("Logs/AccountInfo/" + userName + ".info");

                infoFile.Info.Level      = summonerData.SummonerLevel.Level;
                infoFile.Info.ExpBalance = summonerData.SummonerLevelAndPoints.ExpPoints.ToString() + "/" + summonerData.SummonerLevel.ExpToNextLevel.ToString();

                infoFile.Save();
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not prepare INFO File: " + e.Message);
            }

            gameState        = "LOBBY";
            lastSummonerData = summonerData;

            doRoomStuff();
        }
Beispiel #12
0
        private static async void RoomMessageHandler(object sender, object message)
        {
            //Our group already finished?
            if (System.IO.File.Exists("Logs/" + hostName + ".gfinished"))
            {
                System.Environment.Exit(0);
            }

            //Console.WriteLine(groupSplitted);
            try
            {
                if (((MessageReceivedEventArgs)message).Body is RtmpSharp.IO.AsObject)
                {
                    if (!groupSplitted)
                    {
                        return;
                    }

                    //Convert object
                    RtmpSharp.IO.AsObject asnObject = ((MessageReceivedEventArgs)message).Body as AsObject;

                    if (asnObject.TypeName == "com.riotgames.platform.gameinvite.contract.InvitationRequest" && Client.botType == "BOT")
                    {
                        String InvitationState = asnObject["invitationState"] as String;

                        if (InvitationState != "ACTIVE")
                        {
                            return;
                        }

                        String InvitationId = asnObject["invitationId"] as String;

                        //Join them :)!
                        try
                        {
                            Console.WriteLine("Accepting Invitation");
                            await RiotCalls.Accept(InvitationId);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("INVITATION: " + e.Message);
                            return;
                        }

                        return;
                    }

                    if (Client.botType == "HOST" || Client.botType == "HOST2")
                    {
                        RtmpSharp.IO.AsObject lobbyStatus = asnObject;

                        //Check if 5 Invitations got sent
                        RtmpSharp.IO.AMF3.ArrayCollection invitees = lobbyStatus["invitees"] as RtmpSharp.IO.AMF3.ArrayCollection;

                        //if (invitees.Count != 5)
                        //{
                        //    await InvitePlayers();
                        //}

                        //Check if 5 Players are in lobby
                        RtmpSharp.IO.AMF3.ArrayCollection members = lobbyStatus["members"] as RtmpSharp.IO.AMF3.ArrayCollection;

                        if (members.Count == 5)
                        {
                            //Wait and attach to queue
                            Thread.Sleep(1500);

                            MatchMakerParams matchParams = new MatchMakerParams();
                            matchParams.Languages     = null;
                            matchParams.BotDifficulty = "EASY";
                            matchParams.Team          = new List <int>();

                            for (int i = 0; i < members.Count; ++i)
                            {
                                RtmpSharp.IO.AsObject memberObj = members[i] as RtmpSharp.IO.AsObject;
                                //Console.WriteLine(memberObj["summonerId"]);
                                matchParams.Team.Add(Convert.ToInt32(memberObj["summonerId"]));
                            }

                            matchParams.QueueIds     = new int[] { 25 };
                            matchParams.InvitationId = lobbyStatus["invitationId"] as String;

                            await RiotCalls.AttachTeamToQueue(matchParams);

                            Console.WriteLine("Attached to Queue");
                        }
                    }
                }
                else if (message.GetType() == typeof(GameDTO) || ((MessageReceivedEventArgs)message).Body.GetType() == typeof(GameDTO))
                {
                    GameDTO dto = null;

                    try
                    {
                        if (message.GetType() == typeof(GameDTO))
                        {
                            dto = message as GameDTO;
                        }
                        else
                        {
                            dto = ((MessageReceivedEventArgs)message).Body as GameDTO;
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Ignoring => Convert (object to GameDTO)");
                        return;
                    }

                    //Console.WriteLine(dto.GameState + ":" + groupSplitted);

                    //Game Popup?
                    if (dto.GameState == "JOINING_CHAMP_SELECT" && !acceptedGame)
                    {
                        try
                        {
                            await RiotCalls.AcceptPoppedGame(true);
                        }
                        catch (Exception e)
                        { }

                        acceptedGame = true;
                        return;
                    }

                    //Host left room? follow him!
                    //if (Client.botType == "BOT" && dto.GameState == "TEAM_SELECT")
                    //{
                    //    bool leaveRoom = false;

                    //    if (groupSplitted)
                    //    {
                    //        if (lvlGroupType == "ZERO")
                    //        {
                    //            if (dto.OwnerSummary.SummonerInternalName != hostName)
                    //                leaveRoom = true;
                    //        }

                    //        if (lvlGroupType == "ONE")
                    //        {
                    //            if (dto.OwnerSummary.SummonerInternalName != hostNameTwo)
                    //                leaveRoom = true;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (dto.OwnerSummary.SummonerInternalName != hostName)
                    //            leaveRoom = true;
                    //    }

                    //    if (leaveRoom)
                    //    {
                    //        Console.WriteLine("Host left the game, follow him!");
                    //        restart();
                    //    }
                    //}

                    if (dto.GameState == "TEAM_SELECT" && !groupSplitted)
                    {
                        List <Participant> AllParticipants = new List <Participant>(dto.TeamOne.ToArray());
                        AllParticipants.AddRange(dto.TeamTwo);

                        //Console.WriteLine("Player joined the game! " + AllParticipants.Count.ToString() + "/10");
                        gameState = "TEAM_SELECT";

                        if (Client.botType == "HOST")
                        {
                            int playerRoomCount = 10;

                            if (AllParticipants.Count == playerRoomCount) // 10/5 Players joined?
                            {
                                Thread.Sleep(1500);

                                await RiotCalls.StartChampionSelection(dto.Id, dto.OptimisticLock);

                                Console.WriteLine("Room started!");
                                gameState = "CHAMP_SELECT";
                            }
                        }
                    }

                    //Something failed
                    if (dto.GameState.Contains("FAILED"))
                    {
                        Console.WriteLine("FATAL: " + dto.GameState);
                        restart();
                    }

                    //Roomstate changed
                    if (dto.GameState == "TEAM_SELECT" && gameState == "CHAMP_SELECT")
                    {
                        gameState = "TEAM_SELECT";
                        Console.WriteLine("Unknown player left the room!");
                        //restart();
                    }

                    //Selecting Champion etc.
                    if (dto.GameState == "CHAMP_SELECT" || dto.GameState == "PRE_CHAMP_SELECT")
                    {
                        inInviteLobby = false;
                        gameState     = "CHAMP_SELECT";

                        if (!Client.selectedChampion)
                        {
                            Client.selectedChampion = true;
                            gameState = "CHAMP_SELECT";

                            //Signal to the server we are in champion select
                            try
                            {
                                await RiotCalls.SetClientReceivedGameMessage(dto.Id, "CHAMP_SELECT_CLIENT");

                                globalDto = dto;
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Ignoring => " + e.Message);
                            }

                            try
                            {
                                await RiotCalls.ChampionSelectCompleted();

                                Console.WriteLine("Selected Champion and Locked");

                                //await RiotCalls.ChampionSelectCompleted();
                                //Console.WriteLine("[2]Selected Champion and Locked");
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Locking in error: " + e.Message);
                            }
                        }
                    }

                    //Game ended
                    if (dto.GameState == "TERMINATED" || dto.GameState == "TERMINATED_IN_ERROR")
                    {
                        gameStarted  = false;
                        acceptedGame = false;
                        gameState    = "LOBBY";

                        AllSummonerData summonerData = null;
                        summonerData = await RiotCalls.GetAllSummonerDataByAccount(Client.PlayerSession.AccountSummary.AccountId);

                        lastSummonerData = summonerData;

                        if (Client.botType == "HOST")
                        {
                            try
                            {
                                System.IO.File.Delete("Logs/Rooms/" + hostName + ".roomID");
                            }
                            catch (Exception elol)
                            { }
                        }

                        Console.WriteLine(DateTime.Now.ToString("HH:mm:ss tt") + " end");
                        Console.WriteLine("Level " + summonerData.SummonerLevel.Level.ToString() + " " + summonerData.SummonerLevelAndPoints.ExpPoints.ToString() + "/" + summonerData.SummonerLevel.ExpToNextLevel.ToString());

                        //Remove GAMEEND file
                        try
                        {
                            System.IO.File.Delete("Logs/" + lastSummonerData.Summoner.SumId.ToString() + ".GAMEEND");
                        }
                        catch (Exception)
                        {
                        }

                        if (summonerData.SummonerLevel.Level == 3)
                        {
                            Console.WriteLine("Buying EXP Boost!");
                            BuyExpBoost(await RiotCalls.GetStoreUrl());
                        }

                        if ((botLevelLimit == "LEVEL_5" && summonerData.SummonerLevel.Level >= 5) || (botLevelLimit == "LEVEL_10" && summonerData.SummonerLevel.Level >= 10) || (botLevelLimit == "LEVEL_30" && summonerData.SummonerLevel.Level >= 30))
                        {
                            System.IO.File.WriteAllText(@"Logs/" + userName + ".finished", "1");
                        }

                        dynamic infoFile = Config.Load("Logs/AccountInfo/" + userName + ".info");

                        infoFile.Info.Level      = summonerData.SummonerLevel.Level;
                        infoFile.Info.ExpBalance = summonerData.SummonerLevelAndPoints.ExpPoints.ToString() + "/" + summonerData.SummonerLevel.ExpToNextLevel.ToString();

                        infoFile.Save();
                        infoFile = null;

                        //Wait 5 Seconds for observerThreads!
                        //Thread.Sleep(5000);

                        //Make sure observerThread gets terminated
                        //try
                        //{
                        //    observerThread.Abort();
                        //}
                        //catch (Exception)
                        //{ }

                        doRoomStuff(); //Start Loop again
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("FAK:" + e.Message);
                restart();
            }
        }
Beispiel #13
0
        public RemotingMessageReceivedEventArgs HandleMessage(object sender, RemotingMessageReceivedEventArgs e)
        {
            object[]       body           = e.Body as object[];
            SummonerClient summonerSender = sender as SummonerClient;
            int            creds          = Convert.ToInt32(body[0]);

            AllSummonerData allSD = new AllSummonerData()
            {
                SummonerDefaultSpells = new SummonerDefaultSpells()
                {
                    SummonerId    = summonerSender._sumId,
                    SpellDefault1 = new ArrayCollection(),
                    SpellDefault2 = new ArrayCollection()
                },
                SummonerTalentsAndPoints = new SummonerTalentsAndPoints()
                {
                    TalentPoints = 30,
                    ModifyDate   = new DateTime(2016, 08, 11, 12, 00, 00),
                    CreateDate   = new DateTime(2016, 08, 11, 12, 00, 00),
                    SummonerId   = summonerSender._sumId
                },
                Summoner = new Summoner()
                {
                    InternalName = summonerSender._session.Summary.Username,
                    PreviousSeasonHighestTier       = "CHALLENGER",
                    PreviousSeasonHighestTeamReward = 5,
                    AcctId                 = summonerSender._accId,
                    HelpFlag               = false,
                    SumId                  = summonerSender._sumId,
                    ProfileIconId          = Convert.ToInt32(summonerSender._sumIcon),
                    DisplayEloQuestionaire = false,
                    LastGameDate           = new DateTime(2016, 08, 11, 12, 00, 00),
                    RevisionDate           = new DateTime(2016, 08, 11, 12, 00, 00),
                    AdvancedTutorialFlag   = false,
                    RevisionId             = 1,
                    Name           = summonerSender._summonername,
                    NameChangeFlag = false,
                    TutorialFlag   = false,
                    SummonerId     = summonerSender._sumId
                },
                SummonerLevel = new SummonerLevel
                {
                    ExpTierMod     = 1.0,
                    SummonerTier   = 5.0,
                    InfTierMod     = 1.0,
                    ExpToNextLevel = 32651,
                    Level          = 30.0
                },
                SummonerLevelAndPoints = new SummonerLevelAndPoints
                {
                    InfPoints     = 0,
                    ExpPoints     = 32651,
                    SummonerId    = summonerSender._sumId,
                    SummonerLevel = 30
                },
                SpellBook = new SpellBookDTO
                {
                    SummonerId = summonerSender._sumId,
                    DateString = "Wed Jul 17 23:05:42 PDT 2013",
                    BookPages  = new ArrayCollection
                    {
                        new SpellBookPageDTO
                        {
                            Current     = true,
                            SummonerId  = summonerSender._sumId,
                            PageId      = 2.0,
                            CreateDate  = DateTime.Now,
                            Name        = "Rune Page 1",
                            SlotEntries = new ArrayCollection()
                        },
                        new SpellBookPageDTO
                        {
                            Current     = false,
                            SummonerId  = summonerSender._sumId,
                            PageId      = 3.0,
                            CreateDate  = DateTime.Now,
                            Name        = "Rune Page 2",
                            SlotEntries = new ArrayCollection()
                        }
                    }
                },
            };

            Console.WriteLine(JsonConvert.SerializeObject(allSD));

            e.ReturnRequired = true;
            e.Data           = allSD;
            return(e);
        }