using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BigWalkFunMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BigWalkFunMod")]
[assembly: AssemblyTitle("BigWalkFunMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 BigWalkFunMod
{
[HarmonyPatch(typeof(PlayerActions), "ActionUseHeldSwitch")]
internal static class FlareGunUsePatch
{
[HarmonyPrefix]
private static bool BeforeUse(PlayerActions __instance)
{
RocketLauncherController instance = RocketLauncherController.Instance;
if ((Object)(object)instance == (Object)null || instance.IsInternalShot)
{
return true;
}
if (!instance.IsLocalFlareGunAction(__instance))
{
return true;
}
return !instance.IsBusy;
}
[HarmonyPostfix]
private static void AfterUse(PlayerActions __instance)
{
RocketLauncherController instance = RocketLauncherController.Instance;
if (!((Object)(object)instance == (Object)null) && !instance.IsInternalShot && !instance.IsBusy && instance.IsLocalFlareGunAction(__instance))
{
instance.BeginBurstAfterOriginalShot(__instance.playerCharacter);
}
}
}
[BepInPlugin("charl.bigwalk.funmod", "Big Walk Fun Mod", "1.11.0")]
public sealed class Plugin : BasePlugin
{
public const string PluginGuid = "charl.bigwalk.funmod";
public const string PluginName = "Big Walk Fun Mod";
public const string PluginVersion = "1.11.0";
internal static Plugin Instance { get; private set; }
internal static ConfigEntry<KeyCode> DiagnosticKey { get; private set; }
internal static ConfigEntry<int> MinimumFlares { get; private set; }
internal static ConfigEntry<int> MaximumFlares { get; private set; }
internal static ConfigEntry<float> ShotIntervalSeconds { get; private set; }
internal static ConfigEntry<float> ReloadSeconds { get; private set; }
public override void Load()
{
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
Instance = this;
DiagnosticKey = ((BasePlugin)this).Config.Bind<KeyCode>("Rocket Launcher", "Diagnostic key", (KeyCode)288, "Logs the currently held item and launcher state.");
MinimumFlares = ((BasePlugin)this).Config.Bind<int>("Rocket Launcher", "Minimum flares", 5, "Minimum number of flares in each burst.");
MaximumFlares = ((BasePlugin)this).Config.Bind<int>("Rocket Launcher", "Maximum flares", 8, "Maximum number of flares in each burst.");
bool flag = default(bool);
if (MaximumFlares.Value > 8)
{
ManualLogSource log = ((BasePlugin)this).Log;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(61, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Reducing stored maximum flare count from ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(MaximumFlares.Value);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to 8 for stability.");
}
log.LogWarning(val);
MaximumFlares.Value = 8;
}
ShotIntervalSeconds = ((BasePlugin)this).Config.Bind<float>("Rocket Launcher", "Shot interval seconds", 0.18f, "Delay between repeated uses of the held flare gun.");
ReloadSeconds = ((BasePlugin)this).Config.Bind<float>("Rocket Launcher", "Reload seconds", 2f, "Length of the visual reload and firing lockout after each burst.");
((BasePlugin)this).AddComponent<RocketLauncherController>();
Harmony.CreateAndPatchAll(typeof(FlareGunUsePatch), "charl.bigwalk.funmod");
Harmony.CreateAndPatchAll(typeof(PropPickupPatch), "charl.bigwalk.funmod");
ManualLogSource log2 = ((BasePlugin)this).Log;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(80, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Big Walk Fun Mod");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("1.11.0");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded. The launcher replaces the Yellow flare gun at its normal world spawn.");
}
log2.LogInfo(val2);
}
}
[HarmonyPatch(typeof(PlayerActions), "ActionPickUpProp")]
internal static class PropPickupPatch
{
[HarmonyPrefix]
private static void BeforePickup(PlayerActions __instance, Prop __0)
{
RocketLauncherController.Instance?.RecordPickedUpProp(__instance, __0);
}
}
public sealed class RocketLauncherController : MonoBehaviour
{
private PlayerCharacter _burstPlayer;
private int _shotsRemaining;
private int _burstSize;
private float _nextShotTime;
private bool _releasePending;
private float _releaseTime;
private bool _reloading;
private float _reloadStartTime;
private Prop _visualProp;
private Prop _yellowLauncherProp;
private Transform _visualRoot;
private Transform _barrelDrum;
private Transform _reloadCanister;
private Transform _loadedRocket;
private Collider _originalPickupCollider;
private BoxCollider _launcherPickupCollider;
private BoxCollider _registeredBoxCollider;
private CapsuleCollider _registeredCapsuleCollider;
private SphereCollider _registeredSphereCollider;
private MeshCollider _registeredMeshCollider;
private bool _usesRegisteredPickupCollider;
private int _launcherInteractionLayer = -1;
private Material _launcherBaseMaterial;
private Vector3 _visualBasePosition;
private Vector3 _canisterBasePosition;
private float _drumAngle;
private float _reloadStartAngle;
private float _nextVisualCheckTime;
private bool _loggedVisualDiagnostics;
private bool _launcherEquipped;
internal static RocketLauncherController Instance { get; private set; }
internal bool IsInternalShot { get; private set; }
internal bool IsBusy
{
get
{
if (_shotsRemaining <= 0 && !_releasePending)
{
return _reloading;
}
return true;
}
}
public RocketLauncherController(IntPtr pointer)
: base(pointer)
{
}
private void Awake()
{
Instance = this;
}
private void OnDestroy()
{
if ((Object)(object)Instance == (Object)(object)this)
{
Instance = null;
}
}
private void Update()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
ProcessPendingRelease();
ProcessBurst();
ProcessReloadAnimation();
ProcessVisualRecoil();
if (Time.unscaledTime >= _nextVisualCheckTime)
{
_nextVisualCheckTime = Time.unscaledTime + 0.5f;
EnsureWorldLauncherVisuals();
}
if (Input.GetKeyDown(Plugin.DiagnosticKey.Value))
{
LogState();
}
}
private void LateUpdate()
{
//IL_0089: 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_007a: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Expected O, but got Unknown
//IL_01e4: 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_0224: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_visualProp != (Object)null) || !((Object)(object)_visualRoot != (Object)null))
{
return;
}
SuppressOriginalRenderers(_visualProp);
Renderer[] array = Il2CppArrayBase<Renderer>.op_Implicit(((Component)_visualRoot).GetComponentsInChildren<Renderer>(true));
Renderer[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
array2[i].enabled = true;
}
if (!_loggedVisualDiagnostics)
{
_loggedVisualDiagnostics = true;
Bounds val = (Bounds)((array.Length != 0) ? array[0].bounds : new Bounds(_visualRoot.position, Vector3.zero));
for (int j = 1; j < array.Length; j++)
{
((Bounds)(ref val)).Encapsulate(array[j].bounds);
}
PlayerCharacter val2 = FindLocalPlayer();
Transform val3 = (((Object)(object)val2 != (Object)null) ? val2.cameraTransform : null);
float num = (((Object)(object)val3 != (Object)null) ? Vector3.Distance(val3.position, ((Bounds)(ref val)).center) : (-1f));
Camera main = Camera.main;
int num2 = (((Object)(object)main != (Object)null) ? main.cullingMask : 0);
bool flag = (Object)(object)main != (Object)null && (num2 & (1 << ((Component)_visualRoot).gameObject.layer)) != 0;
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag2 = default(bool);
BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(158, 9, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Launcher render diagnostic: renderers=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(array.Length);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("active=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<bool>(((Component)_visualRoot).gameObject.activeInHierarchy);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", layer=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((Component)_visualRoot).gameObject.layer);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("rootWorldScale=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Vector3>(_visualRoot.lossyScale);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", boundsSize=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Vector3>(((Bounds)(ref val)).size);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("boundsCenter=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Vector3>(((Bounds)(ref val)).center);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", cameraDistance=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(num, "F2");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("mainCameraMask=0x");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num2, "X8");
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", cameraRendersLayer=");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<bool>(flag);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(".");
}
log.LogInfo(val4);
}
}
internal bool IsLocalFlareGunAction(PlayerActions actions)
{
PlayerCharacter val = ((actions != null) ? actions.playerCharacter : null);
if (_launcherEquipped && (Object)(object)val != (Object)null && ((NetworkBehaviour)val).isLocalPlayer)
{
return IsFlareGun(GetHeldProp(val));
}
return false;
}
internal void RecordPickedUpProp(PlayerActions actions, Prop pickedProp)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
PlayerCharacter val = ((actions != null) ? actions.playerCharacter : null);
if (!((Object)(object)val == (Object)null) && ((NetworkBehaviour)val).isLocalPlayer)
{
bool flag = (_launcherEquipped = IsKnownYellowLauncher(pickedProp));
if (!flag)
{
CancelBurst();
}
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag2 = default(bool);
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Pickup classification: prop='");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)(object)pickedProp != (Object)null) ? ((Object)((Component)pickedProp).gameObject).name : "none");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', ");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("yellowLauncher=");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(flag);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
}
log.LogInfo(val2);
}
}
internal void BeginBurstAfterOriginalShot(PlayerCharacter player)
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
Prop heldProp = GetHeldProp(player);
if (_launcherEquipped && IsFlareGun(heldProp))
{
EnsureLauncherVisual(heldProp);
if ((Object)(object)_loadedRocket != (Object)null)
{
((Component)_loadedRocket).gameObject.SetActive(false);
}
int num = Math.Max(1, Plugin.MinimumFlares.Value);
int num2 = Math.Max(num, Plugin.MaximumFlares.Value);
_burstSize = Random.Range(num, num2 + 1);
_shotsRemaining = _burstSize - 1;
_burstPlayer = player;
_nextShotTime = Time.unscaledTime + Math.Max(0.08f, Plugin.ShotIntervalSeconds.Value);
AdvanceDrum();
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(64, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Rocket launcher started ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_burstSize);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("-shot burst from normal flare-gun input.");
}
log.LogInfo(val);
if (_shotsRemaining == 0)
{
BeginReload();
}
}
}
private void ProcessBurst()
{
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Expected O, but got Unknown
if (_shotsRemaining <= 0 || Time.unscaledTime < _nextShotTime)
{
return;
}
Prop heldProp = GetHeldProp(_burstPlayer);
if (!_launcherEquipped || (Object)(object)_burstPlayer == (Object)null || _burstPlayer.actions == null || !IsFlareGun(heldProp))
{
((BasePlugin)Plugin.Instance).Log.LogWarning((object)"Rocket launcher burst cancelled because the launcher is no longer held.");
CancelBurst();
return;
}
try
{
IsInternalShot = true;
_burstPlayer.actions.ActionUseHeldSwitch();
}
finally
{
IsInternalShot = false;
}
_releasePending = true;
_releaseTime = Time.unscaledTime + 0.05f;
_shotsRemaining--;
_nextShotTime = Time.unscaledTime + Math.Max(0.08f, Plugin.ShotIntervalSeconds.Value);
AdvanceDrum();
if (_shotsRemaining == 0)
{
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Rocket launcher completed ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_burstSize);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("-shot burst; reloading.");
}
log.LogInfo(val);
}
}
private void ProcessPendingRelease()
{
if (_releasePending && !(Time.unscaledTime < _releaseTime))
{
_releasePending = false;
if ((Object)(object)_burstPlayer != (Object)null && _burstPlayer.actions != null)
{
_burstPlayer.actions.ActionUseHeldUpSwitch();
}
if (_shotsRemaining == 0)
{
BeginReload();
}
}
}
private void BeginReload()
{
if (!_reloading)
{
_reloading = true;
_reloadStartTime = Time.unscaledTime;
_reloadStartAngle = _drumAngle;
}
}
private void ProcessReloadAnimation()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: 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)
if (!_reloading)
{
return;
}
float num = Math.Max(0.25f, Plugin.ReloadSeconds.Value);
float num2 = Mathf.Clamp01((Time.unscaledTime - _reloadStartTime) / num);
float num3 = num2 * num2 * (3f - 2f * num2);
if ((Object)(object)_barrelDrum != (Object)null)
{
_barrelDrum.localRotation = Quaternion.Euler(0f, 0f, _reloadStartAngle + 360f * num3);
}
if ((Object)(object)_reloadCanister != (Object)null)
{
float num4 = Mathf.Sin(num2 * (float)Math.PI) * 0.16f;
_reloadCanister.localPosition = _canisterBasePosition + Vector3.back * num4;
}
if (!(num2 < 1f))
{
_reloading = false;
_drumAngle = Mathf.Repeat(_reloadStartAngle, 360f);
if ((Object)(object)_barrelDrum != (Object)null)
{
_barrelDrum.localRotation = Quaternion.Euler(0f, 0f, _drumAngle);
}
if ((Object)(object)_reloadCanister != (Object)null)
{
_reloadCanister.localPosition = _canisterBasePosition;
}
_burstPlayer = null;
if ((Object)(object)_loadedRocket != (Object)null)
{
((Component)_loadedRocket).gameObject.SetActive(true);
}
((BasePlugin)Plugin.Instance).Log.LogInfo((object)"Rocket launcher reload complete.");
}
}
private void AdvanceDrum()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
_drumAngle += 60f;
if ((Object)(object)_barrelDrum != (Object)null && !_reloading)
{
_barrelDrum.localRotation = Quaternion.Euler(0f, 0f, _drumAngle);
}
}
private void ProcessVisualRecoil()
{
//IL_004d: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_visualRoot == (Object)null))
{
float num = ((_shotsRemaining > 0) ? Mathf.Clamp01((_nextShotTime - Time.unscaledTime) / Math.Max(0.08f, Plugin.ShotIntervalSeconds.Value)) : 0f);
_visualRoot.localPosition = _visualBasePosition + Vector3.back * (0.045f * num);
}
}
private void EnsureWorldLauncherVisuals()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
PlayerCharacter player = FindLocalPlayer();
Prop heldProp = GetHeldProp(player);
if (!_launcherEquipped && IsAnyFlareGun(heldProp) && IsKnownYellowLauncher(heldProp))
{
_launcherEquipped = true;
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Launcher equipped by held-instance detection: '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)heldProp).gameObject).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'.");
}
log.LogInfo(val);
}
if (_launcherEquipped && IsAnyFlareGun(heldProp))
{
EnsureLauncherVisual(heldProp);
AttachHeldVisual(player);
return;
}
if (_launcherEquipped && (Object)(object)heldProp == (Object)null)
{
_launcherEquipped = false;
CancelBurst();
}
Prop[] array = Il2CppArrayBase<Prop>.op_Implicit(Resources.FindObjectsOfTypeAll<Prop>());
foreach (Prop val2 in array)
{
if ((Object)(object)val2 != (Object)null)
{
Scene scene = ((Component)val2).gameObject.scene;
if (((Scene)(ref scene)).IsValid() && IsYellowWorldFlareGun(val2))
{
_yellowLauncherProp = val2;
EnsureLauncherVisual(val2);
AttachWorldVisual(val2);
break;
}
}
}
}
private void EnsureLauncherVisual(Prop prop)
{
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_0389: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0401: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: 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_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
//IL_0482: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
//IL_04f7: 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_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
//IL_0548: Unknown result type (might be due to invalid IL or missing references)
//IL_054d: Unknown result type (might be due to invalid IL or missing references)
//IL_0561: Unknown result type (might be due to invalid IL or missing references)
//IL_0566: Unknown result type (might be due to invalid IL or missing references)
//IL_058a: Unknown result type (might be due to invalid IL or missing references)
//IL_058f: Unknown result type (might be due to invalid IL or missing references)
//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
//IL_060e: Unknown result type (might be due to invalid IL or missing references)
//IL_0622: Unknown result type (might be due to invalid IL or missing references)
//IL_0636: Unknown result type (might be due to invalid IL or missing references)
//IL_063b: Unknown result type (might be due to invalid IL or missing references)
//IL_0648: Unknown result type (might be due to invalid IL or missing references)
//IL_064f: Expected O, but got Unknown
//IL_0683: Unknown result type (might be due to invalid IL or missing references)
//IL_069a: Unknown result type (might be due to invalid IL or missing references)
//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0704: Unknown result type (might be due to invalid IL or missing references)
//IL_0709: Unknown result type (might be due to invalid IL or missing references)
//IL_072e: Unknown result type (might be due to invalid IL or missing references)
//IL_0742: Unknown result type (might be due to invalid IL or missing references)
//IL_0756: Unknown result type (might be due to invalid IL or missing references)
//IL_075b: Unknown result type (might be due to invalid IL or missing references)
//IL_076e: Unknown result type (might be due to invalid IL or missing references)
//IL_0773: Unknown result type (might be due to invalid IL or missing references)
//IL_077d: Unknown result type (might be due to invalid IL or missing references)
//IL_0784: Expected O, but got Unknown
//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
//IL_07de: Unknown result type (might be due to invalid IL or missing references)
//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0806: Unknown result type (might be due to invalid IL or missing references)
//IL_080b: Unknown result type (might be due to invalid IL or missing references)
//IL_082f: Unknown result type (might be due to invalid IL or missing references)
//IL_0843: Unknown result type (might be due to invalid IL or missing references)
//IL_0857: Unknown result type (might be due to invalid IL or missing references)
//IL_085c: Unknown result type (might be due to invalid IL or missing references)
//IL_0880: Unknown result type (might be due to invalid IL or missing references)
//IL_0885: Unknown result type (might be due to invalid IL or missing references)
//IL_0899: Unknown result type (might be due to invalid IL or missing references)
//IL_089e: Unknown result type (might be due to invalid IL or missing references)
//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
//IL_08db: Unknown result type (might be due to invalid IL or missing references)
//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0904: Expected O, but got Unknown
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0995: Unknown result type (might be due to invalid IL or missing references)
//IL_09af: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_visualProp == (Object)(object)prop && (Object)(object)_visualRoot != (Object)null)
{
SuppressOriginalRenderers(prop);
return;
}
if ((Object)(object)_visualRoot != (Object)null && (Object)(object)_visualProp != (Object)null && (Object)(object)_visualProp != (Object)(object)prop)
{
RestoreOriginalRenderers(_visualProp);
if ((Object)(object)_launcherPickupCollider != (Object)null)
{
((Collider)_launcherPickupCollider).enabled = false;
}
Object.Destroy((Object)(object)((Component)_visualRoot).gameObject);
_visualRoot = null;
_barrelDrum = null;
_reloadCanister = null;
_loadedRocket = null;
_originalPickupCollider = null;
_launcherPickupCollider = null;
_registeredBoxCollider = null;
_registeredCapsuleCollider = null;
_registeredSphereCollider = null;
_registeredMeshCollider = null;
_usesRegisteredPickupCollider = false;
}
_visualProp = prop;
CaptureVisiblePropMaterial(prop);
CaptureInteractionLayer(prop);
Transform transform = ((Component)prop).transform;
Transform val = transform.Find("BigWalkRocketLauncherVisual");
if ((Object)(object)val != (Object)null)
{
_visualRoot = val;
_barrelDrum = val.Find("BarrelDrum");
_reloadCanister = val.Find("ReloadCanister");
_loadedRocket = val.Find("LoadedRocket");
_visualBasePosition = _visualRoot.localPosition;
_canisterBasePosition = (((Object)(object)_reloadCanister != (Object)null) ? _reloadCanister.localPosition : Vector3.zero);
SuppressOriginalRenderers(prop);
return;
}
SuppressOriginalRenderers(prop);
GameObject val2 = new GameObject("BigWalkRocketLauncherVisual");
val2.layer = ((Component)prop).gameObject.layer;
val2.SetActive(true);
_visualRoot = val2.transform;
_visualRoot.SetParent(transform, false);
_visualRoot.localPosition = Vector3.zero;
_visualRoot.localRotation = Quaternion.identity;
Vector3 lossyScale = transform.lossyScale;
_visualRoot.localScale = new Vector3(SafeInverseScale(lossyScale.x), SafeInverseScale(lossyScale.y), SafeInverseScale(lossyScale.z));
_visualBasePosition = _visualRoot.localPosition;
_loggedVisualDiagnostics = false;
Color color = default(Color);
((Color)(ref color))..ctor(0.2f, 0.27f, 0.12f);
Color color2 = default(Color);
((Color)(ref color2))..ctor(0.055f, 0.065f, 0.07f);
Color color3 = default(Color);
((Color)(ref color3))..ctor(0.16f, 0.18f, 0.17f);
Color color4 = default(Color);
((Color)(ref color4))..ctor(0.95f, 0.25f, 0.035f);
CreatePart("MainLaunchTube", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, -0.56f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.115f, 0.68f, 0.115f), color);
CreatePart("MuzzleCollar", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, -1.26f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.165f, 0.075f, 0.165f), color2);
CreatePart("MuzzleOpening", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, -1.342f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.132f, 0.008f, 0.132f), new Color(0.01f, 0.01f, 0.012f));
CreatePart("RearVent", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, 0.15f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.175f, 0.1f, 0.175f), color2);
CreatePart("RearVentOpening", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, 0.258f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.138f, 0.008f, 0.138f), new Color(0.01f, 0.01f, 0.012f));
CreatePart("ShoulderRest", (PrimitiveType)3, _visualRoot, new Vector3(0f, -0.055f, 0.06f), Quaternion.identity, new Vector3(0.27f, 0.27f, 0.12f), color2);
CreatePart("PistolGrip", (PrimitiveType)3, _visualRoot, new Vector3(0f, -0.19f, -0.62f), Quaternion.Euler(-12f, 0f, 0f), new Vector3(0.095f, 0.28f, 0.13f), color2);
CreatePart("ForwardGrip", (PrimitiveType)3, _visualRoot, new Vector3(0f, -0.17f, -0.88f), Quaternion.Euler(8f, 0f, 0f), new Vector3(0.08f, 0.23f, 0.1f), color2);
CreatePart("SightRail", (PrimitiveType)3, _visualRoot, new Vector3(0f, 0.14f, -0.55f), Quaternion.identity, new Vector3(0.06f, 0.04f, 0.64f), color3);
CreatePart("RearSight", (PrimitiveType)3, _visualRoot, new Vector3(0f, 0.2f, -0.16f), Quaternion.identity, new Vector3(0.12f, 0.08f, 0.035f), color2);
CreatePart("FrontSight", (PrimitiveType)3, _visualRoot, new Vector3(0f, 0.19f, -1.04f), Quaternion.identity, new Vector3(0.05f, 0.07f, 0.035f), color2);
CreatePart("WarningBand", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, -0.98f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.122f, 0.035f, 0.122f), color4);
GameObject val3 = new GameObject("BarrelDrum");
_barrelDrum = val3.transform;
_barrelDrum.SetParent(_visualRoot, false);
_barrelDrum.localPosition = new Vector3(0f, 0.015f, -0.12f);
CreatePart("ReloadRing", (PrimitiveType)2, _barrelDrum, Vector3.zero, Quaternion.Euler(90f, 0f, 0f), new Vector3(0.122f, 0.045f, 0.122f), color3);
CreatePart("ReloadRingHandle", (PrimitiveType)3, _barrelDrum, new Vector3(0.13f, 0f, 0f), Quaternion.identity, new Vector3(0.06f, 0.045f, 0.07f), color4);
_reloadCanister = CreatePart("ReloadCanister", (PrimitiveType)2, _visualRoot, new Vector3(0f, 0.015f, 0.02f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.085f, 0.13f, 0.085f), color4);
_canisterBasePosition = _reloadCanister.localPosition;
GameObject val4 = new GameObject("LoadedRocket");
_loadedRocket = val4.transform;
_loadedRocket.SetParent(_visualRoot, false);
_loadedRocket.localPosition = new Vector3(0f, 0.015f, -1.48f);
CreatePart("RocketWarhead", (PrimitiveType)1, _loadedRocket, new Vector3(0f, 0f, -0.09f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.1f, 0.18f, 0.1f), color4);
CreatePart("RocketMotor", (PrimitiveType)2, _loadedRocket, new Vector3(0f, 0f, 0.13f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.068f, 0.13f, 0.068f), color3);
CreatePart("RocketFinTop", (PrimitiveType)3, _loadedRocket, new Vector3(0f, 0.09f, 0.22f), Quaternion.identity, new Vector3(0.025f, 0.13f, 0.14f), color4);
CreatePart("RocketFinSide", (PrimitiveType)3, _loadedRocket, new Vector3(0.09f, 0f, 0.22f), Quaternion.identity, new Vector3(0.13f, 0.025f, 0.14f), color4);
CreateRegisteredPickupCollider();
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val5 = new BepInExInfoLogInterpolatedStringHandler(114, 5, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Replaced world/held '");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(((Object)((Component)prop).gameObject).name);
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("' visual with a rocket launcher ");
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("(active=");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<bool>(((Component)_visualRoot).gameObject.activeInHierarchy);
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", layer=");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<int>(((Component)_visualRoot).gameObject.layer);
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("parentWorldScale=");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector3>(lossyScale);
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", compensatedLocalScale=");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Vector3>(_visualRoot.localScale);
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(").");
}
log.LogInfo(val5);
}
private void AttachHeldVisual(PlayerCharacter player)
{
//IL_008a: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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)
if (!((Object)(object)_visualRoot == (Object)null) && !((Object)(object)player == (Object)null) && !((Object)(object)player.cameraTransform == (Object)null))
{
Camera main = Camera.main;
Transform val = (((Object)(object)main != (Object)null) ? ((Component)main).transform : player.cameraTransform);
bool num = (Object)(object)_visualRoot.parent != (Object)(object)val;
if ((Object)(object)_visualRoot.parent != (Object)(object)val)
{
_visualRoot.SetParent(val, false);
}
_visualRoot.localPosition = new Vector3(0.1f, -0.47f, 0.42f);
_visualRoot.localRotation = Quaternion.Euler(7f, 176f, -3f);
_visualRoot.localScale = Vector3.one * 0.78f;
_visualBasePosition = _visualRoot.localPosition;
if ((Object)(object)_launcherPickupCollider != (Object)null && !_usesRegisteredPickupCollider)
{
((Collider)_launcherPickupCollider).enabled = false;
}
SetLayerRecursive(layer: GetHeldPropRenderLayer(_visualProp), root: _visualRoot);
if (num)
{
_loggedVisualDiagnostics = false;
}
}
}
private void AttachWorldVisual(Prop prop)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: 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)
//IL_009a: 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_00b6: 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)
if (!((Object)(object)_visualRoot == (Object)null) && !((Object)(object)prop == (Object)null))
{
bool num = (Object)(object)_visualRoot.parent != (Object)(object)((Component)prop).transform;
if (num)
{
_visualRoot.SetParent(((Component)prop).transform, false);
}
Vector3 lossyScale = ((Component)prop).transform.lossyScale;
_visualRoot.localPosition = new Vector3(0f, 0f, 0.58f);
_visualRoot.localRotation = Quaternion.identity;
_visualRoot.localScale = new Vector3(SafeInverseScale(lossyScale.x), SafeInverseScale(lossyScale.y), SafeInverseScale(lossyScale.z));
_visualBasePosition = _visualRoot.localPosition;
if ((Object)(object)_launcherPickupCollider != (Object)null && !_usesRegisteredPickupCollider)
{
((Collider)_launcherPickupCollider).enabled = true;
}
UpdateRegisteredPickupColliderBounds();
SetLayerRecursive(_visualRoot, ((Component)prop).gameObject.layer);
if ((Object)(object)_launcherPickupCollider != (Object)null && !_usesRegisteredPickupCollider)
{
((Component)_launcherPickupCollider).gameObject.layer = ((_launcherInteractionLayer >= 0) ? _launcherInteractionLayer : ((Component)prop).gameObject.layer);
}
if (num)
{
_loggedVisualDiagnostics = false;
}
}
}
private Transform CreatePart(string name, PrimitiveType primitive, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale, Color color)
{
//IL_0000: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: 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)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive(primitive);
((Object)val).name = name;
val.layer = ((Component)parent).gameObject.layer;
val.transform.SetParent(parent, false);
val.transform.localPosition = localPosition;
val.transform.localRotation = localRotation;
val.transform.localScale = localScale;
Collider component = val.GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
Renderer component2 = val.GetComponent<Renderer>();
if ((Object)(object)component2 != (Object)null)
{
Material val2 = (Material)((!((Object)(object)_launcherBaseMaterial != (Object)null)) ? ((object)component2.material) : ((object)new Material(_launcherBaseMaterial)));
val2.color = color;
if (val2.HasProperty("_BaseColor"))
{
val2.SetColor("_BaseColor", color);
}
if (val2.HasProperty("_Color"))
{
val2.SetColor("_Color", color);
}
component2.sharedMaterial = val2;
}
MeshFilter component3 = val.GetComponent<MeshFilter>();
if ((Object)(object)component3 != (Object)null)
{
Mesh mesh = component3.mesh;
Color[] array = (Color[])(object)new Color[mesh.vertexCount];
for (int i = 0; i < array.Length; i++)
{
array[i] = color;
}
mesh.colors = Il2CppStructArray<Color>.op_Implicit(array);
}
return val.transform;
}
private void CaptureVisiblePropMaterial(Prop prop)
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
if ((Object)(object)_launcherBaseMaterial != (Object)null || (Object)(object)prop == (Object)null)
{
return;
}
Renderer[] array = Il2CppArrayBase<Renderer>.op_Implicit(((Component)prop).GetComponentsInChildren<Renderer>(true));
bool flag = default(bool);
foreach (Renderer val in array)
{
bool num = (Object)(object)_visualRoot != (Object)null && ((Object)(object)((Component)val).transform == (Object)(object)_visualRoot || ((Component)val).transform.IsChildOf(_visualRoot));
Material sharedMaterial = val.sharedMaterial;
if (!num && (Object)(object)sharedMaterial != (Object)null && (Object)(object)sharedMaterial.shader != (Object)null)
{
_launcherBaseMaterial = sharedMaterial;
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(63, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Launcher material source: renderer='");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)val).gameObject).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', ");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("shader='");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)sharedMaterial.shader).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', renderQueue=");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(sharedMaterial.renderQueue);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
}
log.LogInfo(val2);
return;
}
}
((BasePlugin)Plugin.Instance).Log.LogWarning((object)"Launcher material source: no original flare-gun material was found; primitive fallback will be used.");
}
private void CaptureInteractionLayer(Prop prop)
{
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Expected O, but got Unknown
if ((Object)(object)prop == (Object)null)
{
return;
}
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(((Component)prop).GetComponentsInChildren<Collider>(true));
bool flag = default(bool);
foreach (Collider val in array)
{
if (!((Object)(object)_visualRoot != (Object)null) || (!((Object)(object)((Component)val).transform == (Object)(object)_visualRoot) && !((Component)val).transform.IsChildOf(_visualRoot)))
{
_originalPickupCollider = val;
_registeredBoxCollider = ((Component)val).gameObject.GetComponent<BoxCollider>();
_registeredCapsuleCollider = ((Component)val).gameObject.GetComponent<CapsuleCollider>();
_registeredSphereCollider = ((Component)val).gameObject.GetComponent<SphereCollider>();
_registeredMeshCollider = ((Component)val).gameObject.GetComponent<MeshCollider>();
_launcherInteractionLayer = ((Component)val).gameObject.layer;
string text = (((Object)(object)_registeredBoxCollider != (Object)null) ? "BoxCollider" : (((Object)(object)_registeredCapsuleCollider != (Object)null) ? "CapsuleCollider" : (((Object)(object)_registeredSphereCollider != (Object)null) ? "SphereCollider" : (((Object)(object)_registeredMeshCollider != (Object)null) ? "MeshCollider" : ((object)val).GetType().Name))));
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(61, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Launcher pickup source: collider='");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)((Component)val).gameObject).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', ");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("type=");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", layer=");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(_launcherInteractionLayer);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("trigger=");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(val.isTrigger);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(".");
}
log.LogInfo(val2);
return;
}
}
_launcherInteractionLayer = ((Component)prop).gameObject.layer;
ManualLogSource log2 = ((BasePlugin)Plugin.Instance).Log;
BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(70, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Launcher pickup source: no original collider found; using prop layer ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(_launcherInteractionLayer);
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(".");
}
log2.LogWarning(val3);
}
private void CreateRegisteredPickupCollider()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
if (!((Object)(object)_originalPickupCollider == (Object)null) && !((Object)(object)_launcherPickupCollider != (Object)null))
{
if ((Object)(object)_registeredBoxCollider != (Object)null)
{
_launcherPickupCollider = _registeredBoxCollider;
_usesRegisteredPickupCollider = true;
}
else if ((Object)(object)_registeredCapsuleCollider != (Object)null || (Object)(object)_registeredSphereCollider != (Object)null || (Object)(object)_registeredMeshCollider != (Object)null)
{
_usesRegisteredPickupCollider = true;
}
else
{
_launcherPickupCollider = ((Component)_originalPickupCollider).gameObject.AddComponent<BoxCollider>();
((Collider)_launcherPickupCollider).isTrigger = _originalPickupCollider.isTrigger;
}
UpdateRegisteredPickupColliderBounds();
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(81, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Launcher pickup collider expanded on registered object '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)_originalPickupCollider).gameObject).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' ");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("(registeredComponent=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_usesRegisteredPickupCollider);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
}
log.LogInfo(val);
}
}
private void UpdateRegisteredPickupColliderBounds()
{
//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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: 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)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: 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_019a: 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_01be: 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_0202: 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_0210: 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_00af: 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_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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00e1: 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_00ea: 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_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_originalPickupCollider == (Object)null || (Object)(object)_visualRoot == (Object)null)
{
return;
}
Renderer[] array = Il2CppArrayBase<Renderer>.op_Implicit(((Component)_visualRoot).GetComponentsInChildren<Renderer>(true));
if (array.Length == 0)
{
return;
}
Bounds bounds = array[0].bounds;
for (int i = 1; i < array.Length; i++)
{
((Bounds)(ref bounds)).Encapsulate(array[i].bounds);
}
Transform transform = ((Component)_originalPickupCollider).transform;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity);
for (int j = -1; j <= 1; j += 2)
{
for (int k = -1; k <= 1; k += 2)
{
for (int l = -1; l <= 1; l += 2)
{
Vector3 val3 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)j, (float)k, (float)l));
Vector3 val4 = transform.InverseTransformPoint(val3);
val = Vector3.Min(val, val4);
val2 = Vector3.Max(val2, val4);
}
}
}
Vector3 center = (val + val2) * 0.5f;
Vector3 val5 = val2 - val + new Vector3(0.1f, 0.1f, 0.1f);
if ((Object)(object)_registeredBoxCollider != (Object)null)
{
_registeredBoxCollider.center = center;
_registeredBoxCollider.size = val5;
}
else if ((Object)(object)_registeredCapsuleCollider != (Object)null)
{
_registeredCapsuleCollider.center = center;
_registeredCapsuleCollider.direction = 2;
_registeredCapsuleCollider.radius = Mathf.Max(val5.x, val5.y) * 0.5f;
_registeredCapsuleCollider.height = Mathf.Max(val5.z, _registeredCapsuleCollider.radius * 2f);
}
else if ((Object)(object)_registeredSphereCollider != (Object)null)
{
_registeredSphereCollider.center = center;
_registeredSphereCollider.radius = Mathf.Max(val5.x, Mathf.Max(val5.y, val5.z)) * 0.5f;
}
else if ((Object)(object)_registeredMeshCollider != (Object)null)
{
Mesh sharedMesh = CreateBoxMesh(center, val5);
_registeredMeshCollider.sharedMesh = sharedMesh;
}
else if ((Object)(object)_launcherPickupCollider != (Object)null)
{
_launcherPickupCollider.center = center;
_launcherPickupCollider.size = val5;
}
}
private static Mesh CreateBoxMesh(Vector3 center, Vector3 size)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0026: 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_002e: 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)
//IL_003c: 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_0046: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_00eb: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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)
//IL_0109: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: 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)
Vector3 val = size * 0.5f;
Mesh val2 = new Mesh();
((Object)val2).name = "BigWalkRocketLauncherPickupMesh";
val2.vertices = Il2CppStructArray<Vector3>.op_Implicit((Vector3[])(object)new Vector3[8]
{
center + new Vector3(0f - val.x, 0f - val.y, 0f - val.z),
center + new Vector3(val.x, 0f - val.y, 0f - val.z),
center + new Vector3(val.x, val.y, 0f - val.z),
center + new Vector3(0f - val.x, val.y, 0f - val.z),
center + new Vector3(0f - val.x, 0f - val.y, val.z),
center + new Vector3(val.x, 0f - val.y, val.z),
center + new Vector3(val.x, val.y, val.z),
center + new Vector3(0f - val.x, val.y, val.z)
});
val2.triangles = Il2CppStructArray<int>.op_Implicit(new int[36]
{
0, 2, 1, 0, 3, 2, 4, 5, 6, 4,
6, 7, 0, 1, 5, 0, 5, 4, 3, 7,
6, 3, 6, 2, 1, 2, 6, 1, 6, 5,
0, 4, 7, 0, 7, 3
});
val2.RecalculateBounds();
return val2;
}
private void SuppressOriginalRenderers(Prop prop)
{
Renderer[] array = (((Object)(object)_visualRoot != (Object)null) ? Il2CppArrayBase<Renderer>.op_Implicit(((Component)_visualRoot).GetComponentsInChildren<Renderer>(true)) : Array.Empty<Renderer>());
bool flag = (Object)(object)_visualRoot != (Object)null && ((Component)_visualRoot).gameObject.activeInHierarchy && array.Length != 0;
Renderer[] array2 = Il2CppArrayBase<Renderer>.op_Implicit(((Component)prop).GetComponentsInChildren<Renderer>(true));
foreach (Renderer val in array2)
{
if ((Object)(object)_visualRoot != (Object)null && ((Object)(object)((Component)val).transform == (Object)(object)_visualRoot || ((Component)val).transform.IsChildOf(_visualRoot)))
{
val.enabled = true;
}
else
{
val.enabled = !flag;
}
}
}
private void RestoreOriginalRenderers(Prop prop)
{
if ((Object)(object)prop == (Object)null)
{
return;
}
Renderer[] array = Il2CppArrayBase<Renderer>.op_Implicit(((Component)prop).GetComponentsInChildren<Renderer>(true));
foreach (Renderer val in array)
{
if (!((Object)(object)_visualRoot != (Object)null) || (!((Object)(object)((Component)val).transform == (Object)(object)_visualRoot) && !((Component)val).transform.IsChildOf(_visualRoot)))
{
val.enabled = true;
}
}
}
private static void SetLayerRecursive(Transform root, int layer)
{
((Component)root).gameObject.layer = layer;
for (int i = 0; i < root.childCount; i++)
{
SetLayerRecursive(root.GetChild(i), layer);
}
}
private int GetHeldPropRenderLayer(Prop prop)
{
if ((Object)(object)prop == (Object)null)
{
return 8;
}
Renderer[] array = Il2CppArrayBase<Renderer>.op_Implicit(((Component)prop).GetComponentsInChildren<Renderer>(true));
foreach (Renderer val in array)
{
if (!((Object)(object)_visualRoot != (Object)null) || (!((Object)(object)((Component)val).transform == (Object)(object)_visualRoot) && !((Component)val).transform.IsChildOf(_visualRoot)))
{
return ((Component)val).gameObject.layer;
}
}
return ((Component)prop).gameObject.layer;
}
private void CancelBurst()
{
_shotsRemaining = 0;
_releasePending = false;
_burstPlayer = null;
_reloading = false;
}
private static Prop GetHeldProp(PlayerCharacter player)
{
if (!((Object)(object)player != (Object)null) || player.hands == null)
{
return null;
}
return player.hands.heldProp;
}
private static bool IsFlareGun(Prop prop)
{
return IsAnyFlareGun(prop);
}
private static bool IsAnyFlareGun(Prop prop)
{
if ((Object)(object)prop != (Object)null)
{
return ((Object)((Component)prop).gameObject).name.IndexOf("FlareGunProp", StringComparison.OrdinalIgnoreCase) >= 0;
}
return false;
}
private static bool IsYellowWorldFlareGun(Prop prop)
{
if ((Object)(object)prop != (Object)null)
{
return ((Object)((Component)prop).gameObject).name.IndexOf("FlareGunPropYellow", StringComparison.OrdinalIgnoreCase) >= 0;
}
return false;
}
private bool IsKnownYellowLauncher(Prop prop)
{
if ((Object)(object)prop != (Object)null)
{
if (!IsYellowWorldFlareGun(prop) && !((Object)(object)prop == (Object)(object)_yellowLauncherProp))
{
if ((Object)(object)prop == (Object)(object)_visualProp)
{
return (Object)(object)_yellowLauncherProp == (Object)(object)_visualProp;
}
return false;
}
return true;
}
return false;
}
private static float SafeInverseScale(float value)
{
if (!(Mathf.Abs(value) < 0.0001f))
{
return 1f / value;
}
return 1f;
}
private static PlayerCharacter FindLocalPlayer()
{
PlayerCharacter[] array = Il2CppArrayBase<PlayerCharacter>.op_Implicit(Resources.FindObjectsOfTypeAll<PlayerCharacter>());
foreach (PlayerCharacter val in array)
{
if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled && ((NetworkBehaviour)val).isLocalPlayer)
{
return val;
}
}
return null;
}
private void LogState()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
Prop heldProp = GetHeldProp(FindLocalPlayer());
ManualLogSource log = ((BasePlugin)Plugin.Instance).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(95, 6, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Rocket launcher diagnostic: held='");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)(object)heldProp != (Object)null) ? ((Object)((Component)heldProp).gameObject).name : "none");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', ");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("launcherEquipped=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_launcherEquipped);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", busy=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(IsBusy);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", remaining=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_shotsRemaining);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("reloading=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(_reloading);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", visual=");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>((Object)(object)_visualRoot != (Object)null);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(".");
}
log.LogInfo(val);
}
}
}