Esempio n. 1
0
        public static void Run(WowInterface wowInterface, AmeisenBotConfig config)
        {
            // create a copy here to prevent updates while selling
            foreach (IWowItem item in wowInterface.CharacterManager.Inventory.Items.Where(e => e.Price > 0).ToList())
            {
                IWowItem itemToSell = item;

                if (config.ItemSellBlacklist.Any(e => e.Equals(item.Name, StringComparison.OrdinalIgnoreCase)) ||
                    (!config.SellGrayItems && item.ItemQuality == WowItemQuality.Poor) ||
                    (!config.SellWhiteItems && item.ItemQuality == WowItemQuality.Common) ||
                    (!config.SellGreenItems && item.ItemQuality == WowItemQuality.Uncommon) ||
                    (!config.SellBlueItems && item.ItemQuality == WowItemQuality.Rare) ||
                    (!config.SellPurpleItems && item.ItemQuality == WowItemQuality.Epic))
                {
                    continue;
                }

                if (wowInterface.CharacterManager.IsItemAnImprovement(item, out IWowItem itemToReplace))
                {
                    // equip item and sell the other after
                    itemToSell = itemToReplace;
                    wowInterface.HookManager.LuaEquipItem(item, itemToReplace);
                }

                if (itemToSell != null &&
                    (wowInterface.ObjectManager.Player.Class != WowClass.Hunter || itemToSell.GetType() != typeof(WowProjectile)))
                {
                    wowInterface.HookManager.LuaUseContainerItem(itemToSell.BagId, itemToSell.BagSlot);
                    wowInterface.HookManager.LuaCofirmStaticPopup();
                }
            }
        }
Esempio n. 2
0
 public DeathknightBlood(WowInterface wowInterface, AmeisenBotConfig config)
 {
     WowInterface  = wowInterface;
     ObjectManager = wowInterface.ObjectManager;
     HookManager   = wowInterface.HookManager;
     TargetManager = new TargetManager(new DpsTargetSelectionLogic(wowInterface, config), TimeSpan.FromMilliseconds(250));//Heal/Tank/DPS
 }
Esempio n. 3
0
 public TankTargetSelectionLogic(WowInterface wowInterface, AmeisenBotConfig config)
 {
     WowInterface       = wowInterface;
     PriorityTargets    = new List <int>();
     BlacklistedTargets = new List <int>();
     Config             = config;
 }
Esempio n. 4
0
        public SettingsWindow(AmeisenBotConfig config)
        {
            Config         = config;
            PendingChanges = false;

            InitializeComponent();
        }
Esempio n. 5
0
 public static void Run(AmeisenBotInterfaces bot, AmeisenBotConfig config)
 {
     // this can fail for myriad of reasons like not having enough money to buy service, or npc getting rekt/trainerFrame bugging out
     // this basically assumes unlimited cash supply and stable trainer frame open while executing
     bot.Wow.ClickOnTrainButton();
     bot.Wow.ClearTarget();
 }
Esempio n. 6
0
        public DefaultTestEngine(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            Bot    = bot;
            Config = config;

            RootSelector = new Selector
                           (
                () => trainer != null,
                new Selector
                (
                    () => Bot.Wow.UiIsVisible("GossipFrame"),
                    new Selector
                    (
                        () => SelectedTraining(),
                        new Leaf(TrainAll),
                        new Leaf(Fail)
                    ),
                    new Leaf(OpenTrainer)
                ),
                new Leaf(GetTrainer)
                           );

            TestTree = new Tree
                       (
                RootSelector
                       );
        }
Esempio n. 7
0
 public StateLogin(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, IOffsetList offsetList, CharacterManager characterManager) : base(stateMachine)
 {
     Config           = config;
     OffsetList       = offsetList;
     CharacterManager = characterManager;
     LoginHandler     = new DefaultLoginHandler(AmeisenBotStateMachine.XMemory, offsetList);
 }
