public static void HandleMissionServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 3: reply = new RMCPacketResponseMissionService_Method3(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseMissionService_GetAllMissionTemplate(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 7: reply = new RMCPResponseEmpty(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC MissionService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandlePartyServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponsePartyService_GetInviteeList(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponsePartyService_GetInviteList(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 7: case 8: case 9: case 0xB: case 0xC: case 0xD: reply = new RMCPResponseEmpty(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC PartyService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleLootServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseLootService_GetLootStatic(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseLootService_Method4(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 5: reply = new RMCPacketResponseLootService_Method5(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC LootService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleUnlockServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseUnlockService_GetCurrentUserUnlock(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseUnlockService_Method2(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 3: reply = new RMCPacketResponseUnlockService_Method3(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC UnlockService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandlePlayerProfileServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 2: reply = new RMCPResponseEmpty(); break; case 0xF: reply = new RMCPacketResponsePlayerProfileService_GetAllFaceSkinTones(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0x10: reply = new RMCPResponseEmpty(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0x11: reply = new RMCPacketResponsePlayerProfileService_Method11(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0x12: reply = new RMCPacketResponsePlayerProfileService_LoadCharacterProfiles(client); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC PlayerProfileService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void ProcessChatServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 0x5: reply = new RMCPacketResponseChatService_Method5(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0x9: case 0xA: reply = new RMCPResponseEmpty(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0xE: reply = new RMCPacketResponseChatService_GetPlayerStatuses(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0x10: reply = new RMCPacketResponseChatService_Method10(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC ChatService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleStoreServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseStoreService_GetSKUs(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 8: reply = new RMCPacketResponseStoreService_EnterCoupons(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 9: reply = new RMCPResponseEmpty(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0xB: reply = new RMCPacketResponseStoreService_GetShoppingDetails(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC StoreService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleServerInfoRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseServerInfo_Method1(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseServerInfo_Method2(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 5: reply = new RMCPacketResponseServerInfo_GetServerTime(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC ServerInfoService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleSecureServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 4: RMCPacketRequestRegisterEx h = (RMCPacketRequestRegisterEx)rmc.request; switch (h.className) { case "UbiAuthenticationLoginCustomData": reply = new RMCPacketResponseRegisterEx(client.PID); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC Secure] Error: Unknown Custom Data class " + h.className); break; } break; default: Log.WriteLine(1, "[RMC Secure] Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleAuthenticationServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 2: RMCPacketRequestLoginCustomData h = (RMCPacketRequestLoginCustomData)rmc.request; switch (h.className) { case "UbiAuthenticationLoginCustomData": reply = new RMCPResponseEmpty(); ClientInfo user = DBHelper.GetUserByName(h.username); if (user != null) { if (user.pass == h.password) { reply = new RMCPacketResponseLoginCustomData(client.PID, client.sPID, client.sPort); client.name = h.username; client.pass = h.password; client.sessionKey = ((RMCPacketResponseLoginCustomData)reply).ticket.sessionKey; RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); } else { RMC.SendResponseWithACK(client.udp, p, rmc, client, reply, true, 0x80030065); } } else { RMC.SendResponseWithACK(client.udp, p, rmc, client, reply, true, 0x80030064); } break; default: Log.WriteLine(1, "[RMC Authentication] Error: Unknown Custom Data class " + h.className); break; } break; case 3: reply = new RMCPacketResponseRequestTicket(client.PID, client.sPID); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC Authentication] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleOverlordNewsProtocolRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseOverlordNewsProtocol_Method1(client); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC OverlordNewsProtocolService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleAMMDedicatedServerServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 6: reply = new RMCPacktResponseAMMDS_Method6(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC AMMDedicatedServerService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleDBGTelemetryServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseDBGTelemetry_DBGAMMClientInfo(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC DBGTelemetryService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleProfanityFilterServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseProfanityFilterService_GetAllProfaneWords(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC ProfanityFilterService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void SendNotification(ClientInfo client, uint source, uint type, uint subType, uint param1, uint param2, uint param3, string paramStr) { WriteLog(1, "Send Notification: [" + source.ToString("X8") + " " + type.ToString("X8") + " " + subType.ToString("X8") + " " + param1.ToString("X8") + " " + param2.ToString("X8") + " " + param3.ToString("X8") + " \"" + paramStr + "\"]"); MemoryStream m = new MemoryStream(); Helper.WriteU32(m, source); Helper.WriteU32(m, type * 1000 + subType); Helper.WriteU32(m, param1); Helper.WriteU32(m, param2); Helper.WriteU16(m, (ushort)(paramStr.Length + 1)); foreach (char c in paramStr) { m.WriteByte((byte)c); } m.WriteByte(0); Helper.WriteU32(m, param3); byte[] payload = m.ToArray(); QPacket q = new QPacket(); q.m_oSourceVPort = new QPacket.VPort(0x31); q.m_oDestinationVPort = new QPacket.VPort(0x3f); q.type = QPacket.PACKETTYPE.DATA; q.flags = new List <QPacket.PACKETFLAG>(); q.payload = new byte[0]; q.uiSeqId = (ushort)(++client.seqCounter); q.m_bySessionID = client.sessionID; RMCP rmc = new RMCP(); rmc.proto = RMCP.PROTOCOL.GlobalNotificationEventProtocol; rmc.methodID = 1; rmc.callID = ++client.callCounterRMC; RMCPCustom reply = new RMCPCustom(); reply.buffer = payload; RMC.SendRequestPacket(client.udp, q, rmc, client, reply, true, 0); }
public static void HandleInventoryServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseInventoryService_GetTemplateItems(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseInventoryService_Method2(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 3: reply = new RMCPacketResponseInventoryService_Method3(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseInventoryService_GetAllApplyItems(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 6: reply = new RMCPacketResponseInventoryService_GetUserInventoryByBagType(p.payload[21], p.payload[17]); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 16: reply = new RMCPacketResponseInventoryService_GetAllDefaultLoadoutKits(client); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC InventoryService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleSkillsServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseSkillsService_GetGameClass(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseSkillsService_GetSkills(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 3: reply = new RMCPacketResponseSkillsService_Method3(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseSkillsService_GetModifierLists(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 5: reply = new RMCPacketResponseSkillsService_GetModifiers(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 7: reply = new RMCPacketResponseSkillsService_Method7(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC SkillService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleAbilityServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseAbilityService_GetPersonaAbilityUpgrades(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseAbilityService_Method2(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC AbilityService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleOpsProtocolServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 19: reply = new RMCPacketResponseOpsProtocolService_GetAllOperatorVariables(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 23: reply = new RMCPacketResponseOpsProtocolService_GetAllPriorityBroadcasts(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC OpsProtocolService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public static void HandleAchievementsServiceRequest(QPacket p, RMCP rmc, ClientInfo client) { RMCPResponse reply; switch (rmc.methodID) { case 2: reply = new RMCPacketResponseAchievementsService_Method2(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseAchievementsService_Method4(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 9: reply = new RMCPacketResponseAchievementsService_Method9(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0xC: reply = new RMCPResponseEmpty(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; case 0xD: reply = new RMCPacketResponseAchievementsService_MethodD(); RMC.SendResponseWithACK(client.udp, p, rmc, client, reply); break; default: Log.WriteLine(1, "[RMC AchievementsService] Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
public void Execute() { RMC.SendNotification(client, source, type, subType, param1, param2, param3, paramStr); }
public static void ProcessPacket(string source, byte[] data, IPEndPoint ep, UdpClient listener, uint serverPID, ushort listenPort, bool removeConnectPayload = false) { StringBuilder sb = new StringBuilder(); foreach (byte b in data) { sb.Append(b.ToString("X2") + " "); } while (true) { QPacket p = new QPacket(data); MemoryStream m = new MemoryStream(data); byte[] buff = new byte[(int)p.realSize]; m.Seek(0, 0); m.Read(buff, 0, buff.Length); Log.LogPacket(false, buff); Log.WriteLine(5, "[" + source + "] received : " + p.ToStringShort()); Log.WriteLine(10, "[" + source + "] received : " + sb.ToString()); Log.WriteLine(10, "[" + source + "] received : " + p.ToStringDetailed()); QPacket reply = null; ClientInfo client = null; if (p.type != QPacket.PACKETTYPE.SYN && p.type != QPacket.PACKETTYPE.NATPING) { client = Global.GetClientByIDrecv(p.m_uiSignature); } switch (p.type) { case QPacket.PACKETTYPE.SYN: reply = QPacketHandler.ProcessSYN(p, ep, out client); break; case QPacket.PACKETTYPE.CONNECT: if (client != null && !p.flags.Contains(QPacket.PACKETFLAG.FLAG_ACK)) { client.sPID = serverPID; client.sPort = listenPort; if (removeConnectPayload) { p.payload = new byte[0]; p.payloadSize = 0; } reply = QPacketHandler.ProcessCONNECT(client, p); } break; case QPacket.PACKETTYPE.DATA: if (p.m_oSourceVPort.type == QPacket.STREAMTYPE.OldRVSec) { RMC.HandlePacket(listener, p); } if (p.m_oSourceVPort.type == QPacket.STREAMTYPE.DO) { DO.HandlePacket(listener, p); } break; case QPacket.PACKETTYPE.DISCONNECT: if (client != null) { reply = QPacketHandler.ProcessDISCONNECT(client, p); } break; case QPacket.PACKETTYPE.PING: if (client != null) { reply = QPacketHandler.ProcessPING(client, p); } break; case QPacket.PACKETTYPE.NATPING: ulong time = BitConverter.ToUInt64(p.payload, 5); if (timeToIgnore.Contains(time)) { timeToIgnore.Remove(time); } else { reply = p; m = new MemoryStream(); byte b = (byte)(reply.payload[0] == 1 ? 0 : 1); m.WriteByte(b); Helper.WriteU32(m, 166202); //RVCID Helper.WriteU64(m, time); reply.payload = m.ToArray(); Send(source, reply, ep, listener); m = new MemoryStream(); b = (byte)(b == 1 ? 0 : 1); m.WriteByte(b); Helper.WriteU32(m, 166202); //RVCID time = Helper.MakeTimestamp(); timeToIgnore.Add(time); Helper.WriteU64(m, Helper.MakeTimestamp()); reply.payload = m.ToArray(); } break; } if (reply != null) { Send(source, reply, ep, listener); } if (p.realSize != data.Length) { m = new MemoryStream(data); int left = (int)(data.Length - p.realSize); byte[] newData = new byte[left]; m.Seek(p.realSize, 0); m.Read(newData, 0, left); data = newData; } else { break; } } }