Exemplo n.º 1
0
 public virtual void Update(IMemoryApi memoryApi, IOffsetList offsetList)
 {
     if (DescriptorAddress != IntPtr.Zero && memoryApi.Read(DescriptorAddress, out WowObjectDescriptor obj))
     {
         RawObject = obj;
     }
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 public HookManager(XMemory xMemory, IOffsetList offsetList, ObjectManager objectManager, IAmeisenBotCache botCache)
 {
     XMemory       = xMemory;
     OffsetList    = offsetList;
     ObjectManager = objectManager;
     BotCache      = botCache;
 }
Exemplo n.º 4
0
        public AmeisenBotManager(Dispatcher dispatcher, IOffsetList offsetList, Settings settings)
        {
            AmeisenBotLogger.Instance.Log("Initializing AmeisenBotManager", LogLevel.Verbose);

            Dispatcher = dispatcher;
            OffsetList = offsetList;
            Settings   = settings;

            WowAccounts = new Dictionary <WowAccount, BotStartState>();

            WowStartQueue = new Queue <WowAccount>();
            LoginQueue    = new Queue <WowAccount>();

            foreach (WowAccount account in JsonConvert.DeserializeObject <List <WowAccount> >(File.ReadAllText(Settings.BotFleetConfig)))
            {
                WowAccounts.Add(account, BotStartState.None);
            }

            IAmeisenBotViews   = new List <IAmeisenBotView>();
            ManagedAmeisenBots = new List <ManagedAmeisenBot>();

            ActiveWowTimer          = new Timer();
            ActiveWowTimer.Elapsed += ActiveWowTimer_Elapsed;
            ActiveWowTimer.Interval = 1000;
            ActiveWowTimer.Start();
        }
Exemplo n.º 5
0
        public override void Update(IMemoryApi memoryApi, IOffsetList offsetList)
        {
            base.Update(memoryApi, offsetList);

            if (!memoryApi.Read(DescriptorAddress + WowObjectDescriptor.EndOffset,
                                out WowItemDescriptor objPtr))
            {
                return;
            }

            Count = objPtr.StackCount;
            Owner = objPtr.Owner;

            ItemEnchantments = new List <ItemEnchantment>
            {
                objPtr.Enchantment1,
                objPtr.Enchantment2,
                objPtr.Enchantment3,
                objPtr.Enchantment4,
                objPtr.Enchantment5,
                objPtr.Enchantment6,
                objPtr.Enchantment7,
                objPtr.Enchantment8,
                objPtr.Enchantment9,
                objPtr.Enchantment10,
                objPtr.Enchantment11,
                objPtr.Enchantment12,
            };
        }
Exemplo n.º 6
0
        public override void Update(IMemoryApi memoryApi, IOffsetList offsetList)
        {
            base.Update(memoryApi, offsetList);

            if (memoryApi.Read(DescriptorAddress + WowObjectDescriptor.EndOffset, out WowCorpseDescriptor obj))
            {
                RawWowCorpse = obj;
            }
        }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
0
        public MemoryWowActionExecutor(TrashMem trashMem, IOffsetList offsetList)
        {
            originalEndsceneBytes = offsetList.EndSceneBytes;

            TrashMem   = trashMem;
            OffsetList = offsetList;

            EndsceneAddress = GetEndScene();
            SetupEndsceneHook();
        }
Exemplo n.º 9
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();
        }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
0
        public ObjectManager(XMemory xMemory, IOffsetList offsetList, IAmeisenBotCache botCache)
        {
            IsWorldLoaded = true;

            WowObjects = new List <WowObject>();
            XMemory    = xMemory;
            OffsetList = offsetList;
            BotCache   = botCache;

            EnableClickToMove();
        }
Exemplo n.º 12
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>();
 }
Exemplo n.º 13
0
        public override void Update(IMemoryApi memoryApi, IOffsetList offsetList)
        {
            base.Update(memoryApi, offsetList);

            if (memoryApi.Read(DescriptorAddress + WowObjectDescriptor.EndOffset, out WowDynobjectDescriptor objPtr) &&
                memoryApi.Read(IntPtr.Add(BaseAddress, (int)offsetList.WowDynobjectPosition), out Vector3 position))
            {
                Caster   = objPtr.Caster;
                Radius   = objPtr.Radius;
                SpellId  = objPtr.SpellId;
                Position = position;
            }
        }
        public bool DoLogin(Process process, WowAccount wowAccount, IOffsetList offsetlist, int maxTries = 4)
        {
            try
            {
                TrashMem trashMem = new TrashMem(process);
                int      count    = 0;

                LoginInProgress = true;
                LoginInProgressCharactername = wowAccount.CharacterName;

                OffsetList = offsetlist;

                while (trashMem.ReadInt32(offsetlist.StaticIsWorldLoaded) != 1)
                {
                    if (process.HasExited || count >= maxTries)
                    {
                        return(false);
                    }

                    switch (trashMem.ReadString(offsetlist.StaticGameState, Encoding.ASCII, 10))
                    {
                    case "login":
                        HandleLogin(trashMem, process, wowAccount);
                        count++;
                        break;

                    case "charselect":
                        HandleCharSelect(trashMem, process, wowAccount);
                        break;

                    default:
                        count++;
                        break;
                    }

                    Thread.Sleep(2000);
                }
            }
            catch (Exception e)
            {
                AmeisenBotLogger.Instance.Log($"[{process.Id.ToString("X" , CultureInfo.InvariantCulture.NumberFormat)}]\tCrash at Login: \n{e}", LogLevel.Error);
                return(false);
            }

            AmeisenBotLogger.Instance.Log($"[{process.Id.ToString("X" , CultureInfo.InvariantCulture.NumberFormat)}]\tLogin successful...", LogLevel.Verbose);
            LoginInProgress = false;
            LoginInProgressCharactername = string.Empty;

            return(true);
        }
