Decompiled source of Lareins EquipmentSlots v1.0.0

plugins\Lareins_EquipmentSlots\Lareins_EquipmentSlots.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Lareins_Core;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lareins_EquipmentSlots")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lareins_EquipmentSlots")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("85940a70-80f8-4927-9fe8-a024d951b824")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Lareins_EquipmentSlots;

[BepInPlugin("com.lareins.equipmentslots", "Lareins_EquipmentSlots", "3.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EquipmentSlotsPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Humanoid), "EquipItem")]
	private static class Patch_Humanoid_EquipItem
	{
		private static void Postfix(Humanoid __instance, ItemData item, bool __result)
		{
			//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_0097: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			if (!__result || !ModAktif.Value || CantaMi(item))
			{
				return;
			}
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val == null || ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)val != (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			int num = EkipmanIcinSlotBul(item);
			if (num < 0)
			{
				return;
			}
			Inventory inventory = ((Humanoid)val).GetInventory();
			if (inventory == null)
			{
				return;
			}
			Vector2i val2 = SlotKoordinati(num);
			if (item.m_gridPos == val2)
			{
				if (!_playerYukleniyor)
				{
					EnvanterYenile(inventory);
				}
				return;
			}
			Vector2i gridPos = item.m_gridPos;
			ItemData val3 = SlotEsyasiGetir(inventory, num);
			item.m_gridPos = val2;
			if (val3 != null && val3 != item)
			{
				Vector2i bosKonum;
				if (gridPos.y >= 0 && gridPos.y < 12 && gridPos.x < 8 && inventory.GetItemAt(gridPos.x, gridPos.y) == null)
				{
					val3.m_gridPos = gridPos;
				}
				else if (BosNormalSlotBul(inventory, out bosKonum))
				{
					val3.m_gridPos = bosKonum;
				}
			}
			if (!_playerYukleniyor)
			{
				EnvanterYenile(inventory);
			}
		}
	}

	[HarmonyPatch(typeof(Humanoid), "UnequipItem")]
	private static class Patch_Humanoid_UnequipItem
	{
		private static void Postfix(Humanoid __instance, ItemData item, bool triggerEquipEffects)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!ModAktif.Value || item == null || _playerYukleniyor)
			{
				return;
			}
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if (val != null && (!((Object)(object)Player.m_localPlayer != (Object)null) || !((Object)(object)val != (Object)(object)Player.m_localPlayer)) && OzelSlottaMi(item))
			{
				Inventory inventory = ((Humanoid)val).GetInventory();
				if (inventory != null && BosNormalSlotBul(inventory, out var bosKonum))
				{
					item.m_gridPos = bosKonum;
					EnvanterYenile(inventory);
				}
			}
		}
	}

	[HarmonyPatch(typeof(InventoryGrid), "UpdateInventory")]
	private static class Patch_InventoryGrid_UpdateInventory
	{
		private static readonly FieldInfo _fiHeight = AccessTools.Field(typeof(Inventory), "m_height");

		private static void Prefix(InventoryGrid __instance, Inventory inventory, out int __state)
		{
			__state = -1;
			if (inventory != null && !(_fiHeight == null) && !((Object)(object)Player.m_localPlayer == (Object)null) && inventory == ((Humanoid)Player.m_localPlayer).GetInventory())
			{
				int height = inventory.GetHeight();
				if (height > 12)
				{
					__state = height;
					_fiHeight.SetValue(inventory, GorunurSatirSayisiBul(inventory));
				}
			}
		}

		private static void Postfix(Inventory inventory, int __state)
		{
			if (__state > 0 && inventory != null && _fiHeight != null)
			{
				_fiHeight.SetValue(inventory, __state);
			}
		}
	}

	[HarmonyPatch]
	private static class Patch_Inventory_BosSlotKorumasi
	{
		private static readonly FieldInfo _fiHeight = AccessTools.Field(typeof(Inventory), "m_height");

		private static IEnumerable<MethodBase> TargetMethods()
		{
			MethodInfo[] metotlar = typeof(Inventory).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			for (int i = 0; i < metotlar.Length; i++)
			{
				string ad = metotlar[i].Name;
				if (ad == "FindEmptySlot" || ad == "HaveEmptySlot")
				{
					yield return metotlar[i];
				}
			}
		}

		private static void Prefix(Inventory __instance, out int __state)
		{
			__state = -1;
			if (__instance != null && !(_fiHeight == null) && !((Object)(object)Player.m_localPlayer == (Object)null) && __instance == ((Humanoid)Player.m_localPlayer).GetInventory())
			{
				int height = __instance.GetHeight();
				if (height > 12)
				{
					__state = height;
					_fiHeight.SetValue(__instance, GorunurSatirSayisiBul(__instance));
				}
			}
		}

		private static void Postfix(Inventory __instance, int __state)
		{
			if (__state > 0 && __instance != null && _fiHeight != null)
			{
				_fiHeight.SetValue(__instance, __state);
			}
		}
	}

	[HarmonyPatch(typeof(Inventory), "SetHeight")]
	private static class Patch_Inventory_SetHeight_Korumasi
	{
		private static void Prefix(Inventory __instance, ref int height)
		{
			if (__instance == null)
			{
				return;
			}
			List<ItemData> allItems = __instance.GetAllItems();
			for (int i = 0; i < allItems.Count; i++)
			{
				ItemData val = allItems[i];
				if (val != null && val.m_gridPos.y >= height && val.m_gridPos.y <= 21)
				{
					height = val.m_gridPos.y + 1;
				}
			}
		}
	}

	[HarmonyPatch(typeof(Inventory), "AddItem", new Type[]
	{
		typeof(int),
		typeof(ItemData),
		typeof(bool)
	})]
	private static class Patch_Inventory_AddItem_Yukleme
	{
		private static void Prefix(Inventory __instance, ItemData itemData, ref bool skipValidPositionCheck)
		{
			if (__instance == null || itemData == null)
			{
				return;
			}
			int y = itemData.m_gridPos.y;
			if (y >= 4 && y <= 21)
			{
				if (y >= __instance.GetHeight())
				{
					__instance.SetHeight(y + 1);
				}
				skipValidPositionCheck = true;
			}
		}
	}

	[HarmonyPatch(typeof(Player), "Save")]
	private static class Patch_Player_Save
	{
		private static void Prefix(Player __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			Inventory inventory = ((Humanoid)__instance).GetInventory();
			if (inventory != null)
			{
				SlotEtiketleriniGuncelle(inventory);
				if (inventory.GetHeight() <= 21)
				{
					inventory.SetHeight(22);
				}
			}
		}
	}

	[HarmonyPatch(typeof(Inventory), "Load", new Type[]
	{
		typeof(ZPackage),
		typeof(bool)
	})]
	private static class Patch_Inventory_Load_Bool
	{
		private static void Postfix(Inventory __instance)
		{
			YuklemeSonrasiGeriYukle(__instance);
		}
	}

	[HarmonyPatch(typeof(Inventory), "Load", new Type[] { typeof(ZPackage) })]
	private static class Patch_Inventory_Load_Single
	{
		private static void Postfix(Inventory __instance)
		{
			YuklemeSonrasiGeriYukle(__instance);
		}
	}

	[HarmonyPatch(typeof(Player), "Load")]
	private static class Patch_Player_Load
	{
		private static void Prefix()
		{
			_playerYukleniyor = true;
		}

		private static void Postfix(Player __instance)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)__instance == (Object)null)
				{
					return;
				}
				Inventory inventory = ((Humanoid)__instance).GetInventory();
				if (inventory == null)
				{
					return;
				}
				YuklemeSonrasiGeriYukle(inventory);
				List<ItemData> allItems = inventory.GetAllItems();
				for (int i = 0; i < allItems.Count; i++)
				{
					ItemData val = allItems[i];
					if (val != null)
					{
						int num = KoordinattanSlotIndeksi(val.m_gridPos);
						if (num >= 0 && EkipmanSlotuMu(num) && !val.m_equipped)
						{
							((Humanoid)__instance).EquipItem(val, false);
						}
					}
				}
				SlotEtiketleriniGuncelle(inventory);
			}
			finally
			{
				_playerYukleniyor = false;
			}
		}
	}

	[HarmonyPatch(typeof(Player), "CreateTombStone")]
	private static class Patch_Player_CreateTombStone
	{
		private static void Prefix(Player __instance)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer)
			{
				return;
			}
			Inventory inventory = ((Humanoid)__instance).GetInventory();
			if (inventory == null)
			{
				return;
			}
			List<ItemData> allItems = inventory.GetAllItems();
			for (int i = 0; i < allItems.Count; i++)
			{
				ItemData val = allItems[i];
				int num = KoordinattanSlotIndeksi(val.m_gridPos);
				if (num >= 0)
				{
					if (val.m_customData == null)
					{
						val.m_customData = new Dictionary<string, string>();
					}
					val.m_customData["Lareins_OzelSlot"] = num.ToString();
				}
			}
		}
	}

	[HarmonyPatch(typeof(TombStone), "Interact", new Type[]
	{
		typeof(Humanoid),
		typeof(bool),
		typeof(bool)
	})]
	private static class Patch_TombStone_Interact
	{
		private static void Postfix(Humanoid character)
		{
			//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)
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || (Object)(object)character != (Object)(object)localPlayer || !ModAktif.Value)
			{
				return;
			}
			Inventory inventory = ((Humanoid)localPlayer).GetInventory();
			if (inventory == null)
			{
				return;
			}
			List<ItemData> list = new List<ItemData>(inventory.GetAllItems());
			bool flag = false;
			for (int i = 0; i < list.Count; i++)
			{
				ItemData val = list[i];
				if (val == null || val.m_customData == null || !val.m_customData.TryGetValue("Lareins_OzelSlot", out var value) || !int.TryParse(value, out var result))
				{
					continue;
				}
				val.m_customData.Remove("Lareins_OzelSlot");
				if (result >= 0 && result < 13 && SlotEsyasiGetir(inventory, result) == null && EsyaSlotaUygunMu(val, result))
				{
					val.m_gridPos = SlotKoordinati(result);
					flag = true;
					if (EkipmanSlotuMu(result))
					{
						((Humanoid)localPlayer).EquipItem(val, false);
					}
				}
			}
			if (flag)
			{
				EnvanterYenile(inventory);
			}
		}
	}

	public const string ModGUID = "com.lareins.equipmentslots";

	public const string ModName = "Lareins_EquipmentSlots";

	public const string ModVersion = "3.1.0";

	public static EquipmentSlotsPlugin Instance;

	private Harmony _harmony;

	public static ConfigEntry<bool> ModAktif;

	public static ConfigEntry<bool> MiniHudGoster;

	public static ConfigEntry<float> PanelYatayOfset;

	public static ConfigEntry<float> PanelDikeyOfset;

	public static ConfigEntry<bool> KonumSifirla;

	public static ConfigEntry<KeyCode> Iksir1Tus;

	public static ConfigEntry<KeyCode> Iksir2Tus;

	public static ConfigEntry<KeyCode> Iksir3Tus;

	public static ConfigEntry<KeyCode> Yiyecek1Tus;

	public static ConfigEntry<KeyCode> Yiyecek2Tus;

	public static ConfigEntry<KeyCode> Yiyecek3Tus;

	public const int OzelSatirY = 20;

	public const int OzelSatirY2 = 21;

	public const int ToplamOzelSlot = 13;

	private static bool _playerYukleniyor = false;

	public static readonly string[] SlotAdlari = new string[13]
	{
		"Miğfer", "Göğüs", "Bacak", "Pelerin", "Kemer", "İksir 1", "İksir 2", "İksir 3", "Yiyecek 1", "Yiyecek 2",
		"Yiyecek 3", "Broş / Takı", "Ok"
	};

	public static Vector2i SlotKoordinati(int slotIndeks)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return new Vector2i(slotIndeks % 8, 20 + slotIndeks / 8);
	}

	public static int KoordinattanSlotIndeksi(Vector2i pos)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		if (pos.y == 20 && pos.x >= 0 && pos.x < 8)
		{
			return pos.x;
		}
		if (pos.y == 21 && pos.x >= 0 && pos.x < 5)
		{
			return 8 + pos.x;
		}
		return -1;
	}

	private void Awake()
	{
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Expected O, but got Unknown
		Instance = this;
		ModAktif = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "ModAktif", true, "Ekipman, Broş, Ok, İksir ve Yiyecek yan envanter panelini etkinleştirir.");
		MiniHudGoster = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "MiniHudGoster", true, "Envanter kapalıyken sol üstte 1-8 barının yanında hızlı İksir & Yemek barını gösterir.");
		PanelYatayOfset = ((BaseUnityPlugin)this).Config.Bind<float>("Genel", "PanelYatayOfset", 12f, "Ek panelin ana envanter sağ kenarına olan yatay uzaklığı.");
		PanelDikeyOfset = ((BaseUnityPlugin)this).Config.Bind<float>("Genel", "PanelDikeyOfset", 0f, "Ek panelin dikey hizalama ince ayarı.");
		KonumSifirla = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "KonumSifirla", false, "Panel yatay ve dikey konum ayarlarını varsayılana döndürür.");
		Iksir1Tus = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Kisayollar", "Iksir1Tus", (KeyCode)122, "1. İksir slotu kullanım tuşu.");
		Iksir2Tus = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Kisayollar", "Iksir2Tus", (KeyCode)120, "2. İksir slotu kullanım tuşu.");
		Iksir3Tus = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Kisayollar", "Iksir3Tus", (KeyCode)99, "3. İksir slotu kullanım tuşu.");
		Yiyecek1Tus = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Kisayollar", "Yiyecek1Tus", (KeyCode)118, "1. Yiyecek slotu kullanım tuşu.");
		Yiyecek2Tus = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Kisayollar", "Yiyecek2Tus", (KeyCode)98, "2. Yiyecek slotu kullanım tuşu.");
		Yiyecek3Tus = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Kisayollar", "Yiyecek3Tus", (KeyCode)110, "3. Yiyecek slotu kullanım tuşu.");
		string text = "Ekipman Slotlari";
		CorePlugin.AyarEkle(text, "Ekipman Paneli Aktif", "Yan ekipman, iksir ve yiyecek panelini acar/kapatir.", ModAktif);
		CorePlugin.AyarEkle(text, "Hizli Iksir/Yemek Bari", "Sol ustteki 1-8 barinin saginda hizli iksir ve yemek kutularini gosterir.", MiniHudGoster);
		CorePlugin.AyarEkle(text, "Iksir 1 Tusu", "1. iksir kutusunu kullanma tusu.", Iksir1Tus);
		CorePlugin.AyarEkle(text, "Iksir 2 Tusu", "2. iksir kutusunu kullanma tusu.", Iksir2Tus);
		CorePlugin.AyarEkle(text, "Iksir 3 Tusu", "3. iksir kutusunu kullanma tusu.", Iksir3Tus);
		CorePlugin.AyarEkle(text, "Yiyecek 1 Tusu", "1. yiyecek kutusunu kullanma tusu.", Yiyecek1Tus);
		CorePlugin.AyarEkle(text, "Yiyecek 2 Tusu", "2. yiyecek kutusunu kullanma tusu.", Yiyecek2Tus);
		CorePlugin.AyarEkle(text, "Yiyecek 3 Tusu", "3. yiyecek kutusunu kullanma tusu.", Yiyecek3Tus);
		CorePlugin.AyarEkle(text, "Panel Yatay Konum", "Yan panelin ana envantere yatay uzakligi.", PanelYatayOfset, -50f, 150f);
		CorePlugin.AyarEkle(text, "Panel Dikey Konum", "Yan panelin dikey ince ayari.", PanelDikeyOfset, -150f, 150f);
		CorePlugin.AyarEkle(text, "Konum Ayarlarini Sifirla", "Isaretlendiginde panel konumunu baslangic ayarina dondurur.", KonumSifirla);
		_harmony = new Harmony("com.lareins.equipmentslots");
		GuvenliYamaUygula(typeof(Patch_Humanoid_EquipItem));
		GuvenliYamaUygula(typeof(Patch_Humanoid_UnequipItem));
		GuvenliYamaUygula(typeof(Patch_InventoryGrid_UpdateInventory));
		GuvenliYamaUygula(typeof(Patch_Inventory_BosSlotKorumasi));
		GuvenliYamaUygula(typeof(Patch_Inventory_AddItem_Yukleme));
		GuvenliYamaUygula(typeof(Patch_Inventory_SetHeight_Korumasi));
		GuvenliYamaUygula(typeof(Patch_Player_Save));
		GuvenliYamaUygula(typeof(Patch_Inventory_Load_Bool));
		GuvenliYamaUygula(typeof(Patch_Inventory_Load_Single));
		GuvenliYamaUygula(typeof(Patch_Player_Load));
		GuvenliYamaUygula(typeof(Patch_Player_CreateTombStone));
		GuvenliYamaUygula(typeof(Patch_TombStone_Interact));
		Type[] nestedTypes = typeof(EquipmentSlotsUI).GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
		for (int i = 0; i < nestedTypes.Length; i++)
		{
			if (nestedTypes[i].GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0)
			{
				GuvenliYamaUygula(nestedTypes[i]);
			}
		}
	}

	private void GuvenliYamaUygula(Type yamaTipi)
	{
		try
		{
			_harmony.CreateClassProcessor(yamaTipi).Patch();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Yama atlandi (" + yamaTipi.Name + "): " + ex.Message));
		}
	}

	public static void SlotEtiketleriniGuncelle(Inventory inv)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if (inv == null)
		{
			return;
		}
		List<ItemData> allItems = inv.GetAllItems();
		for (int i = 0; i < allItems.Count; i++)
		{
			ItemData val = allItems[i];
			if (val == null)
			{
				continue;
			}
			int num = KoordinattanSlotIndeksi(val.m_gridPos);
			if (num >= 0)
			{
				if (val.m_customData == null)
				{
					val.m_customData = new Dictionary<string, string>();
				}
				val.m_customData["Lareins_KayitliSlot"] = num.ToString();
			}
			else if (val.m_customData != null && val.m_customData.ContainsKey("Lareins_KayitliSlot"))
			{
				val.m_customData.Remove("Lareins_KayitliSlot");
			}
		}
	}

	public static void EnvanterYenile(Inventory inv)
	{
		if (inv != null)
		{
			SlotEtiketleriniGuncelle(inv);
			if (AccessTools.Field(typeof(Inventory), "m_onChanged")?.GetValue(inv) is Action action)
			{
				action();
			}
			if (InventoryGui.IsVisible() && (Object)(object)InventoryGui.instance != (Object)null)
			{
				EquipmentSlotsUI.SlotlariYenile(InventoryGui.instance);
			}
		}
	}

	private void OnDestroy()
	{
		Harmony harmony = _harmony;
		if (harmony != null)
		{
			harmony.UnpatchSelf();
		}
	}

	private void Update()
	{
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		if (KonumSifirla.Value)
		{
			PanelYatayOfset.Value = 12f;
			PanelDikeyOfset.Value = 0f;
			KonumSifirla.Value = false;
			if (InventoryGui.IsVisible() && (Object)(object)InventoryGui.instance != (Object)null)
			{
				EquipmentSlotsUI.ArayuzuKurVeyaGuncelle(InventoryGui.instance);
			}
		}
		if (!ModAktif.Value || CorePlugin.HerhangiPencereAcikMi())
		{
			return;
		}
		Player localPlayer = Player.m_localPlayer;
		if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && !((Character)localPlayer).InCutscene() && !((Character)localPlayer).IsTeleporting() && !InventoryGui.IsVisible() && !Minimap.IsOpen() && !StoreGui.IsVisible() && !TextInput.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible())
		{
			if (TusBasildi(Iksir1Tus.Value))
			{
				OzelSlotKullan(localPlayer, 5);
			}
			else if (TusBasildi(Iksir2Tus.Value))
			{
				OzelSlotKullan(localPlayer, 6);
			}
			else if (TusBasildi(Iksir3Tus.Value))
			{
				OzelSlotKullan(localPlayer, 7);
			}
			else if (TusBasildi(Yiyecek1Tus.Value))
			{
				OzelSlotKullan(localPlayer, 8);
			}
			else if (TusBasildi(Yiyecek2Tus.Value))
			{
				OzelSlotKullan(localPlayer, 9);
			}
			else if (TusBasildi(Yiyecek3Tus.Value))
			{
				OzelSlotKullan(localPlayer, 10);
			}
		}
	}

	private static bool TusBasildi(KeyCode tus)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return (int)tus != 0 && Input.GetKeyDown(tus);
	}

	public static void OzelSlotKullan(Player player, int slotIndeks)
	{
		if (!((Object)(object)player == (Object)null))
		{
			ItemData val = SlotEsyasiGetir(((Humanoid)player).GetInventory(), slotIndeks);
			if (val != null)
			{
				((Humanoid)player).UseItem(((Humanoid)player).GetInventory(), val, false);
			}
		}
	}

	public static bool OzelSlottaMi(ItemData item)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return item != null && KoordinattanSlotIndeksi(item.m_gridPos) >= 0;
	}

	public static bool EkipmanSlotuMu(int slotIndeks)
	{
		return (slotIndeks >= 0 && slotIndeks <= 4) || slotIndeks == 11;
	}

	public static ItemData SlotEsyasiGetir(Inventory inv, int slotIndeks)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		if (inv == null || slotIndeks < 0 || slotIndeks >= 13)
		{
			return null;
		}
		Vector2i val = SlotKoordinati(slotIndeks);
		List<ItemData> allItems = inv.GetAllItems();
		for (int i = 0; i < allItems.Count; i++)
		{
			ItemData val2 = allItems[i];
			if (val2 != null && val2.m_gridPos == val)
			{
				return val2;
			}
		}
		return null;
	}

	public static bool CantaMi(ItemData item)
	{
		if (item == null || item.m_shared == null)
		{
			return false;
		}
		string text = (item.m_shared.m_name ?? "").ToLowerInvariant();
		string text2 = (((Object)(object)item.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name.ToLowerInvariant() : "");
		return text.Contains("backpack") || text.Contains("çanta") || text.Contains("canta") || text.Contains("heybe") || text2.Contains("backpack") || text2.Contains("lareins_backpack") || text2.Contains("lareins_bp");
	}

	public static bool BrosVeyaTakiMi(ItemData item)
	{
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Invalid comparison between Unknown and I4
		if (item == null || item.m_shared == null || CantaMi(item))
		{
			return false;
		}
		string text = ((object)Unsafe.As<ItemType, ItemType>(ref item.m_shared.m_itemType)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant();
		if (text.Contains("trinket") || text.Contains("ring") || text.Contains("amulet"))
		{
			return true;
		}
		string text2 = (item.m_shared.m_name ?? "").ToLowerInvariant();
		string text3 = (((Object)(object)item.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name.ToLowerInvariant() : "");
		if (text2.Contains("brooch") || text2.Contains("broş") || text2.Contains("bros") || text2.Contains("necklace") || text2.Contains("ring") || text2.Contains("trinket") || text2.Contains("charm") || text2.Contains("talisman") || text3.Contains("brooch") || text3.Contains("trinket") || text3.Contains("ring"))
		{
			return true;
		}
		return (int)item.m_shared.m_itemType == 18;
	}

	public static bool EsyaSlotaUygunMu(ItemData item, int slotIndeks)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Invalid comparison between Unknown and I4
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Invalid comparison between Unknown and I4
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Invalid comparison between Unknown and I4
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Invalid comparison between Unknown and I4
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Invalid comparison between Unknown and I4
		if (item == null || item.m_shared == null || CantaMi(item))
		{
			return false;
		}
		ItemType itemType = item.m_shared.m_itemType;
		switch (slotIndeks)
		{
		case 0:
			return (int)itemType == 6;
		case 1:
			return (int)itemType == 7;
		case 2:
			return (int)itemType == 11;
		case 3:
			return (int)itemType == 17;
		case 4:
			return (int)itemType == 18;
		case 5:
		case 6:
		case 7:
			return IksirMi(item);
		case 8:
		case 9:
		case 10:
			return YiyecekMi(item);
		case 11:
			return BrosVeyaTakiMi(item);
		case 12:
			return (int)itemType == 9;
		default:
			return false;
		}
	}

	public static bool IksirMi(ItemData item)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Invalid comparison between Unknown and I4
		if (item == null || item.m_shared == null)
		{
			return false;
		}
		if ((int)item.m_shared.m_itemType != 2)
		{
			return false;
		}
		if (item.m_shared.m_food > 0f || item.m_shared.m_foodStamina > 0f || item.m_shared.m_foodEitr > 0f)
		{
			return false;
		}
		return true;
	}

	public static bool YiyecekMi(ItemData item)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Invalid comparison between Unknown and I4
		if (item == null || item.m_shared == null)
		{
			return false;
		}
		if ((int)item.m_shared.m_itemType != 2)
		{
			return false;
		}
		return item.m_shared.m_food > 0f || item.m_shared.m_foodStamina > 0f || item.m_shared.m_foodEitr > 0f;
	}

	public static int EkipmanIcinSlotBul(ItemData item)
	{
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected I4, but got Unknown
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Invalid comparison between Unknown and I4
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Invalid comparison between Unknown and I4
		if (item == null || item.m_shared == null || CantaMi(item))
		{
			return -1;
		}
		string text = ((object)Unsafe.As<ItemType, ItemType>(ref item.m_shared.m_itemType)/*cast due to .constrained prefix*/).ToString().ToLowerInvariant();
		if (text.Contains("trinket") || text.Contains("ring") || text.Contains("amulet"))
		{
			return 11;
		}
		ItemType itemType = item.m_shared.m_itemType;
		ItemType val = itemType;
		switch (val - 6)
		{
		default:
			if ((int)val != 17)
			{
				if ((int)val != 18)
				{
					break;
				}
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer != (Object)null && SlotEsyasiGetir(((Humanoid)localPlayer).GetInventory(), 4) != null && SlotEsyasiGetir(((Humanoid)localPlayer).GetInventory(), 11) == null)
				{
					return 11;
				}
				return 4;
			}
			return 3;
		case 0:
			return 0;
		case 1:
			return 1;
		case 5:
			return 2;
		case 3:
			return 12;
		case 2:
		case 4:
			break;
		}
		if (BrosVeyaTakiMi(item))
		{
			return 11;
		}
		return -1;
	}

	public static int GorunurSatirSayisiBul(Inventory inv)
	{
		int num = 4;
		if (inv == null)
		{
			return num;
		}
		List<ItemData> allItems = inv.GetAllItems();
		for (int i = 0; i < allItems.Count; i++)
		{
			ItemData val = allItems[i];
			if (val == null)
			{
				continue;
			}
			if (val.m_gridPos.y >= num && val.m_gridPos.y < 12)
			{
				num = val.m_gridPos.y + 1;
			}
			if (val.m_equipped && CantaMi(val))
			{
				string text = (((Object)(object)val.m_dropPrefab != (Object)null) ? ((Object)val.m_dropPrefab).name : "");
				if (text.StartsWith("Lareins_Backpack_Lv") && int.TryParse(text.Replace("Lareins_Backpack_Lv", ""), out var result))
				{
					num = Mathf.Max(num, 4 + result);
				}
			}
		}
		return num;
	}

	public static bool BosNormalSlotBul(Inventory inv, out Vector2i bosKonum)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		bosKonum = new Vector2i(-1, -1);
		if (inv == null)
		{
			return false;
		}
		int num = 8;
		int num2 = GorunurSatirSayisiBul(inv);
		for (int i = 0; i < num2; i++)
		{
			for (int j = 0; j < num; j++)
			{
				if (inv.GetItemAt(j, i) == null)
				{
					bosKonum = new Vector2i(j, i);
					return true;
				}
			}
		}
		return false;
	}

	private static void YuklemeSonrasiGeriYukle(Inventory inv)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		if (inv == null)
		{
			return;
		}
		List<ItemData> allItems = inv.GetAllItems();
		int num = 3;
		for (int i = 0; i < allItems.Count; i++)
		{
			ItemData val = allItems[i];
			if (val != null)
			{
				Vector2i bosKonum;
				if (val.m_customData != null && val.m_customData.TryGetValue("Lareins_KayitliSlot", out var value) && int.TryParse(value, out var result) && result >= 0 && result < 13)
				{
					val.m_gridPos = SlotKoordinati(result);
				}
				else if (val.m_gridPos.y >= 12 && val.m_gridPos.y < 20 && BosNormalSlotBul(inv, out bosKonum))
				{
					val.m_gridPos = bosKonum;
				}
				if (val.m_gridPos.y > num && val.m_gridPos.y <= 21)
				{
					num = val.m_gridPos.y;
				}
			}
		}
		inv.SetHeight(Mathf.Max(4, num + 1));
	}
}
public static class EquipmentSlotsUI
{
	private class SlotKutuUI
	{
		public int SlotIndeks;

