Exemplo n.º 1
0
        public static void HarpToTP_E(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "8B 8D E4 F9 FF FF FF 15") - 5;

            byte[] j = new byte[1];
            NativeFunctions.ReadProcessMemory(Context.HContext.Handle, a, j, 1, 0);
            if (j[0] != 0xE9)
            {
                var player = Context.MyPlayer;
                InlineHook.Inject(Context.HContext,
                                  AssemblySnippet.FromCode(
                                      new AssemblyCode[] {
                    (Instruction)$"pushad",
                    AssemblySnippet.FromClrCall(
                        Context.HContext.MainAddressHelper.GetFunctionAddress("Terraria.Main", "get_LocalPlayer"),
                        null, false),
                    (Instruction)$"mov ebx,eax",
                    (Instruction)$"push 16",
                    (Instruction)$"fild dword ptr [{Context.TileTargetX_Address}]",
                    (Instruction)$"fild dword ptr [esp]",
                    (Instruction)$"fmul",
                    (Instruction)$"fstp dword ptr [ebx+{Entity.OFFSET_Position}]",

                    (Instruction)$"fild dword ptr [{Context.TileTargetY_Address}]",
                    (Instruction)$"fild dword ptr [esp]",
                    (Instruction)$"fmul",
                    (Instruction)$"fstp dword ptr [ebx+{Entity.OFFSET_Position + 0x4}]",
                    (Instruction)$"add esp,4",
                    (Instruction)$"popad",
                }),
                                  a, false);
            }
        }