Exemplo n.º 15
0
        public CharacterManager(XMemory xMemory, AmeisenBotConfig config, IOffsetList offsetList, ObjectManager objectManager, HookManager hookManager)
        {
            XMemory       = xMemory;
            OffsetList    = offsetList;
            ObjectManager = objectManager;
            HookManager   = hookManager;
            Config        = config;

            KeyMap = new Dictionary <VirtualKeys, bool>();

            Inventory      = new CharacterInventory(hookManager);
            Equipment      = new CharacterEquipment(hookManager);
            SpellBook      = new SpellBook(hookManager);
            ItemComparator = new ItemLevelComparator();
            Skills         = new List <string>();
        }
Exemplo n.º 16
0
        public override void Update(IMemoryApi memoryApi, IOffsetList offsetList)
        {
            base.Update(memoryApi, offsetList);

            if (memoryApi.Read(DescriptorAddress + WowObjectDescriptor.EndOffset, out WowGameobjectDescriptor objPtr) &&
                memoryApi.Read(IntPtr.Add(BaseAddress, (int)offsetList.WowGameobjectPosition), out Vector3 position))
            {
                GameObjectType = (WowGameObjectType)objPtr.GameobjectBytes1;
                CreatedBy      = objPtr.CreatedBy;
                Bytes0         = objPtr.GameobjectBytes0;
                DisplayId      = objPtr.DisplayId;
                Faction        = objPtr.Faction;
                Flags          = new(objPtr.Flags);
                Level          = objPtr.Level;
                Position       = position;
            }
        }
        public MemoryWowDataAdapter(TrashMem trashMem, IOffsetList offsetList)
        {
            LastIsWorldLoaded = false;

            WowObjectList = new List <WowObject>();
            TrashMem      = trashMem;
            OffsetList    = offsetList;

            SetupAdapter();

            ObjectManager = new WowObjectManager(this);

            SetupWatchdogs();

            EnableAutoloot();
            EnableClickToMove();
        }
Exemplo n.º 18
0
        public override string ReadName(IMemoryApi memoryApi, IOffsetList offsetList)
        {
            if (memoryApi.Read(IntPtr.Add(offsetList.NameStore, (int)offsetList.NameMask), out uint nameMask) &&
                memoryApi.Read(IntPtr.Add(offsetList.NameStore, (int)offsetList.NameBase), out uint nameBase))
            {
                uint shortGuid = (uint)Guid & 0xfffffff;
                uint offset    = 12 * (nameMask & shortGuid);

                if (memoryApi.Read(new(nameBase + offset + 8), out uint current) &&
                    memoryApi.Read(new(nameBase + offset), out offset))
                {
                    if ((current & 0x1) == 0x1)
                    {
                        return(string.Empty);
                    }

                    memoryApi.Read(new(current), out uint testGuid);

                    while (testGuid != shortGuid)
                    {
                        memoryApi.Read(new(current + offset + 4), out current);

                        if ((current & 0x1) == 0x1)
                        {
                            return(string.Empty);
                        }

                        memoryApi.Read(new(current), out testGuid);
                    }

                    if (memoryApi.ReadString(new(current + (int)offsetList.NameString), Encoding.UTF8, out string name, 16))
                    {
                        return(name);
                    }
                }
            }

            return(string.Empty);
        }
Exemplo n.º 19
0
        public static List <WowProcess> GetRunningWows(IOffsetList offsetList)
        {
            List <WowProcess> wows        = new List <WowProcess>();
            List <Process>    processList = new List <Process>(Process.GetProcessesByName("Wow"));

            foreach (Process p in processList)
            {
                TrashMem trashMem = new TrashMem(p);
                uint     pDevice  = trashMem.ReadUnmanaged <uint>(offsetList.StaticEndSceneDevice);
                uint     pEnd     = trashMem.ReadUnmanaged <uint>(pDevice + offsetList.EndSceneOffsetDevice);
                uint     pScene   = trashMem.ReadUnmanaged <uint>(pEnd);
                uint     endscene = trashMem.ReadUnmanaged <uint>(pScene + offsetList.EndSceneOffset);

                bool isAlreadyHooked = false;
                try
                {
                    isAlreadyHooked = trashMem.ReadChar(endscene + 0x2) == 0xE9;
                }
                catch { }

                string name = trashMem.ReadString(offsetList.StaticPlayerName, Encoding.ASCII, 12);
                if (name.Length == 0)
                {
                    name = "";
                }

                string realm = trashMem.ReadString(offsetList.StaticRealmName, Encoding.ASCII, 12);
                if (realm.Length == 0)
                {
                    realm = "";
                }

                wows.Add(new WowProcess(p, name, realm, isAlreadyHooked));
                trashMem.Detach();
            }

            return(wows);
        }
