Exemple #1
0
 public static bool ProductStop()
 {
     try
     {
         Fsm.StopEngine();
         if (_instanceFromOtherAssembly != null)
         {
             EventsListener.UnHookEvent(WoWEventsType.LOOT_READY, callback => FarmingTask.TakeFarmingLoots());
             EventsListener.UnHookEvent(WoWEventsType.LOOT_OPENED, callback => FarmingTask.TakeFarmingLoots());
             EventsListener.UnHookEvent(WoWEventsType.CINEMATIC_START, callback => ToggleCinematic(true));
             EventsListener.UnHookEvent(WoWEventsType.CINEMATIC_STOP, callback => ToggleCinematic(false));
             _instanceFromOtherAssembly.Stop();
             Thread.Sleep(500);
             MovementManager.StopMove();
             Fight.StopFight();
             CombatClass.DisposeCombatClass();
             LongMove.StopLongMove();
             Memory.WowMemory.GameFrameUnLock();
             return(true);
         }
     }
     catch (Exception e)
     {
         Logging.WriteError("ProductStop(): " + e);
     }
     return(false);
 }
Exemple #2
0
        /// <summary>
        /// Change the state of out FSM
        /// </summary>
        private void WatchForStateChanges()
        {
            while (Active)
            {
                // Is me supposed to follow
                FollowCheck();

                // Bot stuff check
                BotStuffCheck();

                // Am I in combat
                InCombatCheck();

                // Do I need to release my spirit
                ReleaseSpiritCheck();

                // Am I dead?
                DeadCheck();

                // Do i need to buff
                if (AmeisenDataHolder.IsAllowedToBuff)
                {
                    try
                    {
                        CombatClass.HandleBuffs();
                    }
                    catch { }
                }

                AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"FSM: {StateMachine.GetCurrentState()}", this);
                Thread.Sleep(AmeisenDataHolder.Settings.stateMachineStateUpdateMillis);
            }
        }
Exemple #3
0
            /// <summary>
            /// Sets the CombatClass value of a given Creature object.
            /// <para>Will operate on the Creature object's CharacteristicDictionary only if the target key ("CombatClass") already exists.</para>
            /// </summary>
            /// <param name="creature"></param>
            /// <param name="combatClass"></param>
            public static void SetCombatClass(this Creature creature, CombatClass combatClass)
            {
                if (creature.CharacteristicDictionary.ContainsKey("CombatClass"))
                {
                    var setCombatClass = (CharaCombatClass)creature.CharacteristicDictionary["CombatClass"];

                    setCombatClass.CombatClass = combatClass;
                }
            }
Exemple #4
0
 internal static void Dispose()
 {
     try
     {
         CombatClass.DisposeCombatClass();
         Fsm.StopEngine();
         Fight.StopFight();
     }
     catch (Exception e)
     {
         Logging.WriteError("Damage Dealer > Bot > Bot  > Dispose(): " + e);
     }
 }
Exemple #5
0
 internal static void Dispose()
 {
     try
     {
         CombatClass.DisposeCombatClass();
         Fsm.StopEngine();
         Fight.StopFight();
         MovementManager.StopMove();
     }
     catch (Exception e)
     {
         Logging.WriteError("Archaeologist > Bot > Bot  > Dispose(): " + e);
     }
 }
Exemple #6
0
    private readonly Spell Torment = new Spell("Torment"); //No GCD

    #endregion

    public DemonHunterVengeance()
    {
        Main.InternalRange             = ObjectManager.Me.GetCombatReach;
        Main.InternalAggroRange        = Main.InternalRange;
        Main.InternalLightHealingSpell = null;
        MySettings = DemonHunterVengeanceSettings.GetSettings();
        Main.DumpCurrentSettings <DemonHunterVengeanceSettings>(MySettings);
        UInt128 lastTarget = 0;

        while (Main.InternalLoop)
        {
            try
            {
                if (!ObjectManager.Me.IsDeadMe)
                {
                    if (!ObjectManager.Me.IsMounted)
                    {
                        if (Fight.InFight && ObjectManager.Me.Target > 0)
                        {
                            if (ObjectManager.Me.Target != lastTarget)
                            {
                                lastTarget = ObjectManager.Me.Target;
                            }

                            if (CombatClass.InSpellRange(ObjectManager.Target, 0, 40))
                            {
                                Combat();
                            }
                            else
                            {
                                Patrolling();
                            }
                        }
                        else
                        {
                            Patrolling();
                        }
                    }
                }
                else
                {
                    Thread.Sleep(500);
                }
            }
            catch
            {
            }
            Thread.Sleep(100);
        }
    }
Exemple #7
0
 internal static void Dispose()
 {
     try
     {
         CombatClass.DisposeCombatClass();
         Fsm.StopEngine();
         Fight.StopFight();
         MimesisClientCom.Disconnect();
     }
     catch (Exception e)
     {
         Logging.WriteError("Mimesis > Bot > Bot  > Dispose(): " + e);
     }
 }
    public TEMPLATE_SPEC()
    {
        Main.InternalRange             = TEMPLATE_COMBAT_RANGE; // Max range of your combat spells (40f for most classes, ObjectManager.Me.GetCombatReach for melee)
        Main.InternalAggroRange        = TEMPLATE_PULL_RANGE;   // Range at which your RANGED class should engage enemies remove if your class is melee
        Main.InternalLightHealingSpell = null;                  /*new Spell("TEMPLATE_HEALING_SPELL");*/
        MySettings = TEMPLATE_SPECSettings.GetSettings();
        Main.DumpCurrentSettings <TEMPLATE_SPECSettings>(MySettings);
        UInt128 lastTarget = 0;

        while (Main.InternalLoop)
        {
            try
            {
                if (!ObjectManager.Me.IsDeadMe)
                {
                    if (!ObjectManager.Me.IsMounted)
                    {
                        if (Fight.InFight && ObjectManager.Me.Target > 0)
                        {
                            if (ObjectManager.Me.Target != lastTarget)
                            {
                                lastTarget = ObjectManager.Me.Target;
                            }

                            if (CombatClass.InSpellRange(ObjectManager.Target, 0, 40))
                            {
                                Combat();
                            }
                            else if (!ObjectManager.Me.IsCast)
                            {
                                Patrolling();
                            }
                        }
                        else if (!ObjectManager.Me.IsCast)
                        {
                            Patrolling();
                        }
                    }
                }
                else
                {
                    Thread.Sleep(500);
                }
            }
            catch
            {
            }
            Thread.Sleep(100);
        }
    }
        private void SpellSettingsShortcutButton_Click(object sender, EventArgs e)
        {
            string pathToCombatClassFile;

            if (nManagerSetting.CurrentSetting.CombatClass == "OfficialTnbClassSelector")
            {
                pathToCombatClassFile = Application.StartupPath + "\\CombatClasses\\OfficialTnbClassSelector\\Tnb_" + ObjectManager.Me.WowClass + "Rotations.dll";
            }
            else
            {
                pathToCombatClassFile = Application.StartupPath + "\\CombatClasses\\" + nManagerSetting.CurrentSetting.CombatClass;
            }
            CombatClass.ShowConfigurationCombatClass(pathToCombatClassFile);
        }