		public GameObject KokObj;

		public Image Ikon;

		public Image KusanildiCer;

		public Image DayaniklilikArka;

		public Image DayaniklilikDolu;

		public Text MiktarYazi;

		public Text EtiketYazi;

		public Text SolAltTusYazi;

		public ItemData SonEsya;

		public int SonMiktar = -1;

		public bool SonKusanildi;
	}

	private class CopKutusuDinleyici : MonoBehaviour, IPointerDownHandler, IEventSystemHandler
	{
		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)eventData.button > 0)
			{
				return;
			}
			InventoryGui instance = InventoryGui.instance;
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)instance == (Object)null || (Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			ItemData val = EldekiEsyaGetir(instance);
			if (val == null)
			{
				return;
			}
			Inventory inventory = ((Humanoid)localPlayer).GetInventory();
			if (inventory != null)
			{
				if (val.m_equipped)
				{
					((Humanoid)localPlayer).UnequipItem(val, false);
				}
				inventory.RemoveItem(val);
				EldekiEsyaAyarla(instance, null, null, 0);
				EquipmentSlotsPlugin.EnvanterYenile(inventory);
				SlotlariYenile(instance);
				((Character)localPlayer).Message((MessageType)1, "Eşya silindi: " + val.m_shared.m_name, 0, (Sprite)null, false);
			}
		}
	}

	private class SlotTiklamaDinleyici : MonoBehaviour, IPointerDownHandler, IEventSystemHandler
	{
		public int SlotIndeks;

		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Invalid comparison between Unknown and I4
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			InventoryGui instance = InventoryGui.instance;
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)instance == (Object)null || (Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			Inventory inventory = ((Humanoid)localPlayer).GetInventory();
			if (inventory == null)
			{
				return;
			}
			ItemData val = EquipmentSlotsPlugin.SlotEsyasiGetir(inventory, SlotIndeks);
			if ((int)eventData.button == 1)
			{
				if (val == null)
				{
					return;
				}
				if (EquipmentSlotsPlugin.EkipmanSlotuMu(SlotIndeks))
				{
					((Humanoid)localPlayer).UnequipItem(val, true);
				}
				else if (SlotIndeks == 12)
				{
					if (EquipmentSlotsPlugin.BosNormalSlotBul(inventory, out var bosKonum))
					{
						val.m_gridPos = bosKonum;
					}
				}
				else
				{
					((Humanoid)localPlayer).UseItem(inventory, val, false);
				}
				EquipmentSlotsPlugin.EnvanterYenile(inventory);
				SlotlariYenile(instance);
			}
			else
			{
				if ((int)eventData.button != 0)
				{
					return;
				}
				ItemData val2 = EldekiEsyaGetir(instance);
				if (val2 != null)
				{
					if (!EquipmentSlotsPlugin.EsyaSlotaUygunMu(val2, SlotIndeks))
					{
						return;
					}
					if (val != null && val.m_shared.m_name == val2.m_shared.m_name && val.m_stack < val.m_shared.m_maxStackSize)
					{
						int num = Mathf.Min(val2.m_stack, val.m_shared.m_maxStackSize - val.m_stack);
						val.m_stack += num;
						val2.m_stack -= num;
						if (val2.m_stack <= 0)
						{
							inventory.RemoveItem(val2);
							EldekiEsyaAyarla(instance, null, null, 0);
						}
					}
					else
					{
						Vector2i gridPos = val2.m_gridPos;
						val2.m_gridPos = EquipmentSlotsPlugin.SlotKoordinati(SlotIndeks);
						if (EquipmentSlotsPlugin.EkipmanSlotuMu(SlotIndeks))
						{
							((Humanoid)localPlayer).EquipItem(val2, false);
						}
						if (val != null)
						{
							if (EquipmentSlotsPlugin.EkipmanSlotuMu(SlotIndeks))
							{
								((Humanoid)localPlayer).UnequipItem(val, false);
							}
							val.m_gridPos = gridPos;
							EldekiEsyaAyarla(instance, val, inventory, val.m_stack);
						}
						else
						{
							EldekiEsyaAyarla(instance, null, null, 0);
						}
					}
				}
				else if (val != null)
				{
					if (EquipmentSlotsPlugin.EkipmanSlotuMu(SlotIndeks))
					{
						((Humanoid)localPlayer).UnequipItem(val, false);
					}
					EldekiEsyaAyarla(instance, val, inventory, val.m_stack);
				}
				EquipmentSlotsPlugin.EnvanterYenile(inventory);
				SlotlariYenile(instance);
			}
		}
	}

	[HarmonyPatch(typeof(InventoryGrid), "GetElement")]
	private static class Patch_InventoryGrid_GetElement
	{
		private static bool Prefix(int y, ref object __result)
		{
			if (y < 0)
			{
				__result = null;
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(InventoryGui), "Show")]
	private static class Patch_InventoryGui_Show
	{
		private static void Postfix(InventoryGui __instance)
		{
			ArayuzuKurVeyaGuncelle(__instance);
		}
	}

	[HarmonyPatch(typeof(Hud), "Update")]
	private static class Patch_Hud_Update
	{
		private static void Postfix(Hud __instance)
		{
			MiniHudGuncelle(__instance);
		}
	}

	private static GameObject _yanPanelObj;

	private static RectTransform _yanPanelRect;

	private static SlotKutuUI[] _slotKutulari = new SlotKutuUI[13];

	private static GameObject _miniHudObj;

	private static SlotKutuUI[] _miniHudKutulari = new SlotKutuUI[6];

	private static Sprite _orijinalSlotSprite;

	private static Material _orijinalSlotMat;

	private static Sprite _orijinalPanelSprite;

	private static Material _orijinalPanelMat;

	private static Color _orijinalPanelRenk = new Color(0.24f, 0.17f, 0.11f, 0.96f);

	private static Font _orijinalFont;

	private static bool _bilesenlerYakalani;

	private static readonly FieldInfo _fiDragItem = AccessTools.Field(typeof(InventoryGui), "m_dragItem");

	private static readonly MethodInfo _miSetupDragItem = AccessTools.Method(typeof(InventoryGui), "SetupDragItem", (Type[])null, (Type[])null);

	private static void OrnekBilesenleriYakala(InventoryGui gui)
	{
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		if (_bilesenlerYakalani || (Object)(object)gui == (Object)null)
		{
			return;
		}
		if ((Object)(object)gui.m_playerGrid != (Object)null && (Object)(object)gui.m_playerGrid.m_elementPrefab != (Object)null)
		{
			GameObject elementPrefab = gui.m_playerGrid.m_elementPrefab;
			Image component = elementPrefab.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				_orijinalSlotSprite = component.sprite;
				_orijinalSlotMat = ((Graphic)component).material;
			}
			Text componentInChildren = elementPrefab.GetComponentInChildren<Text>(true);
			if ((Object)(object)componentInChildren != (Object)null)
			{
				_orijinalFont = componentInChildren.font;
			}
		}
		if ((Object)(object)gui.m_player != (Object)null)
		{
			Image[] componentsInChildren = ((Component)gui.m_player).GetComponentsInChildren<Image>(true);
			foreach (Image val in componentsInChildren)
			{
				if ((Object)(object)val.sprite != (Object)null && (Object)(object)val.sprite != (Object)(object)_orijinalSlotSprite && (((Object)((Component)val).gameObject).name.ToLowerInvariant().Contains("bkg") || ((Object)((Component)val).gameObject).name.ToLowerInvariant().Contains("panel") || (Object)(object)((Component)val).transform == (Object)(object)gui.m_player))
				{
					_orijinalPanelSprite = val.sprite;
					_orijinalPanelMat = ((Graphic)val).material;
					if (((Graphic)val).color.r < 0.7f)
					{
						_orijinalPanelRenk = ((Graphic)val).color;
					}
					break;
				}
			}
		}
		if ((Object)(object)_orijinalFont == (Object)null)
		{
			_orijinalFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
		}
		_bilesenlerYakalani = true;
	}

	public static void ArayuzuKurVeyaGuncelle(InventoryGui gui)
	{
		if ((Object)(object)gui == (Object)null || (Object)(object)gui.m_player == (Object)null)
		{
			return;
		}
		if (!EquipmentSlotsPlugin.ModAktif.Value)
		{
			if ((Object)(object)_yanPanelObj != (Object)null && _yanPanelObj.activeSelf)
			{
				_yanPanelObj.SetActive(false);
			}
			return;
		}
		OrnekBilesenleriYakala(gui);
		if ((Object)(object)_yanPanelObj == (Object)null)
		{
			YanPanelOlustur(gui);
		}
		if ((Object)(object)_yanPanelObj != (Object)null)
		{
			if (!_yanPanelObj.activeSelf)
			{
				_yanPanelObj.SetActive(true);
			}
			YanPanelKonumGuncelle(gui);
			SlotlariYenile(gui);
		}
	}

	private static void YanPanelOlustur(InventoryGui gui)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0053: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: 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_0293: 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_0304: 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)
		GameObject val = new GameObject("Lareins_EquipmentSidePanel", new Type[1] { typeof(RectTransform) });
		val.transform.SetParent(((Transform)gui.m_player).parent, false);
		_yanPanelObj = val;
		_yanPanelRect = val.GetComponent<RectTransform>();
		_yanPanelRect.anchorMin = gui.m_player.anchorMin;
		_yanPanelRect.anchorMax = gui.m_player.anchorMax;
		_yanPanelRect.pivot = new Vector2(0f, 1f);
		_yanPanelRect.sizeDelta = new Vector2(248f, 504f);
		Image val2 = val.AddComponent<Image>();
		if ((Object)(object)_orijinalPanelSprite != (Object)null)
		{
			val2.sprite = _orijinalPanelSprite;
			val2.type = (Type)1;
		}
		if ((Object)(object)_orijinalPanelMat != (Object)null)
		{
			((Graphic)val2).material = _orijinalPanelMat;
		}
		((Graphic)val2).color = _orijinalPanelRenk;
		BaslikEkle(_yanPanelRect, "EKİPMAN", new Vector2(124f, -18f));
		BaslikEkle(_yanPanelRect, "İKSİR & YİYECEK", new Vector2(124f, -262f));
		float boyut = 66f;
		float num = 74f;
		float num2 = 17f;
		_slotKutulari[0] = SlotKutusuOlustur(_yanPanelRect, 0, new Vector2(num2 + 0f * num, -36f), boyut, miniHudMu: false);
		_slotKutulari[1] = SlotKutusuOlustur(_yanPanelRect, 1, new Vector2(num2 + 1f * num, -36f), boyut, miniHudMu: false);
		_slotKutulari[2] = SlotKutusuOlustur(_yanPanelRect, 2, new Vector2(num2 + 2f * num, -36f), boyut, miniHudMu: false);
		_slotKutulari[3] = SlotKutusuOlustur(_yanPanelRect, 3, new Vector2(num2 + 0f * num, -110f), boyut, miniHudMu: false);
		_slotKutulari[4] = SlotKutusuOlustur(_yanPanelRect, 4, new Vector2(num2 + 1f * num, -110f), boyut, miniHudMu: false);
		_slotKutulari[11] = SlotKutusuOlustur(_yanPanelRect, 11, new Vector2(num2 + 2f * num, -110f), boyut, miniHudMu: false);
		_slotKutulari[12] = SlotKutusuOlustur(_yanPanelRect, 12, new Vector2(num2 + 1f * num, -184f), boyut, miniHudMu: false);
		for (int i = 0; i < 3; i++)
		{
			int num3 = 5 + i;
			_slotKutulari[num3] = SlotKutusuOlustur(_yanPanelRect, num3, new Vector2(num2 + (float)i * num, -280f), boyut, miniHudMu: false);
		}
		for (int j = 0; j < 3; j++)
		{
			int num4 = 8 + j;
			_slotKutulari[num4] = SlotKutusuOlustur(_yanPanelRect, num4, new Vector2(num2 + (float)j * num, -354f), boyut, miniHudMu: false);
		}
		CopKutusuOlustur(_yanPanelRect, new Vector2(num2, -432f), new Vector2(214f, 48f));
	}

	private static void CopKutusuOlustur(RectTransform ebeveyn, Vector2 konum, Vector2 boyut)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_003f: 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_006b: 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)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Lareins_TrashSlot", new Type[1] { typeof(RectTransform) });
		val.transform.SetParent((Transform)(object)ebeveyn, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0f, 1f);
		component.anchorMax = new Vector2(0f, 1f);
		component.pivot = new Vector2(0f, 1f);
		component.anchoredPosition = konum;
		component.sizeDelta = boyut;
		Image val2 = val.AddComponent<Image>();
		if ((Object)(object)_orijinalSlotSprite != (Object)null)
		{
			val2.sprite = _orijinalSlotSprite;
			val2.type = (Type)1;
		}
		if ((Object)(object)_orijinalPanelMat != (Object)null)
		{
			((Graphic)val2).material = _orijinalPanelMat;
		}
		((Graphic)val2).color = new Color(0.45f, 0.12f, 0.1f, 0.92f);
		Text val3 = KutuYaziOlustur(val.transform, "CopYazi", Vector2.zero, Vector2.one, Vector2.zero, 13, (TextAnchor)4, new Color(1f, 0.85f, 0.8f, 0.95f));
		val3.fontStyle = (FontStyle)1;
		val3.text = "İTEM SİL (ÇÖP KUTUSU)";
		val.AddComponent<CopKutusuDinleyici>();
	}

	private static void YanPanelKonumGuncelle(InventoryGui gui)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_yanPanelRect == (Object)null) && !((Object)(object)gui == (Object)null) && !((Object)(object)gui.m_player == (Object)null))
		{
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			gui.m_player.GetLocalCorners(array);
			Vector3 val = ((Transform)gui.m_player).localPosition + array[2];
			float num = val.x + EquipmentSlotsPlugin.PanelYatayOfset.Value;
			float num2 = val.y + EquipmentSlotsPlugin.PanelDikeyOfset.Value;
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(num, num2, 0f);
			if (((Transform)_yanPanelRect).localPosition != val2)
			{
				((Transform)_yanPanelRect).localPosition = val2;
			}
		}
	}

	private static void BaslikEkle(RectTransform ebeveyn, string metin, Vector2 konum)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Baslik_" + metin, new Type[1] { typeof(RectTransform) });
		val.transform.SetParent((Transform)(object)ebeveyn, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0f, 1f);
		component.anchorMax = new Vector2(0f, 1f);
		component.pivot = new Vector2(0.5f, 0.5f);
		component.anchoredPosition = konum;
		component.sizeDelta = new Vector2(220f, 22f);
		Text val2 = val.AddComponent<Text>();
		if ((Object)(object)_orijinalFont != (Object)null)
		{
			val2.font = _orijinalFont;
		}
		val2.text = metin;
		val2.fontSize = 14;
		val2.fontStyle = (FontStyle)1;
		val2.alignment = (TextAnchor)4;
		((Graphic)val2).color = new Color(0.96f, 0.84f, 0.56f, 1f);
		((Graphic)val2).raycastTarget = false;
	}

	private static SlotKutuUI SlotKutusuOlustur(RectTransform ebeveyn, int slotIndeks, Vector2 konum, float boyut, bool miniHudMu)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_004b: 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_0077: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Expected O, but got Unknown
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: 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_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Expected O, but got Unknown
		//IL_02d5: 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_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Expected O, but got Unknown
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_0436: Unknown result type (might be due to invalid IL or missing references)
		//IL_0446: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_047b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0497: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("OzelSlot_" + slotIndeks, new Type[1] { typeof(RectTransform) });
		val.transform.SetParent((Transform)(object)ebeveyn, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0f, 1f);
		component.anchorMax = new Vector2(0f, 1f);
		component.pivot = new Vector2(0f, 1f);
		component.anchoredPosition = konum;
		component.sizeDelta = new Vector2(boyut, boyut);
		Image val2 = val.AddComponent<Image>();
		if ((Object)(object)_orijinalSlotSprite != (Object)null)
		{
			val2.sprite = _orijinalSlotSprite;
			val2.type = (Type)1;
		}
		if ((Object)(object)_orijinalSlotMat != (Object)null)
		{
			((Graphic)val2).material = _orijinalSlotMat;
		}
		((Graphic)val2).color = (miniHudMu ? new Color(0.08f, 0.07f, 0.06f, 0.58f) : new Color(0.16f, 0.12f, 0.09f, 0.92f));
		GameObject val3 = new GameObject("Kusanildi", new Type[1] { typeof(RectTransform) });
		val3.transform.SetParent(val.transform, false);
		RectTransform component2 = val3.GetComponent<RectTransform>();
		component2.anchorMin = Vector2.zero;
		component2.anchorMax = Vector2.one;
		component2.offsetMin = new Vector2(2f, 2f);
		component2.offsetMax = new Vector2(-2f, -2f);
		Image val4 = val3.AddComponent<Image>();
		((Graphic)val4).color = new Color(1f, 0.78f, 0.2f, 0.28f);
		((Graphic)val4).raycastTarget = false;
		val3.SetActive(false);
		GameObject val5 = new GameObject("Ikon", new Type[1] { typeof(RectTransform) });
		val5.transform.SetParent(val.transform, false);
		RectTransform component3 = val5.GetComponent<RectTransform>();
		component3.anchorMin = Vector2.zero;
		component3.anchorMax = Vector2.one;
		float num = (miniHudMu ? 5f : 6f);
		component3.offsetMin = new Vector2(num, num);
		component3.offsetMax = new Vector2(0f - num, 0f - num);
		Image val6 = val5.AddComponent<Image>();
		val6.preserveAspect = true;
		((Graphic)val6).raycastTarget = false;
		((Behaviour)val6).enabled = false;
		GameObject val7 = new GameObject("DayaniklilikArka", new Type[1] { typeof(RectTransform) });
		val7.transform.SetParent(val.transform, false);
		RectTransform component4 = val7.GetComponent<RectTransform>();
		component4.anchorMin = new Vector2(0.1f, 0.08f);
		component4.anchorMax = new Vector2(0.9f, 0.14f);
		component4.offsetMin = Vector2.zero;
		component4.offsetMax = Vector2.zero;
		Image val8 = val7.AddComponent<Image>();
		((Graphic)val8).color = new Color(0f, 0f, 0f, 0.8f);
		((Graphic)val8).raycastTarget = false;
		val7.SetActive(false);
		GameObject val9 = new GameObject("DayaniklilikDolu", new Type[1] { typeof(RectTransform) });
		val9.transform.SetParent(val7.transform, false);
		RectTransform component5 = val9.GetComponent<RectTransform>();
		component5.anchorMin = Vector2.zero;
		component5.anchorMax = Vector2.one;
		component5.offsetMin = Vector2.zero;
		component5.offsetMax = Vector2.zero;
		Image val10 = val9.AddComponent<Image>();
		val10.type = (Type)3;
		val10.fillMethod = (FillMethod)0;
		((Graphic)val10).color = new Color(0.25f, 0.85f, 0.35f, 1f);
		((Graphic)val10).raycastTarget = false;
		Text miktarYazi = KutuYaziOlustur(val.transform, "Miktar", new Vector2(0f, 0f), new Vector2(1f, 0.48f), new Vector2(-3f, 2f), miniHudMu ? 11 : 12, (TextAnchor)8, Color.white);
		Text etiketYazi = KutuYaziOlustur(val.transform, "Etiket", new Vector2(0f, 0f), new Vector2(1f, 1f), Vector2.zero, 11, (TextAnchor)4, new Color(0.96f, 0.88f, 0.7f, 0.82f));
		Text val11 = KutuYaziOlustur(val.transform, "SolAltTus", new Vector2(0f, 0f), new Vector2(0.6f, 0.48f), new Vector2(3f, 2f), miniHudMu ? 11 : 11, (TextAnchor)6, new Color(1f, 0.88f, 0.45f, 0.98f));
		val11.fontStyle = (FontStyle)1;
		if (!miniHudMu)
		{
			SlotTiklamaDinleyici slotTiklamaDinleyici = val.AddComponent<SlotTiklamaDinleyici>();
			slotTiklamaDinleyici.SlotIndeks = slotIndeks;
		}
		return new SlotKutuUI
		{
			SlotIndeks = slotIndeks,
			KokObj = val,
			Ikon = val6,
			KusanildiCer = val4,
			DayaniklilikArka = val8,
			DayaniklilikDolu = val10,
			MiktarYazi = miktarYazi,
			EtiketYazi = etiketYazi,
			SolAltTusYazi = val11
		};
	}

	private static Text KutuYaziOlustur(Transform ebeveyn, string ad, Vector2 aMin, Vector2 aMax, Vector2 ofset, int boyut, TextAnchor hiza, Color renk)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_006c: 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_007e: 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_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(ad, new Type[1] { typeof(RectTransform) });
		val.transform.SetParent(ebeveyn, false);
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = aMin;
		component.anchorMax = aMax;
		component.offsetMin = new Vector2(2f, 1f);
		component.offsetMax = new Vector2(-2f, -1f);
		if (ofset != Vector2.zero)
		{
			component.anchoredPosition += ofset;
		}
		Text val2 = val.AddComponent<Text>();
		if ((Object)(object)_orijinalFont != (Object)null)
		{
			val2.font = _orijinalFont;
		}
		val2.fontSize = boyut;
		val2.alignment = hiza;
		((Graphic)val2).color = renk;
		((Graphic)val2).raycastTarget = false;
		return val2;
	}

	public static void SlotlariYenile(InventoryGui gui)
	{
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null)
		{
			return;
		}
		Inventory inventory = ((Humanoid)localPlayer).GetInventory();
		if (inventory == null)
		{
			return;
		}
		for (int i = 0; i < 13; i++)
		{
			if (_slotKutulari[i] != null)
			{
				ItemData item = EquipmentSlotsPlugin.SlotEsyasiGetir(inventory, i);
				TekSlotGuncelle(_slotKutulari[i], item, miniHudMu: false);
			}
		}
	}

	private static void TekSlotGuncelle(SlotKutuUI kutu, ItemData item, bool miniHudMu)
	{
		if (kutu == null)
		{
			return;
		}
		string text = TusEtiketiGetir(kutu.SlotIndeks);
		if ((Object)(object)kutu.SolAltTusYazi != (Object)null && kutu.SolAltTusYazi.text != text)
		{
			kutu.SolAltTusYazi.text = text;
		}
		if (item == null)
		{
			if (kutu.SonEsya != null || kutu.SonMiktar != 0)
			{
				kutu.SonEsya = null;
				kutu.SonMiktar = 0;
				kutu.SonKusanildi = false;
				((Behaviour)kutu.Ikon).enabled = false;
				((Component)kutu.KusanildiCer).gameObject.SetActive(false);
				((Component)kutu.DayaniklilikArka).gameObject.SetActive(false);
				kutu.MiktarYazi.text = "";
				kutu.EtiketYazi.text = (miniHudMu ? "" : EquipmentSlotsPlugin.SlotAdlari[kutu.SlotIndeks]);
			}
		}
		else if (kutu.SonEsya != item || kutu.SonMiktar != item.m_stack || kutu.SonKusanildi != item.m_equipped)
		{
			kutu.SonEsya = item;
			kutu.SonMiktar = item.m_stack;
			kutu.SonKusanildi = item.m_equipped;
			((Behaviour)kutu.Ikon).enabled = true;
			kutu.Ikon.sprite = item.GetIcon();
			((Component)kutu.KusanildiCer).gameObject.SetActive(item.m_equipped);
			if (item.m_shared.m_useDurability && item.m_shared.m_maxDurability > 0f)
			{
				((Component)kutu.DayaniklilikArka).gameObject.SetActive(true);
				kutu.DayaniklilikDolu.fillAmount = Mathf.Clamp01(item.GetDurabilityPercentage());
			}
			else
			{
				((Component)kutu.DayaniklilikArka).gameObject.SetActive(false);
			}
			kutu.MiktarYazi.text = ((item.m_shared.m_maxStackSize > 1) ? item.m_stack.ToString() : "");
			kutu.EtiketYazi.text = "";
		}
	}

	private static string TusEtiketiGetir(int slotIndeks)
	{
		//IL_002c: 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_0050: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		return slotIndeks switch
		{
			5 => TusKisaAd(EquipmentSlotsPlugin.Iksir1Tus.Value), 
			6 => TusKisaAd(EquipmentSlotsPlugin.Iksir2Tus.Value), 
			7 => TusKisaAd(EquipmentSlotsPlugin.Iksir3Tus.Value), 
			8 => TusKisaAd(EquipmentSlotsPlugin.Yiyecek1Tus.Value), 
			9 => TusKisaAd(EquipmentSlotsPlugin.Yiyecek2Tus.Value), 
			10 => TusKisaAd(EquipmentSlotsPlugin.Yiyecek3Tus.Value), 
			_ => "", 
		};
	}

	private unsafe static string TusKisaAd(KeyCode tus)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		if ((int)tus == 0)
		{
			return "";
		}
		return ((object)(*(KeyCode*)(&tus))/*cast due to .constrained prefix*/).ToString().Replace("Alpha", "").ToLowerInvariant();
	}

	public static void MiniHudGuncelle(Hud hud)
	{
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Expected O, but got Unknown
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)hud == (Object)null)
		{
			return;
		}
		if (!EquipmentSlotsPlugin.ModAktif.Value || !EquipmentSlotsPlugin.MiniHudGoster.Value || InventoryGui.IsVisible() || !((Object)(object)Player.m_localPlayer != (Object)null) || ((Character)Player.m_localPlayer).IsDead())
		{
			if ((Object)(object)_miniHudObj != (Object)null && _miniHudObj.activeSelf)
			{
				_miniHudObj.SetActive(false);
			}
			return;
		}
		if ((Object)(object)_miniHudObj == (Object)null && (Object)(object)hud.m_rootObject != (Object)null)
		{
			if (!_bilesenlerYakalani && (Object)(object)InventoryGui.instance != (Object)null)
			{
				OrnekBilesenleriYakala(InventoryGui.instance);
			}
			_miniHudObj = new GameObject("Lareins_MiniConsumableHud", new Type[1] { typeof(RectTransform) });
			_miniHudObj.transform.SetParent(hud.m_rootObject.transform, false);
			RectTransform component = _miniHudObj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.anchoredPosition = new Vector2(612f, -15f);
			component.sizeDelta = new Vector2(360f, 56f);
			float boyut = 52f;
			float num = 56f;
			for (int i = 0; i < 6; i++)
			{
				int slotIndeks = 5 + i;
				float num2 = ((i >= 3) ? 12f : 0f);
				_miniHudKutulari[i] = SlotKutusuOlustur(component, slotIndeks, new Vector2((float)i * num + num2, 0f), boyut, miniHudMu: true);
			}
		}
		if ((Object)(object)_miniHudObj != (Object)null)
		{
			if (!_miniHudObj.activeSelf)
			{
				_miniHudObj.SetActive(true);
			}
			Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory();
			for (int j = 0; j < 6; j++)
			{
				ItemData item = EquipmentSlotsPlugin.SlotEsyasiGetir(inventory, 5 + j);
				TekSlotGuncelle(_miniHudKutulari[j], item, miniHudMu: true);
			}
		}
	}

	private static ItemData EldekiEsyaGetir(InventoryGui gui)
	{
		if ((Object)(object)gui == (Object)null || _fiDragItem == null)
		{
			return null;
		}
		object? value = _fiDragItem.GetValue(gui);
		return (ItemData)((value is ItemData) ? value : null);
	}

	private static void EldekiEsyaAyarla(InventoryGui gui, ItemData item, Inventory inv, int miktar)
	{
		if (!((Object)(object)gui == (Object)null) && !(_miSetupDragItem == null))
		{
			_miSetupDragItem.Invoke(gui, new object[3] { item, inv, miktar });
		}
	}
}