Decompiled source of StartWithFryingPan v1.0.0

StartWithFryingPan.dll

Decompiled 16 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPOStarterMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPOStarterMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fabb92f3-fcd9-4b44-843a-0797123892fb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(LevelGenerator), "PlayerSpawn")]
public static class PlayerSpawnPatch
{
	private static readonly HashSet<string> SpawnedForSteamIds = new HashSet<string>();

	private static void Postfix()
	{
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		if (SemiFunc.MenuLevel() || (Object)(object)GameDirector.instance == (Object)null || (Object)(object)StatsManager.instance == (Object)null || !SemiFunc.RunIsLevel() || (Object)(object)RunManager.instance == (Object)null)
		{
			return;
		}
		Item val = FindPanItem();
		if ((Object)(object)val == (Object)null || val.prefab == null || !val.prefab.IsValid())
		{
			Debug.LogWarning((object)"[PlayerSpawnPatch] Could not find a Frying Pan item to spawn.");
			return;
		}
		foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
		{
			if ((Object)(object)player == (Object)null)
			{
				continue;
			}
			Vector3 val2 = ((Component)player).transform.position + ((Component)player).transform.right * 0.75f + Vector3.up * 0.75f;
			Quaternion rotation = ((Component)player).transform.rotation;
			try
			{
				if ((Object)(object)GameManager.instance != (Object)null && GameManager.instance.gameMode != 0)
				{
					PhotonNetwork.InstantiateRoomObject(val.prefab.ResourcePath, val2, rotation, (byte)0, (object[])null);
				}
				else
				{
					Object.Instantiate<GameObject>(val.prefab.Prefab, val2, rotation);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[PlayerSpawnPatch] Failed to spawn Frying Pan: " + ex.Message));
			}
		}
	}

	private static Item FindPanItem()
	{
		Dictionary<string, Item> itemDictionary = StatsManager.instance.itemDictionary;
		if (itemDictionary.TryGetValue("Item Melee Frying Pan", out var value))
		{
			return value;
		}
		return null;
	}
}
[BepInPlugin("com.borenfenix.startwithfryingpan", "Start With Frying Pan", "1.0.0")]
public class StartWithFryingPanPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[StartWithFryingPan] Plugin loaded and initialized. ");
		Harmony val = new Harmony("com.borenfenix.startwithfryingpan");
		val.PatchAll();
	}
}