using System;
using System.Collections.Generic;
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;
using UnityEngine.UI;
[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 ShermanJumbo.Helldivers_2_Ammo_and_Optics
{
[BepInPlugin("ShermanJumbo.Helldivers_2_Ammo_and_Optics", "Helldivers_2_Ammo_and_Optics", "1.0.6")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Helldivers_2_Ammo_and_OpticsPlugin : 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(), "ShermanJumbo.Helldivers_2_Ammo_and_Optics");
OtherLoader.RegisterDirectLoad(BasePath, "ShermanJumbo.Helldivers_2_Ammo_and_Optics", "", "shermanjumbo_helldivers2_ammo_optics", "", "");
}
}
}
namespace ShermanJumbo
{
public class ProjectileModeSwitchWithSounds : MonoBehaviour
{
public enum ProjMode
{
FirstMode,
SecondMode
}
public FVRFireArmRound ParentRound;
[Header("Mode Control")]
public List<string> ModeName;
public List<FireArmRoundClass> ModeClass;
public List<FVRObject> AltObjWrapper;
public ProjMode CurrentMode = ProjMode.FirstMode;
public FVRPooledAudioType Type = (FVRPooledAudioType)11;
public AudioEvent AudioEvent;
[Header("UI Display")]
public GameObject Canvas;
public Text DisplayText;
public void Update()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
FVRViveHand hand = ((FVRInteractiveObject)ParentRound).m_hand;
if ((Object)(object)hand != (Object)null)
{
if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f)
{
SwapMode();
}
if (hand.IsInStreamlinedMode && hand.Input.BYButtonDown)
{
SwapMode();
}
Canvas.gameObject.SetActive(true);
}
else
{
Canvas.gameObject.SetActive(false);
}
}
public void SwapMode()
{
//IL_0002: 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)
SM.PlayCoreSound(Type, AudioEvent, ((Component)this).transform.position);
if (CurrentMode == ProjMode.FirstMode)
{
CurrentMode = ProjMode.SecondMode;
}
else
{
CurrentMode = ProjMode.FirstMode;
}
UpdateMenu();
}
public void UpdateMenu()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)DisplayText != (Object)null)
{
DisplayText.text = ModeName[(int)CurrentMode];
}
ParentRound.RoundClass = ModeClass[(int)CurrentMode];
((FVRPhysicalObject)ParentRound).ObjectWrapper = AltObjWrapper[(int)CurrentMode];
}
}
public class TubeFedShotgunFakeAutoMagSwitcher : MonoBehaviour
{
public enum MagState
{
LeftMag,
RightMag
}
[Serializable]
public class FauxMag
{
public Transform LowerPathForward;
public Transform LowerPathRearward;
public Transform TrigPoint;
}
public FVRFireArmMagazine Magazine;
public TubeFedShotgun Shotgun;
public FVRFireArmMagazineReloadTrigger Trig;
public Transform Switch;
public List<FauxMag> FauxMags;
public MagState CurState;
private void Update()
{
if ((float)Magazine.m_numRounds < 8f)
{
CurState = MagState.RightMag;
}
else
{
CurState = MagState.LeftMag;
}
UpdateState();
}
private void UpdateState()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
if (CurState == MagState.LeftMag)
{
Shotgun.RoundPos_LowerPath_Forward.position = FauxMags[0].LowerPathForward.position;
Shotgun.RoundPos_LowerPath_Rearward.position = FauxMags[0].LowerPathRearward.position;
((Component)Trig).transform.position = FauxMags[0].TrigPoint.position;
((Component)Switch).transform.localEulerAngles = new Vector3(0f, 0f, 16f);
}
else if (CurState == MagState.RightMag)
{
Shotgun.RoundPos_LowerPath_Forward.position = FauxMags[1].LowerPathForward.position;
Shotgun.RoundPos_LowerPath_Rearward.position = FauxMags[1].LowerPathRearward.position;
((Component)Trig).transform.position = FauxMags[1].TrigPoint.position;
((Component)Switch).transform.localEulerAngles = new Vector3(0f, 0f, -16f);
}
}
}
}