Decompiled source of balrond containers v1.2.9

plugins/BalrondContainers.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
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("RainbowTrollArmor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RainbowTrollArmor")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f405ea1c-ac25-47a3-9aa2-a8f56c14bfd6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BalrondContainers;

public class FxReplacment
{
	private List<GameObject> allPrefabs;

	public void setInstance(List<GameObject> gameObjects)
	{
		allPrefabs = gameObjects;
	}

	public void ReplaceFxOnPiece(GameObject gameObject)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			Debug.LogWarning((object)"BALROND CONTAINERS: GameObject not found");
			return;
		}
		Piece component = gameObject.GetComponent<Piece>();
		if ((Object)(object)component != (Object)null)
		{
			EffectList placeEffect = component.m_placeEffect;
			if (placeEffect != null)
			{
				findEffectsAndChange(placeEffect.m_effectPrefabs);
			}
		}
		WearNTear component2 = gameObject.GetComponent<WearNTear>();
		if ((Object)(object)component2 != (Object)null)
		{
			EffectList hitEffect = component2.m_hitEffect;
			if (hitEffect != null)
			{
				findEffectsAndChange(hitEffect.m_effectPrefabs);
			}
		}
	}

	private void findEffectsAndChange(EffectData[] effects)
	{
		if (effects == null || effects.Length == 0)
		{
			Debug.LogError((object)"BALROND CONTAINERS: Effects in Method are empty");
			return;
		}
		foreach (EffectData val in effects)
		{
			if ((Object)(object)val.m_prefab != (Object)null)
			{
				string name = ((Object)val.m_prefab).name;
				GameObject val2 = allPrefabs.Find((GameObject x) => ((Object)x).name == name);
				if ((Object)(object)val2 == (Object)null)
				{
					Debug.LogWarning((object)("BALROND CONTAINERS: Replace Effect not found: " + name));
				}
				else
				{
					val.m_prefab = val2;
				}
			}
		}
	}
}
[BepInPlugin("balrond.astafaraios.BalrondContainers", "BalrondContainers", "1.2.9")]
public class Launch : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	public static class ZNetScene_Awake_Path
	{
		public static void Prefix(ZNetScene __instance)
		{
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null)
			{
				Debug.LogWarning((object)"BALROND CONTAINERS: No ZnetScene found");
				return;
			}
			GameObject val = FindItem(__instance.m_prefabs, "Hammer");
			List<GameObject> pieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces.m_pieces;
			fxReplacment.setInstance(__instance.m_prefabs);
			foreach (GameObject item in prefabs)
			{
				editBuildPiece(__instance.m_prefabs, item);
				fxReplacment.ReplaceFxOnPiece(item);
				GameObject val2 = __instance.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)item).name);
				if ((Object)(object)val2 == (Object)null)
				{
					__instance.m_prefabs.Add(item);
				}
				GameObject val3 = pieces.Find((GameObject x) => ((Object)x).name == ((Object)item).name);
				if ((Object)(object)val3 == (Object)null)
				{
					pieces.Add(item);
				}
			}
			if (!new ZNet().IsDedicated())
			{
				ShaderReplacment.runMaterialFix();
			}
		}
	}

	private readonly Harmony harmony = new Harmony("balrond.astafaraios.BalrondContainers");

	public const string PluginGUID = "balrond.astafaraios.BalrondContainers";

	public const string PluginName = "BalrondContainers";

	public const string PluginVersion = "1.2.9";

	public static AssetBundle assetBundle;

	public static List<GameObject> prefabs = new List<GameObject>();

	public static FxReplacment fxReplacment = new FxReplacment();

	public static GameObject barrel;

	public static GameObject seedbasket;

	public static GameObject fabricShelf;

	public static GameObject shelf;

	public static GameObject shed;

	public static GameObject basket;

	public static GameObject trough;

	public static GameObject locker;

	public static GameObject table;

	public static GameObject table2;

	public static GameObject table3;

	public static GameObject table4;

	public static GameObject weaponrack;

	private void Awake()
	{
		assetBundle = GetAssetBundleFromResources("balrondcontainers");
		loadAssets();
		harmony.PatchAll();
	}

	private void loadAssets()
	{
		string text = "Assets/Custom/Containers/Prefabs/";
		weaponrack = assetBundle.LoadAsset<GameObject>(text + "piece_chest_weaponrack.prefab");
		ShaderReplacment.Replace(weaponrack);
		TopContainer topContainer = weaponrack.AddComponent<TopContainer>();
		topContainer.slotAmount = 6;
		prefabs.Add(weaponrack);
		barrel = assetBundle.LoadAsset<GameObject>(text + "piece_chest_barrel_bal.prefab");
		ShaderReplacment.Replace(barrel);
		barrel.AddComponent<TopFood>();
		prefabs.Add(barrel);
		table = assetBundle.LoadAsset<GameObject>(text + "piece_chest_foodtable.prefab");
		ShaderReplacment.Replace(table);
		TopContainer topContainer2 = table.AddComponent<TopContainer>();
		topContainer2.slotAmount = 10;
		prefabs.Add(table);
		table2 = assetBundle.LoadAsset<GameObject>(text + "piece_chest_foodtable_oak.prefab");
		ShaderReplacment.Replace(table2);
		TopContainer topContainer3 = table2.AddComponent<TopContainer>();
		topContainer3.slotAmount = 12;
		prefabs.Add(table2);
		table3 = assetBundle.LoadAsset<GameObject>(text + "piece_chest_foodtable_round.prefab");
		ShaderReplacment.Replace(table3);
		TopContainer topContainer4 = table3.AddComponent<TopContainer>();
		topContainer4.slotAmount = 8;
		prefabs.Add(table3);
		table4 = assetBundle.LoadAsset<GameObject>(text + "piece_chest_foodtable_fine.prefab");
		ShaderReplacment.Replace(table4);
		TopContainer topContainer5 = table4.AddComponent<TopContainer>();
		topContainer5.slotAmount = 4;
		prefabs.Add(table4);
		fabricShelf = assetBundle.LoadAsset<GameObject>(text + "piece_chest_fabricshelf_bal.prefab");
		ShaderReplacment.Replace(fabricShelf);
		TopContainer topContainer6 = fabricShelf.AddComponent<TopContainer>();
		topContainer6.slotAmount = 9;
		prefabs.Add(fabricShelf);
		seedbasket = assetBundle.LoadAsset<GameObject>(text + "piece_chest_seedbasket_bal.prefab");
		Transform val = seedbasket.transform.Find("piece_chest_barrel_bal");
		if ((Object)(object)val != (Object)null)
		{
			Object.DestroyImmediate((Object)(object)((Component)val).gameObject);
		}
		ShaderReplacment.Replace(seedbasket);
		seedbasket.AddComponent<TopFood>();
		prefabs.Add(seedbasket);
		shelf = assetBundle.LoadAsset<GameObject>(text + "piece_chest_shelf_bal.prefab");
		ShaderReplacment.Replace(shelf);
		shelf.AddComponent<TopPotion>();
		prefabs.Add(shelf);
		shed = assetBundle.LoadAsset<GameObject>(text + "piece_chest_woodshed_bal.prefab");
		ShaderReplacment.Replace(shed);
		TopContainer topContainer7 = shed.AddComponent<TopContainer>();
		topContainer7.slotAmount = 28;
		prefabs.Add(shed);
		basket = assetBundle.LoadAsset<GameObject>(text + "piece_chest_rockshed_bal.prefab");
		ShaderReplacment.Replace(basket);
		TopContainer topContainer8 = basket.AddComponent<TopContainer>();
		topContainer8.slotAmount = 24;
		prefabs.Add(basket);
		trough = assetBundle.LoadAsset<GameObject>(text + "piece_chest_trough_bal.prefab");
		ShaderReplacment.Replace(trough);
		TopContainer topContainer9 = trough.AddComponent<TopContainer>();
		topContainer9.slotAmount = 3;
		prefabs.Add(trough);
		locker = assetBundle.LoadAsset<GameObject>(text + "piece_chest_metalshed_bal.prefab");
		ShaderReplacment.Replace(locker);
		TopContainer topContainer10 = locker.AddComponent<TopContainer>();
		topContainer10.slotAmount = 24;
		prefabs.Add(locker);
	}

	private void OnDestroy()
	{
		harmony.UnpatchSelf();
	}

	private static bool IsObjectDBValid()
	{
		return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null;
	}

	public static AssetBundle GetAssetBundleFromResources(string filename)
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename));
		using Stream stream = executingAssembly.GetManifestResourceStream(name);
		return AssetBundle.LoadFromStream(stream);
	}

	private static GameObject FindItem(List<GameObject> list, string name)
	{
		GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		Debug.LogWarning((object)"BALROND CONTAINERS: Item Not Found");
		return null;
	}

	public static CraftingStation FindStation(List<GameObject> list, string name)
	{
		GameObject val = FindItem(list, name);
		if ((Object)(object)val != (Object)null)
		{
			return val.GetComponent<CraftingStation>();
		}
		return null;
	}

	public static void editBuildPiece(List<GameObject> buildPieces, GameObject gameObject)
	{
		Piece component = gameObject.GetComponent<Piece>();
		component.m_enabled = true;
		createResourceFor(((Object)gameObject).name, component, buildPieces);
	}

	public static Requirement createReq(string name, int amount)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		Requirement val = new Requirement();
		val.m_resItem = FindItem(ObjectDB.instance.m_items, name).GetComponent<ItemDrop>();
		val.m_amount = amount;
		val.m_recover = true;
		val.m_amountPerLevel = amount;
		return val;
	}

	public static void createResourceFor(string prefabName, Piece piece, List<GameObject> buildPieces)
	{
		//IL_0452: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0889: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0770: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_054e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0648: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_072a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		List<Requirement> list = new List<Requirement>();
		switch (prefabName)
		{
		case "piece_chest_weaponrack":
			piece.m_name = "Visual weapon shelf";
			piece.m_description = "Will display each weapon and tool per slot.(Dose nto support shields)";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("RoundLog", 15));
			list.Add(createReq("Chain", 2));
			list.Add(createReq("BronzeNails", 12));
			list.Add(createReq("Iron", 2));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_fabricshelf_bal":
			piece.m_name = "Visual fabric shelf";
			piece.m_description = "Will display leather and fabric put inside per slot.";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("RoundLog", 8));
			list.Add(createReq("Copper", 2));
			list.Add(createReq("BronzeNails", 12));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_foodtable":
			piece.m_name = "Visual food table";
			piece.m_description = "Will display food on each slot presented on a plate. 10 slot";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("FineWood", 6));
			list.Add(createReq("RoundLog", 20));
			list.Add(createReq("Copper", 4));
			list.Add(createReq("BronzeNails", 22));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_foodtable_oak":
			piece.m_name = "Visual food table";
			piece.m_description = "Will display food on each slot presented on a plate. And has a nice candle light 12 slot";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("FineWood", 30));
			list.Add(createReq("Copper", 8));
			list.Add(createReq("Tar", 3));
			list.Add(createReq("IronNails", 40));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_foodtable_round":
			piece.m_name = "Visual food table";
			piece.m_description = "Will display food on each slot presented on a plate. 8 slot";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("FineWood", 20));
			list.Add(createReq("Copper", 4));
			list.Add(createReq("Tar", 3));
			list.Add(createReq("IronNails", 40));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_foodtable_fine":
			piece.m_name = "Visual food table";
			piece.m_description = "Will display food on each slot presented on a plate. 4 slot";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("FineWood", 10));
			list.Add(createReq("BronzeNails", 10));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_barrel_bal":
			piece.m_name = "Visual barrel";
			piece.m_description = "Will display on top one of items put inside.";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("RoundLog", 10));
			list.Add(createReq("Copper", 4));
			list.Add(createReq("BronzeNails", 10));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_seedbasket_bal":
			piece.m_name = "Visual basket";
			piece.m_description = "Will display on top one of items put inside. Focus on seeds and vegetables!";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("Wood", 8));
			list.Add(createReq("BeechSeeds", 6));
			list.Add(createReq("LeatherScraps", 6));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_shelf_bal":
			piece.m_name = "Visual Shelf";
			piece.m_description = "Will display each elixir put inside per slot";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("FineWood", 6));
			list.Add(createReq("Wood", 6));
			list.Add(createReq("Copper", 2));
			list.Add(createReq("BronzeNails", 12));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_woodshed_bal":
			piece.m_name = "Visual woodshed";
			piece.m_description = "Will display each wood stack put inside";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			piece.m_category = (PieceCategory)4;
			list.Clear();
			list.Add(createReq("RoundLog", 20));
			list.Add(createReq("FineWood", 15));
			list.Add(createReq("LeatherScraps", 10));
			list.Add(createReq("IronNails", 20));
			piece.m_category = (PieceCategory)4;
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_rockshed_bal":
			piece.m_name = "Visual Ore Basket";
			piece.m_description = "Will display each rock stack and ore inside. Scrap is not Ore!";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			list.Clear();
			piece.m_category = (PieceCategory)4;
			list.Add(createReq("RoundLog", 20));
			list.Add(createReq("Stone", 10));
			list.Add(createReq("Iron", 2));
			list.Add(createReq("BronzeNails", 40));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_trough_bal":
			piece.m_name = "Visual trough";
			piece.m_description = "Will display animal food put inside";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			piece.m_category = (PieceCategory)4;
			list.Clear();
			list.Add(createReq("RoundLog", 3));
			list.Add(createReq("Wood", 3));
			list.Add(createReq("FineWood", 3));
			list.Add(createReq("BronzeNails", 12));
			piece.m_resources = list.ToArray();
			break;
		case "piece_chest_metalshed_bal":
			piece.m_name = "Visual metal shelf";
			piece.m_description = "Will display 2 metal bars for each stack inside";
			piece.m_craftingStation = FindStation(buildPieces, "piece_workbench");
			piece.m_category = (PieceCategory)4;
			list.Clear();
			list.Add(createReq("RoundLog", 12));
			list.Add(createReq("Stone", 30));
			list.Add(createReq("Iron", 4));
			list.Add(createReq("BronzeNails", 20));
			piece.m_resources = list.ToArray();
			break;
		}
	}
}
public class RestrictionService
{
	public static Dictionary<string, HashSet<string>> restrictions = new Dictionary<string, HashSet<string>>();

