Results 1 to 11 of 11
  1. #1
    RPGuserZ1002's Avatar
    Join Date
    Apr 2019
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0

    How do I make a hacked client for Terraria?

    Hello everyone,
    I am a new user on the forums. I've discovered this forum a month ago, but I have created an account today. I have tried some of the Terraria hacks clients here, and I like them.

    I was always wondering how could you make a hacked client for Terraria. I have already learned the basics of C# and I have Visual Studio installed in my device.

    If you have an intention of showing me a tutorial on how to make a hacked client, I would gladly appreciate it.

  2. #2
    HiImKyle's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    England
    Posts
    233
    Reputation
    10
    Thanks
    206
    Telling you would be easier as I don't think many people would use or need a video explaining what to do. Unless you want one, in which case I can make one if you prefer it.

    First you need to decide what kind of hack you wanna make, I know you said Hacked Client but I'm giving you options here.

    - Do you want a hacked client that's internal, hooked methods etc.
    - Or do you want to make a RTM Tool that mods on the fly like Jake's Hack.

    Once you figure out. From there it's easy. Let's say you want to make a hacked client that's internal.

    I'm going to tell you how I think you should do it, because I think it's easier for you.

    First download dnSpy. Open Terraria up in dnSpy. Find methods you want to edit, and edit. This is more or less the easiest, but it's also kinda shitty in the event of a game update (which might be soon!)

    I use a different method which is more aimed at automating the patching of the game so it's easier to update and fix which is IL Patching via a library called Mono.Cecil, using this in a C# program can patch Terraria to add code directly to the game without the need for dnSpy/ILSpy etc. With this method I can create a DLL of which Terraria references in methods of my choosing. This DLL houses all of my code so I don't need to ship Terraria along side with it.

    I can expand on this, maybe with methods of interest, or code snippets you can use if you need the extra help.

    Eventually you'll get somewhere like this.

    If there's one sentence I would say to tl;dr it's if you need help, don't be afraid to ask. Check my sig if you want more live chat than forum chat. Or if you use Steam, you can see it under my picture.
    Last edited by HiImKyle; 04-20-2019 at 01:24 PM.

  3. The Following User Says Thank You to HiImKyle For This Useful Post:

    RPGuserZ1002 (04-20-2019)

  4. #3
    RPGuserZ1002's Avatar
    Join Date
    Apr 2019
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    Thank you for answering Kyle, i have decided to make a client that it is internal and has hooked methods. I have downloaded dnSpy and I got used to it a little bit. I've already opened terraria on dnSpy https://prntscr.com/neoj4w. But the only problem is that I am confused and I don't where to begin.

  5. #4
    HiImKyle's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    England
    Posts
    233
    Reputation
    10
    Thanks
    206
    Quote Originally Posted by RPGuserZ1002 View Post
    But the only problem is that I am confused and I don't where to begin.
    So like you said, you got Terraria open in dnSpy which is good. You see on the left it shows "Terraria (1.3.5.3)" then under that is "Terraria.exe", if you click on the arrow next to the exe one you will get a drop down of all the namespaces that exist within the exe. You should know what a namespace is, but if you don't it's not entirely important.

    If you clicked on the arrow of a namespace, you'll get all the classes that are under that namespace.
    If you clicked on the arrow of a class, you'll get all the methods and fields/properties of that class.

    One thing you should never do is click on the class name, always click on the arrow! Clicking on the class name tells dnSpy to decompile that entire class for you to read. One class you should avoid doing this with is Main under the "Terraria" namespace. This contains pretty much everything upfront. Game updates, drawing methods, server methods. It's the whole shabang, which is why it takes a minute or two to decompile and isn't really worth waiting for as most of the methods within Main are useless to you.

    Once you have a class's methods and fields/properties shown you can click on each one individually. This tells dnSpy to decompile ONLY that which is much faster for browsing through methods of interest. Speeds up the process of doing this entire thing.

    Some methods you should hook are, Initialize(), Update(GameTime), Draw(GameTime). These 3 methods are in Main so like I said, click the arrow, find the method and click on the method.

    To edit a method, when the method is shown, you can right click within the code and click Edit Method. From here dnSpy will open that method in an editor for you to edit as you see fit. Once you have edited and added/removed what you want press compile. dnSpy will then show you the method again but with the edits you made, do note that it's either dnSpy itself or the Roslyn Compiler that sort of changes how your edits are layed out, but don't worry they should still perform exactly how you intend, provided you got the code correct that is.

    That should give you the general idea on how to use dnSpy with Terraria.

     
    Terraria.Main.Initialize()
    Terraria.Main.Update(GameTime)
    Terraria.Main.Draw(GameTime)
    Terraria.Main.DoUpdate_Enter_ToggleChat() <- You can enable the chat in singleplayer if you edit this correctly. (Hint: netMode)
    Terraria.Main.DoUpdate_HandleChat() <- Hook the chat, process commands if needed (Hint: Line 55)
    Terraria.Main.OurLoad<T>(string) <- Not used before but looks like this is a good spot to load custom textures if you wanted.
    Terraria.NetMessage.SendData(lots of arguments) <- Send data directly to the server
    Terraria.Player.PutItemInInventory(int, int) <- Spawn items


    EDIT: Forgot to mention, you can create entirely new classes with dnSpy by right clicking, then Add Class. dnSpy will open a editor for you and you can add all your methods that are going to be called via hooked methods here. Neater that way.

    EDIT 2: Forgot to mention again! Once you've made changes, they're not written instantly. In fact if you close dnSpy will ask you to save. You can do this manually by clicking File > Save Module > OK
    Last edited by HiImKyle; 04-20-2019 at 03:26 PM.

  6. The Following 2 Users Say Thank You to HiImKyle For This Useful Post:

    loleris111 (05-25-2020),RPGuserZ1002 (04-20-2019)

  7. #5
    RPGuserZ1002's Avatar
    Join Date
    Apr 2019
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    Thank you for your time Kyle! I appreciate it so much that you spent your time helping me here. Do you mind adding you on disc0rd so i can ask you questions?

  8. #6
    HiImKyle's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    England
    Posts
    233
    Reputation
    10
    Thanks
    206
    Quote Originally Posted by RPGuserZ1002 View Post
    Thank you for your time Kyle! I appreciate it so much that you spent your time helping me here. Do you mind adding you on disc0rd so i can ask you questions?
    Sure go ahead.

  9. The Following User Says Thank You to HiImKyle For This Useful Post:

    RPGuserZ1002 (04-20-2019)

  10. #7
    RPGuserZ1002's Avatar
    Join Date
    Apr 2019
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    Alright I'll friend you tomorrow because I don't have time now.

  11. #8
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0

    How to get command arguments?

    Quote Originally Posted by HiImKyle View Post


    So like you said, you got Terraria open in dnSpy which is good. You see on the left it shows "Terraria (1.3.5.3)" then under that is "Terraria.exe", if you click on the arrow next to the exe one you will get a drop down of all the namespaces that exist within the exe. You should know what a namespace is, but if you don't it's not entirely important.

    If you clicked on the arrow of a namespace, you'll get all the classes that are under that namespace.
    If you clicked on the arrow of a class, you'll get all the methods and fields/properties of that class.

    One thing you should never do is click on the class name, always click on the arrow! Clicking on the class name tells dnSpy to decompile that entire class for you to read. One class you should avoid doing this with is Main under the "Terraria" namespace. This contains pretty much everything upfront. Game updates, drawing methods, server methods. It's the whole shabang, which is why it takes a minute or two to decompile and isn't really worth waiting for as most of the methods within Main are useless to you.

    Once you have a class's methods and fields/properties shown you can click on each one individually. This tells dnSpy to decompile ONLY that which is much faster for browsing through methods of interest. Speeds up the process of doing this entire thing.

    Some methods you should hook are, Initialize(), Update(GameTime), Draw(GameTime). These 3 methods are in Main so like I said, click the arrow, find the method and click on the method.

    To edit a method, when the method is shown, you can right click within the code and click Edit Method. From here dnSpy will open that method in an editor for you to edit as you see fit. Once you have edited and added/removed what you want press compile. dnSpy will then show you the method again but with the edits you made, do note that it's either dnSpy itself or the Roslyn Compiler that sort of changes how your edits are layed out, but don't worry they should still perform exactly how you intend, provided you got the code correct that is.

    That should give you the general idea on how to use dnSpy with Terraria.

     
    Terraria.Main.Initialize()
    Terraria.Main.Update(GameTime)
    Terraria.Main.Draw(GameTime)
    Terraria.Main.DoUpdate_Enter_ToggleChat() <- You can enable the chat in singleplayer if you edit this correctly. (Hint: netMode)
    Terraria.Main.DoUpdate_HandleChat() <- Hook the chat, process commands if needed (Hint: Line 55)
    Terraria.Main.OurLoad<T>(string) <- Not used before but looks like this is a good spot to load custom textures if you wanted.
    Terraria.NetMessage.SendData(lots of arguments) <- Send data directly to the server
    Terraria.Player.PutItemInInventory(int, int) <- Spawn items


    EDIT: Forgot to mention, you can create entirely new classes with dnSpy by right clicking, then Add Class. dnSpy will open a editor for you and you can add all your methods that are going to be called via hooked methods here. Neater that way.

    EDIT 2: Forgot to mention again! Once you've made changes, they're not written instantly. In fact if you close dnSpy will ask you to save. You can do this manually by clicking File > Save Module > OK
    I understand that a lot of time has passed, but still how can I make commands like itemgive, i, item .item id count? I searched everywhere but did not find

  12. #9
    HiImKyle's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Location
    England
    Posts
    233
    Reputation
    10
    Thanks
    206
    Quote Originally Posted by ItsMakar View Post
    I understand that a lot of time has passed, but still how can I make commands like itemgive, i, item .item id count? I searched everywhere but did not find
    Take a look at Terraria.Main.DoUpdate_HandleChat(), line 50~. Check if the message starts with a "." or whatever you want your prefix to be and do something else. Check my sig, I don't check mpgh often.

  13. #10
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    Quote Originally Posted by HiImKyle View Post


    Take a look at Terraria.Main.DoUpdate_HandleChat(), line 50~. Check if the message starts with a "." or whatever you want your prefix to be and do something else. Check my sig, I don't check mpgh often.

    In general, I meant how to make arguments, but I already learned how

  14. #11
    ItsMakar's Avatar
    Join Date
    Aug 2021
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    HiImKyle pls say how you create filtering in item giver ( i create it but it glitchy grid layout wokring bad if i filtering text this is my code

    ImGui.Begin("Item Giver");

    ItemGiverFilter.Draw("");
    ImGui.SliderInt("Count", ref ItemGiverItemsCount, 1, 999, ItemGiverItemsCount.ToString());

    foreach (var (item, index) in RegisteredItemIds.WithIndex()) {
    if (!ItemGiverFilter.PassFilter(item.Key.Value)) {
    continue;
    }

    // yes i took it from imgui issues on ******
    if (index > 0 && index % (Math.Round(ImGui.GetWindowSize().x / 41)) == 0) ImGui.NewLine();

    if (ImGui.ImageButton(item.Value, new ImVec2(27, 27), new ImVec2(0, 0), new ImVec2(1, 1), 0, new ImVec4(0, 0, 0, 0), new ImVec4(1, 1, 1, 1))) {
    Hacks.LocalPlayer.QuickSpawnItem(new EntitySource_Film(), item.Key.Key, ItemGiverItemsCount);
    }
    ImGui.SameLine();
    }

    ImGui.End();
    video: https ://dri ve .go ogle .c om /fil e/d/1FN cqwYi 8tCuIS nuds MfWx Uvy9A MEt3n_/vie w?usp =s harin g (without spaces)

    - - - Updated - - -

    UPD: I think I can somehow fix this, but I need not to draw only the last elements, it don't draw random ones, and because of this, somewhere there are more buttons and somewhere less

    - - - Updated - - -

    but i don't know how....
    Last edited by ItsMakar; 06-10-2022 at 12:32 AM. Reason: fix

Similar Threads

  1. [Solved] How do I make a hacked client?
    By Alkine in forum Realm of the Mad God Private Servers Help
    Replies: 7
    Last Post: 06-06-2016, 07:58 AM
  2. [Solved] How to change ip of hacked client for private server?
    By Coolet in forum Realm of the Mad God Help & Requests
    Replies: 1
    Last Post: 03-23-2016, 01:59 AM
  3. How to make a hacked client for a private server?
    By MatuandJohku in forum Realm of the Mad God Private Servers Help
    Replies: 5
    Last Post: 04-28-2015, 12:33 AM
  4. [Solved] How Do I Get A Hacked client For Hexxit?
    By kayden700 in forum Minecraft Help
    Replies: 9
    Last Post: 10-15-2014, 01:24 PM
  5. Replies: 2
    Last Post: 05-05-2013, 11:41 AM