Beispiel #1
0
 public static void RespawnInhibitorsCommand(LoLClient client)
 {
     foreach (var inhib in client.Hero.Team.GetOposedTeams()[0].GetUnits <Inhibitor>(x => !x.Alive))
     {
         inhib.Revive();
     }
 }
Beispiel #2
0
        public void Handle(LoLClient client, string content)
        {
            string[] info = content.Split(null);
            string   name = info[0].Substring(1, info[0].Length - 1);

            if (Handlers.ContainsKey(name))
            {
                MethodInfo    method = Handlers[name];
                List <object> param  = new List <object>()
                {
                    client
                };

                string[]        paramString  = info.ToArray();
                ParameterInfo[] methodParams = method.GetParameters();

                try
                {
                    for (int i = 1; i < methodParams.Length; i++)
                    {
                        param.Add(Convert.ChangeType(paramString[i], methodParams[i].ParameterType));
                    }

                    method.Invoke(this, param.ToArray());
                }
                catch
                {
                    client.Hero.DebugMessage(name + " usage: [" + string.Join("] [", Array.ConvertAll(methodParams.Skip(1).ToArray(), x => x.ParameterType.Name)) + "]");
                }
            }
            else
            {
                client.Hero.DebugMessage("Available commands: ." + string.Join(" " + COMMANDS_PREFIX, Handlers.Keys));
            }
        }
Beispiel #3
0
 public static void InventoryCommand(LoLClient client)
 {
     foreach (var item in client.Hero.Inventory.GetItems())
     {
         client.Hero.DebugMessage("Id:" + item.Id + " Slot:" + item.Slot);
     }
 }
Beispiel #4
0
        protected override void OnMessage(MessageEventArgs e)
        {
            Console.WriteLine(e.Data);
            DataFetcher dataFetcher = new DataFetcher();

            LoLClient lol = new LoLClient();

            if (e.Data.Contains("#01"))
            {
                Send(lol.GetSummonerIdByName(e.Data.Substring(3)));
            }
            else if (e.Data.Contains("#04"))
            {
                // ↓ Tony, add here the method for ChampionStatisticsActivity
                //Send ($"#05{METHOD NAME)");
                string jsonChampStats = dataFetcher.ChampionStatsData(e.Data.Substring(3));
                Console.WriteLine(jsonChampStats);
                Send($"{jsonChampStats}");
            }
            else if (e.Data.Contains("#06"))
            {
                // ↓ Tony, add here the method for MatchHistory
                //Send ($"#07{METHOD NAME)");
                string jsonMatchesHistory = dataFetcher.MatchHistoryData(e.Data.Substring(3));
                Send($"{jsonMatchesHistory}");
            }
        }
Beispiel #5
0
 public static Task <object> callPersistenceMessaging(this LoLClient lolClient, SimpleDialogMessageResponse response)
 {
     return(lolClient.InvokeAsync <object>("clientFacadeService", "callPersistenceMessaging", new object[]
     {
         (SerializedNameAttribute)Attribute.GetCustomAttribute(response.GetType(), typeof(SerializedNameAttribute))
     }));
 }
Beispiel #6
0
        public static void HandleSellItemMessage(SellItemMessage message, LoLClient client)
        {
            Item  itemRemoved = client.Hero.Inventory.RemoveItem(message.slotId);
            float sellRatio   = itemRemoved.Record.SellBackModifier > 0 ? itemRemoved.Record.SellBackModifier : ITEM_SELL_SHOP_RATIO_DEFAULT;

            client.Hero.AddGold(itemRemoved.Record.GetTotalPrice() * sellRatio, false);
            client.Hero.UpdateStats();
        }
