using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Movement;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("DisplayGunStats")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0+f404df9102c60bced67a9a0123fcc2b86cf6732c")]
[assembly: AssemblyProduct("DisplayGunStats")]
[assembly: AssemblyTitle("DisplayGunStats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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;
}
}
}
[BepInPlugin("sparroh.displaygunstats", "DisplayGunStats", "1.1.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class GunDataDisplayMod : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.displaygunstats";
public const string PluginName = "DisplayGunStats";
public const string PluginVersion = "1.1.0";
private Harmony harmony;
private static Gun currentGun;
private static FieldInfo playerField;
private static PropertyInfo activeProp;
private float updateTimer;
private const float UpdateInterval = 0.5f;
private static bool hudEnabled = true;
private static readonly Color sky = new Color(0.529f, 0.808f, 0.922f);
private static readonly Color orchid = new Color(0.855f, 0.439f, 0.839f);
private static readonly Color rose = new Color(0.8901961f, 12f / 85f, 0.16862746f);
private static readonly Color macaroon = new Color(83f / 85f, 0.8784314f, 0.4627451f);
private static readonly Color shamrock = new Color(1f / 85f, 0.6745098f, 0.07450981f);
private GameObject hudContainer;
private TextMeshProUGUI titleText;
private TextMeshProUGUI[] statTexts;
private const int NUM_STAT_LINES = 25;
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("sparroh.displaygunstats").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"DisplayGunStats loaded successfully.");
playerField = typeof(Gun).GetField("player", BindingFlags.Instance | BindingFlags.NonPublic);
activeProp = typeof(IGear).GetProperty("Active");
}
private void CreateHUD()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Expected O, but got Unknown
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)hudContainer != (Object)null))
{
RectTransform reticle = Player.LocalPlayer.PlayerLook.Reticle;
hudContainer = new GameObject("GunStatsHUD");
hudContainer.transform.SetParent((Transform)(object)reticle, false);
RectTransform obj = hudContainer.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.18f, 1.08f);
obj.anchorMax = new Vector2(0.18f, 1.08f);
obj.anchoredPosition = new Vector2(0f, 0f);
obj.sizeDelta = new Vector2(350f, 400f);
GameObject val = new GameObject("TitleText");
val.transform.SetParent(hudContainer.transform, false);
titleText = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)titleText).fontSize = 18f;
((Graphic)titleText).color = Color.white;
((TMP_Text)titleText).enableWordWrapping = false;
((TMP_Text)titleText).alignment = (TextAlignmentOptions)513;
((TMP_Text)titleText).verticalAlignment = (VerticalAlignmentOptions)512;
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = new Vector2(1f, 0f);
component.anchoredPosition = new Vector2(0f, 0f);
component.sizeDelta = new Vector2(0f, 25f);
statTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[25];
for (int i = 0; i < 25; i++)
{
GameObject val2 = new GameObject($"StatText{i}");
val2.transform.SetParent(hudContainer.transform, false);
statTexts[i] = val2.AddComponent<TextMeshProUGUI>();
((TMP_Text)statTexts[i]).fontSize = 16f;
((Graphic)statTexts[i]).color = Color.white;
((TMP_Text)statTexts[i]).enableWordWrapping = false;
((TMP_Text)statTexts[i]).alignment = (TextAlignmentOptions)513;
((TMP_Text)statTexts[i]).verticalAlignment = (VerticalAlignmentOptions)512;
RectTransform component2 = val2.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = new Vector2(1f, 0f);
component2.anchoredPosition = new Vector2(0f, 0f - ((float)i * 18f + 25f));
component2.sizeDelta = new Vector2(0f, 18f);
}
}
}
private void UpdateHUD()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)hudContainer == (Object)null || (Object)(object)titleText == (Object)null || statTexts == null)
{
return;
}
RectTransform component = hudContainer.GetComponent<RectTransform>();
float num = 0f;
GameObject val = GameObject.Find("DamageMeterHUD");
if ((Object)(object)val != (Object)null && val.activeSelf)
{
num -= 100f;
}
GameObject val2 = GameObject.Find("SpeedometerHUD");
if ((Object)(object)val2 != (Object)null && val2.activeSelf)
{
num -= 25f;
}
component.anchoredPosition = new Vector2(0f, num);
if ((Object)(object)currentGun == (Object)null)
{
((TMP_Text)titleText).text = "No Gun Active";
for (int i = 0; i < statTexts.Length; i++)
{
((TMP_Text)statTexts[i]).text = "";
}
return;
}
IWeapon val3 = (IWeapon)(object)currentGun;
UpgradeStatChanges val4 = new UpgradeStatChanges();
ref GunData gunData = ref val3.GunData;
Dictionary<string, StatInfo> dictionary = new Dictionary<string, StatInfo>();
IEnumerator<StatInfo> enumerator = ((IGear)val3).EnumeratePrimaryStats(val4);
while (enumerator.MoveNext())
{
dictionary[enumerator.Current.name] = enumerator.Current;
}
Dictionary<string, StatInfo> dictionary2 = new Dictionary<string, StatInfo>();
IEnumerator<StatInfo> enumerator2 = ((IGear)val3).EnumerateSecondaryStats(val4);
while (enumerator2.MoveNext())
{
if (enumerator2.Current.name != "Aim Zoom")
{
dictionary2[enumerator2.Current.name] = enumerator2.Current;
}
}
List<string> lines = new List<string>();
lines.Add("Current Gun Stats:");
AddStatFromEnum(ref lines, dictionary2, "Damage");
AddStatFromEnum(ref lines, dictionary, "Damage Type");
AddStatFromEnum(ref lines, dictionary2, "Fire Rate");
lines.Add($"Burst Size: <color=#{ColorUtility.ToHtmlStringRGB(macaroon)}>{gunData.burstSize}</color>");
lines.Add("Burst Interval: <color=#" + ColorUtility.ToHtmlStringRGB(macaroon) + ">" + gunData.burstFireInterval.ToString("F2") + "</color>");
AddStatFromEnumWithCustomLabel(ref lines, dictionary2, "Ammo Capacity", "Magazine Size");
lines.Add($"Ammo Capacity: <color=#{ColorUtility.ToHtmlStringRGB(sky)}>{gunData.ammoCapacity}</color>");
AddStatFromEnum(ref lines, dictionary2, "Reload Duration");
AddStatFromEnum(ref lines, dictionary2, "Charge Duration");
lines.Add($"Explosion Size: <color=#{ColorUtility.ToHtmlStringRGB(orchid)}>{Mathf.Round(gunData.hitForce)}</color>");
AddStatFromEnum(ref lines, dictionary2, "Range");
lines.Add($"Recoil: <color=#{ColorUtility.ToHtmlStringRGB(shamrock)}>X({Mathf.Round(gunData.recoilData.recoilX.x)}, {Mathf.Round(gunData.recoilData.recoilX.y)}) Y({Mathf.Round(gunData.recoilData.recoilY.x)}, {Mathf.Round(gunData.recoilData.recoilY.y)})</color>");
lines.Add($"Spread: <color=#{ColorUtility.ToHtmlStringRGB(shamrock)}>Size({Mathf.Round(gunData.spreadData.spreadSize.x)}, {Mathf.Round(gunData.spreadData.spreadSize.y)})</color>");
lines.Add("Fire Mode: <color=#" + ColorUtility.ToHtmlStringRGB(macaroon) + ">" + ((gunData.automatic == 1) ? "Automatic" : "Semi Automatic") + "</color>");
((TMP_Text)titleText).text = lines[0];
for (int j = 1; j < lines.Count && j <= statTexts.Length; j++)
{
((TMP_Text)statTexts[j - 1]).text = lines[j];
}
for (int k = lines.Count - 1; k < statTexts.Length; k++)
{
((TMP_Text)statTexts[k]).text = "";
}
}
private void AddStatFromEnumWithCustomLabel(ref List<string> lines, Dictionary<string, StatInfo> stats, string statName, string displayLabel)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
if (stats.TryGetValue(statName, out var value))
{
string text = displayLabel + ":";
string value2 = value.value;
Color statValueColor = GetStatValueColor(statName);
lines.Add(text + " <color=#" + ColorUtility.ToHtmlStringRGB(statValueColor) + ">" + value2 + "</color>");
}
}
private void AddStatFromEnum(ref List<string> lines, Dictionary<string, StatInfo> stats, string statName)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
if (stats.TryGetValue(statName, out var value))
{
string text = value.name + ":";
string value2 = value.value;
Color val = ((value.name == "Damage Type") ? value.color : GetStatValueColor(value.name));
lines.Add(text + " <color=#" + ColorUtility.ToHtmlStringRGB(val) + ">" + value2 + "</color>");
}
}
private Color GetStatValueColor(string statName)
{
//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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
return (Color)(statName switch
{
"Damage" => rose,
"Fire Rate" => macaroon,
"Ammo Capacity" => sky,
"Reload Duration" => sky,
"Charge Duration" => sky,
"Range" => shamrock,
_ => Color.white,
});
}
private void Update()
{
if ((Object)(object)hudContainer == (Object)null && (Object)(object)Player.LocalPlayer != (Object)null && (Object)(object)Player.LocalPlayer.PlayerLook != (Object)null && (Object)(object)Player.LocalPlayer.PlayerLook.Reticle != (Object)null)
{
CreateHUD();
}
updateTimer += Time.deltaTime;
if (updateTimer >= 0.5f)
{
updateTimer = 0f;
UpdateCurrentGun();
UpdateHUD();
}
if (((ButtonControl)Keyboard.current.f9Key).wasPressedThisFrame)
{
hudEnabled = !hudEnabled;
if ((Object)(object)hudContainer != (Object)null)
{
hudContainer.SetActive(hudEnabled);
}
}
}
public static void UpdateCurrentGun()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if ((Object)(object)Player.LocalPlayer == (Object)null)
{
return;
}
Gun[] array = Object.FindObjectsOfType<Gun>();
foreach (Gun val in array)
{
if ((Object)(Player)playerField.GetValue(val) == (Object)(object)Player.LocalPlayer)
{
IGear obj = (IGear)(object)val;
if ((bool)activeProp.GetValue(obj))
{
currentGun = val;
return;
}
}
}
currentGun = null;
}
private void OnDestroy()
{
if ((Object)(object)hudContainer != (Object)null)
{
Object.Destroy((Object)(object)hudContainer);
}
harmony.UnpatchSelf();
}
}
[HarmonyPatch(typeof(Gun), "Enable")]
internal class GunEnablePatch
{
[HarmonyPostfix]
private static void Postfix(Gun __instance)
{
GunDataDisplayMod.UpdateCurrentGun();
}
}
[HarmonyPatch(typeof(Gun), "Disable")]
internal class GunDisablePatch
{
[HarmonyPostfix]
private static void Postfix(Gun __instance)
{
GunDataDisplayMod.UpdateCurrentGun();
}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
public const string AssemblySemFileVer = "0.0.1.0";
public const string AssemblySemVer = "0.0.1.0";
public const string BranchName = "master";
public const string BuildMetaData = "";
public const string CommitDate = "2025-10-17";
public const string CommitsSinceVersionSource = "1";
public const string EscapedBranchName = "master";
public const string FullBuildMetaData = "Branch.master.Sha.f404df9102c60bced67a9a0123fcc2b86cf6732c";
public const string FullSemVer = "0.0.1-1";
public const string InformationalVersion = "0.0.1-1+Branch.master.Sha.f404df9102c60bced67a9a0123fcc2b86cf6732c";
public const string Major = "0";
public const string MajorMinorPatch = "0.0.1";
public const string Minor = "0";
public const string Patch = "1";
public const string PreReleaseLabel = "";
public const string PreReleaseLabelWithDash = "";
public const string PreReleaseNumber = "1";
public const string PreReleaseTag = "1";
public const string PreReleaseTagWithDash = "-1";
public const string SemVer = "0.0.1-1";
public const string Sha = "f404df9102c60bced67a9a0123fcc2b86cf6732c";
public const string ShortSha = "f404df9";
public const string UncommittedChanges = "12";
public const string VersionSourceSha = "";
public const string WeightedPreReleaseNumber = "55001";
}
namespace DisplayGunStats
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DisplayGunStats";
public const string PLUGIN_NAME = "DisplayGunStats";
public const string PLUGIN_VERSION = "0.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}