using System;
using System.Collections.Generic;
using System.Diagnostics;
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 TMPro;
using ULTRAKILL.Cheats;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BetterWeaponHUDs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("BetterWeaponHUDs")]
[assembly: AssemblyTitle("BetterWeaponHUDs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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 BetterWeaponHUDs
{
[HarmonyPatch]
internal static class GunDisplayPatches
{
[HarmonyPatch(typeof(HudController), "Awake")]
[HarmonyPostfix]
private static void Awake(HudController __instance)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("GunCanvasNew", new Type[5]
{
typeof(RectTransform),
typeof(Canvas),
typeof(CanvasScaler),
typeof(HUDPos),
typeof(CanvasGroup)
});
val.transform.SetParent(((Component)__instance).transform, false);
val.layer = LayerMask.NameToLayer("AlwaysOnTop");
Transform transform = val.transform;
Transform obj = ((transform is RectTransform) ? transform : null);
((RectTransform)obj).anchoredPosition3D = new Vector3(0.885f, -0.915f, 1f);
obj.localEulerAngles = new Vector3(0f, 30f, 0f);
obj.localScale = new Vector3(0.0007f, 0.001f, 0.001f);
HUDPos component = val.GetComponent<HUDPos>();
component.active = true;
component.reversePos = new Vector3(-1.52f, -1.025f, 1f);
component.reverseRot = new Vector3(0f, -30f, 0f);
__instance.weaponIcon.transform.SetParent(val.transform, false);
}
[HarmonyPatch(typeof(HudController), "Start")]
[HarmonyPostfix]
private static void Start(HudController __instance)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)__instance.speedometer.rect))
{
__instance.speedometer.rect.anchoredPosition = new Vector2(-79f, 190f);
}
}
[HarmonyPatch(typeof(HudController), "CheckSituation")]
[HarmonyPostfix]
private static void CheckSituation(HudController __instance)
{
GameObject weaponIcon = __instance.weaponIcon;
if (weaponIcon == null)
{
return;
}
Transform transform = weaponIcon.transform;
if (transform == null)
{
return;
}
Transform parent = transform.parent;
if (parent != null)
{
GameObject gameObject = ((Component)parent).gameObject;
if (gameObject != null)
{
gameObject.SetActive(!HideUI.Active && MonoSingleton<PrefsManager>.Instance.GetInt("hudType", 0) == 1);
}
}
}
[HarmonyPatch(typeof(HUDOptions), "WeaponIcon")]
[HarmonyPostfix]
private static void WeaponIcon(HudController[] ___hudCons)
{
CollectionExtensions.DoIf<HudController>((IEnumerable<HudController>)___hudCons, (Func<HudController, bool>)((HudController hudCon) => Object.op_Implicit((Object)(object)hudCon.speedometer.rect)), (Action<HudController>)delegate(HudController hudCon)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
hudCon.speedometer.rect.anchoredPosition = new Vector2(-79f, 190f);
});
}
[HarmonyPatch(typeof(RailcannonMeter), "CheckStatus")]
[HarmonyPostfix]
private static void RailcannonMeter_CheckStatus(RailcannonMeter __instance)
{
if (MonoSingleton<PrefsManager>.Instance.GetBool("weaponIcons", false) && !HudController.Instance.altHud)
{
((Behaviour)Traverse.Create((object)__instance).Field("self").GetValue<Image>()).enabled = false;
__instance.miniVersion.SetActive(true);
}
}
}
[HarmonyPatch]
internal static class HPDisplayPatches
{
[HarmonyPatch(typeof(NewMovement), "Awake")]
[HarmonyPostfix]
private static void Awake(NewMovement __instance)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("AntiHPText", new Type[5]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(HealthBar),
typeof(TextMeshProUGUI),
typeof(ColorBlindGet)
});
val.transform.SetParent(__instance.screenHud.transform.Find("GunCanvas/StatsPanel/Filler/Panel (2)/Filler"), false);
Transform transform = val.transform;
Transform obj = ((transform is RectTransform) ? transform : null);
((RectTransform)obj).anchoredPosition3D = new Vector3(12f, 0f, 0f);
((RectTransform)obj).sizeDelta = new Vector2(155f, 15f);
HealthBar component = val.GetComponent<HealthBar>();
component.antiHpText = true;
component.hpSliders = Array.Empty<Slider>();
component.hpText = (TMP_Text)(object)val.GetComponent<TextMeshProUGUI>();
ColorBlindGet component2 = val.GetComponent<ColorBlindGet>();
component2.hct = (HudColorType)4;
component2.UpdateColor();
TextMeshProUGUI component3 = val.GetComponent<TextMeshProUGUI>();
((TMP_Text)component3).alignment = (TextAlignmentOptions)4100;
((TMP_Text)component3).characterSpacing = -10f;
((TMP_Text)component3).enableAutoSizing = true;
((TMP_Text)component3).font = Addressables.LoadAssetAsync<TMP_FontAsset>((object)"Assets/Fonts/VCR_OSD_MONO_1.asset").WaitForCompletion();
((TMP_Text)component3).fontMaterial = Addressables.LoadAssetAsync<Material>((object)"Assets/Fonts/VCR_OSD_MONO Overlay.mat").WaitForCompletion();
((TMP_Text)component3).fontStyle = (FontStyles)1;
((TMP_Text)component3).verticalAlignment = (VerticalAlignmentOptions)4096;
((Graphic)component3).raycastTarget = false;
}
}
[BepInPlugin("BetterWeaponHUDs", "BetterWeaponHUDs", "1.1.1")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("BetterWeaponHUDs").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterWeaponHUDs is loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "BetterWeaponHUDs";
public const string PLUGIN_NAME = "BetterWeaponHUDs";
public const string PLUGIN_VERSION = "1.1.1";
}
}