Beispiel #7
0
        public static void TestCommand(LoLClient client)
        {
            client.Send(new ChangeSlotSpellDataMessage(client.Hero.NetId, 0, false, new ChangeSpellDataSpellName()
            {
                SpellName = "BlindMonkQTwo",
            }));
            return;

            for (int i = 0; i < 10; i++)
            {
                JungleManager.Instance.SpawnMonster("SRU_OrderMinionMelee", client.Hero.Game, client.Hero.Position + new Vector2(i * 150, 0));
            }

            for (int i = 0; i < 10; i++)
            {
                JungleManager.Instance.SpawnMonster("SRU_OrderMinionRanged", client.Hero.Game, client.Hero.Position + new Vector2(0, i * 150));
            }

            client.Hero.Game.Send(new BuffAddMessage(client.Hero.NetId, 0, BuffTypeEnum.Counter
                                                     , 1, false, "Recall".HashString(), (uint)client.Hero.GetHash(), 0f, 1f, client.Hero.NetId));

            return;

            /* client.Hero.Game.Send(new WaypointGroupWithSpeedMessage(client.Hero.NetId, new MovementDataWithSpeed[]{
             * new MovementDataWithSpeed()
             * {
             *  HasTeleportID = false,
             *  SpeedParams =new SpeedParams()
             *  {
             *      Facing = false,
             *      FollowBackDistance =0f,
             *      FollowDistance = 0f,
             *      FollowNetID = 0,
             *      FollowTravelTime =0f,
             *      ParabolicGravity =102f,
             *      ParabolicStartPoint = client.Hero.Position,
             *      PathSpeedOverride = 200F,// DashManager.GetDash().Speed,
             *  },
             *  TeleportID = 0,
             *  TeleportNetID = client.Hero.NetId,
             *  Waypoints= GridPosition.Translate(new Vector2[]{client.Hero.Position,client.Hero.Position+new Vector2(100,100) },client.Hero.Game.Map.Size)
             * } }, Environment.TickCount));
             * return;
             * //    client.Hero.Game.Send(new UpdateModelMessage(t.NetId, "SRUAP_Turret_Chaos1", true, 0));
             */


            client.Hero.BlueTip("Legends", "This is for developpement purpose only!", "", TipCommandEnum.ACTIVATE_TIP_DIALOGUE);
            return;

            var turret = client.Hero.Game.GetUnit <AITurret>("Turret_T2_C_01");

            List <short> items = new List <short>()
            {
                1501, 1502, 1503, 1505
            };
        }
Beispiel #8
0
        public static void HandleHeartBeat(HeartBeatMessage message, LoLClient client)
        {
            if (message.receiveTime > message.ackTime)
            {
                var diff = message.ackTime - message.receiveTime;

                var msg = $"Player {client.Hero.Name} sent an invalid heartbeat - Timestamp error (diff: {diff})";
                logger.Write(msg, MessageState.WARNING);
            }
        }
Beispiel #9
0
        public static void HandleClickMessage(ClickMessage message, LoLClient client)
        {
            var targetUnit = client.Hero.Game.Map.GetUnit(message.targetNetId);

            if (targetUnit != null)
            {
                string msg = "You clicked on {0} Position : {1} Distance to me : {2}";
                client.Hero.DebugMessage(string.Format(msg, targetUnit.Name, targetUnit.Position, targetUnit.GetDistanceTo(client.Hero)));
            }
        }
        public static void HandleClientReadyMessage(ClientReadyMessage message, LoLClient client)
        {
            client.Ready = true;

            client.Send(new LoadScreenInfoMessage(6, 6, ConfigurationProvider.Instance.GetBlueIds(), ConfigurationProvider.Instance.GetPurpleIds()), Channel.CHL_LOADING_SCREEN);

            foreach (var player in ConfigurationProvider.Instance.Configuration.Players)
            {
                client.Send(new LoadScreenPlayerNameMessage(player.UserId, player.SkinId, player.Name, 0), Channel.CHL_LOADING_SCREEN);
                client.Send(new LoadScreenPlayerChampionMessage(player.UserId, player.SkinId, player.ChampionName, 0), Channel.CHL_LOADING_SCREEN);
            }
        }
Beispiel #11
0
        public static void Cercle2Command(LoLClient client, float size)
        {
            float start = 0;

            float end = (float)(2 * Math.PI);

            for (float i = start; i < end; i += 0.5f)
            {
                var v = Geo.GetPointOnCircle(client.Hero.Position, i, size);
                client.Hero.AttentionPing(v, client.Hero.NetId, PingTypeEnum.Ping_OnMyWay);
            }
        }
Beispiel #12
0
        public static void VisionCommand(LoLClient client)
        {
            string str = "I have vision on : ";

            str += Environment.NewLine;
            foreach (var unit in client.Hero.Team.GetVisibleUnits())
            {
                str += unit.Name + " distance: (" + unit.GetDistanceTo(client.Hero) + ")  ";
            }

            client.Hero.DebugMessage(str);
        }
Beispiel #13
0
        public static void HandleCharLoadedMessage(CharLoadedMessage message, LoLClient client)
        {
            client.Hero.ReadyToSpawn = true;

            client.Hero.NetId         = client.Hero.Game.NetIdProvider.PopNextNetId();
            client.Hero.SpawnPosition = client.Hero.Game.Map.GetSpawnPosition(client.Hero);
            client.Hero.Position      = client.Hero.SpawnPosition;

            if (client.Hero.Game.CanSpawn)
            {
                client.Hero.Game.Spawn();
            }
        }
