Decompiled source of RavenwoodBalrondPieces v1.0.4

plugins/RavenwoodBalrondPieces/RavenwoodBalrondPieces.dll

Decompiled 3 months 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 BepInEx;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BalrondBuildingRepack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BalrondBuildingRepack")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cde312a0-cf19-4264-8616-e1c74774beed")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RavenwoodBalrondPieces;

internal class BuildPieceList
{
	public static string[] buildPieces = new string[124]
	{
		"clutter_bookset1_bal", "clutter_bookset2_bal", "clutter_bookset3_bal", "clutter_bottleset_bal", "clutter_cupset_bal", "clutter_tableset_bal", "Hearth_1x3_bal", "Hearth_2x3_bal", "Hearth_2x2_bal", "charred_chest_bal",
		"dvergr_bed_bal", "dvergr_chair_bal", "dvergr_chest_bal", "dvergr_shelf_bal", "dvergr_stool_bal", "dvergr_table_bal", "piece_chest_private_bal", "bed_noble_bal", "black_carpet_end_bal", "black_carpet_mid_bal",
		"ground_spike_trap_bal", "piece_banner_black1_bal", "piece_banner_black2_bal", "piece_banner_black3_bal", "piece_banner_black4_bal", "piece_bed03_bal", "piece_candlechandelier_bal", "piece_chest_jewelbox_bal", "piece_chest_stone_bal", "piece_crystal_walltorch_bal",
		"piece_crystalchandelier_bal", "piece_curtain_big_bal", "piece_elegant_bench_bal", "piece_elegant_bench2_bal", "piece_emberwood_stool_bal", "piece_emberwoodchair_bal", "piece_table_round_noble_bal", "runefire_bal", "linen_carpet_bal", "rug_neck_bal",
		"rug_fox_bal", "rug_bear_bal", "wood_pillar4_bal", "wood_long_stair_bal", "piece_grausten_roof_45_top_bal", "dverger_gate_bal", "dvergr_secretdoor_bal", "giant_metal_gate_bal", "blackmarble_floor4m_bal", "blackmarble_roof27_bal",
		"blackmarble_stair_inner_bal", "blackmarble_stair_outer_bal", "blackmarble_stone_ladder_bal", "crystal_tile_floor_2x2_bal", "crystal_wall_2x2_bal", "emberwood_pillar2_bal", "emberwood_pillar4_bal", "plate_gate_bal", "rawstone_pole_bal", "rune_floor_bal",
		"stone_floor_triangle_bal", "stone_long_stair_bal", "stone_pole_bal", "stone_railing_bal", "stone_roof27_bal", "stone_stair_corner_bal", "stone_stair_corner_left_bal", "stone_stair_inner_bal", "stone_stair_outer_bal", "stone_stair_railing_bal",
		"stone_stair_railing_left_bal", "stone_stair_railing_right_bal", "stone_stepladder_bal", "stonemoss_tile_floor_2x2_bal", "blackmarble_creep_slope_inverted_2x2x1_bal", "blackmarble_1x1_enforced_bal", "stone_1x1_enforced_bal", "blackmarble_Wall_Window_2x2_bal", "stone_beam_bal", "blackmarble_long_stair_bal",
		"clay_stair_bal", "ClayBeam_bal", "ClayCube_bal", "ClayPole_bal", "clayr_arch_bal", "ClayWall_bal", "bg_stake_wall_bal", "leather_roof_bal", "clay_floor_2x2_bal", "bush_roof_bal",
		"bush_roof_top_bal", "bush_roof_icorner_bal", "bush_roof_ocorner_bal", "piece_sharpstakes_big_bal", "Piece_hardwood_pillar_arch_bal", "Piece_hardwood_pillar_arch_small_bal", "Piece_hardwood_pillarbase_medium_bal", "Piece_hardwood_pillarbase_small_bal", "Piece_hardwood_pillarbase_tapered_bal", "Piece_hardwood_pillarbase_tapered_inverted_bal",
		"Piece_hardwood_pillarbeam_medium_bal", "Piece_hardwood_pillarbeam_small_bal", "piece_hardwood_roof_45_bal", "piece_hardwood_roof_45_arch_bal", "piece_hardwood_roof_45_arch_corner_bal", "piece_hardwood_roof_45_arch_corner2_bal", "piece_hardwood_roof_45_corner_bal", "piece_hardwood_roof_45_corner2_bal", "piece_hardwood_roof_45_top_bal", "wood_roof_flat_bal",
		"silver_ore_pile_bal", "bcopper_ore_pile_bal", "biron_ore_pile_bal", "bmetal_ore_pile_bal", "flametal_ore_pile_bal", "straw_floor_2x2_bal", "rostrum_bal", "sulfur_cauldron_bal", "target_practice_bal", "fishing_rack_bal",
		"hardwood_door_bal", "animal_cages_bal", "supply_shelf_bal", "weapon_rack_bal"
	};
}
public class DatabaseAddMethods
{
	public void AddItems(List<GameObject> items)
	{
		foreach (GameObject item in items)
		{
			AddItem(item);
		}
	}

	public void AddRecipes(List<Recipe> recipes)
	{
		foreach (Recipe recipe in recipes)
		{
			AddRecipe(recipe);
		}
	}

	public void AddStatuseffects(List<StatusEffect> statusEffects)
	{
		foreach (StatusEffect statusEffect in statusEffects)
		{
			AddStatus(statusEffect);
		}
	}