	public void setupConfig()
	{
		string[] array = new string[4] { "piece_chest_metalshed_bal", "piece_chest_fabricshelf_bal", "piece_chest_woodshed_bal", "piece_chest_shelf_bal" };
		string[] array2 = array;
		foreach (string name in array2)
		{
			createRestrictions(name);
		}
	}

	public static bool ShouldRemoveItem(Inventory __instance, ItemData item)
	{
		if (__instance == null || item == null)
		{
			return false;
		}
		return CanAddItem(__instance, item);
	}

	public static bool CanAddItem(Inventory inventory, ItemData item)
	{
		if (inventory == null || item == null)
		{
			return false;
		}
		if (inventory.m_name == null && !inventoryRestricted(inventory.m_name))
		{
			return true;
		}
		if (isItemAllowed(item, inventory.m_name))
		{
			return true;
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null)
		{
			return false;
		}
		((Character)localPlayer).Message((MessageType)2, "Restricted Item!", 0, (Sprite)null);
		return false;
	}

	public static bool inventoryRestricted(string name)
	{
		HashSet<string> hashSet = restrictions[name];
		if (hashSet == null)
		{
			return false;
		}
		return true;
	}

	public static bool isItemAllowed(ItemData itemData, string containerName)
	{
		return getIsItemAllowed(((Object)itemData.m_dropPrefab).name, containerName);
	}

