Wisling / tibiaauto

Tibia Auto is made to excel in the automation of various aspects of the playing the MMORPG Tibia
31 stars 17 forks source link

reopen backpacks when no backpacks open #44

Closed Wisling closed 8 years ago

Wisling commented 8 years ago

Reopens backpacks after 8 seconds when none are open. Uses AutoLogin mutex and window maximizing to open containers. Limitations of this exist due to not being able to tell which container is which while they are opened, so no backpack can be selectively opened if it accidentally closed.

dmarszk commented 8 years ago

Inventory GUI container is still dynamically allocated AFAIK. At least from what I got out yesterday. Lemme copypaste, with some corrections, what I wrote to you yesterday.

Every sidebar gui element (and not only sidebar, probably) has a common structure (I guess the same class it inherites from has).

Changing sidebar size, or minimizing it, or adding a new one (opening bp for eg.) causes calling sub_5159E0 for 10.92 (guess it's recalcElementCoords), usually multiple times (because it needs to update coords for multiple elements), with pointer to the GUI element instance allocated on heap in ECX (probably pointer to this in MS fastcall),

bool minimized is @ offset 0x64 of the GUI element instance. Minimizing an element programatically would involve flipping the said bool and then calling the given function, though most likely it needs to be called in the GUI drawing thread to prevent race conditions.

I bet this might differ alot for Tibia 11 (anybody got a binary?).

Minimized backpacks got int32 height value equal to 19. I don't remember the offset now. But minimizing an element changes alot of values.

felipetnh commented 8 years ago

I have no idea how you guys find out that kind of stuff... ahahaha xD

Wisling commented 8 years ago

If you know how to debug code in a program line-by-line, you could probably figure it out for general exe files. Using IDA or OllyDbg(or ever Visual Studio) you can run an executable line-by-line, except there are no human readable function names or variables so you can't always tell what each line is doing. And you need to use breakpoints more creatively since a 8GHz CPU goes through about 8 billion of those lines of code per second. Cheat engine is also helpful just to find a value that changes or that you can control(like a window height or HP value). With those two tools, really, the only limitation you have is your creativity.

dmarszk commented 8 years ago

Was going to link this - https://www.youtube.com/watch?v=NFQCYpIHLNQ

But yeah, basically what Wisling said.

felipetnh commented 8 years ago

https://media.giphy.com/media/ujUdrdpX7Ok5W/giphy.gif