Exemplo n.º 2
0
        public static void HighLight_E(GameContext Context)
        {
            int a = AobscanHelper.AobscanASM(
                Context.HContext.Handle,
                @"mov [ebp-0x48],edx
fld dword ptr [esi+0x8]
fld dword ptr [ebp-0x3c]
fcomip st(1)
fstp st(0)") + 3;

            if (a <= 0)
            {
                return;
            }
            InlineHook.Inject(Context.HContext,
                              AssemblySnippet.FromASMCode(
                                  @"mov dword ptr [esi+0x8],0x3f800000
mov dword ptr [esi+0x10],0x3f800000
mov dword ptr [esi+0x18],0x3f800000
fld dword ptr [esi+0x8]
fld dword ptr [ebp-0x3c]"
                                  ),
                              a, false
                              );
        }
Exemplo n.º 3
0
        public static void SendChat(GameContext Context, string Text)
        {
            byte[] bs     = Encoding.Unicode.GetBytes(Text);
            int    strEnd = 0;
            int    strMem = NativeFunctions.VirtualAllocEx(Context.HContext.Handle, 0, Text.Length + 10,
                                                           NativeFunctions.AllocationType.Commit, NativeFunctions.MemoryProtection.ExecuteReadWrite);

            NativeFunctions.WriteProcessMemory(Context.HContext.Handle, strMem, bs, bs.Length, 0);
            NativeFunctions.WriteProcessMemory(Context.HContext.Handle, strMem + bs.Length, ref strEnd, 4, 0);

            var             mscorlib_AddrHelper = Context.HContext.GetAddressHelper("mscorlib.dll");
            int             ctor = mscorlib_AddrHelper.GetFunctionAddress("System.String", "CtorCharPtr");
            AssemblySnippet asm  = AssemblySnippet.FromCode(
                new AssemblyCode[] {
                (Instruction)"push ecx",
                (Instruction)"push edx",
                AssemblySnippet.ConstructString(Context.HContext, strMem, Context.HContext.MainAddressHelper.GetStaticFieldAddress("Terraria.Main", "chatText")),
                (Instruction)$"mov byte ptr [{Context.HContext.MainAddressHelper.GetStaticFieldAddress("Terraria.Main", "drawingPlayerChat")}],1",
                (Instruction)$"mov byte ptr [{Context.HContext.MainAddressHelper.GetStaticFieldAddress("Terraria.Main", "inputTextEnter")}],1",
                (Instruction)$"mov byte ptr [{Context.HContext.MainAddressHelper.GetStaticFieldAddress("Terraria.Main", "chatRelease")}],1",
                (Instruction)"pop edx",
                (Instruction)"pop ecx"
            });

            InlineHook.InjectAndWait(Context.HContext, asm, Context.HContext.MainAddressHelper.GetFunctionAddress("Terraria.Main", "DoUpdate"), true);
            NativeFunctions.VirtualFreeEx(Context.HContext.Handle, strMem, 0);
        }
Exemplo n.º 4
0
        public void Emit(GameContext context, float X, float Y)
        {
            int data = NativeFunctions.VirtualAllocEx(context.HContext.Handle, 0, (int)(32 * Projs.Count), NativeFunctions.AllocationType.Commit, NativeFunctions.MemoryProtection.ExecuteReadWrite);

            NativeFunctions.WriteProcessMemory(context.HContext.Handle, data, BitConverter.GetBytes(Projs.Count), 4, 0);
            for (int i = 0; i < Projs.Count; i++)
            {
                int t = data + 8 + i * 32;
                NativeFunctions.WriteProcessMemory(context.HContext.Handle, t, BitConverter.GetBytes(Projs[i].ProjType), 4, 0);
                NativeFunctions.WriteProcessMemory(context.HContext.Handle, t + 4, BitConverter.GetBytes(context.MyPlayer.X + Projs[i].Location.X), 4, 0);
                NativeFunctions.WriteProcessMemory(context.HContext.Handle, t + 8, BitConverter.GetBytes(context.MyPlayer.Y + Projs[i].Location.Y), 4, 0);
                NativeFunctions.WriteProcessMemory(context.HContext.Handle, t + 12, BitConverter.GetBytes(Projs[i].Speed.X), 4, 0);
                NativeFunctions.WriteProcessMemory(context.HContext.Handle, t + 16, BitConverter.GetBytes(Projs[i].Speed.Y), 4, 0);
            }
            AssemblySnippet snippet = AssemblySnippet.FromCode(
                new AssemblyCode[] {
                (Instruction)$"pushad",
                (Instruction)$"mov ebx,{data}",
            });

            snippet.Content.Add(AssemblySnippet.Loop(
                                    AssemblySnippet.FromCode(
                                        new AssemblyCode[] {
                (Instruction)$"mov eax,[esp]",                                        //i
                (Instruction)$"shl eax,5",
                (Instruction)$"lea eax,[ebx+8+eax]",
                Projectile.GetSnippet_Call_NewProjectile(context, null, false,
                                                         "[eax+4]", "[eax+8]", "[eax+12]", "[eax+16]", "[eax]", 0, 0f, context.MyPlayerIndex, 0f, 0f),
            }),
                                    (int)Projs.Count, true));
            snippet.Content.Add((Instruction)"popad");
            InlineHook.InjectAndWait(context.HContext, snippet,
                                     context.HContext.MainAddressHelper["Terraria.Main", "Update"], true);
            NativeFunctions.VirtualFreeEx(context.HContext.Handle, data, 0);
        }
Exemplo n.º 5
0
    public override void Disable(GameContext ctx)
    {
        nuint a = GetFunctionAddress(ctx, "Terraria.Player", "AddBuff");

        InlineHook.FreeHook(ctx.HContext, a);
        this.IsEnabled = false;
    }
Exemplo n.º 6
0
    public override void Disable(GameContext ctx)
    {
        nuint a = ctx.GameModuleHelper["Terraria.Player", "IsAValidEquipmentSlotForIteration"];

        InlineHook.FreeHook(ctx.HContext, a);
        this.IsEnabled = false;
    }
Exemplo n.º 7
0
    public override void Disable(GameContext ctx)
    {
        nuint a = ctx.GameModuleHelper["Terraria.Player", "GetItemGrabRange"];

        InlineHook.FreeHook(ctx.HContext, a);
        this.IsEnabled = false;
    }
Exemplo n.º 8
0
        public static void ShowCircuit_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "88 96 F8 05 00 00 88 96 F9 05 00 00") - 6;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 9
0
        public static void MachinicalRulerEffect_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "d9 9e c0 03 00 00 88 96 f0 05 00 00") + 12;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 10
0
        public static void FastTileSpeed_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "8b 85 30 f0 ff ff d9 80 c4 03 00 00") - 6;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 11
