Decompiled source of Edible Mushrooms Glow v2.0.0

PinkNonToxic/PinkMushroomMod.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PinkMushroomMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PinkMushroomMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("722cb149-1753-4361-832b-50d9752a79c2")]
[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 PinkMushroomMod;

[BepInPlugin("com.abi.peak.pinknontoxicmushrooms", "Pink Non-Toxic Mushrooms", "2.1.0")]
public class PinkNonToxicMushroomsMod : BaseUnityPlugin
{
	private class Marked : MonoBehaviour
	{
	}

	private void Start()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"\ud83c\udf38 Pink Mushroom Mod v2.1 gestartet!");
		((MonoBehaviour)this).InvokeRepeating("MarkNonToxicMushrooms", 10f, 10f);
	}

	private void MarkNonToxicMushrooms()
	{
		GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0);
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if ((Object)(object)val == (Object)null || (Object)(object)val.GetComponent<Marked>() != (Object)null)
			{
				continue;
			}
			Component component = val.GetComponent("Item");
			if ((Object)(object)component == (Object)null)
			{
				continue;
			}
			FieldInfo field = ((object)component).GetType().GetField("itemTags");
			if (field == null)
			{
				continue;
			}
			string text = field.GetValue(component)?.ToString();
			if (!string.IsNullOrEmpty(text) && text.ToLower().Contains("mushroom"))
			{
				if (text.ToLower().Contains("toxic") || text.ToLower().Contains("poisonous"))
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)("☠\ufe0f Toxic skipped: " + ((Object)val).name));
					continue;
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)("✅ Non-toxic mushroom found: " + ((Object)val).name));
				CreateBeam(val);
				CreateOutline(val);
				val.AddComponent<Marked>();
			}
		}
	}

	private void CreateBeam(GameObject target)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Expected O, but got Unknown
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		Bounds bounds = target.GetComponentInChildren<Renderer>().bounds;
		Vector3 center = ((Bounds)(ref bounds)).center;
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)2);
		((Object)val).name = "PinkLandmarkBeam";
		val.transform.SetParent((Transform)null);
		val.transform.position = center + Vector3.up * 5f;
		val.transform.rotation = Quaternion.identity;
		val.transform.localScale = new Vector3(0.25f, 5f, 0.25f);
		Component val2 = default(Component);
		if (val.TryGetComponent<Component>(ref val2) && ((object)val2).GetType().Name.Contains("Collider"))
		{
			Object.Destroy((Object)(object)val2);
		}
		Material val3 = new Material(Shader.Find("Standard"));
		val3.color = new Color(1f, 0f, 1f, 0.3f);
		val3.SetFloat("_Mode", 3f);
		val3.SetInt("_SrcBlend", 5);
		val3.SetInt("_DstBlend", 10);
		val3.SetInt("_ZWrite", 0);
		val3.DisableKeyword("_ALPHATEST_ON");
		val3.EnableKeyword("_ALPHABLEND_ON");
		val3.DisableKeyword("_ALPHAPREMULTIPLY_ON");
		val3.renderQueue = 3000;
		val.GetComponent<Renderer>().material = val3;
		Light val4 = val.AddComponent<Light>();
		val4.type = (LightType)2;
		val4.color = Color.magenta;
		val4.range = 8f;
		val4.intensity = 2f;
	}

	private void CreateOutline(GameObject target)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		Renderer[] componentsInChildren = target.GetComponentsInChildren<Renderer>();
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
			if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null))
			{
				GameObject val2 = new GameObject("PinkOutline");
				val2.transform.SetParent(((Component)val).transform, false);
				val2.transform.localPosition = Vector3.zero;
				val2.transform.localRotation = Quaternion.identity;
				val2.transform.localScale = Vector3.one * 1.05f;
				MeshFilter val3 = val2.AddComponent<MeshFilter>();
				val3.mesh = component.sharedMesh;
				MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
				Material val5 = new Material(Shader.Find("Unlit/Color"));
				val5.color = new Color(1f, 0f, 1f, 0.4f);
				((Renderer)val4).material = val5;
				((Renderer)val4).shadowCastingMode = (ShadowCastingMode)0;
				((Renderer)val4).receiveShadows = false;
			}
		}
	}
}