Exemplo n.º 1
0
        public bool Tick()
        {
            if (Pet != null)
            {
                if (CastCallPet != null
                    && ((Pet.Guid == 0
                        && CastCallPet.Invoke())
                    || CastRevivePet != null
                        && Pet != null && (Pet.Health == 0 || Pet.IsDead)
                            && CastRevivePet()))
                {
                    return true;
                }

                if (Pet == null || Pet.Health == 0 || Pet.IsDead)
                {
                    return true;
                }

                if (CastMendPet != null
                    && DateTime.Now - LastMendPetUsed > HealPetCooldown
                        && Pet?.HealthPercentage < 80
                        && CastMendPet.Invoke())
                {
                    LastMendPetUsed = DateTime.Now;
                    return true;
                }
            }

            return false;
        }
Exemplo n.º 2
0
        public bool Tick()
        {
            if (Bot.Player.IsMounted)
            {
                // dont summon pets while on mount, they despawn when mounted
                LastTimeMounted = DateTime.UtcNow;
                return(false);
            }

            if (LastTimeMounted + TimeSpan.FromSeconds(1) > DateTime.UtcNow)
            {
                // only do stuff 1sec after we dismounted
                // pets need a few ms to spawn
                return(false);
            }

            if (Bot.Objects.Pet != null)
            {
                if (CastCallPet != null &&
                    ((Bot.Objects.Pet.Guid == 0 && CastCallPet.Invoke()) ||
                     (CastRevivePet != null &&
                      Bot.Objects.Pet != null &&
                      (Bot.Objects.Pet.Health == 0 || Bot.Objects.Pet.IsDead) && CastRevivePet())))
                {
                    return(true);
                }

                if (Bot.Objects.Pet == null || Bot.Objects.Pet.Health == 0 || Bot.Objects.Pet.IsDead)
                {
                    return(true);
                }

                if (CastMendPet != null &&
                    DateTime.UtcNow - LastMendPetUsed > HealPetCooldown &&
                    Bot.Objects.Pet.HealthPercentage < 80.0 &&
                    CastMendPet.Invoke())
                {
                    LastMendPetUsed = DateTime.UtcNow;
                    return(true);
                }
            }
            else if (CastCallPet != null && CallPetEvent.Run() && !Bot.Player.IsCasting)
            {
                if (CallReviveToggle)
                {
                    CastRevivePet();
                }
                else
                {
                    CastCallPet.Invoke();
                }

                CallReviveToggle = !CallReviveToggle;
            }

            return(false);
        }
Exemplo n.º 3
0
        public bool Tick()
        {
            if (WowInterface.ObjectManager.Pet != null)
            {
                if (CastCallPet != null &&
                    ((WowInterface.ObjectManager.Pet.Guid == 0 &&
                      CastCallPet.Invoke()) ||
                     CastRevivePet != null &&
                     WowInterface.ObjectManager.Pet != null && (WowInterface.ObjectManager.Pet.Health == 0 || WowInterface.ObjectManager.Pet.IsDead) &&
                     CastRevivePet()))
                {
                    return(true);
                }

                if (WowInterface.ObjectManager.Pet == null || WowInterface.ObjectManager.Pet.Health == 0 || WowInterface.ObjectManager.Pet.IsDead)
                {
                    return(true);
                }

                if (CastMendPet != null &&
                    DateTime.Now - LastMendPetUsed > HealPetCooldown &&
                    WowInterface.ObjectManager.Pet.HealthPercentage < 80 &&
                    CastMendPet.Invoke())
                {
                    LastMendPetUsed = DateTime.Now;
                    return(true);
                }
            }
            else if (CastCallPet != null && CallPetEvent.Run() && !WowInterface.ObjectManager.Player.IsCasting)
            {
                if (CallReviveToggle)
                {
                    CastRevivePet();
                }
                else
                {
                    CastCallPet.Invoke();
                }

                CallReviveToggle = !CallReviveToggle;
            }

            return(false);
        }