	private static bool getIsItemAllowed(string itemName, string containerName)
	{
		return restrictions[containerName]?.Contains(itemName) ?? true;
	}

	private void createRestrictions(string name)
	{
		HashSet<string> hashSet = new HashSet<string>();
		switch (name)
		{
		case "piece_chest_metalshed_bal":
			hashSet.Clear();
			hashSet.Add("Copper");
			hashSet.Add("Tin");
			hashSet.Add("Silver");
			hashSet.Add("Bronze");
			hashSet.Add("BlackMetal");
			hashSet.Add("Flametal");
			hashSet.Add("FlametalNew");
			hashSet.Add("Cobalt_bal");
			hashSet.Add("DarkSteel_bal");
			hashSet.Add("MoltenSteel_bal");
			hashSet.Add("BellMetal_bal");
			hashSet.Add("Amethyst_bal");
			hashSet.Add("Frosteel_bal");
			hashSet.Add("Electrum_bal");
			hashSet.Add("GoldBar_bal");
			hashSet.Add("ClayBrick_bal");
			hashSet.Add("WhiteMetal_bal");
			hashSet.Add("Ferroboron_bal");
			restrictions.Add(name, hashSet);
			break;
		case "piece_chest_fabricshelf_bal":
			hashSet.Clear();
			hashSet.Add("LeatherScraps");
			hashSet.Add("AskHide");
			hashSet.Add("BearFur_bal");
			hashSet.Add("DeerHide");
			hashSet.Add("BoarHide_bal");
			hashSet.Add("NorthernFur_bal");
			hashSet.Add("NeckSkin_bal");
			hashSet.Add("FoxFur_bal");
			hashSet.Add("DrakeSkin_bal");
			hashSet.Add("BlackSkin_bal");
			hashSet.Add("TrollHide");
			hashSet.Add("WolfPelt");
			hashSet.Add("LoxPelt");
			hashSet.Add("ScaleHide");
			hashSet.Add("JuteRed");
			hashSet.Add("JuteBlue");
			hashSet.Add("LinenThread");
			hashSet.Add("StrawThread_bal");
			hashSet.Add("SilkReinforcedThread_bal");
			restrictions.Add(name, hashSet);
			break;
		case "piece_chest_woodshed_bal":
			hashSet.Clear();
			hashSet.Add("Wood");
			hashSet.Add("RoundLog");
			hashSet.Add("Blackwood");
			hashSet.Add("HardWood_bal");
			hashSet.Add("FineWood");
			hashSet.Add("YggdrasilWood");
			hashSet.Add("CrystalWood_bal");
			restrictions.Add(name, hashSet);
			break;
		case "piece_chest_rockshed_bal":
			hashSet.Clear();
			hashSet.Add("Coal");
			hashSet.Add("Stone");
			hashSet.Add("Flint");
			hashSet.Add("Grausten");
			hashSet.Add("BlackMarble");
			hashSet.Add("CopperOre");
			hashSet.Add("TinOre");
			hashSet.Add("SilverOre");
			hashSet.Add("BronzeOre");
			hashSet.Add("BlackMetalOre_bal");
			hashSet.Add("FlametalOre");
			hashSet.Add("FlametalOreNew");
			hashSet.Add("CobaltOre_bal");
			hashSet.Add("DarkIron_bal");
			hashSet.Add("Electrum_bal");
			hashSet.Add("Clay_bal");
			hashSet.Add("GoldOre_bal");
			hashSet.Add("MagmaStone_bal");
			restrictions.Add(name, hashSet);
			break;
		case "piece_chest_shelf_bal":
			hashSet.Clear();
			hashSet.Add("PhilosopherStoneRed");
			hashSet.Add("PhilosopherStonePurple");
			hashSet.Add("PhilosopherStoneGreen");
			hashSet.Add("PhilosopherStoneBlue");
			hashSet.Add("PhilosopherStoneBlack");
			hashSet.Add("Lesser_Stamina_Vial");
			hashSet.Add("Lesser_Spiritual_Healing_Vial");
			hashSet.Add("Lesser_Healing_Tide_Vial");
			hashSet.Add("Potion_Meadbase");
			hashSet.Add("Medium_Stamina_Flask");
			hashSet.Add("Medium_Spiritual_Healing_Flask");
			hashSet.Add("Medium_Healing_Tide_Flask");
			hashSet.Add("Grand_Stamina_Elixir");
			hashSet.Add("Grand_Stealth_Elixir");
			hashSet.Add("Grand_Stamina_Elixir");
			hashSet.Add("Grand_Spiritual_Healing_Potion");
			hashSet.Add("Grand_Healing_Tide_Potion");
			hashSet.Add("Flask_of_the_God");
			hashSet.Add("Flask_of_Second_Wind");
			hashSet.Add("Flask_of_Magelight");
			hashSet.Add("Flask_of_Fortification");
			hashSet.Add("Flask_of_Elements");
			hashSet.Add("BarleyWine");
			hashSet.Add("MeadEitrMinor");
			hashSet.Add("MeadStaminaMinor");
			hashSet.Add("MeadBaseEitrMinor");
			hashSet.Add("MeadBaseFrostResist");
			hashSet.Add("MeadBaseHealthMajor");
			hashSet.Add("MeadBaseHealthMedium");
			hashSet.Add("MeadBaseHealthMinor");
			hashSet.Add("MeadBasePoisonResist");
			hashSet.Add("MeadBaseStaminaLingering");
			hashSet.Add("MeadBaseStaminaMedium");
			hashSet.Add("MeadBaseStaminaMinor");
			hashSet.Add("MeadTasty");
			hashSet.Add("MeadStaminaMedium");
			hashSet.Add("MeadFrostResist");
			hashSet.Add("MeadHealthMinor");
			hashSet.Add("MeadHealthMedium");
			hashSet.Add("MeadPoisonResist");
			hashSet.Add("MeadHealthMajor");
			hashSet.Add("MeadHealthLingering");
			hashSet.Add("MeadEitrLingering");
			hashSet.Add("MeadStaminaLingering");
			hashSet.Add("AcidVial_bal");
			hashSet.Add("BossElixirBonemass_bal");
			hashSet.Add("BossElixirEikthyr_bal");
			hashSet.Add("BossElixirElder_bal");
			hashSet.Add("BossElixirFader_bal");
			hashSet.Add("BossElixirModer_bal");
			hashSet.Add("BossElixirQueen_bal");
			hashSet.Add("BossElixirYagluth_bal");
			hashSet.Add("ElementalBrew_bal");
			hashSet.Add("ElixirArmor_bal");
			hashSet.Add("ElixirCarry_bal");
			hashSet.Add("ElixirOcean_bal");
			hashSet.Add("ElixirRage_bal");
			hashSet.Add("ElixirSky_bal");
			hashSet.Add("ElixirSpeed_bal");
			hashSet.Add("ElixirStealth_bal");
			hashSet.Add("ElixirVigor_bal");
			hashSet.Add("LingeringEitrPotion_bal");
			hashSet.Add("LingeringHealthPotion_bal");
			hashSet.Add("LingeringRejuvenationPotion_bal");
			hashSet.Add("LingeringStaminaPotion_bal");
			hashSet.Add("MajesticEitrPotion_bal");
			hashSet.Add("MajesticFirePotion_bal");
			hashSet.Add("MajesticFrostPotion_bal");
			hashSet.Add("MajesticHealthPotion_bal");
			hashSet.Add("MajesticLightPotion_bal");
			hashSet.Add("MajesticPoisonPotion_bal");
			hashSet.Add("MajesticRejuvenationPotion_bal");
			hashSet.Add("MajesticSpiritPotion_bal");
			hashSet.Add("MajesticStaminaPotion_bal");
			hashSet.Add("MajorEitrPotion_bal");
			hashSet.Add("MajorFirePotion_bal");
			hashSet.Add("MajorFrostPotion_bal");
			hashSet.Add("MajorHealthPotion_bal");
			hashSet.Add("MajorLightPotion_bal");
			hashSet.Add("MajorPoisonPotion_bal");
			hashSet.Add("MajorRejuvenationPotion_bal");
			hashSet.Add("MajorSpiritPotion_bal");
			hashSet.Add("MajorStaminaPotio_bal");
			hashSet.Add("MeadBaseEitrMajesticNew_bal");
			hashSet.Add("MeadBaseEitrMajorNew_bal");
			hashSet.Add("MeadBaseEitrMediumNew_bal");
			hashSet.Add("MeadBaseEitrMinorNew_bal");
			hashSet.Add("MeadBaseElementalBrew_bal");
			hashSet.Add("MeadBaseElixirA_bal");
			hashSet.Add("MeadBaseElixirA1_bal");
			hashSet.Add("MeadBaseElixirA2_bal");
			hashSet.Add("MeadBaseElixirA3_bal");
			hashSet.Add("MeadBaseElixirA4_bal");
			hashSet.Add("MeadBaseElixirA5_bal");
			hashSet.Add("MeadBaseElixirA6_bal");
			hashSet.Add("MeadBaseFireResistMajestic_bal");
			hashSet.Add("MeadBaseFireResistMajor_bal");
			hashSet.Add("MeadBaseFireResistMedium_bal");
			hashSet.Add("MeadBaseFireResistMinor_bal");
			hashSet.Add("MeadBaseFrostResistMajestic_bal");
			hashSet.Add("MeadBaseFrostResistMajor_bal");
			hashSet.Add("MeadBaseFrostResistMedium_bal");
			hashSet.Add("MeadBaseFrostResistMinor_bal");
			hashSet.Add("MeadBaseHealingMajestic_bal");
			hashSet.Add("MeadBaseHealingMajor_bal");
			hashSet.Add("MeadBaseHealingMedium_bal");
			hashSet.Add("MeadBaseHealingMinor_bal");
			hashSet.Add("MeadBaseLightingResistMajestic_bal");
			hashSet.Add("MeadBaseLightingResistMajor_bal");
			hashSet.Add("MeadBaseLightingResistMedium_bal");
			hashSet.Add("MeadBaseLightingResistMinor_bal");
			hashSet.Add("MeadBaseLingeringEitrNew_bal");
			hashSet.Add("MeadBaseLingeringeRejuvenationNew_bal");
			hashSet.Add("MeadBaseLingeringHealingNew_bal");
			hashSet.Add("MeadBaseLingeringStaminaNew_bal");
			hashSet.Add("MeadBaseMoonshine_bal");
			hashSet.Add("MeadBasePoisonResistMajestic_bal");
			hashSet.Add("MeadBasePoisonResistMajor_bal");
			hashSet.Add("MeadBasePoisonResistMedium_bal");
			hashSet.Add("MeadBasePoisonResistMinor_bal");
			hashSet.Add("MeadBaseRejuvenationMajestic_bal");
			hashSet.Add("MeadBaseRejuvenationMajor_bal");
			hashSet.Add("MeadBaseRejuvenationMedium_bal");
			hashSet.Add("MeadBaseRejuvenationMinor_bal");
			hashSet.Add("MeadBaseSpiritResistMajestic_bal");
			hashSet.Add("MeadBaseSpiritResistMajor_bal");
			hashSet.Add("MeadBaseSpiritResistMedium_bal");
			hashSet.Add("MeadBaseSpiritResistMinor_bal");
			hashSet.Add("MeadBaseStaminaMajesticNew_bal");
			hashSet.Add("MeadBaseStaminaMajorNew_bal");
			hashSet.Add("MeadBaseStaminaMediumNew_bal");
			hashSet.Add("MeadBaseStaminaMinorNew_bal");
			hashSet.Add("MediumEitrPotion_bal");
			hashSet.Add("MediumFirePotion_bal");
			hashSet.Add("MediumFrostPotion_bal");
			hashSet.Add("MediumHealthPotion_bal");
			hashSet.Add("MediumPoisonPotion_bal");
			hashSet.Add("MediumRejuvenationPotion_bal");
			hashSet.Add("MediumSpiritPotion_bal");
			hashSet.Add("MediumStaminaPotion_bal");
			hashSet.Add("MediumThunderPotion_bal");
			hashSet.Add("MinorEitrPotion_bal");
			hashSet.Add("MinorFirePotion_bal");
			hashSet.Add("MinorFrostPotion_bal");
			hashSet.Add("MinorHealthPotion_bal");
			hashSet.Add("MinorPoisonPotion_bal");
			hashSet.Add("MinorRejuvenationPotion_bal");
			hashSet.Add("MinorSpiritPotion_bal");
			hashSet.Add("MinorStaminaPotion_bal");
			hashSet.Add("MinorThunderPotion_bal");
			restrictions.Add(name, hashSet);
			break;
		}
	}
}
public class ShaderReplacment
{
	public static List<GameObject> prefabsToReplaceShader = new List<GameObject>();

