示例#1
0
 public static byte[] HandleMessage(ClientInfo client, byte[] data)
 {
     Log.WriteLine(1, "[DO] Handling DO_GetParticipantsResponseMessage... TODO!");
     return(new byte[0]);
 }
示例#2
0
        public static byte[] HandleMessage(ClientInfo client, byte[] data)
        {
            Log.WriteLine(1, "[DO] Handling DO_MigrationMessage");
            MemoryStream m = new MemoryStream(data);

            m.Seek(1, 0);
            ushort callID = Helper.ReadU16(m);
            DupObj from   = new DupObj(Helper.ReadU32(m));
            DupObj obj    = new DupObj(Helper.ReadU32(m));

            obj.Master = from;
            DupObj to   = new DupObj(Helper.ReadU32(m));
            DupObj fobj = DO_Session.FindObj(obj);

            if (fobj == null)
            {
                Log.WriteLine(1, "[DO] DupObj " + obj.getDesc() + " not found!", Color.Red);
            }
            else if (fobj.Master == (uint)to)
            {
                Log.WriteLine(1, "[DO] Master of DupObj " + fobj.getDesc() + " alread set, ignored!", Color.Orange);
            }
            else
            {
                fobj.Master = to;
            }
            List <byte[]> msgs = new List <byte[]>();

            msgs.Add(DO_Outcome.Create(callID, 0x60001));
            if (fobj != null && fobj.Class == DupObjClass.SES_cl_Player_NetZ && fobj.ID == 257 && !client.matchStartSent)
            {
                /*
                 * msgs.Add(DO_RMCRequestMessage.Create(client.callCounterDO_RMC++,
                 *  0x1006,
                 *  new DupObj(DupObjClass.Station, 1),
                 *  new DupObj(DupObjClass.SES_cl_Player_NetZ, 257),
                 *  (ushort)DO_RMCRequestMessage.DOC_METHOD.SetPlayerState,
                 *  new byte[] { 0x34, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0xC0, 0x05, 0x00, 0x10, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
                 *  ));
                 * msgs.Add(DO_RMCRequestMessage.Create(client.callCounterDO_RMC++,
                 *  0x1006,
                 *  new DupObj(DupObjClass.Station, 1),
                 *  new DupObj(DupObjClass.SES_cl_Player_NetZ, 257),
                 *  (ushort)DO_RMCRequestMessage.DOC_METHOD.SetPlayerRDVInfo,
                 *  new byte[] { 0x01, 0x00, 0x00, 0x00 }
                 *  ));
                 */
                SessionInfosParameter p = new SessionInfosParameter();
                p.sParams.byte25 = 1;
                m = new MemoryStream();
                m.WriteByte(2); //update
                Helper.WriteU32(m, new DupObj(DupObjClass.SES_cl_SessionInfos, 2));
                m.WriteByte(2); //part
                p.toBuffer(m);
                msgs.Add(m.ToArray());

                p.sParams.byte25 = 2;
                m = new MemoryStream();
                m.WriteByte(2); //update
                Helper.WriteU32(m, new DupObj(DupObjClass.SES_cl_SessionInfos, 2));
                m.WriteByte(2); //part
                p.toBuffer(m);
                msgs.Add(m.ToArray());

                msgs.Add(DO_RMCRequestMessage.Create(client.callCounterDO_RMC++,
                                                     0x806,
                                                     new DupObj(DupObjClass.Station, 1),
                                                     new DupObj(DupObjClass.SES_cl_SessionInfos, 2),
                                                     (ushort)DO_RMCRequestMessage.DOC_METHOD.OnStartMatch,
                                                     new byte[] { }
                                                     ));
                client.matchStartSent = true;
            }
            return(DO_BundleMessage.Create(client, msgs));
        }
 public RMCPacketResponsePlayerProfileService_LoadCharacterProfiles(ClientInfo client)
 {
     persona    = DBHelper.GetPersona(client);
     characters = DBHelper.GetCharacters(client.PID);
 }
        public static byte[] HandleMessage(ClientInfo client, QPacket p, byte[] data)
        {
            Log.WriteLine(1, "[DO] Handling DO_RMCRequestMessage...");
            MemoryStream m = new MemoryStream(data);

            m.Seek(1, 0);
            ushort     callID       = Helper.ReadU16(m);
            uint       flags        = Helper.ReadU32(m);
            uint       station      = Helper.ReadU32(m);
            uint       targetObject = Helper.ReadU32(m);
            DOC_METHOD method       = (DOC_METHOD)Helper.ReadU16(m);

            Log.WriteLine(2, "[DO] RMC Call ID      : 0x" + callID.ToString("X4"));
            Log.WriteLine(2, "[DO] RMC Call Flags   : 0x" + flags.ToString("X8"));
            Log.WriteLine(2, "[DO] RMC Call Station : 0x" + station.ToString("X8"));
            Log.WriteLine(2, "[DO] RMC Call DupObj  : 0x" + targetObject.ToString("X8") + " " + new DupObj(targetObject).getDesc());
            byte[]        buff;
            MemoryStream  m2;
            List <byte[]> msgs;

            switch (method)
            {
            case DOC_METHOD.SyncRequest:
                Log.WriteLine(1, "[DO] Handling SyncRequest...");
                ulong time = Helper.ReadU64(m);
                buff = Create(client.callCounterDO_RMC++, 0x83C, new DupObj(DupObjClass.Station, 1), new DupObj(DupObjClass.SessionClock, 1), 6, new Payload_SyncResponse(time).toBuffer());
                m2   = new MemoryStream();
                Helper.WriteU32(m2, (uint)buff.Length);
                m2.Write(buff, 0, buff.Length);
                m2.WriteByte((byte)QPacket.MakeChecksum(m2.ToArray(), 0));
                p.payload       = m2.ToArray();
                p.payloadSize   = (ushort)p.payload.Length;
                p.m_uiSignature = client.IDsend;
                DO.Send(p, client);
                return(null);

            case DOC_METHOD.RequestIDRangeFromMaster:
                Log.WriteLine(1, "[DO] Handling RequestIDRangeFromMaster...");
                return(DO_RMCResponseMessage.Create(callID, 0x60001, new byte[] { 0x01, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 }));

            case DOC_METHOD.IncreasePlayerNb:
                Log.WriteLine(1, "[DO] Handling IncreasePlayerNb...");
                msgs = new List <byte[]>();
                msgs.Add(new byte[] { 0x02, 0x02, 0x00, 0x40, 0x05, 0x01, 0x01, 0x00, 0x00, 0x00 });
                msgs.Add(DO_RMCResponseMessage.Create(callID, 0x60001, new byte[] { 0x00 }));
                return(DO_BundleMessage.Create(client, msgs));

            case DOC_METHOD.AskForSettingPlayerParameters:
                Log.WriteLine(1, "[DO] Handling AskForSettingPlayerParameters...");
                int len = (int)(data.Length - m.Position);
                buff = new byte[len];
                m.Read(buff, 0, len);
                client.settings = buff;
                msgs            = new List <byte[]>();
                msgs.Add(DO_RMCRequestMessage.Create(client.callCounterDO_RMC++,
                                                     0x1006,
                                                     new DupObj(DupObjClass.Station, 1),
                                                     new DupObj(DupObjClass.SES_cl_Player_NetZ, 257),
                                                     (ushort)DO_RMCRequestMessage.DOC_METHOD.SetPlayerParameters,
                                                     client.settings
                                                     ));
                msgs.Add(DO_RMCResponseMessage.Create(callID, 0x60001, new byte[] { 0x00 }));
                return(DO_BundleMessage.Create(client, msgs));

            case DOC_METHOD.AskForSettingPlayerState:
                Log.WriteLine(1, "[DO] Handling AskForSettingPlayerState...");
                msgs = new List <byte[]>();
                msgs.Add(DO_RMCRequestMessage.Create(client.callCounterDO_RMC++,
                                                     0x1006,
                                                     new DupObj(DupObjClass.Station, 1),
                                                     new DupObj(DupObjClass.SES_cl_Player_NetZ, 257),
                                                     (ushort)DO_RMCRequestMessage.DOC_METHOD.SetPlayerState,
                                                     BitConverter.GetBytes(Helper.ReadU32(m))
                                                     ));
                msgs.Add(DO_RMCResponseMessage.Create(callID, 0x60001, new byte[] { 0x00 }));
                return(DO_BundleMessage.Create(client, msgs));

            default:
                Log.WriteLine(1, "[DO] Error: Unhandled DOC method: " + method + "!");
                return(null);
            }
        }
示例#5
0
 public RMCPacketResponseInventoryService_GetAllDefaultLoadoutKits(ClientInfo client)
 {
     kits = DBHelper.GetLoadoutKits(client.PID);
 }
示例#6
0
 private static void InitSession(ClientInfo client)
 {
     DO_Session.ResetObjects();
 }