private static void InvokeOnIncomingDamage(InComingDamageEventArgs args) { if (args?.InComingDamage < 1 || args == null) { return; } if (args.DamageType == InComingDamageEventArgs.Type.HeroAttack && !Brain.Utility.Load.menu.SubMenus.FirstOrDefault(m => m.DisplayName.Equals("DamageHandler")).CheckBoxValue("Heros")) { return; } if (args.DamageType == InComingDamageEventArgs.Type.MinionAttack && !Brain.Utility.Load.menu.SubMenus.FirstOrDefault(m => m.DisplayName.Equals("DamageHandler")).CheckBoxValue("Minions")) { return; } if (args.DamageType == InComingDamageEventArgs.Type.TurretAttack && !Brain.Utility.Load.menu.SubMenus.FirstOrDefault(m => m.DisplayName.Equals("DamageHandler")).CheckBoxValue("Turrets")) { return; } OnIncomingDamage?.Invoke( new InComingDamageEventArgs( args.Sender, args.Target, args.InComingDamage * (Brain.Utility.Load.menu.SubMenus.FirstOrDefault(m => m.DisplayName.Equals("DamageHandler")).SliderValue("Mod") * 0.01f), args.DamageType)); }
private static void InvokeOnIncomingDamage(InComingDamageEventArgs args) { if (args?.InComingDamage < 1 || args == null) { return; } //Logger.Send("OnIcomingDamage: [Sender=" + args.Sender.BaseSkinName + "] [Target=" + args.Target.BaseSkinName + "] [ICD=" + args.InComingDamage.ToString("F1") + "] [DamageType=" + args.DamageType + "]"); OnIncomingDamage?.Invoke(new InComingDamageEventArgs(args.Sender, args.Target, args.InComingDamage, args.DamageType)); }
private static void InvokeOnIncomingDamage(InComingDamageEventArgs args) { if (args.DamageType == InComingDamageEventArgs.Type.HeroAttack && !DamageHandler.CheckBoxValue("Heros")) { return; } if (args.DamageType == InComingDamageEventArgs.Type.MinionAttack && !DamageHandler.CheckBoxValue("Minions")) { return; } if (args.DamageType == InComingDamageEventArgs.Type.TurretAttack && !DamageHandler.CheckBoxValue("Turrets")) { return; } if (args.DamageType == InComingDamageEventArgs.Type.SkillShot && !DamageHandler.CheckBoxValue("Skillshots")) { return; } if (args.DamageType == InComingDamageEventArgs.Type.TargetedSpell && !DamageHandler.CheckBoxValue("Targetedspells")) { return; } OnIncomingDamage?.Invoke(new InComingDamageEventArgs(args.Sender, args.Target, args.InComingDamage * (DamageHandler.SliderValue("Mod") * 0.01f), args.DamageType)); }
public static void Init() { Game.OnUpdate += delegate { // Used to Invoke the Incoming Damage Event When there is SkillShot Incoming foreach (var spell in Collision.NewSpells) { foreach (var ally in EntityManager.Heroes.Allies.Where(a => !a.IsDead && a.IsValidTarget() && a.IsInDanger(spell))) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(spell.Caster, ally, spell.Caster.GetSpellDamage(ally, spell.spell.slot), InComingDamageEventArgs.Type.SkillShot)); } } }; SpellsDetector.OnTargetedSpellDetected += delegate(AIHeroClient sender, AIHeroClient target, GameObjectProcessSpellCastEventArgs args, Database.TargetedSpells.TSpell spell) { // Used to Invoke the Incoming Damage Event When there is a TargetedSpell Incoming if (target.IsAlly) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(sender, target, sender.GetSpellDamage(target, spell.slot), InComingDamageEventArgs.Type.TargetedSpell)); } }; Obj_AI_Base.OnBasicAttack += delegate(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { // Used to Invoke the Incoming Damage Event When there is an AutoAttack Incoming var target = args.Target as AIHeroClient; var hero = sender as AIHeroClient; var turret = sender as Obj_AI_Turret; var minion = sender as Obj_AI_Minion; if (target == null || !target.IsAlly) { return; } if (hero != null) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(hero, target, hero.GetAutoAttackDamage(target), InComingDamageEventArgs.Type.HeroAttack)); } if (turret != null) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(turret, target, turret.GetAutoAttackDamage(target), InComingDamageEventArgs.Type.TurretAttack)); } if (minion != null) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(minion, target, minion.GetAutoAttackDamage(target), InComingDamageEventArgs.Type.MinionAttack)); } }; Obj_AI_Base.OnProcessSpellCast += delegate(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { var caster = sender as AIHeroClient; var target = args.Target as AIHeroClient; if (caster == null || target == null || !caster.IsEnemy || !target.IsAlly || args.IsAutoAttack()) { return; } if (!Database.TargetedSpells.TargetedSpellsList.Any(s => s.hero == caster.Hero && s.slot == args.Slot)) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(caster, target, caster.GetSpellDamage(target, args.Slot), InComingDamageEventArgs.Type.TargetedSpell)); } }; }
static Events() { // Invoke the OnGameEnd event #region OnGameEnd // Variable used to make sure that the event invoke isn't spammed and is only called once var gameEndNotified = false; // Every time the game ticks (1ms) Game.OnTick += delegate { // Make sure we're not repeating the invoke if (gameEndNotified) { return; } // Get the enemy nexus var nexus = ObjectManager.Get <Obj_HQ>(); // Check and return if the nexus is null if (nexus == null) { return; } // If the nexus is dead or its health is equal to 0 if (nexus.Any(n => n.IsDead || n.Health.Equals(0))) { // Invoke the event OnGameEnd(EventArgs.Empty); // Set gameEndNotified to true, as the event has been completed gameEndNotified = true; Logger.Send("Game ended!", Logger.LogLevel.Info); } }; Game.OnUpdate += delegate { // Used to Invoke the Incoming Damage Event When there is SkillShot Incoming foreach (var spell in Collision.NewSpells) { foreach (var ally in EntityManager.Heroes.Allies.Where(a => !a.IsDead && a.IsValidTarget() && a.IsInDanger(spell))) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(spell.Caster, ally, spell.Caster.GetSpellDamage(ally, spell.spell.slot), InComingDamageEventArgs.Type.SkillShot)); } } }; SpellsDetector.OnTargetedSpellDetected += delegate(AIHeroClient sender, AIHeroClient target, GameObjectProcessSpellCastEventArgs args, Database.TargetedSpells.TSpell spell) { // Used to Invoke the Incoming Damage Event When there is a TargetedSpell Incoming if (target.IsAlly) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(sender, target, sender.GetSpellDamage(target, spell.slot), InComingDamageEventArgs.Type.TargetedSpell)); } }; Obj_AI_Base.OnBasicAttack += delegate(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { // Used to Invoke the Incoming Damage Event When there is an AutoAttack Incoming var target = args.Target as AIHeroClient; var hero = sender as AIHeroClient; var turret = sender as Obj_AI_Turret; var minion = sender as Obj_AI_Minion; if (target == null || !target.IsAlly) { return; } if (hero != null) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(hero, target, hero.GetAutoAttackDamage(target), InComingDamageEventArgs.Type.HeroAttack)); } if (turret != null) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(turret, target, turret.GetAutoAttackDamage(target), InComingDamageEventArgs.Type.TurretAttack)); } if (minion != null) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(minion, target, minion.GetAutoAttackDamage(target), InComingDamageEventArgs.Type.MinionAttack)); } }; Obj_AI_Base.OnProcessSpellCast += delegate(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { var caster = sender as AIHeroClient; var target = args.Target as AIHeroClient; if (caster == null || target == null || !caster.IsEnemy || !target.IsAlly || args.IsAutoAttack()) { return; } if (!Database.TargetedSpells.TargetedSpellsList.Any(s => s.hero == caster.Hero && s.slot == args.Slot)) { OnIncomingDamage?.Invoke(new InComingDamageEventArgs(caster, target, caster.GetSpellDamage(target, args.Slot), InComingDamageEventArgs.Type.TargetedSpell)); } }; #endregion // Invoke the OnGameStart event #region OnGameStart // When the player object is created Loading.OnLoadingComplete += delegate { if (Player.Instance.IsInShopRange()) { //OnGameStart(EventArgs.Empty); Logger.Send("Game started!", Logger.LogLevel.Info); } }; #endregion }