0
        public static void FastSpeed_D(GameContext Context)
        {
            int a = AobscanHelper.AobscanASM(
                Context.HContext.Handle,
                "mov [esi+0x54b],dl\nmov [esi+0x54d],dl") - 6;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 12
0
        public static void LowGravity_D(GameContext Context)
        {
            int a = AobscanHelper.AobscanASM(
                Context.HContext.Handle,
                "fldz\nfstp dword ptr [esi+0x410]") + 8;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 13
0
        public static void LowGravity_E(GameContext Context)
        {
            int a = AobscanHelper.AobscanASM(
                Context.HContext.Handle,
                "mov [esi+0x414],edx\ncmp dword ptr [esi+0x370],0");

            InlineHook.Inject(Context.HContext, AssemblySnippet.FromASMCode("mov dword ptr [esi+0x410],0x41200000"), a, false);
        }
Exemplo n.º 14
0
        public static void RulerEffect_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext,
                "88 96 F8 05 00 00 88 96 F9 05 00 00") - 6;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 15
0
        public static void ShadowDodge_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "88 96 33 05 00 00 88 96 A9 05 00 00") - 6;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 16
0
        public static void SwingingAttacksAll_D(GameContext Context)
        {
            int a = (int)Context.HContext.MainAddressHelper["Terraria.Player", "ItemCheck_MeleeHitNPCs", 0x115].StartAddress - 6;
            int b = (int)Context.HContext.MainAddressHelper["Terraria.Player", "ItemCheck_MeleeHitNPCs", 0x12B].StartAddress;

            InlineHook.FreeHook(Context.HContext, a);
            InlineHook.FreeHook(Context.HContext, b);
        }
Exemplo n.º 17
0
        public static void DisableInvisibility_D(GameContext Context)
        {
            int a = (int)Context.HContext.MainAddressHelper["Terraria.Player", "ItemCheck", 0xF938].StartAddress;
            int b = (int)Context.HContext.MainAddressHelper["Terraria.Player", "ItemCheck", 0xF962].StartAddress;

            InlineHook.FreeHook(Context.HContext, a);
            InlineHook.FreeHook(Context.HContext, b);
        }
Exemplo n.º 18
0
        public static void HarpToTP_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "8B 8D E4 F9 FF FF FF 15") - 5;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 19
0
        public static void SlimeGunBurn_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "8b 85 b8 f3 ff ff 89 45 cc 8b 45 cc 40") - 0x1a;

            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 20
0
        public static void SwingingAttacksAll_D(GameContext Context)
        {
            int a = (int)Context.HContext.MainAddressHelper["Terraria.Player", "ItemCheck", 0xF938].StartAddress;
            int b = (int)Context.HContext.MainAddressHelper["Terraria.Player", "ItemCheck", 0xF962].StartAddress;

            InlineHook.FreeHook(Context.HContext, a);
            InlineHook.FreeHook(Context.HContext, b);
        }
Exemplo n.º 21
0
        public static void RevealMap(GameContext Context)
        {
            AssemblySnippet asm = AssemblySnippet.FromClrCall(
                Context.HContext.GetAddressHelper("TRInjections.dll").GetFunctionAddress("TRInjections.Utils", "RevealMap"), null, true);

            InlineHook.InjectAndWait(Context.HContext, asm,
                                     Context.HContext.MainAddressHelper.GetFunctionAddress("Terraria.Main", "DoUpdate"), true);
        }
