diff --git a/PTT-Plugin/Data/ExfilsTargets.cs b/PTT-Plugin/Data/ExfilsTargets.cs index 9341756..485ac31 100644 --- a/PTT-Plugin/Data/ExfilsTargets.cs +++ b/PTT-Plugin/Data/ExfilsTargets.cs @@ -80,6 +80,7 @@ public bool IsAvailable() } bool playerIsHighLevel = Helpers.PlayerProfile.GetLevel() >= 20; + bool playerIsLowLevel = !playerIsHighLevel; bool isSandboxLow = transitMapId.ToLower() == "sandbox"; bool isSandboxHigh = transitMapId.ToLower() == "sandbox_high"; @@ -88,7 +89,7 @@ public bool IsAvailable() return false; } - if (!playerIsHighLevel && isSandboxHigh) + if (playerIsLowLevel && isSandboxHigh) { return false; } diff --git a/PTT-Plugin/Services/ExfilPromptService.cs b/PTT-Plugin/Services/ExfilPromptService.cs index 1bb1efc..ff29207 100644 --- a/PTT-Plugin/Services/ExfilPromptService.cs +++ b/PTT-Plugin/Services/ExfilPromptService.cs @@ -18,7 +18,13 @@ public class ExfilPromptService( ExfilsTargetsService exfilsTargetsService ) { - public void InitPromptHandlers() + public void Init() + { + ieService.DisableVanillaActions = true; + InitPromptHandlers(); + } + + private void InitPromptHandlers() { // requires manual activation (no auto-extract even if the player enabled the IEAPI option in BepInEx) ieService.OnActionsAppliedEvent += RequiresManualActivation; @@ -160,13 +166,12 @@ private OnActionsAppliedResult ExfilPromptHandler(ExfiltrationPoint exfil, Custo private OnActionsAppliedResult RequiresManualActivation(ExfiltrationPoint exfil, CustomExfilTrigger customExfilTrigger, bool exfilIsAvailableToPlayer) { - // compat with older version of Interactable Exfils API (< 1.4.0) + // avoid crash with older version of Interactable Exfils API (< 1.4.0) if (customExfilTrigger == null) { return null; } - // TODO: find out why it doesn't work as intended? (in some cases, when player enable/disable the bepinex setting manually) customExfilTrigger.RequiresManualActivation = true; return null; } diff --git a/PTT-Plugin/Services/IEApiWrapper.cs b/PTT-Plugin/Services/IEApiWrapper.cs index cff34d1..daaab58 100644 --- a/PTT-Plugin/Services/IEApiWrapper.cs +++ b/PTT-Plugin/Services/IEApiWrapper.cs @@ -11,9 +11,7 @@ public static void Init(ExfilsTargetsService exfilsTargetsService) if (interactableExfilsService != null) { - interactableExfilsService.DisableVanillaActions = true; - var exfilPromptService = new ExfilPromptService(interactableExfilsService, exfilsTargetsService); - exfilPromptService.InitPromptHandlers(); + new ExfilPromptService(interactableExfilsService, exfilsTargetsService).Init(); Logger.Info($"Jehree's Interactable Exfils API: initialized exfils prompt service"); } else