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 archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
Market GUI [Archive] - Forums

PDA

View Full Version : Market GUI



nazn
10-20-2015, 12:00 AM
I want to write something capable of using the Market, at least pulling data or posting offers, preferably both. However I'm still on research phrase.
I've examined window structure a little but hit some major problems.


Window doesn't update when values like when item category, item or search string is changed (actually just a way to select an item from the list would be enough, changing the list is trivial).
Although I've found a way how to find offers' data by searching for a pattern of bytes, I still can't find anything to distinguish buy and sell.
A way to solve both would be by using call functions of GUI widgets, but brute-forcing every function is a tedious work. Also the lists are quite big, how the end is marked?
How to properly call a function? I've done a little test but it crashed and I don't know why.
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
label(varxx)
label(unload)

newmem:
push eax //save state of registers
mov eax,[varxx] //to make sure it runs once
cmp eax,1
je unload
push ebx
push ecx
push edx
push esi
push edi
push ebp
push esp
mov eax,1
mov [varxx],eax
mov eax,0127e0fc //loading registers
mov ebx,0000000c //these values are always
mov ecx,0421b4d8 //constant in single instance
mov edx,00d883c4
mov esi,0421b4d8
mov edi,03f1c4c8
mov ebp,0127e108
mov esp,0127dfe8
call 00A52A50 //toggles level filter
pop esp //restoring registers
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
unload:
pop eax
jmp originalcode

originalcode:
mov eax,[ecx+10]
ret
int 3

exit:
jmp returnhere

varxx:
db 0

"Tibia.exe"+4E660: //it's called quite often
jmp newmem
returnhere:



Most of my data structure research (Tibia 10.82, Windows):

offers in cache structure:
0x00 - ??
0x04,2b - ??
0x06,2b - 0x00b3
0x08 - item id
0x0c,2b - amount
0x0e,2b - ??
0x10 - price
0x14 - string ("amount [...]")

all windows:
0x00 - according to this post (http://tpforums.org/forum/threads/443-Tibia-GUI-structure) it's callback structure
0x0c - parent window
0x10 - next item
0x14 - 0x20 - offsets, size
0x24 - first child

buttons:
0x30,1b - click on
0x31,1b - mouse over
0x94,1b - button down

market window:
0x24 - first child, (offers button, details, my offers, close, the line, title, sub window)
0x28 - 0x0
0x2c - sub window - very important
0x30 - my offers
0x34 - close
0x38 - details
0x3c - offers
0x40 - title
0x44 - the line (that one separating sub window from buttons)

offers sub window (address in "Tibia.exe"+0053395C +30 +34 +6c +c):
0x24 - first child, fee
0x28 - 0x0
0x2c - categories
0x30 - level filter button
0x34 - vocation
0x38 - 1H
0x3c - 2H
0x40 - object types (select item)
0x44 - start of item id list
0x48 - end ^
0x4c - ??, some kind of image or bit map?
0x50 - search
0x54 - gold
0x58 - coins
sell part:
0x5c - "Sell Offers:"
0x60 - amount (just a text)
0x64 - total
0x68 - "gold"
0x6c - slider
0x70 - accept button
0x74 - sell offers

0x78-0x90 - buy part
create offer part:
0x94 - "Anonym." button
0x98 - number of items
0x9c - slider
0xa0 - create
0xa4 - sell button
0xa8 - buy
0xac - price
0xb0 - fee

0xb4 - ???
0xb8 - ???


sell/buy offers:
0x2c - amount of offers
0x34 - first element of something, no idea of what, but looks important
0x38 - last element, is always [x+0x2c]*4 away
0x40 - selected (doesn't update)

categories/object types:
0x2c - number of elements
0x40 - selected elem. (doesn't update)

slider:
0x28 - has something to do with mouse capture
0x2c - the slider:
0x30 - amount (doesn't update, but works)
0x3c,2b - flag, 101 - click on the box, 100 - click on slider
0x48 - 0x0:on the left, 0x40:on the right
0x30 - left button
0x34 - right button

search/price input:
0x2c - str pointer
0x30 - max length
0x34 - position
0x54 - trim left
0x58 - focus