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; }
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; 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) return recall; 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 = Map == Utility.Map.MapType.CrystalScar ? 4500 : 8000; 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 } var time = Environment.TickCount - Game.Ping; if(!RecallT.ContainsKey(recall.UnitNetworkId)) 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(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; }
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 UpdateRecall(Packet.S2C.Recall.Struct newRecall) { this.Recall = newRecall; return this; }
public PlayerInfo(Obj_AI_Hero champ) { this.Champ = champ; this.Recall = new Packet.S2C.Recall.Struct(champ.NetworkId, Packet.S2C.Recall.RecallStatus.Unknown, Packet.S2C.Recall.ObjectType.Player, 0); this.IncomingDamage = new Dictionary<int, float>(); }