	public static List<Material> materialsInPrefabs = new List<Material>();

	public string[] shaderlist = new string[49]
	{
		"Custom/AlphaParticle", "Custom/Blob", "Custom/Bonemass", "Custom/Clouds", "Custom/Creature", "Custom/Decal", "Custom/Distortion", "Custom/Flow", "Custom/FlowOpaque", "Custom/Grass",
		"Custom/GuiScroll", "Custom/Heightmap", "Custom/icon", "Custom/InteriorSide", "Custom/LitGui", "Custom/LitParticles", "Custom/mapshader", "Custom/ParticleDecal", "Custom/Piece", "Custom/Player",
		"Custom/Rug", "Custom/ShadowBlob", "Custom/SkyboxProcedural", "Custom/SkyObject", "Custom/StaticRock", "Custom/Tar", "Custom/Trilinearmap", "Custom/UI/BGBlur", "Custom/Vegetation", "Custom/Water",
		"Custom/WaterBottom", "Custom/WaterMask", "Custom/Yggdrasil", "Custom/Yggdrasil/root", "Hidden/BlitCopyHDRTonemap", "Hidden/Dof/DepthOfFieldHdr", "Hidden/Dof/DX11Dof", "Hidden/Internal-Loading", "Hidden/Internal-UIRDefaultWorld", "Hidden/SimpleClear",
		"Hidden/SunShaftsComposite", "Lux Lit Particles/ Bumped", "Lux Lit Particles/ Tess Bumped", "Particles/Standard Surface2", "Particles/Standard Unlit2", "Standard TwoSided", "ToonDeferredShading2017", "Unlit/DepthWrite", "Unlit/Lighting"
	};

