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 MoreEfficientChargingStation v1.0.2
plugins/yazirushi-MoreEfficientChargingStation/MoreEfficientChargingStation.dll
Decompiled a month agousing 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 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("MoreEfficientChargingStation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreEfficientChargingStation")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("fb73a4de-ee3c-435a-9712-e558bfdb6cae")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreEfficientChargingStation; [BepInPlugin("yazirushi.MoreEfficientChargingStation", "More Efficient ChargingStation", "1.0.2")] public class MoreEfficientChargingStation : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("yazirushi.MoreEfficientChargingStation"); internal static ManualLogSource mls; public static ConfigEntry<float> ChargeCostMultiplier; public static ConfigEntry<float> CrystalPriceMultiplier; public static ConfigEntry<bool> EnableLogging; private void Awake() { ChargeCostMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "ChargeCost Multiplier", 2f, "The higher the value, the longer the energy crystal lasts. Conversely, the lower the value, the shorter its duration. Negative values are not allowed."); CrystalPriceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "CrystalPrice Multiplier", 1f, "The higher the value, the more expensive the Energy Crystals become. Conversely, the lower the value, the cheaper they become. Negative values are not allowed."); EnableLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("ConsoleLog", "EnableLogging", false, "Enables the output of debug logs."); mls = ((BaseUnityPlugin)this).Logger; mls.LogInfo((object)"Starting MoreEfficientChargingStation..."); mls.LogInfo((object)$"MoreEfficientChargingStation:ChargeCostMultiplier = {ChargeCostMultiplier.Value:F2}"); mls.LogInfo((object)$"MoreEfficientChargingStation:CrystalPriceMultiplier = {CrystalPriceMultiplier.Value:F2}"); mls.LogInfo((object)$"MoreEfficientChargingStation:EnableLogging = {EnableLogging.Value}"); harmony.PatchAll(); } } [HarmonyPatch(typeof(ChargingStation), "Start")] public class Patch_ChargingStation { private static readonly FieldInfo fieldBatteryChargeCost = AccessTools.Field(typeof(ChargingStation), "batteryChargeCost"); private static void Postfix(ChargingStation __instance) { float value = MoreEfficientChargingStation.ChargeCostMultiplier.Value; value = Mathf.Max(value, 0.01f); float num = (float)fieldBatteryChargeCost.GetValue(__instance); float num2 = num / value; fieldBatteryChargeCost.SetValue(__instance, num2); if (MoreEfficientChargingStation.EnableLogging.Value) { MoreEfficientChargingStation.mls.LogInfo((object)$"MoreEfficientChargingStation config Multiplier:{value:F2}"); MoreEfficientChargingStation.mls.LogInfo((object)$"MoreEfficientChargingStation chargeCost Original:{num},Result:{num2}"); } } } [HarmonyPatch(typeof(ShopManager), "CrystalValueGet")] public class CrystalValuePatch { private static void Postfix(ref float __result) { if (MoreEfficientChargingStation.CrystalPriceMultiplier.Value != 1f) { float value = MoreEfficientChargingStation.CrystalPriceMultiplier.Value; value = Mathf.Max(value, 0.01f); float num = __result; __result *= value; __result = Mathf.Ceil(__result); __result = Mathf.Max(__result, 1f); if (MoreEfficientChargingStation.EnableLogging.Value) { MoreEfficientChargingStation.mls.LogInfo((object)$"MoreEfficientChargingStation config Multiplier:{value:F2}"); MoreEfficientChargingStation.mls.LogInfo((object)$"MoreEfficientChargingStation price Original:{num},Result:{__result}"); } } else if (MoreEfficientChargingStation.EnableLogging.Value) { MoreEfficientChargingStation.mls.LogInfo((object)"MoreEfficientChargingStation CrystalValuePatch skip"); } } }