Beispiel #1
0
        /**
         * Connects to the hub. Errors if there is already a hub connection.
         * Will cancel a pending reconnection if there is one. This method is
         * not guaranteed to connect on first try.
         */
        public async void Connect()
        {
            if (!league.IsConnected)
            {
                return;
            }
            //await Task.Delay(2000);

            //选择英雄
            // PRATISE 2, FIRE 11
            //PATCH
            /// lol - champ - select / v1 / session / actions / 11
            //{ "championId":15}

            //选择召唤师技能
            //PATCH
            /// lol - champ - select / v1 / session / my - selection
            //{ "spell1Id":4,"spell2Id":1}

            //确定
            //GET
            /// lol - platform - config / v1 / namespaces / LcuSocial / DefaultGameQueues


            while (true)
            {
                var result = league.Request("POST", "/lol-matchmaking/v1/ready-check/accept", "");
                //var result1 = league.Request("PATCH", "/lol-champ-select/v1/session/actions/11", "{\"championId\":24}");
                //var result1 = league.Request("GET", "/lol-champ-select/v1/pickable-champion-ids", "");
                //var result11 = league.Request("GET", "/lol-summoner/v1/summoners/2255279182488480", "");
                //var result111 = league.Request("PATCH", "/lol-champ-select/v1/session/actions/2", "{\"championId\":24}");
                //var result2 = league.Request("PATCH", "/lol-champ-select/v1/session/my-selection", "{\"spell1Id\":1,\"spell2Id\":4}");
                await Task.Delay(1500);
            }
        }
Beispiel #2
0
        /**
         * Handles a message post-decryption, which is the raw message sent by the mobile client.
         */
        private async void HandleMimicMessage(dynamic msg)
        {
            if (!(msg is JsonArray))
            {
                return;
            }

            if (msg[0] == (long)MobileOpcode.Subscribe)
            {
                var path = (string)msg[1];
                if (!observedPaths.ContainsKey(path))
                {
                    observedPaths.Add(path, new Regex(path));
                }
            }
            else if (msg[0] == (long)MobileOpcode.Unsubscribe)
            {
                var path = (string)msg[1];
                if (observedPaths.ContainsKey(path))
                {
                    observedPaths.Remove(path);
                }
            }
            else if (msg[0] == (long)MobileOpcode.Request)
            {
                var id     = (long)msg[1];
                var path   = (string)msg[2];
                var method = (string)msg[3];
                var body   = (string)msg[4];

                var result = await league.Request(method, path, body);

                var contents = await result.Content.ReadAsStringAsync();

                if (contents.IsNullOrEmpty())
                {
                    contents = "null";
                }

                Send("[" + (long)MobileOpcode.Response + "," + id + "," + (long)result.StatusCode + "," + contents + "]");
            }
            else if (msg[0] == (long)MobileOpcode.Version)
            {
                Send("[" + (long)MobileOpcode.VersionResponse + ", \"" + Program.VERSION + "\", \"" + Environment.MachineName + "\"]");
            }
        }