Decompiled source of BeastSizeChanger v1.0.3

BeastSizeChanger.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BeastSizeChanger;
using Il2Cpp;
using Il2CppFemur;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "BeastSizeChanger", "1.0.3", "konradKG25", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 BeastSizeChanger
{
	public class Mod : MelonMod
	{
		public static class BuildInfo
		{
			public const string Name = "BeastSizeChanger";

			public const string Author = "konradKG25";

			public const string Version = "1.0.3";

			public const string DownloadLink = null;
		}

		private bool showMenu = false;

		private string inputSize = "1.0";

		private float beastSize = 1f;

		public Vector3 MegaladonSize = new Vector3(2f, 2f, 2f);

		public bool SharksToMegalodons;

		public bool OnlyPlayers = false;

		public static Instance Logger => Melon<Mod>.Logger;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg(ConsoleColor.Green, "Mod Test initialized!");
		}

		public override void OnUpdate()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if (((ButtonControl)Keyboard.current.f8Key).wasReleasedThisFrame)
			{
				showMenu = !showMenu;
			}
			SharkActor[] array = Il2CppArrayBase<SharkActor>.op_Implicit(Object.FindObjectsOfType<SharkActor>(true));
			SharkActor[] array2 = array;
			foreach (SharkActor val in array2)
			{
				if (SharksToMegalodons && ((Component)val).transform.localScale != MegaladonSize)
				{
					((Component)val).gameObject.SetActive(false);
					((Component)val).transform.localScale = new Vector3(2f, 2f, 2f);
					((Component)val).gameObject.SetActive(true);
				}
			}
		}

		public override void OnGUI()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			if (!showMenu)
			{
				return;
			}
			GUI.Box(new Rect(100f, 100f, 250f, 250f), "Beast Size Changer");
			GUI.Label(new Rect(120f, 140f, 200f, 30f), "Enter Size:");
			inputSize = GUI.TextField(new Rect(120f, 170f, 200f, 30f), inputSize);
			SharksToMegalodons = GUI.Toggle(new Rect(120f, 210f, 200f, 30f), SharksToMegalodons, "Sharks To Megalodons");
			OnlyPlayers = GUI.Toggle(new Rect(120f, 240f, 200f, 30f), OnlyPlayers, "Only Player");
			if (GUI.Button(new Rect(120f, 280f, 200f, 30f), "Change Size"))
			{
				if (float.TryParse(inputSize, out var result))
				{
					beastSize = result;
					MelonLogger.Msg($"Beast Size changed to: {beastSize}");
					MelonLogger.Msg($"Sharks To Megalodons: {SharksToMegalodons}");
					MelonLogger.Msg($"Only Player: {OnlyPlayers}");
					ChangeBeastSize();
				}
				else
				{
					MelonLogger.Warning("Invalid number entered!");
				}
			}
		}

		public void ChangeBeastSize()
		{
			//IL_0066: 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)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			MelonLogger.Msg("Beast Size has been changed!");
			Actor[] array = Il2CppArrayBase<Actor>.op_Implicit(Object.FindObjectsOfType<Actor>(true));
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(beastSize, beastSize, beastSize);
			Actor[] array2 = array;
			foreach (Actor val2 in array2)
			{
				if (OnlyPlayers && !val2.IsAI && ((Component)val2).transform.localScale != val)
				{
					((Component)val2).gameObject.SetActive(false);
					((Component)val2).transform.localScale = val;
					((Component)val2).gameObject.SetActive(true);
				}
				if (!OnlyPlayers && val2.IsAI && ((Component)val2).transform.localScale != val)
				{
					((Component)val2).gameObject.SetActive(false);
					((Component)val2).transform.localScale = val;
					((Component)val2).gameObject.SetActive(true);
				}
			}
		}
	}
}