I'm not 100% sure, but I think this is what you're looking for:
common/EQPacket.cpp:
Code:
390 void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
391 {
392 if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
393 int Key=DecodeKey;
394 unsigned char *test=(unsigned char *)malloc(size);
395 buffer+=2;
396 size-=2;
397
398 int i;
399 for (i = 0 ; i+4 <= size ; i+=4)
400 {
401 int pt = (*(int*)&buffer[i])^(Key);
402 Key = (*(int*)&buffer[i]);
403 *(int*)&test[i]=pt;
404 }
405 unsigned char KC=Key&0xFF;
406 for ( ; i < size ; i++)
407 {
408 test[i]=buffer[i]^KC;
409 }
410 memcpy(buffer,test,size);
411 free(test);
412 }
413 }