using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AIs; using BepInEx; using BepInEx.Logging; using Enums; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyCompany("SmallBonesHarvest")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Gives you bone needles when killing small animals")] [assembly: AssemblyTitle("SmallBonesHarvest")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 SmallBonesHarvest { public class OnHarvestPatch { [HarmonyPatch(typeof(DeadBody), "OnHarvest")] [HarmonyPrefix] private static bool Prefix(DeadBody __instance) { Plugin.OnHarvestEvent.Invoke(__instance); return false; } } [BepInPlugin("SmallBonesHarvest", "Gives you bone needles when killing small animals", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private ItemsManager IM; public static UnityEvent OnHarvestEvent = new UnityEvent(); private List harvestedAIIDs = new List(1) { (AIID)29 }; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); OnHarvestEvent.AddListener((UnityAction)delegate(DeadBody db) { OnHarvest(db); }); Logger.LogInfo((object)"Plugin SmallBonesHarvest is loaded!"); } private void Start() { IM = ItemsManager.Get(); } public void OnHarvest(DeadBody __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) AIID aIID = __instance.m_AIID; Logger.LogInfo((object)$"OnHarvest called for AIID: {aIID}"); if (harvestedAIIDs.Contains(aIID)) { Logger.LogInfo((object)$"Harvesting small bones for AIID: {aIID}"); Vector3 val = ((Component)__instance).transform.position + Vector3.up * 0.1f; IM.CreateItem((ItemID)316, true, val, Quaternion.identity); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "SmallBonesHarvest"; public const string PLUGIN_NAME = "Gives you bone needles when killing small animals"; public const string PLUGIN_VERSION = "1.0.0"; } }