Beispiel #1
0
        public static void Init()
        {
            // Clears and adds new HealthRelics and bardhealthshrines.
            HealthRelics.Clear();
            foreach (var hr in ObjectManager.Get <GameObject>().Where(o => o != null && o.Name.ToLower().Contains("healthrelic") && o.IsValid && !o.IsDead))
            {
                var validrelic = ObjectManager.GetUnitByNetworkId <Obj_AI_Base>((uint)hr.NetworkId)?.PredictHealth() > 0;
                if (validrelic)
                {
                    HealthRelics.Add(hr);
                }
            }

            // Clears and adds new EnemyTraps.
            EnemyTraps.Clear();
            foreach (var trap in ObjectManager.Get <Obj_AI_Minion>().Where(trap => trap.IsEnemy && !trap.IsDead && trap.IsValid))
            {
                if (TrapsNames.Contains(trap.Name))
                {
                    var ttrap = new traps {
                        Trap = trap, IsSpecial = false
                    };
                    EnemyTraps.Add(ttrap);
                } /*
                   * if (SpecialTrapsNames.Contains(trap.Name))
                   * {
                   * var ttrap = new traps { Trap = trap, IsSpecial = true };
                   * EnemyTraps.Add(ttrap);
                   * }*/
            }

            var lastupdate = 0f;

            Game.OnTick += delegate
            {
                if (Core.GameTickCount - lastupdate > Misc.ProtectFPS + 200)
                {
                    foreach (var bardhs in ObjectManager.Get <GameObject>()
                             .Where(o => o.Name.Equals("bardhealthshrine", StringComparison.CurrentCultureIgnoreCase) && o.IsAlly && o.IsValid && !o.IsDead && !HealthRelics.Contains(o)))
                    {
                        HealthRelics.Add(bardhs);
                        if (Config.EnableDebug)
                        {
                            Logger.Send("Added " + bardhs.Name);
                        }
                    }

                    // Removes HealthRelics and Enemy Traps.
                    HealthRelics.RemoveAll(h => h == null || !h.IsValid || h.IsDead || EntityManager.Heroes.AllHeroes.Any(a => a.IsValidTarget() && a.Distance(h) <= a.BoundingRadius + h.BoundingRadius));
                    EnemyTraps.RemoveAll(t => t.Trap == null || !t.Trap.IsValid || t.Trap.IsDead || EntityManager.Heroes.Allies.Any(a => a.IsValidTarget() && a.Distance(t.Trap) <= a.BoundingRadius + t.Trap.BoundingRadius));
                    lastupdate = Core.GameTickCount;
                    ZacPassives.RemoveAll(p => p.IsDead || !p.IsValid);
                }
            };

            GameObject.OnCreate += GameObject_OnCreate;
            GameObject.OnDelete += GameObject_OnDelete;
        }
Beispiel #2
0
        /// <summary>
        ///     Checks if healthrelic or traps are created and add them to the list.
        /// </summary>
        public static void GameObject_OnCreate(GameObject sender, EventArgs args)
        {
            var @base = sender as Obj_AI_Base;

            if (@base != null && @base.BaseSkinName.Equals("OlafAxe") || sender.Name.Contains("Olaf_Base_Q_Axe_Ally"))
            {
                OlafAxeObject = new Objects.OlafAxe(sender);
            }

            if (sender.Name.Contains("Draven_Base_Q_reticle_self"))
            {
                if (!DravenAxes.Any(a => a.Axe.IdEquals(sender)))
                {
                    DravenAxes.Add(new Objects.DravenAxe(sender));
                }
            }

            if (sender.GetType() == typeof(Obj_GeneralParticleEmitter))
            {
                var gameObject = (Obj_GeneralParticleEmitter)sender;
                if (ZacPassiveNames.Contains(gameObject.Name) && !ZacPassives.Contains(gameObject) && Player.Instance.Hero == Champion.Zac)
                {
                    ZacPassives.Add(gameObject);
                    Logger.Send("Create " + gameObject.Name);
                }
            }

            var caster = sender as Obj_AI_Base;

            if (caster != null)
            {
                if (TrapsNames.Contains(sender.Name) && sender.IsEnemy)
                {
                    var trap = new traps {
                        Trap = caster, IsSpecial = false
                    };
                    EnemyTraps.Add(trap);
                    Logger.Send("Create " + sender.Name);
                } /*
                   * if (SpecialTrapsNames.Contains(caster.Name) && caster.IsEnemy)
                   * {
                   * var trap = new traps { Trap = caster, IsSpecial = true };
                   * EnemyTraps.Add(trap);
                   * Logger.Send("Create " + sender.Name);
                   * }*/
            }
            if (sender.Name.ToLower().Contains("healthrelic"))
            {
                HealthRelics.Add(sender);
                Logger.Send("Create " + sender.Name);
            }
        }
