using System;
using System.CodeDom.Compiler;
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.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Player;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ShowSentryAmmoPercentage")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ShowSentryAmmoPercentage")]
[assembly: AssemblyTitle("ShowSentryAmmoPercentage")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
namespace ShowSentryAmmoPercentage
{
[BepInPlugin("ShowSentryAmmoPercentage.GUID", "ShowSentryAmmoPercentage", "1.0.0")]
internal class EntryPoint : BasePlugin
{
private Harmony _Harmony;
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_Harmony = new Harmony("ShowSentryAmmoPercentage.Harmony");
_Harmony.PatchAll();
}
public override bool Unload()
{
_Harmony.UnpatchSelf();
return ((BasePlugin)this).Unload();
}
}
[HarmonyPatch]
internal static class Patch_SentryScreenAmmo
{
[HarmonyPostfix]
[HarmonyPatch(typeof(SentryGunFirstPerson), "OnBulletsUpdate")]
private static void Post_AmmoUpdate(SentryGunFirstPerson __instance, int bullets)
{
int bulletsMaxCap = PlayerBackpackManager.LocalBackpack.AmmoStorage.ClassAmmo.BulletsMaxCap;
float value = (float)bullets / (float)bulletsMaxCap;
if (__instance.m_screen != null)
{
__instance.m_screen.SetAmmo($"<size=75%><line-height=75%><u>{value:P0}</u>\n{bullets}</line-height></size>");
}
}
[HarmonyPostfix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static void Post_SetAmmo(SentryGunInstance __instance)
{
int value = Mathf.FloorToInt(__instance.m_ammo / __instance.CostOfBullet);
float value2 = __instance.Ammo / __instance.AmmoMaxCap;
if (__instance.m_screen != null)
{
__instance.m_screen.SetAmmo($"<size=75%><line-height=75%><u>{value2:P0}</u>\n{value}</line-height></size>");
}
}
}
[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "ShowSentryAmmoPercentage";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = null;
public const string SemVer = "1.0.0";
public const string GitRevShort = null;
public const string GitRevLong = null;
public const string GitBranch = null;
public const string GitTag = null;
public const int GitCommitsSinceTag = 0;
public const bool GitIsDirty = false;
}
}