	public static List<Shader> shaders = new List<Shader>();

	private static readonly HashSet<Shader> CachedShaders = new HashSet<Shader>();

	public static bool debug = true;

	public static Shader findShader(string name)
	{
		Shader[] array = Resources.FindObjectsOfTypeAll<Shader>();
		if (array.Length == 0)
		{
			Debug.LogWarning((object)"SHADER LIST IS EMPTY!");
			return null;
		}
		if (debug)
		{
		}
		return shaders.Find((Shader x) => ((Object)x).name == name);
	}

	public static Shader GetShaderByName(string name)
	{
		return shaders.Find((Shader x) => ((Object)x).name == name.Trim());
	}

	public static void debugShaderList(List<Shader> shadersRes)
	{
		foreach (Shader shadersRe in shadersRes)
		{
			Debug.LogWarning((object)("SHADER NAME IS: " + ((Object)shadersRe).name));
		}
		debug = false;
	}

	public static void Replace(GameObject gameObject)
	{
		prefabsToReplaceShader.Add(gameObject);
		GetMaterialsInPrefab(gameObject);
	}

	public static void GetMaterialsInPrefab(GameObject gameObject)
	{
		Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
		Renderer[] array = componentsInChildren;
		foreach (Renderer val in array)
		{
			Material[] sharedMaterials = val.sharedMaterials;
			if (sharedMaterials == null || sharedMaterials.Length == 0)
			{
				continue;
			}
			Material[] array2 = sharedMaterials;
			foreach (Material val2 in array2)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					materialsInPrefabs.Add(val2);
				}
			}
		}
	}

	public static void getMeShaders()
	{
		AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>();
		AssetBundle[] array2 = array;
		foreach (AssetBundle val in array2)
		{
			IEnumerable<Shader> enumerable3;
			try
			{
				IEnumerable<Shader> enumerable2;
				if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val))
				{
					IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>();
					enumerable2 = enumerable;
				}
				else
				{
					enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>)
						where (Object)(object)shader != (Object)null
						select shader;
				}
				enumerable3 = enumerable2;
			}
			catch (Exception)
			{
				continue;
			}
			if (enumerable3 == null)
			{
				continue;
			}
			foreach (Shader item in enumerable3)
			{
				CachedShaders.Add(item);
			}
		}
	}

	public static void runMaterialFix()
	{
		getMeShaders();
		shaders.AddRange(CachedShaders);
		foreach (Material materialsInPrefab in materialsInPrefabs)
		{
			Shader shader = materialsInPrefab.shader;
			if (!((Object)(object)shader == (Object)null))
			{
				string name = ((Object)shader).name;
				if (!(name == "Standard") && name.Contains("Balrond"))
				{
					setProperValue(materialsInPrefab, name);
				}
			}
		}
	}

	private static void setProperValue(Material material, string shaderName)
	{
		string name = shaderName.Replace("Balrond", "Custom");
		name = checkNaming(name);
		Shader shaderByName = GetShaderByName(name);
		if ((Object)(object)shaderByName == (Object)null)
		{
			Debug.LogWarning((object)("Shader not found " + name));
		}
		else
		{
			material.shader = shaderByName;
		}
	}

	private static string checkNaming(string name)
	{
		string result = name;
		if (name.Contains("Bumped"))
		{
			result = name.Replace("Custom", "Lux Lit Particles");
		}
		if (name.Contains("Tess Bumped"))
		{
			result = name.Replace("Custom", "Lux Lit Particles");
		}
		if (name.Contains("Standard Surface"))
		{
			result = name.Replace("Custom", "Particles");
			result = result.Replace("Standard Surface2", "Standard Surface");
		}
		if (name.Contains("Standard Unlit"))
		{
			result = name.Replace("Custom", "Particles");
			result = result.Replace("Standard Unlit", "Standard Unlit2");
			result = result.Replace("Standard Unlit22", "Standard Unlit2");
		}
		return result;
	}
}
[Serializable]
public class TopContainer : MonoBehaviour
{
	public Container container;

