using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RocketpackFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RocketpackFix")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5e1ae9aa-43d4-412e-b032-04dbb1084e5b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.rocketpackfix", "RocketpackFix", "1.0.0")]
public sealed class RocketpackFix : BaseUnityPlugin
{
private Harmony harmony;
private void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
harmony = new Harmony("com.rocketpackfix");
harmony.PatchAll();
}
private void OnDestroy()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
}
[HarmonyPatch(typeof(CharacterMovement), "RocketRPC")]
internal static class RocketpackFix_RocketRPCPatch
{
private static void Postfix(CharacterMovement __instance)
{
if (!((Object)(object)__instance == (Object)null))
{
Character component = ((Component)__instance).GetComponent<Character>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component != (Object)(object)Character.localCharacter))
{
((MonoBehaviour)__instance).StartCoroutine(WaitForRocketEnd(__instance, component));
}
}
}
private static IEnumerator WaitForRocketEnd(CharacterMovement movement, Character character)
{
while ((Object)(object)movement != (Object)null && movement.rocketActive)
{
yield return (object)new WaitForFixedUpdate();
}
if (!((Object)(object)character == (Object)null))
{
if (character.refs != null && (Object)(object)character.refs.view != (Object)null && character.refs.view.IsMine)
{
character.refs.view.RPC("RPCA_UnFall", (RpcTarget)0, Array.Empty<object>());
}
if ((Object)(object)character.data != (Object)null)
{
character.data.fallSeconds = 0f;
character.data.currentRagdollControll = 1f;
}
if ((Object)(object)Singleton<MainCameraMovement>.Instance != (Object)null)
{
Singleton<MainCameraMovement>.Instance.StopRocketing();
}
}
}
}