Chat Packet Information

Post Reply
User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Chat Packet Information

Post by atom0s » Wed Dec 17, 2014 4:40 am

More debugging information about another packet, this time the incoming chat packet (0x17) from the server.

Here is the handler for the packet:

Code: Select all

char __cdecl sub_100D6790(int a1, int a2, int a3)
{
  unsigned int v3; // ebx@1
  int v4; // ebp@1
  __int16 v5; // ax@1
  unsigned int v6; // ecx@1
  int v7; // eax@3
  char v8; // cl@3
  char *v9; // eax@7
  int v10; // eax@12
  int v11; // ecx@14
  char result; // al@16
  int v13; // eax@19
  int v14; // [sp-1Ch] [bp-100h]@24
  char v15; // [sp-18h] [bp-FCh]@24
  int v16; // [sp-14h] [bp-F8h]@24
  int v17; // [sp-10h] [bp-F4h]@24
  int v18; // [sp-Ch] [bp-F0h]@24
  char *v19; // [sp-8h] [bp-ECh]@24
  int *v20; // [sp-4h] [bp-E8h]@24
  int v21; // [sp+8h] [bp-DCh]@3
  int v22; // [sp+Ch] [bp-D8h]@3
  int v23; // [sp+10h] [bp-D4h]@4
  char Source; // [sp+18h] [bp-CCh]@7
  char v25; // [sp+27h] [bp-BDh]@7
  char Args; // [sp+28h] [bp-BCh]@1
  char v27[4]; // [sp+38h] [bp-ACh]@1
  char Dest; // [sp+3Ch] [bp-A8h]@1
  _BYTE v29[152]; // [sp+4Ch] [bp-98h]@6

  v5 = sub_100D6720();
  v4 = a3;
  Args = 0;
  HIWORD(v6) = 0;
  v27[0] = v5 != 0;
  LOWORD(v6) = *(_WORD *)a3;
  Dest = 0;
  v3 = sub_100D10D0(26, v6 >> 9) + 1;
  if ( (signed int)v3 > 150 )
    v3 = 150;
  v8 = *(_BYTE *)(a3 + 5);
  v7 = a3 + 24;
  v22 = 0;
  v21 = 0;
  if ( v8 & 8 )
  {
    v7 = sub_100EFE10((char *)(a3 + 24), (int)&v22, (int)&v21, (int)&v23);
    v3 += a3 + 24 - v7;
  }
  if ( v3 )
    memcpy(v29, (const void *)v7, v3);
  v29[v3] = 0;
  v9 = strncpy(&Source, (const char *)(v4 + 8), 0xFu);
  LOBYTE(v9) = *(_BYTE *)(v4 + 5);
  v25 = 0;
  if ( (_BYTE)v9 & 1 && (v9 = (char *)sprintf(&Args, "[GM]"), *(_BYTE *)(v4 + 5) & 1)
    || *(_BYTE *)(v4 + 4) == 0x19
    || (v9 = (char *)sub_100D3D10(&Source), v9 != (char *)1) )
  {
    LOBYTE(v9) = *(_BYTE *)(v4 + 4);
    switch ( *(_BYTE *)(v4 + 4) )
    {
      case 0:
      case 1:
        v10 = sub_100CD510((int)v9, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s%s : %s\n", (unsigned int)&Args);
        goto LABEL_34;
      case 8:
        v10 = sub_100CD510((int)v9, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s%s %s\n", (unsigned int)&Args);
        goto LABEL_34;
      case 0x1A:
        sub_101A65A0(*(_WORD *)(v4 + 6), 0);
        v11 = v21;
        LOBYTE(v11) = *(_BYTE *)(v4 + 4);
        v10 = sub_100CD510(v11, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s%s[%s]: %s\n", (unsigned int)&Args);
        goto LABEL_34;
      case 3:
        if ( !sub_100CD510((int)v9, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s%s>> %s\n", (unsigned int)&Args) )
          goto LABEL_36;
        sub_100D6C50(&Source);
        return 1;
      case 4:
        if ( !sub_100CD510((int)v9, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "(%s%s) %s\n", (unsigned int)&Args) )
          goto LABEL_36;
        sub_100DB970(0);
        return 1;
      case 5:
      case 0x1B:
      case 0x1E:
        sub_100D6740(&Dest, (char)v9, v27[0]);
        v13 = v21;
        LOBYTE(v13) = *(_BYTE *)(v4 + 4);
        v10 = sub_100CD510(v13, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s<%s%s> %s\n", (unsigned int)&Dest);
        goto LABEL_34;
      case 0x21:
        v10 = sub_100CD510((int)v9, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "{%s%s} %s\n", (unsigned int)&Args);
        goto LABEL_34;
      case 0x18:
        v10 = sub_100CD510(0, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s%s : %s\n", (unsigned int)&Args);
        goto LABEL_34;
      case 0x19:
        if ( Source )
        {
          v10 = sub_100CD510(0, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s%s : %s\n", (unsigned int)&Args);
        }
        else
        {
          v20 = (int *)v29;
          v19 = "%s\n";
          v18 = (int)&v23;
          v17 = v21;
          v16 = v22;
          v15 = *(_BYTE *)(v4 + 5);
          v14 = 0;
LABEL_33:
          v10 = sub_100CD510(v14, v15, v16, v17, v18, v19, (char)v20);
        }
LABEL_34:
        if ( v10 )
          goto LABEL_35;
        goto LABEL_36;
      case 6:
      case 7:
        v20 = (int *)v29;
        v19 = "----== SystemMessage ==----\n%s\n";
        goto LABEL_30;
      case 0xC:
        sub_1009BAF0(&Source, (int)v29);
        return 1;
      case 0x15:
        if ( !sub_100CD510((int)v9, *(_BYTE *)(v4 + 5), v22, v21, (int)&v23, "%s\n", (unsigned int)v29) )
          goto LABEL_36;
        sub_100D6C50(&Source);
        return 1;
      case 0xD:
      case 0xE:
      case 0x10:
      case 0x13:
      case 0x16:
      case 0x1C:
      case 0x1F:
        v20 = (int *)v29;
        v19 = "%s\n";
LABEL_30:
        v18 = (int)&v23;
        v17 = v21;
        v16 = v22;
        v15 = *(_BYTE *)(v4 + 5);
        goto LABEL_32;
      case 0xF:
      case 0x11:
      case 0x12:
      case 0x14:
      case 0x17:
      case 0x1D:
      case 0x20:
        v20 = (int *)v29;
        v19 = "%s\n";
        v18 = (int)&v23;
        v17 = v21;
        v16 = v22;
        v15 = *(_BYTE *)(v4 + 5);
LABEL_32:
        v14 = (int)v9;
        goto LABEL_33;
      case 9:
      case 0xA:
      case 0xB:
LABEL_35:
        result = 1;
        break;
      default:
        goto LABEL_36;
    }
  }
  else
  {
LABEL_36:
    result = 0;
  }
  return result;
}
Each of the cases is a chat mode. Here are what they do:

Code: Select all

case 0:     // say
case 1:     // shout
case 8:     // emote
case 0x1A:  // yell
case 3:     // tell
case 4:     // party
case 5:     // linkshell
case 0x1B:  // linkshell (possibly new ls1)
case 0x1E:  // linkshell (possibly new ls2)
case 0x21:  // Unknown Message: {[GM] Atomos} This is a test message. (color was yellow/gold)
case 0x18:  // Unknown (Looks similar to say.)
case 0x19:  // Unknown (Looks similar to say.)
case 6:     // System Message 
case 7:     // System Message
case 0xC:   // GM Tell
case 0x15:  // Unknown (Strips name, shows just the message.) (color was yellow/gold)
case 0xD:   // Unknown (Strips name, shows just the message.) (color was same as say)
case 0xE:   // Unknown (Strips name, shows just the message.) (color was same as shout)
case 0x10:  // Unknown (Strips name, shows just the message.) (color was same as linkshell)
case 0x13:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x16:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x1C:  // Unknown (Strips name, shows just the message.) (color was green)
case 0x1F:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0xF:   // Unknown (Strips name, shows just the message.) (color was same as party)
case 0x11:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x12:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x14:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x17:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x1D:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 0x20:  // Unknown (Strips name, shows just the message.) (color was yellow)
case 9:     // Do nothing.. packet is swallowed.
case 0xA:   // Do nothing.. packet is swallowed.
case 0xB:   // Do nothing.. packet is swallowed.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Chat Packet Information

Post by kjLotus » Wed Dec 17, 2014 3:50 pm

ls1 is 5 and ls2 is 1B

Post Reply