using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Jotunn.Managers; 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("PrimeWildlife")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PrimeWildlife")] [assembly: AssemblyTitle("PrimeWildlife")] [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 PrimeWildlife { [BepInPlugin("com.prime.wildlife", "Prime Wildlife", "0.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PrimeWildlifePlugin : BaseUnityPlugin { private Harmony _harmony; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown _harmony = new Harmony("com.prime.wildlife"); _harmony.PatchAll(typeof(PrimeWildlifePlugin).Assembly); PrefabManager.OnVanillaPrefabsAvailable += RegisterWildlife; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Prime Wildlife 0.2 loaded."); } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterWildlife; if (_harmony != null) { _harmony.UnpatchSelf(); } } private void RegisterWildlife() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterWildlife; RegisterClone("Boar", "PrimeBoar"); RegisterClone("Neck", "PrimeNeck"); } private void RegisterClone(string original, string custom) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = PrefabManager.Instance.CreateClonedPrefab(custom, original); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)(custom + ": source prefab not found: " + original)); return; } Character component = val.GetComponent(); if ((Object)(object)component == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)(custom + ": Character component missing.")); return; } component.m_faction = (Faction)3; PrefabManager.Instance.AddPrefab(val); ((BaseUnityPlugin)this).Logger.LogInfo((object)("REGISTERED " + custom + " (Undead faction; vanilla AI retained).")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)(custom + " registration failed: " + ex)); } } } [HarmonyPatch(typeof(BaseAI), "IsEnemy", new Type[] { typeof(Character), typeof(Character) })] internal static class MatchingWildlifeNeutrality { private static bool Prefix(Character a, Character b, ref bool __result) { if ((Object)(object)a == (Object)null || (Object)(object)b == (Object)null) { return true; } string a2 = CleanName(((Object)((Component)a).gameObject).name); string b2 = CleanName(((Object)((Component)b).gameObject).name); if (IsPair(a2, b2, "Boar", "PrimeBoar") || IsPair(a2, b2, "Neck", "PrimeNeck")) { __result = false; return false; } return true; } private static bool IsPair(string a, string b, string vanilla, string prime) { return (a == vanilla && b == prime) || (a == prime && b == vanilla); } private static string CleanName(string name) { return name.Replace("(Clone)", "").Trim(); } } }