Exemplo n.º 20
0
 public TracelineJumpHookModule(Action <IntPtr> onUpdate, Action <IHookModule> tick, IMemoryApi memoryApi, IOffsetList offsetList) : base(onUpdate, tick, memoryApi, 256)
 {
     OffsetList = offsetList;
 }
Exemplo n.º 21
0
 public WowMemoryApi(IOffsetList offsets)
     : base()
 {
     Offsets = offsets;
 }
Exemplo n.º 22
0
 public RunLuaHookModule(Action <IntPtr> onUpdate, Action <IHookModule> tick, IMemoryApi memoryApi, IOffsetList offsetList, string lua, string varName, uint allocSize = 128) : base(onUpdate, tick, memoryApi, allocSize)
 {
     OffsetList = offsetList;
     Lua        = lua;
     VarName    = varName;
 }
Exemplo n.º 23
0
 public DefaultLoginHandler(XMemory xMemory, IOffsetList offsetList)
 {
     XMemory    = xMemory;
     OffsetList = offsetList;
 }
Exemplo n.º 24
0
        public override void Update(IMemoryApi memoryApi, IOffsetList offsetList)
        {
            base.Update(memoryApi, offsetList);

            if (memoryApi.Read(DescriptorAddress + WowObjectDescriptor.EndOffset + WowUnitDescriptor.EndOffset, out WowPlayerDescriptor obj))
            {
                RawWowPlayer = obj;

                questlogEntries = new QuestlogEntry[]
                {
                    obj.QuestlogEntry1,
                    obj.QuestlogEntry2,
                    obj.QuestlogEntry3,
                    obj.QuestlogEntry4,
                    obj.QuestlogEntry5,
                    obj.QuestlogEntry6,
                    obj.QuestlogEntry7,
                    obj.QuestlogEntry8,
                    obj.QuestlogEntry9,
                    obj.QuestlogEntry10,
                    obj.QuestlogEntry11,
                    obj.QuestlogEntry12,
                    obj.QuestlogEntry13,
                    obj.QuestlogEntry14,
                    obj.QuestlogEntry15,
                    obj.QuestlogEntry16,
                    obj.QuestlogEntry17,
                    obj.QuestlogEntry18,
                    obj.QuestlogEntry19,
                    obj.QuestlogEntry20,
                    obj.QuestlogEntry21,
                    obj.QuestlogEntry22,
                    obj.QuestlogEntry23,
                    obj.QuestlogEntry24,
                    obj.QuestlogEntry25,
                };

                itemEnchantments = new VisibleItemEnchantment[]
                {
                    obj.VisibleItemEnchantment1,
                    obj.VisibleItemEnchantment2,
                    obj.VisibleItemEnchantment3,
                    obj.VisibleItemEnchantment4,
                    obj.VisibleItemEnchantment5,
                    obj.VisibleItemEnchantment6,
                    obj.VisibleItemEnchantment7,
                    obj.VisibleItemEnchantment8,
                    obj.VisibleItemEnchantment9,
                    obj.VisibleItemEnchantment10,
                    obj.VisibleItemEnchantment11,
                    obj.VisibleItemEnchantment12,
                    obj.VisibleItemEnchantment13,
                    obj.VisibleItemEnchantment14,
                    obj.VisibleItemEnchantment15,
                    obj.VisibleItemEnchantment16,
                    obj.VisibleItemEnchantment17,
                    obj.VisibleItemEnchantment18,
                    obj.VisibleItemEnchantment19,
                };
            }

            if (memoryApi.Read(IntPtr.Add(BaseAddress, (int)offsetList.WowUnitSwimFlags), out uint swimFlags))
            {
                IsSwimming = (swimFlags & 0x200000) != 0;
            }

            if (memoryApi.Read(IntPtr.Add(BaseAddress, (int)offsetList.WowUnitFlyFlagsPointer), out IntPtr flyFlagsPointer) &&
                memoryApi.Read(IntPtr.Add(flyFlagsPointer, (int)offsetList.WowUnitFlyFlags), out uint flyFlags))
            {
                IsFlying = (flyFlags & 0x2000000) != 0;
            }

            if (memoryApi.Read(offsetList.BreathTimer, out int breathTimer))
            {
                IsUnderwater = breathTimer > 0;
            }

            if (memoryApi.Read(offsetList.ComboPoints, out byte comboPoints))
            {
                ComboPoints = comboPoints;
            }

            IsGhost = HasBuffById(8326);
        }