public static void HandlePacket(UdpClient udp, QPacket p) { ClientInfo client = Global.GetClientByIDrecv(p.m_uiSignature); if (client == null) { return; } if (p.flags.Contains(QPacket.PACKETFLAG.FLAG_ACK)) { return; } WriteLog("Handling packet..."); RMCPacket rmc = new RMCPacket(p); WriteLog("Received packet :\n" + rmc); switch (rmc.proto) { case RMCPacket.PROTOCOL.Authentication: ProcessAuthentication(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.Secure: ProcessSecure(udp, p, rmc, client); break; default: WriteLog("No handler implemented for packet protocol " + rmc.proto); break; } }
private static void ProcessChatService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 0x5: reply = new RMCPacketResponseChatService_Method5(); SendReply(udp, p, rmc, client, reply); break; case 0x9: case 0xA: reply = new RMCPacketResponseEmpty(); SendReply(udp, p, rmc, client, reply); break; case 0xE: reply = new RMCPacketResponseChatService_GetPlayerStatuses(); SendReply(udp, p, rmc, client, reply); break; case 0x10: reply = new RMCPacketResponseChatService_Method10(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessAuthentication(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 2: RMCPacketRequestLoginCustomData h = (RMCPacketRequestLoginCustomData)rmc.header; switch (h.className) { case "UbiAuthenticationLoginCustomData": reply = new RMCPacketResponseLoginCustomData(client.PID); client.sessionKey = ((RMCPacketResponseLoginCustomData)reply).ticket.sessionKey; SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown RMC Packet Authentication Custom Data class " + h.className); break; } break; case 3: reply = new RMCPacketResponseRequestTicket(client.PID); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown RMC Packet Authentication Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessPartyService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponsePartyService_GetInviteeList(); SendReply(udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponsePartyService_GetInviteList(); SendReply(udp, p, rmc, client, reply); break; case 7: case 8: case 9: case 0xB: case 0xC: case 0xD: reply = new RMCPacketResponseEmpty(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessPlayerProfileService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 0xF: reply = new RMCPacketResponsePlayerProfileService_MethodF(); SendReply(udp, p, rmc, client, reply); break; case 0x10: reply = new RMCPacketResponseEmpty(); SendReply(udp, p, rmc, client, reply); break; case 0x11: reply = new RMCPacketResponsePlayerProfileService_Method11(); SendReply(udp, p, rmc, client, reply); break; case 0x12: reply = new RMCPacketResponsePlayerProfileService_LoadCharacterProfiles(); List <GR5_Character> list = DBHelper.GetUserCharacters(client.PID); ((RMCPacketResponsePlayerProfileService_LoadCharacterProfiles)reply).Characters.AddRange(list); ((RMCPacketResponsePlayerProfileService_LoadCharacterProfiles)reply).PersonaID = client.PID; ((RMCPacketResponsePlayerProfileService_LoadCharacterProfiles)reply).Name = client.name; SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessServerInfo(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseServerInfo_Method1(); SendReply(udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseServerInfo_Method2(); SendReply(udp, p, rmc, client, reply); break; case 5: reply = new RMCPacketResponseServerInfo_GetServerTime(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessSecure(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 4: RMCPacketRequestRegisterEx h = (RMCPacketRequestRegisterEx)rmc.header; switch (h.className) { case "UbiAuthenticationLoginCustomData": reply = new RMCPacketResponseRegisterEx(client.PID); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown RMC Packet Secure Custom Data class " + h.className); break; } break; default: WriteLog(1, "Error: Unknown RMC Packet Secure Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessInventoryService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseInventoryService_GetTemplateItems(); SendReply(udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseInventoryService_Method2(); SendReply(udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseInventoryService_GetAllApplyItems(); SendReply(udp, p, rmc, client, reply); break; case 16: reply = new RMCPacketResponseInventoryService_GetAllDefaultLoadoutKits(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void SendReplyPacket(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client, RMCPacketReply reply, bool useCompression) { QPacket np = new QPacket(p.toBuffer()); np.flags = new List <QPacket.PACKETFLAG>() { QPacket.PACKETFLAG.FLAG_NEED_ACK }; np.m_oSourceVPort = p.m_oDestinationVPort; np.m_oDestinationVPort = p.m_oSourceVPort; np.m_uiSignature = client.IDsend; np.uiSeqId++; MemoryStream m = new MemoryStream(); Helper.WriteU8(m, (byte)rmc.proto); Helper.WriteU8(m, 0x1); Helper.WriteU32(m, rmc.callID); Helper.WriteU32(m, rmc.methodID | 0x8000); byte[] buff = reply.ToBuffer(); m.Write(buff, 0, buff.Length); buff = m.ToArray(); m = new MemoryStream(); Helper.WriteU32(m, (uint)buff.Length); m.Write(buff, 0, buff.Length); np.payload = m.ToArray(); np.payloadSize = (ushort)np.payload.Length; WriteLog("send response packet"); Send(udp, np, client); WriteLog("Response Data Content : \n" + reply.ToString()); }
private static void ProcessSkillsService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseSkillsService_GetGameClass(); SendReply(udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseSkillsService_GetSkills(); SendReply(udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseSkillsService_Method4(); SendReply(udp, p, rmc, client, reply); break; case 5: reply = new RMCPacketResponseSkillsService_GetModifiers(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessLeaderboardService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseLeaderboardService_GetLeaderboards(); SendReply(udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseLeaderboardService_Method2(); SendReply(udp, p, rmc, client, reply); break; case 3: reply = new RMCPacketResponseLeaderboardService_Method2(); SendReply(udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseLeaderboardService_Method4(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void SendReply(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client, RMCPacketReply reply, bool useCompression = true, uint error = 0) { WriteLog(2, "Response : " + reply.ToString()); string payload = reply.PayloadToString(); if (payload != "") { WriteLog(5, "Response Data Content : \n" + payload); } SendACK(udp, p, client); SendReplyPacket(udp, p, rmc, client, reply, useCompression, error); }
private static void ProcessAuthentication(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 2: RMCPacketRequestLoginCustomData h = (RMCPacketRequestLoginCustomData)rmc.header; switch (h.className) { case "UbiAuthenticationLoginCustomData": reply = new RMCPacketResponseEmpty(); ClientInfo user = DBHelper.GetUserByName(h.username); if (user != null) { if (user.pass == h.password) { reply = new RMCPacketResponseLoginCustomData(client.PID); client.name = h.username; client.pass = h.password; client.sessionKey = ((RMCPacketResponseLoginCustomData)reply).ticket.sessionKey; SendReply(udp, p, rmc, client, reply); } else { SendReply(udp, p, rmc, client, reply, true, 0x80030065); } } else { SendReply(udp, p, rmc, client, reply, true, 0x80030064); } break; default: WriteLog(1, "Error: Unknown RMC Packet Authentication Custom Data class " + h.className); break; } break; case 3: reply = new RMCPacketResponseRequestTicket(client.PID); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown RMC Packet Authentication Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessMissionService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 4: reply = new RMCPacketResponseMissionService_GetAllMissionTemplate(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void DBGTelemetry(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseDBGTelemetry_DBGAMMClientInfo(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessFriendsService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 5: reply = new RMCPacketResponseFriendsService_Method5(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessAbilityService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseAbilityService_GetPersonaAbilityUpgrades(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessUnlockService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseUnlockService_GetCurrentUserUnlock(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessLoadout(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 3: reply = new RMCPacketResponseLoadout_GetLoadoutPowers(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessProfanityFilterService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseProfanityFilterService_GetAllProfaneWords(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessInventoryService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseInventoryService_GetTemplateItems(); List <GR5_TemplateItem> items = DBHelper.GetTemplateItems(); ((RMCPacketResponseInventoryService_GetTemplateItems)reply).items.AddRange(items); SendReply(udp, p, rmc, client, reply); break; case 2: reply = new RMCPacketResponseInventoryService_Method2(); SendReply(udp, p, rmc, client, reply); break; case 3: reply = new RMCPacketResponseInventoryService_Method3(); SendReply(udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseInventoryService_GetAllApplyItems(); SendReply(udp, p, rmc, client, reply); break; case 6: reply = new RMCPacketResponseInventoryService_Method6(); SendReply(udp, p, rmc, client, reply); break; case 16: reply = new RMCPacketResponseInventoryService_GetAllDefaultLoadoutKits(); List <GR5_LoadoutKit> kits = DBHelper.GetLoadoutKits(client.PID); ((RMCPacketResponseInventoryService_GetAllDefaultLoadoutKits)reply).kits.AddRange(kits); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessOverlordNewsProtocol(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 1: reply = new RMCPacketResponseOverlordNewsProtocol_Method1(); List <GR5_NewsMessage> news = DBHelper.GetNews(client.PID); //((RMCPacketResponseOverlordNewsProtocol_Method1)reply).news.AddRange(news); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessAMMGameClient(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 4: reply = new RMCPacktResponseAMM_RequestAMMSearch(); SendReply(udp, p, rmc, client, reply); break; case 7: reply = new RMCPacktResponseAMM_Method7(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessPlayerProfileService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 18: reply = new RMCPacketResponsePlayerProfileService_LoadCharacterProfiles(); RMCPacketResponsePlayerProfileService_LoadCharacterProfiles.Character c = new RMCPacketResponsePlayerProfileService_LoadCharacterProfiles.Character(); c.PersonaID = client.PID; ((RMCPacketResponsePlayerProfileService_LoadCharacterProfiles)reply).chars.Add(c); ((RMCPacketResponsePlayerProfileService_LoadCharacterProfiles)reply).PersonaID = client.PID; ((RMCPacketResponsePlayerProfileService_LoadCharacterProfiles)reply).PlayerName = client.name; SendReply(udp, p, rmc, client, reply); break; default: WriteLog("Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessOpsProtocolService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 19: reply = new RMCPacketResponseOpsProtocolService_GetAllOperatorVariables(); SendReply(udp, p, rmc, client, reply); break; case 23: reply = new RMCPacketResponseOpsProtocolService_GetAllPriorityBroadcasts(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void ProcessAchievementsService(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client) { RMCPacketReply reply; switch (rmc.methodID) { case 2: reply = new RMCPacketResponseAchievementsService_Method2(); SendReply(udp, p, rmc, client, reply); break; case 4: reply = new RMCPacketResponseAchievementsService_Method4(); SendReply(udp, p, rmc, client, reply); break; case 9: reply = new RMCPacketResponseAchievementsService_Method9(); SendReply(udp, p, rmc, client, reply); break; case 0xC: reply = new RMCPacketResponseEmpty(); SendReply(udp, p, rmc, client, reply); break; case 0xD: reply = new RMCPacketResponseAchievementsService_MethodD(); SendReply(udp, p, rmc, client, reply); break; default: WriteLog(1, "Error: Unknown Method 0x" + rmc.methodID.ToString("X")); break; } }
private static void SendReply(UdpClient udp, QPacket p, RMCPacket rmc, ClientInfo client, RMCPacketReply reply, bool useCompression = true) { SendACK(udp, p, client); SendReplyPacket(udp, p, rmc, client, reply, useCompression); }
public static void HandlePacket(UdpClient udp, QPacket p) { ClientInfo client = Global.GetClientByIDrecv(p.m_uiSignature); if (client == null) { return; } if (p.flags.Contains(QPacket.PACKETFLAG.FLAG_ACK)) { return; } WriteLog(10, "Handling packet..."); RMCPacket rmc = new RMCPacket(p); WriteLog(1, "Received packet : " + rmc.ToString()); string payload = rmc.PayLoadToString(); if (payload != "") { WriteLog(5, payload); } switch (rmc.proto) { case RMCPacket.PROTOCOL.Authentication: ProcessAuthentication(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.Secure: ProcessSecure(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.Telemetry: ProcessTelemetry(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.AMMGameClient: ProcessAMMGameClient(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.PlayerProfileService: ProcessPlayerProfileService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.ArmorService: ProcessArmorService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.InventoryService: ProcessInventoryService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.LootService: ProcessLootService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.WeaponService: ProcessWeaponService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.FriendsService: ProcessFriendsService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.ChatService: ProcessChatService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.MissionService: ProcessMissionService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.PartyService: ProcessPartyService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.StatisticsService: ProcessStatisticsService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.AchievementsService: ProcessAchievementsService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.ProgressionService: ProcessProgressionService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.DBGTelemetry: DBGTelemetry(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.RewardService: ProcessRewardService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.StoreService: ProcessStoreService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.AdvertisementsService: ProcessAdvertisementsService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.SkillsService: ProcessSkillsService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.Loadout: ProcessLoadout(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.UnlockService: ProcessUnlockService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.AvatarService: ProcessAvatarService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.WeaponProficiencyService: ProcessWeaponProficiencyService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.OpsProtocolService: ProcessOpsProtocolService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.ServerInfo: ProcessServerInfo(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.LeaderboardService: ProcessLeaderboardService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.PveArchetypeService: ProcessPveArchetypeService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.InboxMessageService: ProcessInboxMessageService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.ProfanityFilterService: ProcessProfanityFilterService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.AbilityService: ProcessAbilityService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.SurveyService: ProcessSurveyService(udp, p, rmc, client); break; case RMCPacket.PROTOCOL.OverlordNewsProtocol: ProcessOverlordNewsProtocol(udp, p, rmc, client); break; default: WriteLog(1, "Error: No handler implemented for packet protocol " + rmc.proto); break; } }