Decompiled source of TF2 Scout In A Mental Asylum SFX and model v2.0.12

BepInEx/plugins/ScoutGhost.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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("ScoutGhost")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScoutGhost")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f4f463df-5f3f-42f2-bcba-826d1c3368d5")]
[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 Scout.Patches
{
	[HarmonyPatch]
	internal class EnemyTypes
	{
		public static GameObject ScoutModel;

		[HarmonyPatch(typeof(RoundManager), "BeginEnemySpawning")]
		[HarmonyPostfix]
		public static void ScoutModelTest(RoundManager __instance)
		{
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "scoutghost"));
			ScoutModel = val.LoadAsset<GameObject>("assets/scoutmodel/prefab/default.prefab");
			foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies)
			{
				if (!((Object)(object)enemy.enemyType != (Object)null) || !((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<DressGirlAI>() != (Object)null))
				{
					continue;
				}
				DressGirlAI component = enemy.enemyType.enemyPrefab.GetComponent<DressGirlAI>();
				if (!((Object)(object)((Component)component).gameObject.transform.Find("DressGirlModel") != (Object)null) || !((Object)(object)((Component)component).gameObject.transform.Find("DressGirlModel").Find("basemesh") != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("DressGirlModel").Find("basemesh")).gameObject != (Object)null) || !((Object)(object)((Component)((Component)component).gameObject.transform.Find("DressGirlModel").Find("basemesh")).gameObject.GetComponent<SkinnedMeshRenderer>() != (Object)null))
				{
					break;
				}
				Object.Destroy((Object)((Component)((Component)component).gameObject.transform.Find("DressGirlModel").Find("basemesh")).gameObject.GetComponent<SkinnedMeshRenderer>());
				ScoutModel.transform.SetParent(enemy.enemyType.enemyPrefab.transform, false);
				ScoutModel.transform.localPosition = new Vector3(0f, 0f, 0f);
				foreach (Transform item in ScoutModel.transform)
				{
					Transform val2 = item;
					((Component)ScoutModel.transform.Find("default_2")).tag = "DoNotSet";
					((Component)ScoutModel.transform.Find("default_1")).tag = "DoNotSet";
					((Component)ScoutModel.transform.Find("default_0")).tag = "DoNotSet";
				}
			}
		}
	}
}
namespace ScoutGhost
{
	[BepInPlugin("ScoutGhost", "ScoutGhost", "0.0.1")]
	internal class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string GUID = "bugp3tly.ScoutGhost";

			public const string NAME = "Scout Ghost";

			public const string VERSION = "0.0.1";

			public const string ASSET_BUNDLE_NAME = "myfirstassetbundles";
		}

		public Harmony harmonymain;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmonymain = new Harmony("ScoutGhost");
			harmonymain.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ScoutGhost Loaded.");
		}
	}
}