PWI - Guide for finding chat message offsets - C# code included

04/21/2011 20:50 omarranimado#31
wen i understand ur postings right (not the ah releated), u code a tool to get items/price from catshops ?
sounds like a cool idea!

i think now about a tool who scan radius for catshops, search for items from list in those shops and get result with price, shop location and amount.
actual i must smile about the idea: a bot stand in city, scanning shops and compare prizes...then wander to one shop, buy stuff and wander to other stuff to sell.

sounds like a great experiment and lot of coding fun...i think i give it a try.
searching some offsets and build up a small demo tool for that.
but can be take a while...im from the age to have no holidays and more work :(
04/21/2011 21:04 Smurfin#32
haha that's refreshing after getting dizzy looking at hex numbers :D

I haven't tried making the script yet, just making sure if I have the right chatbase first, so I won't get stressed later and confused why it won't work lol.

it came up with not only 3 results in idapro, around ten but that's the only one that make sense and similar to what you refer to.

the baseChatAddress is enough to get started, test it first, and see if I can make it work by following Interest07's offsets in autoIt.


do you know how to make an autofinder for base_something ? lolkop made this script for autofinding base and call address using stringregexp in autoit, it's very convenient if later the base addresses are changed in future patch without manually look up every needed baseAddress using ce or idapro or ollydbg.

Code:
$path = "c:\Perfect World Indonesia\element\elementclient.exe"
$file = FileOpen($path, 16)
$data = FileRead($file, FileGetSize($path))
FileClose($file)
$select = StringRegExp($data, '(A1(.{8})578B482081C1EC000000E8(.{8}))', 1)
$call_pos = StringInStr($data, $select[0])/2 + 0x40000E
ConsoleWrite('$base = '&rev($select[1])&@CRLF)
ConsoleWrite('$select_call = 0x'&Hex(('0x'&rev($select[2])) + $call_pos + 5)&@CRLF)
$pick = StringRegExp($data, '(8B15(.{8})50518B4A2081C1EC000000E8(.{8}))', 1)
$call_pos = StringInStr($data, $pick[0])/2 + 0x400010
ConsoleWrite('$pick_call = 0x'&Hex(('0x'&rev($pick[2])) + $call_pos + 5)&@CRLF)

Func rev($string)
	Local $all
	For $i = StringLen($string) + 1 To 1 Step -2
		$all = $all & StringMid($string, $i, 2)
	Next
	Return $all
EndFunc
04/21/2011 21:14 Smurfin#33
Quote:
Originally Posted by omarranimado View Post
wen i understand ur postings right (not the ah releated), u code a tool to get items/price from catshops ?
sounds like a cool idea!

i think now about a tool who scan radius for catshops, search for items from list in those shops and get result with price, shop location and amount.
actual i must smile about the idea: a bot stand in city, scanning shops and compare prizes...then wander to one shop, buy stuff and wander to other stuff to sell.

sounds like a great experiment and lot of coding fun...i think i give it a try.
searching some offsets and build up a small demo tool for that.
but can be take a while...im from the age to have no holidays and more work :(
that's very useful, as a buyer we can find items at specific price and skip checking catshops one by one, as a seller, we can make an alarm if there is a competitor catshop around sells the same items we sell at cheaper price :D
04/21/2011 23:35 PW-Prophets#34
Global $Chat = 0xAE9620

Func BuildChatArray()
Local $array[1][2], $pointer, $counter
For $i=188 To 198
$pointer = _MemoryRead($CHAT, $PROCESS_INFORMATION)
ReDim $array[$counter + 1][2]
$array[$counter][0] = _MemoryRead($pointer + $i * dec("1c") + 0x4, $PROCESS_INFORMATION, "Byte") ;Chat Type
$array[$counter][1] = _MemoryRead(_MemoryRead($pointer + $i * dec("1c") + 0x8, $PROCESS_INFORMATION), $PROCESS_INFORMATION, 'wchar[100]') ;Chat text
If $array[$counter][0] = 4 Then

Do

addhistory($array[$counter][1])

SoundPlay("C:\Users\name\Desktop\botfolder\Alert.w ma")


MsgBox(0,"Someone has whispered you","Click OK when sound finish")

sleep(1000)
until 1 = 1
endif
$counter += 1


Next

_ArraySort($array, "", "", "", 6)
;_ArrayDisplay($array)
Global $ChatArray = $array
sleep(10)
EndFunc ;==>


This is what I have been using to test for PWI.

For $i=188 To 198 is only checking the last 10 msgs

SoundPlay("C:\Users\name\Desktop\botfolder\Alert.w ma") change this to link to the sound you want to play on whisper.

Hope this helps with writing yours and thank you dumbfck for this work.
04/21/2011 23:39 Smurfin#35
thanks a lot PW-Prophets :handsdown:, and it's already in autoit :)

about For $i=188 To 198 for last ten msgs, is it because the chat window only stored and display 198 lines in there ?
04/22/2011 00:12 PW-Prophets#36
Quote:
Originally Posted by Smurfin View Post
thanks a lot PW-Prophets :handsdown:, and it's already in autoit :)

about For $i=188 To 198 for last ten msgs, is it because the chat window only stored and display 198 lines in there ?
Yep only displays 198 msgs.
04/22/2011 00:36 omarranimado#37
Quote:
Originally Posted by Smurfin View Post
that's very useful, as a buyer we can find items at specific price and skip checking catshops one by one, as a seller, we can make an alarm if there is a competitor catshop around sells the same items we sell at cheaper price :D
Quote:
Func GetPPLList()
Local $array[1][6], $pointer, $ppl_base, $counter
$ppl_counter = memread(memread(memread(memread(memread(0xAE44C4) + 0x1C) + 0x1C) +0x20) + 0x14)

$pointer = memread(memread(memread(memread(memread(0xAE44C4) + 0x1C) + 0x1C) + 0x20) + 0x88)
For $x=0 To $ppl_counter-1
$ppl_base = memread($pointer + $x*0x4)
If $ppl_base<>0 Then
ReDim $array[$counter+1][6]
$array[$counter][0] = memread($ppl_base + 0x46C) ;PPL ID
$array[$counter][1] = memread(memread($ppl_base + 0x628), 'wchar[30]') ;PPL Name
$array[$counter][2] = memread(memread($ppl_base + 0x724), 'wchar[30]') ;PPL Catshop Name
$array[$counter][3] = (memread($ppl_base + 0x3C, 'float')+4000)/10 ;PPL x-position
$array[$counter][4] = (memread($ppl_base + 0x44, 'float')+5500)/10 ;PPL y-position
$array[$counter][5] = memread($ppl_base + 0x40, 'float')/10 ;PPL z-position
$counter += 1
EndIf
Next
Return $array
EndFunc
yep, this makes fun and heres the autoit ppl list source.
now i need to sort out the catshops by name...try to get there items and prices.
but not today zzzZZZZ ;)
04/22/2011 07:20 Interest07#38
Quote:
Originally Posted by omarranimado View Post
yep, this makes fun and heres the autpoit ppl list source.
now i sort out the catshops by name...try to get there items and prices.
but not today zzzZZZZ ;)
It sure is a lot of fun ;)

