using System; using System.Reflection; using EFT; using EFT.InventoryLogic; using EFT.UI; using stupid.solutions; using stupid.solutions.Utils; public class StatusManager { public class HookManager { public static bool CheckItemFilter_Hook(ItemFilter[] filters, Item item) { return true; } } public static void Stop_Hook(object instance, string profileId, ExitStatus exitStatus, string exitName, float delay = 0f) { try { Main.alwayssurvivedhook.Unhook(); MethodInfo originalMethod = Main.alwayssurvivedhook.OriginalMethod; if (originalMethod != null) { if (Settings.alwayssurvived) { ExitStatus exitStatus2 = ExitStatus.Survived; originalMethod.Invoke(instance, new object[4] { profileId, exitStatus2, exitName, delay }); ConsoleScreen.Log("Setting Exit Status to Survived"); } else { originalMethod.Invoke(instance, new object[4] { profileId, exitStatus, exitName, delay }); ConsoleScreen.Log("Always Survive is off, not doing anything"); } } } catch (Exception ex) { ConsoleScreen.Log("Exception in hook method:"); ConsoleScreen.Log($"Exception Type: {ex.GetType()}"); ConsoleScreen.Log("Exception Message: " + ex.Message); ConsoleScreen.Log("Stack Trace: " + ex.StackTrace); } finally { Main.alwayssurvivedhook.Hook(); } } public static bool CheckItemFilter_Hook(object instance, Item item) { try { Main.checkItemFilterHook.Unhook(); MethodInfo originalMethod = Main.checkItemFilterHook.OriginalMethod; if (originalMethod != null) { if (Settings.removefilters) { return true; } return (bool)originalMethod.Invoke(instance, new object[1] { item }); } } catch (Exception ex) { ConsoleScreen.Log("Exception in CheckItemFilter_Hook: " + ex.Message); } finally { Main.checkItemFilterHook.Hook(); } return false; } public static bool CheckItemExcludedFilter_Hook(object instance, Item item) { try { Main.checkItemExcludedFilterHook.Unhook(); MethodInfo originalMethod = Main.checkItemExcludedFilterHook.OriginalMethod; if (originalMethod != null) { if (Settings.removefilters) { return true; } return (bool)originalMethod.Invoke(instance, new object[1] { item }); } } catch (Exception ex) { ConsoleScreen.Log("Exception in CheckItemExcludedFilter_Hook: " + ex.Message); } finally { Main.checkItemExcludedFilterHook.Hook(); } return false; } }