コード例 #1
0
        public override void Run()
        {
            if (Usefuls.InGame)
            {
                return;
            }

            if (!_relogger)
            {
                Logging.Write("Initiate player relogging.");
                _reloggerTimer = new Helpful.Timer(1000 * 60 * 5);
                _reloggerTimer.Reset();
            }

            while (Products.Products.IsStarted)
            {
                Logging.Status = "relogger";

                Login.SettingsLogin s = new Login.SettingsLogin
                {
                    Login     = nManagerSetting.CurrentSetting.EmailOfTheBattleNetAccount,
                    Password  = nManagerSetting.CurrentSetting.PasswordOfTheBattleNetAccount,
                    Realm     = Usefuls.RealmName,
                    Character = Memory.WowMemory.Memory.ReadUTF8String(Memory.WowProcess.WowModule +
                                                                       (uint)Addresses.Player.playerName),
                    BNetName = nManagerSetting.CurrentSetting.BattleNetSubAccount,
                };

                Login.Pulse(s);
                _relogger = true;
                if (_relogger && Usefuls.InGame && !Usefuls.IsLoading)
                {
                    Thread.Sleep(5000);
                    if (Usefuls.InGame && !Usefuls.IsLoading)
                    {
                        Logging.Write("Ending player relogging with success.");
                        _reloggerTimer = null;
                        _relogger      = false;
                        ConfigWowForThisBot.ConfigWow();
                        if (Products.Products.ProductName == "Damage Dealer" && !nManagerSetting.CurrentSetting.ActivateMovementsDamageDealer)
                        {
                            ConfigWowForThisBot.StartStopClickToMove(false);
                        }
                        if (Products.Products.ProductName == "Heal Bot" && nManagerSetting.CurrentSetting.ActivateMovementsHealerBot)
                        {
                            ConfigWowForThisBot.StartStopClickToMove(false);
                        }
                        SpellManager.UpdateSpellBook();
                        //Products.Products.ProductRestart();
                        break;
                    }
                }
            }
        }
コード例 #2
0
        public static void CGPlayer_C__MoveTo(Vector3 point)
        {
            lock (thisLock)
            {
                MovementsAction.Ascend(false);
                MovementsAction.Descend(false);
                if (!Usefuls.InGame || Usefuls.IsLoading)
                {
                    return;
                }

                Helpful.Timer timer = new Helpful.Timer(2000);
                while (ObjectManager.ObjectManager.Me.GetBaseAddress == 0)
                {
                    if (timer.IsReady)
                    {
                        return;
                    }
                    Thread.Sleep(200);
                }
                Usefuls.UpdateLastHardwareAction();
                if (!point.IsValid)
                {
                    return;
                }

                // Allocate Memory:
                uint posCodecave = Memory.WowMemory.Memory.AllocateMemory(0x4 * 3);
                Memory.WowMemory.Memory.WriteFloat(posCodecave, point.X);
                Memory.WowMemory.Memory.WriteFloat(posCodecave + 0x4, point.Y);
                Memory.WowMemory.Memory.WriteFloat(posCodecave + 0x8, point.Z);
                string[] asm = new[]
                {
                    "push " + posCodecave,
                    "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress,
                    "call " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.CGPlayer_C__MoveTo),
                    "retn"
                };

                Memory.WowMemory.InjectAndExecute(asm);
                Memory.WowMemory.Memory.FreeMemory(posCodecave);
                if (cache != point)
                {
                    Logging.WriteNavigator("MoveTo(" + point + ")");
                    if (cache.IsValid && cache.DistanceTo(point) > 500)
                    {
                        Logging.WriteDebug("The two previouses CTM were very far appart from each others, logging CallStack.");
                        Logging.WriteDebug(Hook.CurrentCallStack);
                    }
                    cache = point;
                }
            }
        }
