Decompiled source of FrequentWeaponSpawns v1.0.0

FrequentWeaponSpawns.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FrequentWeaponSpawns")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FrequentWeaponSpawns")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b1fcc204-0b03-4522-a313-06980a1d3234")]
[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")]
public class FrequentGrenadeSpawns : MonoBehaviour
{
	private void OnEnable()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)("Scene " + ((Scene)(ref scene)).name + " loaded. Adding grenade spawns."));
		GameObject[] array = Object.FindObjectsOfType<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (!((Object)(object)val == (Object)null) && (((Object)val).name.Contains("SpawnPoint") || ((Object)val).name.Contains("ItemSpawn")) && Random.value < 0.5f)
			{
				GameObject val2 = FindPrefabByName("Fart Grenade");
				if ((Object)(object)val2 != (Object)null)
				{
					Vector3 val3 = val.transform.position + Random.insideUnitSphere * 2f;
					GameObject val4 = Object.Instantiate<GameObject>(val2, val3, Quaternion.identity);
					Debug.Log((object)string.Format("Spawned {0} at {1}", "Fart Grenade", val3));
				}
				else
				{
					Debug.LogWarning((object)"Prefab Fart Grenade not found!");
				}
			}
		}
	}

	private GameObject FindPrefabByName(string name)
	{
		GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if ((Object)(object)val != (Object)null && ((Object)val).name.Equals(name, StringComparison.OrdinalIgnoreCase))
			{
				return val;
			}
		}
		return null;
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "com.yourname.frequentgrenadespawns";

	public const string PLUGIN_NAME = "FrequentGrenadeSpawns";

	public const string PLUGIN_VERSION = "1.0.0";
}