public DupObj(DupObjClass cls, uint id, uint masterID, DupObjPayload pl) { Class = cls; ID = id; Master = new DupObj(DupObjClass.Station, masterID); Payload = pl; }
public static byte[] Create(ushort callID, DupObj obj) { Log.WriteLine(1, "[DO] Creating DO_FetchRequestMessage"); MemoryStream m = new MemoryStream(); m.WriteByte(0xD); Helper.WriteU16(m, callID); Helper.WriteU32(m, obj); Helper.WriteU32(m, obj.Master); return(m.ToArray()); }
public static byte[] Create(DupObj obj, byte version) { Log.WriteLine(1, "[DO] Creating DO_CreateDuplicaMessage"); MemoryStream m = new MemoryStream(); m.WriteByte(0x12); Helper.WriteU32(m, obj); Helper.WriteU32(m, obj.Master); Helper.WriteU8(m, version); byte[] payload = obj.getPayload(); m.Write(payload, 0, payload.Length); return(m.ToArray()); }
public static byte[] HandleMessage(ClientInfo client, byte[] data) { Log.WriteLine(1, "[DO] Handling DO_CreateDuplicaMessage..."); MemoryStream m = new MemoryStream(data); m.Seek(1, 0); DupObj obj = new DupObj(Helper.ReadU32(m)); obj.Master = new DupObj(Helper.ReadU32(m)); DO_Session.DupObjs.Add(obj); Log.WriteLine(1, "[DO] Adding DupObj " + obj.getDesc()); return(null); }
public static byte[] HandleMessage(ClientInfo client, byte[] data) { Log.WriteLine(1, "[DO] Handling DO_DeleteMessage"); uint handle = BitConverter.ToUInt32(data, 1); DupObj obj = DO_Session.FindObj(handle); if (obj == null) { Log.WriteLine(1, "[DO] DO_DeleteMessage sent for an unknown dupobj"); return(new byte[0]); } DO_Session.DupObjs.Remove(obj); return(null); }
public static byte[] Create(ushort callID, DupObj obj, byte version) { Log.WriteLine(1, "[DO] Creating DO_CreateAndPromoteDuplicaMessage"); MemoryStream m = new MemoryStream(); m.WriteByte(0x13); Helper.WriteU16(m, callID); Helper.WriteU32(m, obj); Helper.WriteU32(m, obj.Master); m.WriteByte(version); Helper.WriteU32(m, 0); byte[] payload = obj.getPayload(); m.Write(payload, 0, payload.Length); return(m.ToArray()); }
public static byte[] Create(byte successByte, DupObj clientStation) { Log.WriteLine(1, "[DO] Creating DO_JoinResponseMessage"); MemoryStream m = new MemoryStream(); m.WriteByte(1); m.WriteByte(successByte); if (successByte == 1) { Helper.WriteU32(m, clientStation); Helper.WriteU32(m, clientStation.Master); Helper.WriteU16(m, 0); } else { Log.WriteLine(1, "[DO] Creating negative DO_JoinResponseMessage failed, TODO!"); } return(m.ToArray()); }
public static byte[] HandleMessage(ClientInfo client, byte[] data, byte sessionID) { Log.WriteLine(1, "[DO] Handling DO_JoinRequestMessage..."); SendConnectionRequest(client, sessionID); List <byte[]> msgs = new List <byte[]>(); InitSession(client); DupObj clientStation = new DupObj(DupObjClass.Station, client.stationID, 1); Payload_Station ps = new Payload_Station(); ps.connectionInfo.m_strStationURL1 = "prudp:/address=255.0.0.0;port=4"; ps.stationState = STATIONSTATE.JoiningSession; clientStation.Payload = ps; DO_Session.DupObjs.Add(clientStation); msgs.Add(DO_JoinResponseMessage.Create(1, new DupObj(DupObjClass.Station, client.stationID, 1))); msgs.Add(DO_CreateAndPromoteDuplicaMessage.Create(client.callCounterDO_RMC++, clientStation, 2)); msgs.Add(DO_MigrationMessage.Create(client.callCounterDO_RMC++, new DupObj(DupObjClass.Station, 1), new DupObj(DupObjClass.Station, client.stationID), new DupObj(DupObjClass.Station, client.stationID), 3, new List <uint>())); clientStation.Master.ID = client.stationID; return(DO_BundleMessage.Create(client, msgs)); }
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 DupObj(DupObjClass cls, uint id, uint masterID) { Class = cls; ID = id; Master = new DupObj(DupObjClass.Station, masterID); }
public DupObj(uint u, uint m) { Class = (DupObjClass)(u >> 22); ID = u & 0x3FFFFF; Master = new DupObj(m); }