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.Game.Missions;
using CG.Game.Player;
using CG.Game.SpaceObjects.Controllers;
using CG.Objects;
using CG.Ship.Modules;
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 UI.AstralMap;
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.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+73290ff66ea25cefc2f47bd5498457c5b2106334")]
[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.4.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.4")]
[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> PrivateGameEntriesPatch;
internal static ConfigEntry<bool> FullRoomEntriesPatch;
internal static ConfigEntry<bool> AstralMapSoftlockPatch;
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. Previously Destroyed ships jumping in on sector leave, which was patched in 1.0.0. A side effect of the change is the entrypoints being left beyhind, which will be removed by this patch.");
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).\nEdit: Largly patched in Vanilla 1.0.0, a spawner is created and never destroyed in the starting sector.");
Bindings.DestroImpactFXOnLeavePatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "DestroyImpactFXOnLeave", false, "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)\nEdit: Post Void Crew 1.0.0, this issue has largly been fixed. Only enable this setting if you deem it necessary.");
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.PrivateGameEntriesPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "PrivateGameEntries", true, "Client-Side, Disables creation of private room entries in the matchmaking lists.");
Bindings.FullRoomEntriesPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "FullRoomEntries", true, "Client-Side, Disables showing of full rooms in matchmaking lists");
Bindings.AstralMapSoftlockPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches", "AstralMapSoftlock", true, "Client-Side, Fixes astral map softlocking when accessing during void enter/exit.");
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. 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 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)
{
string[] array = arguments.Split(' ');
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);
}
((UltimateCharacterLocomotion)((Player)LocalPlayer.Instance).Locomotion).GetAbility<CarryableInteract>(-1).lockInteraction = false;
((Player)LocalPlayer.Instance).CarryableHandler.carryableInsertPromise.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 Disconnect : ChatCommand
{
private bool simulating = false;
public override string[] CommandAliases()
{
return new string[1] { "disconnect" };
}
public override string Description()
{
return "Simulates a photon disconnect";
}
public override void Execute(string arguments)
{
Messaging.Notification("Simulating Connection Loss", false);
simulating = !simulating;
PhotonNetwork.NetworkingClient.SimulateConnectionLoss(simulating);
}
}
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 PrivateGameEntriesPatchGUIValue;
private bool FullRoomEntriesPatchGUIValue;
private bool AstralMapSoftlockPatchGUIValue;
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.PrivateGameEntriesPatch, ref PrivateGameEntriesPatchGUIValue);
DrawValueConfig(BepinPlugin.Bindings.FullRoomEntriesPatch, ref FullRoomEntriesPatchGUIValue);
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;
PrivateGameEntriesPatchGUIValue = BepinPlugin.Bindings.PrivateGameEntriesPatch.Value;
FullRoomEntriesPatchGUIValue = BepinPlugin.Bindings.FullRoomEntriesPatch.Value;
AstralMapSoftlockPatchGUIValue = BepinPlugin.Bindings.AstralMapSoftlockPatch.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.4";
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(AstralMapController), "OnDisable")]
internal class AstralMapDisablePatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
CodeInstruction[] array = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MonoBehaviour), "StopAllCoroutines", (Type[])null, (Type[])null))
};
CodeInstruction[] array2 = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Pop, (object)null)
};
return HarmonyHelpers.PatchBySequence(instructions, (IEnumerable<CodeInstruction>)array, (IEnumerable<CodeInstruction>)array2, (PatchMode)2, (CheckMode)0, false);
}
}
[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(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_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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;
Object[] array3 = (Object[])(object)Object.FindObjectsOfType<PhotonView>();
array = array3;
Object[] array4 = array;
foreach (Object val3 in array4)
{
if (val3.name == "VoidJumpArrivalPosition(Clone)")
{
PhotonView val4 = (PhotonView)val3;
PhotonNetwork.Destroy(val4);
}
}
}
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(MatchmakingController), "GetRooms")]
internal class PrivateGameEntries
{
private static bool PatchMethod1(bool ShowFull)
{
if (BepinPlugin.Bindings.FullRoomEntriesPatch.Value)
{
return false;
}
return ShowFull;
}
private static int PatchMethod2(int max)
{
if (BepinPlugin.Bindings.PrivateGameEntriesPatch.Value)
{
return 0;
}
return max;
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
CodeInstruction[] array = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Ldarg_1, (object)null)
};
CodeInstruction[] array2 = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PrivateGameEntries), "PatchMethod1", (Type[])null, (Type[])null))
};
instructions = HarmonyHelpers.PatchBySequence(instructions, (IEnumerable<CodeInstruction>)array, (IEnumerable<CodeInstruction>)array2, (PatchMode)1, (CheckMode)2, false);
array = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Mathf), "Max", new Type[2]
{
typeof(int),
typeof(int)
}, (Type[])null))
};
array2 = (CodeInstruction[])(object)new CodeInstruction[1]
{
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PrivateGameEntries), "PatchMethod2", (Type[])null, (Type[])null))
};
return HarmonyHelpers.PatchBySequence(instructions, (IEnumerable<CodeInstruction>)array, (IEnumerable<CodeInstruction>)array2, (PatchMode)1, (CheckMode)0, false);
}
}
[HarmonyPatch(typeof(CarrierCarryableHandler), "TryInsertCarryable")]
internal class SetCarriableActive
{
private static void Prefix(CarryableObject carryable)
{
if ((Object)(object)carryable == (Object)null)
{
BepinPlugin.Log.LogError((object)"SetCarriableActive:Prefix - Carryable is null!");
}
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;
}
}
}