using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using SammyCadian.RocketLauncherScripts;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("SammyCadian")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("rocketLauncherScripts")]
[assembly: AssemblyTitle("rocketLauncherScripts")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 SammyCadian.RocketLauncherScripts
{
public class ImpactGrenade : MonoBehaviour
{
public Color blinkColor;
public UnityEvent onDetonate;
private ItemToggle itemToggle;
private ItemAttributes itemAttributes;
internal bool isActive;
private float grenadeTimer;
public float tickTime = 0.2f;
private PhotonView photonView;
private PhysGrabObjectImpactDetector physGrabObjectImpactDetector;
public Sound soundSplinter;
public Sound soundTick;
private float splinterAnimationProgress;
public AnimationCurve splinterAnimationCurve;
private Transform splinterTransform;
private Material grenadeEmissionMaterial;
private ItemEquippable itemEquippable;
private Vector3 grenadeStartPosition;
private Quaternion grenadeStartRotation;
private PhysGrabObject physGrabObject;
private Vector3 prevPosition;
[FormerlySerializedAs("isThiefGrenade")]
[HideInInspector]
public bool isSpawnedGrenade;
public GameObject throwLine;
private Rigidbody rb;
private float throwLineTimer;
private TrailRenderer throwLineTrail;
private bool armed;
private void Start()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
itemToggle = ((Component)this).GetComponent<ItemToggle>();
itemAttributes = ((Component)this).GetComponent<ItemAttributes>();
photonView = ((Component)this).GetComponent<PhotonView>();
physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
GameObject gameObject = ((Component)((Component)this).transform.Find("Mesh")).gameObject;
grenadeStartPosition = ((Component)this).transform.position;
grenadeStartRotation = ((Component)this).transform.rotation;
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
rb = ((Component)this).GetComponent<Rigidbody>();
throwLineTrail = throwLine.GetComponent<TrailRenderer>();
}
private void FixedUpdate()
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)itemEquippable == (Object)null || (Object)(object)itemToggle == (Object)null || (Object)(object)itemAttributes == (Object)null || (Object)(object)photonView == (Object)null || (Object)(object)physGrabObjectImpactDetector == (Object)null || (Object)(object)physGrabObject == (Object)null || (Object)(object)rb == (Object)null || (Object)(object)throwLineTrail == (Object)null)
{
return;
}
if (itemEquippable.isEquipped || itemEquippable.wasEquippedTimer > 0f)
{
prevPosition = rb.position;
return;
}
Vector3 val = (rb.position - prevPosition) / Time.fixedDeltaTime;
Vector3 val2 = rb.position - prevPosition;
_ = ((Vector3)(ref val2)).normalized;
prevPosition = rb.position;
if (!physGrabObject.grabbed && ((Vector3)(ref val)).magnitude > 2f)
{
throwLineTimer = 0.2f;
}
if (throwLineTimer > 0f)
{
throwLineTrail.emitting = true;
throwLineTimer -= Time.fixedDeltaTime;
}
else
{
throwLineTrail.emitting = false;
}
}
private void Update()
{
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)itemEquippable == (Object)null || (Object)(object)itemToggle == (Object)null || (Object)(object)itemAttributes == (Object)null || (Object)(object)photonView == (Object)null || (Object)(object)physGrabObjectImpactDetector == (Object)null || (Object)(object)physGrabObject == (Object)null || (Object)(object)rb == (Object)null || (Object)(object)throwLineTrail == (Object)null || (Object)(object)itemToggle == (Object)null || (Object)(object)rb == (Object)null)
{
return;
}
soundTick.PlayLoop(isActive, 2f, 2f, 1f);
if (itemEquippable.isEquipped)
{
if (isActive)
{
isActive = false;
grenadeTimer = 0f;
splinterAnimationProgress = 0f;
itemToggle.ToggleItem(false, -1);
}
return;
}
if (isActive)
{
if (splinterAnimationProgress < 1f)
{
splinterAnimationProgress += 5f * Time.deltaTime;
float num = splinterAnimationCurve.Evaluate(splinterAnimationProgress);
}
float num2 = Mathf.PingPong(Time.time * 8f, 1f);
Color val = blinkColor * Mathf.LinearToGammaSpace(num2);
}
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
if (itemToggle.toggleState && !isActive)
{
isActive = true;
TickStart();
}
if (isActive)
{
grenadeTimer += Time.deltaTime;
if (grenadeTimer >= tickTime)
{
armed = true;
}
}
}
private void OnCollisionEnter(Collision collision)
{
if (armed)
{
TickEnd();
}
}
private void GrenadeReset()
{
//IL_004b: 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)
isActive = false;
grenadeTimer = 0f;
throwLine.SetActive(false);
splinterAnimationProgress = 0f;
itemToggle.ToggleItem(false, -1);
if (SemiFunc.IsMasterClientOrSingleplayer())
{
Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
component.velocity = Vector3.zero;
component.angularVelocity = Vector3.zero;
}
}
private void TickStart()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClient())
{
photonView.RPC("TickStartRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
TickStartRPC();
}
}
private void TickEnd()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClient())
{
photonView.RPC("TickEndRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
TickEndRPC();
}
}
[PunRPC]
private void TickStartRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: 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)
if (SemiFunc.MasterOnlyRPC(_info))
{
soundSplinter.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
isActive = true;
}
}
[PunRPC]
private void TickEndRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.MasterOnlyRPC(_info) || itemEquippable.isEquipped)
{
return;
}
onDetonate.Invoke();
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (!SemiFunc.RunIsShop() || isSpawnedGrenade)
{
if (!isSpawnedGrenade)
{
StatsManager.instance.ItemRemove(itemAttributes.instanceName);
}
physGrabObjectImpactDetector.DestroyObject(true);
}
else
{
physGrabObject.Teleport(grenadeStartPosition, grenadeStartRotation);
}
}
if (SemiFunc.RunIsShop() && !isSpawnedGrenade)
{
GrenadeReset();
}
}
}
public class RocketLauncher : MonoBehaviour
{
public enum State
{
Idle,
OutOfAmmo,
Buildup,
Shooting,
Reloading
}
private PhysGrabObject physGrabObject;
private ItemToggle itemToggle;
public bool hasOneShot = true;
public float shootTime = 1f;
public bool hasBuildUp;
public float buildUpTime = 1f;
public int numberOfBullets = 1;
[Range(0f, 65f)]
public float gunRandomSpread;
public float gunRange = 50f;
public float distanceKeep = 0.8f;
public float gunRecoilForce = 1f;
public float cameraShakeMultiplier = 1f;
public float torqueMultiplier = 1f;
public float grabStrengthMultiplier = 1f;
public float shootCooldown = 1f;
public float batteryDrain = 0.1f;
public bool batteryDrainFullBar;
public int batteryDrainFullBars = 1;
[Range(0f, 100f)]
public float misfirePercentageChange = 50f;
public AnimationCurve shootLineWidthCurve;
public float grabVerticalOffset = -0.2f;
public float aimVerticalOffset = -5f;
public float investigateRadius = 20f;
private float investigateCooldown;
public Transform gunMuzzle;
public GameObject bulletPrefab;
public GameObject rocketPrefab;
public GameObject muzzleFlashPrefab;
public GameObject visibleRocketMeshSection;
private ParticleScriptExplosion particleScriptExplosion;
public Transform backblastPosition;
public Transform gunTrigger;
internal HurtCollider hurtCollider;
public Sound soundShoot;
public Sound soundShootGlobal;
public Sound soundNoAmmoClick;
public Sound soundHit;
private ItemBattery itemBattery;
private PhotonView photonView;
private PhysGrabObjectImpactDetector impactDetector;
private bool prevToggleState;
private AnimationCurve triggerAnimationCurve;
private float triggerAnimationEval;
private bool triggerAnimationActive;
public UnityEvent onStateIdleStart;
public UnityEvent onStateIdleUpdate;
public UnityEvent onStateIdleFixedUpdate;
[Space(20f)]
public UnityEvent onStateOutOfAmmoStart;
public UnityEvent onStateOutOfAmmoUpdate;
public UnityEvent onStateOutOfAmmoFixedUpdate;
[Space(20f)]
public UnityEvent onStateBuildupStart;
public UnityEvent onStateBuildupUpdate;
public UnityEvent onStateBuildupFixedUpdate;
[Space(20f)]
public UnityEvent onStateShootingStart;
public UnityEvent onStateShootingUpdate;
public UnityEvent onStateShootingFixedUpdate;
[Space(20f)]
public UnityEvent onStateReloadingStart;
public UnityEvent onStateReloadingUpdate;
public UnityEvent onStateReloadingFixedUpdate;
private bool hasIdleUpdate = true;
private bool hasIdleFixedUpdate = true;
private bool hasOutOfAmmoUpdate = true;
private bool hasOutOfAmmoFixedUpdate = true;
private bool hasBuildupUpdate = true;
private bool hasBuildupFixedUpdate = true;
private bool hasShootingUpdate = true;
private bool hasShootingFixedUpdate = true;
private bool hasReloadingUpdate = true;
private bool hasReloadingFixedUpdate = true;
internal float stateTimer;
internal float stateTimeMax;
internal State stateCurrent;
private State statePrev;
private bool stateStart;
private ItemEquippable itemEquippable;
public bool fuckYou;
private void Start()
{
itemEquippable = ((Component)this).GetComponent<ItemEquippable>();
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
itemToggle = ((Component)this).GetComponent<ItemToggle>();
itemBattery = ((Component)this).GetComponent<ItemBattery>();
photonView = ((Component)this).GetComponent<PhotonView>();
impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
triggerAnimationCurve = AssetManager.instance.animationCurveClickInOut;
if (onStateIdleUpdate == null)
{
hasIdleUpdate = false;
}
if (onStateIdleFixedUpdate == null)
{
hasIdleFixedUpdate = false;
}
if (onStateOutOfAmmoUpdate == null)
{
hasOutOfAmmoUpdate = false;
}
if (onStateOutOfAmmoFixedUpdate == null)
{
hasOutOfAmmoFixedUpdate = false;
}
if (onStateBuildupUpdate == null)
{
hasBuildupUpdate = false;
}
if (onStateBuildupFixedUpdate == null)
{
hasBuildupFixedUpdate = false;
}
if (onStateShootingUpdate == null)
{
hasShootingUpdate = false;
}
if (onStateShootingFixedUpdate == null)
{
hasShootingFixedUpdate = false;
}
if (onStateReloadingUpdate == null)
{
hasReloadingUpdate = false;
}
if (onStateReloadingFixedUpdate == null)
{
hasReloadingFixedUpdate = false;
}
}
private void FixedUpdate()
{
StateMachine(_fixedUpdate: true);
}
private void Update()
{
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)itemEquippable == (Object)null || (Object)(object)physGrabObject == (Object)null || (Object)(object)itemToggle == (Object)null || (Object)(object)itemBattery == (Object)null || (Object)(object)photonView == (Object)null || (Object)(object)impactDetector == (Object)null || triggerAnimationCurve == null)
{
return;
}
StateMachine(_fixedUpdate: false);
if ((Object)(object)physGrabObject != (Object)null && physGrabObject.grabbed && physGrabObject.grabbedLocal)
{
PhysGrabber.instance.OverrideGrabDistance(distanceKeep);
}
if (triggerAnimationActive)
{
float num = 45f;
triggerAnimationEval += Time.deltaTime * 4f;
gunTrigger.localRotation = Quaternion.Euler(num * triggerAnimationCurve.Evaluate(triggerAnimationEval), 0f, 0f);
if (triggerAnimationEval >= 1f)
{
gunTrigger.localRotation = Quaternion.Euler(0f, 0f, 0f);
triggerAnimationActive = false;
triggerAnimationEval = 1f;
}
}
UpdateMaster();
AppearanceCheck();
}
private void AppearanceCheck()
{
visibleRocketMeshSection.SetActive(itemBattery.batteryLife == 100f);
}
private void UpdateMaster()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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_0058: 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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.IsMasterClientOrSingleplayer() || physGrabObject.playerGrabbing.Count <= 0)
{
return;
}
Quaternion val = Quaternion.Euler(aimVerticalOffset, 0f, 0f);
Quaternion val2 = Quaternion.Euler(0f, 0f, 0f);
Quaternion identity = Quaternion.identity;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = true;
foreach (PhysGrabber item in physGrabObject.playerGrabbing)
{
if (flag4)
{
if (item.playerAvatar.isCrouching)
{
flag2 = true;
}
if (item.playerAvatar.isCrawling)
{
flag3 = true;
}
flag4 = false;
}
if (item.isRotating)
{
flag = true;
}
}
if (!flag)
{
physGrabObject.TurnXYZ(val, val2, identity);
}
float num = grabVerticalOffset;
if (flag2)
{
num += 0.5f;
}
if (flag3)
{
num -= 0.5f;
}
physGrabObject.OverrideGrabVerticalPosition(num);
if (!flag)
{
if (stateCurrent == State.OutOfAmmo)
{
physGrabObject.OverrideTorqueStrength(0.01f, 0.1f);
}
else if (physGrabObject.grabbed)
{
physGrabObject.OverrideTorqueStrength(12f, 0.1f);
physGrabObject.OverrideAngularDrag(20f, 0.1f);
}
}
if (flag)
{
physGrabObject.OverrideTorqueStrength(2f, 0.1f);
physGrabObject.OverrideAngularDrag(20f, 0.1f);
}
}
public void Misfire()
{
if (!physGrabObject.grabbed && !physGrabObject.hasNeverBeenGrabbed && SemiFunc.IsMasterClientOrSingleplayer() && (float)Random.Range(0, 100) < misfirePercentageChange)
{
Shoot();
}
}
public void Shoot()
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (itemBattery.batteryLifeInt <= 0)
{
flag = true;
}
if (Random.Range(0, 10000) == 0)
{
flag = false;
}
if (flag)
{
return;
}
if (hasOneShot)
{
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("ShootRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
ShootRPC();
}
StateSet(State.Reloading);
}
else if (hasBuildUp)
{
StateSet(State.Buildup);
}
else
{
StateSet(State.Shooting);
}
}
private void MuzzleFlash()
{
//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>(muzzleFlashPrefab, gunMuzzle.position, gunMuzzle.rotation, gunMuzzle).GetComponent<ItemGunMuzzleFlash>().ActivateAllEffects();
}
private void StartTriggerAnimation()
{
triggerAnimationActive = true;
triggerAnimationEval = 0f;
}
private static bool MasterOnlyRPC(PhotonMessageInfo _info)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.IsMultiplayer() || _info.Sender == PhotonNetwork.MasterClient)
{
return true;
}
return false;
}
[PunRPC]
public void ShootRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: 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_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: 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)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: 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_02ac: Unknown result type (might be due to invalid IL or missing references)
if (!MasterOnlyRPC(_info))
{
return;
}
float num = 3f * cameraShakeMultiplier;
float num2 = 16f * cameraShakeMultiplier;
SemiFunc.CameraShakeImpactDistance(gunMuzzle.position, 5f * cameraShakeMultiplier, 0.1f, num, num2);
SemiFunc.CameraShakeDistance(gunMuzzle.position, 0.1f * cameraShakeMultiplier, 0.1f * cameraShakeMultiplier, num, num2);
soundShoot.Play(gunMuzzle.position, 1f, 1f, 1f, 1f);
soundShootGlobal.Play(gunMuzzle.position, 1f, 1f, 1f, 1f);
MuzzleFlash();
StartTriggerAnimation();
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
if (investigateRadius > 0f)
{
}
physGrabObject.rb.AddForceAtPosition(-gunMuzzle.forward * gunRecoilForce, gunMuzzle.position, (ForceMode)1);
if (!batteryDrainFullBar)
{
ItemBattery obj = itemBattery;
obj.batteryLife -= batteryDrain;
}
else
{
itemBattery.RemoveFullBar(batteryDrainFullBars);
}
RaycastHit val4 = default(RaycastHit);
for (int i = 0; i < numberOfBullets; i++)
{
Vector3 position = gunMuzzle.position;
bool hit = false;
bool flag = false;
Vector3 val = gunMuzzle.forward;
if (gunRandomSpread > 0f)
{
float num3 = Random.Range(0f, gunRandomSpread / 2f);
float num4 = Random.Range(0f, 360f);
Vector3 val2 = Vector3.Cross(val, Random.onUnitSphere);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
Quaternion val3 = Quaternion.AngleAxis(num3, normalized);
val2 = Quaternion.AngleAxis(num4, val) * val3 * val;
val = ((Vector3)(ref val2)).normalized;
}
if (Physics.Raycast(gunMuzzle.position, val, ref val4, gunRange, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" })))
{
position = ((RaycastHit)(ref val4)).point;
hit = true;
}
else
{
flag = true;
}
if (flag)
{
position = gunMuzzle.position + gunMuzzle.forward * gunRange;
hit = true;
}
ShootBullet(gunMuzzle.forward, hit);
}
}
private void ShootBullet(Vector3 _shootDirection, bool _hit)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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_0029: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("ShootBulletRPC", (RpcTarget)0, new object[2] { _shootDirection, _hit });
}
else
{
ShootBulletRPC(_shootDirection, _hit);
}
}
}
[PunRPC]
public void ShootBulletRPC(Vector3 _shootDirection, bool _hit, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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)
if (!MasterOnlyRPC(_info))
{
return;
}
if (physGrabObject.playerGrabbing.Count > 1)
{
foreach (PhysGrabber item in physGrabObject.playerGrabbing)
{
item.OverrideGrabRelease();
}
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (SemiFunc.IsMultiplayer())
{
photonView.RPC("BetterBackBlastRPC", (RpcTarget)0, Array.Empty<object>());
GameObject val = PhotonNetwork.Instantiate("Items/ItemGrenadeRocket", ((Component)this).transform.position, Quaternion.identity, (byte)0, (object[])null);
val.GetComponent<RocketProj>().Initialize();
val.GetComponent<RocketProj>().ReceiveDirection(_shootDirection);
val.GetComponent<RocketProj>().Spawn();
}
else
{
BetterBackBlastRPC();
RocketProj component = Object.Instantiate<GameObject>(rocketPrefab, ((Component)this).transform.position, Quaternion.identity).GetComponent<RocketProj>();
component.Initialize();
component.ReceiveDirection(_shootDirection);
component.Spawn();
}
}
}
[PunRPC]
private void BetterBackBlastRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
particleScriptExplosion.Spawn(backblastPosition.position, 0.4f, 0, 50, 2f, false, true, 1f);
}
private void StateSet(State _state)
{
//IL_004f: 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)
if (_state == stateCurrent)
{
return;
}
if (SemiFunc.IsMultiplayer())
{
if (SemiFunc.IsMasterClient())
{
photonView.RPC("StateSetRPC", (RpcTarget)0, new object[1] { (int)_state });
}
}
else
{
StateSetRPC((int)_state);
}
}
private void ShootLogic()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)itemToggle != (Object)null && itemToggle.toggleState != prevToggleState)
{
if (itemBattery.batteryLifeInt <= 0)
{
soundNoAmmoClick.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
StartTriggerAnimation();
SemiFunc.CameraShakeImpact(1f, 0.1f);
physGrabObject.rb.AddForceAtPosition(-gunMuzzle.forward * 1f, gunMuzzle.position, (ForceMode)1);
}
else
{
Shoot();
}
prevToggleState = itemToggle.toggleState;
}
}
[PunRPC]
private void StateSetRPC(int state, PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (MasterOnlyRPC(_info))
{
stateStart = true;
statePrev = stateCurrent;
stateCurrent = (State)state;
}
}
private void StateMachine(bool _fixedUpdate)
{
switch (stateCurrent)
{
case State.Idle:
StateIdle(_fixedUpdate);
break;
case State.OutOfAmmo:
StateOutOfAmmo(_fixedUpdate);
break;
case State.Buildup:
StateBuildup(_fixedUpdate);
break;
case State.Shooting:
StateShooting(_fixedUpdate);
break;
case State.Reloading:
StateReloading(_fixedUpdate);
break;
}
}
private void StateIdle(bool _fixedUpdate)
{
if (stateStart && !_fixedUpdate)
{
if (onStateIdleStart != null)
{
onStateIdleStart.Invoke();
}
stateStart = false;
prevToggleState = itemToggle.toggleState;
}
if (!_fixedUpdate)
{
ShootLogic();
if (hasIdleUpdate)
{
onStateIdleUpdate.Invoke();
}
}
if (_fixedUpdate && hasIdleFixedUpdate)
{
onStateIdleFixedUpdate.Invoke();
}
}
private void StateOutOfAmmo(bool _fixedUpdate)
{
if (stateStart && !_fixedUpdate)
{
if (onStateOutOfAmmoStart != null)
{
onStateOutOfAmmoStart.Invoke();
}
stateStart = false;
prevToggleState = itemToggle.toggleState;
}
if (!_fixedUpdate)
{
if (itemBattery.batteryLifeInt > 0)
{
StateSet(State.Idle);
return;
}
ShootLogic();
if (hasOutOfAmmoUpdate)
{
onStateOutOfAmmoUpdate.Invoke();
}
}
if (_fixedUpdate && hasOutOfAmmoFixedUpdate)
{
onStateOutOfAmmoFixedUpdate.Invoke();
}
}
private void StateBuildup(bool _fixedUpdate)
{
if (stateStart && !_fixedUpdate)
{
if (onStateBuildupStart != null)
{
onStateBuildupStart.Invoke();
}
stateTimer = 0f;
stateTimeMax = buildUpTime;
stateStart = false;
}
if (!_fixedUpdate)
{
if (hasBuildupUpdate)
{
onStateBuildupUpdate.Invoke();
}
stateTimer += Time.deltaTime;
if (Object.op_Implicit((Object)(object)itemEquippable) && itemEquippable.isEquipped)
{
StateSet(State.Idle);
}
if (stateTimer >= stateTimeMax && itemBattery.batteryLifeInt > 0)
{
StateSet(State.Shooting);
}
}
if (_fixedUpdate && hasBuildupFixedUpdate)
{
onStateBuildupFixedUpdate.Invoke();
}
}
private void StateShooting(bool _fixedUpdate)
{
if (stateStart && !_fixedUpdate)
{
stateStart = false;
if (onStateShootingStart != null)
{
onStateShootingStart.Invoke();
}
if (!hasOneShot)
{
stateTimeMax = shootTime;
stateTimer = 0f;
investigateCooldown = 0f;
}
else
{
stateTimer = 0.001f;
}
if (itemBattery.batteryLifeInt > 0)
{
itemBattery.RemoveFullBar(1);
}
}
if (!_fixedUpdate)
{
if (investigateRadius > 0f)
{
if (investigateCooldown <= 0f)
{
investigateCooldown = 0.5f;
}
else
{
investigateCooldown -= Time.deltaTime;
}
}
stateTimer += Time.deltaTime;
if (stateTimer >= stateTimeMax || (Object.op_Implicit((Object)(object)itemEquippable) && itemEquippable.isEquipped))
{
StateSet(State.Reloading);
}
if (hasShootingUpdate)
{
onStateShootingUpdate.Invoke();
}
}
if (_fixedUpdate && hasShootingFixedUpdate)
{
onStateShootingFixedUpdate.Invoke();
}
}
private void StateReloading(bool _fixedUpdate)
{
if (stateStart && !_fixedUpdate)
{
stateStart = false;
if (onStateReloadingStart != null)
{
onStateReloadingStart.Invoke();
}
stateTimeMax = shootCooldown;
stateTimer = 0f;
}
if (!_fixedUpdate)
{
stateTimer += Time.deltaTime;
if (stateTimer >= stateTimeMax)
{
if (itemBattery.batteryLifeInt > 0)
{
StateSet(State.Idle);
}
else
{
StateSet(State.OutOfAmmo);
}
}
if (hasReloadingUpdate)
{
onStateReloadingUpdate.Invoke();
}
}
if (_fixedUpdate && hasReloadingFixedUpdate)
{
onStateReloadingFixedUpdate.Invoke();
}
}
}
public class RocketProj : MonoBehaviour
{
[CompilerGenerated]
private sealed class <LateSpawn>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public RocketProj <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LateSpawn>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (!<>4__this.physGrabObject.spawned || <>4__this.rb.isKinematic)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>4__this.itemToggle.ToggleItem(true, -1);
<>4__this.rb.AddForce(<>4__this.startDirection * (float)Random.Range(10, 10), (ForceMode)1);
<>4__this.itemGrenade.isSpawnedGrenade = true;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private ParticleScriptExplosion particleScriptExplosion;
private ItemToggle itemToggle;
private ImpactGrenade itemGrenade;
private PhotonView photonView;
private PhysGrabObject physGrabObject;
private Rigidbody rb;
public Sound soundExplosion;
public Sound soundExplosionGlobal;
private Vector3 startDirection;
public bool alwaysFlying;
private void Start()
{
Initialize();
}
public void Initialize()
{
particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
itemToggle = ((Component)this).GetComponent<ItemToggle>();
itemGrenade = ((Component)this).GetComponent<ImpactGrenade>();
photonView = ((Component)this).GetComponent<PhotonView>();
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
rb = ((Component)this).GetComponent<Rigidbody>();
}
public void Spawn()
{
((MonoBehaviour)this).StartCoroutine(LateSpawn());
itemGrenade.isSpawnedGrenade = true;
}
private void Update()
{
//IL_003f: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)itemToggle == (Object)null) && !((Object)(object)rb == (Object)null))
{
if (alwaysFlying)
{
rb.AddForce(((Component)this).transform.forward * 100f, (ForceMode)0);
}
else if (itemToggle.toggleState)
{
rb.freezeRotation = true;
rb.AddForce(((Component)this).transform.forward * 100f, (ForceMode)0);
rb.useGravity = true;
}
else
{
rb.freezeRotation = false;
rb.useGravity = false;
}
}
}
[IteratorStateMachine(typeof(<LateSpawn>d__14))]
private IEnumerator LateSpawn()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LateSpawn>d__14(0)
{
<>4__this = this
};
}
public void ReceiveDirection(Vector3 direction)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
startDirection = ((Vector3)(ref direction)).normalized;
((Component)this).transform.forward = startDirection;
}
public void Explosion()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)"Grenade explosion");
particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
particleScriptExplosion.Spawn(((Component)this).transform.position, 1.2f, 120, 500, 2f, false, true, 1f);
soundExplosion.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
soundExplosionGlobal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
}
}
}
namespace RocketLauncherScripts
{
[HarmonyPatch(typeof(PlayerController))]
internal static class ExamplePlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
RocketLauncherScripts.Logger.LogDebug((object)$"{__instance} Start Prefix");
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(PlayerController __instance)
{
RocketLauncherScripts.Logger.LogDebug((object)$"{__instance} Start Postfix");
}
}
[BepInPlugin("SammyCadian.RocketLauncherScripts", "RocketLauncherScripts", "1.0")]
public class RocketLauncherScripts : BaseUnityPlugin
{
internal static RocketLauncherScripts Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
internal RocketLauncher? rocketLauncherScriptInstance { get; private set; }
internal RocketProj? rocketProjScriptInstance { get; private set; }
internal ImpactGrenade? ImpactGrenadeScriptInstance { get; private set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
rocketLauncherScriptInstance = ((Component)this).gameObject.AddComponent<RocketLauncher>();
rocketProjScriptInstance = ((Component)this).gameObject.AddComponent<RocketProj>();
ImpactGrenadeScriptInstance = ((Component)this).gameObject.AddComponent<ImpactGrenade>();
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}