diff --git a/QSB/Menus/MenuManager.cs b/QSB/Menus/MenuManager.cs index 18646a82..9ef1054f 100644 --- a/QSB/Menus/MenuManager.cs +++ b/QSB/Menus/MenuManager.cs @@ -156,7 +156,7 @@ namespace QSB.Menus { CreateCommonPopups(); - HostButton = MenuApi.PauseMenu_MakeSimpleButton("MULTIPLAYER (HOST)"); + HostButton = MenuApi.PauseMenu_MakeSimpleButton("OPEN TO MULTIPLAYER"); HostButton.onClick.AddListener(Host); DisconnectButton = MenuApi.PauseMenu_MakeSimpleButton("DISCONNECT"); @@ -180,7 +180,7 @@ namespace QSB.Menus { CreateCommonPopups(); - ClientButton = MenuApi.TitleScreen_MakeMenuOpenButton("MULTIPLAYER (CONNECT)", _ClientButtonIndex, PopupMenu); + ClientButton = MenuApi.TitleScreen_MakeMenuOpenButton("CONNECT TO MULTIPLAYER", _ClientButtonIndex, PopupMenu); DisconnectButton = MenuApi.TitleScreen_MakeSimpleButton("DISCONNECT", _DisconnectIndex); DisconnectButton.onClick.AddListener(Disconnect); @@ -302,6 +302,7 @@ namespace QSB.Menus KickReason.QSBVersionNotMatching => "Server refused connection as QSB version does not match.", KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.", KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)", + KickReason.DLCNotMatching => "Server refused connection as DLC installation state does not match.", KickReason.None => "Kicked from server. No reason given.", _ => $"Kicked from server. KickReason:{reason}", }; diff --git a/QSB/Player/Events/PlayerJoinEvent.cs b/QSB/Player/Events/PlayerJoinEvent.cs index f6f3b239..d0177a15 100644 --- a/QSB/Player/Events/PlayerJoinEvent.cs +++ b/QSB/Player/Events/PlayerJoinEvent.cs @@ -19,7 +19,8 @@ namespace QSB.Player.Events PlayerName = name, QSBVersion = QSBCore.QSBVersion, GameVersion = QSBCore.GameVersion, - Platform = QSBCore.Platform + Platform = QSBCore.Platform, + DlcInstalled = QSBCore.DLCInstalled }; public override void OnReceiveRemote(bool server, PlayerJoinMessage message) @@ -51,6 +52,15 @@ namespace QSB.Player.Events if (server) { DebugLog.ToConsole($"Error - Client {message.PlayerName} connecting with wrong game platform. (Client:{message.Platform}, Server:{QSBCore.Platform})", MessageType.Error); + QSBEventManager.FireEvent(EventNames.QSBPlayerKick, message.AboutId, KickReason.DLCNotMatching); + } + } + + if (message.DlcInstalled != QSBCore.DLCInstalled) + { + if (server) + { + DebugLog.ToConsole($"Error - Client {message.PlayerName} connecting with wrong DLC installation state. (Client:{message.DlcInstalled}, Server:{QSBCore.DLCInstalled})", MessageType.Error); QSBEventManager.FireEvent(EventNames.QSBPlayerKick, message.AboutId, KickReason.GamePlatformNotMatching); } } @@ -58,7 +68,7 @@ namespace QSB.Player.Events var player = QSBPlayerManager.GetPlayer(message.AboutId); player.Name = message.PlayerName; DebugLog.ToAll($"{player.Name} joined!", MessageType.Info); - DebugLog.DebugWrite($"{player.Name} joined. id:{player.PlayerId}, qsbVersion:{message.QSBVersion}, gameVersion:{message.GameVersion}, platform:{message.Platform}", MessageType.Info); + DebugLog.DebugWrite($"{player.Name} joined. id:{player.PlayerId}, qsbVersion:{message.QSBVersion}, gameVersion:{message.GameVersion}, platform:{message.Platform}. dlcInstalled:{message.DlcInstalled}", MessageType.Info); } public override void OnReceiveLocal(bool server, PlayerJoinMessage message) diff --git a/QSB/Player/Events/PlayerJoinMessage.cs b/QSB/Player/Events/PlayerJoinMessage.cs index a07f5f4d..a965cf20 100644 --- a/QSB/Player/Events/PlayerJoinMessage.cs +++ b/QSB/Player/Events/PlayerJoinMessage.cs @@ -9,6 +9,7 @@ namespace QSB.Player.Events public string QSBVersion { get; set; } public string GameVersion { get; set; } public GamePlatform Platform { get; set; } + public bool DlcInstalled { get; set; } public override void Deserialize(QNetworkReader reader) { @@ -17,6 +18,7 @@ namespace QSB.Player.Events QSBVersion = reader.ReadString(); GameVersion = reader.ReadString(); Platform = (GamePlatform)reader.ReadInt32(); + DlcInstalled = reader.ReadBoolean(); } public override void Serialize(QNetworkWriter writer) @@ -26,6 +28,7 @@ namespace QSB.Player.Events writer.Write(QSBVersion); writer.Write(GameVersion); writer.Write((int)Platform); + writer.Write(DlcInstalled); } } } \ No newline at end of file diff --git a/QSB/Player/KickReason.cs b/QSB/Player/KickReason.cs index d02b4159..5b44b066 100644 --- a/QSB/Player/KickReason.cs +++ b/QSB/Player/KickReason.cs @@ -5,6 +5,7 @@ None, QSBVersionNotMatching, GameVersionNotMatching, - GamePlatformNotMatching + GamePlatformNotMatching, + DLCNotMatching } } diff --git a/QSB/QSBCore.cs b/QSB/QSBCore.cs index 746cddda..1de470f5 100644 --- a/QSB/QSBCore.cs +++ b/QSB/QSBCore.cs @@ -79,6 +79,7 @@ namespace QSB public static GamePlatform Platform => typeof(Achievements).Assembly.GetTypes().Any(x => x.Name == "EpicEntitlementRetriever") ? GamePlatform.Epic : GamePlatform.Steam; + public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned; public static IMenuAPI MenuApi { get; private set; } private static DebugSettings DebugSettings { get; set; } = new DebugSettings();