Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DurableBatteryArea v1.0.0
DurableBatteryArea.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DurableBatteryArea.Patches; 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("DurableBatteryArea")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DurableBatteryArea")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2ddfcb1a-b23e-4c2e-b28e-2211e58be5b8")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] public class DurableCrystalStateData { public float ChargeSegments { get; set; } public float ChargeRate { get; set; } public DurableCrystalStateData(float chargeSegments, float chargeRate) { ChargeSegments = chargeSegments; ChargeRate = chargeRate; } } public static class Log { public static ManualLogSource _logSource; static Log() { _logSource = Logger.CreateLogSource("Durable Battery Area"); } public static void LogInfo(object data) { _logSource.LogInfo(data); } public static void LogWarning(object data) { _logSource.LogWarning(data); } public static void LogError(object data) { _logSource.LogError(data); } public static void LogDebug(object data) { _logSource.LogDebug(data); } public static void LogFatal(object data) { _logSource.LogFatal(data); } public static void LogMessage(object data) { _logSource.LogMessage(data); } } namespace DurableBatteryArea { [BepInPlugin("upgame.REPO.DurableBatteryArea", "Durable Battery Area", "1.0.0")] public class PluginBase : BaseUnityPlugin { public const string PluginGUID = "upgame.REPO.DurableBatteryArea"; public const string PluginName = "Durable Battery Area"; public const string PluginVersion = "1.0.0"; private readonly Harmony _harmony = new Harmony("upgame.REPO.DurableBatteryArea"); private static PluginBase Instance; private ConfigEntry<bool> _energyEnable; private ConfigEntry<float> _multiplier; private static AcceptableValueRange<float> acceptableRange = new AcceptableValueRange<float>(0.5f, 5f); private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown if ((Object)Instance == (Object)null) { Instance = this; } Log.LogInfo("<更耐久的卡车电池>加载成功! Successfully loaded plugin: upgame.REPO.DurableBatteryArea!"); _energyEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("DurableCrystal", "Enable", false, "True is set to enable infinite energy."); _multiplier = ((BaseUnityPlugin)this).Config.Bind<float>("DurableCrystal", "PowerMultiplier", 2f, new ConfigDescription("PowerMultiplier indicates how many times greater the current crystal energy is compared to the vanilla. eg) value set to 2 then the crystal energy that was originally sufficient for one device can now power two devices.", (AcceptableValueBase)(object)acceptableRange, Array.Empty<object>())); _multiplier.Value = Mathf.Clamp(_multiplier.Value, 0.5f, 5f); _harmony.PatchAll(typeof(PluginBase)); _harmony.PatchAll(typeof(ChargingStation_Update_Patch)); Log.LogInfo((_energyEnable.Value ? "已启用无限电池!" : "已禁用无限电池,") + " " + (_energyEnable.Value ? "" : ("当前电池容量已扩容为原版的" + _multiplier.Value + "倍。"))); } public static bool GetEnable() { return Instance._energyEnable.Value; } public static float GetMultiplier() { return Instance._multiplier.Value; } } } namespace DurableBatteryArea.Patches { [HarmonyPatch(typeof(ChargingStation), "Update")] internal class ChargingStation_Update_Patch { private static void Prefix(out object __state, ref float ___chargeSegments, ref float ___chargeRate, ref float ___charge, int ___chargeInt) { __state = new DurableCrystalStateData(___chargeSegments, ___chargeRate); if (!PluginBase.GetEnable()) { float multiplier = PluginBase.GetMultiplier(); ___chargeSegments /= multiplier; ___chargeRate /= multiplier; } } private static void Postfix(object __state, ref float ___chargeSegments, ref float ___chargeRate, ref float ___charge, int ___chargeInt) { float num = ___chargeSegments; float num2 = ___chargeRate; if (PluginBase.GetEnable()) { ___charge = 6f; } else { float multiplier = PluginBase.GetMultiplier(); ___chargeSegments /= multiplier; ___chargeRate /= multiplier; } if (__state is DurableCrystalStateData durableCrystalStateData) { ___chargeSegments = durableCrystalStateData.ChargeSegments; ___chargeRate = durableCrystalStateData.ChargeRate; } } } }