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 


[Terraria] Calculating Timers...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Marcus101RR
Expert Cheater
Reputation: 2

Joined: 09 Mar 2011
Posts: 131
Location: USA, FL

PostPosted: Sun Sep 30, 2012 11:41 pm    Post subject: [Terraria] Calculating Timers... Reply with quote

[Terraria] Calculating Timers...

I managed to get some things out of Terraria via Steam Version. Not supporting the cracked/non-steam at the moment. So the timer was found for buffs, however, I am unable to translate it to a double/float in order to compensate the milliseconds and seconds apart from each other.

The timer is stored in a 4 Byte Value on an address, or I should say the timer itself is 4 Bytes Long.

I did manage to find out that the multiplier is 59. So, in order to get 30 minutes of a buff, you must do the following:

59 * 60 * 30 = 30 Minutes of Buff

Here is the table so far:

Anyone know a way to translate the timer value to a more proper easy method in seconds? Rather than this strange formula?



Terraria2.CT
 Description:
Terraria Table (Health, Mana, Buff, Timers)

Download
 Filename:  Terraria2.CT
 Filesize:  4.25 KB
 Downloaded:  906 Time(s)

Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
mgr.inz.Player
I post too much
Reputation: 223

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Oct 01, 2012 9:29 am    Post subject: Reply with quote

Add new custom type:
Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(value59,4)

value59:
dd (float)59

TypeName:
db 'TerrariaTimer',0

ByteSize:
dd 4

ConvertRoutine:
push ebp
mov ebp,esp
mov eax,[ebp+8]
mov eax,[eax]

cvtsi2ss xmm0,eax
divss xmm0,[value59]
cvtss2si eax,xmm0
pop ebp
ret 4


ConvertBackRoutine:
push ebp
mov ebp,esp
push eax
push ebx
mov ebx,[ebp+c]

cvtsi2ss xmm0,[ebp+8]
mulss xmm0,[value59]
cvtss2si eax,xmm0

mov [ebx],eax
pop ebx
pop eax
pop ebp
ret 8


all values will be seconds (integer - 4byte)





Or if you prefer seconds as float, use this:
Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,4)
alloc(value59,4)

value59:
dd (float)59

TypeName:
db 'TerrariaTimer_float',0

ByteSize:
dd 4

UsesFloat:
dd 1

ConvertRoutine:
push ebp
mov ebp,esp
mov eax,[ebp+8]
mov eax,[eax]

push eax
cvtsi2ss xmm0,eax
divss xmm0,[value59]
movss [esp],xmm0
pop eax

pop ebp
ret 4


ConvertBackRoutine:
push ebp
mov ebp,esp
push eax
push ebx
mov ebx,[ebp+c]

movss xmm0,[ebp+8]
mulss xmm0,[value59]
cvttss2si eax,xmm0

mov [ebx],eax
pop ebx
pop eax
pop ebp
ret 8





Note: above scripts are only for 32bit cheatengine (cheatengine-i386.exe)

_________________
Back to top
View user's profile Send private message MSN Messenger
Marcus101RR
Expert Cheater
Reputation: 2

Joined: 09 Mar 2011
Posts: 131
Location: USA, FL

PostPosted: Mon Oct 01, 2012 11:54 am    Post subject: Reply with quote

I thank you for this code, but I is there a place I can learn something like this? Next time I need to do this, I probably won't know how to do that. So, if you can link me to some tutorial that teaches you these scripts that would be great.

Thanks
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Mon Oct 01, 2012 8:13 pm    Post subject: Reply with quote

Terraria is written in C# and is not protected. You can use tools like ilSpy to decompile it and check out the code. (The developer encourages it as well for modders.)

Code:

                case 425:
                    this.mana = 40;
                    this.channel = true;
                    this.damage = 0;
                    this.useStyle = 1;
                    this.name = "Fairy Bell";
                    this.shoot = 72;
                    this.width = 24;
                    this.height = 24;
                    this.useSound = 25;
                    this.useAnimation = 20;
                    this.useTime = 20;
                    this.rare = 5;
                    this.noMelee = true;
                    this.toolTip = "Summons a magical fairy";
                    this.value = (this.value = 250000);
                    this.buffType = 27;
                    this.buffTime = 18000;
                    break;


For example, this is the Fairy Bell item.
The duration is 18000.
Which is actually 300 seconds. (18000/60)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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