Skip to content

Commit

Permalink
Move shared quests to server config
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jun 20, 2024
1 parent 925e350 commit bb8e5f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Fika.Core/Coop/Players/CoopPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static async Task<LocalPlayer> Create(int playerId, Vector3 position, Qua
ISession session = Singleton<ClientApplication<ISession>>.Instance.GetClientBackEndSession();

GClass3229 questController;
if (FikaPlugin.QuestSharing.Value)
if (FikaPlugin.Instance.SharedQuestProgression)
{
questController = new CoopClientSharedQuestController(profile, inventoryController, session, player);
}
Expand Down
7 changes: 3 additions & 4 deletions Fika.Core/FikaPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public class FikaPlugin : BaseUnityPlugin
public static ConfigEntry<float> MinimumNamePlateScale { get; set; }

// Coop | Quest Sharing
public static ConfigEntry<bool> QuestSharing { get; set; }
public static ConfigEntry<EQuestSharingTypes> QuestTypesToShareAndReceive { get; set; }

// Coop | Custom
Expand Down Expand Up @@ -186,6 +185,7 @@ public class FikaPlugin : BaseUnityPlugin
public string[] BlacklistedItems;
public bool ForceSaveOnDeath;
public bool UseInertia;
public bool SharedQuestProgression;
#endregion

protected void Awake()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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<float>(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 }));

Expand Down
9 changes: 7 additions & 2 deletions Fika.Core/Models/ClientConfigModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit bb8e5f8

Please sign in to comment.