using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CG.Client.UI;
using CG.Game;
using CG.Game.Player;
using CG.Space;
using Gameplay.SpacePlatforms;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Opsive.UltimateCharacterController.Character;
using UnityEngine;
using VoidManager;
using VoidManager.MPModChecks;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Slipstream")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Slipstream")]
[assembly: AssemblyTitle("Players near the ship keep most of the ship's velocity")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Slipstream
{
[HarmonyPatch(typeof(CharacterLocomotion))]
internal class CharacterLocomotionPatch
{
private static Vector3 lastShipVelocity = Vector3.zero;
private static Quaternion lastShipRotation = Quaternion.identity;
[HarmonyPrefix]
[HarmonyPatch("UpdateExternalForces")]
private static void PrefixForces(CharacterLocomotion __instance, ref Vector3 ___m_ExternalForce, out Vector3 __state)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: 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_011d: 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_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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_013c: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//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_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: 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_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
__state = Vector3.zero;
if (!VoidManagerPlugin.Enabled || (Object)(object)((Player)LocalPlayer.Instance).Locomotion != (Object)(object)__instance)
{
return;
}
ClientGame current = ClientGame.Current;
if (current == null)
{
return;
}
AbstractPlayerControlledShip playerShip = current.PlayerShip;
Vector3? obj;
if (playerShip == null)
{
obj = null;
}
else
{
MovingSpacePlatform platform = playerShip.Platform;
obj = ((platform != null) ? new Vector3?(((SpacePlatform)platform).Velocity) : null);
}
Vector3? val = obj;
if (!val.HasValue)
{
return;
}
Vector3 velocity = ((SpacePlatform)ClientGame.Current.PlayerShip.Platform).Velocity;
Quaternion rotation = ClientGame.Current.PlayerShip.Platform.Rotation;
if (!((Player)LocalPlayer.Instance).IsBeingSimulated)
{
Vector3 position = ((Player)LocalPlayer.Instance).Position;
IEnumerable<Collider> colliders = ((AbstractSpaceCraft)ClientGame.Current.PlayerShip).GetColliders();
if (colliders != null && colliders.Any(delegate(Collider collider)
{
//IL_0001: 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_000a: Unknown result type (might be due to invalid IL or missing references)
Bounds bounds = collider.bounds;
return ((Bounds)(ref bounds)).Contains(position);
}))
{
__state = velocity;
___m_ExternalForce -= __state;
__state += velocity - lastShipVelocity;
Quaternion val2 = Quaternion.Inverse(lastShipRotation) * rotation;
Vector3 val3 = position - ClientGame.Current.playerShip.Platform.Position;
Vector3 val4 = val2 * val3;
LocalPlayer instance = LocalPlayer.Instance;
((Player)instance).Position = ((Player)instance).Position + (val4 - val3);
}
}
lastShipVelocity = velocity;
lastShipRotation = rotation;
}
[HarmonyPostfix]
[HarmonyPatch("UpdateExternalForces")]
private static void PostfixForces(ref Vector3 ___m_ExternalForce, Vector3 __state)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (VoidManagerPlugin.Enabled)
{
___m_ExternalForce += __state;
}
}
}
[HarmonyPatch(typeof(LocalPlayer), "SetPlatform")]
internal class LocalPlayerPatch
{
private static readonly FieldInfo externalForce = AccessTools.Field(typeof(CharacterLocomotion), "m_ExternalForce");
private static void Prefix(SpacePlatform ___spacePlatform, out SpacePlatform __state)
{
__state = ___spacePlatform;
}
private static void Postfix(LocalPlayer __instance, SpacePlatform platform, SpacePlatform __state)
{
//IL_002f: 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)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (VoidManagerPlugin.Enabled && !((Object)(object)platform == (Object)(object)__state))
{
if ((Object)(object)platform != (Object)null)
{
externalForce.SetValue(((Player)__instance).Locomotion, Vector3.zero);
}
else if ((Object)(object)__state != (Object)null)
{
Vector3 val = (Vector3)externalForce.GetValue(((Player)__instance).Locomotion);
externalForce.SetValue(((Player)__instance).Locomotion, val + __state.Velocity);
}
}
}
}
public class MyPluginInfo
{
public const string PLUGIN_GUID = "id107.slipstream";
public const string PLUGIN_NAME = "Slipstream";
public const string USERS_PLUGIN_NAME = "Slipstream";
public const string PLUGIN_VERSION = "1.0.0";
public const string PLUGIN_DESCRIPTION = "Players near the ship keep most of the ship's velocity";
public const string PLUGIN_ORIGINAL_AUTHOR = "18107";
public const string PLUGIN_AUTHORS = "18107";
public const string PLUGIN_THUNDERSTORE_ID = "";
}
[HarmonyPatch(typeof(FadeController), "Start")]
internal class Patch
{
private static void Postfix()
{
BepinPlugin.Log.LogInfo((object)"Example Patch Executed");
}
}
[BepInPlugin("id107.slipstream", "Slipstream", "1.0.0")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin id107.slipstream is loaded!");
}
}
public class VoidManagerPlugin : VoidPlugin
{
public static bool Enabled { get; private set; }
public override MultiplayerType MPType => (MultiplayerType)14;
public override string Author => "18107";
public override string Description => "Players near the ship keep most of the ship's velocity";
public override string ThunderstoreID => "";
public override SessionChangedReturn OnSessionChange(SessionChangedInput input)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
Enabled = input.IsMod_Session;
SessionChangedReturn result = default(SessionChangedReturn);
result.SetMod_Session = true;
return result;
}
}
}