	public Piece piece;

	public ZNetView znet;

	public Inventory inventory;

	public int prevAmount = 0;

	public float currentWeight = 0f;

	public List<GameObject> shelfSlots = new List<GameObject>();

	public int slotAmount = 3;

	public bool isSetup = false;

	public bool isLanuched = false;

	public GameObject[] activeSlots;

	public List<ItemData> currentList = new List<ItemData>();

	private void Start()
	{
		piece = ((Component)this).GetComponent<Piece>();
		znet = ((Component)this).GetComponent<ZNetView>();
		container = ((Component)this).GetComponent<Container>();
		if ((Object)(object)container == (Object)null)
		{
			Debug.Log((object)"BALROND CONTAINERS: container  NOT found");
			return;
		}
		prepareContainer();
		inventory = container.m_inventory;
		if (isSetup && validate())
		{
			((MonoBehaviour)this).InvokeRepeating("setSlot", 1f, 4f);
			isLanuched = true;
		}
	}

	public void prepareContainer()
	{
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		List<GameObject> list = new List<GameObject>();
		for (int i = 0; i < slotAmount; i++)
		{
			list.Add(null);
		}
		activeSlots = list.ToArray();
		foreach (Transform item in ((Component)this).transform)
		{
			Transform val = item;
			if (((Object)val).name == "slot")
			{
				shelfSlots.Add(((Component)val).gameObject);
			}
		}
		isSetup = true;
	}

