Decompiled source of ActionBar v2.2.1
fierrof.ActionBar.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using SideLoader.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("fierrof.ActionBar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ede040323196862fd2b0a07362b3dd27d89efbb9")] [assembly: AssemblyProduct("fierrof.ActionBar")] [assembly: AssemblyTitle("fierrof.ActionBar")] [assembly: AssemblyVersion("1.0.0.0")] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] public class ConfigurationManagerAttributes : Attribute { public Action<ConfigEntryBase> CustomDrawer; public bool? HideDefaultButton; public bool? Browsable; public bool? IsAdvanced; public int? Order; } namespace fierrof.ActionBar; public class ActionBarManager : MonoBehaviour { private const int SLOT_WIDTH = 54; private const int SLOT_HEIGHT = 81; private Transform _vanillaBar; private GameObject[] _containers = (GameObject[])(object)new GameObject[4]; private List<GameObject>[] _slots = new List<GameObject>[4]; private int[] _lastSlotCount = new int[4]; private float[] _lastPosX = new float[4]; private float[] _lastPosY = new float[4]; private float[] _lastScale = new float[4]; private int[] _lastGap = new int[4]; private int[] _lastRows = new int[4]; private bool[] _lastEnabled = new bool[4]; private CanvasGroup _canvasGroup; private Canvas _uiCanvas; private GameObject _configOverlay; private bool _wasConfigMode; private string _loadedCharacterUID; private int _draggingBarIndex = -1; private Vector2 _dragAnchorOffset; private string _lastWeaponContext = ""; private float _totalLoadTime; private float _retryInterval; private bool _slotsLoaded; public void Setup(Transform vanillaBar) { _vanillaBar = vanillaBar; for (int i = 0; i < 4; i++) { _slots[i] = new List<GameObject>(); } ((Component)this).gameObject.AddComponent<HudMoverManager>(); BuildUI(); for (int j = 0; j < 4; j++) { SyncSlots(j); } } private void BuildUI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.layer = 5; RectTransform obj = ((Component)this).gameObject.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; _uiCanvas = ((Component)this).gameObject.AddComponent<Canvas>(); _uiCanvas.overrideSorting = true; _uiCanvas.sortingOrder = 1; ((Component)this).gameObject.AddComponent<GraphicRaycaster>(); _canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>(); _canvasGroup.alpha = 0f; _canvasGroup.blocksRaycasts = false; for (int i = 0; i < 4; i++) { _containers[i] = UIFactory.CreateUIObject($"SlotContainer_Bar{i + 1}", ((Component)this).gameObject, default(Vector2)); GridLayoutGroup obj2 = _containers[i].AddComponent<GridLayoutGroup>(); obj2.cellSize = new Vector2(54f, 81f); obj2.spacing = new Vector2((float)Plugin.SlotGap[i].Value, (float)Plugin.SlotGap[i].Value); obj2.constraint = (Constraint)1; obj2.constraintCount = Mathf.Clamp(Plugin.SlotCount[i].Value, 1, 20); obj2.startCorner = (Corner)0; obj2.startAxis = (Axis)0; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; ContentSizeFitter obj3 = _containers[i].AddComponent<ContentSizeFitter>(); obj3.horizontalFit = (FitMode)2; obj3.verticalFit = (FitMode)2; Image obj4 = _containers[i].AddComponent<Image>(); ((Graphic)obj4).color = new Color(0f, 0f, 0f, 0f); ((Graphic)obj4).raycastTarget = true; _containers[i].AddComponent<BarDragHandler>().BarIndex = i; bool value = Plugin.Enabled[i].Value; _containers[i].SetActive(value); _lastEnabled[i] = value; } BuildConfigOverlay(); } private void BuildConfigOverlay() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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) _configOverlay = new GameObject("ConfigOverlay"); _configOverlay.transform.SetParent(((Component)this).gameObject.transform, false); _configOverlay.transform.SetAsFirstSibling(); RectTransform obj = _configOverlay.AddComponent<RectTransform>(); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = Vector2.zero; obj.offsetMax = Vector2.zero; Image obj2 = _configOverlay.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.7f); ((Graphic)obj2).raycastTarget = false; GameObject val = new GameObject("InstructionText"); val.transform.SetParent(_configOverlay.transform, false); RectTransform obj3 = val.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(0.6f, 0.7f); obj3.anchorMax = new Vector2(0.98f, 0.98f); obj3.offsetMin = Vector2.zero; obj3.offsetMax = Vector2.zero; Text obj4 = val.AddComponent<Text>(); obj4.font = Font.CreateDynamicFontFromOSFont("Arial", 40); obj4.fontSize = 40; obj4.alignment = (TextAnchor)2; ((Graphic)obj4).color = Color.white; obj4.text = "INSTRUCTIONS\n<size=26>• Open Config (F5) to add/resize bars\n• Drag skills and items into slots to assign them\n• Middle-Click a slot to toggle it Dynamic\n\nEDITOR MODE\n• Hover a slot & press a key to bind it\n• Drag bars and HUD elements to move them\n• Right-Click a slot to Hide/Disable it\n• Scroll wheel on HUD element to resize\n• Right-Click HUD element to reset position\n• Middle-Click HUD element to reset scale</size>"; Outline obj5 = val.AddComponent<Outline>(); ((Shadow)obj5).effectColor = Color.black; ((Shadow)obj5).effectDistance = new Vector2(2f, -2f); _configOverlay.SetActive(false); } private void SyncSlots(int barIndex) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(Plugin.SlotCount[barIndex].Value, 1, 20); int num2 = Mathf.Clamp(Plugin.Rows[barIndex].Value, 1, 20); int num3 = Mathf.Clamp(num * num2, 1, 400); while (_slots[barIndex].Count < num3) { _slots[barIndex].Add(CreateSlot(barIndex, _slots[barIndex].Count)); } while (_slots[barIndex].Count > num3) { Object.Destroy((Object)(object)_slots[barIndex][_slots[barIndex].Count - 1]); _slots[barIndex].RemoveAt(_slots[barIndex].Count - 1); } GameObject obj = _containers[barIndex]; GridLayoutGroup val = ((obj != null) ? obj.GetComponent<GridLayoutGroup>() : null); if ((Object)(object)val != (Object)null) { int value = Plugin.SlotGap[barIndex].Value; val.constraint = (Constraint)1; val.constraintCount = num; val.spacing = new Vector2((float)value, (float)value); } GameObject obj2 = _containers[barIndex]; RectTransform val2 = ((obj2 != null) ? obj2.GetComponent<RectTransform>() : null); if ((Object)(object)val2 != (Object)null) { LayoutRebuilder.ForceRebuildLayoutImmediate(val2); } } private GameObject CreateSlot(int barIndex, int slotIndex) { //IL_0028: 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_005d: 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) GameObject obj = UIFactory.CreateUIObject($"Slot_{barIndex}_{slotIndex}", _containers[barIndex], new Vector2(54f, 81f)); ((Graphic)obj.AddComponent<Image>()).color = new Color(0.12f, 0.12f, 0.12f, 0.85f); Outline obj2 = obj.AddComponent<Outline>(); ((Shadow)obj2).effectColor = Color.black; ((Shadow)obj2).effectDistance = new Vector2(2f, -2f); int? num = 54; int? num2 = 81; int? num3 = 54; int? num4 = 81; UIFactory.SetLayoutElement(obj, num, num2, (int?)null, (int?)null, num3, num4, (bool?)null); SlotDropHandler slotDropHandler = obj.AddComponent<SlotDropHandler>(); slotDropHandler.BarIndex = barIndex; slotDropHandler.SlotIndex = slotIndex; return obj; } private void Update() { if ((Object)(object)NetworkLevelLoader.Instance != (Object)null && !NetworkLevelLoader.Instance.IsGameplayPaused && !NetworkLevelLoader.Instance.IsGameplayLoading) { CharacterManager instance = CharacterManager.Instance; if ((Object)(object)((instance != null) ? instance.GetFirstLocalCharacter() : null) != (Object)null) { float num = 1f; if (_canvasGroup.alpha != num) { _canvasGroup.alpha = num; _canvasGroup.blocksRaycasts = true; } TryLoadSlots(); HandleConfigModeState(); HandleBarDragging(); HandleEquipmentChange(); SuppressVanillaBar(); ApplyConfig(); return; } } if (_canvasGroup.alpha != 0f) { _canvasGroup.alpha = 0f; _canvasGroup.blocksRaycasts = false; } } private void HandleEquipmentChange() { if (!_slotsLoaded) { return; } CharacterManager instance = CharacterManager.Instance; Character val = ((instance != null) ? instance.GetFirstLocalCharacter() : null); if (!((Object)(object)val == (Object)null)) { string contextKey = SlotSaveManager.GetContextKey(val); if (!(contextKey == _lastWeaponContext)) { _lastWeaponContext = contextKey; ApplyDynamicPresets(val); SaveSlots(); Plugin.Log.LogMessage((object)("Dynamic context changed to '" + contextKey + "'.")); } } } public void ApplyDynamicPresets(Character character) { if ((Object)(object)character == (Object)null) { return; } string[] resolveKeys = (from k in SlotSaveManager.GetResolveKeys(character) where k != "baseline" select k).ToArray(); SlotDropHandler[] allSlotHandlers = GetAllSlotHandlers(); foreach (SlotDropHandler slotDropHandler in allSlotHandlers) { if (!slotDropHandler.IsDynamic) { continue; } if (SlotSaveManager.TryResolvePreset(slotDropHandler.BarIndex, slotDropHandler.SlotIndex, resolveKeys, out var itemID) && itemID > 0) { if (slotDropHandler.AssignedItemID != itemID || !((Object)(object)slotDropHandler.AssignedItem != (Object)null)) { Item val = SlotSaveManager.FindItem(character, itemID); if ((Object)(object)val != (Object)null) { slotDropHandler.AssignItemSilent(val); continue; } slotDropHandler.ClearSlotSilent(); slotDropHandler.SetAssignedItemIdOnly(itemID); } } else if (slotDropHandler.BaseItemID <= 0) { if (slotDropHandler.AssignedItemID > 0) { slotDropHandler.ClearSlotSilent(); } } else if (slotDropHandler.AssignedItemID != slotDropHandler.BaseItemID || !((Object)(object)slotDropHandler.AssignedItem != (Object)null)) { Item val2 = SlotSaveManager.FindItem(character, slotDropHandler.BaseItemID); if ((Object)(object)val2 != (Object)null) { slotDropHandler.AssignItemSilent(val2); continue; } slotDropHandler.ClearSlotSilent(); slotDropHandler.SetAssignedItemIdOnly(slotDropHandler.BaseItemID); } } } private void TryLoadSlots() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) CharacterManager instance = CharacterManager.Instance; Character val = ((instance != null) ? instance.GetFirstLocalCharacter() : null); if ((Object)(object)val == (Object)null) { return; } string text = UID.op_Implicit(val.UID); if (text != _loadedCharacterUID) { SlotDropHandler[] allSlotHandlers = GetAllSlotHandlers(); foreach (SlotDropHandler obj in allSlotHandlers) { obj.ClearSlotSilent(); obj.SetBaseItemIdOnly(-1); obj.IsDynamic = false; obj.Mode = SlotMode.Active; } _loadedCharacterUID = text; _slotsLoaded = false; _totalLoadTime = 0f; _retryInterval = 0.5f; _lastWeaponContext = ""; SlotSaveManager.Reset(); } if (_slotsLoaded) { return; } _totalLoadTime += Time.unscaledDeltaTime; _retryInterval += Time.unscaledDeltaTime; if (_retryInterval < 0.5f) { return; } _retryInterval = 0f; bool flag = SlotSaveManager.Load(text, GetAllSlotHandlers(), val); if (flag || _totalLoadTime > 10f) { ApplyDynamicPresets(val); _lastWeaponContext = SlotSaveManager.GetContextKey(val); SaveSlots(); _slotsLoaded = true; if (!flag) { Plugin.Log.LogWarning((object)"Some slotted items could not be found in inventory."); } } } public void SaveSlots() { if (_loadedCharacterUID != null) { CharacterManager instance = CharacterManager.Instance; if (!((Object)(object)((instance != null) ? instance.GetFirstLocalCharacter() : null) == (Object)null)) { SlotSaveManager.Save(_loadedCharacterUID, GetAllSlotHandlers()); } } } public SlotDropHandler[] GetAllSlotHandlers() { List<SlotDropHandler> list = new List<SlotDropHandler>(); for (int i = 0; i < 4; i++) { list.AddRange(from s in _slots[i] select s.GetComponent<SlotDropHandler>() into h where (Object)(object)h != (Object)null select h); } return list.ToArray(); } private void HandleConfigModeState() { //IL_0079: 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_009e: Expected O, but got Unknown //IL_010e: 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_0133: Expected O, but got Unknown if (SlotDropHandler.IsEditMode && !_wasConfigMode) { _configOverlay.SetActive(true); Time.timeScale = 0f; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; _wasConfigMode = true; RefreshAllSlotVisuals(); for (int i = 0; i < 4; i++) { if ((Object)(object)_containers[i] != (Object)null) { ((Graphic)_containers[i].GetComponent<Image>()).color = new Color(0.18f, 0.18f, 0.18f, 0.75f); ((LayoutGroup)_containers[i].GetComponent<GridLayoutGroup>()).padding = new RectOffset(4, 4, 4, 4); } } } else if (!SlotDropHandler.IsEditMode && _wasConfigMode) { _configOverlay.SetActive(false); Time.timeScale = 1f; Cursor.lockState = (CursorLockMode)2; _wasConfigMode = false; _draggingBarIndex = -1; RefreshAllSlotVisuals(); for (int j = 0; j < 4; j++) { if ((Object)(object)_containers[j] != (Object)null) { ((Graphic)_containers[j].GetComponent<Image>()).color = Color.clear; ((LayoutGroup)_containers[j].GetComponent<GridLayoutGroup>()).padding = new RectOffset(0, 0, 0, 0); } } } if (SlotDropHandler.IsEditMode && Input.GetKeyDown((KeyCode)27)) { SlotDropHandler.IsEditMode = false; } } private void HandleBarDragging() { //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) //IL_0021: 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_00a4: 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_00ae: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if (!SlotDropHandler.IsEditMode) { _draggingBarIndex = -1; return; } if (Input.GetMouseButtonDown(0)) { Vector2 mousePosition = Vector2.op_Implicit(Input.mousePosition); _draggingBarIndex = GetBarIndexUnderMouse(mousePosition); if (_draggingBarIndex >= 0 && (Object)(object)_containers[_draggingBarIndex] != (Object)null) { RectTransform component = _containers[_draggingBarIndex].GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null && TryGetMouseNormalized(mousePosition, out var normalized)) { _dragAnchorOffset = component.anchorMin - normalized; } else { _draggingBarIndex = -1; } } } if (_draggingBarIndex < 0) { return; } if (Input.GetMouseButton(0)) { Vector2 mousePosition2 = Vector2.op_Implicit(Input.mousePosition); if (!TryGetMouseNormalized(mousePosition2, out var normalized2)) { return; } RectTransform component2 = _containers[_draggingBarIndex].GetComponent<RectTransform>(); if ((Object)(object)component2 == (Object)null) { return; } Vector2 val = normalized2 + _dragAnchorOffset; val.x = Mathf.Clamp01(val.x); val.y = Mathf.Clamp01(val.y); component2.anchorMin = val; component2.anchorMax = val; component2.anchoredPosition = Vector2.zero; } if (!Input.GetMouseButtonUp(0)) { return; } if (_draggingBarIndex >= 0 && (Object)(object)_containers[_draggingBarIndex] != (Object)null) { RectTransform component3 = _containers[_draggingBarIndex].GetComponent<RectTransform>(); if ((Object)(object)component3 != (Object)null) { int num = Mathf.RoundToInt(component3.anchorMin.x * 100f); int num2 = Mathf.RoundToInt(component3.anchorMin.y * 100f); Plugin.PositionX[_draggingBarIndex].Value = Mathf.Clamp(num, 0, 100); Plugin.PositionY[_draggingBarIndex].Value = Mathf.Clamp(num2, 0, 100); } } _draggingBarIndex = -1; } private int GetBarIndexUnderMouse(Vector2 mousePosition) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) for (int num = 3; num >= 0; num--) { if (!((Object)(object)_containers[num] == (Object)null) && _containers[num].activeInHierarchy) { RectTransform component = _containers[num].GetComponent<RectTransform>(); if (!((Object)(object)component == (Object)null)) { Camera val = (((Object)(object)_uiCanvas != (Object)null) ? _uiCanvas.worldCamera : null); if (RectTransformUtility.RectangleContainsScreenPoint(component, mousePosition, val)) { return num; } } } } return -1; } private bool TryGetMouseNormalized(Vector2 mousePosition, out Vector2 normalized) { //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_003b: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) normalized = Vector2.zero; RectTransform component = ((Component)this).GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null) { return false; } Camera val = (((Object)(object)_uiCanvas != (Object)null) ? _uiCanvas.worldCamera : null); Vector2 val2 = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(component, mousePosition, val, ref val2)) { return false; } Rect rect = component.rect; if (((Rect)(ref rect)).width <= 0f || ((Rect)(ref rect)).height <= 0f) { return false; } normalized.x = Mathf.Clamp01((val2.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width); normalized.y = Mathf.Clamp01((val2.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height); return true; } private void RefreshAllSlotVisuals() { SlotDropHandler[] allSlotHandlers = GetAllSlotHandlers(); for (int i = 0; i < allSlotHandlers.Length; i++) { allSlotHandlers[i].RefreshEditModeVisuals(); } } private void SuppressVanillaBar() { if (!((Object)(object)_vanillaBar == (Object)null)) { if (((Component)_vanillaBar).gameObject.activeSelf) { ((Component)_vanillaBar).gameObject.SetActive(false); } Transform parent = _vanillaBar.parent; if ((Object)(object)parent != (Object)null && ((Component)parent).gameObject.activeSelf) { ((Component)parent).gameObject.SetActive(false); } } } private void ApplyConfig() { //IL_0131: 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_01c1: 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_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 4; i++) { if ((Object)(object)_containers[i] == (Object)null) { continue; } bool value = Plugin.Enabled[i].Value; if (value != _lastEnabled[i]) { _containers[i].SetActive(value); _lastEnabled[i] = value; } if (!value) { continue; } int num = Mathf.Clamp(Plugin.SlotCount[i].Value, 1, 20); int num2 = Mathf.Clamp(Plugin.Rows[i].Value, 1, 20); int num3 = Mathf.Clamp(num * num2, 1, 400); if (_slots[i].Count != num3) { SyncSlots(i); } float num4 = (float)Plugin.PositionX[i].Value / 100f; float num5 = (float)Plugin.PositionY[i].Value / 100f; float num6 = (float)Plugin.Scale[i].Value / 100f; int value2 = Plugin.SlotGap[i].Value; if (value2 != _lastGap[i] || num2 != _lastRows[i] || num != _lastSlotCount[i]) { GridLayoutGroup component = _containers[i].GetComponent<GridLayoutGroup>(); if ((Object)(object)component != (Object)null) { component.spacing = new Vector2((float)value2, (float)value2); component.constraintCount = num; } _lastGap[i] = value2; _lastRows[i] = num2; _lastSlotCount[i] = num; } RectTransform component2 = _containers[i].GetComponent<RectTransform>(); if (i == _draggingBarIndex) { _lastPosX[i] = component2.anchorMin.x; _lastPosY[i] = component2.anchorMin.y; _lastScale[i] = num6; continue; } component2.anchorMin = new Vector2(num4, num5); component2.anchorMax = new Vector2(num4, num5); component2.pivot = new Vector2(0.5f, 0f); component2.anchoredPosition = Vector2.zero; ((Transform)component2).localScale = new Vector3(num6, num6, 1f); _lastPosX[i] = num4; _lastPosY[i] = num5; _lastScale[i] = num6; } } } public class BarDragHandler : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler { public int BarIndex; private RectTransform _rect; private Canvas _rootCanvas; private bool _dragging; private bool _hovered; private void Awake() { _rect = ((Component)this).GetComponent<RectTransform>(); } private void Start() { Canvas componentInParent = ((Component)this).GetComponentInParent<Canvas>(); _rootCanvas = ((componentInParent != null) ? componentInParent.rootCanvas : null); } public void OnPointerEnter(PointerEventData eventData) { _hovered = true; } public void OnPointerExit(PointerEventData eventData) { _hovered = false; } public void OnBeginDrag(PointerEventData eventData) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (SlotDropHandler.IsEditMode && (int)eventData.button == 0) { _dragging = true; } } public void OnDrag(PointerEventData eventData) { //IL_0022: 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_002b: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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) if (_dragging && !((Object)(object)_rootCanvas == (Object)null)) { Rect rect = ((Component)_rootCanvas).GetComponent<RectTransform>().rect; Vector2 size = ((Rect)(ref rect)).size; float num = eventData.delta.x / size.x; float num2 = eventData.delta.y / size.y; Vector2 val = _rect.anchorMin + new Vector2(num, num2); val.x = Mathf.Clamp01(val.x); val.y = Mathf.Clamp01(val.y); _rect.anchorMin = val; _rect.anchorMax = val; } } public void OnEndDrag(PointerEventData eventData) { //IL_0016: 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) if (_dragging) { _dragging = false; int num = Mathf.RoundToInt(_rect.anchorMin.x * 100f); int num2 = Mathf.RoundToInt(_rect.anchorMin.y * 100f); Plugin.PositionX[BarIndex].Value = Mathf.Clamp(num, 0, 100); Plugin.PositionY[BarIndex].Value = Mathf.Clamp(num2, 0, 100); Plugin.Log.LogMessage((object)$"Bar {BarIndex + 1}: dragged to X={num}, Y={num2}."); } } private void Update() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (_hovered && SlotDropHandler.IsEditMode) { Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0); } } } [HarmonyPatch(typeof(CharacterManager))] internal static class CharacterManagerQuickSlotPatch { [HarmonyPatch("ApplyQuickSlots")] [HarmonyPatch(new Type[] { typeof(Character) })] [HarmonyPostfix] private static void ClearVanillaQuickSlotsAfterApply(Character _character) { if (!((Object)(object)_character == (Object)null) && _character.IsLocalPlayer && !((Object)(object)_character.QuickSlotMngr == (Object)null)) { int quickSlotCount = _character.QuickSlotMngr.QuickSlotCount; for (int i = 0; i < quickSlotCount; i++) { _character.QuickSlotMngr.ClearQuickSlot(i); } } } } [HarmonyPatch(typeof(CharacterUI), "Start")] public static class CharacterUIPatch { private static void Postfix(CharacterUI __instance) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)__instance).transform.Find("Canvas/GameplayPanels/HUD/QuickSlot"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"Vanilla quickslot root not found — skipping."); return; } Transform val2 = val.Find("Keyboard"); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"Vanilla keyboard action bar not found — skipping keyboard suppression."); return; } SuppressVanillaKeyboardQuickSlots(val, val2); ((Component)val2).gameObject.SetActive(false); Transform val3 = ((Component)__instance).transform.Find("Canvas/GameplayPanels"); Transform val4 = ((Component)__instance).transform.Find("Canvas/GameplayPanels/Menus/DropPanel"); if ((Object)(object)val4 != (Object)null) { Canvas val5 = ((Component)val4).gameObject.GetComponent<Canvas>(); if ((Object)(object)val5 == (Object)null) { val5 = ((Component)val4).gameObject.AddComponent<Canvas>(); } ((Component)val4).gameObject.GetComponent<GraphicRaycaster>(); if ((Object)(object)((Component)val4).gameObject.GetComponent<GraphicRaycaster>() == (Object)null) { ((Component)val4).gameObject.AddComponent<GraphicRaycaster>(); } val5.overrideSorting = true; val5.sortingOrder = 0; } GameObject val6 = new GameObject("ActionBar_Root"); val6.transform.SetParent(val3, false); val6.AddComponent<ActionBarManager>().Setup(val2); Plugin.Log.LogMessage((object)"Custom ActionBar created."); } private static void SuppressVanillaKeyboardQuickSlots(Transform quickSlotRoot, Transform keyboardBar) { //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_007f: Unknown result type (might be due to invalid IL or missing references) Component component = ((Component)quickSlotRoot).GetComponent("QuickSlotControllerSwitcher"); if ((Object)(object)component == (Object)null) { return; } FieldInfo field = ((object)component).GetType().GetField("m_keyboardQuickSlots", BindingFlags.Instance | BindingFlags.NonPublic); if (!(field == null)) { object? value = field.GetValue(component); CanvasGroup val = (CanvasGroup)((value is CanvasGroup) ? value : null); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); val.alpha = 0f; val.blocksRaycasts = false; val.interactable = false; } GameObject val2 = new GameObject("DummyKeyboardQuickSlots") { layer = 5 }; val2.transform.SetParent(quickSlotRoot, false); CanvasGroup val3 = val2.AddComponent<CanvasGroup>(); val3.alpha = 0f; val3.blocksRaycasts = false; val3.interactable = false; field.SetValue(component, val3); ((Component)keyboardBar).gameObject.SetActive(false); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class CursorUnlockPatch { private static void Postfix(ref bool __result) { if (SlotDropHandler.IsEditMode) { __result = true; } } } [HarmonyPatch(typeof(ItemDisplayDropGround), "IsDropValid")] public static class DropGroundPatch { private static void Postfix(ItemDisplay ___m_draggedDisplay, ref bool __result) { if (__result) { if (SlotDropHandler.IsPointerOverSlot) { __result = false; } else if (((___m_draggedDisplay != null) ? ___m_draggedDisplay.RefItem : null) is Skill) { __result = false; } } } } [DefaultExecutionOrder(32000)] public class HudMover : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler, IScrollHandler { public string ElementId; public bool AnchorBottom; public int SortPriority; private RectTransform _rect; private Vector2 _originalAnchoredPos; private bool _originalPosCaptured; private Vector2 _dragOffset; private bool _dragging; private Vector2 _targetPosition; private bool _hasTargetPosition; private GameObject _handleObj; private Canvas _addedCanvas; private GraphicRaycaster _addedRaycaster; private CanvasGroup _canvasGroup; private bool _wasActive; private float _originalAlpha = -1f; private LayoutGroup _layoutGroup; private ContentSizeFitter _sizeFitter; private bool _hadLayoutGroup; private bool _hadSizeFitter; private MonoBehaviour _gameScript; private bool _hadGameScript; private LayoutElement _layoutElement; private int _scalePercent = 100; public Vector2 OriginalPosition => _originalAnchoredPos; public bool IsCustomized { get { if (!_hasTargetPosition) { return _scalePercent != 100; } return true; } } public int ScalePercent => _scalePercent; private void EnsureInit() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rect == (Object)null) { _rect = ((Component)this).GetComponent<RectTransform>(); } if ((Object)(object)_rect != (Object)null && !_originalPosCaptured) { _originalAnchoredPos = _rect.anchoredPosition; _originalPosCaptured = true; } } private void Awake() { EnsureInit(); } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Canvas.willRenderCanvases += new WillRenderCanvases(HandleWillRenderCanvases); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Canvas.willRenderCanvases -= new WillRenderCanvases(HandleWillRenderCanvases); } public void SetScale(int percent) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) _scalePercent = percent; EnsureInit(); if (!((Object)(object)_rect == (Object)null)) { float num = (float)percent / 100f; ((Transform)_rect).localScale = new Vector3(num, num, 1f); } } public void OnBeginDrag(PointerEventData eventData) { //IL_0009: 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_0025: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) if (SlotDropHandler.IsEditMode && (int)eventData.button == 0) { _dragging = true; _dragOffset = eventData.position - new Vector2(((Transform)_rect).position.x, ((Transform)_rect).position.y); } } private void Update() { if (SlotDropHandler.IsEditMode && (Object)(object)_canvasGroup != (Object)null && _canvasGroup.alpha < 0.05f) { _canvasGroup.alpha = 1f; } } public bool IsMouseOver() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //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) if ((Object)(object)_rect == (Object)null) { return false; } Canvas componentInParent = ((Component)_rect).GetComponentInParent<Canvas>(); Camera val = (((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null); return RectTransformUtility.RectangleContainsScreenPoint(_rect, Vector2.op_Implicit(Input.mousePosition), val); } private void LateUpdate() { EnsureInit(); if (_hasTargetPosition && !_dragging) { EnforceTargetPosition(); } } private void HandleWillRenderCanvases() { if (_hasTargetPosition && !_dragging) { EnforceTargetPosition(); } } private void EnforceTargetPosition() { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) EnsureInit(); if (!((Object)(object)_rect == (Object)null)) { EnsureLayoutIsolation(); Vector2 val = _rect.anchoredPosition - _targetPosition; if (((Vector2)(ref val)).sqrMagnitude > 0.01f) { _rect.anchoredPosition = _targetPosition; } } } private void EnsureLayoutIsolation() { if ((Object)(object)_layoutElement == (Object)null) { _layoutElement = ((Component)this).GetComponent<LayoutElement>(); } if ((Object)(object)_layoutElement == (Object)null) { _layoutElement = ((Component)this).gameObject.AddComponent<LayoutElement>(); } if (!_layoutElement.ignoreLayout) { _layoutElement.ignoreLayout = true; } } public void EnforceLayoutNow() { if (_hasTargetPosition) { EnsureLayoutIsolation(); Canvas.ForceUpdateCanvases(); EnforceTargetPosition(); } } public void OnDrag(PointerEventData eventData) { //IL_000f: 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_0023: 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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (_dragging) { ((Transform)_rect).position = Vector2.op_Implicit(new Vector2(Input.mousePosition.x, Input.mousePosition.y) - _dragOffset); } } public void OnEndDrag(PointerEventData eventData) { //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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) if (_dragging) { _dragging = false; _targetPosition = _rect.anchoredPosition; _hasTargetPosition = true; EnsureLayoutIsolation(); Vector2 position = GetPosition(); Plugin.Log.LogMessage((object)$"HUD '{ElementId}': moved to ({position.x:F1}, {position.y:F1})."); HudMoverManager.Instance?.SavePositions(); } } public void OnScroll(PointerEventData eventData) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (SlotDropHandler.IsEditMode) { int num = ((eventData.scrollDelta.y > 0f) ? 5 : (-5)); int num2 = Mathf.Clamp(_scalePercent + num, 10, 500); SetScale(num2); if (Plugin.HudElementScale.TryGetValue(ElementId, out var value)) { value.Value = num2; } HudMoverManager.Instance?.SavePositions(); } } public void EnableEditVisuals() { //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_054a: 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_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_addedCanvas == (Object)null) { _addedCanvas = ((Component)this).gameObject.GetComponent<Canvas>(); if ((Object)(object)_addedCanvas == (Object)null) { _addedCanvas = ((Component)this).gameObject.AddComponent<Canvas>(); } } _addedCanvas.overrideSorting = true; _addedCanvas.sortingOrder = 100 + SortPriority; if ((Object)(object)_addedRaycaster == (Object)null) { _addedRaycaster = ((Component)this).gameObject.GetComponent<GraphicRaycaster>(); if ((Object)(object)_addedRaycaster == (Object)null) { _addedRaycaster = ((Component)this).gameObject.AddComponent<GraphicRaycaster>(); } } _wasActive = ((Component)this).gameObject.activeSelf; _canvasGroup = ((Component)this).GetComponent<CanvasGroup>(); if ((Object)(object)_canvasGroup != (Object)null) { _originalAlpha = _canvasGroup.alpha; } if (!((Component)this).gameObject.activeSelf) { ((Component)this).gameObject.SetActive(true); } if ((Object)(object)_canvasGroup != (Object)null) { if (_canvasGroup.alpha < 0.05f) { _canvasGroup.alpha = 1f; } _canvasGroup.blocksRaycasts = true; _canvasGroup.interactable = true; } _layoutGroup = ((Component)this).GetComponent<LayoutGroup>(); _sizeFitter = ((Component)this).GetComponent<ContentSizeFitter>(); if ((Object)(object)_layoutGroup != (Object)null) { _hadLayoutGroup = ((Behaviour)_layoutGroup).enabled; ((Behaviour)_layoutGroup).enabled = false; } if ((Object)(object)_sizeFitter != (Object)null) { _hadSizeFitter = ((Behaviour)_sizeFitter).enabled; ((Behaviour)_sizeFitter).enabled = false; } MonoBehaviour[] components = ((Component)this).GetComponents<MonoBehaviour>(); foreach (MonoBehaviour val in components) { if (!((Object)(object)val == (Object)(object)this) && !(val is HudMover) && !(val is GraphicRaycaster) && ((object)val).GetType().Name == "InteractionDisplay") { _gameScript = val; _hadGameScript = ((Behaviour)val).enabled; ((Behaviour)val).enabled = false; break; } } if ((Object)(object)_handleObj == (Object)null) { _handleObj = new GameObject("HudMover_Handle"); _handleObj.transform.SetParent(((Component)this).transform, false); _handleObj.transform.SetAsLastSibling(); _handleObj.AddComponent<LayoutElement>().ignoreLayout = true; Image obj = _handleObj.AddComponent<Image>(); ((Graphic)obj).color = new Color(0.18f, 0.18f, 0.18f, 0.75f); ((Graphic)obj).raycastTarget = true; RectTransform component = _handleObj.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); RectTransform val2 = (AnchorBottom ? FindContentChild(_rect) : null); RectTransform obj2 = val2 ?? _rect; Rect rect = obj2.rect; float num = Mathf.Clamp(((Rect)(ref rect)).width + 10f, 60f, 150f); rect = obj2.rect; float num2 = Mathf.Clamp(((Rect)(ref rect)).height + 10f, 60f, 150f); component.sizeDelta = new Vector2(num, num2); if ((Object)(object)val2 != (Object)null) { ((Transform)component).position = ((Transform)val2).position; } else { component.anchoredPosition = Vector2.zero; } GameObject val3 = new GameObject("Label"); val3.transform.SetParent(_handleObj.transform, false); Text obj3 = val3.AddComponent<Text>(); obj3.text = ElementId; obj3.font = Font.CreateDynamicFontFromOSFont("Arial", 14); obj3.fontSize = 12; obj3.alignment = (TextAnchor)7; ((Graphic)obj3).color = Color.yellow; ((Graphic)obj3).raycastTarget = false; Outline obj4 = val3.AddComponent<Outline>(); ((Shadow)obj4).effectColor = Color.black; ((Shadow)obj4).effectDistance = new Vector2(1f, -1f); RectTransform component2 = val3.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 1f); component2.anchorMax = new Vector2(1f, 1f); component2.pivot = new Vector2(0.5f, 0f); component2.anchoredPosition = new Vector2(0f, 2f); component2.sizeDelta = new Vector2(0f, 16f); if ((Object)(object)val2 != (Object)null) { Image component3 = ((Component)val2).GetComponent<Image>(); RawImage component4 = ((Component)val2).GetComponent<RawImage>(); if ((Object)(object)component3 != (Object)null && (Object)(object)component3.sprite != (Object)null) { GameObject val4 = new GameObject("VisualProxy"); val4.transform.SetParent(_handleObj.transform, false); Image obj5 = val4.AddComponent<Image>(); obj5.sprite = component3.sprite; ((Graphic)obj5).color = new Color(1f, 1f, 1f, 0.7f); ((Graphic)obj5).raycastTarget = false; RectTransform component5 = val4.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0.5f, 0.5f); component5.anchorMax = new Vector2(0.5f, 0.5f); component5.pivot = new Vector2(0.5f, 0.5f); rect = val2.rect; component5.sizeDelta = ((Rect)(ref rect)).size; component5.anchoredPosition = Vector2.zero; } else if ((Object)(object)component4 != (Object)null && (Object)(object)component4.texture != (Object)null) { GameObject val5 = new GameObject("VisualProxy_Raw"); val5.transform.SetParent(_handleObj.transform, false); RawImage obj6 = val5.AddComponent<RawImage>(); obj6.texture = component4.texture; ((Graphic)obj6).color = new Color(1f, 1f, 1f, 0.7f); ((Graphic)obj6).raycastTarget = false; RectTransform component6 = val5.GetComponent<RectTransform>(); component6.anchorMin = new Vector2(0.5f, 0.5f); component6.anchorMax = new Vector2(0.5f, 0.5f); component6.pivot = new Vector2(0.5f, 0.5f); rect = val2.rect; component6.sizeDelta = ((Rect)(ref rect)).size; component6.anchoredPosition = Vector2.zero; } } } _handleObj.SetActive(true); } public void DisableEditVisuals() { if ((Object)(object)_handleObj != (Object)null) { _handleObj.SetActive(false); } if ((Object)(object)_addedRaycaster != (Object)null) { Object.Destroy((Object)(object)_addedRaycaster); _addedRaycaster = null; } if ((Object)(object)_addedCanvas != (Object)null) { Object.Destroy((Object)(object)_addedCanvas); _addedCanvas = null; } if ((Object)(object)_layoutGroup != (Object)null) { ((Behaviour)_layoutGroup).enabled = _hadLayoutGroup; } if ((Object)(object)_sizeFitter != (Object)null) { ((Behaviour)_sizeFitter).enabled = _hadSizeFitter; } if ((Object)(object)_gameScript != (Object)null) { ((Behaviour)_gameScript).enabled = _hadGameScript; _gameScript = null; } if (!_wasActive) { ((Component)this).gameObject.SetActive(false); } if ((Object)(object)_canvasGroup != (Object)null && _originalAlpha >= 0f) { _canvasGroup.alpha = _originalAlpha; } } public void SetPosition(float x, float y) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) EnsureInit(); _targetPosition = new Vector2(x, y); _hasTargetPosition = true; if (!((Object)(object)_rect == (Object)null)) { _rect.anchoredPosition = _targetPosition; EnsureLayoutIsolation(); } } public Vector2 GetPosition() { //IL_0015: 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_0029: Unknown result type (might be due to invalid IL or missing references) EnsureInit(); if ((Object)(object)_rect == (Object)null) { return _targetPosition; } if (!_hasTargetPosition) { return _rect.anchoredPosition; } return _targetPosition; } public void ResetToOriginal() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) EnsureInit(); _hasTargetPosition = false; if ((Object)(object)_rect != (Object)null) { _rect.anchoredPosition = _originalAnchoredPos; } if ((Object)(object)_layoutElement == (Object)null) { _layoutElement = ((Component)this).GetComponent<LayoutElement>(); } if ((Object)(object)_layoutElement != (Object)null) { _layoutElement.ignoreLayout = false; } } private static RectTransform FindContentChild(RectTransform parent) { RectTransform fallback = null; return FindContentChildRecursive(parent, ref fallback) ?? fallback; } private static RectTransform FindContentChildRecursive(RectTransform parent, ref RectTransform fallback) { for (int i = 0; i < ((Transform)parent).childCount; i++) { RectTransform component = ((Component)((Transform)parent).GetChild(i)).GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null || ((Object)component).name == "HudMover_Handle") { continue; } Image component2 = ((Component)component).GetComponent<Image>(); RawImage component3 = ((Component)component).GetComponent<RawImage>(); if ((Object)(object)component2 != (Object)null || (Object)(object)component3 != (Object)null) { string text = (((Object)(object)component2 != (Object)null && (Object)(object)component2.sprite != (Object)null) ? ((Object)component2.sprite).name : ""); string text2 = (((Object)(object)component3 != (Object)null && (Object)(object)component3.texture != (Object)null) ? ((Object)component3.texture).name : ""); string text3 = ((Object)component).name + text + text2; if (text3.IndexOf("Icon", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("EmptyBag", StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf("Bandage", StringComparison.OrdinalIgnoreCase) >= 0) { return component; } if ((Object)(object)fallback == (Object)null) { fallback = component; } } RectTransform val = FindContentChildRecursive(component, ref fallback); if ((Object)(object)val != (Object)null) { return val; } } return null; } } public class HudMoverManager : MonoBehaviour { [CompilerGenerated] private sealed class <EnforceHudLayoutAfterLoad>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HudMoverManager <>4__this; private int <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EnforceHudLayoutAfterLoad>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; HudMoverManager hudMoverManager = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <i>5__2 = 0; break; case 1: <>1__state = -1; <i>5__2++; break; } if (<i>5__2 < 20) { Canvas.ForceUpdateCanvases(); foreach (HudMover mover in hudMoverManager._movers) { if (!((Object)(object)mover == (Object)null)) { mover.EnforceLayoutNow(); } } <>2__current = null; <>1__state = 1; return true; } hudMoverManager._postLoadEnforceRoutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private List<HudMover> _movers = new List<HudMover>(); private bool _attached; private bool _wasEditMode; private Coroutine _postLoadEnforceRoutine; private readonly HashSet<string> _attachedElementIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public static readonly Dictionary<string, string> KnownElements = new Dictionary<string, string> { { "MainCharacterBars", "Health / Stamina" }, { "Mana", "Mana" }, { "Stability", "Stability" }, { "QuiverDisplay", "Arrows" }, { "StatusEffect - Panel", "Status Effects" }, { "InteractionDisplay", "Interact Tooltip" }, { "Compass", "Compass" }, { "TemperatureSensor", "Temperature" }, { "Tutorialization_DropBag", "Backpack" }, { "Tutorialization_UseBandage", "Bandage" } }; private static readonly HashSet<string> Blacklist = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Canvas", "CharacterUI", "GameplayPanels", "SafeFrame", "GeneralPanels", "DebugPanels", "DropPanel", "ActionBar_Root", "CharacterMainCharacterBars", "SlotContainer", "QuickSlot" }; public static HudMoverManager Instance { get; private set; } private static string SavePath => Path.Combine(Paths.ConfigPath, "ActionBar_HUD", "hud_positions.json"); private void Awake() { Instance = this; } private void Update() { if (!_attached) { CharacterManager instance = CharacterManager.Instance; Character val = ((instance != null) ? instance.GetFirstLocalCharacter() : null); if ((Object)(object)val?.CharacterUI != (Object)null) { DiscoverAndAttach(val.CharacterUI); _attached = true; } } if (SlotDropHandler.IsEditMode && !_wasEditMode) { foreach (HudMover mover in _movers) { if ((Object)(object)mover != (Object)null) { ForceVisible(((Component)mover).gameObject); } } foreach (HudMover mover2 in _movers) { mover2.EnableEditVisuals(); } _wasEditMode = true; } else if (!SlotDropHandler.IsEditMode && _wasEditMode) { foreach (HudMover mover3 in _movers) { mover3.DisableEditVisuals(); } _wasEditMode = false; } if (SlotDropHandler.IsEditMode) { if (Input.GetMouseButtonDown(1)) { HandleHudElementClick(1); } else if (Input.GetMouseButtonDown(2)) { HandleHudElementClick(2); } } } private void LateUpdate() { if (SlotDropHandler.IsEditMode) { foreach (HudMover mover in _movers) { if ((Object)(object)mover != (Object)null) { ForceVisible(((Component)mover).gameObject); } } return; } foreach (HudMover mover2 in _movers) { if ((Object)(object)mover2 == (Object)null) { continue; } if (mover2.ElementId == "Backpack" && Plugin.HideBackpack.Value) { if (((Component)mover2).gameObject.activeSelf) { ((Component)mover2).gameObject.SetActive(false); } } else if (mover2.ElementId == "Bandage" && Plugin.HideBandage.Value && ((Component)mover2).gameObject.activeSelf) { ((Component)mover2).gameObject.SetActive(false); } } } public void UpdateVisibilityOnConfigChange() { if (SlotDropHandler.IsEditMode) { return; } foreach (HudMover mover in _movers) { if ((Object)(object)mover == (Object)null) { continue; } if (mover.ElementId == "Backpack") { if (Plugin.HideBackpack.Value && ((Component)mover).gameObject.activeSelf) { ((Component)mover).gameObject.SetActive(false); } else if (!Plugin.HideBackpack.Value && !((Component)mover).gameObject.activeSelf) { ((Component)mover).gameObject.SetActive(true); } } else if (mover.ElementId == "Bandage") { if (Plugin.HideBandage.Value && ((Component)mover).gameObject.activeSelf) { ((Component)mover).gameObject.SetActive(false); } else if (!Plugin.HideBandage.Value && !((Component)mover).gameObject.activeSelf) { ((Component)mover).gameObject.SetActive(true); } } } } private void HandleHudElementClick(int button) { HudMover hudMover = null; foreach (HudMover mover in _movers) { if (!((Object)(object)mover == (Object)null) && mover.IsMouseOver() && ((Object)(object)hudMover == (Object)null || mover.SortPriority > hudMover.SortPriority)) { hudMover = mover; } } if ((Object)(object)hudMover == (Object)null) { return; } switch (button) { case 1: hudMover.ResetToOriginal(); SavePositions(); Plugin.Log.LogMessage((object)("HUD '" + hudMover.ElementId + "': position reset.")); break; case 2: { hudMover.SetScale(100); if (Plugin.HudElementScale.TryGetValue(hudMover.ElementId, out var value)) { value.Value = 100; } SavePositions(); Plugin.Log.LogMessage((object)("HUD '" + hudMover.ElementId + "': scale reset to 100%.")); break; } } } private void ForceVisible(GameObject go) { if (!go.activeSelf) { go.SetActive(true); } CanvasGroup component = go.GetComponent<CanvasGroup>(); if ((Object)(object)component != (Object)null && component.alpha < 0.05f) { component.alpha = 1f; } } private void DiscoverAndAttach(CharacterUI characterUI) { Transform transform = ((Component)characterUI).transform; Plugin.Log.LogMessage((object)"=== HUD Discovery: Scanning CharacterUI children ==="); _movers.Clear(); _attachedElementIds.Clear(); DiscoverRecursive(transform, 0, 10); LoadPositions(); if (_postLoadEnforceRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_postLoadEnforceRoutine); } _postLoadEnforceRoutine = ((MonoBehaviour)this).StartCoroutine(EnforceHudLayoutAfterLoad()); try { ApplyConfigScales(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to apply HUD scales: " + ex.Message)); } Plugin.Log.LogMessage((object)$"HUD Mover: attached to {_movers.Count} elements."); } [IteratorStateMachine(typeof(<EnforceHudLayoutAfterLoad>d__20))] private IEnumerator EnforceHudLayoutAfterLoad() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EnforceHudLayoutAfterLoad>d__20(0) { <>4__this = this }; } private void DiscoverRecursive(Transform parent, int depth, int maxDepth) { if (depth > maxDepth) { return; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if ((Object)(object)((Component)child).GetComponent<RectTransform>() == (Object)null) { continue; } string name = ((Object)child).name; string text = new string(' ', depth * 2); Plugin.Log.LogMessage((object)$" {text}[L{depth}] {name} (active={((Component)child).gameObject.activeSelf})"); bool flag = Blacklist.Contains(name); string value; bool flag2 = KnownElements.TryGetValue(name, out value); if (flag2) { flag2 = IsExpectedHudContext(name, child); } if (flag2 && _attachedElementIds.Contains(value)) { flag2 = false; } if (flag2 && !flag) { HudMover hudMover = ((Component)child).GetComponent<HudMover>(); if ((Object)(object)hudMover == (Object)null) { hudMover = ((Component)child).gameObject.AddComponent<HudMover>(); hudMover.ElementId = value; hudMover.SortPriority = depth; if (name.StartsWith("Tutorialization")) { hudMover.AnchorBottom = true; } } _movers.Add(hudMover); _attachedElementIds.Add(value); Plugin.Log.LogMessage((object)(" >>> Attached HudMover: '" + value + "' (" + ((Object)child).name + ")")); if (name == "MainCharacterBars") { DiscoverRecursive(child, depth + 1, maxDepth); } } else { DiscoverRecursive(child, depth + 1, maxDepth); } } } private static bool IsExpectedHudContext(string elementName, Transform node) { if (elementName == "Mana") { if ((Object)(object)node.parent != (Object)null) { return ((Object)node.parent).name == "MainCharacterBars"; } return false; } return true; } public void ApplyConfigScales() { foreach (HudMover mover in _movers) { if (!((Object)(object)mover == (Object)null) && Plugin.HudElementScale.TryGetValue(mover.ElementId, out var value)) { mover.SetScale(value.Value); } } } public void ApplyScale(string elementId, int scalePercent) { foreach (HudMover mover in _movers) { if (!((Object)(object)mover == (Object)null) && mover.ElementId == elementId) { mover.SetScale(scalePercent); SavePositions(); break; } } } public void SavePositions() { //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_0067: 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) try { Directory.CreateDirectory(Path.GetDirectoryName(SavePath)); Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (HudMover mover in _movers) { if (!((Object)(object)mover == (Object)null) && mover.IsCustomized) { Vector2 position = mover.GetPosition(); dictionary[mover.ElementId] = $"{mover.ElementId}={position.x:F2},{position.y:F2},{mover.ScalePercent}"; } } List<string> list = dictionary.Values.ToList(); if (list.Count != 0 || !File.Exists(SavePath)) { File.WriteAllLines(SavePath, list); Plugin.Log.LogMessage((object)("HUD positions saved to " + SavePath + ".")); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to save HUD positions: " + ex.Message)); } } public void LoadPositions() { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_00b2: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(SavePath)) { return; } try { string[] array = File.ReadAllLines(SavePath); Dictionary<string, Vector2> dictionary = new Dictionary<string, Vector2>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string[] array3 = array2[i].Split(new char[1] { '=' }); if (array3.Length != 2) { continue; } string[] array4 = array3[1].Split(new char[1] { ',' }); if (array4.Length >= 2 && float.TryParse(array4[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array4[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { string key = array3[0].Trim(); dictionary[key] = new Vector2(result, result2); if (array4.Length >= 3 && int.TryParse(array4[2].Trim(), out var result3)) { dictionary2[key] = result3; } } } foreach (HudMover mover in _movers) { if ((Object)(object)mover == (Object)null) { continue; } try { if (dictionary.TryGetValue(mover.ElementId, out var value)) { mover.SetPosition(value.x, value.y); Plugin.Log.LogMessage((object)$"HUD '{mover.ElementId}': restored to ({value.x:F1}, {value.y:F1})."); } if (dictionary2.TryGetValue(mover.ElementId, out var value2)) { mover.SetScale(value2); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to restore HUD '" + mover.ElementId + "': " + ex.Message)); } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Failed to load HUD positions: " + ex2.Message)); } } public void ResetAllPositions() { foreach (HudMover mover in _movers) { if (!((Object)(object)mover == (Object)null)) { mover.ResetToOriginal(); mover.SetScale(100); if (Plugin.HudElementScale.TryGetValue(mover.ElementId, out var value)) { value.Value = 100; } } } if (File.Exists(SavePath)) { File.Delete(SavePath); } Plugin.Log.LogMessage((object)"HUD positions and scales reset to defaults."); } public void OnSceneUnloaded() { _movers.Clear(); _attached = false; } } [Flags] public enum Modifiers { None = 0, Ctrl = 1, Shift = 2, Alt = 4 } [BepInPlugin("fierrof.actionbar", "ActionBar", "2.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "fierrof.actionbar"; public const string NAME = "ActionBar"; public const string VERSION = "2.2.0"; public static ManualLogSource Log; public const int MAX_BARS = 4; public const int MAX_ROWS = 20; public const int MAX_SLOTS_PER_ROW = 20; public const int MAX_SLOTS_PER_BAR = 400; public const int MAX_BINDABLE_SLOTS = 20; public static ConfigEntry<bool>[] Enabled = new ConfigEntry<bool>[4]; public static ConfigEntry<int>[] SlotCount = new ConfigEntry<int>[4]; public static ConfigEntry<int>[] PositionX = new ConfigEntry<int>[4]; public static ConfigEntry<int>[] PositionY = new ConfigEntry<int>[4]; public static ConfigEntry<int>[] Scale = new ConfigEntry<int>[4]; public static ConfigEntry<int>[] SlotGap = new ConfigEntry<int>[4]; public static ConfigEntry<int>[] Rows = new ConfigEntry<int>[4]; public static ConfigEntry<bool> SetHotkeyMode; public static ConfigEntry<bool> HideBackpack; public static ConfigEntry<bool> HideBandage; public static ConfigEntry<int> LabelFontSize; public static ConfigEntry<int> CooldownFontSize; public static Dictionary<string, ConfigEntry<int>> HudElementScale = new Dictionary<string, ConfigEntry<int>>(); public static ConfigEntry<KeyCode>[][] SlotKeys = new ConfigEntry<KeyCode>[4][]; private static KeyCode[][] RuntimeSlotKeys = new KeyCode[4][]; private static Modifiers[][] RuntimeSlotModifiers = new Modifiers[4][]; private static readonly KeyCode[] DefaultKeys; private static string ExtraKeybindsPath => Path.Combine(Paths.ConfigPath, "ActionBar_ExtraKeybinds.txt"); private static string ModifiersPath => Path.Combine(Paths.ConfigPath, "ActionBar_Modifiers.txt"); private void Awake() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Expected O, but got Unknown //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Expected O, but got Unknown //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Expected O, but got Unknown //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Expected O, but got Unknown //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Expected O, but got Unknown //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Expected O, but got Unknown //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Expected O, but got Unknown //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; SetHotkeyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Global Settings", "Edit Mode", false, new ConfigDescription("Click to enter Edit Mode (drag bars, assign hotkeys).", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = DrawEditModeButton, HideDefaultButton = true, Order = -1 } })); ((BaseUnityPlugin)this).Config.Bind<bool>("Global Settings", "Reset HUD", false, new ConfigDescription("Reset all moved HUD elements to their default positions.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = DrawResetHudButton, HideDefaultButton = true, Order = -2 } })); HideBackpack = ((BaseUnityPlugin)this).Config.Bind<bool>("Global Settings", "Hide Backpack", false, new ConfigDescription("Hide the backpack icon from the HUD.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = -3 } })); HideBackpack.SettingChanged += delegate { if ((Object)(object)HudMoverManager.Instance != (Object)null) { HudMoverManager.Instance.UpdateVisibilityOnConfigChange(); } }; HideBandage = ((BaseUnityPlugin)this).Config.Bind<bool>("Global Settings", "Hide Bandage", false, new ConfigDescription("Hide the bandage icon from the HUD.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = -4 } })); HideBandage.SettingChanged += delegate { if ((Object)(object)HudMoverManager.Instance != (Object)null) { HudMoverManager.Instance.UpdateVisibilityOnConfigChange(); } }; LabelFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Global Settings", "Label Font Size", 11, new ConfigDescription("Font size for hotkey and item count labels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(6, 24), new object[1] { new ConfigurationManagerAttributes { Order = -5 } })); CooldownFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Global Settings", "Cooldown Font Size", 16, new ConfigDescription("Font size for the cooldown timer.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 30), new object[1] { new ConfigurationManagerAttributes { Order = -6 } })); LabelFontSize.SettingChanged += delegate { SlotDropHandler[] array2 = Object.FindObjectsOfType<SlotDropHandler>(); for (int l = 0; l < array2.Length; l++) { array2[l].RefreshFontSizes(); } }; CooldownFontSize.SettingChanged += delegate { SlotDropHandler[] array = Object.FindObjectsOfType<SlotDropHandler>(); for (int k = 0; k < array.Length; k++) { array[k].RefreshFontSizes(); } }; foreach (KeyValuePair<string, string> knownElement in HudMoverManager.KnownElements) { string value = knownElement.Value; ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>("HUD Element Scaling", value + " Scale", 100, new ConfigDescription("Scale of " + value + " (100 = default)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), Array.Empty<object>())); HudElementScale[value] = val; string capturedName = value; val.SettingChanged += delegate(object sender, EventArgs args) { if ((Object)(object)HudMoverManager.Instance != (Object)null) { HudMoverManager.Instance.ApplyScale(capturedName, ((ConfigEntry<int>)sender).Value); } }; } for (int i = 0; i < 4; i++) { string text = $"Bar {i + 1} Settings"; bool flag = i == 0; int barIdx = i; List<ConfigurationManagerAttributes> list = new List<ConfigurationManagerAttributes>(); Enabled[i] = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Enabled", flag, new ConfigDescription($"Enable Action Bar {i + 1}", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { HideDefaultButton = true } })); ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { HideDefaultButton = true }; list.Add(configurationManagerAttributes); SlotCount[i] = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Slots", 8, new ConfigDescription($"Number of quickslot buttons displayed for Bar {i + 1}", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), new object[1] { configurationManagerAttributes })); ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes { CustomDrawer = DrawIntSlider, HideDefaultButton = true }; list.Add(configurationManagerAttributes2); PositionX[i] = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Position X", 85, new ConfigDescription("Horizontal position (0 = left, 100 = right)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { configurationManagerAttributes2 })); int num = 5 + i * 10; ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes { CustomDrawer = DrawIntSlider, HideDefaultButton = true }; list.Add(configurationManagerAttributes3); PositionY[i] = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Position Y", num, new ConfigDescription("Vertical position (0 = bottom, 100 = top)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { configurationManagerAttributes3 })); ConfigurationManagerAttributes configurationManagerAttributes4 = new ConfigurationManagerAttributes { HideDefaultButton = true }; list.Add(configurationManagerAttributes4); Scale[i] = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Scale", 100, new ConfigDescription("Size of the action bar in percent", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 500), new object[1] { configurationManagerAttributes4 })); ConfigurationManagerAttributes configurationManagerAttributes5 = new ConfigurationManagerAttributes { HideDefaultButton = true }; list.Add(configurationManagerAttributes5); SlotGap[i] = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Slot Gap", 8, new ConfigDescription("Space between slots in pixels", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), new object[1] { configurationManagerAttributes5 })); ConfigurationManagerAttributes configurationManagerAttributes6 = new ConfigurationManagerAttributes { HideDefaultButton = true }; list.Add(configurationManagerAttributes6); Rows[i] = ((BaseUnityPlugin)this).Config.Bind<int>(text, "Rows", 1, new ConfigDescription("Number of rows (1 = horizontal bar, more = grid)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), new object[1] { configurationManagerAttributes6 })); SlotKeys[i] = new ConfigEntry<KeyCode>[20]; RuntimeSlotKeys[i] = (KeyCode[])(object)new KeyCode[400]; for (int j = 0; j < 20; j++) { KeyCode val2 = (KeyCode)((i == 0 && j < DefaultKeys.Length) ? ((int)DefaultKeys[j]) : 0); SlotKeys[i][j] = ((BaseUnityPlugin)this).Config.Bind<KeyCode>($"Bar {i + 1} Keybinds", $"Slot{j + 1}", val2, new ConfigDescription($"Key for slot {j + 1} on Bar {i + 1}", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); int bindBar = i; int bindSlot = j; SlotKeys[i][j].SettingChanged += delegate { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown RuntimeSlotKeys[bindBar][bindSlot] = (KeyCode)(int)SlotKeys[bindBar][bindSlot].Value; }; } ConfigurationManagerAttributes configurationManagerAttributes7 = new ConfigurationManagerAttributes { CustomDrawer = delegate { DrawResetBarButton(barIdx); }, HideDefaultButton = true, Order = -100 }; list.Add(configurationManagerAttributes7); ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Reset Bar", false, new ConfigDescription($"Reset all settings for Bar {i + 1} to defaults (except Enabled)", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes7 })); ConfigurationManagerAttributes[] capturedAttrs = list.ToArray(); SetBarConfigVisible(capturedAttrs, flag); Enabled[i].SettingChanged += delegate(object sender, EventArgs args) { bool value2 = ((ConfigEntry<bool>)sender).Value; SetBarConfigVisible(capturedAttrs, value2); }; } InitializeRuntimeKeybinds(); new Harmony("fierrof.actionbar").PatchAll(); Log.LogMessage((object)"ActionBar v2.2.0 loaded. [dynamic-context-save-fix]"); } private static void InitializeRuntimeKeybinds() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected I4, but got O //IL_005a->IL005a: Incompatible stack types: O vs I4 //IL_004c->IL005a: Incompatible stack types: I4 vs O //IL_004c->IL005a: Incompatible stack types: O vs I4 for (int i = 0; i < 4; i++) { if (RuntimeSlotKeys[i] == null) { RuntimeSlotKeys[i] = (KeyCode[])(object)new KeyCode[400]; } if (RuntimeSlotModifiers[i] == null) { RuntimeSlotModifiers[i] = new Modifiers[400]; } for (int j = 0; j < 400; j++) { object obj = RuntimeSlotKeys[i]; int num = j; int num2; if (j >= 20) { num2 = 0; obj = num2; num2 = (int)obj; } else { obj = SlotKeys[i][j].Value; num2 = (int)obj; } ((int[])num2)[num] = (int)obj; RuntimeSlotModifiers[i][j] = Modifiers.None; } } LoadExtraKeybinds(); LoadModifiers(); } private static void LoadExtraKeybinds() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected I4, but got Unknown if (!File.Exists(ExtraKeybindsPath)) { return; } try { string[] array = File.ReadAllLines(ExtraKeybindsPath); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (string.IsNullOrEmpty(text)) { continue; } string[] array2 = text.Split(new char[1] { '=' }); if (array2.Length == 2) { string[] array3 = array2[0].Split(new char[1] { ',' }); if (array3.Length == 2 && int.TryParse(array3[0], out var result) && int.TryParse(array3[1], out var result2) && result >= 0 && result < 4 && result2 >= 20 && result2 < 400 && Enum.TryParse<KeyCode>(array2[1], out KeyCode result3)) { RuntimeSlotKeys[result][result2] = (KeyCode)(int)result3; } } } } catch (Exception ex) { Log.LogWarning((object)("Failed to load extra keybinds: " + ex.Message)); } } private static void SaveExtraKeybinds() { //IL_0028: 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_003e: Unknown result type (might be due to invalid IL or missing references) try { Directory.CreateDirectory(Path.GetDirectoryName(ExtraKeybindsPath)); List<string> list = new List<string>(); for (int i = 0; i < 4; i++) { for (int j = 20; j < 400; j++) { KeyCode val = RuntimeSlotKeys[i][j]; if ((int)val != 0) { list.Add($"{i},{j}={val}"); } } } File.WriteAllLines(ExtraKeybindsPath, list.ToArray()); } catch (Exception ex) { Log.LogWarning((object)("Failed to save extra keybinds: " + ex.Message)); } } private static void LoadModifiers() { if (!File.Exists(ModifiersPath)) { return; } try { string[] array = File.ReadAllLines(ModifiersPath); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (string.IsNullOrEmpty(text)) { continue; } string[] array2 = text.Split(new char[1] { '=' }); if (array2.Length == 2) { string[] array3 = array2[0].Split(new char[1] { ',' }); if (array3.Length == 2 && int.TryParse(array3[0], out var result) && int.TryParse(array3[1], out var result2) && result >= 0 && result < 4 && result2 >= 0 && result2 < 400 && Enum.TryParse<Modifiers>(array2[1], out var result3)) { RuntimeSlotModifiers[result][result2] = result3; } } } } catch (Exception ex) { Log.LogWarning((object)("Failed to load modifiers: " + ex.Message)); } } private static void SaveModifiers() { try { Directory.CreateDirectory(Path.GetDirectoryName(ModifiersPath)); List<string> list = new List<string>(); for (int i = 0; i < 4; i++) { if (RuntimeSlotModifiers[i] == null) { continue; } for (int j = 0; j < 400; j++) { Modifiers modifiers = RuntimeSlotModifiers[i][j]; if (modifiers != 0) { list.Add($"{i},{j}={modifiers}"); } } } if (list.Count > 0) { File.WriteAllLines(ModifiersPath, list.ToArray()); } else if (File.Exists(ModifiersPath)) { File.Delete(ModifiersPath); } } catch (Exception ex) { Log.LogWarning((object)("Failed to save modifiers: " + ex.Message)); } } private static void DrawIntSlider(ConfigEntryBase entry) { int num = (int)entry.BoxedValue; AcceptableValueRange<int> val = (AcceptableValueRange<int>)(object)entry.Description.AcceptableValues; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); int num2 = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)num, (float)val.MinValue, (float)val.MaxValue, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })); if (int.TryParse(GUILayout.TextField(num2.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }), out var result)) { num2 = Mathf.Clamp(result, val.MinValue, val.MaxValue); } if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) })) { num2 = (int)entry.DefaultValue; } GUILayout.EndHorizontal(); if (num2 != num) { entry.BoxedValue = num2; } } private static void SetBarConfigVisible(ConfigurationManagerAttributes[] attrs, bool visible) { for (int i = 0; i < attrs.Length; i++) { attrs[i].Browsable = visible; } RefreshConfigManager(); } private static void RefreshConfigManager() { Type type = Type.GetType("ConfigurationManager.ConfigurationManager, ConfigurationManager"); if (type == null) { return; } Object val = Object.FindObjectOfType(type); if (!(val == (Object)null)) { PropertyInfo property = type.GetProperty("DisplayingWindow"); if (property != null && (bool)property.GetValue(val, null)) { property.SetValue(val, false, null); property.SetValue(val, true, null); } } } private static void DrawResetBarButton(int barIndex) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected I4, but got O //IL_0129->IL0129: Incompatible stack types: O vs I4 //IL_011b->IL0129: Incompatible stack types: I4 vs O //IL_011b->IL0129: Incompatible stack types: O vs I4 if (!GUILayout.Button($"Reset Bar {barIndex + 1} to Defaults", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { return; } SlotCount[barIndex].Value = (int)((ConfigEntryBase)SlotCount[barIndex]).DefaultValue; PositionX[barIndex].Value = (int)((ConfigEntryBase)PositionX[barIndex]).DefaultValue; PositionY[barIndex].Value = (int)((ConfigEntryBase)PositionY[barIndex]).DefaultValue; Scale[barIndex].Value = (int)((ConfigEntryBase)Scale[barIndex]).DefaultValue; SlotGap[barIndex].Value = (int)((ConfigEntryBase)SlotGap[barIndex]).DefaultValue; Rows[barIndex].Value = (int)((ConfigEntryBase)Rows[barIndex]).DefaultValue; for (int i = 0; i < 20; i++) { SlotKeys[barIndex][i].Value = (KeyCode)((ConfigEntryBase)SlotKeys[barIndex][i]).DefaultValue; } for (int j = 0; j < 400; j++) { object obj = RuntimeSlotKeys[barIndex]; int num = j; int num2; if (j >= 20) { num2 = 0; obj = num2; num2 = (int)obj; } else { obj = SlotKeys[barIndex][j].Value; num2 = (int)obj; } ((int[])num2)[num] = (int)obj; } SaveExtraKeybinds(); SlotDropHandler[] array = Object.FindObjectsOfType<SlotDropHandler>(); foreach (SlotDropHandler slotDropHandler in array) { if (slotDropHandler.BarIndex == barIndex) { if ((Object)(object)slotDropHandler.AssignedItem != (Object)null) { slotDropHandler.ClearSlotSilent(); } slotDropHandler.Mode = SlotMode.Active; slotDropHandler.IsDynamic = false; slotDropHandler.RefreshEditModeVisuals(); } } SlotSaveManager.ClearBarPresets(barIndex); ActionBarManager actionBarManager = Object.FindObjectOfType<ActionBarManager>(); if ((Object)(object)actionBarManager != (Object)null) { actionBarManager.SaveSlots(); } Log.LogMessage((object)$"Bar {barIndex + 1}: reset to defaults."); } private static void DrawEditModeButton(ConfigEntryBase entry) { if (GUILayout.Button(SlotDropHandler.IsEditMode ? "Exit Edit Mode" : "Enter Edit Mode", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { SlotDropHandler.IsEditMode = !SlotDropHandler.IsEditMode; if (SlotDropHandler.IsEditMode) { CloseConfigWindow(); } } } private static void DrawResetHudButton(ConfigEntryBase entry) { if (GUILayout.Button("Reset All HUD Positions", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { if ((Object)(object)HudMoverManager.Instance != (Object)null) { HudMoverManager.Instance.ResetAllPositions(); } else { Log.LogWarning((object)"Cannot reset HUD positions: HUD Manager not active (load a character first)."); } } } private static void CloseConfigWindow() { Type type = Type.GetType("ConfigurationManager.ConfigurationManager, ConfigurationManager"); if (!(type == null)) { Object val = Object.FindObjectOfType(type); if (!(val == (Object)null)) { type.GetProperty("DisplayingWindow")?.SetValue(val, false, null); } } } public static KeyCode GetBoundKey(int barIndex, int slotIndex) { if (barIndex >= 0 && barIndex < 4) { if (slotIndex >= 0 && slotIndex < 400) { return RuntimeSlotKeys[barIndex][slotIndex]; } return (KeyCode)0; } return (KeyCode)0; } public static Modifiers GetBoundModifiers(int barIndex, int slotIndex) { if (barIndex < 0 || barIndex >= 4) { return Modifiers.None; } if (slotIndex < 0 || slotIndex >= 400) { return Modifiers.None; } return RuntimeSlotModifiers[barIndex][slotIndex]; } public static void SetBoundKey(int barIndex, int slotIndex, KeyCode key) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected I4, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (barIndex >= 0 && barIndex < 4 && slotIndex >= 0 && slotIndex < 400) { RuntimeSlotKeys[barIndex][slotIndex] = (KeyCode)(int)key; if (slotIndex < 20) { SlotKeys[barIndex][slotIndex].Value = key; } else { SaveExtraKeybinds(); } } } public static void SetBoundModifiers(int barIndex, int slotIndex, Modifiers mods) { if (barIndex >= 0 && barIndex < 4 && slotIndex >= 0 && slotIndex < 400) { RuntimeSlotModifiers[barIndex][slotIndex] = mods; SaveModifiers(); } } static Plugin() { KeyCode[] array = new KeyCode[20]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); DefaultKeys = (KeyCode[])(object)array; } } [HarmonyPatch] internal static class ControlsInputQuickSlotPatch { private static readonly string[] QuickSlotBoolMethods = new string[18] { "QuickSlot1", "QuickSlot2", "QuickSlot3", "QuickSlot4", "QuickSlotInstant1", "QuickSlotInstant2", "QuickSlotInstant3", "QuickSlotInstant4", "QuickSlotInstant5", "QuickSlotInstant6", "QuickSlotInstant7", "QuickSlotInstant8", "QuickSlotItem1", "QuickSlotItem2", "QuickSlotItem3", "QuickSlotToggle1", "QuickSlotToggle2", "QuickSlotToggled" }; private static IEnumerable<MethodBase> TargetMethods() { return from m in typeof(ControlsInput).GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where m.ReturnType == typeof(bool) && UnityEngineExtensions.Contains<string>(QuickSlotBoolMethods, m.Name) select m; } [HarmonyPrefix] private static bool SuppressAllQuickSlotChecks(ref bool __result) { __result = false; return false; } } [HarmonyPatch(typeof(ControlsInput), "SetQuickSlotActive")] internal static class ControlsInputActivationPatch { [HarmonyPrefix] private static void ForceVanillaKeyboardQuickSlotsInactive(int _playerID, ref bool _active) { if (!ControlsInput.IsLastActionGamepad(_playerID)) { _active = false; } } } [HarmonyPatch(typeof(LocalCharacterControl), "UpdateQuickSlots")] internal static class LocalCharacterControlPatch { [HarmonyPrefix] private static bool SuppressUpdateQuickSlots() { return false; } } [HarmonyPatch] internal static class CharacterQuickSlotManagerExecutionPatch { private static IEnumerable<MethodBase> TargetMethods() { return from m in typeof(CharacterQuickSlotManager).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where m.Name == "QuickSlotInput" || m.Name == "DelayedInput" || m.Name == "SetQuickSlot" || m.Name == "SetItemQuickSlot" || m.Name == "OnAssigningQuickSlot" select m; } [HarmonyPrefix] private static bool SuppressQuickSlotExecution() { return false; } } [HarmonyPatch(typeof(CharacterQuickSlotManager), "RefreshQuickSlots")] internal static class CharacterQuickSlotManagerRefreshPatch { [HarmonyPostfix] private static void ClearVanillaQuickSlots(CharacterQuickSlotManager __instance) { int quickSlotCount = __instance.QuickSlotCount; for (int i = 0; i < quickSlotCount; i++) { __instance.ClearQuickSlot(i); } } } [HarmonyPatch(typeof(SkillMenu), "OnSectionSelected", new Type[] { typeof(int) })] public static class SkillMenuPatch { private static void Postfix(ItemListDisplay ___m_skillList) { if (!((Object)(object)___m_skillList == (Object)null)) { ItemDisplay[] componentsInChildren = ((Component)___m_skillList).GetComponentsInChildren<ItemDisplay>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Movable = true; } } } } public class SlotDropHandler : MonoBehaviour, IDropHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IDragHandler, IEndDragHandler { [CompilerGenerated] private sealed class <RefreshCountDelayed>d__76 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SlotDropHandler <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RefreshCountDelayed>d__76(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; SlotDropHandler slotDropHandler = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; case 1: <>1__state = -1; slotDropHandler.UpdateCountLabel(); 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 <TrackCooldown>d__72 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Skill skill; public SlotDropHandler <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TrackCooldown>d__72(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown int num = <>1__state; SlotDropHandler slotDropHandler = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } if ((Object)(object)skill != (Object)null && skill.InCooldown()) { int num2 = Mathf.CeilToInt(skill.RealCooldown * (1f - skill.CoolDownProgress)); slotDropHandler._cooldownLabel.text = ((num2 > 0) ? num2.ToString() : ""); } else { slotDropHandler._cooldownLabel.text = ""; } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } 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 <TrackCount>d__75 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SlotDropHandler <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TrackCount>d__75(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown int num = <>1__state; SlotDropHandler slotDropHandler = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } slotDropHandler.UpdateCountLabel(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool _isHovered; private static readonly Color DynamicBorderColor = new Color(0.08f, 0.3f, 0.08f, 1f); private Image _iconImage; private Text _keyLabel; private Image _bgImage; private Outline _outline; private Image[] _dynamicBorderEdges; private CanvasGroup _slotCanvasGroup; private Text _cooldownLabel; private Coroutine _cooldownCoroutine; private Text _countLabel; private Coroutine _countCoroutine; private bool _slotItemDragging; private GameObject _dragGhost; private RectTransform _dragGhostRect; public int BarIndex { get; set; } public int SlotIndex { get; set; } public static bool IsPointerOverSlot { get; private set; } public static bool IsEditMode { get; set;