Good luck! Occasionally you'll come across acatshop selling vit stone for only 2 million instead of 20 million and things like that :D

Got my ah gold finder working, now just need to figure how to neatly convert my sql data into a graph on my site >.>
04/22/2011 08:46 omarranimado#39
Quote:
Originally Posted by Interest07 View Post
It sure is a lot of fun ;)

Good luck! Occasionally you'll come across acatshop selling vit stone for only 2 million instead of 20 million and things like that :D
this sound like u code it allready ?
are the catshop items right now in client memory or must i send a packet first, like the one talking to an npc ?

would be nice if u share some infos about this :)

Quote:
Got my ah gold finder working, now just need to figure how to neatly convert my sql data into a graph on my site >.>
if u need help on this, im webdesigner/programmer :cool:
04/22/2011 10:50 PW-Prophets#40
Quote:
Originally Posted by omarranimado View Post
this sound like u code it allready ?
are the catshop items right now in client memory or must i send a packet first, like the one talking to an npc ?

would be nice if u share some infos about this :)


if u need help on this, im webdesigner/programmer :cool:
Its a secret lmao.I personally dont want this cat let out of the bag if you know what I mean.

But here is a good example and might answer your question. [Only registered and activated users can see links. Click Here To Register...]
04/22/2011 13:11 omarranimado#41
Quote:
Originally Posted by PW-Prophets View Post
Its a secret lmao.I personally dont want this cat let out of the bag if you know what I mean.

But here is a good example and might answer your question. [Only registered and activated users can see links. Click Here To Register...]
if i understand u right...
u like to get infos for free, like the spirit of open source.
but u not wanted to give infos.

and the promotion of ur script is from non interrest for me, since it shows only the result.
also a php script to list some items shows nothing.

infos would be...how do u get the infos, u reading shurely from a mysql database.
reading by a ingame bot who post to the database.

but glad that i can help u to promote here :rolleyes:
so i refuse my older posting, to send u the source of ur recoded/bugfixed bot.
04/22/2011 17:06 PW-Prophets#42
Quote:
Originally Posted by omarranimado View Post
if i understand u right...
u like to get infos for free, like the spirit of open source.
but u not wanted to give infos.

and the promotion of ur script is from non interrest for me, since it shows only the result.
also a php script to list some items shows nothing.

infos would be...how do u get the infos, u reading shurely from a mysql database.
reading by a ingame bot who post to the database.

