Decompiled source of NyrZModpack v1.0.0

BepInEx/plugins/aedenthorn-Ammo Count-2273-0-5-1-1767252553.zip/AmmoCount.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6e6853a1c5a064e73250e5d0d397c361fa42d8a1")]
[assembly: AssemblyVersion("1.0.0.0")]
public class AedenthornUtils
{
	public static bool IgnoreKeyPresses(bool extra = false)
	{
		if (!extra)
		{
			int result;
			if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
			{
				Chat instance = Chat.instance;
				result = ((instance != null && instance.HasFocus()) ? 1 : 0);
			}
			else
			{
				result = 1;
			}
			return (byte)result != 0;
		}
		int result2;
		if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog())
		{
			Chat instance2 = Chat.instance;
			if ((instance2 == null || !instance2.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible())
			{
				TextViewer instance3 = TextViewer.instance;
				result2 = ((instance3 != null && instance3.IsVisible()) ? 1 : 0);
				goto IL_00d2;
			}
		}
		result2 = 1;
		goto IL_00d2;
		IL_00d2:
		return (byte)result2 != 0;
	}

	public static bool CheckKeyDown(string value)
	{
		try
		{
			return Input.GetKeyDown(value.ToLower());
		}
		catch
		{
			return false;
		}
	}

	public static bool CheckKeyHeld(string value, bool req = true)
	{
		try
		{
			return Input.GetKey(value.ToLower());
		}
		catch
		{
			return !req;
		}
	}
}
namespace AmmoCount;

