Decompiled source of FriendlyDvergrs v1.0.0

FriendlyDvergrs.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("FriendlyDvergrs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FriendlyDvergrs")]
[assembly: AssemblyTitle("FriendlyDvergrs")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 FriendlyDvergrs
{
	[BepInPlugin("com.kolyn.friendlydvergrs", "Friendly Dvergrs", "1.0.0")]
	public sealed class FriendlyDvergrsPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.kolyn.friendlydvergrs";

		public const string PluginName = "Friendly Dvergrs";

		public const string PluginVersion = "1.0.0";

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("com.kolyn.friendlydvergrs");
			_harmony.PatchAll();
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch(typeof(BaseAI), "SetAggravated")]
	internal static class BaseAISetAggravatedPatch
	{
		private static void Prefix(BaseAI __instance, ref bool aggro)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			if (aggro)
			{
				Character component = ((Component)__instance).GetComponent<Character>();
				if ((Object)(object)component != (Object)null && (int)component.GetFaction() == 10)
				{
					aggro = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(BaseAI), "IsEnemy", new Type[] { typeof(Character) })]
	internal static class BaseAIIsEnemyPatch
	{
		private static bool Prefix(BaseAI __instance, Character other, ref bool __result)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			Character component = ((Component)__instance).GetComponent<Character>();
			if ((Object)(object)component != (Object)null && (Object)(object)other != (Object)null && (int)component.GetFaction() == 10 && other.IsPlayer())
			{
				__result = false;
				return false;
			}
			return true;
		}
	}
}