Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RuneStorageNetwork v1.4.1
RuneStorageNetwork.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace ValheimME; public class MEClick : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler { public Action<bool> OnClick; public Action OnMiddle; public GameObject Highlight; public bool Hover; public void OnPointerClick(PointerEventData e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 if ((int)e.button == 2) { if (OnMiddle != null) { OnMiddle(); } } else if (OnClick != null) { OnClick((int)e.button == 1); } } public void OnPointerEnter(PointerEventData e) { Hover = true; if ((Object)(object)Highlight != (Object)null) { Highlight.SetActive(true); } } public void OnPointerExit(PointerEventData e) { Hover = false; if ((Object)(object)Highlight != (Object)null) { Highlight.SetActive(false); } } } [HarmonyPatch(typeof(InventoryGui), "Update")] public static class InventoryGuiUpdatePatch { public static bool Prefix() { if (!((Object)(object)MEPlugin.Instance == (Object)null)) { return !MEPlugin.Instance.SearchFocused; } return true; } } [BepInPlugin("morbi.runestoragenetwork", "Rune Storage Network", "1.4.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MEPlugin : BaseUnityPlugin { private class Entry { public string Key; public string Name; public int Count; public int Quality; public int Category; public Sprite Icon; public List<KeyValuePair<Container, ItemData>> Sources = new List<KeyValuePair<Container, ItemData>>(); } private class CraftInfo { public string Name; public Sprite Icon; public int Amount; public int Times; public string Station; public string Missing; } private const int Cols = 8; private int VisibleRows = 5; private GameObject _ui; private RectTransform _uiRect; private TMP_Text _uiStatus; private TMP_Text _uiSearchText; private TMP_Text _uiHint; private RectTransform _uiViewport; private RectTransform _uiContent; private ScrollRect _uiScroll; private MEClick _uiSearchClick; private GameObject _uiSearchFocusFrame; private Button _bLager; private Button _bCraft; private Button _bSort; private Button _bNetSort; private Button _bDeposit; private Button _bClose; private GameObject _slotTemplate; private TMP_Text _textTemplate; private readonly List<GameObject> _slotPool = new List<GameObject>(); private readonly List<GameObject> _rowPool = new List<GameObject>(); private float _step = 70f; private Vector2 _slotSize = new Vector2(64f, 64f); private float _uiW; private float _uiH; private int _lastSortMode = -1; private bool _searchFocusedRaw; private GameObject _qtyPanel; private TMP_Text _qtyTitle; private TMP_Text _qtyValue; private Entry _qtyEntry; private string _qtyText = ""; private bool _qtyOpen; private static readonly MethodInfo SetupDragMethod = AccessTools.Method(typeof(InventoryGui), "SetupDragItem", (Type[])null, (Type[])null); private static readonly FieldInfo DragItemField = AccessTools.Field(typeof(InventoryGui), "m_dragItem"); private static readonly FieldInfo DragInvField = AccessTools.Field(typeof(InventoryGui), "m_dragInventory"); private static readonly FieldInfo DragAmountField = AccessTools.Field(typeof(InventoryGui), "m_dragAmount"); private static readonly FieldInfo TipTopic = AccessTools.Field(typeof(UITooltip), "m_topic"); private static readonly FieldInfo TipText = AccessTools.Field(typeof(UITooltip), "m_text"); public const string PluginGuid = "morbi.runestoragenetwork"; public const string PluginName = "Rune Storage Network"; public const string PluginVersion = "1.4.1"; public const string StorageKey = "morbi_rsn_storage"; public static MEPlugin Instance; private ConfigEntry<float> _range; private static ConfigEntry<bool> _allowNormalChests; private ConfigEntry<bool> _autoSort; private ConfigEntry<float> _autoSortInterval; private ConfigEntry<bool> _sortInsideChests; private ConfigEntry<int> _mainRows; private ConfigEntry<int> _keepBottomRight; private ConfigEntry<float> _uiScale; private ConfigEntry<int> _sortMode; private ConfigEntry<string> _favorites; private ConfigEntry<int> _uiRows; private ConfigEntry<Vector2> _uiOffset; private static readonly string[] SortModeNames = new string[3] { "Type", "Amount", "Name" }; private static readonly FieldInfo CurrentContainerField = typeof(InventoryGui).GetField("m_currentContainer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo InventoryListField = typeof(Inventory).GetField("m_inventory", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo ContainerSaveMethod = typeof(Container).GetMethod("Save", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); private const string LockIdKey = "rsn_lock_id"; private const string LockTimeKey = "rsn_lock_t"; private const string TermIdKey = "rsn_term_id"; private const string TermTimeKey = "rsn_term_t"; private const string TermNameKey = "rsn_term_name"; private const double LockSeconds = 8.0; private readonly HashSet<Container> _myLocks = new HashSet<Container>(); private int _busyChests; private METerminal _terminal; private bool _open; private int _tab; private string _search = ""; private Vector2 _scrollNet; private Vector2 _scrollCraft; private float _nextRefresh; private List<Container> _network = new List<Container>(); private List<Entry> _entries = new List<Entry>(); private List<CraftInfo> _crafts = new List<CraftInfo>(); private int _freeSlots; private int _totalSlots; private string _status = ""; private float _statusUntil; private GUIStyle _small; private GUIStyle _center; private GUIStyle _rich; private GUISkin _skin; private GUIStyle _panel; private GUIStyle _slot; private GUIStyle _title; private GUIStyle _countShadow; private GUIStyle _rowBox; private GUIStyle _tip; private Texture2D _divider; private static readonly Color CText = Color32.op_Implicit(new Color32((byte)232, (byte)214, (byte)176, byte.MaxValue)); private static readonly Color CGold = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)183, (byte)92, byte.MaxValue)); private static readonly Color CHover = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)207, (byte)122, byte.MaxValue)); private float _openedAt; private Sprite _sprPanel; private Sprite _sprSlot; private Sprite _sprButton; private Color _colPanel = Color.white; private Color _colSlot = Color.white; private Color _colButton = Color.white; private bool _spritesTried; private GUIStyle _btnText; private GUIStyle _amount; private GUIStyle _qualityStyle; private GameObject _blockerRoot; private RectTransform _blockerRect; private float _nextAutoSort; private GameObject _chestButton; private static readonly HashSet<string> WoodIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Wood", "FineWood", "RoundLog", "ElderBark", "YggdrasilWood", "Blackwood" }; private static readonly HashSet<string> StoneIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Stone", "Flint", "Obsidian", "Grausten", "BlackMarble", "Crystal", "MoltenCore" }; private static readonly HashSet<string> MetalIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Copper", "Tin", "Bronze", "Iron", "Silver", "BlackMetal", "Flametal", "FlametalNew", "BronzeNails", "IronNails" }; private static readonly HashSet<string> FuelIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Coal", "Resin", "Guck", "Tar", "SurtlingCore", "Sap", "Eitr" }; private static readonly HashSet<string> MonsterIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "BoneFragments", "Entrails", "Bloodbag", "GreydwarfEye", "Ooze", "WitheredBone", "Chain", "Wishbone", "TrophyFrostTroll", "Needle", "FreezeGland", "DragonTear", "Crystal", "SoftTissue", "Bilebag", "Mandible", "RoyalJelly", "CharredBone", "Feathers", "Chitin", "WolfFang", "WolfClaw", "HardAntler", "DragonEgg" }; private static readonly string[] CategoryNames = new string[17] { "Weapons", "Tools", "Armor", "Ammo", "Food & Potions", "Wood", "Stone", "Ore & Scrap", "Metal", "Fuel & Resin", "Hides & Leather", "Monster Drops", "Plants & Seeds", "Meat & Fish", "Material", "Trophies", "Misc" }; public bool SearchFocused { get { if (!_searchFocusedRaw) { return _qtyOpen; } return true; } private set { _searchFocusedRaw = value; } } public bool IsTerminalOpen => _open; private void UiTick() { bool flag = _open && (Object)(object)InventoryGui.instance != (Object)null && InventoryGui.IsVisible(); if (flag && (Object)(object)_ui == (Object)null) { try { BuildUi(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Terminal UI could not be built: " + ex)); _open = false; return; } } if ((Object)(object)_ui != (Object)null && _ui.activeSelf != flag) { _ui.SetActive(flag); if (flag) { UiRebuild(); } } if (!flag) { SearchFocused = false; CloseQty(); } else { AlignToInventory(); HandleSearchInput(); UpdateHeader(); } } private unsafe void BuildUi() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Expected O, but got Unknown //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Expected O, but got Unknown //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Expected O, but got Unknown //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Expected O, but got Unknown //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Expected O, but got Unknown //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Expected O, but got Unknown //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Expected O, but got Unknown //IL_0901: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Expected O, but got Unknown //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Expected O, but got Unknown InventoryGui instance = InventoryGui.instance; RectTransform player = instance.m_player; Transform parent = ((Transform)player).parent; _slotTemplate = FindLiveSlot(instance.m_playerGrid) ?? instance.m_playerGrid.m_elementPrefab; _textTemplate = instance.m_containerName; if (instance.m_playerGrid.m_elementSpace > 1f) { _step = instance.m_playerGrid.m_elementSpace; } RectTransform component = _slotTemplate.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { Rect rect = component.rect; if (((Rect)(ref rect)).width > 1f) { rect = component.rect; _slotSize = ((Rect)(ref rect)).size; goto IL_00cc; } } if ((Object)(object)component != (Object)null && component.sizeDelta.x > 1f) { _slotSize = component.sizeDelta; } goto IL_00cc; IL_00cc: VisibleRows = Mathf.Clamp(_uiRows.Value, 3, 12); _uiW = 8f * _step + 80f; _uiH = 150f + (float)VisibleRows * _step + 80f; _ui = new GameObject("ME_Terminal", new Type[1] { typeof(RectTransform) }); _uiRect = (RectTransform)_ui.transform; ((Transform)_uiRect).SetParent(parent, false); RectTransform uiRect = _uiRect; RectTransform uiRect2 = _uiRect; Vector2 slotSize = default(Vector2); ((Vector2)(ref slotSize))..ctor(0.5f, 0.5f); uiRect2.anchorMax = slotSize; uiRect.anchorMin = slotSize; _uiRect.pivot = new Vector2(0f, 1f); _uiRect.sizeDelta = new Vector2(_uiW, _uiH); AlignToInventory(); Image val = _ui.AddComponent<Image>(); Image val2 = FindLargestImage((Transform)(object)player) ?? FindLargestImage((Transform)(object)instance.m_container); CopyImage(val2, val); if ((Object)(object)val2 != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Rune terminal background: " + ((Object)val2).name + " / " + (((Object)(object)val2.sprite != (Object)null) ? ((Object)val2.sprite).name : "-") + " / color " + ((object)((Graphic)val2).color/*cast due to .constrained prefix*/).ToString())); } ((Graphic)val).raycastTarget = true; MakeText("Rune Terminal", 28f, new Vector2(30f, -20f), new Vector2(215f, 42f), (TextAlignmentOptions)513).fontStyle = (FontStyles)1; _bLager = MakeButton("Storage", new Vector2(250f, -20f), new Vector2(110f, 42f), (UnityAction)delegate { SetTab(0); }); _bCraft = MakeButton("Crafting", new Vector2(368f, -20f), new Vector2(130f, 42f), (UnityAction)delegate { SetTab(1); }); _bClose = MakeButton("X", new Vector2(_uiW - 30f - 48f, -20f), new Vector2(48f, 42f), new UnityAction(CloseTerminal)); GameObject val3 = Object.Instantiate<GameObject>(_slotTemplate, (Transform)(object)_uiRect, false); ((Object)val3).name = "ME_Search"; StripHelpers(val3); foreach (Transform item in val3.transform) { ((Component)item).gameObject.SetActive(false); } Component[] components = val3.GetComponents<Component>(); foreach (Component val4 in components) { if ((Object)(object)val4 != (Object)null && (((object)val4).GetType().Name == "UIInputHandler" || ((object)val4).GetType().Name == "UITooltip")) { Object.Destroy((Object)(object)val4); } } RectTransform val5 = (RectTransform)val3.transform; Place(val5, new Vector2(30f, -74f), new Vector2(200f, 40f)); val3.SetActive(true); Transform val6 = val3.transform.Find("selected"); _uiSearchFocusFrame = (((Object)(object)val6 != (Object)null) ? ((Component)val6).gameObject : null); _uiSearchClick = val3.AddComponent<MEClick>(); _uiSearchClick.OnClick = delegate { SearchFocused = true; }; _uiSearchText = MakeText("", 17f, new Vector2(10f, 0f), new Vector2(185f, 40f), (TextAlignmentOptions)513, val5); _bSort = MakeButton("Sort", new Vector2(_uiW - 30f - 190f - 8f - 170f, -74f), new Vector2(170f, 40f), (UnityAction)delegate { _sortMode.Value = (Mathf.Clamp(_sortMode.Value, 0, SortModeNames.Length - 1) + 1) % SortModeNames.Length; UiRebuild(); }); _bNetSort = MakeButton("Sort network", new Vector2(_uiW - 30f - 190f, -74f), new Vector2(190f, 40f), (UnityAction)delegate { Status(SortNetworkGlobal(_network) ? ("Network sorted (" + SortModeNames[Mathf.Clamp(_sortMode.Value, 0, 2)] + ")") : "Sorting not possible"); _nextRefresh = 0f; }); _uiStatus = MakeText("", 16f, new Vector2(30f, -122f), new Vector2(_uiW - 60f, 26f), (TextAlignmentOptions)513); GameObject val7 = new GameObject("Viewport", new Type[1] { typeof(RectTransform) }); _uiViewport = (RectTransform)val7.transform; ((Transform)_uiViewport).SetParent((Transform)(object)_uiRect, false); Place(_uiViewport, new Vector2(30f, -152f), new Vector2(8f * _step, (float)VisibleRows * _step)); ((Graphic)val7.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.001f); val7.AddComponent<RectMask2D>(); GameObject val8 = new GameObject("Content", new Type[1] { typeof(RectTransform) }); _uiContent = (RectTransform)val8.transform; ((Transform)_uiContent).SetParent((Transform)(object)_uiViewport, false); Place(_uiContent, Vector2.zero, new Vector2(8f * _step, (float)VisibleRows * _step)); _uiScroll = val7.AddComponent<ScrollRect>(); _uiScroll.viewport = _uiViewport; _uiScroll.content = _uiContent; _uiScroll.horizontal = false; _uiScroll.vertical = true; _uiScroll.movementType = (MovementType)2; _uiScroll.scrollSensitivity = _step * 0.6f; _uiScroll.inertia = false; if ((Object)(object)instance.m_recipeListScroll != (Object)null) { Scrollbar component2 = Object.Instantiate<GameObject>(((Component)instance.m_recipeListScroll).gameObject, (Transform)(object)_uiRect, false).GetComponent<Scrollbar>(); component2.onValueChanged = new ScrollEvent(); component2.direction = (Direction)2; Place((RectTransform)((Component)component2).transform, new Vector2(30f + 8f * _step + 8f, -152f), new Vector2(16f, (float)VisibleRows * _step)); ((Component)component2).gameObject.SetActive(true); _uiScroll.verticalScrollbar = component2; _uiScroll.verticalScrollbarVisibility = (ScrollbarVisibility)0; } float num2 = 0f - (152f + (float)VisibleRows * _step + 16f); _uiHint = MakeText("Left-click: pick up | Ctrl/Shift+click: to inventory | Right-click: 1 item\nStore: drop item on terminal, right-click or Ctrl+click in inventory", 14f, new Vector2(30f, num2), new Vector2(_uiW - 240f, 48f), (TextAlignmentOptions)513); _bDeposit = MakeButton("Store all", new Vector2(_uiW - 30f - 190f, num2), new Vector2(190f, 44f), (UnityAction)delegate { int num3 = DepositAll(); Status((num3 > 0) ? (num3 + " items stored") : "Nothing to store"); _nextRefresh = 0f; }); BuildQtyPanel(); _ui.SetActive(false); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[5] { "Rune terminal UI built (slot ", null, null, null, null }; slotSize = _slotSize; obj[1] = ((object)(*(Vector2*)(&slotSize))/*cast due to .constrained prefix*/).ToString(); obj[2] = ", spacing "; obj[3] = _step.ToString(); obj[4] = ")."; logger.LogInfo((object)string.Concat(obj)); } private void AlignToInventory() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_uiRect == (Object)null) && !((Object)(object)InventoryGui.instance == (Object)null)) { RectTransform player = InventoryGui.instance.m_player; Transform parent = ((Transform)_uiRect).parent; if (!((Object)(object)player == (Object)null) && !((Object)(object)parent == (Object)null)) { Vector3[] array = (Vector3[])(object)new Vector3[4]; player.GetWorldCorners(array); Vector3 val = parent.InverseTransformPoint(array[0]); Vector2 value = _uiOffset.Value; ((Transform)_uiRect).localPosition = new Vector3(val.x + value.x, val.y - 12f + value.y, 0f); } } } private static GameObject FindLiveSlot(InventoryGrid grid) { if ((Object)(object)grid == (Object)null) { return null; } Transform[] componentsInChildren = ((Component)grid).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val.Find("icon") != (Object)null && (Object)(object)val.Find("amount") != (Object)null && (Object)(object)((Component)val).GetComponent<Image>() != (Object)null) { return ((Component)val).gameObject; } } return null; } private static Image FindLargestImage(Transform root) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return null; } Image result = null; float num = 0f; Image[] componentsInChildren = ((Component)root).GetComponentsInChildren<Image>(true); foreach (Image val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val.sprite == (Object)null || ((Graphic)val).color.a < 0.3f) { continue; } string text = ((Object)val.sprite).name.ToLowerInvariant(); if (!text.Contains("slot") && !text.Contains("item")) { Rect rect = ((Graphic)val).rectTransform.rect; float num2 = ((Rect)(ref rect)).width * ((Rect)(ref rect)).height; if (num2 > num) { num = num2; result = val; } } } return result; } private static void CopyImage(Image src, Image dst) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)src == (Object)null) { ((Graphic)dst).color = new Color(0.16f, 0.11f, 0.07f, 0.95f); return; } dst.sprite = src.sprite; dst.type = src.type; ((Graphic)dst).color = ((Graphic)src).color; ((Graphic)dst).material = ((Graphic)src).material; dst.fillCenter = src.fillCenter; dst.pixelsPerUnitMultiplier = src.pixelsPerUnitMultiplier; dst.preserveAspect = false; } private static void Place(RectTransform rt, Vector2 topLeft, Vector2 size) { //IL_0013: 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_002a: 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_003c: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); rt.anchorMax = val; rt.anchorMin = val; rt.pivot = new Vector2(0f, 1f); rt.anchoredPosition = topLeft; rt.sizeDelta = size; } private static void StripHelpers(GameObject go) { Component[] componentsInChildren = go.GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string name = ((object)val).GetType().Name; if (name == "UIGamePad" || name == "Localize") { Object.Destroy((Object)(object)val); } } } } private TMP_Text MakeText(string text, float size, Vector2 pos, Vector2 box, TextAlignmentOptions align, RectTransform parent = null) { //IL_003d: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) TMP_Text obj = Object.Instantiate<TMP_Text>(_textTemplate, (Transform)(object)(((Object)(object)parent != (Object)null) ? parent : _uiRect), false); StripHelpers(((Component)obj).gameObject); ((Component)obj).gameObject.SetActive(true); Place(obj.rectTransform, pos, box); obj.enableAutoSizing = false; obj.fontSize = size; obj.alignment = align; obj.richText = true; obj.overflowMode = (TextOverflowModes)1; obj.text = text; return obj; } private Button MakeButton(string text, Vector2 pos, Vector2 size, UnityAction action, RectTransform parent = null) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown InventoryGui instance = InventoryGui.instance; GameObject obj = Object.Instantiate<GameObject>(((Component)(((Object)(object)instance.m_takeAllButton != (Object)null) ? instance.m_takeAllButton : instance.m_stackAllButton)).gameObject, (Transform)(object)(((Object)(object)parent != (Object)null) ? parent : _uiRect), false); StripHelpers(obj); ((Object)obj).name = "ME_Button_" + text; obj.SetActive(true); Place((RectTransform)obj.transform, pos, size); Button component = obj.GetComponent<Button>(); component.onClick = new ButtonClickedEvent(); ((UnityEvent)component.onClick).AddListener(action); ((Selectable)component).interactable = true; SetButtonText(component, text); return component; } private static void SetButtonText(Button b, string text) { TMP_Text componentInChildren = ((Component)b).GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = text; } } private static void SetButtonColor(Button b, Color col) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) TMP_Text componentInChildren = ((Component)b).GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = col; } } private void SetTab(int tab) { if (_tab != tab) { _tab = tab; _nextRefresh = 0f; if ((Object)(object)_uiScroll != (Object)null) { _uiScroll.verticalNormalizedPosition = 1f; } UiRebuild(); } } private void UpdateHeader() { //IL_01f3: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_uiStatus == (Object)null)) { _uiStatus.text = "<color=#d8c39a>" + _network.Count + " storage chests | " + _entries.Count + " item types | " + _freeSlots + " / " + _totalSlots + " slots free" + ((_busyChests > 0) ? (" | " + _busyChests + " busy") : "") + "</color>" + ((Time.time < _statusUntil) ? (" <color=#ffcf7a>" + _status + "</color>") : ""); string text = (_searchFocusedRaw ? (_search + ((Time.time % 1f < 0.5f) ? "|" : " ")) : (string.IsNullOrEmpty(_search) ? "<color=#8a7a60>Search ...</color>" : _search)); if (_uiSearchText.text != text) { _uiSearchText.text = text; } if ((Object)(object)_uiSearchFocusFrame != (Object)null && _uiSearchFocusFrame.activeSelf != _searchFocusedRaw) { _uiSearchFocusFrame.SetActive(_searchFocusedRaw); } int num = Mathf.Clamp(_sortMode.Value, 0, SortModeNames.Length - 1); if (num != _lastSortMode) { SetButtonText(_bSort, "Sort: " + SortModeNames[num]); _lastSortMode = num; } Color val = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)183, (byte)92, byte.MaxValue)); Color val2 = Color32.op_Implicit(new Color32((byte)232, (byte)214, (byte)176, byte.MaxValue)); SetButtonColor(_bLager, (_tab == 0) ? val : val2); SetButtonColor(_bCraft, (_tab == 1) ? val : val2); ((Component)_bSort).gameObject.SetActive(_tab == 0); ((Component)_bDeposit).gameObject.SetActive(_tab == 0); ((Component)_uiHint).gameObject.SetActive(_tab == 0); } } private void HandleSearchInput() { if (_qtyOpen) { HandleQtyInput(); } else { if (!_searchFocusedRaw) { return; } if (Input.GetMouseButtonDown(0) && !_uiSearchClick.Hover) { SearchFocused = false; return; } if (Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { SearchFocused = false; return; } string text = _search ?? ""; string text2 = text; string inputString = Input.inputString; for (int i = 0; i < inputString.Length; i++) { char c = inputString[i]; switch (c) { case '\b': if (text2.Length > 0) { text2 = text2.Substring(0, text2.Length - 1); } break; default: if (!char.IsControl(c) && text2.Length < 30) { text2 += c; } break; case '\n': case '\r': break; } } if (text2 != text) { _search = text2; if ((Object)(object)_uiScroll != (Object)null) { _uiScroll.verticalNormalizedPosition = 1f; } UiRebuild(); } } } private GameObject MakePlainSlot(RectTransform parent) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(_slotTemplate, (Transform)(object)parent, false); StripHelpers(val); foreach (Transform item in val.transform) { ((Component)item).gameObject.SetActive(false); } Component[] components = val.GetComponents<Component>(); foreach (Component val2 in components) { if ((Object)(object)val2 != (Object)null && (((object)val2).GetType().Name == "UIInputHandler" || ((object)val2).GetType().Name == "UITooltip")) { Object.Destroy((Object)(object)val2); } } val.SetActive(true); return val; } private void BuildQtyPanel() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Expected O, but got Unknown //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown _qtyPanel = MakePlainSlot(_uiRect); ((Object)_qtyPanel).name = "ME_Quantity"; RectTransform val = (RectTransform)_qtyPanel.transform; float num = 400f; float num2 = 210f; Place(val, new Vector2((_uiW - num) / 2f, (0f - (_uiH - num2)) / 2f), new Vector2(num, num2)); Image component = _qtyPanel.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { Color color = ((Graphic)component).color; color.a = Mathf.Max(color.a, 0.97f); ((Graphic)component).color = color; ((Graphic)component).raycastTarget = true; } _qtyTitle = MakeText("", 20f, new Vector2(20f, -14f), new Vector2(num - 40f, 30f), (TextAlignmentOptions)514, val); GameObject val2 = MakePlainSlot(val); Place((RectTransform)val2.transform, new Vector2((num - 160f) / 2f, -52f), new Vector2(160f, 46f)); Transform val3 = val2.transform.Find("selected"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(true); } _qtyValue = MakeText("", 26f, Vector2.zero, new Vector2(160f, 46f), (TextAlignmentOptions)514, (RectTransform)val2.transform); float num3 = 80f; float num4 = 38f; float num5 = 8f; float num6 = 4f * num3 + 3f * num5; float num7 = (num - num6) / 2f; MakeButton("-10", new Vector2(num7, -110f), new Vector2(num3, num4), (UnityAction)delegate { AddQty(-10); }, val); MakeButton("-1", new Vector2(num7 + (num3 + num5), -110f), new Vector2(num3, num4), (UnityAction)delegate { AddQty(-1); }, val); MakeButton("+1", new Vector2(num7 + 2f * (num3 + num5), -110f), new Vector2(num3, num4), (UnityAction)delegate { AddQty(1); }, val); MakeButton("+10", new Vector2(num7 + 3f * (num3 + num5), -110f), new Vector2(num3, num4), (UnityAction)delegate { AddQty(10); }, val); float num8 = 110f; float num9 = 3f * num8 + 2f * num5; float num10 = (num - num9) / 2f; MakeButton("Max", new Vector2(num10, -158f), new Vector2(num8, 40f), (UnityAction)delegate { if (_qtyEntry != null) { _qtyText = _qtyEntry.Count.ToString(); UpdateQtyText(); } }, val); MakeButton("Take", new Vector2(num10 + num8 + num5, -158f), new Vector2(num8, 40f), (UnityAction)delegate { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Quantity popup: Take clicked"); ConfirmQty(); }, val); MakeButton("Cancel", new Vector2(num10 + 2f * (num8 + num5), -158f), new Vector2(num8, 40f), new UnityAction(CloseQty), val); _qtyPanel.SetActive(false); } private void OpenQty(Entry e) { if (!((Object)(object)_qtyPanel == (Object)null) && e != null) { _qtyEntry = e; int num = ((e.Sources.Count <= 0 || e.Sources[0].Value == null) ? 1 : Mathf.Max(1, e.Sources[0].Value.m_shared.m_maxStackSize)); _qtyText = Mathf.Min(num, e.Count).ToString(); _qtyOpen = true; _searchFocusedRaw = false; _qtyTitle.text = "<color=#ffb75c>" + e.Name + "</color> <color=#a8946e>(" + e.Count + " in network)</color>"; UpdateQtyText(); _qtyPanel.SetActive(true); _qtyPanel.transform.SetAsLastSibling(); } } private void CloseQty() { _qtyOpen = false; _qtyEntry = null; if ((Object)(object)_qtyPanel != (Object)null && _qtyPanel.activeSelf) { _qtyPanel.SetActive(false); } } private int QtyValue() { if (!int.TryParse(_qtyText, out var result)) { return 0; } return result; } private void AddQty(int d) { int num = ((_qtyEntry != null) ? _qtyEntry.Count : 0); int num2 = Mathf.Clamp(QtyValue() + d, 0, num); _qtyText = ((num2 > 0) ? num2.ToString() : ""); UpdateQtyText(); } private void UpdateQtyText() { if (!((Object)(object)_qtyValue == (Object)null)) { string text = ((Time.time % 1f < 0.5f) ? "|" : " "); _qtyValue.text = (string.IsNullOrEmpty(_qtyText) ? "<color=#8a7a60>0</color>" : _qtyText) + text; } } private void ConfirmQty() { Entry qtyEntry = _qtyEntry; int num = QtyValue(); if (qtyEntry == null) { CloseQty(); return; } if (num <= 0) { QtyMessage("Choose an amount first"); return; } CloseQty(); string key = qtyEntry.Key; string name = qtyEntry.Name; try { Refresh(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Quantity popup: refresh failed: " + ex.Message)); } Entry entry = _entries.Find((Entry x) => x.Key == key); if (entry == null) { QtyMessage("No " + name + " left in the network"); _nextRefresh = 0f; return; } num = Mathf.Min(num, entry.Count); _status = ""; int num2 = WithdrawAmount(entry, num); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Quantity popup: wanted " + num + ", took " + num2 + " from " + entry.Sources.Count + " stacks")); if (num2 > 0) { QtyMessage("Took " + num2 + "x " + name); } else if (_status != "Inventory full") { QtyMessage("Nothing taken - chest is busy"); } else { QtyMessage("Inventory full"); } _nextRefresh = 0f; } private void QtyMessage(string s) { Status(s); Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { ((Character)localPlayer).Message((MessageType)2, s, 0, (Sprite)null, false); } } private void HandleQtyInput() { if (Input.GetKeyDown((KeyCode)27)) { CloseQty(); return; } if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { ConfirmQty(); return; } string inputString = Input.inputString; for (int i = 0; i < inputString.Length; i++) { char c = inputString[i]; if (c == '\b') { if (_qtyText.Length > 0) { _qtyText = _qtyText.Substring(0, _qtyText.Length - 1); } } else if (char.IsDigit(c) && _qtyText.Length < 6) { _qtyText += c; } } if (_qtyEntry != null && QtyValue() > _qtyEntry.Count) { _qtyText = _qtyEntry.Count.ToString(); } if (_qtyText.StartsWith("0")) { _qtyText = _qtyText.TrimStart(new char[1] { '0' }); } UpdateQtyText(); } private void UiRebuild() { if (!((Object)(object)_ui == (Object)null) && _ui.activeSelf) { if (_tab == 0) { BuildStorageView(); } else { BuildCraftView(); } } } private GameObject GetSlot(int i) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown while (_slotPool.Count <= i) { GameObject val = Object.Instantiate<GameObject>(_slotTemplate, (Transform)(object)_uiContent, false); ((Object)val).name = "ME_Slot"; StripHelpers(val); foreach (Transform item in val.transform) { Transform val2 = item; string text = ((Object)val2).name.ToLowerInvariant(); if (text != "icon" && text != "amount" && text != "quality" && text != "selected" && text != "equiped") { ((Component)val2).gameObject.SetActive(false); } } Component[] components = val.GetComponents<Component>(); foreach (Component val3 in components) { if ((Object)(object)val3 != (Object)null && ((object)val3).GetType().Name == "UIInputHandler") { Object.Destroy((Object)(object)val3); } } MEClick mEClick = val.AddComponent<MEClick>(); Transform val4 = val.transform.Find("selected"); if ((Object)(object)val4 != (Object)null) { mEClick.Highlight = ((Component)val4).gameObject; ((Component)val4).gameObject.SetActive(false); } _slotPool.Add(val); } return _slotPool[i]; } private void FillSlot(GameObject go, Entry e, int index) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0071: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) Place((RectTransform)go.transform, new Vector2((float)(index % 8) * _step + (_step - _slotSize.x) / 2f, 0f - ((float)(index / 8) * _step + (_step - _slotSize.y) / 2f)), _slotSize); go.SetActive(true); Transform val = go.transform.Find("icon"); Transform val2 = go.transform.Find("amount"); Transform val3 = go.transform.Find("quality"); MEClick component = go.GetComponent<MEClick>(); if ((Object)(object)val != (Object)null) { Image component2 = ((Component)val).GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { component2.sprite = e?.Icon; ((Behaviour)component2).enabled = e != null && (Object)(object)e.Icon != (Object)null; } ((Component)val).gameObject.SetActive(e != null); } if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(e != null); TMP_Text component3 = ((Component)val2).GetComponent<TMP_Text>(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = e != null; Color color = ((Graphic)component3).color; if (color.a < 0.9f) { color.a = 1f; ((Graphic)component3).color = color; } component3.text = ((e != null) ? FormatCount(e.Count) : ""); } } if ((Object)(object)val3 != (Object)null) { bool flag = e != null && e.Quality > 1; ((Component)val3).gameObject.SetActive(flag); TMP_Text component4 = ((Component)val3).GetComponent<TMP_Text>(); if ((Object)(object)component4 != (Object)null) { ((Behaviour)component4).enabled = flag; component4.text = (flag ? e.Quality.ToString() : ""); } } SetTooltip(go, (e != null) ? (e.Name + ((e.Quality > 1) ? (" (level " + e.Quality + ")") : "") + (IsFavorite(e) ? " [pinned]" : "")) : "", (e != null) ? ("Amount: " + e.Count + "\nLeft-click: pick up stack\nShift/Ctrl + left-click: stack to inventory\nRight-click: 1 item to inventory\nCtrl + right-click: choose amount\nMiddle-click: pin / unpin") : ""); Transform val4 = go.transform.Find("equiped"); bool flag2 = IsFavorite(e); if ((Object)(object)val4 != (Object)null && ((Component)val4).gameObject.activeSelf != flag2) { ((Component)val4).gameObject.SetActive(flag2); } Entry captured = e; component.OnClick = delegate(bool right) { OnTerminalSlotClick(captured, right); }; component.OnMiddle = delegate { if (captured != null) { ToggleFavorite(captured); UiRebuild(); } }; } private static void SetDrag(ItemData item, Inventory inv, int amount) { if (SetupDragMethod != null && (Object)(object)InventoryGui.instance != (Object)null) { SetupDragMethod.Invoke(InventoryGui.instance, new object[3] { item, inv, amount }); } } private static ItemData GetDrag(out Inventory inv, out int amount) { inv = null; amount = 0; if ((Object)(object)InventoryGui.instance == (Object)null || DragItemField == null) { return null; } object? value = DragItemField.GetValue(InventoryGui.instance); ItemData val = (ItemData)((value is ItemData) ? value : null); if (val == null) { return null; } inv = (Inventory)((DragInvField != null) ? /*isinst with value type is only supported in some contexts*/: null); object obj = ((DragAmountField != null) ? DragAmountField.GetValue(InventoryGui.instance) : null); amount = ((obj is int) ? ((int)obj) : val.m_stack); return val; } private void OnTerminalSlotClick(Entry e, bool right) { //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Inventory inv; int amount; ItemData drag = GetDrag(out inv, out amount); if (drag != null) { if (inv == ((Humanoid)localPlayer).GetInventory()) { string text = LocalName(drag); int num = Deposit(inv, drag); Status((num > 0) ? (num + "x " + text + " stored") : "No space in network"); } SetDrag(null, null, 1); _nextRefresh = 0f; } else { if (e == null) { return; } if (right && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))) { OpenQty(e); return; } if (right) { Withdraw(e, single: true); _nextRefresh = 0f; return; } if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305) || Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) { Withdraw(e, single: false); _nextRefresh = 0f; return; } KeyValuePair<Container, ItemData> keyValuePair = new KeyValuePair<Container, ItemData>(null, null); foreach (KeyValuePair<Container, ItemData> source in e.Sources) { if (!((Object)(object)source.Key == (Object)null) && source.Value != null && source.Key.GetInventory().ContainsItem(source.Value) && (keyValuePair.Value == null || source.Value.m_stack > keyValuePair.Value.m_stack)) { keyValuePair = source; } } if (keyValuePair.Value == null) { _nextRefresh = 0f; return; } if (!CanEdit(keyValuePair.Key)) { Status("That chest is busy right now"); _nextRefresh = 0f; return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (!FindEmptyPlayerSlot(inventory, out var slot)) { Status("No free inventory slot"); return; } Inventory inventory2 = keyValuePair.Key.GetInventory(); inventory.MoveItemToThis(inventory2, keyValuePair.Value, keyValuePair.Value.m_stack, slot.x, slot.y); Save(keyValuePair.Key); ItemData itemAt = inventory.GetItemAt(slot.x, slot.y); if (itemAt != null) { SetDrag(itemAt, inventory, itemAt.m_stack); } _nextRefresh = 0f; } } private bool FindEmptyPlayerSlot(Inventory pinv, out Vector2i slot) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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) int num = Mathf.Min(8, pinv.GetWidth()); for (int num2 = Mathf.Clamp(_mainRows.Value, 1, pinv.GetHeight()) - 1; num2 >= 1; num2--) { for (int num3 = num - 1; num3 >= 0; num3--) { if (pinv.GetItemAt(num3, num2) == null) { slot = new Vector2i(num3, num2); return true; } } } for (int i = 0; i < num; i++) { if (pinv.GetItemAt(i, 0) == null) { slot = new Vector2i(i, 0); return true; } } slot = new Vector2i(0, 0); return false; } private static void SetTooltip(GameObject go, string topic, string text) { UITooltip component = go.GetComponent<UITooltip>(); if ((Object)(object)component == (Object)null) { return; } try { if (TipTopic != null) { TipTopic.SetValue(component, topic); } if (TipText != null) { TipText.SetValue(component, text); } } catch { } ((Behaviour)component).enabled = !string.IsNullOrEmpty(topic); } private void BuildStorageView() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject item in _rowPool) { item.SetActive(false); } List<Entry> list = SortedVisible(); int num = Mathf.Max(VisibleRows, Mathf.CeilToInt((float)list.Count / 8f)); int num2 = num * 8; _uiContent.sizeDelta = new Vector2(8f * _step, (float)num * _step); for (int i = 0; i < num2; i++) { FillSlot(GetSlot(i), (i < list.Count) ? list[i] : null, i); } for (int j = num2; j < _slotPool.Count; j++) { _slotPool[j].SetActive(false); } } private GameObject GetRow(int i) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) while (_rowPool.Count <= i) { GameObject val = new GameObject("ME_Row", new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)_uiContent, false); GameObject val3 = Object.Instantiate<GameObject>(_slotTemplate, (Transform)(object)val2, false); ((Object)val3).name = "slot"; StripHelpers(val3); foreach (Transform item in val3.transform) { Transform val4 = item; if (((Object)val4).name.ToLowerInvariant() != "icon") { ((Component)val4).gameObject.SetActive(false); } } Component[] components = val3.GetComponents<Component>(); foreach (Component val5 in components) { if ((Object)(object)val5 != (Object)null && (((object)val5).GetType().Name == "UIInputHandler" || ((object)val5).GetType().Name == "UITooltip")) { Object.Destroy((Object)(object)val5); } } Place((RectTransform)val3.transform, new Vector2(0f, 0f), _slotSize); ((Object)MakeText("", 16f, new Vector2(_slotSize.x + 12f, 0f), new Vector2(8f * _step - _slotSize.x - 20f, _slotSize.y), (TextAlignmentOptions)513, val2)).name = "text"; _rowPool.Add(val); } return _rowPool[i]; } private void BuildCraftView() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown foreach (GameObject item in _slotPool) { item.SetActive(false); } List<CraftInfo> list = _crafts.FindAll((CraftInfo c) => Matches(c.Name)); float num = _slotSize.y + 8f; _uiContent.sizeDelta = new Vector2(8f * _step, Mathf.Max((float)VisibleRows * _step, (float)list.Count * num)); for (int num2 = 0; num2 < list.Count; num2++) { CraftInfo craftInfo = list[num2]; GameObject row = GetRow(num2); Place((RectTransform)row.transform, new Vector2(0f, (float)(-num2) * num), new Vector2(8f * _step, _slotSize.y)); row.SetActive(true); Transform val = row.transform.Find("slot/icon"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); Image component = ((Component)val).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { component.sprite = craftInfo.Icon; ((Behaviour)component).enabled = (Object)(object)craftInfo.Icon != (Object)null; } } ((Component)row.transform.Find("text")).GetComponent<TMP_Text>().text = "<color=#ffb75c><b>" + craftInfo.Name + "</b></color>" + ((craftInfo.Amount > 1) ? (" x" + craftInfo.Amount) : "") + " <color=#a8946e>" + craftInfo.Station + "</color>\n" + ((craftInfo.Times > 0) ? ("<color=#b7e07a>" + craftInfo.Times + "x craftable</color>") : ("<color=#e0806a>" + craftInfo.Missing + "</color>")); } for (int num3 = list.Count; num3 < _rowPool.Count; num3++) { _rowPool[num3].SetActive(false); } } private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) Instance = this; _range = ((BaseUnityPlugin)this).Config.Bind<float>("Network", "Range", 20f, new ConfigDescription("Storage chests within this radius (meters) of a terminal belong to the network. (Synced from server)", (AcceptableValueBase)null, new object[1] { AdminOnly() })); _allowNormalChests = ((BaseUnityPlugin)this).Config.Bind<bool>("Network", "AllowNormalChests", false, new ConfigDescription("If true, normal chests can be added to the network with a 'Rune: ON/OFF' button. If false, only Rune Chests belong to the network. (Synced from server)", (AcceptableValueBase)null, new object[1] { AdminOnly() })); _autoSort = ((BaseUnityPlugin)this).Config.Bind<bool>("AutoSort", "Enabled", true, new ConfigDescription("Automatically gather identical items in the same storage chest. (Synced from server)", (AcceptableValueBase)null, new object[1] { AdminOnly() })); _autoSortInterval = ((BaseUnityPlugin)this).Config.Bind<float>("AutoSort", "Interval", 60f, new ConfigDescription("How often (seconds) the network is tidied up. (Synced from server)", (AcceptableValueBase)null, new object[1] { AdminOnly() })); _sortInsideChests = ((BaseUnityPlugin)this).Config.Bind<bool>("AutoSort", "SortInsideChests", true, new ConfigDescription("Additionally sort the contents of each storage chest by type. (Synced from server)", (AcceptableValueBase)null, new object[1] { AdminOnly() })); _mainRows = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "InventoryRows", 4, "Normal inventory rows. Slots below (Equipment & Quick Slots) are never stored."); _keepBottomRight = ((BaseUnityPlugin)this).Config.Bind<int>("Store", "KeepBottomRightSlots", 4, "This many bottom-right slots are kept when using 'Store all'."); _uiScale = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "Scale", 1f, "Size of the terminal window (1 = normal)."); _uiRows = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "VisibleRows", 5, "How many slot rows the terminal shows without scrolling (3-12)."); _uiOffset = ((BaseUnityPlugin)this).Config.Bind<Vector2>("Display", "Offset", new Vector2(0f, 0f), "Moves the terminal (x right, y up) relative to its position below the inventory."); _favorites = ((BaseUnityPlugin)this).Config.Bind<string>("Display", "PinnedItems", "", "Pinned items (always shown first in the terminal). Toggle with middle-click."); _sortMode = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "SortMode", 0, "Terminal sorting: 0 = Type, 1 = Amount, 2 = Name."); PrefabManager.OnVanillaPrefabsAvailable += AddPieces; new Harmony("morbi.runestoragenetwork").PatchAll(typeof(MEPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Rune Storage Network loaded."); } private void AddPieces() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown try { PieceConfig val = new PieceConfig(); val.Name = "Rune Terminal"; val.Description = "Rune Storage Network: access all nearby rune storage chests from one place."; val.PieceTable = "Hammer"; val.Category = "Misc"; val.CraftingStation = "piece_workbench"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("FineWood", 10, 0, true), new RequirementConfig("Bronze", 2, 0, true), new RequirementConfig("GreydwarfEye", 5, 0, true) }; CustomPiece val2 = new CustomPiece("piece_me_terminal", "piece_table_runed_small", val); GameObject piecePrefab = val2.PiecePrefab; MapTable[] componentsInChildren = piecePrefab.GetComponentsInChildren<MapTable>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } if ((Object)(object)piecePrefab.GetComponent<METerminal>() == (Object)null) { piecePrefab.AddComponent<METerminal>(); } BuildTerminalModel(piecePrefab.transform); PieceManager.Instance.AddPiece(val2); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Rune terminal registered."); PieceConfig val3 = new PieceConfig(); val3.Name = "Rune Chest"; val3.Description = "Rune Storage Network: a storage chest that is automatically part of the rune network. 32 slots."; val3.PieceTable = "Hammer"; val3.Category = "Misc"; val3.CraftingStation = "piece_workbench"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("FineWood", 10, 0, true), new RequirementConfig("Iron", 2, 0, true), new RequirementConfig("Crystal", 1, 0, true) }; CustomPiece val4 = new CustomPiece("piece_rune_chest", "piece_chest", val3); GameObject piecePrefab2 = val4.PiecePrefab; Container componentInChildren = piecePrefab2.GetComponentInChildren<Container>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.m_name = "Rune Chest"; componentInChildren.m_width = 8; componentInChildren.m_height = 4; } if ((Object)(object)piecePrefab2.GetComponent<RuneChestMarker>() == (Object)null) { piecePrefab2.AddComponent<RuneChestMarker>(); } BuildRuneChestModel(piecePrefab2.transform); PieceManager.Instance.AddPiece(val4); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Rune chest registered."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Rune terminal could not be registered: " + ex)); } finally { PrefabManager.OnVanillaPrefabsAvailable -= AddPieces; } } private static MeshFilter FindMainMesh(GameObject prefab) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0097: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) MeshFilter result = null; float num = 0f; MeshFilter[] componentsInChildren = prefab.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val.sharedMesh == (Object)null || (Object)(object)((Component)val).GetComponent<MeshRenderer>() == (Object)null) { continue; } string text = ((Object)val).name.ToLowerInvariant(); if (!text.Contains("lod1") && !text.Contains("lod2") && !text.Contains("lod3")) { Bounds bounds = val.sharedMesh.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num2 = size.x * size.y * size.z; if (num2 > num) { num = num2; result = val; } } } return result; } private static GameObject AddPart(Transform parent, string prefabName, Vector3 center, Vector3 size, Vector3 euler) { //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) //IL_0056: 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_0078: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("[RuneStorage] Modellteil nicht gefunden: " + prefabName)); return null; } MeshFilter val = FindMainMesh(prefab); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = new GameObject("rune_" + prefabName); val2.transform.SetParent(parent, false); val2.layer = ((Component)parent).gameObject.layer; val2.AddComponent<MeshFilter>().sharedMesh = val.sharedMesh; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)((Component)val).GetComponent<MeshRenderer>()).sharedMaterials; Bounds bounds = val.sharedMesh.bounds; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(size.x / Mathf.Max(((Bounds)(ref bounds)).size.x, 0.001f), size.y / Mathf.Max(((Bounds)(ref bounds)).size.y, 0.001f), size.z / Mathf.Max(((Bounds)(ref bounds)).size.z, 0.001f)); Quaternion val4 = Quaternion.Euler(euler); val2.transform.localRotation = val4; val2.transform.localScale = val3; val2.transform.localPosition = center - val4 * Vector3.Scale(((Bounds)(ref bounds)).center, val3); return val2; } private static GameObject CopyVisual(Transform parent, string prefabName, Vector3 basePos, float targetHeight, Vector3 euler, bool fitLargestSide = false) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = PrefabManager.Instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { Debug.LogWarning((object)("[RuneStorage] Modellteil nicht gefunden: " + prefabName)); return null; } GameObject val = new GameObject("rune_" + prefabName); val.transform.SetParent(parent, false); GameObject val2 = new GameObject("inner"); val2.transform.SetParent(val.transform, false); Matrix4x4 worldToLocalMatrix = prefab.transform.worldToLocalMatrix; bool flag = false; Bounds val3 = default(Bounds); MeshFilter[] componentsInChildren = prefab.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val4 in componentsInChildren) { if ((Object)(object)val4 == (Object)null || (Object)(object)val4.sharedMesh == (Object)null) { continue; } MeshRenderer component = ((Component)val4).GetComponent<MeshRenderer>(); if ((Object)(object)component == (Object)null) { continue; } string text = ((Object)val4).name.ToLowerInvariant(); if (text.Contains("lod1") || text.Contains("lod2") || text.Contains("lod3") || text.Contains("collider")) { continue; } Matrix4x4 val5 = worldToLocalMatrix * ((Component)val4).transform.localToWorldMatrix; GameObject val6 = new GameObject(((Object)val4).name); val6.transform.SetParent(val2.transform, false); val6.layer = ((Component)parent).gameObject.layer; val6.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val5)).GetColumn(3)); val6.transform.localRotation = ((Matrix4x4)(ref val5)).rotation; val6.transform.localScale = ((Matrix4x4)(ref val5)).lossyScale; val6.AddComponent<MeshFilter>().sharedMesh = val4.sharedMesh; ((Renderer)val6.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)component).sharedMaterials; Bounds bounds = val4.sharedMesh.bounds; for (int j = 0; j < 8; j++) { Vector3 val7 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((j & 1) != 0) ? 1 : (-1)), (float)(((j & 2) != 0) ? 1 : (-1)), (float)(((j & 4) != 0) ? 1 : (-1)))); Vector3 val8 = ((Matrix4x4)(ref val5)).MultiplyPoint3x4(val7); if (!flag) { ((Bounds)(ref val3))..ctor(val8, Vector3.zero); flag = true; } else { ((Bounds)(ref val3)).Encapsulate(val8); } } } if (!flag) { Object.DestroyImmediate((Object)(object)val); return null; } val2.transform.localPosition = new Vector3(0f - ((Bounds)(ref val3)).center.x, 0f - ((Bounds)(ref val3)).min.y, 0f - ((Bounds)(ref val3)).center.z); float num = (fitLargestSide ? Mathf.Max(((Bounds)(ref val3)).size.x, Mathf.Max(((Bounds)(ref val3)).size.y, ((Bounds)(ref val3)).size.z)) : ((Bounds)(ref val3)).size.y); float num2 = targetHeight / Mathf.Max(num, 0.001f); val.transform.localPosition = basePos; val.transform.localRotation = Quaternion.Euler(euler); val.transform.localScale = Vector3.one * num2; return val; } private static void BuildRuneChestModel(Transform root) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_0026: 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_003f: Unknown result type (might be due to invalid IL or missing references) try { float num = 0.6f; MeshFilter val = FindMainMesh(((Component)root).gameObject); if ((Object)(object)val != (Object)null) { Bounds bounds = val.sharedMesh.bounds; num = ((Component)val).transform.TransformPoint(((Bounds)(ref bounds)).max).y - root.position.y; if (num < 0.3f || num > 1.5f) { num = 0.6f; } } GameObject val2 = new GameObject("rune_chest_crystal"); val2.transform.SetParent(root, false); val2.transform.localPosition = new Vector3(0f, num + 0.35f, 0f); CopyVisual(val2.transform, "Crystal", Vector3.zero, 0.2f, Vector3.zero, fitLargestSide: true); Light obj = val2.AddComponent<Light>(); obj.type = (LightType)2; obj.color = new Color(0.35f, 0.8f, 1f); obj.range = 2.2f; obj.intensity = 0.9f; obj.shadows = (LightShadows)0; val2.AddComponent<RuneCrystalSpin>(); } catch (Exception ex) { Debug.LogWarning((object)("[RuneStorage] Rune-Chest-Modell konnte nicht gebaut werden: " + ex)); } } private static void BuildTerminalModel(Transform root) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_0026: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) try { float num = 0.72f; MeshFilter val = FindMainMesh(((Component)root).gameObject); if ((Object)(object)val != (Object)null) { Bounds bounds = val.sharedMesh.bounds; num = ((Component)val).transform.TransformPoint(((Bounds)(ref bounds)).max).y - root.position.y; if (num < 0.3f || num > 1.5f) { num = 0.72f; } } CopyVisual(root, "piece_magetable_ext2", new Vector3(-0.32f, num, 0.28f), 0.38f, new Vector3(0f, 20f, 0f)); GameObject val2 = new GameObject("rune_crystal_pivot"); val2.transform.SetParent(root, false); val2.transform.localPosition = new Vector3(0f, num + 0.28f, 0f); if ((Object)(object)CopyVisual(val2.transform, "Crystal", Vector3.zero, 0.38f, Vector3.zero, fitLargestSide: true) == (Object)null) { CopyVisual(val2.transform, "DragonTear", Vector3.zero, 0.3f, Vector3.zero, fitLargestSide: true); } Light obj = val2.AddComponent<Light>(); obj.type = (LightType)2; obj.color = new Color(0.35f, 0.8f, 1f); obj.range = 3.5f; obj.intensity = 1.4f; obj.shadows = (LightShadows)0; val2.AddComponent<RuneCrystalSpin>(); CopyVisual(root, "DragonTear", new Vector3(0f, num, 0f), 0.12f, Vector3.zero); } catch (Exception ex) { Debug.LogWarning((object)("[RuneStorage] Terminal-Modell konnte nicht gebaut werden: " + ex)); } } public static bool IsStorage(Container c) { if ((Object)(object)c == (Object)null) { return false; } if ((Object)(object)((Component)c).GetComponentInParent<RuneChestMarker>() != (Object)null) { return true; } if (_allowNormalChests == null || !_allowNormalChests.Value) { return false; } ZNetView componentInParent = ((Component)c).GetComponentInParent<ZNetView>(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsValid()) { return false; } return componentInParent.GetZDO().GetInt("morbi_rsn_storage", 0) == 1; } private static void SetStorage(Container c, bool on) { ZNetView componentInParent = ((Component)c).GetComponentInParent<ZNetView>(); if (!((Object)(object)componentInParent == (Object)null) && componentInParent.IsValid()) { if (!componentInParent.IsOwner()) { componentInParent.ClaimOwnership(); } componentInParent.GetZDO().Set("morbi_rsn_storage", on ? 1 : 0); } } private static void Save(Container c) { if ((Object)(object)c != (Object)null && ContainerSaveMethod != null) { ContainerSaveMethod.Invoke(c, null); } } private static ConfigurationManagerAttributes AdminOnly() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown return new ConfigurationManagerAttributes { IsAdminOnly = true }; } private static double Now() { if (!((Object)(object)ZNet.instance != (Object)null)) { return Time.time; } return ZNet.instance.GetTimeSeconds(); } private static long MyId() { if (!((Object)(object)Player.m_localPlayer != (Object)null)) { return 0L; } return Player.m_localPlayer.GetPlayerID(); } private static bool LockedByOther(ZDO z, string idKey, string timeKey) { long num = z.GetLong(idKey, 0L); if (num == 0L || num == MyId()) { return false; } double num2 = (double)z.GetLong(timeKey, 0L) / 1000.0; return Now() - num2 < 8.0; } private static void SetLock(ZDO z, string idKey, string timeKey, bool on) { z.Set(idKey, on ? MyId() : 0); z.Set(timeKey, on ? ((long)(Now() * 1000.0)) : 0); } public static bool CanEdit(Container c) { if ((Object)(object)c == (Object)null) { return false; } ZNetView componentInParent = ((Component)c).GetComponentInParent<ZNetView>(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsValid() || !componentInParent.IsOwner()) { return false; } if (c.IsInUse()) { return false; } return !LockedByOther(componentInParent.GetZDO(), "rsn_lock_id", "rsn_lock_t"); } private List<Container> GetNetwork(Vector3 center) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) float num = _range.Value * _range.Value; List<Container> list = new List<Container>(); _busyChests = 0; Container[] array = Object.FindObjectsByType<Container>((FindObjectsSortMode)0); foreach (Container val in array) { if ((Object)(object)val == (Object)null || val.GetInventory() == null) { continue; } Vector3 val2 = ((Component)val).transform.position - center; if (((Vector3)(ref val2)).sqrMagnitude > num || (Object)(object)((Component)val).GetComponent<TombStone>() != (Object)null || !IsStorage(val)) { continue; } ZNetView componentInParent = ((Component)val).GetComponentInParent<ZNetView>(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsValid()) { continue; } ZDO zDO = componentInParent.GetZDO(); if (val.IsInUse() || LockedByOther(zDO, "rsn_lock_id", "rsn_lock_t")) { _busyChests++; continue; } if (!componentInParent.IsOwner()) { componentInParent.ClaimOwnership(); } if (!componentInParent.IsOwner()) { _busyChests++; continue; } if (_open) { double num2 = (double)zDO.GetLong("rsn_lock_t", 0L) / 1000.0; if (zDO.GetLong("rsn_lock_id", 0L) != MyId() || Now() - num2 > 3.2) { SetLock(zDO, "rsn_lock_id", "rsn_lock_t", on: true); } _myLocks.Add(val); } list.Add(val); } list.Sort(delegate(Container a, Container b) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = ((Component)a).transform.position - center; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; val3 = ((Component)b).transform.position - center; return sqrMagnitude.CompareTo(((Vector3)(ref val3)).sqrMagnitude); }); return list; } private void ReleaseLocks() { foreach (Container myLock in _myLocks) { if (!((Object)(object)myLock == (Object)null)) { ZNetView componentInParent = ((Component)myLock).GetComponentInParent<ZNetView>(); if (!((Object)(object)componentInParent == (Object)null) && componentInParent.IsValid() && componentInParent.IsOwner() && componentInParent.GetZDO().GetLong("rsn_lock_id", 0L) == MyId()) { SetLock(componentInParent.GetZDO(), "rsn_lock_id", "rsn_lock_t", on: false); } } } _myLocks.Clear(); } private bool TryLockTerminal(METerminal t, out string user) { user = ""; ZNetView component = ((Component)t).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return true; } ZDO zDO = component.GetZDO(); if (LockedByOther(zDO, "rsn_term_id", "rsn_term_t")) { user = zDO.GetString("rsn_term_name", "another player"); return false; } if (!component.IsOwner()) { component.ClaimOwnership(); } SetLock(zDO, "rsn_term_id", "rsn_term_t", on: true); zDO.Set("rsn_term_name", ((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerName() : ""); return true; } private void RefreshTerminalLock() { if ((Object)(object)_terminal == (Object)null) { return; } ZNetView component = ((Component)_terminal).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { ZDO zDO = component.GetZDO(); if (!component.IsOwner()) { component.ClaimOwnership(); } double num = (double)zDO.GetLong("rsn_term_t", 0L) / 1000.0; if (Now() - num > 3.2) { SetLock(zDO, "rsn_term_id", "rsn_term_t", on: true); } } } private void ReleaseTerminal(METerminal t) { if (!((Object)(object)t == (Object)null)) { ZNetView component = ((Component)t).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid() && component.IsOwner() && component.GetZDO().GetLong("rsn_term_id", 0L) == MyId()) { SetLock(component.GetZDO(), "rsn_term_id", "rsn_term_t", on: false); } } } private static Texture2D Tex(Color fill, Color border, int b) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0084: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).filterMode = (FilterMode)0; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { bool flag = j < b || i < b || j >= 16 - b || i >= 16 - b; Color val2 = (flag ? border : fill); if (!flag) { val2 = Color.Lerp(val2, val2 * 0.8f, (float)i / 16f); } val2.a = (flag ? border.a : fill.a); val.SetPixel(j, i, val2); } } val.Apply(); return val; } private static Font FindValheimFont() { Font result = null; Font[] array = Resources.FindObjectsOfTypeAll<Font>(); foreach (Font val in array) { if (!((Object)(object)val == (Object)null)) { string text = ((Object)val).name.ToLowerInvariant(); if (text.Contains("averia") && text.Contains("bold")) { return val; } if (text.Contains("averia") || text.Contains("norse")) { result = val; } } } return result; } private void BuildSkin() { //IL_005a: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_010f: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Expected O, but got Unknown //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039e: 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_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Expected O, but got Unknown //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Expected O, but got Unknown //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Expected O, but got Unknown //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Expected O, but got Unknown //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Expected O, but got Unknown //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Expected O, but got Unknown //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Expected O, but got Unknown //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Expected O, but got Unknown //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Expected O, but got Unknown //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Expected O, but got Unknown //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Expected O, but got Unknown //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Expected O, but got Unknown //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) _skin = Object.Instantiate<GUISkin>(GUI.skin); Font val = FindValheimFont(); if ((Object)(object)val != (Object)null) { _skin.font = val; } Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor((byte)42, (byte)30, (byte)20, (byte)245); Color32 val3 = default(Color32); ((Color32)(ref val3))..ctor((byte)120, (byte)84, (byte)48, byte.MaxValue); Color32 val4 = new Color32((byte)58, (byte)42, (byte)28, byte.MaxValue); Color32 val5 = default(Color32); ((Color32)(ref val5))..ctor((byte)82, (byte)58, (byte)34, byte.MaxValue); Color32 val6 = default(Color32); ((Color32)(ref val6))..ctor((byte)36, (byte)25, (byte)16, byte.MaxValue); Color32 val7 = default(Color32); ((C