using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MalorianCode")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MalorianCode")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b9b63cac-1c1d-40c4-8f6e-11274edf9b9a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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 Cityrobo
{
public class MalorianAnimationController : MonoBehaviour
{
private enum EBoltPos
{
Forward,
ForwardToEject,
Eject,
EjectToStartChambering,
StartChambering,
ChamberingToLocked,
Locked,
LockedToRear,
Rear
}
private class ProxyInfo
{
public FVRFireArmChamber Chamber;
public FVRFirearmMovingProxyRound Proxy;
public Transform Parent;
public float CurrentBoltZPosition;
public Transform RoundPosMagExit;
public Transform RoundPosEjecting;
}
[Header("ManipulateFireArmRoundProxy Config")]
public FVRFireArm FireArm;
[Tooltip("Bolt/Slide position at which chambering starts.\nIf not set this is the Bolt/Slide-Lock position.")]
public Transform BoltRoundChamberingStartPos;
[Tooltip("Bolt/Slide position at which chambering ends.\nIf not set this is the Chamber position.")]
public Transform BoltRoundChamberingEndPos;
[Tooltip("Bolt/Slide position at which extraction starts.\nIf not set this is the Chamber position.")]
public Transform BoltRoundExtractionStartPos;
[Tooltip("Bolt/Slide position at which extraction ends.\nIf not set this is the Bolt/Slide-Lock position.")]
public Transform BoltRoundExtractionEndPos;
[Tooltip("Is magazine a double feed magazine?")]
public bool DoubleFeed;
[Header("Chambering Animation")]
public AnimationCurve ChamberingPosX;
public AnimationCurve ChamberingPosY;
public AnimationCurve ChamberingPosZ;
public AnimationCurve ChamberingRotX;
public AnimationCurve ChamberingRotY;
public AnimationCurve ChamberingRotZ;
[Header("Extraction Animation")]
public AnimationCurve ExtractionPosX;
public AnimationCurve ExtractionPosY;
public AnimationCurve ExtractionPosZ;
public AnimationCurve ExtractionRotX;
public AnimationCurve ExtractionRotY;
public AnimationCurve ExtractionRotZ;
[Header("In Editor Testing")]
[Tooltip("Putting a testing round into this field activates in editor testing.")]
public Transform ProxyRound;
[Tooltip("Check this box to test the extraction cycle.")]
public bool TestExtraction;
[Tooltip("Set the virtual amount of rounds in the magazine for double feed testing.")]
public int VirtualNumberOfRoundsInMag;
[Tooltip("Does round in magazine start on even round count?")]
public bool StartsAtEvenRoundCount;
[Tooltip("Displays the current bolt lerp to help with keyframe creation. (time value)")]
public float CurrentEditorLerpValue;
[Header("Only used for curve setup with context menu.")]
[Tooltip("Round X-Axis offset inside the magazine")]
public float DoubleFeedXPosOffset;
[Tooltip("Round Y-Axis rotation inside the magazine")]
public float DoubleFeedYRotOffset;
[HideInInspector]
public bool RoundWasExtracted;
private static readonly Dictionary<Handgun, MalorianAnimationController> _existingManipulateFireArmRoundProxyHandguns = new Dictionary<Handgun, MalorianAnimationController>();
private float _lastBoltZ;
private EBoltPos _curBoltPos;
private EBoltPos _lastBoltPos;
private Transform BoltParent
{
get
{
FVRFireArm fireArm = FireArm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val == null)
{
Handgun val2 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val2 == null)
{
TubeFedShotgun val3 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val3 == null)
{
OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
if (val4 == null)
{
BoltActionRifle val5 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null);
if (val5 != null)
{
return ((Component)val5.BoltHandle).transform.parent;
}
return null;
}
return ((Component)val4.Bolt).transform.parent;
}
return ((Component)val3.Bolt).transform.parent;
}
return ((Component)val2.Slide).transform.parent;
}
return ((Component)val.Bolt).transform.parent;
}
}
private float CurrentBoltZ
{
get
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
FVRFireArm fireArm = FireArm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val == null)
{
Handgun val2 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val2 == null)
{
TubeFedShotgun val3 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val3 == null)
{
OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
if (val4 == null)
{
BoltActionRifle val5 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null);
if (val5 != null)
{
return ((Component)val5.BoltHandle).transform.localPosition.z;
}
return 0f;
}
return val4.Bolt.m_boltZ_current;
}
return val3.Bolt.m_boltZ_current;
}
return val2.Slide.m_slideZ_current;
}
return val.Bolt.m_boltZ_current;
}
}
private FVRFireArmChamber Chamber
{
get
{
FVRFireArm fireArm = FireArm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val == null)
{
OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
if (val2 == null)
{
TubeFedShotgun val3 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val3 == null)
{
Handgun val4 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val4 == null)
{
return ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Chamber;
}
return val4.Chamber;
}
return val3.Chamber;
}
return val2.Chamber;
}
return val.Chamber;
}
}
private static bool CheckAllDictionariesForFirearm(FVRFireArm fireArm, out MalorianAnimationController manipulateFireArmRoundProxy)
{
Handgun val = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val != null)
{
Handgun key = val;
if (_existingManipulateFireArmRoundProxyHandguns.TryGetValue(key, out manipulateFireArmRoundProxy))
{
return true;
}
}
manipulateFireArmRoundProxy = null;
return false;
}
public void Awake()
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
FVRFireArm fireArm = FireArm;
Handgun val = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val != null)
{
_existingManipulateFireArmRoundProxyHandguns.Add(val, this);
if ((Object)(object)BoltRoundChamberingStartPos == (Object)null)
{
BoltRoundChamberingStartPos = val.Slide.Point_Slide_LockPoint;
}
if ((Object)(object)BoltRoundChamberingEndPos == (Object)null)
{
BoltRoundChamberingEndPos = val.Slide.Point_Slide_Forward;
}
if ((Object)(object)BoltRoundExtractionStartPos == (Object)null)
{
BoltRoundExtractionStartPos = val.Slide.Point_Slide_Forward;
}
if ((Object)(object)BoltRoundExtractionEndPos == (Object)null)
{
BoltRoundExtractionEndPos = val.Slide.Point_Slide_LockPoint;
}
_lastBoltZ = ((Component)val.Slide).transform.localPosition.z;
}
}
public void OnDestroy()
{
FVRFireArm fireArm = FireArm;
Handgun val = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val != null)
{
_existingManipulateFireArmRoundProxyHandguns.Remove(val);
}
}
public void Update()
{
if ((Object)(object)ProxyRound == (Object)null)
{
UpdateCurrentBoltPositionEnum();
if (_curBoltPos >= EBoltPos.Eject && _lastBoltPos < EBoltPos.Eject)
{
FVRFireArm fireArm = FireArm;
Handgun val = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val != null)
{
Handgun_BoltEvent_EjectRound(val.Slide);
}
}
if (!Chamber.IsFull && _curBoltPos < EBoltPos.StartChambering && _lastBoltPos > EBoltPos.EjectToStartChambering)
{
FVRFireArm fireArm2 = FireArm;
Handgun val2 = (Handgun)(object)((fireArm2 is Handgun) ? fireArm2 : null);
if (val2 != null)
{
Handgun_BoltEvent_ExtractRoundFromMag(val2.Slide);
}
}
_lastBoltPos = _curBoltPos;
}
else
{
UpdateDisplayRoundPositionsEditor();
}
}
private void UpdateCurrentBoltPositionEnum()
{
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
Transform boltParent = BoltParent;
float currentBoltZ = CurrentBoltZ;
FVRFireArm fireArm = FireArm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
float num;
if (val == null)
{
Handgun val2 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val2 == null)
{
TubeFedShotgun val3 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val3 == null)
{
OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
if (val4 == null)
{
BoltActionRifle val5 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null);
num = ((val5 == null) ? 0f : val5.BoltHandle.Point_Forward.localPosition.z);
}
else
{
num = val4.Bolt.m_boltZ_forward;
}
}
else
{
num = val3.Bolt.m_boltZ_forward;
}
}
else
{
num = val2.Slide.m_slideZ_forward;
}
}
else
{
num = val.Bolt.m_boltZ_forward;
}
float num2 = num;
fireArm = FireArm;
ClosedBoltWeapon val6 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val6 == null)
{
Handgun val7 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val7 == null)
{
TubeFedShotgun val8 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val8 == null)
{
OpenBoltReceiver val9 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
if (val9 == null)
{
BoltActionRifle val10 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null);
num = ((val10 == null) ? 0f : Mathf.Lerp(val10.BoltHandle.Point_Forward.localPosition.z, val10.BoltHandle.Point_Rearward.localPosition.z, 0.975f));
}
else
{
num = val9.Bolt.m_boltZ_lock;
}
}
else
{
num = val8.Bolt.m_boltZ_lock;
}
}
else
{
num = val7.Slide.m_slideZ_lock;
}
}
else
{
num = val6.Bolt.m_boltZ_lock;
}
float num3 = num;
fireArm = FireArm;
ClosedBoltWeapon val11 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val11 == null)
{
Handgun val12 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val12 == null)
{
TubeFedShotgun val13 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val13 == null)
{
OpenBoltReceiver val14 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
if (val14 == null)
{
BoltActionRifle val15 = (BoltActionRifle)(object)((fireArm is BoltActionRifle) ? fireArm : null);
num = ((val15 == null) ? 0f : val15.BoltHandle.Point_Rearward.localPosition.z);
}
else
{
num = val14.Bolt.m_boltZ_rear;
}
}
else
{
num = val13.Bolt.m_boltZ_rear;
}
}
else
{
num = val12.Slide.m_slideZ_rear;
}
}
else
{
num = val11.Bolt.m_boltZ_rear;
}
float num4 = num;
float z = boltParent.InverseTransformPoint(BoltRoundChamberingStartPos.position).z;
float z2 = boltParent.InverseTransformPoint(BoltRoundExtractionEndPos.position).z;
EBoltPos curBoltPos = ((!Mathf.Approximately(currentBoltZ, num2)) ? ((Mathf.Approximately(currentBoltZ, z2) && !Mathf.Approximately(num3, z2) && !Mathf.Approximately(z2, z)) ? EBoltPos.Eject : ((Mathf.Approximately(currentBoltZ, z) && !Mathf.Approximately(num3, z)) ? EBoltPos.StartChambering : (Mathf.Approximately(currentBoltZ, num3) ? EBoltPos.Locked : (Mathf.Approximately(currentBoltZ, num4) ? EBoltPos.Rear : ((currentBoltZ > z2) ? EBoltPos.ForwardToEject : ((currentBoltZ > z) ? EBoltPos.EjectToStartChambering : ((!(currentBoltZ > num3)) ? EBoltPos.LockedToRear : EBoltPos.ChamberingToLocked))))))) : EBoltPos.Forward);
_curBoltPos = curBoltPos;
}
private void HandgunUpdate(HandgunSlide slide)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
Transform parent = ((Component)slide).transform.parent;
float z = parent.InverseTransformPoint(BoltRoundExtractionEndPos.position).z;
float z2 = parent.InverseTransformPoint(BoltRoundChamberingStartPos.position).z;
if (_lastBoltZ >= z && slide.m_slideZ_current < z)
{
Handgun_BoltEvent_EjectRound(slide);
}
if (!slide.Handgun.m_proxy.IsFull && !slide.Handgun.Chamber.IsFull && slide.m_slideZ_current > z2)
{
Handgun_BoltEvent_ExtractRoundFromMag(slide);
}
_lastBoltZ = slide.m_slideZ_current;
}
private void Handgun_BoltEvent_ExtractRoundFromMag(HandgunSlide slide)
{
Handgun_BeginChamberingRound(slide.Handgun);
}
private void Handgun_BoltEvent_EjectRound(HandgunSlide slide)
{
slide.Handgun.EjectExtractedRound();
}
public void Handgun_BeginChamberingRound(Handgun handgun)
{
bool flag = false;
GameObject fromPrefabReference = null;
if (((FVRFireArm)handgun).HasBelt)
{
if (!handgun.m_proxy.IsFull && ((FVRFireArm)handgun).BeltDD.HasARound())
{
flag = true;
fromPrefabReference = RemoveRound(((FVRFireArm)handgun).BeltDD);
}
}
else if (!handgun.m_proxy.IsFull && (Object)(object)((FVRFireArm)handgun).Magazine != (Object)null && !((FVRFireArm)handgun).Magazine.IsBeltBox && ((FVRFireArm)handgun).Magazine.HasARound())
{
flag = true;
fromPrefabReference = RemoveRound(((FVRFireArm)handgun).Magazine);
}
if (flag && flag)
{
handgun.m_proxy.SetFromPrefabReference(fromPrefabReference);
UpdateDisplayRoundPositions();
}
}
public GameObject RemoveRound(FVRFireArmMagazine mag)
{
mag.m_timeSinceRoundInserted = 0f;
GameObject gameObject = ((AnvilAsset)mag.LoadedRounds[mag.m_numRounds - 1].LR_ObjectWrapper).GetGameObject();
if ((!mag.IsInfinite || !GM.CurrentSceneSettings.AllowsInfiniteAmmoMags) && !GM.CurrentSceneSettings.IsAmmoInfinite && !GM.CurrentPlayerBody.IsInfiniteAmmo)
{
if (GM.CurrentPlayerBody.IsAmmoDrain)
{
mag.m_numRounds = 0;
}
else if (mag.m_numRounds > 0)
{
mag.LoadedRounds[mag.m_numRounds - 1] = null;
mag.m_numRounds--;
if (mag.DisplayBullets.Length != 0)
{
mag.DisplayBullets[0].SetActive(false);
}
}
}
RoundWasExtracted = true;
return gameObject;
}
public GameObject RemoveRound(FVRFirearmBeltDisplayData belt)
{
GameObject gameObject = ((AnvilAsset)belt.BeltRounds[0].LR_ObjectWrapper).GetGameObject();
if (!GM.CurrentPlayerBody.IsInfiniteAmmo && belt.m_roundsOnBelt > 0)
{
belt.BeltRounds.RemoveAt(0);
belt.m_roundsOnBelt--;
}
if (belt.m_roundsOnBelt <= 0)
{
belt.Firearm.HasBelt = false;
}
RoundWasExtracted = true;
return gameObject;
}
private void UpdateDisplayRoundPositionsEditor()
{
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: 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_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
Transform boltParent = BoltParent;
float currentBoltZ = CurrentBoltZ;
float z;
float z2;
if (TestExtraction)
{
z = boltParent.InverseTransformPoint(BoltRoundExtractionStartPos.position).z;
z2 = boltParent.InverseTransformPoint(BoltRoundExtractionEndPos.position).z;
float num = (CurrentEditorLerpValue = Mathf.InverseLerp(z2, z, currentBoltZ));
float num2 = ExtractionPosX.Evaluate(num);
float num3 = ExtractionPosY.Evaluate(num);
float num4 = ExtractionPosZ.Evaluate(num);
float num5 = ExtractionRotX.Evaluate(num);
float num6 = ExtractionRotY.Evaluate(num);
float num7 = ExtractionRotZ.Evaluate(num);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num2, num3, num4);
Quaternion val2 = Quaternion.Euler(num5, num6, num7);
ProxyRound.position = boltParent.TransformPoint(val);
ProxyRound.rotation = UnityEngineExtensions.TransformRotation(boltParent, val2);
return;
}
z = boltParent.InverseTransformPoint(BoltRoundChamberingStartPos.position).z;
z2 = boltParent.InverseTransformPoint(BoltRoundChamberingEndPos.position).z;
float num8 = (CurrentEditorLerpValue = Mathf.InverseLerp(z, z2, currentBoltZ));
float num9 = ChamberingPosX.Evaluate(num8);
float num10 = ChamberingPosY.Evaluate(num8);
float num11 = ChamberingPosZ.Evaluate(num8);
float num12 = ChamberingRotX.Evaluate(num8);
float num13 = ChamberingRotY.Evaluate(num8);
float num14 = ChamberingRotZ.Evaluate(num8);
if (DoubleFeed && ((float)VirtualNumberOfRoundsInMag % 2f != 0f || !StartsAtEvenRoundCount) && ((float)VirtualNumberOfRoundsInMag % 2f == 0f || StartsAtEvenRoundCount))
{
num9 = 0f - num9;
num13 = 0f - num13;
}
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(num9, num10, num11);
Quaternion val4 = Quaternion.Euler(num12, num13, num14);
ProxyRound.position = boltParent.TransformPoint(val3);
ProxyRound.rotation = UnityEngineExtensions.TransformRotation(boltParent, val4);
}
public void UpdateDisplayRoundPositions()
{
FVRFireArm fireArm = FireArm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
FVRFireArmChamber val5;
if (val == null)
{
Handgun val2 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val2 == null)
{
TubeFedShotgun val3 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val3 == null)
{
OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val5 = ((val4 != null) ? val4.Chamber : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Chamber);
}
else
{
val5 = val3.Chamber;
}
}
else
{
val5 = val2.Chamber;
}
}
else
{
val5 = val.Chamber;
}
FVRFireArmChamber val6 = val5;
fireArm = FireArm;
ClosedBoltWeapon val7 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
FVRFirearmMovingProxyRound val11;
if (val7 == null)
{
Handgun val8 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val8 == null)
{
TubeFedShotgun val9 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val9 == null)
{
OpenBoltReceiver val10 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val11 = ((val10 != null) ? val10.m_proxy : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).m_proxy);
}
else
{
val11 = val9.m_proxy;
}
}
else
{
val11 = val8.m_proxy;
}
}
else
{
val11 = val7.m_proxy;
}
FVRFirearmMovingProxyRound val12 = val11;
Transform boltParent = BoltParent;
float currentBoltZ = CurrentBoltZ;
fireArm = FireArm;
ClosedBoltWeapon val13 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
Transform val17;
if (val13 == null)
{
Handgun val14 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val14 == null)
{
TubeFedShotgun val15 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val15 == null)
{
OpenBoltReceiver val16 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val17 = ((val16 != null) ? val16.RoundPos_MagazinePos : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Extraction_MagazinePos);
}
else
{
val17 = val15.RoundPos_UpperPath_Forward;
}
}
else
{
val17 = val14.RoundPos_Magazine;
}
}
else
{
val17 = val13.RoundPos_MagazinePos;
}
Transform roundPosMagExit = val17;
fireArm = FireArm;
ClosedBoltWeapon val18 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val18 == null)
{
Handgun val19 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val19 == null)
{
TubeFedShotgun val20 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val20 == null)
{
OpenBoltReceiver val21 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val17 = ((val21 != null) ? val21.RoundPos_Ejecting : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Extraction_Ejecting);
}
else
{
val17 = val20.RoundPos_Ejecting;
}
}
else
{
val17 = val19.RoundPos_Ejecting;
}
}
else
{
val17 = val18.RoundPos_Ejecting;
}
Transform roundPosEjecting = val17;
ProxyInfo proxyInfo = new ProxyInfo
{
Chamber = val6,
Proxy = val12,
Parent = boltParent,
CurrentBoltZPosition = currentBoltZ,
RoundPosMagExit = roundPosMagExit,
RoundPosEjecting = roundPosEjecting
};
if ((Object)(object)boltParent != (Object)null)
{
if ((Object)(object)val6 != (Object)null && val6.IsFull)
{
ModifyProxyPositionExtraction(proxyInfo);
}
if ((Object)(object)val12 != (Object)null && val12.IsFull)
{
ModifyProxyPositionChambering(proxyInfo);
}
}
}
private void ModifyProxyPositionExtraction(ProxyInfo proxyInfo)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
float z = proxyInfo.Parent.InverseTransformPoint(BoltRoundExtractionStartPos.position).z;
float num = Mathf.InverseLerp(proxyInfo.Parent.InverseTransformPoint(BoltRoundExtractionEndPos.position).z, z, proxyInfo.CurrentBoltZPosition);
float num2 = ExtractionPosX.Evaluate(num);
float num3 = ExtractionPosY.Evaluate(num);
float num4 = ExtractionPosZ.Evaluate(num);
float num5 = ExtractionRotX.Evaluate(num);
float num6 = ExtractionRotY.Evaluate(num);
float num7 = ExtractionRotZ.Evaluate(num);
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num2, num3, num4);
Quaternion val2 = Quaternion.Euler(num5, num6, num7);
proxyInfo.Chamber.ProxyRound.position = proxyInfo.Parent.TransformPoint(val);
proxyInfo.Chamber.ProxyRound.rotation = UnityEngineExtensions.TransformRotation(proxyInfo.Parent, val2);
}
private void ModifyProxyPositionChambering(ProxyInfo proxyInfo)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_010c: 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)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
float z = proxyInfo.Parent.InverseTransformPoint(BoltRoundChamberingStartPos.position).z;
float z2 = proxyInfo.Parent.InverseTransformPoint(BoltRoundChamberingEndPos.position).z;
float num = Mathf.InverseLerp(z, z2, proxyInfo.CurrentBoltZPosition);
float num2 = ChamberingPosX.Evaluate(num);
float num3 = ChamberingPosY.Evaluate(num);
float num4 = ChamberingPosZ.Evaluate(num);
float num5 = ChamberingRotX.Evaluate(num);
float num6 = ChamberingRotY.Evaluate(num);
float num7 = ChamberingRotZ.Evaluate(num);
if (DoubleFeed && (Object)(object)FireArm.Magazine != (Object)null)
{
float num8 = Mathf.Sign(FireArm.Magazine.DisplayBullets[0].transform.localPosition.x);
num2 *= num8;
num6 *= num8;
}
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(num2, num3, num4);
Quaternion val2 = Quaternion.Euler(num5, num6, num7);
proxyInfo.Proxy.ProxyRound.position = proxyInfo.Parent.TransformPoint(val);
proxyInfo.Proxy.ProxyRound.rotation = UnityEngineExtensions.TransformRotation(proxyInfo.Parent, val2);
}
[ContextMenu("SetupDefaultProxyRoundCurves")]
public void SetupDefaultProxyRoundCurves()
{
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
Transform boltParent = BoltParent;
FVRFireArm fireArm = FireArm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
FVRFireArmChamber val5;
if (val == null)
{
Handgun val2 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val2 == null)
{
TubeFedShotgun val3 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val3 == null)
{
OpenBoltReceiver val4 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val5 = ((val4 != null) ? val4.Chamber : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Chamber);
}
else
{
val5 = val3.Chamber;
}
}
else
{
val5 = val2.Chamber;
}
}
else
{
val5 = val.Chamber;
}
FVRFireArmChamber val6 = val5;
fireArm = FireArm;
ClosedBoltWeapon val7 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
Transform val11;
if (val7 == null)
{
Handgun val8 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val8 == null)
{
TubeFedShotgun val9 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val9 == null)
{
OpenBoltReceiver val10 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val11 = ((val10 != null) ? val10.RoundPos_MagazinePos : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Extraction_MagazinePos);
}
else
{
val11 = val9.RoundPos_UpperPath_Forward;
}
}
else
{
val11 = val8.RoundPos_Magazine;
}
}
else
{
val11 = val7.RoundPos_MagazinePos;
}
Transform val12 = val11;
fireArm = FireArm;
ClosedBoltWeapon val13 = (ClosedBoltWeapon)(object)((fireArm is ClosedBoltWeapon) ? fireArm : null);
if (val13 == null)
{
Handgun val14 = (Handgun)(object)((fireArm is Handgun) ? fireArm : null);
if (val14 == null)
{
TubeFedShotgun val15 = (TubeFedShotgun)(object)((fireArm is TubeFedShotgun) ? fireArm : null);
if (val15 == null)
{
OpenBoltReceiver val16 = (OpenBoltReceiver)(object)((fireArm is OpenBoltReceiver) ? fireArm : null);
val11 = ((val16 != null) ? val16.RoundPos_Ejecting : ((BoltActionRifle)(((fireArm is BoltActionRifle) ? fireArm : null)?)).Extraction_Ejecting);
}
else
{
val11 = val15.RoundPos_Ejecting;
}
}
else
{
val11 = val14.RoundPos_Ejecting;
}
}
else
{
val11 = val13.RoundPos_Ejecting;
}
Transform val17 = val11;
boltParent.InverseTransformPoint(val12.position);
Quaternion val18 = UnityEngineExtensions.InverseTransformRotation(boltParent, val12.localRotation);
Vector3 eulerAngles = ((Quaternion)(ref val18)).eulerAngles;
if (eulerAngles.x > 180f)
{
eulerAngles.x -= 360f;
}
if (eulerAngles.y > 180f)
{
eulerAngles.y -= 360f;
}
if (eulerAngles.z > 180f)
{
eulerAngles.z -= 360f;
}
boltParent.InverseTransformPoint(((Component)val6).transform.position);
val18 = UnityEngineExtensions.InverseTransformRotation(boltParent, ((Component)val6).transform.localRotation);
Vector3 eulerAngles2 = ((Quaternion)(ref val18)).eulerAngles;
if (eulerAngles2.x > 180f)
{
eulerAngles2.x -= 360f;
}
if (eulerAngles2.y > 180f)
{
eulerAngles2.y -= 360f;
}
if (eulerAngles2.z > 180f)
{
eulerAngles2.z -= 360f;
}
boltParent.InverseTransformPoint(val17.position);
val18 = UnityEngineExtensions.InverseTransformRotation(boltParent, val17.localRotation);
Vector3 eulerAngles3 = ((Quaternion)(ref val18)).eulerAngles;
if (eulerAngles3.x > 180f)
{
eulerAngles3.x -= 360f;
}
if (eulerAngles3.y > 180f)
{
eulerAngles3.y -= 360f;
}
if (eulerAngles3.z > 180f)
{
eulerAngles3.z -= 360f;
}
}
}
public class MalorianSlapFlameThrower : MonoBehaviour
{
[Tooltip("The gun.")]
public Handgun Malorian;
[Tooltip("Point forward direction is slap direction reference. (Blue arrow!).")]
public Transform SlapPointAndDirection;
[Tooltip("Minimal distance between hand and slap point.")]
public float SlapDistanceRequirement = 0.1f;
[Tooltip("Alignment required between hand velocity vector and slap direction.")]
public float SlapAlignmentRequirement = 0.3f;
[Tooltip("Hand velocity required before slap is registered.")]
public float SlapSpeedRequirement = 1f;
[Tooltip("The actual flame thrower bit.")]
public ParticleSystem FireParticleEmitter;
[Tooltip("How many flames to fire (literally)")]
public int NumberOfFlameParticlesPerShot;
[Tooltip("Sounds to be played when roasting a choom.")]
public AudioEvent FlameThrowerSounds;
[Tooltip("Time in seconds you can't roast anyone.")]
public float FlameThrowerRechargeTime = 1f;
[Tooltip("This object turns on when you are ready to incinerate a choom.")]
public GameObject FlameThrowerReadyIndicator;
[Tooltip("This object turns on when you gotta wait for the next roast.")]
public GameObject FlameThrowerChargingIndicator;
[Tooltip("Flame has recoil? Whatever I guess!")]
public FVRFireArmRecoilProfile FlameThrowerRecoilProfile;
private bool _coolingDown;
public void Awake()
{
GameObject flameThrowerReadyIndicator = FlameThrowerReadyIndicator;
if (flameThrowerReadyIndicator != null)
{
flameThrowerReadyIndicator.SetActive(true);
}
GameObject flameThrowerChargingIndicator = FlameThrowerChargingIndicator;
if (flameThrowerChargingIndicator != null)
{
flameThrowerChargingIndicator.SetActive(false);
}
}
public void Update()
{
//IL_0032: 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)
//IL_004d: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
if (((FVRInteractiveObject)Malorian).IsHeld && !_coolingDown)
{
FVRViveHand otherHand = ((FVRInteractiveObject)Malorian).m_hand.OtherHand;
float num = Vector3.Distance(SlapPointAndDirection.position, ((HandInput)(ref otherHand.Input)).Pos);
float num2 = Vector3.Dot(SlapPointAndDirection.forward, ((Vector3)(ref otherHand.Input.VelLinearWorld)).normalized);
if (num < SlapDistanceRequirement && num2 > SlapAlignmentRequirement && ((Vector3)(ref otherHand.Input.VelLinearWorld)).magnitude > SlapSpeedRequirement)
{
FireParticleEmitter.Emit(NumberOfFlameParticlesPerShot);
SM.PlayCoreSound((FVRPooledAudioType)0, FlameThrowerSounds, ((Component)this).transform.position).FollowThisTransform(((Component)FireParticleEmitter).transform);
((FVRFireArm)Malorian).Recoil(((FVRFireArm)Malorian).IsTwoHandStabilized(), ((FVRFireArm)Malorian).IsForegripStabilized(), ((FVRFireArm)Malorian).IsShoulderStabilized(), FlameThrowerRecoilProfile, 1f);
((FVRInteractiveObject)Malorian).m_hand.Buzz(((FVRInteractiveObject)Malorian).m_hand.Buzzer.Buzz_GunShot);
((MonoBehaviour)this).StartCoroutine(CoolDownTimer());
}
}
}
private IEnumerator CoolDownTimer()
{
_coolingDown = true;
GameObject flameThrowerReadyIndicator = FlameThrowerReadyIndicator;
if (flameThrowerReadyIndicator != null)
{
flameThrowerReadyIndicator.SetActive(false);
}
GameObject flameThrowerChargingIndicator = FlameThrowerChargingIndicator;
if (flameThrowerChargingIndicator != null)
{
flameThrowerChargingIndicator.SetActive(true);
}
for (float i = 0f; i < FlameThrowerRechargeTime; i += Time.deltaTime)
{
yield return null;
}
GameObject flameThrowerReadyIndicator2 = FlameThrowerReadyIndicator;
if (flameThrowerReadyIndicator2 != null)
{
flameThrowerReadyIndicator2.SetActive(true);
}
GameObject flameThrowerChargingIndicator2 = FlameThrowerChargingIndicator;
if (flameThrowerChargingIndicator2 != null)
{
flameThrowerChargingIndicator2.SetActive(false);
}
_coolingDown = false;
}
}
[BepInPlugin("h3vr.cityrobo.MalorianCode", "Malorian Code", "1.0.0")]
public class MalorianCode : BaseUnityPlugin
{
}
}