//nur deklariert, noch nicht initialisiert //konstruktor private Gamedata () { //sicher gehen, dass nur eine instanz erschaffen //aber redundand, weil private -> nur in script änderbar und hier * macht if (instance != null) return; instance = this; Paused = false; //damit zeit AssetModificationProcessor anfang nicht zurückgedreht wird }
internal static void EmulateDamage(Obj_AI_Base sender, Unit hero, Gamedata data, EventType dmgType, string notes = null, float dmgEntry = 0f, int expiry = 500) { var hpred = new HPInstance(); hpred.EventType = dmgType; hpred.Target = hero.Instance; hpred.GameData = data; hpred.Name = string.Empty; if (sender != null) { hpred.Attacker = sender; } if (!string.IsNullOrEmpty(data?.SpellName)) { hpred.Name = data.SpellName; } if (dmgEntry < 1f && sender != null) { switch (dmgType) { case EventType.AutoAttack: hpred.PredictedDmg = (float)Math.Max(sender.GetAutoAttackDamage(hero.Instance), 0); break; case EventType.MinionAttack: case EventType.TurretAttack: hpred.PredictedDmg = (float) Math.Max(sender.CalculateDamage(hero.Instance, DamageType.Physical, sender.BaseAttackDamage + sender.FlatPhysicalDamageMod), 0); break; default: var aiHero = sender as Obj_AI_Hero; if (aiHero != null) { if (!string.IsNullOrEmpty(data?.SpellName)) { hpred.PredictedDmg = (float)Math.Max(aiHero.GetSpellDamage(hero.Instance, data.Slot), 0); } } break; } } else { var idmg = dmgEntry; hpred.PredictedDmg = (float)Math.Round(idmg); } if (hpred.PredictedDmg > 0) { var idmg = hpred.PredictedDmg * ZLib.Menu["weightdmg"].As <MenuSlider>().Value / 100; hpred.PredictedDmg = (float)Math.Round(idmg); } else { var idmg = (hero.Instance.Health / hero.Instance.MaxHealth) * 5; hpred.PredictedDmg = (float)Math.Round(idmg); } if (dmgType != EventType.Buff && dmgType != EventType.Troy) { // check duplicates (missiles and process spell) if (ZLib.DamageCollection.Select(entry => entry.Value).Any(o => data != null && o.Name == data.SpellName)) { return; } } var dmg = AddDamage(hpred, hero, notes); var extendedEndtime = ZLib.Menu["lagtolerance"].As <MenuSlider>().Value * 10; DelayAction.Queue(expiry + extendedEndtime, () => RemoveDamage(dmg, notes)); }
internal static void Obj_AI_Base_OnUnitSpellCast(Obj_AI_Base sender, Obj_AI_BaseMissileClientDataEventArgs args) { var aiHero = sender as Obj_AI_Hero; if (aiHero != null && ZLib.Menu["dumpdata"].As <MenuBool>().Enabled) { var clientdata = new Gamedata { SpellName = args.SpellData.Name.ToLower(), ChampionName = aiHero.UnitSkinName.ToLower(), Slot = args.SpellSlot, Radius = args.SpellData.LineWidth > 0 ? args.SpellData.LineWidth : (args.SpellData.CastRadiusSecondary > 0 ? args.SpellData.CastRadiusSecondary : args.SpellData.CastRadius), CastRange = args.SpellData.CastRange, Delay = 250f, MissileSpeed = (int)args.SpellData.MissileSpeed }; Helpers.ExportSpellData(clientdata, args.SpellData.TargettingType.ToString().ToLower()); } if (Helpers.IsEpicMinion(sender) || Helpers.IsCrab(sender)) { return; } try { #region Hero var attacker = sender as Obj_AI_Hero; if (attacker != null) { foreach (var hero in ZLib.GetUnits()) { #region auto attack if (args.SpellData.Name.ToLower().Contains("attack") && args.Target != null) { if (args.Target.NetworkId == hero.Instance.NetworkId) { double dmg = 0; dmg += (int)Math.Max(attacker.GetAutoAttackDamage(hero.Instance), 0); if (attacker.HasBuffOfType(BuffType.CombatEnchancer)) { dmg += attacker.AmplifyAuto(hero.Instance); } if (args.SpellData.Name.ToLower().Contains("crit")) { dmg = dmg * 2; } EmulateDamage(attacker, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.AutoAttack, "enemy.autoattack", (float)dmg); } } #endregion var data = ZLib.CachedSpells.Find(x => x.SpellName.ToLower() == args.SpellData.Name.ToLower()); if (data == null) { continue; } #region self/selfaoe if (data.CastType == CastType.Proximity) { if (data.Radius < 1f) { data.Radius = args.SpellData.CastRadiusSecondary > 0 ? args.SpellData.CastRadiusSecondary : args.SpellData.CastRadius; } GameObject fromobj = null; if (data.FromObject != null) { fromobj = ObjectManager.Get <GameObject>() .FirstOrDefault( x => data.FromObject != null && // todo: actually get team data.FromObject.Any(y => x.Name.Contains(y))); } var correctpos = fromobj?.Position ?? attacker.ServerPosition; if (hero.Instance.Distance(correctpos) <= data.CastRange + 125) { if (!data.SpellName.Equals("kalistaexpungewrapper") || hero.Instance.HasBuff("kalistaexpungemarker")) { EmulateDamage(attacker, hero, data, EventType.Spell, "spell.proximity"); } } } #endregion #region skillshot line if (data.CastType.ToString().Contains("Linear")) { GameObject fromobj = null; if (data.FromObject != null) { fromobj = ObjectManager.Get <GameObject>() .FirstOrDefault( x => data.FromObject != null && // todo: actually get team data.FromObject.Any(y => x.Name.Contains(y))); } if (args.SpellData.LineWidth > 0 && data.Radius < 1f) { data.Radius = args.SpellData.LineWidth; } var startpos = fromobj?.Position ?? attacker.ServerPosition; if (hero.Instance.Distance(startpos) > data.CastRange + 35) { continue; } if ((data.SpellName == "azirq" || data.SpellName == "azire") && fromobj == null) { continue; } var distance = (int) (1000 * (startpos.Distance(hero.Instance.ServerPosition) / data.MissileSpeed)); var endtime = data.Delay + distance - Game.Ping / 2f; var direction = (args.End.To2D() - startpos.To2D()).Normalized(); var endpos = startpos.To2D() + direction * startpos.To2D().Distance(args.End.To2D()); if (startpos.To2D().Distance(endpos) > data.CastRange) { endpos = startpos.To2D() + direction * data.CastRange; } if (startpos.To2D().Distance(endpos) < data.CastRange && data.FixedRange) { endpos = startpos.To2D() + direction * data.CastRange; } if (data.IsPerpindicular) { startpos = (endpos - direction.Perpendicular() * data.CastRange).To3D(); endpos = endpos + direction.Perpendicular() * data.CastRange; } var proj = hero.Instance.ServerPosition.To2D().ProjectOn(startpos.To2D(), endpos); var projdist = hero.Instance.ServerPosition.To2D().Distance(proj.SegmentPoint); var evadetime = (int)(1000 * (data.Radius - projdist + hero.Instance.BoundingRadius) / hero.Instance.MoveSpeed); if (proj.IsOnSegment && projdist <= data.Radius + hero.Instance.BoundingRadius + 35) { if (data.CastRange > 9000 || data.Global) { if (hero.Instance.NetworkId == Player.NetworkId) { if (evadetime < endtime) { continue; } } } if (data.CastType == CastType.LinearAoE || data.CastType == CastType.MissileLinearAoE) { if (hero.Instance.Distance(endpos) <= hero.Instance.BoundingRadius + 235) { EmulateDamage(attacker, hero, data, EventType.Spell, "spell.linear.explosion"); } } EmulateDamage(attacker, hero, data, EventType.Spell, "spell.linear", 0f, (int)endtime); } } #endregion #region skillshot circle/cone if (data.CastType == CastType.Circlular || data.CastType == CastType.Sector) { GameObject fromobj = null; if (data.FromObject != null) { fromobj = ObjectManager.Get <GameObject>() .FirstOrDefault( x => data.FromObject != null && // todo: actually get team data.FromObject.Any(y => x.Name.Contains(y))); } if (data.Radius < 1f) { data.Radius = args.SpellData.CastRadiusSecondary > 0 ? args.SpellData.CastRadiusSecondary : args.SpellData.CastRadius; } var startpos = fromobj?.Position ?? attacker.ServerPosition; if (hero.Instance.Distance(startpos) > data.CastRange + 35) { continue; } if ((data.SpellName == "azirq" || data.SpellName == "azire") && fromobj == null) { continue; } var distance = (int)(1000 * (startpos.Distance(hero.Instance.ServerPosition) / data.MissileSpeed)); var endtime = data.Delay + distance - Game.Ping / 2f; var direction = (args.End.To2D() - startpos.To2D()).Normalized(); var endpos = startpos.To2D() + direction * startpos.To2D().Distance(args.End.To2D()); if (startpos.To2D().Distance(endpos) > data.CastRange) { endpos = startpos.To2D() + direction * data.CastRange; } var evadetime = (int)(1000 * (data.Radius - hero.Instance.Distance(startpos) + hero.Instance.BoundingRadius) / hero.Instance.MoveSpeed); if (hero.Instance.Distance(endpos) <= data.Radius + hero.Instance.BoundingRadius + 35) { if (evadetime > endtime) { EmulateDamage(attacker, hero, data, EventType.Spell, "spell.circular", 0f, (int)endtime); } } } #endregion #region unit type if (data.CastType == CastType.Targeted) { if (args.Target == null) { continue; } if (hero.Instance.NetworkId == args.Target.NetworkId) { if (hero.Instance.Distance(attacker.ServerPosition) <= data.CastRange + 100) { var distance = (int)(1000 * (attacker.Distance(hero.Instance.ServerPosition) / data.MissileSpeed)); var endtime = data.Delay + distance - Game.Ping / 2f; EmulateDamage(attacker, hero, data, EventType.Spell, "spell.targeted", 0f, (int)endtime); } } } #endregion } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.Hero"); Console.WriteLine(e); } } try { #region Turret var turret = sender as Obj_AI_Turret; if (turret != null && !turret.IsDead && args.Target != null) { foreach (var hero in ZLib.GetUnits()) { if (args.Target.NetworkId == hero.Instance.NetworkId) { if (turret.Distance(hero.Instance.ServerPosition) <= 900 && Player.Distance(hero.Instance.ServerPosition) <= 1000) { EmulateDamage(turret, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.TurretAttack, "enemy.turret"); } } } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.Turret"); Console.WriteLine(e); } } try { #region Minion var minion = sender as Obj_AI_Minion; if (minion != null && !minion.IsDead && args.Target != null) { foreach (var hero in ZLib.GetUnits()) { if (hero.Instance.NetworkId == args.Target.NetworkId) { if (hero.Instance.Distance(minion.ServerPosition) <= 750 && Player.Distance(hero.Instance.ServerPosition) <= 1000) { EmulateDamage(minion, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.MinionAttack, "enemy.minion"); } } } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.Minion"); Console.WriteLine(e); } } try { #region Gangplank Barrel var attacker = sender as Obj_AI_Hero; if (attacker != null && attacker.ChampionName.Equals("Gangplank")) { var data = ZLib.CachedSpells.Find(x => x.SpellName.ToLower() == "gangplanke"); if (data != null) { foreach (var hero in ZLib.GetUnits()) { var gplist = new List <Obj_AI_Minion>(); gplist.AddRange(ObjectManager.Get <Obj_AI_Minion>() .Where( x => x.UnitSkinName.ToLower() == "gangplankbarrel" && x.Position.Distance(x.Position) <= 375 && x.IsFloatingHealthBarActive) .OrderBy(y => y.Position.Distance(hero.Instance.ServerPosition))); foreach (var obj in gplist) { if (hero.Instance.Distance(obj.Position) <= 375 && args.Target.Name == "Barrel") { var dmg = (float)Math.Abs(attacker.GetAutoAttackDamage(hero.Instance) * 1.2 + 150); if (args.SpellData.Name.ToLower().Contains("crit")) { dmg = dmg * 2; } EmulateDamage(attacker, hero, data, EventType.Spell, "enemy.gankplankbarrel", dmg); } } } } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.GangplankBarrel"); Console.WriteLine(e); } } try { #region Items var attacker = sender as Obj_AI_Hero; if (attacker != null && attacker.IsValid) { if (args.SpellData.TargettingType == 1 && args.Target != null) { foreach (var hero in ZLib.GetUnits()) { if (args.Target.NetworkId != hero.Instance.NetworkId) { continue; } // todo: item damage if (args.SpellData.Name.ToLower() == "bilgewatercutlass") { var dmg = (float)0; EmulateDamage(attacker, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.Item, "enemy.itemcast", dmg); } if (args.SpellData.Name.ToLower() == "itemswordoffeastandfamine") { var dmg = (float)0; EmulateDamage(attacker, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.Item, "enemy.itemcast", dmg); } if (args.SpellData.Name.ToLower() == "hextechgunblade") { var dmg = (float)0; EmulateDamage(attacker, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.Item, "enemy.itemcast", dmg); } } } // todo: if (args.SpellData.TargettingType == 0) { foreach (var hero in ZLib.GetUnits()) { if (args.SpellData.Name.ToLower() == "itemtiamatcleave") { if (attacker.Distance(hero.Instance.ServerPosition) <= 375) { var dmg = (float)0; EmulateDamage(attacker, hero, new Gamedata { SpellName = args.SpellData.Name }, EventType.Item, "enemy.itemcast", dmg); } } } } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.Items"); Console.WriteLine(e); } } try { #region LucianQ if (args.SpellData.Name.ToLower() == "lucianq") { var data = ZLib.CachedSpells.Find(x => x.SpellName.ToLower() == "lucianq"); if (data != null) { foreach (var hero in ZLib.GetUnits()) { var delay = ((350 - Game.Ping) / 1000f); var herodir = (hero.Instance.ServerPosition - hero.Instance.Position).Normalized(); var expectedpos = args.Target.Position + herodir * hero.Instance.MoveSpeed * (delay); if (args.Start.Distance(expectedpos) < 1100) { expectedpos = args.Target.Position + (args.Target.Position - sender.ServerPosition).Normalized() * 800; } var proj = hero.Instance.ServerPosition.To2D().ProjectOn(args.Start.To2D(), expectedpos.To2D()); var projdist = hero.Instance.ServerPosition.To2D().Distance(proj.SegmentPoint); if (100 + hero.Instance.BoundingRadius > projdist) { EmulateDamage(sender, hero, data, EventType.Spell, "enemy.lucianq"); } } } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.LucianQ"); Console.WriteLine(e); } } }
internal static void MissileClient_OnSpellMissileCreate(GameObject sender) { try { #region FoW / Missile if (sender.Type != GameObjectType.MissileClient) { return; } var missile = (MissileClient)sender; if (missile.SpellCaster is Obj_AI_Hero && missile.SpellCaster?.Team != Player.Team) { var startPos = missile.StartPosition.To2D(); var endPos = missile.EndPosition.To2D(); var data = Gamedata.GetByMissileName(missile.SpellData.Name.ToLower()); if (data == null) { return; } if (data.Radius < 1f) { data.Radius = missile.SpellData.LineWidth; } var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > data.CastRange) { endPos = startPos + direction * data.CastRange; } if (startPos.Distance(endPos) < data.CastRange && data.FixedRange) { endPos = startPos + direction * data.CastRange; } foreach (var hero in ZLib.GetUnits()) { var distance = (1000 * (startPos.Distance(hero.Instance.ServerPosition) / data.MissileSpeed)); var endtime = -100 + Game.Ping / 2 + distance; // setup projection var proj = hero.Instance.ServerPosition.To2D().ProjectOn(startPos, endPos); var projdist = hero.Instance.ServerPosition.To2D().Distance(proj.SegmentPoint); // get the evade time var evadetime = (int)(1000 * (data.Radius - projdist + hero.Instance.BoundingRadius) / hero.Instance.MoveSpeed); // check if hero on segment if (proj.IsOnSegment && projdist <= data.Radius + hero.Instance.BoundingRadius + 35) { if (data.CastRange > 10000) { // ignore if can evade if (hero.Instance.NetworkId == Player.NetworkId) { if (evadetime < endtime) { // check next player continue; } } } EmulateDamage(missile.SpellCaster, hero, data, EventType.Spell, "missile.oncreate", 0f, (int)endtime); } } } #endregion } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Projections.Missile"); Console.WriteLine(e); } } }
private static void MissileClient_OnSpellMissileCreate(GameObject sender, EventArgs args) { #region FoW / Missile if (!sender.IsValid <MissileClient>()) { return; } var missile = (MissileClient)sender; if (missile.SpellCaster is Obj_AI_Hero && missile.SpellCaster?.Team != Player.Team) { var startPos = missile.StartPosition.To2D(); var endPos = missile.EndPosition.To2D(); var data = Gamedata.GetByMissileName(missile.SData.Name.ToLower()); if (data == null) { return; } // set line width if (data.Radius == 0f) { data.Radius = missile.SData.LineWidth; } var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > data.CastRange) { endPos = startPos + direction * data.CastRange; } if (startPos.Distance(endPos) < data.CastRange && data.FixedRange) { endPos = startPos + direction * data.CastRange; } foreach (var hero in Activator.Allies()) { // reset if needed Helpers.ResetIncomeDamage(hero.Player); var distance = (1000 * (startPos.Distance(hero.Player.ServerPosition) / data.MissileSpeed)); var endtime = -100 + Game.Ping / 2 + distance; // setup projection var proj = hero.Player.ServerPosition.To2D().ProjectOn(startPos, endPos); var projdist = hero.Player.ServerPosition.To2D().Distance(proj.SegmentPoint); // get the evade time var evadetime = (int)(1000 * (data.Radius - projdist + hero.Player.BoundingRadius) / hero.Player.MoveSpeed); // check if hero on segment if (data.Radius + hero.Player.BoundingRadius + 35 <= projdist) { continue; } if (data.CastRange > 10000) { // ignore if can evade if (hero.Player.NetworkId == Player.NetworkId) { if (hero.Player.CanMove && evadetime < endtime) { // check next player continue; } } } if (Activator.Origin.Item(data.SDataName + "predict").GetValue <bool>()) { Utility.DelayAction.Add(100, () => { hero.Attacker = missile.SpellCaster; hero.IncomeDamage += 1; hero.HitTypes.Add(HitType.Spell); hero.HitTypes.AddRange( Lists.MenuTypes.Where( x => Activator.Origin.Item(data.SDataName + x.ToString().ToLower()) .GetValue <bool>())); Utility.DelayAction.Add((int)endtime * 2 + (200 - Game.Ping), () => { hero.Attacker = null; hero.IncomeDamage -= 1; hero.HitTypes.RemoveAll( x => !x.Equals(HitType.Spell) && Activator.Origin.Item(data.SDataName + x.ToString().ToLower()) .GetValue <bool>()); hero.HitTypes.Remove(HitType.Spell); }); }); } } } #endregion }
internal static void OnUpdate() { try { foreach (var unit in ZLib.GetUnits()) { var troy = Gametroy.Troys.Find(x => x.Included); if (troy == null) { continue; } if (!troy.Obj.IsVisible || !troy.Obj.IsValid) { continue; } foreach (var entry in ZLib.TroyList.Where(x => x.Name.ToLower() == troy.Name.ToLower())) { var owner = ZLib.GetUnits().FirstOrDefault(x => x.HeroNameMatch(entry.ChampionName)); if (owner == null || owner.Instance == null) { continue; } if (owner.Instance.NetworkId == unit.Instance.NetworkId) { continue; } Gamedata data = null; if (entry.ChampionName == null && entry.Slot == SpellSlot.Unknown) { data = new Gamedata { SpellName = troy.Obj.Name } } ; if (entry.ChampionName != null && entry.Slot != SpellSlot.Unknown) { data = ZLib.CachedSpells.Where(x => x.Slot == entry.Slot) .FirstOrDefault(x => x.HeroNameMatch(entry.ChampionName)); if (data != null) { data.EventTypes = entry.EventTypes; } } if (unit.Instance.Distance(troy.Obj.Position) <= entry.Radius + unit.Instance.BoundingRadius) { // check delay (e.g fizz bait) if ((int)(Game.ClockTime * 1000) - troy.Start >= entry.DelayFromStart) { // limit the damage using an interval if ((int)(Game.ClockTime * 1000) - troy.Limiter >= entry.Interval * 1000) { Projections.EmulateDamage(owner.Instance, unit, data, EventType.Troy, "troy.onupdate"); troy.Limiter = (int)(Game.ClockTime * 1000); } } } } } } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.Gametroys.OnUpdate"); Console.WriteLine(e); } } }
public static void EmulateDamage(Obj_AI_Base sender, Base.Champion hero, Gamedata data, HitType dmgType, string notes = null, float dmgEntry = 0f, int expiry = 500) { var hpred = new HPInstance(); hpred.HitType = dmgType; hpred.TargetHero = hero.Player; hpred.Data = data; hpred.Name = string.Empty; if (!string.IsNullOrEmpty(data?.SDataName)) { hpred.Name = data.SDataName; } if (sender is AIHeroClient) { hpred.Attacker = sender; } if (dmgEntry == 0f && sender != null) { switch (dmgType) { case HitType.AutoAttack: hpred.PredictedDmg = (float)sender.GetAutoAttackDamage(hero.Player, true); break; case HitType.MinionAttack: case HitType.TurretAttack: hpred.PredictedDmg = (float) Math.Max( sender.CalcDamage(hero.Player, Damage.DamageType.Physical, sender.BaseAttackDamage + sender.FlatPhysicalDamageMod), 0); break; default: if (!string.IsNullOrEmpty(data?.SDataName)) { hpred.PredictedDmg = (float)Math.Max(0, sender.GetSpellDamage(hero.Player, data.SDataName)); } break; } } else { var idmg = dmgEntry; hpred.PredictedDmg = (float)Math.Round(idmg); } if (hpred.PredictedDmg > 0) { var idmg = hpred.PredictedDmg * Activator.Origin.Item("weightdmg").GetValue <Slider>().Value / 100; hpred.PredictedDmg = (float)Math.Round(idmg); } else { var idmg = (hero.Player.Health / hero.Player.MaxHealth) * 5; hpred.PredictedDmg = (float)Math.Round(idmg); } if (dmgType != HitType.Buff && dmgType != HitType.Troy) { // check duplicates (missiles and process spell) if (IncomeDamage.Select(entry => entry.Value).Any(o => o.Name == data.SDataName)) { return; } } var dmg = AddDamage(hpred, hero, notes); var extendedEndtime = Activator.Origin.Item("lagtolerance").GetValue <Slider>().Value * 10; LeagueSharp.Common.Utility.DelayAction.Add(expiry + extendedEndtime, () => RemoveDamage(dmg, notes)); }
private static void Obj_AI_Base_OnUnitSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { var aiHero = sender as AIHeroClient; if (aiHero != null && Activator.Origin.Item("dumpdata").GetValue <bool>()) { var clientdata = new Gamedata { SDataName = args.SData.Name.ToLower(), ChampionName = aiHero.BaseSkinName.ToLower(), Slot = args.Slot, Radius = args.SData.LineWidth > 0 ? args.SData.LineWidth : (args.SData.CastRadiusSecondary > 0 ? args.SData.CastRadiusSecondary : args.SData.CastRadius), CastRange = args.SData.CastRange, Delay = 250f, MissileSpeed = (int)args.SData.MissileSpeed }; Helpers.ExportSpellData(clientdata, args.SData.TargettingType.ToString().ToLower()); } if (Helpers.IsEpicMinion(sender) || Helpers.IsCrab(sender)) { return; } #region Hero if (sender.IsEnemy && sender is AIHeroClient) { var attacker = (AIHeroClient)sender; if (attacker.IsValid <AIHeroClient>()) { foreach (var hero in Activator.Allies()) { #region auto attack if (args.SData.Name.ToLower().Contains("attack") && args.Target != null) { if (args.Target.NetworkId == hero.Player.NetworkId) { float dmg = 0; dmg += (int)Math.Max(attacker.GetAutoAttackDamage(hero.Player, true), 0); if (attacker.HasBuff("sheen")) { dmg += (int)Math.Max(attacker.GetAutoAttackDamage(hero.Player, true) + attacker.GetCustomDamage("sheen", hero.Player), 0); } if (attacker.HasBuff("lichbane")) { dmg += (int)Math.Max(attacker.GetAutoAttackDamage(hero.Player, true) + attacker.GetCustomDamage("lichbane", hero.Player), 0); } if (attacker.HasBuff("itemstatikshankcharge") && attacker.GetBuff("itemstatikshankcharge").Count == 100) { dmg += new[] { 62, 120, 200, 200 } }
private static void MissileClient_OnSpellMissileCreate(GameObject sender, EventArgs args) { #region FoW / Missile if (!sender.IsValid <MissileClient>()) { return; } var missile = (MissileClient)sender; if (missile.SpellCaster is AIHeroClient && missile.SpellCaster?.Team != Player.Team) { var startPos = missile.StartPosition.To2D(); var endPos = missile.EndPosition.To2D(); var data = Gamedata.GetByMissileName(missile.SData.Name.ToLower()); if (data == null) { return; } // set line width if (data.Radius == 0f) { data.Radius = missile.SData.LineWidth; } var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > data.CastRange) { endPos = startPos + direction * data.CastRange; } if (startPos.Distance(endPos) < data.CastRange && data.FixedRange) { endPos = startPos + direction * data.CastRange; } foreach (var hero in Activator.Allies()) { var distance = (1000 * (startPos.Distance(hero.Player.ServerPosition) / data.MissileSpeed)); var endtime = -100 + Game.Ping / 2 + distance; // setup projection var proj = hero.Player.ServerPosition.To2D().ProjectOn(startPos, endPos); var projdist = hero.Player.ServerPosition.To2D().Distance(proj.SegmentPoint); // get the evade time var evadetime = (int)(1000 * (data.Radius - projdist + hero.Player.BoundingRadius) / hero.Player.MoveSpeed); // check if hero on segment if (proj.IsOnSegment && projdist <= data.Radius + hero.Player.BoundingRadius + 35) { if (data.CastRange > 10000) { // ignore if can evade if (hero.Player.NetworkId == Player.NetworkId) { if (evadetime < endtime) { // check next player continue; } } } if (Activator.Origin.Item(data.SDataName + "predict").GetValue <bool>()) { EmulateDamage(missile.SpellCaster, hero, data, HitType.Spell, "missile.OnCreate", 0f, (int)endtime); } } } } #endregion }
private static void OnEnemyBuffUpdate(EventArgs args) { foreach (var enemy in Activator.Heroes) { if (!enemy.Player.IsEnemy) { continue; } var aura = Auradata.CachedAuras.Find(au => enemy.Player.HasBuff(au.Name)); if (aura == null) { continue; } Gamedata data = null; if (aura.Champion == null && aura.Slot == SpellSlot.Unknown) { data = new Gamedata { SDataName = aura.Name } } ; if (aura.Champion != null && aura.Slot != SpellSlot.Unknown) { data = Gamedata.CachedSpells.Where(x => x.Slot == aura.Slot).Find(x => x.HeroNameMatch(aura.Champion)); } if (aura.Reverse && aura.DoT) { if (Utils.GameTimeTickCount - aura.TickLimiter >= aura.Interval * 1000) { foreach (var ally in Activator.Allies()) { if (ally.Player.Distance(enemy.Player) <= aura.Radius + 35) { Projections.EmulateDamage(enemy.Player, ally, data, HitType.Buff, "aura.DoT"); } } aura.TickLimiter = Utils.GameTimeTickCount; } } if (aura.Reverse && aura.Evade) { if (Utils.GameTimeTickCount - aura.TickLimiter >= 100) { foreach (var ally in Activator.Allies()) { if (ally.Player.Distance(enemy.Player) <= aura.Radius + 35) { Projections.EmulateDamage(enemy.Player, ally, data, HitType.Buff, "aura.Evade"); } } aura.TickLimiter = Utils.GameTimeTickCount; } } } }
static void Game_OnUpdate(EventArgs args) { foreach (var hero in Activator.Allies()) { var aura = Auradata.CachedAuras.Find(au => hero.Player.HasBuff(au.Name)); if (aura == null) { continue; } if (aura.Reverse) { continue; } if (aura.Cleanse) { Utility.DelayAction.Add(aura.CleanseTimer, () => { // double check after delay incase we no longer have the buff if (hero.Player.HasBuff(aura.Name) && hero.Player.IsValidTarget(float.MaxValue, false)) { hero.ForceQSS = true; Utility.DelayAction.Add(100, () => hero.ForceQSS = false); } }); } var owner = hero.Player.GetBuff(aura.Name).Caster as Obj_AI_Hero; if (owner == null || !owner.IsEnemy) { continue; } Gamedata data = null; if (aura.Champion == null && aura.Slot == SpellSlot.Unknown) { data = new Gamedata { SDataName = aura.Name } } ; if (aura.Champion != null && aura.Slot != SpellSlot.Unknown) { data = Gamedata.CachedSpells.Where(x => x.Slot == aura.Slot).Find(x => x.HeroNameMatch(aura.Champion)); } if (aura.Evade) { Utility.DelayAction.Add(aura.EvadeTimer, () => { // double check after delay incase we no longer have the buff if (hero.Player.HasBuff(aura.Name)) { if (Utils.GameTimeTickCount - aura.TickLimiter >= 250) { // ReSharper disable once PossibleNullReferenceException Projections.EmulateDamage(owner, hero, data, HitType.Buff, "aura.Evade"); aura.TickLimiter = Utils.GameTimeTickCount; } } }); } if (aura.DoT) { if (Utils.GameTimeTickCount - aura.TickLimiter >= aura.Interval * 1000) { if (aura.Name == "velkozresearchstack" && !hero.Player.HasBuffOfType(BuffType.Slow)) { continue; } // ReSharper disable once PossibleNullReferenceException Projections.EmulateDamage(owner, hero, data, HitType.Buff, "aura.DoT"); aura.TickLimiter = Utils.GameTimeTickCount; } } } }
static void Game_OnUpdate(EventArgs args) { foreach (var hero in Activator.Allies()) { var troy = Gametroy.Troys.FirstOrDefault(x => x.Included); if (troy == null) { continue; } if (!troy.Obj.IsVisible || !troy.Obj.IsValid) { continue; } foreach (var entry in Troydata.Troys.Where(x => x.Name.ToLower() == troy.Name.ToLower())) { var owner = Activator.Heroes.FirstOrDefault(x => x.Player.ChampionName.ToLower() == entry.ChampionName.ToLower()); if (owner == null || !owner.Player.IsEnemy) { continue; } Gamedata data = null; if (entry.ChampionName == null && entry.Slot == SpellSlot.Unknown) { data = new Gamedata { SDataName = troy.Obj.Name } } ; if (entry.ChampionName != null && entry.Slot != SpellSlot.Unknown) { data = Gamedata.CachedSpells.Find(x => x.ChampionName.ToLower() == entry.ChampionName.ToLower()); } if (hero.Player.Distance(troy.Obj.Position) <= entry.Radius + hero.Player.BoundingRadius) { // check delay (e.g fizz bait) if (Utils.GameTimeTickCount - troy.Start >= entry.DelayFromStart) { if (hero.Player.IsValidTarget(float.MaxValue, false)) { if (!hero.Player.IsZombie && !hero.Immunity) { // limit the damage using an interval if (Utils.GameTimeTickCount - troy.Limiter >= entry.Interval * 1000) { Projections.PredictTheDamage(owner.Player, hero, data, HitType.Troy, "troy.OnUpdate"); troy.Limiter = Utils.GameTimeTickCount; } } } } } } } } }
/// <summary> /// Emulates the damage. /// </summary> /// <param name="sender">The sender.</param> /// <param name="hero">The hero.</param> /// <param name="data">The data.</param> /// <param name="dmgType">Type of the damage.</param> /// <param name="notes">The notes.</param> /// <param name="dmgEntry">The damage ammount.</param> /// <param name="expiry">The time of expiry.</param> public static void EmulateDamage(Obj_AI_Base sender, Unit hero, Gamedata data, EventType dmgType, string notes = null, float dmgEntry = 0f, int expiry = 500) { Projections.EmulateDamage(sender, hero, data, dmgType, notes, dmgEntry, expiry); }
private static void OnBuffProximity() { try { foreach (var unit in ZLib.GetUnits()) { if (unit.Instance == null || !unit.Instance.IsValidTarget(float.MaxValue, true)) { continue; } var aura = ZLib.CachedAuras.Find(au => unit.Instance.HasBuff(au.Name)); if (aura == null) { continue; } var owner = GetBuffCaster(unit, aura.Name); if (owner == null || unit.Instance.NetworkId == owner.NetworkId) { continue; } Gamedata data = null; if (aura.Champion == null && aura.Slot == SpellSlot.Unknown) { data = new Gamedata { SpellName = aura.Name } } ; if (aura.Champion != null && aura.Slot != SpellSlot.Unknown) { data = ZLib.CachedSpells .Where(x => x.Slot == aura.Slot).FirstOrDefault(x => x.HeroNameMatch(aura.Champion)); } if (aura.Reverse && aura.DoT) { if ((int)(Game.ClockTime * 1000) - aura.TickLimiter >= aura.Interval * 1000) { foreach (var ally in ZLib.GetUnits()) { if (ally.Instance.Distance(unit.Instance) <= aura.Radius + 35) { Projections.EmulateDamage(owner, ally, data, EventType.Buff, "aura.dot"); } } aura.TickLimiter = (int)(Game.ClockTime * 1000); } } if (aura.Reverse && aura.Evade) { if ((int)(Game.ClockTime * 1000) - aura.TickLimiter >= 100) { foreach (var ally in ZLib.GetUnits()) { if (ally.Instance.Distance(unit.Instance) <= aura.Radius + 35) { Projections.EmulateDamage(owner, ally, data, EventType.Buff, "aura.evade"); } } aura.TickLimiter = (int)(Game.ClockTime * 1000); } } } } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.OnBuffSurrounding"); Console.WriteLine(e); } } }
private static void OnBuffUpdate() { try { foreach (var hero in ZLib.GetUnits()) { if (hero.Instance == null || !hero.Instance.IsValidTarget(float.MaxValue, true)) { continue; } var aura = ZLib.CachedAuras.Find(au => hero.Instance.HasBuff(au.Name)); if (aura == null) { continue; } var owner = GetBuffCaster(hero, aura.Name); if (owner == null || owner.NetworkId == hero.Instance.NetworkId) { continue; } if (aura.Reverse) { continue; } var data = new Gamedata(); if (aura.Champion == null && aura.Slot == SpellSlot.Unknown) { data = new Gamedata { SpellName = aura.Name } } ; if (aura.Champion != null && aura.Slot != SpellSlot.Unknown) { data = ZLib.CachedSpells.Where(x => x.Slot == aura.Slot) .FirstOrDefault(x => x.HeroNameMatch(aura.Champion)); } if (aura.Evade) { DelayAction.Queue(aura.EvadeTimer, () => { // double check after delay incase we no longer have the buff if (hero.Instance.HasBuff(aura.Name)) { if ((int)(Game.ClockTime * 1000) - aura.TickLimiter >= 250) { Projections.EmulateDamage(owner, hero, data, EventType.Buff, "aura.evade"); aura.TickLimiter = (int)(Game.ClockTime * 1000); } } }); } if (aura.DoT) { if ((int)(Game.ClockTime * 1000) - aura.TickLimiter >= aura.Interval * 1000) { if (aura.Name == "velkozresearchstack" && !hero.Instance.HasBuffOfType(BuffType.Slow)) { continue; } // ReSharper disable once PossibleNullReferenceException Projections.EmulateDamage(owner, hero, data, EventType.Buff, "aura.dot"); aura.TickLimiter = (int)(Game.ClockTime * 1000); } } } } catch (Exception e) { if (ZLib.Menu["logerror"].As <MenuBool>().Enabled) { Console.WriteLine("== Error at: ZLib.OnBuffUpdate"); Console.WriteLine(e); } } }