using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Enemies;
using FX_EffectSystem;
using GTFO.API;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using MindAttic.GTFO.Shared;
using Player;
using SNetwork;
using StateMachines;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GTFO.EZ.AbsurdMoves")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cb17a2cfed345417dab6913f2021417dda7de9e1")]
[assembly: AssemblyProduct("GTFO.EZ.AbsurdMoves")]
[assembly: AssemblyTitle("GTFO.EZ.AbsurdMoves")]
[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.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]
[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]
[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 MindAttic.GTFO.Shared
{
internal static class SharedOwner
{
internal static readonly ManualLogSource Log = Logger.CreateLogSource("MindAttic.GTFO.Shared");
internal const string MasterSection = "0. Mod";
internal const string MasterKey = "Enabled";
private static readonly string[] Order = new string[4] { "MindAttic.GTFO.EZ", "MindAttic.GTFO.EZ.AbsurdWeapons", "MindAttic.GTFO.EZ.AbsurdMoves", "MindAttic.GTFO.EZ.AbsurdItems" };
private static bool? _isOwner;
internal static bool IsOwner
{
get
{
bool valueOrDefault = _isOwner == true;
if (!_isOwner.HasValue)
{
valueOrDefault = FindOwner();
_isOwner = valueOrDefault;
return valueOrDefault;
}
return valueOrDefault;
}
}
private static bool FindOwner()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
try
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
string[] order = Order;
for (int i = 0; i < order.Length; i++)
{
if (TryGetActive(order[i], out BasePlugin plugin))
{
Assembly assembly = ((object)plugin).GetType().Assembly;
if (!(assembly.GetType(typeof(SharedOwner).FullName) == null))
{
return assembly == executingAssembly;
}
}
}
}
catch (Exception ex)
{
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't tell which GTFO.* mod runs the shared keys. ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
Log.LogWarning(val);
}
return false;
}
internal static bool IsActive(string guid)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
try
{
BasePlugin plugin;
return TryGetActive(guid, out plugin);
}
catch (Exception ex)
{
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't check whether ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(guid);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is installed. ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
Log.LogWarning(val);
return false;
}
}
internal static bool TryGetSetting<T>(string guid, string section, string key, [NotNullWhen(true)] out ConfigEntry<T>? entry)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
entry = null;
try
{
BasePlugin plugin;
return TryGetActive(guid, out plugin) && plugin.Config.TryGetEntry<T>(section, key, ref entry);
}
catch (Exception ex)
{
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(25, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't read [");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(section);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(key);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(guid);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
Log.LogWarning(val);
entry = null;
return false;
}
}
private static bool TryGetActive(string guid, [NotNullWhen(true)] out BasePlugin? plugin)
{
plugin = null;
if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue(guid, out var value))
{
object instance = value.Instance;
BasePlugin val = (BasePlugin)((instance is BasePlugin) ? instance : null);
if (val != null)
{
ConfigEntry<bool> val2 = default(ConfigEntry<bool>);
if (val.Config.TryGetEntry<bool>("0. Mod", "Enabled", ref val2) && !val2.Value)
{
return false;
}
plugin = val;
return true;
}
}
return false;
}
internal static bool Get(string key)
{
object data = AppDomain.CurrentDomain.GetData("MindAttic.GTFO." + key);
if (data is bool)
{
return (bool)data;
}
return false;
}
internal static void Set(string key, bool value)
{
AppDomain.CurrentDomain.SetData("MindAttic.GTFO." + key, value);
}
}
internal static class InfiniteToggles
{
private const string AmmoKey = "InfiniteAmmo";
private const string HealthKey = "InfiniteHealth";
private static readonly InventorySlot[] AmmoSlots;
private static int _lastFrame;
internal static bool InfiniteAmmoOn => SharedOwner.Get("InfiniteAmmo");
internal static bool InfiniteHealthOn => SharedOwner.Get("InfiniteHealth");
internal static void Tick()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Invalid comparison between Unknown and I4
if (Time.frameCount == _lastFrame || !SharedOwner.IsOwner)
{
return;
}
_lastFrame = Time.frameCount;
if ((int)FocusStateManager.CurrentState == 4)
{
if (Input.GetKeyDown((KeyCode)277))
{
Toggle("InfiniteHealth", "Infinite health");
}
if (Input.GetKeyDown((KeyCode)127))
{
Toggle("InfiniteAmmo", "Infinite ammo");
}
}
if (InfiniteAmmoOn)
{
Refill();
}
}
private static void Toggle(string key, string what)
{
bool flag = !SharedOwner.Get(key);
SharedOwner.Set(key, flag);
Show(what + ": " + (flag ? "ON" : "OFF"));
}
private static void Show(string message)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
try
{
MessageHelper.Show(message, MessageType.EventLog);
}
catch (Exception ex)
{
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (no warden message: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
SharedOwner.Log.LogInfo(val);
return;
}
SharedOwner.Log.LogInfo((object)message);
}
private static void Refill()
{
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
try
{
PlayerAgent val = default(PlayerAgent);
if (!PlayerManager.TryGetLocalPlayerAgent(ref val) || (Object)(object)val == (Object)null || !((Agent)val).Alive)
{
return;
}
PlayerBackpack localBackpack = PlayerBackpackManager.LocalBackpack;
PlayerAmmoStorage val2 = ((localBackpack != null) ? localBackpack.AmmoStorage : null);
if (val2 == null)
{
return;
}
bool flag = false;
InventorySlot[] ammoSlots = AmmoSlots;
foreach (InventorySlot val3 in ammoSlots)
{
InventorySlotAmmo inventorySlotAmmo = val2.GetInventorySlotAmmo(val3);
if (inventorySlotAmmo != null && !(inventorySlotAmmo.AmmoInPack >= inventorySlotAmmo.AmmoMaxCap))
{
val2.SetAmmo(inventorySlotAmmo.AmmoType, inventorySlotAmmo.AmmoMaxCap);
flag = true;
}
}
PlayerInventoryBase inventory = val.Inventory;
object obj;
if (inventory == null)
{
obj = null;
}
else
{
ItemEquippable wieldedItem = inventory.WieldedItem;
obj = ((wieldedItem != null) ? ((Il2CppObjectBase)wieldedItem).TryCast<BulletWeapon>() : null);
}
BulletWeapon val4 = (BulletWeapon)obj;
if ((Object)(object)val4 != (Object)null && ((ItemEquippable)val4).GetCurrentClip() < ((ItemEquippable)val4).ClipSize)
{
((ItemEquippable)val4).SetCurrentClip(((ItemEquippable)val4).ClipSize);
val2.SetClipAmmoInSlot(val.Inventory.WieldedSlot);
flag = true;
}
if (flag)
{
val2.UpdateAllAmmoUI();
val2.NeedsSync = true;
}
}
catch (Exception ex)
{
bool flag2 = default(bool);
BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(30, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Infinite ammo: refill failed. ");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
}
SharedOwner.Log.LogWarning(val5);
}
}
internal static bool AllowDamage(Dam_PlayerDamageLocal damage)
{
if (!InfiniteHealthOn)
{
return true;
}
try
{
PlayerAgent owner = ((Dam_PlayerDamageBase)damage).Owner;
return (Object)(object)owner == (Object)null || (Object)(object)owner.Owner == (Object)null || owner.Owner.IsBot;
}
catch (Exception)
{
return true;
}
}
static InfiniteToggles()
{
InventorySlot[] array = new InventorySlot[3];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
AmmoSlots = (InventorySlot[])(object)array;
_lastFrame = -1;
}
}
[HarmonyPatch(typeof(Dam_PlayerDamageLocal))]
internal static class InfiniteToggles_Patches
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void AfterUpdate()
{
InfiniteToggles.Tick();
}
[HarmonyPatch("ReceiveBulletDamage")]
[HarmonyPatch("ReceiveExplosionDamage")]
[HarmonyPatch("ReceiveMeleeDamage")]
[HarmonyPatch("ReceivePushDamage")]
[HarmonyPatch("ReceiveFireDamage")]
[HarmonyPatch("ReceiveTentacleAttackDamage")]
[HarmonyPatch("ReceiveTentacleTrapGrabDamage")]
[HarmonyPatch("ReceiveParasiteTrapDamage")]
[HarmonyPatch("ReceiveTentacleTankGrabDamage")]
[HarmonyPatch("ReceiveShooterProjectileDamage")]
[HarmonyPatch("ReceiveParasiteDamage")]
[HarmonyPatch("ReceiveStickyDamage")]
[HarmonyPatch("ReceiveFallDamage")]
[HarmonyPatch("ReceiveNoAirDamage")]
[HarmonyPatch("ReceiveSetDead")]
[HarmonyPrefix]
private static bool BeforeDamage(Dam_PlayerDamageLocal __instance)
{
return InfiniteToggles.AllowDamage(__instance);
}
}
internal enum MessageType
{
Warden,
EventLog,
Center,
Subtitle
}
internal static class MessageHelper
{
internal const float DefaultSeconds = 5f;
private const string UpUntilKey = "MindAttic.GTFO.WardenMessageUpUntil";
private const string RoutineKey = "MindAttic.GTFO.WardenMessageRoutine";
private const float RevealSpeed = 200f;
private const float StaleMargin = 3f;
private static float UpUntil
{
get
{
object data = AppDomain.CurrentDomain.GetData("MindAttic.GTFO.WardenMessageUpUntil");
if (data is float)
{
return (float)data;
}
return 0f;
}
set
{
AppDomain.CurrentDomain.SetData("MindAttic.GTFO.WardenMessageUpUntil", value);
}
}
private static IntPtr Routine
{
get
{
object data = AppDomain.CurrentDomain.GetData("MindAttic.GTFO.WardenMessageRoutine");
if (data is IntPtr)
{
return (IntPtr)data;
}
return IntPtr.Zero;
}
set
{
AppDomain.CurrentDomain.SetData("MindAttic.GTFO.WardenMessageRoutine", value);
}
}
internal static bool Show(string text, MessageType type = MessageType.Warden, float seconds = 5f)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
bool flag = default(bool);
try
{
seconds = Mathf.Max(0.5f, seconds);
flag = type switch
{
MessageType.Warden => Warden(text, seconds),
MessageType.EventLog => EventLog(text),
MessageType.Center => Center(text, seconds),
MessageType.Subtitle => Subtitle(text, seconds),
_ => false,
};
return flag;
}
catch (Exception ex)
{
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(16, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (no ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<MessageType>(type);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" message: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
}
SharedOwner.Log.LogInfo(val);
return false;
}
}
private static bool EventLog(string text)
{
PlayerGuiLayer playerLayer = GuiManager.PlayerLayer;
PUI_GameEventLog val = ((playerLayer != null) ? playerLayer.m_gameEventLog : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
val.AddLogItem(text, (eGameEventChatLogType)2);
return true;
}
private static bool Center(string text, float seconds)
{
InteractionGuiLayer interactionLayer = GuiManager.InteractionLayer;
if (interactionLayer == null)
{
return false;
}
interactionLayer.SetTimedMessage(text, seconds, (ePUIMessageStyle)0, 0);
return true;
}
private static bool Subtitle(string text, float seconds)
{
PlayerGuiLayer playerLayer = GuiManager.PlayerLayer;
PUI_Subtitles val = ((playerLayer != null) ? playerLayer.m_subtitles : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
val.ShowSingleLineSubtitle(text, seconds);
return true;
}
private static bool Warden(string text, float seconds)
{
PlayerGuiLayer playerLayer = GuiManager.PlayerLayer;
PUI_WardenIntel val = ((playerLayer != null) ? playerLayer.m_wardenIntel : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
Coroutine newObjectiveRoutine = val.m_newObjectiveRoutine;
LinkedList<IEnumerator> subObjectiveMessageQueue = val.m_subObjectiveMessageQueue;
if (Time.unscaledTime < UpUntil && newObjectiveRoutine != null && ((Il2CppObjectBase)newObjectiveRoutine).Pointer == Routine && (subObjectiveMessageQueue == null || subObjectiveMessageQueue.Count == 0))
{
((MonoBehaviour)val).StopCoroutine(newObjectiveRoutine);
if (val.m_revealTextRoutine != null)
{
((MonoBehaviour)val).StopCoroutine(val.m_revealTextRoutine);
}
val.m_newObjectiveRoutine = null;
val.m_revealTextRoutine = null;
val.ResetSubObjectiveMesssagQueue();
}
Coroutine newObjectiveRoutine2 = val.m_newObjectiveRoutine;
IntPtr intPtr = ((newObjectiveRoutine2 != null) ? ((Il2CppObjectBase)newObjectiveRoutine2).Pointer : IntPtr.Zero);
float until = Time.unscaledTime + seconds + 3f;
val.ShowSubObjectiveMessage("", text, false, 200f, seconds, DelegateSupport.ConvertDelegate<Action>((Delegate)(Action)delegate
{
if (UpUntil == until)
{
UpUntil = 0f;
}
}));
Coroutine newObjectiveRoutine3 = val.m_newObjectiveRoutine;
IntPtr intPtr2 = ((newObjectiveRoutine3 != null) ? ((Il2CppObjectBase)newObjectiveRoutine3).Pointer : IntPtr.Zero);
if (intPtr2 != IntPtr.Zero && intPtr2 != intPtr)
{
Routine = intPtr2;
UpUntil = until;
}
else
{
Routine = IntPtr.Zero;
UpUntil = 0f;
}
return true;
}
}
internal static class RemoteEvents
{
internal static void Register<T>(string eventName, Action<ulong, T> onReceive) where T : struct
{
NetworkAPI.RegisterEvent<T>(eventName, (Action<ulong, T>)delegate(ulong sender, T message)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
try
{
onReceive(sender, message);
}
catch (Exception ex)
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Couldn't handle network event ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(eventName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(sender);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
SharedOwner.Log.LogError(val);
}
});
}
}
}
namespace GTFO.EZ.AbsurdMoves
{
internal static class AirMoves
{
internal static ConfigEntry<bool> DoubleJumpEnabled = null;
internal static ConfigEntry<float> SecondJumpHeightMultiplier = null;
private const float SecondPressAfter = 0.1f;
private static float _airborneSince = -1f;
private static bool _doubleJumpUsed;
internal static void Bind(ConfigFile config)
{
DoubleJumpEnabled = config.Bind<bool>("Double Jump", "Double Jump Enabled", true, "Turns the double jump on or off. On: press Jump a second time in the air to jump again - a whole new jump, the game's own, from wherever you are. Once per jump.");
SecondJumpHeightMultiplier = config.Bind<float>("Double Jump", "Second Jump Height Multiplier", 1.5f, "Scales the second jump's upward speed against a jump off the ground. 1 = the same as a ground jump, 1.5 = half again as fast up (well over twice as high, since height grows with the square of the speed).");
}
internal static void Reset()
{
_airborneSince = -1f;
_doubleJumpUsed = false;
}
internal static void Tick(PlayerAgent agent, PlayerLocomotion loc)
{
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
if (!Moves.InAir(loc))
{
_airborneSince = -1f;
_doubleJumpUsed = false;
return;
}
if (_airborneSince < 0f)
{
_airborneSince = Time.time;
}
if (MovesToggle.Active && !GroundPound.Active && DoubleJumpEnabled.Value && !_doubleJumpUsed && Moves.InPlay && InputMapper.GetButtonDown.Invoke((InputAction)5, (eFocusState)4) && !(Time.time - _airborneSince <= 0.1f))
{
_doubleJumpUsed = true;
Moves.ResetFallStart(agent, loc);
loc.ChangeState((PLOC_State)3, false);
loc.m_verticalVelocity *= Mathf.Max(0.1f, SecondJumpHeightMultiplier.Value);
}
}
}
internal sealed class BulletTime : MonoBehaviour
{
private readonly struct Trigger
{
public readonly byte Unused;
}
private const string StartEvent = "MindAttic.GTFO.EZ.AbsurdMoves.BulletTime";
private const float RampIn = 0.4f;
private const float RampOut = 0.8f;
private static ConfigEntry<bool> featureOn = null;
private static ConfigEntry<KeyCode> key = null;
private static ConfigEntry<float> duration = null;
private static ConfigEntry<float> cooldown = null;
private static ConfigEntry<float> timeScale = null;
private static ConfigEntry<string> muffle = null;
private static ConfigEntry<string> enterSound = null;
private static ConfigEntry<string> exitSound = null;
private static ConfigEntry<string> loopStart = null;
private static ConfigEntry<string> loopStop = null;
private static readonly List<(uint Id, float Target, float Before)> rtpcs = new List<(uint, float, float)>();
private static float startedAt = -1f;
private static float readyAt;
private static float baseFixedDelta = -1f;
private static float baseTimeScale = 1f;
private static bool announceReady;
private static bool armed;
private static bool Active => startedAt >= 0f;
public BulletTime(IntPtr ptr)
: base(ptr)
{
}
internal static void Bind(ConfigFile config)
{
featureOn = config.Bind<bool>("Bullet Time", "Enabled", true, "Turns bullet time on or off. On: tap the key to slow the whole game - everyone and everything - for a few seconds, Max Payne style.");
key = config.Bind<KeyCode>("Bullet Time", "Key", (KeyCode)308, "Starts bullet time as you let go of it. A press with another key in it (Alt+Tab, Alt+Enter) or one that loses the game focus doesn't count.");
duration = config.Bind<float>("Bullet Time", "DurationSeconds", 5f, "How long bullet time lasts, in real seconds.");
cooldown = config.Bind<float>("Bullet Time", "CooldownSeconds", 10f, "Real seconds after bullet time ends before it can start again.");
timeScale = config.Bind<float>("Bullet Time", "TimeScale", 0.3f, "How fast the game runs during bullet time (1 = normal, 0.3 = under a third).");
muffle = config.Bind<string>("Bullet Time", "SoundMuffle", "SOUND_EFFECT_MUFFLE=100, GAME_MENU_MUFFLE=100", "The game's Wwise mix parameters (NAME=value, comma-separated) pushed during bullet time for the hollow, underwater sound; each goes back to what it was after. Empty = no muffle.");
enterSound = config.Bind<string>("Bullet Time", "EnterSound", "STINGER_LOW_BOOM", "Played as bullet time starts (a deep boom). Empty = silent.");
exitSound = config.Bind<string>("Bullet Time", "ExitSound", "COMBAT_FADING_PULSE_LEVEL_1", "Played as bullet time ends. Empty = silent.");
loopStart = config.Bind<string>("Bullet Time", "LoopSound", "ENEMYHEARTBEATLOOP", "A loop under bullet time (a slow heartbeat). Empty = none.");
loopStop = config.Bind<string>("Bullet Time", "LoopStopSound", "ENEMYHEARTBEATLOOPEND", "Stops the loop.");
}
internal static void Init()
{
RemoteEvents.Register<Trigger>("MindAttic.GTFO.EZ.AbsurdMoves.BulletTime", delegate
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
try
{
Begin(fromTeammate: true);
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves teammate's bullet time failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logger.LogError(val);
try
{
if (Active)
{
End();
}
}
catch (Exception)
{
}
}
});
}
internal static void ForceEnd()
{
if (Active)
{
End();
}
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
try
{
if ((int)GameStateManager.CurrentStateName != 10)
{
if (Active)
{
End();
}
readyAt = 0f;
armed = false;
announceReady = false;
return;
}
if (KeyTapped() && Begin())
{
NetworkAPI.InvokeEvent<Trigger>("MindAttic.GTFO.EZ.AbsurdMoves.BulletTime", default(Trigger), (SNet_ChannelType)2);
}
if (Active)
{
Tick();
}
else if (announceReady && Time.unscaledTime >= readyAt)
{
announceReady = false;
if (featureOn.Value)
{
MessageHelper.Show("Bullet time ready", MessageType.EventLog);
}
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(40, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves bullet time failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logger.LogError(val);
if (Active)
{
End();
}
}
}
private void OnDestroy()
{
if (Active)
{
RestoreClock();
}
}
private static bool KeyTapped()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Invalid comparison between Unknown and I4
//IL_002f: 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 (!MovesToggle.Active || !featureOn.Value || (int)FocusStateManager.CurrentState != 4 || !Application.isFocused)
{
armed = false;
return false;
}
if (Input.GetKeyDown(key.Value))
{
armed = true;
}
else if (armed && Input.anyKeyDown)
{
armed = false;
}
if (!armed || !Input.GetKeyUp(key.Value))
{
return false;
}
armed = false;
return true;
}
private void OnApplicationFocus(bool focused)
{
if (!focused)
{
armed = false;
}
}
private static bool Begin(bool fromTeammate = false)
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
if (Active || (!fromTeammate && Time.unscaledTime < readyAt))
{
return false;
}
startedAt = Time.unscaledTime;
baseTimeScale = ((Time.timeScale > 0f) ? Time.timeScale : 1f);
baseFixedDelta = Time.fixedDeltaTime;
rtpcs.Clear();
string[] array = muffle.Value.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
for (int i = 0; i < array.Length; i++)
{
string[] array2 = array[i].Split('=', 2, StringSplitOptions.TrimEntries);
if (array2.Length == 2 && float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
{
uint iDFromString = AkSoundEngine.GetIDFromString(array2[0]);
rtpcs.Add((iDFromString, result, CellSound.GetGlobalRTPCValue(iDFromString)));
}
}
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
if (localPlayerAgent != null)
{
Sounds.Play(enterSound.Value, ((Agent)localPlayerAgent).Position);
}
return true;
}
private static float Strength(float elapsed)
{
float num = Mathf.Max(duration.Value, 1.2f);
if (elapsed < 0.4f)
{
return Mathf.SmoothStep(0f, 1f, elapsed / 0.4f);
}
if (elapsed > num - 0.8f)
{
return Mathf.SmoothStep(0f, 1f, (num - elapsed) / 0.8f);
}
return 1f;
}
private static void Tick()
{
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
float num = Time.unscaledTime - startedAt;
if (num >= Mathf.Max(duration.Value, 1.2f))
{
End();
return;
}
float num2 = Strength(num);
float num3 = (Time.timeScale = baseTimeScale * Mathf.Lerp(1f, Mathf.Clamp(timeScale.Value, 0.05f, 1f), num2));
Time.fixedDeltaTime = baseFixedDelta * num3 / baseTimeScale;
foreach (var (num5, num6, num7) in rtpcs)
{
CellSound.SetGlobalRTPCValue(num5, Mathf.Lerp(num7, num6, num2));
}
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
if ((Object)(object)localPlayerAgent != (Object)null)
{
LoopSounds.Touch("bullet-time", loopStart.Value, loopStop.Value, ((Agent)localPlayerAgent).Position);
}
}
private static void RestoreClock()
{
Time.timeScale = baseTimeScale;
if (baseFixedDelta > 0f)
{
Time.fixedDeltaTime = baseFixedDelta;
}
}
private static void End()
{
//IL_0028: 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)
//IL_007d: Invalid comparison between Unknown and I4
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
RestoreClock();
foreach (var (num, _, num2) in rtpcs)
{
CellSound.SetGlobalRTPCValue(num, num2);
}
rtpcs.Clear();
startedAt = -1f;
readyAt = Time.unscaledTime + cooldown.Value;
announceReady = true;
if ((int)GameStateManager.CurrentStateName == 10)
{
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
if (localPlayerAgent != null)
{
Sounds.Play(exitSound.Value, ((Agent)localPlayerAgent).Position);
}
}
}
}
internal static class ConfigMigrations
{
private static readonly (int Version, string Section, string Key, object OldDefault)[] DefaultMigrations = new(int, string, string, object)[1] { (1, "Slide", "Slide Duration (seconds)", 1.2f) };
internal static void Apply(ConfigFile config)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
ConfigEntry<int> val = config.Bind<int>("Internal", "Config Migration Version", 0, "Internal bookkeeping - do not edit. Tracks which one-time default migrations have already run.");
int value = val.Value;
int num = value;
(int, string, string, object)[] defaultMigrations = DefaultMigrations;
bool flag = default(bool);
for (int i = 0; i < defaultMigrations.Length; i++)
{
(int, string, string, object) tuple = defaultMigrations[i];
int item = tuple.Item1;
string item2 = tuple.Item2;
string item3 = tuple.Item3;
object item4 = tuple.Item4;
num = Math.Max(num, item);
if (value >= item)
{
continue;
}
ConfigDefinition val2 = new ConfigDefinition(item2, item3);
if (!config.ContainsKey(val2))
{
continue;
}
ConfigEntryBase val3 = config[val2];
if (object.Equals(val3.BoxedValue, item4))
{
val3.BoxedValue = val3.DefaultValue;
ManualLogSource logger = Plugin.Logger;
BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(64, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("GTFO.EZ.AbsurdMoves config: [");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(item2);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("] ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(item3);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" moved from its old default ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<object>(item4);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" to ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<object>(val3.DefaultValue);
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(".");
}
logger.LogInfo(val4);
}
}
if (num != value)
{
val.Value = num;
}
}
}
internal static class Dodge
{
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> Distance;
internal static ConfigEntry<float> Seconds;
internal static ConfigEntry<float> CooldownSeconds;
internal static ConfigEntry<float> DoubleTapWindowSeconds;
internal static void Bind(ConfigFile config)
{
Enabled = config.Bind<bool>("Dodge", "Dodge Enabled", true, "Turns the dodge on or off. On: hold Shift and double-tap W, A, S or D for a quick dodge that way, relative to where you look - mainly to duck out of a homing projectile's path on short notice. Moves you through the game's own character controller, so it collides with walls and enemies like any other movement. Off: the keys do nothing extra.");
Distance = config.Bind<float>("Dodge", "Dodge Distance (meters)", 6f, "Meters a full dodge covers (it stops sooner if it hits a wall). Default 6.");
Seconds = config.Bind<float>("Dodge", "Dodge Duration (seconds)", 0.25f, "Seconds a full dodge takes - distance / duration is the dodge speed. Default 0.25 (24 m/s at the default distance).");
CooldownSeconds = config.Bind<float>("Dodge", "Dodge Cooldown (seconds)", 1.5f, "Seconds before another dodge can trigger after one starts. Default 1.5.");
DoubleTapWindowSeconds = config.Bind<float>("Dodge", "Dodge Double-Tap Window (seconds)", 0.5f, "How quickly the two presses of the same direction key must land to count as a double-tap. Default 0.5.");
}
}
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "Update")]
internal static class DodgeHotkey_Update_Patch
{
private static readonly (KeyCode Key, Vector2 Dir)[] DirectionKeys = new(KeyCode, Vector2)[4]
{
((KeyCode)119, new Vector2(0f, 1f)),
((KeyCode)115, new Vector2(0f, -1f)),
((KeyCode)97, new Vector2(-1f, 0f)),
((KeyCode)100, new Vector2(1f, 0f))
};
private static readonly float[] LastTap = new float[4] { -10f, -10f, -10f, -10f };
private static int _lastFrame = -1;
private static bool InPlay => (int)FocusStateManager.CurrentState == 4;
private static bool ShiftHeld
{
get
{
if (!Input.GetKey((KeyCode)304))
{
return Input.GetKey((KeyCode)303);
}
return true;
}
}
[HarmonyPostfix]
private static void Postfix()
{
//IL_0046: 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)
if (Time.frameCount == _lastFrame)
{
return;
}
_lastFrame = Time.frameCount;
DodgeRunner.Tick();
if (!MovesToggle.Active || !Dodge.Enabled.Value || !InPlay)
{
return;
}
for (int i = 0; i < DirectionKeys.Length; i++)
{
if (Input.GetKeyDown(DirectionKeys[i].Key) && ShiftHeld)
{
float num = Time.time - LastTap[i];
LastTap[i] = Time.time;
if (num <= Dodge.DoubleTapWindowSeconds.Value)
{
LastTap[i] = -10f;
DodgeRunner.TryStart(DirectionKeys[i].Dir);
}
}
}
}
}
internal static class DodgeRunner
{
private const float WallProbeRadius = 0.3f;
private const float WallSkin = 0.15f;
private static float _cooldownUntil;
private static PlayerAgent? _player;
private static Vector3 _direction;
private static float _timeLeft;
internal static void Cancel()
{
_player = null;
}
internal static void TryStart(Vector2 local)
{
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
//IL_008c: 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_00b2: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_00ed: 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)
if ((Object)(object)_player != (Object)null || Time.time < _cooldownUntil || Mantle.Active || GroundPound.Active || Dodge.Seconds.Value <= 0f || Dodge.Distance.Value <= 0f)
{
return;
}
try
{
PlayerAgent val = default(PlayerAgent);
if (PlayerManager.TryGetLocalPlayerAgent(ref val) && !((Object)(object)val == (Object)null) && ((Agent)val).Alive)
{
Vector3 val2 = (((Object)(object)val.FPSCamera != (Object)null) ? ((LookCameraController)val.FPSCamera).FlatForward : ((Component)val).transform.forward);
Vector3 val3 = (((Object)(object)val.FPSCamera != (Object)null) ? ((LookCameraController)val.FPSCamera).FlatRight : ((Component)val).transform.right);
Vector3 val4 = val2 * local.y + val3 * local.x;
if (!(((Vector3)(ref val4)).sqrMagnitude < 0.0001f))
{
_player = val;
_direction = ((Vector3)(ref val4)).normalized;
_timeLeft = Dodge.Seconds.Value;
_cooldownUntil = Time.time + Dodge.CooldownSeconds.Value;
}
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(23, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Dodge: couldn't start. ");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Exception>(ex);
}
logger.LogWarning(val5);
_player = null;
}
}
internal static void Tick()
{
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
//IL_0047: 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_0069: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_player == (Object)null)
{
return;
}
try
{
if (!((Agent)_player).Alive)
{
_player = null;
return;
}
float num = Mathf.Min(Time.deltaTime, _timeLeft);
_timeLeft -= num;
Vector3 position = ((Agent)_player).Position;
float num2 = Dodge.Distance.Value / Dodge.Seconds.Value * num;
RaycastHit val = default(RaycastHit);
bool num3 = Physics.SphereCast(position + Vector3.up, 0.3f, _direction, ref val, num2 + 0.15f, LayerManager.MASK_WORLD);
if (num3)
{
num2 = Mathf.Max(0f, ((RaycastHit)(ref val)).distance - 0.15f);
}
PlayerCharacterController playerCharacterController = _player.PlayerCharacterController;
if (playerCharacterController != null)
{
playerCharacterController.Move(_direction * num2);
}
if (num3 || _timeLeft <= 0f)
{
_player = null;
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Dodge: step failed. ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
logger.LogWarning(val2);
_player = null;
}
}
}
[HarmonyPatch(typeof(BulletWeaponArchetype), "Update")]
internal static class FireMidAir
{
internal static ConfigEntry<bool> Enabled;
private const byte Untouched = byte.MaxValue;
internal static void Bind(ConfigFile config)
{
Enabled = config.Bind<bool>("Fire On The Move", "Fire Mid-Air Enabled", true, "Turns firing in the air on or off. On: your guns fire while jumping or falling. Off: vanilla (the trigger does nothing until you land).");
}
[HarmonyPrefix]
private static void Prefix(BulletWeaponArchetype __instance, out byte __state)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected I4, but got Unknown
__state = byte.MaxValue;
if (MovesToggle.Active && Enabled.Value)
{
PlayerLocomotion val = FireGate.LocalLocomotion(__instance);
if (!((Object)(object)val == (Object)null) && Moves.InAir(val))
{
__state = (byte)(int)val.m_currentStateEnum;
val.m_currentStateEnum = (PLOC_State)0;
}
}
}
[HarmonyFinalizer]
private static void Finalizer(BulletWeaponArchetype __instance, byte __state)
{
if (__state != byte.MaxValue)
{
PlayerAgent owner = __instance.m_owner;
PlayerLocomotion val = ((owner != null) ? owner.Locomotion : null);
if ((Object)(object)val != (Object)null)
{
val.m_currentStateEnum = (PLOC_State)__state;
}
}
}
}
internal static class FireGate
{
internal static PlayerLocomotion? LocalLocomotion(BulletWeaponArchetype archetype)
{
PlayerAgent owner = archetype.m_owner;
PlayerAgent val = default(PlayerAgent);
if ((Object)(object)owner == (Object)null || !PlayerManager.TryGetLocalPlayerAgent(ref val) || (Object)(object)val == (Object)null)
{
return null;
}
if (!(((Il2CppObjectBase)owner).Pointer == ((Il2CppObjectBase)val).Pointer))
{
return null;
}
return owner.Locomotion;
}
}
[HarmonyPatch(typeof(BulletWeaponArchetype), "Update")]
internal static class FireWhileRunning
{
internal static ConfigEntry<bool> Enabled;
internal static void Bind(ConfigFile config)
{
Enabled = config.Bind<bool>("Fire On The Move", "Fire While Running Enabled", true, "Turns firing while sprinting on or off. On: your guns fire while you sprint, without slowing you down. Off: vanilla (the trigger does nothing while sprinting).");
}
[HarmonyPrefix]
private static void Prefix(BulletWeaponArchetype __instance, out bool __state)
{
__state = false;
if (MovesToggle.Active && Enabled.Value)
{
PlayerLocomotion val = FireGate.LocalLocomotion(__instance);
if (!((Object)(object)val == (Object)null) && val.IsRunning)
{
__state = true;
val.IsRunning = false;
}
}
}
[HarmonyFinalizer]
private static void Finalizer(BulletWeaponArchetype __instance, bool __state)
{
if (__state)
{
PlayerAgent owner = __instance.m_owner;
PlayerLocomotion val = ((owner != null) ? owner.Locomotion : null);
if ((Object)(object)val != (Object)null)
{
val.IsRunning = true;
}
}
}
}
[HarmonyPatch(typeof(FirstPersonItemHolder), "Update")]
internal static class FireWhileRunningPose
{
private const float RaisedFor = 0.6f;
private const float RaiseRate = 6f;
private static float _lastTrigger = -10f;
[HarmonyPrefix]
private static void Prefix(FirstPersonItemHolder __instance)
{
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Invalid comparison between Unknown and I4
try
{
if (!MovesToggle.Active || !FireWhileRunning.Enabled.Value)
{
return;
}
PlayerAgent owner = __instance.m_owner;
if ((Object)(object)owner == (Object)null || !((Agent)owner).IsLocallyOwned || (Object)(object)owner.Owner == (Object)null || owner.Owner.IsBot)
{
return;
}
PlayerLocomotion locomotion = owner.Locomotion;
if (!((Object)(object)locomotion == (Object)null) && (int)locomotion.m_currentStateEnum == 2)
{
ItemEquippable wieldedItem = __instance.WieldedItem;
bool num = (Object)(object)((wieldedItem != null) ? ((Il2CppObjectBase)wieldedItem).TryCast<BulletWeapon>() : null) != (Object)null;
if (num && Moves.InPlay && InputMapper.GetButton.Invoke((InputAction)8, (eFocusState)4))
{
_lastTrigger = Time.time;
}
bool flag = num && Time.time - _lastTrigger < 0.6f;
__instance.IsRunning = !flag;
if (flag)
{
__instance.RunInertia = 0f;
__instance.m_runWeight = Mathf.MoveTowards(__instance.m_runWeight, 0f, Time.deltaTime * 6f);
}
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag2 = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves sprint-fire pose failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val);
}
}
}
internal static class GroundPound
{
private readonly struct ImpactMessage
{
public readonly float X;
public readonly float Y;
public readonly float Z;
public ImpactMessage(Vector3 at)
{
//IL_0000: 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_000e: Unknown result type (might be due to invalid IL or missing references)
float x = at.x;
float y = at.y;
float z = at.z;
X = x;
Y = y;
Z = z;
}
}
private const string ImpactEvent = "MindAttic.GTFO.EZ.AbsurdMoves.GroundPound";
private const float FallDamageGraceSeconds = 0.5f;
private const int MaxDebris = 50;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> MinHeight;
internal static ConfigEntry<float> MinSpeed;
internal static ConfigEntry<float> Radius;
internal static ConfigEntry<float> PushDistance;
internal static ConfigEntry<float> Damage;
internal static ConfigEntry<float> Stagger;
internal static ConfigEntry<int> DebrisCount;
internal static ConfigEntry<string> ImpactSound;
private static bool _pounding;
private static float _speed;
private const float MaxPoundSeconds = 6f;
private static float _graceUntil;
private static float _startedAt;
private static bool _gameImmunity;
internal static bool Active => _pounding;
internal static void Bind(ConfigFile config)
{
Enabled = config.Bind<bool>("Ground Pound", "Ground Pound Enabled", true, "Turns the ground pound on or off. On: press Crouch in mid-air to slam down at double fall speed, taking no fall damage, and land in a shockwave that pushes enemies back. Only works high enough above the floor (below).");
MinHeight = config.Bind<float>("Ground Pound", "Min Height (meters)", 2f, "How far above the floor you must be for a ground pound to start.");
MinSpeed = config.Bind<float>("Ground Pound", "Min Slam Speed (m/s)", 12f, "Slowest the slam drops at, even if you were barely falling yet. It doubles your fall speed when that's faster.");
Radius = config.Bind<float>("Ground Pound", "Shockwave Radius (meters)", 5f, "How far from where you land the shockwave reaches.");
PushDistance = config.Bind<float>("Ground Pound", "Pushback Distance (meters)", 4f, "How far an enemy right next to you is shoved (less further out).");
Damage = config.Bind<float>("Ground Pound", "Shockwave Damage", 10f, "Damage to each enemy in the shockwave (less further out). 0 = push only.");
Stagger = config.Bind<float>("Ground Pound", "Shockwave Stagger", 3f, "Stagger multiplier of the shockwave's hit.");
DebrisCount = config.Bind<int>("Ground Pound", "Debris Count", 10, "Dust-and-scorch bursts scattered around the landing - a crater, not a single puff. At most 50.");
ImpactSound = config.Bind<string>("Ground Pound", "Impact Sound", "STINGER_LOW_BOOM", "Played on landing (a game sound event name). Empty = silent.");
}
internal static void Init()
{
RemoteEvents.Register("MindAttic.GTFO.EZ.AbsurdMoves.GroundPound", delegate(ulong sender, ImpactMessage message)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
try
{
Land(new Vector3(message.X, message.Y, message.Z), PlayerFor(sender));
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves teammate's ground pound failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val);
}
});
}
internal static void Reset(PlayerLocomotion? loc)
{
if (!_pounding && _graceUntil <= 0f)
{
return;
}
_pounding = false;
_graceUntil = 0f;
try
{
if ((Object)(object)loc != (Object)null && !((Il2CppObjectBase)loc).WasCollected)
{
loc.DisableFallDamageTemporarily = _gameImmunity;
}
}
catch (Exception)
{
}
}
private static bool OnFeet(PlayerLocomotion loc)
{
//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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
PLOC_State currentStateEnum = loc.m_currentStateEnum;
if ((int)currentStateEnum <= 2 || (int)currentStateEnum == 5 || (int)currentStateEnum == 17)
{
return true;
}
return false;
}
internal static void Tick(PlayerAgent agent, PlayerLocomotion loc)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_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)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//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_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
if (!_pounding && _graceUntil > 0f && Time.time > _graceUntil)
{
_graceUntil = 0f;
loc.DisableFallDamageTemporarily = _gameImmunity;
}
if (_pounding)
{
if (!Moves.InAir(loc))
{
if (!OnFeet(loc))
{
Reset(loc);
return;
}
_pounding = false;
_graceUntil = Time.time + 0.5f;
Vector3 position = ((Agent)agent).Position;
Land(position, agent);
NetworkAPI.InvokeEvent<ImpactMessage>("MindAttic.GTFO.EZ.AbsurdMoves.GroundPound", new ImpactMessage(position), (SNet_ChannelType)2);
}
else if (Time.time - _startedAt > 6f)
{
Reset(loc);
}
else
{
Vector3 verticalVelocity = loc.m_verticalVelocity;
verticalVelocity.y = Mathf.Min(verticalVelocity.y + Physics.gravity.y * Time.deltaTime, 0f - _speed);
loc.m_verticalVelocity = verticalVelocity;
loc.m_horizontalVelocity = Vector3.zero;
loc.DisableFallDamageTemporarily = true;
Moves.ResetFallStart(agent, loc);
}
}
else if (MovesToggle.Active && Enabled.Value && !Mantle.Active && Moves.InAir(loc) && Moves.InPlay && InputMapper.GetButtonDown.Invoke((InputAction)10, (eFocusState)4) && !Physics.Raycast(((Agent)agent).Position + Vector3.up * 0.2f, Vector3.down, MinHeight.Value + 0.2f, LayerManager.MASK_WORLD))
{
_pounding = true;
_startedAt = Time.time;
_speed = Mathf.Max(MinSpeed.Value, (0f - loc.m_verticalVelocity.y) * 2f);
if (_graceUntil <= 0f)
{
_gameImmunity = loc.DisableFallDamageTemporarily;
}
_graceUntil = 0f;
loc.DisableFallDamageTemporarily = true;
}
}
[HideFromIl2Cpp]
private static void Land(Vector3 at, PlayerAgent? pounder)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//IL_0038: 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_00a8: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
Sounds.Play(ImpactSound.Value, at);
SpawnDebris(at);
if (!SNet.IsMaster)
{
return;
}
float value = Radius.Value;
if (value <= 0f)
{
return;
}
HashSet<IntPtr> hashSet = new HashSet<IntPtr>();
bool flag = default(bool);
foreach (Collider item in (Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(at, value, LayerManager.MASK_ENEMY_DAMAGABLE))
{
Dam_EnemyDamageLimb component = ((Component)item).GetComponent<Dam_EnemyDamageLimb>();
object obj;
if (component == null)
{
obj = null;
}
else
{
Dam_EnemyDamageBase obj2 = component.m_base;
obj = ((obj2 != null) ? obj2.Owner : null);
}
EnemyAgent val = (EnemyAgent)obj;
if ((Object)(object)val == (Object)null || !((Agent)val).Alive || !hashSet.Add(((Il2CppObjectBase)val).Pointer))
{
continue;
}
Vector3 val2 = val.Position - at;
val2.y = 0f;
if (((Vector3)(ref val2)).sqrMagnitude < 0.01f)
{
val2 = Random.insideUnitSphere;
}
val2.y = 0f;
float num = Mathf.Clamp01(1f - ((Vector3)(ref val2)).magnitude / value);
((Vector3)(ref val2)).Normalize();
PoundPushes.Start(val, val2, Mathf.Max(0f, PushDistance.Value) * Mathf.Lerp(0.35f, 1f, num));
if (!(Damage.Value > 0f) || !((Object)(object)pounder != (Object)null))
{
continue;
}
try
{
component.BulletDamage(Damage.Value * Mathf.Lerp(0.5f, 1f, num), ((Il2CppObjectBase)pounder).Cast<Agent>(), ((Component)component).transform.position, val2, -val2, false, Stagger.Value, 1f, 0u);
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("GTFO.EZ.AbsurdMoves ground pound hit failed: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val3);
}
}
}
[HideFromIl2Cpp]
private static void SpawnDebris(Vector3 center)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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)
//IL_005d: 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_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_007b: 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_0085: 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_009d: 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_00a9: 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_00b4: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: 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)
try
{
FX_Manager.PlayEffect(false, (FX_GroupName)1, center + Vector3.up * 0.05f, Quaternion.LookRotation(Vector3.up), true);
float num = Mathf.Max(1f, Radius.Value * 0.5f);
int num2 = Mathf.Clamp(DebrisCount.Value, 0, 50);
RaycastHit val3 = default(RaycastHit);
for (int i = 0; i < num2; i++)
{
Vector2 val = Random.insideUnitCircle * num;
Vector3 val2 = (Physics.Raycast(center + new Vector3(val.x, 1f, val.y), Vector3.down, ref val3, 2.5f, LayerManager.MASK_WORLD) ? ((RaycastHit)(ref val3)).point : (center + new Vector3(val.x, 0f, val.y)));
FX_Manager.PlayEffect(false, (FX_GroupName)1, val2 + Vector3.up * 0.05f, Quaternion.LookRotation(Vector3.up), true);
}
}
catch (Exception)
{
}
}
private static PlayerAgent? PlayerFor(ulong lookup)
{
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if ((Object)(object)current != (Object)null && (Object)(object)current.Owner != (Object)null && current.Owner.Lookup == lookup)
{
return current;
}
}
return null;
}
}
internal sealed class PoundPushes : MonoBehaviour
{
private sealed class Push
{
public EnemyAgent Enemy;
public Vector3 Direction;
public float Remaining;
public float Age;
}
private const int AllAreas = -1;
private const float Sharpness = 12f;
private const float MaxSeconds = 0.6f;
private static readonly Dictionary<IntPtr, Push> pushes = new Dictionary<IntPtr, Push>();
public PoundPushes(IntPtr ptr)
: base(ptr)
{
}
[HideFromIl2Cpp]
internal static void Start(EnemyAgent enemy, Vector3 direction, float distance)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
pushes[((Il2CppObjectBase)enemy).Pointer] = new Push
{
Enemy = enemy,
Direction = direction,
Remaining = distance
};
}
private void Update()
{
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Expected O, but got Unknown
//IL_00b8: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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_014f: Unknown result type (might be due to invalid IL or missing references)
if (pushes.Count == 0)
{
return;
}
List<IntPtr> list = null;
NavMeshHit val = default(NavMeshHit);
NavMeshHit val3 = default(NavMeshHit);
NavMeshHit val4 = default(NavMeshHit);
bool flag = default(bool);
foreach (var (item, push2) in pushes)
{
try
{
EnemyAgent enemy = push2.Enemy;
push2.Age += Time.deltaTime;
if ((Object)(object)enemy == (Object)null || !((Agent)enemy).Alive || push2.Remaining < 0.02f || push2.Age > 0.6f)
{
(list ?? (list = new List<IntPtr>())).Add(item);
continue;
}
float num = push2.Remaining * (1f - Mathf.Exp(-12f * Time.deltaTime));
Vector3 position = enemy.Position;
if (!NavMesh.SamplePosition(position, ref val, 1f, -1))
{
(list ?? (list = new List<IntPtr>())).Add(item);
continue;
}
Vector3 val2 = position + push2.Direction * num;
if (NavMesh.Raycast(((NavMeshHit)(ref val)).position, val2, ref val3, -1))
{
val2 = ((NavMeshHit)(ref val3)).position;
push2.Remaining = 0f;
}
else
{
push2.Remaining -= num;
}
if (NavMesh.SamplePosition(val2, ref val4, 1f, -1))
{
enemy.AI.NavmeshAgentWarp(((NavMeshHit)(ref val4)).position);
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(46, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("GTFO.EZ.AbsurdMoves ground pound push failed: ");
((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val5);
(list ?? (list = new List<IntPtr>())).Add(item);
}
}
if (list == null)
{
return;
}
foreach (IntPtr item2 in list)
{
pushes.Remove(item2);
}
}
}
internal static class Mantle
{
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> Seconds;
internal static ConfigEntry<float> Reach;
internal static ConfigEntry<float> EyeMargin;
private const float MinLedgeHeight = 0.6f;
private const float OntoTop = 0.6f;
private const float StandRadius = 0.35f;
private const float StandHeight = 1.8f;
private const float FallbackEyeHeight = 1.6f;
private static bool _mantling;
private static float _startedAt;
private static Vector3 _from;
private static Vector3 _edge;
private static Vector3 _to;
private static FirstPersonItemHolder? _loweredOn;
internal static bool Active => _mantling;
internal static void Bind(ConfigFile config)
{
Enabled = config.Bind<bool>("Mantling", "Mantling Enabled", true, "Turns mantling on or off. On: jump at a ledge while holding forward and, if its top is no higher than your eyes and there's room to stand on it, you're pulled up on top.");
Seconds = config.Bind<float>("Mantling", "Mantle Duration (seconds)", 0.35f, "How long the pull-up takes.");
Reach = config.Bind<float>("Mantling", "Ledge Reach (meters)", 0.8f, "How close the ledge's face must be in front of you.");
EyeMargin = config.Bind<float>("Mantling", "Eye Level Margin (meters)", 0.1f, "How far above eye level a ledge top can still be grabbed. 0 = strictly at or below your eyes.");
}
internal static void Reset()
{
_mantling = false;
RaiseGun();
}
internal static void Tick(PlayerAgent agent, PlayerLocomotion loc)
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
Vector3 top;
Vector3 forward;
if (_mantling)
{
Step(agent, loc);
}
else if (MovesToggle.Active && Enabled.Value && !(Seconds.Value <= 0f) && !GroundPound.Active && Moves.InPlay && Moves.InAir(loc) && !(InputMapper.GetAxis.Invoke((InputAction)2, (eFocusState)4) < 0.5f) && FindLedge(agent, out top, out forward))
{
_mantling = true;
_startedAt = Time.time;
_from = ((Component)agent).transform.position;
_edge = new Vector3(_from.x, top.y + 0.05f, _from.z);
_to = top + forward * 0.05f + Vector3.up * 0.05f;
LowerGun(agent);
Step(agent, loc);
}
}
private static void Step(PlayerAgent agent, PlayerLocomotion loc)
{
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_006d: 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_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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!((Agent)agent).Alive || Seconds.Value <= 0f)
{
Reset();
return;
}
float num = Mathf.Clamp01((Time.time - _startedAt) / Seconds.Value);
Vector3 val = ((num < 0.6f) ? Vector3.Lerp(_from, _edge, Mathf.SmoothStep(0f, 1f, num / 0.6f)) : Vector3.Lerp(_edge, _to, Mathf.SmoothStep(0f, 1f, (num - 0.6f) / 0.4f)));
PlayerCharacterController playerCharacterController = agent.PlayerCharacterController;
if (playerCharacterController != null)
{
playerCharacterController.Move(val - ((Component)agent).transform.position);
}
loc.m_verticalVelocity = Vector3.zero;
loc.m_horizontalVelocity = Vector3.zero;
Moves.ResetFallStart(agent, loc);
if (num >= 1f)
{
Reset();
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("GTFO.EZ.AbsurdMoves mantle failed: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val2);
Reset();
}
}
private static void LowerGun(PlayerAgent agent)
{
FirstPersonItemHolder fPItemHolder = agent.FPItemHolder;
if (!((Object)(object)fPItemHolder == (Object)null) && !((Object)(object)_loweredOn != (Object)null))
{
int itemDownCounter = fPItemHolder.m_itemDownCounter;
fPItemHolder.m_itemDownCounter = itemDownCounter + 1;
_loweredOn = fPItemHolder;
}
}
private static void RaiseGun()
{
FirstPersonItemHolder loweredOn = _loweredOn;
_loweredOn = null;
if ((Object)(object)loweredOn == (Object)null)
{
return;
}
try
{
if (!((Il2CppObjectBase)loweredOn).WasCollected)
{
loweredOn.m_itemDownCounter = Mathf.Max(0, loweredOn.m_itemDownCounter - 1);
}
}
catch (Exception)
{
}
}
private static bool FindLedge(PlayerAgent agent, out Vector3 top, out Vector3 forward)
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
top = Vector3.zero;
forward = Moves.FlatForward(agent);
Vector3 position = ((Agent)agent).Position;
float num = ((Agent)agent).EyePosition.y - position.y;
if (num < 0.5f || num > 3f)
{
num = 1.6f;
}
RaycastHit val = default(RaycastHit);
if (!Physics.Raycast(position + Vector3.up * 0.6f, forward, ref val, Reach.Value, LayerManager.MASK_WORLD))
{
return false;
}
if (Mathf.Abs(((RaycastHit)(ref val)).normal.y) > 0.35f)
{
return false;
}
float num2 = num + EyeMargin.Value;
RaycastHit val2 = default(RaycastHit);
if (!Physics.Raycast(position + forward * (((RaycastHit)(ref val)).distance + 0.3f) + Vector3.up * (num2 + 0.05f), Vector3.down, ref val2, num2 + 0.05f - 0.6f + 0.05f, LayerManager.MASK_WORLD))
{
return false;
}
if (((RaycastHit)(ref val2)).normal.y < 0.7f)
{
return false;
}
float num3 = ((RaycastHit)(ref val2)).point.y - position.y;
if (num3 < 0.6f || num3 > num2)
{
return false;
}
Vector3 val3 = position + forward * (((RaycastHit)(ref val)).distance + 0.6f);
val3.y = ((RaycastHit)(ref val2)).point.y;
if (Physics.CheckCapsule(val3 + Vector3.up * 0.4f, val3 + Vector3.up * 1.4499999f, 0.35f, LayerManager.MASK_WORLD))
{
return false;
}
if (Physics.Raycast(position + Vector3.up * (num - 0.1f), Vector3.up, num3 + 0.2f, LayerManager.MASK_WORLD))
{
return false;
}
top = val3;
return true;
}
}
[HarmonyPatch(typeof(PlayerLocomotion), "Update")]
internal static class Moves
{
private const float StaleAfter = 0.5f;
private static IntPtr _lastLoc;
private static float _lastTick = -10f;
internal static bool InPlay => (int)FocusStateManager.CurrentState == 4;
internal static bool InAir(PlayerLocomotion loc)
{
//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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
PLOC_State currentStateEnum = loc.m_currentStateEnum;
return (int)currentStateEnum == 3 || (int)currentStateEnum == 4;
}
internal static Vector3 FlatForward(PlayerAgent agent)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0041: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = (((Object)(object)agent.FPSCamera != (Object)null) ? ((LookCameraController)agent.FPSCamera).FlatForward : ((Component)agent).transform.forward);
val.y = 0f;
if (!(((Vector3)(ref val)).sqrMagnitude > 0.0001f))
{
return Vector3.forward;
}
return ((Vector3)(ref val)).normalized;
}
internal static void ResetFallStart(PlayerAgent agent, PlayerLocomotion loc)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
PLOC_Base currentState = ((StateMachine<PLOC_Base>)(object)loc).CurrentState;
PLOC_Fall val = ((currentState != null) ? ((Il2CppObjectBase)currentState).TryCast<PLOC_Fall>() : null);
if (val != null)
{
val.m_startPos = ((Agent)agent).Position;
}
}
internal static void JumpSway(PlayerAgent agent)
{
FirstPersonItemHolder fPItemHolder = agent.FPItemHolder;
if (fPItemHolder != null)
{
fPItemHolder.PlayJumpAnimation();
}
}
private static void ResetAll(PlayerLocomotion? loc)
{
GroundPound.Reset(loc);
Mantle.Reset();
AirMoves.Reset();
Slide.Reset();
}
[HarmonyPostfix]
private static void Postfix(PlayerLocomotion __instance)
{
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
try
{
if (!((StateMachine<PLOC_Base>)(object)__instance).LocallyOwned)
{
return;
}
PlayerAgent owner = __instance.m_owner;
if ((Object)(object)owner == (Object)null || (Object)(object)owner.Owner == (Object)null || owner.Owner.IsBot)
{
return;
}
if (!((Agent)owner).Alive || (int)GameStateManager.CurrentStateName != 10)
{
ResetAll(__instance);
MovesToggle.ResetForLevel();
return;
}
if (((Il2CppObjectBase)__instance).Pointer != _lastLoc || Time.time - _lastTick > 0.5f)
{
ResetAll(__instance);
}
_lastLoc = ((Il2CppObjectBase)__instance).Pointer;
_lastTick = Time.time;
MovesToggle.Tick(__instance);
GroundPound.Tick(owner, __instance);
Mantle.Tick(owner, __instance);
if (!Mantle.Active)
{
AirMoves.Tick(owner, __instance);
}
Slide.Tick(owner, __instance);
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(44, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves movement update failed: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
logger.LogWarning(val);
}
}
}
internal static class MovesToggle
{
private static ConfigEntry<KeyCode> key;
internal static bool Active { get; private set; }
internal static void Bind(ConfigFile config)
{
key = config.Bind<KeyCode>("Moves Toggle", "ToggleAbsurdMovesKey", (KeyCode)278, "Switches every Absurd Move on or off, all at once. Off: the dodge, bullet time, fire mid-air/while running, ground pound, mantle, double jump and slide all do nothing, and whichever of them is in progress is cancelled right away. Off at the start of every level.");
}
internal static void Tick(PlayerLocomotion loc)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (Moves.InPlay && Input.GetKeyDown(key.Value))
{
Active = !Active;
if (!Active)
{
CancelAll(loc);
}
Announce(Active ? "Absurd Moves: ON" : "Absurd Moves: OFF");
}
}
internal static void ResetForLevel()
{
Active = false;
}
private static void CancelAll(PlayerLocomotion loc)
{
GroundPound.Reset(loc);
Mantle.Reset();
AirMoves.Reset();
Slide.Reset();
DodgeRunner.Cancel();
BulletTime.ForceEnd();
}
private static void Announce(string message)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
MessageHelper.Show(message, MessageType.Center, 3f);
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(message);
}
logger.LogInfo(val);
}
}
[BepInPlugin("MindAttic.GTFO.EZ.AbsurdMoves", "GTFO.EZ.AbsurdMoves", "18.0.0")]
[BepInProcess("GTFO.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
public const string GUID = "MindAttic.GTFO.EZ.AbsurdMoves";
public const string NAME = "GTFO.EZ.AbsurdMoves";
public const string VERSION = "18.0.0";
internal static ManualLogSource Logger;
public override void Load()
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val;
if (!((BasePlugin)this).Config.Bind<bool>("0. Mod", "Enabled", true, "Turn the whole mod on or off. When false, the mod loads nothing: no patches, no moves, no hotkeys.").Value)
{
ManualLogSource logger = Logger;
val = new BepInExInfoLogInterpolatedStringHandler(64, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("GTFO.EZ.AbsurdMoves");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is switched off in its config ([0. Mod] Enabled) - not loading.");
}
logger.LogInfo(val);
return;
}
MovesToggle.Bind(((BasePlugin)this).Config);
Dodge.Bind(((BasePlugin)this).Config);
BulletTime.Bind(((BasePlugin)this).Config);
AirMoves.Bind(((BasePlugin)this).Config);
Slide.Bind(((BasePlugin)this).Config);
FireMidAir.Bind(((BasePlugin)this).Config);
FireWhileRunning.Bind(((BasePlugin)this).Config);
GroundPound.Bind(((BasePlugin)this).Config);
Mantle.Bind(((BasePlugin)this).Config);
ConfigMigrations.Apply(((BasePlugin)this).Config);
ClassInjector.RegisterTypeInIl2Cpp<LoopSounds>();
ClassInjector.RegisterTypeInIl2Cpp<BulletTime>();
ClassInjector.RegisterTypeInIl2Cpp<PoundPushes>();
BulletTime.Init();
GroundPound.Init();
new Harmony("MindAttic.GTFO.EZ.AbsurdMoves").PatchAll();
((BasePlugin)this).AddComponent<LoopSounds>();
((BasePlugin)this).AddComponent<BulletTime>();
((BasePlugin)this).AddComponent<PoundPushes>();
ManualLogSource logger2 = Logger;
val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("GTFO.EZ.AbsurdMoves");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("18.0.0");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded.");
}
logger2.LogInfo(val);
}
}
internal static class Slide
{
[HarmonyPatch(typeof(PlayerLocomotion), "GetInputMoveVector")]
private static class IgnoreMoveKeys
{
[HarmonyPostfix]
private static void Postfix(PlayerLocomotion __instance, ref Vector3 __result)
{
//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)
if (_sliding && ((StateMachine<PLOC_Base>)(object)__instance).LocallyOwned)
{
PlayerAgent owner = __instance.m_owner;
if ((Object)(object)owner != (Object)null && (Object)(object)owner.Owner != (Object)null && !owner.Owner.IsBot)
{
__result = Vector3.zero;
}
}
}
}
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> Speed;
internal static ConfigEntry<float> Seconds;
private const float WallProbeRadius = 0.3f;
private const float WallSkin = 0.15f;
private static PLOC_State _lastState;
private static bool _sliding;
private static Vector3 _direction;
private static float _startSpeed;
private static float _startedAt;
internal static bool Active => _sliding;
internal static void Bind(ConfigFile config)
{
Enabled = config.Bind<bool>("Slide", "Slide Enabled", true, "Turns the slide on or off. On: crouch while sprinting to slide on in the direction you were running - holding your speed, then easing to a stop - while you look and shoot anywhere. Standing up, jumping or hitting a wall ends it.");
Speed = config.Bind<float>("Slide", "Slide Start Speed (m/s)", 9f, "Speed the slide starts at (more if you were already faster).");
Seconds = config.Bind<float>("Slide", "Slide Duration (seconds)", 2.4f, "How long a slide lasts. Speed holds near the start speed early on and drops off toward the end; a slide covers about two thirds of start speed x duration (14 m at the defaults).");
}
internal static void Reset()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
_sliding = false;
_lastState = (PLOC_State)0;
}
internal static void Tick(PlayerAgent agent, PlayerLocomotion loc)
{
//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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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: Invalid comparison between Unknown and I4
//IL_010b: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Invalid comparison between Unknown and I4
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
PLOC_State currentStateEnum = loc.m_currentStateEnum;
bool flag = (int)_lastState == 2;
_lastState = currentStateEnum;
if (!_sliding)
{
if (!MovesToggle.Active || !Enabled.Value || !flag || (int)currentStateEnum != 1 || Seconds.Value <= 0f)
{
return;
}
Vector3 horizontalVelocity = loc.HorizontalVelocity;
horizontalVelocity.y = 0f;
_direction = ((((Vector3)(ref horizontalVelocity)).sqrMagnitude > 0.25f) ? ((Vector3)(ref horizontalVelocity)).normalized : Moves.FlatForward(agent));
_startSpeed = Mathf.Max(Speed.Value, ((Vector3)(ref horizontalVelocity)).magnitude);
loc.ResetExternalPushForce();
loc.m_horizontalVelocity = Vector3.zero;
_startedAt = Time.time;
_sliding = true;
}
float num = (Time.time - _startedAt) / Seconds.Value;
if (!Enabled.Value || (int)currentStateEnum != 1 || num >= 1f)
{
_sliding = false;
return;
}
float num2 = _startSpeed * (1f - num * num) * Time.deltaTime;
RaycastHit val = default(RaycastHit);
bool num3 = Physics.SphereCast(((Agent)agent).Position + Vector3.up * 0.5f, 0.3f, _direction, ref val, num2 + 0.15f, LayerManager.MASK_WORLD);
if (num3)
{
num2 = Mathf.Max(0f, ((RaycastHit)(ref val)).distance - 0.15f);
}
PlayerCharacterController playerCharacterController = agent.PlayerCharacterController;
if (playerCharacterController != null)
{
playerCharacterController.Move(_direction * num2);
}
if (num3)
{
_sliding = false;
}
}
}
internal static class Sounds
{
private static readonly HashSet<string> failed = new HashSet<string>();
internal static void Play(string eventName, Vector3 position)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(eventName))
{
return;
}
try
{
CellSound.Post(eventName.Trim(), position);
}
catch (Exception ex)
{
if (failed.Add(eventName))
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(44, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves couldn't play sound '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(eventName);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val);
}
}
}
}
internal sealed class LoopSounds : MonoBehaviour
{
private sealed class Loop
{
public CellSoundPlayer Player;
public string StopEvent = "";
public Vector3 Position;
public float LastTouch;
}
private const float StopAfter = 0.25f;
private static readonly Dictionary<string, Loop> loops = new Dictionary<string, Loop>();
private static readonly HashSet<string> failed = new HashSet<string>();
public LoopSounds(IntPtr ptr)
: base(ptr)
{
}
internal static void Touch(string key, string startEvent, string stopEvent, Vector3 position)
{
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_004e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
if (string.IsNullOrWhiteSpace(startEvent) || failed.Contains(startEvent))
{
return;
}
CellSoundPlayer val = null;
try
{
if (!loops.TryGetValue(key, out Loop value))
{
val = new CellSoundPlayer(position);
value = new Loop
{
Player = val,
StopEvent = stopEvent
};
value.Player.Post(startEvent.Trim(), position);
loops[key] = value;
}
else
{
value.Player.UpdatePosition(position);
}
value.Position = position;
value.LastTouch = Time.time;
}
catch (Exception ex)
{
if (failed.Add(startEvent))
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(48, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("GTFO.EZ.AbsurdMoves couldn't run loop sound '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(startEvent);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("': ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val2);
}
loops.Remove(key);
try
{
if (val != null)
{
val.Recycle();
}
}
catch
{
}
}
}
private void Update()
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
if (loops.Count == 0)
{
return;
}
List<string> list = null;
foreach (var (item, loop2) in loops)
{
if (Time.time - loop2.LastTouch > 0.25f)
{
(list ?? (list = new List<string>())).Add(item);
}
}
if (list == null)
{
return;
}
bool flag = default(bool);
foreach (string item2 in list)
{
Loop loop3 = loops[item2];
loops.Remove(item2);
try
{
if (!string.IsNullOrWhiteSpace(loop3.StopEvent))
{
loop3.Player.Post(loop3.StopEvent.Trim(), loop3.Position);
}
else
{
loop3.Player.Stop();
}
loop3.Player.Recycle();
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(48, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GTFO.EZ.AbsurdMoves couldn't stop a loop sound: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogWarning(val);
}
}
}
}
}