Decompiled source of ServalMod v1.0.0

MyFirstPlugin.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MyFirstPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin for BepInEx")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MyFirstPlugin")]
[assembly: AssemblyTitle("MyFirstPlugin")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ModelReplaceMod
{
	[BepInPlugin("com.kotokott.tfscout", "TF Scout Replace", "1.0.0")]
	public class TFScoutBase : BaseUnityPlugin
	{
		internal static TFScoutBase instance;

		internal ManualLogSource logger;

		internal static GameObject ScoutModel;

		private readonly Harmony harmony = new Harmony("com.kotokott.tfscout");

		private void Awake()
		{
			instance = this;
			logger = ((BaseUnityPlugin)this).Logger;
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "tfscout");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				logger.LogError((object)"КРИТИЧЕСКАЯ ОШИБКА: Не удалось загрузить бандл tfscout!");
				return;
			}
			ScoutModel = val.LoadAsset<GameObject>("Tf 2 scout");
			if ((Object)(object)ScoutModel == (Object)null)
			{
				logger.LogError((object)"ОШИБКА: Префаб не найден в бандле!");
				return;
			}
			logger.LogInfo((object)"Бандл и модель успешно загружены. Применяю патчи...");
			harmony.PatchAll();
		}
	}
	[HarmonyPatch(typeof(EnemyThinMan))]
	internal class EnemyThinManPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void Postfix(EnemyThinMan __instance)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			TFScoutBase.instance.logger.LogInfo((object)"Враг EnemyThinMan появился! Заменяю на Скаута...");
			if (!((Object)(object)TFScoutBase.ScoutModel == (Object)null))
			{
				Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>();
				foreach (Renderer val in componentsInChildren)
				{
					val.enabled = false;
				}
				GameObject val2 = Object.Instantiate<GameObject>(TFScoutBase.ScoutModel, ((Component)__instance).transform);
				val2.transform.localPosition = Vector3.zero;
				val2.transform.localRotation = Quaternion.identity;
				val2.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
				TFScoutBase.instance.logger.LogInfo((object)"Скаут успешно установлен на место врага!");
			}
		}
	}
}