示例#1
0
        public static uint WowClientDB2__GetRowPointer(int index, uint offset, bool box = false)
        {
            try
            {
                Usefuls.UpdateLastHardwareAction();

                var asm = new string[]
                {
                    "push 0",
                    "push 0",
                    "push 0",
                    "push " + (Memory.WowProcess.WowModule + (uint)Addresses.DBC.Unknown),                             //dunno what it is
                    "push " + index,
                    "mov ecx, " + (Memory.WowProcess.WowModule + offset),                                              //db2pointer
                    "call " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.WowClientDB2__GetRowPointer), //function
                    "retn"
                };

                //return Core.Memory.Read<IntPtr>(Core.Executor.Execute(asm, "DB2Reader"));
                ;
                uint ret = Memory.WowMemory.InjectAndExecute(asm);
                if (box)
                {
                    MessageBox.Show(ret.ToString("X"));
                }
                return(ret);
            }
            catch (Exception exception)
            {
                Logging.WriteError("WowClientDB2__GetRowPointer(int index, uint offset): " + exception);
            }
            return(0);
        }
示例#2
0
文件: Lua.cs 项目: zneel/TheNoobBot
        public static void LuaDoString(string command, bool notInGameMode = false, bool doAntiAfk = true)
        {
            try
            {
                if (!notInGameMode && (!Usefuls.InGame || Usefuls.IsLoading))
                {
                    Memory.WowMemory.GameFrameUnLock();
                    return;
                }
                while (!notInGameMode && !Usefuls.InGame || Usefuls.IsLoading)
                {
                    Memory.WowMemory.GameFrameUnLock();
                    Thread.Sleep(200);
                }
                if (!notInGameMode && doAntiAfk) // Avoid loop while retrieving the AFK key to press.
                {
                    Usefuls.UpdateLastHardwareAction();
                }
                if (command.Replace(" ", "").Length <= 0)
                {
                    return;
                }

                // Allocate memory
                uint doStringArgCodecave = Memory.WowMemory.Memory.AllocateMemory(Encoding.UTF8.GetBytes(command).Length + 1 + Others.Random(1, 25));
                if (doStringArgCodecave <= 0)
                {
                    return;
                }
                // Write value:
                Memory.WowMemory.Memory.WriteBytes(doStringArgCodecave, Encoding.UTF8.GetBytes(command));

                //Console.WriteLine("LuaDoString(" + command + ", " + notInGameMode + ")");

                // Write the asm stuff for Lua_DoString
                string[] asm = new[]
                {
                    "mov eax, " + doStringArgCodecave,
                    "push 0",
                    "push eax",
                    "push eax",
                    "mov eax, " +
                    (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.FrameScript_ExecuteBuffer),  // Lua_DoString
                    "call eax",
                    "add esp, 0xC",
                    "@out:",
                    "retn"
                };

                // Inject
                Memory.WowMemory.InjectAndExecute(asm, true);
                // Free memory allocated
                Memory.WowMemory.Memory.FreeMemory(doStringArgCodecave);
            }
            catch (Exception exception)
            {
                Logging.WriteError("LuaDoString(string command, bool notInGameMode = false): " + exception);
            }
        }
示例#3
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;
                }
            }
        }
示例#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
        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);
            }
        }