public EnemyInfo UpdateRecall(Packet.S2C.Recall.Struct newRecall) { IncomingDamage.Clear(); Recall = newRecall; return(EnemyInfo); }
private static void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (args.PacketData[0] == Packet.S2C.Recall.Header) { Packet.S2C.Recall.Struct newRecall = Helper.RecallDecode(args.PacketData); PlayerInfo playerInfo = _playerInfo.Find((PlayerInfo x) => x.Champ.NetworkId == newRecall.UnitNetworkId).UpdateRecall(newRecall); if (_menu.Item("debugMode").GetValue <bool>()) { Game.PrintChat(string.Concat(new object[] { playerInfo.Champ.ChampionName, ": ", playerInfo.Recall.Status, " duration: ", playerInfo.Recall.Duration, " guessed health: ", Helper.GetTargetHealth(playerInfo), " lastseen: ", playerInfo.LastSeen, " health: ", playerInfo.Champ.Health, " own-ultdamage: ", (float)Helper.GetUltDamage(ObjectManager.Player, playerInfo.Champ) * UltInfo[ObjectManager.Player.ChampionName].DamageMultiplicator })); } } }
private void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (args.PacketData[0] == Packet.S2C.Recall.Header) { Packet.S2C.Recall.Struct decoded = Packet.S2C.Recall.Decoded(args.PacketData); if (decoded.UnitNetworkId == _hero.NetworkId) { switch (decoded.Status) { case Packet.S2C.Recall.RecallStatus.RecallStarted: _begin = Game.ClockTime; _duration = decoded.Duration; _active = true; break; case Packet.S2C.Recall.RecallStatus.RecallFinished: Program.Instance().Notify(_hero.ChampionName + " 姝e湪鍥炲煄."); _active = false; break; case Packet.S2C.Recall.RecallStatus.RecallAborted: _active = false; break; case Packet.S2C.Recall.RecallStatus.Unknown: Program.Instance().Notify(_hero.ChampionName + " is <font color='#ff3232'>unknown</font> (" + _hero.Spellbook.GetSpell(SpellSlot.Recall).Name + ")"); _active = false; break; } } } }
public static Packet.S2C.Recall.Struct Decode(byte[] data) { var recall = new Packet.S2C.Recall.Struct { Status = Packet.S2C.Recall.RecallStatus.Unknown }; using (var reader = new BinaryReader(new MemoryStream(data))) { reader.ReadByte(); reader.ReadInt32(); recall.UnitNetworkId = reader.ReadInt32(); reader.ReadBytes(66); if (BitConverter.ToString(reader.ReadBytes(6)) != "00-00-00-00-00-00") { recall.Status = BitConverter.ToString(reader.ReadBytes(3)) != "00-00-00" ? Packet.S2C.Recall.RecallStatus.TeleportStart : Packet.S2C.Recall.RecallStatus.RecallStarted; } } var hero = ObjectManager.Get <Obj_AI_Hero>().FirstOrDefault(h => h.IsValid && h.NetworkId == recall.UnitNetworkId); if (!Equals(hero, default(Obj_AI_Hero))) { recall.Duration = recall.Status == Packet.S2C.Recall.RecallStatus.TeleportStart ? 3500 : Utility.GetRecallTime(hero); if (!T.ContainsKey(recall.UnitNetworkId)) { T.Add(recall.UnitNetworkId, Environment.TickCount); } else { if (T[recall.UnitNetworkId] == 0) { T[recall.UnitNetworkId] = Environment.TickCount; } else { if (Environment.TickCount - T[recall.UnitNetworkId] > recall.Duration - 150) { recall.Status = recall.Status == Packet.S2C.Recall.RecallStatus.TeleportStart ? Packet.S2C.Recall.RecallStatus.TeleportEnd : Packet.S2C.Recall.RecallStatus.RecallFinished; } else { recall.Status = recall.Status == Packet.S2C.Recall.RecallStatus.TeleportStart ? Packet.S2C.Recall.RecallStatus.TeleportAbort : Packet.S2C.Recall.RecallStatus.RecallAborted; } T[recall.UnitNetworkId] = 0; } } } return(recall); }
private static void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (args.PacketData[0] == Packet.S2C.Recall.Header) { Packet.S2C.Recall.Struct newRecall = RecallDecode(args.PacketData); Program.Helper.EnemyInfo.Find(x => x.Player.NetworkId == newRecall.UnitNetworkId).RecallInfo.UpdateRecall(newRecall); //Packet.S2C.Recall.Decoded(args.PacketData) } }
public static void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (args.PacketData[0] == Packet.S2C.Recall.Header) { Packet.S2C.Recall.Struct decoded = Packet.S2C.Recall.Decoded(args.PacketData); Obj_AI_Hero objAiHero = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(decoded.UnitNetworkId); Packet.S2C.Recall.RecallStatus recallStatus = decoded.Status; Game.PrintChat(objAiHero.Name + " is " + recallStatus); } }
private static void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (args.PacketData[0] == Packet.S2C.Recall.Header) { Packet.S2C.Recall.Struct newRecall = Helper.RecallDecode(args.PacketData); PlayerInfo playerInfo = _playerInfo.Find(x => x.Champ.NetworkId == newRecall.UnitNetworkId).UpdateRecall(newRecall); //Packet.S2C.Recall.Decoded(args.PacketData) if (_menu.Item("debugMode").GetValue <bool>()) { Game.PrintChat(playerInfo.Champ.ChampionName + ": " + playerInfo.Recall.Status + " duration: " + playerInfo.Recall.Duration + " guessed health: " + Helper.GetTargetHealth(playerInfo) + " lastseen: " + playerInfo.LastSeen + " health: " + playerInfo.Champ.Health + " own-ultdamage: " + (float)Helper.GetUltDamage(ObjectManager.Player, playerInfo.Champ) * UltInfo[ObjectManager.Player.ChampionName].DamageMultiplicator); } } }
static PlayerInfo AddRecall(Packet.S2C.Recall.Struct newrecall) { foreach (PlayerInfo playerinfo in Players) { if (playerinfo == null) { continue; } if (playerinfo.recall.UnitNetworkId == newrecall.UnitNetworkId) //update info if already existing { playerinfo.recall = newrecall; return(playerinfo); } } PlayerInfo newplayeirnfo = new PlayerInfo(newrecall); Players.Add(newplayeirnfo); return(newplayeirnfo); }
private void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (!IsActive()) { return; } try { var reader = new BinaryReader(new MemoryStream(args.PacketData)); byte packetId = reader.ReadByte(); //PacketId if (packetId != Packet.S2C.Recall.Header) //OLD 215 { return; } //Log.LogPacket(args.PacketData); Packet.S2C.Recall.Struct recall = RecallDecode(args.PacketData);//Packet.S2C.Recall.Decoded(args.PacketData); HandleRecall(recall); } catch (Exception ex) { Console.WriteLine("RecallProcess: " + ex); } }
private void Game_OnGameProcessPacket(GamePacketEventArgs args) { if (args.PacketData[0] == Packet.S2C.Recall.Header) { Packet.S2C.Recall.Struct decoded = Packet.S2C.Recall.Decoded(args.PacketData); if (decoded.UnitNetworkId == Hero.NetworkId) { RecallStatus = decoded.Status; if (decoded.Status == Packet.S2C.Recall.RecallStatus.RecallFinished) { BeforeRecallLocation = Hero.ServerPosition; Vector3 enemyPos = ObjectManager.Get <GameObject>() .First( x => x.Type == GameObjectType.obj_SpawnPoint && x.Team != ObjectManager.Player.Team) .Position; LastLocation = enemyPos; PredictedLocation = enemyPos; LastSeen = Game.ClockTime; } } } }
public static Packet.S2C.Recall.Struct RecallDecode(byte[] data) { var reader = new BinaryReader(new MemoryStream(data)); var recall = new Packet.S2C.Recall.Struct(); reader.ReadByte(); //PacketId reader.ReadInt32(); recall.UnitNetworkId = reader.ReadInt32(); reader.ReadBytes(66); recall.Status = Packet.S2C.Recall.RecallStatus.Unknown; bool teleport = false; if (BitConverter.ToString(reader.ReadBytes(6)) != "00-00-00-00-00-00") { if (BitConverter.ToString(reader.ReadBytes(3)) != "00-00-00") { recall.Status = Packet.S2C.Recall.RecallStatus.TeleportStart; teleport = true; } else { recall.Status = Packet.S2C.Recall.RecallStatus.RecallStarted; } } reader.Close(); var champ = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(recall.UnitNetworkId); if (champ != null) { if (teleport) { recall.Duration = 3500; } else //use masteries to detect recall duration, because spelldata is not initialized yet when enemy has not been seen { recall.Duration = Program.Map == Utility.Map.MapType.CrystalScar ? 4500 : 8000; if (champ.Masteries.Any(x => x.Page == MasteryPage.Utility && x.Id == 65 && x.Points == 1)) { recall.Duration -= Program.Map == Utility.Map.MapType.CrystalScar ? 500 : 1000; //phasewalker mastery } } int time = Environment.TickCount - Game.Ping; if (!Program.RecallT.ContainsKey(recall.UnitNetworkId)) { Program.RecallT.Add(recall.UnitNetworkId, time); //will result in status RecallStarted, which would be wrong if the assembly was to be loaded while somebody recalls } else { if (Program.RecallT[recall.UnitNetworkId] == 0) { Program.RecallT[recall.UnitNetworkId] = time; } else { if (time - Program.RecallT[recall.UnitNetworkId] > recall.Duration - 75) { recall.Status = teleport ? Packet.S2C.Recall.RecallStatus.TeleportEnd : Packet.S2C.Recall.RecallStatus.RecallFinished; } else { recall.Status = teleport ? Packet.S2C.Recall.RecallStatus.TeleportAbort : Packet.S2C.Recall.RecallStatus.RecallAborted; } Program.RecallT[recall.UnitNetworkId] = 0; //recall aborted or finished, reset status } } } return(recall); }
private void HandleRecall(Packet.S2C.Recall.Struct recallEx) { int time = Environment.TickCount - Game.Ping; foreach (RecallInfo recall in Recalls) { if (recall == null) { continue; } if (recallEx.Type == Packet.S2C.Recall.ObjectType.Player) { var obj = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(recall.NetworkId); var objEx = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(recallEx.UnitNetworkId); if (obj == null) { continue; } if (obj.NetworkId == objEx.NetworkId) //already existing { recall.Recall = recallEx; recall.Recall2 = new Packet.S2C.Recall.Struct(); var t = Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorMode").GetValue <StringList>(); if (t.SelectedIndex == 0 || t.SelectedIndex == 2) { var percentHealth = (int)((obj.Health / obj.MaxHealth) * 100); String sColor = "<font color='#FFFFFF'>"; String color = (percentHealth > 50 ? "<font color='#00FF00'>" : (percentHealth > 30 ? "<font color='#FFFF00'>" : "<font color='#FF0000'>")); if (recallEx.Status == Packet.S2C.Recall.RecallStatus.TeleportStart || recallEx.Status == Packet.S2C.Recall.RecallStatus.RecallStarted) { String text = (recallEx.Status == Packet.S2C.Recall.RecallStatus.TeleportStart ? "porting" : "recalling"); recall.StartTime = (int)Game.Time; if ( Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorChatChoice") .GetValue <StringList>() .SelectedIndex == 1) { Game.PrintChat(obj.ChampionName + " {0} with {1} hp {2}({3})", text, (int)obj.Health, color, percentHealth); } else if ( Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorChatChoice") .GetValue <StringList>() .SelectedIndex == 2 && Menu.GlobalSettings.GetMenuItem("SAwarenessGlobalSettingsServerChatPingActive") .GetValue <bool>()) { Game.Say(obj.ChampionName + " {0} with {1} hp {2}({3})", text, (int)obj.Health, color, percentHealth); } } else if (recallEx.Status == Packet.S2C.Recall.RecallStatus.TeleportEnd || recallEx.Status == Packet.S2C.Recall.RecallStatus.RecallFinished) { String text = (recallEx.Status == Packet.S2C.Recall.RecallStatus.TeleportStart ? "ported" : "recalled"); if ( Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorChatChoice") .GetValue <StringList>() .SelectedIndex == 1) { Game.PrintChat(obj.ChampionName + " {0} with {1} hp {2}({3})", text, (int)obj.Health, color, percentHealth); } else if ( Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorChatChoice") .GetValue <StringList>() .SelectedIndex == 2 && Menu.GlobalSettings.GetMenuItem( "SAwarenessGlobalSettingsServerChatPingActive").GetValue <bool>()) { Game.Say(obj.ChampionName + " {0} with {1} hp {2}({3})", text, (int)obj.Health, color, percentHealth); } } else { if ( Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorChatChoice") .GetValue <StringList>() .SelectedIndex == 1) { Game.PrintChat(obj.ChampionName + " canceled with {0} hp", (int)obj.Health); } else if ( Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorChatChoice") .GetValue <StringList>() .SelectedIndex == 2 && Menu.GlobalSettings.GetMenuItem( "SAwarenessGlobalSettingsServerChatPingActive").GetValue <bool>()) { Game.Say(obj.ChampionName + " canceled with {0} hp", (int)obj.Health); } } } return; } } else if (recallEx.Status == Packet.S2C.Recall.RecallStatus.TeleportStart || recallEx.Status == Packet.S2C.Recall.RecallStatus.TeleportEnd) { if (recall.Recall.Status == Packet.S2C.Recall.RecallStatus.TeleportStart) { recall.Recall2 = recallEx; } var obj = ObjectManager.GetUnitByNetworkId <GameObject>(recallEx.UnitNetworkId); Vector3 pos = obj.Position; for (int i = 0; i < Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorPingTimes") .GetValue <Slider>() .Value; i++) { GamePacket gPacketT; if (Menu.RecallDetector.GetMenuItem("SAwarenessRecallDetectorLocalPing").GetValue <bool>()) { gPacketT = Packet.S2C.Ping.Encoded(new Packet.S2C.Ping.Struct(pos[0], pos[1], 0, 0, Packet.PingType.Danger)); gPacketT.Process(); } else { gPacketT = Packet.C2S.Ping.Encoded(new Packet.C2S.Ping.Struct(pos.X, pos.Y, 0, Packet.PingType.Danger)); //gPacketT.Send(); } } } } }
public PlayerInfo UpdateRecall(Packet.S2C.Recall.Struct newRecall) { Recall = newRecall; return(this); }
public PlayerInfo(Obj_AI_Hero champ) { Champ = champ; Recall = new Packet.S2C.Recall.Struct(champ.NetworkId, Packet.S2C.Recall.RecallStatus.Unknown, Packet.S2C.Recall.ObjectType.Player, 0); IncomingDamage = new Dictionary <int, float>(); }
public static Packet.S2C.Recall.Struct RecallDecode(byte[] data) { BinaryReader binaryReader = new BinaryReader(new MemoryStream(data)); Packet.S2C.Recall.Struct result = default(Packet.S2C.Recall.Struct); binaryReader.ReadByte(); binaryReader.ReadInt32(); result.UnitNetworkId = binaryReader.ReadInt32(); binaryReader.ReadBytes(66); result.Status = Packet.S2C.Recall.RecallStatus.Unknown; bool flag = false; if (BitConverter.ToString(binaryReader.ReadBytes(6)) != "00-00-00-00-00-00") { if (BitConverter.ToString(binaryReader.ReadBytes(3)) != "00-00-00") { result.Status = Packet.S2C.Recall.RecallStatus.TeleportStart; flag = true; } else { result.Status = Packet.S2C.Recall.RecallStatus.RecallStarted; } } binaryReader.Close(); Obj_AI_Hero unitByNetworkId = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(result.UnitNetworkId); if (unitByNetworkId != null) { if (flag) { result.Duration = 3500; } else { result.Duration = ((Program.Map == Utility.Map.MapType.CrystalScar) ? 4500 : 8000); if (unitByNetworkId.Masteries.Any((Mastery x) => x.Page == MasteryPage.Utility && x.Id == 65 && x.Points == 1)) { result.Duration -= ((Program.Map == Utility.Map.MapType.CrystalScar) ? 500 : 1000); } } int num = Environment.TickCount - Game.Ping; if (!Program.RecallT.ContainsKey(result.UnitNetworkId)) { Program.RecallT.Add(result.UnitNetworkId, num); } else { if (Program.RecallT[result.UnitNetworkId] == 0) { Program.RecallT[result.UnitNetworkId] = num; } else { if (num - Program.RecallT[result.UnitNetworkId] > result.Duration - 75) { result.Status = (flag ? Packet.S2C.Recall.RecallStatus.TeleportEnd : Packet.S2C.Recall.RecallStatus.RecallFinished); } else { result.Status = (flag ? Packet.S2C.Recall.RecallStatus.TeleportAbort : Packet.S2C.Recall.RecallStatus.RecallAborted); } Program.RecallT[result.UnitNetworkId] = 0; } } } return(result); }
public EnemyInfo UpdateRecall(Packet.S2C.Recall.Struct newRecall) { Recall = newRecall; return(EnemyInfo); }
public RecallInfo(EnemyInfo enemyInfo) { EnemyInfo = enemyInfo; Recall = new Packet.S2C.Recall.Struct(EnemyInfo.Player.NetworkId, Packet.S2C.Recall.RecallStatus.Unknown, Packet.S2C.Recall.ObjectType.Player, 0); IncomingDamage = new Dictionary <int, float>(); }
public PlayerInfo(Packet.S2C.Recall.Struct recall) { this.recall = recall; }
public static Packet.S2C.Recall.Struct RecallDecode(byte[] data) { BinaryReader reader = new BinaryReader(new MemoryStream(data)); Packet.S2C.Recall.Struct result = new Packet.S2C.Recall.Struct(); reader.ReadByte(); //PacketId reader.ReadBytes(4); result.UnitNetworkId = BitConverter.ToInt32(reader.ReadBytes(4), 0); reader.ReadBytes(66); result.Status = Packet.S2C.Recall.RecallStatus.Unknown; bool teleport = false; if (BitConverter.ToString(reader.ReadBytes(6)) != "00-00-00-00-00-00") { if (BitConverter.ToString(reader.ReadBytes(3)) != "00-00-00") { result.Status = Packet.S2C.Recall.RecallStatus.TeleportStart; teleport = true; } else { result.Status = Packet.S2C.Recall.RecallStatus.RecallStarted; } } reader.Close(); Obj_AI_Hero unit = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(result.UnitNetworkId); result.Duration = 0; if (unit != null) { if (teleport) { result.Duration = 3500; } else //use masteries to detect recall duration, because spelldata is not initialized yet when enemy has not been seen { result.Duration = Program.IsDominion ? 4500 : 8000; foreach (Mastery mastery in unit.Masteries) { if (mastery.Page == MasteryPage.Utility) { if (mastery.Id == 65 && mastery.Points == 1) { result.Duration -= Program.IsDominion ? 500 : 1000; //phasewalker for dominion only 0.5s decrease } } } } if (!Program.RecallT.ContainsKey(result.UnitNetworkId)) { Program.RecallT.Add(result.UnitNetworkId, Environment.TickCount); //will result in status RecallStarted, which would be wrong if the assembly was to be loaded while somebody recalls } else { if (Program.RecallT[result.UnitNetworkId] == 0) { Program.RecallT[result.UnitNetworkId] = Environment.TickCount; } else { if (Environment.TickCount - Program.RecallT[result.UnitNetworkId] > result.Duration - 75) { result.Status = teleport ? Packet.S2C.Recall.RecallStatus.TeleportEnd : Packet.S2C.Recall.RecallStatus.RecallFinished; } else { result.Status = teleport ? Packet.S2C.Recall.RecallStatus.TeleportAbort : Packet.S2C.Recall.RecallStatus.RecallAborted; } Program.RecallT[result.UnitNetworkId] = 0; //recall aborted or finished, reset status } } } return(result); }
public Packet.S2C.Recall.Struct RecallDecode(byte[] data) { var time = Environment.TickCount - Game.Ping; var reader = new BinaryReader(new MemoryStream(data)); var recall = new Packet.S2C.Recall.Struct(); reader.ReadByte(); //PacketId reader.ReadInt32(); recall.UnitNetworkId = reader.ReadInt32(); reader.ReadBytes(66); recall.Status = Packet.S2C.Recall.RecallStatus.Unknown; var teleport = false; if (BitConverter.ToString(reader.ReadBytes(6)) != "00-00-00-00-00-00") { if (BitConverter.ToString(reader.ReadBytes(3)) != "00-00-00") { recall.Status = Packet.S2C.Recall.RecallStatus.TeleportStart; teleport = true; } else { recall.Status = Packet.S2C.Recall.RecallStatus.RecallStarted; } } reader.Close(); var champ = ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(recall.UnitNetworkId); if (champ != null) { if (teleport) { recall.Duration = 3500; } else //use masteries to detect recall duration, because spelldata is not initialized yet when enemy has not been seen { if (Map == Utility.Map.MapType.CrystalScar) { recall.Duration = 4500; } else { recall.Duration = 8000; if (champ.HasBuff("HandOfBaron", true)) { recall.Duration -= 4000; } } if (champ.Masteries.Any(x => x.Page == MasteryPage.Utility && x.Id == 65 && x.Points == 1)) { recall.Duration -= Map == Utility.Map.MapType.CrystalScar ? 500 : 1000; //phasewalker mastery } } if (!RecallT.ContainsKey(recall.UnitNetworkId) || RecallT[recall.UnitNetworkId] == 0) { RecallT[recall.UnitNetworkId] = time; } else { if (time - RecallT[recall.UnitNetworkId] > recall.Duration - 75) { recall.Status = teleport ? Packet.S2C.Recall.RecallStatus.TeleportEnd : Packet.S2C.Recall.RecallStatus.RecallFinished; } else { recall.Status = teleport ? Packet.S2C.Recall.RecallStatus.TeleportAbort : Packet.S2C.Recall.RecallStatus.RecallAborted; } RecallT[recall.UnitNetworkId] = 0; //recall aborted or finished, reset status } } return(recall); }