Decompiled source of PROJECT AUDGOOF April Fools 2026 Archive v1.0.0

UserData/Mods/AUDGOOF 1.6.1 powerups.dll

Decompiled 15 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Combat;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using Il2CppTMPro;
using MelonLoader;
using Microsoft.CodeAnalysis;
using PunchPowerup;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "PunchPowerup", "1.0.0", "notnotnotswipez", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PunchPowerup")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PunchPowerup")]
[assembly: AssemblyTitle("PunchPowerup")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 PunchPowerup
{
	[RegisterTypeInIl2Cpp]
	public class CollidePowerComponent : MonoBehaviour
	{
		public bool chargedPunch = false;

		public bool grabbed = false;

		private GameObject nameCanvas;

		public CollidePowerComponent(IntPtr intPtr)
			: base(intPtr)
		{
		}

		public void Awake()
		{
			nameCanvas = MakeNameCanvas(((Component)this).transform, 0.002f, 0.5f, "Punch: Ready");
		}

		public void OnCollisionEnter(Collision collision)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (grabbed && !chargedPunch)
			{
				Vector3 impulse = collision.impulse;
				float magnitude = ((Vector3)(ref impulse)).magnitude;
				if (magnitude > 10f && Object.op_Implicit((Object)(object)collision.rigidbody) && (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponentInChildren<BehaviourBaseNav>()) || Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponentInChildren<RigidbodyProjectile>())) && DateTime.Now.Ticks - Core.lastValidSoundTime < TimeSpan.FromSeconds(0.20000000298023224).Ticks)
				{
					chargedPunch = true;
					Core.OnChargeState(newState: true);
				}
			}
		}

		public void Update()
		{
			if (!grabbed)
			{
				chargedPunch = false;
				Core.OnChargeState(newState: false);
			}
			nameCanvas.SetActive(chargedPunch);
		}

		private static GameObject MakeNameCanvas(Transform parent, float scale, float yAdd, string text)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Looker");
			GameObject val2 = new GameObject("NameCanvas");
			val2.transform.parent = val.transform;
			val2.transform.localPosition = Vector3.zero;
			val2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
			val.AddComponent<LookAtCameraContinuous>();
			Canvas val3 = val2.AddComponent<Canvas>();
			val3.renderMode = (RenderMode)2;
			val.transform.parent = parent;
			val.transform.localPosition = Vector3.zero;
			val.transform.position = val.transform.position + Vector3.up * yAdd;
			val2.transform.localScale = Vector3.one * scale;
			TextMeshProUGUI val4 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).text = text;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)4098;
			((TMP_Text)val4).enableAutoSizing = true;
			return val2;
		}
	}
	public class Core : MelonMod
	{
		public static List<string> allowedBarcodes = new List<string> { "c1534c5a-6d15-47c7-9ad4-b04156696b69", "c1534c5a-d30c-4c18-9f5f-7cfe54726173" };

		private static CollidePowerComponent leftHandComponent;

		private static CollidePowerComponent rightHandComponent;

		public static long lastValidSoundTime = 0L;

		public static bool prevChargeState = false;

		public override void OnInitializeMelon()
		{
			Hooking.OnGripAttached += Hooking_OnGripAttached;
			Hooking.OnGripDetached += Hooking_OnGripDetached;
		}

		public static void OnChargeState(bool newState)
		{
			if (newState != prevChargeState)
			{
				prevChargeState = newState;
				Player.RigManager.SwapAvatarCrate(((ScannableReference)Player.RigManager.AvatarCrate).Barcode, false, (Action<bool>)null);
			}
		}

		private void Hooking_OnGripDetached(Grip grip, Hand hand)
		{
			ValidateHandImpactProperties();
		}

		private void Hooking_OnGripAttached(Grip arg1, Hand arg2)
		{
			ValidateHandImpactProperties();
		}

		private void ValidateHandImpactProperties()
		{
			if (Object.op_Implicit((Object)(object)leftHandComponent))
			{
				leftHandComponent.grabbed = false;
			}
			if (Object.op_Implicit((Object)(object)rightHandComponent))
			{
				rightHandComponent.grabbed = false;
			}
			leftHandComponent = null;
			rightHandComponent = null;
			if (Object.op_Implicit((Object)(object)Player.LeftHand.AttachedReceiver))
			{
				Transform root = ((Component)Player.LeftHand.AttachedReceiver).transform.root;
				CollidePowerComponent collidePowerComponent = ((Component)root).GetComponent<CollidePowerComponent>();
				if (!Object.op_Implicit((Object)(object)collidePowerComponent))
				{
					collidePowerComponent = AddChildImpactProperties(root);
				}
				if (Object.op_Implicit((Object)(object)collidePowerComponent))
				{
					leftHandComponent = collidePowerComponent;
					leftHandComponent.grabbed = true;
				}
			}
			if (Object.op_Implicit((Object)(object)Player.RightHand.AttachedReceiver))
			{
				Transform root2 = ((Component)Player.RightHand.AttachedReceiver).transform.root;
				CollidePowerComponent collidePowerComponent2 = ((Component)root2).GetComponent<CollidePowerComponent>();
				if (!Object.op_Implicit((Object)(object)collidePowerComponent2))
				{
					collidePowerComponent2 = AddChildImpactProperties(root2);
				}
				if (Object.op_Implicit((Object)(object)collidePowerComponent2))
				{
					rightHandComponent = collidePowerComponent2;
					rightHandComponent.grabbed = true;
				}
			}
			if (Object.op_Implicit((Object)(object)leftHandComponent))
			{
				leftHandComponent.grabbed = true;
			}
			if (Object.op_Implicit((Object)(object)rightHandComponent))
			{
				rightHandComponent.grabbed = true;
			}
		}

		public bool HasChargeReady()
		{
			if (Object.op_Implicit((Object)(object)leftHandComponent) && leftHandComponent.chargedPunch)
			{
				return true;
			}
			if (Object.op_Implicit((Object)(object)rightHandComponent) && rightHandComponent.chargedPunch)
			{
				return true;
			}
			return false;
		}

		public static void RemoveCharges()
		{
			if (Object.op_Implicit((Object)(object)leftHandComponent))
			{
				leftHandComponent.chargedPunch = false;
			}
			if (Object.op_Implicit((Object)(object)rightHandComponent))
			{
				rightHandComponent.chargedPunch = false;
			}
			OnChargeState(newState: false);
		}

		private CollidePowerComponent AddChildImpactProperties(Transform parent)
		{
			Poolee componentInChildren = ((Component)parent).GetComponentInChildren<Poolee>();
			if (Object.op_Implicit((Object)(object)componentInChildren) && allowedBarcodes.Contains(((Scannable)componentInChildren.SpawnableCrate)._barcode._id))
			{
				return ((Component)parent).gameObject.AddComponent<CollidePowerComponent>();
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(AudioSource), "Play", new Type[] { })]
	public class AudioPlayPatch
	{
		public static void Postfix(AudioSource __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance.clip))
			{
				string text = ((Object)__instance.clip).name.ToLower();
				if (text == "impact_metal_barrel_big3" || text == "frying pan")
				{
					Core.lastValidSoundTime = DateTime.Now.Ticks;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Avatar), "RefreshBodyMeasurements", new Type[] { })]
	public class AvatarComputeStats
	{
		public static void Postfix(Avatar __instance)
		{
			if (Core.prevChargeState)
			{
				RigManager componentInParent = ((Component)__instance).GetComponentInParent<RigManager>();
				if (Object.op_Implicit((Object)(object)componentInParent) && ((Object)componentInParent).GetInstanceID() == ((Object)Player.RigManager).GetInstanceID() && !Object.op_Implicit((Object)(object)((Il2CppObjectBase)__instance).TryCast<RealHeptaAvatar>()))
				{
					__instance._strengthUpper *= 50f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(HandSFX), "PunchAttack", new Type[]
	{
		typeof(RelevantCollision),
		typeof(float),
		typeof(float)
	})]
	public class HandSFXPunchAttackPatch
	{
		public static void Postfix(RelevantCollision c, float impulse, float relVelSqr)
		{
			Core.RemoveCharges();
		}
	}
}