using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AimAssist;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Enemy;
using Equipment;
using Fleece;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Progress;
using RunnerUtils.Components;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.Universal;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RunnerUtils")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Utilities for IAYB speedrunning ")]
[assembly: AssemblyFileVersion("3.4.2.0")]
[assembly: AssemblyInformationalVersion("3.4.2")]
[assembly: AssemblyProduct("RunnerUtils")]
[assembly: AssemblyTitle("RunnerUtils")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.4.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RunnerUtils
{
internal static class Configs
{
private static ConfigEntry<bool> m_skipSplashCardsEntry;
private static ConfigEntry<float> m_throwCamRangeScaleEntry;
private static ConfigEntry<bool> m_throwCamUnlockCameraEntry;
private static ConfigEntry<bool> m_throwCamAutoSwitchEntry;
private static ConfigEntry<bool> m_walkabilityOverlayEntry;
private static ConfigEntry<bool> m_saveLocationVerboseEntry;
private static ConfigEntry<bool> m_snowmanPercentEntry;
public static bool SkipSplashCardsEnabled
{
get
{
return m_skipSplashCardsEntry.Value;
}
set
{
m_skipSplashCardsEntry.Value = value;
}
}
public static float ThrowCamRangeScale
{
get
{
return m_throwCamRangeScaleEntry.Value;
}
set
{
m_throwCamRangeScaleEntry.Value = value;
}
}
public static bool ThrowCamUnlockCameraEnabled
{
get
{
return m_throwCamUnlockCameraEntry.Value;
}
set
{
m_throwCamUnlockCameraEntry.Value = value;
}
}
public static bool ThrowCamAutoSwitchEnabled
{
get
{
return m_throwCamAutoSwitchEntry.Value;
}
set
{
m_throwCamAutoSwitchEntry.Value = value;
}
}
public static bool WalkabilityOverlayEnabled
{
get
{
return m_walkabilityOverlayEntry.Value;
}
set
{
m_walkabilityOverlayEntry.Value = value;
}
}
public static bool SaveLocationVerboseEnabled
{
get
{
return m_saveLocationVerboseEntry.Value;
}
set
{
m_saveLocationVerboseEntry.Value = value;
}
}
public static bool SnowmanPercentEnabled
{
get
{
return m_snowmanPercentEntry.Value;
}
set
{
m_snowmanPercentEntry.Value = value;
}
}
public static void Init(ConfigFile config)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
m_skipSplashCardsEntry = config.Bind<bool>("Options", "Skip Splash Cards", false, "Skip the splash cards on boot");
m_throwCamRangeScaleEntry = config.Bind<float>("Throw Cam", "Camera Range", 0.2f, new ConfigDescription("Follow range of the throw cam", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 3f), Array.Empty<object>()));
m_throwCamUnlockCameraEntry = config.Bind<bool>("Throw Cam", "Unlock Camera", false, "Unlock the camera when in throw cam");
m_throwCamAutoSwitchEntry = config.Bind<bool>("Throw Cam", "Auto Switch", false, "Automatically switch to throw cam when a projectile is thrown");
m_walkabilityOverlayEntry = config.Bind<bool>("Walkability Overlay", "Enable", false, "Makes all walkable surfaces appear snowy, and all unwalkable surfaces appear black");
m_saveLocationVerboseEntry = config.Bind<bool>("Location Save", "Verbose", false, "Log the exact location and rotation when a save or load is performed");
m_snowmanPercentEntry = config.Bind<bool>("Snowman%", "Enable", true, "Displays your time upon destroying a snowman, to time the (silly) category snowman%");
}
}
public static class FairPlay
{
private static InGameLog igl = new InGameLog(" ", 10);
public static bool triggersModified = false;
public static void Init()
{
//IL_000f: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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)
igl.anchoredPos = new Vector2(800f, 567f);
igl.sizeDelta = new Vector2(750f, 250f);
igl.textAlignment = (TextAlignmentOptions)260;
igl.Setup();
}
public static void Update()
{
if (!Object.op_Implicit((Object)(object)igl.TextComponent))
{
return;
}
igl.Clear();
foreach (ComponentBase component in ComponentBase.components)
{
if (component.ShowOnFairPlay && component.enabled)
{
igl.LogLine(component.Identifier);
}
}
if (triggersModified)
{
igl.LogLine("Triggers");
}
if (LocationSave.savedPosition.HasValue || LocationSave.savedRotation.HasValue)
{
igl.LogLine("Location Saved" + (Configs.SaveLocationVerboseEnabled ? (" (" + LocationSave.StringLoc + ")") : ""));
}
}
}
public class InGameLog
{
private class CircularArray<T>
{
private int len;
private T[] array = new T[length];
private int startIndex;
public T this[int idx]
{
get
{
return array[GetIdx(idx)];
}
set
{
array[GetIdx(idx)] = value;
}
}
public int Length
{
get
{
return len;
}
set
{
if (value > len)
{
for (int i = len; i < value; i++)
{
array[i] = default(T);
}
}
len = value;
}
}
public int MaxLength
{
get
{
return array.Length;
}
set
{
if (value > 0 && value != this.array.Length)
{
T[] array = new T[value];
int num = Math.Min(value, this.array.Length);
for (int i = 0; i < num; i++)
{
array[i] = this.array[GetIdx(i)];
}
startIndex = 0;
this.array = array;
}
}
}
public CircularArray(int length)
{
}
private int GetIdx(int index)
{
return (startIndex + index) % array.Length;
}
public void Push(T value)
{
array[GetIdx(len)] = value;
if (len == array.Length)
{
startIndex++;
if (startIndex == array.Length)
{
startIndex = 0;
}
}
else
{
len++;
}
}
public T Pop()
{
return array[GetIdx(--len)];
}
public void ForEach(Action<T, int> callback)
{
for (int i = 0; i < len; i++)
{
callback(this[i], i);
}
}
public void ReverseForEach(Action<T, int> callback)
{
for (int num = len - 1; num >= 0; num--)
{
callback(this[num], num);
}
}
}
private int m_bufferLen = 15;
private bool m_shouldBeVisible = true;
private int fadeLen;
public Vector2 anchoredPos = new Vector2(-925f, 535f);
public Vector2 sizeDelta = new Vector2(500f, 250f);
public TextAlignmentOptions textAlignment = (TextAlignmentOptions)257;
private GameObject m_gameObj;
private string m_name;
private CircularArray<string> buffer;
public TextMeshProUGUI TextComponent { get; private set; }
public int Length
{
get
{
return m_bufferLen;
}
set
{
m_bufferLen = value;
buffer.MaxLength = value;
}
}
public InGameLog(string name = "Unnamed Log", int bufferLength = 15, int fadeLength = 4)
{
//IL_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
m_name = name;
m_bufferLen = bufferLength;
fadeLen = fadeLength;
buffer = new CircularArray<string>(m_bufferLen);
}
public void ToggleVisibility()
{
((Behaviour)TextComponent).enabled = !((Behaviour)TextComponent).enabled;
m_shouldBeVisible = ((Behaviour)TextComponent).enabled;
}
public void Show()
{
((Behaviour)TextComponent).enabled = true;
m_shouldBeVisible = true;
}
public void Hide()
{
((Behaviour)TextComponent).enabled = false;
m_shouldBeVisible = false;
}
public void LogLine(string message)
{
if (!Object.op_Implicit((Object)(object)TextComponent))
{
throw new InvalidOperationException("Log not initialized! call Setup() before using.");
}
buffer.Push(message + "\n");
FlushBuffer();
}
public void Log(string message)
{
if (!Object.op_Implicit((Object)(object)TextComponent))
{
throw new InvalidOperationException("Log not initialized! call Setup() before using.");
}
buffer.Push(message);
FlushBuffer();
}
public void PushBufferLine(string message)
{
if (!Object.op_Implicit((Object)(object)TextComponent))
{
throw new InvalidOperationException("Log not initialized! call Setup() before using.");
}
buffer.Push(message + "\n");
}
public void PushBuffer(string message)
{
if (!Object.op_Implicit((Object)(object)TextComponent))
{
throw new InvalidOperationException("Log not initialized! call Setup() before using.");
}
buffer.Push(message);
}
public void Clear()
{
while (buffer.Length > 0)
{
buffer.Pop();
}
FlushBuffer();
}
public void SetBufferLine(int idx, string message)
{
if (idx >= buffer.Length)
{
buffer.Length = idx + 1;
}
buffer[idx] = message + "\n";
}
public void FlushBuffer()
{
if (Object.op_Implicit((Object)(object)TextComponent))
{
((TMP_Text)TextComponent).text = m_name + "\n";
buffer.ForEach(delegate(string val, int i)
{
TextMeshProUGUI textComponent = TextComponent;
((TMP_Text)textComponent).text = ((TMP_Text)textComponent).text + ((i < m_bufferLen - fadeLen) ? val : ($"<alpha=#{255 * (m_bufferLen - i) / fadeLen:X2}>" + val));
});
}
}
public void Setup()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_00b8: 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_0115: Unknown result type (might be due to invalid IL or missing references)
HUDGPS gPS = GameManager.instance.player.GetHUD().GetGPS();
if (Object.op_Implicit((Object)(object)m_gameObj))
{
if (!m_gameObj.activeInHierarchy)
{
m_gameObj = Object.Instantiate<GameObject>(new GameObject(), ((Component)((Component)gPS).transform.parent).gameObject.transform);
}
}
else
{
m_gameObj = Object.Instantiate<GameObject>(new GameObject(), ((Component)((Component)gPS).transform.parent).gameObject.transform);
}
((Object)m_gameObj).name = m_name + " (Ingame Log)";
RectTransform val = m_gameObj.GetComponent<RectTransform>();
if (!Object.op_Implicit((Object)(object)val))
{
val = m_gameObj.AddComponent<RectTransform>();
}
val.anchoredPosition = anchoredPos;
val.sizeDelta = sizeDelta;
TextMeshProUGUI componentInChildren = ((Component)((Component)gPS).transform.parent).GetComponentInChildren<TextMeshProUGUI>();
TextComponent = m_gameObj.GetComponent<TextMeshProUGUI>();
if (!Object.op_Implicit((Object)(object)TextComponent))
{
TextComponent = m_gameObj.AddComponent<TextMeshProUGUI>();
}
((TMP_Text)TextComponent).alignment = textAlignment;
((TMP_Text)TextComponent).font = ((TMP_Text)componentInChildren).font;
((TMP_Text)TextComponent).fontSize = 24f;
((Behaviour)TextComponent).enabled = m_shouldBeVisible;
FlushBuffer();
}
}
[BepInPlugin("RunnerUtils", "RunnerUtils", "3.4.2")]
public class Mod : BaseUnityPlugin
{
[HarmonyPatch(typeof(Player), "Initialize")]
public class PlayerPatch
{
[HarmonyPostfix]
public static void PlayerInitPostfix()
{
ShowTriggers.RegisterAll();
Igl.Setup();
ThrowCam.Reset();
FairPlay.Init();
ComponentBase<HardFallOverlay>.Instance.SetupIndicator();
ComponentBase<MovementDebug>.Instance.Init();
}
}
[HarmonyPatch(typeof(PlayerMovement), "Initialize")]
public class PlayerMovementPatch
{
[HarmonyPostfix]
public static void InitWalkabilityOverlay(CharacterController ___controller)
{
if (Configs.WalkabilityOverlayEnabled)
{
Terrain[] activeTerrains = Terrain.activeTerrains;
foreach (Terrain obj in activeTerrains)
{
TerrainData data = obj.terrainData;
WalkabilityOverlay.MakeWalkabilityTex(ref data, ___controller.slopeLimit);
obj.terrainData = data;
}
}
}
}
[HarmonyPatch(typeof(HUDLevelTimer), "Update")]
public class The
{
[HarmonyPostfix]
public static void Postfix(ref TMP_Text ___gradeText)
{
___gradeText.text = " " + ___gradeText.text;
}
}
internal static ManualLogSource Logger;
private static string loadBearingColonThree = ":3";
public static Mod Instance { get; private set; }
private static RUInputManager InputManager { get; set; } = new RUInputManager();
public static InGameLog Igl { get; private set; } = new InGameLog("RunnerUtils~Ingame Log (v3.4.2)");
public void Awake()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
if (loadBearingColonThree != ":3")
{
Application.Quit();
}
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
Configs.Init(((BaseUnityPlugin)this).Config);
new Harmony("RunnerUtils").PatchAll();
SceneManager.sceneLoaded += OnSceneLoaded;
Logger.LogInfo((object)"Hiiiiiiiiiiii :3");
}
private void Update()
{
if (GameManager.instance.player != null)
{
FairPlay.Update();
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
if ((int)mode == 1)
{
ShowTriggers.ExtendRegistry();
}
ViewCones.OnSceneLoad();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RunnerUtils";
public const string PLUGIN_NAME = "RunnerUtils";
public const string PLUGIN_VERSION = "3.4.2";
}
}
namespace RunnerUtils.UI
{
internal class Base
{
public struct CustomSettingTab
{
public readonly string name;
public readonly Type type;
public CustomSettingTab(string name, Type type)
{
this.name = name;
this.type = type;
}
}
[HarmonyPatch(typeof(UISettingsRoot), "Start")]
public static class UISettingsRootPatch
{
[HarmonyPrefix]
public static void AttachTabs(UISettingsRoot __instance)
{
Mod.Logger.LogInfo((object)"Attaching custom settings");
m_uiSettingsRootInstance = __instance;
CustomTabs.ForEach(delegate(CustomSettingTab customTabInfo)
{
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
if (!typeof(UISettingsSubMenu).IsAssignableFrom(customTabInfo.type))
{
throw new ArgumentException("Settings submenu type \"" + customTabInfo.type.FullName + "\" must inherit from UISettingsSubMenu");
}
Mod.Logger.LogInfo((object)(" => Attaching tab " + customTabInfo.name));
GameObject gameObject = ((Component)((Component)__instance.subMenus[0]).gameObject.transform.parent).gameObject;
GameObject val = Object.Instantiate<GameObject>(((Component)__instance.subMenus[0]).gameObject, gameObject.transform);
((Object)val).name = customTabInfo.name + " Settings";
foreach (Transform item in val.transform)
{
Object.Destroy((Object)(object)((Component)item).gameObject);
}
Object.Destroy((Object)(object)val.GetComponent<UISettingsSubMenuVisual>());
Component obj = val.AddComponent(customTabInfo.type);
UISettingsSubMenu val2 = (UISettingsSubMenu)(object)((obj is UISettingsSubMenu) ? obj : null);
val2.menuName = FleeceUtil.MakeJumper(customTabInfo.name);
int num = __instance.subMenus.Length;
Array.Resize(ref __instance.subMenus, num + 1);
__instance.subMenus[num] = val2;
val.transform.SetSiblingIndex(num + 1);
});
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass10_0
{
public ScrollRect scrollRect;
}
private static UISettingsRoot m_uiSettingsRootInstance;
private static Sprite m_uiMilitarySquareSprite = ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite img) => ((Object)img).name == "UI_MilitarySquare"));
public static List<CustomSettingTab> CustomTabs { get; } = new List<CustomSettingTab>(1)
{
new CustomSettingTab("RunnerUtils", typeof(UISettingsSubMenuRunnerUtils))
};
public static UISettingsOptionToggle MakeToggleOption(Transform parent, Jumper text, bool initialValue)
{
GameObject obj = Object.Instantiate<GameObject>(((Component)((Component)m_uiSettingsRootInstance.subMenus[0]).transform.GetChild(2)).gameObject, parent);
((Component)obj.transform.GetChild(0)).gameObject.GetComponent<FleeceTextSetter>().passage = text;
UISettingsOptionToggle component = obj.GetComponent<UISettingsOptionToggle>();
component.SetToggled(initialValue);
return component;
}
public static GameObject MakeHeading(Transform parent, string text, string subtitle = null)
{
GameObject obj = Object.Instantiate<GameObject>(((Component)((Component)m_uiSettingsRootInstance.subMenus[5]).transform.GetChild(0)).gameObject, parent);
((Object)obj.transform).name = text;
VerticalLayoutGroup obj2 = obj.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)obj2).padding.left = 16;
((LayoutGroup)obj2).padding.top = 30;
((LayoutGroup)obj2).CalculateLayoutInputHorizontal();
((LayoutGroup)obj2).CalculateLayoutInputVertical();
obj.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
Transform child = obj.transform.GetChild(0);
((Object)child).name = "RunnerUtils Heading text";
((TMP_Text)((Component)child).gameObject.GetComponent<TextMeshProUGUI>()).text = text;
Transform child2 = obj.transform.GetChild(1);
if (subtitle != null)
{
((Object)child2).name = "RunnerUtils Subtitle text";
((TMP_Text)((Component)child2).gameObject.GetComponent<TextMeshProUGUI>()).text = subtitle;
return obj;
}
Object.Destroy((Object)(object)((Component)child2).gameObject);
return obj;
}
public static void MakeRebind(Transform parent, GameObject prefab, RUInputManager.BindingInfo bindingInfo)
{
//IL_008a: 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)
GameObject obj = Object.Instantiate<GameObject>(prefab, parent);
((TMP_Text)((Component)obj.transform.Find("Text (TMP)")).GetComponent<TextMeshProUGUI>()).text = bindingInfo.identifier;
UISettingsOptionRebind component = obj.GetComponent<UISettingsOptionRebind>();
component.passageActionName = FleeceUtil.MakeJumper(bindingInfo.identifier);
component.actionDescription.text = bindingInfo.identifier;
InputActionMap obj2 = GameManager.instance.inputManager.playerInput.actions.FindActionMap("Default Action Map", false);
InputAction val = ((IEnumerable<InputAction>)(object)obj2.actions).FirstOrDefault((Func<InputAction, bool>)((InputAction act) => act.name == "RunnerUtils " + bindingInfo.identifier + " (kbm)"));
InputAction val2 = ((IEnumerable<InputAction>)(object)obj2.actions).FirstOrDefault((Func<InputAction, bool>)((InputAction act) => act.name == "RunnerUtils " + bindingInfo.identifier + " (gamepad)"));
if (val == null || val2 == null)
{
throw new Exception("InputAction(s) for \"" + bindingInfo.identifier + "\" were unexpectedly not found");
}
component.actions = (InputActionReference[])(object)new InputActionReference[2]
{
InputActionReference.Create(val),
InputActionReference.Create(val2)
};
}
public static GameObject MakeMenuScrollable(UISettingsSubMenu menu)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: 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_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: 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)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Expected O, but got Unknown
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Expected O, but got Unknown
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_0337: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0378: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: Expected O, but got Unknown
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03de: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Unknown result type (might be due to invalid IL or missing references)
//IL_04df: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0500: Unknown result type (might be due to invalid IL or missing references)
//IL_0508: Unknown result type (might be due to invalid IL or missing references)
//IL_0510: Unknown result type (might be due to invalid IL or missing references)
//IL_0517: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass10_0 CS$<>8__locals0 = new <>c__DisplayClass10_0();
VerticalLayoutGroup component = ((Component)menu).GetComponent<VerticalLayoutGroup>();
((Behaviour)component).enabled = false;
GameObject val = new GameObject("RunnerUtils Scroll", new Type[1] { typeof(RectTransform) });
val.transform.SetParent(((Component)menu).transform, false);
RectTransform component2 = val.GetComponent<RectTransform>();
component2.anchorMin = Vector2.zero;
component2.anchorMax = Vector2.one;
component2.offsetMin = new Vector2(0f, 3f);
component2.offsetMax = new Vector2(-2f, 0f);
GameObject val2 = new GameObject("RunnerUtils Scrollbar", new Type[2]
{
typeof(RectTransform),
typeof(Scrollbar)
});
val2.transform.SetParent(val.transform, false);
RectTransform component3 = val2.GetComponent<RectTransform>();
component3.anchorMin = new Vector2(1f, 0f);
component3.anchorMax = new Vector2(1f, 1f);
component3.pivot = new Vector2(1f, 1f);
component3.sizeDelta = new Vector2(20f, 0f);
component3.anchoredPosition = Vector2.zero;
GameObject val3 = new GameObject("RunnerUtils Sliding Area", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(val2.transform, false);
RectTransform component4 = val3.GetComponent<RectTransform>();
component4.anchorMin = Vector2.zero;
component4.anchorMax = Vector2.one;
component4.offsetMin = Vector2.zero;
component4.offsetMax = Vector2.zero;
GameObject val4 = new GameObject("RunnerUtils Scroll Handle", new Type[2]
{
typeof(RectTransform),
typeof(Image)
});
val4.transform.SetParent(val3.transform, false);
RectTransform component5 = val4.GetComponent<RectTransform>();
component5.anchorMin = Vector2.zero;
component5.anchorMax = Vector2.one;
component5.offsetMin = Vector2.zero;
component5.offsetMax = Vector2.zero;
if (Object.op_Implicit((Object)(object)m_uiMilitarySquareSprite))
{
Image component6 = ((Component)component5).GetComponent<Image>();
component6.sprite = m_uiMilitarySquareSprite;
component6.type = (Type)1;
component6.preserveAspect = false;
component6.pixelsPerUnitMultiplier = 3f;
}
else
{
Debug.LogWarning((object)"UI_MilitarySquare not found in memory");
}
Scrollbar component7 = val2.GetComponent<Scrollbar>();
component7.direction = (Direction)2;
component7.handleRect = component5;
((Selectable)component7).targetGraphic = (Graphic)(object)val4.GetComponent<Image>();
CS$<>8__locals0.scrollRect = val.AddComponent<ScrollRect>();
CS$<>8__locals0.scrollRect.verticalScrollbar = component7;
CS$<>8__locals0.scrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)1;
CS$<>8__locals0.scrollRect.vertical = true;
CS$<>8__locals0.scrollRect.horizontal = false;
CS$<>8__locals0.scrollRect.scrollSensitivity = 5f;
CS$<>8__locals0.scrollRect.movementType = (MovementType)2;
CS$<>8__locals0.scrollRect.inertia = true;
GameObject val5 = new GameObject("RunnerUtils Viewport", new Type[2]
{
typeof(RectTransform),
typeof(RectMask2D)
});
val5.transform.SetParent(val.transform, false);
RectTransform component8 = val5.GetComponent<RectTransform>();
component8.anchorMin = Vector2.zero;
component8.anchorMax = Vector2.one;
component8.offsetMin = Vector2.zero;
component8.offsetMax = new Vector2(-30f, 0f);
Image obj = val5.gameObject.AddComponent<Image>();
((Graphic)obj).color = new Color(0f, 0f, 0f, 0f);
((Graphic)obj).raycastTarget = true;
GameObject val6 = new GameObject("RunnerUtils Scroll Content", new Type[1] { typeof(RectTransform) });
val6.transform.SetParent(val5.transform, false);
RectTransform component9 = val6.GetComponent<RectTransform>();
component9.anchorMin = Vector2.zero;
component9.anchorMax = Vector2.one;
component9.offsetMin = Vector2.zero;
component9.offsetMax = Vector2.zero;
component9.pivot = new Vector2(0f, 1f);
CS$<>8__locals0.scrollRect.viewport = component8;
CS$<>8__locals0.scrollRect.content = component9;
((MonoBehaviour)CS$<>8__locals0.scrollRect).StartCoroutine(FixScrollOnNextFrame());
VerticalLayoutGroup obj2 = val6.AddComponent<VerticalLayoutGroup>();
((LayoutGroup)obj2).padding = ((LayoutGroup)component).padding;
((HorizontalOrVerticalLayoutGroup)obj2).spacing = ((HorizontalOrVerticalLayoutGroup)component).spacing;
((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = ((HorizontalOrVerticalLayoutGroup)component).childControlWidth;
((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = ((HorizontalOrVerticalLayoutGroup)component).childControlHeight;
((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth;
((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight;
((LayoutGroup)obj2).childAlignment = (TextAnchor)1;
Object.Destroy((Object)(object)component);
val6.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
int childCount = ((Component)menu).transform.childCount;
for (int i = 0; i < childCount; i++)
{
Transform child = ((Component)menu).transform.GetChild(0);
Transform obj3 = ((child is RectTransform) ? child : null);
Vector2 anchoredPosition = ((RectTransform)obj3).anchoredPosition;
Vector2 anchorMin = ((RectTransform)obj3).anchorMin;
Vector2 anchorMax = ((RectTransform)obj3).anchorMax;
Vector2 pivot = ((RectTransform)obj3).pivot;
Vector2 sizeDelta = ((RectTransform)obj3).sizeDelta;
obj3.SetParent(val6.transform, false);
((RectTransform)obj3).anchorMin = anchorMin;
((RectTransform)obj3).anchorMax = anchorMax;
((RectTransform)obj3).pivot = pivot;
((RectTransform)obj3).sizeDelta = sizeDelta;
((RectTransform)obj3).anchoredPosition = anchoredPosition;
}
return val6;
[IteratorStateMachine(typeof(<>c__DisplayClass10_0.<<MakeMenuScrollable>g__FixScrollOnNextFrame|0>d))]
IEnumerator FixScrollOnNextFrame()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <>c__DisplayClass10_0.<<MakeMenuScrollable>g__FixScrollOnNextFrame|0>d(0)
{
<>4__this = CS$<>8__locals0
};
}
}
}
internal class FleeceUtil
{
private static int currentOffset;
public static Jumper MakeJumper(string text)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
Passage val = ScriptableObject.CreateInstance<Passage>();
val.id = Story.active.passages.Count + 100000 + currentOffset++;
val.text = text;
Story.active.passages.Add(val);
return new Jumper
{
passage = val
};
}
}
internal static class Rebinding
{
[HarmonyPatch(typeof(SaveSystem), "AttemptApplyRebind")]
public static class SaveSystemPatch
{
[HarmonyPrefix]
public static void SetupCustomBindings(SaveDataSettings settings)
{
if (m_defaultActionMap == null)
{
m_defaultActionMap = GameManager.instance.inputManager.GetPlayerInput().actions.FindActionMap("Default Action Map", false);
InitialiseCustomBindings();
}
}
}
[HarmonyPatch(typeof(UISettingsSubMenuBindings), "Start")]
public static class UISettingsSubMenuBindingsPatch
{
[HarmonyPrefix]
public static void CreateRebindButtons(ref UISettingsSubMenuBindings __instance)
{
GameObject val = Base.MakeMenuScrollable((UISettingsSubMenu)(object)__instance);
Object.Destroy((Object)(object)((Component)val.transform.Find("Reset Bindings")).gameObject);
Base.MakeHeading(val.transform, "RunnerUtils rebinds", "These rebinds are for actions related to the RunnerUtils mod.\nFor other RunnerUtils settings see the RunnerUtils tab.");
Object.Instantiate<GameObject>(((Component)val.transform.Find("Headers")).gameObject, val.transform);
GameObject gameObject = ((Component)val.transform.Find("Rebind Jump")).gameObject;
foreach (RUInputManager.BindingInfo binding in RUInputManager.Bindings)
{
Base.MakeRebind(val.transform, gameObject, binding);
}
}
}
[HarmonyPatch(typeof(UISettingsRebindUI), "TriggerRebindAction")]
public static class UISettingsRebindUIPatch
{
public static RebindingOperation ApplyExtraRebindingOperations(RebindingOperation operation, UISettingsRebindUI instance)
{
return operation.OnPotentialMatch((Action<RebindingOperation>)delegate(RebindingOperation o)
{
Mod.Logger.LogInfo((object)("User is rebinding " + o.action.name + ", trying to see if delete (" + o.selectedControl.path + ")"));
if (o.selectedControl.path == "/Keyboard/delete")
{
Mod.Logger.LogInfo((object)"Deleting bind");
InputActionRebindingExtensions.ApplyBindingOverride(o.action, 0, "");
o.Cancel();
instance.RebindComplete();
}
});
}
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> AddUnbindingSupport(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"''", (string)null)
}).Set(OpCodes.Ldstr, (object)"''\n(or press DELETE to unbind)").MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)0.1f, (string)null)
})
.Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldarg_0, (object)null),
new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(UISettingsRebindUIPatch), "ApplyExtraRebindingOperations", (Type[])null, (Type[])null))
})
.InstructionEnumeration();
}
}
[HarmonyPatch(typeof(UISettingsOptionRebind), "RefreshText")]
public static class UISettingsOptionRebindPatch
{
public static string ToHumanReadableStringDetour(string path, HumanReadableStringOptions options = 0, InputControl control = null)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!(path == string.Empty))
{
return InputControlPath.ToHumanReadableString(path, options, control);
}
return "NOT BOUND";
}
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> ReplaceToHumanReadableString(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: 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: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(InputControlPath), "ToHumanReadableString", new Type[3]
{
typeof(string),
typeof(HumanReadableStringOptions),
typeof(InputControl)
}, (Type[])null), (string)null)
}).Set(OpCodes.Call, (object)AccessTools.Method(typeof(UISettingsOptionRebindPatch), "ToHumanReadableStringDetour", (Type[])null, (Type[])null)).InstructionEnumeration();
}
}
private static InputActionMap m_defaultActionMap;
public static void InitialiseCustomBindings()
{
m_defaultActionMap.Disable();
List<InputAction> list = new List<InputAction>();
foreach (RUInputManager.BindingInfo binding in RUInputManager.Bindings)
{
list.AddRange(InitialiseCustomBinding(m_defaultActionMap, binding));
}
list.ForEach(delegate(InputAction action)
{
action.Enable();
});
m_defaultActionMap.Enable();
}
public static InputAction[] InitialiseCustomBinding(InputActionMap map, RUInputManager.BindingInfo bindingInfo)
{
//IL_0046: 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_009e: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
string text = "RunnerUtils " + bindingInfo.identifier;
string kbmName = text + " (kbm)";
string gamepadName = text + " (gamepad)";
InputAction val = ((IEnumerable<InputAction>)(object)map.actions).FirstOrDefault((Func<InputAction, bool>)((InputAction action) => action.name == kbmName));
InputAction val2 = ((IEnumerable<InputAction>)(object)map.actions).FirstOrDefault((Func<InputAction, bool>)((InputAction action) => action.name == gamepadName));
InputBinding val3;
if (val == null)
{
val = InputActionSetupExtensions.AddAction(map, kbmName, (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
val.Disable();
InputAction obj = val;
val3 = default(InputBinding);
((InputBinding)(ref val3)).path = bindingInfo.defaultKeyPath;
((InputBinding)(ref val3)).id = new Guid(bindingInfo.guidKbm);
InputActionSetupExtensions.AddBinding(obj, val3);
val.performed += delegate
{
bindingInfo.action();
};
}
if (val2 == null)
{
val2 = InputActionSetupExtensions.AddAction(map, gamepadName, (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
val2.Disable();
InputAction obj2 = val2;
val3 = default(InputBinding);
((InputBinding)(ref val3)).path = "";
((InputBinding)(ref val3)).id = new Guid(bindingInfo.guidGamepad);
InputActionSetupExtensions.AddBinding(obj2, val3);
val2.performed += delegate
{
bindingInfo.action();
};
}
return (InputAction[])(object)new InputAction[2] { val, val2 };
}
}
public class UISettingsSubMenuRunnerUtils : UISettingsSubMenu
{
private UISettingsOptionToggle m_skipSplashCardsToggle;
private UISettingsOptionToggle m_walkabilityOverlayToggle;
private UISettingsOptionToggle m_verboseLocationSaveToggle;
private UISettingsOptionToggle m_snowmanPercentToggle;
private UISettingsOptionToggle m_throwCamUnlockCameraToggle;
private UISettingsOptionToggle m_throwCamAutoSwitchToggle;
private static Jumper m_splashCardSkipText = FleeceUtil.MakeJumper("Skip splash cards");
private static Jumper m_walkabilityOverlayText = FleeceUtil.MakeJumper("Walkability Overlay");
private static Jumper m_verboseLocationSaveText = FleeceUtil.MakeJumper("Log exact location on save/load");
private static Jumper m_snowmanPercentText = FleeceUtil.MakeJumper("Enable Snowman% Timer");
private static Jumper m_throwCamUnlockCameraText = FleeceUtil.MakeJumper("Unlock Camera");
private static Jumper m_throwCamAutoSwitchText = FleeceUtil.MakeJumper("Auto Switch");
public void Awake()
{
GameObject val = Base.MakeMenuScrollable((UISettingsSubMenu)(object)this);
GameObject obj = Base.MakeHeading(val.transform, "RunnerUtils Settings", "Some of these options are banned from regular play.\nPlease show the top right corner during all recordings with this mod.");
((LayoutGroup)obj.GetComponent<VerticalLayoutGroup>()).padding.top = 0;
((LayoutGroup)obj.GetComponent<VerticalLayoutGroup>()).padding.bottom = 10;
m_skipSplashCardsToggle = Base.MakeToggleOption(val.transform, m_splashCardSkipText, Configs.SkipSplashCardsEnabled);
m_walkabilityOverlayToggle = Base.MakeToggleOption(val.transform, m_walkabilityOverlayText, Configs.WalkabilityOverlayEnabled);
m_verboseLocationSaveToggle = Base.MakeToggleOption(val.transform, m_verboseLocationSaveText, Configs.SaveLocationVerboseEnabled);
m_snowmanPercentToggle = Base.MakeToggleOption(val.transform, m_snowmanPercentText, Configs.SnowmanPercentEnabled);
GameObject obj2 = Base.MakeHeading(val.transform, "Throw Cam");
((LayoutGroup)obj2.GetComponent<VerticalLayoutGroup>()).padding.top = 10;
((LayoutGroup)obj2.GetComponent<VerticalLayoutGroup>()).padding.bottom = 0;
m_throwCamUnlockCameraToggle = Base.MakeToggleOption(val.transform, m_throwCamUnlockCameraText, Configs.ThrowCamUnlockCameraEnabled);
m_throwCamAutoSwitchToggle = Base.MakeToggleOption(val.transform, m_throwCamAutoSwitchText, Configs.ThrowCamAutoSwitchEnabled);
}
public override void SaveSettings()
{
((UISettingsSubMenu)this).SaveSettings();
Configs.SkipSplashCardsEnabled = m_skipSplashCardsToggle.GetToggled();
Configs.WalkabilityOverlayEnabled = m_walkabilityOverlayToggle.GetToggled();
Configs.SaveLocationVerboseEnabled = m_verboseLocationSaveToggle.GetToggled();
Configs.SnowmanPercentEnabled = m_snowmanPercentToggle.GetToggled();
Configs.ThrowCamUnlockCameraEnabled = m_throwCamUnlockCameraToggle.GetToggled();
Configs.ThrowCamAutoSwitchEnabled = m_throwCamAutoSwitchToggle.GetToggled();
}
}
}
namespace RunnerUtils.Patches
{
[HarmonyPatch(typeof(ProgressManager), "ShouldDisplayGameIntroOnStart")]
public static class IntroSplashCardSkip
{
[HarmonyPrefix]
public static void SkipSplashCards(ref bool __result)
{
if (Configs.SkipSplashCardsEnabled)
{
__result = false;
}
}
}
}
namespace RunnerUtils.Extensions
{
public static class CodeMatcherExtensions
{
public static CodeMatcher Dump(this CodeMatcher matcher)
{
foreach (CodeInstruction item in matcher.InstructionEnumeration())
{
Mod.Logger.LogInfo((object)item);
}
return matcher;
}
}
}
namespace RunnerUtils.Components
{
public class AutoJump : ComponentBase<AutoJump>
{
[HarmonyPatch(typeof(PlayerMovement), "UpdateJumpCheck")]
public static class PlayerMovementPatch
{
public static bool InputCheckDetour(InputCheck inputCheck)
{
if (ComponentBase<AutoJump>.Instance.enabled)
{
return inputCheck.Held();
}
return inputCheck.Pressed(false);
}
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> AutoJumpIfActionHeld(IEnumerable<CodeInstruction> instructions)
{
//IL_0002: 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_0022: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
{
new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(InputCheck), "Pressed", (Type[])null, (Type[])null), (string)null)
}).RemoveInstruction().Set(OpCodes.Call, (object)AccessTools.Method(typeof(PlayerMovementPatch), "InputCheckDetour", (Type[])null, (Type[])null))
.InstructionEnumeration();
}
}
public override string Identifier => "Auto Jump";
public override bool ShowOnFairPlay => true;
}
public abstract class ComponentBase
{
public static List<ComponentBase> components = new List<ComponentBase>();
public bool enabled;
public abstract string Identifier { get; }
public abstract bool ShowOnFairPlay { get; }
public void Toggle()
{
if (enabled)
{
Disable();
}
else
{
Enable();
}
}
public virtual void Enable()
{
enabled = true;
}
public virtual void Disable()
{
enabled = false;
}
}
public abstract class ComponentBase<T> : ComponentBase where T : ComponentBase<T>, new()
{
public static T Instance { get; }
static ComponentBase()
{
Instance = new T();
ComponentBase.components.Add(Instance);
}
}
public class HardFallOverlay : ComponentBase<HardFallOverlay>
{
[HarmonyPatch(typeof(PlayerMovement), "Update")]
public class PlayerMovementPatch
{
[HarmonyPostfix]
public static void UpdateIndicator(PlayerMovement __instance)
{
GameObject obj = ComponentBase<HardFallOverlay>.Instance.m_obj;
if (obj != null)
{
obj.SetActive(ComponentBase<HardFallOverlay>.Instance.enabled);
}
ComponentBase<HardFallOverlay>.Instance.m_text.text = (__instance.IsHardFalling() ? "<color=#FF0000>HF" : "<color=#ED424240>HF");
}
}
private GameObject m_obj;
private TMP_Text m_text;
public override string Identifier => "HF Overlay";
public override bool ShowOnFairPlay => true;
public void SetupIndicator()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
HUDGPS gPS = GameManager.instance.player.GetHUD().GetGPS();
m_obj = Object.Instantiate<GameObject>(new GameObject(), ((Component)((Component)gPS).transform.parent).gameObject.transform);
TMP_FontAsset font = ((TMP_Text)((Component)((Component)gPS).transform.parent).GetComponentInChildren<TextMeshProUGUI>()).font;
((Object)m_obj).name = "RunnerUtils~HF Indicator";
m_text = (TMP_Text)(object)m_obj.AddComponent<TextMeshProUGUI>();
m_text.fontSize = 35f;
m_text.font = font;
m_text.alignment = (TextAlignmentOptions)1025;
RectTransform val = m_obj.GetComponent<RectTransform>();
if (!Object.op_Implicit((Object)(object)val))
{
val = m_obj.AddComponent<RectTransform>();
}
val.anchoredPosition = new Vector2(-1085f, -645f);
}
}
public class InfiniteAmmo : ComponentBase<InfiniteAmmo>
{
[HarmonyPatch(typeof(HUDAmmoIndicator), "LoadInSlots")]
public class HUDAmmoIndicatorPatch
{
[HarmonyPostfix]
public static void ColorSlots(ref List<HUDAmmoIndicatorSlot> ___spawnedSlots)
{
//IL_001b: 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)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (ComponentBase<InfiniteAmmo>.Instance.enabled)
{
ColorAmmoSlots(___spawnedSlots, Color.red);
return;
}
ColorAmmoSlots(___spawnedSlots, Color.white);
foreach (HUDAmmoIndicatorSlot ___spawnedSlot in ___spawnedSlots)
{
___spawnedSlot.lowAmmoColor = Color.yellow;
}
}
}
[HarmonyPatch(typeof(DebugManager), "GetInfiniteAmmo")]
public class DebugManagerPatch
{
[HarmonyPrefix]
public static bool SetInfiniteAmmo(ref bool __result)
{
if (ComponentBase<InfiniteAmmo>.Instance.enabled)
{
__result = true;
return false;
}
return true;
}
}
public override string Identifier => "Infinite Ammo";
public override bool ShowOnFairPlay => true;
public override void Enable()
{
base.Enable();
ReloadSlots();
}
public override void Disable()
{
base.Disable();
ReloadSlots();
}
private static void ReloadSlots()
{
try
{
GameManager.instance.player.GetHUD().GetAmmoIndicator().LoadInSlots(GameManager.instance.player.GetArmScript().GetEquippedWeapon());
}
catch
{
}
}
private static void ColorAmmoSlots(List<HUDAmmoIndicatorSlot> slots, Color color)
{
//IL_0011: 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)
foreach (HUDAmmoIndicatorSlot slot in slots)
{
slot.lowAmmoColor = color;
slot.LowAmmo();
}
}
}
public class InfiniteHealth : ComponentBase<InfiniteHealth>
{
[HarmonyPatch(typeof(DebugManager), "GetInfiniteHealth")]
public class DebugManagerPatch
{
[HarmonyPrefix]
public static bool SetInfiniteHealth(ref bool __result)
{
if (ComponentBase<InfiniteHealth>.Instance.enabled)
{
__result = true;
return false;
}
return true;
}
}
public override string Identifier => "Infinite Health";
public override bool ShowOnFairPlay => true;
}
public static class LocationSave
{
public static Vector3? savedPosition;
public static Vector3? savedRotation;
public static string StringLoc => $"<color=red>l{savedPosition}<color=white>@<color=blue>r{savedRotation}</color>";
public static void SaveLocation()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
Player player = GameManager.instance.player;
savedPosition = ((player != null) ? new Vector3?(player.GetPosition()) : null);
Player player2 = GameManager.instance.player;
savedRotation = ((player2 != null) ? new Vector3?(player2.GetLookScript().GetBaseRotation()) : null);
if (savedPosition.HasValue)
{
_ = savedRotation.HasValue;
}
}
public static void ClearLocation()
{
savedPosition = null;
savedRotation = null;
}
public static void RestoreLocation()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (savedPosition.HasValue)
{
Player player = GameManager.instance.player;
if (player != null)
{
player.GetMovementScript().Teleport(savedPosition.Value);
}
}
if (savedRotation.HasValue)
{
Player player2 = GameManager.instance.player;
if (player2 != null)
{
player2.GetLookScript().SetBaseRotation(savedRotation.Value);
}
}
}
}
public class MovementDebug : ComponentBase<MovementDebug>
{
[HarmonyPatch(typeof(PlayerMovement), "Update")]
public class PlayerMovementPatch
{
[HarmonyPostfix]
public static void LogMovement(PlayerMovement __instance, ref int ___dropOnEnemyFrames, ref int ___fallLevel, ref float ___coyoteTimer, ref float ___vMomentum)
{
if (ComponentBase<MovementDebug>.Instance.enabled)
{
igl.SetBufferLine(0, $"Hard falling: {__instance.IsHardFalling()}");
igl.SetBufferLine(1, $"Drop frames: {___dropOnEnemyFrames}");
igl.SetBufferLine(2, $"Fall level: {___fallLevel}");
igl.SetBufferLine(3, $"Coyote: {___coyoteTimer:0.00}");
igl.SetBufferLine(4, $"vMomentum: {___vMomentum:0.00}");
igl.FlushBuffer();
}
}
}
private static InGameLog igl = new InGameLog("RunnerUtils~Movement Info", 10);
public override string Identifier => "Advanced Movement Info";
public override bool ShowOnFairPlay => false;
public void Init()
{
//IL_000f: 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)
igl.anchoredPos = new Vector2(-425f, 535f);
igl.Setup();
if (!enabled)
{
igl.Hide();
}
}
public override void Enable()
{
base.Enable();
igl.Show();
}
public override void Disable()
{
base.Disable();
igl.Hide();
}
}
public class PauseTime : ComponentBase<PauseTime>
{
[HarmonyPatch(typeof(LevelController), "Initialize")]
public class LevelControllerPatch
{
[HarmonyPostfix]
public static void InitScale()
{
m_timeScale = GameManager.instance.timeManager.CreateTimeScale((float)((!ComponentBase<PauseTime>.Instance.enabled) ? 1 : 0));
}
}
private static TimeScale m_timeScale;
public override string Identifier => "Timestop";
public override bool ShowOnFairPlay => true;
public override void Enable()
{
base.Enable();
m_timeScale.SetScale(0f);
}
public override void Disable()
{
base.Disable();
m_timeScale.SetScale(1f);
}
}
public class RUInputManager
{
public struct BindingInfo
{
public readonly Action action;
public readonly string identifier;
public readonly string guidKbm;
public readonly string guidGamepad;
public readonly string defaultKeyPath;
public BindingInfo(string identifier, Action action, string guidKbm, string guidGamepad, string defaultKeyPath = "")
{
this.action = action;
this.identifier = identifier;
this.guidKbm = guidKbm;
this.guidGamepad = guidGamepad;
this.defaultKeyPath = defaultKeyPath;
}
}
public static List<BindingInfo> Bindings { get; } = new List<BindingInfo>(19)
{
new BindingInfo("Log Visibility Toggle", delegate
{
Mod.Igl.ToggleVisibility();
Mod.Igl.LogLine("Toggled log visibility");
}, "8f6a1c2e-5d3b-4f7a-9a1e-1b2c3d4e5f01", "8f6a1c2e-5d3b-4f7a-9a1e-1b2c3d4e5fA1", "<Keyboard>/k"),
new BindingInfo("Clear Log", delegate
{
Mod.Igl.Clear();
Mod.Igl.LogLine("Cleared Log");
}, "2a9d4b77-6e21-4c8f-b2c4-7d9a0f1e3b02", "2a9d4b77-6e21-4c8f-b2c4-7d9a0f1e3bA2", "<Keyboard>/j"),
new BindingInfo("Force Trigger Visibility On", delegate
{
ShowTriggers.ShowAll();
Mod.Igl.LogLine("Enabled all triggers' visibility");
FairPlay.triggersModified = true;
}, "c1e7f9a2-3b44-4d9a-8fcb-2a6d5e7f8c03", "c1e7f9a2-3b44-4d9a-8fcb-2a6d5e7f8cA3", "<Keyboard>/o"),
new BindingInfo("Force Trigger Visibility Off", delegate
{
ShowTriggers.HideAll();
Mod.Igl.LogLine("Disabled all triggers' visibility");
FairPlay.triggersModified = false;
}, "d4b82f11-91c3-4e2d-9b5e-6a7c8d9e0f04", "d4b82f11-91c3-4e2d-9b5e-6a7c8d9e0fA4", "<Keyboard>/i"),
new BindingInfo("Toggle Infinite Ammo", delegate
{
if (Object.op_Implicit((Object)(object)GameManager.instance.player.GetHUD()))
{
ComponentBase<InfiniteAmmo>.Instance.Toggle();
Mod.Igl.LogLine("Toggled infinite ammo");
}
}, "e93a6d55-2f0b-4c1a-a8e3-5d7f9b1c2d05", "e93a6d55-2f0b-4c1a-a8e3-5d7f9b1c2dA5", "<Keyboard>/l"),
new BindingInfo("Toggle Infinite Health", delegate
{
if (Object.op_Implicit((Object)(object)GameManager.instance.player.GetHUD()))
{
ComponentBase<InfiniteHealth>.Instance.Toggle();
Mod.Igl.LogLine("Toggled infinite health");
}
}, "3f31a91c-1a20-49d8-9672-ff1e528b2501", "3f31a91c-1a20-49d8-9672-ff1e528b25A1", "<Keyboard>/comma"),
new BindingInfo("Toggle Throw Cam", delegate
{
if (ThrowCam.cameraAvailable)
{
ThrowCam.ToggleCam();
Mod.Igl.LogLine("Toggled throw cam");
}
else
{
Mod.Igl.LogLine("Unable to switch to throw cam ~ no thrown weapons are in the air");
}
}, "9c0d1e2f-3a4b-4c5d-8e9f-1a2b3c4d5e07", "9c0d1e2f-3a4b-4c5d-8e9f-1a2b3c4d5eA7", "<Keyboard>/semicolon"),
new BindingInfo("Toggle auto jump", delegate
{
ComponentBase<AutoJump>.Instance.Toggle();
Mod.Igl.LogLine("Toggled auto jump");
}, "1e2f3a4b-5c6d-4e7f-8a9b-0c1d2e3f4a08", "1e2f3a4b-5c6d-4e7f-8a9b-0c1d2e3f4aA8", "<Keyboard>/m"),
new BindingInfo("Toggle hard fall overlay", delegate
{
ComponentBase<HardFallOverlay>.Instance.Toggle();
Mod.Igl.LogLine("Toggled hf overlay");
}, "0f1e2d3c-4b5a-4c6d-8e7f-9a0b1c2d3e11", "0f1e2d3c-4b5a-4c6d-8e7f-9a0b1c2d3eA1", "<Keyboard>/u"),
new BindingInfo("Toggle timestop", delegate
{
ComponentBase<PauseTime>.Instance.Toggle();
Mod.Igl.LogLine("Toggled timestop");
}, "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e12", "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5eA2", "<Keyboard>/rightShift"),
new BindingInfo("Save Location", delegate
{
LocationSave.SaveLocation();
Mod.Igl.LogLine("Saved location " + (Configs.SaveLocationVerboseEnabled ? LocationSave.StringLoc : ""));
}, "4e5f6a7b-8c9d-4a0b-9c1d-2e3f4a5b6c13", "4e5f6a7b-8c9d-4a0b-9c1d-2e3f4a5b6cA3", "<Keyboard>/leftBracket"),
new BindingInfo("Load Location", delegate
{
Vector3? savedPosition = LocationSave.savedPosition;
if (savedPosition.HasValue)
{
LocationSave.RestoreLocation();
Mod.Igl.LogLine("Loaded previous location " + (Configs.SaveLocationVerboseEnabled ? LocationSave.StringLoc : ""));
}
else
{
Mod.Igl.LogLine("No location saved!");
}
}, "7a8b9c0d-1e2f-4a3b-8c4d-5e6f7a8b9c14", "7a8b9c0d-1e2f-4a3b-8c4d-5e6f7a8b9cA4", "<Keyboard>/rightBracket"),
new BindingInfo("Clear Location", delegate
{
LocationSave.ClearLocation();
Mod.Igl.LogLine("Cleared saved location");
}, "8b9c0d1e-2f3a-4b5c-9d6e-7f8a9b0c1d15", "8b9c0d1e-2f3a-4b5c-9d6e-7f8a9b0c1dA5", "<Keyboard>/p"),
new BindingInfo("Toggle view cones visibility", delegate
{
ComponentBase<ViewCones>.Instance.Toggle();
Mod.Igl.LogLine("Toggled view cones' visibility");
}, "9d0e1f2a-3b4c-4d5e-8f6a-7b8c9d0e1f16", "9d0e1f2a-3b4c-4d5e-8f6a-7b8c9d0e1fA6", "<Keyboard>/y"),
new BindingInfo("Trigger Visibility Toggle", delegate
{
ShowTriggers.ToggleAll();
Mod.Igl.LogLine("Toggled all triggers' visibility");
FairPlay.triggersModified = true;
}, "aa1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c17", "aa1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3cA7"),
new BindingInfo("OOB Box Visibility Toggle", delegate
{
ShowTriggers.ToggleAllOf<PlayerOutOfBoundsBox>();
Mod.Igl.LogLine("Toggled OOB boxes' visibility");
FairPlay.triggersModified = true;
}, "bb2c3d4e-5f6a-4b7c-9d8e-0f1a2b3c4d18", "bb2c3d4e-5f6a-4b7c-9d8e-0f1a2b3c4dA8"),
new BindingInfo("Start Trigger Visibility Toggle", delegate
{
ShowTriggers.ToggleAllOf<PlayerTimerStartBox>();
Mod.Igl.LogLine("Toggled start triggers' visibility");
FairPlay.triggersModified = true;
}, "cc3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e19", "cc3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5eA9"),
new BindingInfo("Spawner Visibility Toggle", delegate
{
ShowTriggers.ToggleAllOf<EnemySpawner>();
Mod.Igl.LogLine("Toggled spawners' visibility");
FairPlay.triggersModified = true;
}, "dd4e5f6a-7b8c-4d9e-8f0a-1b2c3d4e5f20", "dd4e5f6a-7b8c-4d9e-8f0a-1b2c3d4e5fA0"),
new BindingInfo("Toggle advanced movement info", delegate
{
ComponentBase<MovementDebug>.Instance.Toggle();
Mod.Igl.LogLine("Toggled movement info");
}, "ee5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a21", "ee5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6aA1")
};
}
public static class ShowTriggers
{
[HarmonyPatch(typeof(EnemySpawner))]
public class EnemySpawnerPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void ColorAndRegisterSpawners(EnemySpawner __instance)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
MeshRenderer val = default(MeshRenderer);
if (((Component)__instance).gameObject.TryGetComponent<MeshRenderer>(ref val))
{
((Renderer)val).material.SetColor(baseColor, spawnerColor);
}
((Component)__instance).gameObject.SetActive(true);
registry.Add(((Component)__instance).gameObject);
}
[HarmonyPatch("SpawnEnemy")]
[HarmonyPostfix]
public static void KeepActiveAfterSpawn(EnemySpawner __instance)
{
((Component)__instance).gameObject.SetActive(true);
}
}
[HarmonyPatch(typeof(PlacedEquipment), "Initialize")]
public class PlacedEquipmentPatch
{
[HarmonyPostfix]
public static void ShowAndRegisterEquipment(PlacedEquipment __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
MakeVisible(((Component)__instance).gameObject, placedEquipmentColor);
registry.Add(((Component)__instance).gameObject);
}
}
private static Texture2D tex;
public static Material mat;
private static Color spawnerColor;
private static Color placedEquipmentColor;
private static Dictionary<Type, Color> triggerColors;
private static Dictionary<string, Color> extraColors;
private static List<GameObject> registry;
private static readonly int mainTex;
private static readonly int baseColor;
static ShowTriggers()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
tex = new Texture2D(1, 1);
mat = new Material(Shader.Find("Sprites/Default"));
spawnerColor = Color.magenta;
placedEquipmentColor = new Color(1f, 0f, 0.5f, 0.5f);
triggerColors = new Dictionary<Type, Color>();
extraColors = new Dictionary<string, Color>();
registry = new List<GameObject>();
mainTex = Shader.PropertyToID("_MainTex");
baseColor = Shader.PropertyToID("_BaseColor");
mat.SetTexture(mainTex, (Texture)(object)tex);
triggerColors.Add(typeof(PlayerOutOfBoundsBox), new Color(1f, 0.5f, 0f, 0.5f));
triggerColors.Add(typeof(PlayerTimerStartBox), new Color(0.5f, 0f, 1f, 0.5f));
triggerColors.Add(typeof(KillPlayerEventTrigger), new Color(1f, 0f, 0f, 0.5f));
extraColors.Add("Spawn", new Color(1f, 1f, 0f, 0.5f));
extraColors.Add("SpawnEnemy", new Color(1f, 1f, 0f, 0.5f));
}
public static void ShowAllOf<T>() where T : MonoBehaviour
{
T val = default(T);
for (int num = registry.Count - 1; num >= 0; num--)
{
if (!Object.op_Implicit((Object)(object)registry[num]))
{
registry.RemoveAt(num);
}
else if (registry[num].TryGetComponent<T>(ref val))
{
((Renderer)registry[num].GetComponent<MeshRenderer>()).enabled = true;
}
}
}
public static void HideAllOf<T>() where T : MonoBehaviour
{
T val = default(T);
for (int num = registry.Count - 1; num >= 0; num--)
{
if (!Object.op_Implicit((Object)(object)registry[num]))
{
registry.RemoveAt(num);
}
else if (registry[num].TryGetComponent<T>(ref val))
{
((Renderer)registry[num].GetComponent<MeshRenderer>()).enabled = false;
}
}
}
public static void ToggleAllOf<T>() where T : MonoBehaviour
{
T val = default(T);
for (int num = registry.Count - 1; num >= 0; num--)
{
if (!Object.op_Implicit((Object)(object)registry[num]))
{
registry.RemoveAt(num);
}
else if (registry[num].TryGetComponent<T>(ref val))
{
MeshRenderer component = registry[num].GetComponent<MeshRenderer>();
((Renderer)component).enabled = !((Renderer)component).enabled;
}
}
}
public static void ShowAll()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
for (int num = registry.Count - 1; num >= 0; num--)
{
if (!Object.op_Implicit((Object)(object)registry[num]))
{
registry.RemoveAt(num);
}
else
{
foreach (Transform item in registry[num].transform)
{
Transform val = item;
if (((Object)((Component)val).gameObject).name == "SpawnerTrace")
{
((Component)val).gameObject.SetActive(true);
}
}
((Renderer)registry[num].GetComponent<MeshRenderer>()).enabled = true;
}
}
}
public static void HideAll()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
for (int num = registry.Count - 1; num >= 0; num--)
{
if (!Object.op_Implicit((Object)(object)registry[num]))
{
registry.RemoveAt(num);
}
else
{
foreach (Transform item in registry[num].transform)
{
Transform val = item;
if (((Object)((Component)val).gameObject).name == "SpawnerTrace")
{
((Component)val).gameObject.SetActive(false);
}
}
((Renderer)registry[num].GetComponent<MeshRenderer>()).enabled = false;
}
}
}
public static void ToggleAll()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
for (int num = registry.Count - 1; num >= 0; num--)
{
if (!Object.op_Implicit((Object)(object)registry[num]))
{
registry.RemoveAt(num);
}
else
{
MeshRenderer component = registry[num].GetComponent<MeshRenderer>();
foreach (Transform item in registry[num].transform)
{
Transform val = item;
if (((Object)((Component)val).gameObject).name == "SpawnerTrace")
{
((Component)val).gameObject.SetActive(!((Component)val).gameObject.activeInHierarchy);
}
}
((Renderer)component).enabled = !((Renderer)component).enabled;
}
}
}
public static void RegisterAllOf<T>() where T : MonoBehaviour
{
registry.Clear();
EventTriggerBoxPlayer[] array = Object.FindObjectsOfType<EventTriggerBoxPlayer>(true);
foreach (EventTriggerBoxPlayer val in array)
{
if (Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<T>()))
{
RegisterObj(val);
}
}
}
public static void RegisterAllExcluding(Type[] Ts)
{
registry.Clear();
EventTriggerBoxPlayer[] array = Object.FindObjectsOfType<EventTriggerBoxPlayer>(true);
foreach (EventTriggerBoxPlayer val in array)
{
bool flag = true;
foreach (Type type in Ts)
{
if (Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent(type)))
{
flag = false;
break;
}
}
if (flag)
{
RegisterObj(val);
}
}
}
public static void RegisterAll()
{
registry.Clear();
EventTriggerBoxPlayer[] array = Object.FindObjectsOfType<EventTriggerBoxPlayer>(true);
for (int i = 0; i < array.Length; i++)
{
RegisterObj(array[i]);
}
}
public static void ExtendRegistry()
{
EventTriggerBoxPlayer[] array = Object.FindObjectsOfType<EventTriggerBoxPlayer>(true);
foreach (EventTriggerBoxPlayer val in array)
{
if (!registry.Contains(((Component)val).gameObject))
{
RegisterObj(val);
}
}
}
private static void MakeVisible(GameObject obj, Color boxColor)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_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)
BoxCollider val = default(BoxCollider);
if (obj.TryGetComponent<BoxCollider>(ref val))
{
MeshRenderer val2 = obj.AddComponent<MeshRenderer>();
MeshFilter val3 = default(MeshFilter);
if (!obj.TryGetComponent<MeshFilter>(ref val3))
{
val3 = obj.AddComponent<MeshFilter>();
}
GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)3);
Mesh sharedMesh = obj2.GetComponent<MeshFilter>().sharedMesh;
Object.Destroy((Object)(object)obj2);
Mesh val4 = Object.Instantiate<Mesh>(sharedMesh);
Vector3[] vertices = val4.vertices;
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = Vector3.Scale(vertices[i], val.size) + val.center;
}
val4.vertices = vertices;
val4.RecalculateBounds();
val3.mesh = val4;
((Renderer)val2).material = mat;
((Renderer)val2).enabled = false;
((Renderer)val2).material.color = boxColor;
}
}
private static void RegisterObj(EventTriggerBoxPlayer obj)
{
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
Color boxColor = default(Color);
((Color)(ref boxColor))..ctor(0f, 1f, 0f, 0.25f);
UnityEvent onTrigger = obj.onTrigger;
int num = ((onTrigger != null) ? ((UnityEventBase)onTrigger).GetPersistentEventCount() : 0);
for (int i = 0; i < num; i++)
{
string text = ((onTrigger != null) ? ((UnityEventBase)onTrigger).GetPersistentMethodName(i) : null);
if ((text == "Spawn" || text == "SpawnEnemy") ? true : false)
{
Object persistentTarget = ((UnityEventBase)onTrigger).GetPersistentTarget(i);
if (!Object.op_Implicit(persistentTarget))
{
continue;
}
GameObject gameObject;
try
{
gameObject = ((Component)(MonoBehaviour)persistentTarget).gameObject;
}
catch
{
continue;
}
foreach (EnemySpawner item in new List<EnemySpawner>(gameObject.GetComponentsInChildren<EnemySpawner>(true)))
{
GameObject val = new GameObject("SpawnerTrace");
val.transform.SetParent(((Component)obj).gameObject.transform);
LineRenderer obj3 = val.AddComponent<LineRenderer>();
((Renderer)obj3).material = mat;
obj3.startColor = extraColors[text];
obj3.endColor = spawnerColor;
obj3.positionCount = 2;
obj3.SetPosition(0, ((Component)obj).gameObject.transform.position);
obj3.SetPosition(1, ((Component)item).gameObject.transform.position);
val.SetActive(false);
}
}
if (text != null && extraColors.TryGetValue(text, out var value))
{
boxColor = value;
}
}
foreach (KeyValuePair<Type, Color> item2 in triggerColors.Where((KeyValuePair<Type, Color> kv) => Object.op_Implicit((Object)(object)((Component)obj).gameObject.GetComponent(kv.Key))))
{
boxColor = item2.Value;
}
MakeVisible(((Component)obj).gameObject, boxColor);
registry.Add(((Component)obj).gameObject);
}
}
public static class ThrowCam
{
[HarmonyPatch(typeof(PlayerWeaponToss))]
public static class PlayerWeaponTossPatch
{
[HarmonyPatch("Initialize", new Type[]
{
typeof(WeaponPickup),
typeof(AimTarget)
})]
[HarmonyPostfix]
public static void SetupCamOnInit(ref TossedEquipment ___tossedEquipment)
{
if (cameraAvailable)
{
Reset();
}
SetupCam();
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void UpdateCamPosition(ref bool ___hitSurface, ref Transform ___tiltAnchor, ref Transform ___spinAnchor)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (!___hitSurface && cameraAvailable)
{
UpdatePos(___tiltAnchor, m_velocity);
}
}
[HarmonyPatch("OnCollisionEnter")]
[HarmonyPostfix]
public static void ResetOnCollision()
{
Reset();
}
[HarmonyPatch("FixedUpdate")]
[HarmonyPostfix]
public static void UpdateVelocity(float ___speed, float ___gravity, Transform ___tiltAnchor)
{
//IL_000b: 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_0016: 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_0021: 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)
m_velocity = ((Component)___tiltAnchor.parent).transform.forward * ___speed + Vector3.down * ___gravity;
}
}
[HarmonyPatch(typeof(TossedEquipment))]
public static class TossedEquipmentPatch
{
[HarmonyPatch("Initialize")]
[HarmonyPostfix]
public static void SetupCamOnInit()
{
if (cameraAvailable)
{
Reset();
}
SetupCam();
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void UpdateCamPosition(ref bool ___collided, ref Rigidbody ___rb)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (!___collided && cameraAvailable)
{
UpdatePos(((Component)___rb).gameObject.transform, ___rb.velocity);
}
}
[HarmonyPatch("OnCollisionEnter")]
[HarmonyPostfix]
public static void ResetOnCollision()
{
Reset();
}
}
private static Camera m_cam;
private static Camera m_oldCam;
private static GameObject m_obj;
private static Vector3 m_velocity;
public static bool cameraAvailable;
private static void UpdatePos(Transform anchor, Vector3 velocity)
{
//IL_000b: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
m_obj.transform.position = anchor.position - velocity * Configs.ThrowCamRangeScale;
if (Configs.ThrowCamUnlockCameraEnabled)
{
m_obj.transform.rotation = ((Component)GameManager.instance.cameraManager.GetArmCamera()).transform.rotation;
}
else
{
m_obj.transform.LookAt(anchor);
}
}
public static void Reset()
{
cameraAvailable = false;
((Component)GameManager.instance.player.GetHUD().GetReticle()).gameObject.SetActive(true);
if (Object.op_Implicit((Object)(object)m_cam))
{
((Behaviour)m_cam).enabled = false;
((Behaviour)m_oldCam).enabled = true;
Object.Destroy((Object)(object)m_obj);
}
}
public static void ToggleCam()
{
((Behaviour)m_oldCam).enabled = !((Behaviour)m_oldCam).enabled;
((Behaviour)m_cam).enabled = !((Behaviour)m_cam).enabled;
GameObject gameObject = ((Component)GameManager.instance.player.GetHUD().GetReticle()).gameObject;
gameObject.SetActive(!gameObject.activeInHierarchy);
}
private static void SetupCam()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
m_oldCam = GameManager.instance.cameraManager.GetManagersCamera();
m_obj = new GameObject();
m_cam = m_obj.AddComponent<Camera>();
CameraExtensions.GetUniversalAdditionalCameraData(m_cam).cameraStack.Add(CameraExtensions.GetUniversalAdditionalCameraData(m_oldCam).cameraStack[1]);
((Behaviour)m_cam).enabled = false;
cameraAvailable = true;
if (Configs.ThrowCamAutoSwitchEnabled)
{
ToggleCam();
}
}
}
public class ViewCones : ComponentBase<ViewCones>
{
[HarmonyPatch(typeof(EnemyHuman))]
public class EnemyHumanPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void CreateViewCone(EnemyHuman __instance)
{
//IL_0009: 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)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
if (__instance.GetSniperScanZone() == null)
{
GameObject val = new GameObject();
MeshRenderer obj = val.AddComponent<MeshRenderer>();
((Renderer)obj).material = ShowTriggers.mat;
((Renderer)obj).material.color = defaultColor;
((Object)val).name = "View Cone";
val.AddComponent<MeshFilter>();
val.transform.up = __instance.GetHeadAnchor().forward;
val.transform.position = __instance.GetHeadAnchor().position;
val.transform.parent = ((Component)__instance).gameObject.transform;
val.AddComponent<ViewCone>();
}
}
[HarmonyPatch("OnPlayerSeen")]
[HarmonyPostfix]
public static void RecolorConeOnSeen(EnemyHuman __instance)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (__instance.GetSniperScanZone() == null)
{
Transform obj = ((Component)__instance).transform.Find("View Cone");
if (obj != null)
{
((Component)obj).GetComponent<ViewCone>().SetColor(seenColor);
}
}
}
[HarmonyPatch("RefreshPlayerInView")]
[HarmonyPrefix]
public static void UpdateViewConeVisibility(EnemyHuman __instance)
{
//IL_003d: 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_004a: 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_0084: 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)
if (__instance.GetSniperScanZone() != null)
{
return;
}
Transform val = ((Component)__instance).transform.Find("View Cone");
if (val == null)
{
return;
}
ViewCone component = ((Component)val).GetComponent<ViewCone>();
if (!component.ForceDisable)
{
Vector3 targetCenter = GameManager.instance.player.GetTargetCenter(0f);
bool visibility = Vector3.Distance(targetCenter, __instance.GetHeadAnchor().position) < __instance.GetDetectionRadius() * 2f;
component.SetVisibility(visibility);
if (!__instance.GetHasPersonallySeenPlayer())
{
component.SetColor((!__instance.PositionSightlineClear(targetCenter)) ? noSightlineColor : defaultColor);
}
}
}
}
[HarmonyPatch(typeof(Enemy))]
public class EnemyPatch
{
[HarmonyPatch("Kill")]
[HarmonyPostfix]
public static void DestroyViewCone(Enemy __instance)
{
if (__instance is EnemyHuman)
{
Transform val = ((Component)__instance).transform.Find("View Cone");
if (val != null)
{
Object.Destroy((Object)(object)((Component)val).gameObject);
}
}
}
}
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshFilter))]
public class ViewCone : MonoBehaviour
{
private static Dictionary<(float, float), Mesh> cachedMeshes = new Dictionary<(float, float), Mesh>();
private const int defaultSubdivisions = 25;
private MeshRenderer m_renderer;
private bool m_forceDisable;
public bool ForceDisable
{
get
{
return m_forceDisable;
}
set
{
m_forceDisable = value;
((Renderer)m_renderer).enabled = !value;
}
}
public void SetVisibility(bool value)
{
if (!ForceDisable)
{
((Renderer)((Component)this).GetComponent<MeshRenderer>()).enabled = value;
}
}
public void Start()
{
EnemyHuman component = ((Component)((Component)this).transform.parent).gameObject.GetComponent<EnemyHuman>();
float detectionRadius = component.GetDetectionRadius();
float detectionAngle = component.GetDetectionAngle();
Mesh val;
if (cachedMeshes.ContainsKey((detectionRadius, detectionAngle)))
{
val = cachedMeshes[(detectionRadius, detectionAngle)];
}
else
{
val = CreateConeMesh(25, detectionRadius, detectionAngle);
cachedMeshes[(detectionRadius, detectionAngle)] = val;
}
((Component)this).GetComponent<MeshFilter>().sharedMesh = val;
m_renderer = ((Component)this).GetComponent<MeshRenderer>();
cones.Add(this);
ForceDisable = !ComponentBase<ViewCones>.Instance.enabled;
}
public void SetColor(Color col)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
((Renderer)m_renderer).material.color = col;
}
public void OnDestroy()
{
cones.Remove(this);
}
private static Mesh CreateConeMesh(int subdivisions, float height, float angle)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: 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_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_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
Mesh val = new Mesh();
float num = height * Mathf.Tan(0.5f * angle * (MathF.PI / 180f));
Vector3[] array = (Vector3[])(object)new Vector3[subdivisions + 2];
Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
int[] array3 = new int[subdivisions * 2 * 3];
array[0] = new Vector3(0f, height, 0f);
array2[0] = new Vector2(0.5f, 0f);
for (int i = 0; i < subdivisions; i++)
{
float num2 = (float)i / (float)(subdivisions - 1);
float num3 = num2 * (MathF.PI * 2f);
float num4 = Mathf.Cos(num3) * num;
float num5 = Mathf.Sin(num3) * num;
array[i + 1] = new Vector3(num4, height, num5);
array2[i + 1] = new Vector2(num2, 0f);
}
array[subdivisions + 1] = Vector3.zero;
array2[subdivisions + 1] = new Vector2(0.5f, 1f);
for (int j = 0; j < subdivisions - 1; j++)
{
int num6 = j * 3;
array3[num6] = 0;
array3[num6 + 1] = j + 1;
array3[num6 + 2] = j + 2;
}
int num7 = subdivisions * 3;
for (int k = 0; k < subdivisions - 1; k++)
{
int num8 = k * 3 + num7;
array3[num8] = k + 1;
array3[num8 + 1] = subdivisions + 1;
array3[num8 + 2] = k + 2;
}
val.vertices = array;
val.uv = array2;
val.triangles = array3;
val.RecalculateBounds();
val.RecalculateNormals();
return val;
}
}
private static List<ViewCone> cones = new List<ViewCone>();
private static Color seenColor = new Color(1f, 0f, 0f, 0.25f);
private static Color defaultColor = new Color(0.5f, 0f, 0.5f, 0.4f);
private static Color noSightlineColor = new Color(0f, 0.5f, 0.5f, 0.25f);
public override string Identifier => "View Cones";
public override bool ShowOnFairPlay => true;
public override void Enable()
{
base.Enable();
foreach (ViewCone cone in cones)
{
cone.ForceDisable = false;
}
}
public override void Disable()
{
base.Disable();
foreach (ViewCone cone in cones)
{
cone.ForceDisable = true;
}
}
public static void OnSceneLoad()
{
cones.Clear();
}
}
public static class WalkabilityOverlay
{
private static Dictionary<TerrainData, float[,,]> cachedMaps = new Dictionary<TerrainData, float[,,]>();
public static void MakeWalkabilityTex(ref TerrainData data, float maxWalkableAngle)
{
if (cachedMaps.TryGetValue(data, out var value))
{
data.SetAlphamaps(0, 0, value);
return;
}
data.terrainLayers[1].diffuseTexture = Texture2D.blackTexture;
data.terrainLayers[1].diffuseTexture.Apply(true);
float[,,] array = new float[data.alphamapWidth, data.alphamapHeight, data.alphamapLayers];
for (int i = 0; i < data.alphamapHeight; i++)
{
for (int j = 0; j < data.alphamapWidth; j++)
{
float num = (float)j * 1f / (float)(data.alphamapWidth - 1);
float num2 = (float)i * 1f / (float)(data.alphamapHeight - 1);
float steepness = data.GetSteepness(num2, num);
if (steepness < maxWalkableAngle)
{
array[j, i, 0] = 1f;
continue;
}
float num3 = steepness - 45f;
array[j, i, 0] = (1f - num3 / 45f) * 0.25f;
array[j, i, 1] = num3 / 45f * 4f;
}
}
cachedMaps.Add(data, array);
data.SetAlphamaps(0, 0, array);
}
}
[HarmonyPatch(typeof(Snowman), "Kill")]
public static class SnowmanPercent
{
[HarmonyPostfix]
public static void ShowPopUp()
{
if (Configs.SnowmanPercentEnabled)
{
float time = GameManager.instance.levelController.GetCombatTimer().GetTime(true);
GameManager.instance.player.GetHUD().GetNotificationPopUp().TriggerPopUp($"Snowman%: {time:0.00}", (ThreatLevel)2);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}