Decompiled source of Lareins Backpack v1.0.1

plugins\Lareins_Backpack\Lareins_Backpack.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lareins_Backpack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lareins_Backpack")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7fb6069a-723f-48e6-88b1-51651a715556")]
[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_Backpack;

public static class BackpackAssets
{
	private static readonly Dictionary<int, Sprite> ikonOnbellek = new Dictionary<int, Sprite>();

	private static Material deriMat;

	private static Material duzDeriMat;

	private static Material koyuDeriMat;

	private static Material matKumasMat;

	private static Material metalMat;

	private static Material kurtKurkMat;

	private static Material loxKurkMat;

	private static Material ahsapMat;

	private static bool dokularYuklendi = false;

	private static void ValheimMateryalleriniYukle()
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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_00bc: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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_0124: 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_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		if (!dokularYuklendi)
		{
			Shader val = Shader.Find("Standard");
			if ((Object)(object)val == (Object)null)
			{
				val = Shader.Find("Diffuse");
			}
			deriMat = (Material)(((object)KatiOyunMateryaliBul("ShieldWood")) ?? ((object)new Material(val)
			{
				color = new Color(0.38f, 0.21f, 0.1f)
			}));
			duzDeriMat = (Material)(((object)KatiOyunMateryaliBul("Hammer")) ?? ((object)new Material(val)
			{
				color = new Color(0.45f, 0.26f, 0.12f)
			}));
			koyuDeriMat = (Material)(((object)KatiOyunMateryaliBul("Club")) ?? ((object)new Material(val)
			{
				color = new Color(0.18f, 0.1f, 0.05f)
			}));
			matKumasMat = (Material)(((object)KatiOyunMateryaliBul("Tankard")) ?? ((object)new Material(val)
			{
				color = new Color(0.46f, 0.41f, 0.28f)
			}));
			kurtKurkMat = (Material)(((object)KatiOyunMateryaliBul("TrophyWolf")) ?? ((object)new Material(val)
			{
				color = new Color(0.68f, 0.7f, 0.74f)
			}));
			loxKurkMat = (Material)(((object)KatiOyunMateryaliBul("TrophyLox")) ?? ((object)new Material(val)
			{
				color = new Color(0.35f, 0.22f, 0.12f)
			}));
			metalMat = (Material)(((object)KatiOyunMateryaliBul("ShieldIronBuckler")) ?? ((object)new Material(val)
			{
				color = new Color(0.58f, 0.62f, 0.66f)
			}));
			ahsapMat = (Material)(((object)KatiOyunMateryaliBul("Hammer")) ?? ((object)new Material(val)
			{
				color = new Color(0.28f, 0.16f, 0.08f)
			}));
			dokularYuklendi = true;
		}
	}

	private static Material KatiOyunMateryaliBul(string prefabAdi)
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		if ((Object)(object)ObjectDB.instance == (Object)null)
		{
			return null;
		}
		GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabAdi);
		if ((Object)(object)itemPrefab == (Object)null)
		{
			return null;
		}
		MeshRenderer componentInChildren = itemPrefab.GetComponentInChildren<MeshRenderer>(true);
		if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((Renderer)componentInChildren).sharedMaterial != (Object)null)
		{
			return new Material(((Renderer)componentInChildren).sharedMaterial);
		}
		return null;
	}

	public static Color SeviyeRengi(int seviye)
	{
		//IL_0039: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_006f: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		return (Color)(seviye switch
		{
			1 => new Color(0.56f, 0.35f, 0.17f), 
			2 => new Color(0.42f, 0.23f, 0.11f), 
			3 => new Color(0.3f, 0.19f, 0.11f), 
			4 => new Color(0.24f, 0.23f, 0.25f), 
			5 => new Color(0.52f, 0.56f, 0.62f), 
			6 => new Color(0.15f, 0.25f, 0.21f), 
			_ => new Color(0.42f, 0.25f, 0.13f), 
		});
	}

	public static Color SeviyeMetalRengi(int seviye)
	{
		//IL_0039: 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_0055: 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_006c: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: 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)
		return (Color)(seviye switch
		{
			1 => new Color(0.55f, 0.42f, 0.28f), 
			2 => new Color(0.68f, 0.52f, 0.3f), 
			3 => new Color(0.85f, 0.58f, 0.22f), 
			4 => new Color(0.7f, 0.74f, 0.78f), 
			5 => new Color(0.92f, 0.96f, 1f), 
			6 => new Color(0.16f, 0.6f, 0.42f), 
			_ => Color.gray, 
		});
	}

	public static GameObject SirtModeliOlustur(int seviye, Transform sirtKemigi)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0053: 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_0074: 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_00a0: 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_00e0: 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_0102: Expected O, but got Unknown
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Expected O, but got Unknown
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: 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_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: 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_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: 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_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_042f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_048f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0525: Unknown result type (might be due to invalid IL or missing references)
		//IL_0539: Unknown result type (might be due to invalid IL or missing references)
		//IL_0563: Unknown result type (might be due to invalid IL or missing references)
		//IL_0577: 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_05b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0603: Unknown result type (might be due to invalid IL or missing references)
		//IL_0626: Unknown result type (might be due to invalid IL or missing references)
		//IL_063a: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0671: Unknown result type (might be due to invalid IL or missing references)
		//IL_0697: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0713: Unknown result type (might be due to invalid IL or missing references)
		//IL_0727: Unknown result type (might be due to invalid IL or missing references)
		//IL_0914: Unknown result type (might be due to invalid IL or missing references)
		//IL_0928: Unknown result type (might be due to invalid IL or missing references)
		//IL_094f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0970: Unknown result type (might be due to invalid IL or missing references)
		//IL_0984: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_09bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_09f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a9d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0adb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b19: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0761: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: Unknown result type (might be due to invalid IL or missing references)
		//IL_079c: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_080b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0832: Unknown result type (might be due to invalid IL or missing references)
		//IL_0857: Unknown result type (might be due to invalid IL or missing references)
		//IL_086b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0895: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
		ValheimMateryalleriniYukle();
		GameObject val = new GameObject($"Lareins_Backpack3D_Lv{seviye}");
		val.transform.SetParent(sirtKemigi, false);
		Vector3 lossyScale = sirtKemigi.lossyScale;
		float num = ((lossyScale.x > 0.001f) ? (1f / lossyScale.x) : 1f);
		float num2 = ((lossyScale.y > 0.001f) ? (1f / lossyScale.y) : 1f);
		float num3 = ((lossyScale.z > 0.001f) ? (1f / lossyScale.z) : 1f);
		val.transform.localScale = new Vector3(num, num2, num3);
		val.transform.localPosition = new Vector3(0f, 0.0004f, -0.0017f);
		val.transform.localRotation = Quaternion.Euler(4f, 180f, 0f);
		Material val2 = new Material((seviye < 3) ? duzDeriMat : deriMat);
		val2.color = Color.Lerp(val2.color, SeviyeRengi(seviye), 0.7f);
		Material val3 = new Material(metalMat);
		val3.color = SeviyeMetalRengi(seviye);
		ParcaEkle((PrimitiveType)1, val.transform, new Vector3(0f, 0.01f, 0.04f), new Vector3(0.38f, 0.24f, 0.2f), val2);
		TokaVeKayisEkle(val.transform, 1.15f, 0.04f, val3);
		OmuzKayislariEkle(val.transform, 1.14f);
		switch (seviye)
		{
		case 1:
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, 0.16f, 0.06f), new Vector3(0.39f, 0.08f, 0.21f), koyuDeriMat);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.05f, 0.14f), new Vector3(0.22f, 0.16f, 0.06f), koyuDeriMat);
			OyunEkipmaniEkle("Tankard", val.transform, new Vector3(-0.21f, -0.05f, 0.08f), Quaternion.Euler(0f, 0f, 0f), 0.58f);
			break;
		case 2:
		{
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, 0.16f, 0.06f), new Vector3(0.39f, 0.08f, 0.21f), koyuDeriMat);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.05f, 0.14f), new Vector3(0.22f, 0.16f, 0.06f), koyuDeriMat);
			GameObject val10 = ParcaEkle((PrimitiveType)2, val.transform, new Vector3(0f, -0.24f, 0.05f), new Vector3(0.11f, 0.2f, 0.11f), matKumasMat);
			val10.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(-0.1f, -0.24f, 0.05f), new Vector3(0.025f, 0.12f, 0.12f), koyuDeriMat);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0.1f, -0.24f, 0.05f), new Vector3(0.025f, 0.12f, 0.12f), koyuDeriMat);
			OyunEkipmaniEkle("AxeStone", val.transform, new Vector3(0.21f, -0.02f, 0.08f), Quaternion.Euler(-90f, 0f, 0f), 0.55f);
			break;
		}
		case 3:
		{
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, 0.16f, 0.06f), new Vector3(0.39f, 0.08f, 0.21f), koyuDeriMat);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.05f, 0.14f), new Vector3(0.22f, 0.16f, 0.06f), koyuDeriMat);
			GameObject val9 = ParcaEkle((PrimitiveType)2, val.transform, new Vector3(0f, 0.28f, 0.05f), new Vector3(0.12f, 0.21f, 0.12f), matKumasMat);
			val9.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(-0.1f, 0.28f, 0.05f), new Vector3(0.025f, 0.13f, 0.13f), koyuDeriMat);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0.1f, 0.28f, 0.05f), new Vector3(0.025f, 0.13f, 0.13f), koyuDeriMat);
			OyunEkipmaniEkle("PickaxeBronze", val.transform, new Vector3(0.21f, -0.02f, 0.08f), Quaternion.Euler(-90f, 0f, 0f), 0.54f);
			OyunEkipmaniEkle("KnifeFlint", val.transform, new Vector3(-0.21f, -0.02f, 0.09f), Quaternion.Euler(90f, 0f, 0f), 0.58f);
			break;
		}
		case 4:
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, 0.16f, 0.07f), new Vector3(0.39f, 0.045f, 0.21f), val3);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.16f, 0.07f), new Vector3(0.39f, 0.045f, 0.21f), val3);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.04f, 0.15f), new Vector3(0.24f, 0.18f, 0.06f), koyuDeriMat);
			ParcaEkle((PrimitiveType)2, val.transform, new Vector3(-0.22f, 0.01f, 0.06f), new Vector3(0.11f, 0.2f, 0.11f), matKumasMat);
			OyunEkipmaniEkle("PickaxeIron", val.transform, new Vector3(0.21f, -0.02f, 0.08f), Quaternion.Euler(-90f, 0f, 0f), 0.55f);
			OyunEkipmaniEkle("Torch", val.transform, new Vector3(-0.2f, -0.02f, 0.12f), Quaternion.Euler(-90f, 0f, 0f), 0.48f);
			break;
		case 5:
		{
			GameObject val7 = ParcaEkle((PrimitiveType)1, val.transform, new Vector3(0f, 0.18f, 0.03f), new Vector3(0.18f, 0.23f, 0.18f), kurtKurkMat);
			val7.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.04f, 0.15f), new Vector3(0.24f, 0.18f, 0.06f), koyuDeriMat);
			GameObject val8 = ParcaEkle((PrimitiveType)2, val.transform, new Vector3(0f, 0.28f, 0.05f), new Vector3(0.12f, 0.21f, 0.12f), matKumasMat);
			val8.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			OyunEkipmaniEkle("PickaxeIron", val.transform, new Vector3(0.21f, -0.02f, 0.08f), Quaternion.Euler(-90f, 0f, 0f), 0.56f);
			OyunEkipmaniEkle("KnifeSilver", val.transform, new Vector3(-0.21f, -0.02f, 0.09f), Quaternion.Euler(90f, 0f, 0f), 0.6f);
			OyunEkipmaniEkle("MeadHealthMedium", val.transform, new Vector3(-0.08f, -0.09f, 0.16f), Quaternion.Euler(0f, 0f, 0f), 0.58f);
			break;
		}
		default:
		{
			GameObject val4 = ParcaEkle((PrimitiveType)1, val.transform, new Vector3(0f, 0.18f, 0.03f), new Vector3(0.18f, 0.23f, 0.18f), loxKurkMat);
			val4.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.16f, 0.07f), new Vector3(0.38f, 0.045f, 0.21f), val3);
			ParcaEkle((PrimitiveType)3, val.transform, new Vector3(0f, -0.04f, 0.15f), new Vector3(0.24f, 0.18f, 0.06f), koyuDeriMat);
			GameObject val5 = ParcaEkle((PrimitiveType)2, val.transform, new Vector3(0f, 0.28f, 0.05f), new Vector3(0.12f, 0.21f, 0.12f), matKumasMat);
			val5.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			GameObject val6 = ParcaEkle((PrimitiveType)2, val.transform, new Vector3(0f, -0.24f, 0.05f), new Vector3(0.1f, 0.19f, 0.1f), koyuDeriMat);
			val6.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			OyunEkipmaniEkle("PickaxeBlackMetal", val.transform, new Vector3(0.22f, -0.02f, 0.08f), Quaternion.Euler(-90f, 0f, 0f), 0.58f);
			OyunEkipmaniEkle("KnifeBlackMetal", val.transform, new Vector3(-0.21f, -0.02f, 0.09f), Quaternion.Euler(90f, 0f, 0f), 0.62f);
			OyunEkipmaniEkle("MeadHealthMajor", val.transform, new Vector3(0.08f, -0.09f, 0.16f), Quaternion.Euler(0f, 0f, 0f), 0.62f);
			break;
		}
		}
		return val;
	}

	private static void OyunEkipmaniEkle(string prefabAdi, Transform parent, Vector3 pos, Quaternion rot, float olcek)
	{
		//IL_0068: 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_0082: 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)
		if ((Object)(object)ObjectDB.instance == (Object)null)
		{
			return;
		}
		GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabAdi);
		if ((Object)(object)itemPrefab == (Object)null)
		{
			return;
		}
		Transform val = itemPrefab.transform.Find("attach");
		GameObject val2 = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : itemPrefab);
		GameObject val3 = Object.Instantiate<GameObject>(val2, parent, false);
		val3.transform.localPosition = pos;
		val3.transform.localRotation = rot;
		val3.transform.localScale = Vector3.one * olcek;
		val3.SetActive(true);
		Collider[] componentsInChildren = val3.GetComponentsInChildren<Collider>(true);
		foreach (Collider val4 in componentsInChildren)
		{
			Object.Destroy((Object)(object)val4);
		}
		Rigidbody[] componentsInChildren2 = val3.GetComponentsInChildren<Rigidbody>(true);
		foreach (Rigidbody val5 in componentsInChildren2)
		{
			Object.Destroy((Object)(object)val5);
		}
		ItemDrop[] componentsInChildren3 = val3.GetComponentsInChildren<ItemDrop>(true);
		foreach (ItemDrop val6 in componentsInChildren3)
		{
			Object.Destroy((Object)(object)val6);
		}
		ZNetView[] componentsInChildren4 = val3.GetComponentsInChildren<ZNetView>(true);
		foreach (ZNetView val7 in componentsInChildren4)
		{
			Object.Destroy((Object)(object)val7);
		}
		Light[] componentsInChildren5 = val3.GetComponentsInChildren<Light>(true);
		foreach (Light val8 in componentsInChildren5)
		{
			Object.Destroy((Object)(object)val8);
		}
		Component[] componentsInChildren6 = val3.GetComponentsInChildren<Component>(true);
		foreach (Component val9 in componentsInChildren6)
		{
			if ((Object)(object)val9 != (Object)null && ((object)val9).GetType().Name == "ParticleSystem")
			{
				Object.Destroy((Object)(object)val9);
			}
		}
	}

	private static void TokaVeKayisEkle(Transform parent, float s, float zOfset, Material metal)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0094: 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)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		ParcaEkle((PrimitiveType)3, parent, new Vector3(-0.085f * s, 0.03f, zOfset + 0.085f * s), new Vector3(0.028f, 0.3f * s, 0.016f), koyuDeriMat);
		ParcaEkle((PrimitiveType)3, parent, new Vector3(0.085f * s, 0.03f, zOfset + 0.085f * s), new Vector3(0.028f, 0.3f * s, 0.016f), koyuDeriMat);
		ParcaEkle((PrimitiveType)3, parent, new Vector3(-0.085f * s, 0.05f * s, zOfset + 0.095f * s), new Vector3(0.042f, 0.038f, 0.016f), metal);
		ParcaEkle((PrimitiveType)3, parent, new Vector3(0.085f * s, 0.05f * s, zOfset + 0.095f * s), new Vector3(0.042f, 0.038f, 0.016f), metal);
	}

	private static void OmuzKayislariEkle(Transform parent, float s)
	{
		//IL_0014: 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_004f: 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_0083: 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)
		GameObject val = ParcaEkle((PrimitiveType)3, parent, new Vector3(-0.105f * s, 0.03f, -0.05f), new Vector3(0.036f, 0.36f * s, 0.022f), koyuDeriMat);
		val.transform.localRotation = Quaternion.Euler(-8f, 0f, -3f);
		GameObject val2 = ParcaEkle((PrimitiveType)3, parent, new Vector3(0.105f * s, 0.03f, -0.05f), new Vector3(0.036f, 0.36f * s, 0.022f), koyuDeriMat);
		val2.transform.localRotation = Quaternion.Euler(-8f, 0f, 3f);
	}

	private static GameObject ParcaEkle(PrimitiveType tip, Transform parent, Vector3 pos, Vector3 scale, Material mat)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: 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)
		GameObject val = GameObject.CreatePrimitive(tip);
		Object.Destroy((Object)(object)val.GetComponent<Collider>());
		val.transform.SetParent(parent, false);
		val.transform.localPosition = pos;
		val.transform.localScale = scale;
		val.GetComponent<Renderer>().material = mat;
		return val;
	}

	public static Sprite IkonOlustur(int seviye)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_008f: 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_0096: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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_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_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: 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_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: 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_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: 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_025d: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		if (ikonOnbellek.TryGetValue(seviye, out var value) && (Object)(object)value != (Object)null)
		{
			return value;
		}
		int num = 64;
		Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
		for (int i = 0; i != num; i++)
		{
			for (int j = 0; j != num; j++)
			{
				val.SetPixel(j, i, val2);
			}
		}
		Color val3 = SeviyeRengi(seviye);
		Color val4 = val3 * 0.62f;
		val4.a = 1f;
		Color kenar = Color.Lerp(val3, Color.white, 0.25f);
		Color val5 = SeviyeMetalRengi(seviye);
		Color ic = default(Color);
		((Color)(ref ic))..ctor(0.55f, 0.5f, 0.34f, 1f);
		Color kenar2 = default(Color);
		((Color)(ref kenar2))..ctor(0.36f, 0.32f, 0.2f, 1f);
		KutuCiz(val, 16, 10, 30, 34, val3, val4);
		KutuCiz(val, 15, 34, 32, 11, val4, kenar);
		KutuCiz(val, 22, 14, 18, 12, val4, kenar);
		KutuCiz(val, 21, 12, 3, 32, val4, val4);
		KutuCiz(val, 38, 12, 3, 32, val4, val4);
		KutuCiz(val, 20, 28, 5, 4, val5, val5);
		KutuCiz(val, 37, 28, 5, 4, val5, val5);
		KutuCiz(val, 29, 37, 5, 5, val5, kenar);
		if (seviye != 1)
		{
			int y = ((seviye == 2) ? 4 : 46);
			KutuCiz(val, 13, y, 36, 9, ic, kenar2);
			KutuCiz(val, 20, y, 3, 9, val4, val4);
			KutuCiz(val, 39, y, 3, 9, val4, val4);
		}
		if (seviye > 2)
		{
			KutuCiz(val, 49, 10, 2, 34, val4, val4);
			KutuCiz(val, 44, 41, 12, 3, val5, kenar);
		}
		if (seviye > 4)
		{
			KutuCiz(val, 13, 32, 36, 5, new Color(0.82f, 0.84f, 0.88f, 1f), val4);
		}
		val.Apply();
		Sprite val6 = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f));
		ikonOnbellek[seviye] = val6;
		return val6;
	}

	private static void KutuCiz(Texture2D tex, int x0, int y0, int w, int h, Color ic, Color kenar)
	{
		//IL_004b: 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)
		for (int i = y0; i != y0 + h; i++)
		{
			for (int j = x0; j != x0 + w; j++)
			{
				if (j != 0 && i != 0 && j <= 63 && i <= 63)
				{
					bool flag = j == x0 || j == x0 + w - 1 || i == y0 || i == y0 + h - 1;
					tex.SetPixel(j, i, flag ? kenar : ic);
				}
			}
		}
	}
}
[BepInPlugin("com.lareins.backpack", "Lareins_Backpack", "1.3.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BackpackPlugin : BaseUnityPlugin
{
	public class CantaTanimi
	{
		public int Seviye;

		public string PrefabAdi;

		public string TurkceAd;

		public string Aciklama;

		public int EkSatir;

		public float TemelDayaniklilik;

		public float SeviyeBasiDayaniklilik;

		public string UretimIstasyonu;

		public int IstasyonSeviyesi;

		public Dictionary<string, int> Malzemeler;

		public Dictionary<string, int> YukseltmeMalzemeleri;
	}

	[HarmonyPatch]
	private static class TooltipYama
	{
		private static MethodBase TargetMethod()
		{
			return (from m in typeof(ItemData).GetMethods(BindingFlags.Static | BindingFlags.Public)
				where m.Name == "GetTooltip"
				orderby m.GetParameters().Length descending
				select m).FirstOrDefault();
		}

		private static void Postfix(ItemData item, int qualityLevel, ref string __result)
		{
			if (ModAktif.Value && item != null)
			{
				int num = CantaSeviyesiBul(item);
				if (num != 0)
				{
					CantaTanimi cantaTanimi = Cantalar[num - 1];
					float num2 = KutuBasiAgirlik(qualityLevel);
					int num3 = cantaTanimi.EkSatir * 8;
					float num4 = (float)num3 * num2;
					__result = __result.Replace($"$lareins_bp_{num}", cantaTanimi.TurkceAd);
					__result += $"\n\n<color=orange>Ek Envanter Alani:</color> +{cantaTanimi.EkSatir} Satir ({num3} Kutu)";
					__result += $"\n<color=orange>Kutu Basi Kapasite:</color> +{num2} kg (Kalite {qualityLevel}/5)";
					__result += $"\n<color=green>Toplam Ek Tasima Gucu:</color> +{num4} kg";
					__result += "\n<color=yellow>Kemer ve Pelerin ile ayni anda takilir.</color>";
				}
			}
		}
	}

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

	public const string ModName = "Lareins_Backpack";

	public const string ModVersion = "1.3.2";

	public static ConfigEntry<bool> ModAktif;

	public static readonly List<CantaTanimi> Cantalar = new List<CantaTanimi>
	{
		new CantaTanimi
		{
			Seviye = 1,
			PrefabAdi = "Lareins_Backpack_Lv1",
			TurkceAd = "1. Sv Yolcu Heybesi",
			Aciklama = "Envantere +1 ek satir (8 kutu) ve rulo uyku tulumu saglar. Kemer ve pelerinle ayni anda takilir.",
			EkSatir = 1,
			TemelDayaniklilik = 300f,
			SeviyeBasiDayaniklilik = 150f,
			UretimIstasyonu = "piece_workbench",
			IstasyonSeviyesi = 1,
			Malzemeler = new Dictionary<string, int>
			{
				{ "LeatherScraps", 10 },
				{ "DeerHide", 4 }
			},
			YukseltmeMalzemeleri = new Dictionary<string, int>
			{
				{ "LeatherScraps", 5 },
				{ "DeerHide", 2 }
			}
		},
		new CantaTanimi
		{
			Seviye = 2,
			PrefabAdi = "Lareins_Backpack_Lv2",
			TurkceAd = "2. Sv Deri Sirt Cantasi",
			Aciklama = "Envantere +2 ek satir (16 kutu) ve alt kamp rulosu saglar.",
			EkSatir = 2,
			TemelDayaniklilik = 500f,
			SeviyeBasiDayaniklilik = 200f,
			UretimIstasyonu = "piece_workbench",
			IstasyonSeviyesi = 2,
			Malzemeler = new Dictionary<string, int>
			{
				{ "DeerHide", 10 },
				{ "TrollHide", 4 },
				{ "BoneFragments", 10 }
			},
			YukseltmeMalzemeleri = new Dictionary<string, int>
			{
				{ "DeerHide", 5 },
				{ "TrollHide", 2 }
			}
		},
		new CantaTanimi
		{
			Seviye = 3,
			PrefabAdi = "Lareins_Backpack_Lv3",
			TurkceAd = "3. Sv Kesifci Cantasi",
			Aciklama = "Envantere +3 ek satir (24 kutu), ust kamp mati ve yan kazma askisi saglar.",
			EkSatir = 3,
			TemelDayaniklilik = 750f,
			SeviyeBasiDayaniklilik = 250f,
			UretimIstasyonu = "forge",
			IstasyonSeviyesi = 1,
			Malzemeler = new Dictionary<string, int>
			{
				{ "TrollHide", 8 },
				{ "Bronze", 6 },
				{ "FineWood", 10 }
			},
			YukseltmeMalzemeleri = new Dictionary<string, int>
			{
				{ "TrollHide", 4 },
				{ "Bronze", 3 }
			}
		},
		new CantaTanimi
		{
			Seviye = 4,
			PrefabAdi = "Lareins_Backpack_Lv4",
			TurkceAd = "4. Sv Demir Takviyeli Canta",
			Aciklama = "Envantere +4 ek satir (32 kutu) ve demir cerceveli yuksek kapasite saglar.",
			EkSatir = 4,
			TemelDayaniklilik = 1000f,
			SeviyeBasiDayaniklilik = 300f,
			UretimIstasyonu = "forge",
			IstasyonSeviyesi = 2,
			Malzemeler = new Dictionary<string, int>
			{
				{ "Iron", 10 },
				{ "DeerHide", 12 },
				{ "Root", 4 }
			},
			YukseltmeMalzemeleri = new Dictionary<string, int>
			{
				{ "Iron", 5 },
				{ "DeerHide", 6 }
			}
		},
		new CantaTanimi
		{
			Seviye = 5,
			PrefabAdi = "Lareins_Backpack_Lv5",
			TurkceAd = "5. Sv Gumus & Kurt Kurku Canta",
			Aciklama = "Envantere +5 ek satir (40 kutu) ve soguga dayanikli kurt kurku omuzluk saglar.",
			EkSatir = 5,
			TemelDayaniklilik = 1350f,
			SeviyeBasiDayaniklilik = 350f,
			UretimIstasyonu = "forge",
			IstasyonSeviyesi = 3,
			Malzemeler = new Dictionary<string, int>
			{
				{ "WolfPelt", 10 },
				{ "Silver", 8 },
				{ "WolfFang", 6 }
			},
			YukseltmeMalzemeleri = new Dictionary<string, int>
			{
				{ "WolfPelt", 5 },
				{ "Silver", 4 }
			}
		},
		new CantaTanimi
		{
			Seviye = 6,
			PrefabAdi = "Lareins_Backpack_Lv6",
			TurkceAd = "6. Sv Siyah Metal & Lox Cantasi",
			Aciklama = "Envantere +6 ek satir (48 kutu) ve maksimum tasima kapasitesi saglar.",
			EkSatir = 6,
			TemelDayaniklilik = 1800f,
			SeviyeBasiDayaniklilik = 450f,
			UretimIstasyonu = "forge",
			IstasyonSeviyesi = 4,
			Malzemeler = new Dictionary<string, int>
			{
				{ "LoxPelt", 10 },
				{ "BlackMetal", 12 },
				{ "LinenThread", 15 }
			},
			YukseltmeMalzemeleri = new Dictionary<string, int>
			{
				{ "LoxPelt", 5 },
				{ "BlackMetal", 6 }
			}
		}
	};

	private static GameObject cantaHavuzu;

	private static GameObject aktifSirtModeli;

	private static int aktifSirtSeviyesi = 0;

	private static float varsayilanPanelAltOffset = float.NaN;

	private static int sonGuncellenenSatir = -1;

	private void Awake()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		ModAktif = ((BaseUnityPlugin)this).Config.Bind<bool>("Genel", "ModAktif", true, "6 seviyeli 3D sirt cantasi ve envanter genisletme sistemini acar");
		CorePlugin.AyarEkle("Sirt Cantasi (6 Sv)", "Mod Aktif", "6 seviyeli 3D sirt cantasi ve ek envanter satirlarini acar.", ModAktif);
		new Harmony("com.lareins.backpack").PatchAll(typeof(BackpackPlugin));
		new Harmony("com.lareins.backpack.tooltip").PatchAll(typeof(TooltipYama));
	}

	public static float KutuBasiAgirlik(int quality)
	{
		return quality switch
		{
			1 => 10f, 
			2 => 11f, 
			3 => 13f, 
			4 => 16f, 
			_ => 20f, 
		};
	}

	public static int CantaSeviyesiBul(ItemData item)
	{
		if (item == null)
		{
			return 0;
		}
		string text = (((Object)(object)item.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name : "");
		if (text.StartsWith("Lareins_Backpack_Lv") && int.TryParse(text.Replace("Lareins_Backpack_Lv", ""), out var result))
		{
			return result;
		}
		if (item.m_shared != null && item.m_shared.m_name != null && item.m_shared.m_name.StartsWith("$lareins_bp_") && int.TryParse(item.m_shared.m_name.Replace("$lareins_bp_", ""), out var result2))
		{
			return result2;
		}
		return 0;
	}

	public static ItemData KusaniilmisCantayiBul(Player p)
	{
		if ((Object)(object)p == (Object)null || ((Humanoid)p).GetInventory() == null)
		{
			return null;
		}
		foreach (ItemData allItem in ((Humanoid)p).GetInventory().GetAllItems())
		{
			if (allItem != null && CantaSeviyesiBul(allItem) > 0 && allItem.m_equipped)
			{
				return allItem;
			}
		}
		return null;
	}

	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	[HarmonyPrefix]
	private static void DunyaAcilirkenCantalariHazirla(ZNetScene __instance)
	{
		if (ModAktif.Value && !((Object)(object)__instance == (Object)null) && !((Object)(object)ObjectDB.instance == (Object)null))
		{
			CantalariKaydet(ObjectDB.instance, __instance);
		}
	}

	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	[HarmonyPostfix]
	private static void ObjectDBCantaKaydet(ObjectDB __instance)
	{
		if (ModAktif.Value && !((Object)(object)__instance == (Object)null) && !((Object)(object)ZNetScene.instance == (Object)null))
		{
			CantalariKaydet(__instance, ZNetScene.instance);
		}
	}

	private static void CantalariKaydet(ObjectDB odb, ZNetScene zns)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Expected O, but got Unknown
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: 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_032d: Expected O, but got Unknown
		GameObject val = odb.GetItemPrefab("CapeDeerHide") ?? odb.GetItemPrefab("BeltStrength");
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		if ((Object)(object)cantaHavuzu == (Object)null)
		{
			cantaHavuzu = new GameObject("Lareins_Backpack_Prefabs");
			cantaHavuzu.SetActive(false);
			Object.DontDestroyOnLoad((Object)(object)cantaHavuzu);
		}
		Dictionary<int, GameObject> value = Traverse.Create((object)zns).Field("m_namedPrefabs").GetValue<Dictionary<int, GameObject>>();
		Dictionary<int, GameObject> value2 = Traverse.Create((object)odb).Field("m_itemByHash").GetValue<Dictionary<int, GameObject>>();
		foreach (CantaTanimi item in Cantalar)
		{
			GameObject val2 = odb.GetItemPrefab(item.PrefabAdi);
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = Object.Instantiate<GameObject>(val, cantaHavuzu.transform);
				((Object)val2).name = item.PrefabAdi;
				ItemDrop component = val2.GetComponent<ItemDrop>();
				component.m_itemData.m_dropPrefab = val2;
				SharedData shared = component.m_itemData.m_shared;
				shared.m_name = $"$lareins_bp_{item.Seviye}";
				shared.m_description = item.Aciklama;
				shared.m_itemType = (ItemType)16;
				shared.m_equipDuration = 0.5f;
				shared.m_maxStackSize = 1;
				shared.m_maxQuality = 5;
				shared.m_weight = 2f + (float)item.Seviye * 0.5f;
				shared.m_useDurability = true;
				shared.m_maxDurability = item.TemelDayaniklilik;
				shared.m_durabilityPerLevel = item.SeviyeBasiDayaniklilik;
				shared.m_armor = 0f;
				shared.m_armorPerLevel = 0f;
				shared.m_movementModifier = 0f;
				shared.m_setName = "";
				shared.m_setSize = 0;
				shared.m_setStatusEffect = null;
				shared.m_equipStatusEffect = null;
				shared.m_icons = (Sprite[])(object)new Sprite[1] { BackpackAssets.IkonOlustur(item.Seviye) };
				odb.m_items.Add(val2);
				Recipe val3 = ScriptableObject.CreateInstance<Recipe>();
				((Object)val3).name = "Recipe_" + item.PrefabAdi;
				val3.m_item = component;
				val3.m_amount = 1;
				val3.m_enabled = true;
				val3.m_minStationLevel = item.IstasyonSeviyesi;
				GameObject prefab = zns.GetPrefab(item.UretimIstasyonu);
				if ((Object)(object)prefab != (Object)null)
				{
					val3.m_craftingStation = prefab.GetComponent<CraftingStation>();
				}
				List<Requirement> list = new List<Requirement>();
				foreach (KeyValuePair<string, int> item2 in item.Malzemeler)
				{
					GameObject itemPrefab = odb.GetItemPrefab(item2.Key);
					if (!((Object)(object)itemPrefab == (Object)null))
					{
						int amountPerLevel = (item.YukseltmeMalzemeleri.ContainsKey(item2.Key) ? item.YukseltmeMalzemeleri[item2.Key] : 2);
						list.Add(new Requirement
						{
							m_resItem = itemPrefab.GetComponent<ItemDrop>(),
							m_amount = item2.Value,
							m_amountPerLevel = amountPerLevel,
							m_recover = true
						});
					}
				}
				val3.m_resources = list.ToArray();
				odb.m_recipes.Add(val3);
			}
			int stableHashCode = StringExtensionMethods.GetStableHashCode(item.PrefabAdi);
			if (value2 != null)
			{
				value2[stableHashCode] = val2;
			}
			if (!zns.m_prefabs.Contains(val2))
			{
				zns.m_prefabs.Add(val2);
			}
			if (value != null)
			{
				value[stableHashCode] = val2;
			}
		}
		TurkceIsimleriKaydet();
	}

	private static void TurkceIsimleriKaydet()
	{
		Type type = AccessTools.TypeByName("Localization");
		if (type == null)
		{
			return;
		}
		object value = Traverse.Create(type).Property("instance", (object[])null).GetValue();
		if (value == null)
		{
			return;
		}
		Dictionary<string, string> value2 = Traverse.Create(value).Field("m_translations").GetValue<Dictionary<string, string>>();
		if (value2 == null)
		{
			return;
		}
		foreach (CantaTanimi item in Cantalar)
		{
			value2[$"lareins_bp_{item.Seviye}"] = item.TurkceAd;
		}
	}

	[HarmonyPatch(typeof(InventoryGui), "DoCrafting")]
	[HarmonyPrefix]
	private static bool CantaUretimGaranti(InventoryGui __instance, Player player)
	{
		//IL_01b6: 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_01c9: 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)
		if (!ModAktif.Value || (Object)(object)__instance == (Object)null || (Object)(object)player == (Object)null)
		{
			return true;
		}
		Recipe value = Traverse.Create((object)__instance).Field("m_craftRecipe").GetValue<Recipe>();
		if ((Object)(object)value == (Object)null || (Object)(object)value.m_item == (Object)null)
		{
			return true;
		}
		if (CantaSeviyesiBul(value.m_item.m_itemData) == 0)
		{
			return true;
		}
		ItemData value2 = Traverse.Create((object)__instance).Field("m_craftUpgradeItem").GetValue<ItemData>();
		int num = ((value2 == null) ? 1 : (value2.m_quality + 1));
		if (!player.NoCostCheat() && !player.HaveRequirements(value, false, num, 1))
		{
			return false;
		}
		if (value2 != null)
		{
			value2.m_quality = num;
			value2.m_durability = value2.GetMaxDurability();
		}
		else
		{
			if (!((Humanoid)player).GetInventory().HaveEmptySlot())
			{
				((Character)player).Message((MessageType)2, "Envanterde bos yer yok!", 0, (Sprite)null, false);
				return false;
			}
			ItemData val = value.m_item.m_itemData.Clone();
			val.m_dropPrefab = ((Component)value.m_item).gameObject;
			val.m_quality = 1;
			val.m_durability = val.GetMaxDurability();
			((Humanoid)player).GetInventory().AddItem(val);
		}
		if (!player.NoCostCheat())
		{
			player.ConsumeResources(value.m_resources, num, -1, 1);
		}
		EffectList value3 = Traverse.Create((object)__instance).Field("m_craftEffects").GetValue<EffectList>();
		if (value3 != null)
		{
			value3.Create(((Component)player).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID));
		}
		Traverse.Create((object)__instance).Method("UpdateCraftingPanel", new object[1] { false }).GetValue();
		return false;
	}

	[HarmonyPatch(typeof(Humanoid), "UseItem")]
	[HarmonyPrefix]
	private static bool CantaKusanVeyaCikar(Humanoid __instance, Inventory inventory, ItemData item)
	{
		if (!ModAktif.Value || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || item == null)
		{
			return true;
		}
		if (CantaSeviyesiBul(item) == 0)
		{
			return true;
		}
		if (item.m_equipped)
		{
			Player val = (Player)(object)((__instance is Player) ? __instance : null);
			if ((Object)(object)val != (Object)null && AltSatirlardaEsyaVarMi(((Humanoid)val).GetInventory(), 4))
			{
				((Character)val).Message((MessageType)2, "Cantayi cikarmak icin once ek satirlardaki esyalari bosaltin!", 0, (Sprite)null, false);
				return false;
			}
			item.m_equipped = false;
		}
		else
		{
			foreach (ItemData allItem in inventory.GetAllItems())
			{
				if (allItem != item && CantaSeviyesiBul(allItem) > 0 && allItem.m_equipped)
				{
					allItem.m_equipped = false;
				}
			}
			item.m_equipped = true;
		}
		EnvanterBoyutunuGuncelle((Player)(object)((__instance is Player) ? __instance : null));
		ZSyncAnimation component = ((Component)__instance).GetComponent<ZSyncAnimation>();
		if (component != null)
		{
			component.SetTrigger("equip_hip");
		}
		return false;
	}

	private static bool AltSatirlardaEsyaVarMi(Inventory env, int normalSatirSayisi)
	{
		if (env == null)
		{
			return false;
		}
		foreach (ItemData allItem in env.GetAllItems())
		{
			if (allItem != null && allItem.m_gridPos.y > normalSatirSayisi - 1)
			{
				return true;
			}
		}
		return false;
	}

	private static void EnvanterBoyutunuGuncelle(Player p)
	{
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)p == (Object)null || ((Humanoid)p).GetInventory() == null)
		{
			return;
		}
		ItemData val = KusaniilmisCantayiBul(p);
		int num = 0;
		if (val != null)
		{
			int num2 = CantaSeviyesiBul(val);
			if (num2 > 0)
			{
				num = Cantalar[num2 - 1].EkSatir;
			}
		}
		int num3 = 4 + num;
		Inventory inventory = ((Humanoid)p).GetInventory();
		if (inventory.GetHeight() != num3)
		{
			inventory.SetHeight(num3);
		}
		if (!((Object)(object)InventoryGui.instance != (Object)null) || !((Object)(object)InventoryGui.instance.m_playerGrid != (Object)null))
		{
			return;
		}
		if (sonGuncellenenSatir != num3)
		{
			sonGuncellenenSatir = num3;
			InventoryGui.instance.m_playerGrid.UpdateInventory(inventory, p, (ItemData)null);
		}
		RectTransform player = InventoryGui.instance.m_player;
		if ((Object)(object)player != (Object)null)
		{
			if (float.IsNaN(varsayilanPanelAltOffset))
			{
				varsayilanPanelAltOffset = player.offsetMin.y;
			}
			float num4 = InventoryGui.instance.m_playerGrid.m_elementSpace;
			if (num4 <= 10f)
			{
				num4 = 70f;
			}
			Vector2 offsetMin = player.offsetMin;
			float num5 = varsayilanPanelAltOffset - (float)num * num4;
			if (Mathf.Abs(offsetMin.y - num5) > 0.5f)
			{
				offsetMin.y = num5;
				player.offsetMin = offsetMin;
			}
		}
	}

	[HarmonyPatch(typeof(Player), "GetMaxCarryWeight")]
	[HarmonyPostfix]
	private static void MaksimumAgirlikEkle(Player __instance, ref float __result)
	{
		if (!ModAktif.Value || (Object)(object)__instance == (Object)null)
		{
			return;
		}
		ItemData val = KusaniilmisCantayiBul(__instance);
		if (val != null)
		{
			int num = CantaSeviyesiBul(val);
			if (num > 0)
			{
				int num2 = Cantalar[num - 1].EkSatir * 8;
				float num3 = KutuBasiAgirlik(val.m_quality);
				__result += (float)num2 * num3;
			}
		}
	}

	private static Transform SirtKemigiBul(Transform kok)
	{
		Transform[] componentsInChildren = ((Component)kok).GetComponentsInChildren<Transform>(true);
		foreach (Transform val in componentsInChildren)
		{
			if (((Object)val).name == "Spine2" || ((Object)val).name == "Spine1")
			{
				return val;
			}
		}
		return kok;
	}

	[HarmonyPatch(typeof(Player), "Update")]
	[HarmonyPostfix]
	private static void SirtModeliniGuncelle(Player __instance)
	{
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		if (!ModAktif.Value || (Object)(object)__instance != (Object)(object)Player.m_localPlayer)
		{
			return;
		}
		EnvanterBoyutunuGuncelle(__instance);
		ItemData val = KusaniilmisCantayiBul(__instance);
		int num = ((val != null) ? CantaSeviyesiBul(val) : 0);
		if (num != aktifSirtSeviyesi)
		{
			aktifSirtSeviyesi = num;
			if ((Object)(object)aktifSirtModeli != (Object)null)
			{
				Object.Destroy((Object)(object)aktifSirtModeli);
				aktifSirtModeli = null;
			}
			if (num > 0)
			{
				Transform sirtKemigi = SirtKemigiBul(((Component)__instance).transform);
				aktifSirtModeli = BackpackAssets.SirtModeliOlustur(num, sirtKemigi);
			}
		}
		if (val != null)
		{
			Vector3 velocity = ((Character)__instance).GetVelocity();
			if (((Vector3)(ref velocity)).magnitude > 1f && val.m_durability > 0f)
			{
				val.m_durability = Mathf.Max(0f, val.m_durability - Time.deltaTime * 0.05f);
			}
		}
	}

	[HarmonyPatch(typeof(Inventory), "Load", new Type[]
	{
		typeof(ZPackage),
		typeof(bool)
	})]
	[HarmonyPostfix]
	private static void YuklemedeCantaYuksekliginiKoru(Inventory __instance)
	{
		if (!ModAktif.Value || __instance == null)
		{
			return;
		}
		foreach (ItemData allItem in __instance.GetAllItems())
		{
			if (allItem != null && CantaSeviyesiBul(allItem) > 0 && allItem.m_equipped)
			{
				int num = CantaSeviyesiBul(allItem);
				int num2 = 4 + Cantalar[num - 1].EkSatir;
				if (__instance.GetHeight() < num2)
				{
					__instance.SetHeight(num2);
				}
				break;
			}
		}
	}
}