コード例 #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();
                }
            }
        }
コード例 #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
 }
コード例 #3
0
 public TankTargetSelectionLogic(WowInterface wowInterface, AmeisenBotConfig config)
 {
     WowInterface       = wowInterface;
     PriorityTargets    = new List <int>();
     BlacklistedTargets = new List <int>();
     Config             = config;
 }
コード例 #4
0
        public SettingsWindow(AmeisenBotConfig config)
        {
            Config         = config;
            PendingChanges = false;

            InitializeComponent();
        }
コード例 #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();
 }
コード例 #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
                       );
        }
コード例 #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);
 }
コード例 #8
0
ファイル: MainWindow.xaml.cs プロジェクト: jfla15/AmeisenBotX
        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);
        }
コード例 #9
0
        public IdleActionManager(AmeisenBotConfig config, IEnumerable <IIdleAction> idleActions)
        {
            Config      = config;
            IdleActions = idleActions;

            Rnd         = new();
            LastActions = new();
        }
コード例 #10
0
        public FollowMovementProvider(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            Bot    = bot;
            Config = config;

            Random           = new();
            OffsetCheckEvent = new(TimeSpan.FromMilliseconds(30000));
        }
コード例 #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;
 }
コード例 #12
0
ファイル: StateAttacking.cs プロジェクト: jfla15/AmeisenBotX
        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;
        }
コード例 #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));
        }
コード例 #14
0
ファイル: QuestEngine.cs プロジェクト: jaydeshow/AmeisenBotX
        public QuestEngine(WowInterface wowInterface, AmeisenBotConfig config, AmeisenBotStateMachine stateMachine)
        {
            WowInterface = wowInterface;
            Config       = config;
            StateMachine = stateMachine;

            CompletedQuests           = new List <int>();
            QueryCompletedQuestsEvent = new TimegatedEvent(TimeSpan.FromSeconds(2));
        }
コード例 #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;
 }
コード例 #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();
        }
コード例 #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"));
        }
コード例 #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
                           );
        }
コード例 #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>();
        }
コード例 #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;
 }
コード例 #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)>();
        }
コード例 #22
0
ファイル: StateIdle.cs プロジェクト: vpoverennov/AmeisenBotX
        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));
        }
コード例 #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>();
 }
コード例 #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;
        }
コード例 #25
0
ファイル: JobEngine.cs プロジェクト: jaydeshow/AmeisenBotX
        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>();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #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);
        }