Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
Help starting out
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Help starting out

  1. #1

    Help starting out

    This is my code so far I just need a way to get the actual value now.
    As of now it returns 20439520 but how do I use this to get the players exp.

    Code:
            public static uint Version;
            public static uint Experience;
            public static uint Flags;
    
            public static uint Health;
            public static uint HealthMax;
    
            public static uint Mana;
            public static uint ManaMax;
    
            public static void Version1001(Process Tibia)
            {
                uint baseAddress = (uint)Tibia.MainModule.BaseAddress.ToInt32();
                Version = 0x57B705 + baseAddress;
                Experience = 0x3BE1E0 + baseAddress;
                Health = 0x553000 + baseAddress;
                HealthMax = 0x55302C + baseAddress;
                Mana = 0x3BE224 + baseAddress;
                ManaMax = 0x3BE1D4 + baseAddress;
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                Process Tibia = Process.GetProcessesByName("Tibia")[0];
                Version1001(Tibia);
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                textBox1.Text = Convert.ToString(Experience);
            }
    Last edited by Kannibale; 06-19-2013 at 07:27 PM.

  2. #2
    Senior Member
    Join Date
    Mar 2009
    Location
    Brazil
    Posts
    266
    Which language are you using?

  3. #3
    Senior Member
    Join Date
    Dec 2011
    Posts
    249
    I'm not sure if you are actually reading it from the client, by your code example it seems like you are not, but since it returned 0 I will assume that you are reading the hitpoints address from the Tibia client.

    The hitpoints value in the client is XOR encrypted and this is a little bit harder then reading for example experience from the client, try that out first and check if you get the correct value.

  4. #4
    Quote Originally Posted by Ash Katchup View Post
    Which language are you using?
    I'm using c#

  5. #5
    Member Diego's Avatar
    Join Date
    Mar 2012
    Location
    México
    Posts
    79
    You are simply displaying the memory address + base address as an integer, you gotta read the value out of the memory in the tibia client first.

    int playerExperience = ReadInt32(Experience);

    MessageBox.Show(playerExperience.ToString());

    *Taking on account you have a method named ReadInt32() that actually reads the process memory...
    TibiaViewer taking AFK botting to a whole different level Sign up!.

  6. #6
    Quote Originally Posted by Diego View Post
    *Taking on account you have a method named ReadInt32() that actually reads the process memory...
    If someone could post this for me I'll be able to figure out the rest on my own. Thanks for the reply.

  7. #7
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Quote Originally Posted by Kannibale View Post
    If someone could post this for me I'll be able to figure out the rest on my own. Thanks for the reply.
    It's available to you in another thread where you tried out some source code... I've responded to you there.

  8. #8
    Senior Member
    Join Date
    Mar 2009
    Location
    Brazil
    Posts
    266
    As you're using C#, i'm going to post my code.

    I've create a Class just to keep the methods and functions to read the memory.

    Code:
    static class Memoria
        {
            public static byte[] ReadBytes(IntPtr handle, long address, uint bytesToRead)
            {
                IntPtr ptrBytesRead;
                byte[] buffer = new byte[bytesToRead];
    
                WinApi.ReadProcessMemory(handle, new IntPtr(address), buffer, bytesToRead, out ptrBytesRead);
    
                return buffer;
            }
    
            public static byte ReadByte(IntPtr handle, long address)
            {
                return ReadBytes(handle, address, 1)[0];
            }
    
            public static short ReadInt16(IntPtr handle, long address)
            {
                return BitConverter.ToInt16(ReadBytes(handle, address, 2), 0);
            }
    
            public static ushort ReadUInt16(IntPtr handle, long address)
            {
                return BitConverter.ToUInt16(ReadBytes(handle, address, 2), 0);
            }
    
            public static string ReadString(IntPtr handle, long address, uint length)
            {
                if (length > 0)
                {
                    byte[] buffer;
                    buffer = ReadBytes(handle, address, length);
                    return System.Text.ASCIIEncoding.Default.GetString(buffer).Split(new Char())[0];
                }
                else
                {
                    string s = "";
                    byte temp = ReadByte(handle, address++);
                    while (temp != 0)
                    {
                        s += (char)temp;
                        temp = ReadByte(handle, address++);
                    }
                    return s;
                }
            }
    
        }
    Then, on my main form, i've created a Client class, to save some data:

    Code:
    public class Cliente
        {
            public int ID { get; set; }
            public int Base { get; set; }
            public IntPtr processHandle { get; set; }
    
            public int LerMemoria(int endereco)
            {
                return ((int)Memoria.ReadUInt16(processHandle, Base + endereco));
            }
        }
    FInally, on my main form, i search for the Tibia Client and save it's ID, base address and handle

    Code:
    private void EscolheCliente()
            {
                foreach (Process p in Process.GetProcesses())
                {
                    StringBuilder classname = new StringBuilder();
                    WinApi.GetClassName(p.MainWindowHandle, classname, 12);
    
                    if (classname.ToString().Equals("TibiaClient", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (p.MainModule.FileVersionInfo.FileVersion == "9.10") // Here you set the Tibia Version
                        {
                            client = new Cliente();
    
                            client.processHandle = WinApi.OpenProcess(WinApi.PROCESS_ALL_ACCESS, 0, (uint)p.Id);
                            client.ID = p.Id;
                            client.Base = (int)p.MainModule.BaseAddress;
    
                            return;
                        }
                    }
                }
            }
    And then, i read the addresses like this:

    Code:
    int LookId = 0x5B34B4;
    
    client.LerMemoria(LookId);
    Last edited by Ash Katchup; 06-19-2013 at 09:22 PM.

  9. #9
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    Quote Originally Posted by Ash Katchup View Post
    As you're using C#, i'm going to post my code.

    I've create a Class just to keep the methods and functions to read the memory.

    Code:
    static class Memoria
        {
            public static byte[] ReadBytes(IntPtr handle, long address, uint bytesToRead)
            {
                IntPtr ptrBytesRead;
                byte[] buffer = new byte[bytesToRead];
    
                WinApi.ReadProcessMemory(handle, new IntPtr(address), buffer, bytesToRead, out ptrBytesRead);
    
                return buffer;
            }
    .
    .
    .
            public static short ReadInt16(IntPtr handle, long address)
            {
                return BitConverter.ToInt16(ReadBytes(handle, address, 2), 0);
            }
    
            public static ushort ReadUInt16(IntPtr handle, long address)
            {
                return BitConverter.ToUInt16(ReadBytes(handle, address, 2), 0);
            }
    Then, on my main form, i've created a Client class, to save some data:

    Code:
    .
    .
    .
            public int LerMemoria(int endereco)
            {
                return ((int)Memoria.ReadUInt16(processHandle, Base + endereco));
            }
    .
    .
    .
    if your intent is to read "int" values, you should read up to 4 bytes instead of 2 bytes, because you are actually reading "short (Int16)" instead of "int (Int32)".

  10. #10
    Senior Member
    Join Date
    Jan 2008
    Location
    Cambridge, England
    Posts
    725
    Quote Originally Posted by Ash Katchup View Post
    As you're using C#, i'm going to post my code.

    I've create a Class just to keep the methods and functions to read the memory.

    Code:
    static class Memoria
        {
            public static byte[] ReadBytes(IntPtr handle, long address, uint bytesToRead)
            {
                IntPtr ptrBytesRead;
                byte[] buffer = new byte[bytesToRead];
    
                WinApi.ReadProcessMemory(handle, new IntPtr(address), buffer, bytesToRead, out ptrBytesRead);
    
                return buffer;
            }
    
            public static byte ReadByte(IntPtr handle, long address)
            {
                return ReadBytes(handle, address, 1)[0];
            }
    
            public static short ReadInt16(IntPtr handle, long address)
            {
                return BitConverter.ToInt16(ReadBytes(handle, address, 2), 0);
            }
    
            public static ushort ReadUInt16(IntPtr handle, long address)
            {
                return BitConverter.ToUInt16(ReadBytes(handle, address, 2), 0);
            }
    
            public static string ReadString(IntPtr handle, long address, uint length)
            {
                if (length > 0)
                {
                    byte[] buffer;
                    buffer = ReadBytes(handle, address, length);
                    return System.Text.ASCIIEncoding.Default.GetString(buffer).Split(new Char())[0];
                }
                else
                {
                    string s = "";
                    byte temp = ReadByte(handle, address++);
                    while (temp != 0)
                    {
                        s += (char)temp;
                        temp = ReadByte(handle, address++);
                    }
                    return s;
                }
            }
    
        }
    Then, on my main form, i've created a Client class, to save some data:

    Code:
    public class Cliente
        {
            public int ID { get; set; }
            public int Base { get; set; }
            public IntPtr processHandle { get; set; }
    
            public int LerMemoria(int endereco)
            {
                return ((int)Memoria.ReadUInt16(processHandle, Base + endereco));
            }
        }
    FInally, on my main form, i search for the Tibia Client and save it's ID, base address and handle

    Code:
    private void EscolheCliente()
            {
                foreach (Process p in Process.GetProcesses())
                {
                    StringBuilder classname = new StringBuilder();
                    WinApi.GetClassName(p.MainWindowHandle, classname, 12);
    
                    if (classname.ToString().Equals("TibiaClient", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (p.MainModule.FileVersionInfo.FileVersion == "9.10") // Here you set the Tibia Version
                        {
                            client = new Cliente();
    
                            client.processHandle = WinApi.OpenProcess(WinApi.PROCESS_ALL_ACCESS, 0, (uint)p.Id);
                            client.ID = p.Id;
                            client.Base = (int)p.MainModule.BaseAddress;
    
                            return;
                        }
                    }
                }
            }
    And then, i read the addresses like this:

    Code:
    int LookId = 0x5B34B4;
    
    client.LerMemoria(LookId);
    Does your file version work correctly? I know that in the latest client version it reads 10.0.1.0, so I would expect it to be 9.0.1.0 for you. Can't say it's wrong as I haven't checked, but I guess if that code works it works :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •