using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using WK_huoyan1231COMLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("WK_UnlimitBackPack")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WK_UnlimitBackPack")]
[assembly: AssemblyTitle("WK_UnlimitBackPack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "huoyan1231.whiteknuckle.unlimitbackpack";
public const string PLUGIN_NAME = "WK_UnlimitBackPack";
public const string PLUGIN_VERSION = "1.0.0";
}
namespace WK_UnlimitBackPack
{
[BepInPlugin("huoyan1231.whiteknuckle.unlimitbackpack", "WK_UnlimitBackPack", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal const float UnlimitedCapacity = 1E+09f;
internal static ConfigEntry<bool> EnableUnlimitedBackpack;
internal static ConfigEntry<bool> DisableLeaderboardOnLoad;
private void Awake()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
EnableUnlimitedBackpack = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableUnlimitedBackpack", true, "When true, the backpack encumbrance soft-limit is removed so you can carry unlimited items with no movement/jump debuff.");
DisableLeaderboardOnLoad = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableLeaderboardOnLoad", true, "When true, this mod asks WK_huoyan1231COMLib to disable leaderboard score upload while it is loaded.");
new Harmony("huoyan1231.whiteknuckle.unlimitbackpack").PatchAll();
Logger.LogInfo((object)string.Format("[{0}] v{1} loaded. UnlimitedBackpack={2}, DisableLeaderboard={3}", "WK_UnlimitBackPack", "1.0.0", EnableUnlimitedBackpack.Value, DisableLeaderboardOnLoad.Value));
if (DisableLeaderboardOnLoad.Value)
{
DisableLeaderboardsForThisRun();
}
}
internal static void DisableLeaderboardsForThisRun()
{
try
{
LeaderboardManager.DisableForThisRun("huoyan1231.whiteknuckle.unlimitbackpack");
Logger.LogInfo((object)"[WK_UnlimitBackPack] Requested leaderboard disable via COMLib.");
}
catch (Exception ex)
{
Logger.LogWarning((object)("[WK_UnlimitBackPack] Failed to disable leaderboard via COMLib: " + ex.Message));
}
}
}
[HarmonyPatch(typeof(Inventory), "GetUnencumberanceAmount")]
internal static class Patch_UnlimitBackpack
{
private static bool Prefix(ref float __result)
{
if (Plugin.EnableUnlimitedBackpack.Value)
{
__result = 1E+09f;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(M_Gamemode), "StartFreshGamemode")]
internal static class Patch_DisableLeaderboardOnRunStart
{
private static void Postfix()
{
if (Plugin.DisableLeaderboardOnLoad.Value)
{
Plugin.DisableLeaderboardsForThisRun();
}
}
}
}