namespace Supercell.Laser.Logic.Message { using Supercell.Laser.Logic.Message; using Supercell.Laser.Logic.Message.Account; using Supercell.Laser.Logic.Message.Club; using Supercell.Laser.Logic.Message.Battle; using Supercell.Laser.Logic.Message.Friends; using Supercell.Laser.Logic.Message.Home; using Supercell.Laser.Logic.Message.Ranking; using Supercell.Laser.Logic.Message.Security; using Supercell.Laser.Logic.Message.Team; using Supercell.Laser.Logic.Message.Team.Stream; using Supercell.Laser.Logic.Message.Udp; using Supercell.Laser.Logic.Message.Account.Auth; using Supercell.Laser.Logic.Message.Latency; using Supercell.Laser.Logic.Message.Api; using Supercell.Laser.Logic.Message.Ranked; public class MessageFactory { public static MessageFactory Instance; static MessageFactory() { Instance = new MessageFactory(); } private Dictionary Definitions; public MessageFactory() { Definitions = new Dictionary() { {10099, typeof(ClientCryptoErrorMessage)}, {10100, typeof(ClientHelloMessage)}, {10101, typeof(AuthenticationMessage)}, {10107, typeof(ClientCapabilitiesMessage)}, {10108, typeof(KeepAliveMessage)}, {10110, typeof(AnalyticEventMessage)}, {10119, typeof(ReportAllianceStreamMessage)}, {10177, typeof(ClientInfoMessage)}, {10212, typeof(ChangeAvatarNameMessage)}, {10501, typeof(AcceptFriendMessage)}, {10502, typeof(AddFriendMessage)}, {10504, typeof(AskForFriendListMessage)}, {10506, typeof(RemoveFriendMessage)}, {10576, typeof(SetBlockFriendRequestsMessage)}, {11000, typeof(RequestSyncSSID)}, {10555, typeof(ClientInputMessage)}, {14101, typeof(GoHomeMessage)}, {14102, typeof(EndClientTurnMessage)}, {14103, typeof(MatchmakeRequestMessage)}, {14104, typeof(StartSpectateMessage)}, {14106, typeof(CancelMatchmakingMessage)}, {14107, typeof(StopSpectateMessage)}, {14109, typeof(GoHomeFromOfflinePractiseMessage)}, {14110, typeof(AskForBattleEndMessage)}, {14114, typeof(GetBattleLogMessage)}, {14113, typeof(GetPlayerProfileMessage)}, {14117, typeof(RequestMatchCancelMessage)}, {14118, typeof(SinglePlayerMatchRequestMessage)}, {14166, typeof(ChronosEventSeenMessage)}, {14277, typeof(GetSeasonRewardsMessage)}, {14301, typeof(CreateAllianceMessage)}, {14302, typeof(AskForAllianceDataMessage)}, {14303, typeof(AskForJoinableAllianceListMessage)}, {14305, typeof(JoinAllianceMessage)}, {14306, typeof(ChangeAllianceMemberRoleMessage)}, {14307, typeof(KickAllianceMemberMessage)}, {14308, typeof(LeaveAllianceMessage)}, {14315, typeof(ChatToAllianceStreamMessage)}, {14316, typeof(ChangeAllianceSettingsMessage)}, {14324, typeof(AllianceSearchMessage)}, {14350, typeof(TeamCreateMessage)}, {14351, typeof(TeamJoinMessage)}, {14353, typeof(TeamLeaveMessage)}, {14354, typeof(TeamChangeMemberSettingsMessage)}, {14355, typeof(TeamSetMemberReadyMessage)}, {14358, typeof(TeamSpectateMessage)}, {14359, typeof(TeamChatMessage)}, {14361, typeof(TeamMemberStatusMessage)}, {14362, typeof(TeamSetEventMessage)}, {14363, typeof(TeamSetLocationMessage)}, {14365, typeof(TeamInviteMessage)}, {14366, typeof(PlayerStatusMessage)}, {14367, typeof(TeamClearInviteMessage)}, {14369, typeof(TeamPremadeChatMessage)}, {14370, typeof(TeamInviteMessage)}, {14371, typeof(TeamJoinOrCreateRoomMessage)}, {14403, typeof(GetLeaderboardMessage)}, {14479, typeof(TeamInvitationResponseMessage)}, {14600, typeof(AvatarNameCheckRequestMessage)}, {14777, typeof(SetInvitesBlockedMessage)}, {18686, typeof(SetSupportedCreatorMessage)}, {19001, typeof(LatencyTestResultMessage)}, {19995, typeof(RequestCodeSSID)}, {19996, typeof(RequestMaintenance)}, {19997, typeof(RequestSaveAll)}, {19998, typeof(RequestDBChanges)}, {19999, typeof(RequestServerStatus)}, {12157, typeof(RankedMatchHeroDataUpdatedMessage)}, {12155, typeof(RankedMatchPickHeroMessage)}, {12152, typeof(RankedMatchBanHeroMessage)}, {12100, typeof(CreatePlayerMapMessage)}, {12101, typeof(DeletePlayerMapMessage)}, {12102, typeof(GetPlayerMapsMessage)}, {12103, typeof(UpdatePlayerMapMessage)}, {12104, typeof(SubmitPlayerMapMessage)}, {12105, typeof(PublishPlayerMapMessage)}, {12106, typeof(ChangePlayerMapNameMessage)}, {12107, typeof(EnterMapEditorMessage)}, {12108, typeof(GoHomeFromMapEditorMessage)}, {12110, typeof(TeamSetPlayerMapMessage)}, {12111, typeof(SignoffPlayerMapMessage)}, {12125, typeof(ReportPlayerMapMessage)}, }; } public GameMessage CreateMessageByType(int type) { if (Definitions.TryGetValue(type, out Type messageType)) return (GameMessage)Activator.CreateInstance(messageType); Console.WriteLine($"[MessageFactory] Unknown message type: {type}"); return null; } } }