using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEngine;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace HurricaneHammer
{
public class HammerMagazine : FVRFireArmMagazine
{
public GameObject SourceShellStack;
public void SyncShells()
{
if ((Object)(object)SourceShellStack != (Object)null && SourceShellStack.activeSelf != base.m_numRounds > 0)
{
SourceShellStack.SetActive(base.m_numRounds > 0);
}
}
public override void FVRUpdate()
{
((FVRFireArmMagazine)this).FVRUpdate();
SyncShells();
}
public override void Awake()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected I4, but got Unknown
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
FireArmRoundClass[] array = (FireArmRoundClass[])(object)new FireArmRoundClass[base.m_capacity];
FireArmRoundClass defaultRoundClass = AM.GetDefaultRoundClass(base.RoundType);
for (int i = 0; i < array.Length; i++)
{
array[i] = (FireArmRoundClass)(int)defaultRoundClass;
}
FVRMagazineLoadingPattern val = new FVRMagazineLoadingPattern();
val.Classes = array;
base.DefaultLoadingPattern = val;
((FVRFireArmMagazine)this).Awake();
}
}
public class HammerNativeAudio : MonoBehaviour
{
public OpenBoltReceiver Firearm;
public static void ApplyNativeHandling(FVRFirearmAudioSet target, FVRFirearmAudioSet donor)
{
FieldInfo[] fields = typeof(FVRFirearmAudioSet).GetFields(BindingFlags.Instance | BindingFlags.Public);
foreach (FieldInfo fieldInfo in fields)
{
if ((object)fieldInfo.FieldType == typeof(AudioEvent) && !fieldInfo.Name.StartsWith("Shots_") && !(fieldInfo.Name == "MagazineIn") && !(fieldInfo.Name == "MagazineOut") && !(fieldInfo.Name == "MagazineInsertRound") && !(fieldInfo.Name == "MagazineEjectRound") && !(fieldInfo.Name == "BoltSlideBackHeld") && !(fieldInfo.Name == "BoltSlideForwardHeld"))
{
fieldInfo.SetValue(target, fieldInfo.GetValue(donor));
}
}
}
private IEnumerator Start()
{
FVRObject entry = null;
for (int i = 0; i < 300; i++)
{
if (IM.OD != null && IM.OD.TryGetValue("AA12", out entry))
{
break;
}
yield return null;
}
if ((Object)(object)entry == (Object)null)
{
Debug.LogError((object)"HAMMER_AA12_AUDIO_DONOR_UNAVAILABLE");
yield break;
}
AnvilCallback<GameObject> request = ((AnvilAsset)entry).GetGameObjectAsync();
yield return request;
if ((Object)(object)request.Result == (Object)null)
{
yield break;
}
OpenBoltReceiver donor = request.Result.GetComponent<OpenBoltReceiver>();
if ((Object)(object)donor == (Object)null)
{
yield break;
}
ApplyNativeHandling(((FVRFireArm)Firearm).AudioClipSet, ((FVRFireArm)donor).AudioClipSet);
Debug.Log((object)"HAMMER_HANDLING_READY: bundled reload clips retained for gun and spare drums");
foreach (FVRObject compatibleMagazine in ((FVRPhysicalObject)donor).ObjectWrapper.CompatibleMagazines)
{
if ((Object)(object)compatibleMagazine != (Object)null && !((FVRPhysicalObject)Firearm).ObjectWrapper.CompatibleMagazines.Contains(compatibleMagazine))
{
((FVRPhysicalObject)Firearm).ObjectWrapper.CompatibleMagazines.Add(compatibleMagazine);
}
}
}
}
public class HammerReflex : MonoBehaviour
{
public Transform Muzzle;
public Transform Window;
public float ConvergenceDistance = 25f;
private MaterialPropertyBlock properties;
public void UpdateAim()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
if (!((Object)(object)Muzzle == (Object)null) && !((Object)(object)Window == (Object)null))
{
Vector3 val = Muzzle.position + Muzzle.forward * ConvergenceDistance;
Window.rotation = Quaternion.LookRotation(val - Window.position, ((Component)this).transform.up);
if (properties == null)
{
properties = new MaterialPropertyBlock();
}
properties.SetFloat("_ZeroDistance", Vector3.Distance(val, Window.position));
((Component)Window).GetComponent<Renderer>().SetPropertyBlock(properties);
}
}
private void LateUpdate()
{
UpdateAim();
}
}
}
namespace LocalTest.HurricaneHammerPrototype
{
[BepInPlugin("LocalTest.HurricaneHammerPrototype", "HurricaneHammerPrototype", "0.1.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HurricaneHammerPrototypePlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "LocalTest.HurricaneHammerPrototype");
OtherLoader.RegisterDirectLoad(BasePath, "LocalTest.HurricaneHammerPrototype", "", "", "hurricane_hammer", "");
}
}
}