Exemple #10
0
        internal static bool Pulse()
        {
            try
            {
                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new FightHostileTargetDamageDealerOnly {
                    Priority = 30
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 20
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 10
                });
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(12, "FSM Damage Dealer");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Damage Dealer > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #11
0
 internal static void Dispose()
 {
     try
     {
         FishingTask.StopLoopFish();
         CombatClass.DisposeCombatClass();
         Fsm.StopEngine();
         Fight.StopFight();
         MovementManager.StopMove();
     }
     catch (Exception e)
     {
         Logging.WriteError("Grinder > Bot > Bot  > Dispose(): " + e);
     }
 }
Exemple #12
0
 internal static void Dispose()
 {
     try
     {
         CombatClass.DisposeCombatClass();
         CustomProfile.DisposeCustomProfile();
         Fsm.StopEngine();
         Fight.StopFight();
         MovementManager.StopMove();
     }
     catch (Exception e)
     {
         Logging.WriteError("Battlegrounder > Bot > Bot  > Dispose(): " + e);
     }
 }
Exemple #13
0
 internal static void Dispose()
 {
     try
     {
         CombatClass.DisposeCombatClass();
         Fsm.StopEngine();
         Fight.StopFight();
         MovementManager.StopMove();
         GarrisonState.RestoreSettings();
     }
     catch (Exception e)
     {
         Logging.WriteError("GarrisonFarming > Bot > Bot  > Dispose(): " + e);
     }
 }
Exemple #14
0
        public override void Execute()
        {
            // do i need to loot units
            if (UnitLootList.Count > 0)
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Looting);
                return;
            }

            // do i need to follow someone
            if (IsUnitToFollowThere())
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Following);
            }

            // do we need to repair our equipment
            if (DateTime.Now - LastRepairCheck > TimeSpan.FromSeconds(12))
            {
                if (IsRepairNpcNear() &&
                    CharacterManager.Equipment.Equipment.Any(e => ((double)e.Value.MaxDurability / (double)e.Value.Durability) < 0.2))
                {
                    AmeisenBotStateMachine.SetState(AmeisenBotState.Repairing);
                }

                LastRepairCheck = DateTime.Now;
            }

            // do we need to sell stuff
            if (DateTime.Now - LastBagSlotCheck > TimeSpan.FromSeconds(5) &&
                CharacterManager.Inventory.Items.Any(e => e.Price > 0))
            {
                if (IsVendorNpcNear() &&
                    HookManager.GetFreeBagSlotCount() < 4)
                {
                    AmeisenBotStateMachine.SetState(AmeisenBotState.Selling);
                }

                LastBagSlotCheck = DateTime.Now;
            }

            // do buffing etc...
            CombatClass?.OutOfCombatExecute();
        }
        public void DoThings()
        {
            try
            {
                if (CombatClass != null)
                {
                    if (AmeisenDataHolder.IsAllowedToAttack)
                    {
                        CombatClass.HandleAttacking();
                    }

                    if (AmeisenDataHolder.IsAllowedToTank)
                    {
                        CombatClass.HandleTanking();
                    }

                    if (AmeisenDataHolder.IsAllowedToHeal)
                    {
                        CombatClass.HandleHealing();
                    }
                }
            }
            catch { }
        }
Exemple #16
0
        public override void Execute()
        {
            if (!ObjectManager.Player.IsInCombat && !AmeisenBotStateMachine.IsAnyPartymemberInCombat())
            {
                AmeisenBotStateMachine.SetState(AmeisenBotState.Idle);
                return;
            }

            // we can do nothing until the ObjectManager is initialzed
            if (ObjectManager != null &&
                ObjectManager.Player != null)
            {
                // use the default Target selection algorithm if the CombatClass doenst

                // Note: this only works for dps classes, tanks and healers need
                //        to implement their own target selection algorithm
                if (CombatClass == null || !CombatClass.HandlesTargetSelection)
                {
                    // make sure we got both objects refreshed before we check them
                    ObjectManager.UpdateObject(ObjectManager.Player);
                    ObjectManager.UpdateObject(ObjectManager.Target);

                    // do we need to clear our target
                    if (ObjectManager.TargetGuid > 0 &&
                        (ObjectManager.Target.IsDead ||
                         HookManager.GetUnitReaction(ObjectManager.Player, ObjectManager.Target) == WowUnitReaction.Friendly))
                    {
                        HookManager.ClearTarget();
                        ObjectManager.UpdateObject(ObjectManager.Player);
                    }

                    // select a new target if our current target is invalid
                    if ((ObjectManager.TargetGuid == 0 ||
                         (ObjectManager.Target == null || ObjectManager.Target.Guid == ObjectManager.PlayerGuid)) &&
                        SelectTargetToAttack(out WowUnit target))
                    {
                        HookManager.TargetGuid(target.Guid);

                        ObjectManager.UpdateObject(ObjectManager.Player);
                        ObjectManager.UpdateObject(ObjectManager.Target);
                    }
                }

                // use the default MovementEngine to move if the CombatClass doesnt
                if (CombatClass == null || !CombatClass.HandlesMovement)
                {
                    HandleMovement(ObjectManager.Target);
                }

                // if no CombatClass is loaded, just autoattack
                if (CombatClass != null)
                {
                    CombatClass.Execute();
                }
                else
                {
                    if (!ObjectManager.Player.IsAutoAttacking)
                    {
                        HookManager.StartAutoAttack();
                    }
                }
            }

            TryCount = 0;
        }