	private bool validate()
	{
		if ((Object)(object)container == (Object)null && !znet.IsValid())
		{
			Debug.LogWarning((object)"I did not pass Validation");
			return false;
		}
		if (inventory == null)
		{
			inventory = container.m_inventory;
		}
		if (inventory == null)
		{
			return false;
		}
		return true;
	}

	private bool compareWeight()
	{
		float totalWeight = inventory.GetTotalWeight();
		if (totalWeight != currentWeight)
		{
			currentWeight = totalWeight;
			return true;
		}
		return false;
	}

	private void FixedUpdate()
	{
		if (isSetup && validate() && !isLanuched)
		{
			((MonoBehaviour)this).InvokeRepeating("setSlot", 1f, 4f);
			isLanuched = true;
		}
	}

	public void setSlot()
	{
		if (!validate())
		{
			return;
		}
		List<ItemData> list = new List<ItemData>();
		list = inventory.GetAllItems();
		if (list == null)
		{
			return;
		}
		int num = list.Count();
		if (num > slotAmount)
		{
			return;
		}
		for (int i = 0; i < activeSlots.Length; i++)
		{
			if ((Object)(object)activeSlots[i] != (Object)null)
			{
				activeSlots[i].SetActive(false);
				activeSlots[i] = null;
			}
		}
		if (num <= 0)
		{
			return;
		}
		int num2 = 1;
		foreach (ItemData item in list)
		{
			int index = num - num2;
			checkSlot(shelfSlots[num - num2], ((Object)item.m_dropPrefab).name, index);
			num2++;
		}
	}

	private void checkSlot(GameObject slot, string name, int index)
	{
		if ((Object)(object)activeSlots[index] != (Object)null && ((Object)activeSlots[index]).name == name)
		{
			return;
		}
		Transform val = slot.transform.Find(name);
		if ((Object)(object)val == (Object)null)
		{
			if ((Object)(object)activeSlots[index] != (Object)null)
			{
				activeSlots[index].SetActive(false);
				activeSlots[index] = null;
			}
			return;
		}
		if ((Object)(object)activeSlots[index] != (Object)null)
		{
			activeSlots[index].SetActive(false);
		}
		activeSlots[index] = ((Component)val).gameObject;
		activeSlots[index].SetActive(true);
	}
}
[Serializable]
public class TopFood : MonoBehaviour
{
	public Container container;

	public Piece piece;

	public ZNetView znet;

	public Inventory inventory;

	public int prevAmount = 0;

	public float currentWeight = 0f;

	public List<GameObject> shelfSlots = new List<GameObject>();

	public int slotAmount = 3;

	public bool isSetup = false;

	public bool isLanuched = false;

	public GameObject[] activeSlots = (GameObject[])(object)new GameObject[0];

	public GameObject visibleMesh;

	public bool isVisible = false;

	public GameObject topfood;

	public string currentName;

	private void Start()
	{
		piece = ((Component)this).GetComponent<Piece>();
		znet = ((Component)this).GetComponent<ZNetView>();
		container = ((Component)this).GetComponent<Container>();
		if ((Object)(object)container == (Object)null)
		{
			Debug.Log((object)"BALROND CONTAINERS: container  NOT found");
			return;
		}
		prepareContainer();
		inventory = container.m_inventory;
		if (isSetup && validate())
		{
			((MonoBehaviour)this).InvokeRepeating("setSlot", 1f, 4f);
			isLanuched = true;
		}
	}

