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 JetBrains.Annotations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LavaDamage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LavaDamage")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eaad9041-7ae9-49e9-8539-6529b4460377")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Stollie.LavaDamage;
[BepInPlugin("stollie.mods.lava_damage", "LavaDamage", "1.0.0")]
public class LavaDamage : BaseUnityPlugin
{
[HarmonyPatch(typeof(Character), "UpdateHeatDamage")]
public static class Character_UpdateHeatDamage_Patch
{
public static void Prefix(Character __instance)
{
__instance.m_lavaFullDamage = _lavaDamage.Value;
}
}
public const string PluginId = "stollie.mods.lava_damage";
private Harmony _harmony;
private static LavaDamage _instance;
private static ConfigEntry<bool> _loggingEnabled;
private static ConfigEntry<float> _lavaDamage;
[UsedImplicitly]
private void Awake()
{
_instance = this;
_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "stollie.mods.lava_damage");
_loggingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "Logging Enabled", true, "Enable logging");
_lavaDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Lava Damage", "Lava Damage Amount", 100f, "Amount of Lava Damage Sustained - Vanilla is 100.0f");
((BaseUnityPlugin)this).Config.SettingChanged += Config_SettingChanged;
}
private void Config_SettingChanged(object sender, SettingChangedEventArgs e)
{
Log($"LavaDamage should now be {_lavaDamage.Value}");
}
public static void Log(string message)
{
if (_loggingEnabled.Value)
{
((BaseUnityPlugin)_instance).Logger.LogInfo((object)("LAVADAMAGE LOG: " + message));
}
}
public static void LogWarning(string message)
{
if (_loggingEnabled.Value)
{
((BaseUnityPlugin)_instance).Logger.LogWarning((object)("LAVADAMAGE LOG: " + message));
}
}
public static void LogError(string message)
{
if (_loggingEnabled.Value)
{
((BaseUnityPlugin)_instance).Logger.LogError((object)("LAVADAMAGE LOG: " + message));
}
}
[UsedImplicitly]
private void OnDestroy()
{
_instance = null;
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}