How to get speech from 0xAD packet

Here you can discuss packets, implementation and design, and software related to the packet sniffing and such. This is not the place to post packages for POL, but rather discuss the packet side of them.

Moderator: POL Developer

Post Reply
mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

How to get speech from 0xAD packet

Post by mr bubbles » Sun Apr 08, 2007 9:00 pm

Can anyone explain where the characters input is in this packet and how to convert it to text i can read?

I just cant get my head around this packet :/ An example would be ideal. Thanks.

User avatar
CWO
POL Expert
Posts: 1142
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Post by CWO » Sun Apr 08, 2007 9:20 pm

Its a pain to get text from this because it all depends on if they have speech.mul or not and if so, how many tokens from speech.mul they're using. If GetInt8(3) != 0xC0 then its at offset 12 as a Unicode string.

if GetInt8(3) == 0xC0 then...
the number of speech.mul triggers is the last 4 BITS of GetInt8(12) and the first 4 bits of GetInt8(13) the last 4 bits of 13 is 1/3 of the first trigger. Each trigger is 1 1/2 bytes.

Not gonna guarantee this code since I tested it only a little bit but it would be something like...

Code: Select all

	var speech := "";
	var speechstart := 12;
	if (packet.GetInt8(3) == 0xC0)
		var triggers := packet.GetInt16(12)/16;
		var bytes := CInt(triggers*1.5 + 2);
		speechstart := CInt(speechstart + bytes);
		var speechlen := packet.GetInt16(1) - 1 - speechstart;
		speech := CStr(packet.GetString(speechstart, speechlen));
	else
		var speechlen := (packet.GetInt16(1) - 13)/2;
		speech := CChrZ(packet.GetUnicodeString(speechstart, speechlen));
	endif
	SendSysMessage(character, speech);
Last edited by CWO on Mon Apr 09, 2007 4:47 am, edited 4 times in total.

mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Post by mr bubbles » Sun Apr 08, 2007 10:29 pm

ah perfect. exactly what i was after. Thanks a lot for that :)

User avatar
CWO
POL Expert
Posts: 1142
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Post by CWO » Sun Apr 08, 2007 10:30 pm

updated it a tiny bit. Nothing thats broken in the last code, just tweaked it a tiny bit and took out my testvar.

Edit: Also just got rid of the sendsysmessage from when I was testing the packet.getstring

Post Reply