Jump to content

Is there MaNGOS Protocol Documentation?


Guest echeese
 Share

Recommended Posts

I have been doing some research into it myself (from a mostly academic point of view of trying to make a 'server' people could connect to in JAVA), but even most of the source is mysterious about it.

Good starting points in the source I found so far:

1. game -> Server -> Opcodes.cpp / Opcodes.h lists all expected codes send by clients.

2. WorldSocket.cpp, WorldSocket::HandleAuthSession in particular seems to handle the connecting of new clients to mangos.

3. WorldSession seems to handle booting of players and some communication from and to them.

Don't expect much documentation there - a few lines of hints randomly placed is about it for most functions / classes. Some methods are entirely undocumented while other functions are quite well written with pleny of comments throughout, I am guessing the result of an open-source development model.

If you do ever find some real protocol documentation, let me know :D

Link to comment
Share on other sites

In stricted meaning protocol as set of packets with structure is well described by source code:

For example client->server packet:

    /*0x10E*/ { "CMSG_SPLIT_ITEM",                              STATUS_LOGGEDIN, &WorldSession::HandleSplitItemOpcode           },

Look in WorldSession::HandleSplitItemOpcode:

void WorldSession::HandleSplitItemOpcode( WorldPacket & recv_data )
{
   //sLog.outDebug("WORLD: CMSG_SPLIT_ITEM");
   uint8 srcbag, srcslot, dstbag, dstslot;
   uint32 count;

   recv_data >> srcbag >> srcslot >> dstbag >> dstslot >> count;

So recieved packet include 5 fields and have (1+1+1+1+4 = 8 bytes size.

Meaning of fields described by its names and later code that use its.

In same function we see function calles for item operation errors reporting to client:

        _player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL );

    WorldPacket data( SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18) );
   data << uint8(msg);

   if(msg)
   {
       data << uint64(pItem ? pItem->GetGUID() : 0);
       data << uint64(pItem2 ? pItem2->GetGUID() : 0);
       data << uint8(0);                                   // not 0 there...

       if(msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I)
       {
           uint32 level = 0;

           if(pItem)
               if(ItemPrototype const* proto =  pItem->GetProto())
                   level = proto->RequiredLevel;

           data << uint32(level);                          // new 2.4.0
       }
   }
   GetSession()->SendPacket(&data);

We can see that server->client packet SMSG_INVENTORY_CHANGE_FAILURE

have 1 byte field `msg` with error type and additional fields if not ok case

EQUIP_ERR_OK = 0,

and additional fields if not ok case ( EQUIP_ERR_OK = 0,

2 possible affected item guids, then _unknown_ 1 byte field and morefields for EQUIP_ERR_CANT_EQUIP_LEVEL_I case

Link to comment
Share on other sites

The reason I asked is because I want to write some software to make sense of the packets. Basically, output human-readable data about each packet, for example, replace the guids with the actual names, and co-ordinates instead of hex numbers. But it seems that not all the opcodes are documented, and not all the ones that are implemented are implemented entirely/correctly.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use