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 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("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eff5117c-c508-4bed-97b7-ae18774fc548")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UnlimitedFuel;
[BepInPlugin("com.Odion30.UnlimitedFuel", "UnlimitedFuel", "1.1")]
public class UnlimitedFuel : BaseUnityPlugin
{
public const string MODNAME = "UnlimitedFuel";
public const string AUTHOR = "Odion30";
public const string GUID = "com.Odion30.UnlimitedFuel";
public const string VERSION = "1.1";
public static Mod_Config Mod_Config;
private static UnlimitedFuel context;
public void Awake()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
context = this;
Mod_Config = new Mod_Config(((BaseUnityPlugin)this).Config);
new Harmony("com.Odion30.UnlimitedFuel").PatchAll();
Object.DontDestroyOnLoad((Object)(object)this);
}
public static void Dbgl(string str = "", bool pref = true)
{
((BaseUnityPlugin)context).Logger.Log((LogLevel)32, (object)((pref ? (typeof(UnlimitedFuel).Namespace + " ") : "") + str));
}
}
[HarmonyPatch(typeof(Fireplace), "UpdateFireplace")]
public static class Fireplace_UpdateFireplace_Patch
{
public static void Prefix(Fireplace __instance, ZNetView ___m_nview)
{
if (!UnlimitedFuel.Mod_Config.Enabled)
{
return;
}
if (__instance.m_name.Contains("torch"))
{
if (UnlimitedFuel.Mod_Config.Fuel_Torches)
{
___m_nview.GetZDO().Set(ZDOVars.s_fuel, __instance.m_maxFuel);
}
}
else if (UnlimitedFuel.Mod_Config.Fuel_Fireplaces)
{
___m_nview.GetZDO().Set(ZDOVars.s_fuel, __instance.m_maxFuel);
}
}
}
[HarmonyPatch(typeof(Smelter), "UpdateSmelter")]
public static class Smelter_UpdateSmelter_Patch
{
public static void Prefix(Smelter __instance, ZNetView ___m_nview)
{
if (!UnlimitedFuel.Mod_Config.Enabled || !((float)__instance.m_maxFuel > 0f))
{
return;
}
if ((float)__instance.m_maxOre > 0f)
{
if (UnlimitedFuel.Mod_Config.Fuel_Smelter)
{
___m_nview.GetZDO().Set(ZDOVars.s_fuel, (float)__instance.m_maxFuel);
}
}
else if (UnlimitedFuel.Mod_Config.Fuel_Bathtub)
{
___m_nview.GetZDO().Set(ZDOVars.s_fuel, (float)__instance.m_maxFuel);
}
}
}
[HarmonyPatch(typeof(CookingStation), "UpdateCooking")]
public static class CookingStation_UpdateCooking_Patch
{
public static void Postfix(CookingStation __instance, ZNetView ___m_nview)
{
if (UnlimitedFuel.Mod_Config.Enabled && (float)__instance.m_maxFuel > 0f && UnlimitedFuel.Mod_Config.Fuel_Oven)
{
___m_nview.GetZDO().Set(ZDOVars.s_fuel, (float)__instance.m_maxFuel);
}
}
}
[HarmonyPatch(typeof(ShieldGenerator), "UpdateShield")]
public static class ShieldGenerator_UpdateShield_Patch
{
public static void Prefix(ShieldGenerator __instance, ZNetView ___m_nview)
{
if (UnlimitedFuel.Mod_Config.Enabled && UnlimitedFuel.Mod_Config.Fuel_Shield)
{
___m_nview.GetZDO().Set(ZDOVars.s_fuel, (float)__instance.m_maxFuel);
}
}
}
public class Mod_Config
{
public bool Enabled { get; set; }
public bool Fuel_Torches { get; private set; }
public bool Fuel_Fireplaces { get; private set; }
public bool Fuel_Oven { get; private set; }
public bool Fuel_Smelter { get; private set; }
public bool Fuel_Bathtub { get; private set; }
public bool Fuel_Shield { get; private set; }
public Mod_Config(ConfigFile Config)
{
Enabled = Config.Bind<bool>("General", "Enabled", true, "Enable this mod").Value;
Fuel_Torches = Config.Bind<bool>("General", "Torches", true, "Autofill Torches!").Value;
Fuel_Fireplaces = Config.Bind<bool>("General", "Fireplaces", true, "Autofill Fireplaces!").Value;
Fuel_Oven = Config.Bind<bool>("General", "Oven", true, "Autofill Oven!").Value;
Fuel_Smelter = Config.Bind<bool>("General", "Smelter", true, "Autofill Smelter!").Value;
Fuel_Bathtub = Config.Bind<bool>("General", "Bathtub", true, "Autofill Bathtub!").Value;
Fuel_Shield = Config.Bind<bool>("General", "Shield", true, "Autofill Shield!").Value;
}
}