	private void prepareContainer()
	{
		topfood = ((Component)((Component)this).transform.Find("topfood")).gameObject;
		isSetup = true;
	}

	private bool validate()
	{
		if ((Object)(object)container == (Object)null || (Object)(object)znet == (Object)null || !znet.IsValid())
		{
			return false;
		}
		if (inventory == null)
		{
			inventory = container.m_inventory;
		}
		if (inventory == null)
		{
			return false;
		}
		return true;
	}

	private bool compareWeight()
	{
		float totalWeight = inventory.GetTotalWeight();
		if (totalWeight != currentWeight)
		{
			currentWeight = totalWeight;
			return true;
		}
		return false;
	}

	private void FixedUpdate()
	{
		if (isSetup && validate() && !isLanuched)
		{
			((MonoBehaviour)this).InvokeRepeating("setSlot", 1f, 4f);
			isLanuched = true;
		}
	}

	public void setSlot()
	{
		if (!validate() || inventory == null || !znet.IsValid())
		{
			return;
		}
		List<ItemData> list = new List<ItemData>();
		list = inventory.GetAllItems();
		if (list == null || list.Count() == 0)
		{
			isVisible = false;
			currentName = null;
			if ((Object)(object)visibleMesh != (Object)null)
			{
				visibleMesh.SetActive(false);
			}
			visibleMesh = null;
			return;
		}
		string name = ((Object)list[0].m_dropPrefab).name;
		if (currentName != name || currentName == null)
		{
			currentName = name;
			if ((Object)(object)visibleMesh != (Object)null)
			{
				visibleMesh.SetActive(false);
			}
			Transform val = topfood.transform.Find(currentName);
			if ((Object)(object)val != (Object)null)
			{
				visibleMesh = ((Component)val).gameObject;
				visibleMesh.SetActive(true);
				isVisible = true;
			}
		}
	}
}
[Serializable]
public class TopPotion : MonoBehaviour
{
	public Container container;

	public Piece piece;

	public ZNetView znet;

	public Inventory inventory;

	public int prevAmount = 0;

	public float currentWeight = 0f;

	public List<GameObject> shelfSlots = new List<GameObject>();

	public int slotAmount = 3;

	public bool isSetup = false;

	public bool isLanuched = false;

	public GameObject[] activeSlots = (GameObject[])(object)new GameObject[0];

	private void Start()
	{
		piece = ((Component)this).GetComponent<Piece>();
		znet = ((Component)this).GetComponent<ZNetView>();
		container = ((Component)this).GetComponent<Container>();
		if ((Object)(object)container == (Object)null)
		{
			Debug.Log((object)"BALROND CONTAINERS: container  NOT found");
			return;
		}
		prepareContainer();
		inventory = container.m_inventory;
		if (isSetup && validate())
		{
			((MonoBehaviour)this).InvokeRepeating("setSlot", 1f, 4f);
			isLanuched = true;
		}
	}

	private void FixedUpdate()
	{
		if (isSetup && validate() && !isLanuched)
		{
			((MonoBehaviour)this).InvokeRepeating("setSlot", 1f, 4f);
			isLanuched = true;
		}
	}

	public void prepareContainer()
	{
		slotAmount = 9;
		List<GameObject> list = new List<GameObject>();
		for (int i = 0; i < slotAmount; i++)
		{
			list.Add(null);
		}
		activeSlots = list.ToArray();
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-1")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-2")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-3")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-4")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-5")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-6")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-7")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-8")).gameObject);
		shelfSlots.Add(((Component)((Component)this).transform.Find("potionslot-9")).gameObject);
		isSetup = true;
	}

	private bool validate()
	{
		if ((Object)(object)container == (Object)null || !znet.IsValid())
		{
			return false;
		}
		if (inventory == null)
		{
			inventory = container.m_inventory;
		}
		if (inventory == null)
		{
			return false;
		}
		return true;
	}

	private bool compareWeight()
	{
		float totalWeight = inventory.GetTotalWeight();
		if (totalWeight != currentWeight)
		{
			currentWeight = totalWeight;
			return true;
		}
		return false;
	}

	public void setSlot()
	{
		if (!validate())
		{
			return;
		}
		List<ItemData> list = new List<ItemData>();
		list = inventory.GetAllItems();
		if (list == null)
		{
			return;
		}
		int num = list.Count();
		for (int i = 0; i < activeSlots.Length; i++)
		{
			if ((Object)(object)activeSlots[i] != (Object)null)
			{
				activeSlots[i].SetActive(false);
				activeSlots[i] = null;
			}
		}
		if (num <= 0)
		{
			return;
		}
		int num2 = 1;
		foreach (ItemData item in list)
		{
			int index = num - num2;
			checkSlot(shelfSlots[num - num2], ((Object)item.m_dropPrefab).name, index);
			num2++;
		}
	}

	private void checkSlot(GameObject slot, string name, int index)
	{
		if ((Object)(object)activeSlots[index] != (Object)null && ((Object)activeSlots[index]).name == name)
		{
			return;
		}
		Transform val = slot.transform.Find(name);
		if ((Object)(object)val == (Object)null)
		{
			if ((Object)(object)activeSlots[index] != (Object)null)
			{
				activeSlots[index].SetActive(false);
				activeSlots[index] = null;
			}
			return;
		}
		if ((Object)(object)activeSlots[index] != (Object)null)
		{
			activeSlots[index].SetActive(false);
		}
		activeSlots[index] = ((Component)val).gameObject;
		activeSlots[index].SetActive(true);
	}
}