using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.Kirshoo.MushroomsNOW")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("com.github.Kirshoo.MushroomsNOW")]
[assembly: AssemblyTitle("MushroomsNOW")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace MushroomsNOW
{
public enum ShroomColor
{
Red,
Yellow,
Green,
Blue,
Purple
}
public enum ShroomEffect
{
InfiniteStamina,
FasterBoi,
LowGravity,
Invincibility,
CureSome,
FartJump,
Blindness,
Ragdolls,
MoreSpores,
Numbness
}
public class Shroom
{
public ShroomColor color;
public ShroomEffect effect;
public float stamAmount;
}
[BepInPlugin("com.github.Kirshoo.MushroomsNOW", "MushroomsNOW", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal readonly List<Shroom> shrooms = new List<Shroom>();
private const int MushroomCount = 5;
private static GUIStyle? fontStyle = null;
private bool showShroomInfo;
internal static ConfigEntry<KeyCode> guiButton = null;
private static readonly List<string> mushroomEffectNames = new List<string> { "Infinite Stamina", "Faster Boi", "Low Gravity", "Invincibility", "Cure-Some", "Fart Jump", "Blindness", "Ragdolls", "More spores", "Numbness" };
public const string Id = "com.github.Kirshoo.MushroomsNOW";
internal static ManualLogSource Log { get; private set; } = null;
public static string Name => "MushroomsNOW";
public static string Version => "1.0.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
BindConfig();
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
}
public void BindConfig()
{
guiButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("MushroomsNow", "InfoToggle", (KeyCode)109, "When pressed, will toggle the on screen information about current effects of mushrooms.");
}
private void Start()
{
SceneManager.sceneLoaded += updateShroomEffects;
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)109))
{
showShroomInfo = !showShroomInfo;
}
}
private void OnGUI()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
if (!showShroomInfo)
{
return;
}
if (shrooms.Count == 0)
{
CreateLabelWithBorder(new Rect(25f, 25f, 200f, 20f), "No shroom information is available");
return;
}
for (int i = 0; i < shrooms.Count; i++)
{
Shroom shroom = shrooms[i];
CreateLabelWithBorder(new Rect(25f, 25f * (float)(i + 1), 400f, 25f), $"{shroom.color}: {mushroomEffectNames[(int)shroom.effect]}, {shroom.stamAmount * 100f}% stamina");
}
}
private void EnsureFont()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if (fontStyle == null)
{
fontStyle = new GUIStyle(GUI.skin.label);
fontStyle.fontSize = 16;
fontStyle.fontStyle = (FontStyle)1;
}
}
private void CreateLabelWithBorder(Rect rect, string text, int borderSize = 1)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
EnsureFont();
GUIStyle val = fontStyle;
val.normal.textColor = Color.black;
for (int i = -borderSize; i <= borderSize; i++)
{
for (int j = -borderSize; j <= borderSize; j++)
{
if (i != 0 || j != 0)
{
GUI.Label(new Rect(((Rect)(ref rect)).x + (float)i, ((Rect)(ref rect)).y + (float)j, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, val);
}
}
}
val.normal.textColor = Color.white;
GUI.Label(rect, text, val);
}
private void updateShroomEffects(Scene scene, LoadSceneMode mode)
{
shrooms.Clear();
if (((Scene)(ref scene)).name != "WillIsland" && !((Scene)(ref scene)).name.ToLowerInvariant().StartsWith("level"))
{
return;
}
MushroomManager instance = MushroomManager.instance;
if ((Object)(object)instance == (Object)null)
{
Log.LogError((object)"MushroomManager is not instantiated? Cannot predict the mushroom effects");
return;
}
for (int i = 0; i < instance.mushroomEffects.Length && i < 5; i++)
{
shrooms.Add(new Shroom
{
color = (ShroomColor)i,
effect = (ShroomEffect)instance.mushroomEffects[i],
stamAmount = (float)instance.mushroomStamAmt[i] * 0.05f
});
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}