	private 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;
	}

	private void AddStatus(StatusEffect status)
	{
		if (!IsObjectDBValid())
		{
			return;
		}
		if ((Object)(object)status != (Object)null)
		{
			if ((Object)(object)ObjectDB.instance.GetStatusEffect(status.m_nameHash) == (Object)null)
			{
				ObjectDB.instance.m_StatusEffects.Add(status);
			}
			else
			{
				Debug.Log((object)(Launch.projectName + ":  " + ((Object)status).name + " - Status already in the game"));
			}
		}
		else
		{
			Debug.LogError((object)(Launch.projectName + ":  " + ((Object)status).name + " - Status not found"));
		}
	}

	private void AddRecipe(Recipe recipe)
	{
		if (!IsObjectDBValid())
		{
			return;
		}
		if ((Object)(object)recipe != (Object)null)
		{
			if ((Object)(object)ObjectDB.instance.m_recipes.Find((Recipe x) => ((Object)x).name == ((Object)recipe).name) == (Object)null)
			{
				if ((Object)(object)recipe.m_item != (Object)null)
				{
					ObjectDB.instance.m_recipes.Add(recipe);
				}
			}
			else
			{
				Debug.Log((object)(Launch.projectName + ":  " + ((Object)recipe).name + " - Recipe with this name already in the Game"));
			}
		}
		else
		{
			Debug.LogError((object)(Launch.projectName + ":  " + ((Object)recipe).name + " - Recipe not found"));
		}
	}

	private void AddItem(GameObject newPrefab)
	{
		if (!IsObjectDBValid())
		{
			return;
		}
		ItemDrop component = newPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component != (Object)null)
		{
			if ((Object)(object)ObjectDB.instance.GetItemPrefab(((Object)newPrefab).name) == (Object)null)
			{
				ObjectDB.instance.m_items.Add(newPrefab);
				Dictionary<int, GameObject> dictionary = (Dictionary<int, GameObject>)typeof(ObjectDB).GetField("m_itemByHash", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ObjectDB.instance);
				dictionary[((Object)newPrefab).name.GetHashCode()] = newPrefab;
			}
			else
			{
				Debug.LogWarning((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop already exist"));
			}
		}
		else
		{
			Debug.LogError((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop not found on prefab"));
		}
	}
}
public class FxReplacment
{
	private List<GameObject> allPrefabs;

	private string projectName = "[BalrondBiomes]";

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

	public void ReplaceOnObject(GameObject gameObject)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			return;
		}
		SpawnArea component = gameObject.GetComponent<SpawnArea>();
		if ((Object)(object)component != (Object)null)
		{
			EffectList spawnEffects = component.m_spawnEffects;
			if (spawnEffects != null)
			{
				findEffectsAndChange(spawnEffects.m_effectPrefabs);
			}
		}
		Destructible component2 = gameObject.GetComponent<Destructible>();
		if ((Object)(object)component2 != (Object)null)
		{
			EffectList hitEffect = component2.m_hitEffect;
			if (hitEffect != null)
			{
				findEffectsAndChange(hitEffect.m_effectPrefabs);
			}
			EffectList destroyedEffect = component2.m_destroyedEffect;
			if (destroyedEffect != null)
			{
				findEffectsAndChange(destroyedEffect.m_effectPrefabs);
			}
		}
		Projectile component3 = gameObject.GetComponent<Projectile>();
		if ((Object)(object)component3 != (Object)null)
		{
			EffectList hitEffects = component3.m_hitEffects;
			if (hitEffects != null)
			{
				findEffectsAndChange(hitEffects.m_effectPrefabs);
			}
			EffectList hitWaterEffects = component3.m_hitWaterEffects;
			if (hitWaterEffects != null)
			{
				findEffectsAndChange(hitWaterEffects.m_effectPrefabs);
			}
			EffectList spawnOnHitEffects = component3.m_spawnOnHitEffects;
			if (spawnOnHitEffects != null)
			{
				findEffectsAndChange(spawnOnHitEffects.m_effectPrefabs);
			}
		}
	}

	public void ReplaceOnVegetation(GameObject gameObject)
	{
		Pickable component = gameObject.GetComponent<Pickable>();
		if ((Object)(object)component != (Object)null)
		{
			fixPlant(component);
		}
		Destructible component2 = gameObject.GetComponent<Destructible>();
		if ((Object)(object)component2 != (Object)null)
		{
			fixPDestructable(component2);
		}
		MineRock5 component3 = gameObject.GetComponent<MineRock5>();
		if ((Object)(object)component3 != (Object)null)
		{
			fixMineRock5(component3);
		}
		MineRock component4 = gameObject.GetComponent<MineRock>();
		if ((Object)(object)component4 != (Object)null)
		{
			fixMineRock(component4);
		}
	}

	private void fixPlant(Pickable pickable)
	{
		EffectList pickEffector = pickable.m_pickEffector;
		if (pickEffector != null)
		{
			findEffectsAndChange(pickEffector.m_effectPrefabs);
		}
	}

	private void fixPDestructable(Destructible minerock5)
	{
		EffectList hitEffect = minerock5.m_hitEffect;
		if (hitEffect != null)
		{
			findEffectsAndChange(hitEffect.m_effectPrefabs);
		}
		EffectList destroyedEffect = minerock5.m_destroyedEffect;
		if (destroyedEffect != null)
		{
			findEffectsAndChange(destroyedEffect.m_effectPrefabs);
		}
	}

	private void fixMineRock5(MineRock5 minerock5)
	{
		EffectList hitEffect = minerock5.m_hitEffect;
		if (hitEffect != null)
		{
			findEffectsAndChange(hitEffect.m_effectPrefabs);
		}
		EffectList destroyedEffect = minerock5.m_destroyedEffect;
		if (destroyedEffect != null)
		{
			findEffectsAndChange(destroyedEffect.m_effectPrefabs);
		}
	}

	private void fixMineRock(MineRock minerock5)
	{
		EffectList hitEffect = minerock5.m_hitEffect;
		if (hitEffect != null)
		{
			findEffectsAndChange(hitEffect.m_effectPrefabs);
		}
		EffectList destroyedEffect = minerock5.m_destroyedEffect;
		if (destroyedEffect != null)
		{
			findEffectsAndChange(destroyedEffect.m_effectPrefabs);
		}
	}

	public void ReplaceOnMonster(GameObject gameObject)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			Debug.LogWarning((object)(projectName + ":: GameObject not found"));
			return;
		}
		Humanoid component = gameObject.GetComponent<Humanoid>();
		if ((Object)(object)component == (Object)null)
		{
			Debug.LogWarning((object)(projectName + ":: GameObject not found"));
			return;
		}
		EffectList dropEffects = component.m_dropEffects;
		if (dropEffects != null)
		{
			findEffectsAndChange(dropEffects.m_effectPrefabs);
		}
		EffectList backstabHitEffects = ((Character)component).m_backstabHitEffects;
		if (backstabHitEffects != null)
		{
			findEffectsAndChange(backstabHitEffects.m_effectPrefabs);
		}
		EffectList consumeItemEffects = component.m_consumeItemEffects;
		if (consumeItemEffects != null)
		{
			findEffectsAndChange(consumeItemEffects.m_effectPrefabs);
		}
		EffectList critHitEffects = ((Character)component).m_critHitEffects;
		if (critHitEffects != null)
		{
			findEffectsAndChange(critHitEffects.m_effectPrefabs);
		}
		EffectList deathEffects = ((Character)component).m_deathEffects;
		if (deathEffects != null)
		{
			findEffectsAndChange(deathEffects.m_effectPrefabs);
		}
		EffectList hitEffects = ((Character)component).m_hitEffects;
		if (hitEffects != null)
		{
			findEffectsAndChange(hitEffects.m_effectPrefabs);
		}
		EffectList jumpEffects = ((Character)component).m_jumpEffects;
		if (jumpEffects != null)
		{
			findEffectsAndChange(jumpEffects.m_effectPrefabs);
		}
		EffectList perfectBlockEffect = component.m_perfectBlockEffect;
		if (perfectBlockEffect != null)
		{
			findEffectsAndChange(perfectBlockEffect.m_effectPrefabs);
		}
		EffectList pickupEffects = component.m_pickupEffects;
		if (pickupEffects != null)
		{
			findEffectsAndChange(pickupEffects.m_effectPrefabs);
		}
		EffectList slideEffects = ((Character)component).m_slideEffects;
		if (slideEffects != null)
		{
			findEffectsAndChange(slideEffects.m_effectPrefabs);
		}
		EffectList tarEffects = ((Character)component).m_tarEffects;
		if (tarEffects != null)
		{
			findEffectsAndChange(tarEffects.m_effectPrefabs);
		}
		EffectList waterEffects = ((Character)component).m_waterEffects;
		if (waterEffects != null)
		{
			findEffectsAndChange(waterEffects.m_effectPrefabs);
		}
		FootStep component2 = gameObject.GetComponent<FootStep>();
		if (!((Object)(object)component2 != (Object)null))
		{
			return;
		}
		List<StepEffect> effects = component2.m_effects;
		foreach (StepEffect item in effects)
		{
			GameObject[] effectPrefabs = item.m_effectPrefabs;
			List<GameObject> list = new List<GameObject>();
			list.AddRange(effectPrefabs);
			for (int i = 0; i < list.Count; i++)
			{
				if ((Object)(object)list[i] != (Object)null)
				{
					string name = ((Object)list[i]).name;
					GameObject val = allPrefabs.Find((GameObject x) => ((Object)x).name == name);
					if (!((Object)(object)val == (Object)null))
					{
						list[i] = val;
					}
				}
			}
		}
	}

	public void ReplaceOnItem(GameObject gameObject)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			return;
		}
		ItemDrop component = gameObject.GetComponent<ItemDrop>();
		if (!((Object)(object)component == (Object)null))
		{
			EffectList hitEffect = component.m_itemData.m_shared.m_hitEffect;
			if (hitEffect != null)
			{
				findEffectsAndChange(hitEffect.m_effectPrefabs);
			}
			EffectList hitTerrainEffect = component.m_itemData.m_shared.m_hitTerrainEffect;
			if (hitTerrainEffect != null)
			{
				findEffectsAndChange(hitTerrainEffect.m_effectPrefabs);
			}
			EffectList holdStartEffect = component.m_itemData.m_shared.m_holdStartEffect;
			if (holdStartEffect != null)
			{
				findEffectsAndChange(holdStartEffect.m_effectPrefabs);
			}
			EffectList trailStartEffect = component.m_itemData.m_shared.m_trailStartEffect;
			if (trailStartEffect != null)
			{
				findEffectsAndChange(trailStartEffect.m_effectPrefabs);
			}
			EffectList blockEffect = component.m_itemData.m_shared.m_blockEffect;
			if (blockEffect != null)
			{
				findEffectsAndChange(blockEffect.m_effectPrefabs);
			}
		}
	}

	public void ReplaceFxOnPiece(GameObject gameObject)
	{
		if ((Object)(object)gameObject == (Object)null)
		{
			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)
		{
			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))
				{
					val.m_prefab = val2;
				}
			}
		}
	}
}
public class ModResourceLoader
{
	public AssetBundle assetBundle;

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

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

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

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

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

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

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

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

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

	public FxReplacment fxReplacment = null;

	public List<Recipe> recipes = new List<Recipe>();

	public List<StatusEffect> statusEffects = new List<StatusEffect>();

	public StatusEffect newBarleyStatus = null;

	public ShaderReplacment shaderReplacment = new ShaderReplacment();

	public Sprite newLogo = null;

	public void loadAssets()
	{
		assetBundle = GetAssetBundleFromResources("ravenwoodrepack");
		string basePath = "Assets/Custom/Comission/BuildPieceRepackRavenWood/";
		loadPieces(basePath);
		loadOther(basePath);
	}

