From bb8e5f80e03995cd2c6638281c0a8a16e7b537e6 Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:57:53 +0200 Subject: [PATCH] Move shared quests to server config --- Fika.Core/Coop/Players/CoopPlayer.cs | 2 +- Fika.Core/FikaPlugin.cs | 7 +++---- Fika.Core/Models/ClientConfigModel.cs | 9 +++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Fika.Core/Coop/Players/CoopPlayer.cs b/Fika.Core/Coop/Players/CoopPlayer.cs index 325abda5..0d3080f8 100644 --- a/Fika.Core/Coop/Players/CoopPlayer.cs +++ b/Fika.Core/Coop/Players/CoopPlayer.cs @@ -68,7 +68,7 @@ public static async Task Create(int playerId, Vector3 position, Qua ISession session = Singleton>.Instance.GetClientBackEndSession(); GClass3229 questController; - if (FikaPlugin.QuestSharing.Value) + if (FikaPlugin.Instance.SharedQuestProgression) { questController = new CoopClientSharedQuestController(profile, inventoryController, session, player); } diff --git a/Fika.Core/FikaPlugin.cs b/Fika.Core/FikaPlugin.cs index 41c0a979..9c7714c7 100644 --- a/Fika.Core/FikaPlugin.cs +++ b/Fika.Core/FikaPlugin.cs @@ -118,7 +118,6 @@ public class FikaPlugin : BaseUnityPlugin public static ConfigEntry MinimumNamePlateScale { get; set; } // Coop | Quest Sharing - public static ConfigEntry QuestSharing { get; set; } public static ConfigEntry QuestTypesToShareAndReceive { get; set; } // Coop | Custom @@ -186,6 +185,7 @@ public class FikaPlugin : BaseUnityPlugin public string[] BlacklistedItems; public bool ForceSaveOnDeath; public bool UseInertia; + public bool SharedQuestProgression; #endregion protected void Awake() @@ -263,8 +263,9 @@ private void GetClientConfig() BlacklistedItems = clientConfig.BlacklistedItems; ForceSaveOnDeath = clientConfig.ForceSaveOnDeath; UseInertia = clientConfig.UseInertia; + SharedQuestProgression = clientConfig.SharedQuestProgression; - clientConfig.ToString(); + clientConfig.LogValues(); } private void SetupConfig() @@ -319,8 +320,6 @@ private void SetupConfig() MinimumNamePlateScale = Config.Bind("Coop | Name Plates", "Minimum Name Plate Scale", 0.01f, new ConfigDescription("The minimum scale of the name plates.", new AcceptableValueRange(0.0f, 1f), new ConfigurationManagerAttributes() { Order = 0 })); // Coop | Quest Sharing - - QuestSharing = Config.Bind("Coop | Quest Sharing", "Quest Sharing", false, new ConfigDescription("Toggle to enable the quest sharing system. Cannot be toggled mid-raid.", tags: new ConfigurationManagerAttributes() { Order = 9 })); QuestTypesToShareAndReceive = Config.Bind("Coop | Quest Sharing", "Quest Types", EQuestSharingTypes.All, new ConfigDescription("Which quest types to receive and send.", tags: new ConfigurationManagerAttributes() { Order = 8 })); diff --git a/Fika.Core/Models/ClientConfigModel.cs b/Fika.Core/Models/ClientConfigModel.cs index 94a62313..90b8c2de 100644 --- a/Fika.Core/Models/ClientConfigModel.cs +++ b/Fika.Core/Models/ClientConfigModel.cs @@ -31,7 +31,11 @@ public struct ClientConfigModel [DataMember(Name = "useInertia")] public bool UseInertia; - public ClientConfigModel(bool useBTR, bool friendlyFire, bool dynamicVExfils, bool allowFreeCam, bool allowItemSending, string[] blacklistedItems, bool forceSaveOnDeath, bool useInertia) + [DataMember(Name = "sharedQuestProgression")] + public bool SharedQuestProgression; + + public ClientConfigModel(bool useBTR, bool friendlyFire, bool dynamicVExfils, bool allowFreeCam, bool allowItemSending, string[] blacklistedItems, bool forceSaveOnDeath, bool useInertia, + bool sharedQuestProgression) { UseBTR = useBTR; FriendlyFire = friendlyFire; @@ -41,9 +45,10 @@ public ClientConfigModel(bool useBTR, bool friendlyFire, bool dynamicVExfils, bo BlacklistedItems = blacklistedItems; ForceSaveOnDeath = forceSaveOnDeath; UseInertia = useInertia; + SharedQuestProgression = sharedQuestProgression; } - public new void ToString() + public void LogValues() { FikaPlugin.Instance.FikaLogger.LogInfo("Received config from server:"); FieldInfo[] fields = typeof(ClientConfigModel).GetFields();