コード例 #3
0
ファイル: Pather.cs プロジェクト: zneel/TheNoobBot
        public Pather(string continent, ConnectionHandlerDelegate connectionHandler)
        {
            lock (_threadLocker)
            {
                try
                {
                    ConnectionHandler = connectionHandler;

                    Continent = continent.Substring(continent.LastIndexOf('\\') + 1);

                    string dir = Application.StartupPath;
                    _meshPath = dir + "\\Meshes"; // + continent;


                    if (!Directory.Exists(_meshPath))
                    {
                        Logging.WriteNavigator(DetourStatus.Failure + " No mesh for " + continent + " (Path: " + _meshPath +
                                               ")");
                    }

                    _mesh        = new NavMesh();
                    _loadedTiles = new Dictionary <Tuple <int, int>, int>();
                    _failedTiles = new Dictionary <Tuple <int, int>, int>();
                    if (_loadTileCheck == null)
                    {
                        _loadTileCheck = new Helpful.Timer(60 * 1000); // 1 min
                    }
                    DetourStatus status;

                    // check if this is a dungeon and initialize our mesh accordingly
                    WoWMap map = WoWMap.FromMPQName(continent);
                    if (map.Record.MapType == WoWMap.MapType.WDTOnlyType || continent == "AllianceGunship")
                    {
                        string dungeonPath = GetDungeonPath();
                        if (!File.Exists(_meshPath + "\\" + dungeonPath))
                        {
                            downloadTile(dungeonPath);
                        }
                        byte[] data = File.ReadAllBytes(_meshPath + "\\" + dungeonPath);
                        status = _mesh.Initialize(data);
                        AddMemoryPressure(data.LongLength);
                        IsDungeon = true;
                    }
                    else //                       20bits 28bits
                    {
                        status = _mesh.Initialize(1048576, 2048 * Division * Division, Utility.Origin, Utility.TileSize / Division, Utility.TileSize / Division);
                    }
                    // maxPolys = 1 << polyBits (20) = 1048576
                    // maxTiles = is 8192 (was 4096), Travel loads tons of tile in quester.
                    // I have logs with over 6000 .tile files loaded.

                    if (status.HasFailed())
                    {
                        Logging.WriteNavigator(status + " Failed to initialize the mesh");
                    }

                    _query = new NavMeshQuery(new PatherCallback(this));
                    DetourStatus t = _query.Initialize(_mesh, 524287); // 20bits - 1
                    //Logging.WriteDebug("NavMeshQuery initialized with status: " + t);
                    Filter = new QueryFilter {
                        IncludeFlags = 0xFFFF, ExcludeFlags = 0x0
                    };
                    // Add the costs
                    Filter.SetAreaCost((int)PolyArea.Water, 4);
                    Filter.SetAreaCost((int)PolyArea.Terrain, 1);
                    Filter.SetAreaCost((int)PolyArea.Road, 1);  // This is the Taxi system, not in tiles yet
                    Filter.SetAreaCost((int)PolyArea.Danger, 25);
                    if (nManagerSetting.DangerousZones.Count > 0)
                    {
                        int addedDangers = ReportDanger(nManagerSetting.DangerousZones, true);
                        if (addedDangers > 0)
                        {
                            Logging.WriteNavigator(addedDangers + " dangers added.");
                        }
                    }
                }
                catch (Exception exception)
                {
                    Logging.WriteError("Pather(string continent, ConnectionHandlerDelegate connectionHandler): " + exception);
                }
            }
        }
