Programar cheats para Tibia requiere su tiempo. Tibia tiene su esquema interno y debes adaptarte a él. Con la API ReadProcessMemory lees valores de direcciones de memoria periodicamente comprobando el mana en el caso del rune maker.
Recomiendo que utilices C#o C++ para la programación del mismo. El code de abajo está en VB.NET ya que tiene unos añitos pero sigue siendo válido, es de lo último que programé cuando me dedicaba al mundo de cheats en Tibia (ya te dije que me comí un baneo por codear cheats)...
En este code ves que controlo el mana del personaje y al quedarse en "X" creo una SD, o como comida o creo una runa blanca (esto era para un OT).
Simplemente lo que hago es simular la pulsación de hotkeys en el cliente de Tibia, bastante simple.
Las direcciones de memoria de las que hablo. Copia el code en un módulo que tenga por nombre "Addresses"... OJO esto era para la versión de Tibia 9.8. Aquí tienes las addresses para la última version (10.76) ->
http://www.blackdtools.net/showthread.php?61995-10-76-Blackd-Tibia-addresses-10-76Module Addresses
Public p As Process = Process.GetProcessesByName("Tibia")(0)
Public BaseAddress As Int32 = p.MainModule.BaseAddress.ToInt32
Public hWnd As IntPtr = p.Handle
End Module
Module Player
Public XorKey As IntPtr = &H3B6EF0 + BaseAddress
Public Mana As IntPtr = &H3B6F44 + BaseAddress
End Module
El código en cuestión. Crea un proyecto WinForms (VB.NET) en Visual Studio y pega el code en la clase la ventana principal (Form1.vb).
Imports System.Threading
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("kernel32.dll", SetLastError:=True)> _
Public Shared Function ReadProcessMemory( _
ByVal hProcess As IntPtr, _
ByVal lpBaseAddress As IntPtr, _
<Out()> ByVal lpBuffer() As Byte, _
ByVal dwSize As Integer, _
ByRef lpNumberOfBytesRead As Integer
) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean
End Function
Private t_m(2) As Thread
Private t_paused(2) As Boolean
Private Const WM_KEYDOWN As Int32 = &H100
Private Sub CreateBlankRune()
Dim PMana As Int32 = ReadInt32(Mana.ToInt32) Xor ReadInt32(XorKey)
If PMana > 50 Then
PostMessage(p.MainWindowHandle, WM_KEYDOWN, Keys.F1, 0)
Thread.Sleep(6000)
End If
CreateBlankRune()
End Sub
Private Sub CreateSuddenDeathRune()
Dim PMana As Int32 = ReadInt32(Mana.ToInt32) Xor ReadInt32(XorKey)
If PMana > 1000 Then
PostMessage(p.MainWindowHandle, WM_KEYDOWN, Keys.F2, 0)
Thread.Sleep(25000)
End If
CreateSuddenDeathRune()
End Sub
Private Sub EatFood()
While True
PostMessage(p.MainWindowHandle, WM_KEYDOWN, Keys.F3, 0)
Thread.Sleep(360000)
End While
End Sub
Private Function ReadInt32(ByVal Address As IntPtr) As Int32
Dim Buffer(3) As Byte
Dim readBytes As Int32 = Nothing
ReadProcessMemory(hWnd, Address, Buffer, 4, readBytes)
Return BitConverter.ToInt32(Buffer, 0)
End Function
Private Sub UpdateText(ByVal lbl As Label, ByVal Text As String, ByVal Running As Boolean)
If Running Then
lbl.ForeColor = Color.Green
Else
lbl.ForeColor = Color.Red
End If
lbl.Text = Text
End Sub
Private Sub btn_BlankRune_Click(sender As System.Object, e As System.EventArgs) Handles btn_BlankRune.Click
If Not t_paused(0) Then
t_paused(0) = True
btn_BlankRune.Text = "Detener Hilo Adori Blank"
UpdateText(Label4, "INICIADO", True)
t_m(0) = New Thread(AddressOf CreateBlankRune)
t_m(0).Start()
Else
t_paused(0) = False
btn_BlankRune.Text = "Adori Blank"
UpdateText(Label4, "DETENIDO", False)
t_m(0).Abort()
End If
End Sub
Private Sub btn_SDRune_Click(sender As System.Object, e As System.EventArgs) Handles btn_SDRune.Click
If Not t_paused(1) Then
t_paused(1) = True
btn_SDRune.Text = "Detener Hilo SD"
UpdateText(Label5, "INICIADO", True)
t_m(1) = New Thread(AddressOf CreateSuddenDeathRune)
t_m(1).Start()
Else
t_paused(1) = False
btn_SDRune.Text = "Sudden Death"
UpdateText(Label5, "DETENIDO", False)
t_m(1).Abort()
End If
End Sub
Private Sub btn_eatFood_Click(sender As System.Object, e As System.EventArgs) Handles btn_eatFood.Click
If Not t_paused(2) Then
t_paused(2) = True
btn_eatFood.Text = "Detener Hilo Eat Food"
UpdateText(Label6, "INICIADO", True)
t_m(2) = New Thread(AddressOf EatFood)
t_m(2).Start()
Else
t_paused(2) = False
btn_eatFood.Text = "Eat Food"
UpdateText(Label6, "DETENIDO", False)
t_m(2).Abort()
End If
End Sub
Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
For i As Int32 = 0 To t_m.Length - 1
If t_m(i) IsNot Nothing Then
If t_m(i).IsAlive Then
t_m(i).Abort()
End If
End If
Next
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Try
Dim pStat As Boolean = IsNothing(p)
Catch ex As Exception
MsgBox("Aségurate de que Tibia se está ejecutando.", 16)
Application.Exit()
End Try
End Sub
End Class
Si tienes dudas responde en este post.
Saludos.