Beispiel #14
0
        public static void HandleCastSpellRequest(CastSpellRequestMessage message, LoLClient client)
        {
            AttackableUnit autoAttackTarget = null;

            AttackableUnit spellTarget = client.Hero.Game.Map.GetUnit(message.targetNetId) as AttackableUnit;

            if (client.Hero.AttackManager.IsAttacking)
            {
                autoAttackTarget = client.Hero.AttackManager.GetTarget();
            }

            client.Hero.StopMove();
            client.Hero.CastSpell(message.slot, message.position, message.endPosition, spellTarget, autoAttackTarget);
        }
        public static void HandleKeyCheckMessage(KeyCheckMessage message, LoLClient client)
        {
            long userId = LoLServer.BlowFish.Decrypt((ulong)message.checkId);

            logger.Write("User (" + userId + ") connected!");

            if (userId != message.userId)
            {
                return;
            }
            client.UserId = userId;

            PlayerData datas = ConfigurationProvider.Instance.GetPlayerData(userId);

            if (datas == null)
            {
                logger.Write("No player data for userId:" + userId, MessageState.WARNING);
                return;
            }

            Game targetGame = GameProvider.TestGame;

            if (targetGame.Contains(userId))
            {
                logger.Write(userId + "try to connect a second time!", MessageState.WARNING);
                return;
            }
            client.DefinePlayer(new AIHero(client, datas, AIUnitRecord.GetAIUnitRecord(datas.ChampionName)));

            client.Hero.DefineGame(targetGame);

            client.Hero.Game.AddUnitToTeam(client.Hero, client.Hero.Data.Team);

            client.Hero.PlayerNo = client.Hero.Game.PopNextPlayerNo();

            // on montre aux joueurs de la partie que je suis la !
            client.Hero.Game.Send(new KeyCheckMessage(PartialKey, client.Hero.PlayerNo, userId, 0, 0, 0), Channel.CHL_HANDSHAKE);

            // on montre a moi les autre joueurs de la partie
            foreach (var player in client.Hero.Game.Players)
            {
                client.Send(new KeyCheckMessage(PartialKey, player.PlayerNo, player.Client.UserId.Value, 0, 0, 0), Channel.CHL_HANDSHAKE);
            }

            // useless??
            client.Send(new WorldGameNumberMessage(client.Hero.Game.Id, client.Hero.Game.Name), Channel.CHL_S2C);

            // blowfish >= 8
            client.Encrypt = true;
        }
Beispiel #16
0
 public static void HandlePingLoadInfoMessage(PingLoadInfoMessage message, LoLClient client)
 {
     client.Hero.Game.Send(new PingLoadInfoAnswerMessage()
     {
         netId  = message.netId,
         loaded = message.loaded,
         ping   = message.ping,
         unk1   = message.unk1,
         unk2   = message.unk2,
         unk3   = message.unk3,
         unk4   = message.unk4,
         userId = client.UserId.Value,
     }, Channel.CHL_LOW_PRIORITY, ENet.PacketFlags.None);
 }
        public static void HandleSynchVersionMessage(SynchVersionMessage message, LoLClient client)
        {
            string version = Crypto.GetVersion(message.version);

            if (version != LoLServer.CLIENT_REQUIRED_VERSION)
            {
                client.Disconnect();
            }
            else
            {
                var infos = ConfigurationProvider.Instance.GetPlayersInformations();
                client.Send(new SynchVersionAnswerMessage(0, 1, (int)client.Hero.Game.Map.Id, infos,
                                                          LoLServer.CLIENT_REQUIRED_VERSION, GameModeEnum.CLASSIC, "NA1", 487826), Channel.CHL_S2C);
            }
        }
Beispiel #18
0
        public static void HandleViewRequestMessage(ViewRequestMessage message, LoLClient client)
        {
            byte requestNo = 0x00;

            if (message.requestNo == 0xFE)
            {
                requestNo = 0xFF;
            }
            else
            {
                requestNo = message.requestNo;
            }

            client.Send(new ViewMessage(requestNo));
        }
        public static void TestCommand(LoLClient client)
        {
            return;

            //    client.Hero.Game.Send(new UpdateModelMessage(t.NetId, "SRUAP_Turret_Chaos1", true, 0));



            client.Hero.BlueTip("Legends", "This is for developpement purpose only!", "", TipCommandEnum.ACTIVATE_TIP_DIALOGUE);
            return;

            var turret = client.Hero.Game.GetUnit <AITurret>("Turret_T2_C_01");

            List <short> items = new List <short>()
            {
                1501, 1502, 1503, 1505
            };
        }
        public AccountEdit(List <Account> accounts = null)
        {
            InitializeComponent();

            RegionBox.ItemsSource  = LoLClient.GetAllAvailableRegions();
            RegionBox.SelectedItem = Settings.Config.SelectedRegion;

            _accounts = accounts;

            if (Settings.Config.ShowPasswords)
            {
                PasswordBoxText.Text       = PasswordBox.Password;
                PasswordBoxText.Visibility = Visibility.Visible;
                PasswordBox.Visibility     = Visibility.Hidden;
            }
            else
            {
                PasswordBox.Password       = PasswordBoxText.Text;
                PasswordBoxText.Visibility = Visibility.Hidden;
                PasswordBox.Visibility     = Visibility.Visible;
            }

            if (_accounts != null)
            {
                if (_accounts.Count == 1)
                {
                    UsernameBox.Text       = _accounts[0].Username;
                    PasswordBox.Password   = _accounts[0].Password;
                    PasswordBoxText.Text   = _accounts[0].Password;
                    RegionBox.SelectedItem = _accounts[0].Region;
                }
                else
                {
                    UsernameLabel.Visibility = Visibility.Collapsed;
                    UsernameBox.Visibility   = Visibility.Collapsed;

                    PasswordLabel.Visibility   = Visibility.Collapsed;
                    PasswordBox.Visibility     = Visibility.Collapsed;
                    PasswordBoxText.Visibility = Visibility.Collapsed;
                }
            }
        }
Beispiel #21
0
        public Client(Region region, string username, string password)
        {
            Data = new Account
            {
                Username = username,
                Password = password,
                Region   = region,
                Refunds  = 0
            };

            IsCompleted = new TaskCompletionSource <bool>();

            _lolClient = new LoLClient(username, password, region, Settings.Config.ClientVersion);

            _lolClient.OnError += OnError;

            _lolClient.OnMessageReceived += new EventHandler <MessageReceivedEventArgs>(this.OnMessageReceived);

            GetData();
        }
        public static void HandleChatBoxMessage(ChatBoxMessage message, LoLClient client)
        {
            if (message.content.StartsWith(CommandsProvider.COMMANDS_PREFIX))
            {
                CommandsProvider.Instance.Handle(client, message.content);
            }
            else
            {
                switch (message.channel)
                {
                case ChatChannelType.ALL:
                    client.Hero.Game.Send(message, Channel.CHL_COMMUNICATION);
                    break;

                case ChatChannelType.TEAM:
                    client.Hero.Team.Send(message, Channel.CHL_COMMUNICATION);
                    break;
                }
            }
        }
Beispiel #23
0
 public static void AddItemCommand(LoLClient client, int itemId)
 {
     client.Hero.Inventory.AddItem(itemId);
 }
Beispiel #24
0
 public static Task <object> ackLeaverBusterWarning(this LoLClient lolClient)
 {
     return(lolClient.InvokeAsync <object>("clientFacadeService", "ackLeaverBusterWarning", new object[0]));
 }
Beispiel #25
0
 public static void PositionCommand(LoLClient client)
 {
     client.Hero.DebugMessage(client.Hero.Position.ToString());
     client.Hero.AttentionPing(client.Hero.Position, client.Hero.NetId, PingTypeEnum.Ping_OnMyWay);
 }
Beispiel #26
0
 public static void AddMagicalShieldCommand(LoLClient client, float value)
 {
     client.Hero.Shields.Magical += value;
     client.Hero.OnShieldModified(true, false, value);
 }
Beispiel #27
0
 public static void AddShieldCommand(LoLClient client, float value)
 {
     client.Hero.AddGlobalShield(value);
 }
Beispiel #28
0
 public static void AddLifeStealCommand(LoLClient client, float value)
 {
     client.Hero.Stats.LifeSteal.FlatBonus += value;
     client.Hero.UpdateStats();
 }
Beispiel #29
0
 public static void AddCritCommand(LoLClient client, float value)
 {
     client.Hero.Stats.CriticalHit.FlatBonus += value;
     client.Hero.UpdateStats();
 }
Beispiel #30
0
 public static void AddGoldCommand(LoLClient client, int gold)
 {
     client.Hero.AddGold(gold, true);
     client.Hero.UpdateStats();
 }