Exemplo n.º 22
0
    public override void Enable(GameContext ctx)
    {
        int off = GetOffset(ctx, "Terraria.Entity", "position");
        var ass = AssemblySnippet.FromCode(
            new AssemblyCode[] {
            Instruction.Create("pushad"),
            Instruction.Create($"cmp byte ptr [{ctx.MapFullScreen_Address}],0"),
            Instruction.Create("je _rwualfna"),
            Instruction.Create($"cmp byte ptr [{ctx.MouseRight_Address}],0"),
            Instruction.Create("je _rwualfna"),
            Instruction.Create($"cmp byte ptr [{ctx.MouseRightRelease_Address}],0"),
            Instruction.Create("je _rwualfna"),
            AssemblySnippet.FromCode(
                new AssemblyCode[] {
                Instruction.Create($"mov byte ptr [{ctx.MapFullScreen_Address}],0"),
                Instruction.Create($"mov byte ptr [{ctx.MouseRightRelease_Address}],0"),
                AssemblySnippet.FromClrCall(
                    ctx.GameModuleHelper.GetFunctionAddress("Terraria.Main", "get_LocalPlayer"), false, null, null, null, Array.Empty <object>()),
                Instruction.Create("mov ebx,eax"),
                Instruction.Create("push eax"),
                Instruction.Create("mov dword ptr [esp],2"),
                Instruction.Create($"fild dword ptr [{ctx.ScreenWidth_Address}]"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fild dword ptr [{ctx.MouseX_Address}]"),
                Instruction.Create("fsubp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullScreenScale_Address}]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullscreenPos_Address + 4}]"),
                Instruction.Create("fsubrp"),
                Instruction.Create("mov dword ptr [esp],16"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fmulp"),
                Instruction.Create($"fstp dword ptr [ebx+{off}]"),
                Instruction.Create("mov dword ptr [esp],2"),
                Instruction.Create($"fild dword ptr [{ctx.ScreenHeight_Address}]"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fild dword ptr [{ctx.MouseY_Address}]"),
                Instruction.Create("fsubp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullScreenScale_Address}]"),
                Instruction.Create("fdivp"),
                Instruction.Create($"fld dword ptr [{ctx.MapFullscreenPos_Address + 8}]"),
                Instruction.Create("fsubrp"),
                Instruction.Create("mov dword ptr [esp],16"),
                Instruction.Create("fild dword ptr [esp]"),
                Instruction.Create("fmulp"),
                Instruction.Create($"fstp dword ptr [ebx+{off + 0x4}]"),

                Instruction.Create("pop eax"),
            }),
            Instruction.Create("_rwualfna:"),
            Instruction.Create("popad")
        });
        HookParameters ps = new HookParameters(ctx.GameModuleHelper.GetFunctionAddress("Terraria.Main", "Update") + 5, 4096);

        InlineHook.Hook(ctx.HContext, ass, ps);
    }
Exemplo n.º 23
0
        public static void FastTileSpeed_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "8b 85 30 f0 ff ff d9 80 c4 03 00 00") - 6;

            //int a = (int)Context.HContext.MainAddressHelper.GetFunctionInstruction("Terraria.Player", "Update", 0x2CDD).EndAddress - 6;
            InlineHook.FreeHook(Context.HContext, a);
        }
Exemplo n.º 24
0
        public static void SendWater(GameContext Context, int x, int y)
        {
            AssemblySnippet snippet = AssemblySnippet.FromDotNetCall(
                Context.HContext.AddressHelper.GetFunctionAddress("Terraria.NetMessage", "sendWater"),
                null,
                true,
                x, y);

            InlineHook.InjectAndWait(Context.HContext, snippet, Context.HContext.AddressHelper.GetFunctionAddress("Terraria.Main", "Update"), true);
        }
Exemplo n.º 25
0
        public static void RulerEffect_E(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "88 96 F8 05 00 00 88 96 F9 05 00 00") - 6;

            InlineHook.Inject(Context.HContext, AssemblySnippet.FromASMCode(
                                  "mov byte ptr [esi+0x5f7],0x1"),
                              a, false, false);
        }
Exemplo n.º 26
0
        public static void SlimeGunBurn_E(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "8b 85 b8 f3 ff ff 89 45 cc 8b 45 cc 40") - 0x1a;

            InlineHook.Inject(Context.HContext, AssemblySnippet.FromASMCode(
                                  "mov dword ptr [esp+8],216000\nmov edx,0x99"),
                              a, false, false);
        }
Exemplo n.º 27
0
        public static void HighLight_D(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(Context.HContext.Handle, "C7 ** ** ******** E9 ** ** ** ** DF F1 DD D8 7A", true);

            if (a <= 0)
            {
                return;
            }
            InlineHook.FreeHook(Context.HContext, a + 7);
        }
Exemplo n.º 28
0
        public static void InfiniteFly_D(GameContext Context)
        {
            int addr = AobscanHelper.Aobscan(Context.HContext.Handle, "E9 ******** 90 80 BF", true);

            if (addr <= 0)
            {
                return;
            }
            InlineHook.FreeHook(Context.HContext, addr);
        }
Exemplo n.º 29
0
        public static void ShowCircuit_E(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "88 96 1D 06 00 00 88 96 1E 06 00 00") - 6;

            InlineHook.Inject(Context.HContext, AssemblySnippet.FromASMCode(
                                  "mov byte ptr [esi+0x62a],0x1"),
                              a, false, false);
        }
Exemplo n.º 30
0
        public static void ShadowDodge_E(GameContext Context)
        {
            int a = AobscanHelper.Aobscan(
                Context.HContext.Handle,
                "00 00 88 96 33 05 00 00 88 96 A9 05 00 00") - 4;

            InlineHook.Inject(Context.HContext, AssemblySnippet.FromASMCode(
                                  "mov byte ptr [esi+0x532],0x1"),
                              a, false, false);
        }