Decompiled source of Melanies NPCs v0.0.0

MelanieMeliciousNPCs.dll

Decompiled 8 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using MelanieMeliciousNPCs.NetcodePatcher;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
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("MelanieMeliciousNPC")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MelanieMelicious")]
[assembly: AssemblyProduct("Melanie's NPCs")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 MelMelNPCs
{
	public class HarmonyPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "SpawnSyncedProps")]
		private static void SpawnCompanyNPCs(RoundManager __instance)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (GameNetworkManager.Instance.isHostingGame && __instance.currentLevel.levelID == 3)
			{
				GameObject val = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/MelanieNPC/Prefab/MelMelNPC0.prefab"), new Vector3(-18f, -2.6f, -32.6f), Quaternion.identity, __instance.mapPropsContainer.transform);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		private static void NetworkPatch(ref GameNetworkManager __instance)
		{
			((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.bundle.LoadAsset<GameObject>("Assets/MelanieNPC/Prefab/MelMelNPC0.prefab"));
		}
	}
	[BepInPlugin("MelanieMelicious.NPCs", "MelanieMelicious - Melanie NPCs", "0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "MelanieMelicious.NPCs";

		private const string NAME = "MelanieMelicious - Melanie NPCs";

		private const string VERSION = "0.0.0";

		public const string NAMESPACE = "melanienpcs";

		private readonly Harmony harmony = new Harmony("MelanieMelicious.NPCs");

		public static AssetBundle bundle;

		public static Plugin instance;

		private void Awake()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "melanienpc");
			bundle = AssetBundle.LoadFromFile(text);
			harmony.PatchAll(typeof(HarmonyPatches));
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace MelanieMeliciousNPCs.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}