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 R2InventoryArtifact v1.0.1
LookingGlass.dll
Decompiled 3 hours 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.Collections.ObjectModel; 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 System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates.Missions.AccessCodes.Node; using HG; using HarmonyLib; using ItemQualities; using LeTai.Asset.TranslucentImage; using LookingGlass.AutoSortItems; using LookingGlass.Base; using LookingGlass.BuffDescriptions; using LookingGlass.BuffTimers; using LookingGlass.CommandItemCount; using LookingGlass.CommandWindowBlur; using LookingGlass.DPSMeterStuff; using LookingGlass.EquipTimerFix; using LookingGlass.EscapeToCloseMenu; using LookingGlass.HiddenItems; using LookingGlass.HidePickupNotifs; using LookingGlass.ItemCounters; using LookingGlass.ItemStatsNameSpace; using LookingGlass.LookingGlassLanguage; using LookingGlass.PickupNotifsDuration; using LookingGlass.ResizeCommandWindow; using LookingGlass.StatsDisplay; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using Rewired; using RiskOfOptions; using RiskOfOptions.Components.Options; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using RoR2.Items; using RoR2.Networking; using RoR2.Skills; using RoR2.UI; using TMPro; using Unity.Jobs; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("DropPod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.15.2.0")] [assembly: AssemblyInformationalVersion("1.15.2+611986c06836cf0eba0ae1329a7799179c0be1a8")] [assembly: AssemblyProduct("LookingGlass")] [assembly: AssemblyTitle("LookingGlass")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Wet-Boys/LookingGlass")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LookingGlass { [BepInPlugin("droppod.lookingglass", "LookingGlass", "1.15.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BasePlugin : BaseUnityPlugin { internal static BasePlugin instance; internal AllyCardInfo allyCardStuff; internal AutoSortItemsClass autoSortItems; internal NoWindowBlur noWindowBlur; internal ButtonsToCloseMenu buttonsToCloseMenu; internal HidePickupNotifications hidePickupNotifications; internal ItemStats itemStats; internal CommandItemCountClass commandItemCountClass; internal ModifyCommandWindow resizeCommandWindowClass; internal StatsDisplayClass statsDisplayClass; internal DPSMeter dpsMeter; internal PortalTracker portalTracking; internal ItemCounter itemCounter; internal BuffTimersClass buffTimers; internal CooldownFixer equipFixer; internal UnHiddenItems unHiddenItems; internal BuffDescriptionsClass buffDescriptions; internal PickupNotifDurationClass pickupNotifDurationClass; public static byte[] logo; public static Sprite logo2; internal bool ItemQualitiesLoaded; public void Awake() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); instance = this; try { string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icons"); int num = Random.Range(0, Directory.GetFiles(path).Length); int num2 = 0; string[] files = Directory.GetFiles(path); foreach (string path2 in files) { if (num2 == num) { logo = File.ReadAllBytes(path2); } num2++; } Texture2D val = LoadTexture(logo, 256, 256); logo2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 100f, 1u, (SpriteMeshType)1, new Vector4(0f, 0f, 0f, 0f), true); ModSettingsManager.SetModIcon(logo2); } catch (Exception) { } ItemQualitiesLoaded = Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); statsDisplayClass = new StatsDisplayClass(); autoSortItems = new AutoSortItemsClass(); itemStats = new ItemStats(); noWindowBlur = new NoWindowBlur(); buttonsToCloseMenu = new ButtonsToCloseMenu(); commandItemCountClass = new CommandItemCountClass(); resizeCommandWindowClass = new ModifyCommandWindow(); itemCounter = new ItemCounter(); buffTimers = new BuffTimersClass(); portalTracking = new PortalTracker(); equipFixer = new CooldownFixer(); buffDescriptions = new BuffDescriptionsClass(); allyCardStuff = new AllyCardInfo(); hidePickupNotifications = new HidePickupNotifications(); pickupNotifDurationClass = new PickupNotifDurationClass(); unHiddenItems = new UnHiddenItems(); dpsMeter = new DPSMeter(); statsDisplayClass.CheckForOldDefaultSettingsThatNeedToBeUpdated(); ModSettingsManager.SetModDescription("Stat info, item stacking info, skill and equipment cooldown info, and much more ui related things."); } private void FixedUpdate() { dpsMeter.FixedUpdate(); LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); StatsDisplayClass.cachedUserBody = (Object.op_Implicit((Object)(object)((firstLocalUser != null) ? firstLocalUser.cameraRigController : null)) ? LocalUserManager.GetFirstLocalUser().cameraRigController.targetBody : null); statsDisplayClass.FixedUpdate(); } public static Texture2D LoadTexture(byte[] bytes, int width, int height) { //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_0011: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown Texture2D val = new Texture2D(width, height, (TextureFormat)5, false, false); ImageConversion.LoadImage(val, bytes); ((Texture)val).filterMode = (FilterMode)0; return val; } } public static class LGColorDictionary { public enum ColorSource { Health, Shield, Barrier, Armor, Damage, Crit, AttackSpeed, Bleed, MovementSpeed, Jumps, Cooldown, AllStats, Gold, Downside, Void, WorldEvent } public static string GetColor(ColorSource colorSource) { if (colorSource == ColorSource.Health) { return "00FF00"; } return "FF00FF"; } } internal class AllyCardInfo : BaseThing { public static ConfigEntry<bool> allyInfoConfig; public AllyCardInfo() { Setup(); } public void Setup() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_006e: 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_00d8: Unknown result type (might be due to invalid IL or missing references) allyInfoConfig = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Misc", "Ally Info", true, "Hovering over ally cards shows info if they are a Drone."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allyInfoConfig, new CheckBoxConfig { restartRequired = false })); MethodInfo? method = typeof(AllyCardController).GetMethod("UpdateInfo", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(AllyCardInfo).GetMethod("AddAllyTooltips", BindingFlags.Instance | BindingFlags.Public); new Hook((MethodBase)method, method2, (object)this); MethodInfo? method3 = typeof(AllyCardController).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(AllyCardInfo).GetMethod("MakeTargetable", BindingFlags.Instance | BindingFlags.Public); new Hook((MethodBase)method3, method2, (object)this); MethodInfo? method4 = typeof(AllyCardManager).GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(AllyCardInfo).GetMethod("AddRaycaster", BindingFlags.Instance | BindingFlags.Public); new Hook((MethodBase)method4, method2, (object)this); } public void AddRaycaster(Action<AllyCardManager> orig, AllyCardManager self) { orig(self); if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<GraphicRaycaster>())) { ((Component)self).gameObject.AddComponent<GraphicRaycaster>(); } } public void MakeTargetable(Action<AllyCardController> orig, AllyCardController self) { orig(self); Image val = default(Image); if (((Component)self).TryGetComponent<Image>(ref val)) { ((Graphic)val).raycastTarget = true; } } public void AddAllyTooltips(Action<AllyCardController> orig, AllyCardController self) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Invalid comparison between Unknown and I4 //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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) orig(self); if (!allyInfoConfig.Value) { return; } TooltipProvider val = ((Component)self).GetComponent<TooltipProvider>(); if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)self).gameObject.AddComponent<TooltipProvider>(); } if (Object.op_Implicit((Object)(object)self.sourceMaster) && Object.op_Implicit((Object)(object)self.cachedSourceCharacterBody)) { TooltipContent val2 = default(TooltipContent); val2.titleToken = self.cachedSourceCharacterBody.baseNameToken; val2.titleColor = self.cachedSourceCharacterBody.bodyColor; if (val2.titleColor == Color.clear) { val2.titleColor = new Color(0.4902f, 0.8784f, 0.2588f, 1f); } DroneIndex droneIndexFromBodyIndex = DroneCatalog.GetDroneIndexFromBodyIndex(self.cachedSourceCharacterBody.bodyIndex); if ((int)droneIndexFromBodyIndex != -1) { val2.bodyToken = DroneCatalog.GetDroneDef(droneIndexFromBodyIndex).skillDescriptionToken; } ((Behaviour)val).enabled = true; val.SetContent(val2); } else { ((Behaviour)val).enabled = false; } } public void SetupRiskOfOptions() { } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } internal class PortalTracker : BaseThing { public bool _goldPortal; public bool _greenPortal; public bool _voidPortal; public bool _acPortal; public bool _artifactPortal; public bool _accessNode; public bool shopPortal { get { if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { return TeleporterInteraction.instance.shouldAttemptToSpawnShopPortal; } return false; } } public bool goldPortal { get { if (!_goldPortal) { if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { return TeleporterInteraction.instance.shouldAttemptToSpawnGoldshoresPortal; } return false; } return true; } } public bool msPortal { get { if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { return TeleporterInteraction.instance.shouldAttemptToSpawnMSPortal; } return false; } } public PortalTracker() { Setup(); } public void Setup() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) MethodInfo? method = typeof(Stage).GetMethod("PreStartClient", BindingFlags.Instance | BindingFlags.Public); MethodInfo method2 = typeof(PortalTracker).GetMethod("StageStart", BindingFlags.Instance | BindingFlags.NonPublic); new Hook((MethodBase)method, method2, (object)this); MethodInfo? method3 = typeof(PortalSpawner).GetMethod("OnWillSpawnUpdated", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(PortalTracker).GetMethod("TrackPortalSpawner", BindingFlags.Instance | BindingFlags.NonPublic); new Hook((MethodBase)method3, method2, (object)this); new Hook((MethodBase)typeof(PortalDialerPerformActionState).GetMethod("OnEnter", BindingFlags.Instance | BindingFlags.Public), typeof(PortalTracker).GetMethod("ArtifactPortal", BindingFlags.Instance | BindingFlags.Public), (object)this); new Hook((MethodBase)typeof(NodesOnAndReady).GetMethod("OnEnter", BindingFlags.Instance | BindingFlags.Public), typeof(PortalTracker).GetMethod("AccessNode", BindingFlags.Instance | BindingFlags.Public), (object)this); } public void ArtifactPortal(Action<PortalDialerPerformActionState> orig, PortalDialerPerformActionState self) { orig(self); _artifactPortal = true; } public void AccessNode(Action<NodesOnAndReady> orig, NodesOnAndReady self) { orig(self); _accessNode = true; } public void SetupRiskOfOptions() { } public string ReturnAllAvailablePortals() { if (!Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { return "<style=cStack>None</style>"; } string text = string.Empty; int num = 0; if (shopPortal) { num++; text += "<style=cLunarObjective>Bazaar </style>"; } if (goldPortal) { num++; text += "<style=cIsDamage>Gold </style>"; } if (_accessNode) { num++; text += "<style=cIsHealth>Node </style>"; } if (_acPortal) { num++; text += "<style=cIsUtility>Encrypted </style>"; } if (_greenPortal) { num++; text += "<style=cIsHealing>Storm </style>"; } if (_voidPortal) { num++; text += "<style=cIsVoid>Void </style>"; } if (msPortal) { num++; text += "<style=cIsUtility>Celestial </style>"; } if (_artifactPortal) { num++; text += "<style=cIsDeath>Artifact </style>"; } if (num == 0) { return "<style=cStack>None</style>"; } return $"<size={(int)(7f / (7f + (float)num) * 100f)}%>{text}</size>"; } private void TrackPortalSpawner(Action<PortalSpawner, bool> orig, PortalSpawner self, bool newValue) { if (newValue) { if (self.previewChildName == "VoidPortalIndicator") { _voidPortal = true; } else if (self.previewChildName == "StormPortalIndicator") { _greenPortal = true; } else if (self.previewChildName == "AccessCodesSymbol") { _acPortal = true; } else if (self.previewChildName == "CEPortalIndicator") { _acPortal = true; } else if (self.previewChildName == "GoldshoresPortalIndicator") { _goldPortal = true; } } orig(self, newValue); } private void StageStart(Action<Stage> orig, Stage self) { orig(self); _goldPortal = false; _greenPortal = false; _voidPortal = false; _acPortal = false; _artifactPortal = false; _accessNode = false; } } internal class Utils { public static float CalculateChanceWithNullableMaster(float baseChance, CharacterMaster master) { if (Object.op_Implicit((Object)(object)master)) { return CalculateChanceWithLuck(baseChance, master.luck); } return baseChance; } public static float CalculateChanceWithLuck(float baseChance, float luckIn) { if (ItemStats.capChancePercentage.Value) { baseChance = Mathf.Min(baseChance, 1f); } float num = Mathf.Floor(baseChance); float num2 = baseChance % 1f; int num3 = Mathf.CeilToInt(luckIn); if (num3 > 0) { return num + (1f - Mathf.Pow(1f - num2, (float)(num3 + 1))); } if (num3 < 0) { return num + Mathf.Pow(num2, (float)(Mathf.Abs(num3) + 1)); } return baseChance; } public static float GetLuckFromCachedUserBody(CharacterBody cachedUserBody) { if (Object.op_Implicit((Object)(object)cachedUserBody) && Object.op_Implicit((Object)(object)cachedUserBody.master)) { return cachedUserBody.master.luck; } return 0f; } public static float GetExponentialRechargeTime(float baseCooldown, float extraPercent, int count) { return baseCooldown * Mathf.Pow(1f - extraPercent, (float)(count - 1)); } public static float GetExponentialStacking(float basePercent, float extraPercent, int count) { return 1f - (1f - basePercent) * Mathf.Pow(1f - extraPercent, (float)(count - 1)); } public static float GetHyperbolicStacking(float basePercent, float extraPercent, int count) { return 1f - 1f / (1f + basePercent + extraPercent * (float)(count - 1)); } public static float GetBandolierStacking(int count) { return 1f - 1f / Mathf.Pow(1f + (float)count, 0.33f); } public static string DictToString<TKey, TValue>(Dictionary<TKey, TValue> dict) { string text = "{\n"; foreach (KeyValuePair<TKey, TValue> item in dict) { text += $"[{item.Key}] = {item.Value}\n"; } return text + "}"; } } public static class PluginInfo { public const string PLUGIN_GUID = "droppod.lookingglass"; public const string PLUGIN_NAME = "LookingGlass"; public const string PLUGIN_VERSION = "1.15.2"; } } namespace LookingGlass.StatsDisplay { public class SliderWithText : MonoBehaviour { public Slider slider; public TMP_InputField inputField; public string formatString = "f0"; public UnityEvent<float> onValueChanged = new UnityEvent<float>(); private float _value; public float Value { get { return _value; } set { if (_value != value) { _value = value; onValueChanged.Invoke(_value); } UpdateControls(); } } public void Setup(Slider slider, TMP_InputField inputField, float min, float max) { this.slider = slider; this.inputField = inputField; ((Behaviour)inputField).enabled = true; slider.minValue = min; slider.maxValue = max; ((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); } private void UpdateControls() { slider.value = Value; inputField.text = Value.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 StatsDisplayClass : BaseThing { public enum Colors { Logbook, CategoryChest, None } public enum StatsDisplayEnum { Off, Same_On_Both, Different_On_Tab, Only_Show_On_Main, Only_Show_On_Tab, Show_Only_Stats_On_Tab } public enum StatDisplayPreset { Set, LookingGlass, Simpler, Extra, Extra_For_OnlyStats, Minimal, Old } [StructLayout(LayoutKind.Sequential, Size = 1)] private struct RegexJob : IJob { internal static string output = ""; public void Execute() { try { output = GenerateStatsText(); } catch (Exception data) { Log.Error(data); } } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__36_0; internal void <SetupRiskOfOptions>b__36_0() { CreatePositionWindow(detachedPosition); } } [CompilerGenerated] private sealed class <FixScaleAfterFrame>d__49 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StatsDisplayClass <>4__this; public int nlines; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FixScaleAfterFrame>d__49(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown int num = <>1__state; StatsDisplayClass statsDisplayClass = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: { <>1__state = -1; float preferredHeight = (statsDisplayOverrideHeight.Value ? (((TMP_Text)statsDisplayClass.textComponent).fontSize * (float)(nlines + 1)) : ((TMP_Text)statsDisplayClass.textComponent).preferredHeight); statsDisplayClass.layoutElement.preferredHeight = preferredHeight; 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 <SetLastDelayed>d__50 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StatsDisplayClass <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetLastDelayed>d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; StatsDisplayClass statsDisplayClass = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; statsDisplayClass.statTracker.SetAsLastSibling(); 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(); } } public static ConfigEntry<StatDisplayPreset> statStringPresets; public static ConfigEntry<bool> movePurchaseText; public static ConfigEntry<bool> checkIfOldDefaultSettings; public static ConfigEntry<StatsDisplayEnum> statsDisplay; public static ConfigEntry<string> secondaryStatsDisplayString; public static ConfigEntry<string> statsDisplayString; public static ConfigEntry<float> statsDisplaySize; public static ConfigEntry<float> statsDisplayUpdateInterval; public static ConfigEntry<bool> builtInColors; public static ConfigEntry<bool> statsDisplayOverrideHeight; public static ConfigEntry<int> statsDisplayOverrideHeightValue; public static ConfigEntry<int> floatPrecision; public static ConfigEntry<bool> statsDisplayAttached; public static ConfigEntry<Vector2> detachedPosition; public static Dictionary<string, Func<CharacterBody, string>> statDictionary = new Dictionary<string, Func<CharacterBody, string>>(); internal static CharacterBody cachedUserBody = null; private Transform statTracker; private TextMeshProUGUI textComponent; private GameObject textComponentGameObject; private LayoutElement layoutElement; private Image cachedImage; private static Hook overrideHook; private static Hook overrideHook2; public static bool scoreBoardOpen; public static bool deathScreen; private static readonly Regex statsRegex = new Regex("(?<!\\\\)\\[(\\w+)\\]", RegexOptions.Compiled); private static JobHandle regexHandle; private float timer; private const string syntaxList = "\n\n damage \n attackSpeed, attackSpeedPercent \n crit, critWithLuck, critMultiplier\n bleedChance, bleedChanceWithLuck\n maxHealth, maxShield, maxBarrier \n hpAddPercent, healthAddPercent, shieldAddPercent\n effectiveHealth, effectiveMaxHealth\n shieldFraction, barrierDecayRate\n healthPercentage\n regen, regenHp, regenRaw\n armor, armorDamageReduction\n curseHealthReduction \n hasOSP \n damagePercent, damagePercentWithWatch\n maxHpPercent, maxHealthStat, maxShieldStat\n speed, speedPercent, speedPercentSprintAffected\n velocity, acceleration \n availableJumps, maxJumps\n jumpPower, maxJumpHeight\n level, experience \n luck \n mountainShrines \n portals, shopPortal, goldPortal, msPortal, voidPortal, greenPortal\n difficultyCoefficient, stage\n ping\n\n killCount, killCountRun \n dps, percentDps \n combo, maxComboThisRun, maxCombo\n killCombo, maxKillComboThisRun, maxKillCombo\n remainingComboDuration\n\n teddyBearBlockChance, saferSpacesCD \n instaKillChance \n\n lvl1_damage, lvl1_maxHealth"; private bool isRiskUI; private float originalFontSize = -1f; private VerticalLayoutGroup layoutGroup; public StatsDisplayClass() { Setup(); SetupRiskOfOptions(); } public void Setup() { //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) statsDisplay = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<StatsDisplayEnum>("Stats Display", "Stats Display", StatsDisplayEnum.Different_On_Tab, "Enables Stats Display in various cases.\n\n-Same stats regardless of scoreboard\n\n-Tab stats on scoreboard for 2 different stat displays\n\n-Only show when Scoreboard is open\n\n-Only show when scoreboard is open and hide everything else when it is open. (In case other mods decide to use that space, to avoid the clutter)"); statsDisplay.SettingChanged += Display_SettingChanged; statsDisplayString = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<string>("Stats Display", "Stats Display String", "<margin-left=0.6em><size=115%>Stats</size>\nDamage: [damage]\nAttack Speed: [attackSpeed]\nCrit Chance: [critWithLuck]\nRegen: [regen]\nArmor: [armor] | [armorDamageReduction]\nSpeed: [speed]\nJumps: [availableJumps] / [maxJumps]\nKills: [killCount]\nDPS: [dps]\nCombo: [combo]\n</margin>", "String for the stats display. You can customize this with Unity Rich Text if you want, see \n https://docs.unity3d.com/Packages/[email protected]/manual/RichText.html for more info. \nAvailable syntax for the [] stuff is:\n\n damage \n attackSpeed, attackSpeedPercent \n crit, critWithLuck, critMultiplier\n bleedChance, bleedChanceWithLuck\n maxHealth, maxShield, maxBarrier \n hpAddPercent, healthAddPercent, shieldAddPercent\n effectiveHealth, effectiveMaxHealth\n shieldFraction, barrierDecayRate\n healthPercentage\n regen, regenHp, regenRaw\n armor, armorDamageReduction\n curseHealthReduction \n hasOSP \n damagePercent, damagePercentWithWatch\n maxHpPercent, maxHealthStat, maxShieldStat\n speed, speedPercent, speedPercentSprintAffected\n velocity, acceleration \n availableJumps, maxJumps\n jumpPower, maxJumpHeight\n level, experience \n luck \n mountainShrines \n portals, shopPortal, goldPortal, msPortal, voidPortal, greenPortal\n difficultyCoefficient, stage\n ping\n\n killCount, killCountRun \n dps, percentDps \n combo, maxComboThisRun, maxCombo\n killCombo, maxKillComboThisRun, maxKillCombo\n remainingComboDuration\n\n teddyBearBlockChance, saferSpacesCD \n instaKillChance \n\n lvl1_damage, lvl1_maxHealth"); statsDisplaySize = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Stats Display", "Stats Display font size", -1f, "General font size of the stats display menu.\n\nIf set to -1, it will be sized relative to the Objective Header and Objectives. 13.5 on the default hud."); statsDisplayUpdateInterval = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Stats Display", "Stats Display update interval", 0.25f, "The interval at which stats display updates, in seconds. Lower values will increase responsiveness, but may potentially affect performance for large texts\n\nValues below 0.2 are not recommended for normal play for performance reasons.\n\n"); statsDisplayUpdateInterval.SettingChanged += Display_SettingChanged; builtInColors = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Use default colors", true, "Uses the default styling for stats display syntax items."); builtInColors.SettingChanged += BuiltInColors_SettingChanged; statsDisplayOverrideHeight = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Override Stats Display Height", false, "Sets a user-specified height for Stats Display (may be necessary if you get particularly creative with formatting)"); statsDisplayOverrideHeightValue = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<int>("Stats Display", "Stats Display Height Value", 7, "Height, in lines of full-size text, for the Stats Display panel"); floatPrecision = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<int>("Stats Display", "StatsDisplay Float Precision", 2, "How many decimal points will be used in floating point values"); floatPrecision.SettingChanged += BuiltInColors_SettingChanged; secondaryStatsDisplayString = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<string>("Stats Display", "Secondary Stats Display String", "<margin-left=0.6em><size=115%>Stats</size>\nDamage: [damage]\nAttack Speed: [attackSpeed]\nCrit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nRegen: [regen]\nArmor: [armor] | [armorDamageReduction]\nSpeed: [speed]\nJumps: [availableJumps] / [maxJumps]\nTotal Kills: [killCountRun]\nMax Combo: [maxComboThisRun]\nMountain Shrines: [mountainShrines]\nPortals: [portals] \n</margin>", "Secondary string for the stats display. You can customize this with Unity Rich Text if you want, see \n https://docs.unity3d.com/Packages/[email protected]/manual/RichText.html for more info. \nAvailable syntax for the [] stuff is: \n\n damage \n attackSpeed, attackSpeedPercent \n crit, critWithLuck, critMultiplier\n bleedChance, bleedChanceWithLuck\n maxHealth, maxShield, maxBarrier \n hpAddPercent, healthAddPercent, shieldAddPercent\n effectiveHealth, effectiveMaxHealth\n shieldFraction, barrierDecayRate\n healthPercentage\n regen, regenHp, regenRaw\n armor, armorDamageReduction\n curseHealthReduction \n hasOSP \n damagePercent, damagePercentWithWatch\n maxHpPercent, maxHealthStat, maxShieldStat\n speed, speedPercent, speedPercentSprintAffected\n velocity, acceleration \n availableJumps, maxJumps\n jumpPower, maxJumpHeight\n level, experience \n luck \n mountainShrines \n portals, shopPortal, goldPortal, msPortal, voidPortal, greenPortal\n difficultyCoefficient, stage\n ping\n\n killCount, killCountRun \n dps, percentDps \n combo, maxComboThisRun, maxCombo\n killCombo, maxKillComboThisRun, maxKillCombo\n remainingComboDuration\n\n teddyBearBlockChance, saferSpacesCD \n instaKillChance \n\n lvl1_damage, lvl1_maxHealth"); StatsDisplayDefinitions.SetupDefs(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1810f, 1015f); statsDisplayAttached = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Attach To Objective Panel", true, "If enabled, will be attached to below the objective panel, otherwise position can be configured"); detachedPosition = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<Vector2>("Stats Display", "Stats Display Position", val, $"Position of detached Stats Display.\n[Default: {val.x:f0}, {val.y:f0}]"); statsDisplayAttached.SettingChanged += Display_SettingChanged; detachedPosition.SettingChanged += DetachedPosition_SettingChanged; new Hook((MethodBase)typeof(ScoreboardController).GetMethod("OnEnable", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)new Action<Action<ScoreboardController>, ScoreboardController>(OnEnable)); new Hook((MethodBase)typeof(ScoreboardController).GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)new Action<Action<ScoreboardController>, ScoreboardController>(OnDisable)); statStringPresets = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<StatDisplayPreset>("Stats Display", "Preset", StatDisplayPreset.Set, "Override current Stat Display settings with a premade preset.Further changes can made from there.\n\nExtra: More stats on Tab\n\nSimpler: Dont include DPS, Combo\n\nMinimal: DPS + Jump, Few stats on Tab for mathing or remembering.\n\n"); statStringPresets.SettingChanged += ApplyPresets; movePurchaseText = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats Display", "Move Purchase Text", true, "Move purchase text further to the left to avoid clipping with larger Stat Displays, Evolution Inventory, Objectives, etc.."); movePurchaseText.SettingChanged += MovePurchase; checkIfOldDefaultSettings = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Stats", "Check For Old Default Settings v2", true, "Override the stat display with the updated one, if you were using the default one prior to updating.\nNot meant as a config just needs to be tracked."); if (!checkIfOldDefaultSettings.Value) { ApplyPresets(null, null); } } private bool SecondaryDisabled() { if (statsDisplay.Value != StatsDisplayEnum.Same_On_Both) { return statsDisplay.Value == StatsDisplayEnum.Only_Show_On_Main; } return true; } private bool PrimaryDisabled() { return statsDisplay.Value >= StatsDisplayEnum.Only_Show_On_Tab; } public void SetupRiskOfOptions() { //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_0016: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0073: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_007d: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c0: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0106: 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_0117: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //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: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01be: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_01f2: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)statsDisplay, new ChoiceConfig { restartRequired = false })); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)statStringPresets, false)); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(statsDisplayString, new InputFieldConfig { name = "Main Display String", restartRequired = false, lineType = (LineType)2, submitOn = (SubmitEnum)6, richText = false, checkIfDisabled = new IsDisabledDelegate(PrimaryDisabled) })); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(secondaryStatsDisplayString, new InputFieldConfig { name = "Tab Display String", restartRequired = false, lineType = (LineType)2, submitOn = (SubmitEnum)6, richText = false, checkIfDisabled = new IsDisabledDelegate(SecondaryDisabled) })); ModSettingsManager.AddOption((BaseOption)new SliderOption(statsDisplaySize, new SliderConfig { restartRequired = false, min = -1f, max = 24f, FormatString = "{0:F1}" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(movePurchaseText, new CheckBoxConfig { restartRequired = false })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(builtInColors, new CheckBoxConfig { restartRequired = false })); ModSettingsManager.AddOption((BaseOption)new SliderOption(statsDisplayUpdateInterval, new SliderConfig { name = "Update interval", restartRequired = false, min = 0.01f, max = 1f, FormatString = "{0:F2}s" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(statsDisplayOverrideHeight, new CheckBoxConfig { restartRequired = false })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(statsDisplayOverrideHeightValue, new IntSliderConfig { restartRequired = false, min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(floatPrecision, new IntSliderConfig { name = "Float precision", restartRequired = false, min = 0, max = 5 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(statsDisplayAttached, new CheckBoxConfig { restartRequired = false })); string key = ((ConfigEntryBase)detachedPosition).Definition.Key; string section = ((ConfigEntryBase)detachedPosition).Definition.Section; string description = ((ConfigEntryBase)detachedPosition).Description.Description; object obj = <>c.<>9__36_0; if (obj == null) { UnityAction val = delegate { CreatePositionWindow(detachedPosition); }; <>c.<>9__36_0 = val; obj = (object)val; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption(key, section, description, "Open", (UnityAction)obj)); } public void CheckForOldDefaultSettingsThatNeedToBeUpdated() { if (checkIfOldDefaultSettings.Value) { bool flag = false; bool flag2 = false; Debug.Log((object)"Checking for old"); string text = "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [damage]\nCrit Chance: [critWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nDPS: [dps]\nCombo: [currentCombatDamage]\nCombo Timer: [remainingComboDuration]\nMax Combo: [maxCombo]"; string text2 = "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [baseDamage]\nCrit Chance: [critWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nDPS: [dps]\nCombo: [currentCombatDamage]\nCombo Timer: [remainingComboDuration]\nMax Combo: [maxCombo]"; string text3 = "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [damage]\nCrit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nMax Combo: [maxCombo]\n<size=120%>Portals:</size> \n<size=50%>Gold:[goldPortal] Shop:[shopPortal] Celestial:[msPortal] Void:[voidPortal]</size>"; string text4 = "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [baseDamage]\nCrit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nMax Combo: [maxCombo]\n<size=120%>Portals:</size> \n<size=50%>Gold:[goldPortal] Shop:[shopPortal] Celestial:[msPortal] Void:[voidPortal]</size>"; if (statsDisplayString.Value == text || statsDisplayString.Value == text2) { flag = true; } if (secondaryStatsDisplayString.Value == text3 || secondaryStatsDisplayString.Value == text4) { flag2 = true; } if (flag) { Debug.Log((object)"Old1 detected"); statsDisplayString.Value = (string)((ConfigEntryBase)statsDisplayString).DefaultValue; } if (flag2) { Debug.Log((object)"Old2 detected"); secondaryStatsDisplayString.Value = (string)((ConfigEntryBase)secondaryStatsDisplayString).DefaultValue; } checkIfOldDefaultSettings.Value = false; } } private void ApplyPresets(object sender, EventArgs e) { if (statStringPresets.Value != 0) { string text = statsDisplayString.Value; string text2 = secondaryStatsDisplayString.Value; switch (statStringPresets.Value) { case StatDisplayPreset.LookingGlass: text = (string)((ConfigEntryBase)statsDisplayString).DefaultValue; text2 = (string)((ConfigEntryBase)secondaryStatsDisplayString).DefaultValue; break; case StatDisplayPreset.Extra: text = (string)((ConfigEntryBase)statsDisplayString).DefaultValue; text2 = "<margin-left=0.6em><size=115%>Stats</size>\nDamage: [damage] | [damagePercentWithWatch]\nAttack Speed: [attackSpeedPercent]\nCrit Stats: [critWithLuck] | [critMultiplier]\nBleed Chance: [bleedChanceWithLuck]\nRegen: [regenHp]\nArmor: [armor] | [armorDamageReduction]\nMax Hp: [maxHpPercent]\nEhp: [effectiveHealth]\nSpeed: [speed] | [speedPercent]\nJumps: [availableJumps] / [maxJumps]\nLuck: [luck]\nTotal Kills: [killCountRun]\nPing: [ping]\nPortals: [portals] \n</margin>"; break; case StatDisplayPreset.Extra_For_OnlyStats: text = string.Empty; text2 = "<size=16px><line-height=7.5px>\n<align=center>Stats:</align>\r\n\r\n\r\n</line-height></size><margin-left=0.6em><line-height=110%>Damage: [damage] | [damagePercentWithWatch]\nAttack Speed: [attackSpeedPercent]\nCrit Stats: [critWithLuck] | [critMultiplier]\nBleed Chance: [bleedChanceWithLuck]\nRegen: [regenHp]\nArmor: [armor] | [armorDamageReduction]\nMax Hp: [maxHpPercent]\nEhp: [effectiveHealth]\nSpeed: [speed] | [speedPercent]\nJumps: [availableJumps] / [maxJumps]\nLuck: [luck]\nKills: [killCount]\nPing: [ping]\nPortals: [portals] \n</line-height></margin>"; break; case StatDisplayPreset.Simpler: text = "<line-height=110%><align=center><size=16px>Stats:</align></size></line-height><margin-left=0.6em>\nDamage: [damage]\nAttack Speed: [attackSpeed]\nCrit Chance: [critWithLuck]\nRegen: [regen]\nArmor: [armor] | [armorDamageReduction]\nSpeed: [speed]\nJumps: [availableJumps] / [maxJumps]\nKills: [killCount]\n</margin>"; text2 = "<line-height=110%><align=center><size=16px>Stats:</align></size></line-height>\n<margin-left=0.6em>Damage: [damage]\nAttack Speed: [attackSpeed]\nCrit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nRegen: [regen]\nArmor: [armor] | [armorDamageReduction]\nSpeed: [speed]\nJumps: [availableJumps] / [maxJumps]\nKills: [killCount]\nPortals: [portals]\n</margin>"; break; case StatDisplayPreset.Minimal: text = "<margin-left=0.6em><line-height=110%>Jumps: [availableJumps] / [maxJumps]\nDPS: [dps] | [percentDps]\n</line-height></margin>"; text2 = "<margin-left=0.6em><line-height=110%>Crit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nPortal: [portals]</line-height></margin>"; break; case StatDisplayPreset.Old: text = "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [damage]\nCrit Chance: [critWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nDPS: [dps]\nCombo: [combo]\nCombo Timer: [remainingComboDuration]\nMax Combo: [maxCombo]"; text2 = "<size=120%>Stats</size>\nLuck: [luck]\nDamage: [damage]\nCrit Chance: [critWithLuck]\nBleed Chance: [bleedChanceWithLuck]\nAttack Speed: [attackSpeed]\nArmor: [armor] | [armorDamageReduction]\nRegen: [regen]\nSpeed: [speed]\nJumps: [availableJumps]/[maxJumps]\nKills: [killCount]\nMountain Shrines: [mountainShrines]\nMax Combo: [maxCombo]\n<size=120%>Portals:</size> \n<size=50%>Gold:[goldPortal] Shop:[shopPortal] Celestial:[msPortal] Void:[voidPortal]</size>"; break; } statsDisplayString.Value = text; secondaryStatsDisplayString.Value = text2; statStringPresets.Value = StatDisplayPreset.Set; GameObject val = GameObject.Find("SafeArea/SubPanelArea/SettingsSubPanel, (Mod Options)/Options Panel(Clone)/Scroll View/Viewport/VerticalLayout/Mod Option Input Field, Main Display String"); GameObject val2 = GameObject.Find("SafeArea/SubPanelArea/SettingsSubPanel, (Mod Options)/Options Panel(Clone)/Scroll View/Viewport/VerticalLayout/Mod Option Input Field, Tab Display String"); if (Object.op_Implicit((Object)(object)val)) { InputFieldController component = val.GetComponent<InputFieldController>(); InputFieldController component2 = val2.GetComponent<InputFieldController>(); ((ModSettingsControl<string, BaseOptionConfig>)(object)component).SubmitValue(text); ((ModSettingsControl<string, BaseOptionConfig>)(object)component2).SubmitValue(text2); } } } private void MovePurchase(object sender, EventArgs e) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) HUD val = HUD.instancesList[0]; if (Object.op_Implicit((Object)(object)val)) { Transform val2 = ((Component)val).transform.Find("MainContainer/MainUIArea/SpringCanvas/RightCluster/ContextNotification/"); if (Object.op_Implicit((Object)(object)val2)) { val2.localPosition = new Vector3((float)(movePurchaseText.Value ? (-240) : 0), val2.localPosition.y, 0f); } } } private void OnEnable(Action<ScoreboardController> orig, ScoreboardController self) { scoreBoardOpen = true; ForceUpdate(); orig(self); } private void OnDisable(Action<ScoreboardController> orig, ScoreboardController self) { scoreBoardOpen = false; ForceUpdate(); orig(self); } private void BuiltInColors_SettingChanged(object sender, EventArgs e) { StatsDisplayDefinitions.SetupDefs(); } private void Display_SettingChanged(object sender, EventArgs e) { if (Object.op_Implicit((Object)(object)statTracker)) { Object.DestroyImmediate((Object)(object)((Component)statTracker).gameObject); ForceUpdate(); } } private void DetachedPosition_SettingChanged(object sender, EventArgs e) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)statTracker) && !statsDisplayAttached.Value) { Transform parent = statTracker.parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); Transform obj = statTracker; ((RectTransform)((obj is RectTransform) ? obj : null)).anchoredPosition3D = new Vector3(detachedPosition.Value.x, detachedPosition.Value.y, 0f - val.anchoredPosition3D.z); } } public void CalculateStuff(string statsText) { //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) if (statsDisplay.Value == StatsDisplayEnum.Off || !Object.op_Implicit((Object)(object)cachedUserBody)) { return; } if (!Object.op_Implicit((Object)(object)statTracker)) { GameObject val = Run.instance.uiInstances[0]; if (!Object.op_Implicit((Object)(object)val)) { return; } if (statsDisplayAttached.Value) { MovePurchase(null, null); originalFontSize = -1f; VerticalLayoutGroup[] componentsInChildren = val.GetComponentsInChildren<VerticalLayoutGroup>(); foreach (VerticalLayoutGroup val2 in componentsInChildren) { if (!(((Object)((Component)val2).gameObject).name == "RightInfoBar")) { continue; } Transform val3 = ((Component)val2).transform.Find("ObjectivePanel"); GameObject val4 = (Object.op_Implicit((Object)(object)val3.Find("Label")) ? ((Component)val3.Find("Label")).gameObject : null); bool active = false; if (Object.op_Implicit((Object)(object)val4)) { active = val4.activeSelf; val4.SetActive(true); } GameObject val5 = Object.Instantiate<GameObject>(((Component)val3).gameObject); val5.transform.parent = ((Component)val3.parent).transform; ((Object)val5).name = "PlayerStats"; if (Object.op_Implicit((Object)(object)val4)) { val4.SetActive(active); } if (Object.op_Implicit((Object)(object)val5.transform.Find("StripContainer"))) { Object.Destroy((Object)(object)((Component)val5.transform.Find("StripContainer")).gameObject); } if (Object.op_Implicit((Object)(object)val5.transform.Find("Minimap"))) { Object.DestroyImmediate((Object)(object)((Component)val5.transform.Find("Minimap")).gameObject); } if (Object.op_Implicit((Object)(object)val5.GetComponent<HudObjectiveTargetSetter>())) { Object.Destroy((Object)(object)val5.GetComponent<HudObjectiveTargetSetter>()); } if (Object.op_Implicit((Object)(object)val5.GetComponent<ObjectivePanelController>())) { Object.Destroy((Object)(object)val5.GetComponent<ObjectivePanelController>()); } RectTransform component = val5.GetComponent<RectTransform>(); layoutGroup = val5.GetComponent<VerticalLayoutGroup>(); textComponent = val5.GetComponentInChildren<TextMeshProUGUI>(); layoutElement = val5.GetComponentInChildren<LayoutElement>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)layoutGroup) || !Object.op_Implicit((Object)(object)textComponent) || !Object.op_Implicit((Object)(object)layoutElement)) { layoutGroup = null; textComponent = null; layoutElement = null; Object.DestroyImmediate((Object)(object)val5); break; } ((Transform)component).localPosition = Vector3.zero; ((Transform)component).localEulerAngles = Vector3.zero; ((Transform)component).localScale = Vector3.one; ((Behaviour)layoutGroup).enabled = false; ((Behaviour)layoutGroup).enabled = true; ((TMP_Text)textComponent).alignment = (TextAlignmentOptions)257; ((Graphic)textComponent).color = Color.white; textComponentGameObject = ((Component)textComponent).gameObject; Transform val6 = val3.Find("StripContainer/ObjectiveStrip/Label"); if (Object.op_Implicit((Object)(object)val6)) { ((TMP_Text)textComponent).fontSize = (((TMP_Text)val4.GetComponent<HGTextMeshProUGUI>()).fontSize + ((TMP_Text)((Component)val6).GetComponent<HGTextMeshProUGUI>()).fontSize) / 2f; } else { ((TMP_Text)textComponent).fontSize = (((TMP_Text)textComponent).fontSize + 11f) / 2f; } if (Object.op_Implicit((Object)(object)val5.transform.Find("Seperator"))) { isRiskUI = true; VerticalLayoutGroup component2 = ((Component)val5.transform.Find("Seperator")).GetComponent<VerticalLayoutGroup>(); ((LayoutGroup)component2).padding.top = 0; ((LayoutGroup)component2).childAlignment = (TextAnchor)0; } statTracker = val5.transform; ((MonoBehaviour)Run.instance).StartCoroutine(SetLastDelayed()); break; } } else { HUD componentInParent = val.GetComponentInParent<HUD>(); if (Object.op_Implicit((Object)(object)componentInParent)) { GameObject val7 = new GameObject("PlayerStats"); RectTransform val8 = val7.AddComponent<RectTransform>(); Transform transform = componentInParent.mainUIPanel.transform; RectTransform val9 = (RectTransform)(object)((transform is RectTransform) ? transform : null); ((Transform)val8).SetParent((Transform)(object)val9, false); val8.anchoredPosition3D = new Vector3(detachedPosition.Value.x, detachedPosition.Value.y, 0f - val9.anchoredPosition3D.z); Vector2 anchorMax = (val8.anchorMin = -val9.anchorMin / (val9.anchorMax - val9.anchorMin)); val8.anchorMax = anchorMax; val8.sizeDelta = Vector2.zero; layoutGroup = val7.AddComponent<VerticalLayoutGroup>(); layoutElement = val7.AddComponent<LayoutElement>(); textComponent = val7.AddComponent<TextMeshProUGUI>(); ((TMP_Text)textComponent).fontSize = 16f; ((Graphic)textComponent).color = Color.white; ((TMP_Text)textComponent).enableWordWrapping = false; textComponentGameObject = ((Component)textComponent).gameObject; statTracker = (Transform)(object)val8; } } if (Object.op_Implicit((Object)(object)statTracker)) { Object.Destroy((Object)(object)((Component)statTracker).GetComponentInChildren<LanguageTextMeshController>()); if (statsDisplay.Value >= StatsDisplayEnum.Only_Show_On_Tab && !scoreBoardOpen) { ((Component)statTracker).gameObject.SetActive(false); } else if (statsDisplay.Value == StatsDisplayEnum.Only_Show_On_Main && scoreBoardOpen) { ((Component)statTracker).gameObject.SetActive(false); } else { ((Component)statTracker).gameObject.SetActive(true); } } } if (Object.op_Implicit((Object)(object)textComponentGameObject)) { textComponentGameObject.SetActive(true); } if (Object.op_Implicit((Object)(object)textComponent) && Object.op_Implicit((Object)(object)layoutElement)) { ((TMP_Text)textComponent).text = statsText; int num = (statsDisplayOverrideHeight.Value ? statsDisplayOverrideHeightValue.Value : statsText.Split('\n').Length); if (originalFontSize == -1f) { originalFontSize = ((TMP_Text)textComponent).fontSize; } ((TMP_Text)textComponent).fontSize = ((statsDisplaySize.Value == -1f) ? originalFontSize : statsDisplaySize.Value); ((MonoBehaviour)Run.instance).StartCoroutine(FixScaleAfterFrame(num)); if (statsDisplayAttached.Value) { if (!Object.op_Implicit((Object)(object)cachedImage)) { cachedImage = ((Component)((Component)layoutElement).transform.parent).GetComponent<Image>(); } if (Object.op_Implicit((Object)(object)cachedImage)) { ((Behaviour)cachedImage).enabled = num != 0; } } if (isRiskUI && Object.op_Implicit((Object)(object)layoutGroup)) { ((LayoutGroup)layoutGroup).padding.bottom = (int)((float)num / 16f * 50f); } } else { layoutGroup = null; textComponent = null; layoutElement = null; if (Object.op_Implicit((Object)(object)statTracker)) { Log.Debug("Somehow statTracker [" + ((Object)((Component)statTracker).gameObject).name + "] got set but other items didn't attempting to delete it and try again."); Object.DestroyImmediate((Object)(object)((Component)statTracker).gameObject); } } } [IteratorStateMachine(typeof(<FixScaleAfterFrame>d__49))] private IEnumerator FixScaleAfterFrame(int nlines) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FixScaleAfterFrame>d__49(0) { <>4__this = this, nlines = nlines }; } [IteratorStateMachine(typeof(<SetLastDelayed>d__50))] private IEnumerator SetLastDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetLastDelayed>d__50(0) { <>4__this = this }; } private static void CreatePositionWindow(ConfigEntry<Vector2> configEntry) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Expected O, but got Unknown GameObject canvasObj = new GameObject("Vector2 Popup"); canvasObj.layer = LayerIndex.ui.intVal; Canvas obj = canvasObj.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 10; CanvasScaler obj2 = canvasObj.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.screenMatchMode = (ScreenMatchMode)1; canvasObj.AddComponent<CanvasRenderer>(); canvasObj.AddComponent<GraphicRaycaster>(); canvasObj.AddComponent<RooEscapeRouter>().escapePressed.AddListener(new UnityAction(Close)); GameObject val = new GameObject("Window"); RectTransform windowRect = val.AddComponent<RectTransform>(); ((Transform)windowRect).SetParent(canvasObj.transform, false); windowRect.anchorMin = new Vector2(0.5f, 0.5f); windowRect.anchorMax = new Vector2(0.5f, 0.5f); windowRect.pivot = new Vector2(0.5f, 0.5f); windowRect.sizeDelta = new Vector2(450f, 160f); val.AddComponent<VerticalLayoutGroup>(); GameObject val2 = new GameObject("Background"); RectTransform obj3 = val2.AddComponent<RectTransform>(); ((Transform)obj3).SetParent(((Component)windowRect).transform, false); obj3.anchorMin = new Vector2(-0.25f, -0.25f); obj3.anchorMax = new Vector2(1.25f, 1.25f); obj3.pivot = new Vector2(0.5f, 0.5f); ((Graphic)val2.AddComponent<Image>()).color = new Color(0.125f, 0.25f, 0.4f, 1f); val2.AddComponent<LayoutElement>().ignoreLayout = true; GameObject sliderPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/SettingsSliderControl.prefab").WaitForCompletion(); CreateSlider("X", 0, 0f, 1920f); CreateSlider("Y", 1, 0f, 1080f); GameObject obj4 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/GenericMenuButton.prefab").WaitForCompletion(), (Transform)(object)windowRect); obj4.GetComponent<LanguageTextMeshController>().token = "Close"; obj4.AddComponent<LayoutElement>().minHeight = 32f; ((UnityEvent)((Button)obj4.GetComponentInChildren<HGButton>()).onClick).AddListener(new UnityAction(Close)); void Close() { Object.Destroy((Object)(object)canvasObj); } void CreateSlider(string name, int index, float min, float max) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) GameObject val3 = Object.Instantiate<GameObject>(sliderPrefab, (Transform)(object)windowRect); SettingsSlider component = val3.GetComponent<SettingsSlider>(); ((BaseSettingsControl)component).nameLabel.token = name; Slider slider = component.slider; ((Component)slider).GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 40f); Object.DestroyImmediate((Object)(object)component); Object.DestroyImmediate((Object)(object)val3.GetComponent<SelectableDescriptionUpdater>()); SliderWithText sliderWithText = val3.AddComponent<SliderWithText>(); sliderWithText.Setup(slider, val3.GetComponentInChildren<TMP_InputField>(), min, max); sliderWithText.onValueChanged.AddListener((UnityAction<float>)delegate(float newValue) { //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_002a: Unknown result type (might be due to invalid IL or missing references) Vector2 value2 = configEntry.Value; ((Vector2)(ref value2))[index] = newValue; configEntry.Value = value2; }); Vector2 value = configEntry.Value; sliderWithText.Value = ((Vector2)(ref value))[index]; } } internal void FixedUpdate() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) if (statsDisplay.Value != 0 && Object.op_Implicit((Object)(object)cachedUserBody)) { if (timer <= 0f) { timer += statsDisplayUpdateInterval.Value; ((JobHandle)(ref regexHandle)).Complete(); CalculateStuff(RegexJob.output); } timer -= Time.deltaTime; if (timer <= 0f) { regexHandle = IJobExtensions.Schedule<RegexJob>(default(RegexJob), default(JobHandle)); } } } private static string GenerateStatsText() { string input = ((statsDisplay.Value >= StatsDisplayEnum.Different_On_Tab && scoreBoardOpen) ? secondaryStatsDisplayString.Value : statsDisplayString.Value); return statsRegex.Replace(input, MatchEvaluator); } private static string MatchEvaluator(Match match) { if (!statDictionary.TryGetValue(match.Groups[1].Value, out var value)) { return match.Value; } return value(cachedUserBody); } private void ForceUpdate() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (statsDisplay.Value != 0 && Object.op_Implicit((Object)(object)cachedUserBody)) { regexHandle = IJobExtensions.Schedule<RegexJob>(default(RegexJob), regexHandle); timer = 0f; FixedUpdate(); } if (!Object.op_Implicit((Object)(object)statTracker)) { return; } if (statsDisplay.Value == StatsDisplayEnum.Show_Only_Stats_On_Tab) { for (int i = 1; i < statTracker.parent.childCount; i++) { ((Component)statTracker.parent.GetChild(i)).gameObject.SetActive(!scoreBoardOpen); } } if (statsDisplay.Value >= StatsDisplayEnum.Only_Show_On_Tab && !scoreBoardOpen) { ((Component)statTracker).gameObject.SetActive(false); } else if (statsDisplay.Value == StatsDisplayEnum.Only_Show_On_Main && scoreBoardOpen) { ((Component)statTracker).gameObject.SetActive(false); } else { ((Component)statTracker).gameObject.SetActive(true); } } } internal class StatsDisplayDefinitions { internal static string floatPrecision; internal static void SetupDefs() { string utilityString = (StatsDisplayClass.builtInColors.Value ? "<style=cIsUtility>" : ""); string damageString = (StatsDisplayClass.builtInColors.Value ? "<style=cIsDamage>" : ""); string healingString = (StatsDisplayClass.builtInColors.Value ? "<style=cIsHealing>" : ""); string healthString = (StatsDisplayClass.builtInColors.Value ? "<style=cIsHealth>" : ""); string voidString = (StatsDisplayClass.builtInColors.Value ? "<style=cIsVoid>" : ""); string gray = (StatsDisplayClass.builtInColors.Value ? "<style=cStack>" : ""); string styleString = (StatsDisplayClass.builtInColors.Value ? "</style>" : ""); floatPrecision = "0." + new string('#', StatsDisplayClass.floatPrecision.Value); StatsDisplayClass.statDictionary.Clear(); StatsDisplayClass.statDictionary.Add("lvl1_damage", (CharacterBody cachedUserBody) => damageString + cachedUserBody.baseDamage.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("damage", (CharacterBody cachedUserBody) => damageString + cachedUserBody.damage.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("baseDamage", StatsDisplayClass.statDictionary["damage"]); StatsDisplayClass.statDictionary.Add("damagePercent", (CharacterBody cachedUserBody) => damageString + (cachedUserBody.damage / (cachedUserBody.baseDamage * (cachedUserBody.level * 0.2f + 0.8f)) * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("damagePercentWithWatch", (CharacterBody cachedUserBody) => damageString + ((double)(cachedUserBody.damage / (cachedUserBody.baseDamage * (cachedUserBody.level * 0.2f + 0.8f))) * (1.0 + 0.2 * (double)cachedUserBody.inventory.GetItemCountEffective(Items.FragileDamageBonus)) * 100.0).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("attackSpeed", (CharacterBody cachedUserBody) => damageString + cachedUserBody.attackSpeed.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("attackSpeedPercent", (CharacterBody cachedUserBody) => damageString + (cachedUserBody.attackSpeed / cachedUserBody.baseAttackSpeed * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("crit", (CharacterBody cachedUserBody) => damageString + cachedUserBody.crit.ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("critWithLuck", delegate(CharacterBody cachedUserBody) { float num4 = Utils.CalculateChanceWithLuck(cachedUserBody.crit / 100f, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f; return damageString + num4.ToString(floatPrecision) + "%" + styleString; }); StatsDisplayClass.statDictionary.Add("critMultiplier", (CharacterBody cachedUserBody) => damageString + "×" + cachedUserBody.critMultiplier.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("bleedChance", (CharacterBody cachedUserBody) => damageString + cachedUserBody.bleedChance.ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("bleedChanceWithLuck", delegate(CharacterBody cachedUserBody) { float num3 = Utils.CalculateChanceWithLuck(cachedUserBody.bleedChance / 100f, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f; return damageString + num3.ToString(floatPrecision) + "%" + styleString; }); StatsDisplayClass.statDictionary.Add("bleedChanceWithSpleen", delegate(CharacterBody cachedUserBody) { float num2 = Utils.CalculateChanceWithLuck(cachedUserBody.crit / 100f, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * Utils.CalculateChanceWithLuck(cachedUserBody.bleedChance / 100f, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f; return damageString + num2.ToString(floatPrecision) + "%" + styleString; }); StatsDisplayClass.statDictionary.Add("armor", (CharacterBody cachedUserBody) => healingString + cachedUserBody.armor.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("armorDamageReduction", (CharacterBody cachedUserBody) => healingString + (100f - 100f * (100f / (100f + cachedUserBody.armor))).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("lvl1_regen", (CharacterBody cachedUserBody) => healingString + cachedUserBody.baseRegen.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("regenRaw", (CharacterBody cachedUserBody) => healingString + cachedUserBody.regen.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("regen", (CharacterBody cachedUserBody) => healingString + ((((int)Run.instance.selectedDifficulty >= 7) ? (cachedUserBody.regen / 2f) : cachedUserBody.regen) * (float)(1 + cachedUserBody.inventory.GetItemCountEffective(Items.IncreaseHealing))).ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("regenHp", (CharacterBody cachedUserBody) => healingString + ((((int)Run.instance.selectedDifficulty >= 7) ? (cachedUserBody.regen / 2f) : cachedUserBody.regen) * (float)(1 + cachedUserBody.inventory.GetItemCountEffective(Items.IncreaseHealing))).ToString(floatPrecision) + " hp/s" + styleString); StatsDisplayClass.statDictionary.Add("lvl1_maxHealth", (CharacterBody cachedUserBody) => $"{healingString}{cachedUserBody.baseMaxHealth}{styleString}"); StatsDisplayClass.statDictionary.Add("maxHealth", (CharacterBody cachedUserBody) => $"{healingString}{cachedUserBody.maxHealth}{styleString}"); StatsDisplayClass.statDictionary.Add("maxShield", (CharacterBody cachedUserBody) => $"{healingString}{cachedUserBody.maxShield}{styleString}"); StatsDisplayClass.statDictionary.Add("maxBarrier", (CharacterBody cachedUserBody) => $"{healingString}{cachedUserBody.maxBarrier}{styleString}"); StatsDisplayClass.statDictionary.Add("shieldFraction", (CharacterBody cachedUserBody) => healingString + (cachedUserBody.maxShield / cachedUserBody.healthComponent.fullCombinedHealth * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("barrierDecayRate", (CharacterBody cachedUserBody) => healingString + cachedUserBody.healthComponent.GetBarrierDecayRate().ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("maxHpPercent", (CharacterBody cachedUserBody) => healingString + (cachedUserBody.healthComponent.fullCombinedHealth / (cachedUserBody.baseMaxHealth * (cachedUserBody.level * 0.3f + 0.7f)) * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("maxHealthPercent", (CharacterBody cachedUserBody) => healingString + (cachedUserBody.maxHealth / (cachedUserBody.baseMaxHealth * (cachedUserBody.level * 0.3f + 0.7f)) * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("maxShieldPercent", (CharacterBody cachedUserBody) => healingString + (cachedUserBody.maxShield / (cachedUserBody.baseMaxHealth * (cachedUserBody.level * 0.3f + 0.7f)) * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("effectiveHealth", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.healthComponent)) ? (healingString + "N/A" + styleString) : (healingString + (cachedUserBody.healthComponent.combinedHealth / (100f / (100f + cachedUserBody.armor))).ToString(floatPrecision) + styleString)); StatsDisplayClass.statDictionary.Add("effectiveMaxHealth", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.healthComponent)) ? (healingString + "N/A" + styleString) : (healingString + (cachedUserBody.healthComponent.fullCombinedHealth / (100f / (100f + cachedUserBody.armor))).ToString(floatPrecision) + styleString)); StatsDisplayClass.statDictionary.Add("healthPercentage", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.healthComponent)) ? (healingString + "N/A" + styleString) : (healingString + (cachedUserBody.healthComponent.combinedHealthFraction * 100f).ToString(floatPrecision) + styleString)); StatsDisplayClass.statDictionary.Add("critHeal", (CharacterBody cachedUserBody) => healingString + cachedUserBody.critHeal.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("hasOneShotProtection", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.healthComponent)) ? (healingString + "N/A" + styleString) : $"{healingString}{cachedUserBody.oneShotProtectionFraction * cachedUserBody.healthComponent.fullCombinedHealth - cachedUserBody.healthComponent.missingCombinedHealth > 0f}{styleString}"); StatsDisplayClass.statDictionary.Add("cursePenalty", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.cursePenalty.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("curseHealthReduction", (CharacterBody cachedUserBody) => healthString + ((1f - 1f / cachedUserBody.cursePenalty) * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("speed", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.moveSpeed.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("speedPercent", (CharacterBody cachedUserBody) => utilityString + (cachedUserBody.moveSpeed / cachedUserBody.baseMoveSpeed / (cachedUserBody.isSprinting ? cachedUserBody.sprintingSpeedMultiplier : 1f) * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("speedPercentSprintAffected", (CharacterBody cachedUserBody) => utilityString + (cachedUserBody.moveSpeed / cachedUserBody.baseMoveSpeed * 100f).ToString(floatPrecision) + "%" + styleString); StatsDisplayClass.statDictionary.Add("acceleration", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.acceleration.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("velocity", delegate(CharacterBody cachedUserBody) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) object obj; if (!Object.op_Implicit((Object)(object)cachedUserBody.characterMotor)) { if (!Object.op_Implicit((Object)(object)cachedUserBody.rigidbody)) { obj = "N/A"; } else { Vector3 velocity = cachedUserBody.rigidbody.velocity; obj = ((Vector3)(ref velocity)).magnitude.ToString(floatPrecision); } } else { obj = ((Vector3)(ref cachedUserBody.characterMotor.velocity)).magnitude.ToString(floatPrecision); } string text = (string)obj; return utilityString + text + styleString; }); StatsDisplayClass.statDictionary.Add("jumpPower", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.jumpPower.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("maxJumpHeight", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.maxJumpHeight.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("maxJumps", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.maxJumpCount}{styleString}"); StatsDisplayClass.statDictionary.Add("availableJumps", (CharacterBody cachedUserBody) => (!Object.op_Implicit((Object)(object)cachedUserBody.characterMotor)) ? (utilityString + "N/A" + styleString) : $"{utilityString}{cachedUserBody.maxJumpCount - cachedUserBody.characterMotor.jumpCount}{styleString}"); StatsDisplayClass.statDictionary.Add("luck", (CharacterBody cachedUserBody) => utilityString + Utils.GetLuckFromCachedUserBody(cachedUserBody).ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("teddyBearBlockChance", delegate(CharacterBody cachedUserBody) { int itemCountEffective2 = cachedUserBody.inventory.GetItemCountEffective(Items.Bear); return utilityString + (0.15f * (float)itemCountEffective2 / (0.15f * (float)itemCountEffective2 + 1f) * 100f).ToString(floatPrecision) + "%" + styleString; }); StatsDisplayClass.statDictionary.Add("saferSpacesCD", delegate(CharacterBody cachedUserBody) { int itemCountEffective = cachedUserBody.inventory.GetItemCountEffective(Items.BearVoid); return (itemCountEffective == 0) ? (utilityString + "N/A" + styleString) : (utilityString + (15f * Mathf.Pow(0.9f, (float)itemCountEffective)).ToString(floatPrecision) + "s" + styleString); }); StatsDisplayClass.statDictionary.Add("instaKillChance", delegate(CharacterBody cachedUserBody) { int itemCount = cachedUserBody.inventory.GetItemCount(Items.CritGlassesVoid); float num = Utils.CalculateChanceWithLuck(0.005f * (float)itemCount, Utils.GetLuckFromCachedUserBody(cachedUserBody)) * 100f; return damageString + num.ToString(floatPrecision) + "%" + styleString; }); StatsDisplayClass.statDictionary.Add("mountainShrines", (CharacterBody cachedUserBody) => string.Format("{0}{1}{2}", utilityString, (TeleporterInteraction.instance != null) ? ((object)TeleporterInteraction.instance._shrineBonusStacks) : "N/A", styleString)); StatsDisplayClass.statDictionary.Add("shopPortal", (CharacterBody cachedUserBody) => utilityString + (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) ? BasePlugin.instance.portalTracking.shopPortal.ToString() : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("goldPortal", (CharacterBody cachedUserBody) => damageString + (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) ? BasePlugin.instance.portalTracking.goldPortal.ToString() : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("msPortal", (CharacterBody cachedUserBody) => utilityString + (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) ? BasePlugin.instance.portalTracking.msPortal.ToString() : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("voidPortal", (CharacterBody cachedUserBody) => voidString + (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) ? BasePlugin.instance.portalTracking._voidPortal.ToString() : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("greenPortal", (CharacterBody cachedUserBody) => healingString + (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) ? BasePlugin.instance.portalTracking._greenPortal.ToString() : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("portals", (CharacterBody cachedUserBody) => BasePlugin.instance.portalTracking.ReturnAllAvailablePortals()); StatsDisplayClass.statDictionary.Add("killCount", (CharacterBody cachedUserBody) => $"{healthString}{BasePlugin.instance.dpsMeter.killsThisStage}{styleString}"); StatsDisplayClass.statDictionary.Add("killCountRun", (CharacterBody cachedUserBody) => $"{healthString}{BasePlugin.instance.dpsMeter.killsThisRun}{styleString}"); StatsDisplayClass.statDictionary.Add("dps", (CharacterBody cachedUserBody) => damageString + (BasePlugin.instance.dpsMeter.damageDealtSincePeriod / DPSMeter.DPS_MAX_TIME).ToString("0.#") + styleString); StatsDisplayClass.statDictionary.Add("percentDps", (CharacterBody cachedUserBody) => damageString + Mathf.RoundToInt(BasePlugin.instance.dpsMeter.damageDealtSincePeriod * 100f / cachedUserBody.damage / DPSMeter.DPS_MAX_TIME) + "%" + styleString); StatsDisplayClass.statDictionary.Add("combo", (CharacterBody cachedUserBody) => $"{damageString}{(int)BasePlugin.instance.dpsMeter.currentCombatDamage}{styleString}"); StatsDisplayClass.statDictionary.Add("currentCombatDamage", (CharacterBody cachedUserBody) => $"{damageString}{(int)BasePlugin.instance.dpsMeter.currentCombatDamage}{styleString}"); StatsDisplayClass.statDictionary.Add("maxCombo", (CharacterBody cachedUserBody) => $"{damageString}{(int)BasePlugin.instance.dpsMeter.maxCombo}{styleString}"); StatsDisplayClass.statDictionary.Add("maxComboThisRun", (CharacterBody cachedUserBody) => $"{damageString}{(int)BasePlugin.instance.dpsMeter.maxRunCombo}{styleString}"); StatsDisplayClass.statDictionary.Add("killCombo", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.currentComboKills}{styleString}"); StatsDisplayClass.statDictionary.Add("currentCombatKills", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.currentComboKills}{styleString}"); StatsDisplayClass.statDictionary.Add("maxKillCombo", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.maxKillCombo}{styleString}"); StatsDisplayClass.statDictionary.Add("maxKillComboThisRun", (CharacterBody cachedUserBody) => $"{damageString}{BasePlugin.instance.dpsMeter.maxRunKillCombo}{styleString}"); StatsDisplayClass.statDictionary.Add("remainingComboDuration", (CharacterBody cachedUserBody) => $"{utilityString}{(int)BasePlugin.instance.dpsMeter.timer + 1}{styleString}"); StatsDisplayClass.statDictionary.Add("experience", (CharacterBody cachedUserBody) => utilityString + cachedUserBody.experience.ToString(floatPrecision) + styleString); StatsDisplayClass.statDictionary.Add("level", (CharacterBody cachedUserBody) => $"{utilityString}{cachedUserBody.level}{styleString}"); StatsDisplayClass.statDictionary.Add("difficultyCoefficient", (CharacterBody cachedUserBody) => damageString + (Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.difficultyCoefficient.ToString(floatPrecision) : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("stage", (CharacterBody cachedUserBody) => utilityString + Language.GetString(Object.op_Implicit((Object)(object)Stage.instance) ? Stage.instance.sceneDef.nameToken : "N/A") + styleString); StatsDisplayClass.statDictionary.Add("ping", (CharacterBody cachedUserBody) => gray + (NetworkServer.active ? "0" : RttManager.GetConnectionRTTInMilliseconds(((NetworkManager)NetworkManagerSystem.singleton).client.connection).ToString()) + "ms" + styleString); } } } namespace LookingGlass.PickupNotifsDuration { internal class PickupNotifDurationClass : BaseThing { [CompilerGenerated] private static class <>O { public static IsDisabledDelegate <0>__NotificationsDisabled; } private static Hook overrideHook; public static ConfigEntry<float> notificationDuration; public PickupNotifDurationClass() { Setup(); SetupRiskOfOptions(); } public void Setup() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown MethodInfo? method = typeof(CharacterMasterNotificationQueue).GetMethod("PushNotification", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(PickupNotifDurationClass).GetMethod("PushNotification", BindingFlags.Instance | BindingFlags.NonPublic); overrideHook = new Hook((MethodBase)method, method2, (object)this); notificationDuration = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<float>("Misc", "Pickup Notifications Duration", 6f, "Duration of pickup notifications. 6s is the vanilla duration"); } public void SetupRiskOfOptions() { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_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 //IL_0043: 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_004e: Expected O, but got Unknown ConfigEntry<float> obj = notificationDuration; SliderConfig val = new SliderConfig { restartRequired = false, min = 0.01f, max = 24f, formatString = "{0:F1}s" }; object obj2 = <>O.<0>__NotificationsDisabled; if (obj2 == null) { IsDisabledDelegate val2 = NotificationsDisabled; <>O.<0>__NotificationsDisabled = val2; obj2 = (object)val2; } ((BaseOptionConfig)val).checkIfDisabled = (IsDisabledDelegate)obj2; ModSettingsManager.AddOption((BaseOption)new SliderOption(obj, val)); } private static bool NotificationsDisabled() { return HidePickupNotifications.disablePickupNotifications.Value; } private void PushNotification(Action<CharacterMasterNotificationQueue, NotificationInfo, float> orig, CharacterMasterNotificationQueue self, NotificationInfo info, float duration) { duration = notificationDuration.Value; orig(self, info, duration); } } } namespace LookingGlass.HidePickupNotifs { internal class HidePickupNotifications : BaseThing { public static ConfigEntry<bool> disablePickupNotifications; private static Hook overrideHook; public HidePickupNotifications() { Setup(); } public void Setup() { disablePickupNotifications = ((BaseUnityPlugin)BasePlugin.instance).Config.Bind<bool>("Misc", "Disable Pickup Notifications", false, "Disable item pickup notifications"); InitHooks(); SetupRiskOfOptions(); } public void SetupRiskOfOptions() { //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_0016: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(disablePickupNotifications, new CheckBoxConfig { restartRequired = false })); } private void InitHooks() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown MethodInfo? method = typeof(CharacterMasterNotificationQueue).GetMethod("PushPickupNotification", new Type[4] { typeof(CharacterMaster), typeof(PickupIndex), typeof(bool), typeof(int) }); MethodInfo method2 = typeof(HidePickupNotifications).GetMethod("PushPickupNotification", BindingFlags.Instance | BindingFlags.NonPublic); overrideHook = new Hook((MethodBase)method, method2, (object)this); } private void PushPickupNotification(Action<CharacterMaster, PickupIndex, bool, int> orig, CharacterMaster characterMaster, PickupIndex pickupIndex, bool isTemporary, int upgradeCount) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!disablePickupNotifications.Value) { orig(characterMaster, pickupIndex, isTemporary, upgradeCount); } } } } namespace LookingGlass.LookingGlassLanguage { public static class LookingGlassLanguageAPI { public static void SetupToken(Language language, string token, string value) { language.stringsByToken["LG_TOKEN_" + token] = value; } } } namespace LookingGlass.ItemStatsNameSpace { public class ItemDefinitions { public static Dictionary<int, ItemStatsDef> allItemDefinitions = new Dictionary<int, ItemStatsDef>(); public static Dictionary<int, ItemStatsDef> allEquipmentDefinitions = new Dictionary<int, ItemStatsDef>(); public static float GetRegenMult(Inventory inv) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if ((int)Run.instance.selectedDifficulty >= 7) { return 0.3f; } if (inv.GetItemCountEffective(Items.MonsoonPlayerHelper) > 0) { return 0.6f; } if (inv.GetItemCountEffective(Items.DrizzlePlayerHelper) > 0) { return 1.5f; } return 1f; } public static void RegisterItemStatsDef(ItemStatsDef itemStatsDef, ItemIndex itemIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected I4, but got Unknown allItemDefinitions.Add((int)itemIndex, itemStatsDef); } internal static void RegisterAll() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected I4, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected I4, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected I4, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected I4, but got Unknown //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected I4, but got Unknown //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected I4, but got Unknown //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Expected I4, but got Unknown //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Expected I4, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Expected I4, but got Unknown //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Expected I4, but got Unknown //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Expected I4, but got Unknown //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Expected I4, but got Unknown //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Expected I4, but got Unknown //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Expected I4, but got Unknown //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Expected I4, but got Unknown //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Expected I4, but got Unknown //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Expected I4, but got Unknown //IL_0977: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Expected I4, but got Unknown //IL_09df: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Expected I4, but got Unknown //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_0a53: Expected I4, but got Unknown //IL_0ab0: Unknown result type (might be due to invalid IL or missing references) //IL_0abb: Expected I4, but got Unknown //IL_0b18: Unknown result type (might be due to invalid IL or missing references) //IL_0b23: Expected I4, but got Unknown //IL_0b80: Unknown result type (might be due to invalid IL or missing references) //IL_0b8b: Expected I4, but got Unknown //IL_0be8: Unk
R2InventoryArtifact.dll
Decompiled 3 hours 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using On.RoR2; using On.RoR2.Networking; using On.RoR2.UI; using R2API; using R2InventoryArtifact.Artifact; using R2InventoryArtifact.Hooks; using R2InventoryArtifact.Model; using R2InventoryArtifact.UI; using R2InventoryArtifact.UI.Builders; using R2InventoryArtifact.UI.Components; using R2InventoryArtifact.UI.Layouts; using R2InventoryArtifact.UI.Services; using R2InventoryArtifact.Util; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using RoR2.Networking; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("R2InventoryArtifact")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ba7336eb64844c7f9095891af19699fba0b4d49d")] [assembly: AssemblyProduct("R2InventoryArtifact")] [assembly: AssemblyTitle("R2InventoryArtifact")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace R2InventoryArtifact { public class DebugManager : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnClientConnect <>9__2_0; internal void <Awake>b__2_0(orig_OnClientConnect s, NetworkManagerSystemSteam u, NetworkConnection t) { } } public static DebugManager Instance; public static Run currentRun; private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } Instance = this; object obj = <>c.<>9__2_0; if (obj == null) { hook_OnClientConnect val = delegate { }; <>c.<>9__2_0 = val; obj = (object)val; } NetworkManagerSystemSteam.OnClientConnect += (hook_OnClientConnect)obj; Run.onRunStartGlobal += HandleRunStart; } private void HandleRunStart(Run run) { currentRun = run; } private void SpawnItem(ItemIndex itemindex, bool isTemp = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0045: Unknown result type (might be due to invalid IL or missing references) Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; UniquePickup val = default(UniquePickup); ((UniquePickup)(ref val))..ctor(PickupCatalog.FindPickupIndex(itemindex)); if (Object.op_Implicit((Object)(object)transform)) { PickupDropletController.CreatePickupDroplet(val, transform.position, transform.forward * 20f, false); } } private void SpawnItem(EquipmentIndex itemindex, bool isTemp = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0045: Unknown result type (might be due to invalid IL or missing references) Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; UniquePickup val = default(UniquePickup); ((UniquePickup)(ref val))..ctor(PickupCatalog.FindPickupIndex(itemindex)); if (Object.op_Implicit((Object)(object)transform)) { PickupDropletController.CreatePickupDroplet(val, transform.position, transform.forward * 20f, false); } } private void PrintItems() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) Log.Info("Printing items..."); Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemDef current = enumerator.Current; Log.Info("\"" + current.nameToken + "\":\t{IconPath: \"" + Language.GetString(current.nameToken).Replace(" ", "_") + "webp\", BaseLabel:\"" + ((Object)current).name + "\", Label:\"" + Language.GetString(current.nameToken) + "\"}"); } } finally { ((IDisposable)enumerator).Dispose(); } Log.Info("Printing Equipment..."); EquipmentDef[] equipmentDefs = EquipmentCatalog.equipmentDefs; foreach (EquipmentDef val in equipmentDefs) { Log.Info("\"" + val.nameToken + "\":\t{IconPath: \"" + Language.GetString(val.nameToken).Replace(" ", "_") + "webp\", BaseLabel:\"" + ((Object)val).name + "\", Label:\"" + Language.GetString(val.nameToken) + "\"}"); } } private void AdvanceStage() { if (Object.op_Implicit((Object)(object)currentRun)) { currentRun.AdvanceStage(SceneCatalog.FindSceneDef("golemplains")); } } private void GrantMoney() { PlayerCharacterMasterController.instances[0].master.GiveMoney(200u); } private void LevelPlayer() { PlayerCharacterMasterController.instances[0].master.GiveExperience(100uL); } private void Update() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyUp((KeyCode)49)) { SpawnItem(Items.IncreaseDamageOnMultiKill.itemIndex); } if (Input.GetKeyUp((KeyCode)50)) { SpawnItem(Items.LowerPricedChests.itemIndex); } if (Input.GetKeyUp((KeyCode)51)) { GrantMoney(); } if (Input.GetKeyUp((KeyCode)51)) { SpawnItem(Items.Mushroom.itemIndex); } if (Input.GetKeyUp((KeyCode)52)) { CharacterMaster master = PlayerCharacterMasterController.instances[0].master; if (Object.op_Implicit((Object)(object)master)) { master.GetBody().InflictLavaDamage(); } } if (Input.GetKeyUp((KeyCode)53)) { AdvanceStage(); } if (Input.GetKeyUp((KeyCode)54)) { LevelPlayer(); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Initialize(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug((object)FormatLogMessage(data.ToString())); } internal static void Error(object data) { _logSource.LogError((object)FormatLogMessage(data.ToString())); } internal static void Fatal(object data) { _logSource.LogFatal((object)FormatLogMessage(data.ToString())); } internal static void Info(object data) { _logSource.LogInfo((object)FormatLogMessage(data.ToString())); } internal static void Message(object data) { _logSource.LogMessage((object)FormatLogMessage(data.ToString())); } internal static void Warning(object data) { _logSource.LogWarning((object)FormatLogMessage(data.ToString())); } private static string FormatLogMessage(string message) { StackTrace stackTrace = new StackTrace(1, fNeedFileInfo: false); StackFrame frame = stackTrace.GetFrame(1); List<string> list = new List<string>(1) { $"{DateTime.Now:yy-MM-dd HH::mm::ss}" }; if (frame != null) { list.Add(frame.GetMethod().DeclaringType.Name); list.Add(frame.GetMethod().Name); } list.Add(message); return string.Join(" | ", list); } } public enum InventoryShowType { ToggleShow, HoldToShow } public static class PluginConfig { private const int INVENTORY_WIDTH_MIN_VALUE = 10; private const int INVENTORY_WIDTH_MAX_VALUE = 20; private const int INVENTORY_HEIGHT_MIN_VALUE = 20; private const int INVENTORY_HEIGHT_MAX_VALUE = 40; public static ConfigEntry<KeyboardShortcut> ShowInventoryKey { get; private set; } public static ConfigEntry<KeyboardShortcut> RotateInventoryItemKey { get; private set; } public static ConfigEntry<InventoryShowType> InventoryShowType { get; private set; } public static ConfigEntry<bool> DisableAutoPickup { get; private set; } public static ConfigEntry<int> InventoryHeight { get; private set; } public static ConfigEntry<int> InventoryWidth { get; private set; } public static ConfigEntry<float> UIScale { get; private set; } public static ConfigEntry<float> UIVerticalPadding { get; private set; } public static ConfigEntry<float> UIHorizontalPadding { get; private set; } public static void Initialize(ConfigFile config, PluginInfo pluginInfo) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00ab: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Expected O, but got Unknown InventoryShowType = config.Bind<InventoryShowType>("Inventory", "Toggle Inventory", global::R2InventoryArtifact.InventoryShowType.ToggleShow, "Toggle or Show inventory"); DisableAutoPickup = config.Bind<bool>("Inventory", "Disable Autopickup", false, "Disables automatically picking up items by approaching them"); InventoryWidth = config.Bind<int>("Inventory", "Inventory Width", 15, new ConfigDescription("Number of cells for the width of the inventory", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 20), Array.Empty<object>())); InventoryHeight = config.Bind<int>("Inventory", "Inventory Height", 30, new ConfigDescription("Number of cells for the height of the inventory", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 40), Array.Empty<object>())); ShowInventoryKey = config.Bind<KeyboardShortcut>("Keybinds", "Show Inventory Keybind", new KeyboardShortcut((KeyCode)113, Array.Empty<KeyCode>()), "Keybind for Showing and hiding the inventory"); RotateInventoryItemKey = config.Bind<KeyboardShortcut>("Keybinds", "Rotate Inventory Item", new KeyboardShortcut((KeyCode)324, Array.Empty<KeyCode>()), "Keybind for rotating the inventory"); UIScale = config.Bind<float>("UI", "UI Scale", 1f, "Scale multiplier for the level-up selection UI (0.5=half size, 2.0=double)."); UIVerticalPadding = config.Bind<float>("UI", "UI Vertical Padding", 2f, "Vertical UI Padding"); UIHorizontalPadding = config.Bind<float>("UI", "UI Horizontal Padding", 2f, "Horizontal UI Padding"); try { string directoryName = Path.GetDirectoryName(pluginInfo.Location); string path = Path.Combine(directoryName, "Assets", "icon.png"); Sprite modIcon = R2InventoryArtifactUtil.LoadSprite(path); ModSettingsManager.SetModIcon(modIcon); } catch (Exception ex) { Log.Warning("Failed to load mod icon: " + ex.Message); } ModSettingsManager.SetModDescription("Artifact of Inventory - Manage your inventory"); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)InventoryShowType)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DisableAutoPickup)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(ShowInventoryKey)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(RotateInventoryItemKey)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(InventoryWidth, new IntSliderConfig { min = 10, max = 20 })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(InventoryHeight, new IntSliderConfig { min = 20, max = 40 })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(UIScale, new StepSliderConfig { min = 0.5f, max = 2f, increment = 0.1f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(UIVerticalPadding, new StepSliderConfig { min = 1f, max = 10f, increment = 0.5f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(UIHorizontalPadding, new StepSliderConfig { min = 1f, max = 10f, increment = 0.5f })); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("foxfen64.R2InventoryArtifact", "R2InventoryArtifact", "1.0.1")] public class R2InventoryArtifact : BaseUnityPlugin { public const string PluginGUID = "foxfen64.R2InventoryArtifact"; public const string PluginAuthor = "foxfen64"; public const string PluginName = "R2InventoryArtifact"; public const string PluginVersion = "1.0.1"; public static R2InventoryArtifact Instance; public void Awake() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } Instance = this; Log.Initialize(((BaseUnityPlugin)this).Logger); PluginConfig.Initialize(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Info); InventoryArtifactProvider.Initialize(((BaseUnityPlugin)this).Info); InventoryService.Initialize(((BaseUnityPlugin)this).Info); ComponentBuilder.Initialize(); GameObject val = new GameObject("R2InventoryArtifactPlugin"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<InventoryHook>(); val.AddComponent<UIHook>(); val.AddComponent<LevelUpHook>(); Log.Info("R2InventoryArtifactPlugin Initialized..."); } } } namespace R2InventoryArtifact.Util { public static class R2InventoryArtifactUtil { public static Sprite LoadSprite(string path) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (File.Exists(path)) { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(256, 256, (TextureFormat)5, false, false); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)0; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 1u, (SpriteMeshType)1, Vector4.zero, true); } return null; } } [Serializable] public struct IntRect { public int Width; public int Height; public IntRect(int width, int height) { Width = width; Height = height; } public bool Contains(GridPosition pos) { return Contains(pos.Row, pos.Col); } public bool Contains(int row, int col) { return col >= 0 && col < Width && row >= 0 && row < Height; } } [Serializable] public struct GridPosition { public int Row; public int Col; public GridPosition(int Col, int Row) { this.Row = Row; this.Col = Col; } public override string ToString() { return $"(Row:{Row},Col:{Col})"; } public static GridPosition operator +(GridPosition a, GridPosition b) { return new GridPosition(a.Col + b.Col, a.Row + b.Row); } public static GridPosition operator -(GridPosition a, GridPosition b) { return new GridPosition(a.Col - b.Col, a.Row - b.Row); } public static bool operator ==(GridPosition a, GridPosition b) { return a.Col == b.Col && a.Row == b.Row; } public static bool operator !=(GridPosition a, GridPosition b) { return a.Col != b.Col || a.Row != b.Row; } public override bool Equals(object obj) { return this == (GridPosition)obj; } public override int GetHashCode() { return HashCode.Combine(Col, Row); } } } namespace R2InventoryArtifact.Util.R2API { [Serializable] public struct R2Item { public string Name; public string Description; public R2ItemTier ItemTier; public ItemIndex ItemCode; } [Serializable] public enum R2ItemTier { NONE, T1, T2, T3, BOSS, LUNAR, VT1, VT2, VT3, VBOSS } public class R2ItemService { } [Serializable] public enum R2ItemCode { None = -1, Other = 2, AACannon = 0, AdaptiveArmor = 1, AlienHead = 2, RepulsionArmorPlate = 3, ShatteringJustice = 4, ArtifactKey = 5, Mocha = 6, PredatoryInstincts = 7, BolsteringLantern = 8, GestureoftheDrowned = 9, Bandolier = 10, WarBonds = 11, EclipseLite = 12, TopazBrooch = 13, Aegis = 14, TougherTimes = 15, SaferSpaces = 16, QueensGland = 17, BrilliantBehemoth = 18, TriTipDagger = 19, Shatterspleen = 20, Needletick = 21, GhorsTome = 22, QuickFix = 23, GrowthNectar = 24, ITEM_BOOSTATTACKSPEED_NAME = 25, ITEM_BOOSTDAMAGE_NAME = 26, ITEM_BOOSTEQUIPMENTRECHARGE_NAME = 27, ITEM_BOOSTHP_NAME = 28, ArmorPiercingRounds = 29, SentientMeatHook = 30, ITEM_BURNNEARBY_NAME = 31, DefensiveMicrobots = 32, Ukulele = 33, Polylute = 34, LeafClover57 = 35, BenthicBloom = 36, ITEM_CONVERTCRITCHANCETOCRITDAMAGE_NAME = 37, SearedSteak = 38, WickedRing = 39, ITEM_CRIPPLEWARDONLEVEL_NAME = 40, HikersBoots = 41, LaserScope = 42, LensMakersGlasses = 43, LostSeersLenses = 44, ITEM_CRITHEAL_NAME = 45, Crowbar = 46, ITEM_CUTHP_NAME = 47, CeremonialDagger = 48, DeathMark = 49, WarpedEcho = 50, ITEM_DESTRUCTIBLESPAWNER_NAME = 51, ITEM_DRIZZLEPLAYERHELPER_NAME = 52, ITEM_DRONEDYNAMITEDISPLAY_NAME = 53, SpareDroneParts = 55, ITEM_DRONEWEAPONSBOOST_NAME = 56, ITEM_DRONEWEAPONSDISPLAY1_NAME = 57, ITEM_DRONEWEAPONSDISPLAY2_NAME = 58, BoxofDynamite = 59, SubstandardDuplicator = 60, SingularityBand = 61, ITEM_EMPOWERALWAYS_NAME = 62, WarHorn = 63, FuelCell = 64, LysateCell = 65, OldGuillotine = 66, Willothewisp = 67, VoidsentFlame = 68, FunctionalCoupler = 69, DiosBestFriend = 70, DiosBestFriend_Consumed = 71, PluripotentLarva = 72, PluripotentLarva_Consumed = 73, ChanceDoll = 74, PrayerBeads = 75, H3AD5Tv2 = 76, HopooFeather = 77, KjarosBand = 78, MoltenPerforator = 79, BundleofFireworks = 80, BisonSteak = 81, FocusedConvergence = 82, DelicateWatch = 83, DelicateWatch_Broken = 84, ShippingRequestForm = 85, ITEM_GHOST_NAME = 86, HappiestMask = 87, BrittleCrown = 88, RollofPennies = 89, ITEM_GUMMYCLONEIDENTIFIER_NAME = 90, LightFluxPauldron = 91, StoneFluxPauldron = 92, WakeofVultures = 93, HarvestersScythe = 94, CautiousSlug = 95, PowerElixir = 96, EmptyBottle = 97, ITEM_HEALTHDECAY_NAME = 98, PaulsGoatHoof = 99, RunaldsBand = 100, FrostRelic = 101, Gasoline = 102, BensRaincoat = 103, ChronicExpansion = 104, RejuvenationRack = 105, LuminousShot = 106, AncestralIncubator = 107, Infusion = 108, ITEM_INVADINGDOPPELGANGER_NAME = 109, SonorousWhispers = 110, WaxQuail = 111, FaradaySpur = 112, Junk = 113, Brainstalks = 114, BreachingFin = 115, TitanicKnurl = 116, ResonanceDisc = 117, ITEM_LEMURIANHARNESS_NAME = 118, ITEM_LEVELBONUS_NAME = 119, ChargedPerforator = 120, SaleStar = 121, SaleStar_Consumed = 122, Purity = 123, ShapedGlass = 124, VisionsofHeresy = 125, HooksofHeresy = 126, EssenceofHeresy = 127, Egocentrism = 128, BeadsofFealty = 129, StridesofHeresy = 130, BlessingsofTerafirmae = 131, ITEM_MAGEATTUNEMENT_NAME = 132, EncryptedCerebellum = 133, ExposedCerebellum = 134, Medkit = 135, RunicLens = 136, ITEM_MINIONLEASH_NAME = 138, DefenseNucleus = 139, AtGMissileMk1 = 140, PlasmaShrimp = 141, OminousLoanNote = 142, ITEM_MONSOONPLAYERHELPER_NAME = 143, DefiantGouge = 144, PocketICBM = 145, HuntersHarpoon = 146, BustlingFungus = 147, WeepingFungus = 148, FocusCrystal = 149, NkuhanasOpinion = 150, GenesisLoop = 151, LongstandingSolitude = 152, OddlyshapedOpal = 153, Planula = 154, Pearl = 155, SymbioticScorpion = 156, PersonalShieldGenerator = 157, OldWarStealthkit = 158, OrphanedCore = 159, InterstellarDeskPlant = 160, ITEM_PLANTONHIT_NAME = 161, ITEM_PLASMACORE_NAME = 162, PrisonMatrix = 163, OcularBattery = 164, SentryKey = 165, Shuriken = 166, MercurialRachis = 167, BottledChaos = 168, EulogyZero = 169, RegeneratingScrap = 170, RegeneratingScrap_Consumed = 171, Corpsebloom = 172, EmpathyCores = 173, ItemScrap = 174, Green = 174, StrangeScrapGreen = 175, ItemScrapRed = 176, StrangeScrap = 177, Red = 177, ItemScrapWhite = 178, StrangeScrapWhite = 179, ItemScrapYellow = 180, BackupMagazine = 181, LeechingSeed = 182, NetworkedSuffering = 183, KineticDampener = 184, Transcendence = 185, IrradiantPearl = 186, FaultyConductor = 187, UnstableTeslaCoil = 188, MiredUrn = 189, SkullToken = 190, Chronobauble = 191, Tentabauble = 192, ElusiveAntlers = 193, CollectorsCompulsion = 194, RoseBuckler = 195, EnergyDrink = 196, RedWhip = 197, LittleDisciple = 198, SquidPolyp = 199, ITEM_STATSFROMSCRAP_NAME = 200, HeartyStew = 201, StickyBomb = 202, IgnitionTank = 203, ElectricBoomerang = 204, StunGrenade = 205, SoldiersSyringe = 206, LeptonDaisy = 207, SoulboundCatalyst = 208, UnstableTransmitter = 210, UnstableTransmitter_Consumed = 211, ITEM_TEMPESTONKILL_NAME = 213, Razorwire = 214, HalcyonSeed = 215, TonicAffliction = 216, MonsterTooth = 217, NeutroniumWeight = 218, RustedKey = 219, EncrustedKey = 220, NoxiousThorn = 221, UltimateMeal = 222, HardlightAfterburner = 224, NewlyHatchedZoea = 225, ITEM_WARCRYONCOMBAT_NAME = 227, BerzerkersPauldron = 228, Warbanner = 229, SautéedWorms = 230 } } namespace R2InventoryArtifact.Model { public enum InventoryEffectCode { None, BundleOfFireworks_BisonSteak_IgnitionTank } [Serializable] public class InventoryEffect { public string Name; public string Description; } public class InventoryEffectObserver { public Dictionary<InventoryEffectCode, int> EffectFreqs = new Dictionary<InventoryEffectCode, int>(); private Dictionary<InventoryItem, Dictionary<InventoryEffectCode, int>> _itemEffectMap = new Dictionary<InventoryItem, Dictionary<InventoryEffectCode, int>>(); private Dictionary<InventoryItem, HashSet<InventoryItem>> _adjList = new Dictionary<InventoryItem, HashSet<InventoryItem>>(); public event Action<InventoryEffectCode, int> OnEffectAdd; public event Action<InventoryEffectCode, int> OnEffectRemove; public void AddAdjacency(InventoryItem itemA, InventoryItem itemB) { _adjList[itemA] = _adjList.GetValueOrDefault(itemA, new HashSet<InventoryItem>()); _adjList[itemA].Add(itemB); _adjList[itemB] = _adjList.GetValueOrDefault(itemB, new HashSet<InventoryItem>()); _adjList[itemB].Add(itemA); ValidateAdjacency(itemA); ValidateAdjacency(itemB); } public void RemoveAdjacency(InventoryItem itemA, InventoryItem itemB) { _adjList[itemA].Remove(itemB); _adjList[itemB].Remove(itemA); ValidateAdjacency(itemA); ValidateAdjacency(itemB); } private void ValidateAdjacency(InventoryItem parent) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) HashSet<UniquePickup> adjacent = (from i in _adjList.GetValueOrDefault(parent, new HashSet<InventoryItem>()) select i.Pickup).ToHashSet(); Dictionary<InventoryEffectCode, int> dictionary = (from kvPair in _itemEffectMap.GetValueOrDefault(parent, new Dictionary<InventoryEffectCode, int>()) select new KeyValuePair<InventoryEffectCode, int>(kvPair.Key, 0)).ToDictionary((KeyValuePair<InventoryEffectCode, int> k) => k.Key, (KeyValuePair<InventoryEffectCode, int> v) => v.Value); InventoryEffectCode inventoryEffectCode = InventoryService.GetInventoryEffectCode(parent.Pickup, adjacent); if (inventoryEffectCode != 0) { dictionary[inventoryEffectCode] = dictionary.GetValueOrDefault(inventoryEffectCode, 0) + 1; } List<(InventoryEffectCode, int)> list = new List<(InventoryEffectCode, int)>(); List<(InventoryEffectCode, int)> list2 = new List<(InventoryEffectCode, int)>(); foreach (KeyValuePair<InventoryEffectCode, int> item in dictionary) { item.Deconstruct(out var key, out var value); InventoryEffectCode inventoryEffectCode2 = key; int num = value; int valueOrDefault = _itemEffectMap.GetValueOrDefault(parent, new Dictionary<InventoryEffectCode, int>()).GetValueOrDefault(inventoryEffectCode2, 0); if (num != valueOrDefault) { int num2 = EffectFreqs.GetValueOrDefault(inventoryEffectCode2, 0) - (valueOrDefault - num); if (num > valueOrDefault) { list.Add((inventoryEffectCode2, num2)); } else if (valueOrDefault > num) { list2.Add((inventoryEffectCode2, num2)); } if (num2 > 0) { EffectFreqs[inventoryEffectCode2] = num2; } else { EffectFreqs.Remove(inventoryEffectCode2); } } } list.ForEach(delegate((InventoryEffectCode, int) set) { this.OnEffectAdd?.Invoke(set.Item1, set.Item2); }); list2.ForEach(delegate((InventoryEffectCode, int) set) { this.OnEffectRemove?.Invoke(set.Item1, set.Item2); }); _itemEffectMap[parent] = dictionary; } } public enum PickupType { None, Item, Equipment } [Serializable] public class InventoryItem { public UniquePickup Pickup; public PickupType PickupType = PickupType.None; private List<GridPosition> _nodeOrigin; private List<GridPosition> _activeOrigin; private int _orientation = 0; public List<GridPosition> Nodes; public List<GridPosition> ActiveNodes; private int _stackCount = 1; public int MaxStackCount = 4; public bool IsDroppable = true; public bool IsEquippable = true; public int StackCount { get { return _stackCount; } set { _stackCount = value; this.OnStackCountChanged(); } } public ItemTier ItemTier => ((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.itemTier; public event Action OnStackCountChanged; public InventoryItem(UniquePickup pickup, List<GridPosition> nodeOrigin, List<GridPosition> activeOrigin) { //IL_0033: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 Pickup = pickup; if ((int)((PickupIndex)(ref pickup.pickupIndex)).pickupDef.itemIndex != -1) { PickupType = PickupType.Item; } else if ((int)((PickupIndex)(ref pickup.pickupIndex)).pickupDef.equipmentIndex != -1) { PickupType = PickupType.Equipment; } ItemTier itemTier = ((PickupIndex)(ref pickup.pickupIndex)).pickupDef.itemTier; if (PickupType == PickupType.Item) { ItemTier val = itemTier; ItemTier val2 = val; if ((int)val2 == 3 || val2 - 5 <= 4) { IsDroppable = false; } } _nodeOrigin = nodeOrigin; _activeOrigin = activeOrigin; Nodes = new List<GridPosition>(_nodeOrigin); ActiveNodes = new List<GridPosition>(_activeOrigin); } public void Rotate() { _orientation = (_orientation + 1) % 3; for (int i = 0; i < Nodes.Count; i++) { Nodes[i] = new GridPosition(-Nodes[i].Row, Nodes[i].Col); } for (int j = 0; j < ActiveNodes.Count; j++) { ActiveNodes[j] = new GridPosition(-ActiveNodes[j].Row, ActiveNodes[j].Col); } } public TooltipContent GetTooltipContent() { //IL_0003: 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_006a: 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_0086: 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_0101: 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_0106: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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) TooltipContent result = default(TooltipContent); switch (PickupType) { case PickupType.Item: { ItemDef itemDef = ItemCatalog.GetItemDef(((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.itemIndex); result.titleToken = itemDef.nameToken; result.bodyToken = itemDef.descriptionToken; result.bodyColor = ((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.baseColor; result.titleColor = ((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.darkColor; break; } case PickupType.Equipment: { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.equipmentIndex); result.titleToken = equipmentDef.nameToken; result.bodyToken = equipmentDef.descriptionToken; result.bodyColor = ((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.baseColor; result.titleColor = ((PickupIndex)(ref Pickup.pickupIndex)).pickupDef.darkColor; break; } } return result; } } public enum InventoryResultCode { FAILED, GRID_INSERT, GRID_UPDATE, GRID_REMOVE, HOLD_INSERT, HOLD_UPDATE, HOLD_REMOVE, NONEQUIP_INSERT, NONEQUIP_UPDATE, NONEQUIP_REMOVE } public struct InventoryUpdateResult { public InventoryResultCode ResultCode; public InventoryItem InventoryItem; public GridPosition Pos; public InventoryUpdateResult(InventoryResultCode ResultCode, InventoryItem InventoryItem, GridPosition Pos = default(GridPosition)) { this.ResultCode = ResultCode; this.InventoryItem = InventoryItem; this.Pos = Pos; } } [Serializable] public class InventoryLock { public List<GridPosition> Nodes; public int UnlockLevel; public bool IsLocked = true; } public static class InventoryModel { private static IntRect _grid; private static List<InventoryItem> _holdList; private static List<InventoryItem> _nonEquipList; private static InventoryItem[,] _inventory; public static List<InventoryLock> InventoryLocks; private static Dictionary<InventoryItem, GridPosition> _itemRoot; private static Dictionary<GridPosition, List<InventoryItem>> _activeMap; private static InventoryEffectObserver _effectObserver; public static event Action<InventoryEffectCode, int> OnEffectAdd { add { _effectObserver.OnEffectAdd += value; } remove { _effectObserver.OnEffectAdd -= value; } } public static event Action<InventoryEffectCode, int> OnEffectRemove { add { _effectObserver.OnEffectRemove += value; } remove { _effectObserver.OnEffectRemove -= value; } } public static void Initialize(IntRect grid, List<InventoryLock> locks) { _grid = grid; InventoryLocks = locks; _effectObserver = new InventoryEffectObserver(); Reset(); } public static bool SetItemAt(InventoryItem item, GridPosition pos) { if (!IsValidItemPosition(item, pos)) { return false; } foreach (GridPosition node in item.Nodes) { GridPosition key = node + pos; _inventory[key.Row, key.Col] = item; if (!_activeMap.ContainsKey(key)) { continue; } foreach (InventoryItem item2 in _activeMap[key]) { if (item != item2) { _effectObserver.AddAdjacency(item, item2); } } } foreach (GridPosition activeNode in item.ActiveNodes) { GridPosition gridPosition = activeNode + pos; if (_grid.Contains(gridPosition)) { if (_inventory[gridPosition.Row, gridPosition.Col] != null) { _effectObserver.AddAdjacency(item, _inventory[gridPosition.Row, gridPosition.Col]); } List<InventoryItem> valueOrDefault = _activeMap.GetValueOrDefault(gridPosition, new List<InventoryItem>()); valueOrDefault.Add(item); _activeMap[gridPosition] = valueOrDefault; } } _itemRoot[item] = pos; return true; } public static void UnsetItemAt(InventoryItem item, GridPosition pos) { if (item == null || _inventory[pos.Row, pos.Col] != item) { return; } foreach (GridPosition node in item.Nodes) { GridPosition key = node + pos; _inventory[key.Row, key.Col] = null; if (!_activeMap.ContainsKey(key)) { continue; } foreach (InventoryItem item2 in _activeMap[key]) { if (item != item2) { _effectObserver.RemoveAdjacency(item, item2); } } } foreach (GridPosition activeNode in item.ActiveNodes) { GridPosition gridPosition = activeNode + pos; if (_grid.Contains(gridPosition)) { if (_inventory[gridPosition.Row, gridPosition.Col] != null) { _effectObserver.RemoveAdjacency(item, _inventory[gridPosition.Row, gridPosition.Col]); } _activeMap[gridPosition].Remove(item); if (_activeMap[gridPosition].Count == 0) { _activeMap.Remove(gridPosition); } } } _itemRoot.Remove(item); } public static List<InventoryEffectCode> GetEffectList() { return _effectObserver.EffectFreqs.Keys.ToList(); } public static InventoryItem GetItemAt(GridPosition pos) { return GetItemAt(pos.Row, pos.Col); } public static InventoryItem GetItemAt(int row, int col) { if (!_grid.Contains(row, col)) { return null; } return _inventory[row, col]; } public static GridPosition GetItemRoot(InventoryItem item) { return _itemRoot[item]; } public static InventoryUpdateResult AddToInventory(UniquePickup pickup, bool toNonEquip) { //IL_0001: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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) InventoryItem inventoryItem = InventoryService.GetInventoryItem(pickup); if (toNonEquip) { foreach (InventoryItem nonEquip in _nonEquipList) { if (nonEquip.Pickup == inventoryItem.Pickup) { nonEquip.StackCount++; return new InventoryUpdateResult(InventoryResultCode.NONEQUIP_UPDATE, nonEquip); } } _nonEquipList.Add(inventoryItem); return new InventoryUpdateResult(InventoryResultCode.NONEQUIP_INSERT, inventoryItem); } for (int i = 0; i < _grid.Height; i++) { for (int j = 0; j < _grid.Width; j++) { if (_inventory[i, j] != null && _inventory[i, j].Pickup == inventoryItem.Pickup && _inventory[i, j].StackCount < _inventory[i, j].MaxStackCount) { _inventory[i, j].StackCount++; return new InventoryUpdateResult(InventoryResultCode.GRID_UPDATE, _inventory[i, j], new GridPosition(j, i)); } } } foreach (InventoryItem hold in _holdList) { if (hold.Pickup == inventoryItem.Pickup && hold.StackCount < hold.MaxStackCount) { hold.StackCount++; return new InventoryUpdateResult(InventoryResultCode.HOLD_UPDATE, hold); } } for (int k = 0; k < _grid.Height; k++) { for (int l = 0; l < _grid.Width; l++) { for (int m = 0; m < 4; m++) { GridPosition pos = new GridPosition(l, k); if (IsValidItemPosition(inventoryItem, pos)) { SetItemAt(inventoryItem, pos); return new InventoryUpdateResult(InventoryResultCode.GRID_INSERT, inventoryItem, pos); } inventoryItem.Rotate(); } } } AddToHold(inventoryItem); return new InventoryUpdateResult(InventoryResultCode.HOLD_INSERT, inventoryItem); } private static List<InventoryUpdateResult> RemoveFromNonEquip(UniquePickup pickup, int count) { //IL_0007: 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) List<InventoryUpdateResult> list = new List<InventoryUpdateResult>(); InventoryItem inventoryItem = _nonEquipList.Find((InventoryItem ne) => ne.Pickup == pickup); if (inventoryItem == null) { return list; } InventoryUpdateResult inventoryUpdateResult = default(InventoryUpdateResult); inventoryUpdateResult.InventoryItem = inventoryItem; inventoryUpdateResult.Pos = default(GridPosition); inventoryUpdateResult.ResultCode = InventoryResultCode.NONEQUIP_UPDATE; InventoryUpdateResult item = inventoryUpdateResult; inventoryItem.StackCount = Math.Max(inventoryItem.StackCount - count, 0); if (inventoryItem.StackCount == 0) { _nonEquipList.Remove(inventoryItem); item.ResultCode = InventoryResultCode.NONEQUIP_REMOVE; } list.Add(item); return list; } public static List<InventoryUpdateResult> RemoveItems(UniquePickup pickup, bool fromNonEquip, int count = 1) { //IL_0007: 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_0024: 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_0084: Unknown result type (might be due to invalid IL or missing references) if (fromNonEquip || ((UniquePickup)(ref pickup)).isTempItem) { return RemoveFromNonEquip(pickup, count); } List<InventoryUpdateResult> list = new List<InventoryUpdateResult>(); List<InventoryUpdateResult> tmp = new List<InventoryUpdateResult>(); _holdList.ForEach(delegate(InventoryItem item) { //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) if (item.Pickup == pickup) { tmp.Add(new InventoryUpdateResult { ResultCode = InventoryResultCode.HOLD_UPDATE, InventoryItem = item }); } }); foreach (InventoryItem key in _itemRoot.Keys) { if (key.Pickup == pickup) { tmp.Add(new InventoryUpdateResult { ResultCode = InventoryResultCode.GRID_UPDATE, InventoryItem = key, Pos = _itemRoot[key] }); } } tmp.Sort((InventoryUpdateResult item1, InventoryUpdateResult item2) => (item1.ResultCode == item2.ResultCode) ? (item1.InventoryItem.StackCount - item2.InventoryItem.StackCount) : (item1.ResultCode - item2.ResultCode)); int num = 0; for (int i = 0; i < tmp.Count; i++) { if (num >= count) { break; } InventoryUpdateResult item3 = tmp[i]; int num2 = count - num; if (item3.InventoryItem.StackCount > num2) { item3.InventoryItem.StackCount -= num2; list.Add(item3); break; } switch (item3.ResultCode) { case InventoryResultCode.GRID_UPDATE: UnsetItemAt(item3.InventoryItem, item3.Pos); item3.ResultCode = InventoryResultCode.GRID_REMOVE; break; case InventoryResultCode.HOLD_UPDATE: RemoveFromHold(item3.InventoryItem); item3.ResultCode = InventoryResultCode.HOLD_REMOVE; break; } list.Add(item3); num += item3.InventoryItem.StackCount; } return list; } public static void RemoveFromNonEquip(InventoryItem item) { _nonEquipList.Remove(item); } public static bool IsPositionLocked(GridPosition pos) { foreach (InventoryLock inventoryLock in InventoryLocks) { foreach (GridPosition node in inventoryLock.Nodes) { if (pos == node) { return inventoryLock.IsLocked; } } } return false; } public static List<InventoryLock> SetUnlocksAtLevel(int level) { List<InventoryLock> list = new List<InventoryLock>(); for (int i = 0; i < InventoryLocks.Count; i++) { if (InventoryLocks[i].IsLocked && InventoryLocks[i].UnlockLevel <= level) { InventoryLocks[i].IsLocked = false; list.Add(InventoryLocks[i]); } } return list; } public static bool IsValidItemPosition(InventoryItem item, GridPosition pos) { foreach (GridPosition node in item.Nodes) { GridPosition pos2 = pos + node; if (!_grid.Contains(pos2) || _inventory[pos2.Row, pos2.Col] != null || IsPositionLocked(pos2)) { return false; } } return true; } public static void AddToHold(InventoryItem item) { _holdList.Add(item); } public static void RemoveFromHold(InventoryItem item) { _holdList.Remove(item); } public new static string ToString() { List<string> list = new List<string>(); for (int i = 0; i < _inventory.GetLength(0); i++) { List<string> list2 = new List<string>(); for (int j = 0; j < _inventory.GetLength(1); j++) { list2.Add((_inventory[i, j] != null) ? "[x]" : "[ ]"); } list.Add(string.Join("\t", list2)); } return string.Join("\n", list); } internal static List<InventoryUpdateResult> DiscardHold() { if (_holdList.Count == 0) { return new List<InventoryUpdateResult>(); } List<InventoryUpdateResult> list = _holdList.Select((InventoryItem item) => new InventoryUpdateResult(InventoryResultCode.HOLD_REMOVE, item)).ToList(); list.ForEach(delegate(InventoryUpdateResult res) { RemoveFromHold(res.InventoryItem); }); return list; } internal static void Reset() { _inventory = new InventoryItem[_grid.Height, _grid.Width]; _activeMap = new Dictionary<GridPosition, List<InventoryItem>>(); _holdList = new List<InventoryItem>(); _nonEquipList = new List<InventoryItem>(); _itemRoot = new Dictionary<InventoryItem, GridPosition>(); for (int i = 0; i < InventoryLocks.Count; i++) { InventoryLocks[i].IsLocked = true; } } } } namespace R2InventoryArtifact.UI { public class InventoryUI : MonoBehaviour, IDropHandler, IEventSystemHandler { public static InventoryUI Instance; private CanvasGroup _canvasGroup; private InventoryGridComponent _inventoryGrid; private InventoryHoldComponent _inventoryHoldList; private InventoryNonEquipComponent _inventoryNonEquipList; private InventoryDropComponent _inventoryDropArea; public InventoryItemElement CursorElement; public int PlayerLevel; public bool IsVisible = true; public event Action<UniquePickup, int> OnInventoryItemDropped; public event Action<bool> OnUIVisibilityChanged; private void Awake() { Log.Debug("InventoryUI Awake...."); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } public void Initialize(IntRect rect, List<InventoryLock> locks) { if (Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } Instance = this; InventoryModel.Initialize(rect, locks); _canvasGroup = ((Component)this).GetComponent<CanvasGroup>(); _inventoryHoldList = ComponentBuilder.BuildInventoryHoldComponent(((Component)this).transform); _inventoryDropArea = ComponentBuilder.BuildInventoryDropComponent(((Component)this).transform); _inventoryGrid = ComponentBuilder.BuildInventoryGridComponent(((Component)this).transform); _inventoryNonEquipList = ComponentBuilder.BuildInventoryNonEquipComponent(((Component)this).transform); _inventoryGrid.Initialize(rect, locks); _inventoryDropArea.OnInventoryItemDropped += HandleItemDrop; } private void OnDestroy() { _inventoryDropArea.OnInventoryItemDropped -= HandleItemDrop; Log.Info("destroyed inventoryui"); } public void SetUIVisibility(bool show) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown _canvasGroup.alpha = (show ? 1 : 0); _canvasGroup.blocksRaycasts = show; IsVisible = show; if (!show) { List<InventoryUpdateResult> list = InventoryModel.DiscardHold(); list.ForEach(delegate(InventoryUpdateResult res) { _inventoryHoldList.RemoveFromHold(res.InventoryItem); HandleItemDrop(res.InventoryItem); }); if ((Object)(object)CursorElement != (Object)null) { PointerEventData val = new PointerEventData(EventSystem.current); if (CursorElement.DragSource == DragSource.HOLD) { val.pointerDrag = ((Component)CursorElement).gameObject; ExecuteEvents.endDragHandler.Invoke((IEndDragHandler)(object)CursorElement, (BaseEventData)(object)val); _inventoryHoldList.OnDrop(val); } } } this.OnUIVisibilityChanged?.Invoke(show); } public void HandleItemDrop(InventoryItem item) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.OnInventoryItemDropped(item.Pickup, item.StackCount); } public InventoryResultCode AddToInventory(UniquePickup pickup, bool toNonEquip) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) InventoryUpdateResult inventoryUpdateResult = InventoryModel.AddToInventory(pickup, toNonEquip); switch (inventoryUpdateResult.ResultCode) { case InventoryResultCode.NONEQUIP_INSERT: _inventoryNonEquipList.AddItem(inventoryUpdateResult.InventoryItem); break; case InventoryResultCode.GRID_INSERT: _inventoryGrid.InsertItemAt(inventoryUpdateResult.InventoryItem, inventoryUpdateResult.Pos); break; case InventoryResultCode.HOLD_INSERT: _inventoryHoldList.AddToHold(inventoryUpdateResult.InventoryItem); break; } return inventoryUpdateResult.ResultCode; } public void AddToHold(InventoryItem item) { InventoryModel.AddToHold(item); _inventoryHoldList.AddToHold(item); } public void RemoveFromInventory(UniquePickup pickup, bool fromNonEquip, int count) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) List<InventoryUpdateResult> list = InventoryModel.RemoveItems(pickup, fromNonEquip, count); list.ForEach(delegate(InventoryUpdateResult result) { switch (result.ResultCode) { case InventoryResultCode.GRID_REMOVE: _inventoryGrid.RemoveAt(result.Pos); break; case InventoryResultCode.HOLD_REMOVE: _inventoryHoldList.RemoveFromHold(result.InventoryItem); break; case InventoryResultCode.NONEQUIP_REMOVE: _inventoryNonEquipList.RemoveFromNonEquip(result.InventoryItem); break; } }); } public void SetCursorElement(InventoryItemElement element) { CursorElement = element; _inventoryGrid.RepaintGrid(); } public void SetPlayerLevel(int playerLevel) { PlayerLevel = playerLevel; Debug.Log((object)$"Setting player level to: {PlayerLevel}"); List<InventoryLock> locks = InventoryModel.SetUnlocksAtLevel(PlayerLevel); _inventoryGrid.UpdateGridLocks(locks); _inventoryGrid.RepaintGrid(); } public void ResetInventory() { InventoryModel.Reset(); _inventoryHoldList.Clear(); _inventoryNonEquipList.Clear(); _inventoryGrid.Clear(); _inventoryGrid.UpdateGridLocks(InventoryModel.InventoryLocks); _inventoryGrid.RepaintGrid(); PlayerLevel = 0; } public void RotateCursorItem() { if ((Object)(object)CursorElement != (Object)null) { CursorElement.Rotate(); _inventoryGrid.RepaintGrid(); } } public void OnDrop(PointerEventData eventData) { InventoryItemElement component = eventData.pointerDrag.GetComponent<InventoryItemElement>(); if ((Object)(object)component != (Object)null && component.DragSource == DragSource.HOLD) { AddToHold(component.Item); Object.Destroy((Object)(object)((Component)component).gameObject); } } } public static class UIConstants { public const int SPACING_SX = 2; public const int SPACING_SM = 4; public const int SPACING_MD = 8; public const int SPACING_LG = 12; public const int FONT_SM = 8; public const int FONT_MD = 12; public const int FONT_LG = 16; private const float ALPHA = 0.5f; public static readonly Color COLOR_ITEM_SLOT_NEUTRAL = ColorFromHex("#ffffff", 0.5f); public static readonly Color COLOR_ITEM_SLOT_ACTIVE = ColorFromHex("#daa520", 0.5f); public static readonly Color COLOR_ITEM_SLOT_ACTIVE_OUTLINE = ColorFromHex("#b8860b", 0.5f); public static readonly Color COLOR_ITEM_SLOT_HOVER_VALID = ColorFromHex("#008000", 0.5f); public static readonly Color COLOR_ITEM_SLOT_HOVER_INVALID = ColorFromHex("#FF0000", 0.5f); public static readonly Color COLOR_ITEM_SLOT_LOCKED = ColorFromHex("#414141", 0.5f); public static readonly Color COLOR_TOOLTIP_TITLE_SLOT_LOCKED = ColorFromHex("#414141", 0.5f); public static readonly Color COLOR_TOOLTIP_BODY_SLOT_LOCKED = ColorFromHex("#d6d6d6", 0.5f); public static (Color, Color) GetItemTeirColor(ItemTier tier) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected I4, but got Unknown //IL_0042: 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_006b: 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) //IL_0094: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) return (int)tier switch { 0 => (ColorFromHex("#6b6b6b", 0.5f), ColorFromHex("#6b6b6b", 0.5f)), 1 => (ColorFromHex("#a0ff9a", 0.5f), ColorFromHex("#2f7d32", 0.5f)), 2 => (ColorFromHex("#ff6b6b", 0.5f), ColorFromHex("#8b1a1a", 0.5f)), 4 => (ColorFromHex("#ffd966", 0.5f), ColorFromHex("#b38f00", 0.5f)), 3 => (ColorFromHex("#7fbfff", 0.5f), ColorFromHex("#1f4f99", 0.5f)), 6 => (ColorFromHex("#d98cff", 0.5f), ColorFromHex("#6b2f8f", 0.5f)), 7 => (ColorFromHex("#d98cff", 0.5f), ColorFromHex("#6b2f8f", 0.5f)), 8 => (ColorFromHex("#d98cff", 0.5f), ColorFromHex("#6b2f8f", 0.5f)), 9 => (ColorFromHex("#d98cff", 0.5f), ColorFromHex("#6b2f8f", 0.5f)), _ => (ColorFromHex("#6b6b6b", 0.5f), ColorFromHex("#6b6b6b", 0.5f)), }; } public static Color ColorFromHex(string hex, float alpha = 1f) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = 0f; float num3 = 0f; hex = hex.Trim().Replace("#", ""); num = (float)Convert.ToInt32(hex.Substring(0, 2), 16) / 256f; num2 = (float)Convert.ToInt32(hex.Substring(2, 2), 16) / 256f; num3 = (float)Convert.ToInt32(hex.Substring(4, 2), 16) / 256f; return new Color(num, num2, num3, alpha); } } } namespace R2InventoryArtifact.UI.Services { public class InventoryItemProps { public List<GridPosition> NodeOrigin; public List<GridPosition> ActiveOrigin; public int MaxStackCount; } public class InventoryService { private static string _ITEM_DATA_FILENAME = "item_data.json"; private static Dictionary<string, InventoryItemProps> _inventoryDict; public static void Initialize(PluginInfo pluginInfo) { _inventoryDict = new Dictionary<string, InventoryItemProps>(); string directoryName = Path.GetDirectoryName(pluginInfo.Location); if (string.IsNullOrEmpty(directoryName)) { return; } string text = Path.Combine(directoryName, "Assets", _ITEM_DATA_FILENAME); Log.Info("try load file: " + text); try { using StreamReader streamReader = new StreamReader(text); string text2 = streamReader.ReadToEnd(); _inventoryDict = JsonConvert.DeserializeObject<Dictionary<string, InventoryItemProps>>(text2); } catch (Exception arg) { Log.Info($"Unable to read file ({text}): {arg}"); } } public static InventoryItem GetInventoryItem(UniquePickup pickup) { //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Expected I4, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Invalid comparison between Unknown and I4 //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Expected I4, but got Unknown //IL_050c: Unknown result type (might be due to invalid IL or missing references) InventoryItemProps valueOrDefault = _inventoryDict.GetValueOrDefault(((PickupIndex)(ref pickup.pickupIndex)).pickupDef.nameToken, null); if (valueOrDefault != null) { return new InventoryItem(pickup, valueOrDefault.NodeOrigin, valueOrDefault.ActiveOrigin) { MaxStackCount = valueOrDefault.MaxStackCount }; } List<List<GridPosition>> list = new List<List<GridPosition>> { new List<GridPosition> { new GridPosition(0, 0), new GridPosition(0, 1), new GridPosition(1, 0), new GridPosition(1, 1) }, new List<GridPosition> { new GridPosition(-1, 0), new GridPosition(0, 0), new GridPosition(1, 0), new GridPosition(2, 0) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(0, -1), new GridPosition(-1, -1), new GridPosition(1, 0) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(0, -1), new GridPosition(1, -1) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(1, 0), new GridPosition(0, 1), new GridPosition(0, 2) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(0, 1), new GridPosition(0, 2) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(1, 0), new GridPosition(0, -1) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(1, 0), new GridPosition(1, 1), new GridPosition(-1, 0), new GridPosition(-1, 1) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(-2, 0), new GridPosition(1, 0), new GridPosition(2, 0) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(1, 0), new GridPosition(0, -1), new GridPosition(0, -2) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(-1, -1), new GridPosition(0, 1), new GridPosition(1, 1) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(0, 1), new GridPosition(1, 0), new GridPosition(1, 1), new GridPosition(1, 2) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(1, 0), new GridPosition(0, -1), new GridPosition(0, 1) }, new List<GridPosition> { new GridPosition(0, 0), new GridPosition(-1, 0), new GridPosition(-2, 0), new GridPosition(0, 1), new GridPosition(0, 2) } }; int maxStackCount = 2; ItemTier itemTier = ((PickupIndex)(ref pickup.pickupIndex)).pickupDef.itemTier; ItemTier val = itemTier; switch ((int)val) { case 0: case 6: case 10: maxStackCount = 5; break; case 1: case 7: maxStackCount = 4; break; case 2: case 8: maxStackCount = 3; break; } ItemIndex itemIndex = ((PickupIndex)(ref pickup.pickupIndex)).pickupDef.itemIndex; EquipmentIndex equipmentIndex = ((PickupIndex)(ref pickup.pickupIndex)).pickupDef.equipmentIndex; int val2 = (int)(((int)itemIndex != -1) ? itemIndex : equipmentIndex); val2 = Math.Max(val2, 0) % list.Count; return new InventoryItem(pickup, new List<GridPosition>(list[val2]), new List<GridPosition>()) { MaxStackCount = maxStackCount }; } public static InventoryEffectCode GetInventoryEffectCode(UniquePickup pickup, HashSet<UniquePickup> adjacent) { return InventoryEffectCode.None; } public static InventoryEffect GetInventoryEffectInfo(InventoryEffectCode effectCode) { if (effectCode == InventoryEffectCode.BundleOfFireworks_BisonSteak_IgnitionTank) { return new InventoryEffect { Name = "Cook-out", Description = "Bundle of Fireworks now ignite on it" }; } return null; } } public static class UIAssetService { public static void Initialize() { } public static Sprite GetSprite(UniquePickup pickup) { return ((PickupIndex)(ref pickup.pickupIndex)).pickupDef.iconSprite; } } } namespace R2InventoryArtifact.UI.Layouts { [Serializable] public struct BentoSpan { public int Col; public int Row; [Min(1f)] public int ColSpan; [Min(1f)] public int RowSpan; } public class BentoLayoutGroup : LayoutGroup { [SerializeField] private float m_Spacing; [SerializeField] private int m_UnitWidth = 1; [SerializeField] private int m_UnitHeight = 1; [SerializeField] private List<BentoSpan> m_Spans; [HideInInspector] public float Spacing { get { return m_Spacing; } set { m_Spacing = value; } } [HideInInspector] public int UnitWidth { get { return m_UnitWidth; } set { m_UnitWidth = value; } } [HideInInspector] public int UnitHeight { get { return m_UnitHeight; } set { m_UnitHeight = value; } } [HideInInspector] public List<BentoSpan> Spans { get { return m_Spans; } set { m_Spans = value ?? new List<BentoSpan>(); } } public override void CalculateLayoutInputHorizontal() { ((LayoutGroup)this).CalculateLayoutInputHorizontal(); ((LayoutGroup)this).SetLayoutInputForAxis(1f, 1f, 1f, 0); } public override void CalculateLayoutInputVertical() { ((LayoutGroup)this).CalculateLayoutInputHorizontal(); ((LayoutGroup)this).SetLayoutInputForAxis(1f, 1f, 1f, 1); } private (float, float) CalcChildAxis(int axis, BentoSpan span) { //IL_0079: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) float num; Rect rect; float num2; int num3; int num4; if (axis == 0) { num = ((LayoutGroup)this).padding.left; rect = ((LayoutGroup)this).rectTransform.rect; num2 = (((Rect)(ref rect)).width - (float)((LayoutGroup)this).padding.horizontal - Spacing * (float)(UnitWidth - 1)) / (float)UnitWidth; num3 = span.Col; num4 = span.ColSpan; } else { num = ((LayoutGroup)this).padding.top; rect = ((LayoutGroup)this).rectTransform.rect; num2 = (((Rect)(ref rect)).height - (float)((LayoutGroup)this).padding.vertical - Spacing * (float)(UnitHeight - 1)) / (float)UnitHeight; num3 = span.Row; num4 = span.RowSpan; } float item = num + num2 * (float)num3 + Spacing * (float)num3; float item2 = num2 * (float)num4 + Spacing * (float)(num4 - 1); return (item, item2); } public override void SetLayoutHorizontal() { int num = Mathf.Min(((LayoutGroup)this).rectChildren.Count, m_Spans.Count); for (int i = 0; i < num; i++) { var (num2, num3) = CalcChildAxis(0, Spans[i]); ((LayoutGroup)this).SetChildAlongAxis(((LayoutGroup)this).rectChildren[i], 0, num2, num3); } } public override void SetLayoutVertical() { int num = Mathf.Min(((LayoutGroup)this).rectChildren.Count, m_Spans.Count); for (int i = 0; i < num; i++) { var (num2, num3) = CalcChildAxis(1, Spans[i]); ((LayoutGroup)this).SetChildAlongAxis(((LayoutGroup)this).rectChildren[i], 1, num2, num3); } } } public class InventoryGridLayoutGroup : LayoutGroup { private int _cols = 5; private float _cellSize = 100f; private float _spacing = 0f; public Action<float> OnCellSizeChanged; public void Initialize(int cols, int spacing) { _cols = cols; _spacing = spacing; } public override void CalculateLayoutInputHorizontal() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) ((LayoutGroup)this).CalculateLayoutInputHorizontal(); Rect rect = ((LayoutGroup)this).rectTransform.rect; float num = ((Rect)(ref rect)).width - (float)((LayoutGroup)this).padding.horizontal; _cellSize = num / (float)_cols; ((LayoutGroup)this).SetLayoutInputForAxis(num, num, num, 0); OnCellSizeChanged(_cellSize); } public override void CalculateLayoutInputVertical() { //IL_003c: 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) ((LayoutGroup)this).CalculateLayoutInputHorizontal(); float num = _cellSize * (float)(((LayoutGroup)this).rectChildren.Count / _cols) + (float)((LayoutGroup)this).padding.vertical; ((LayoutGroup)this).rectTransform.sizeDelta = new Vector2(((LayoutGroup)this).rectTransform.sizeDelta.x, num); ((LayoutGroup)this).SetLayoutInputForAxis(num, num, num, 1); } public override void SetLayoutHorizontal() { float start = ((LayoutGroup)this).padding.left; int i = 0; ((LayoutGroup)this).rectChildren.ForEach(delegate { ((LayoutGroup)this).SetChildAlongAxis(((LayoutGroup)this).rectChildren[i], 0, start + _cellSize * (float)(i % _cols), _cellSize); i++; }); } public override void SetLayoutVertical() { float start = ((LayoutGroup)this).padding.top; int i = 0; ((LayoutGroup)this).rectChildren.ForEach(delegate { ((LayoutGroup)this).SetChildAlongAxis(((LayoutGroup)this).rectChildren[i], 1, start + _cellSize * (float)(i / _cols), _cellSize); i++; }); } } } namespace R2InventoryArtifact.UI.Components { public class InventoryDropComponent : MonoBehaviour, IDropHandler, IEventSystemHandler { public event Action<InventoryItem> OnInventoryItemDropped; public void OnDrop(PointerEventData eventData) { InventoryItemElement component = eventData.pointerDrag.GetComponent<InventoryItemElement>(); if (!((Object)(object)component == (Object)null) && component.Item.IsDroppable) { this.OnInventoryItemDropped(component.Item); Object.Destroy((Object)(object)((Component)component).gameObject); } } } public class InventoryEffectComponent : MonoBehaviour { private TextMeshProUGUI textLbl; private Dictionary<InventoryEffectCode, InventoryEffectElement> _effectDict; public void Initialize() { InventoryModel.OnEffectAdd += AddEffect; InventoryModel.OnEffectRemove += RemoveEffect; } private void Awake() { textLbl = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); _effectDict = new Dictionary<InventoryEffectCode, InventoryEffectElement>(); } private void OnDestroy() { InventoryModel.OnEffectAdd -= AddEffect; InventoryModel.OnEffectRemove -= RemoveEffect; } private void AddEffect(InventoryEffectCode code, int stackCount) { if (_effectDict.ContainsKey(code)) { _effectDict[code].UpdateContent(code, stackCount); return; } InventoryEffectElement inventoryEffectElement = ComponentBuilder.BuildEffectElement(code.ToString()); _effectDict[code] = inventoryEffectElement; inventoryEffectElement.UpdateContent(code, stackCount); ((Component)inventoryEffectElement).transform.SetParent(((Component)this).transform); } private void RemoveEffect(InventoryEffectCode code, int stackCount) { if (stackCount > 0) { _effectDict[code].UpdateContent(code, stackCount); return; } Object.Destroy((Object)(object)((Component)_effectDict[code]).gameObject); _effectDict.Remove(code); } } public class InventoryEffectElement : MonoBehaviour { private TextMeshProUGUI text; private void Awake() { text = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); } public void UpdateContent(InventoryEffectCode code, int stackCount) { ((TMP_Text)text).text = $"{code} ({stackCount})"; } } public class InventoryGridComponent : MonoBehaviour, IPointerExitHandler, IEventSystemHandler { private IntRect _gridRect; private InventorySlotComponent[,] _slots; private GridPosition? _cursorPosition; private static List<(int, int)> _DIRS = new List<(int, int)> { (-1, 0), (1, 0), (0, -1), (0, 1) }; public void Initialize(IntRect gridSize, List<InventoryLock> locks) { _gridRect = gridSize; _slots = new InventorySlotComponent[_gridRect.Height, _gridRect.Width]; InventoryGridLayoutGroup inventoryGridLayoutGroup = ((Component)this).gameObject.AddComponent<InventoryGridLayoutGroup>(); inventoryGridLayoutGroup.Initialize(_gridRect.Width, 4); ScrollRect scrollRect; if (Object.op_Implicit((Object)(object)(scrollRect = ((Component)((Component)this).gameObject.transform.parent.parent).GetComponent<ScrollRect>()))) { inventoryGridLayoutGroup.OnCellSizeChanged = (Action<float>)Delegate.Combine(inventoryGridLayoutGroup.OnCellSizeChanged, new Action<float>(HandleCellSizeChanged)); } for (int i = 0; i < gridSize.Height; i++) { for (int j = 0; j < gridSize.Width; j++) { GridPosition pos = new GridPosition(j, i); InventorySlotComponent inventorySlotComponent = ComponentBuilder.BuildGridSlot(((Component)this).transform, $"{i}-{j}"); inventorySlotComponent.Initialize(this, pos); _slots[i, j] = inventorySlotComponent; } } UpdateGridLocks(locks); void HandleCellSizeChanged(float size) { scrollRect.scrollSensitivity = size / 2f; } } public void InsertItemAt(InventoryItem item, GridPosition pos) { InventoryItemElement inventoryItemElement = ComponentBuilder.BuildItemElement(((object)(UniquePickup)(ref item.Pickup)).ToString() ?? ""); inventoryItemElement.Initialize(item, DragSource.GRID); ((Component)inventoryItemElement).transform.SetParent(((Component)_slots[pos.Row, pos.Col]).transform); } internal void RemoveAt(GridPosition pos) { if (((Component)_slots[pos.Row, pos.Col]).transform.childCount != 0) { Transform child = ((Component)_slots[pos.Row, pos.Col]).transform.GetChild(0); InventoryItemElement component; if (Object.op_Implicit((Object)(object)child) && Object.op_Implicit((Object)(object)(component = ((Component)child).GetComponent<InventoryItemElement>()))) { Object.Destroy((Object)(object)((Component)component).gameObject); } } } public void UnsetItemAt(InventoryItem item, GridPosition pos) { InventoryModel.UnsetItemAt(item, pos); SetHelper(item, pos, set: false); } public void SetItemAt(InventoryItem item, GridPosition pos) { InventoryModel.SetItemAt(item, pos); SetHelper(item, pos, set: true); } private void SetHelper(InventoryItem item, GridPosition pos, bool set) { foreach (GridPosition node in item.Nodes) { GridPosition gridPosition = node + pos; InventorySlotComponent inventorySlotComponent = _slots[gridPosition.Row, gridPosition.Col]; if (set) { inventorySlotComponent.Occupy(item); } else { inventorySlotComponent.UnOccupy(); } } RepaintGrid(); } public void UpdateCursorPosition(GridPosition pos) { _cursorPosition = pos; RepaintGrid(); } public void RepaintGrid() { //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) List<GridPosition> list = new List<GridPosition>(); List<GridPosition> list2 = new List<GridPosition>(); bool flag = true; if (_cursorPosition.HasValue) { if ((Object)(object)InventoryUI.Instance.CursorElement != (Object)null) { flag = InventoryModel.IsValidItemPosition(InventoryUI.Instance.CursorElement.Item, _cursorPosition.Value); list = InventoryUI.Instance.CursorElement.Item.Nodes.Select((GridPosition n) => n + _cursorPosition.Value).ToList(); list2 = (from n in InventoryUI.Instance.CursorElement.Item.ActiveNodes select n + _cursorPosition.Value into n where _gridRect.Contains(n) select n).ToList(); } else { InventoryItem itemAt = InventoryModel.GetItemAt(_cursorPosition.Value); if (itemAt != null) { GridPosition itemRoot = InventoryModel.GetItemRoot(itemAt); list2 = (from n in itemAt.Nodes select n + itemRoot into n where _gridRect.Contains(n) select n).ToList(); } } } for (int i = 0; i < _gridRect.Height; i++) { for (int j = 0; j < _gridRect.Width; j++) { InventoryItem itemAt2 = InventoryModel.GetItemAt(i, j); InventorySlotComponent inventorySlotComponent = _slots[i, j]; bool[] array = new bool[4]; if (itemAt2 != null) { for (int k = 0; k < _DIRS.Count; k++) { int num = i + _DIRS[k].Item1; int num2 = j + _DIRS[k].Item2; array[k] = _gridRect.Contains(num2, num) && InventoryModel.GetItemAt(num, num2) == itemAt2; } } GridPosition gridPosition = new GridPosition(j, i); if (InventoryModel.IsPositionLocked(gridPosition)) { inventorySlotComponent.Paint(UIConstants.COLOR_ITEM_SLOT_LOCKED); } else if (list2.Contains(gridPosition)) { inventorySlotComponent.Paint(UIConstants.COLOR_ITEM_SLOT_ACTIVE, UIConstants.COLOR_ITEM_SLOT_ACTIVE_OUTLINE, array[0], array[1], array[2], array[3]); } else if (itemAt2 != null) { Color titleColor = itemAt2.GetTooltipContent().titleColor; inventorySlotComponent.Paint(titleColor, titleColor, array[0], array[1], array[2], array[3]); } else if ((Object)(object)InventoryUI.Instance.CursorElement != (Object)null && _cursorPosition.HasValue && list.Contains(gridPosition)) { inventorySlotComponent.Paint(flag ? UIConstants.COLOR_ITEM_SLOT_HOVER_VALID : UIConstants.COLOR_ITEM_SLOT_HOVER_INVALID); } else { inventorySlotComponent.Paint(UIConstants.COLOR_ITEM_SLOT_NEUTRAL); } } } } public void OnPointerExit(PointerEventData eventData) { _cursorPosition = null; RepaintGrid(); } public void UpdateGridLocks(List<InventoryLock> locks) { foreach (InventoryLock invLock in locks) { invLock.Nodes.ForEach(delegate(GridPosition node) { if (_gridRect.Contains(node)) { if (invLock.IsLocked) { _slots[node.Row, node.Col].LockSlot(invLock); } else { _slots[node.Row, node.Col].UnlockSlot(); } } }); } } internal void Clear() { for (int i = 0; i < _slots.GetLength(0); i++) { for (int j = 0; j < _slots.GetLength(1); j++) { if (((Component)_slots[i, j]).transform.childCount > 0) { Object.Destroy((Object)(object)((Component)((Component)_slots[i, j]).transform.GetChild(0)).gameObject); } } } } } public class InventoryHoldComponent : MonoBehaviour, IDropHandler, IEventSystemHandler { public static InventoryHoldComponent Instance; private static Transform _listTarget; private static List<InventoryHoldElement> _elements; private void Awake() { Instance = this; if (((Component)this).transform.childCount > 0) { _listTarget = ((Component)this).transform.GetChild(0); } else { _listTarget = ((Component)this).transform; } _elements = new List<InventoryHoldElement>(); } public void AddToHold(InventoryItem item) { InventoryHoldElement inventoryHoldElement = ComponentBuilder.BuildHoldElement(_listTarget, ((object)(UniquePickup)(ref item.Pickup)).ToString()); inventoryHoldElement.Initialize(item); ((Component)inventoryHoldElement).transform.SetParent(_listTarget); _elements.Add(inventoryHoldElement); } public void RemoveFromHold(InventoryItem item) { InventoryHoldElement inventoryHoldElement = _elements.Find((InventoryHoldElement element) => element.Item == item); _elements.Remove(inventoryHoldElement); if (Object.op_Implicit((Object)(object)inventoryHoldElement)) { Object.Destroy((Object)(object)((Component)inventoryHoldElement).gameObject); } } public void OnDrop(PointerEventData eventData) { InventoryItemElement component = eventData.pointerDrag.GetComponent<InventoryItemElement>(); if (!((Object)(object)component == (Object)null) && (component.Item.IsDroppable || component.DragSource != DragSource.GRID) && component.DragSource != DragSource.NONEQUIP) { InventoryItem item = component.Item; Object.Destroy((Object)(object)((Component)component).gameObject); InventoryUI.Instance.AddToHold(item); } } internal void Clear() { foreach (InventoryHoldElement element in _elements) { Object.Destroy((Object)(object)((Component)element).gameObject); } } } public class InventoryHoldElement : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { public InventoryItem Item; private TextMeshProUGUI _titleLbl; private TextMeshProUGUI _stackLbl; private Image _icon; private TooltipProvider _tooltip; public void Initialize(InventoryItem item) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Item = item; _icon = ((Component)((Component)this).transform.GetChild(0)).GetComponent<Image>(); TextMeshProUGUI[] componentsInChildren = ((Component)this).GetComponentsInChildren<TextMeshProUGUI>(); _titleLbl = componentsInChildren[0]; _stackLbl = componentsInChildren[1]; _icon.sprite = UIAssetService.GetSprite(item.Pickup); Item.OnStackCountChanged += UpdateLabels; _tooltip = ((Component)this).gameObject.AddComponent<TooltipProvider>(); _tooltip.SetContent(Item.GetTooltipContent()); UpdateLabels(); } private void OnDestroy() { Item.OnStackCountChanged -= UpdateLabels; } public void UpdateLabels() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_titleLbl != (Object)null) { ((TMP_Text)_titleLbl).text = Language.GetString(Item.GetTooltipContent().titleToken); } if ((Object)(object)_stackLbl != (Object)null) { ((TMP_Text)_stackLbl).text = $"Stack: {Item.StackCount}"; } } public void OnBeginDrag(PointerEventData eventData) { InventoryItemElement inventoryItemElement = ComponentBuilder.BuildItemElement(((object)(UniquePickup)(ref Item.Pickup)).ToString()); inventoryItemElement.Initialize(Item, DragSource.HOLD); ((Component)inventoryItemElement).transform.SetParent(((Component)InventoryUI.Instance).transform); eventData.pointerDrag = ((Component)inventoryItemElement).gameObject; ExecuteEvents.beginDragHandler.Invoke((IBeginDragHandler)(object)inventoryItemElement, (BaseEventData)(object)eventData); InventoryModel.RemoveFromHold(Item); Object.Destroy((Object)(object)((Component)this).gameObject); } public void OnDrag(PointerEventData eventData) { } public void OnEndDrag(PointerEventData eventData) { } } public enum DragSource { HOLD, GRID, NONEQUIP } public class InventoryItemElement : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IEndDragHandler, IDragHandler { private const int MAX_ROTATION = 4; private Image _icon; private TextMeshProUGUI _label; public InventoryItem Item; private CanvasGroup _canvasGroup; private Transform dropTarget; private int _orientationTarget; public DragSource DragSource; private TooltipProvider _tooltip; public void Initialize(InventoryItem item, DragSource dragSource) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Item = item; _icon = ((Component)this).GetComponentInChildren<Image>(); _label = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); _canvasGroup = ((Component)this).GetComponent<CanvasGroup>(); if (!item.IsEquippable) { _canvasGroup.blocksRaycasts = false; } _icon.sprite = UIAssetService.GetSprite(Item.Pickup); ((TMP_Text)_label).text = Item.StackCount.ToString(); item.OnStackCountChanged += UpdateStackCountLabel; DragSource = dragSource; _tooltip = ((Component)this).gameObject.AddComponent<TooltipProvider>(); _tooltip.SetContent(Item.GetTooltipContent()); } public void UpdateStackCountLabel() { ((TMP_Text)_label).text = Item.StackCount.ToString(); } private void OnDestroy() { Item.OnStackCountChanged -= UpdateStackCountLabel; } public void Rotate() { Item.Rotate(); _orientationTarget = (_orientationTarget + 1) % 4; } public void OnBeginDrag(PointerEventData eventData) { SetDropTarget(((Component)this).transform.parent); ((Component)this).transform.SetParent(((Component)this).transform.root); ((Component)this).transform.SetAsLastSibling(); _orientationTarget = 0; InventoryUI.Instance.SetCursorElement(this); _canvasGroup.alpha = 0.5f; _canvasGroup.blocksRaycasts = false; } public void OnDrag(PointerEventData eventData) { //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) ((Component)this).transform.position = Vector2.op_Implicit(eventData.position); } public void OnEndDrag(PointerEventData eventData) { for (int i = 0; i < 4; i++) { if (_orientationTarget == 0) { break; } Rotate(); } ((Component)this).transform.SetParent(dropTarget); _canvasGroup.alpha = 1f; _canvasGroup.blocksRaycasts = true; InventoryUI.Instance.SetCursorElement(null); } public void SetDropTarget(Transform target) { dropTarget = target; _orientationTarget = 0; } } public class InventoryNonEquipComponent : MonoBehaviour { private List<InventoryItemElement> _elements; public static Transform _listTarget; public void Awake() { _elements = new List<InventoryItemElement>(); if (((Component)this).transform.childCount > 0) { _listTarget = ((Component)this).transform.GetChild(0); } else { _listTarget = ((Component)this).transform; } } public void AddItem(InventoryItem item) { InventoryItemElement inventoryItemElement = ComponentBuilder.BuildItemElement(((object)(UniquePickup)(ref item.Pickup)).ToString()); inventoryItemElement.Initialize(item, DragSource.NONEQUIP); ((Component)inventoryItemElement).transform.SetParent(_listTarget); _elements.Add(inventoryItemElement); } internal void RemoveFromNonEquip(InventoryItem inventoryItem) { InventoryItemElement inventoryItemElement = _elements.Find((InventoryItemElement item) => item.Item == inventoryItem); _elements.Remove(inventoryItemElement); Object.Destroy((Object)(object)((Component)inventoryItemElement).gameObject); } internal void Clear() { foreach (InventoryItemElement element in _elements) { Object.Destroy((Object)(object)((Component)element).gameObject); } } } public struct SlotPaintParams { public Color baseColor; public Color outlineColor; public bool AdjT; public bool AdjB; public bool AdjL; public bool AdjR; } public class InventorySlotComponent : MonoBehaviour, IDropHandler, IEventSystemHandler, IPointerEnterHandler { private const float OUTLINE_THICKNESS = 0.05f; private GridPosition _pos; private InventoryGridComponent _parentGrid; private InventoryItem _item; private InventoryLock _slotLock; private TooltipProvider _tooltipProvider; private Image _img; public void Initialize(InventoryGridComponent parentGrid, GridPosition pos) { _img = ((Component)this).GetComponent<Image>(); _tooltipProvider = ((Component)this).GetComponent<TooltipProvider>(); _parentGrid = parentGrid; _pos = pos; ((Behaviour)_tooltipProvider).enabled = false; } public void Occupy(InventoryItem item) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) _item = item; ((Behaviour)_tooltipProvider).enabled = true; _tooltipProvider.SetContent(_item.GetTooltipContent()); } public void UnOccupy() { _item = null; ((Behaviour)_tooltipProvider).enabled = false; } public void Paint(Color baseColor) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) Paint(baseColor, baseColor, AdjT: false, AdjB: false, AdjL: false, AdjR: false); } public void Paint(Color baseColor, Color outlineColor, bool AdjT, bool AdjB, bool AdjL, bool AdjR) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Graphic)_img).color = baseColor; } public void OnTransformChildrenChanged() { if (((Component)this).transform.childCount == 0) { _parentGrid.UnsetItemAt(_item, _pos); return; } InventoryItemElement component = ((Component)((Component)this).transform.GetChild(0)).GetComponent<InventoryItemElement>(); _parentGrid.SetItemAt(component.Item, _pos); } public void OnDrop(PointerEventData eventData) { InventoryItemElement component = eventData.pointerDrag.GetComponent<InventoryItemElement>(); if (!((Object)(object)component == (Object)null) && component.DragSource != DragSource.NONEQUIP) { if (InventoryModel.IsValidItemPosition(component.Item, _pos)) { component.SetDropTarget(((Component)this).transform); component.DragSource = DragSource.GRID; } else if (component.DragSource == DragSource.HOLD) { InventoryHoldComponent.Instance.AddToHold(component.Item); Object.Destroy((Object)(object)((Component)component).gameObject); } } } public void OnPointerEnter(PointerEventData eventData) { _parentGrid.UpdateCursorPosition(_pos); } public void LockSlot(InventoryLock slotLock) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) _slotLock = slotLock; ((Behaviour)_tooltipProvider).enabled = true; _tooltipProvider.SetContent(new TooltipContent { titleColor = UIConstants.COLOR_TOOLTIP_TITLE_SLOT_LOCKED, bodyColor = UIConstants.COLOR_TOOLTIP_BODY_SLOT_LOCKED, titleToken = "Slot Locked", bodyToken = $"Unlocks at Level <style=cIsHealth>{slotLock.UnlockLevel}</style>." }); _img.sprite = ComponentBuilder.GetSprite(ComponentBuilder.SpritePanelType.DISABLED_TILE); } public void UnlockSlot() { _slotLock = null; ((Behaviour)_tooltipProvider).enabled = false; _img.sprite = ComponentBuilder.GetSprite(ComponentBuilder.SpritePanelType.TILE); } } public class R2Tooltip : MonoBehaviour { private TextMeshProUGUI _headerText; private TextMeshProUGUI _bodyText; private CanvasGroup _group; public void Initialize(TextMeshProUGUI headerText, TextMeshProUGUI bodyText, CanvasGroup group) { _headerText = headerText; _bodyText = bodyText; _group = group; _group.blocksRaycasts = false; } public void UpdateContext(R2TooltipContext context) { ((TMP_Text)_headerText).text = context.Title; ((TMP_Text)_bodyText).text = context.Body; } public void Show() { _group.alpha = 1f; } public void Hide() { _group.alpha = 0f; } } public class R2TooltipProvider : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerMoveHandler { private static R2Tooltip _tooltipInstance; private R2TooltipContext _context; private void Awake() { if ((Object)(object)_tooltipInstance == (Object)null) { _tooltipInstance = ComponentBuilder.BuildR2TooltipComponent("Tooltip"); ((Component)_tooltipInstance).transform.SetParent(((Component)InventoryUI.Instance).transform); } } public void Initialize(R2TooltipContext context) { _context = context; } public void SetTooltipVisiblity(bool show) { if (show) { _tooltipInstance.UpdateContext(_context); _tooltipInstance.Show(); } else { _tooltipInstance.Hide(); } } public void OnPointerEnter(PointerEventData eventData) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((Component)_tooltipInstance).gameObject.transform.position = Vector2.op_Implicit(eventData.position); SetTooltipVisiblity(show: true); } public void OnPointerMove(PointerEventData eventData) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((Component)_tooltipInstance).gameObject.transform.position = Vector2.op_Implicit(eventData.position); } public void OnPointerExit(PointerEventData eventData) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((Component)_tooltipInstance).gameObject.transform.position = Vector2.op_Implicit(eventData.position); SetTooltipVisiblity(show: false); } public void ForceShow() { _tooltipInstance.Show(); } public void ForceHide() { _tooltipInstance.Hide(); } } public struct R2TooltipContext { public string Title; public string Body; public Color HeaderBkg; } } namespace R2InventoryArtifact.UI.Builders { public static class ComponentBuilder { private enum AnchorPreset { START, CENTER, END, STRETCH } public enum SpritePanelType { NONE, HEADER, TILE, DISABLED_TILE, PANEL, HANDLE, BACKDROP, ELEMENT } private static Dictionary<SpritePanelType, Sprite> _spriteDict; public static GameObject BuildScrollView(Transform parent, string objName = "", bool horizontal = false, bool vertical = false) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) RectTransform val = BuildPanel(parent, objName, SpritePanelType.HEADER); GameObject gameObject = ((Component)val).gameObject; ScrollRect val2 = ((Component)val).gameObject.AddComponent<ScrollRect>(); val2.horizontal = horizontal; val2.vertical = vertical; val2.inertia = false; val2.movementType = (MovementType)2; RectTransform val3 = BuildPanel(gameObject.transform, "Viewport"); SetRectTransformAnchor(val3, AnchorPreset.STRETCH, AnchorPreset.STRETCH); val3.pivot = Vector2.zero; ((Component)val3).gameObject.AddComponent<Mask>().showMaskGraphic = false; val2.viewport = ((Component)val3).GetComponent<RectTransform>(); RectTransform val4 = BuildPanel(((Component)val3).transform, "Content"); SetRectTransformAnchor(val4, (!horizontal || vertical) ? AnchorPreset.STRETCH : AnchorPreset.START, (!vertical || horizontal) ? AnchorPreset.STRETCH : AnchorPreset.START); ContentSizeFitter val5 = ((Component)val4).gameObject.AddComponent<ContentSizeFitter>(); if (horizontal) { val5.horizontalFit = (FitMode)1; } if (vertical) { val5.verticalFit = (FitMode)1; } val2.content = val4; if (horizontal) { val2.horizontalScrollbar = BuildScrollBar(gameObject.transform, (Direction)0); val2.horizontalScrollbarVisibility = (ScrollbarVisibility)2; val2.horizontalScrollbarSpacing = -3f; } if (vertical) { val2.verticalScrollbar = BuildScrollBar(gameObject.transform, (Direction)2); val2.verticalScrollbarVisibility = (ScrollbarVisibility)2; val2.verticalScrollbarSpacing = -3f; } gameObject.transform.SetParent(parent); return ((Component)val4).gameObject; } private static Scrollbar BuildScrollBar(Transform parent, Direction direction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_005e: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) bool flag = (int)direction == 0 || (int)direction == 1; string objName = (flag ? "HScrollBar" : "VScrollBar"); RectTransform val = BuildPanel(parent, objName); SetRectTransformAnchor(val, flag ? AnchorPreset.STRETCH : AnchorPreset.END, (!flag) ? AnchorPreset.STRETCH : AnchorPreset.START, (flag ? Vector2.up : Vector2.right) * 8f); val.pivot = (flag ? Vector2.zero : Vector2.one); Scrollbar val2 = ((Component)val).gameObject.AddComponent<Scrollbar>(); val2.direction = direction; RectTransform val3 = BuildRect(((Component)val).gameObject.transform, "SlidingArea"); SetRectTransformAnchor(val3, AnchorPreset.STRETCH, AnchorPreset.STRETCH); val3.sizeDelta = Vector2.zero; val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; RectTransform val5 = (val2.handleRect = BuildPanel(((Component)val3).transform, "Handle")); SetRectTransformAnchor(val5, AnchorPreset.STRETCH, AnchorPreset.STRETCH); ((Selectable)val2).targetGraphic = (Graphic)(object)((Component)val5).GetComponent<Image>(); return val2; } public static RectTransform BuildRect(Transform parent, string objName = "") { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(objName); RectTransform result = val.AddComponent<RectTransform>(); val.transform.SetParent(parent); return result; } public static RectTransform BuildPanel(Transform parent, string objName = "", SpritePanelType panelType = SpritePanelType.NONE) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(objName); RectTransform result = val.AddComponent
RiskOfOptions.dll
Decompiled 3 hours 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.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using JetBrains.Annotations; using LeTai.Asset.TranslucentImage; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using RiskOfOptions.Components.AssetResolution; using RiskOfOptions.Components.AssetResolution.Data; using RiskOfOptions.Components.ColorPicker; using RiskOfOptions.Components.Misc; using RiskOfOptions.Components.Options; using RiskOfOptions.Components.Panel; using RiskOfOptions.Components.RuntimePrefabs; using RiskOfOptions.Containers; using RiskOfOptions.Lib; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RiskOfOptions.Resources; using RiskOfOptions.Utils; using RoR2; using RoR2.UI; using RoR2.UI.SkinControllers; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.TextCore; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Rune580")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.8.5.0")] [assembly: AssemblyInformationalVersion("2.8.5+8fd3064c380e9c685465d201281316e718478119")] [assembly: AssemblyProduct("RiskOfOptions")] [assembly: AssemblyTitle("RiskOfOptions")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Rune580/RiskOfOptions")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RiskOfOptions { internal static class ExtensionMethods { internal static IEnumerable<Type> GetValidTypes(this Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type type) => (object)type != null); } } internal static ModMetaData GetModMetaData(this Assembly assembly) { ModMetaData result = default(ModMetaData); foreach (Type validType in assembly.GetValidTypes()) { BepInPlugin customAttribute = ((MemberInfo)validType).GetCustomAttribute<BepInPlugin>(); if (customAttribute != null) { result.Guid = customAttribute.GUID; result.Name = customAttribute.Name; } } return result; } internal static float Remap(this float value, float fromMin, float fromMax, float toMin, float toMax) { float num = value - fromMin; float num2 = fromMax - fromMin; float num3 = num / num2; return Mathf.Clamp((toMax - toMin) * num3 + toMin, toMin, toMax); } internal static T GetCopyOf<T>(this Component comp, T other) where T : Component { Type type = ((object)comp).GetType(); if (type != ((object)other).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { fieldInfo.SetValue(comp, fieldInfo.GetValue(other)); } return (T)(object)((comp is T) ? comp : null); } internal static T AddComponent<T>(this GameObject go, T toAdd) where T : Component { return ((Component)(object)go.AddComponent<T>()).GetCopyOf(toAdd); } internal static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component { T val = gameObject.GetComponent<T>(); if (!Object.op_Implicit((Object)(object)val)) { val = gameObject.AddComponent<T>(); } return val; } internal static bool CloseEnough(Vector2 a, Vector2 b) { //IL_0000: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(a.x - b.x) < 0.0001f) { return Mathf.Abs(a.y - b.y) < 0.0001f; } return false; } internal static bool CloseEnough(Color a, Color b) { //IL_0000: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004b: 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) if (Mathf.Abs(a.r - b.r) < 0.0001f && Mathf.Abs(a.g - b.g) < 0.0001f && Mathf.Abs(a.b - b.b) < 0.0001f) { return Mathf.Abs(a.a - b.a) < 0.0001f; } return false; } internal static bool CloseEnough(Color[] a, Color b) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < a.Length; i++) { _ = ref a[i]; if (!CloseEnough(a[i], b)) { return false; } } return true; } internal static Vector2 SmoothStep(Vector2 a, Vector2 b, float t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) Vector2 zero = Vector2.zero; zero.x = Mathf.SmoothStep(a.x, b.x, t); zero.y = Mathf.SmoothStep(a.y, b.y, t); return zero; } internal static double Abs(double num) { if (!(num < 0.0)) { return num; } return -1.0 * num; } internal static double RoundUpToDecimalPlace(this double num, int place) { float num2 = Mathf.Pow(10f, (float)place); num2 = ((num2 == 0f) ? 1f : num2); return Mathf.Ceil((float)num * num2) / num2; } } public static class KeyboardShortcutExtensions { public static bool IsPressedInclusive(this KeyboardShortcut key) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) bool flag = ((KeyboardShortcut)(ref key)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey); return Input.GetKey(((KeyboardShortcut)(ref key)).MainKey) && flag; } } internal static class LanguageTokens { public static readonly string OptionRebindDialogTitle = "RISK_OF_OPTIONS".ToUpper() + "_OPTION_REBIND_DIALOG_TITLE_TOKEN"; public static readonly string OptionRebindDialogDescription = "RISK_OF_OPTIONS".ToUpper() + "_OPTION_REBIND_DIALOG_DESCRIPTION_TOKEN"; public static readonly string LeftPageButton = "RISK_OF_OPTIONS".ToUpper() + "_LEFT_PAGE_BUTTON_TEXT_TOKEN;"; public static readonly string RightPageButton = "RISK_OF_OPTIONS".ToUpper() + "_RIGHT_PAGE_BUTTON_TEXT_TOKEN;"; public const string HeaderToken = "RISK_OF_OPTIONS_MOD_OPTIONS_HEADER_BUTTON_TEXT"; public const string NoModsHeaderToken = "RISK_OF_OPTIONS_NO_MODS_HEADER_TEXT"; public const string NoModsDescriptionToken = "RISK_OF_OPTIONS_NO_MODS_DESCRIPTION_TEXT"; public const string ModsHeaderToken = "RISK_OF_OPTIONS_MODS_HEADER_TEXT"; public const string ModsDescriptionToken = "RISK_OF_OPTIONS_DESCRIPTION_TEXT"; public const string DialogButtonToken = "RISK_OF_OPTIONS_NO_MODS_BUTTON_TEXT"; public static void Register() { LanguageApi.Add(OptionRebindDialogTitle, "Rebind Control..."); LanguageApi.Add(LeftPageButton, "<"); LanguageApi.Add(RightPageButton, ">"); LanguageApi.Add("RISK_OF_OPTIONS_NO_MODS_HEADER_TEXT", "No Supported Mods Installed"); LanguageApi.Add("RISK_OF_OPTIONS_NO_MODS_DESCRIPTION_TEXT", "No mods implementing RiskOfOptions found.\nThis mod doesn't do anything if you don't have any mods installed that supports RiskOfOptions.\nThis won't show again."); LanguageApi.Add("RISK_OF_OPTIONS_MODS_HEADER_TEXT", "You can configure your mods in game!"); LanguageApi.Add("RISK_OF_OPTIONS_DESCRIPTION_TEXT", "Mods with support for RiskOfOptions found!\nYou can configure them in the \"MOD OPTIONS\" panel.\nThis won't show again"); LanguageApi.Add("RISK_OF_OPTIONS_NO_MODS_BUTTON_TEXT", "Ok"); } } public static class ModSettingsManager { private static Hook _pauseHook; internal static readonly ModIndexedOptionCollection OptionCollection = new ModIndexedOptionCollection(); internal const string StartingText = "RISK_OF_OPTIONS"; internal const int StartingTextLength = 15; internal static bool disablePause = false; internal static readonly List<string> RestartRequiredOptions = new List<string>(); internal static void Init() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown LanguageApi.Init(); Assets.LoadAssets(); Prefabs.Init(); LanguageTokens.Register(); SettingsModifier.Init(); MethodInfo? method = typeof(PauseManager).GetMethod("CCTogglePause", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method2 = typeof(ModSettingsManager).GetMethod("PauseManagerOnCCTogglePause", BindingFlags.Static | BindingFlags.NonPublic); _pauseHook = new Hook((MethodBase)method, method2); } private static void PauseManagerOnCCTogglePause(Action<ConCommandArgs> orig, ConCommandArgs args) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!disablePause) { orig(args); } } public static void SetModDescription(string description) { ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData(); SetModDescription(description, modMetaData.Guid, modMetaData.Name); } public static void SetModDescription(string description, string modGuid, string modName) { EnsureContainerExists(modGuid, modName); OptionCollection[modGuid].SetDescriptionText(description); } public static void SetModDescriptionToken(string descriptionToken) { ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData(); SetModDescriptionToken(descriptionToken, modMetaData.Guid, modMetaData.Name); } public static void SetModDescriptionToken(string descriptionToken, string modGuid, string modName) { EnsureContainerExists(modGuid, modName); OptionCollection[modGuid].DescriptionToken = descriptionToken; } public static void SetModIcon(Sprite iconSprite) { ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData(); SetModIcon(iconSprite, modMetaData.Guid, modMetaData.Name); } public static void SetModIcon(Sprite iconSprite, string modGuid, string modName) { EnsureContainerExists(modGuid, modName); OptionCollection[modGuid].icon = iconSprite; } public static void SetModIcon(GameObject iconPrefab) { ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData(); SetModIcon(iconPrefab, modMetaData.Guid, modMetaData.Name); } public static void SetModIcon(GameObject iconPrefab, string modGuid, string modName) { EnsureContainerExists(modGuid, modName); OptionCollection[modGuid].iconPrefab = iconPrefab; } public static void AddOption(BaseOption option) { ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData(); AddOption(option, modMetaData.Guid, modMetaData.Name); } public static void AddOption(BaseOption option, string modGuid, string modName) { option.SetProperties(); option.ModGuid = modGuid; option.ModName = modName; option.Identifier = (modGuid + "." + option.Category + "." + option.Name + "." + option.OptionTypeName).Replace(" ", "_").ToUpper(); option.RegisterTokens(); OptionCollection.AddOption(ref option); } public static void AddOption(BaseOption option, string modGuid, string modName, string nameToken, string descriptionToken) { option.SetProperties(); option.ModGuid = modGuid; option.ModName = modName; option.NameToken = nameToken; option.DescriptionToken = descriptionToken; option.Identifier = (modGuid + "." + option.Category + "." + option.Name + "." + option.OptionTypeName).Replace(" ", "_").ToUpper(); if (option is ChoiceOption choiceOption) { choiceOption.RegisterChoiceTokens(); } OptionCollection.AddOption(ref option); } private static void EnsureContainerExists(string modGuid, string modName) { if (!OptionCollection.ContainsModGuid(modGuid)) { OptionCollection[modGuid] = new OptionCollection(modName, modGuid); } } public static void SetCategoryNameToken(string modGuid, BaseOption option, string nameToken) { OptionCollection[modGuid][option.Category].SetNameToken(nameToken); } } [BepInPlugin("com.rune580.riskofoptions", "RiskOfOptions", "2.8.5")] public sealed class RiskOfOptionsPlugin : BaseUnityPlugin { internal static ConfigEntry<bool>? seenNoMods; internal static ConfigEntry<bool>? seenMods; public static ConfigEntry<DecimalSeparator>? decimalSeparator; public static ConfigEntry<bool>? showModifiedIndicator; public static ConfigEntry<Color>? nonDefaultModifiedColor; public static ConfigEntry<Color>? hasChangedModifiedColor; private void Awake() { //IL_0097: 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) seenNoMods = ((BaseUnityPlugin)this).Config.Bind<bool>("One Time Stuff", "Has seen the no mods prompt", false, (ConfigDescription)null); seenMods = ((BaseUnityPlugin)this).Config.Bind<bool>("One Time Stuff", "Has seen the mods prompt", false, (ConfigDescription)null); decimalSeparator = ((BaseUnityPlugin)this).Config.Bind<DecimalSeparator>("Display", "DecimalSeparator", DecimalSeparator.Period, "Changes how numbers are displayed across RoO.\nPeriod: 1,000.00\nComma: 1.000,00"); showModifiedIndicator = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "Show modified indicator", true, "Show a colored marker on the left of mod options that have been modified"); nonDefaultModifiedColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Display", "Modified color (non-default)", new Color(0.47843137f, 0.6901961f, 1f), "Color of the modified indicator when a mod option has a value different from its default"); hasChangedModifiedColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Display", "Modified color (revertable)", new Color(1f, 46f / 51f, 0.28627452f), "Color of the modified indicator when a mod option has changed but is still able to be reverted"); ModSettingsManager.Init(); ModSettingsManager.SetModIcon(Prefabs.animatedIcon); ModSettingsManager.AddOption(new ChoiceOption((ConfigEntryBase)(object)decimalSeparator)); ModSettingsManager.AddOption(new CheckBoxOption(showModifiedIndicator)); ColorOptionConfig config = new ColorOptionConfig { checkIfDisabled = DisabledModifiedIndicator }; ModSettingsManager.AddOption(new ColorOption(nonDefaultModifiedColor, config)); ModSettingsManager.AddOption(new ColorOption(hasChangedModifiedColor, config)); } private bool DisabledModifiedIndicator() { return !showModifiedIndicator.Value; } } internal static class SettingsModifier { public static void Init() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/SettingsPanelTitle.prefab").WaitForCompletion(); GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/SettingsPanel.prefab").WaitForCompletion(); if ((Object)(object)obj == (Object)null || (Object)(object)val == (Object)null) { throw new Exception("Couldn't initialize Risk Of Options! Continue at your own risk!"); } obj.AddComponent<ModOptionPanelController>(); val.AddComponent<ModOptionPanelController>(); LanguageApi.Add("RISK_OF_OPTIONS_MOD_OPTIONS_HEADER_BUTTON_TEXT", "MOD OPTIONS"); RuntimePrefabManager.Register<ModOptionsPanelPrefab>(); RuntimePrefabManager.Register<CheckBoxPrefab>(); RuntimePrefabManager.Register<SliderPrefab>(); RuntimePrefabManager.Register<StepSliderPrefab>(); RuntimePrefabManager.Register<IntSliderPrefab>(); RuntimePrefabManager.Register<FloatFieldPrefab>(); RuntimePrefabManager.Register<IntFieldPrefab>(); RuntimePrefabManager.Register<KeyBindPrefab>(); RuntimePrefabManager.Register<InputFieldPrefab>(); RuntimePrefabManager.Register<ChoicePrefab>(); RuntimePrefabManager.Register<GenericButtonPrefab>(); } } public static class PluginInfo { public const string PLUGIN_GUID = "com.rune580.riskofoptions"; public const string PLUGIN_NAME = "RiskOfOptions"; public const string PLUGIN_VERSION = "2.8.5"; } } namespace RiskOfOptions.Utils { public class ColorPickerUtil : MonoBehaviour { [Serializable] public class ColorChangedEvent : UnityEvent<Color> { } public RooColorHue hueController; public RooColorPicker colorPicker; public RgbaSliderController rgbaSliders; public Image preview; public TMP_InputField hexField; public string hexFormatString = "{0:X6}"; private Action<Color> _onColorSelected; private float _hue; private float _saturation; private float _value; private int _hexValue; private Color _color = Color.white; public void Awake() { ((UnityEvent<float>)hueController.onHueChanged).AddListener((UnityAction<float>)UpdateHue); ((UnityEvent<float, float>)colorPicker.onValueChanged).AddListener((UnityAction<float, float>)UpdateSatAndVal); ((UnityEvent<string>)(object)hexField.onSubmit).AddListener((UnityAction<string>)HexFieldSubmit); ((UnityEvent<string>)(object)hexField.onEndEdit).AddListener((UnityAction<string>)HexFieldSubmit); ((UnityEvent<Color>)rgbaSliders.onColorChanged).AddListener((UnityAction<Color>)SetColor); } public void SetColor(Color newColor) { //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_0042: Unknown result type (might be due to invalid IL or missing references) _color = newColor; float value = default(float); Color.RGBToHSV(_color, ref value, ref _saturation, ref _value); _hue = value.Remap(0f, 1f, 0f, 6.28f); _hexValue = _color.ToRGBHex(); UpdateControls(); UpdateHandles(); } private void UpdateHue(float hue) { _hue = hue; colorPicker.SetHue(_hue); UpdateColorFromHSV(); } private void UpdateSatAndVal(float saturation, float value) { _saturation = saturation; _value = value; UpdateColorFromHSV(); } private void HexFieldSubmit(string text) { //IL_001d: 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) if (int.TryParse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var result)) { _hexValue = result; } SetColor(_color.FromRGBHex(_hexValue)); } private void UpdateColorFromHSV() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) Color color = ColorExtensions.ColorFromHSV(_hue, _saturation, _value); color.a = _color.a; _color = color; _hexValue = _color.ToRGBHex(); rgbaSliders.inPicker = true; UpdateControls(); rgbaSliders.inPicker = false; } private void UpdateHandles() { //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) hueController.SetHue(_hue); colorPicker.SetHue(_hue); if (_color != Color.black) { colorPicker.SetValues(_saturation, _value); } } private void UpdateControls() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) ((Graphic)preview).color = _color; hexField.text = string.Format(CultureInfo.InvariantCulture, hexFormatString, _hexValue); rgbaSliders.SetSliders(_color); } public void Accept() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _onColorSelected(_color); Close(); } public void Close() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) RoR2Application.unscaledTimeTimers.CreateTimer(0.1f, (Action)delegate { DestroyPicker(((Component)this).gameObject); }); } private static void DestroyPicker(GameObject gameObject) { Object.DestroyImmediate((Object)(object)gameObject); } public static void OpenColorPicker(Action<Color> onColorSelected, Color currentColor) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) ColorPickerUtil component = Object.Instantiate<GameObject>(Prefabs.colorPickerOverlay).GetComponent<ColorPickerUtil>(); component._onColorSelected = onColorSelected; component.SetColor(currentColor); } } public class KeyBindUtil : MonoBehaviour { private MPEventSystem _mpEventSystem; private SimpleDialogBox _dialogBox; private Action<KeyboardShortcut> _onBind; private float _timeoutTimer; private string _keyBindName; private bool _finished; private readonly List<KeyCode> _heldKeys = new List<KeyCode>(); private readonly List<KeyCode> _keySequence = new List<KeyCode>(); public void StartListening() { if (ModSettingsManager.disablePause || _finished) { Object.DestroyImmediate((Object)(object)((Component)this).gameObject); return; } ModSettingsManager.disablePause = true; _dialogBox = SimpleDialogBox.Create(_mpEventSystem); LanguageApi.AddDelegate(LanguageTokens.OptionRebindDialogDescription, ControlRebindingHook); } public void StopListening() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) _finished = true; if (Object.op_Implicit((Object)(object)_dialogBox) && Object.op_Implicit((Object)(object)_dialogBox.rootObject)) { Object.DestroyImmediate((Object)(object)_dialogBox.rootObject); _dialogBox = null; } LanguageApi.RemoveDelegate(LanguageTokens.OptionRebindDialogDescription); RoR2Application.unscaledTimeTimers.CreateTimer(0.3f, (Action)Finish); Object.Destroy((Object)(object)((Component)this).gameObject, 0.5f); } private void Update() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if (!_finished) { _timeoutTimer -= Time.unscaledDeltaTime; ExtraKeyDown(); ExtraKeyUp(); if (_timeoutTimer < 0f || !Object.op_Implicit((Object)(object)_dialogBox)) { StopListening(); return; } _dialogBox.headerToken = new TokenParamsPair { token = LanguageTokens.OptionRebindDialogTitle, formatParams = Array.Empty<object>() }; _dialogBox.descriptionToken = new TokenParamsPair { token = LanguageTokens.OptionRebindDialogDescription, formatParams = new object[2] { LanguageTokens.OptionRebindDialogDescription, _timeoutTimer } }; } } public void OnGUI() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_0078: 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_006e: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (_finished) { return; } bool flag = !Event.current.isKey; EventType type; if (!flag) { type = Event.current.type; bool flag2 = type - 4 <= 1; flag = !flag2; } if (flag || (int)Event.current.keyCode == 0) { return; } if ((int)Event.current.keyCode == 27) { SetKeyBind((KeyCode)0); return; } type = Event.current.type; if ((int)type != 4) { if ((int)type != 5) { throw new ArgumentOutOfRangeException(); } KeyUp(Event.current.keyCode); } else { KeyDown(Event.current.keyCode); } } private void ExtraKeyDown() { if (Input.GetKeyDown((KeyCode)304)) { KeyDown((KeyCode)304); } else if (Input.GetKeyDown((KeyCode)303)) { KeyDown((KeyCode)303); } else if (Input.GetKeyDown((KeyCode)323)) { KeyDown((KeyCode)323); } else if (Input.GetKeyDown((KeyCode)324)) { KeyDown((KeyCode)324); } else if (Input.GetKeyDown((KeyCode)325)) { KeyDown((KeyCode)325); } else if (Input.GetKeyDown((KeyCode)326)) { KeyDown((KeyCode)326); } else if (Input.GetKeyDown((KeyCode)327)) { KeyDown((KeyCode)327); } } private void ExtraKeyUp() { if (Input.GetKeyUp((KeyCode)304)) { KeyUp((KeyCode)304); } else if (Input.GetKeyUp((KeyCode)303)) { KeyUp((KeyCode)303); } else if (Input.GetKeyUp((KeyCode)323)) { KeyUp((KeyCode)323); } else if (Input.GetKeyUp((KeyCode)324)) { KeyUp((KeyCode)324); } else if (Input.GetKeyUp((KeyCode)325)) { KeyUp((KeyCode)325); } else if (Input.GetKeyUp((KeyCode)326)) { KeyUp((KeyCode)326); } else if (Input.GetKeyUp((KeyCode)327)) { KeyUp((KeyCode)327); } } private void KeyDown(KeyCode keyCode) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!_heldKeys.Contains(keyCode)) { _heldKeys.Add(keyCode); } } private void KeyUp(KeyCode keyCode) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected I4, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!_heldKeys.Contains(keyCode)) { return; } _heldKeys.Remove(keyCode); if (_keySequence.Contains(keyCode)) { return; } _keySequence.Add(keyCode); if (_heldKeys.Count != 0) { return; } KeyboardShortcut keyBind = default(KeyboardShortcut); if (_keySequence.Count > 1) { KeyCode[] array = (KeyCode[])(object)new KeyCode[_keySequence.Count - 1]; for (int i = 0; i < array.Length; i++) { array[i] = (KeyCode)(int)_keySequence[i + 1]; } ((KeyboardShortcut)(ref keyBind))..ctor(_keySequence[0], array); } else { ((KeyboardShortcut)(ref keyBind))..ctor(_keySequence[0], Array.Empty<KeyCode>()); } SetKeyBind(keyBind); } private void SetKeyBind(KeyCode keyCode) { //IL_0001: 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) SetKeyBind(new KeyboardShortcut(keyCode, Array.Empty<KeyCode>())); } private void SetKeyBind(KeyboardShortcut keyBind) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _onBind(keyBind); StopListening(); } private string ControlRebindingHook() { int num = Mathf.RoundToInt(_timeoutTimer); return $"Press the button(s) you wish to assign for {_keyBindName}.\n{num} second(s) remaining."; } private void Finish() { ModSettingsManager.disablePause = false; } public static void StartBinding(Action<KeyboardShortcut> onBind, string keyBindName, float timeoutTimer = 5f, MPEventSystem mpEventSystem = null) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) KeyBindUtil component = new GameObject("KeyBindUtil instance", new Type[1] { typeof(KeyBindUtil) }).GetComponent<KeyBindUtil>(); component._onBind = onBind; component._timeoutTimer = timeoutTimer; component._mpEventSystem = mpEventSystem; component._keyBindName = keyBindName; component.StartListening(); } } } namespace RiskOfOptions.Resources { internal static class Assets { private static AssetBundle _mainAssetBundle; internal static T Load<T>(string asset) where T : Object { return _mainAssetBundle.LoadAsset<T>(asset); } internal static void LoadAssets() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RiskOfOptions.Resources.AssetBundles.riskofoptions"); _mainAssetBundle = AssetBundle.LoadFromStream(stream); } } public static class Prefabs { private static AssetBundle _uiBundle; public static GameObject animatedIcon; public static GameObject modOptionsPanel; public static GameObject modListPanel; public static GameObject modListButton; public static GameObject modDescriptionPanel; public static GameObject modOptionDescriptionPanel; public static GameObject modOptionCategories; public static GameObject boolButton; public static GameObject sliderButton; public static GameObject stepSliderButton; public static GameObject intSliderButton; public static GameObject floatFieldButton; public static GameObject intFieldButton; public static GameObject inputFieldButton; public static GameObject colorPickerButton; public static GameObject colorPickerOverlay; internal static void Init() { _uiBundle = LoadBundle("uielements"); animatedIcon = LoadPrefab("RoO-Icon.prefab"); modOptionsPanel = LoadPrefab("Options Panel.prefab"); modListPanel = LoadPrefab("Mod List Panel.prefab"); modListButton = LoadPrefab("Mod List Button.prefab"); modDescriptionPanel = LoadPrefab("Mod Description Panel.prefab"); modOptionDescriptionPanel = LoadPrefab("Option Description Panel.prefab"); modOptionCategories = LoadPrefab("Category Headers.prefab"); boolButton = LoadPrefab("ModSettingsButton, Bool.prefab"); sliderButton = LoadPrefab("ModSettingsButton, Slider.prefab"); stepSliderButton = LoadPrefab("ModSettingsButton, Step Slider.prefab"); intSliderButton = LoadPrefab("ModSettingsButton, Int Slider.prefab"); floatFieldButton = LoadPrefab("ModSettingsButton, Float Field.prefab"); intFieldButton = LoadPrefab("ModSettingsButton, Int Field.prefab"); inputFieldButton = LoadPrefab("ModSettingsButton, InputField.prefab"); colorPickerButton = LoadPrefab("ModSettingsButton, ColorPicker.prefab"); colorPickerOverlay = LoadPrefab("Color Picker Overlay.prefab"); } private static GameObject LoadPrefab(string path) { GameObject val = _uiBundle.LoadAsset<GameObject>("assets/roo/prefabs/" + path); AssetResolver[] componentsInChildren = val.GetComponentsInChildren<AssetResolver>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].AttemptResolve(); } return val; } private static AssetBundle LoadBundle(string name) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RiskOfOptions.Resources.AssetBundles." + name); return AssetBundle.LoadFromStream(stream); } } } namespace RiskOfOptions.Options { public abstract class BaseOption { public abstract string OptionTypeName { get; protected set; } public string Identifier { get; internal set; } public string ModGuid { get; internal set; } public string ModName { get; internal set; } public string Category { get; internal set; } public string Name { get; internal set; } public string Description { get; internal set; } public string DescriptionToken { get; internal set; } public string NameToken { get; internal set; } internal abstract ConfigEntryBase ConfigEntry { get; } public virtual void SetCategoryName(string fallback, BaseOptionConfig config) { if (!string.IsNullOrEmpty(config.category)) { Category = config.category; } else { Category = fallback; } } public virtual void SetName(string fallback, BaseOptionConfig config) { if (!string.IsNullOrEmpty(config.name)) { Name = config.name; } else { Name = fallback; } } public virtual void SetDescription(string fallback, BaseOptionConfig config) { if (!string.IsNullOrEmpty(config.description)) { Description = config.description; } else { Description = fallback; } } internal virtual void RegisterTokens() { LanguageApi.Add(GetNameToken(), Name); LanguageApi.Add(GetDescriptionToken(), Description); } public string GetNameToken() { if (!string.IsNullOrEmpty(NameToken)) { return NameToken; } return ("RISK_OF_OPTIONS." + ModGuid + "." + Category + "." + Name + "." + OptionTypeName + ".name").Replace(" ", "_").ToUpper(); } public string GetDescriptionToken() { if (!string.IsNullOrEmpty(DescriptionToken)) { return DescriptionToken; } return ("RISK_OF_OPTIONS." + ModGuid + "." + Category + "." + Name + "." + OptionTypeName + ".description").Replace(" ", "_").ToUpper(); } public abstract GameObject CreateOptionGameObject(GameObject prefab, Transform parent); public abstract BaseOptionConfig GetConfig(); public override bool Equals(object obj) { if (obj == null) { return false; } if (obj is BaseOption other) { return Equals(other); } return false; } private bool Equals(BaseOption other) { return string.Equals(Identifier, other.Identifier, StringComparison.InvariantCulture); } public override int GetHashCode() { if (Identifier == null) { return 0; } return StringComparer.InvariantCulture.GetHashCode(Identifier); } protected internal virtual void SetProperties() { if (ConfigEntry != null) { BaseOptionConfig config = GetConfig(); SetCategoryName(ConfigEntry.Definition.Section, config); SetName(ConfigEntry.Definition.Key, config); SetDescription(ConfigEntry.Description.Description, config); } } public string GetLocalizedName() { return Language.GetString(GetNameToken()); } public string GetLocalizedDescription() { return Language.GetString(GetDescriptionToken()); } } public class CheckBoxOption : BaseOption, ITypedValueHolder<bool> { protected readonly bool originalValue; private readonly ConfigEntry<bool> _configEntry; protected readonly CheckBoxConfig config; public override string OptionTypeName { get; protected set; } = "checkbox"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual bool Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public CheckBoxOption(ConfigEntry<bool> configEntry) : this(configEntry, new CheckBoxConfig()) { } public CheckBoxOption(ConfigEntry<bool> configEntry, bool restartRequired) : this(configEntry, new CheckBoxConfig { restartRequired = restartRequired }) { } public CheckBoxOption(ConfigEntry<bool> configEntry, CheckBoxConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected CheckBoxOption(CheckBoxConfig config, bool originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsBool componentInChildren = obj.GetComponentInChildren<ModSettingsBool>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; ((Object)obj).name = "Mod Option CheckBox, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { return Value != GetOriginalValue(); } public bool GetOriginalValue() { return originalValue; } } public class ChoiceOption : BaseOption, ITypedValueHolder<object> { protected readonly object originalValue; private readonly ConfigEntryBase _configEntry; protected readonly ChoiceConfig config; private string[] _nameTokens; public override string OptionTypeName { get; protected set; } = "choice"; internal override ConfigEntryBase ConfigEntry => _configEntry; public virtual object Value { get { return _configEntry.BoxedValue; } set { _configEntry.BoxedValue = Enum.Parse(_configEntry.SettingType, value.ToString()); } } public ChoiceOption(ConfigEntryBase configEntry) : this(configEntry, new ChoiceConfig()) { } public ChoiceOption(ConfigEntryBase configEntry, bool restartRequired) : this(configEntry, new ChoiceConfig { restartRequired = restartRequired }) { } public ChoiceOption(ConfigEntryBase configEntry, ChoiceConfig config) : this(config, configEntry.BoxedValue) { if (!configEntry.SettingType.IsEnum) { throw new InvalidCastException("T in configEntry<T> must be of type Enum, Type found: " + configEntry.SettingType.Name); } _configEntry = configEntry; } protected ChoiceOption(ChoiceConfig config, object originalValue) { this.originalValue = originalValue; this.config = config; } internal override void RegisterTokens() { base.RegisterTokens(); RegisterChoiceTokens(); } internal void RegisterChoiceTokens() { string[] names = Enum.GetNames(Value.GetType()); _nameTokens = new string[names.Length]; for (int i = 0; i < names.Length; i++) { string text = ("RISK_OF_OPTIONS." + base.ModGuid + "." + base.Category + "." + base.Name + "." + OptionTypeName + ".item." + names[i]).Replace(" ", "_").ToUpper(); _nameTokens[i] = text; LanguageApi.Add(text, names[i]); } } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); DropDownController componentInChildren = obj.GetComponentInChildren<DropDownController>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; ((Object)obj).name = "Mod Option Choice, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { return !Value.Equals(originalValue); } public object GetOriginalValue() { return originalValue; } internal string[] GetNameTokens() { return _nameTokens; } } public class ColorOption : BaseOption, ITypedValueHolder<Color> { protected readonly Color originalValue; private readonly ConfigEntry<Color> _configEntry; protected readonly ColorOptionConfig config; public override string OptionTypeName { get; protected set; } = "color"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual Color Value { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _configEntry.Value; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _configEntry.Value = value; } } public ColorOption(ConfigEntry<Color> configEntry) : this(configEntry, new ColorOptionConfig()) { } public ColorOption(ConfigEntry<Color> configEntry, bool restartRequired) : this(configEntry, new ColorOptionConfig { restartRequired = true }) { } public ColorOption(ConfigEntry<Color> configEntry, ColorOptionConfig config) : this(config, configEntry.Value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) _configEntry = configEntry; } protected ColorOption(ColorOptionConfig config, Color originalValue) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsColor componentInChildren = obj.GetComponentInChildren<ModSettingsColor>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; ((Object)obj).name = "Mod Option Color, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { //IL_0001: 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) return Value != GetOriginalValue(); } public Color GetOriginalValue() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return originalValue; } } public enum DecimalSeparator { Period, Comma } public static class DecimalSeparatorExtensions { private static CultureInfo? _commaCultureInstance; private static CultureInfo CommaCulture { get { if (_commaCultureInstance == null) { _commaCultureInstance = (CultureInfo)CultureInfo.InvariantCulture.Clone(); _commaCultureInstance.NumberFormat.NumberDecimalSeparator = ","; _commaCultureInstance.NumberFormat.NumberGroupSeparator = "."; } return _commaCultureInstance; } } public static char Char(this DecimalSeparator separator) { return separator switch { DecimalSeparator.Period => '.', DecimalSeparator.Comma => ',', _ => throw new ArgumentOutOfRangeException("separator", separator, null), }; } public static CultureInfo GetCultureInfo(this DecimalSeparator separator) { return separator switch { DecimalSeparator.Period => CultureInfo.InvariantCulture, DecimalSeparator.Comma => CommaCulture, _ => throw new ArgumentOutOfRangeException("separator", separator, null), }; } } public class FloatFieldOption : BaseOption, ITypedValueHolder<float> { protected readonly float originalValue; private readonly ConfigEntry<float> _configEntry; protected readonly FloatFieldConfig config; public override string OptionTypeName { get; protected set; } = "float_field"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual float Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public FloatFieldOption(ConfigEntry<float> configEntry) : this(configEntry, new FloatFieldConfig()) { } public FloatFieldOption(ConfigEntry<float> configEntry, bool restartRequired) : this(configEntry, new FloatFieldConfig { restartRequired = restartRequired }) { } public FloatFieldOption(ConfigEntry<float> configEntry, FloatFieldConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected FloatFieldOption(FloatFieldConfig config, float originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsFloatField componentInChildren = obj.GetComponentInChildren<ModSettingsFloatField>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.min = config.Min; componentInChildren.max = config.Max; componentInChildren.formatString = config.FormatString; ((Object)componentInChildren).name = "Mod Options Float Field, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public float GetOriginalValue() { return originalValue; } public bool ValueChanged() { return Value != GetOriginalValue(); } } public class GenericButtonOption : BaseOption { internal readonly GenericButtonConfig config; internal override ConfigEntryBase ConfigEntry => null; public override string OptionTypeName { get; protected set; } = "generic_button"; public GenericButtonOption(string name, string category, UnityAction onButtonPressed) : this(name, category, "", "Open", onButtonPressed) { } public GenericButtonOption(string name, string category, string description, string buttonText, UnityAction onButtonPressed) { config = new GenericButtonConfig(name, category, description, buttonText, onButtonPressed); base.Category = category; base.Name = name; base.Description = description; } internal override void RegisterTokens() { base.RegisterTokens(); LanguageApi.Add(GetButtonLabelToken(), config.ButtonText); } public string GetButtonLabelToken() { return ("RISK_OF_OPTIONS." + base.ModGuid + "." + base.Category + "." + base.Name + "." + OptionTypeName + ".sub_button.name").Replace(" ", "_").ToUpper(); } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); GenericButtonController componentInChildren = obj.GetComponentInChildren<GenericButtonController>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.buttonToken = GetButtonLabelToken(); componentInChildren.OnButtonPressed = config.OnButtonPressed; ((Object)obj).name = "Mod Option GenericButton, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } } public class IntFieldOption : BaseOption, ITypedValueHolder<int> { protected readonly int originalValue; private readonly ConfigEntry<int> _configEntry; protected readonly IntFieldConfig config; public override string OptionTypeName { get; protected set; } = "int_field"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual int Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public IntFieldOption(ConfigEntry<int> configEntry) : this(configEntry, new IntFieldConfig()) { } public IntFieldOption(ConfigEntry<int> configEntry, bool restartRequired) : this(configEntry, new IntFieldConfig { restartRequired = restartRequired }) { } public IntFieldOption(ConfigEntry<int> configEntry, IntFieldConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected IntFieldOption(IntFieldConfig config, int originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsIntField componentInChildren = obj.GetComponentInChildren<ModSettingsIntField>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.min = config.Min; componentInChildren.max = config.Max; componentInChildren.formatString = config.FormatString; ((Object)componentInChildren).name = "Mod Options Int Field, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public int GetOriginalValue() { return originalValue; } public bool ValueChanged() { return Value != GetOriginalValue(); } } public class IntSliderOption : BaseOption, ITypedValueHolder<int> { protected readonly int originalValue; private readonly ConfigEntry<int> _configEntry; protected readonly IntSliderConfig config; public override string OptionTypeName { get; protected set; } = "int_slider"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual int Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public IntSliderOption(ConfigEntry<int> configEntry) : this(configEntry, new IntSliderConfig()) { } public IntSliderOption(ConfigEntry<int> configEntry, bool restartRequired) : this(configEntry, new IntSliderConfig { restartRequired = restartRequired }) { } public IntSliderOption(ConfigEntry<int> configEntry, IntSliderConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected IntSliderOption(IntSliderConfig config, int originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsIntSlider componentInChildren = obj.GetComponentInChildren<ModSettingsIntSlider>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.minValue = config.min; componentInChildren.maxValue = config.max; componentInChildren.formatString = config.formatString; ((Object)obj).name = "Mod Options Int Slider, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { return Value != GetOriginalValue(); } public int GetOriginalValue() { return originalValue; } } public interface ITypedValueHolder<T> { T Value { get; set; } T GetOriginalValue(); bool ValueChanged(); } public class KeyBindOption : BaseOption, ITypedValueHolder<KeyboardShortcut> { protected readonly KeyboardShortcut originalValue; private readonly ConfigEntry<KeyboardShortcut> _configEntry; protected readonly KeyBindConfig config; public override string OptionTypeName { get; protected set; } = "key_bind"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual KeyboardShortcut Value { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _configEntry.Value; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _configEntry.Value = value; } } public KeyBindOption(ConfigEntry<KeyboardShortcut> configEntry) : this(configEntry, new KeyBindConfig()) { } public KeyBindOption(ConfigEntry<KeyboardShortcut> configEntry, bool restartRequired) : this(configEntry, new KeyBindConfig { restartRequired = restartRequired }) { } public KeyBindOption(ConfigEntry<KeyboardShortcut> configEntry, KeyBindConfig config) : this(config, configEntry.Value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) _configEntry = configEntry; } protected KeyBindOption(KeyBindConfig config, KeyboardShortcut originalValue) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a5: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(prefab, parent); KeyBindController controller = val.GetComponentInChildren<KeyBindController>(); controller.nameToken = GetNameToken(); controller.settingToken = base.Identifier; ((TMP_Text)((Component)val.transform.Find("ButtonText")).GetComponent<HGTextMeshProUGUI>()).SetText(GetLocalizedName(), true); ((Object)val).name = "Mod Option KeyBind, " + base.Name; HGButton[] componentsInChildren = val.GetComponentsInChildren<HGButton>(); UnityAction val2 = default(UnityAction); for (int i = 0; i < componentsInChildren.Length; i++) { ButtonClickedEvent onClick = ((Button)componentsInChildren[i]).onClick; UnityAction obj = val2; if (obj == null) { UnityAction val3 = delegate { controller.StartListening(); }; UnityAction val4 = val3; val2 = val3; obj = val4; } ((UnityEvent)onClick).AddListener(obj); } return val; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = Value; return !((object)(KeyboardShortcut)(ref value)).Equals((object?)GetOriginalValue()); } public KeyboardShortcut GetOriginalValue() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return originalValue; } } public class SliderOption : BaseOption, ITypedValueHolder<float> { protected readonly float originalValue; private readonly ConfigEntry<float> _configEntry; protected readonly SliderConfig config; public override string OptionTypeName { get; protected set; } = "slider"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual float Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public SliderOption(ConfigEntry<float> configEntry) : this(configEntry, new SliderConfig()) { } public SliderOption(ConfigEntry<float> configEntry, bool restartRequired) : this(configEntry, new SliderConfig { restartRequired = restartRequired }) { } public SliderOption(ConfigEntry<float> configEntry, SliderConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected SliderOption(SliderConfig config, float originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsSlider componentInChildren = obj.GetComponentInChildren<ModSettingsSlider>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.minValue = config.min; componentInChildren.maxValue = config.max; componentInChildren.formatString = config.FormatString; ((Object)obj).name = "Mod Option Slider, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { return Value != GetOriginalValue(); } public float GetOriginalValue() { return originalValue; } } public class StepSliderOption : BaseOption, ITypedValueHolder<float> { protected readonly float originalValue; private readonly ConfigEntry<float> _configEntry; protected readonly StepSliderConfig config; public override string OptionTypeName { get; protected set; } = "step_slider"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual float Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public StepSliderOption(ConfigEntry<float> configEntry) : this(configEntry, new StepSliderConfig()) { } public StepSliderOption(ConfigEntry<float> configEntry, bool restartRequired) : this(configEntry, new StepSliderConfig { restartRequired = restartRequired }) { } public StepSliderOption(ConfigEntry<float> configEntry, StepSliderConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected StepSliderOption(StepSliderConfig config, float originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { GameObject obj = Object.Instantiate<GameObject>(prefab, parent); ModSettingsStepSlider componentInChildren = obj.GetComponentInChildren<ModSettingsStepSlider>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.increment = config.increment; componentInChildren.minValue = config.min; componentInChildren.maxValue = config.max; componentInChildren.remapManualInputToStep = config.remapManualInputToStep; componentInChildren.formatString = config.FormatString; int num = (int)Math.Round(Math.Abs(config.min - config.max) / config.increment); componentInChildren.slider.minValue = 0f; componentInChildren.slider.maxValue = num; componentInChildren.slider.wholeNumbers = true; ((Object)obj).name = "Mod Option Step Slider, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { return Value != GetOriginalValue(); } public float GetOriginalValue() { return originalValue; } } public class StringInputFieldOption : BaseOption, ITypedValueHolder<string> { protected readonly string originalValue; private readonly ConfigEntry<string> _configEntry; protected readonly InputFieldConfig config; public override string OptionTypeName { get; protected set; } = "string_input_field"; internal override ConfigEntryBase ConfigEntry => (ConfigEntryBase)(object)_configEntry; public virtual string Value { get { return _configEntry.Value; } set { _configEntry.Value = value; } } public StringInputFieldOption(ConfigEntry<string> configEntry) : this(configEntry, new InputFieldConfig()) { } public StringInputFieldOption(ConfigEntry<string> configEntry, bool restartRequired) : this(configEntry, new InputFieldConfig { restartRequired = restartRequired }) { } public StringInputFieldOption(ConfigEntry<string> configEntry, InputFieldConfig config) : this(config, configEntry.Value) { _configEntry = configEntry; } protected StringInputFieldOption(InputFieldConfig config, string originalValue) { this.originalValue = originalValue; this.config = config; } public override GameObject CreateOptionGameObject(GameObject prefab, Transform parent) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(prefab, parent); InputFieldController componentInChildren = obj.GetComponentInChildren<InputFieldController>(); componentInChildren.nameToken = GetNameToken(); componentInChildren.settingToken = base.Identifier; componentInChildren.submitOn = config.submitOn; componentInChildren.lineType = config.lineType; componentInChildren.richText = config.richText; componentInChildren.characterValidation = (CharacterValidation)0; ((Object)obj).name = "Mod Option Input Field, " + base.Name; return obj; } public override BaseOptionConfig GetConfig() { return config; } public bool ValueChanged() { return !string.Equals(_configEntry.Value, originalValue, StringComparison.InvariantCulture); } public string GetOriginalValue() { return originalValue; } } } namespace RiskOfOptions.OptionConfigs { public class BaseOptionConfig { public delegate bool IsDisabledDelegate(); public string name = ""; public string description = ""; public string category = ""; public bool restartRequired; [Obsolete("Not yet implemented")] public bool hidden; public IsDisabledDelegate checkIfDisabled; } public class CheckBoxConfig : BaseOptionConfig { } public class ChoiceConfig : BaseOptionConfig { } public class ColorOptionConfig : BaseOptionConfig { } public class FloatFieldConfig : NumericFieldConfig<float> { public override float Min { get; set; } = float.MinValue; public override float Max { get; set; } = float.MaxValue; } public class GenericButtonConfig : BaseOptionConfig { public readonly UnityAction OnButtonPressed; public readonly string ButtonText; public GenericButtonConfig(string name, string category, string description, string buttonText, UnityAction onButtonPressed) { base.name = name; base.category = category; base.description = description; ButtonText = buttonText; OnButtonPressed = onButtonPressed; } } public class InputFieldConfig : BaseOptionConfig { [Flags] public enum SubmitEnum { OnChar = 1, OnSubmit = 2, OnExit = 4, OnExitOrSubmit = 6, All = 7 } public SubmitEnum submitOn = SubmitEnum.OnChar; public LineType lineType = (LineType)1; public bool richText = true; } public class IntFieldConfig : NumericFieldConfig<int> { public override int Min { get; set; } = int.MinValue; public override int Max { get; set; } = int.MaxValue; } public class IntSliderConfig : BaseOptionConfig { public delegate bool IntSliderTryParse(string input, CultureInfo cultureInfo, out int value); public int min; public int max = 100; public string formatString = "{0}"; public IntSliderTryParse? TryParseDelegate { get; set; } } public class KeyBindConfig : BaseOptionConfig { } public abstract class NumericFieldConfig<TNumeric> : BaseOptionConfig { public delegate bool NumericFieldTryParse(string input, CultureInfo cultureInfo, out TNumeric value); public abstract TNumeric Min { get; set; } public abstract TNumeric Max { get; set; } public string FormatString { get; set; } = "{0}"; public NumericFieldTryParse? TryParse { get; set; } } public class SliderConfig : BaseOptionConfig { public delegate bool SliderTryParse(string input, CultureInfo cultureInfo, out float value); public float min; public float max = 100f; [Obsolete("Use FormatString Property instead")] public string formatString = "{0:0}%"; public virtual string FormatString { get { return formatString; } set { formatString = value; } } public SliderTryParse? TryParseDelegate { get; set; } } public class StepSliderConfig : SliderConfig { public float increment = 1f; public bool remapManualInputToStep = true; public override string FormatString { get; set; } = "{0}"; } } namespace RiskOfOptions.Lib { public static class ColorExtensions { private const float Scale = 255f; public static Color FromRGBHex(this Color orig, int hex) { //IL_0033: 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) int num = (hex & 0xFF0000) >> 16; int num2 = (hex & 0xFF00) >> 8; int num3 = hex & 0xFF; return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, orig.a); } public static int ToRGBHex(this Color orig) { //IL_0000: 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_0020: Unknown result type (might be due to invalid IL or missing references) int num = (int)(orig.r * 255f) << 16; int num2 = (int)(orig.g * 255f) << 8; int num3 = (int)(orig.b * 255f); return num | num2 | num3; } internal static Color ColorFromHSV(float hue, float sat, float val) { //IL_0051: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) float num = val * sat; float num2 = MathF.PI / 3f; float num3 = num * (1f - Mathf.Abs((float)((double)(hue / num2) % 2.0 - 1.0))); float num4 = val - num; if (hue < 1f * num2) { return new Color(num4 + num, num4 + num3, num4 + 0f, 1f); } if (hue < 2f * num2) { return new Color(num4 + num3, num4 + num, num4 + 0f, 1f); } if (hue < 3f * num2) { return new Color(num4 + 0f, num4 + num, num4 + num3, 1f); } if (hue < 4f * num2) { return new Color(num4 + 0f, num4 + num3, num4 + num, 1f); } if (hue < 5f * num2) { return new Color(num4 + num3, num4 + 0f, num4 + num, 1f); } return new Color(num4 + num, num4 + 0f, num4 + num3, 1f); } internal static void ToHSV(this Color orig, float inHue, out float outHue, out float saturation, out float value) { //IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00f4: Unknown result type (might be due to invalid IL or missing references) outHue = 0f; float num = Mathf.Min(orig.r, Mathf.Min(orig.g, orig.b)); float num2 = Mathf.Max(orig.r, Mathf.Max(orig.g, orig.b)); float num3 = num2 - num; value = num2; if (num3 == 0f) { saturation = 0f; outHue = inHue.Remap(0f, 6.28f, 0f, 1f); } else { saturation = num3 / num2; float num4 = ((num2 - orig.r) / 6f + num3 / 2f) / num3; float num5 = ((num2 - orig.g) / 6f + num3 / 2f) / num3; float num6 = ((num2 - orig.b) / 6f + num3 / 2f) / num3; if (orig.r == num3) { outHue = num6 - num5; } else if (orig.g == num3) { outHue = 1f / 3f + num4 - num6; } else if (orig.b == num3) { outHue = 2f / 3f + num5 - num4; } if (outHue < 0f) { outHue += 1f; } if (outHue > 1f) { outHue -= 1f; } } outHue = outHue.Remap(0f, 1f, 0f, 6.28f); } } internal static class CursorController { private static Hook _controllerHook; private static CursorSet _origMouse; private static CursorSet _origGamepad; private static CursorSet _cursorSet = default(CursorSet); private static CursorIndicatorController _indicatorControllerInstance; internal static readonly Dictionary<string, GameObject> Cursors = new Dictionary<string, GameObject>(); private static CursorIndicatorController IndicatorController { get { if (!Object.op_Implicit((Object)(object)_indicatorControllerInstance)) { _indicatorControllerInstance = ((IEnumerable<MPEventSystem>)MPEventSystem.readOnlyInstancesList).FirstOrDefault((Func<MPEventSystem, bool>)((MPEventSystem instance) => (Object)(object)instance.cursorIndicatorController != (Object)null))?.cursorIndicatorController; } return _indicatorControllerInstance; } } internal static void Init() { InitHooks(); LoadCursors(); ModifyCursorIndicatorController(); } private static void InitHooks() { MethodInfo method = typeof(CursorController).GetMethod("SetCursorOverride", BindingFlags.Static | BindingFlags.NonPublic); _controllerHook = HookHelper.NewHook<CursorIndicatorController>("SetCursor", method); } private static void LoadCursors() { } private static void ModifyCursorIndicatorController() { //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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/CursorIndicator.prefab").WaitForCompletion(); obj.AddComponent<AddCursorsToController>(); CursorIndicatorController component = obj.GetComponent<CursorIndicatorController>(); _origMouse = component.mouseCursorSet; _origGamepad = component.gamepadCursorSet; } private static void SetCursorOverride(Action<CursorIndicatorController, CursorSet, CursorImage, Color> orig, CursorIndicatorController self, CursorSet set, CursorImage image, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) orig(self, set, image, color); } } internal static class HookHelper { private const BindingFlags TargetFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private const BindingFlags DestFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; internal static Hook NewHook<TTarget, TDest>(string targetMethodName, string destMethodName, TDest instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown MethodInfo? method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method2 = typeof(TDest).GetMethod(destMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return new Hook((MethodBase)method, method2, (object)instance); } internal static Hook NewHook<TTarget>(string targetMethodName, MethodInfo destMethod) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return new Hook((MethodBase)typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic), destMethod); } } internal static class KeyValuePairExtensions { internal static void Deconstruct<TKey, TValue>(this KeyValuePair<TKey, TValue> keyValuePair, out TKey key, out TValue value) { key = keyValuePair.Key; value = keyValuePair.Value; } } internal static class LanguageApi { internal delegate string LanguageStringDelegate(); private static readonly Dictionary<string, string> LanguageEntries = new Dictionary<string, string>(); private static readonly Dictionary<string, LanguageStringDelegate> DynamicLanguageEntries = new Dictionary<string, LanguageStringDelegate>(); private static Hook _languageHook; internal static void Init() { MethodInfo method = typeof(LanguageApi).GetMethod("GetLocalizedStringByToken", BindingFlags.Static | BindingFlags.NonPublic); _languageHook = HookHelper.NewHook<Language>("GetLocalizedStringByToken", method); } internal static void Add(string token, string entry) { LanguageEntries[token] = entry; } internal static void AddDelegate(string token, LanguageStringDelegate stringDelegate) { DynamicLanguageEntries[token] = stringDelegate; } internal static void RemoveDelegate(string token) { DynamicLanguageEntries.Remove(token); } private static string GetLocalizedStringByToken(Func<Language, string, string> orig, Language self, string token) { if (token.Length > 15) { if (token.Substring(0, 15) != "RISK_OF_OPTIONS") { return orig(self, token); } if (LanguageEntries.TryGetValue(token, out string value)) { return value; } if (DynamicLanguageEntries.TryGetValue(token, out LanguageStringDelegate value2)) { return value2(); } } return orig(self, token); } } public struct ModMetaData { public string Guid; public string Name; } } namespace RiskOfOptions.Containers { internal class Category { public readonly string name; private readonly List<BaseOption> _options = new List<BaseOption>(); private readonly Dictionary<string, int> _identifierOptionMap = new Dictionary<string, int>(); private string _customNameToken; public string ModGuid { get; } internal string NameToken { get { if (!string.IsNullOrEmpty(_customNameToken)) { return _customNameToken; } return ("RISK_OF_OPTIONS." + ModGuid + ".category." + name).Replace(" ", "_").ToUpper(); } } internal int OptionCount => _options.Count; internal BaseOption this[int index] => _options[index]; internal Category(string name, string modGuid) { this.name = name; ModGuid = modGuid; _customNameToken = string.Empty; LanguageApi.Add(NameToken, name); } internal void AddOption(ref BaseOption option) { int count = _options.Count; _options.Add(option); _identifierOptionMap.Add(option.Identifier, count); } internal BaseOption GetOption(string identifier) { return _options[_identifierOptionMap[identifier]]; } private bool Equals(Category other) { return name == other.name; } public override bool Equals(object obj) { if (obj == null) { return false; } if (this == obj) { return true; } if (obj.GetType() == GetType()) { return Equals((Category)obj); } return false; } public override int GetHashCode() { if (name == null) { return 0; } return name.GetHashCode(); } public static bool operator ==(Category left, Category right) { if ((object)right != null && (object)left != null) { return left.name == right.name; } return false; } public static bool operator !=(Category left, Category right) { return !(left == right); } public void SetNameToken(string nameToken) { _customNameToken = nameToken; } } internal class ModIndexedOptionCollection : IEnumerable<OptionCollection>, IEnumerable { private class OptionCollectionEnumerator : IEnumerator<OptionCollection>, IEnumerator, IDisposable { private readonly OptionCollection[] _optionCollections; private int _position = -1; public OptionCollection Current { get { try { return _optionCollections[_position]; } catch (IndexOutOfRangeException) { throw new InvalidOperationException(); } } } object IEnumerator.Current => Current; internal OptionCollectionEnumerator(OptionCollection[] optionCollections) { _optionCollections = optionCollections; } public bool MoveNext() { _position++; return _position < _optionCollections.Length; } public void Reset() { _position = -1; } public void Dispose() { } } private readonly Dictionary<string, OptionCollection> _optionCollections = new Dictionary<string, OptionCollection>(); private readonly Dictionary<string, string> _identifierModGuidMap = new Dictionary<string, string>(); internal OptionCollection this[string modGuid] { get { return _optionCollections[modGuid]; } set { _optionCollections[modGuid] = value; } } internal int Count => _optionCollections.Count; internal void AddOption(ref BaseOption option) { if (!_optionCollections.ContainsKey(option.ModGuid)) { _optionCollections[option.ModGuid] = new OptionCollection(option.ModName, option.ModGuid); } _optionCollections[option.ModGuid].AddOption(ref option); _identifierModGuidMap[option.Identifier] = option.ModGuid; } internal BaseOption GetOption(string identifier) { string key = _identifierModGuidMap[identifier]; return _optionCollections[key].GetOption(identifier); } internal bool ContainsModGuid(string modGuid) { return _optionCollections.ContainsKey(modGuid); } public IEnumerator<OptionCollection> GetEnumerator() { return new OptionCollectionEnumerator(_optionCollections.Values.ToArray()); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } internal class OptionCollection { private readonly List<Category> _categories = new List<Category>(); private readonly Dictionary<string, int> _nameCategoryMap = new Dictionary<string, int>(); private readonly Dictionary<string, string> _identifierCategoryNameMap = new Dictionary<string, string>(); public Sprite? icon; public GameObject? iconPrefab; private string? _descriptionToken; public string ModName { get; } public string ModGuid { get; } internal int CategoryCount => _categories.Count; internal string NameToken => ("RISK_OF_OPTIONS." + ModGuid + ".mod_list_button.name").Replace(" ", "_").ToUpper(); internal string DescriptionToken { get { if (_descriptionToken == null) { _descriptionToken = ("RISK_OF_OPTIONS." + ModGuid + ".mod_list_button.description").Replace(" ", "_").ToUpper(); } return _descriptionToken; } set { _descriptionToken = value; } } internal Category this[int index] => _categories[index]; internal Category this[string categoryName] => _categories[_nameCategoryMap[categoryName]]; internal OptionCollection(string modName, string modGuid) { ModName = modName; ModGuid = modGuid; LanguageApi.Add(NameToken, ModName); } internal void SetDescriptionText(string descriptionText) { LanguageApi.Add(DescriptionToken, descriptionText); } internal void AddOption(ref BaseOption option) { if (!_nameCategoryMap.ContainsKey(option.Category)) { int count = _categories.Count; _categories.Add(new Category(option.Category, ModGuid)); _nameCategoryMap[option.Category] = count; } _categories[_nameCategoryMap[option.Category]].AddOption(ref option); _identifierCategoryNameMap[option.Identifier] = option.Category; } internal BaseOption GetOption(string identifier) { _ = _identifierCategoryNameMap[identifier]; return _categories[_nameCategoryMap[_identifierCategoryNameMap[identifier]]].GetOption(identifier); } } } namespace RiskOfOptions.Components.RuntimePrefabs { public class CheckBoxPrefab : IRuntimePrefab { public GameObject CheckBoxButton { get; private set; } public void Instantiate(GameObject settingsPanel) { CheckBoxButton = Object.Instantiate<GameObject>(Prefabs.boolButton); GameObject val = Object.Instantiate<GameObject>(((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio") .Find("Scroll View") .Find("Viewport") .Find("VerticalLayout") .Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject); CarouselController componentInChildren = val.GetComponentInChildren<CarouselController>(); ModSettingsBool component = CheckBoxButton.GetComponent<ModSettingsBool>(); component.checkBoxFalse = componentInChildren.choices[0].customSprite; component.checkBoxTrue = componentInChildren.choices[1].customSprite; CheckBoxButton.GetComponent<HGButton>().hoverLanguageTextMeshController = val.GetComponent<HGButton>().hoverLanguageTextMeshController; Object.DestroyImmediate((Object)(object)val); } public void Destroy() { Object.DestroyImmediate((Object)(object)CheckBoxButton); } } public class ChoicePrefab : IRuntimePrefab { public GameObject ChoiceButton { get; private set; } public void Instantiate(GameObject settingsPanel) { //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Expected O, but got Unknown GameObject gameObject = ((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio") .Find("Scroll View") .Find("Viewport") .Find("VerticalLayout") .Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject; ChoiceButton = Object.Instantiate<GameObject>(((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Video") .Find("Scroll View") .Find("Viewport") .Find("VerticalLayout") .Find("Option, Resolution")).gameObject); Transform obj = ChoiceButton.transform.Find("CarouselRect"); Object.DestroyImmediate((Object)(object)((Component)obj).GetComponent<ResolutionControl>()); Object.DestroyImmediate((Object)(object)((Component)obj.Find("RefreshRateDropdown")).gameObject); Object.DestroyImmediate((Object)(object)((Component)obj.Find("ApplyButton")).gameObject); Object.DestroyImmediate((Object)(object)ChoiceButton.GetComponent<SelectableDescriptionUpdater>()); Object.DestroyImmediate((Object)(object)ChoiceButton.GetComponent<PanelSkinController>()); Object.DestroyImmediate((Object)(object)ChoiceButton.GetComponent<Image>()); Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("BaseOutline")).gameObject, ChoiceButton.transform); GameObject val = Object.Instantiate<GameObject>(((Component)gameObject.transform.Find("HoverOutline")).gameObject, ChoiceButton.transform); ChoiceButton.SetActive(false); HGButton obj2 = ChoiceButton.AddComponent<HGButton>(gameObject.GetComponent<HGButton>()); obj2.imageOnHover = val.GetComponent<Image>(); ChoiceButton.AddComponent<ButtonSkinController>(gameObject.GetComponent<ButtonSkinController>()); Image targetGraphic = ChoiceButton.AddComponent<Image>(gameObject.GetComponent<Image>()); ((Selectable)obj2).targetGraphic = (Graphic)(object)targetGraphic; ((Selectable)obj2).navigation = default(Navigation); ((UnityEventBase)((Button)obj2).onClick).RemoveAllListeners(); Transform val2 = ChoiceButton.transform.Find("Text, Name"); ChoiceButton.AddComponent<DropDownController>().nameLabel = ((Component)val2).GetComponent<LanguageTextMeshController>(); RectTransform val3 = (RectTransform)val2; val3.anchoredPosition = Vector2.zero; val3.pivot = new Vector2(0.5f, 0.5f); val3.sizeDelta = new Vector2(-24f, -8f); val3.anchorMax = new Vector2(0.5f, 1f); GameObject gameObject2 = ((Component)ChoiceButton.transform.Find("CarouselRect").Find("ResolutionDropdown")).gameObject; ((Object)gameObject2).name = "Dropdown"; LayoutElement component = gameObject2.GetComponent<LayoutElement>(); component.minWidth = 300f; component.preferredWidth = 300f; Object.DestroyImmediate((Object)(object)gameObject2.GetComponent<MPDropdown>()); ((Component)gameObject2.transform.Find("Label")).gameObject.AddComponent<LanguageTextMeshController>(); RooDropdown rooDropdown = gameObject2.AddComponent<RooDropdown>(); rooDropdown.defaultColors = ((Selectable)gameObject.GetComponent<HGButton>()).colors; Object.DestroyImmediate((Object)(object)((Component)gameObject2.transform.Find("Template")).gameObject); GameObject val4 = Object.Instantiate<GameObject>(gameObject, ChoiceButton.transform); ((Object)val4).name = "Choice Item Prefab"; val4.SetActive(false); HGButton component2 = val4.GetComponent<HGButton>(); ((UnityEventBase)((Button)component2).onClick).RemoveAllListeners(); ((MPButton)component2).disablePointerClick = false; Object.DestroyImmediate((Object)(object)val4.GetComponent<CarouselController>()); Object.DestroyImmediate((Object)(object)((Component)val4.transform.Find("CarouselRect")).gameObject); LayoutElement component3 = val4.GetComponent<LayoutElement>(); component3.minHeight = 40f; component3.preferredHeight = 40f; rooDropdown.choiceItemPrefab = val4; GameObject val5 = Object.Instantiate<GameObject>(((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio")).gameObject, gameObject2.transform); ((Object)val5).name = "Drop Down Parent"; val5.SetActive(false); Transform obj3 = val5.transform.Find("Scroll View").Find("Viewport").Find("VerticalLayout"); Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject); Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Slider (Master Volume)")).gameObject); Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Slider (SFX Volume)")).gameObject); Object.DestroyImmediate((Object)(object)((Component)((Component)obj3).transform.Find("SettingsEntryButton, Slider (MSX Volume)")).gameObject); Object.DestroyImmediate((Object)(object)val5.GetComponent<SettingsPanelController>()); Object.DestroyImmediate((Object)(object)val5.GetComponent<HGButtonHistory>()); Object.DestroyImmediate((Object)(object)val5.GetComponent<OnEnableEvent>()); Object.DestroyImmediate((Object)(object)val5.GetComponent<UIJuice>()); Canvas orAddComponent = val5.GetOrAddComponent<Canvas>(); orAddComponent.overrideSorting = true; orAddComponent.sortingOrder = 30000; val5.GetOrAddComponent<GraphicRaycaster>(); val5.GetOrAddComponent<CanvasGroup>().alpha = 1f; RectTransform component4 = val5.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = new Vector2(1f, 0f); component4.pivot = new Vector2(0.5f, 1f); component4.sizeDelta = new Vector2(0f, 300f); component4.anchoredPosition = Vector2.zero; RectTransform component5 = ((Component)val5.transform.Find("Scroll View").Find("Scrollbar Vertical")).GetComponent<RectTransform>(); component5.anchorMin = new Vector2(1f, 0.02f); component5.anchorMax = new Vector2(1f, 0.98f); component5.sizeDelta = new Vector2(24f, 0f); component5.anchoredPosition = new Vector2(-26f, 0f); GameObject gameObject3 = ((Component)val5.transform.Find("Scroll View").Find("Viewport").Find("VerticalLayout")).gameObject; ((LayoutGroup)gameObject3.GetComponent<VerticalLayoutGroup>()).padding = new RectOffset(4, 18, 4, 4); rooDropdown.content = gameObject3; rooDropdown.template = val5; ((Object)ChoiceButton).name = "Mod Option Prefab, Choice"; } public void Destroy() { Object.DestroyImmediate((Object)(object)ChoiceButton); } } public class FloatFieldPrefab : IRuntimePrefab { public GameObject FloatField { get; private set; } public void Instantiate(GameObject settingsPanel) { FloatField = Object.Instantiate<GameObject>(Prefabs.floatFieldButton); } public void Destroy() { Object.DestroyImmediate((Object)(object)FloatField); } } public class GenericButtonPrefab : IRuntimePrefab { public GameObject GenericButton { get; private set; } public void Instantiate(GameObject settingsPanel) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) Transform val = settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Audio") .Find("Scroll View") .Find("Viewport") .Find("VerticalLayout"); GenericButton = Object.Instantiate<GameObject>(((Component)val.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject); ((Object)GenericButton).name = "Mod Option Prefab, GenericButton"; GenericButton.SetActive(false); Object.DestroyImmediate((Object)(object)GenericButton.GetComponentInChildren<CarouselController>()); Object.DestroyImmediate((Object)(object)((Component)GenericButton.transform.Find("CarouselRect")).gameObject); GenericButton.AddComponent<GenericButtonController>(); GameObject val2 = new GameObject("ButtonContainer", new Type[3] { typeof(RectTransform), typeof(HorizontalLayoutGroup), typeof(ContentSizeFitter) }); val2.transform.SetParent(GenericButton.transform); HorizontalLayoutGroup component = val2.GetComponent<HorizontalLayoutGroup>(); ((LayoutGroup)component).childAlignment = (TextAnchor)5; ((LayoutGroup)component).padding = new RectOffset(8, 8, 0, 0); ((HorizontalOrVerticalLayoutGroup)component).spacing = 8f; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false; RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(1f, 0.5f); component2.anchoredPosition = new Vector2(-6f, 0f); ContentSizeFitter component3 = val2.GetComponent<ContentSizeFitter>(); component3.horizontalFit = (FitMode)2; component3.verticalFit = (FitMode)1; GameObject obj = Object.Instantiate<GameObject>(((Component)val.Find("SettingsEntryButton, Bool (Audio Focus)")).gameObject, val2.transform); ((Object)obj).name = "Button"; Object.DestroyImmediate((Object)(object)obj.GetComponentInChildren<CarouselController>()); Object.DestroyImmediate((Object)(object)((Component)obj.transform.Find("CarouselRect")).gameObject); obj.GetComponent<LayoutElement>().minHeight = 48f; HGButton component4 = obj.GetComponent<HGButton>(); ((MPButton)component4).disablePointerClick = false; ((UnityEventBase)((Button)component4).onClick).RemoveAllListeners(); HGTextMeshProUGUI componentInChildren = obj.GetComponentInChildren<HGTextMeshProUGUI>(); ((TMP_Text)componentInChildren).enableAutoSizing = false; ((TMP_Text)componentInChildren).fontSizeMin = ((TMP_Text)componentInChildren).fontSize; ((TMP_Text)componentInChildren).fontSizeMax = ((TMP_Text)componentInChildren).fontSize; } public void Destroy() { Object.DestroyImmediate((Object)(object)GenericButton); } } public class InputFieldPrefab : IRuntimePrefab { public GameObject InputField { get; private set; } public void Instantiate(GameObject settingsPanel) { InputField = Object.Instantiate<GameObject>(Prefabs.inputFieldButton); InputField.SetActive(false); } public void Destroy() { Object.DestroyImmediate((Object)(object)InputField); } } public class IntFieldPrefab : IRuntimePrefab { public GameObject IntField { get; private set; } public void Instantiate(GameObject settingsPanel) { IntField = Object.Instantiate<GameObject>(Prefabs.intFieldButton); } public void Destroy() { Object.DestroyImmediate((Object)(object)IntField); } } public class IntSliderPrefab : IRuntimePrefab { public GameObject IntSlider { get; private set; } public void Instantiate(GameObject settingsPanel) { IntSlider = Object.Instantiate<GameObject>(Prefabs.intSliderButton); } public void Destroy() { Object.DestroyImmediate((Object)(object)IntSlider); } } public interface IRuntimePrefab { void Instantiate(GameObject settingsPanel); void Destroy(); } public class KeyBindPrefab : IRuntimePrefab { public GameObject KeyBind { get; private set; } public void Instantiate(GameObject settingsPanel) { GameObject gameObject = ((Component)settingsPanel.transform.Find("SafeArea").Find("SubPanelArea").Find("SettingsSubPanel, Controls (M&KB)") .Find("Scroll View") .Find("Viewport") .Find("VerticalLayout") .Find("SettingsEntryButton, Binding (Jump)")).gameObject; KeyBind = Object.Instantiate<GameObject>(gameObject); ((Object)KeyBind).name = "Mod Option Prefab, KeyBind"; InputBindingControl componentInChildren = KeyBind.GetComponentInChildren<InputBindingControl>(); KeyBind.AddComponent<KeyBindController>().nameLabel = componentInChildren.nameLabel; Object.DestroyImmediate((Object)(object)componentInChildren); Object.DestroyImmediate((Object)(object)KeyBind.GetComponentInChildren<InputBindingDisplayController>()); HGButton[] componentsInChildren = KeyBind.GetComponentsInChildren<HGButton>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((UnityEventBase)((Button)componentsInChildren[i]).onClick).RemoveAllListeners(); } } public void Destroy() { Object.DestroyImmediate((Object)(object)KeyBind); } } public class ModOptionsPanelPrefab : IRuntimePrefab { [CanBeNull] private GameObject _optionsPanel; [CanBeNull] private GameObject _genericDescriptionPanel; private GameObject _audioVerticalLayout; [CanBeNull] private GameObject _emptyButton; public GameObject ModListButton { get; private set; } public GameObject ModOptionsHeaderButton { get; private set; } public GameObject Canvas { get; private set; } public GameObject ModListPanel { get; private set; } public GameObject ModListHighlight { get; private set; } public GameObject ModDescriptionPanel { get; private set; } public GameObject CategoryHeader { get; private set; } public GameObject CategoryHeaderButton { get; private set; } public GameObject CategoryHeaderHighlight { get; private set; } public GameObject CategoryPageIndicators { get; private set; } public GameObject CategoryPageIndicator { get; private set; } public GameObject CategoryPageIndicatorOutline { get; private set; } public GameObject CategoryLeftButton { get; private set; } public GameObject CategoryRightButton { get; private set; } public GameObject ModOptionsPanel { get; private set; } public GameObject ModOptionsDescriptionPanel { get; private set; } public GameObject WarningPanel { get; private set; } public void Instantiate(GameObject settingsPanel) { Transform transform = settingsPanel.transform; Transform subPanelArea = transform.Find("SafeArea").Find("SubPanelArea"); Transform headerArea = transform.Find("SafeArea").Find("HeaderContainer").Find("Header (JUICED)"); CreateOptionsPanel(subPanelArea); CreateGenericDescriptionPanel(subPanelArea); CreateModOptionsHeaderButton(headerArea); CreateVerticalLayout(subPanelArea); CreateModListButton(); CreateEmptyButton(); CreateCanvas(); CreateModListPanel(settingsPanel); CreateModDescriptionPanel(); CreateCategoryHeader(); CreateAdditionalCategoryStuff(); CreateModOptionsPanel(); Object.DestroyImmediate((Object)(object)_emptyButton); Object.DestroyImmediate((Object)(object)_optionsPanel);