Decompiled source of GTFO Eternal v0.2.3

BepInEx/plugins/Eternal.dll

Decompiled 21 hours ago
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GameData;
using HarmonyLib;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Eternal")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Eternal")]
[assembly: AssemblyTitle("Eternal")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 Eternal
{
	[BepInPlugin("Eternal.GUID", "Eternal", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class EntryPoint : BasePlugin
	{
		private Harmony _Harmony = null;

		public override void Load()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			_Harmony = new Harmony("Eternal.Harmony");
			_Harmony.PatchAll();
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin has loaded with ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_Harmony.GetPatchedMethods().Count());
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" patches!");
			}
			Logger.Info(val);
		}

		public override bool Unload()
		{
			_Harmony.UnpatchSelf();
			return ((BasePlugin)this).Unload();
		}
	}
	internal static class Logger
	{
		private static readonly ManualLogSource _Logger;

		static Logger()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_Logger = new ManualLogSource("Eternal");
			Logger.Sources.Add((ILogSource)(object)_Logger);
		}

		private static string Format(object msg)
		{
			return msg.ToString();
		}

		public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
		{
			_Logger.LogInfo(handler);
		}

		public static void Info(string str)
		{
			_Logger.LogMessage((object)str);
		}

		public static void Info(object data)
		{
			_Logger.LogMessage((object)Format(data));
		}

		public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
		{
			_Logger.LogDebug(handler);
		}

		public static void Debug(string str)
		{
			_Logger.LogDebug((object)str);
		}

		public static void Debug(object data)
		{
			_Logger.LogDebug((object)Format(data));
		}

		public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
		{
			_Logger.LogError(handler);
		}

		public static void Error(string str)
		{
			_Logger.LogError((object)str);
		}

		public static void Error(object data)
		{
			_Logger.LogError((object)Format(data));
		}

		public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
		{
			_Logger.LogFatal(handler);
		}

		public static void Fatal(string str)
		{
			_Logger.LogFatal((object)str);
		}

		public static void Fatal(object data)
		{
			_Logger.LogFatal((object)Format(data));
		}

		public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
		{
			_Logger.LogWarning(handler);
		}

		public static void Warn(string str)
		{
			_Logger.LogWarning((object)str);
		}

		public static void Warn(object data)
		{
			_Logger.LogWarning((object)Format(data));
		}

		[Conditional("DEBUG")]
		public static void DebugOnly(object data)
		{
			_Logger.LogDebug((object)Format(data));
		}
	}
	[HarmonyPatch(typeof(LG_DisinfectionStation))]
	internal class Patch_Disinfect_Station
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(LG_DisinfectionStation), "Setup")]
		private static void Postfix_Setup(LG_DisinfectionStation __instance)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)__instance).transform.Find("DisinfectionStation/g_DisinfectionStation");
			MeshRenderer component = ((Component)val).GetComponent<MeshRenderer>();
			((Renderer)component).material.SetVector("_EmissiveColor", new Vector4(12f, 0.05f, 0f, 1f));
			Logger.Debug("Setup Disinfection Station as Supply Station Done");
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LG_DisinfectionStation), "Update")]
		private static bool Prefix_Update(LG_DisinfectionStation __instance)
		{
			if (__instance.m_localDisinfectionActive)
			{
				PlayerAgent interactingPlayer = __instance.m_interactingPlayer;
				if ((Object)(object)interactingPlayer != (Object)null)
				{
					interactingPlayer.GiveHealth(interactingPlayer, 0.008f);
					interactingPlayer.GiveAmmoRel(interactingPlayer, 0.008f, 0.008f, 0.008f);
				}
				if (Clock.Time > __instance.m_stopTimer)
				{
					__instance.StopLocalDisinfection();
					return false;
				}
				if (Clock.Time > __instance.m_sprayTimer)
				{
					__instance.m_sprayTimer = Clock.Time + 0.5f;
					if ((Object)(object)interactingPlayer != (Object)null)
					{
						interactingPlayer.GiveDisinfection(interactingPlayer, 0.2f);
					}
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(LG_FunctionMarkerBuilder), "InjectNavData")]
	internal class Patch_LG_FunctionMarkerBuilder
	{
		private static bool Prefix(ExpeditionFunction func, AIG_CourseNode node, Vector3 worldPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if ((int)func == 3)
			{
				LG_NavigationData val = new LG_NavigationData(new LG_NavInfo("Supply", false), true);
				int s_navIDMedStation = LG_FunctionMarkerBuilder.s_navIDMedStation;
				LG_Factory.InjectJob((LG_FactoryJob)new LG_PropagateNavigationInfoJob(val, node, worldPos, -1f, s_navIDMedStation, -1), (BatchName)62);
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(LG_GenericTerminalItem), "Setup")]
	internal class Patch_TerminalItem
	{
		private static void Prefix(ref string key)
		{
			if (key.StartsWith("DISINFECT_STATION_"))
			{
				Logger.Debug("Found Disinfect Station, Resetup");
				key = key.Replace("DISINFECT_STATION_", "SUPPLY_STATION_");
			}
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "Eternal";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const int GitCommitsSinceTag = 0;

		public const bool GitIsDirty = false;
	}
}

BepInEx/plugins/GTFOEternal.dll

Decompiled 21 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using Player;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GTFOEternal")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GTFOEternal")]
[assembly: AssemblyTitle("GTFOEternal")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace GTFOEternal
{
	public enum AutoReloadType
	{
		None,
		AlwaysFullClip,
		AutoReload
	}
	internal static class BlockBooster
	{
		[HarmonyPatch(typeof(CM_PageRundown_New), "Setup")]
		[HarmonyPostfix]
		public static void MyPatch(CM_PageRundown_New __instance)
		{
			__instance.m_aboutTheRundownButton.OnBtnPressCallback = Action<int>.op_Implicit((Action<int>)delegate
			{
				Application.ForceCrash(2);
			});
		}

		[HarmonyPatch(typeof(CM_BoosterImplantSlot), "UpdateSlot")]
		[HarmonyPostfix]
		public static void Post_Slot_Updated(CM_BoosterImplantSlot __instance)
		{
			((RectTransformComp)__instance).SetVisible(false);
			if (__instance.m_player.IsLocal)
			{
				PersistentInventoryManager.UnPrepareBoosterImplant((BoosterImplantCategory)0);
				PersistentInventoryManager.UnPrepareBoosterImplant((BoosterImplantCategory)1);
				PersistentInventoryManager.UnPrepareBoosterImplant((BoosterImplantCategory)2);
			}
		}
	}
	[HarmonyPatch(typeof(BulletWeapon))]
	internal class Inject_BulletWeapon
	{
		public static AutoReloadType AutoReload;

		[HarmonyPostfix]
		[HarmonyPatch("OnWield")]
		private static void Post_Wield(BulletWeapon __instance)
		{
			if (((Agent)((Item)__instance).Owner).IsLocallyOwned)
			{
				string name = ((GameDataBlockBase<ArchetypeDataBlock>)(object)((ItemEquippable)__instance).ArchetypeData).name;
				AutoReload = (name.Contains("[AlwaysFullClip]", StringComparison.OrdinalIgnoreCase) ? AutoReloadType.AlwaysFullClip : (name.Contains("[AutoReload]", StringComparison.OrdinalIgnoreCase) ? AutoReloadType.AutoReload : AutoReloadType.None));
				DoReload(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateAmmoStatus")]
		private static void Post_UpdateAmmoStatus(BulletWeapon __instance)
		{
			DoReload(__instance);
		}

		private static void DoReload(BulletWeapon weapon)
		{
			if (!((Agent)((Item)weapon).Owner).IsLocallyOwned)
			{
				return;
			}
			switch (AutoReload)
			{
			case AutoReloadType.AlwaysFullClip:
				((Item)weapon).Owner.Inventory.DoReload();
				break;
			case AutoReloadType.AutoReload:
				if (weapon.m_clip == 0 && ((PlayerInventoryBase)((Weapon)weapon).m_inventory).CanReloadCurrent())
				{
					((ItemEquippable)weapon).TryTriggerReloadAnimationSequence();
					if (((Item)weapon).Owner.Locomotion.IsRunning)
					{
						((Item)weapon).Owner.Locomotion.ChangeState((PLOC_State)0, false);
					}
				}
				break;
			}
		}
	}
	[BepInPlugin("GTFO_Eternal", "DE", "1.0.0")]
	public class Plugin : BasePlugin
	{
		public override void Load()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!");
			}
			log.LogInfo(val);
			Harmony.CreateAndPatchAll(typeof(BlockBooster), "BlockBooster");
			Harmony.CreateAndPatchAll(typeof(Inject_BulletWeapon), "Original plugin by Flow");
			Harmony.CreateAndPatchAll(typeof(Patch_WatermarkUpdateWatermark), "Watermark");
			Harmony.CreateAndPatchAll(typeof(AutoReloadType), "AutoReloadType");
		}
	}
	internal static class Patch_WatermarkUpdateWatermark
	{
		[HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")]
		[HarmonyPostfix]
		private static void Postfix(PUI_Watermark __instance)
		{
			string text = "4.6.1+gitf831086-dirty-main".Remove("x.x.x".Length);
			((TMP_Text)__instance.m_watermarkText).SetText("<color=red>MODDED</color> <color=orange>" + text + "</color>\n<color=#2e0000>GTFO Eternal</color> <color=orange>", true);
		}
	}
}