using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BufferedEvents.Impacts;
using CG;
using CG.Game.Missions;
using CG.Game.Player;
using CG.Game.SpaceObjects.Controllers;
using CG.Game.SpaceObjects.Controllers.ImpulseJumping;
using CG.Objects;
using CG.Ship.Modules;
using CG.Ship.Modules.Weapons;
using CG.Space;
using Gameplay.Atmosphere;
using Gameplay.Carryables;
using Gameplay.NPC.AI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Opsive.UltimateCharacterController.AddOns.Multiplayer.PhotonPun.Character;
using Opsive.UltimateCharacterController.Character;
using Opsive.UltimateCharacterController.FirstPersonController.Character;
using Photon.Pun;
using RSG;
using UI.Codex;
using UI.Token;
using UnityEngine;
using VoidManager;
using VoidManager.Chat.Router;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("VoidFixes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+9145caae62902dfc1fd59e103687c38527d88e32")]
[assembly: AssemblyProduct("VoidFixes")]
[assembly: AssemblyTitle("Provides bug fixes, Log Error eliminations, and Optimizations. Client/Host-Side")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace VoidFixes
{
[BepInPlugin("Dragon.VoidFixes", "Void Fixes", "1.0.1")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal class Bindings
{
internal static ConfigEntry<bool> DestroyJumpingShipsOnLeavePatch;
internal static ConfigEntry<bool> DestroySpawnersOnLeavePatch;
internal static ConfigEntry<bool> DestroImpactFXOnLeavePatch;
internal static ConfigEntry<bool> FinalizePerkTreeNullPatch;
internal static ConfigEntry<bool> SetCarriableActivePatch;
internal static ConfigEntry<bool> CharacterJoinCastsPatch;
internal static ConfigEntry<bool> WaitDurationNullPatch;
internal static ConfigEntry<bool> CameraAttachPatch;
internal static ConfigEntry<bool> DeltaTimePatch;
internal static ConfigEntry<bool> AtmosphereFix;
internal static ConfigEntry<bool> DebugLogging;
}
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Bindings.DebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DebugLogging", true, "Enables Logging");
Bindings.DestroyJumpingShipsOnLeavePatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "DestroyJumpingShipsOnLeave", true, "Host-side, effects networking. Destroys ships jumping in on sector leave (they don't normally get destroyed, just hidden).");
Bindings.DestroySpawnersOnLeavePatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "DestroySpawnersOnLeave", true, "Host-side, effects networking. Destroys spawners on sector leave (they don't normally get destroyed, just hidden).");
Bindings.DestroImpactFXOnLeavePatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "DestroyImpactFXOnLeave", true, "Client-side, Destroys old impactFX on sector leave (they don't normally get destroyed until there's 1024 of a given effect or the session ends).");
Bindings.FinalizePerkTreeNullPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "FinalizePerkTreeNull", true, "Client-Side, Fixes exception which occurs when a player character is loaded.");
Bindings.SetCarriableActivePatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "SetCarriableActive", true, "Client-Side, Attempts to fix picking up invisible items which then locks pickup ability. Try '/fix pickup' command if a similar issue is found.");
Bindings.CharacterJoinCastsPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "CharacterJoinCasts", true, "Client-Side, Fixes exceptions which occur when a player character is loaded.");
Bindings.WaitDurationNullPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "WaitDurationNull", true, "Client-Side, Fixes exception which occurs if a reclaimer timer starts while jumping out of the current sector.");
Bindings.CameraAttachPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "CameraAttach", true, "Client-Side, Fixes exception which occurs when a player character is loaded.");
Bindings.DeltaTimePatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "DeltaTime", true, "Multiple patches on both client and host. Currently affects EVATargetting and KPD spinning barrels. Requires Restart.");
Bindings.AtmosphereFix = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "AtmosphereFix", true, "Host-Side, Fixes O2 and pressure not filling and dropping at the same rate, leading to pressure being lower than oxygen.");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Dragon.VoidFixes is loaded!");
}
}
internal class Commands : ChatCommand
{
private List<Argument> arguments;
private static string subcommands = "pickup, drop";
private static FieldInfo LockInteractionFI = AccessTools.Field(typeof(CarryableInteract), "lockInteraction");
private static FieldInfo CarryableInsertPromiseFI = AccessTools.Field(typeof(CarrierCarryableHandler), "carryableInsertPromise");
private static MethodInfo CarryableOwnerChangeMI = AccessTools.Method(typeof(CarrierCarryableHandler), "CarryableOwnerChange", (Type[])null, (Type[])null);
public Commands()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
arguments = new List<Argument>
{
new Argument(new string[2] { "drop", "pickup" })
};
}
public override string[] CommandAliases()
{
return new string[1] { "fix" };
}
public override string Description()
{
return "Provides input controls for fixing bugs. Subcommands: " + arguments[0].names;
}
public override void Execute(string arguments)
{
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
string[] array = arguments.Split(new char[1] { ' ' });
switch (array[0].ToLower())
{
case "drop":
case "release":
case "throw":
case "eject":
case "pickup":
Messaging.Echo("Attempting to fix pickup/drop capabilities", true);
if ((Object)(object)((Player)LocalPlayer.Instance).Payload == (Object)null)
{
CarryableOwnerChangeMI.Invoke(((Player)LocalPlayer.Instance).CarryableHandler, new object[1]);
break;
}
if (!((Component)((Player)LocalPlayer.Instance).Payload).gameObject.activeSelf)
{
((Component)((Player)LocalPlayer.Instance).Payload).gameObject.SetActive(true);
}
LockInteractionFI.SetValue(((UltimateCharacterLocomotion)((Player)LocalPlayer.Instance).Locomotion).GetAbility<CarryableInteract>(-1), false);
((Promise)CarryableInsertPromiseFI.GetValue(((Player)LocalPlayer.Instance).CarryableHandler)).Reject(new Exception("forced reject"));
break;
case "debug":
BepinPlugin.Bindings.DebugLogging.Value = !BepinPlugin.Bindings.DebugLogging.Value;
Messaging.Echo("Debug now " + BepinPlugin.Bindings.DebugLogging.Value, true);
break;
default:
Messaging.Echo("Subcommand '" + array[0] + "' not found. Subcommands: " + subcommands, true);
break;
}
}
public override string[] UsageExamples()
{
return new string[1] { "/fix [subcommand]" };
}
public override List<Argument> Arguments()
{
return arguments;
}
}
internal class GUI : ModSettingsMenu
{
private bool DebugLoggingGUIValue;
private bool DestroyJumpingShipsOnLeavePatchGUIValue;
private bool DestroySpawnersOnLeavePatchGUIValue;
private bool DestroImpactFXOnLeavePatchGUIValue;
private bool FinalizePerkTreeNullPatchGUIValue;
private bool FrigateEngineeringDoorFixGUIValue;
private bool SetCarriableActivePatchGUIValue;
private bool CharacterJoinCastsPatchGUIValue;
private bool WaitDurationNullPatchGUIValue;
private bool CameraAttachPatchGUIValue;
private bool DeltaTimePatchGUIValue;
private bool AtmosphereFixGUIValue;
public override string Name()
{
return "Void Fixes";
}
public override void Draw()
{
GUILayout.Label("Configuration for various fixes. Some fixes require a restart to take effect.", Array.Empty<GUILayoutOption>());
GUILayout.Label(string.Empty, Array.Empty<GUILayoutOption>());
DrawValueConfig(BepinPlugin.Bindings.DebugLogging, ref DebugLoggingGUIValue);
DrawValueConfig(BepinPlugin.Bindings.DestroyJumpingShipsOnLeavePatch, ref DestroyJumpingShipsOnLeavePatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.DestroySpawnersOnLeavePatch, ref DestroySpawnersOnLeavePatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.DestroImpactFXOnLeavePatch, ref DestroImpactFXOnLeavePatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.FinalizePerkTreeNullPatch, ref FinalizePerkTreeNullPatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.SetCarriableActivePatch, ref SetCarriableActivePatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.CharacterJoinCastsPatch, ref CharacterJoinCastsPatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.WaitDurationNullPatch, ref WaitDurationNullPatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.CameraAttachPatch, ref CameraAttachPatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.DeltaTimePatch, ref DeltaTimePatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.AtmosphereFix, ref AtmosphereFixGUIValue);
}
private void DrawValueConfig(ConfigEntry<bool> entry, ref bool GUIvalue)
{
if (GUITools.DrawCheckbox(((ConfigEntryBase)entry).Definition.Key, ref GUIvalue))
{
entry.Value = GUIvalue;
}
GUILayout.Label(((ConfigEntryBase)entry).Description.Description, Array.Empty<GUILayoutOption>());
GUILayout.Label(string.Empty, Array.Empty<GUILayoutOption>());
}
public override void OnOpen()
{
DebugLoggingGUIValue = BepinPlugin.Bindings.DebugLogging.Value;
DestroyJumpingShipsOnLeavePatchGUIValue = BepinPlugin.Bindings.DestroyJumpingShipsOnLeavePatch.Value;
DestroySpawnersOnLeavePatchGUIValue = BepinPlugin.Bindings.DestroySpawnersOnLeavePatch.Value;
DestroImpactFXOnLeavePatchGUIValue = BepinPlugin.Bindings.DestroImpactFXOnLeavePatch.Value;
FinalizePerkTreeNullPatchGUIValue = BepinPlugin.Bindings.FinalizePerkTreeNullPatch.Value;
SetCarriableActivePatchGUIValue = BepinPlugin.Bindings.SetCarriableActivePatch.Value;
CharacterJoinCastsPatchGUIValue = BepinPlugin.Bindings.CharacterJoinCastsPatch.Value;
WaitDurationNullPatchGUIValue = BepinPlugin.Bindings.WaitDurationNullPatch.Value;
CameraAttachPatchGUIValue = BepinPlugin.Bindings.CameraAttachPatch.Value;
DeltaTimePatchGUIValue = BepinPlugin.Bindings.DeltaTimePatch.Value;
AtmosphereFixGUIValue = BepinPlugin.Bindings.AtmosphereFix.Value;
}
}
public class MyPluginInfo
{
public const string PLUGIN_GUID = "Dragon.VoidFixes";
public const string PLUGIN_NAME = "VoidFixes";
public const string USERS_PLUGIN_NAME = "Void Fixes";
public const string PLUGIN_VERSION = "1.0.1";
public const string PLUGIN_DESCRIPTION = "Provides bug fixes, Log Error eliminations, and Optimizations. Client/Host-Side";
public const string PLUGIN_ORIGINAL_AUTHOR = "Dragon";
public const string PLUGIN_AUTHORS = "Dragon, 18107";
public const string PLUGIN_THUNDERSTORE_ID = "VoidCrewModdingTeam/Void_Fixes";
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)8;
public override string Author => "Dragon, 18107";
public override string Description => "Provides bug fixes, Log Error eliminations, and Optimizations. Client/Host-Side";
public override string ThunderstoreID => "VoidCrewModdingTeam/Void_Fixes";
}
}
namespace VoidFixes.Patches
{
[HarmonyPatch(typeof(LifeSupportModule))]
internal class LifeSupportModulePatch
{
private static readonly MethodInfo GetAtmosphereValuesMethod = AccessTools.Method(typeof(Atmosphere), "GetAtmosphereValues", (Type[])null, (Type[])null);
private static readonly MethodInfo SetAtmosphereValuesMethod = AccessTools.Method(typeof(Atmosphere), "SetAtmosphereValues", (Type[])null, (Type[])null);
[HarmonyPrefix]
[HarmonyPatch("ApplyPressureIncrease")]
private static bool ApplyPressureIncrease()
{
if (!BepinPlugin.Bindings.AtmosphereFix.Value)
{
return true;
}
return false;
}
[HarmonyPostfix]
[HarmonyPatch("ApplyOxygenIncrease")]
private static void ApplyOxygenIncrease(Atmosphere ____atmosphere)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (!BepinPlugin.Bindings.AtmosphereFix.Value)
{
return;
}
foreach (Room key in ____atmosphere.Atmospheres.keys)
{
AtmosphereValues val = (AtmosphereValues)GetAtmosphereValuesMethod.Invoke(____atmosphere, new object[1] { key });
val.Pressure = val.Oxygen;
SetAtmosphereValuesMethod.Invoke(____atmosphere, new object[2] { key, val });
}
}
}
[HarmonyPatch(typeof(FirstPersonObjects), "OnAttachCamera")]
internal class AttachCameraBroken
{
private static bool Prefix()
{
if (!BepinPlugin.Bindings.CameraAttachPatch.Value)
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(PunCharacterAnimatorMonitor), "OnPhotonSerializeView")]
internal class PCAMPatch
{
private static bool Prefix(PhotonStream stream)
{
if (!BepinPlugin.Bindings.CharacterJoinCastsPatch.Value)
{
return true;
}
if (stream.IsWriting)
{
return true;
}
if (stream.PeekNext().GetType() != typeof(short))
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogWarning((object)"Not starting with a short, stopping early.");
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(CustomPunCharacterTransformMonitor), "OnPhotonSerializeView")]
internal class CPCTMPatch
{
private static bool Prefix(PhotonStream stream)
{
if (!BepinPlugin.Bindings.CharacterJoinCastsPatch.Value)
{
return true;
}
if (stream.IsWriting)
{
return true;
}
if (stream.PeekNext().GetType() != typeof(byte))
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogWarning((object)"Not starting with a byte, stopping early.");
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(PunLookSource), "OnPhotonSerializeView")]
internal class PLSPatch
{
private static bool Prefix(PhotonStream stream)
{
if (!BepinPlugin.Bindings.CharacterJoinCastsPatch.Value)
{
return true;
}
if (stream.IsWriting)
{
return true;
}
if (stream.PeekNext().GetType() != typeof(byte))
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogWarning((object)"Not starting with a byte, stopping early.");
}
return false;
}
return true;
}
}
internal class DeltaTme
{
[HarmonyPatch(typeof(SpinningBarrelAnimator), "UpdateBarrelRoll")]
private class SpinningBarrelAnimatorPatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return FixedDeltaToDelta(instructions);
}
}
[HarmonyPatch(typeof(SwarmController), "FlyDroneTowardsEVAPlayer")]
private class SwarmControllerPatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return FixedDeltaToDeltaMultiPatch(instructions, 2);
}
}
internal static CodeInstruction[] DeltaSequence = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Time), "deltaTime"))
};
internal static CodeInstruction[] FixedDeltaSequence = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(Time), "fixedDeltaTime"))
};
private static IEnumerable<CodeInstruction> FixedDeltaToDelta(IEnumerable<CodeInstruction> instructions)
{
if (!BepinPlugin.Bindings.DeltaTimePatch.Value)
{
return instructions;
}
return HarmonyHelpers.PatchBySequence(instructions, (IEnumerable<CodeInstruction>)FixedDeltaSequence, (IEnumerable<CodeInstruction>)DeltaSequence, (PatchMode)2, (CheckMode)0, false);
}
private static IEnumerable<CodeInstruction> FixedDeltaToDeltaMultiPatch(IEnumerable<CodeInstruction> instructions, int count)
{
if (!BepinPlugin.Bindings.DeltaTimePatch.Value)
{
return instructions;
}
for (int i = 0; i < count; i++)
{
instructions = HarmonyHelpers.PatchBySequence(instructions, (IEnumerable<CodeInstruction>)FixedDeltaSequence, (IEnumerable<CodeInstruction>)DeltaSequence, (PatchMode)2, (CheckMode)0, false);
}
return instructions;
}
}
[HarmonyPatch(typeof(GameSessionSector), "Unload")]
internal class DestroyOnLeave
{
private static FieldInfo actJumpToSectorActionFI = AccessTools.Field(typeof(BehJumpToSector), "actJumpToSectorAction");
private static FieldInfo sectorEntryObjectFI = AccessTools.Field(typeof(ActJumpToSector), "sectorEntryObject");
private static FieldInfo VPFI = AccessTools.Field(typeof(VFXImpactsProcessor), "_visualPools");
private static FieldInfo SPFI = AccessTools.Field(typeof(SFXImpactsProcessor), "_soundPools");
private static void Postfix(bool asHost)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Expected O, but got Unknown
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Expected O, but got Unknown
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Expected O, but got Unknown
if (BepinPlugin.Bindings.DestroImpactFXOnLeavePatch.Value)
{
ClearFinishedSharedVFX();
}
if (!asHost)
{
return;
}
Object[] array;
if (BepinPlugin.Bindings.DestroySpawnersOnLeavePatch.Value)
{
array = Object.FindObjectsOfType(typeof(Spawner));
Object[] array2 = array;
foreach (Object val in array2)
{
Spawner val2 = (Spawner)val;
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogInfo((object)"Attempting to photon destroy a spawner");
}
PhotonNetwork.Destroy(((Component)val2).gameObject);
}
}
if (!BepinPlugin.Bindings.DestroyJumpingShipsOnLeavePatch.Value)
{
return;
}
GameSessionSector activeSector = GameSessionSectorManager.Instance.ActiveSector;
array = Object.FindObjectsOfType(typeof(AbstractSpaceCraft), true);
Object[] array3 = array;
foreach (Object val3 in array3)
{
AbstractSpaceCraft val4 = (AbstractSpaceCraft)val3;
if (((Behaviour)val4).isActiveAndEnabled || !(((OrbitObject)val4).Sector != activeSector))
{
continue;
}
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogInfo((object)("Attempting to photon destroy " + ((AbstractCloneStarObject)val4).DisplayName));
}
NpcImpulseJumper component = ((Component)val4).GetComponent<NpcImpulseJumper>();
if ((Object)(object)component != (Object)null)
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogInfo((object)"Found ImpulseJumper");
}
PhotonNetwork.Destroy(component.state.SectorEntryObject);
}
else
{
NpcAI component2 = ((Component)val4).GetComponent<NpcAI>();
if ((Object)(object)component2 != (Object)null)
{
BaseBehaviour activeBehaviour = component2.ActiveBehaviour;
BehJumpToSector val5 = (BehJumpToSector)(object)((activeBehaviour is BehJumpToSector) ? activeBehaviour : null);
if (val5 != null)
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogInfo((object)"Found NpcAI Beh");
}
ActJumpToSector obj = (ActJumpToSector)actJumpToSectorActionFI.GetValue(val5);
PhotonNetwork.Destroy((GameObject)sectorEntryObjectFI.GetValue(obj));
}
}
}
PhotonNetwork.Destroy(((AbstractCloneStarObject)val4).GameObject);
}
}
private static void ClearFinishedSharedVFX()
{
VFXImpactsProcessor val = Object.FindObjectOfType<VFXImpactsProcessor>();
if ((Object)(object)val != (Object)null)
{
Dictionary<PoolableImpactFX, ImpactFXPool> dictionary = (Dictionary<PoolableImpactFX, ImpactFXPool>)VPFI.GetValue(val);
foreach (ImpactFXPool value in dictionary.Values)
{
value.Dispose();
}
}
SFXImpactsProcessor val2 = Object.FindObjectOfType<SFXImpactsProcessor>();
if (!((Object)(object)val2 != (Object)null))
{
return;
}
Dictionary<PoolableImpactFX, ImpactFXPool> dictionary2 = (Dictionary<PoolableImpactFX, ImpactFXPool>)SPFI.GetValue(val2);
foreach (ImpactFXPool value2 in dictionary2.Values)
{
value2.Dispose();
}
}
}
[HarmonyPatch(typeof(LogBookManager), "FinalizePerkTree")]
internal class FinalizePerkTreeNull
{
private static bool Prefix(PerkTreeController ___treeController)
{
if (BepinPlugin.Bindings.FinalizePerkTreeNullPatch.Value && ___treeController == null)
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogWarning((object)"LogBookManager TreeController is null, stopping early.");
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(TokenTerminal), "UpdateTrees")]
internal class TokenTerminalPatch
{
private static bool Prefix(PerkTreeController ___treeController)
{
if (BepinPlugin.Bindings.FinalizePerkTreeNullPatch.Value && ___treeController == null)
{
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogWarning((object)"TokenTerminal TreeController is null, stopping early.");
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(CarrierCarryableHandler), "TryInsertCarryable")]
internal class SetCarriableActive
{
private static void Prefix(AbstractCarryableObject carryable)
{
if (BepinPlugin.Bindings.SetCarriableActivePatch.Value && !((Component)carryable).gameObject.activeSelf)
{
((Component)carryable).gameObject.SetActive(true);
}
}
}
[HarmonyPatch(typeof(WaitDuration), "Run")]
internal class WaitDurationNullReference
{
private static bool Prefix()
{
if (!BepinPlugin.Bindings.WaitDurationNullPatch.Value || GameSessionSectorManager.Instance.ActiveSector != (GameSessionSector)null)
{
return true;
}
if (BepinPlugin.Bindings.DebugLogging.Value)
{
BepinPlugin.Log.LogInfo((object)"Intercepting WaitDuration.Run");
}
return false;
}
}
}