Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Tales of Pirates Static Address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
ghogiel
How do I cheat?
Reputation: 0

Joined: 10 Aug 2007
Posts: 2

PostPosted: Fri Aug 10, 2007 4:00 pm    Post subject: Tales of Pirates Static Address Reply with quote

Hello, as you can prob. see~ this is my first post here.
I'm pretty much a nub for both CE and AutoIt.

I've been lurking on ToP discussions -- particularly on mikeymike's, SXGuy's and Labyrnth's posts. I've modified AutoIt sources from many ppl: mainly SXGuy's and Labyrnth's.

On several ocassions, Labyrnth mentioned that there are actually many static addresses for ToP (or PKO ?). The one I am currently interested is in EXP. I've been trying to get the the static address and failed (miserably). Perhaps there's something I did wrong ? This question is probably directed to Labyrnth: how do you find the cursor static address at the first place ? Are there some special pointer search you did ? Or was it something else.

The one I found for exp was: "0D9F8468", I used this as a constant (see code below) -- unfortunately, this address changes dynamically between logons.

Having said that, I want to share my modifications here:

Consts.au3:
Code:
#include-once

Global Const $__Game_Title = "Tales of Pirates"
Global Const $__Game_Process = WinGetProcess ($__Game_Title, "")


memreader.au3:
Code:
#include-once

Local Const $__mem_cursor = "006d0724" ; Address to read for CursorID this = 7 For a real Enemy Target "Cursor is a Sword"
Local Const $__mem_exp = "0D9F8468"
Local Const $__cursor_sword = 7

Func getPlayerExp ()
   Local $M_open = _MemoryOpen ($__Game_Process)
   Local $result = _MemoryRead ($M_open, "0x" & $__mem_exp)
   _MemoryClose($M_open)
   
   Return $result   
EndFunc

Func getCursor ()
   Local $M_open = _MemoryOpen ($__Game_Process)
   Local $result = _MemoryRead ($M_open, "0x" & $__mem_cursor)
   _MemoryClose($M_open)
   
   Return $result
EndFunc

Func CursorIsSword ()
   Return (getCursor () = $__cursor_sword)
EndFunc

#region read/write memory
Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)

   If Not ProcessExists($iv_Pid) Then
      MsgBox(0, "value of lastaction", "error3")
      SetError(1)
      Return 0
   EndIf

   Local $ah_Handle[2] = [DllOpen('kernel32.dll') ]
   If @error Then
      MsgBox(0, "value of lastaction", "error4")
      SetError(2)
      Return 0
   EndIf
   Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)
   If @error Then
      MsgBox(0, "value of lastaction", "error5")
      DllClose($ah_Handle[0])
      SetError(3)
      Return 0
   EndIf

   $ah_Handle[1] = $av_OpenProcess[0]
   Return $ah_Handle

EndFunc   ;==>_MemoryOpen


Func _MemoryRead($ah_Handle, $iv_Address, $sv_Type = 'dword')

   If Not IsArray($ah_Handle) Then
      SetError(1)
      MsgBox(0, "value of lastaction", "error1")
      Return 0
   EndIf

   Local $v_Buffer = DllStructCreate($sv_Type)

   If @error Then
      MsgBox(0, "value of lastaction", "error2")
      SetError(@error + 1)
      Return 0
   EndIf

   DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

   If Not @error Then
      Local $v_Value = DllStructGetData($v_Buffer, 1)
      Return $v_Value
   Else
      SetError(6)
      Return 0
   EndIf

EndFunc   ;==>_MemoryRead


Func _MemoryWrite($ah_Handle, $iv_Address, $v_Data, $sv_Type = 'dword')

   If Not IsArray($ah_Handle) Then
      SetError(1)
      Return 0
   EndIf

   Local $v_Buffer = DllStructCreate($sv_Type)

   If @error Then
      SetError(@error + 1)
      Return 0
   Else
      DllStructSetData($v_Buffer, 1, $v_Data)
      If @error Then
         SetError(6)
         Return 0
      EndIf
   EndIf

   DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

   If Not @error Then
      Return 1
   Else
      SetError(7)
      Return 0
   EndIf

EndFunc   ;==>_MemoryWrite


Func _MemoryClose($ah_Handle)

   If Not IsArray($ah_Handle) Then
      SetError(1)
      Return 0
   EndIf

   DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1])
   If Not @error Then
      DllClose($ah_Handle[0])
      Return 1
   Else
      DllClose($ah_Handle[0])
      SetError(2)
      Return 0
   EndIf

EndFunc   ;==>_MemoryClose


Main code:
Code:
#include "Consts.au3"
#include "memreader.au3"

WinActivate($__Game_Title)
WinWaitActive($__Game_Title)

Opt("pixelcoordmode", 2)
Opt("mousecoordmode", 2)
Opt("WinTextMatchMode", 2)      ;1=complete, 2=quick
Opt("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

MsgBox(0, "exp is: ", getPlayerExp ())


Thank you very much for you kind attention.

Cheers.
Back to top
View user's profile Send private message
Labyrnth
Moderator
Reputation: 10

Joined: 28 Nov 2006
Posts: 6301

PostPosted: Sat Aug 11, 2007 12:12 pm    Post subject: Reply with quote

Heh ,nice to see someone actually reads what is written.


Finding EXP Static Address: *Your going to slap yourself for missing this lol.

1. Scan in Text.
2. Look for EXP Gained the words.
3. Once you see the results there is the green one. It could be more then

one. But it is the one that changes to say what city your in and what weapon you have in hand.
Thats the address you use to let your bot know if exp is gained and the monster has died so it can attack the next one it finds. Smile.
In auto it you are using the value. So add the same address in CE and change it from text to 4 byte and you will see th value of EXP Gained.
If you want to also detect weapon used so you can trigger a skill for it, then use that same address and the value of the weapon.
===============================================

Finding Cursor ID.
This one is very easy.

1. Have your cursor on the map over grass or something not attackable.
2. Scan for unknown, 4bytes
3. Move cursor over a enemy then scan for has changed.
4. Move it off the enemy and scan for has changed.
Keep doing this and you will find th cursor ID.
They are really simple, also they are single digits. Such as attack might be 7 in value. But the normal cursor over the grass may be 2.
Im just saying an example of the value i dont remember the real on so try what i said and you will find them.

Here is a Example function used to see if EXP is Gained.
7827266 is the value of "EXP Gained" from text to byte.
Code:

Func checkxpgain()
   Local $c=0
   Local $w=0
   While $w=0
      Readlast()
      if $lastaction = 1701869637 Then $w=1
;~                       ^ Exsperiance gained
      $c=$c+1
      if $c>40 then $w=1
      sleep(250)
   WEnd
EndFunc   ;==>checkxpgain




Function to see if your attacking enemy: Weapon Detected.
Code:
Func checkengaged()
   Readlast()
   If $lastaction <> 7827266 Then    ; value for weapon
;~       msgbox(0,"not equal","error returned")
      SetError(1)
   EndIf
EndFunc   ;==>checkengaged
Back to top
View user's profile Send private message
ghogiel
How do I cheat?
Reputation: 0

Joined: 10 Aug 2007
Posts: 2

PostPosted: Sat Aug 11, 2007 10:39 pm    Post subject: Reply with quote

ah thanks very much labby~
i'll give that a shot and keep this thread updated.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites