Decompiled source of PocketEnemies v1.2.0

TinyEnemies.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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("TinyEnemies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinyEnemies")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8e337a40-3e71-4cfa-82d6-da35241827bd")]
[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 PocketEnemies;

[BepInPlugin("com.error.pocketenemies", "Pocket Enemies", "1.2.0")]
public class PocketEnemiesMod : BaseUnityPlugin
{
	public static ConfigEntry<bool> ModEnabled;

	public static ConfigEntry<float> EnemyScale;

	public static ConfigEntry<float> VoicePitch;

	private void Awake()
	{
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "Enable Mod", true, "Turn mod on/off.");
		EnemyScale = ((BaseUnityPlugin)this).Config.Bind<float>("1. General", "Enemy Size", 0.2f, "The tiny scale.");
		VoicePitch = ((BaseUnityPlugin)this).Config.Bind<float>("2. Audio", "Voice Pitch", 1.5f, "How squeaky they sound. (1.5 is chipmunk, 1.0 is normal)");
		Harmony val = new Harmony("com.error.pocketenemies");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Pocket Enemies with Squeaky Voices Loaded!");
	}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
public class EnemyPatch
{
	[HarmonyPostfix]
	private static void Postfix(EnemyIdentifier __instance)
	{
		//IL_0026: 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)
		if (PocketEnemiesMod.ModEnabled.Value)
		{
			float value = PocketEnemiesMod.EnemyScale.Value;
			Transform transform = ((Component)__instance).transform;
			transform.localScale *= value;
			((Component)__instance).gameObject.AddComponent<SqueakyVoiceLogic>();
		}
	}
}
public class SqueakyVoiceLogic : MonoBehaviour
{
	private float timer = 0f;

	private void Update()
	{
		timer += Time.deltaTime;
		if (timer > 0.5f)
		{
			timer = 0f;
			AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren<AudioSource>(true);
			AudioSource[] array = componentsInChildren;
			foreach (AudioSource val in array)
			{
				val.pitch = PocketEnemiesMod.VoicePitch.Value;
			}
		}
	}
}