Exemple #17
0
    private void GCDCycle()
    {
        Usefuls.SleepGlobalCooldown();

        try
        {
            Memory.WowMemory.GameFrameLock(); // !!! WARNING - DONT SLEEP WHILE LOCKED - DO FINALLY(GameFrameUnLock()) !!!

            if (MySettings.UseFelRush && FelRush.IsSpellUsable && CombatClass.InSpellRange(ObjectManager.Target, 0, 20 /*FelRush Range*/) &&
                //Keep Recharging
                (FelRush.GetSpellCharges == 2 ||
                 //Generate Fury
                 (FelMastery.HaveBuff && (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 30) ||
                 //Trigger Momentum
                 (Momentum.HaveBuff && !MomentumBuff.HaveBuff)))
            {
                FelRush.Cast();
                return;
            }
            if (MySettings.UseVengefulRetreat && VengefulRetreat.IsSpellUsable && CombatClass.InSpellRange(ObjectManager.Target, 0, 20 /*Vengeful Retreat Range*/) &&
                //Generate Fury
                ((Prepared.HaveBuff && (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 20) ||
                 //Trigger Momentum
                 (Momentum.HaveBuff && !MomentumBuff.HaveBuff)))
            {
                VengefulRetreat.Cast();
                return;
            }
            //Single Target
            if (ObjectManager.GetUnitInSpellRange(5f) == 1)
            {
                if (MySettings.UseNemesis && Nemesis.IsSpellUsable && Nemesis.IsHostileDistanceGood)
                {
                    Nemesis.Cast();
                    return;
                }
                if (Demonic.HaveBuff && MySettings.UseEyeBeam && EyeBeam.IsSpellUsable && EyeBeam.IsHostileDistanceGood)
                {
                    EyeBeam.Cast();
                    return;
                }
                if (MySettings.UseFelEruption && FelEruption.IsSpellUsable && FelEruption.IsHostileDistanceGood)
                {
                    FelEruption.Cast();
                    return;
                }
                if (MySettings.UseFuryoftheIllidari && FuryoftheIllidari.IsSpellUsable && FuryoftheIllidari.IsHostileDistanceGood &&
                    //Only with Momentum
                    (!Momentum.HaveBuff || MomentumBuff.HaveBuff))
                {
                    FuryoftheIllidari.Cast();
                    return;
                }
                if (FirstBlood.HaveBuff && (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    if (MySettings.UseBladeDance && BladeDance.IsSpellUsable && BladeDance.IsHostileDistanceGood)
                    {
                        BladeDance.Cast();
                        return;
                    }
                    if (MySettings.UseDeathSweep && DeathSweep.IsSpellUsable && DeathSweep.IsHostileDistanceGood)
                    {
                        DeathSweep.Cast();
                        return;
                    }
                }
                if (MySettings.UseFelblade && Felblade.IsSpellUsable && Felblade.IsHostileDistanceGood &&
                    //Generate Fury
                    (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 30)
                {
                    Felblade.Cast();
                    return;
                }
                if (Bloodlet.HaveBuff && MySettings.UseThrowGlaive && ThrowGlaive.IsSpellUsable && ThrowGlaive.IsHostileDistanceGood &&
                    //Only with Momentum
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    ThrowGlaive.Cast();
                    return;
                }
                if (MySettings.UseFelBarrage && FelBarrage.IsSpellUsable && FelBarrage.IsHostileDistanceGood &&
                    //Keep Recharging
                    FelBarrage.GetSpellCharges == 5 &&
                    //Only with Momentum
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    FelBarrage.Cast();
                    return;
                }
                if (MySettings.UseAnnihilation && Annihilation.IsSpellUsable && Annihilation.IsHostileDistanceGood &&
                    //Generate Fury
                    (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 30)
                {
                    Annihilation.Cast();
                    return;
                }
                if (AnguishoftheDeceiver.HaveBuff && MySettings.UseEyeBeam && EyeBeam.IsSpellUsable && EyeBeam.IsHostileDistanceGood)
                {
                    EyeBeam.Cast();
                    return;
                }
                if (MySettings.UseChaosStrike && ChaosStrike.IsSpellUsable && ChaosStrike.IsHostileDistanceGood &&
                    //Generate Fury
                    (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 30)
                {
                    ChaosStrike.Cast();
                    return;
                }
                if (MySettings.UseFelBarrage && FelBarrage.IsSpellUsable && FelBarrage.IsHostileDistanceGood &&
                    //Keep Recharging
                    FelBarrage.GetSpellCharges >= 4 &&
                    //Only with Momentum
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    FelBarrage.Cast();
                    return;
                }
                if (!DemonBlades.HaveBuff && MySettings.UseDemonsBite && DemonsBite.IsSpellUsable && DemonsBite.IsHostileDistanceGood)
                {
                    DemonsBite.Cast();
                    return;
                }
                if (MySettings.UseFelRush && FelRush.IsSpellUsable && CombatClass.InSpellRange(ObjectManager.Target, 6, 20 /*FelRush Range*/))
                {
                    FelRush.Cast();
                    return;
                }
                if (MySettings.UseThrowGlaive && ThrowGlaive.IsSpellUsable && (!CombatClass.InMeleeRange(ObjectManager.Target) ||
                                                                               DemonBlades.HaveBuff))
                {
                    ThrowGlaive.Cast();
                    return;
                }
            }
            //Multiple Target
            else
            {
                if (MySettings.UseFuryoftheIllidari && FuryoftheIllidari.IsSpellUsable && FuryoftheIllidari.IsHostileDistanceGood &&
                    //Only with Momentum
                    (!Momentum.HaveBuff || MomentumBuff.HaveBuff))
                {
                    FuryoftheIllidari.Cast();
                    return;
                }
                if (MySettings.UseFelBarrage && FelBarrage.IsSpellUsable && FelBarrage.IsHostileDistanceGood &&
                    //Keep Recharging
                    FelBarrage.GetSpellCharges >= 4 &&
                    //Only with Momentum
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    FelBarrage.Cast();
                    return;
                }
                if (MySettings.UseEyeBeam && EyeBeam.IsSpellUsable && EyeBeam.IsHostileDistanceGood &&
                    //Only with Momentum
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    EyeBeam.Cast();
                    return;
                }
                if (FirstBlood.HaveBuff && ObjectManager.GetUnitInSpellRange(5f) > 2 &&
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    if (MySettings.UseBladeDance && BladeDance.IsSpellUsable && BladeDance.IsHostileDistanceGood)
                    {
                        BladeDance.Cast();
                        return;
                    }
                    if (MySettings.UseDeathSweep && DeathSweep.IsSpellUsable && DeathSweep.IsHostileDistanceGood)
                    {
                        DeathSweep.Cast();
                        return;
                    }
                }
                if (Bloodlet.HaveBuff && MySettings.UseThrowGlaive && ThrowGlaive.IsSpellUsable && ThrowGlaive.IsHostileDistanceGood &&
                    //Only with Momentum
                    (!MomentumBuff.HaveBuff || MomentumBuff.HaveBuff))
                {
                    ThrowGlaive.Cast();
                    return;
                }
                if (MySettings.UseChaosStrike && ChaosStrike.IsSpellUsable &&
                    ChaosCleave.HaveBuff && ObjectManager.GetUnitInSpellRange(ChaosStrike.MaxRangeHostile) <= 3)
                {
                    ChaosStrike.Cast();
                    return;
                }
                if (MySettings.UseThrowGlaive && ThrowGlaive.IsSpellUsable && ThrowGlaive.IsHostileDistanceGood)
                {
                    ThrowGlaive.Cast();
                    return;
                }
                if (MySettings.UseChaosStrike && ChaosStrike.IsSpellUsable && ChaosStrike.IsHostileDistanceGood &&
                    //Generate Fury
                    (!DemonBlades.HaveBuff || (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 40) &&
                    (ObjectManager.Me.MaxFury - ObjectManager.Me.Fury) < 30)
                {
                    ChaosStrike.Cast();
                    return;
                }
                if (!DemonBlades.HaveBuff && MySettings.UseDemonsBite && DemonsBite.IsSpellUsable && DemonsBite.IsHostileDistanceGood)
                {
                    DemonsBite.Cast();
                    return;
                }
                if (MySettings.UseInfernalStrike && InfernalStrike.IsSpellUsable && InfernalStrike.IsHostileDistanceGood)
                {
                    InfernalStrike.CastAtPosition(ObjectManager.Target.Position);
                    return;
                }
            }
        }
        finally
        {
            Memory.WowMemory.GameFrameUnLock();
        }
    }
        static void Main(string[] args)
        {
            Console.Title = $"=-= Age Old War =-=";
            Console.WriteLine("The battle of canine vs feline");

            short killCount = 0;

            Console.WriteLine("Enter your name: ");
            string name = Console.ReadLine();

            Console.Clear();
            Race playerRace = Race.BostonTerrier;

            Console.WriteLine("Chose your race:\nB) BostonTerrier\nC) Chihuahua\nD) Dachshund\nG)" +
                              " GermanShepherd\nI) IrishWolfhound\nM) Mastiff");
            ConsoleKey raceCHoice = Console.ReadKey(true).Key;

            switch (raceCHoice)
            {
            case ConsoleKey.B:
                playerRace = Race.BostonTerrier;
                break;

            case ConsoleKey.C:
                playerRace = Race.Chihuahua;
                break;

            case ConsoleKey.D:
                playerRace = Race.Dachshund;
                break;

            case ConsoleKey.G:
                playerRace = Race.GermanShepherd;
                break;

            case ConsoleKey.I:
                playerRace = Race.IrishWolfhound;
                break;

            case ConsoleKey.M:
                playerRace = Race.Mastiff;
                break;

            default:
                Console.WriteLine("That was not one of the options, you shall now be a Boston Terrier.");
                playerRace = Race.BostonTerrier;
                break;
            }
            Console.WriteLine($"Welcome, {name} the {playerRace}! Your journey begins...");
            //Maybe have attack of opportunity and/or surprise attack
            //build weapon first as player uses weapon
            Weapon battleAxe = new Weapon("Rusty Battle Axe", 1, 6, 5, true);
            Player player    = new Player(name, 60, 15, 80, 80, Race.BostonTerrier, battleAxe);
            bool   exit      = false;

            do
            {
                Console.WriteLine(GetRoom());

                Himalayan  h1 = new Himalayan("Shorter Haired Himalayan", 20, 20, 8, 2, 1, 6, "A cream colored feline with brown points", false);
                Himalayan  h2 = new Himalayan("Fluffy Himalayan", 30, 30, 13, 2, 4, 7, "A fluffy cream colored feline with brown points", true);
                Siamese    s1 = new Siamese("Sensei Siamese", 30, 30, 10, 3, 6, 8, "Slender with a dark face and light fur covering the rest of its body", true);
                Siamese    s2 = new Siamese("Yukyusha Siamese", 15, 15, 4, 1, 2, 4, "A younger feline with a lighter shaded face than and adult", false);
                Abyssinian a1 = new Abyssinian("Warrior Abyssinian", 25, 25, 12, 4, 5, 6, "Dark shaded fawn colored Abyssianian", true);
                Abyssinian a2 = new Abyssinian("Apprentice Abyssinian", 10, 10, 2, 1, 3, 5, "A younger darkly shaded fawn colored feline", false);
                Ragdoll    r1 = new Ragdoll("Fluffy Puffy Ragdoll", 35, 35, 12, 1, 2, 8, "Very fluffy light color fur with cream-caramel shading and dark face", true);
                Ragdoll    r2 = new Ragdoll("Shaved Ragdoll", 12, 12, 3, 3, 4, 6, "Light colored fur shaded in a creamy caramel color fur is shaved off in a lion cut", false);
                Munchkin   m1 = new Munchkin("Fierce Munchkin", 35, 35, 12, 1, 2, 8, "Short-legged cat carrying a satchel full of catnip", true);
                Munchkin   m2 = new Munchkin("clumsy Munchkin", 8, 8, 4, 3, 4, 6, "Uncordinated stubby legged feline that seems to not have much control over his legs.", false);
                Bengal     b1 = new Bengal("Large Bengal", 35, 35, 15, 3, 4, 8, "A orange-tan colored spotted cat whose spots ripple as they move", true);
                Bengal     b2 = new Bengal("Young Bengal", 8, 8, 4, 3, 4, 6, "A young spotted feline not to sure about war but trained to fight.", false);

                //Because all of our creatures will be of type Monster, they can be put into a collection of Monsters.
                List <Monster> monsters = new List <Monster>()
                {
                    h1, h1, h2, h2, s1, s1, s2, s2, a1, a1, a2, a2, r1, r1, r2, r2, m1, m1, m2, m2, b1, b1, b2, b2
                };
                Monster monster = monsters[new Random().Next(monsters.Count)];
                //square bracket [ ] used in this case is not an array but an index.

                Console.WriteLine("In this room: " + monster.Name); //to pull monster from List.


                bool reload = false;

                do
                {
                    Console.WriteLine("\nPlease choose and action:\n" +
                                      "A) Attack\n" +
                                      "R) RUN AWAY!\n" +
                                      "P) Player stats\n" +
                                      "M) Monster stats\n" +
                                      "X) Exit");
                    ConsoleKey userChoice = Console.ReadKey(true).Key;
                    Console.Clear();

                    switch (userChoice)
                    {
                    default:
                        Console.WriteLine("Thou hast chosen and improper option. Triest thou again.");
                        break;

                    case ConsoleKey.A:
                        Console.WriteLine("You move to attack the feline, but who will get the first strike?");
                        //random roll for initiative:
                        Random initiativeRoll = new Random();
                        int    D20            = initiativeRoll.Next(1, 21); //range - display when not wanting to include 0
                        int    monsterD20     = initiativeRoll.Next(1, 21); //monsters roll
                        Console.WriteLine("Player Roll: " + D20.ToString());
                        Console.WriteLine("Monster Roll: " + monsterD20.ToString());

                        if (D20 >= monsterD20)
                        {
                            Console.WriteLine("Player attacks first");
                            CombatClass.DoAttack(player, monster);
                            if (monster.Life <= 0)
                            {
                                killCount++;
                                Console.ForegroundColor = ConsoleColor.Green;
                                Console.WriteLine($"You have slain the {monster.Name}!");
                                Console.ResetColor();
                                reload = true;
                            }    //end if
                        }
                        //TODO add monster first attack for initiative roll
                        else
                        {
                            Console.WriteLine("Monster attacks first");
                            CombatClass.DoAttack(monster, player);
                        }    //end if initiative roll monster win


                        break;

                    case ConsoleKey.R:
                        Console.WriteLine("You coward! You flee the room," +
                                          $" but the {monster.Name} gets an attack of opportunity!");
                        CombatClass.DoAttack(monster, player);
                        reload = true;    //to get out of inner loop back to outer loop
                        break;

                    case ConsoleKey.P:
                        Console.WriteLine(player.ToString());
                        Console.WriteLine($"Creatures killed: {killCount}");
                        break;

                    case ConsoleKey.M:
                        Console.WriteLine(monster);
                        break;

                    case ConsoleKey.E:
                    case ConsoleKey.X:
                        Console.WriteLine("You have given up.");
                        exit = true;     //exits both loops
                        break;
                    }//end switch - contains menu
                    if (player.Life <= 0)
                    {
                        exit = true;
                    }//end if
                } while (!exit && !reload); //inside loop
                //it's either going to be exit loop or reload the loop
            } while (!exit);//outside loop

            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("GAME OVER!");
        }//end main()
 public void Stop()
 {
     CombatClass?.Exit();
 }
 public void Start()
 {
     CombatClass?.Init();
 }
Exemple #21
0
        internal static bool Pulse()
        {
            try
            {
                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();
                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 170
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 160
                });
                Fsm.AddState(new BattlegrounderQueueing {
                    Priority = 150
                });
                Fsm.AddState(new BattlegrounderCurrentProfile {
                    Priority = 140
                });
                Fsm.AddState(new Looting {
                    Priority = 130
                });
                Fsm.AddState(new Regeneration {
                    Priority = 120
                });
                Fsm.AddState(new ToTown {
                    Priority = 110
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 100
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 90
                });
                Fsm.AddState(new Trainers {
                    Priority = 80
                });
                Fsm.AddState(new AutoItemCombiner {
                    Priority = 53
                });
                Fsm.AddState(new MillingState {
                    Priority = 52
                });
                Fsm.AddState(new ProspectingState {
                    Priority = 51
                });
                Fsm.AddState(new Farming {
                    Priority = 50
                });
                Fsm.AddState(Battlegrounding);
                Fsm.AddState(new BattlegrounderCurrentProfile {
                    Priority = 30
                });
                Fsm.AddState(new BattlegrounderQueueing {
                    Priority = 20
                });
                Fsm.AddState(MovementLoop);
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Battlegrounder");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Battlegrounder > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #22
0
        internal static bool Pulse()
        {
            try
            {
                MountTask.AllowMounting    = true;
                Quest.GetSetIgnoreFight    = false;
                Quest.GetSetIgnoreAllFight = false;
                Quest.GetSetDismissPet     = false;
                Profile = new QuesterProfile();
                QuesterProfileLoader f = new QuesterProfileLoader();
                f.ShowDialog();
                if (!string.IsNullOrWhiteSpace(QuesterSettings.CurrentSettings.LastProfile) &&
                    ((QuesterSettings.CurrentSettings.LastProfileSimple &&
                      File.Exists(Application.StartupPath + "\\Profiles\\Quester\\" + QuesterSettings.CurrentSettings.LastProfile)) ||
                     (!QuesterSettings.CurrentSettings.LastProfileSimple &&
                      File.Exists(Application.StartupPath + "\\Profiles\\Quester\\Grouped\\" + QuesterSettings.CurrentSettings.LastProfile))))
                {
                    Profile = QuesterSettings.CurrentSettings.LastProfileSimple
                        ? XmlSerializer.Deserialize <QuesterProfile>(Application.StartupPath + "\\Profiles\\Quester\\" + QuesterSettings.CurrentSettings.LastProfile)
                        : XmlSerializer.Deserialize <QuesterProfile>(Application.StartupPath + "\\Profiles\\Quester\\Grouped\\" +
                                                                     QuesterSettings.CurrentSettings.LastProfile);
                    DumpInfoAboutProfile(QuesterSettings.CurrentSettings.LastProfile, Profile);

                    foreach (Include include in Profile.Includes)
                    {
                        try
                        {
                            if (!Script.Run(include.ScriptCondition))
                            {
                                continue;
                            }
                            //Logging.Write(Translation.GetText(Translation.Text.SubProfil) + " " + include.PathFile);
                            QuesterProfile profileInclude = XmlSerializer.Deserialize <QuesterProfile>(Application.StartupPath + "\\Profiles\\Quester\\" + include.PathFile);
                            if (profileInclude != null)
                            {
                                // Profile.Includes.AddRange(profileInclude.Includes);
                                Profile.Questers.AddRange(profileInclude.Questers);
                                Profile.Blackspots.AddRange(profileInclude.Blackspots);
                                Profile.AvoidMobs.AddRange(profileInclude.AvoidMobs);
                                Profile.Quests.AddRange(profileInclude.Quests);
                                DumpInfoAboutProfile(include.PathFile, profileInclude);
                            }
                        }

                        catch (Exception e)
                        {
                            MessageBox.Show(Translate.Get(Translate.Id.File_not_found) + ": " + e);
                            Logging.Write(Translate.Get(Translate.Id.File_not_found));
                            return(false);
                        }
                    }
                    // Now check the integrity by checking we have all NPC required
                    foreach (Profile.Quest q in Profile.Quests)
                    {
                        bool isWorldQuest = q.WorldQuestLocation != null && q.WorldQuestLocation.IsValid;
                        if (!isWorldQuest && q.ItemPickUp == 0 && FindQuesterById(q.PickUp).Entry == 0 && !q.AutoAccepted)
                        {
                            MessageBox.Show("Your profile is missing the definition of NPC entry " + q.PickUp +
                                            "\nThe quest is '" + q.Name + "' (" + q.Id + "). Cannot continues!");
                            return(false);
                        }
                        if (!isWorldQuest && FindQuesterById(q.TurnIn).Entry == 0)
                        {
                            MessageBox.Show("Your profile is missing the definition of NPC entry " + q.TurnIn +
                                            "\nThe quest is '" + q.Name + "' (" + q.Id + "). Cannot continues!");
                            return(false);
                        }
                        foreach (Profile.QuestObjective o in q.Objectives)
                        {
                            if (o.NpcEntry != 0 && FindQuesterById(o.NpcEntry).Entry == 0)
                            {
                                MessageBox.Show("Your profile is missing the definition of NPC entry " + o.NpcEntry +
                                                "\nThe quest is '" + q.Name + "' (" + q.Id + "). Cannot continues!");
                                return(false);
                            }
                            if (o.InternalIndex != 0 && o.Count <= 0 && o.CollectCount <= 0)
                            {
                                MessageBox.Show("Your profile has an objective with an InternalIndex but without proper Count or CollectCount values" +
                                                "\nThe quest is '" + q.Name + "' (" + q.Id + "). Cannot continues!");
                                return(false);
                            }
                            if (o.InternalIndex > 23)
                            {
                                MessageBox.Show("Your profile has an objective with an InternalIndex > 23, which is not possible." +
                                                "\nThe quest is '" + q.Name + "' (" + q.Id + "). Cannot continues!");
                                return(false);
                            }
                        }
                    }
                    Logging.Write("Loaded " + Profile.Quests.Count + " quests");
                    Profile.Filter();
                    Logging.Write(Profile.Quests.Count + " quests left after filtering on class/race");

                    Tasks.QuestingTask.completed = false;

                    Quest.ConsumeQuestsCompletedRequest();
                    Logging.Write("received " + Quest.FinishedQuestSet.Count + " quests.");
                }
                else
                {
                    return(false);
                }

                // Black List:
                nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(Profile.Blackspots));

                // Load CC:
                CombatClass.LoadCombatClass();

                ImportedQuesters = false;

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 150
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 140
                });
                Fsm.AddState(new Regeneration {
                    Priority = 130
                });
                Fsm.AddState(new FlightMasterDiscovery {
                    Priority = 120
                });
                Fsm.AddState(new Looting {
                    Priority = 110
                });
                Fsm.AddState(new Travel {
                    Priority = 100
                });
                Fsm.AddState(new ToTown {
                    Priority = 90
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 80
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 70
                });
                Fsm.AddState(new Trainers {
                    Priority = 60
                });
                Fsm.AddState(new AutoItemCombiner {
                    Priority = 52
                });
                Fsm.AddState(new MillingState {
                    Priority = 51
                });
                Fsm.AddState(new ProspectingState {
                    Priority = 50
                });
                Fsm.AddState(new Farming {
                    Priority = 30
                });
                Fsm.AddState(new QuesterState {
                    Priority = 20
                });
                Fsm.AddState(new MovementLoop {
                    Priority = 10
                });
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Quester");
                EventsListener.HookEvent(WoWEventsType.QUEST_DETAIL, callback => Quest.AutoCompleteQuest());
                EventsListener.HookEvent(WoWEventsType.QUEST_AUTOCOMPLETE, callback => Quest.AutoCompleteQuest());

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Quester > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #23
0
        internal static bool Pulse()
        {
            try
            {
                Profile = new FisherbotProfile();

                // If Fish School Load Profile
                if (FisherbotSetting.CurrentSetting.FishSchool)
                {
                    if (File.Exists(Application.StartupPath + "\\Profiles\\Fisherbot\\" + FisherbotSetting.CurrentSetting.FishSchoolProfil))
                    {
                        Profile = XmlSerializer.Deserialize <FisherbotProfile>(Application.StartupPath + "\\Profiles\\Fisherbot\\" + FisherbotSetting.CurrentSetting.FishSchoolProfil);
                        if (Profile.Points.Count <= 0)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        MessageBox.Show(nManager.Translate.Get(nManager.Translate.Id.Please_select_an_profile_or_disable_School_Fish_option));
                        return(false);
                    }
                }

                // Black List:
                nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(Profile.BlackListRadius));

                // Load CC:
                CombatClass.LoadCombatClass();

                if (!FisherbotSetting.CurrentSetting.FishSchool)
                {
                    FisherbotSetting.CurrentSetting.FisherbotPosition = ObjectManager.Me.Position;
                    FisherbotSetting.CurrentSetting.FisherbotRotation = ObjectManager.Me.Rotation;
                }

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 140
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 130
                });
                Fsm.AddState(new ToTown {
                    Priority = 120
                });
                Fsm.AddState(new Looting {
                    Priority = 110
                });
                Fsm.AddState(new Travel {
                    Priority = 100
                });
                Fsm.AddState(new Regeneration {
                    Priority = 90
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 80
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 70
                });
                Fsm.AddState(new Trainers {
                    Priority = 60
                });
                Fsm.AddState(new AutoItemCombiner {
                    Priority = 52
                });
                Fsm.AddState(new MillingState {
                    Priority = 51
                });
                Fsm.AddState(new ProspectingState {
                    Priority = 50
                });
                Fsm.AddState(new Farming {
                    Priority = 30
                });
                Fsm.AddState(new FisherbotState {
                    Priority = 20
                });
                Fsm.AddState(new MovementLoop {
                    Priority = 10, PathLoop = Profile.Points
                });
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Fisherbot");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Fisherbot > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #24
0
        internal static bool Pulse()
        {
            try
            {
                if (!MimesisClientCom.Connect())
                {
                    return(false);
                }
                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 90
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 80
                });
                Fsm.AddState(new FightHostileTarget {
                    Priority = 70
                });
                Fsm.AddState(new Looting {
                    Priority = 60
                });
                Fsm.AddState(new Travel {
                    Priority = 50
                });
                Fsm.AddState(new Farming {
                    Priority = 40
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 30
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 20
                });
                Fsm.AddState(new MimesisState {
                    Priority = 10
                });
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Mimesis");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Mimesis > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #25
0
        internal static bool Pulse()
        {
            try
            {
                Profile = new GrinderProfile();
                LoadProfile f = new LoadProfile();
                f.ShowDialog();
                // If grinder School Load Profile
                if (!string.IsNullOrWhiteSpace(GrinderSetting.CurrentSetting.ProfileName) &&
                    File.Exists(Application.StartupPath + "\\Profiles\\Grinder\\" +
                                GrinderSetting.CurrentSetting.ProfileName))
                {
                    Profile =
                        XmlSerializer.Deserialize <GrinderProfile>(Application.StartupPath + "\\Profiles\\Grinder\\" +
                                                                   GrinderSetting.CurrentSetting.ProfileName);
                    if (Profile.GrinderZones.Count <= 0)
                    {
                        return(false);
                    }
                }
                else
                {
                    MessageBox.Show(Translate.Get(Translate.Id.Please_select_an_profile));
                    return(false);
                }

                SelectZone();


                // Black List:
                foreach (GrinderZone zone in Profile.GrinderZones)
                {
                    nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(zone.BlackListRadius));
                }

                // Add Npc
                foreach (GrinderZone zone in Profile.GrinderZones)
                {
                    NpcDB.AddNpcRange(zone.Npc);
                }

                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new SelectProfileState {
                    Priority = 150
                });
                Fsm.AddState(new Resurrect {
                    Priority = 140
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 130
                });
                Fsm.AddState(new Regeneration {
                    Priority = 120
                });
                Fsm.AddState(new ToTown {
                    Priority = 110
                });
                Fsm.AddState(new Looting {
                    Priority = 100
                });
                Fsm.AddState(new Travel {
                    Priority = 90
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 80
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 70
                });
                Fsm.AddState(new Trainers {
                    Priority = 60
                });
                Fsm.AddState(new AutoItemCombiner {
                    Priority = 52
                });
                Fsm.AddState(new MillingState {
                    Priority = 51
                });
                Fsm.AddState(new ProspectingState {
                    Priority = 50
                });
                Fsm.AddState(Grinding);
                Fsm.AddState(new Farming {
                    Priority = 20
                });
                Fsm.AddState(MovementLoop);
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Grinder");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Grinder > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
 public CharaCombatClass(CombatClass combatClass)
 {
     CombatClass = combatClass;
 }
Exemple #27
0
        internal static bool Pulse()
        {
            try
            {
                if (ObjectManager.Me.Level < 90)
                {
                    Logging.Write("You don't have the required level for this product.");
                    return(false);
                }
                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 110
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 100
                });
                Fsm.AddState(new Regeneration {
                    Priority = 90
                });
                Fsm.AddState(new ToTown {
                    Priority = 80
                });
                Fsm.AddState(new Looting {
                    Priority = 70
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 60
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 50
                });
                Fsm.AddState(new Farming {
                    Priority = 40
                });
                Fsm.AddState(new GarrisonState {
                    Priority = 30
                });

                /* 2
                 * SendFollowerOnDuty - Plugins?
                 */
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(5, "FSM GarrisonFarming");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("GarrisonFarming > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #28
0
        internal static bool Pulse()
        {
            try
            {
                SurveySpell = new Spell("Survey");
                if (!SurveySpell.KnownSpell)
                {
                    MessageBox.Show(Translate.Get(Translate.Id.Survey_spell_not_found__stopping_tnb));
                    Logging.Write("Survey spell not found, stopping bot.");
                    return(false);
                }

                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 130
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 120
                });
                Fsm.AddState(new ToTown {
                    Priority = 110
                });
                Fsm.AddState(new Looting {
                    Priority = 100
                });
                Fsm.AddState(new Travel {
                    Priority = 90
                });
                Fsm.AddState(new Regeneration {
                    Priority = 80
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 70
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 60
                });
                Fsm.AddState(new Trainers {
                    Priority = 59
                });
                Fsm.AddState(new AutoItemCombiner {
                    Priority = 52
                });
                Fsm.AddState(new MillingState {
                    Priority = 51
                });
                Fsm.AddState(new ProspectingState {
                    Priority = 50
                });
                Fsm.AddState(new Farming {
                    Priority = 20
                });
                Fsm.AddState(new ArchaeologyStates
                {
                    Priority         = 10,
                    SolvingEveryXMin = ArchaeologistSetting.CurrentSetting.SolvingEveryXMin,
                    MaxTryByDigsite  = ArchaeologistSetting.CurrentSetting.MaxTryByDigsite,
                    UseKeystones     = ArchaeologistSetting.CurrentSetting.UseKeystones,
                    CrateRestored    = ArchaeologistSetting.CurrentSetting.CrateRestored
                });
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Archaeologist");
                Archaeology.Initialize();
                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Archaeologist > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }
Exemple #29
0
        public static void Pulse(IEnumerable <WoWUnit> woWUnits)
        {
            try
            {
                woWUnits = woWUnits.OrderBy(x => x.GetDistance);
                foreach (WoWUnit wowUnit in woWUnits)
                {
                    try
                    {
                        if (Products.Products.IsStarted)
                        {
                            if (nManagerSetting.IsBlackListed(wowUnit.Guid))
                            {
                                continue;
                            }

                            MovementManager.StopMove();
                            MovementManager.StopMove();
                            Thread.Sleep(250 + Usefuls.Latency);
                            while (ObjectManager.ObjectManager.Me.IsCast)
                            {
                                Thread.Sleep(200);
                            }

                            if (!wowUnit.IsValid)
                            {
                                continue;
                            }

                            bool looted = false;
                            if (wowUnit.IsLootable)
                            {
                                Logging.Write("Loot " + wowUnit.Name);
                            }
                            else if (wowUnit.IsSkinnable && nManagerSetting.CurrentSetting.ActivateBeastSkinning)
                            {
                                Logging.Write("Skin " + wowUnit.Name);
                            }
                            else
                            {
                                continue;
                            }
                            FarmingTask.CurUnit = wowUnit;

                            // We have no item to loot at range, then go to mob
                            if (!CombatClass.InMeleeRange(wowUnit) && (!nManagerSetting.CurrentSetting.UseLootARange || LootARangeId == 0 ||
                                                                       ObjectManager.ObjectManager.Me.Position.DistanceTo(wowUnit.Position) > 40f || !ItemsManager.IsItemUsable(LootARangeId)))
                            {
                                bool         success;
                                List <Point> points = PathFinder.FindPath(wowUnit.Position, out success);
                                if (points.Count <= 0)
                                {
                                    points.Add(ObjectManager.ObjectManager.Me.Position);
                                    points.Add(wowUnit.Position);
                                }
                                if (!success)
                                {
                                    if ((points.Count == 2 && wowUnit.GetDistance > 6) || points.Count != 2)
                                    {
                                        // we didn't find a valid path and the target is not that close, blacklisting.
                                        // Straightline wont help anyway.
                                        Logging.Write("No path to " + wowUnit.Name + ", blacklisting.");
                                        nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                    }
                                }
                                MovementManager.Go(points);
                                Timer timer = new Timer((int)(Math.DistanceListPoint(points) / 3 * 1000) + 3000);
                                while (!ObjectManager.ObjectManager.Me.IsDeadMe && wowUnit.IsValid &&
                                       Products.Products.IsStarted &&
                                       ObjectManager.ObjectManager.GetNumberAttackPlayer() == 0 &&
                                       !(ObjectManager.ObjectManager.Me.InCombat &&
                                         !(ObjectManager.ObjectManager.Me.IsMounted &&
                                           (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))) &&
                                       !timer.IsReady)
                                {
                                    if (ObjectManager.ObjectManager.Me.Position.DistanceTo(wowUnit.Position) <= 4.0f)
                                    {
                                        MovementManager.StopMove();
                                        MovementManager.StopMove();
                                        MountTask.DismountMount();
                                        Thread.Sleep(250);
                                        while (ObjectManager.ObjectManager.Me.GetMove)
                                        {
                                            Thread.Sleep(50);
                                        }
                                        break;
                                    }
                                }
                            }
                            // Now loot
                            if (wowUnit.IsLootable)
                            {
                                // Code for 109167 Findle's Loot-A-Range and 60854 Loot-A-Rang
                                if (nManagerSetting.CurrentSetting.UseLootARange && !CombatClass.InMeleeRange(wowUnit) &&
                                    ObjectManager.ObjectManager.Me.Position.DistanceTo(wowUnit.Position) <= 40f && LootARangeId != 0 &&
                                    ItemsManager.IsItemUsable(LootARangeId))
                                {
                                    // Since these items have a CD of only 3 sec, it's worth waiting for the CD to recover
                                    while (ItemsManager.IsItemOnCooldown(LootARangeId))
                                    {
                                        Thread.Sleep(250);
                                    }
                                    FarmingTask.CountThisLoot = true;
                                    FarmingTask.NodeOrUnit    = false;
                                    ItemsManager.UseToy(LootARangeId);
                                    Thread.Sleep(1000 + Usefuls.Latency);
                                    while (ObjectManager.ObjectManager.Me.IsCast)
                                    {
                                        if (ObjectManager.ObjectManager.Me.InCombat && !(ObjectManager.ObjectManager.Me.IsMounted && (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying)))
                                        {
                                            return;
                                        }
                                        Thread.Sleep(150);
                                    }
                                }
                                else
                                {
                                    FarmingTask.CountThisLoot = true;
                                    FarmingTask.NodeOrUnit    = false;
                                    Interact.InteractWith(wowUnit.GetBaseAddress);
                                    if ((ObjectManager.ObjectManager.Me.InCombat && !(ObjectManager.ObjectManager.Me.IsMounted && (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))))
                                    {
                                        return;
                                    }
                                    Thread.Sleep(500 + Usefuls.Latency);
                                }
                                if (nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                                    ObjectManager.ObjectManager.GetNumberAttackPlayer() > 0)
                                {
                                    return;
                                }
                                Statistics.Loots++;

                                if (nManagerSetting.CurrentSetting.ActivateBeastSkinning)
                                {
                                    Thread.Sleep(475 + Usefuls.Latency); // let the client react to unit flag change
                                    looted = true;
                                }
                                else
                                {
                                    WoWUnit unit = wowUnit;
                                    // we blacklist all unit around for a short time to be sure we loot then
                                    foreach (WoWUnit u in woWUnits.Where(u => u != unit).Where(u => u.Position.DistanceTo2D(unit.Position) <= 25f))
                                    {
                                        nManagerSetting.AddBlackList(u.Guid, 475 + Usefuls.Latency);
                                    }
                                    nManagerSetting.AddBlackList(wowUnit.Guid, 475 + Usefuls.Latency);
                                    return;
                                }
                            }
                            if ((looted || !wowUnit.IsLootable) && !wowUnit.IsSkinnable)
                            {
                                continue;
                            }
                            // From here we are sure the unit is skinnable
                            // if this is the unit we just looted, we need to redo check for extra loot
                            // if this is NOT the unit we just looted, then the check is already done at list building time
                            if (nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                                ObjectManager.ObjectManager.GetNumberAttackPlayer() == 0)
                            {
                                if ((looted || !wowUnit.IsLootable))
                                {
                                    if (wowUnit.ExtraLootType.HasFlag(TypeFlag.HERB_LOOT) || wowUnit.Entry == 112052 || wowUnit.Entry == 113646)
                                    {
                                        int myHerbalismLevel = Skill.GetValue(SkillLine.Herbalism);
                                        if (myHerbalismLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                    else if (wowUnit.ExtraLootType.HasFlag(TypeFlag.MINING_LOOT) || wowUnit.Entry == 104895 || wowUnit.Entry == 104877)
                                    {
                                        int myMiningLevel = Skill.GetValue(SkillLine.Mining);
                                        if (myMiningLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                    else if (wowUnit.ExtraLootType.HasFlag(TypeFlag.ENGENEERING_LOOT))
                                    {
                                        int myEngineeringLevel = Skill.GetValue(SkillLine.Engineering);
                                        if (myEngineeringLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        int mySkinningLevel = Skill.GetValue(SkillLine.Skinning);
                                        if (mySkinningLevel <= 0)
                                        {
                                            nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                                            continue;
                                        }
                                    }
                                }
                                // If we looted at range, we must go to creature to skin it
                                if (!CombatClass.InMeleeRange(wowUnit))
                                {
                                    List <Point> points = PathFinder.FindPath(wowUnit.Position);
                                    if (points.Count <= 0)
                                    {
                                        points.Add(ObjectManager.ObjectManager.Me.Position);
                                        points.Add(wowUnit.Position);
                                    }
                                    MovementManager.Go(points);
                                    Timer timer = new Timer((int)(Math.DistanceListPoint(points) / 3 * 1000) + 3000);
                                    while (!ObjectManager.ObjectManager.Me.IsDeadMe && wowUnit.IsValid &&
                                           Products.Products.IsStarted &&
                                           ObjectManager.ObjectManager.GetNumberAttackPlayer() == 0 &&
                                           !(ObjectManager.ObjectManager.Me.InCombat &&
                                             !(ObjectManager.ObjectManager.Me.IsMounted &&
                                               (nManagerSetting.CurrentSetting.IgnoreFightIfMounted || Usefuls.IsFlying))) &&
                                           !timer.IsReady)
                                    {
                                        if (CombatClass.InMeleeRange(wowUnit))
                                        {
                                            MovementManager.StopMove();
                                            MovementManager.StopMove();
                                            MountTask.DismountMount();
                                            Thread.Sleep(250);
                                            while (ObjectManager.ObjectManager.Me.GetMove)
                                            {
                                                Thread.Sleep(50);
                                            }
                                            break;
                                        }
                                    }
                                }
                                Logging.Write("Skin " + wowUnit.Name);
                                Interact.InteractWith(wowUnit.GetBaseAddress);
                                Thread.Sleep(200 + Usefuls.Latency);
                                while (ObjectManager.ObjectManager.Me.IsCast)
                                {
                                    Thread.Sleep(100);
                                }
                                if ((ObjectManager.ObjectManager.Me.InCombat &&
                                     !(ObjectManager.ObjectManager.Me.IsMounted &&
                                       (nManagerSetting.CurrentSetting.IgnoreFightIfMounted ||
                                        Usefuls.IsFlying))))
                                {
                                    return;
                                }
                                Thread.Sleep(400 + Usefuls.Latency);
                                if (nManagerSetting.CurrentSetting.ActivateBeastSkinning &&
                                    ObjectManager.ObjectManager.GetNumberAttackPlayer() > 0)
                                {
                                    return;
                                }
                                Statistics.Farms++;
                                nManagerSetting.AddBlackList(wowUnit.Guid, 1000 * 60 * 5);
                            }
                        }
                        MovementManager.StopMove();
                        MovementManager.StopMove();
                    }
                    catch
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.WriteError("LootingTask > Pulse(IEnumerable<WoWUnit> woWUnits): " + ex);
            }
        }
Exemple #30
0
        internal static bool Pulse(bool autoLoaded = false)
        {
            try
            {
                if (!autoLoaded)
                {
                    // Load Profile:
                    LoadProfile f = new LoadProfile();
                    f.ShowDialog();
                }
                if (!File.Exists(Application.StartupPath + "\\Profiles\\Gatherer\\" + GathererSetting.CurrentSetting.ProfileName))
                {
                    return(false);
                }
                Profile = XmlSerializer.Deserialize <GathererProfile>(Application.StartupPath + "\\Profiles\\Gatherer\\" + GathererSetting.CurrentSetting.ProfileName);
                if (Profile.Points.Count <= 0)
                {
                    return(false);
                }

                // Reverse profil
                if (GathererSetting.CurrentSetting.PathingReverseDirection)
                {
                    Profile.Points.Reverse();
                }

                NpcDB.AddNpcRange(Profile.Npc);
                nManagerSetting.AddRangeBlackListZone(new List <nManagerSetting.BlackListZone>(Profile.BlackListRadius));

                // Load CC:
                CombatClass.LoadCombatClass();

                // FSM
                Fsm.States.Clear();

                Fsm.AddState(new Pause {
                    Priority = 200
                });
                Fsm.AddState(new Resurrect {
                    Priority = 130
                });
                Fsm.AddState(new IsAttacked {
                    Priority = 120
                });
                Fsm.AddState(new Regeneration {
                    Priority = 110
                });
                Fsm.AddState(new ToTown {
                    Priority = 100
                });
                Fsm.AddState(new Looting {
                    Priority = 90
                });
                Fsm.AddState(new Travel {
                    Priority = 80
                });
                Fsm.AddState(new SpecializationCheck {
                    Priority = 70
                });
                Fsm.AddState(new LevelupCheck {
                    Priority = 60
                });
                Fsm.AddState(new Trainers {
                    Priority = 59
                });
                Fsm.AddState(new AutoItemCombiner {
                    Priority = 52
                });
                Fsm.AddState(new MillingState {
                    Priority = 51
                });
                Fsm.AddState(new ProspectingState {
                    Priority = 50
                });
                Fsm.AddState(new Farming {
                    Priority = 20
                });
                Fsm.AddState(new MovementLoop {
                    Priority = 10, PathLoop = Profile.Points
                });
                Fsm.AddState(new Idle {
                    Priority = 0
                });

                foreach (var statePlugin in Plugins.ListLoadedStatePlugins)
                {
                    Fsm.AddState(statePlugin);
                }

                Fsm.States.Sort();
                Fsm.StartEngine(7, "FSM Gatherer");

                return(true);
            }
            catch (Exception e)
            {
                try
                {
                    Dispose();
                }
                catch
                {
                }
                Logging.WriteError("Gatherer > Bot > Bot  > Pulse(): " + e);
                return(false);
            }
        }