コード例 #4
0
        public static void CGPlayer_C__ClickToMove(Single x, Single y, Single z, UInt128 guid, Int32 action, Single precision, bool forceCTM = false)
        {
            try
            {
                if (!forceCTM && ObjectManager.ObjectManager.Me.TransportGuid <= 0)
                {
                    CGPlayer_C__MoveTo(new Vector3(x, y, z));
                    return;
                }
                if (!Usefuls.InGame && !Usefuls.IsLoading)
                {
                    return;
                }

                Helpful.Timer timer = new Helpful.Timer(2000);
                while (ObjectManager.ObjectManager.Me.GetBaseAddress == 0)
                {
                    if (timer.IsReady)
                    {
                        return;
                    }
                    Thread.Sleep(200);
                }
                Usefuls.UpdateLastHardwareAction();
                if (x == 0 && y == 0 && z == 0 && guid == 0)
                {
                    return;
                }

                // Allocate Memory:
                uint posCodecave       = Memory.WowMemory.Memory.AllocateMemory(0x4 * 3);
                uint guidCodecave      = Memory.WowMemory.Memory.AllocateMemory(32);
                uint precisionCodecave = Memory.WowMemory.Memory.AllocateMemory(0x4);
                if (posCodecave <= 0 || guidCodecave <= 0 || precisionCodecave <= 0)
                {
                    return;
                }
                // Write value:
                Memory.WowMemory.Memory.WriteInt128(guidCodecave, guid);
                Memory.WowMemory.Memory.WriteInt128(guidCodecave + (uint)Marshal.SizeOf(guid), ObjectManager.ObjectManager.Me.TransportGuid);
                Memory.WowMemory.Memory.WriteFloat(precisionCodecave, precision);

                Memory.WowMemory.Memory.WriteFloat(posCodecave, x);
                Memory.WowMemory.Memory.WriteFloat(posCodecave + 0x4, y);
                Memory.WowMemory.Memory.WriteFloat(posCodecave + 0x8, z);

                // BOOL __thiscall CGPlayer_C__ClickToMove(WoWActivePlayer *this, CLICKTOMOVETYPE clickType, WGUID *interactGuid, WOWPOS *clickPos, float precision)

                /*string[] asm = new[]
                 * {
                 *  "mov edx, [" + precisionCodecave + "]",
                 *  "push edx",
                 *  "push " + posCodecave,
                 *  "push " + guidCodecave,
                 *  "mov esi, " + action, // move the last push into esi
                 *  "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress, // get player pointer to ecx prior to call
                 *  "jmp " + (Memory.WowProcess.WowModule + (uint) Addresses.FunctionWow.PushESI), // jmp on a "push esi / call ctm"
                 *  "@out:",
                 *  "retn"
                 * };*/
                string[] asm = new[]
                {
                    "mov edx, [" + precisionCodecave + "]",
                    "push edx",
                    "push " + posCodecave,
                    "push " + guidCodecave,
                    "push " + action,                                                                                  // move the last push into esi
                    "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress,                                       // get player pointer to ecx prior to call
                    "mov edx, " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.CGPlayer_C__ClickToMove), // get player pointer to ecx prior to call
                    "jmp " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.WoWTextCaller),                // jmp on a "push esi / call ctm"
                    "@out:",
                    "retn"
                };
                Memory.WowMemory.InjectAndExecute(asm);
                Memory.WowMemory.Memory.FreeMemory(posCodecave);
                Memory.WowMemory.Memory.FreeMemory(guidCodecave);
                Memory.WowMemory.Memory.FreeMemory(precisionCodecave);
                if (cache != new Vector3(x, y, z))
                {
                    Logging.WriteNavigator("MoveTo(" + x + ", " + y + ", " + z + ", " + guid + ", " + action + ", " + precision + ")");
                    cache = new Vector3(x, y, z);
                }
            }
            catch (Exception exception)
            {
                Logging.WriteError(
                    "CGPlayer_C__ClickToMove(Single x, Single y, Single z, UInt64 guid, Int32 action, Single precision): " +
                    exception);
            }
        }
コード例 #5
0
ファイル: Lua.cs プロジェクト: zneel/TheNoobBot
        public static string GetLocalizedText(string commandline)
        {
            try
            {
                while (!Usefuls.InGame && Usefuls.IsLoading)
                {
                    // if we are not loading, avoid freezing wow => relog for example.
                    Memory.WowMemory.GameFrameUnLock();
                    Thread.Sleep(200);
                }
                if (!Usefuls.InGame && !Usefuls.IsLoading)
                {
                    return("NOT_CONNECTED");
                }
                Helpful.Timer timer = new Helpful.Timer(5000);
                while (ObjectManager.ObjectManager.Me.GetBaseAddress == 0)
                {
                    if (timer.IsReady)
                    {
                        return("NOT_CONNECTED");
                    }
                    Thread.Sleep(200);
                }
                // Command to send using LUA
                string command = commandline;
                if (command.Replace(" ", "").Length <= 0)
                {
                    return("");
                }
                // Allocate memory for command
                uint luaGetLocalizedTextSpace =
                    Memory.WowMemory.Memory.AllocateMemory(Encoding.UTF8.GetBytes(command).Length + 1 +
                                                           Others.Random(1, 25));
                if (luaGetLocalizedTextSpace <= 0)
                {
                    return("");
                }
                // Write command in the allocated memory
                Memory.WowMemory.Memory.WriteBytes(luaGetLocalizedTextSpace, Encoding.UTF8.GetBytes(command));

                // Console.WriteLine("GetLocalizedText(" + Commandline + ")");

                uint pString = Memory.WowMemory.Memory.AllocateMemory(4);

                string[] asm = new[]
                {
                    /*"call " +
                     * (Memory.WowProcess.WowModule + (uint) Addresses.FunctionWow.ClntObjMgrGetActivePlayer)
                     * ,
                     * "test eax, eax",
                     * "je @out",*/
                    /*"call " +
                     * (
                     * ),
                     * "test eax, eax",
                     * "je @out",*/
                    "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress,
                    "push -1",
                    "mov edx, " + luaGetLocalizedTextSpace + "",
                    "push edx",
                    "call " +
                    (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.FrameScript__GetLocalizedText),
                    "mov [" + pString + "], eax",
                    "test eax, eax",
                    "je @out",
                    "push eax",
                    "call " +
                    (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.strlen),
                    "add esp, 4",
                    "@out:",
                    "retn"
                };

                // Inject the shit
                uint stringLength = Memory.WowMemory.InjectAndExecute(asm);

                /*if (stringLength == 0)
                 *  return "NO_RESULT";*/
                uint   retPtr  = Memory.WowMemory.Memory.ReadUInt(pString);
                string sResult = "";
                if (retPtr > 0)
                {
                    sResult = Memory.WowMemory.Memory.ReadUTF8String(retPtr, (int)stringLength);
                }
                // Free memory allocated for command
                Memory.WowMemory.Memory.FreeMemory(luaGetLocalizedTextSpace);
                Memory.WowMemory.Memory.FreeMemory(pString);

                // Remove the LUA variable
                //LuaDoString(commandline + " = nil");

                // Uninstall the hook
                return(sResult);
            }
            catch (Exception exception)
            {
                Logging.WriteError("GetLocalizedText(string commandline): " + exception);
                return("");
            }
        }