but glad that i can help u to promote here :rolleyes:
so i refuse my older posting, to send u the source of ur recoded/bugfixed bot.
Lol you did not like what I had to say...

Not everything has to be open source and this is one thing I want to remain behind closed doors =). I hope you figure it out, but do hope you choose not to post it in open forums thanks.
04/22/2011 18:17 Interest07#43
Quote:
Originally Posted by omarranimado View Post
this sound like u code it allready ?
are the catshop items right now in client memory or must i send a packet first, like the one talking to an npc ?

would be nice if u share some infos about this :)


if u need help on this, im webdesigner/programmer :cool:
Yeah, I already have one coded up. You have to walk up to each catshop and open it up. Only then will the items be in memory. I've posted the offsets for that in the genesis offset thread. You can open the catshops up with the regular action structs that are also posted somewhere, think in my packet thread somewhere hehe.

So basically you can have your bot run a certain route through archosaur visiting all the nearby catshops.

Thanks for the offer on help, I've downloaded some swf thing that should work for creating graphs, if I don't manage to figure it out I'll gladly take some advice lol :D
04/22/2011 18:22 omarranimado#44
Quote:
Originally Posted by dumbfck View Post
Wow that really was a bytch... Got there eventually though, thanks to OllyDbg ^^
Cheat engine just really wasn't cut out for this one - Nothing worse than scanning for a value and getting hundreds of results =P

Ok, with AH open, the base pointer to the sequential list of items is:
[[[[[[[BASE_CALL]+1C]+18]+8]+2BC]+208]+150]

ahItemObjSize = 0x5D0

Code:
struct ahItemObj
{
	*wchar		p_ahRow;		// 0x00	p->String of full line in AH (A bit broken though?)
	char		uk1[0x58];		// 0x04	Unknown
	*wchar		p_fullDescription	// 0x5C	p->Full description text
	uint		dwAuctionId		// 0xB0	Auction ID
	char		uk2[0x4]		// 0xB4	Unknown
	uint		dwCurrentBid		// 0xB8	Current Bid
	uint		dwBuyPrice		// 0xBC	Buy Now price
	char		uk2[0x8]		// 0xC0	Unknown
	uint		dwItemId		// 0xC8	Item ID
	char		uk2[0x504]		// 0xCC	Unknown
}
So for example, to get a list of just the IDs of everything in the AH:
Pseudocode:
[code]
Code:
// 15 items per page
for(i = 0 ; i < 15 ; i++)
{
	itemIDs[i] = ReadUnicode([[[[[[[[[BASE_CALL]+1C]+18]+8]+2BC]+208]+150]+ i*5D0 + B0]+0])
}
[Only registered and activated users can see links. Click Here To Register...]

works very well, thank you two for sharing the info :handsdown:
also ah gold works fine, but i try it only to test.
since the price changed so slow, its no need for me.
but interresting what can be done :awesome:


Quote:
*EDIT: The string referenced by p_ahRow is a tab separated string of each column on the listing display (unicode tab = 0x0009).
I think it might be GBK encoded too (Chinese 2312 / GB2312 character set I think)
replace the unicode tab (u0009) works fine, its from normal unicode charset.
i use it on stringsplit and build up the array :)

more problem actual is the ★
[Only registered and activated users can see links. Click Here To Register...]
seams not the right one to be...i take a closer look later.
04/22/2011 18:27 omarranimado#45
Quote:
Originally Posted by Interest07 View Post
Yeah, I already have one coded up. You have to walk up to each catshop and open it up. Only then will the items be in memory. I've posted the offsets for that in the genesis offset thread. You can open the catshops up with the regular action structs that are also posted somewhere, think in my packet thread somewhere hehe.

So basically you can have your bot run a certain route through archosaur visiting all the nearby catshops.

Thanks for the offer on help, I've downloaded some swf thing that should work for creating graphs, if I don't manage to figure it out I'll gladly take some advice lol :D
after playing with ur ah stuff, i just think about that i have to open shop first.
thx for the info, so i know what i try tomorrow :D

Quote:
public int catShopSellingItemList;
public int catShopBuyingItemList;
to bad, allready a filler variable.

flash is nice, actionscript can make a lot stuff on the fly.
also no problem to get php values in flash.
as u speak about it...seams now more easy for me to make the results visible in flash, than coding a gui in autoit with all the stuff.
save all info from autoitbot as php file, upload to web and ready ;)

just tell me if i can help on ur gfx stuff^^

edit:
Quote:
Originally Posted by PW-Prophets View Post
....but do hope you choose not to post it in open forums thanks.
dont see a reason why not.
i got infos from here who helped me, so i think i help others too.
thats the way open source goes...without open source, i cant learn coding easy like now.
coding is fun for me and im shure for a lot other ppl too.
but u cann tell me a reason for not publishing it.