Esempio n. 8
0
        private AmeisenBotConfig LoadConfig()
        {
            LoadConfigWindow loadConfigWindow = new LoadConfigWindow(BotDataPath);

            loadConfigWindow.ShowDialog();

            if (loadConfigWindow.ConfigToLoad.Length > 0)
            {
                AmeisenBotConfig config;
                if (File.Exists(loadConfigWindow.ConfigToLoad))
                {
                    config = JsonConvert.DeserializeObject <AmeisenBotConfig>(File.ReadAllText(loadConfigWindow.ConfigToLoad));
                }
                else
                {
                    config = new AmeisenBotConfig();
                }

                ConfigPath = loadConfigWindow.ConfigToLoad;
                return(config);
            }
            else
            {
                Close();
            }

            return(null);
        }
Esempio n. 9
0
        public IdleActionManager(AmeisenBotConfig config, IEnumerable <IIdleAction> idleActions)
        {
            Config      = config;
            IdleActions = idleActions;

            Rnd         = new();
            LastActions = new();
        }
Esempio n. 10
0
        public FollowMovementProvider(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            Bot    = bot;
            Config = config;

            Random           = new();
            OffsetCheckEvent = new(TimeSpan.FromMilliseconds(30000));
        }
Esempio n. 11
0
 public StateFollowing(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, ObjectManager objectManager, CharacterManager characterManager, IPathfindingHandler pathfindingHandler, IMovementEngine movementEngine) : base(stateMachine)
 {
     Config             = config;
     ObjectManager      = objectManager;
     CharacterManager   = characterManager;
     PathfindingHandler = pathfindingHandler;
     MovementEngine     = movementEngine;
 }
Esempio n. 12
0
        public StateAttacking(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, WowInterface wowInterface) : base(stateMachine, config, wowInterface)
        {
            Enemies = new List <WowUnit>();
            CombatClassStopwatch = new Stopwatch();

            // default distance values
            DistanceToTarget = WowInterface.CombatClass == null || WowInterface.CombatClass.IsMelee ? 3.0 : 25.0;
        }
Esempio n. 13
0
        public GrindingEngine(WowInterface wowInterface, AmeisenBotConfig config, AmeisenBotStateMachine stateMachine)
        {
            WowInterface = wowInterface;
            Config       = config;
            StateMachine = stateMachine;

            Blacklist        = new List <ulong>();
            TargetInLosEvent = new TimegatedEvent(TimeSpan.FromMilliseconds(500));
        }
Esempio n. 14
0
        public QuestEngine(WowInterface wowInterface, AmeisenBotConfig config, AmeisenBotStateMachine stateMachine)
        {
            WowInterface = wowInterface;
            Config       = config;
            StateMachine = stateMachine;

            CompletedQuests           = new List <int>();
            QueryCompletedQuestsEvent = new TimegatedEvent(TimeSpan.FromSeconds(2));
        }
Esempio n. 15
0
 public StateGhost(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, IOffsetList offsetList, ObjectManager objectManager, CharacterManager characterManager, HookManager hookManager, IPathfindingHandler pathfindingHandler, IMovementEngine movementEngine) : base(stateMachine)
 {
     Config             = config;
     ObjectManager      = objectManager;
     CharacterManager   = characterManager;
     HookManager        = hookManager;
     OffsetList         = offsetList;
     PathfindingHandler = pathfindingHandler;
     MovementEngine     = movementEngine;
 }