コード例 #6
0
        private static void Fly(IEnumerable <WoWGameObject> nodes, bool ignoreCanOpen = false)
        {
            try
            {
                nodes = nodes.OrderBy(x => x.GetDistance);
                foreach (WoWGameObject node in nodes.Where(node => node.IsValid))
                {
                    WoWGameObject inode = node;
                    if (_curNode != null && _curNode.IsValid && !nManagerSetting.IsBlackListed(_curNode.Guid))
                    {
                        inode = _curNode;
                    }
                    if (!inode.IsValid)
                    {
                        MovementManager.StopMove();
                        nManagerSetting.AddBlackList(inode.Guid, 2 * 60 * 1000);
                        Logging.Write("Current inode not valid, blacklist.");
                        continue;
                    }
                    _curNode = inode; // we save a inode we potentially bypassed to make sure we run the list.
                    if (!inode.CanOpen && !ignoreCanOpen)
                    {
                        nManagerSetting.AddBlackList(inode.Guid, 5000);
                        return;
                    }
                    float zT;
                    if (ObjectManager.ObjectManager.Me.Position.Z < inode.Position.Z)
                    {
                        zT = inode.Position.Z + 5.5f;
                    }
                    else
                    {
                        zT = inode.Position.Z + 2.5f;
                    }

                    Point aboveNode = new Point(inode.Position);
                    aboveNode.Z = aboveNode.Z + 2.5f;
                    Point farAboveNode = new Point(aboveNode);
                    farAboveNode.Z = farAboveNode.Z + 50;
                    if (TraceLine.TraceLineGo(farAboveNode, aboveNode, CGWorldFrameHitFlags.HitTestAllButLiquid))
                    {
                        MovementManager.StopMove();
                        if (TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position, aboveNode, CGWorldFrameHitFlags.HitTestAllButLiquid))
                        {
                            Logging.Write("Node stuck");
                            nManagerSetting.AddBlackList(inode.Guid, 1000 * 60 * 2);
                            return;
                        }
                    }
                    else
                    {
                        MovementManager.StopMove();
                    }
                    if (_lastnode != inode.Guid)
                    {
                        _lastnode = inode.Guid;
                        Logging.Write("Farm " + inode.Name + " (" + inode.Entry + ") > " + inode.Position);
                    }
                    MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT, true);

                    Helpful.Timer timer   = new Helpful.Timer((int)(ObjectManager.ObjectManager.Me.Position.DistanceTo(inode.Position) / 3 * 1000) + 5000);
                    bool          toMine  = false;
                    bool          landing = false;

                    while (inode.IsValid && !Usefuls.BadBottingConditions && !Usefuls.ShouldFight && !timer.IsReady)
                    {
                        if (!landing)
                        {
                            bool noDirectPath = TraceLine.TraceLineGo(aboveNode, ObjectManager.ObjectManager.Me.Position, CGWorldFrameHitFlags.HitTestAllButLiquid);
                            zT = noDirectPath ? ObjectManager.ObjectManager.Me.Position.Z : aboveNode.Z;

                            if (ObjectManager.ObjectManager.Me.Position.Z < aboveNode.Z)
                            {
                                // elevate in a 45° angle instead of 90°
                                Point direction = Math.GetPosition2DOfLineByDistance(ObjectManager.ObjectManager.Me.Position,
                                                                                     inode.Position,
                                                                                     (inode.Position.Z + 2.5f) - ObjectManager.ObjectManager.Me.Position.Z);
                                // if there is an obstacle, then go mostly vertical but not 90° to prevent spinning around
                                if (TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position,
                                                          direction,
                                                          CGWorldFrameHitFlags.HitTestAllButLiquid))
                                {
                                    direction = Math.GetPosition2DOfLineByDistance(ObjectManager.ObjectManager.Me.Position,
                                                                                   inode.Position, 1.0f);
                                }
                                MovementManager.MoveTo(direction.X, direction.Y, inode.Position.Z + 5.0f);
                            }
                            else
                            {
                                MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT);
                            }

                            if (!ObjectManager.ObjectManager.Me.IsMounted)
                            {
                                return;
                            }
                            if (!noDirectPath)
                            {
                                landing = true;
                            }
                        }

                        if (ObjectManager.ObjectManager.Me.Position.DistanceTo2D(inode.Position) < 4.0f &&
                            ObjectManager.ObjectManager.Me.Position.DistanceZ(inode.Position) >= 5.0f && !toMine)
                        {
                            toMine = true;

                            if (!ObjectManager.ObjectManager.Me.IsMounted)
                            {
                                return;
                            }
                            zT = inode.Position.Z + 1.5f;
                            MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT);
                            if (inode.GetDistance > 3.0f && TraceLine.TraceLineGo(ObjectManager.ObjectManager.Me.Position, inode.Position, CGWorldFrameHitFlags.HitTestAllButLiquid))
                            {
                                Logging.Write("Node outside view");
                                nManagerSetting.AddBlackList(inode.Guid, 1000 * 120);
                                break;
                            }
                        }
                        else if ((ObjectManager.ObjectManager.Me.Position.DistanceTo2D(inode.Position) < 1.1f ||
                                  (!Usefuls.IsFlying &&
                                   ObjectManager.ObjectManager.Me.Position.DistanceTo2D(inode.Position) < 3.0f)) &&
                                 ObjectManager.ObjectManager.Me.Position.DistanceZ(inode.Position) < 6)
                        {
                            Thread.Sleep(150);
                            MovementManager.StopMove();
                            if (Usefuls.IsFlying)
                            {
                                MountTask.Land();
                            }
                            if (ObjectManager.ObjectManager.Me.GetMove)
                            {
                                MovementManager.StopMove();
                            }
                            while (ObjectManager.ObjectManager.Me.GetMove)
                            {
                                Thread.Sleep(50);
                            }
                            if (!ObjectManager.ObjectManager.Me.HaveBuff(SpellManager.AllInteractMountId()) &&
                                (!inode.IsHerb || inode.IsHerb && !ObjectManager.ObjectManager.Me.HaveBuff(SpellManager.HerbsInteractMountId())))
                            {
                                if (!(SpellManager.HasSpell(169606) && Usefuls.ContinentId == 1116 || Usefuls.ContinentId == 1464)) // Passive Silver Dollar Club given by Stables.
                                {
                                    MountTask.DismountMount();
                                }
                            }
                            else if (inode.IsHerb && ObjectManager.ObjectManager.Me.HaveBuff(SpellManager.DruidMountId()))
                            {
                                Logging.WriteDebug("Druid IsFlying ? " + Usefuls.IsFlying);
                                if (Usefuls.IsFlying)
                                {
                                    MountTask.Land();
                                    MovementManager.StopMove();
                                    if (Usefuls.IsFlying)
                                    {
                                        Logging.Write("You are still flying after two attemps of Landing.");
                                        Logging.Write("Make sure you have binded the action \"SitOrStand\" on a keyboard key and not any mouse button or special button.");
                                        Logging.Write("If you still have this message, please try a \"Reset Keybindings\" before posting on the forum.");
                                        Logging.Write("A work arround have been used, it may let you actually farm or not. Because it's random, please fix your keybinding issue.");
                                        MountTask.Land(true);
                                    }
                                }
                            }

                            Thread.Sleep(Usefuls.Latency + 200);
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                MountTask.DismountMount();
                                return;
                            }
                            _wasLooted    = false;
                            CountThisLoot = true;
                            NodeOrUnit    = true;
                            Interact.InteractWith(inode.GetBaseAddress);
                            Thread.Sleep(Usefuls.Latency + 500);
                            if (!ObjectManager.ObjectManager.Me.IsCast)
                            {
                                Interact.InteractWith(inode.GetBaseAddress);
                                Thread.Sleep(Usefuls.Latency + 500);
                            }
                            while (ObjectManager.ObjectManager.Me.IsCast)
                            {
                                Thread.Sleep(100);
                            }
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                MountTask.DismountMount();
                                CountThisLoot = false;
                                return;
                            }
                            Thread.Sleep(Usefuls.Latency + 100);
                            if (ObjectManager.ObjectManager.Me.InInevitableCombat)
                            {
                                MountTask.DismountMount();
                                CountThisLoot = false;
                                return;
                            }
                            nManagerSetting.AddBlackList(inode.Guid, 1000 * 20);
                            return;
                        }
                        else if (!ObjectManager.ObjectManager.Me.GetMove)
                        {
                            Thread.Sleep(50);
                            if (!ObjectManager.ObjectManager.Me.IsMounted)
                            {
                                return;
                            }
                            MovementManager.MoveTo(inode.Position.X, inode.Position.Y, zT);
                        }
                        if (States.Farming.PlayerNearest(inode))
                        {
                            Logging.Write("Player near the inode, farm canceled");
                            nManagerSetting.AddBlackList(inode.Guid, 15 * 1000);
                            return;
                        }
                    }
                    if (timer.IsReady)
                    {
                        nManagerSetting.AddBlackList(inode.Guid, 60 * 1000);
                    }
                    MovementManager.StopMove();
                    if (!_wasLooted)
                    {
                        Logging.Write("Farm failed #1");
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.WriteError("FarmingTask > Fly(IEnumerable<WoWGameObject> nodes): " + ex);
            }
        }
