using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneworksAmmoHud;
using HarmonyLib;
using Il2CppSLZ.Bonelab;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "BoneworksAmmoHud", "1.0.0", "notnotnotswipez", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BoneworksAmmoHud")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BoneworksAmmoHud")]
[assembly: AssemblyTitle("BoneworksAmmoHud")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 BoneworksAmmoHud
{
public class Core : MelonMod
{
[HarmonyPatch(typeof(UI_HUD), "SHOWAMMO")]
public class ShowAmmoPatch
{
public static void Prefix(UI_HUD __instance, AmmoDisplayLocation ammoLocation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
if ((int)ammoLocation > 0)
{
ammoHud.SetActive(false);
return;
}
ammoHud.SetActive(true);
hudCopy.UIHudSetup();
}
}
public static GameObject ammoHud;
public static UI_HUD hudCopy;
public override void OnInitializeMelon()
{
Hooking.OnUIRigCreated += delegate
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
Transform parent = ((Component)Player.RigManager).transform.Find("PhysicsRig/Pelvis/BeltLf1/InventoryAmmoReceiver");
Transform transform = ((Component)UIRig.Instance).transform;
Transform val = Object.Instantiate<Transform>(transform.Find("PLAYERUI/HUD"));
Transform val2 = ((Component)val).transform.Find("scaleOffset");
val2.localPosition = Vector3.zero;
val2.localRotation = Quaternion.identity;
val2.localScale = Vector3.one * 0.9f;
Transform val3 = val2.Find("hud_Ammo");
val3.localPosition = Vector3.zero;
val3.localRotation = Quaternion.identity;
ammoHud = ((Component)val3).gameObject;
hudCopy = ((Component)val).GetComponent<UI_HUD>();
MelonCoroutines.Start(WaitAndEnableGO(((Component)val3).gameObject));
((Component)val).transform.parent = parent;
((Component)val).transform.localPosition = new Vector3(0.1472f, 0.1683f, 0.0419f);
((Component)val).transform.localEulerAngles = new Vector3(55.11f, 55.11f, 0f);
};
}
private IEnumerator WaitAndEnableGO(GameObject target)
{
for (int i = 0; i < 5; i++)
{
yield return null;
}
target.SetActive(true);
}
}
}