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 CustomDiscoverStateLib v1.0.3
Kistras-CustomDiscoverStateLib.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; 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("Kistras-CustomDiscoverStateLib")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+d532df28d9c45c87453508dbad9c8215460c89f6")] [assembly: AssemblyProduct("CustomDiscoverStateLib")] [assembly: AssemblyTitle("Kistras-CustomDiscoverStateLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.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 CustomDiscoverStateLib { [BepInPlugin("Kistras-CustomDiscoverStateLib", "CustomDiscoverStateLib", "1.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private readonly Harmony harmony = new Harmony("Kistras-CustomDiscoverStateLib"); private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(typeof(Patches)); Logger.LogInfo((object)"Plugin Kistras-CustomDiscoverStateLib is loaded!"); } } public static class CustomDiscoverState { public delegate bool DynamicStateDelegate(ValuableDiscover valuableDiscover, PhysGrabObject physGrabObject, out Color? middle, out Color? corner); public delegate bool ConditionalStateDelegate(ValuableDiscover valuableDiscover, PhysGrabObject physGrabObject); public class CustomDiscoverGraphic { public Color ColorMiddle; public Color ColorCorner; } private static int lastAddedIndex = 260; internal static Dictionary<State, ConditionalStateDelegate> conditionalStates = new Dictionary<State, ConditionalStateDelegate>(); internal static Dictionary<State, CustomDiscoverGraphic> customStates = new Dictionary<State, CustomDiscoverGraphic>(); internal static Dictionary<State, DynamicStateDelegate> dynamicStates = new Dictionary<State, DynamicStateDelegate>(); public static State AddNewDiscoverGraphic(Color middle, Color corner) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0033: 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) State val = (State)lastAddedIndex; lastAddedIndex++; customStates[val] = new CustomDiscoverGraphic { ColorMiddle = middle, ColorCorner = corner }; return val; } public static State AddNewConditionalDiscoverGraphic(ConditionalStateDelegate condition, Color middle, Color corner) { //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_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_0016: 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_001a: Unknown result type (might be due to invalid IL or missing references) State val = AddNewDiscoverGraphic(middle, corner); conditionalStates[val] = condition; return val; } public static State AddNewDynamicDiscoverGraphic(DynamicStateDelegate @delegate) { //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) //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_002a: 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_0033: 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) State val = AddNewDiscoverGraphic(new Color(0f, 0f, 0f, 0f), Color.white); dynamicStates[val] = @delegate; return val; } } [HarmonyPatch] internal class Patches { [HarmonyPatch(typeof(ValuableDiscover), "New")] [HarmonyPrefix] public static bool ValuableDiscoverPatch(ValuableDiscover __instance, PhysGrabObject _target, ref State _state, ValuableDiscoverCustom _custom = null) { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01d1: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected I4, but got Unknown if ((Object)(object)_custom != (Object)null) { _state = (State)3; return true; } Color? middle = null; Color? corner = null; if (!CustomDiscoverState.customStates.TryGetValue(_state, out var value)) { bool flag = false; foreach (KeyValuePair<State, CustomDiscoverState.ConditionalStateDelegate> conditionalState in CustomDiscoverState.conditionalStates) { if (conditionalState.Value(__instance, _target)) { value = CustomDiscoverState.customStates[conditionalState.Key]; flag = true; middle = value.ColorMiddle; corner = value.ColorCorner; break; } } if (!flag || value == null) { foreach (KeyValuePair<State, CustomDiscoverState.DynamicStateDelegate> dynamicState in CustomDiscoverState.dynamicStates) { if (dynamicState.Value(__instance, _target, out middle, out corner)) { _state = (State)(int)dynamicState.Key; flag = true; break; } } if (!flag) { return true; } } } else { middle = value.ColorMiddle; corner = value.ColorCorner; } if (!middle.HasValue || !corner.HasValue) { return true; } ValuableDiscoverGraphic component = Object.Instantiate<GameObject>(__instance.graphicPrefab, ((Component)__instance).transform).GetComponent<ValuableDiscoverGraphic>(); component.target = _target; component.state = _state; ((Graphic)((Component)component.middle).GetComponent<Image>()).color = middle.Value; ((Graphic)((Component)component.topLeft).GetComponent<Image>()).color = corner.Value; ((Graphic)((Component)component.topRight).GetComponent<Image>()).color = corner.Value; ((Graphic)((Component)component.botLeft).GetComponent<Image>()).color = corner.Value; ((Graphic)((Component)component.botRight).GetComponent<Image>()).color = corner.Value; return false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Kistras-CustomDiscoverStateLib"; public const string PLUGIN_NAME = "CustomDiscoverStateLib"; public const string PLUGIN_VERSION = "1.0.1"; } }