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 JerryAr.PTKM1R_JumpMine
{
[BepInPlugin("JerryAr.PTKM1R_JumpMine", "PTKM1R_JumpMine", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class PTKM1R_JumpMinePlugin : 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(), "JerryAr.PTKM1R_JumpMine");
OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.PTKM1R_JumpMine", "", "", "ptkm1r", "");
}
}
}
namespace JerryPTKM
{
public class ColActivate : MonoBehaviour
{
public PTKMBase PTKM;
private void OnCollisionEnter(Collision collision)
{
if (!PTKM.ArmTrigger.m_isLargeAperture && !((FVRInteractiveObject)PTKM.MainObj).IsHeld)
{
PTKM.deployed = true;
}
}
}
public class PTKMBase : MonoBehaviour
{
public Transform centerofmassFold;
public Transform centerofmassUnfold;
public FVRPhysicalObject MainObj;
public PTKMShell Shell;
public Collider DetectCol;
public GameObject Lower;
public GameObject LowerGeo;
public GameObject Upper;
public GameObject UpperGeo;
public GameObject ShellBase;
public GameObject Target;
public GameObject TargetRef;
public bool deployed = false;
public float deploycd = 5f;
public float firecd = 10f;
public bool Jumped;
public bool Fired;
public int iff;
public AR15HandleSightFlipper ArmTrigger;
public Rigidbody rig;
public GameObject uppercol;
public GameObject shellcol;
public KillAfter ka;
public GameObject jumpeffect;
public GameObject fireeffect;
public GameObject shelleffect;
public AudioEvent jumpaud;
public AudioEvent fireaud;
public AudioEvent deployaud;
public AudioEvent click;
public bool clicked;
public Transform Bottom;
private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_006a: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = tr_self.rotation;
Vector3 val = lookPos - tr_self.position;
Vector3 val2 = tr_self.rotation * directionAxis;
Vector3 val3 = Vector3.Cross(val2, val);
Vector3 normalized = ((Vector3)(ref val3)).normalized;
float num = Vector3.Angle(val2, val);
tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
tr_self.localEulerAngles = new Vector3(0f, tr_self.localEulerAngles.y, 0f);
}
private void Update()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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)
//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_040a: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_0454: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_047e: Unknown result type (might be due to invalid IL or missing references)
//IL_0493: Unknown result type (might be due to invalid IL or missing references)
//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0590: Unknown result type (might be due to invalid IL or missing references)
//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_050b: Unknown result type (might be due to invalid IL or missing references)
//IL_053e: Unknown result type (might be due to invalid IL or missing references)
//IL_0559: Unknown result type (might be due to invalid IL or missing references)
((Component)this).gameObject.transform.position = ((Component)MainObj).gameObject.transform.position;
((Component)this).gameObject.transform.rotation = ((Component)MainObj).gameObject.transform.rotation;
if (ArmTrigger.m_isLargeAperture && clicked)
{
SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)ArmTrigger).gameObject.transform.position);
clicked = false;
}
if (!ArmTrigger.m_isLargeAperture && !clicked)
{
SM.PlayCoreSound((FVRPooledAudioType)41, click, ((Component)ArmTrigger).gameObject.transform.position);
clicked = true;
}
if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
{
iff = GM.CurrentPlayerBody.GetPlayerIFF();
}
if (deployed)
{
if (Fired && (Object)(object)Shell != (Object)null)
{
shelleffect.SetActive(true);
shelleffect.transform.position = ((Component)Shell).gameObject.transform.position;
}
if (Jumped)
{
if (firecd > 0f)
{
firecd -= Time.deltaTime;
}
if (firecd <= 8f && Vector3.Angle(((Component)Bottom).transform.forward, TargetRef.transform.position - ShellBase.transform.position) <= 15f && !Fired)
{
fireeffect.SetActive(true);
SM.PlayCoreSound((FVRPooledAudioType)41, fireaud, ((Component)ArmTrigger).gameObject.transform.position);
shellcol.SetActive(false);
if ((Object)(object)Shell != (Object)null)
{
Rigidbody val = ((Component)Shell).gameObject.AddComponent<Rigidbody>();
Shell.activated = true;
val.AddRelativeForce(((Component)val).transform.up * -25f, (ForceMode)2);
val.collisionDetectionMode = (CollisionDetectionMode)2;
}
Fired = true;
}
if (firecd <= 0f && !Fired)
{
if ((Object)(object)Shell != (Object)null)
{
Shell.Explode();
}
Fired = true;
}
}
rig.centerOfMass = centerofmassUnfold.localPosition;
((FVRInteractiveObject)MainObj).IsSimpleInteract = true;
MainObj.DistantGrabbable = false;
if (deploycd > 0f)
{
deploycd -= Time.deltaTime;
DetectCol.enabled = false;
}
else
{
if (!(deploycd <= 0f))
{
return;
}
if ((Object)(object)Target == (Object)null)
{
DetectCol.enabled = true;
}
else if ((Object)(object)Target != (Object)null)
{
DetectCol.enabled = false;
if (!Jumped)
{
TargetRef.transform.SetParent((Transform)null);
TargetRef.transform.position = Target.transform.position;
}
AxisLookAt(Lower.gameObject.transform, TargetRef.transform.position, Vector3.forward);
LowerGeo.transform.localEulerAngles = Vector3.Lerp(LowerGeo.transform.localEulerAngles, Lower.transform.localEulerAngles, Time.deltaTime * 25f);
UpperGeo.transform.localEulerAngles = Vector3.Lerp(UpperGeo.transform.localEulerAngles, new Vector3(0f, 0f, Vector3.Distance(((Component)this).gameObject.transform.position, Target.transform.position)), Time.deltaTime * 25f);
if (Vector3.Angle(Lower.transform.forward, LowerGeo.transform.forward) < 2.5f && Vector3.Angle(UpperGeo.transform.forward, Upper.transform.forward) < 2.5f && !Jumped)
{
SM.PlayCoreSound((FVRPooledAudioType)41, jumpaud, ((Component)ArmTrigger).gameObject.transform.position);
uppercol.SetActive(false);
Rigidbody val2 = ShellBase.AddComponent<Rigidbody>();
val2.AddRelativeForce(new Vector3(0f, 25f, 0f), (ForceMode)2);
val2.AddRelativeTorque(new Vector3(0f, 0f, 50f), (ForceMode)2);
((Behaviour)ka).enabled = true;
Jumped = true;
jumpeffect.SetActive(true);
}
if (Vector3.Distance(((Component)this).gameObject.transform.position, Target.transform.position) > 30f)
{
Target = null;
}
}
}
}
else if (!deployed)
{
DetectCol.enabled = false;
rig.centerOfMass = centerofmassFold.localPosition;
}
}
private void OnTriggerStay(Collider other)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Invalid comparison between Unknown and I4
if ((Object)(object)Target == (Object)null && (Object)(object)((Component)other).gameObject.GetComponent<SosigLink>() != (Object)null && (Object)(object)((Component)other).gameObject.GetComponent<SosigLink>().S != (Object)null && (int)((Component)other).gameObject.GetComponent<SosigLink>().S.BodyState != 3 && !Jumped)
{
Target = ((Component)other).gameObject;
}
}
private void OnDestroy()
{
if ((Object)(object)ShellBase != (Object)null)
{
Object.Destroy((Object)(object)ShellBase);
}
if ((Object)(object)Shell != (Object)null)
{
Shell.Explode();
}
if ((Object)(object)TargetRef != (Object)null)
{
Object.Destroy((Object)(object)TargetRef);
}
}
}
public class PTKMShell : MonoBehaviour
{
public GameObject Explosion;
public bool activated = false;
private void OnCollisionEnter(Collision collision)
{
if (activated)
{
Explode();
}
}
public void Explode()
{
//IL_000d: 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)
Object.Instantiate<GameObject>(Explosion, ((Component)this).transform.position, ((Component)this).transform.rotation);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class legwaggle : MonoBehaviour
{
public WaggleJoint wag;
public float leftunfold;
public float leftfold;
public float rightunfold;
public float rightfold;
public PTKMBase PTKM;
public float cd = 2f;
private void Update()
{
if (PTKM.deployed)
{
if (cd > 0f)
{
cd -= Time.deltaTime;
}
if (cd <= 0f)
{
wag.angleLimitLeft = leftunfold;
wag.angleLimitRight = rightunfold;
}
}
else if (!PTKM.deployed)
{
wag.angleLimitLeft = leftfold;
wag.angleLimitRight = rightfold;
}
}
}
}