Client built-in GM Chat. Implementation.

Here you can post threads specific to the current release of the core (099)

Moderator: POL Developer

Post Reply
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Client built-in GM Chat. Implementation.

Post by RusseL »

Hello everybody.
Today we are going to talk about built-in-GM-chat (yes, there is such client-side feature).

I think, this feature must be implemented in core, it makes pol more user-friendly.

There are 2 packet modifications.

This packet is used to enable Client-Side GMChat (server -> client):

Code: Select all

 var strr := "Hello, mortal (Chat Opened)";
 var newpacket := CreatePacket( 0xae, -1 );
 newpacket.setInt16(1, 48+1+len(strr)*2);
 newpacket.SetInt32(3, targ.serial);
 newpacket.SetInt16(7, 0xFFFF); // As far as i know graphic must be FFFF here
 newpacket.SetInt8(9, 0x0F);   // This byte here is a command to start Chat.
 newpacket.SetInt16(10, 0x35);
 newpacket.SetInt16(12, 3);
 newpacket.SetString(14, "rus", 1);
 newpacket.SetString(18, CStr(who.name), 0);
 newpacket.SetUnicodeString(48, text_to_uc(strr), 0);
 newpacket.SendPacket( targ );
Start GM Chat
Start GM Chat
After the GMChat was enabled for client, client can send a message to GM using '[' button.
Answer
Answer
As an answer it would be sent 0xAD packet (client -> server) (for unicode users)

Code: Select all

- 000103259+1357 --- client Unicode Client Talk
0000: ad 00 26 0f 00 34 00 03 52 55 53 00 00 48 00 45 : ..&..4..RUS..H.E
0010: 00 4c 00 4c 00 4f 00 20 00 47 00 4d 00 21 00 21 : .L.L.O. .G.M.!.!
0020: 00 21 00 21 00 00 -- -- -- -- -- -- -- -- -- -- : .!.!..
uuconvert: HELLO GM!!!!
Where:

Code: Select all

ad - BYTE[1] cmd
00 26 - BYTE[2] length
0f - BYTE[1] Type !!!!!!!!!!!!!!!!!!!!!
00 34 - BYTE[2] Color 
00 03 - BYTE[2] Font 
52 55 53 00 - BYTE[4] Language (Null Terminated)
........
This packet is used to Disable Client-Side GMChat (server -> client)

Code: Select all

 var strr := "Chat Closed.";
 var newpacket := CreatePacket( 0xae, -1 );
 newpacket.setInt16(1, 48+1+len(strr)*2);
 newpacket.SetInt32(3, targ.serial);
 newpacket.SetInt16(7, 0xFFFF); // As far as i know graphic must be FFFF here
 newpacket.SetInt8(9, 0x10);  // This byte here is a command to Stop GM Chat
 newpacket.SetInt16(10, 0x35);
 newpacket.SetInt16(12, 3);
 newpacket.SetString(14, "rus", 1);
 newpacket.SetString(18, CStr(who.name), 0);
 newpacket.SetUnicodeString(48, text_to_uc(strr), 0);
 newpacket.SendPacket( targ );
Stop GM Chat
Stop GM Chat

So, the main problem here:
when the chat was started we should store objref (serial) of GM that opened a chat, and when client sends 0xAD packet with type 0x0F we must filter it and resend this packet only to GM that opened this chat (at the moment it works like standart speech, and everyone in 'line of sight' becomes this message)
It must also work in both directions: player -> gm and gm -> player

Patently it should be controlled when GM or Player is logged off etc...


Good luck. 8)

ps. I hope pol-devs would not forget about Unicode Users this time :)
Post Reply