コード例 #7
0
        public static void InteractWith(uint baseAddress, bool stopMove = false)
        {
            try
            {
                if (!Usefuls.InGame || Usefuls.IsLoading)
                {
                    return;
                }
                Helpful.Timer timer = new Helpful.Timer(2000);
                while (ObjectManager.ObjectManager.Me.GetBaseAddress == 0)
                {
                    if (timer.IsReady)
                    {
                        return;
                    }
                    Thread.Sleep(200);
                }
                if (_firstRun)
                {
                    if (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Druid)
                    {
                        _stealth = new Spell("Prowl");
                    }
                    if (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Rogue)
                    {
                        _stealth = new Spell("Stealth");
                    }
                    _firstRun = false;
                }
                if (_stealth != null && _stealth.KnownSpell)
                {
                    foreach (var aura in ObjectManager.ObjectManager.Me.UnitAuras.Auras)
                    {
                        if (_stealth.Ids.Contains(aura.AuraSpellId))
                        {
                            aura.TryCancel();
                            break;
                        }
                    }
                }
                Usefuls.UpdateLastHardwareAction();
                if (baseAddress > 0)
                {
                    WoWObject to = new WoWObject(baseAddress);
                    if (!to.IsValid)
                    {
                        return;
                    }
                    if (to.Guid <= 0)
                    {
                        return;
                    }

                    uint codecaveGUID = Memory.WowMemory.Memory.AllocateMemory(0x10);
                    Memory.WowMemory.Memory.WriteBytes(codecaveGUID, to.Guid.ToByteArray());

                    string[] asm = new[]
                    {
                        /*"call " +
                         * (Memory.WowProcess.WowModule +
                         * (uint) Addresses.FunctionWow.ClntObjMgrGetActivePlayer)
                         * ,
                         * "test eax, eax",
                         * "je @out",*/
                        /*"call " +
                         * (Memory.WowProcess.WowModule +
                         * (uint) Addresses.FunctionWow.ClntObjMgrGetActivePlayerObj),
                         * "test eax, eax",
                         * "je @out",*/
                        "push " + codecaveGUID,
                        "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress,
                        "call " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.CGUnit_C__Interact),
                        "add esp, 4",
                        "@out:",
                        "retn"
                    };

                    Memory.WowMemory.InjectAndExecute(asm);

                    Memory.WowMemory.Memory.FreeMemory(codecaveGUID);
                    if (stopMove)
                    {
                        MovementManager.StopMove();
                    }
                    Thread.Sleep(Usefuls.Latency);
                }
            }
            catch (Exception exception)
            {
                Logging.WriteError("InteractGameObject(uint baseAddress): " + exception);
            }
        }