Esempio n. 16
0
        public AmeisenBotStateMachine(
            string botDataPath,
            Process wowProcess,
            AmeisenBotConfig config,
            XMemory xMemory,
            IOffsetList offsetList,
            ObjectManager objectManager,
            CharacterManager characterManager,
            HookManager hookManager,
            EventHookManager eventHookManager,
            IAmeisenBotCache botCache,
            IPathfindingHandler pathfindingHandler,
            IMovementEngine movementEngine,
            ICombatClass combatClass)
        {
            AmeisenLogger.Instance.Log("Starting AmeisenBotStateMachine...", LogLevel.Verbose);

            BotDataPath      = botDataPath;
            Config           = config;
            XMemory          = xMemory;
            OffsetList       = offsetList;
            ObjectManager    = objectManager;
            CharacterManager = characterManager;
            HookManager      = hookManager;
            EventHookManager = eventHookManager;
            BotCache         = botCache;

            LastObjectUpdate = DateTime.Now;
            LastGhostCheck   = DateTime.Now;
            LastEventPull    = DateTime.Now;

            LastState    = AmeisenBotState.None;
            UnitLootList = new Queue <ulong>();

            States = new Dictionary <AmeisenBotState, State>()
            {
                { AmeisenBotState.None, new StateNone(this, config) },
                { AmeisenBotState.StartWow, new StateStartWow(this, config, wowProcess, xMemory) },
                { AmeisenBotState.Login, new StateLogin(this, config, offsetList, characterManager) },
                { AmeisenBotState.LoadingScreen, new StateLoadingScreen(this, xMemory, config, objectManager) },
                { AmeisenBotState.Idle, new StateIdle(this, config, offsetList, objectManager, characterManager, hookManager, eventHookManager, combatClass, UnitLootList) },
                { AmeisenBotState.Dead, new StateDead(this, config, objectManager, hookManager) },
                { AmeisenBotState.Ghost, new StateGhost(this, config, offsetList, objectManager, characterManager, hookManager, pathfindingHandler, movementEngine) },
                { AmeisenBotState.Following, new StateFollowing(this, config, objectManager, characterManager, pathfindingHandler, movementEngine) },
                { AmeisenBotState.Attacking, new StateAttacking(this, config, objectManager, characterManager, hookManager, pathfindingHandler, movementEngine, combatClass) },
                { AmeisenBotState.Repairing, new StateRepairing(this, config, objectManager, hookManager, characterManager, pathfindingHandler, movementEngine) },
                { AmeisenBotState.Selling, new StateSelling(this, config, objectManager, hookManager, characterManager, pathfindingHandler, movementEngine) },
                { AmeisenBotState.Healing, new StateEating(this, config, objectManager, characterManager) },
                { AmeisenBotState.InsideAoeDamage, new StateInsideAoeDamage(this, config, objectManager, characterManager, pathfindingHandler, movementEngine) },
                { AmeisenBotState.Looting, new StateLooting(this, config, offsetList, objectManager, characterManager, hookManager, pathfindingHandler, movementEngine, UnitLootList) }
            };

            CurrentState = States.First();
            CurrentState.Value.Enter();
        }
Esempio n. 17
0
        public ConfigEditorWindow(string dataDir, AmeisenBotConfig initialConfig = null)
        {
            InitializeComponent();

            DataDir   = dataDir;
            NewConfig = initialConfig == null;
            Config    = initialConfig ?? new AmeisenBotConfig();

            normalBorderBrush = new SolidColorBrush((Color)FindResource("DarkBorder"));
            errorBorderBrush  = new SolidColorBrush((Color)FindResource("DarkError"));
        }
Esempio n. 18
0
        public DefaultDungeonEngine(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            Bot    = bot;
            Config = config;

            CurrentNodes     = new();
            ExitDungeonEvent = new(TimeSpan.FromMilliseconds(1000));
            InteractionEvent = new(TimeSpan.FromMilliseconds(1000));

            RootSelector = new
                           (
                () => Progress == 100.0,
                new Leaf(ExitDungeon),
                new Selector
                (
                    () => IDied,
                    new Sequence
                    (
                        new Leaf(() => MoveToPosition(DeathPosition)),
                        new Leaf(() =>
            {
                IDied = false;
                return(BtStatus.Success);
            })
                    ),
                    new Selector
                    (
                        () => Bot.Objects.Partyleader == null || Bot.Objects.Partyleader.Guid == Bot.Wow.PlayerGuid || !Bot.Objects.PartymemberGuids.Any(),
                        new Selector
                        (
                            () => AreAllPlayersPresent(20.0f, 14.0f),
                            new Selector
                            (
                                () => Bot.Objects.Partymembers.Any(e => e.Auras.Any(e => Bot.Db.GetSpellName(e.SpellId) == "Food") || e.Auras.Any(e => Bot.Db.GetSpellName(e.SpellId) == "Drink")),
                                new Leaf(() => { return(BtStatus.Success); }),
                                new Leaf(() => FollowNodePath())
                            ),
                            new Leaf(() => { return(BtStatus.Success); })
                        ),
                        new Selector
                        (
                            () => Bot.Objects.Partyleader != null,
                            new Leaf(() => MoveToPosition(Bot.Objects.Partyleader.Position + LeaderFollowOffset, 0.0f, MovementAction.Follow)),
                            new Leaf(() => { return(BtStatus.Success); })
                        )
                    )
                )
                           );

            BehaviorTree = new
                           (
                RootSelector
                           );
        }