[BepInPlugin("aedenthorn.AmmoCount", "Ammo Count", "0.5.0")]
public class BepInExPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(HotkeyBar), "Update")]
	public static class HotkeyBar_Update_Patch
	{
		public static void Postfix(HotkeyBar __instance, List<ItemData> ___m_items)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Expected O, but got Unknown
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			if (!modEnabled.Value || !Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			IEnumerable<object> enumerable = elementsAmmo.GetValue(__instance) as IEnumerable<object>;
			if (reset)
			{
				currentFont = GetFont(ammoStringFontName.Value, ammoStringSize.Value);
			}
			using (IEnumerator<object> enumerator = enumerable.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (enumerator.Current != null)
					{
						GameObject val = (GameObject)AccessTools.Field(enumerator.Current.GetType(), "m_go").GetValue(enumerator.Current);
						Transform val2 = val.transform.Find("AmmoCount");
						if ((Object)(object)val2 != (Object)null && (reset || !(bool)AccessTools.Field(enumerator.Current.GetType(), "m_used").GetValue(enumerator.Current)))
						{
							Object.Destroy((Object)(object)((Component)val2).gameObject);
						}
					}
				}
			}
			reset = false;
			for (int i = 0; i < ___m_items.Count(); i++)
			{
				int x = ___m_items[i].m_gridPos.x;
				if (x < 0 || x >= enumerable.Count() || enumerable.ElementAt(x) == null)
				{
					continue;
				}
				GameObject val3 = (GameObject)AccessTools.Field(enumerable.ElementAt(x).GetType(), "m_go").GetValue(enumerable.ElementAt(x));
				Transform val4 = val3.transform.Find("AmmoCount");
				if (val4 == null)
				{
					GameObject val5 = new GameObject("AmmoCount");
					val5.transform.SetParent(val3.transform);
					val5.AddComponent<RectTransform>().anchoredPosition = Vector2.zero;
					val4 = val5.transform;
					GameObject val6 = new GameObject("Text");
					val6.transform.SetParent(val5.transform);
					TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
					val6.GetComponent<RectTransform>().anchoredPosition = ammoStringPosition.Value;
					val6.GetComponent<RectTransform>().sizeDelta = new Vector2(90f, 90f);
					((TMP_Text)val7).font = currentFont;
					((TMP_Text)val7).fontSize = ammoStringSize.Value;
					((TMP_Text)val7).fontStyle = ammoStringFontStyle.Value;
					((TMP_Text)val7).alignment = ammoStringAlignment.Value;
					((Graphic)val7).color = ammoStringColor.Value;
					if (showIcon.Value)
					{
						GameObject val8 = new GameObject("Icon");
						val8.transform.SetParent(val5.transform);
						val8.AddComponent<Image>();
						val8.GetComponent<RectTransform>().anchoredPosition = iconPosition.Value;
						val8.GetComponent<RectTransform>().sizeDelta = iconSize.Value;
					}
				}
				CheckAmmo(___m_items[i], ((Component)val4).gameObject);
			}
		}

		public static void CheckAmmo(ItemData itemData, GameObject go)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			if (string.IsNullOrEmpty(itemData.m_shared.m_ammoType) || (int)itemData.m_shared.m_itemType == 9)
			{
				go.SetActive(false);
				return;
			}
			ItemData val = FindAmmo(itemData);
			if (val == null)
			{
				go.SetActive(false);
				return;
			}
			go.SetActive(true);
			if (!string.IsNullOrEmpty(ammoStringFormat.Value))
			{
				((TMP_Text)((Component)go.transform.Find("Text")).GetComponent<TextMeshProUGUI>()).text = ammoStringFormat.Value.Replace("{amount}", val.m_stack.ToString()).Replace("{name}", Localization.instance.Localize(val.m_shared.m_name));
			}
			if (showIcon.Value)
			{
				((Component)go.transform.Find("Icon")).GetComponent<Image>().sprite = val.GetIcon();
			}
		}

		public static ItemData FindAmmo(ItemData weapon)
		{
			if (string.IsNullOrEmpty(weapon.m_shared.m_ammoType))
			{
				return null;
			}
			ItemData val = ((Humanoid)Player.m_localPlayer).GetAmmoItem();
			if (val != null && (!((Humanoid)Player.m_localPlayer).GetInventory().ContainsItem(val) || val.m_shared.m_ammoType != weapon.m_shared.m_ammoType))
			{
				val = null;
			}
			if (val == null)
			{
				val = ((Humanoid)Player.m_localPlayer).GetInventory().GetAmmoItem(weapon.m_shared.m_ammoType, (string)null);
			}
			return val;
		}
	}

	[HarmonyPatch(typeof(Terminal), "InputText")]
	public static class InputText_Patch
	{
		public static bool Prefix(Terminal __instance)
		{
			if (!modEnabled.Value)
			{
				return true;
			}
			string text = ((TMP_InputField)__instance.m_input).text;
			if (text.ToLower().Equals(typeof(BepInExPlugin).Namespace.ToLower() + " reset"))
			{
				((BaseUnityPlugin)context).Config.Reload();
				((BaseUnityPlugin)context).Config.Save();
				currentFont = GetFont(ammoStringFontName.Value, ammoStringSize.Value);
				reset = true;
				Traverse.Create((object)__instance).Method("AddString", new object[1] { text }).GetValue();
				Traverse.Create((object)__instance).Method("AddString", new object[1] { ((BaseUnityPlugin)context).Info.Metadata.Name + " config reloaded" }).GetValue();
				return false;
			}
			return true;
		}
	}

	public static BepInExPlugin context;

	public Harmony harmony;

	public static ConfigEntry<bool> modEnabled;

	public static ConfigEntry<bool> isDebug;

	public static ConfigEntry<int> nexusID;

	public static ConfigEntry<bool> showIcon;

	public static ConfigEntry<Vector2> iconPosition;

	public static ConfigEntry<Vector2> iconSize;

	public static ConfigEntry<string> ammoStringFormat;

	public static ConfigEntry<int> ammoStringSize;

	public static ConfigEntry<string> ammoStringFontName;

	public static ConfigEntry<FontStyles> ammoStringFontStyle;

	public static ConfigEntry<TextAlignmentOptions> ammoStringAlignment;

	public static ConfigEntry<Color> ammoStringColor;

	public static ConfigEntry<Vector2> ammoStringPosition;

	public static FieldInfo elementsAmmo;

	public static TMP_FontAsset currentFont;

	public static bool reset = true;

	public static void Dbgl(object obj, LogLevel level = 32)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		if (isDebug.Value)
		{
			((BaseUnityPlugin)context).Logger.Log(level, obj);
		}
	}

	public void Awake()
	{
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: 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_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Expected O, but got Unknown
		context = this;
		modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
		isDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IsDebug", true, "Show debug messages");
		nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 2273, "Nexus mod ID for updates");
		showIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "ShowIcon", true, "Show Ammo Icon");
		iconPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("Options", "IconPosition", new Vector2(0f, 32f), "Icon position");
		iconSize = ((BaseUnityPlugin)this).Config.Bind<Vector2>("Options", "IconSize", new Vector2(20f, 20f), "Icon Size");
		ammoStringFormat = ((BaseUnityPlugin)this).Config.Bind<string>("Options", "AmmoTextFormat", "{amount}", "Ammo string. Use {amount} and/or {name}");
		ammoStringSize = ((BaseUnityPlugin)this).Config.Bind<int>("Options", "AmmoTextSize", 16, "Ammo count size.");
		ammoStringFontName = ((BaseUnityPlugin)this).Config.Bind<string>("Options", "AmmoStringFontName", "Norse", "Ammo count font");
		ammoStringFontStyle = ((BaseUnityPlugin)this).Config.Bind<FontStyles>("Options", "AmmoTextFontStyle", (FontStyles)1, "Ammo count font style");
		ammoStringAlignment = ((BaseUnityPlugin)this).Config.Bind<TextAlignmentOptions>("Options", "AmmoTextAlignment", (TextAlignmentOptions)260, "Ammo count alignment");
		ammoStringColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Options", "AmmoTextColor", new Color(1f, 1f, 1f, 1f), "Ammo count color");
		ammoStringPosition = ((BaseUnityPlugin)this).Config.Bind<Vector2>("Options", "AmmoTextPosition", new Vector2(-6f, -4f), "Ammo count position offset");
		elementsAmmo = AccessTools.Field(typeof(HotkeyBar), "m_elements");
		ammoStringFontName.SettingChanged += SettingChanged;
		showIcon.SettingChanged += SettingChanged;
		iconPosition.SettingChanged += SettingChanged;
		iconSize.SettingChanged += SettingChanged;
		ammoStringFormat.SettingChanged += SettingChanged;
		ammoStringSize.SettingChanged += SettingChanged;
		ammoStringFontStyle.SettingChanged += SettingChanged;
		ammoStringAlignment.SettingChanged += SettingChanged;
		ammoStringColor.SettingChanged += SettingChanged;
		ammoStringPosition.SettingChanged += SettingChanged;
		harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
		harmony.PatchAll();
	}

	public void SettingChanged(object sender, EventArgs e)
	{
		reset = true;
	}

	public void OnDestroy()
	{
		Dbgl("Destroying plugin", (LogLevel)32);
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchAll((string)null);
		}
	}

	public static TMP_FontAsset GetFont(string fontName, int fontSize)
	{
		try
		{
			TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
			TMP_FontAsset[] array2 = array;
			foreach (TMP_FontAsset val in array2)
			{
				Dbgl("got font " + ((Object)val).name, (LogLevel)32);
				if (((Object)val).name == fontName)
				{
					Dbgl("Matches", (LogLevel)32);
					return val;
				}
			}
		}
		catch
		{
		}
		return currentFont;
	}
}

