Decompiled source of PeakProteu v0.1.0

plugins/com.github.Proteuzada.Prots.dll

Decompiled 3 months ago
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.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.Proteuzada.Prots")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.github.Proteuzada.Prots")]
[assembly: AssemblyTitle("PeakProteu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 PeakProteu
{
	[BepInPlugin("com.Proteuzada.PeakProteu.Final", "Peak ModMenu by Proteu", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private bool showMenu;

		private bool infiniteStaminaEnabled;

		private Vector2 scrollPosition;

		private Dictionary<string, ushort> knownItems = new Dictionary<string, ushort>
		{
			{ "Revive", 67 },
			{ "First Aid Kit", 29 },
			{ "Banana Peel", 39 },
			{ "Lantern", 42 },
			{ "Backpack", 6 },
			{ "Rope Spool", 65 },
			{ "Energy Drink", 27 },
			{ "Bandages", 7 },
			{ "Binoculars", 14 },
			{ "Compass", 23 },
			{ "Fire Wood", 28 },
			{ "Flare", 32 },
			{ "Granola Bar", 33 },
			{ "Purple Baga", 40 },
			{ "Lollipop", 44 },
			{ "Marshmallow", 46 },
			{ "Pandora Box", 58 },
			{ "Heat Pack", 35 },
			{ "Antidote", 2 },
			{ "Climbing Spike", 18 },
			{ "Cure-All", 24 },
			{ "Stone", 72 }
		};

		internal static ManualLogSource Log { get; private set; }

		private void SpawnItemByID(ushort itemID)
		{
			//IL_0035: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Item val = default(Item);
				if ((Object)(object)Character.localCharacter == (Object)null)
				{
					Log.LogError((object)"Personagem local não encontrado para spawnar o item.");
				}
				else if (ItemDatabase.TryGetItem(itemID, ref val))
				{
					Vector3 val2 = ((Component)Character.localCharacter).transform.position + ((Component)Character.localCharacter).transform.forward * 1.5f;
					ItemDatabase.Add(val, val2);
					Log.LogInfo((object)$"Tentando spawnar o item: {((Object)val).name} (ID: {itemID})");
				}
				else
				{
					Log.LogError((object)$"Item com ID {itemID} não encontrado no ItemDatabase.");
				}
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Ocorreu um erro ao tentar spawnar o item com ID {itemID}: {arg}");
			}
		}

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Peak ModMenu by Proteu carregado! Pressione 'Insert' para abrir o menu.");
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)277))
			{
				showMenu = !showMenu;
			}
		}

		private void OnGUI()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (showMenu)
			{
				GUI.backgroundColor = Color.black;
				GUIStyle val = new GUIStyle(GUI.skin.window)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1
				};
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(10f, 10f, 300f, 350f);
				GUI.Window(0, val2, new WindowFunction(DrawMenuWindow), "Peak ModMenu by Proteu", val);
			}
		}

		private void DrawMenuWindow(int windowID)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Space(20f);
			bool flag = infiniteStaminaEnabled;
			infiniteStaminaEnabled = GUILayout.Toggle(infiniteStaminaEnabled, " Stamina Infinita", Array.Empty<GUILayoutOption>());
			if (flag != infiniteStaminaEnabled)
			{
				Character.InfiniteStamina();
			}
			GUILayout.Space(10f);
			GUILayout.Label("--- Spawnar Item ---", Array.Empty<GUILayoutOption>());
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(200f) });
			foreach (KeyValuePair<string, ushort> knownItem in knownItems)
			{
				if (GUILayout.Button(knownItem.Key, Array.Empty<GUILayoutOption>()))
				{
					SpawnItemByID(knownItem.Value);
				}
			}
			GUILayout.EndScrollView();
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Fechar", Array.Empty<GUILayoutOption>()))
			{
				showMenu = false;
			}
			GUI.DragWindow();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}