Esempio n. 19
0
        public CharacterManager(AmeisenBotConfig config, WowInterface wowInterface)
        {
            WowInterface = wowInterface;
            Config       = config;

            Inventory      = new CharacterInventory(WowInterface);
            Equipment      = new CharacterEquipment(WowInterface);
            SpellBook      = new SpellBook(WowInterface);
            ItemComparator = new ItemLevelComparator();
            Skills         = new List <string>();
        }
Esempio n. 20
0
 public StateIdle(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, IOffsetList offsetList, ObjectManager objectManager, CharacterManager characterManager, HookManager hookManager, EventHookManager eventHookManager, ICombatClass combatClass, Queue <ulong> unitLootList) : base(stateMachine)
 {
     Config           = config;
     OffsetList       = offsetList;
     ObjectManager    = objectManager;
     HookManager      = hookManager;
     EventHookManager = eventHookManager;
     CharacterManager = characterManager;
     CombatClass      = combatClass;
     UnitLootList     = unitLootList;
 }
Esempio n. 21
0
        public CharacterManager(AmeisenBotConfig config, WowInterface wowInterface)
        {
            WowInterface = wowInterface;
            Config       = config;

            Inventory      = new CharacterInventory(WowInterface);
            Equipment      = new CharacterEquipment(WowInterface);
            SpellBook      = new SpellBook(WowInterface);
            TalentManager  = new TalentManager(WowInterface);
            ItemComparator = new ItemLevelComparator();
            Skills         = new Dictionary <string, (int, int)>();
        }
Esempio n. 22
0
        public StateIdle(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, WowInterface wowInterface) : base(stateMachine, config, wowInterface)
        {
            FirstStart = true;

            BagSlotCheckEvent         = new TimegatedEvent(TimeSpan.FromMilliseconds(5000));
            EatCheckEvent             = new TimegatedEvent(TimeSpan.FromMilliseconds(2000));
            LootCheckEvent            = new TimegatedEvent(TimeSpan.FromMilliseconds(2000));
            RepairCheckEvent          = new TimegatedEvent(TimeSpan.FromMilliseconds(5000));
            QuestgiverCheckEvent      = new TimegatedEvent(TimeSpan.FromMilliseconds(2000));
            QuestgiverRightClickEvent = new TimegatedEvent(TimeSpan.FromMilliseconds(3000));
            RefreshCharacterEvent     = new TimegatedEvent(TimeSpan.FromMilliseconds(1000));
        }
Esempio n. 23
0
 public StateLooting(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, IOffsetList offsetList, ObjectManager objectManager, CharacterManager characterManager, HookManager hookManager, IPathfindingHandler pathfindingHandler, IMovementEngine movementEngine, Queue <ulong> unitLootList) : base(stateMachine)
 {
     Config                 = config;
     ObjectManager          = objectManager;
     CharacterManager       = characterManager;
     HookManager            = hookManager;
     OffsetList             = offsetList;
     PathfindingHandler     = pathfindingHandler;
     MovementEngine         = movementEngine;
     UnitLootList           = unitLootList;
     UnitsAlreadyLootedList = new List <ulong>();
 }
