Decompiled source of SillyCheats v0.1.0

Silly Cheats.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using CheatsAPI;
using HarmonyLib;
using Notiffy.API;
using SillyCheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UKMod template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UKMod template")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d018c2f-f5bc-47be-a844-3e9888579d1f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class ExplodeOnShot : ICheat
{
	public static bool Active;

	public string LongName => "Explode Enemies on Hit";

	public string Identifier => "sillycheats.explodeonhit";

	public string ButtonEnabledOverride => null;

	public string ButtonDisabledOverride => null;

	public string Icon => "death";

	public bool IsActive => Active;

	public bool DefaultState => false;

	public StatePersistenceMode PersistenceMode => (StatePersistenceMode)0;

	public IEnumerator Coroutine(CheatsManager manager)
	{
		yield break;
	}

	public void Enable(CheatsManager manager)
	{
		Active = true;
	}

	public void Disable()
	{
		Active = false;
	}
}
public class FullestAutoCheat : ICheat
{
	public static bool Active;

	public string LongName => "Fullest Auto";

	public string Identifier => "sillycheats.fullestauto";

	public string ButtonEnabledOverride => null;

	public string ButtonDisabledOverride => null;

	public string Icon => "no-weapon-cooldown";

	public bool IsActive => Active;

	public bool DefaultState => false;

	public StatePersistenceMode PersistenceMode => (StatePersistenceMode)0;

	public IEnumerator Coroutine(CheatsManager manager)
	{
		yield break;
	}

	public void Enable(CheatsManager manager)
	{
		Active = true;
	}

	public void Disable()
	{
		Active = false;
	}
}
[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
public static class Patches
{
	private static GameObject explosionPrefab;

	private static bool loadStarted;

	public static void PreloadExplosionPrefab()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		if (!loadStarted)
		{
			loadStarted = true;
			AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Super.prefab");
			val.Completed += delegate(AsyncOperationHandle<GameObject> h)
			{
				explosionPrefab = h.Result;
			};
		}
	}

	[HarmonyPostfix]
	private static void Postfix(Vector3 hitPoint, bool fromExplosion, GameObject sourceWeapon)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (ExplodeOnShot.Active && !fromExplosion && !((Object)(object)sourceWeapon == (Object)null))
		{
			if ((Object)(object)explosionPrefab == (Object)null)
			{
				PreloadExplosionPrefab();
			}
			else
			{
				Object.Instantiate<GameObject>(explosionPrefab, hitPoint, Quaternion.identity);
			}
		}
	}
}
[HarmonyPatch("Update")]
public class FullestAutoPatches
{
	[HarmonyPatch(typeof(Revolver))]
	[HarmonyPrefix]
	public static bool RevolverPrefix(Revolver __instance)
	{
		if (!FullestAutoCheat.Active)
		{
			return true;
		}
		__instance.gunReady = true;
		__instance.shootReady = true;
		__instance.pierceShotCharge = 100f;
		__instance.coinCharge = 500f;
		__instance.anim.speed = 999f;
		return true;
	}

	[HarmonyPatch(typeof(Shotgun))]
	[HarmonyPrefix]
	public static bool ShotgunPrefix(Shotgun __instance)
	{
		if (!FullestAutoCheat.Active)
		{
			return true;
		}
		__instance.gunReady = true;
		__instance.anim.speed = 999f;
		return true;
	}

	[HarmonyPatch(typeof(Nailgun))]
	[HarmonyPrefix]
	public static bool NailgunPrefix(Nailgun __instance)
	{
		if (!FullestAutoCheat.Active)
		{
			return true;
		}
		__instance.fireCooldown = 0f;
		__instance.anim.speed = 999f;
		return true;
	}

	[HarmonyPatch(typeof(Railcannon))]
	[HarmonyPrefix]
	public static bool RailcannonPrefix(Railcannon __instance)
	{
		if (!FullestAutoCheat.Active)
		{
			return true;
		}
		__instance.wc.raicharge = 5f;
		__instance.anim.speed = 999f;
		return true;
	}

	[HarmonyPatch(typeof(RocketLauncher))]
	[HarmonyPrefix]
	public static bool RocketLauncherPrefix(RocketLauncher __instance)
	{
		if (!FullestAutoCheat.Active)
		{
			return true;
		}
		__instance.rateOfFire = 0f;
		__instance.anim.speed = 999f;
		__instance.cooldown = 0f;
		__instance.napalmProjectileCooldown = 0f;
		MonoSingleton<WeaponCharges>.Instance.rocketCannonballCharge = 1f;
		MonoSingleton<WeaponCharges>.Instance.rocketFreezeTime = 1f;
		MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel = 1f;
		return true;
	}

