using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using src.UINavigator; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Clear This Type")] [assembly: AssemblyProduct("Clear This Type")] [assembly: ComVisible(false)] [assembly: Guid("042701eb-e714-4929-96aa-a7f4e71e6630")] [assembly: AssemblyFileVersion("0.1.7.0")] [assembly: AssemblyVersion("0.1.7.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ClearThisType { [BepInPlugin("com.cotl.betterbuildertools.clearthistype", "Clear This Type", "0.1.9")] public sealed class ClearThisTypePlugin : BaseUnityPlugin { public const string PluginGuid = "com.cotl.betterbuildertools.clearthistype"; public const string PluginName = "Clear This Type"; public const string PluginVersion = "0.1.9"; private Harmony _harmony; private KeyCode _clearKey; private KeyCode _controllerConfirmKey; private KeyCode _controllerCancelKey; private string _statusText = ""; private float _statusUntil; private TYPES _pendingType; private float _pendingUntil; private string _pendingName = ""; private int _pendingCount; private GUIStyle _boxStyle; private GUIStyle _titleStyle; private GUIStyle _bodyStyle; private GUIStyle _confirmStyle; private GUIStyle _cancelStyle; private Texture2D _boxBackground; private Texture2D _confirmBackground; private Texture2D _cancelBackground; internal static ManualLogSource Log { get; private set; } private void Awake() { //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) //IL_0040: 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_005a: 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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ClearThisTypeConfig.Bind(((BaseUnityPlugin)this).Config); _clearKey = ParseKey(ClearThisTypeConfig.ClearKey.Value, (KeyCode)289); _controllerConfirmKey = ParseKey(ClearThisTypeConfig.ControllerConfirmKey.Value, (KeyCode)330); _controllerCancelKey = ParseKey(ClearThisTypeConfig.ControllerCancelKey.Value, (KeyCode)331); _harmony = new Harmony("com.cotl.betterbuildertools.clearthistype"); _harmony.PatchAll(typeof(ClearThisTypePlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Clear This Type 0.1.9 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _harmony = null; DestroyTexture(ref _boxBackground); DestroyTexture(ref _confirmBackground); DestroyTexture(ref _cancelBackground); } private void Update() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) bool allowNearestFallback; if (!ClearThisTypeConfig.Enabled.Value || (Object)(object)PlacementRegion.Instance == (Object)null || !IsActiveBuildPlacement()) { ClearPending(); } else if (HasPendingConfirmation() && (Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown((KeyCode)324))) { ClearPending(); ShowStatus("Remove all cancelled"); } else if (HasPendingConfirmation() && ControllerCancelPressed()) { ClearPending(); ShowStatus("Remove all cancelled"); } else if (HasPendingConfirmation() && ControllerConfirmPressed()) { ClearMatchingType(_pendingType); } else if (ClearPressed(out allowNearestFallback)) { QueueOrClearHoveredType(allowNearestFallback); } } private bool ClearPressed(out bool allowNearestFallback) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) allowNearestFallback = false; if (Input.GetKeyDown(_clearKey)) { allowNearestFallback = true; return true; } if (!ClearThisTypeConfig.EnableVanillaClearButton.Value) { return false; } try { return InputManager.Gameplay.GetInteract3ButtonDown(MonoSingleton.Instance.AllowInputOnlyFromPlayer); } catch { return false; } } private bool ControllerConfirmPressed() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(_controllerConfirmKey)) { return true; } try { return InputManager.UI.GetAcceptButtonDown((PlayerFarming)null); } catch { return false; } } private bool ControllerCancelPressed() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(_controllerCancelKey)) { return true; } try { return InputManager.UI.GetCancelButtonDown((PlayerFarming)null); } catch { return false; } } private unsafe void QueueOrClearHoveredType(bool allowNearestFallback) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) Structure val = PlacementRegion.Instance.GetHoveredStructure(); if ((Object)(object)val == (Object)null && allowNearestFallback) { val = GetNearestStructureAtPlacement(PlacementRegion.Instance.PlacementPosition, ClearThisTypeConfig.TargetRadius.Value); } StructureBrain val2 = (((Object)(object)val != (Object)null) ? val.Brain : null); if (val2 == null || val2.Data == null) { Log.LogInfo((object)"Clear This Type: no hovered structure found."); ShowStatus("No matching structure under cursor"); return; } TYPES type = val2.Data.Type; if (!ClearThisTypeConfig.AllowCriticalStructures.Value && IsCritical(type)) { Log.LogWarning((object)("Blocked Clear This Type for protected structure type " + ((object)(*(TYPES*)(&type))/*cast due to .constrained prefix*/).ToString() + ".")); ShowStatus("Protected structure type"); } else if (ClearThisTypeConfig.RequireConfirmation.Value && (_pendingType != type || Time.unscaledTime > _pendingUntil)) { SetPendingConfirmation(type); } else { ClearMatchingType(type); } } private void SetPendingConfirmation(TYPES type) { //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_001e: 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) _pendingType = type; _pendingUntil = Time.unscaledTime + ClearThisTypeConfig.ConfirmationSeconds.Value; _pendingName = StructuresData.LocalizedName(type); _pendingCount = GetStructuresOfType(type).Count; ShowStatus("Remove all " + _pendingName + "? Press again"); } private unsafe void ClearMatchingType(TYPES type) { //IL_0000: 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) //IL_005e: 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_006f: Unknown result type (might be due to invalid IL or missing references) List structuresOfType = GetStructuresOfType(type); int value = ClearThisTypeConfig.MaxClearCount.Value; int num = 0; int num2 = 0; int num3 = structuresOfType.Count - 1; while (num3 >= 0 && num < value) { Structure val = structuresOfType[num3]; if ((Object)(object)val != (Object)null && val.Brain != null && val.Brain.Data != null) { TYPES toBuildType = val.Brain.Data.ToBuildType; if (RemoveStructureCleanly(val)) { num++; num2 += RefundBuildSiteMaterials(type, toBuildType); } } num3--; } Log.LogInfo((object)("Cleared " + num + " structure(s) of type " + ((object)(*(TYPES*)(&type))/*cast due to .constrained prefix*/).ToString() + ".")); ShowStatus((num2 > 0) ? ("Cleared " + num + "x " + ((object)(*(TYPES*)(&type))/*cast due to .constrained prefix*/).ToString() + " and refunded " + num2 + " item(s)") : ("Cleared " + num + "x " + ((object)(*(TYPES*)(&type))/*cast due to .constrained prefix*/).ToString())); ClearPending(); } private static int RefundBuildSiteMaterials(TYPES type, TYPES toBuildType) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0018: 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_0014: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (!ClearThisTypeConfig.RefundBuildSiteMaterials.Value || ((int)type != 31 && (int)type != 118)) { return 0; } List cost = StructuresData.GetCost(((int)toBuildType != 0) ? toBuildType : type); if (cost == null) { return 0; } int num = 0; for (int i = 0; i < cost.Count; i++) { ItemCost val = cost[i]; if (val.CostValue > 0) { Inventory.AddItem(val.CostItem, val.CostValue, true); num += val.CostValue; } } return num; } private void LateUpdate() { UpdateVanillaPrompt(); } private void OnGUI() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) if (ClearThisTypeConfig.ShowConfirmationOverlay.Value && ClearThisTypeConfig.Enabled.Value && HasPendingConfirmation() && IsActiveBuildPlacement()) { EnsureStyles(); float num = Mathf.Min(540f, (float)Screen.width - 48f); float num2 = 168f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, Mathf.Max(56f, (float)Screen.height * 0.18f), num, num2); GUI.Box(val, GUIContent.none, _boxStyle); GUI.Label(new Rect(((Rect)(ref val)).x + 24f, ((Rect)(ref val)).y + 18f, ((Rect)(ref val)).width - 48f, 34f), "Remove all " + _pendingName + "?", _titleStyle); string text = "This will remove " + _pendingCount + " matching structure" + ((_pendingCount == 1) ? "" : "s") + " from the cult. Press " + ClearThisTypeConfig.ClearKey.Value + " again or use Confirm. Controller: Accept to confirm, Back to cancel."; GUI.Label(new Rect(((Rect)(ref val)).x + 24f, ((Rect)(ref val)).y + 58f, ((Rect)(ref val)).width - 48f, 44f), text, _bodyStyle); Rect val2 = new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - 248f, ((Rect)(ref val)).y + ((Rect)(ref val)).height - 48f, 104f, 30f); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref val)).x + ((Rect)(ref val)).width - 132f, ((Rect)(ref val)).y + ((Rect)(ref val)).height - 48f, 84f, 30f); if (GUI.Button(val2, "Confirm", _confirmStyle)) { ClearMatchingType(_pendingType); } if (GUI.Button(val3, "Cancel", _cancelStyle)) { ClearPending(); ShowStatus("Remove all cancelled"); } } } private void UpdateVanillaPrompt() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!ClearThisTypeConfig.ShowPrompt.Value || !ClearThisTypeConfig.Enabled.Value || (Object)(object)PlacementRegion.Instance == (Object)null || (Object)(object)PlacementObject.Instance == (Object)null || (Object)(object)PlayerFarming.Instance == (Object)null || (Object)(object)PlayerFarming.Instance.indicator == (Object)null || !IsActiveBuildPlacement()) { return; } Structure val = PlacementRegion.Instance.GetHoveredStructure(); if ((Object)(object)val == (Object)null) { val = GetNearestStructureAtPlacement(PlacementRegion.Instance.PlacementPosition, ClearThisTypeConfig.TargetRadius.Value); } if (!((Object)(object)val == (Object)null) || !(Time.unscaledTime >= _statusUntil)) { string text = (((int)_pendingType != 0 && Time.unscaledTime <= _pendingUntil) ? "Confirm Remove All" : "Remove All"); Indicator indicator = PlayerFarming.Instance.indicator; indicator.HasThirdInteraction = true; indicator.ThirdInteractable = true; if (ClearThisTypeConfig.UseVanillaPromptSlot.Value) { indicator.thirdControlPrompt.Category = 0; indicator.thirdControlPrompt.Action = 67; } string text2 = (((Object)(object)indicator.Thirdtext != (Object)null) ? ((TMP_Text)indicator.Thirdtext).text : string.Empty); string text3 = ((Time.unscaledTime < _statusUntil && !string.IsNullOrEmpty(_statusText)) ? _statusText : text); ((TMP_Text)indicator.Thirdtext).text = (ShouldReplacePrompt(text2) ? text3 : text2); indicator.Reset(); } } private void ClearVanillaPrompt() { if ((Object)(object)PlayerFarming.Instance != (Object)null && (Object)(object)PlayerFarming.Instance.indicator != (Object)null && (Object)(object)PlayerFarming.Instance.indicator.Fourthtext != (Object)null) { ((TMP_Text)PlayerFarming.Instance.indicator.Fourthtext).text = ""; PlayerFarming.Instance.indicator.HasFourthInteraction = false; } } private void ShowStatus(string text) { _statusText = text; _statusUntil = Time.unscaledTime + 2f; } private bool HasPendingConfirmation() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)_pendingType != 0) { return Time.unscaledTime <= _pendingUntil; } return false; } private void ClearPending() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) _pendingType = (TYPES)0; _pendingUntil = 0f; _pendingName = ""; _pendingCount = 0; } private void EnsureStyles() { //IL_001e: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00ae: Expected O, but got Unknown //IL_00b9: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown if (_boxStyle == null) { _boxBackground = MakeTexture(new Color(0.02f, 0.015f, 0.012f, 0.92f)); _confirmBackground = MakeTexture(new Color(0.66f, 0.08f, 0.06f, 0.94f)); _cancelBackground = MakeTexture(new Color(0.16f, 0.14f, 0.12f, 0.94f)); GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = _boxBackground; val.padding = new RectOffset(18, 18, 18, 18); _boxStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 24, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; val2.normal.textColor = new Color(1f, 0.91f, 0.34f, 1f); _titleStyle = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 16, wordWrap = true, alignment = (TextAnchor)0 }; val3.normal.textColor = Color.white; _bodyStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.button) { fontSize = 16, fontStyle = (FontStyle)1 }; val4.normal.background = _confirmBackground; val4.normal.textColor = Color.white; val4.hover.background = _confirmBackground; val4.hover.textColor = Color.white; val4.active.background = _confirmBackground; val4.active.textColor = Color.white; _confirmStyle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.button) { fontSize = 16, fontStyle = (FontStyle)1 }; val5.normal.background = _cancelBackground; val5.normal.textColor = Color.white; val5.hover.background = _cancelBackground; val5.hover.textColor = Color.white; val5.active.background = _cancelBackground; val5.active.textColor = Color.white; _cancelStyle = val5; } } private static Texture2D MakeTexture(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } private static void DestroyTexture(ref Texture2D texture) { if (!((Object)(object)texture == (Object)null)) { Object.Destroy((Object)(object)texture); texture = null; } } private static Structure GetNearestStructureAtPlacement(Vector3 position, float radius) { //IL_0037: 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) Structure result = null; float num = radius; foreach (Structure structure in Structure.Structures) { if (!((Object)(object)structure == (Object)null) && structure.Brain != null && structure.Brain.Data != null) { float num2 = Vector3.Distance(position, ((Component)structure).transform.position); if (num2 <= num) { result = structure; num = num2; } } } return result; } private static List GetStructuresOfType(TYPES type) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Structure[] array = Structure.Structures.ToArray(); foreach (Structure val in array) { if ((Object)(object)val != (Object)null && val.Brain != null && val.Brain.Data != null && val.Brain.Data.Type == type) { list.Add(val); } } return list; } private static bool RemoveStructureCleanly(Structure structure) { if ((Object)(object)structure == (Object)null || structure.Brain == null || structure.Brain.Data == null) { return false; } try { if ((Object)(object)PlacementRegion.Instance != (Object)null) { PlacementRegion.Instance.DestroyBuilding(structure); } else { structure.RemoveStructure(); Object.Destroy((Object)(object)((Component)structure).gameObject); } return true; } catch (Exception ex) { Log.LogWarning((object)("Clean removal failed for " + ((object)Unsafe.As(ref structure.Type)/*cast due to .constrained prefix*/).ToString() + ": " + ex.Message)); return false; } } private unsafe static bool IsCritical(TYPES type) { string text = ((object)(*(TYPES*)(&type))/*cast due to .constrained prefix*/).ToString(); if (!text.Contains("TEMPLE") && !text.Contains("SHRINE") && !text.Contains("ALTAR")) { return text.Contains("BUILDER"); } return true; } private static bool IsActiveBuildPlacement() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 if ((Object)(object)PlacementObject.Instance == (Object)null || (Object)(object)PlacementRegion.Instance == (Object)null || (int)PlacementRegion.Instance.CurrentMode == 0) { return false; } Mode currentMode = PlacementRegion.Instance.CurrentMode; if ((int)currentMode != 1 && (int)currentMode != 5) { return (int)currentMode == 3; } return true; } private static bool ShouldReplacePrompt(string existing) { if (!string.IsNullOrEmpty(existing) && !existing.Contains("Clear this type") && !existing.Contains("Remove All") && !existing.Contains("Remove all ") && !existing.StartsWith("Cleared ") && !(existing == "Protected structure type") && !(existing == "No matching structure under cursor")) { return existing == "Remove all cancelled"; } return true; } private static KeyCode ParseKey(string raw, KeyCode fallback) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) try { return (KeyCode)Enum.Parse(typeof(KeyCode), raw, ignoreCase: true); } catch { return fallback; } } } internal static class ClearThisTypeConfig { internal static ConfigEntry Enabled; internal static ConfigEntry ClearKey; internal static ConfigEntry ControllerConfirmKey; internal static ConfigEntry ControllerCancelKey; internal static ConfigEntry MaxClearCount; internal static ConfigEntry AllowCriticalStructures; internal static ConfigEntry TargetRadius; internal static ConfigEntry ShowPrompt; internal static ConfigEntry EnableVanillaClearButton; internal static ConfigEntry UseVanillaPromptSlot; internal static ConfigEntry ShowConfirmationOverlay; internal static ConfigEntry RequireConfirmation; internal static ConfigEntry ConfirmationSeconds; internal static ConfigEntry RefundBuildSiteMaterials; internal static void Bind(ConfigFile config) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown Enabled = config.Bind("General", "Enabled", true, "Enable Clear This Type."); ClearKey = config.Bind("Controls", "ClearKey", "F8", "KeyCode used to clear all structures matching the hovered structure type."); ControllerConfirmKey = config.Bind("Controls", "ControllerConfirmKey", "JoystickButton0", "Fallback controller KeyCode used to confirm the custom Remove All prompt. JoystickButton0 is normally A/Cross."); ControllerCancelKey = config.Bind("Controls", "ControllerCancelKey", "JoystickButton1", "Fallback controller KeyCode used to cancel the custom Remove All prompt. JoystickButton1 is normally B/Circle."); EnableVanillaClearButton = config.Bind("Controls", "EnableVanillaClearButton", true, "Also trigger Clear This Type from the vanilla third interaction button while actively placing/editing."); MaxClearCount = config.Bind("Safety", "MaxClearCount", 250, new ConfigDescription("Maximum structures removed by one clear action.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 1000), Array.Empty())); AllowCriticalStructures = config.Bind("Safety", "AllowCriticalStructures", false, "Allow clearing temple/shrine/altar/builder style critical structures."); TargetRadius = config.Bind("Targeting", "TargetRadius", 1.25f, new ConfigDescription("Fallback radius around the build cursor when vanilla hover targeting returns nothing.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 5f), Array.Empty())); ShowPrompt = config.Bind("UI", "ShowPrompt", true, "Show a small build-mode prompt for Clear This Type."); UseVanillaPromptSlot = config.Bind("UI", "UseVanillaPromptSlot", true, "Use the vanilla third interaction prompt slot/glyph for Clear This Type."); ShowConfirmationOverlay = config.Bind("UI", "ShowConfirmationOverlay", true, "Show a centered confirmation prompt before removing every matching structure."); RequireConfirmation = config.Bind("Safety", "RequireConfirmation", true, "Require pressing Clear Type twice before removing every matching structure."); ConfirmationSeconds = config.Bind("Safety", "ConfirmationSeconds", 3f, new ConfigDescription("Seconds the remove-all confirmation remains active.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 10f), Array.Empty())); RefundBuildSiteMaterials = config.Bind("Safety", "RefundBuildSiteMaterials", true, "Refund the full normal cost directly to inventory when Remove All clears unfinished build sites."); } } }