Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Magrider v1.2.2
plugins/Magrider.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dolso; using Dolso.RoO; using EntityStates; using EntityStates.Bandit2.Weapon; using EntityStates.VagrantNovaItem; using HG.BlendableTypes; using HG.Reflection; using JetBrains.Annotations; using KinematicCharacterController; using Magrider.Components; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.Utils; using MotorAPI; using Rewired; using RiskOfOptions; using RiskOfOptions.Components.Options; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Audio; using RoR2.CameraModes; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.HudOverlay; using RoR2.Networking; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using TMPro; using Unity; using Unity.Burst; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: OptIn] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace Dolso { internal static class log { private static readonly ManualLogSource logger = Logger.CreateLogSource(Assembly.GetExecutingAssembly().GetName().Name); [Conditional("DEBUG")] internal static void debug(object data) { logger.LogDebug(data); } internal static void info(object data) { logger.LogInfo(data); } internal static void message(object data) { logger.LogMessage(data); } internal static void warning(object data) { logger.LogWarning(data); } internal static void error(object data) { logger.LogError(data); } internal static void fatal(object data) { logger.LogFatal(data); } internal static void LogError(this ILCursor c, object data) { logger.LogError((object)$"ILCursor failure, skipping: {data}\n{c}"); } internal static void LogErrorCaller(this ILCursor c, object data) { logger.LogError((object)$"ILCursor failed in {new StackFrame(1).GetMethod().Name}, skipping: {data}\n{c}"); } } internal static class HookManager { internal delegate bool ConfigEnabled<T>(T configValue); private class HookedConfig<T> { private readonly ConfigEnabled<T> enabled; private readonly IDetour detour; internal HookedConfig(ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, IDetour detour) { this.enabled = enabled; this.detour = detour; if (configEntry != null) { configEntry.SettingChanged += ConfigChanged; ConfigChanged(configEntry, null); } else { detour.Apply(); } } private void ConfigChanged(object sender, EventArgs args) { if (enabled(((ConfigEntry<T>)sender).Value)) { if (!detour.IsApplied) { detour.Apply(); } } else if (detour.IsApplied) { detour.Undo(); } } } internal const BindingFlags allFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly ConfigEnabled<bool> boolConfigEnabled = BoolEnabled; private static ILHookConfig ilHookConfig = new ILHookConfig { ManualApply = true }; private static HookConfig onHookConfig = new HookConfig { ManualApply = true }; internal static void Hook(Type typeFrom, string fromMethod, Manipulator ilHook) { Hook(GetMethod(typeFrom, fromMethod), ilHook); } internal static void Hook(Delegate fromMethod, Manipulator ilHook) { Hook(fromMethod.Method, ilHook); } internal static void Hook(MethodBase fromMethod, Manipulator ilHook) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) try { new ILHook(fromMethod, ilHook, ref ilHookConfig).Apply(); } catch (Exception e) { e.LogHookError(fromMethod, ((Delegate)(object)ilHook).Method); } } internal static void Hook(Type typeFrom, string fromMethod, Delegate onHook) { Hook(GetMethod(typeFrom, fromMethod), onHook.Method, onHook.Target); } internal static void Hook(Delegate fromMethod, Delegate onHook) { Hook(fromMethod.Method, onHook.Method, onHook.Target); } internal static void Hook(MethodBase fromMethod, Delegate onHook) { Hook(fromMethod, onHook.Method, onHook.Target); } internal static void Hook(MethodBase fromMethod, MethodInfo onHook, object target = null) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) try { new Hook(fromMethod, onHook, target, ref onHookConfig).Apply(); } catch (Exception e) { e.LogHookError(fromMethod, onHook); } } internal static void HookConfig(this ConfigEntry<bool> configEntry, Type typeFrom, string fromMethod, Delegate hook) { configEntry.HookConfig(boolConfigEnabled, GetMethod(typeFrom, fromMethod), hook.Method, hook.Target); } internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase fromMethod, Delegate hook) { configEntry.HookConfig(boolConfigEnabled, fromMethod, hook.Method, hook.Target); } internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase fromMethod, MethodInfo hook) { configEntry.HookConfig(boolConfigEnabled, fromMethod, hook); } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, Type typeFrom, string fromMethod, Delegate hook) { configEntry.HookConfig(enabled, GetMethod(typeFrom, fromMethod), hook.Method, hook.Target); } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase fromMethod, Delegate hook) { configEntry.HookConfig(enabled, fromMethod, hook.Method, hook.Target); } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, ConfigEnabled<T> enabled, MethodBase fromMethod, MethodInfo hook, object target = null) { try { new HookedConfig<T>(configEntry, enabled, ManualDetour(fromMethod, hook, target)); } catch (Exception e) { e.LogHookError(fromMethod, hook); } } internal static IDetour ManualDetour(Type typeFrom, string fromMethod, Delegate hook) { return ManualDetour(GetMethod(typeFrom, fromMethod), hook.Method, hook.Target); } internal static IDetour ManualDetour(MethodBase fromMethod, Delegate hook) { return ManualDetour(fromMethod, hook.Method, hook.Target); } internal static IDetour ManualDetour(MethodBase fromMethod, MethodInfo hook, object target = null) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown try { ParameterInfo[] parameters = hook.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType == typeof(ILContext)) { return (IDetour)new ILHook(fromMethod, (Manipulator)hook.CreateDelegate(typeof(Manipulator)), ref ilHookConfig); } return (IDetour)new Hook(fromMethod, hook, target, ref onHookConfig); } catch (Exception e) { e.LogHookError(fromMethod, hook); return null; } } internal static MethodInfo GetMethod(Type typeFrom, string methodName) { if (typeFrom == null || methodName == null) { log.error($"Null argument in GetMethod: type={typeFrom}, name={methodName}"); return null; } MethodInfo[] array = (from a in typeFrom.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where a.Name == methodName select a).ToArray(); switch (array.Length) { case 1: return array[0]; case 0: log.error($"Failed to find method: {typeFrom}::{methodName}"); return null; default: { string text = $"{array.Length} ambiguous matches found for: {typeFrom}::{methodName}, may be incorrect"; MethodInfo[] array2 = array; for (int i = 0; i < array2.Length; i++) { text = text + "\n" + array2[i]; } log.warning(text); return array[0]; } } } internal static MethodInfo GetMethod(Type typeFrom, string methodName, params Type[] parameters) { if (typeFrom == null || methodName == null) { log.error($"Null argument in GetMethod: type={typeFrom}, name={methodName}"); return null; } MethodInfo? method = typeFrom.GetMethod(methodName, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, parameters, null); if (method == null) { log.error($"Failed to find method: {typeFrom}::{methodName}_{parameters.Length}"); } return method; } internal static void SetPriority(string[] before_il = null, string[] before_on = null, string[] after_il = null, string[] after_on = null) { ilHookConfig.Before = before_il; onHookConfig.Before = before_on; ilHookConfig.After = after_il; onHookConfig.After = after_on; } internal static void LogHookError(this Exception e, MethodBase fromMethod, MethodInfo hook) { log.error((fromMethod == null) ? $"null from-method for hook: {hook.Name}\n{e}" : $"Failed to hook: {fromMethod.DeclaringType}::{fromMethod.Name} - {hook.Name}\n{e}"); } private static bool BoolEnabled(bool configValue) { return configValue; } } internal static class Utilities { private static GameObject _prefabParent; internal static ConfigFile configFile; internal static bool resetConfigs; internal static GameObject CreatePrefab(GameObject gameObject, string name = null) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_prefabParent)) { _prefabParent = new GameObject("DolsoPrefabs"); Object.DontDestroyOnLoad((Object)(object)_prefabParent); ((Object)_prefabParent).hideFlags = (HideFlags)61; _prefabParent.SetActive(false); } GameObject val = Object.Instantiate<GameObject>(gameObject, _prefabParent.transform); if (name != null) { ((Object)val).name = name; } return val; } internal static void Awake(BaseUnityPlugin plugin) { configFile = plugin.Config; } } internal static class RiskofOptions { internal const string RooGuid = "com.rune580.riskofoptions"; internal static bool enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); [MethodImpl(MethodImplOptions.NoInlining)] internal static void SetSprite(Sprite sprite) { ModSettingsManager.SetModIcon(sprite); } internal static void SetSpriteDefaultIcon() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_005b: 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) try { string fullName = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName; Texture2D val = new Texture2D(256, 256); if (ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(fullName, "icon.png")))) { ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } else { log.error("Failed to load icon.png"); } } catch (Exception ex) { log.error("Failed to load icon.png\n" + ex); } } internal static void AddOption(ConfigEntryBase entry) { AddOption(entry, string.Empty, string.Empty); } [MethodImpl(MethodImplOptions.NoInlining)] internal static void AddOption(ConfigEntryBase entry, string categoryName = "", string name = "", bool restartRequired = false) { //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01ae: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00e4: 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_00d4: Expected O, but got Unknown //IL_00cf: 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_00bf: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) Type settingType = entry.SettingType; object obj; if (!(settingType == typeof(float))) { obj = ((!(settingType == typeof(string))) ? ((!(settingType == typeof(bool))) ? ((!(settingType == typeof(int))) ? ((!(settingType == typeof(Color))) ? ((!(settingType == typeof(KeyboardShortcut))) ? ((object)((!settingType.IsEnum) ? ((ChoiceOption)null) : new ChoiceOption(entry, new ChoiceConfig()))) : ((object)new KeyBindOption((ConfigEntry<KeyboardShortcut>)(object)entry, new KeyBindConfig()))) : ((object)new ColorOption((ConfigEntry<Color>)(object)entry, new ColorOptionConfig()))) : ((object)new IntFieldOption((ConfigEntry<int>)(object)entry, new IntFieldConfig()))) : ((object)new CheckBoxOption((ConfigEntry<bool>)(object)entry, new CheckBoxConfig()))) : ((object)new StringInputFieldOption((ConfigEntry<string>)(object)entry, new InputFieldConfig { submitOn = (SubmitEnum)6, lineType = (LineType)0 }))); } else if (entry.Description.AcceptableValues is AcceptableValueRange<float>) { obj = (object)new SliderOption((ConfigEntry<float>)(object)entry, new SliderConfig { min = ((AcceptableValueRange<float>)(object)entry.Description.AcceptableValues).MinValue, max = ((AcceptableValueRange<float>)(object)entry.Description.AcceptableValues).MaxValue, FormatString = "{0:f2}", description = entry.DescWithDefault("{0:f2}") }); } else { ConfigEntry<float> obj2 = (ConfigEntry<float>)(object)entry; FloatFieldConfig val = new FloatFieldConfig(); ((NumericFieldConfig<float>)val).FormatString = "{0:f2}"; ((BaseOptionConfig)val).description = entry.DescWithDefault("{0:f2}"); obj = (object)new FloatFieldOption(obj2, val); } BaseOption val2 = (BaseOption)obj; if (val2 == null) { return; } BaseOptionConfig config = val2.GetConfig(); config.category = categoryName; config.name = name; config.restartRequired = restartRequired; if (config.description == "") { config.description = entry.DescWithDefault(); } try { ModSettingsManager.AddOption(val2); } catch (Exception arg) { log.error($"AddOption {entry.Definition} failed\n{arg}"); } } [MethodImpl(MethodImplOptions.NoInlining)] internal static void AddOption(ConfigEntry<float> entry, float min, float max, string format = "{0:f2}", string categoryName = "") { //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_0014: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig { min = min, max = max, FormatString = format, category = categoryName, description = ((ConfigEntryBase)(object)entry).DescWithDefault(format) })); } [MethodImpl(MethodImplOptions.NoInlining)] internal static void AddIntSlider(ConfigEntry<int> entry, int min, int max, string categoryName = "") { //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_0014: 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_0031: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig { min = min, max = max, category = categoryName, description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } private static string DescWithDefault(this ConfigEntryBase entry, string format = "{0}") { return string.Format("{1}\n[Default: " + format + "]", entry.DefaultValue, entry.Description.Description); } } internal class TextHud { private static readonly Queue<TextHud> hudsToUpdate; internal bool resetOnTargetChanged = true; internal TextAlignmentOptions alignment = (TextAlignmentOptions)257; internal readonly ConfigEntry<bool> toggleEntry; private readonly ConfigEntry<int> fontsizeEntry; private readonly ConfigEntry<Vector2> positionEntry; private readonly string hudName; private GameObject objhud; private HGTextMeshProUGUI textMesh; private string textToUpdate; internal static HUD hud { get { if (HUD.instancesList.Count <= 0) { return null; } return HUD.instancesList[0]; } } internal bool enabled { get { if (toggleEntry == null) { return true; } return toggleEntry.Value; } } internal int fontSize { get { if (fontsizeEntry == null) { return -1; } return fontsizeEntry.Value; } } internal Vector2 position { get { //IL_001e: 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) if (positionEntry == null) { return new Vector2(1776.5f, 173f); } return positionEntry.Value; } } static TextHud() { hudsToUpdate = new Queue<TextHud>(); RoR2Application.onLateUpdate += LateUpdate; } private TextHud(ConfigFile configFile, string name, Vector2? defaultPosition, bool? defaultToggle, int? defaultFontSize) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) hudName = name; if (defaultPosition.HasValue) { positionEntry = configFile.Bind<Vector2>(name, "Position", defaultPosition.Value, "Position of " + name + ", starting from bottom left corner"); } if (defaultToggle.HasValue) { toggleEntry = configFile.Bind<bool>(name, "Toggle", defaultToggle.Value, "Toggles " + name); } if (defaultFontSize.HasValue) { fontsizeEntry = configFile.Bind<int>(name, "Font size", defaultFontSize.Value, "Font size of " + name); } DoHooks(); } internal TextHud(ConfigFile configFile, string name) : this(configFile, name, null, null, null) { } internal TextHud(ConfigFile configFile, string name, Vector2 defaultPosition) : this(configFile, name, defaultPosition, null, null) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) internal TextHud(ConfigFile configFile, string name, Vector2 defaultPosition, bool defaultToggle) : this(configFile, name, defaultPosition, defaultToggle, null) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) internal TextHud(ConfigFile configFile, string name, Vector2 defaultPosition, int defaultFontSize) : this(configFile, name, defaultPosition, null, defaultFontSize) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) internal TextHud(ConfigFile configFile, string name, Vector2 defaultPosition, bool defaultToggle, int defaultFontSize) : this(configFile, name, (Vector2?)defaultPosition, (bool?)defaultToggle, (int?)defaultFontSize) { }//IL_0003: Unknown result type (might be due to invalid IL or missing references) internal void UpdateText(string text) { if (!hudsToUpdate.Contains(this)) { hudsToUpdate.Enqueue(this); } textToUpdate = text; } internal void ClearText() { if (Object.op_Implicit((Object)(object)objhud) && !string.IsNullOrEmpty(((TMP_Text)textMesh).text)) { UpdateText(string.Empty); } } private static void LateUpdate() { while (hudsToUpdate.Count > 0) { TextHud textHud = hudsToUpdate.Dequeue(); if (textHud.enabled) { if ((Object)(object)textHud.objhud == (Object)null) { textHud.InitHud(); } ((TMP_Text)textHud.textMesh).SetText(textHud.textToUpdate, true); } textHud.textToUpdate = null; } } internal void DestroyHUD() { Object.Destroy((Object)(object)objhud); } private void InitHud() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0036: 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_0057: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) objhud = new GameObject(hudName); RectTransform val = objhud.AddComponent<RectTransform>(); if (Object.op_Implicit((Object)(object)hud)) { SetTransform(val, hud); } val.sizeDelta = Vector2.zero; val.pivot = new Vector2(0.5f, 0.5f); val.anchoredPosition = position; textMesh = objhud.AddComponent<HGTextMeshProUGUI>(); ((TMP_Text)textMesh).fontSizeMin = 6f; if (fontSize >= 0) { ((TMP_Text)textMesh).fontSize = fontSize; } ((TMP_Text)textMesh).outlineColor = Color32.op_Implicit(Color.black); ((TMP_Text)textMesh).enableWordWrapping = false; ((TMP_Text)textMesh).alignment = alignment; } private void SetTransform(RectTransform textRect, HUD hud) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_0051: 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_005c: 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_0067: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)hud.mainUIPanel.transform; ((Transform)textRect).SetParent(hud.mainUIPanel.transform, false); textRect.anchoredPosition3D = new Vector3(position.x, position.y, 0f - val.anchoredPosition3D.z); Vector2 anchorMax = (textRect.anchorMin = -val.anchorMin / (val.anchorMax - val.anchorMin)); textRect.anchorMax = anchorMax; } private void DoHooks() { HUD.onHudTargetChangedGlobal += Reset_OnHudTargetChanged; if (toggleEntry != null) { toggleEntry.SettingChanged += Toggle_Changed; } if (positionEntry != null) { positionEntry.SettingChanged += Position_Changed; } if (fontsizeEntry != null) { fontsizeEntry.SettingChanged += FontSize_Changed; } } private void Reset_OnHudTargetChanged(HUD obj) { if (Object.op_Implicit((Object)(object)objhud)) { if (!Object.op_Implicit((Object)(object)objhud.transform.parent)) { Transform transform = objhud.transform; SetTransform((RectTransform)(object)((transform is RectTransform) ? transform : null), hud); } if (resetOnTargetChanged) { ClearText(); } } } private void Toggle_Changed(object sender, EventArgs e) { if (Object.op_Implicit((Object)(object)objhud) && !enabled) { Object.Destroy((Object)(object)objhud); } } private void Position_Changed(object sender, EventArgs e) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)objhud)) { objhud.GetComponent<RectTransform>().anchoredPosition = position; } } private void FontSize_Changed(object sender, EventArgs e) { if (Object.op_Implicit((Object)(object)objhud) && fontSize > 0) { ((TMP_Text)textMesh).fontSize = fontSize; } } internal void AddRoOVector2Option() { AddRoOVector2Option(hudName); } internal void AddRoOVector2Option(string category) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (RiskofOptions.enabled) { new Vector2ScreenOption(positionEntry, hudName + " text", category, new Vector2ScreenOption.DotInfo(((int)alignment == 257) ? new Vector2(0f, 1f) : new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), new Vector2(0.5f, 0.5f), Vector2.op_Implicit(Vector3.zero)), toggleEntry, fontsizeEntry); } } } [MeansImplicitUse] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] internal class HookAttribute : Attribute { private readonly Type typeFrom; private readonly string methodFrom; private readonly Type[] parameters; protected MethodInfo from { get { if ((object)typeFrom != null) { if (parameters != null) { return HookManager.GetMethod(typeFrom, methodFrom, parameters); } return HookManager.GetMethod(typeFrom, methodFrom); } return null; } } internal HookAttribute(Type typeFrom, string methodFrom) { this.typeFrom = typeFrom; this.methodFrom = methodFrom; } internal HookAttribute(Type typeFrom, string methodFrom, params Type[] parameters) { this.typeFrom = typeFrom; this.methodFrom = methodFrom; this.parameters = parameters; } internal HookAttribute() { } internal static void ScanAndApply() { ScanAndApply((from a in Assembly.GetExecutingAssembly().GetTypes() where a.GetCustomAttribute<HookAttribute>() != null select a).ToArray()); } internal static void ScanAndApply(params Type[] types) { for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { foreach (HookAttribute customAttribute in methodInfo.GetCustomAttributes<HookAttribute>(inherit: false)) { MethodInfo methodInfo2 = null; try { methodInfo2 = customAttribute.from; if (methodInfo2 == null && methodInfo.GetParameters().Length == 0) { methodInfo.Invoke(null, null); } else { customAttribute.Hook(methodInfo2, methodInfo); } } catch (Exception e) { e.LogHookError(methodInfo2, methodInfo); } } } } } protected virtual void Hook(MethodInfo from, MethodInfo member) { IDetour obj = HookManager.ManualDetour(from, member); if (obj != null) { obj.Apply(); } } } internal class ConfigVar<T> : BaseConVar { internal readonly ConfigEntry<T> configEntry; private T _value; internal T value { get { return _value; } set { if (configEntry != null) { configEntry.Value = value; } else { _value = value; } } } internal ConfigVar(string section, string name, T defaultValue) : this(section, name, defaultValue, string.Empty) { } internal ConfigVar(string section, string name, T defaultValue, string description) : base(GenerateName(section, name), (ConVarFlags)0, (string)null, $"{description} [Default: {defaultValue}]") { if (description.Length > 0 && Utilities.configFile != null) { configEntry = Utilities.configFile.Bind<T>(section, name, defaultValue, description); SetupConfig(autoroo: true); } else { _value = defaultValue; } } internal ConfigVar(string section, string name, T defaultValue, string description, float min, float max) : this(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>())) { }//IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown internal ConfigVar(string section, string name, T defaultValue, ConfigDescription description) : base(GenerateName(section, name), (ConVarFlags)0, (string)null, $"{description.Description} [Default: {defaultValue}]") { if (Utilities.configFile != null) { configEntry = Utilities.configFile.Bind<T>(section, name, defaultValue, description); SetupConfig(autoroo: true); } else { _value = defaultValue; } } internal ConfigVar(ConfigEntry<T> entry, bool autoroo = true) : base(GenerateName(((ConfigEntryBase)entry).Definition.Section, ((ConfigEntryBase)entry).Definition.Key), (ConVarFlags)0, (string)null, $"{((ConfigEntryBase)entry).Description.Description} [Default: {((ConfigEntryBase)entry).DefaultValue}]") { configEntry = entry; SetupConfig(autoroo); } public override void SetString(string newValue) { string text = ((object)this).ToString(); if (configEntry != null) { ((ConfigEntryBase)configEntry).SetSerializedValue(newValue); } else { _value = TomlTypeConverter.ConvertToValue<T>(newValue); } Debug.LogFormat("\"{0}\" set from \"{1}\" to \"{2}\"", new object[3] { base.name, text, ((object)this).ToString() }); } public override string GetString() { return TomlTypeConverter.ConvertToString((object)_value, typeof(T)); } public override string ToString() { return TomlTypeConverter.ConvertToString((object)_value, typeof(T)); } protected virtual void SetupConfig(bool autoroo) { configEntry.SettingChanged += ConfigValueChanged; _value = configEntry.Value; if (autoroo && RiskofOptions.enabled) { AddToRoO(); } } private void AddToRoO() { RiskofOptions.AddOption((ConfigEntryBase)(object)configEntry); } private void ConfigValueChanged(object sender, EventArgs args) { _value = configEntry.Value; } private static string GenerateName(string section, string name) { return (Assembly.GetExecutingAssembly().GetName().Name + "_" + section + "_" + name).ToLower().Replace(' ', '_'); } public static implicit operator T(ConfigVar<T> self) { return self._value; } } internal class ResetableConfig<T> : ConfigVar<T> { internal ResetableConfig(ConfigEntry<T> entry, bool autoroo = true) : base(entry, autoroo) { } internal ResetableConfig(string section, string name, T defaultValue) : base(section, name, defaultValue) { } internal ResetableConfig(string section, string name, T defaultValue, string description) : base(section, name, defaultValue, description) { } internal ResetableConfig(string section, string name, T defaultValue, ConfigDescription description) : base(section, name, defaultValue, description) { } internal ResetableConfig(string section, string name, T defaultValue, string description, float min, float max) : base(section, name, defaultValue, description, min, max) { } protected override void SetupConfig(bool autoroo) { if (Utilities.resetConfigs) { ResetConfig(); } base.SetupConfig(autoroo); } internal void ResetConfig() { T val = (T)((ConfigEntryBase)configEntry).DefaultValue; if (!configEntry.Value.Equals(val)) { log.info($"Reset {((ConfigEntryBase)configEntry).Definition.Key} from {configEntry.Value} to {val}"); configEntry.Value = val; } } } } namespace Dolso.RoO { internal class RooSliderInput2 : MonoBehaviour { internal UnityEvent<float> onValueChanged = new UnityEvent<float>(); internal string formatString = "F0"; private Slider slider; private TMP_InputField inputField; private float _value; internal float value { get { return _value; } set { if (_value != value) { _value = value; onValueChanged.Invoke(_value); } UpdateControls(); } } private void Awake() { slider = ((Component)this).GetComponentInChildren<Slider>(); inputField = ((Component)this).GetComponentInChildren<TMP_InputField>(); ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)SliderChanged); ((UnityEvent<string>)(object)inputField.onEndEdit).AddListener((UnityAction<string>)OnTextEdited); ((UnityEvent<string>)(object)inputField.onSubmit).AddListener((UnityAction<string>)OnTextEdited); } internal void Setup(float min, float max) { slider.minValue = min; slider.maxValue = max; } internal void SetWholeNumbers(bool wholeNumbers) { slider.wholeNumbers = wholeNumbers; } private void UpdateControls() { if (formatString.StartsWith("F")) { slider.value = value; inputField.text = value.ToString(formatString, CultureInfo.InvariantCulture); } else { int num = (int)value; slider.value = num; inputField.text = num.ToString(formatString, CultureInfo.InvariantCulture); } } private void SliderChanged(float newValue) { value = newValue; } private void OnTextEdited(string newText) { if (float.TryParse(newText, out var result)) { value = Mathf.Clamp(result, slider.minValue, slider.maxValue); } else { value = _value; } } } internal class Vector2ScreenBehaviour : MonoBehaviour { private static Sprite checkOn; private static Sprite checkOff; private RooSliderInput2 sliderX; private RooSliderInput2 sliderY; private RooSliderInput2 sliderSize; private ChildLocator childLocator; private RectTransform positionDot; private RectTransform positionRect; private Vector2ScreenOption option; private Image checkBox; private bool boxState; private ref readonly Vector2ScreenOption.DotInfo dotinfo => ref option.dotInfo; private ConfigEntry<Vector2> positionEntry => option.positionEntry; private ConfigEntry<bool> toggleEntry => option.toggleEntry; private ConfigEntry<int> fontSizeEntry => option.fontSizeEntry; private ConfigEntry<float> scaleEntry => option.scaleEntry; internal static void LoadImages(AsyncOperationHandle<GameObject> handle) { CarouselController component = handle.Result.GetComponent<CarouselController>(); checkOn = component.choices[1].customSprite; checkOff = component.choices[0].customSprite; } internal void SetStartingValues(Vector2ScreenOption option) { //IL_0013: 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_003f: 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) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00b5: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: 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_01c7: Expected O, but got Unknown //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) this.option = option; positionDot.anchorMin = dotinfo.dotAnchor; positionDot.anchorMax = dotinfo.dotAnchor; positionDot.pivot = dotinfo.dotAnchor; positionRect.anchorMin = dotinfo.rectAnchor; positionRect.anchorMax = dotinfo.rectAnchor; positionRect.pivot = dotinfo.rectPivot; positionRect.sizeDelta = dotinfo.rectSize; Vector2 val = CalcMinMax(1920f, 0); sliderX = BuildSlider("PositionX", val.x, val.y); sliderX.formatString = "F0"; sliderX.onValueChanged.AddListener((UnityAction<float>)XChanged); Vector2 val2 = CalcMinMax(1080f, 1); sliderY = BuildSlider("PositionY", val2.x, val2.y); sliderY.formatString = "F0"; sliderY.onValueChanged.AddListener((UnityAction<float>)YChanged); sliderX.value = positionEntry.Value.x; sliderY.value = positionEntry.Value.y; if (toggleEntry != null) { boxState = toggleEntry.Value; ((UnityEvent)((Button)((Component)childLocator.FindChild("Toggle")).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(ToggleChanged)); checkBox = ((Component)childLocator.FindChild("ToggleBox")).GetComponent<Image>(); checkBox.sprite = (boxState ? checkOn : checkOff); } else { ((Component)childLocator.FindChild("ToggleParent")).gameObject.SetActive(false); ((Component)childLocator.FindChild("ToggleText")).gameObject.SetActive(false); RectTransform component = ((Component)childLocator.FindChild("Size")).GetComponent<RectTransform>(); component.anchoredPosition += new Vector2(0f, 66f); } if (fontSizeEntry != null) { sliderSize = BuildSlider("Size", 5f, option.maxScale); sliderSize.formatString = "0"; sliderSize.onValueChanged.AddListener((UnityAction<float>)FontSizeChanged); sliderSize.value = fontSizeEntry.Value; } else if (scaleEntry != null) { sliderSize = BuildSlider("Size", 0f, option.maxScale); sliderSize.formatString = "F1"; sliderSize.onValueChanged.AddListener((UnityAction<float>)ScaleChanged); sliderSize.SetWholeNumbers(wholeNumbers: false); sliderSize.value = scaleEntry.Value; } else { ((Component)childLocator.FindChild("Size")).gameObject.SetActive(false); SetSize(option.maxScale * Vector2.one); } } private void Awake() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown childLocator = ((Component)this).GetComponent<ChildLocator>(); positionDot = ((Component)childLocator.FindChild("PositionDot")).GetComponent<RectTransform>(); positionRect = ((Component)childLocator.FindChild("PositionRect")).GetComponent<RectTransform>(); ((UnityEvent)((Button)((Component)childLocator.FindChild("Apply")).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(Apply)); ((UnityEvent)((Button)((Component)childLocator.FindChild("Cancel")).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(Close)); ((UnityEvent)((Button)((Component)childLocator.FindChild("Default")).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(SetToDefault)); ((Component)this).GetComponent<RooEscapeRouter>().escapePressed.AddListener(new UnityAction(Close)); } private RooSliderInput2 BuildSlider(string childName, float min, float max) { RooSliderInput2 rooSliderInput = ((Component)childLocator.FindChild(childName)).gameObject.AddComponent<RooSliderInput2>(); rooSliderInput.Setup(min, max); return rooSliderInput; } private Vector2 CalcMinMax(float length, int index) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0020: 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_0048: 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_0065: 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_0079: Unknown result type (might be due to invalid IL or missing references) Vector2 val = dotinfo.rectSize; float num = 0f - ((Vector2)(ref val))[index]; val = dotinfo.dotAnchor; float num2 = ((Vector2)(ref val))[index]; val = dotinfo.rectPivot; float num3 = num * (num2 - ((Vector2)(ref val))[index]); float num4 = 0f - length; val = dotinfo.rectAnchor; float num5 = num4 * ((Vector2)(ref val))[index] + num3; val = dotinfo.rectAnchor; float num6 = length * (1f - ((Vector2)(ref val))[index]) + num3; return new Vector2(num5, num6); } private void XChanged(float newValue) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Vector2 anchoredPosition = positionRect.anchoredPosition; anchoredPosition.x = newValue; positionRect.anchoredPosition = anchoredPosition; } private void YChanged(float newValue) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Vector2 anchoredPosition = positionRect.anchoredPosition; anchoredPosition.y = newValue; positionRect.anchoredPosition = anchoredPosition; } private void ToggleChanged() { boxState = !boxState; checkBox.sprite = (boxState ? checkOn : checkOff); } private void FontSizeChanged(float newValue) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) SetSize(newValue * Vector2.one); } private void ScaleChanged(float newValue) { //IL_0008: 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) SetSize(newValue * dotinfo.rectSize); } private void SetSize(Vector2 size) { //IL_0031: 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_0020: Unknown result type (might be due to invalid IL or missing references) if (((Vector2)(ref size)).sqrMagnitude < 16f) { positionDot.sizeDelta = ((Vector2)(ref size)).normalized * 4f; } else { positionDot.sizeDelta = size; } } private void SetToDefault() { //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_0017: 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) Vector2 val = (Vector2)((ConfigEntryBase)positionEntry).DefaultValue; sliderX.value = val.x; sliderY.value = val.y; if (toggleEntry != null) { boxState = (bool)((ConfigEntryBase)toggleEntry).DefaultValue; checkBox.sprite = (boxState ? checkOn : checkOff); } if (fontSizeEntry != null) { sliderSize.value = (int)((ConfigEntryBase)fontSizeEntry).DefaultValue; } else if (scaleEntry != null) { sliderSize.value = (float)((ConfigEntryBase)scaleEntry).DefaultValue; } } private void Apply() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) positionEntry.Value = new Vector2((float)Math.Round(sliderX.value, 2), (float)Math.Round(sliderY.value, 2)); if (toggleEntry != null) { toggleEntry.Value = boxState; } if (fontSizeEntry != null) { fontSizeEntry.Value = Mathf.RoundToInt(sliderSize.value); } else if (scaleEntry != null) { scaleEntry.Value = sliderSize.value; } Close(); } private void Close() { Object.DestroyImmediate((Object)(object)((Component)this).gameObject); } } internal class Vector2ScreenOption { internal readonly struct DotInfo { internal readonly Vector2 dotAnchor; internal readonly Vector2 rectAnchor; internal readonly Vector2 rectPivot; internal readonly Vector2 rectSize; internal DotInfo(Vector2 dotAnchor, Vector2 rectAnchor, Vector2 rectPivot, Vector2 rectSize) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0018: Unknown result type (might be due to invalid IL or missing references) this.dotAnchor = dotAnchor; this.rectAnchor = rectAnchor; this.rectPivot = rectPivot; this.rectSize = rectSize; } } private static GameObject prefab; internal readonly ConfigEntry<Vector2> positionEntry; internal readonly ConfigEntry<bool> toggleEntry; internal readonly ConfigEntry<int> fontSizeEntry; internal readonly ConfigEntry<float> scaleEntry; internal readonly DotInfo dotInfo; internal readonly float maxScale; internal Vector2ScreenOption(ConfigEntry<Vector2> positionEntry, DotInfo dotInfo, float dotSize = 16f) : this(positionEntry, ((ConfigEntryBase)positionEntry).Definition.Key, ((ConfigEntryBase)positionEntry).Definition.Section, dotInfo, null, null, null, dotSize) { } internal Vector2ScreenOption(ConfigEntry<Vector2> positionEntry, string name, string category, DotInfo dotInfo, float dotSize = 16f) : this(positionEntry, name, category, dotInfo, null, null, null, dotSize) { } internal Vector2ScreenOption(ConfigEntry<Vector2> positionEntry, DotInfo dotInfo, ConfigEntry<float> scaleEntry, float maxScale = 3f) : this(positionEntry, ((ConfigEntryBase)positionEntry).Definition.Key, ((ConfigEntryBase)positionEntry).Definition.Section, dotInfo, null, null, scaleEntry, maxScale) { } internal Vector2ScreenOption(ConfigEntry<Vector2> positionEntry, string name, string category, DotInfo dotInfo, ConfigEntry<float> scaleEntry, float maxScale = 3f) : this(positionEntry, name, category, dotInfo, null, null, scaleEntry, maxScale) { } internal Vector2ScreenOption(ConfigEntry<Vector2> positionEntry, string name, string category, DotInfo dotInfo, ConfigEntry<bool> toggleEntry = null, ConfigEntry<int> fontSizeEntry = null) : this(positionEntry, name, category, dotInfo, toggleEntry, fontSizeEntry, null, (fontSizeEntry == null) ? 16 : 36) { } private Vector2ScreenOption(ConfigEntry<Vector2> positionEntry, string name, string category, DotInfo dotInfo, ConfigEntry<bool> toggleEntry, ConfigEntry<int> fontSizeEntry, ConfigEntry<float> scaleEntry, float maxScale) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown this.positionEntry = positionEntry; this.dotInfo = dotInfo; this.maxScale = maxScale; this.toggleEntry = toggleEntry; this.fontSizeEntry = fontSizeEntry; this.scaleEntry = scaleEntry; ModSettingsManager.AddOption((BaseOption)new GenericButtonOption(name, category, "Position of " + name, "Open", new UnityAction(CreateOptionWindow))); EnsureAssets(); } internal static void LoadAssets(string assetFolder) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/SettingsEntryButton, Bool.prefab"); val.Completed += Vector2ScreenBehaviour.LoadImages; if (!Path.IsPathRooted(assetFolder)) { assetFolder = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), assetFolder, "dolso"); } AssetBundle obj = AssetBundle.LoadFromFile(assetFolder); prefab = obj.LoadAsset<GameObject>("TextHud Screen"); obj.Unload(false); } private static void EnsureAssets() { if (!Object.op_Implicit((Object)(object)prefab)) { string text = Directory.EnumerateFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dolso", SearchOption.AllDirectories).FirstOrDefault(); if (text != null) { LoadAssets(text); } else { log.warning("failed to find dolso assetbundle"); } } } private void CreateOptionWindow() { Object.Instantiate<GameObject>(prefab).AddComponent<Vector2ScreenBehaviour>().SetStartingValues(this); } } } namespace Magrider { internal class CameraModeMagrider : CameraModePlayerBasic { internal const float CamMaxPitch = 40f; internal static readonly CameraModeMagrider playerCamera = new CameraModeMagrider { isSpectatorMode = false }; internal static readonly CameraModeMagrider spectatorCamera = new CameraModeMagrider { isSpectatorMode = true }; public override void ApplyLookInputInternal(object rawInstanceData, in CameraModeContext context, in ApplyLookInputArgs input) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a8: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) MagriderThrust magriderThrust = default(MagriderThrust); if (!context.targetInfo.isViewerControlled || !Object.op_Implicit((Object)(object)context.targetInfo.target) || !context.targetInfo.target.TryGetComponent<MagriderThrust>(ref magriderThrust)) { ((CameraModePlayerBasic)this).ApplyLookInputInternal(rawInstanceData, ref context, ref input); return; } InstanceData val = (InstanceData)rawInstanceData; magriderThrust.AccumulateYaw(1f / 27f * (float)Config.mouseMult * input.lookInput.x); Quaternion rotation = ((Component)magriderThrust).transform.rotation; float num = 57.29578f * Mathf.Atan2(2f * (rotation.x * rotation.w - rotation.y * rotation.z), 1f - 2f * (rotation.x * rotation.x - rotation.z * rotation.z)); val.pitchYaw.pitch = Mathf.Clamp(val.pitchYaw.pitch - input.lookInput.y, num - 40f, num + 40f); if (Object.op_Implicit((Object)(object)context.targetInfo.networkedViewAngles) && context.targetInfo.networkedViewAngles.hasEffectiveAuthority) { context.targetInfo.networkedViewAngles.viewAngles = val.pitchYaw; } } public override void UpdateInternal(object rawInstanceData, in CameraModeContext context, out UpdateResult result) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_002a: 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_003b: 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_0042: 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_0051: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00fa: 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_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) CameraRigController cameraRigController = context.cameraInfo.cameraRigController; InstanceData val = (InstanceData)rawInstanceData; CameraTargetParams targetParams = context.targetInfo.targetParams; Quaternion val2 = context.cameraInfo.previousCameraState.rotation; Vector3 position = context.cameraInfo.previousCameraState.position; CharacterCameraParamsData basic = CharacterCameraParamsData.basic; basic.fov = BlendableFloat.op_Implicit(val.neutralFov); Vector2 val3 = Vector2.zero; float num; bool flag; if (Object.op_Implicit((Object)(object)targetParams)) { CharacterCameraParamsData.Blend(ref targetParams.currentCameraParamsData, ref basic, 1f); num = basic.fov.value; val3 = targetParams.recoil; flag = targetParams.currentCameraParamsData.isFirstPerson.value; } else { num = context.cameraInfo.baseFov; flag = false; } val.neutralFov = Mathf.SmoothDamp(val.neutralFov, num, ref val.neutralFovVelocity, 0.2f, float.PositiveInfinity, Time.deltaTime); float pitch = val.pitchYaw.pitch; pitch += val3.y; Vector3 val4 = MagCalculatePivotPosition(in context, flag); GameObject target = context.targetInfo.target; if (Object.op_Implicit((Object)(object)target)) { Quaternion rotation = target.transform.rotation; float num2 = 57.29578f * Mathf.Atan2(2f * (rotation.x * rotation.w - rotation.y * rotation.z), 1f - 2f * (rotation.x * rotation.x - rotation.z * rotation.z)); val2 = rotation * Quaternion.Euler(pitch - num2, 0f, 0f); if (!flag && !Config.tpCameraRotate) { val2 = Quaternion.LookRotation(val2 * Vector3.forward, Vector3.up); } MagriderController magriderController = default(MagriderController); if (target.TryGetComponent<MagriderController>(ref magriderController)) { magriderController.cameraPitch = pitch - num2; } if (!flag) { Vector3 val5 = val2 * basic.idealLocalCameraPos.value; float magnitude = ((Vector3)(ref val5)).magnitude; float num3 = (1f + Mathf.Clamp(val.pitchYaw.pitch, -90f, 90f) / -90f) * 0.5f; magnitude *= Mathf.Sqrt(1f - num3); if (magnitude < 0.25f) { magnitude = 0.25f; } float num4 = cameraRigController.Raycast(new Ray(val4, val5), magnitude, basic.wallCushion.value - 0.01f); if (val.currentCameraDistance >= num4) { val.currentCameraDistance = num4; val.cameraDistanceVelocity = 0f; } else { val.currentCameraDistance = Mathf.SmoothDamp(val.currentCameraDistance, num4, ref val.cameraDistanceVelocity, 0.2f); } position = val4 + ((Vector3)(ref val5)).normalized * val.currentCameraDistance; } else { position = val4; } } result.cameraState.position = position; result.cameraState.rotation = val2; result.cameraState.fov = num; result.showSprintParticles = false; result.firstPersonTarget = null; result.showDisabledSkillsParticles = context.targetInfo.skillsAreDisabled; result.showSecondaryElectricityParticles = context.targetInfo.showSecondaryElectricity; result.lastCrosshairHurtBox = val.lastCrosshairHurtBox; ((CameraModePlayerBasic)this).UpdateCrosshair(rawInstanceData, ref context, ref result.cameraState, ref val4, ref result.crosshairWorldPosition); } private static Vector3 MagCalculatePivotPosition(in CameraModeContext context, bool firstPerson) { //IL_0023: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) //IL_0050: 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_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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_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_00d5: 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_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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) //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_00d0: 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) CameraRigController cameraRigController = context.cameraInfo.cameraRigController; CameraTargetParams targetParams = context.targetInfo.targetParams; Vector3 result = context.cameraInfo.previousCameraState.position; if (Object.op_Implicit((Object)(object)targetParams)) { Vector3 position = ((Component)targetParams).transform.position; Vector3 val = context.targetInfo.target.transform.rotation * new Vector3(0f, targetParams.currentCameraParamsData.pivotVerticalOffset.value, 0f); if (!firstPerson && !Config.tpCameraRotate && val.y < 0.5f) { val.y = 0.5f; } Vector3 val2 = (Object.op_Implicit((Object)(object)targetParams.cameraPivotTransform) ? targetParams.cameraPivotTransform.position : position) + val; if (targetParams.dontRaycastToPivot) { result = val2; } else { Vector3 val3 = val2 - position; float magnitude = ((Vector3)(ref val3)).magnitude; Ray val4 = default(Ray); ((Ray)(ref val4))..ctor(position, val3); float num = cameraRigController.Raycast(val4, magnitude, targetParams.currentCameraParamsData.wallCushion.value); result = ((Ray)(ref val4)).GetPoint(num); } } return result; } public override void CollectLookInputInternal(object rawInstanceData, in CameraModeContext context, out CollectLookInputResult output) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ((CameraModePlayerBasic)this).CollectLookInputInternal(rawInstanceData, ref context, ref output); if (CameraRigController.enableSprintSensitivitySlowdown.value && context.targetInfo.isSprinting) { ref Vector2 lookInput = ref output.lookInput; lookInput *= 2f; } } } internal static class Config { private class ConfigStat<T> { private readonly ConfigEntry<T> configEntry; private readonly Action<GameObject, T> setStat; internal ConfigStat(ConfigEntry<T> configEntry, Action<GameObject, T> setStat) { this.configEntry = configEntry; this.setStat = setStat; configEntry.SettingChanged += OnSettingChanged; ((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)OnBodyAvailable); } private void OnBodyAvailable() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) setStat(BodyCatalog.GetBodyPrefab(Main.bodyIndex), configEntry.Value); } private void OnSettingChanged(object sender, EventArgs args) { if (((ResourceAvailability)(ref BodyCatalog.availability)).available) { OnBodyAvailable(); } foreach (MagriderController instances in InstanceTracker.GetInstancesList<MagriderController>()) { setStat(((Component)instances).gameObject, configEntry.Value); } } } private static ConfigFile configFile; internal static ConfigEntry<string> prevVersion; private const string WEAPONS = "Weapons"; internal static ResetableConfig<float> blasterDamage; internal static ResetableConfig<float> blasterReload; internal static ResetableConfig<float> cannonDamage; internal static ResetableConfig<float> cannonReload; private const string MAGBURNER = "Magburner"; internal static ResetableConfig<float> magburnerDuration; internal static ResetableConfig<float> magburnerRecharge; internal static ResetableConfig<float> magburnerCost; internal static ResetableConfig<float> jumpDuration; internal static ResetableConfig<float> jumpStrength; internal static ResetableConfig<float> jumpTorque; internal static ConfigVar<float> mouseMult; internal static ConfigVar<bool> tpCameraRotate; internal static ConfigVar<bool> scopeToggle; private const string STATS = "Stats"; internal static ResetableConfig<float> acceleration; internal static ResetableConfig<float> stickStrength; internal static ResetableConfig<float> collisionDamage; internal static ResetableConfig<float> collisionCooldown; internal static ResetableConfig<float> flatArmorPerLevel; private const string HORN = "Horn"; internal static ConfigVar<MagriderHorn.HornName> hornName; internal static ConfigVar<KeyboardShortcut> hornKey; internal static void DoConfig(ConfigFile bepConfigFile) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) configFile = bepConfigFile; prevVersion = configFile.Bind<string>("", "last saved version", "1.2.2", "If this is different from current mod version, overwrite config exluding camera settings"); Utilities.resetConfigs = prevVersion.Value != "1.2.2"; if (Utilities.resetConfigs) { prevVersion.Value = "1.2.2"; } mouseMult = new ConfigVar<float>("Camera", "Mouse mult", 1f, "Multiplier for mouse torque", 0f, 5f); tpCameraRotate = new ConfigVar<bool>("Camera", "Third Person Camera Roll", defaultValue: true, "If the third person camera should be affected by the Magrider's roll"); scopeToggle = new ConfigVar<bool>("Camera", "Scope Toggle", defaultValue: true, "If scope should be a toggle instead of a hold"); hornKey = new ConfigVar<KeyboardShortcut>("Horn", "Horn Key", new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()), "Key to activate horn"); hornName = new ConfigVar<MagriderHorn.HornName>("Horn", "Horn Name", MagriderHorn.HornName.Colossus, "Which horn to use"); hornName.configEntry.SettingChanged += MagriderHorn.OnHornChanged; MagriderController.texthud = new TextHud(configFile, "Magrider Text", new Vector2(600f, 500f), defaultToggle: true, 16); blasterDamage = new ResetableConfig<float>(configFile.Bind<float>("Weapons", "Blaster damage", 6.5f, "Blaster's damage coefficient"), autoroo: false); blasterReload = new ResetableConfig<float>(configFile.Bind<float>("Weapons", "Blaster reload time", 0.66f, "Time to reload a blaster shot in seconds"), autoroo: false); cannonDamage = new ResetableConfig<float>(configFile.Bind<float>("Weapons", "Cannon damage", 11f, "Cannon's damage coefficient"), autoroo: false); cannonReload = new ResetableConfig<float>(configFile.Bind<float>("Weapons", "Cannon reload time", 1.5f, "Time to reload a cannon shot in seconds"), autoroo: false); magburnerDuration = new ResetableConfig<float>(configFile.Bind<float>("Magburner", "Magburner Capacity", 1.5f, "The duration capacity of Magburner in seconds"), autoroo: false); magburnerCost = new ResetableConfig<float>(configFile.Bind<float>("Magburner", "Magburner Activation Cost", 0.3f, "The activation cost of Magburner in seconds"), autoroo: false); magburnerRecharge = new ResetableConfig<float>(configFile.Bind<float>("Magburner", "Magburner Recharge", 10f, "How long it takes to recharge Magburner in seconds"), autoroo: false); jumpDuration = new ResetableConfig<float>(configFile.Bind<float>("Jump", "Jump Duration", 3f, "The duration capacity of Jump in seconds"), autoroo: false); jumpStrength = new ResetableConfig<float>(configFile.Bind<float>("Jump", "Jump Strength", 1f, "Vertical acceleration multiplier of Jump"), autoroo: false); jumpTorque = new ResetableConfig<float>(configFile.Bind<float>("Jump", "Jump Torque", 4f, "Torque multiplier of Jump"), autoroo: false); acceleration = new ResetableConfig<float>(configFile.Bind<float>("Stats", "Acceleration", 21f, "Base acceleration of the Magrider"), autoroo: false); stickStrength = new ResetableConfig<float>(configFile.Bind<float>("Stats", "Stick Strength", 1.5f, "How much the magrider will try to stick to walls"), autoroo: false); collisionDamage = new ResetableConfig<float>(configFile.Bind<float>("Stats", "Collision Damage", 0.7f, "Damage multiplier for collisions against enemies"), autoroo: false); collisionCooldown = new ResetableConfig<float>(configFile.Bind<float>("Stats", "Collision Cooldown", 0.2f, "Repeated collisions against the same enemy will have this cooldown in seconds"), autoroo: false); flatArmorPerLevel = new ResetableConfig<float>(configFile.Bind<float>("Stats", "Flat Armor Per Level", 0.4f, "How much flat armor (same mechanic as Repulsion Plate) to gain per level"), autoroo: false); acceleration.AssignStat(delegate(GameObject a, float b) { CharacterBody component = a.GetComponent<CharacterBody>(); component.acceleration = b; component.MarkAllStatsDirty(); }); jumpStrength.AssignStat(delegate(GameObject a, float b) { a.GetComponent<MagriderThrust>().jumpForce = b; }); jumpTorque.AssignStat(delegate(GameObject a, float b) { a.GetComponent<MagriderThrust>().jumpTorque = b; }); stickStrength.AssignStat(delegate(GameObject a, float b) { a.GetComponent<MagriderHover>().stickStrength = b; }); if (RiskofOptions.enabled) { DoRiskOfOptions(); } } private static void DoRiskOfOptions() { Vector2ScreenOption.LoadAssets("Assets"); MagriderController.texthud.AddRoOVector2Option("Stats"); RiskofOptions.AddOption(collisionDamage.configEntry, 0f, 2f); RiskofOptions.AddOption(collisionCooldown.configEntry, 0f, 0.6f, "{0:0.00}s"); RiskofOptions.AddOption(stickStrength.configEntry, 0f, 10f); RiskofOptions.AddOption(flatArmorPerLevel.configEntry, 0f, 1f); RiskofOptions.AddOption(blasterDamage.configEntry, 0f, 20f); RiskofOptions.AddOption(blasterReload.configEntry, 0f, 3f, "{0:0.00}s"); RiskofOptions.AddOption(cannonDamage.configEntry, 0f, 30f); RiskofOptions.AddOption(cannonReload.configEntry, 0f, 5f, "{0:0.00}s"); RiskofOptions.AddOption(magburnerDuration.configEntry, 0f, 5f, "{0:0.00}s"); RiskofOptions.AddOption(magburnerCost.configEntry, 0f, 5f, "{0:0.00}s"); RiskofOptions.AddOption(magburnerRecharge.configEntry, 0f, 30f, "{0:0.00}s"); RiskofOptions.AddOption(jumpDuration.configEntry, 0f, 10f, "{0:0.00}s", "Magburner"); RiskofOptions.AddOption(jumpStrength.configEntry, 0f, 5f, "{0:f2}", "Magburner"); RiskofOptions.AddOption(jumpTorque.configEntry, 0f, 15f, "{0:f2}", "Magburner"); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CcReloadConfig(ConCommandArgs args) { configFile.Reload(); Debug.Log((object)"Reloaded Magrider config"); } private static void AssignStat<T>(this ConfigVar<T> config, Action<GameObject, T> setStat) { new ConfigStat<T>(config.configEntry, setStat); } } internal class Content : IContentPackProvider { [CompilerGenerated] private sealed class <<LoadStaticContentAsync>g__LoadAsync|9_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; public AsyncOperation request; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<LoadStaticContentAsync>g__LoadAsync|9_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!request.isDone) { args.ReportProgress(request.progress); <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BankCallback <>9__12_0; internal void <LoadSoundbankAsync>b__12_0(uint id, IntPtr ptr, AKRESULT akResult, object cookie) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((int)akResult != 1) { log.error(string.Format("Error loading bank: {0}, Error code: {1}", "MagriderSoundBank.bnk", akResult)); } } } [CompilerGenerated] private sealed class <DoBody>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private AsyncOperationHandle<GameObject> <crosshair>5__2; private AsyncOperationHandle<GameObject> <pod>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoBody>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0006: 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) <crosshair>5__2 = default(AsyncOperationHandle<GameObject>); <pod>5__3 = default(AsyncOperationHandle<GameObject>); <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0032: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <crosshair>5__2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Crosshair.prefab"); <pod>5__3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/RoboCratePod.prefab"); <>2__current = <crosshair>5__2; <>1__state = 1; return true; case 1: { <>1__state = -1; CharacterBody component = contentPack.bodyPrefabs.Find("MagriderBody").GetComponent<CharacterBody>(); component._defaultCrosshairPrefab = <crosshair>5__2.Result; component.preferredPodPrefab = <pod>5__3.Result; component.baseAcceleration = Config.acceleration; return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoProjectiles>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private AsyncOperationHandle<GameObject> <explosion>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoProjectiles>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) <explosion>5__2 = default(AsyncOperationHandle<GameObject>); <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0089: 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) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <explosion>5__2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BleedOnHitAndExplode/BleedOnHitAndExplode_Explosion.prefab"); <>2__current = <explosion>5__2; <>1__state = 1; return true; case 1: { <>1__state = -1; GameObject obj = contentPack.projectilePrefabs.Find("MagCannon"); GameObject val = Utilities.CreatePrefab(<explosion>5__2.Result, "CannonExplosion"); val.GetComponent<EffectComponent>().soundName = "magrider_explosion_medium"; val.GetComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; obj.GetComponent<ProjectileImpactExplosion>().impactEffect = val; GameObject obj2 = contentPack.projectilePrefabs.Find("MagBlaster"); GameObject val2 = Utilities.CreatePrefab(<explosion>5__2.Result, "BlasterExplosion"); val2.GetComponent<EffectComponent>().soundName = "magrider_explosion_small"; val2.GetComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; obj2.GetComponent<ProjectileImpactExplosion>().impactEffect = val2; contentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[2] { new EffectDef(val), new EffectDef(val2) }); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoRiskOfOptions>d__16 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private AssetBundleRequest <sprite>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoRiskOfOptions>d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <sprite>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <sprite>5__2 = assetBundle.LoadAssetAsync<Sprite>("icon"); <>2__current = <sprite>5__2; <>1__state = 1; return true; case 1: { <>1__state = -1; Object asset = <sprite>5__2.asset; RiskofOptions.SetSprite((Sprite)(object)((asset is Sprite) ? asset : null)); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoSkills>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private AsyncOperationHandle<Sprite> <rechargesprite>5__2; private AsyncOperationHandle<Shader> <cloudshader>5__3; private AssetBundleRequest <matphase>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoSkills>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_0006: 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) <rechargesprite>5__2 = default(AsyncOperationHandle<Sprite>); <cloudshader>5__3 = default(AsyncOperationHandle<Shader>); <matphase>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_0133: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <rechargesprite>5__2 = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Cleanse/texWaterPackIcon.png"); <cloudshader>5__3 = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGIntersectionCloudRemap.shader"); <matphase>5__4 = assetBundle.LoadAssetAsync<Material>("matPhaseJump-Stubbed"); <>2__current = <rechargesprite>5__2; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = <cloudshader>5__3; <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = <matphase>5__4; <>1__state = 3; return true; case 3: <>1__state = -1; contentPack.skillDefs.Find("MagRechargeDef").icon = <rechargesprite>5__2.Result; cannonDef = contentPack.skillDefs.Find("MagCannonDef"); blasterDef = contentPack.skillDefs.Find("MagBlasterDef"); magburnerDef = contentPack.skillDefs.Find("MagBurnerDef"); ((Material)<matphase>5__4.asset).shader = <cloudshader>5__3.Result; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FinalizeAsync>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GetContentPackAsyncArgs args; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; ContentPack.Copy(contentPack, args.output); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; private AssetBundleCreateRequest <assetBundleRequest>5__2; private AssetBundleRequest <serializableContentPack>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <assetBundleRequest>5__2 = null; <serializableContentPack>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <assetBundleRequest>5__2 = AssetBundle.LoadFromFileAsync(Path.Combine(directory, "magriderassets")); <>2__current = <LoadStaticContentAsync>g__LoadAsync|9_0((AsyncOperation)(object)<assetBundleRequest>5__2, args); <>1__state = 1; return true; case 1: <>1__state = -1; assetBundle = <assetBundleRequest>5__2.assetBundle; <serializableContentPack>5__3 = assetBundle.LoadAssetAsync<SerializableContentPack>("Magrider ContentPack"); <>2__current = <LoadStaticContentAsync>g__LoadAsync|9_0((AsyncOperation)(object)<serializableContentPack>5__3, args); <>1__state = 2; return true; case 2: { <>1__state = -1; Object asset = <serializableContentPack>5__3.asset; contentPack = ((SerializableContentPack)((asset is SerializableContentPack) ? asset : null)).CreateContentPack(); LoadSoundbankAsync(); <>2__current = DoBody(); <>1__state = 3; return true; } case 3: <>1__state = -1; <>2__current = DoProjectiles(); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = DoSkills(); <>1__state = 5; return true; case 5: <>1__state = -1; if (RiskofOptions.enabled) { <>2__current = DoRiskOfOptions(); <>1__state = 6; return true; } break; case 6: <>1__state = -1; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static AssetBundle assetBundle; internal static ContentPack contentPack; internal static SkillDef cannonDef; internal static SkillDef blasterDef; internal static SkillDef magburnerDef; public string identifier => "dolso.magrdier"; private static string directory => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Assets"); [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__9))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__9(0) { args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__10))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__10(0) { args = args }; } [IteratorStateMachine(typeof(<FinalizeAsync>d__11))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__11(0); } internal static void LoadSoundbankAsync() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0043: 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_0033: Expected O, but got Unknown AKRESULT val = AkSoundEngine.AddBasePath(directory); if ((int)val == 1) { object obj = <>c.<>9__12_0; if (obj == null) { BankCallback val2 = delegate(uint id, IntPtr ptr, AKRESULT akResult, object cookie) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((int)akResult != 1) { log.error(string.Format("Error loading bank: {0}, Error code: {1}", "MagriderSoundBank.bnk", akResult)); } }; <>c.<>9__12_0 = val2; obj = (object)val2; } AkBankManager.LoadBankAsync("MagriderSoundBank.bnk", (BankCallback)obj); } else { log.error($"Error adding base path: {directory}, Error code: {val}"); } } [IteratorStateMachine(typeof(<DoBody>d__13))] private static IEnumerator DoBody() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoBody>d__13(0); } [IteratorStateMachine(typeof(<DoProjectiles>d__14))] private static IEnumerator DoProjectiles() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoProjectiles>d__14(0); } [IteratorStateMachine(typeof(<DoSkills>d__15))] private static IEnumerator DoSkills() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoSkills>d__15(0); } [IteratorStateMachine(typeof(<DoRiskOfOptions>d__16))] private static IEnumerator DoRiskOfOptions() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoRiskOfOptions>d__16(0); } [IteratorStateMachine(typeof(<<LoadStaticContentAsync>g__LoadAsync|9_0>d))] [CompilerGenerated] internal static IEnumerator <LoadStaticContentAsync>g__LoadAsync|9_0(AsyncOperation request, LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<LoadStaticContentAsync>g__LoadAsync|9_0>d(0) { request = request, args = args }; } } internal static class Hooks { [Hook(typeof(HealthComponent), "TakeDamageProcess")] private static void AddArmorPLates_IL_HealthComponent_TakeDamage(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0084: 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) ILCursor val = new ILCursor(il); if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "armorPlate") }) || !val.TryGotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Mathf>(x, "Max") })) { val.LogErrorCaller("failed to il add armor plates"); return; } int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HealthComponent, float>>((Func<HealthComponent, float>)func); val.Emit(OpCodes.Sub); static float func(HealthComponent healthComponent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (healthComponent.body.bodyIndex == Main.bodyIndex) { return 2f + healthComponent.body.level * (float)Config.flatArmorPerLevel; } return 0f; } } [Hook(typeof(GenericSkill), "CanApplyAmmoPack")] private static bool ApplyAmmoPack_On_GenericSkill_CanApplyAmmoPack(Func<GenericSkill, bool> orig,