Esempio n. 24
0
        public StateAttacking(AmeisenBotStateMachine stateMachine, AmeisenBotConfig config, ObjectManager objectManager, CharacterManager characterManager, HookManager hookManager, IPathfindingHandler pathfindingHandler, IMovementEngine movementEngine, ICombatClass combatClass) : base(stateMachine)
        {
            Config             = config;
            ObjectManager      = objectManager;
            CharacterManager   = characterManager;
            HookManager        = hookManager;
            PathfindingHandler = pathfindingHandler;
            MovementEngine     = movementEngine;
            CombatClass        = combatClass;

            // default distance values
            DistanceToTarget = combatClass == null || combatClass.IsMelee ? 3.0 : 25.0;
        }
Esempio n. 25
0
        public JobEngine(WowInterface wowInterface, AmeisenBotConfig config)
        {
            AmeisenLogger.I.Log("JobEngine", $"Initializing", LogLevel.Verbose);

            WowInterface = wowInterface;
            Config       = config;

            MiningEvent    = new TimegatedEvent(TimeSpan.FromSeconds(1));
            BlacklistEvent = new TimegatedEvent(TimeSpan.FromSeconds(1));
            MailSentEvent  = new TimegatedEvent(TimeSpan.FromSeconds(3));

            NodeBlacklist = new List <ulong>();
        }
Esempio n. 26
0
        public DefaultJobEngine(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            AmeisenLogger.I.Log("JobEngine", $"Initializing", LogLevel.Verbose);

            Bot    = bot;
            Config = config;

            MiningEvent    = new(TimeSpan.FromSeconds(1));
            BlacklistEvent = new(TimeSpan.FromSeconds(1));
            MailSentEvent  = new(TimeSpan.FromSeconds(3));

            NodeBlacklist = new();
        }
Esempio n. 27
0
        public AMovementEngine(AmeisenBotConfig config)
        {
            Config = config;

            FindPathEvent           = new TimegatedEvent(TimeSpan.FromMilliseconds(500));
            RefreshPathEvent        = new TimegatedEvent(TimeSpan.FromMilliseconds(500));
            DistanceMovedCheckEvent = new TimegatedEvent(TimeSpan.FromMilliseconds(500));

            PathQueue         = new Queue <Vector3>();
            PlacesToAvoidList = new List <(Vector3 position, float radius, DateTime until)>();

            PlayerVehicle = new BasicVehicle();
        }
Esempio n. 28
0
        public MovementEngine(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            Bot    = bot;
            Config = config;

            FindPathEvent           = new(TimeSpan.FromMilliseconds(500));
            RefreshPathEvent        = new(TimeSpan.FromMilliseconds(500));
            DistanceMovedCheckEvent = new(TimeSpan.FromMilliseconds(500));

            PathQueue         = new();
            PlacesToAvoidList = new();

            PlayerVehicle = new(bot);
        }
Esempio n. 29
0
        public CharacterManager(AmeisenBotConfig config, WowInterface wowInterface)
        {
            WowInterface = wowInterface;
            Config       = config;

            Inventory      = new(WowInterface);
            Equipment      = new(WowInterface);
            SpellBook      = new(WowInterface);
            TalentManager  = new(WowInterface);
            ItemComparator = new ItemLevelComparator();
            Skills         = new();

            ItemSlotsToSkip = new();
        }
Esempio n. 30
0
        public AMovementEngine(WowInterface wowInterface, AmeisenBotConfig config)
        {
            WowInterface = wowInterface;
            Config       = config;

            FindPathEvent           = new(TimeSpan.FromMilliseconds(500));
            RefreshPathEvent        = new(TimeSpan.FromMilliseconds(500));
            DistanceMovedCheckEvent = new(TimeSpan.FromMilliseconds(500));

            PathQueue         = new();
            PlacesToAvoidList = new();

            PlayerVehicle = new(wowInterface);
        }