using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Media;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using ValheimMod_StaminaHack.Properties;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ValheimMod_StaminaHack")]
[assembly: AssemblyDescription("BepInEx Plugin")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("sx66627")]
[assembly: AssemblyProduct("ValheimMod_StaminaHack")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2702c72b-538e-4bda-a508-2108f47532ce")]
[assembly: AssemblyFileVersion("0.3")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ValheimMod_StaminaHack
{
[BepInPlugin("sx66627.staminahack", "StaminaHack", "0.4")]
public class StaminaHack : BaseUnityPlugin
{
[HarmonyPatch(typeof(Player), "UseStamina")]
private class Stamina_patch
{
private static void Prefix(ref float ___m_stamina)
{
if (StaminaHackConfig.Value)
{
___m_stamina = 1000f;
}
}
}
public static ConfigEntry<bool> StaminaHackConfig;
public static ConfigEntry<KeyboardShortcut> StaminaHotkey;
public static ConfigEntry<int> NexusIDConfig;
private readonly Harmony harmony = new Harmony("sx66627.staminahack");
private void Awake()
{
ConfigDeploy();
harmony.PatchAll();
Debug.Log((object)$"StaminaHack activate: {StaminaHackConfig.Value}");
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
private void Update()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
KeyboardShortcut value = StaminaHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsUp())
{
if (StaminaHackConfig.Value)
{
StaminaHackConfig.Value = false;
Debug.Log((object)"StaminaHack is disabled with hotkey");
MessageHud.instance.ShowMessage((MessageType)1, "StaminaHack Deactivated", 0, (Sprite)null, false);
SoundPlayer val = new SoundPlayer((Stream)Resources.off);
val.Play();
((Component)val).Dispose();
}
else
{
StaminaHackConfig.Value = true;
Debug.Log((object)"StaminaHack is enabled with hotkey");
MessageHud.instance.ShowMessage((MessageType)1, "StaminaHack Activated", 0, (Sprite)null, false);
SoundPlayer val2 = new SoundPlayer((Stream)Resources.on);
val2.Play();
((Component)val2).Dispose();
}
}
}
public void ConfigDeploy()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
StaminaHackConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Enable Hack", "Stamina Hack", false, "Stamina Hack");
StaminaHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Input", "Stamina Hotkey", KeyboardShortcut.Deserialize("End"), "Hotkey for disable/enable stamina");
NexusIDConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Updates", "NexusID", 1957, "Nexus mod ID for updates.");
}
}
}
namespace ValheimMod_StaminaHack.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("ValheimMod_StaminaHack.Properties.Resources", typeof(Resources).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static UnmanagedMemoryStream off => ResourceManager.GetStream("off", resourceCulture);
internal static UnmanagedMemoryStream on => ResourceManager.GetStream("on", resourceCulture);
internal Resources()
{
}
}
}