using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInExUtils.Attributes;
using BepInExUtils.Extensions;
using BepInExUtils.Interfaces;
using BepInExUtils.Logging;
using HKS_NoClip.Behaviour;
using HKS_NoClip.Extensions;
using HarmonyLib;
using InControl;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("HKS-NoClip")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6917369a6c9bd4a17bf8c5900c294cd54dfec05c")]
[assembly: AssemblyProduct("HKS-NoClip")]
[assembly: AssemblyTitle("HKS-NoClip")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 HKS_NoClip
{
[BepInUtils("io.github.ykysnk.HKS-NoClip", "No Clip", "0.2.23")]
[BepInDependency("io.github.ykysnk.BepinExUtils", "1.0.0")]
[BepInProcess("Hollow Knight Silksong.exe")]
[ConfigBind<KeyCode>(/*Could not decode attribute arguments.*/)]
[ConfigBind<bool>("TurnOffCol2d", "Options", false, "Turn off player collider when noclip is on. (If collider is on may cause some issues).")]
[ConfigBind<bool>("Invincible", "Options", false, "Make the player invincible when noclip is on.")]
[ConfigBind<bool>("QuickToggleNoClip", "Options", true, "Quickly toggle noclip by keep holding jump key and up arrow key.")]
[ConfigBind<bool>("FixFromOldVersion", "Options", true, "If upgrade from old version, fix the save data issues.")]
[ConfigBind<float>("Speed", "Options", 30f, "The speed of the player in noclip.")]
[ConfigBind<float>("QuickToggleNoClipWaitTime", "Options", 2f, "The holding time needs to quickly toggle noclip.")]
[BepInPlugin("io.github.ykysnk.HKS-NoClip", "No Clip", "0.2.23")]
public class Main : BaseUnityPlugin, IBepInUtils
{
private const string SectionOptions = "Options";
private const string Version = "0.2.23";
private static Main? _instance;
private readonly Harmony _harmony = new Harmony("io.github.ykysnk.HKS-NoClip");
public void Init()
{
}
public Main()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0048: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0078: Expected O, but got Unknown
//IL_008d: 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_00a8: Expected O, but got Unknown
//IL_00a8: Expected O, but got Unknown
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00d8: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_0108: Expected O, but got Unknown
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
//IL_013c: Expected O, but got Unknown
//IL_0151: 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_0170: Expected O, but got Unknown
//IL_0170: Expected O, but got Unknown
_instance = this;
Configs._NoClipToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>(new ConfigDefinition("Options", "NoClipToggleKey"), (KeyCode)98, new ConfigDescription("The key to toggle noclip in the game.", (AcceptableValueBase)null, Array.Empty<object>()));
Configs._TurnOffCol2d = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Options", "TurnOffCol2d"), false, new ConfigDescription("Turn off player collider when noclip is on. (If collider is on may cause some issues).", (AcceptableValueBase)null, Array.Empty<object>()));
Configs._Invincible = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Options", "Invincible"), false, new ConfigDescription("Make the player invincible when noclip is on.", (AcceptableValueBase)null, Array.Empty<object>()));
Configs._QuickToggleNoClip = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Options", "QuickToggleNoClip"), true, new ConfigDescription("Quickly toggle noclip by keep holding jump key and up arrow key.", (AcceptableValueBase)null, Array.Empty<object>()));
Configs._FixFromOldVersion = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Options", "FixFromOldVersion"), true, new ConfigDescription("If upgrade from old version, fix the save data issues.", (AcceptableValueBase)null, Array.Empty<object>()));
Configs._Speed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Options", "Speed"), 30f, new ConfigDescription("The speed of the player in noclip.", (AcceptableValueBase)null, Array.Empty<object>()));
Configs._QuickToggleNoClipWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Options", "QuickToggleNoClipWaitTime"), 2f, new ConfigDescription("The holding time needs to quickly toggle noclip.", (AcceptableValueBase)null, Array.Empty<object>()));
Configs.Init();
Utils.Logger.Info((object)"Plugin No Clip is loaded, version 0.2.23");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
Init();
}
}
public static class Utils
{
internal const string GameName = "Hollow Knight Silksong.exe";
internal const string Guid = "io.github.ykysnk.HKS-NoClip";
internal const string Name = "No Clip";
internal const string Version = "0.2.23";
private static Logger? _logger;
public static Logger Logger
{
get
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
object obj = _logger;
if (obj == null)
{
Logger val = new Logger("No Clip");
_logger = val;
obj = (object)val;
}
return (Logger)obj;
}
}
}
public static class Configs
{
public delegate void OnNoClipToggleKeyValueChangedEvent(KeyCode oldValue, KeyCode newValue);
public delegate void OnTurnOffCol2dValueChangedEvent(bool oldValue, bool newValue);
public delegate void OnInvincibleValueChangedEvent(bool oldValue, bool newValue);
public delegate void OnQuickToggleNoClipValueChangedEvent(bool oldValue, bool newValue);
public delegate void OnFixFromOldVersionValueChangedEvent(bool oldValue, bool newValue);
public delegate void OnSpeedValueChangedEvent(float oldValue, float newValue);
public delegate void OnQuickToggleNoClipWaitTimeValueChangedEvent(float oldValue, float newValue);
internal static ConfigEntry<KeyCode>? _NoClipToggleKey;
internal static ConfigEntry<bool>? _TurnOffCol2d;
internal static ConfigEntry<bool>? _Invincible;
internal static ConfigEntry<bool>? _QuickToggleNoClip;
internal static ConfigEntry<bool>? _FixFromOldVersion;
internal static ConfigEntry<float>? _Speed;
internal static ConfigEntry<float>? _QuickToggleNoClipWaitTime;
private static KeyCode? _oldNoClipToggleKey;
private static bool? _oldTurnOffCol2d;
private static bool? _oldInvincible;
private static bool? _oldQuickToggleNoClip;
private static bool? _oldFixFromOldVersion;
private static float? _oldSpeed;
private static float? _oldQuickToggleNoClipWaitTime;
public static KeyCode NoClipToggleKey
{
get
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return (KeyCode)(((??)_NoClipToggleKey?.Value) ?? 0);
}
set
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
if (_NoClipToggleKey != null)
{
_NoClipToggleKey.Value = value;
}
}
}
public static bool TurnOffCol2d
{
get
{
return _TurnOffCol2d?.Value ?? false;
}
set
{
if (_TurnOffCol2d != null)
{
_TurnOffCol2d.Value = value;
}
}
}
public static bool Invincible
{
get
{
return _Invincible?.Value ?? false;
}
set
{
if (_Invincible != null)
{
_Invincible.Value = value;
}
}
}
public static bool QuickToggleNoClip
{
get
{
return _QuickToggleNoClip?.Value ?? false;
}
set
{
if (_QuickToggleNoClip != null)
{
_QuickToggleNoClip.Value = value;
}
}
}
public static bool FixFromOldVersion
{
get
{
return _FixFromOldVersion?.Value ?? false;
}
set
{
if (_FixFromOldVersion != null)
{
_FixFromOldVersion.Value = value;
}
}
}
public static float Speed
{
get
{
return _Speed?.Value ?? 0f;
}
set
{
if (_Speed != null)
{
_Speed.Value = value;
}
}
}
public static float QuickToggleNoClipWaitTime
{
get
{
return _QuickToggleNoClipWaitTime?.Value ?? 0f;
}
set
{
if (_QuickToggleNoClipWaitTime != null)
{
_QuickToggleNoClipWaitTime.Value = value;
}
}
}
public static event OnNoClipToggleKeyValueChangedEvent? OnNoClipToggleKeyValueChanged;
public static event OnTurnOffCol2dValueChangedEvent? OnTurnOffCol2dValueChanged;
public static event OnInvincibleValueChangedEvent? OnInvincibleValueChanged;
public static event OnQuickToggleNoClipValueChangedEvent? OnQuickToggleNoClipValueChanged;
public static event OnFixFromOldVersionValueChangedEvent? OnFixFromOldVersionValueChanged;
public static event OnSpeedValueChangedEvent? OnSpeedValueChanged;
public static event OnQuickToggleNoClipWaitTimeValueChangedEvent? OnQuickToggleNoClipWaitTimeValueChanged;
internal static void Init()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
_oldNoClipToggleKey = _NoClipToggleKey?.Value;
ConfigEntry<KeyCode>? noClipToggleKey = _NoClipToggleKey;
if (noClipToggleKey != null)
{
noClipToggleKey.SettingChanged += delegate
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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)
Configs.OnNoClipToggleKeyValueChanged?.Invoke(_oldNoClipToggleKey.GetValueOrDefault(), _NoClipToggleKey.Value);
_oldNoClipToggleKey = _NoClipToggleKey.Value;
};
}
_oldTurnOffCol2d = _TurnOffCol2d?.Value;
ConfigEntry<bool>? turnOffCol2d = _TurnOffCol2d;
if (turnOffCol2d != null)
{
turnOffCol2d.SettingChanged += delegate
{
Configs.OnTurnOffCol2dValueChanged?.Invoke(_oldTurnOffCol2d.GetValueOrDefault(), _TurnOffCol2d.Value);
_oldTurnOffCol2d = _TurnOffCol2d.Value;
};
}
_oldInvincible = _Invincible?.Value;
ConfigEntry<bool>? invincible = _Invincible;
if (invincible != null)
{
invincible.SettingChanged += delegate
{
Configs.OnInvincibleValueChanged?.Invoke(_oldInvincible.GetValueOrDefault(), _Invincible.Value);
_oldInvincible = _Invincible.Value;
};
}
_oldQuickToggleNoClip = _QuickToggleNoClip?.Value;
ConfigEntry<bool>? quickToggleNoClip = _QuickToggleNoClip;
if (quickToggleNoClip != null)
{
quickToggleNoClip.SettingChanged += delegate
{
Configs.OnQuickToggleNoClipValueChanged?.Invoke(_oldQuickToggleNoClip.GetValueOrDefault(), _QuickToggleNoClip.Value);
_oldQuickToggleNoClip = _QuickToggleNoClip.Value;
};
}
_oldFixFromOldVersion = _FixFromOldVersion?.Value;
ConfigEntry<bool>? fixFromOldVersion = _FixFromOldVersion;
if (fixFromOldVersion != null)
{
fixFromOldVersion.SettingChanged += delegate
{
Configs.OnFixFromOldVersionValueChanged?.Invoke(_oldFixFromOldVersion.GetValueOrDefault(), _FixFromOldVersion.Value);
_oldFixFromOldVersion = _FixFromOldVersion.Value;
};
}
_oldSpeed = _Speed?.Value;
ConfigEntry<float>? speed = _Speed;
if (speed != null)
{
speed.SettingChanged += delegate
{
Configs.OnSpeedValueChanged?.Invoke(_oldSpeed.GetValueOrDefault(), _Speed.Value);
_oldSpeed = _Speed.Value;
};
}
_oldQuickToggleNoClipWaitTime = _QuickToggleNoClipWaitTime?.Value;
ConfigEntry<float>? quickToggleNoClipWaitTime = _QuickToggleNoClipWaitTime;
if (quickToggleNoClipWaitTime != null)
{
quickToggleNoClipWaitTime.SettingChanged += delegate
{
Configs.OnQuickToggleNoClipWaitTimeValueChanged?.Invoke(_oldQuickToggleNoClipWaitTime.GetValueOrDefault(), _QuickToggleNoClipWaitTime.Value);
_oldQuickToggleNoClipWaitTime = _QuickToggleNoClipWaitTime.Value;
};
}
}
}
}
namespace HKS_NoClip.Patches
{
[HarmonyPatch(typeof(HeroController))]
internal class HeroControllerPatches
{
[HarmonyPatch("Awake")]
[HarmonyPrefix]
private static void Awake(HeroController __instance)
{
Utils.Logger.Debug((object)$"__instance {__instance}");
HeroNoClipController heroNoClipController = default(HeroNoClipController);
HeroNoClipController heroNoClipController2 = ((!((Component)__instance).gameObject.TryGetComponent<HeroNoClipController>(ref heroNoClipController)) ? ((Component)__instance).gameObject.AddComponent<HeroNoClipController>() : heroNoClipController);
Utils.Logger.Debug((object)$"controller {heroNoClipController2}");
heroNoClipController2.Controller = __instance;
}
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
private static void FixedUpdate(HeroController __instance)
{
if (Object.op_Implicit((Object)(object)HeroNoClipController.Instance))
{
HeroNoClipController.Instance.FixVelocity();
}
}
private static bool ChangeCanTakeDamage(ref bool __result)
{
if (!Object.op_Implicit((Object)(object)HeroNoClipController.Instance))
{
return true;
}
if (!HeroNoClipController.Instance.IsNoClip)
{
return true;
}
if (!Configs.Invincible)
{
return true;
}
__result = false;
return false;
}
[HarmonyPatch("CanTakeDamage")]
[HarmonyPrefix]
private static bool CanTakeDamage(HeroController __instance, ref bool __result)
{
return ChangeCanTakeDamage(ref __result);
}
[HarmonyPatch("CanTakeDamageIgnoreInvul")]
[HarmonyPrefix]
private static bool CanTakeDamageIgnoreInvul(HeroController __instance, ref bool __result)
{
return ChangeCanTakeDamage(ref __result);
}
}
}
namespace HKS_NoClip.Extensions
{
[AccessExtensions]
[AccessInstance<HeroController>]
[AccessField<Rigidbody2D>("rb2d")]
[AccessField<Collider2D>("col2d")]
[AccessField<InputHandler>("inputHandler")]
[UsedImplicitly]
public static class HeroControllerExtensions
{
public sealed class <>E__0
{
public Rigidbody2D rb2d
{
get
{
throw null;
}
set
{
throw null;
}
}
public Collider2D col2d
{
get
{
throw null;
}
set
{
throw null;
}
}
public InputHandler inputHandler
{
get
{
throw null;
}
set
{
throw null;
}
}
}
[SpecialName]
public static Rigidbody2D get_rb2d(HeroController instance)
{
return ObjectExtensions.GetFieldValue<Rigidbody2D>((object)instance, "rb2d");
}
[SpecialName]
public static void set_rb2d(HeroController instance, Rigidbody2D value)
{
ObjectExtensions.SetFieldValue<Rigidbody2D>((object)instance, "rb2d", value);
}
[SpecialName]
public static Collider2D get_col2d(HeroController instance)
{
return ObjectExtensions.GetFieldValue<Collider2D>((object)instance, "col2d");
}
[SpecialName]
public static void set_col2d(HeroController instance, Collider2D value)
{
ObjectExtensions.SetFieldValue<Collider2D>((object)instance, "col2d", value);
}
[SpecialName]
public static InputHandler get_inputHandler(HeroController instance)
{
return ObjectExtensions.GetFieldValue<InputHandler>((object)instance, "inputHandler");
}
[SpecialName]
public static void set_inputHandler(HeroController instance, InputHandler value)
{
ObjectExtensions.SetFieldValue<InputHandler>((object)instance, "inputHandler", value);
}
}
}
namespace HKS_NoClip.Behaviour
{
public class HeroNoClipController : MonoBehaviour
{
private bool _holdChangeNoClip;
private bool _isHold;
private bool _isSetNoClip;
private Vector2? _lastVelocity;
private float _needTime;
public HeroController? Controller { get; internal set; }
public static HeroNoClipController? Instance { get; private set; }
internal bool IsNoClip { get; private set; }
private void Awake()
{
Instance = this;
}
private void Update()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Controller))
{
FixUpgradeFromOldVersion();
HandleNoClip();
QuickToggleNoClip();
if (Input.GetKeyDown(Configs.NoClipToggleKey))
{
ToggleNoClip();
Utils.Logger.Info((object)("No Clip is now " + (IsNoClip ? "On" : "Off")));
}
}
}
private void FixedUpdate()
{
if (Object.op_Implicit((Object)(object)Controller))
{
FixBodyType();
}
}
private void QuickToggleNoClip()
{
if (!Configs.QuickToggleNoClip || !Object.op_Implicit((Object)(object)Controller))
{
return;
}
InputHandler val = HeroControllerExtensions.get_inputHandler(Controller);
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
if ((!IsNoClip && (!((OneAxisInputControl)val.inputActions.Jump).IsPressed || !((OneAxisInputControl)val.inputActions.Up).IsPressed)) || (IsNoClip && !((OneAxisInputControl)val.inputActions.Jump).IsPressed))
{
_needTime = -1f;
_isHold = false;
_isSetNoClip = false;
return;
}
if (!_isHold)
{
_holdChangeNoClip = !IsNoClip;
}
_isHold = true;
if (_needTime < 0f)
{
_needTime = Time.time + Configs.QuickToggleNoClipWaitTime;
}
if (!(_needTime < 0f) && !(Time.time < _needTime) && !_isSetNoClip)
{
ToggleNoClip(_holdChangeNoClip);
Utils.Logger.Info((object)("No Clip is now " + (IsNoClip ? "On" : "Off")));
_isSetNoClip = true;
}
}
private void ToggleNoClip(bool value)
{
if (!Object.op_Implicit((Object)(object)Controller))
{
return;
}
if (value)
{
if (Configs.TurnOffCol2d)
{
((Behaviour)HeroControllerExtensions.get_col2d(Controller)).enabled = false;
}
if (Object.op_Implicit((Object)(object)Controller.Body))
{
Controller.Body.bodyType = (RigidbodyType2D)1;
}
}
else
{
if (!((Behaviour)HeroControllerExtensions.get_col2d(Controller)).enabled)
{
((Behaviour)HeroControllerExtensions.get_col2d(Controller)).enabled = true;
}
if (Object.op_Implicit((Object)(object)Controller.Body))
{
Controller.Body.bodyType = (RigidbodyType2D)0;
}
}
IsNoClip = value;
}
private void ToggleNoClip()
{
ToggleNoClip(!IsNoClip);
}
private void HandleNoClip()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_004e: 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_007d: 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_0066: 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_0071: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)Controller) || !IsNoClip)
{
return;
}
InputHandler val = HeroControllerExtensions.get_inputHandler(Controller);
if (Object.op_Implicit((Object)(object)val))
{
Vector2 zero = Vector2.zero;
Vector2 vector = ((TwoAxisInputControl)val.inputActions.MoveVector).Vector;
zero += vector * Configs.Speed;
if (((OneAxisInputControl)val.inputActions.Dash).IsPressed)
{
zero *= 2f;
}
Controller.Body.linearVelocity = zero;
_lastVelocity = zero;
}
}
private void FixBodyType()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
if (Object.op_Implicit((Object)(object)Controller) && IsNoClip && Object.op_Implicit((Object)(object)Controller.Body) && (int)Controller.Body.bodyType != 1)
{
Controller.Body.bodyType = (RigidbodyType2D)1;
}
}
internal void FixVelocity()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Controller) && IsNoClip && _lastVelocity.HasValue)
{
Controller.Body.linearVelocity = (Vector2)(((??)_lastVelocity) ?? Vector2.zero);
}
}
private void FixUpgradeFromOldVersion()
{
if (Object.op_Implicit((Object)(object)Controller) && Configs.FixFromOldVersion)
{
bool flag = false;
if (Controller.playerData.isInvincible)
{
Controller.playerData.isInvincible = false;
flag = true;
}
if (Controller.playerData.infiniteAirJump)
{
Controller.playerData.infiniteAirJump = false;
flag = true;
}
if (flag)
{
Utils.Logger.Info((object)"Upgrade from old version, automatically fix the save data issues.");
}
Configs.FixFromOldVersion = false;
}
}
}
}