	public void AddPrefabsToZnetScene(ZNetScene zNetScene)
	{
		zNetScene.m_prefabs.AddRange(vegetationPrefabs);
		foreach (GameObject gm in itemPrefabs)
		{
			GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm).name);
			if ((Object)(object)val == (Object)null)
			{
				zNetScene.m_prefabs.Add(gm);
			}
			else
			{
				Debug.LogWarning((object)("Object exists: " + ((Object)gm).name));
			}
		}
		foreach (GameObject gm2 in buildPrefabs)
		{
			GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm2).name);
			if ((Object)(object)val2 == (Object)null)
			{
				zNetScene.m_prefabs.Add(gm2);
			}
			else
			{
				Debug.LogWarning((object)("Object exists: " + ((Object)gm2).name));
			}
		}
		foreach (GameObject gm3 in vfxPrefabs)
		{
			GameObject val3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == ((Object)gm3).name);
			if ((Object)(object)val3 == (Object)null)
			{
				zNetScene.m_prefabs.Add(gm3);
			}
			else
			{
				Debug.LogWarning((object)("Object exists: " + ((Object)gm3).name));
			}
		}
		zNetScene.m_prefabs.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
		addPlantstoCultivator(zNetScene);
		setupBuildPiecesList(zNetScene);
	}

	private void setupBuildPiecesList(ZNetScene zNetScene)
	{
		string[] array = new string[4] { "Hammer", "HammerIron", "HammerDverger", "HammerBlackmetal" };
		GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Hammer");
		PieceTable buildPieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces;
		string[] array2 = array;
		foreach (string name in array2)
		{
			addBuildpiecesToOtherHammer(name, buildPieces, zNetScene);
		}
		List<GameObject> pieces = buildPieces.m_pieces;
		foreach (GameObject buildPrefab in buildPrefabs)
		{
			setupRavenGuide(buildPrefab, zNetScene.m_prefabs);
			AddToBuildList(buildPrefab, pieces);
		}
	}

	private void addBuildpiecesToOtherHammer(string name, PieceTable pieceTable, ZNetScene zNetScene)
	{
		GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name);
		if (!((Object)(object)val == (Object)null))
		{
			val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces = pieceTable;
		}
	}

	public void setupRavenGuide(GameObject gameObject, List<GameObject> gameObjects)
	{
		GameObject val = null;
		Transform val2 = gameObject.transform.Find("GuidePoint");
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		GameObject val3 = gameObjects.Find((GameObject x) => ((Object)x).name == "piece_workbench");
		if ((Object)(object)val3 != (Object)null)
		{
			GameObject gameObject2 = ((Component)val3.transform.Find("GuidePoint")).gameObject;
			if ((Object)(object)gameObject2 != (Object)null)
			{
				GuidePoint component = gameObject2.GetComponent<GuidePoint>();
				if ((Object)(object)component != (Object)null)
				{
					val = component.m_ravenPrefab;
				}
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			Debug.LogWarning((object)"Ravens not found");
		}
		else
		{
			((Component)val2).GetComponent<GuidePoint>().m_ravenPrefab = val;
		}
	}

	public void setupBuildPiecesListDB()
	{
		GameObject val = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == "Hammer");
		List<GameObject> pieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces.m_pieces;
		foreach (GameObject buildPrefab in buildPrefabs)
		{
			AddToBuildList(buildPrefab, pieces);
		}
	}

	private void AddToBuildList(GameObject prefab, List<GameObject> buildPieces)
	{
		if ((Object)(object)buildPieces.Find((GameObject x) => ((Object)x).name == ((Object)prefab).name) == (Object)null)
		{
			buildPieces.Add(prefab);
		}
	}

	private void addPlantstoCultivator(ZNetScene zNetScene)
	{
		GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Cultivator");
		PieceTable buildPieces = val.GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces;
		List<GameObject> pieces = buildPieces.m_pieces;
		foreach (GameObject plantPrefab in plantPrefabs)
		{
			pieces.Add(plantPrefab);
		}
	}

	public void FixAllFx(FxReplacment fxReplacment)
	{
		this.fxReplacment = fxReplacment;
		fixBuildPiecesFX();
		fixVegetationFX();
		fixItemFX();
		fixMonsterFX();
		fixOtherFX();
	}

	private void loadStatusFromPotion()
	{
		string[] source = new string[0];
		foreach (GameObject itemPrefab in itemPrefabs)
		{
			if (source.Contains(((Object)itemPrefab).name))
			{
				ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
				SharedData shared = component.m_itemData.m_shared;
				checkForStatus(shared.m_consumeStatusEffect);
				checkForStatus(shared.m_setStatusEffect);
				checkForStatus(shared.m_equipStatusEffect);
				checkForStatus(shared.m_attackStatusEffect);
			}
		}
		Debug.Log((object)("Loaded Potion status: " + statusEffects.Count));
	}

	private void checkForStatus(StatusEffect status)
	{
		if ((Object)(object)status != (Object)null)
		{
			statusEffects.Add(status);
		}
	}

	private void fixVegetationFX()
	{
		foreach (GameObject vegetationPrefab in vegetationPrefabs)
		{
			fxReplacment.ReplaceOnVegetation(vegetationPrefab);
		}
	}

	private void fixBuildPiecesFX()
	{
		foreach (GameObject buildPrefab in buildPrefabs)
		{
			fxReplacment.ReplaceFxOnPiece(buildPrefab);
		}
	}

	private void fixItemFX()
	{
		foreach (GameObject itemPrefab in itemPrefabs)
		{
			fxReplacment.ReplaceOnItem(itemPrefab);
		}
	}

	private void fixMonsterFX()
	{
		foreach (GameObject monsterPrefab in monsterPrefabs)
		{
			fxReplacment.ReplaceOnMonster(monsterPrefab);
		}
	}

	private void fixOtherFX()
	{
		foreach (GameObject vfxPrefab in vfxPrefabs)
		{
			fxReplacment.ReplaceOnObject(vfxPrefab);
		}
	}

	private 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 void loadPlants(string basePath)
	{
		string text = basePath + "Plants/";
		string[] array = new string[0];
		string[] array2 = array;
		foreach (string text2 in array2)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Could not find plant with name: " + text2));
				continue;
			}
			ShaderReplacment.Replace(val);
			plantPrefabs.Add(val);
		}
	}

	private void loadPieces(string basePath)
	{
		string text = basePath + "Pieces/";
		string[] buildPieces = BuildPieceList.buildPieces;
		string[] array = buildPieces;
		foreach (string text2 in array)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Could not find piece with name: " + text2));
				continue;
			}
			ShaderReplacment.Replace(val);
			buildPrefabs.Add(val);
		}
	}

	private void loadItems(string basePath)
	{
		string text = basePath + "Items/";
		string[] array = new string[0];
		string[] array2 = array;
		foreach (string text2 in array2)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Could not find item with name: " + text2));
				continue;
			}
			ShaderReplacment.Replace(val);
			itemPrefabs.Add(val);
		}
	}

	private void loadVegetation(string basePath)
	{
		string text = basePath + "Vegetation/";
		string[] array = new string[0];
		string[] array2 = array;
		foreach (string text2 in array2)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Could not find vegegation with name: " + text2));
				continue;
			}
			ShaderReplacment.Replace(val);
			vegetationPrefabs.Add(val);
		}
	}

	private void loadOther(string basePath)
	{
		string text = basePath + "Other/";
		string[] array = new string[1] { "sfx_queendoor_open1" };
		string[] array2 = array;
		foreach (string text2 in array2)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(text + text2 + ".prefab");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Could not find object with name: " + text2));
				continue;
			}
			ShaderReplacment.Replace(val);
			vfxPrefabs.Add(val);
		}
	}

	public void setIronHook(ZNetScene zNetScene)
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_cookingstation_iron");
		GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_cookingstation");
		ItemConversion val3 = new ItemConversion();
		val3.m_from = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BearMeat").GetComponent<ItemDrop>();
		val3.m_to = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BearMeatCooked").GetComponent<ItemDrop>();
		val3.m_cookTime = 40f;
		ItemConversion val4 = new ItemConversion();
		val4.m_from = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Potato").GetComponent<ItemDrop>();
		val4.m_to = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "PotatoFried").GetComponent<ItemDrop>();
		val4.m_cookTime = 30f;
		if ((Object)(object)val != (Object)null)
		{
			CookingStation component = val.GetComponent<CookingStation>();
			component.m_conversion.Add(val4);
			component.m_conversion.Add(val3);
		}
		if ((Object)(object)val2 != (Object)null)
		{
			CookingStation component2 = val2.GetComponent<CookingStation>();
			component2.m_conversion.Add(val4);
			component2.m_conversion.Add(val3);
		}
	}

	public void setupPickableDrops(ZNetScene zNetScene)
	{
		GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Pickable_MeadowsMeatPile01");
		GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Pickable_MeadowsMeatPile02");
		Pickable component = val.GetComponent<Pickable>();
		Pickable component2 = val2.GetComponent<Pickable>();
		GameObject item = getItem(zNetScene, "RawMeat");
		if ((Object)(object)item != (Object)null)
		{
			component.m_itemPrefab = item;
			component2.m_itemPrefab = item;
		}
		createExtraDrops(component, zNetScene);
		createExtraDrops(component2, zNetScene);
	}

	private void createExtraDrops(Pickable pickable, ZNetScene zNetScene)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		List<DropData> list = new List<DropData>();
		string name = ((Object)((Component)pickable).gameObject).name;
		string text = name;
		if (!(text == "Pickable_MeadowsMeatPile01"))
		{
			if (text == "Pickable_MeadowsMeatPile02")
			{
				list.Add(createDrop(zNetScene, "RawMeat", 1, 1, 0.4f));
				list.Add(createDrop(zNetScene, "Coins", 5, 15, 0.2f));
				list.Add(createDrop(zNetScene, "BoneFragments", 1, 3, 0.2f));
				list.Add(createDrop(zNetScene, "NeckTail", 1, 2, 0.3f));
			}
		}
		else
		{
			list.Add(createDrop(zNetScene, "RawMeat", 1, 1, 0.4f));
			list.Add(createDrop(zNetScene, "DeerMeat", 1, 1, 0.2f));
			list.Add(createDrop(zNetScene, "NeckTail", 1, 2, 0.3f));
			list.Add(createDrop(zNetScene, "Honey", 1, 2, 0.1f));
		}
		pickable.m_extraDrops.m_drops = list;
	}

	private DropData createDrop(ZNetScene zNetScene, string name, int min, int max, float chance)
	{
		//IL_0003: 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_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		DropData result = default(DropData);
		result.m_stackMin = min;
		result.m_stackMax = max;
		result.m_weight = chance;
		result.m_item = getItem(zNetScene, name);
		return result;
	}

	private GameObject getItem(ZNetScene zNetScene, string name)
	{
		return zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name);
	}
}
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;
	}
}
[BepInPlugin("balrond.astafaraios.RavenwoodBalrdonPieces", "RavenwoodBalrdonPieces", "1.0.4")]
public class Launch : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Player), "UseStamina")]
	private class Player_UseStamina
	{
		private static bool Prefix()
		{
			if (Player.m_debugMode && ((Terminal)Console.instance).IsCheatsEnabled())
			{
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(AudioMan), "Awake")]
	private static class AudioMan_Awake_Patch
	{
		private static void Postfix(AudioMan __instance)
		{
			foreach (GameObject itemPrefab in modResourceLoader.itemPrefabs)
			{
				AudioSource[] componentsInChildren = itemPrefab.GetComponentsInChildren<AudioSource>(true);
				foreach (AudioSource val in componentsInChildren)
				{
					val.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
				}
			}
			foreach (GameObject buildPrefab in modResourceLoader.buildPrefabs)
			{
				AudioSource[] componentsInChildren2 = buildPrefab.GetComponentsInChildren<AudioSource>(true);
				foreach (AudioSource val2 in componentsInChildren2)
				{
					val2.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
				}
			}
			foreach (GameObject monsterPrefab in modResourceLoader.monsterPrefabs)
			{
				AudioSource[] componentsInChildren3 = monsterPrefab.GetComponentsInChildren<AudioSource>(true);
				foreach (AudioSource val3 in componentsInChildren3)
				{
					val3.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
				}
			}
			foreach (GameObject vfxPrefab in modResourceLoader.vfxPrefabs)
			{
				AudioSource[] componentsInChildren4 = vfxPrefab.GetComponentsInChildren<AudioSource>(true);
				foreach (AudioSource val4 in componentsInChildren4)
				{
					val4.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
				}
			}
			foreach (GameObject vegetationPrefab in modResourceLoader.vegetationPrefabs)
			{
				AudioSource[] componentsInChildren5 = vegetationPrefab.GetComponentsInChildren<AudioSource>(true);
				foreach (AudioSource val5 in componentsInChildren5)
				{
					val5.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup;
				}
			}
		}
	}

	[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
	public static class Object_CopyOtherDB_Path
	{
		public static void Postfix()
		{
			if (IsObjectDBValid())
			{
				modResourceLoader.setupBuildPiecesListDB();
				databaseAddMethods.AddItems(modResourceLoader.itemPrefabs);
				databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects);
				databaseAddMethods.AddRecipes(modResourceLoader.recipes);
			}
		}
	}

	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	public static class ObjectDB_Awake_Path
	{
		public static void Postfix()
		{
			if (IsObjectDBValid())
			{
				modResourceLoader.setupBuildPiecesListDB();
				databaseAddMethods.AddItems(modResourceLoader.itemPrefabs);
				databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects);
				databaseAddMethods.AddRecipes(modResourceLoader.recipes);
				ObjectDB.instance.m_recipes.Sort(SortByScore);
			}
		}

		private static int SortByScore(Recipe p1, Recipe p2)
		{
			if ((Object)(object)p1.m_item == (Object)null)
			{
				return 0;
			}
			if ((Object)(object)p2.m_item == (Object)null)
			{
				return 1;
			}
			return ((Object)p1.m_item).name.CompareTo(((Object)p2.m_item).name);
		}
	}

	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	public static class ZNetScene_Awake_Path
	{
		public static bool hasSpawned;

		public static void Prefix(ZNetScene __instance)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance == (Object)null)
			{
				Debug.LogWarning((object)(projectName + ": No ZnetScene found"));
				return;
			}
			fxReplacment.setInstance(__instance.m_prefabs);
			modResourceLoader.FixAllFx(fxReplacment);
			modResourceLoader.AddPrefabsToZnetScene(__instance);
			if (!Launch.hasSpawned)
			{
				buildPieceBuilder.SetupBuildPieces(__instance.m_prefabs);
				hasSpawned = true;
				if (!new ZNet().IsDedicated())
				{
					ShaderReplacment.runMaterialFix();
				}
			}
		}
	}

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

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

	public const string PluginName = "RavenwoodBalrdonPieces";

	public const string PluginVersion = "1.0.4";

	public static ModResourceLoader modResourceLoader = new ModResourceLoader();

	public static FxReplacment fxReplacment = new FxReplacment();

	public static DatabaseAddMethods databaseAddMethods = new DatabaseAddMethods();

	public static BuildPieceBuilder buildPieceBuilder = new BuildPieceBuilder();

	public static string projectName = "BalrondRavenWoodBuildPieces";

	public static GameObject RootObject;

	public static GameObject PrefabContainer;

	public static bool hasSpawned = false;

	private void Awake()
	{
		createPrefabContainer();
		modResourceLoader.loadAssets();
		harmony.PatchAll();
	}

	public void createPrefabContainer()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		RootObject = new GameObject("_ValheimReforgedRoot");
		Object.DontDestroyOnLoad((Object)(object)RootObject);
		PrefabContainer = new GameObject("Prefabs");
		PrefabContainer.transform.parent = RootObject.transform;
		PrefabContainer.SetActive(false);
	}

	public static GameObject cloneMe(GameObject source, string name)
	{
		GameObject val = Object.Instantiate<GameObject>(source, PrefabContainer.transform);
		((Object)val).name = name;
		fixMaterials(val, source);
		val.SetActive(true);
		return val;
	}

	public static GameObject fixMaterials(GameObject clone, GameObject source)
	{
		MeshRenderer[] componentsInChildren = source.GetComponentsInChildren<MeshRenderer>();
		foreach (MeshRenderer val in componentsInChildren)
		{
			MeshRenderer[] componentsInChildren2 = clone.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val2 in componentsInChildren2)
			{
				if (((Object)val).name == ((Object)val2).name)
				{
					((Renderer)val2).materials = ((Renderer)val).sharedMaterials;
					((Renderer)val2).sharedMaterials = ((Renderer)val).sharedMaterials;
					break;
				}
			}
		}
		return clone;
	}

	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 class BuildPieceBuilder
{
	private List<GameObject> list;

	private string[] piecesNames = BuildPieceList.buildPieces;

	private CraftingStation workbench;

	private CraftingStation tannery;

	private CraftingStation runeForge;

	private CraftingStation alchemyLab;

	private CraftingStation grill;

	private CraftingStation fletcher;

	private CraftingStation blackforge;

	private CraftingStation forge;

	private CraftingStation cauldron;

	private CraftingStation stonecutter;

	public void SetupBuildPieces(List<GameObject> list)
	{
		setupTables(list);
		this.list = list;
		string[] array = piecesNames;
		foreach (string name in array)
		{
			GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("Cant find buildpiece with name: " + name));
			}
			else
			{
				EditBuildPiece(val);
			}
		}
	}

	private void EditBuildPiece(GameObject gameObject)
	{
		//IL_3447: Unknown result type (might be due to invalid IL or missing references)
		//IL_33cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_3656: Unknown result type (might be due to invalid IL or missing references)
		//IL_2b50: Unknown result type (might be due to invalid IL or missing references)
		//IL_2cf9: Unknown result type (might be due to invalid IL or missing references)
		//IL_3ad7: Unknown result type (might be due to invalid IL or missing references)
		//IL_3c95: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f7f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3aa7: Unknown result type (might be due to invalid IL or missing references)
		//IL_2ca6: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f07: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a08: Unknown result type (might be due to invalid IL or missing references)
		//IL_398b: Unknown result type (might be due to invalid IL or missing references)
		//IL_29e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_214d: Unknown result type (might be due to invalid IL or missing references)
		//IL_36ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_386f: Unknown result type (might be due to invalid IL or missing references)
		//IL_39bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_340b: Unknown result type (might be due to invalid IL or missing references)
		//IL_3772: Unknown result type (might be due to invalid IL or missing references)
		//IL_1da3: Unknown result type (might be due to invalid IL or missing references)
		//IL_22a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_3720: Unknown result type (might be due to invalid IL or missing references)
		//IL_1884: Unknown result type (might be due to invalid IL or missing references)
		//IL_395b: Unknown result type (might be due to invalid IL or missing references)
		//IL_197e: Unknown result type (might be due to invalid IL or missing references)
		//IL_2ecb: Unknown result type (might be due to invalid IL or missing references)
		//IL_2d9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b8d: Unknown result type (might be due to invalid IL or missing references)
		//IL_3b07: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b23: Unknown result type (might be due to invalid IL or missing references)
		//IL_2a15: Unknown result type (might be due to invalid IL or missing references)
		//IL_2dda: Unknown result type (might be due to invalid IL or missing references)
		//IL_39eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_32a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_2b17: Unknown result type (might be due to invalid IL or missing references)
		//IL_25ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_34c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_21bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_2434: Unknown result type (might be due to invalid IL or missing references)
		//IL_297f: Unknown result type (might be due to invalid IL or missing references)
		//IL_305f: Unknown result type (might be due to invalid IL or missing references)
		//IL_2e52: Unknown result type (might be due to invalid IL or missing references)
		//IL_2af5: Unknown result type (might be due to invalid IL or missing references)
		//IL_3393: Unknown result type (might be due to invalid IL or missing references)
		//IL_2b9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_361a: Unknown result type (might be due to invalid IL or missing references)
		//IL_35a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ae6: Unknown result type (might be due to invalid IL or missing references)
		//IL_3cdc: Unknown result type (might be due to invalid IL or missing references)
		//IL_2620: Unknown result type (might be due to invalid IL or missing references)
		//IL_193a: Unknown result type (might be due to invalid IL or missing references)
		//IL_19c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_3484: Unknown result type (might be due to invalid IL or missing references)
		//IL_2c02: Unknown result type (might be due to invalid IL or missing references)
		//IL_2011: Unknown result type (might be due to invalid IL or missing references)
		//IL_17c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_1853: Unknown result type (might be due to invalid IL or missing references)
		//IL_331a: Unknown result type (might be due to invalid IL or missing references)
		//IL_17f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_31e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d47: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e15: Unknown result type (might be due to invalid IL or missing references)
		//IL_2abc: Unknown result type (might be due to invalid IL or missing references)
		//IL_23b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_3c4f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3915: Unknown result type (might be due to invalid IL or missing references)
		//IL_32de: Unknown result type (might be due to invalid IL or missing references)
		//IL_2a8c: Unknown result type (might be due to invalid IL or missing references)
		//IL_2e16: Unknown result type (might be due to invalid IL or missing references)
		//IL_2231: Unknown result type (might be due to invalid IL or missing references)
		//IL_29b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_3d91: Unknown result type (might be due to invalid IL or missing references)
		//IL_2c6a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c32: Unknown result type (might be due to invalid IL or missing references)
		//IL_316b: Unknown result type (might be due to invalid IL or missing references)
		//IL_3827: Unknown result type (might be due to invalid IL or missing references)
		//IL_2fd1: Unknown result type (might be due to invalid IL or missing references)
		//IL_3a61: Unknown result type (might be due to invalid IL or missing references)
		//IL_3d38: Unknown result type (might be due to invalid IL or missing references)
		//IL_2a5c: Unknown result type (might be due to invalid IL or missing references)
		//IL_37b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_354f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3357: Unknown result type (might be due to invalid IL or missing references)
		//IL_3bf3: Unknown result type (might be due to invalid IL or missing references)
		//IL_3b37: Unknown result type (might be due to invalid IL or missing references)
		//IL_2d61: Unknown result type (might be due to invalid IL or missing references)
		//IL_30b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c8e: Unknown result type (might be due to invalid IL or missing references)
		//IL_18f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_1f5a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ceb: Unknown result type (might be due to invalid IL or missing references)
		//IL_38cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_3a1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_35de: Unknown result type (might be due to invalid IL or missing references)
		//IL_3692: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f43: Unknown result type (might be due to invalid IL or missing references)
		//IL_1efe: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e21: Unknown result type (might be due to invalid IL or missing references)
		//IL_292c: Unknown result type (might be due to invalid IL or missing references)
		//IL_2e8f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3b67: Unknown result type (might be due to invalid IL or missing references)
		//IL_253a: Unknown result type (might be due to invalid IL or missing references)
		//IL_3103: Unknown result type (might be due to invalid IL or missing references)
		//IL_3023: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a7d: Unknown result type (might be due to invalid IL or missing references)
		//IL_389f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3bad: Unknown result type (might be due to invalid IL or missing references)
		//IL_324f: Unknown result type (might be due to invalid IL or missing references)
		//IL_20db: Unknown result type (might be due to invalid IL or missing references)
		//IL_24c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_2081: Unknown result type (might be due to invalid IL or missing references)
		//IL_1fcc: Unknown result type (might be due to invalid IL or missing references)
		//IL_34fd: Unknown result type (might be due to invalid IL or missing references)
		Piece component = gameObject.gameObject.GetComponent<Piece>();
		component.m_resources = (Requirement[])(object)new Requirement[0];
		SetStation(component, workbench);
		switch (((Object)gameObject).name)
		{
		case "straw_floor_2x2_bal":
			AddResources(component, "Dandelion", 5);
			component.m_category = (PieceCategory)2;
			break;
		case "silver_ore_pile_bal":
			SetStation(component, forge);
			AddResources(component, "SilverOre", 30);
			component.m_category = (PieceCategory)0;
			break;
		case "bmetal_ore_pile_bal":
			SetStation(component, forge);
			AddResources(component, "BlackMetalScrap", 30);
			break;
		case "bcopper_ore_pile_bal":
			SetStation(component, forge);
			AddResources(component, "CopperOre", 30);
			component.m_category = (PieceCategory)0;
			break;
		case "biron_ore_pile_bal":
			SetStation(component, forge);
			AddResources(component, "IronScrap", 30);
			component.m_category = (PieceCategory)0;
			break;
		case "flametal_ore_pile_bal":
			SetStation(component, blackforge);
			AddResources(component, "FlametalOreNew", 30);
			break;
		case "clutter_bookset1_bal":
		case "clutter_bookset2_bal":
		case "clutter_bookset3_bal":
			SetStation(component, workbench);
			AddResources(component, "FineWood", 1);
			AddResources(component, "Coal", 1);
			component.m_category = (PieceCategory)4;
			break;
		case "clutter_bottleset_bal":
		case "clutter_cupset_bal":
		case "clutter_tableset_bal":
			SetStation(component, workbench);
			AddResources(component, "Stone", 1);
			AddResources(component, "FineWood", 1);
			component.m_category = (PieceCategory)4;
			break;
		case "Hearth_1x3_bal":
			setFireplaceFuelItem(component, "Wood");
			SetStation(component, stonecutter);
			AddResources(component, "Stone", 6);
			component.m_category = (PieceCategory)0;
			break;
		case "Hearth_2x3_bal":
			setFireplaceFuelItem(component, "Wood");
			SetStation(component, stonecutter);
			AddResources(component, "Stone", 12);
			component.m_category = (PieceCategory)0;
			break;
		case "Hearth_2x2_bal":
			setFireplaceFuelItem(component, "Wood");
			SetStation(component, stonecutter);
			AddResources(component, "Stone", 9);
			component.m_category = (PieceCategory)0;
			break;
		case "charred_chest_bal":
			SetStation(component, blackforge);
			AddResources(component, "CharredBone", 50);
			AddResources(component, "FlametalNew", 30);
			AddResources(component, "MorgenHeart", 2);
			AddResources(component, "Blackwood", 30);
			component.m_category = (PieceCategory)4;
			break;
		case "StatueOdin_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 15);
			AddResources(component, "Stone", 5);
			AddResources(component, "Ruby", 1);
			component.m_category = (PieceCategory)0;
			break;
		case "StatueRaven_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 20);
			component.m_category = (PieceCategory)0;
			break;
		case "StatueThor_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 25);
			AddResources(component, "Stone", 10);
			AddResources(component, "Crystal", 2);
			component.m_category = (PieceCategory)0;
			break;
		case "wood_roof_flat_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Wood", 2);
			break;
		case "dvergr_bed_bal":
			SetStation(component, forge);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Wood", 2);
			AddResources(component, "ScaleHide", 2);
			AddResources(component, "YggdrasilWood", 2);
			AddResources(component, "Copper", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "dvergr_chair_bal":
			SetStation(component, forge);
			AddResources(component, "LeatherScraps", 2);
			AddResources(component, "YggdrasilWood", 2);
			AddResources(component, "Copper", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "dvergr_chest_bal":
			SetStation(component, forge);
			AddResources(component, "BronzeNails", 12);
			AddResources(component, "YggdrasilWood", 5);
			AddResources(component, "Copper", 5);
			component.m_category = (PieceCategory)4;
			break;
		case "dvergr_shelf_bal":
			SetStation(component, forge);
			AddResources(component, "Wood", 2);
			AddResources(component, "YggdrasilWood", 2);
			AddResources(component, "Copper", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "dvergr_stool_bal":
			SetStation(component, forge);
			AddResources(component, "Wood", 2);
			AddResources(component, "YggdrasilWood", 2);
			AddResources(component, "Copper", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "dvergr_table_bal":
			SetStation(component, forge);
			AddResources(component, "IronNails", 8);
			AddResources(component, "Wood", 2);
			AddResources(component, "YggdrasilWood", 2);
			AddResources(component, "Copper", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_chest_private_bal":
			component.m_category = (PieceCategory)4;
			SetStation(component, forge);
			AddResources(component, "BronzeNails", 40);
			AddResources(component, "YggdrasilWood", 25);
			AddResources(component, "DvergrKeyFragment", 1);
			AddResources(component, "Sap", 10);
			break;
		case "bed_noble_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 1);
			AddResources(component, "FineWood", 10);
			AddResources(component, "JuteRed", 2);
			AddResources(component, "LinenThread", 10);
			component.m_category = (PieceCategory)4;
			break;
		case "black_carpet_end_bal":
			SetStation(component, workbench);
			AddResources(component, "TrollHide", 1);
			AddResources(component, "LinenThread", 1);
			AddResources(component, "Coal", 4);
			component.m_category = (PieceCategory)4;
			break;
		case "black_carpet_mid_bal":
			SetStation(component, workbench);
			AddResources(component, "TrollHide", 5);
			AddResources(component, "LinenThread", 4);
			AddResources(component, "Coal", 8);
			AddResources(component, "JuteRed", 1);
			component.m_category = (PieceCategory)4;
			break;
		case "bone_pile_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BoneFragments", 20);
			AddResources(component, "TrophySkeleton", 5);
			component.m_category = (PieceCategory)0;
			break;
		case "core_wood_bed_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "TrollHide", 2);
			AddResources(component, "Dandelion", 3);
			AddResources(component, "RoundLog", 5);
			AddResources(component, "Wood", 3);
			component.m_category = (PieceCategory)4;
			break;
		case "ground_spike_trap_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Root", 2);
			AddResources(component, "Wood", 2);
			AddResources(component, "BoneFragments", 5);
			component.m_category = (PieceCategory)0;
			break;
		case "piece_banner_black1_bal":
			SetStation(component, forge);
			AddResources(component, "FineWood", 1);
			AddResources(component, "LeatherScraps", 4);
			AddResources(component, "Blueberries", 2);
			AddResources(component, "Coal", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_banner_black2_bal":
			SetStation(component, forge);
			AddResources(component, "FineWood", 1);
			AddResources(component, "LeatherScraps", 4);
			AddResources(component, "Cloudberry", 2);
			AddResources(component, "Coal", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_banner_black3_bal":
			SetStation(component, forge);
			AddResources(component, "FineWood", 1);
			AddResources(component, "LeatherScraps", 4);
			AddResources(component, "Guck", 2);
			AddResources(component, "Coal", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_banner_black4_bal":
			SetStation(component, forge);
			AddResources(component, "FineWood", 1);
			AddResources(component, "LeatherScraps", 4);
			AddResources(component, "Bloodbag", 2);
			AddResources(component, "Coal", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_bed03_bal":
			SetStation(component, workbench);
			AddResources(component, "JuteRed", 2);
			AddResources(component, "JuteBlue", 4);
			AddResources(component, "Coal", 10);
			AddResources(component, "YggdrasilWood", 20);
			break;
		case "piece_candlechandelier_bal":
			SetStation(component, forge);
			setFireplaceFuelItem(component, "Honey");
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Honey", 4);
			AddResources(component, "Resin", 8);
			AddResources(component, "Chain", 1);
			AddResources(component, "Iron", 4);
			AddResources(component, "BronzeNails", 8);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_crystal_walltorch_bal":
			SetStation(component, forge);
			setFireplaceFuelItem(component, "Crystal");
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Crystal", 2);
			AddResources(component, "Iron", 1);
			AddResources(component, "BronzeNails", 4);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_crystalchandelier_bal":
			SetStation(component, forge);
			setFireplaceFuelItem(component, "Crystal");
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Crystal", 5);
			AddResources(component, "Iron", 6);
			AddResources(component, "Chain", 1);
			AddResources(component, "BronzeNails", 8);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_chest_jewelbox_bal":
			SetStation(component, forge);
			AddResources(component, "BronzeNails", 20);
			AddResources(component, "FineWood", 10);
			AddResources(component, "HardAntler", 1);
			AddResources(component, "TrollHide", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_chest_stone_bal":
			SetStation(component, stonecutter);
			AddResources(component, "Stone", 30);
			AddResources(component, "Flint", 10);
			AddResources(component, "SharpeningStone", 4);
			AddResources(component, "IronScrap", 8);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_curtain_big_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 2);
			AddResources(component, "JuteRed", 2);
			AddResources(component, "BronzeNails", 8);
			AddResources(component, "LeatherScraps", 8);
			component.m_category = (PieceCategory)4;
			break;
		case "piece_elegant_bench_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 1);
			AddResources(component, "FineWood", 4);
			AddResources(component, "JuteRed", 1);
			AddResources(component, "BronzeNails", 8);
			break;
		case "piece_elegant_bench2_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 1);
			AddResources(component, "FineWood", 4);
			AddResources(component, "JuteRed", 1);
			AddResources(component, "BronzeNails", 8);
			break;
		case "piece_emberwood_stool_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 1);
			AddResources(component, "FineWood", 2);
			AddResources(component, "JuteRed", 1);
			AddResources(component, "BronzeNails", 4);
			break;
		case "piece_emberwoodchair_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 2);
			AddResources(component, "FineWood", 5);
			AddResources(component, "JuteRed", 1);
			AddResources(component, "BronzeNails", 20);
			break;
		case "piece_sofa_bal":
			SetStation(component, forge);
			AddResources(component, "JuteRed", 2);
			AddResources(component, "JuteBlue", 1);
			AddResources(component, "FineWood", 5);
			AddResources(component, "IronNails", 20);
			break;
		case "piece_table_round_noble_bal":
			SetStation(component, forge);
			AddResources(component, "Iron", 2);
			AddResources(component, "FineWood", 6);
			AddResources(component, "JuteRed", 1);
			AddResources(component, "BronzeNails", 8);
			break;
		case "runefire_bal":
			setFireplaceFuelItem(component, "TrophySkeleton");
			SetStation(component, stonecutter);
			AddResources(component, "FineWood", 10);
			AddResources(component, "Thunderstone", 2);
			AddResources(component, "TrophySkeleton", 5);
			AddResources(component, "Flint", 10);
			component.m_category = (PieceCategory)0;
			break;
		case "corewood_crate_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 6);
			AddResources(component, "BronzeNails", 16);
			component.m_category = (PieceCategory)4;
			break;
		case "rug_bear_bal":
			AddResources(component, "BlackBearPelt_TW", 3, 0, "LeatherScraps", 30);
			AddResources(component, "LinenThread", 4);
			component.m_category = (PieceCategory)4;
			break;
		case "rug_neck_bal":
			component.m_name = "Askvin skin simple rug";
			AddResources(component, "AskHide", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "side_wall_decor_bal":
			SetStation(component, workbench);
			AddResources(component, "FineWood", 2);
			component.m_category = (PieceCategory)2;
			break;
		case "StatueWood_bal":
			SetStation(component, workbench);
			AddResources(component, "RoundLog", 10);
			AddResources(component, "Ruby", 1);
			component.m_category = (PieceCategory)0;
			break;
		case "ladder_wood_2m_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 5);
			component.m_category = (PieceCategory)0;
			break;
		case "ladder_wood_4m_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 4);
			component.m_category = (PieceCategory)0;
			break;
		case "linen_carpet_bal":
			AddResources(component, "Bloodbag", 2);
			AddResources(component, "LinenThread", 10);
			component.m_category = (PieceCategory)4;
			break;
		case "rug_troll_bal":
			AddResources(component, "TrollHide", 5);
			component.m_category = (PieceCategory)4;
			break;
		case "rug_fox_bal":
			AddResources(component, "FoxPelt_TW", 2, 0, "LeatherScraps", 20);
			AddResources(component, "LinenThread", 4);
			component.m_category = (PieceCategory)4;
			break;
		case "rug_fenring_bal":
			AddResources(component, "WolfHairBundle", 3);
			AddResources(component, "WolfPelt", 1);
			AddResources(component, "Wood", 2);
			component.m_category = (PieceCategory)4;
			break;
		case "rug_vigvisir_bal":
			AddResources(component, "Coal", 4);
			AddResources(component, "JuteRed", 4);
			AddResources(component, "StrawThread_bal", 8);
			AddResources(component, "Bloodbag", 1);
			component.m_category = (PieceCategory)4;
			break;
		case "dverger_gate_bal":
			SetStation(component, blackforge);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 6);
			AddResources(component, "Iron", 6);
			AddResources(component, "MechanicalSpring", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "piece_grausten_roof_45_top_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Grausten", 5);
			component.m_category = (PieceCategory)3;
			break;
		case "dvergr_secretdoor_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 13);
			AddResources(component, "MechanicalSpring", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "giant_metal_gate_bal":
			SetStation(component, blackforge);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 6);
			AddResources(component, "Iron", 6);
			AddResources(component, "MechanicalSpring", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_floor4m_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 12);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_roof27_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 6);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_stone_ladder_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 4);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_stair_inner_bal":
		case "blackmarble_stair_outer_bal":
		case "blackmarble_2x2x1_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 6);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_long_stair_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 16);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_Wall_Window_2x2_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 4);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_stair_corner_bal":
		case "blackmarble_stair_corner_left_bal":
		case "blackmarble_head_big01_bal":
		case "blackmarble_head_big02_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 8);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_creep_slope_inverted_2x2x1_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_slope1x2_inverted_bal":
		case "blackmarble_slope1x2_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "blackmarble_1x1_enforced_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "BlackMarble", 2);
			AddResources(component, "CopperScrap", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_1x1_enforced_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 3);
			AddResources(component, "CopperScrap", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "crystal_tile_floor_2x2_bal":
		case "crystal_wall_2x2_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Crystal", 3);
			component.m_category = (PieceCategory)3;
			break;
		case "emberwood_pillar2_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 3);
			AddResources(component, "Flint", 2);
			component.m_category = (PieceCategory)2;
			break;
		case "emberwood_pillar4_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 6);
			AddResources(component, "Flint", 4);
			component.m_category = (PieceCategory)2;
			break;
		case "piece_braziercolumn_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 8);
			AddResources(component, "Iron", 2);
			AddResources(component, "Coal", 2);
			component.m_category = (PieceCategory)3;
			setFireplaceFuelItem(component, "Coal");
			break;
		case "plate_gate_bal":
			SetStation(component, forge);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "FineWood", 4);
			AddResources(component, "Iron", 2);
			AddResources(component, "BlackMetal", 4);
			component.m_category = (PieceCategory)3;
			break;
		case "rawstone_pole_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 2);
			AddResources(component, "Flint", 2);
			AddResources(component, "Wood", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "rune_floor_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 8);
			AddResources(component, "Crystal", 4);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_floor4m_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 12);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_floor_triangle_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 3);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_long_stair_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 16);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_beam_bal":
		case "stone_pole_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_pole2_bal":
		case "stone_railing_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 3);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_roof27_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 6);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_stair_corner_bal":
		case "stone_stair_corner_left_bal":
		case "stone_stair_outer_bal":
		case "stone_stair_inner_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 8);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_stair_railing_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 10);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_stair_railing_right_bal":
		case "stone_stair_railing_left_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 9);
			component.m_category = (PieceCategory)3;
			break;
		case "stone_stepladder_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 5);
			component.m_category = (PieceCategory)3;
			break;
		case "stonemoss_tile_floor_2x2_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 6);
			AddResources(component, "Wood", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "vigvisir_floor_bal":
			SetStation(component, stonecutter);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "Stone", 10);
			AddResources(component, "Coal", 5);
			component.m_category = (PieceCategory)3;
			break;
		case "Piece_hardwood_pillar_arch_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 3);
			SetStation(component, workbench);
			component.m_category = (PieceCategory)2;
			break;
		case "Piece_hardwood_pillar_arch_small_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 1);
			SetStation(component, workbench);
			component.m_category = (PieceCategory)2;
			break;
		case "Piece_hardwood_pillarbase_tapered_bal":
		case "Piece_hardwood_pillarbase_tapered_inverted_bal":
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 3);
			SetStation(component, workbench);
			component.m_category = (PieceCategory)2;
			break;
		case "Piece_hardwood_pillarbeam_medium_bal":
		case "Piece_hardwood_pillarbase_medium_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 2);
			component.m_category = (PieceCategory)2;
			break;
		case "Piece_hardwood_pillarbeam_small_bal":
		case "Piece_hardwood_pillarbase_small_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 1);
			component.m_category = (PieceCategory)2;
			break;
		case "piece_hardwood_roof_45_bal":
		case "piece_hardwood_roof_45_arch_bal":
		case "piece_hardwood_roof_45_arch_corner_bal":
		case "piece_hardwood_roof_45_arch_corner2_bal":
		case "piece_hardwood_roof_45_corner_bal":
		case "piece_hardwood_roof_45_corner2_bal":
		case "piece_hardwood_roof_45_top_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 2);
			AddResources(component, "Flint", 2);
			component.m_category = (PieceCategory)2;
			break;
		case "hardwood_door_bal":
			SetStation(component, workbench);
			component.m_resources = (Requirement[])(object)new Requirement[0];
			AddResources(component, "RoundLog", 3);
			AddResources(component, "IronScrap", 2);
			component.m_category = (PieceCategory)2;
			break;
		case "bg_stake_wall_bal":
			SetStation(component, workbench);
			AddResources(component, "RoundLog", 8);
			AddResources(component, "Wood", 4);
			component.m_category = (PieceCategory)0;
			break;
		case "bush_roof_bal":
		case "bush_roof_icorner_bal":
		case "bush_roof_ocorner_bal":
		case "bush_roof_top_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 2);
			AddResources(component, "Dandelion", 1);
			break;
		case "wood_long_stair_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 6);
			component.m_category = (PieceCategory)2;
			break;
		case "piece_sharpstakes_big_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 10);
			AddResources(component, "RoundLog", 10);
			component.m_category = (PieceCategory)0;
			break;
		case "core_wood_wall_2_bal":
			SetStation(component, workbench);
			AddResources(component, "RoundLog", 2);
			component.m_category = (PieceCategory)2;
			break;
		case "core_wood_wall_4_bal":
			SetStation(component, workbench);
			AddResources(component, "RoundLog", 4);
			component.m_category = (PieceCategory)2;
			break;
		case "wood_iron_log_beam4_bal":
		case "wood_iron_log_pole4_bal":
			SetStation(component, forge);
			AddResources(component, "RoundLog", 2);
			AddResources(component, "Iron", 1);
			component.m_category = (PieceCategory)2;
			break;
		case "leather_roof_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 1);
			AddResources(component, "LeatherScraps", 1);
			component.m_category = (PieceCategory)2;
			break;
		case "ClayBeam_bal":
			SetStation(component, workbench);
			AddResources(component, "Flint", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "ClayCube_bal":
			SetStation(component, workbench);
			AddResources(component, "Flint", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "ClayPole_bal":
			SetStation(component, workbench);
			AddResources(component, "Flint", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "clayr_arch_bal":
			SetStation(component, workbench);
			AddResources(component, "Flint", 1);
			component.m_category = (PieceCategory)3;
			break;
		case "ClayWall_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 2);
			AddResources(component, "Flint", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "clay_floor_2x2_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 2);
			AddResources(component, "Flint", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "clay_stair_bal":
			SetStation(component, workbench);
			AddResources(component, "Flint", 2);
			component.m_category = (PieceCategory)3;
			break;
		case "wood_beam4_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 3);
			component.m_category = (PieceCategory)2;
			break;
		case "wood_pillar4_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 4);
			component.m_category = (PieceCategory)2;
			break;
		case "wood_pole4_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 3);
			component.m_category = (PieceCategory)2;
			break;
		case "rostrum_bal":
			SetStation(component, workbench);
			AddResources(component, "FineWood", 3);
			AddResources(component, "Resin", 3);
			component.m_category = (PieceCategory)4;
			break;
		case "sulfur_cauldron_bal":
			SetStation(component, forge);
			AddResources(component, "BlackMetal", 3);
			AddResources(component, "SulfurStone", 3);
			component.m_category = (PieceCategory)4;
			break;
		case "target_practice_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 3);
			AddResources(component, "Dandelion", 3);
			AddResources(component, "LeatherScraps", 3);
			component.m_category = (PieceCategory)4;
			break;
		case "fishing_rack_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 3);
			AddResources(component, "FishRaw", 5);
			component.m_category = (PieceCategory)4;
			break;
		case "animal_cages_bal":
			SetStation(component, workbench);
			AddResources(component, "Wood", 10);
			AddResources(component, "LeatherScraps", 5);
			component.m_category = (PieceCategory)4;
			break;
		case "supply_shelf_bal":
			SetStation(component, workbench);
			AddResources(component, "FineWood", 5);
			AddResources(component, "Bronze", 2);
			AddResources(component, "LeatherScraps", 3);
			component.m_category = (PieceCategory)4;
			break;
		case "weapon_rack_bal":
			SetStation(component, forge);
			AddResources(component, "Wood", 6);
			AddResources(component, "Iron", 1);
			AddResources(component, "Bronze", 1);
			component.m_category = (PieceCategory)4;
			break;
		}
	}

	private void setFireplaceFuelItem(Piece piece, string name, int startFuel = -1, int maxFuel = -1, float secPerFuel = -1f)
	{
		Fireplace component = ((Component)piece).GetComponent<Fireplace>();
		component.m_fuelItem = FindItem(list, name).GetComponent<ItemDrop>();
		component.m_startFuel = ((startFuel != -1) ? ((float)startFuel) : component.m_startFuel);
		component.m_maxFuel = ((maxFuel != -1) ? ((float)maxFuel) : component.m_maxFuel);
		component.m_secPerFuel = ((secPerFuel != -1f) ? secPerFuel : component.m_secPerFuel);
	}

	private void SetStation(Piece piece, CraftingStation station)
	{
		piece.m_craftingStation = station;
	}

	private void EditResource(Piece piece, string itemName, int amount, bool remove = false)
	{
		if (remove)
		{
			List<Requirement> list = new List<Requirement>();
			Requirement[] resources = piece.m_resources;
			foreach (Requirement val in resources)
			{
				if (((Object)((Component)val.m_resItem).gameObject).name != itemName)
				{
					list.Add(val);
				}
			}
			piece.m_resources = list.ToArray();
			return;
		}
		Requirement[] resources2 = piece.m_resources;
		foreach (Requirement val2 in resources2)
		{
			if (((Object)((Component)val2.m_resItem).gameObject).name == itemName)
			{
				val2.m_amount = amount;
			}
		}
	}

	private void AddResources(Piece piece, string itemName, int amount, int amountPerLevel = 0, string altItem = "", int altAmount = 0, int altAmountPerLevel = 0)
	{
		List<Requirement> list = new List<Requirement>();
		list.AddRange(piece.m_resources);
		Requirement item = createReq(itemName, amount, amountPerLevel, altItem, altAmount, altAmountPerLevel);
		list.Add(item);
		piece.m_resources = list.ToArray();
	}

	private Requirement createReq(string name, int amount, int amountPerLevel, string altItem = "", int altAmount = 0, int altAmountPerLevel = 0)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		Requirement val = new Requirement();
		val.m_recover = true;
		GameObject val2 = list.Find((GameObject x) => ((Object)x).name == name);
		if ((Object)(object)val2 != (Object)null)
		{
			ItemDrop component = val2.GetComponent<ItemDrop>();
			val.m_amount = amount;
			val.m_amountPerLevel = amountPerLevel;
			val.m_resItem = component;
		}
		else
		{
			val2 = FindItem(list, altItem);
			ItemDrop component2 = val2.GetComponent<ItemDrop>();
			val.m_amount = altAmount;
			val.m_amountPerLevel = altAmountPerLevel;
			val.m_resItem = component2;
		}
		return val;
	}

	private GameObject FindItem(List<GameObject> list, string name, bool isStation = false)
	{
		GameObject val = list.Find((GameObject x) => ((Object)x).name == name);
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		if ((Object)(object)val == (Object)null && isStation)
		{
			return null;
		}
		Debug.LogWarning((object)(Launch.projectName + ": Item Not Found - " + name + ", Replaced With Wood"));
		return list.Find((GameObject x) => ((Object)x).name == "Wood");
	}

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

	private void getSignToWork(Piece newSign)
	{
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = list.Find((GameObject x) => ((Object)x).name == "Sign");
		if ((Object)(object)val != (Object)null)
		{
			Debug.LogWarning((object)"Fixing sign values");
			TextMeshProUGUI textWidget = val.GetComponent<Sign>().m_textWidget;
			TextMeshProUGUI textWidget2 = ((Component)newSign).GetComponent<Sign>().m_textWidget;
			((TMP_Text)textWidget2).font = ((TMP_Text)textWidget).font;
			((Graphic)textWidget2).color = ((Graphic)textWidget).color;
			((TMP_Text)textWidget2).fontSize = ((TMP_Text)textWidget).fontSize;
			((TMP_Text)textWidget2).fontStyle = ((TMP_Text)textWidget).fontStyle;
			((TMP_Text)textWidget2).fontSizeMax = ((TMP_Text)textWidget).fontSizeMax;
			((TMP_Text)textWidget2).fontFeatures = ((TMP_Text)textWidget).fontFeatures;
			((TMP_Text)textWidget2).fontSharedMaterial = ((TMP_Text)textWidget).fontSharedMaterial;
			((TMP_Text)textWidget2).fontSharedMaterials = ((TMP_Text)textWidget).fontSharedMaterials;
			((TMP_Text)textWidget2).fontMaterial = ((TMP_Text)textWidget).fontMaterial;
			((TMP_Text)textWidget2).fontMaterials = ((TMP_Text)textWidget).fontMaterials;
		}
	}

	private void setupTables(List<GameObject> list)
	{
		workbench = FindStation(list, "piece_workbench");
		if ((Object)(object)workbench == (Object)null)
		{
			Debug.LogWarning((object)"Did not foundpiece_workbench");
		}
		tannery = FindStation(list, "piece_tannery");
		if ((Object)(object)tannery == (Object)null)
		{
			tannery = workbench;
		}
		blackforge = FindStation(list, "blackforge");
		if ((Object)(object)blackforge == (Object)null)
		{
			Debug.LogWarning((object)"Did not foundblackforge");
		}
		forge = FindStation(list, "forge");
		if ((Object)(object)forge == (Object)null)
		{
			Debug.LogWarning((object)"Did not foundforge");
		}
		cauldron = FindStation(list, "piece_cauldron");
		if ((Object)(object)cauldron == (Object)null)
		{
			Debug.LogWarning((object)"Did not foundpiece_cauldron");
		}
		runeForge = FindStation(list, "piece_runeforge");
		if ((Object)(object)runeForge == (Object)null)
		{
			runeForge = forge;
		}
		alchemyLab = FindStation(list, "piece_alchemylab");
		if ((Object)(object)alchemyLab == (Object)null)
		{
			alchemyLab = cauldron;
		}
		grill = FindStation(list, "piece_grill");
		if ((Object)(object)grill == (Object)null)
		{
			grill = cauldron;
		}
		fletcher = FindStation(list, "piece_fletcher");
		if ((Object)(object)fletcher == (Object)null)
		{
			fletcher = workbench;
		}
		stonecutter = FindStation(list, "piece_stonecutter");
		if ((Object)(object)stonecutter == (Object)null)
		{
			Debug.LogWarning((object)"Did not foundpiece_stonecutter");
			stonecutter = workbench;
		}
	}
}
public class BuildPieceTargeting
{
	private static string[] names = new string[0];

	public void changePieceTargeting(List<GameObject> gameObjects)
	{
		List<GameObject> list = gameObjects.FindAll((GameObject x) => (Object)(object)x.GetComponent<WearNTear>() != (Object)null);
		foreach (GameObject item in list)
		{
			Piece component = item.GetComponent<Piece>();
			if ((Object)(object)component != (Object)null && names.Contains(((Object)item).name))
			{
				((StaticTarget)component).m_primaryTarget = true;
			}
			if ((Object)(object)component != (Object)null && shouldBePrimaryTarget(item))
			{
				((StaticTarget)component).m_primaryTarget = true;
			}
			setResistances(item);
		}
	}

	private bool shouldBePrimaryTarget(GameObject gameObject)
	{
		if ((Object)(object)gameObject.GetComponent<Door>() != (Object)null)
		{
			return true;
		}
		if ((Object)(object)gameObject.GetComponent<CraftingStation>() != (Object)null)
		{
			return true;
		}
		if ((Object)(object)gameObject.GetComponent<StationExtension>() != (Object)null)
		{
			return true;
		}
		if ((Object)(object)gameObject.GetComponent<Container>() != (Object)null)
		{
			return false;
		}
		return false;
	}

	private void setResistances(GameObject gameObject)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		WearNTear component = gameObject.GetComponent<WearNTear>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_damages.m_chop = setChopDamageResistance(component);
			component.m_damages.m_pickaxe = setPickaxeDamageResistance(component);
			component.m_damages.m_fire = setFireDamageResistance(component);
		}
	}

	private DamageModifier setChopDamageResistance(WearNTear wearNTear)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected I4, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		MaterialType materialType = wearNTear.m_materialType;
		MaterialType val = materialType;
		return (DamageModifier)((int)val switch
		{
			0 => 6, 
			3 => 2, 
			2 => 5, 
			1 => 1, 
			_ => 0, 
		});
	}

	private DamageModifier setPickaxeDamageResistance(WearNTear wearNTear)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected I4, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		MaterialType materialType = wearNTear.m_materialType;
		MaterialType val = materialType;
		return (DamageModifier)((int)val switch
		{
			0 => 0, 
			3 => 1, 
			2 => 2, 
			1 => 6, 
			_ => 0, 
		});
	}

	private DamageModifier setFireDamageResistance(WearNTear wearNTear)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected I4, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		MaterialType materialType = wearNTear.m_materialType;
		MaterialType val = materialType;
		return (DamageModifier)((int)val switch
		{
			0 => 6, 
			3 => 2, 
			2 => 0, 
			1 => 5, 
			_ => 0, 
		});
	}
}
public class Resource
{
	public int amount = 1;

	public int amountPerLevel = 0;

	public bool recovery = true;

	public ItemDrop itemDrop;

	public Requirement pieceConfig;

	public string item = "Wood";

	public Resource()
	{
	}

	public Resource(string item, int amount, int amountPerLevel = 0, bool recovery = true)
	{
		this.item = item;
		this.amount = amount;
		this.amountPerLevel = amountPerLevel;
		this.recovery = recovery;
	}

	public void setItemDrop(GameObject prefab)
	{
		if ((Object)(object)prefab.GetComponent<ItemDrop>() != (Object)null)
		{
			itemDrop = prefab.GetComponent<ItemDrop>();
		}
		else
		{
			Debug.LogWarning((object)("DVERGER FURNITURE: NO ITEM DROP FOUND on prefab name: " + ((Object)prefab).name));
		}
	}

	public Requirement getPieceConfig()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_003e: Expected O, but got Unknown
		Requirement val = new Requirement
		{
			m_resItem = itemDrop,
			m_amount = amount,
			m_amountPerLevel = amountPerLevel,
			m_recover = recovery
		};
		Requirement result = val;
		pieceConfig = val;
		return result;
	}
}