	[HarmonyPatch(typeof(ShotgunHammer))]
	[HarmonyPrefix]
	public static bool ShotgunHammerPrefix(ShotgunHammer __instance)
	{
		if (!FullestAutoCheat.Active)
		{
			return true;
		}
		__instance.gunReady = true;
		__instance.anim.speed = 999f;
		return true;
	}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Start")]
public static class SplitOnKillPatch
{
	private static readonly Dictionary<EnemyType, GameObject> templates = new Dictionary<EnemyType, GameObject>();

	[HarmonyPostfix]
	private static void Postfix(EnemyIdentifier __instance)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		if (!templates.ContainsKey(__instance.enemyType))
		{
			GameObject val = Object.Instantiate<GameObject>(((Component)__instance).gameObject);
			val.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)val);
			templates[__instance.enemyType] = val;
		}
		__instance.onDeath.AddListener((UnityAction)delegate
		{
			SplitOnKillLogic.TrySplit(__instance);
		});
	}

	public static bool TryGetTemplate(EnemyType type, out GameObject template)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return templates.TryGetValue(type, out template);
	}
}
public static class SplitOnKillLogic
{
	private class SplitCounter
	{
		public int Count;
	}

	private const float SplitChance = 0.5f;

	private const int SplitAmount = 2;

	private const int MaxSplitsPerLineage = 50;

	private static readonly ConditionalWeakTable<EnemyIdentifier, SplitCounter> lineageCounters = new ConditionalWeakTable<EnemyIdentifier, SplitCounter>();

	private static SplitCounter GetOrCreateCounter(EnemyIdentifier instance)
	{
		if (lineageCounters.TryGetValue(instance, out var value))
		{
			return value;
		}
		SplitCounter splitCounter = new SplitCounter();
		lineageCounters.Add(instance, splitCounter);
		return splitCounter;
	}

	public static void TrySplit(EnemyIdentifier instance)
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		if (!SplitOnKill.Active || Random.value > 0.5f)
		{
			return;
		}
		SplitCounter orCreateCounter = GetOrCreateCounter(instance);
		if (orCreateCounter.Count >= 50 || !SplitOnKillPatch.TryGetTemplate(instance.enemyType, out var template))
		{
			return;
		}
		for (int i = 0; i < 2; i++)
		{
			if (orCreateCounter.Count >= 50)
			{
				break;
			}
			GameObject val = Object.Instantiate<GameObject>(template, ((Component)instance).transform.position, ((Component)instance).transform.rotation);
			val.SetActive(true);
			EnemyIdentifier component = val.GetComponent<EnemyIdentifier>();
			if ((Object)(object)component != (Object)null)
			{
				component.dontCountAsKills = true;
				lineageCounters.Add(component, orCreateCounter);
			}
			orCreateCounter.Count++;
		}
	}

	private static string GetPrefabPath(EnemyIdentifier instance)
	{
		string text = Regex.Replace(((Object)((Component)instance).gameObject).name, "[1-9]", "");
		text = text.Replace(" ", "").Replace("(Clone)", "").Replace("()", "");
		return "Assets/Prefabs/Enemies/" + text + ".prefab";
	}
}
public class SuperSpeed : ICheat
{
	public string LongName => "Super Speed";

	public string Identifier => "sillycheats.superspeed";

	public string ButtonEnabledOverride => null;

	public string ButtonDisabledOverride => null;

	public string Icon => "clash";

	public bool IsActive { get; private set; }

	public bool DefaultState => false;

	public StatePersistenceMode PersistenceMode => (StatePersistenceMode)0;

	public void Enable(CheatsManager manager)
	{
		IsActive = true;
	}

	public void Disable()
	{
		IsActive = false;
		Time.timeScale = 1f;
	}

