using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BeastSizeChangerV2;
using Il2Cpp;
using Il2CppFemur;
using Il2CppGB.Game.Critters;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
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", "2.0", "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 BeastSizeChangerV2
{
public class Mod : MelonMod
{
public static class BuildInfo
{
public const string Name = "BeastSizeChanger";
public const string Author = "konradKG25";
public const string Version = "2.0";
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 Vector3 FishSize = new Vector3(0.2f, 0.2f, 0.2f);
public bool SharksToMegalodons;
public bool SharksToFishes;
public bool Players = false;
public bool Birds = 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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 = MegaladonSize;
((Component)val).gameObject.SetActive(true);
}
if (SharksToFishes && ((Component)val).transform.localScale != FishSize)
{
Rigidbody[] array3 = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)val).GetComponentsInChildren<Rigidbody>());
((Component)val).gameObject.SetActive(false);
((Component)val).transform.localScale = FishSize;
Rigidbody[] array4 = array3;
foreach (Rigidbody val2 in array4)
{
val2.mass = 20f;
}
((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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: 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 V2");
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");
SharksToFishes = GUI.Toggle(new Rect(120f, 240f, 200f, 30f), SharksToFishes, "Sharks To Fishes");
Players = GUI.Toggle(new Rect(120f, 270f, 200f, 30f), Players, "Players");
Birds = GUI.Toggle(new Rect(120f, 300f, 200f, 30f), Birds, "Birds");
if (GUI.Button(new Rect(120f, 330f, 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($"Players: {Players}");
ChangeBeastSize();
}
else
{
MelonLogger.Warning("Invalid number entered!");
}
}
}
public void ChangeBeastSize()
{
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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(Actor.CachedActors.ToArray());
BirdActor[] array2 = Il2CppArrayBase<BirdActor>.op_Implicit(Object.FindObjectsOfType<BirdActor>(true));
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(beastSize, beastSize, beastSize);
if (!Birds)
{
Actor[] array3 = array;
foreach (Actor val2 in array3)
{
if (Players)
{
if (!val2.IsAI && ((Component)val2).transform.localScale != val)
{
((Component)val2).gameObject.SetActive(false);
((Component)val2).transform.localScale = val;
((Component)val2).gameObject.SetActive(true);
}
}
else if (!Players && val2.IsAI && ((Component)val2).transform.localScale != val)
{
((Component)val2).gameObject.SetActive(false);
((Component)val2).transform.localScale = val;
((Component)val2).gameObject.SetActive(true);
}
}
}
else if (Birds)
{
BirdActor[] array4 = array2;
foreach (BirdActor val3 in array4)
{
((Component)val3).gameObject.SetActive(false);
((Component)val3).transform.localScale = val;
((Component)val3).gameObject.SetActive(true);
}
}
if (!(beastSize > 1f))
{
return;
}
Rigidbody[] array5 = Il2CppArrayBase<Rigidbody>.op_Implicit(Object.FindObjectsOfType<Rigidbody>(true));
Rigidbody[] array6 = array5;
foreach (Rigidbody val4 in array6)
{
Enumerator<Actor> enumerator = Actor.CachedActors.GetEnumerator();
while (enumerator.MoveNext())
{
Actor current = enumerator.Current;
if (!((Component)val4).transform.IsChildOf(((Component)current).transform) && ((Object)((Component)val4).gameObject).name != "Trawler_Hull")
{
val4.mass = 30f;
if (((Object)((Component)val4).gameObject).name != "shark")
{
val4.mass = 20f;
}
}
}
}
}
}
}