using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; 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("OutwardModTemplate")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OutwardModTemplate")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace InfiniteDurability; [BepInPlugin("com.seunome.infinitedurability", "Infinite Durability", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ConfigEntry ModEnabled; internal static ConfigEntry WeaponMultiplier; internal static ConfigEntry ArmorMultiplier; internal static ConfigEntry LanternMultiplier; internal static ConfigEntry DefaultMultiplier; internal static ConfigEntry LanternLightEnabled; internal static ConfigEntry LanternIntensity; internal static ConfigEntry LanternRange; internal static ConfigEntry LanternColorR; internal static ConfigEntry LanternColorG; internal static ConfigEntry LanternColorB; private void Awake() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Expected O, but got Unknown ModEnabled = ((BaseUnityPlugin)this).Config.Bind("Activation", "Activate Mod", true, "Activates or deactivates the durability modifier mod."); WeaponMultiplier = ((BaseUnityPlugin)this).Config.Bind("Durability Multipliers", "Weapon Durability Multiplier", 0f, new ConfigDescription("Durability multiplier for weapons. 0 = infinite, 1 = normal, 2 = double loss.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); ArmorMultiplier = ((BaseUnityPlugin)this).Config.Bind("Durability Multipliers", "Armor Durability Multiplier", 0f, new ConfigDescription("Durability multiplier for armors. 0 = infinite, 1 = normal, 2 = double loss.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); LanternMultiplier = ((BaseUnityPlugin)this).Config.Bind("Durability Multipliers", "Lantern Durability Multiplier", 0f, new ConfigDescription("Durability multiplier for lanterns. 0 = infinite, 1 = normal, 2 = double loss.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); DefaultMultiplier = ((BaseUnityPlugin)this).Config.Bind("Durability Multipliers", "Other Items Durability Multiplier", 1f, new ConfigDescription("Durability multiplier for any other item. 0 = infinite, 1 = normal, 2 = double loss.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); LanternLightEnabled = ((BaseUnityPlugin)this).Config.Bind("Lantern Light", "Enable Lantern Light Modifier", false, "Activates or deactivates the lantern light modifier."); LanternIntensity = ((BaseUnityPlugin)this).Config.Bind("Lantern Light", "Light Intensity Multiplier", 1f, new ConfigDescription("Multiplies the lantern light intensity. 0 = no light, 1 = normal, 2 = double.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); LanternRange = ((BaseUnityPlugin)this).Config.Bind("Lantern Light", "Light Range Multiplier", 1f, new ConfigDescription("Multiplies the lantern light range. 0 = no range, 1 = normal, 2 = double.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); LanternColorR = ((BaseUnityPlugin)this).Config.Bind("Lantern Light", "Light Color R (Red)", 1f, new ConfigDescription("Red channel of the lantern light color. 0 = none, 1 = full.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); LanternColorG = ((BaseUnityPlugin)this).Config.Bind("Lantern Light", "Light Color G (Green)", 0.6f, new ConfigDescription("Green channel of the lantern light color. 0 = none, 1 = full.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); LanternColorB = ((BaseUnityPlugin)this).Config.Bind("Lantern Light", "Light Color B (Blue)", 0.2f, new ConfigDescription("Blue channel of the lantern light color. 0 = none, 1 = full.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); Harmony val = new Harmony("com.seunome.infinitedurability"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Infinite Durability loaded!"); } } [HarmonyPatch(typeof(Item), "ReduceDurability")] public class PatchReduceDurability { private static bool Prefix(Item __instance, ref float _durabilityLost) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 if (!Plugin.ModEnabled.Value) { return true; } if (__instance.IsIndestructible) { return true; } float num = ((__instance is Weapon) ? Plugin.WeaponMultiplier.Value : ((__instance is Armor) ? Plugin.ArmorMultiplier.Value : (((int)__instance.LitStatus == 2) ? Plugin.DefaultMultiplier.Value : Plugin.LanternMultiplier.Value))); if (num == 0f) { return false; } _durabilityLost *= num; return true; } } [HarmonyPatch(typeof(ItemLanternVisual), "Light")] public class PatchLanternLight { private static void Postfix(ItemLanternVisual __instance, bool _light) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ModEnabled.Value && Plugin.LanternLightEnabled.Value && _light) { Light lanternLight = __instance.LanternLight; if (!((Object)(object)lanternLight == (Object)null)) { lanternLight.intensity *= Plugin.LanternIntensity.Value; lanternLight.range *= Plugin.LanternRange.Value; lanternLight.color = new Color(Plugin.LanternColorR.Value, Plugin.LanternColorG.Value, Plugin.LanternColorB.Value); } } } }