BepInEx/plugins/aedenthorn-Discard Inventory Items-45-1-0-0-1739755617.zip/DiscardInventoryItem.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using TMPro;
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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bbc458827b0aa992d3c9a9749506f3403f21c5f4")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DiscardInventoryItem;

[BepInPlugin("aedenthorn.DiscardInventoryItem", "Discard or Recycle Inventory Items", "1.0.0")]
public class BepInExPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(InventoryGui), "UpdateItemDrag")]
	private static class UpdateItemDrag_Patch
	{
		private static void Postfix(InventoryGui __instance, ItemData ___m_dragItem, Inventory ___m_dragInventory, int ___m_dragAmount, ref GameObject ___m_dragGo)
		{
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Expected O, but got Unknown
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			if (!modEnabled.Value || !Input.GetKeyDown(hotKey.Value) || ___m_dragItem == null || !___m_dragInventory.ContainsItem(___m_dragItem))
			{
				return;
			}
			Dbgl($"Discarding {___m_dragAmount}/{___m_dragItem.m_stack} {((Object)___m_dragItem.m_dropPrefab).name}");
			if (returnResources.Value > 0f)
			{
				Recipe recipe = ObjectDB.instance.GetRecipe(___m_dragItem);
				if ((Object)(object)recipe != (Object)null && (returnUnknownResources.Value || Player.m_localPlayer.IsRecipeKnown(___m_dragItem.m_shared.m_name)))
				{
					Dbgl($"Recipe stack: {recipe.m_amount} num of stacks: {___m_dragAmount / recipe.m_amount}");
					List<Requirement> list = recipe.m_resources.ToList();
					bool flag = false;
					bool flag2 = false;
					if (epicLootAssembly != null && returnEnchantedResources.Value)
					{
						MethodInfo? method = epicLootAssembly.GetType("EpicLoot.ItemDataExtensions").GetMethod("IsMagic", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(ItemData) }, null);
						object[] parameters = (object[])(object)new ItemData[1] { ___m_dragItem };
						flag = (bool)method.Invoke(null, parameters);
					}
					if (flag)
					{
						MethodInfo? method2 = epicLootAssembly.GetType("EpicLoot.ItemDataExtensions").GetMethod("GetRarity", BindingFlags.Static | BindingFlags.Public);
						object[] parameters = (object[])(object)new ItemData[1] { ___m_dragItem };
						int num = (int)method2.Invoke(null, parameters);
						List<KeyValuePair<ItemDrop, int>> list2 = (List<KeyValuePair<ItemDrop, int>>)epicLootAssembly.GetType("EpicLoot.Crafting.EnchantHelper").GetMethod("GetEnchantCosts", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[2] { ___m_dragItem, num });
						foreach (KeyValuePair<ItemDrop, int> item in list2)
						{
							if (!returnUnknownResources.Value && ((Object.op_Implicit((Object)(object)ObjectDB.instance.GetRecipe(item.Key.m_itemData)) && !Player.m_localPlayer.IsRecipeKnown(item.Key.m_itemData.m_shared.m_name)) || !Traverse.Create((object)Player.m_localPlayer).Field("m_knownMaterial").GetValue<HashSet<string>>()
								.Contains(item.Key.m_itemData.m_shared.m_name)))
							{
								((Character)Player.m_localPlayer).Message((MessageType)2, "You don't know all the recipes for this item's materials.", 0, (Sprite)null);
								return;
							}
							list.Add(new Requirement
							{
								m_amount = item.Value,
								m_resItem = item.Key
							});
						}
					}
					if (!flag2 && ___m_dragAmount / recipe.m_amount > 0)
					{
						for (int i = 0; i < ___m_dragAmount / recipe.m_amount; i++)
						{
							foreach (Requirement req in list)
							{
								int quality = ___m_dragItem.m_quality;
								for (int num2 = quality; num2 > 0; num2--)
								{
									GameObject val = ((IEnumerable<GameObject>)ObjectDB.instance.m_items).FirstOrDefault((Func<GameObject, bool>)((GameObject item) => item.GetComponent<ItemDrop>().m_itemData.m_shared.m_name == req.m_resItem.m_itemData.m_shared.m_name));
									ItemData itemData = val.GetComponent<ItemDrop>().m_itemData.Clone();
									int num3 = Mathf.RoundToInt((float)req.GetAmount(num2) * returnResources.Value);
									Dbgl($"Returning {num3}/{req.GetAmount(num2)} {((Object)val).name}");
									while (num3 > 0)
									{
										int num4 = Mathf.Min(req.m_resItem.m_itemData.m_shared.m_maxStackSize, num3);
										num3 -= num4;
										if (((Humanoid)Player.m_localPlayer).GetInventory().AddItem(((Object)val).name, num4, req.m_resItem.m_itemData.m_quality, req.m_resItem.m_itemData.m_variant, 0L, "", false) == null)
										{
											ItemDrop component = Object.Instantiate<GameObject>(val, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward + ((Component)Player.m_localPlayer).transform.up, ((Component)Player.m_localPlayer).transform.rotation).GetComponent<ItemDrop>();
											component.m_itemData = itemData;
											component.m_itemData.m_dropPrefab = val;
											component.m_itemData.m_stack = num4;
											Traverse.Create((object)component).Method("Save", Array.Empty<object>()).GetValue();
										}
									}
								}
							}
						}
					}
				}
			}
			if (___m_dragAmount == ___m_dragItem.m_stack)
			{
				((Humanoid)Player.m_localPlayer).RemoveEquipAction(___m_dragItem);
				((Humanoid)Player.m_localPlayer).UnequipItem(___m_dragItem, false);
				___m_dragInventory.RemoveItem(___m_dragItem);
			}
			else
			{
				___m_dragInventory.RemoveItem(___m_dragItem, ___m_dragAmount);
			}
			Object.Destroy((Object)(object)___m_dragGo);
			___m_dragGo = null;
			((object)__instance).GetType().GetMethod("UpdateCraftingPanel", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(__instance, new object[1] { false });
		}
	}

	[HarmonyPatch(typeof(Terminal), "InputText")]
	private static class InputText_Patch
	{
		private static bool Prefix(Terminal __instance)
		{
			if (!modEnabled.Value)
			{
				return true;
			}
			string text = ((TMP_InputField)__instance.m_input).text;
			if (text.ToLower().Equals(typeof(BepInExPlugin).Namespace.ToLower() + " reset"))
			{
				((BaseUnityPlugin)context).Config.Reload();
				((BaseUnityPlugin)context).Config.Save();
				__instance.AddString(text);
				__instance.AddString(((BaseUnityPlugin)context).Info.Metadata.Name + " config reloaded");
				return false;
			}
			return true;
		}
	}

	private static readonly bool isDebug = true;

	public static ConfigEntry<string> hotKey;

	public static ConfigEntry<bool> modEnabled;

	public static ConfigEntry<bool> returnUnknownResources;

	public static ConfigEntry<bool> returnEnchantedResources;

	public static ConfigEntry<float> returnResources;

	public static ConfigEntry<int> nexusID;

	private static BepInExPlugin context;

	private static Assembly epicLootAssembly;

	public static void Dbgl(string str = "", bool pref = true)
	{
		if (isDebug)
		{
			Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str));
		}
	}

	private void Awake()
	{
		context = this;
		hotKey = ((BaseUnityPlugin)this).Config.Bind<string>("General", "DiscardHotkey", "delete", "The hotkey to discard an item");
		modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
		returnUnknownResources = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ReturnUnknownResources", false, "Return resources if recipe is unknown");
		returnEnchantedResources = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ReturnEnchantedResources", false, "Return resources for Epic Loot enchantments");
		returnResources = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ReturnResources", 1f, "Fraction of resources to return (0.0 - 1.0)");
		nexusID = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 45, "Nexus mod ID for updates");
		if (modEnabled.Value)
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}

	private void Start()
	{
		if (Chainloader.PluginInfos.ContainsKey("randyknapp.mods.epicloot"))
		{
			epicLootAssembly = ((object)Chainloader.PluginInfos["randyknapp.mods.epicloot"].Instance).GetType().Assembly;
		}
	}
}