	public IEnumerator Coroutine(CheatsManager manager)
	{
		while (IsActive)
		{
			Time.timeScale = 5f;
			yield return null;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace SillyCheats
{
	public class SplitOnKill : ICheat
	{
		public static bool Active;

		public string LongName => "Split On Kill";

		public string Identifier => "sillycheats.splitkill";

		public string ButtonEnabledOverride => null;

		public string ButtonDisabledOverride => null;

		public string Icon => null;

		public bool IsActive => Active;

		public bool DefaultState => false;

		public StatePersistenceMode PersistenceMode => (StatePersistenceMode)0;

		public IEnumerator Coroutine(CheatsManager manager)
		{
			yield break;
		}

		public void Enable(CheatsManager manager)
		{
			Active = true;
		}

		public void Disable()
		{
			Active = false;
		}
	}
	public static class RandomizerEvents
	{
		private static readonly List<(string message, Action action)> events = new List<(string, Action)>
		{
			("Have another :3", DoDualWield),
			("Mind if i borrow that for a moment?", DoRandomizeWeapon),
			("An enemy has been executed!", DoKillRandomEnemy),
			("Health my beloved", DoOverheal),
			("I sure hope you like speed :^)", DoFullestAutoOn)
		};

		public static void TriggerRandomEvent()
		{
			(string, Action) tuple = events[Random.Range(0, events.Count)];
			tuple.Item2();
			NotificationSystem.NotifySend("Chaos Mode", tuple.Item1, (Sprite)null, "", (Urgency)1, "NotifySend", 0u, (Dictionary<string, string>)null, -1);
		}

		private static void DoDualWield()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			GunControl instance = MonoSingleton<GunControl>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				GameObject val = new GameObject();
				val.transform.SetParent(((Component)instance).transform, true);
				val.transform.localRotation = Quaternion.identity;
				val.transform.localPosition = Vector3.zero;
				DualWield val2 = val.AddComponent<DualWield>();
				val2.delay = 0.05f;
				val2.juiceAmount = 30f;
			}
		}

		private static void DoRandomizeWeapon()
		{
			GunControl instance = MonoSingleton<GunControl>.Instance;
			if ((Object)(object)instance == (Object)null || instance.slots.Count == 0)
			{
				return;
			}
			List<int> list = new List<int>();
			for (int i = 0; i < instance.slots.Count; i++)
			{
				if (instance.slots[i].Count > 0)
				{
					list.Add(i);
				}
			}
			if (list.Count != 0)
			{
				int num = list[Random.Range(0, list.Count)] + 1;
				int count = instance.slots[num - 1].Count;
				int value = Random.Range(0, count);
				instance.SwitchWeapon(num, (int?)value, false, false, false);
			}
		}

		private static void DoKillRandomEnemy()
		{
			List<EnemyIdentifier> currentEnemies = MonoSingleton<EnemyTracker>.Instance.GetCurrentEnemies();
			if (currentEnemies == null)
			{
				return;
			}
			List<EnemyIdentifier> list = new List<EnemyIdentifier>();
			foreach (EnemyIdentifier item in currentEnemies)
			{
				if ((Object)(object)item != (Object)null && !item.dead)
				{
					list.Add(item);
				}
			}
			if (list.Count != 0)
			{
				EnemyIdentifier val = list[Random.Range(0, list.Count)];
				val.InstaKill();
			}
		}

		private static void DoOverheal()
		{
			NewMovement instance = MonoSingleton<NewMovement>.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				instance.hp += 50;
			}
		}

		private static void DoFullestAutoOn()
		{
			FullestAutoCheat.Active = true;
		}
	}
	[BepInPlugin("com.nico.sillycheats", "Silly Cheats", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.nico.sillycheats";

		public const string PluginName = "Silly Cheats";

		public const string PluginVersion = "0.1.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Silly Cheats loaded!");
			Harmony val = new Harmony("com.nico.sillycheats");
			val.PatchAll();
			CheatInjector.RegisterCheats((ICheat[])(object)new ICheat[4]
			{
				new ExplodeOnShot(),
				new SuperSpeed(),
				new FullestAutoCheat(),
				new SplitOnKill()
			}, "silly cheats");
		}
	}
	public class Randomizer : ICheat
	{
		public string LongName => "Randomizer";

		public string Identifier => "sillycheats.randomizer";

		public string ButtonEnabledOverride => null;

		public string ButtonDisabledOverride => null;

		public string Icon => null;

		public bool IsActive { get; private set; }

		public bool DefaultState => false;

		public StatePersistenceMode PersistenceMode => (StatePersistenceMode)0;

		public void Enable(CheatsManager manager)
		{
			IsActive = true;
		}

		public void Disable()
		{
			IsActive = false;
		}

		public IEnumerator Coroutine(CheatsManager manager)
		{
			while (IsActive)
			{
				float wait = Random.Range(10f, 15f);
				yield return (object)new WaitForSeconds(wait);
				if (!IsActive)
				{
					break;
				}
				RandomizerEvents.TriggerRandomEvent();
			}
		}
	}
}