Beispiel #3
0
        /// <summary>
        ///     Checks if healthrelic or traps are deleted and remove them from the list.
        /// </summary>
        public static void GameObject_OnDelete(GameObject sender, EventArgs args)
        {
            var @base = sender as Obj_AI_Base;

            if (@base != null && @base.BaseSkinName.Equals("OlafAxe") || sender.Name.Contains("Olaf_Base_Q_Axe_Ally"))
            {
                OlafAxeObject = null;
            }

            if (sender.Name.Contains("Draven_Base_Q_reticle_self"))
            {
                if (DravenAxes.Any(a => a.Axe.IdEquals(sender)))
                {
                    DravenAxes.RemoveAll(a => a.Axe.IdEquals(sender));
                }
            }

            if (sender.GetType() == typeof(Obj_GeneralParticleEmitter))
            {
                var gameObject = (Obj_GeneralParticleEmitter)sender;
                if (ZacPassiveNames.Contains(gameObject.Name) && ZacPassives.Contains(gameObject))
                {
                    ZacPassives.Remove(gameObject);
                    Logger.Send("Delete " + gameObject.Name);
                }
            }

            var caster = sender as Obj_AI_Base;

            if (caster != null)
            {
                var trap = new traps {
                    Trap = caster, IsSpecial = false
                };
                //var Specialtrap = new traps { Trap = caster, IsSpecial = true };
                if (EnemyTraps.Contains(trap) && trap.Trap.IsEnemy)
                {
                    EnemyTraps.Remove(trap);
                    Logger.Send("Delete " + sender.Name);
                } /*
                   * if (EnemyTraps.Contains(Specialtrap) && caster.IsEnemy)
                   * {
                   * EnemyTraps.Remove(Specialtrap);
                   * Logger.Send("Delete " + sender.Name);
                   * }*/
            }
            if (sender.Name.ToLower().Contains("healthrelic"))
            {
                HealthRelics.Remove(sender);
                Logger.Send("Delete " + sender.Name);
            }
        }
Beispiel #4
0
        /// <summary>
        ///     Checks if healthrelic or traps are created and add them to the list.
        /// </summary>
        public static void GameObject_OnCreate(GameObject sender, EventArgs args)
        {
            if (sender.GetType() == typeof(Obj_GeneralParticleEmitter))
            {
                var gameObject = (Obj_GeneralParticleEmitter)sender;
                if (ZacPassiveNames.Contains(gameObject.Name) && !ZacPassives.Contains(gameObject) && Player.Instance.Hero == Champion.Zac)
                {
                    ZacPassives.Add(gameObject);
                    Logger.Send("Create " + gameObject.Name);
                }
            }

            var caster = sender as Obj_AI_Base;

            if (caster != null)
            {
                if (TrapsNames.Contains(sender.Name) && sender.IsEnemy)
                {
                    var trap = new traps {
                        Trap = caster, IsSpecial = false
                    };
                    EnemyTraps.Add(trap);
                    Logger.Send("Create " + sender.Name);
                } /*
                   * if (SpecialTrapsNames.Contains(caster.Name) && caster.IsEnemy)
                   * {
                   * var trap = new traps { Trap = caster, IsSpecial = true };
                   * EnemyTraps.Add(trap);
                   * Logger.Send("Create " + sender.Name);
                   * }*/
            }
            if (sender.Name.ToLower().Contains("healthrelic"))
            {
                HealthRelics.Add(sender);
                Logger.Send("Create " + sender.Name);
            }
        }
Beispiel #5
0
        /// <summary>
        ///     Checks if healthrelic or traps are deleted and remove them from the list.
        /// </summary>
        public static void GameObject_OnDelete(GameObject sender, EventArgs args)
        {
            if (sender.GetType() == typeof(Obj_GeneralParticleEmitter))
            {
                var gameObject = (Obj_GeneralParticleEmitter)sender;
                if (ZacPassiveNames.Contains(gameObject.Name) && ZacPassives.Contains(gameObject))
                {
                    ZacPassives.Remove(gameObject);
                    Logger.Send("Delete " + gameObject.Name);
                }
            }

            var caster = sender as Obj_AI_Base;

            if (caster != null)
            {
                var trap = new traps {
                    Trap = caster, IsSpecial = false
                };
                //var Specialtrap = new traps { Trap = caster, IsSpecial = true };
                if (EnemyTraps.Contains(trap) && trap.Trap.IsEnemy)
                {
                    EnemyTraps.Remove(trap);
                    Logger.Send("Delete " + sender.Name);
                } /*
                   * if (EnemyTraps.Contains(Specialtrap) && caster.IsEnemy)
                   * {
                   * EnemyTraps.Remove(Specialtrap);
                   * Logger.Send("Delete " + sender.Name);
                   * }*/
            }
            if (sender.Name.ToLower().Contains("healthrelic"))
            {
                HealthRelics.Remove(sender);
                Logger.Send("Delete " + sender.Name);
            }
        }