BepInEx/plugins/q23345-Forever Build (beta)-35-1-2-1614124835.zip/ForeverBuild1.2BepInEx.dll

Decompiled a day ago
using System.Diagnostics;
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("bepinex modding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("bepinex modding")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f1bf6f40-be18-43a7-b8d0-e1572c5fdf2a")]
[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 ForeverBuild
{
	[BepInPlugin("lime.plugins.foreverbuild", "Forever Build", "1.2")]
	public class ForeverBuild : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(WearNTear), "UpdateSupport")]
		private static class RemoveSupportPatch
		{
			private static bool Prefix(ref float ___m_support, ref ZNetView ___m_nview)
			{
				___m_support = 500f;
				___m_nview.GetZDO().Set("support", ___m_support);
				return false;
			}
		}

		private void Awake()
		{
			Debug.Log((object)"Forever Build is here!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
}
namespace ForeverBuildinSlim
{
	public class ForeverBuild
	{
		[HarmonyPatch(typeof(WearNTear), "UpdateSupport")]
		private static class RemoveSupportPatch
		{
			private static void Postfix(ref float ___m_support, ref ZNetView ___m_nview)
			{
				___m_support = 500f;
				___m_nview.GetZDO().Set("support", ___m_support);
			}
		}

		private void Awake()
		{
			Debug.Log((object)"Forever Build is here!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
}