Decompiled source of ToxicOmega ModPack v1.5.1

BepInEx/plugins/Invert_Hotbar.dll

Decompiled 3 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Invert_Hotbar.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Invert_Hotbar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Invert_Hotbar")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8869f55b-9f33-410d-bf4c-4326b79423d1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Invert_Hotbar
{
	[BepInPlugin("com.toxicomega.invert_hotbar", "Invert Hotbar Mod", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "com.toxicomega.invert_hotbar";

		private const string modName = "Invert Hotbar Mod";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("com.toxicomega.invert_hotbar");

		private static Plugin Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("com.toxicomega.invert_hotbar");
			mls.LogInfo((object)"Invert Hotbar mod has awoken.");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(HotbarInvertPatch));
		}
	}
}
namespace Invert_Hotbar.Patches
{
	internal class HotbarInvertPatch
	{
		[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> InvertHotbarScrollDirection(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 1; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ble_Un && list[i - 1].opcode == OpCodes.Ldc_R4 && (double)(float)list[i - 1].operand == 0.0)
				{
					list[i].opcode = OpCodes.Bge_Un;
					break;
				}
			}
			Plugin.mls.LogInfo((object)"ScrollMouse function has been patched.");
			return list.AsEnumerable();
		}
	}
}

BepInEx/plugins/ToxicOmega_Tweaks.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ToxicOmega_Tweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ToxicOmega_Tweaks")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c45438fb-d4c8-487c-9dd3-620b39cfc733")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ToxicOmega_Tweaks
{
	[BepInPlugin("com.toxicomega.toxicomega_tweaks", "ToxicOmega Tweaks", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "com.toxicomega.toxicomega_tweaks";

		private const string modName = "ToxicOmega Tweaks";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("com.toxicomega.toxicomega_tweaks");

		private static Plugin Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("com.toxicomega.toxicomega_tweaks");
			mls.LogInfo((object)"ToxicOmega Tweaks mod has awoken.");
			harmony.PatchAll();
		}
	}
}
namespace ToxicOmega_Tweaks.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerB_Patch
	{
		[HarmonyPatch("DamagePlayer")]
		[HarmonyPrefix]
		private static void DamagePlayer(ref int damageNumber)
		{
			damageNumber = (int)Math.Floor((double)damageNumber * 0.75);
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> LateUpdate(IEnumerable<CodeInstruction> instructions)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 1; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && (double)(float)list[i].operand == 1.25 && list[i + 1].opcode == OpCodes.Sub)
				{
					List<CodeInstruction> collection = new List<CodeInstruction>
					{
						new CodeInstruction(OpCodes.Ldc_R4, (object)0.5f),
						new CodeInstruction(OpCodes.Mul, (object)null)
					};
					list.InsertRange(i + 20, collection);
				}
				if (list[i].opcode == OpCodes.Ldc_R4 && (double)(float)list[i].operand == 4.0 && list[i - 1].opcode == OpCodes.Ldfld)
				{
					List<CodeInstruction> collection2 = new List<CodeInstruction>
					{
						new CodeInstruction(OpCodes.Ldc_R4, (object)3f),
						new CodeInstruction(OpCodes.Mul, (object)null)
					};
					list.InsertRange(i + 5, collection2);
					break;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyPrefix]
		private static bool LateUpdate()
		{
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && GameNetworkManager.Instance.localPlayerController.health < 50)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (localPlayerController.healthRegenerateTimer <= 0f)
				{
					localPlayerController.healthRegenerateTimer = 1f;
					localPlayerController.health++;
					if (localPlayerController.health >= 20)
					{
						localPlayerController.MakeCriticallyInjured(false);
					}
					HUDManager.Instance.UpdateHealthUI(localPlayerController.health, false);
					return true;
				}
				localPlayerController.healthRegenerateTimer -= Time.deltaTime;
			}
			return true;
		}

		[HarmonyPatch("ScrollMouse_performed")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PatchSwitchItemInterval(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.3f)
				{
					list[i].operand = 0.05f;
					break;
				}
			}
			return list.AsEnumerable();
		}
	}
}