Decompiled source of balrond amazing nature v1.2.1

plugins/BalrondAmazingNature.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BalrondArsenalReborn;
using BalrondNature.WorldEdit;
using BalrondNature.WorldEdit.Vegetation;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
using LitJson2;
using SoftReferenceableAssets;
using UnityEngine;
using UnityEngine.Events;
using UpgradeWorld;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BalrondNature")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BalrondNature")]
[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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal static class Compatibility
{
	private const string AlienID = "ZenDragon.ZenWorldSettings";

	private static bool _isLoaded;

	private static bool _Check;

	public static bool IsLoaded()
	{
		if (!_Check)
		{
			_isLoaded = Chainloader.PluginInfos.ContainsKey("ZenDragon.ZenWorldSettings");
			if (_isLoaded)
			{
				Debug.Log((object)"Amazing Nature: Using ZenWorldSettings, Disabled Crypt Key consume");
			}
			_Check = true;
		}
		return _isLoaded;
	}
}
internal static class Compatibility2
{
	public const string AlienID = "ZenDragon.ZenCombat";

	private static bool _isLoaded;

	private static bool _Check;

	public static bool IsLoaded()
	{
		if (!_Check)
		{
			_isLoaded = Chainloader.PluginInfos.ContainsKey("ZenDragon.ZenCombat");
			if (_isLoaded)
			{
				Debug.Log((object)"Amazing Nature: Using ZenDragon.ZenCombat, Disabled Parry/Block changes");
			}
			_Check = true;
		}
		return _isLoaded;
	}
}
public class OfferingStation : MonoBehaviour, Hoverable, Interactable
{
	public string m_name = "Offer station";

	public string m_useItemText = "Use";

	public ItemDrop m_requiredItem;

	public int m_requiredItemAmount = 1;

	public string m_statusEffectName = "";

	public bool m_spawnStatusEffect = true;

	public GameObject m_aoePrefab;

	public GameObject m_spawnPoint = null;

	public bool m_spawnItem = false;

	public ItemDrop m_itemPrefab;

	public Transform m_itemSpawnPoint;

	public string m_setGlobalKey = "";

	public float m_SpawnDelay = 2f;

	public float m_spawnOffset = 0f;

	[Header("Effects")]
	public EffectList m_fuelAddedEffects = new EffectList();

	public EffectList m_spawnStartEffects = new EffectList();

	public EffectList m_spawnFinishEffects = new EffectList();

	public GameObject m_enabledObject;

	public GameObject m_disabledObject;

	public GameObject m_haveFuelObject;

	public Transform m_roofCheckPoint;

	public bool m_requiresRoof = false;

	public bool m_canBeOutside = true;

	public Switch m_addWoodSwitch;

	public bool m_useFuel = false;

	public ItemDrop m_fuelItem;

	public int m_maxFuel = 0;

	public float m_secPerFuel = 2000f;

	public bool m_requireFire = false;

	public Transform[] m_fireCheckPoints;

	public float m_fireCheckRadius = 0.25f;

	private bool m_blockedSmoke;

	public SmokeSpawner m_smokeSpawner;

	public Animator[] m_animators;

	private ZNetView m_nview;

	private string m_requiredItemName;

	private void Awake()
	{
		m_nview = ((Component)this).GetComponent<ZNetView>();
		if ((Object)(object)m_nview == (Object)null || m_nview.GetZDO() == null)
		{
			ZLog.Log((object)"Missing ZnetView Component");
			return;
		}
		validateAoe();
		m_requiredItemName = m_requiredItem.m_itemData.m_shared.m_name;
		if (Object.op_Implicit((Object)(object)m_addWoodSwitch))
		{
		}
		((MonoBehaviour)this).InvokeRepeating("UpdateOfferingStation", 1f, 1f);
	}

	private bool validateAoe()
	{
		if ((Object)(object)m_aoePrefab.GetComponent<Aoe>() == (Object)null)
		{
			ZLog.Log((object)"m_aoePrefab Missing Aoe Component");
			return false;
		}
		return true;
	}

	public string GetHoverText()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false))
		{
			return Localization.instance.Localize(m_name + "\n$piece_noaccess");
		}
		return Localization.instance.Localize(m_name + "\n[<color=yellow><b>1-8</b></color>] \n" + m_useItemText) + " " + Localization.instance.Localize(((Component)m_requiredItem).GetComponent<ItemDrop>().m_itemData.m_shared.m_name) + " amount: " + m_requiredItemAmount;
	}

	public string GetHoverName()
	{
		return m_name;
	}

	public bool Interact(Humanoid user, bool hold, bool alt)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		if (hold || IsSpawnQueued())
		{
			return false;
		}
		if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
		{
			return true;
		}
		if (m_blockedSmoke)
		{
			((Character)user).Message((MessageType)2, "Smoke blocked", 0, (Sprite)null);
			return false;
		}
		if (!IsActive())
		{
			return false;
		}
		if (Spawn(GetSpawnPosition()))
		{
			((Character)user).Message((MessageType)2, "$msg_offerdone", 0, (Sprite)null);
			if (Object.op_Implicit((Object)(object)m_itemSpawnPoint))
			{
				m_fuelAddedEffects.Create(m_itemSpawnPoint.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
			}
		}
		return true;
	}

	public bool UseItem(Humanoid user, ItemData item)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		if (IsSpawnQueued())
		{
			return true;
		}
		if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
		{
			return true;
		}
		if (m_blockedSmoke)
		{
			((Character)user).Message((MessageType)2, "Smoke blocked", 0, (Sprite)null);
			return false;
		}
		if (!IsActive())
		{
			return false;
		}
		if ((Object)(object)m_requiredItem == (Object)null)
		{
			return false;
		}
		if (item.m_shared.m_name == m_requiredItemName)
		{
			int num = user.GetInventory().CountItems(m_requiredItemName, -1, true);
			if (num < m_requiredItemAmount)
			{
				((Character)user).Message((MessageType)2, "$msg_incompleteoffering: " + Localization.instance.Localize(m_requiredItemName) + " " + num + " / " + m_requiredItemAmount, 0, (Sprite)null);
				return true;
			}
			if (m_spawnStatusEffect && (Object)(object)m_aoePrefab == (Object)null)
			{
				Debug.LogWarning((object)"Missing Status Effect Prefab[AoE]");
				return true;
			}
			if (m_spawnItem && (Object)(object)m_itemPrefab == (Object)null)
			{
				Debug.LogWarning((object)"Missing ItemDrop Prefab");
				return true;
			}
			bool flag = false;
			if (((Object)(object)m_aoePrefab != (Object)null && m_spawnStatusEffect) || ((Object)(object)m_itemPrefab != (Object)null && m_spawnItem))
			{
				flag = Spawn(GetSpawnPosition());
			}
			if (flag)
			{
				user.GetInventory().RemoveItem(item.m_shared.m_name, m_requiredItemAmount, -1, true);
				((Character)user).ShowRemovedMessage(m_requiredItem.m_itemData, m_requiredItemAmount);
				((Character)user).Message((MessageType)2, "$msg_offerdone", 0, (Sprite)null);
				if (Object.op_Implicit((Object)(object)m_itemSpawnPoint))
				{
					m_fuelAddedEffects.Create(m_itemSpawnPoint.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1);
				}
				if (!string.IsNullOrEmpty(m_setGlobalKey))
				{
					ZoneSystem.instance.SetGlobalKey(m_setGlobalKey);
				}
			}
			return flag;
		}
		((Character)user).Message((MessageType)2, "$msg_offerwrong", 0, (Sprite)null);
		return true;
	}

	public bool IsActive()
	{
		return (m_maxFuel == 0 || (double)GetFuel() > 0.0) && !m_blockedSmoke;
	}

	private void UpdateGameObjectState()
	{
		bool flag = IsActive();
		m_enabledObject.SetActive(flag);
		if (Object.op_Implicit((Object)(object)m_disabledObject))
		{
			m_disabledObject.SetActive(!flag);
		}
		if (Object.op_Implicit((Object)(object)m_haveFuelObject))
		{
			m_haveFuelObject.SetActive((double)GetFuel() > 0.0);
		}
		SetAnimation(flag);
	}

	private void SetAnimation(bool active)
	{
		Animator[] animators = m_animators;
		foreach (Animator val in animators)
		{
			if (((Component)val).gameObject.activeInHierarchy)
			{
				val.SetBool("active", active);
				val.SetFloat("activef", active ? 1f : 0f);
			}
		}
	}

	private float GetDeltaTime()
	{
		DateTime time = ZNet.instance.GetTime();
		DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("StartTime", time.Ticks));
		double totalSeconds = (time - dateTime).TotalSeconds;
		m_nview.GetZDO().Set("StartTime", time.Ticks);
		return (float)totalSeconds;
	}

	private void UpdateFuel(float dt)
	{
		if (m_useFuel)
		{
			float num = dt / m_secPerFuel;
			float num2 = GetFuel() - num;
			if ((double)num2 < 0.0)
			{
				num2 = 0f;
			}
			SetFuel(num2);
		}
	}

	private void RPC_AddFuel(long sender)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		if (m_nview.IsOwner())
		{
			SetFuel(GetFuel() + 1f);
			m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1);
		}
	}

	private void UpdateOfferingStation()
	{
		if (m_nview.IsValid())
		{
		}
	}

	private Vector3 GetSpawnPosition()
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		return ((Object)(object)m_spawnPoint != (Object)null) ? m_spawnPoint.transform.position : ((Component)this).transform.position;
	}

	private bool Spawn(Vector3 point)
	{
		//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)
		m_spawnStartEffects.Create(point, Quaternion.identity, (Transform)null, 1f, -1);
		((MonoBehaviour)this).Invoke("DelayedSpawn", m_SpawnDelay);
		return true;
	}

	private void UpdateSmoke()
	{
		if ((Object)(object)m_smokeSpawner != (Object)null)
		{
			m_blockedSmoke = m_smokeSpawner.IsBlocked();
		}
		else
		{
			m_blockedSmoke = false;
		}
	}

	private float GetFuel()
	{
		return m_nview.GetZDO().GetFloat("fuel", 0f);
	}

	private void SetFuel(float fuel)
	{
		m_nview.GetZDO().Set("fuel", fuel);
	}

	private bool OnAddFuel(Switch sw, Humanoid user, ItemData item)
	{
		if (!m_useFuel)
		{
			((Character)user).Message((MessageType)2, "No fuel required", 0, (Sprite)null);
			return false;
		}
		if (item != null && item.m_shared.m_name != m_fuelItem.m_itemData.m_shared.m_name)
		{
			((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null);
			return false;
		}
		if (!user.GetInventory().HaveItem(m_fuelItem.m_itemData.m_shared.m_name, true))
		{
			((Character)user).Message((MessageType)2, "$msg_donthaveany " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null);
			return false;
		}
		((Character)user).Message((MessageType)2, "$msg_added " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null);
		user.GetInventory().RemoveItem(m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true);
		m_nview.InvokeRPC("AddFuel", Array.Empty<object>());
		return true;
	}

	private bool IsSpawnQueued()
	{
		return ((MonoBehaviour)this).IsInvoking("DelayedSpawn");
	}

	private void DelayedSpawn()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		if (m_spawnStatusEffect)
		{
			Aoe component = Object.Instantiate<GameObject>(m_aoePrefab, GetSpawnPosition(), Quaternion.identity).GetComponent<Aoe>();
			component.m_statusEffect = m_statusEffectName;
		}
		if (m_spawnItem)
		{
			Object.Instantiate<GameObject>(((Component)m_itemPrefab).gameObject, GetSpawnPosition(), Quaternion.identity);
		}
		m_spawnFinishEffects.Create(GetSpawnPosition(), Quaternion.identity, (Transform)null, 1f, -1);
	}
}
namespace UpgradeWorld
{
	public class CommandRegistration
	{
		public string name = "";

		public string description = "";

		public string[] commands = new string[0];

		public void AddCommand()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			new ConsoleCommand(name, description, (ConsoleEvent)delegate(ConsoleEventArgs args)
			{
				string[] array = commands;
				foreach (string text in array)
				{
					args.Context.TryRunCommand(text, false, false);
				}
			}, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
		}
	}
	[HarmonyPatch(typeof(Terminal), "InitTerminal")]
	public static class Upgrade
	{
		private static List<CommandRegistration> registrations = new List<CommandRegistration>();

		public const string GUID = "upgrade_world";

		public static void Register(string name, string description, params string[] commands)
		{
			if (Chainloader.PluginInfos.ContainsKey("upgrade_world"))
			{
				registrations.Add(new CommandRegistration
				{
					name = name,
					description = description,
					commands = commands
				});
			}
		}

		private static void Postfix()
		{
			foreach (CommandRegistration registration in registrations)
			{
				registration.AddCommand();
			}
		}
	}
}
namespace BalrondArsenalReborn
{
	public class SE_WetImmunity : StatusEffect
	{
		public void Awake()
		{
			base.m_name = "Waterproof";
			((Object)this).name = "Waterproof";
			base.m_tooltip = "Immune to wet effect";
		}

		public override void UpdateStatusEffect(float dt)
		{
			((StatusEffect)this).UpdateStatusEffect(dt);
			if (base.m_character.GetSEMan().HaveStatusEffect("Wet".GetHashCode()))
			{
				base.m_character.GetSEMan().RemoveStatusEffect("Wet".GetHashCode(), false);
			}
		}
	}
}
namespace BalrondNature
{
	public class BalrondTranslator
	{
		public static Dictionary<string, Dictionary<string, string>> translations = new Dictionary<string, Dictionary<string, string>>();

		public static Dictionary<string, string> getLanguage(string language)
		{
			if (string.IsNullOrEmpty(language))
			{
				return null;
			}
			if (translations.TryGetValue(language, out var value))
			{
				return value;
			}
			return null;
		}
	}
	[HarmonyPatch]
	public static class DeepNorthRegion
	{
		[HarmonyPatch(typeof(EnvMan), "GetBiome")]
		private static class EnvMan_GetBiome_Patch
		{
			private static bool Prefix(EnvMan __instance, ref Biome __result)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Expected I4, but got Unknown
				Camera mainCamera = Utils.GetMainCamera();
				if ((Object)(object)mainCamera == (Object)null)
				{
					__result = (Biome)0;
					return false;
				}
				Vector3 position = ((Component)mainCamera).transform.position;
				Heightmap val = GetCachedHeightmap(__instance);
				if ((Object)(object)val == (Object)null || !val.IsPointInside(position, 0f))
				{
					val = Heightmap.FindHeightmap(position);
					SetCachedHeightmap(__instance, val);
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					__result = (Biome)0;
					return false;
				}
				bool flag = DeepNorthZone.IsAshlandsOrDeepNorthArea(position.x, position.z);
				__result = (Biome)(int)val.GetBiome(position, __instance.m_oceanLevelEnvCheckAshlandsDeepnorth, flag);
				return false;
			}
		}

		[HarmonyPatch(typeof(EnvMan), "UpdateEnvironment")]
		private static class EnvMan_UpdateEnvironment_Patch
		{
			private static bool Prefix(EnvMan __instance, long sec, Biome biome)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: 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)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
				string text = CallGetEnvironmentOverride(__instance);
				if (!string.IsNullOrEmpty(text))
				{
					SetEnvironmentPeriod(__instance, -1L);
					SetCurrentBiomeField(__instance, __instance.GetCurrentBiome());
					CallQueueEnvironment(__instance, text);
					return false;
				}
				Camera mainCamera = Utils.GetMainCamera();
				if ((Object)(object)mainCamera == (Object)null)
				{
					return false;
				}
				long num = sec / __instance.m_environmentDuration;
				Vector3 position = ((Component)mainCamera).transform.position;
				bool flag = WorldGenerator.IsAshlands(position.x, position.z);
				bool flag2 = DeepNorthZone.ShouldUseOverrideEnvironment(position.x, position.z, biome);
				bool flag3 = flag || flag2;
				__instance.m_dirLight.renderMode = (LightRenderMode)((!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !((Character)Player.m_localPlayer).InInterior()) ? 1 : 2);
				if (GetEnvironmentPeriod(__instance) == num && GetCurrentBiomeField(__instance) == biome && flag3 == GetInAshlandsOrDeepnorth(__instance))
				{
					return false;
				}
				SetEnvironmentPeriod(__instance, num);
				SetCurrentBiomeField(__instance, biome);
				SetInAshlandsOrDeepnorth(__instance, flag3);
				State state = Random.state;
				Random.InitState((int)num);
				List<EnvEntry> list = CallGetAvailableEnvironments(__instance, biome);
				if (list != null && list.Count > 0)
				{
					EnvSetup val = CallSelectWeightedEnvironment(__instance, list);
					foreach (EnvEntry item in list)
					{
						if (item.m_ashlandsOverride && flag)
						{
							val = item.m_env;
						}
						if (item.m_deepnorthOverride && flag2)
						{
							val = item.m_env;
						}
					}
					if (val != null)
					{
						CallQueueEnvironment(__instance, val);
					}
				}
				Random.state = state;
				return false;
			}
		}

		[HarmonyPatch(typeof(Minimap), "GetMaskColor")]
		private static class Minimap_GetMaskColor_Patch
		{
			private static void Postfix(float wx, float wy, float height, Biome biome, ref Color __result)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: 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)
				__result = ApplyDeepNorthOceanMask(__result, wx, wy, height, biome);
			}
		}

		[HarmonyPatch(typeof(Minimap), "GetPixelColor")]
		private static class Minimap_GetPixelColor_Patch
		{
			private static void Postfix(Biome biome, ref Color __result)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Invalid comparison between Unknown and I4
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				if ((int)biome == 64)
				{
					__result = DeepNorthMapColor;
				}
			}
		}

		[HarmonyPatch(typeof(Minimap), "GenerateWorldMap")]
		private static class Minimap_GenerateWorldMap_Patch
		{
			private static void Postfix(Minimap __instance)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Invalid comparison between Unknown and I4
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Invalid comparison between Unknown and I4
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				Texture2D val = (Texture2D)FI_Minimap_m_mapTexture.GetValue(__instance);
				if ((Object)(object)val == (Object)null || WorldGenerator.instance == null)
				{
					return;
				}
				int textureSize = __instance.m_textureSize;
				int num = textureSize / 2;
				float pixelSize = __instance.m_pixelSize;
				float num2 = pixelSize / 2f;
				Color[] pixels = val.GetPixels();
				for (int i = 0; i < textureSize; i++)
				{
					for (int j = 0; j < textureSize; j++)
					{
						float num3 = (float)(j - num) * pixelSize + num2;
						float num4 = (float)(i - num) * pixelSize + num2;
						Biome biome = WorldGenerator.instance.GetBiome(num3, num4, 0.02f, false);
						if (DeepNorthZone.IsAreaOrNearbyOcean(num3, num4, biome))
						{
							int num5 = i * textureSize + j;
							if ((int)biome == 64)
							{
								pixels[num5] = Color.Lerp(pixels[num5], DeepNorthMapColor, 0.55f);
							}
							else if ((int)biome == 256)
							{
								pixels[num5] = GetDeepNorthOceanTintedColor(pixels[num5], num3, num4);
							}
						}
					}
				}
				val.SetPixels(pixels);
				val.Apply();
			}
		}

		public static readonly Color DeepNorthMapColor = new Color(0.82f, 0.9f, 1f, 1f);

		public static readonly Color DeepNorthOceanColor = new Color(0.56f, 0.72f, 0.96f, 1f);

		public static readonly Color DeepNorthIceColor = new Color(0.82f, 0.92f, 1f, 1f);

		private static readonly BindingFlags InstNonPublic = BindingFlags.Instance | BindingFlags.NonPublic;

		private static readonly FieldInfo FI_EnvMan_m_cachedHeightmap = typeof(EnvMan).GetField("m_cachedHeightmap", InstNonPublic);

		private static readonly FieldInfo FI_EnvMan_m_currentBiome = typeof(EnvMan).GetField("m_currentBiome", InstNonPublic);

		private static readonly FieldInfo FI_EnvMan_m_inAshlandsOrDeepnorth = typeof(EnvMan).GetField("m_inAshlandsOrDeepnorth", InstNonPublic);

		private static readonly FieldInfo FI_EnvMan_m_environmentPeriod = typeof(EnvMan).GetField("m_environmentPeriod", InstNonPublic);

		private static readonly MethodInfo MI_EnvMan_GetEnvironmentOverride = typeof(EnvMan).GetMethod("GetEnvironmentOverride", InstNonPublic);

		private static readonly MethodInfo MI_EnvMan_GetAvailableEnvironments = typeof(EnvMan).GetMethod("GetAvailableEnvironments", InstNonPublic);

		private static readonly MethodInfo MI_EnvMan_SelectWeightedEnvironment = typeof(EnvMan).GetMethod("SelectWeightedEnvironment", InstNonPublic);

		private static readonly MethodInfo MI_EnvMan_QueueEnvironment_String = typeof(EnvMan).GetMethod("QueueEnvironment", InstNonPublic, null, new Type[1] { typeof(string) }, null);

		private static readonly MethodInfo MI_EnvMan_QueueEnvironment_EnvSetup = typeof(EnvMan).GetMethod("QueueEnvironment", InstNonPublic, null, new Type[1] { typeof(EnvSetup) }, null);

		private static readonly FieldInfo FI_Minimap_m_mapTexture = typeof(Minimap).GetField("m_mapTexture", InstNonPublic);

		public static Color GetDeepNorthOceanTintedColor(Color baseColor, float x, float z)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			float oceanBlend = DeepNorthZone.GetOceanBlend(x, z);
			if (oceanBlend <= 0f)
			{
				return baseColor;
			}
			Color val = Color.Lerp(baseColor, DeepNorthOceanColor, Mathf.Clamp01(oceanBlend * 1.15f));
			float num = Mathf.Clamp01(Mathf.InverseLerp(0.35f, 1f, oceanBlend));
			return Color.Lerp(val, DeepNorthIceColor, num * 0.55f);
		}

		public static Color ApplyDeepNorthOceanMask(Color originalMask, float x, float z, float height, Biome biome)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (height >= 30f)
			{
				return originalMask;
			}
			if ((int)biome != 256 && (int)biome != 64)
			{
				return originalMask;
			}
			float oceanBlend = DeepNorthZone.GetOceanBlend(x, z);
			if (oceanBlend <= 0f)
			{
				return originalMask;
			}
			originalMask.b = Mathf.Max(originalMask.b, oceanBlend * 0.45f);
			originalMask.a = Mathf.Max(originalMask.a, oceanBlend * 0.15f);
			return originalMask;
		}

		private static Heightmap GetCachedHeightmap(EnvMan envMan)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return (Heightmap)FI_EnvMan_m_cachedHeightmap.GetValue(envMan);
		}

		private static void SetCachedHeightmap(EnvMan envMan, Heightmap heightmap)
		{
			FI_EnvMan_m_cachedHeightmap.SetValue(envMan, heightmap);
		}

		private static Biome GetCurrentBiomeField(EnvMan envMan)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return (Biome)FI_EnvMan_m_currentBiome.GetValue(envMan);
		}

		private static void SetCurrentBiomeField(EnvMan envMan, Biome biome)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			FI_EnvMan_m_currentBiome.SetValue(envMan, biome);
		}

		private static bool GetInAshlandsOrDeepnorth(EnvMan envMan)
		{
			return (bool)FI_EnvMan_m_inAshlandsOrDeepnorth.GetValue(envMan);
		}

		private static void SetInAshlandsOrDeepnorth(EnvMan envMan, bool value)
		{
			FI_EnvMan_m_inAshlandsOrDeepnorth.SetValue(envMan, value);
		}

		private static long GetEnvironmentPeriod(EnvMan envMan)
		{
			return (long)FI_EnvMan_m_environmentPeriod.GetValue(envMan);
		}

		private static void SetEnvironmentPeriod(EnvMan envMan, long value)
		{
			FI_EnvMan_m_environmentPeriod.SetValue(envMan, value);
		}

		private static string CallGetEnvironmentOverride(EnvMan envMan)
		{
			return (string)MI_EnvMan_GetEnvironmentOverride.Invoke(envMan, null);
		}

		private static List<EnvEntry> CallGetAvailableEnvironments(EnvMan envMan, Biome biome)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return (List<EnvEntry>)MI_EnvMan_GetAvailableEnvironments.Invoke(envMan, new object[1] { biome });
		}

		private static EnvSetup CallSelectWeightedEnvironment(EnvMan envMan, List<EnvEntry> environments)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			return (EnvSetup)MI_EnvMan_SelectWeightedEnvironment.Invoke(envMan, new object[1] { environments });
		}

		private static void CallQueueEnvironment(EnvMan envMan, string name)
		{
			MI_EnvMan_QueueEnvironment_String.Invoke(envMan, new object[1] { name });
		}

		private static void CallQueueEnvironment(EnvMan envMan, EnvSetup env)
		{
			MI_EnvMan_QueueEnvironment_EnvSetup.Invoke(envMan, new object[1] { env });
		}
	}
	internal static class DeepNorthTuning
	{
		public static float MinDistance = 12000f;

		public static float YOffset = 4000f;

		public static float OceanGradientRange = 170f;

		public static float GapRange = 1000f;

		public static float NearbyOceanMargin = 0.75f;

		public static float MainMaskDistance = 1750f;

		public static float SideTaper = 7800f;

		public static float OceanFadeStart = 9750f;

		public static float OceanFadeRange = 1150f;

		public static float CellularLargeStartScale = 0.28f;

		public static int CellularLargeOctaves = 6;

		public static float CellularLargeGain = 0.55f;

		public static float CellularSharpStartScale = 7f;

		public static int CellularSharpOctaves = 4;

		public static float CellularSharpGain = 0.55f;

		public static float CellularSharpPow = 3.5f;

		public static float CellularSharpMul = 2.35f;

		public static float ShelfTarget = 0.2f;

		public static float ShelfBlend = 0.8f;

		public static float MainHeightMul = 1.2f;

		public static float Perlin1 = 0.009f;

		public static float Perlin2 = 0.019f;

		public static float Perlin3 = 0.048f;

		public static float Perlin4 = 0.095f;

		public static float SimplexScale = 0.065f;

		public static float SimplexPow = 1.35f;

		public static float CrackBaseHeight = 0.16f;

		public static float CrackThresholdMin = 0.009f;

		public static float CrackThresholdMax = 0.038f;

		public static float CrackNoiseScale = 0.045f;

		public static float CrackNoiseOffsetX = 5124f;

		public static float CrackNoiseOffsetY = 5000f;

		public static float FbmScale = 0.012f;

		public static int FbmOctaves = 4;

		public static float FbmLacunarity = 2.1f;

		public static float FbmGain = 0.55f;

		public static float BlendMaskMin = 0.62f;

		public static float BlendMaskMax = 1f;

		public static float HeightGateMin = 0.13f;

		public static float HeightGateRange = 0.03f;

		public static float DetailScale1 = 0.09f;

		public static float DetailStrength1 = 0.018f;

		public static float DetailScale2 = 0.35f;

		public static float DetailStrength2 = 0.007f;
	}
	internal static class DeepNorthZone
	{
		public static bool IsCore(float x, float z)
		{
			return WorldGenerator.IsDeepnorth(x, z);
		}

		public static bool IsCore(Vector3 position)
		{
			//IL_0001: 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)
			return IsCore(position.x, position.z);
		}

		public static double GetAngleOffset(float x, float z)
		{
			return (double)WorldGenerator.WorldAngle(x, z + DeepNorthTuning.YOffset) * 100.0;
		}

		public static double GetShiftedDistance(float x, float z)
		{
			return DUtils.Length(x, z + DeepNorthTuning.YOffset);
		}

		public static float GetOceanGradient(float x, float z)
		{
			double shiftedDistance = GetShiftedDistance(x, z);
			double angleOffset = GetAngleOffset(x, z);
			return (float)((shiftedDistance - ((double)DeepNorthTuning.MinDistance + angleOffset)) / (double)DeepNorthTuning.OceanGradientRange);
		}

		public static bool IsNearbyOcean(float x, float z)
		{
			return GetOceanGradient(x, z) > 0f - DeepNorthTuning.NearbyOceanMargin;
		}

		public static bool IsNearbyOcean(float x, float z, Biome biome)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			return (int)biome == 256 && IsNearbyOcean(x, z);
		}

		public static bool IsAreaOrNearbyOcean(float x, float z, Biome biome)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return (int)biome == 64 || IsNearbyOcean(x, z, biome);
		}

		public static bool ShouldUseOverrideEnvironment(float x, float z, Biome biome)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return IsAreaOrNearbyOcean(x, z, biome);
		}

		public static bool IsAshlandsOrDeepNorthArea(float x, float z)
		{
			return WorldGenerator.IsAshlands(x, z) || IsCore(x, z) || IsNearbyOcean(x, z);
		}

		public static float GetOceanBlend(float x, float z)
		{
			float oceanGradient = GetOceanGradient(x, z);
			return Mathf.Clamp01(Mathf.InverseLerp(0f - DeepNorthTuning.NearbyOceanMargin, 0.75f, oceanGradient));
		}

		public static double CreateGap(float x, float z)
		{
			double shiftedDistance = GetShiftedDistance(x, z);
			double angleOffset = GetAngleOffset(x, z);
			return DUtils.MathfLikeSmoothStep(0.0, 1.0, DUtils.Clamp01(Math.Abs(shiftedDistance - ((double)DeepNorthTuning.MinDistance + angleOffset)) / (double)DeepNorthTuning.GapRange));
		}

		public static bool ShouldApplyFreezingWater(float x, float z, Biome biome)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return IsAreaOrNearbyOcean(x, z, biome);
		}

		public static bool ShouldApplyFreezingWater(Character character)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)character == (Object)null)
			{
				return false;
			}
			if (!character.InWater() && !character.IsSwimming())
			{
				return false;
			}
			if (character.IsDead())
			{
				return false;
			}
			Vector3 position = ((Component)character).transform.position;
			Biome biome = (Biome)0;
			if (WorldGenerator.instance != null)
			{
				biome = WorldGenerator.instance.GetBiome(position.x, position.z, 0.02f, false);
			}
			return ShouldApplyFreezingWater(position.x, position.z, biome);
		}
	}
	internal class VfxList
	{
		public static readonly string[] vfx = new string[47]
		{
			"waterbucket_projectile_bal", "vfx_mammothhead_destruction", "vfx_dragonhead_destruction", "ElderMushroomCap_bal", "ElderMushroomLog_bal", "Acai_log_bal", "IcedTree_log_bal", "ElderTreeLog_bal", "ElderTreeLogHalf_bal", "vfx_MeteoriteDestroyed_bal",
			"vfx_MeteoriteDestroyed_large_bal", "radiation1_bal", "radiation2_bal", "vfx_wood_ember_stack_destroyed_bal", "Acai_log_half_bal", "Wet_log_bal", "Wet_log_half_bal", "Cypress_log_bal", "Willow_log_bal", "Maple_log_bal",
			"Oak2_log_bal", "Oak2_log_half_bal", "Poplar_log_bal", "YewTreeLog_bal", "vfx_coin_silver_pile_destroyed_bal", "vfx_coin_silver_stack_destroyed_bal", "bow_projectile_blizzard_bal", "bow_projectile_chitin_bal", "bow_projectile_flametal_bal", "bigyggashoot_log_bal",
			"bigyggashoot_log_half_bal", "bigyggashoot_log_quarter_bal", "stalagmite_ash_destruction_bal", "waterSplashAoe_bal", "vfx_taunted_bal", "vfx_Bleeding_bal", "vfx_FreezingWater_bal", "vfx_Sick_bal", "vfx_Fractured_bal", "vfx_Lacerated_bal",
			"vfx_Punctured_bal", "vfx_Scorched_bal", "vfx_Chilled_bal", "vfx_Staticcharge_bal", "vfx_Soulsapped_bal", "vfx_Enfeebled_bal", "vfx_Firstaidkit_bal"
		};
	}
	[HarmonyPatch(typeof(Character), "RPC_Damage")]
	public static class DamageConditionsPatch
	{
		private class DebuffProcConfig
		{
			public DamageType DamageType;

			public float DamageThreshold;

			public float BaseProcChance;

			public string StatusEffectName;

			public int StatusEffectHash;
		}

		private const string BleedingStatusName = "SE_Bleeding_bal";

		private static readonly int BleedingStatusHash = StringExtensionMethods.GetStableHashCode("SE_Bleeding_bal");

		private static readonly int FracturedStatusHash = StringExtensionMethods.GetStableHashCode("SE_Fractured_bal");

		private static readonly int LaceratedStatusHash = StringExtensionMethods.GetStableHashCode("SE_Lacerated_bal");

		private static readonly int PuncturedStatusHash = StringExtensionMethods.GetStableHashCode("SE_Punctured_bal");

		private static readonly Dictionary<DamageType, DebuffProcConfig> ProcConfigs = new Dictionary<DamageType, DebuffProcConfig>
		{
			{
				(DamageType)32,
				new DebuffProcConfig
				{
					DamageType = (DamageType)32,
					DamageThreshold = 12f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_Scorched_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_Scorched_bal")
				}
			},
			{
				(DamageType)64,
				new DebuffProcConfig
				{
					DamageType = (DamageType)64,
					DamageThreshold = 12f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_Chilled_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_Chilled_bal")
				}
			},
			{
				(DamageType)256,
				new DebuffProcConfig
				{
					DamageType = (DamageType)256,
					DamageThreshold = 10f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_Enfeebled_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_Enfeebled_bal")
				}
			},
			{
				(DamageType)128,
				new DebuffProcConfig
				{
					DamageType = (DamageType)128,
					DamageThreshold = 14f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_StaticCharge_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_StaticCharge_bal")
				}
			},
			{
				(DamageType)512,
				new DebuffProcConfig
				{
					DamageType = (DamageType)512,
					DamageThreshold = 10f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_SoulSapped_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_SoulSapped_bal")
				}
			},
			{
				(DamageType)1,
				new DebuffProcConfig
				{
					DamageType = (DamageType)1,
					DamageThreshold = 10f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_Fractured_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_Fractured_bal")
				}
			},
			{
				(DamageType)2,
				new DebuffProcConfig
				{
					DamageType = (DamageType)2,
					DamageThreshold = 10f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_Lacerated_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_Lacerated_bal")
				}
			},
			{
				(DamageType)4,
				new DebuffProcConfig
				{
					DamageType = (DamageType)4,
					DamageThreshold = 10f,
					BaseProcChance = 0.05f,
					StatusEffectName = "SE_Punctured_bal",
					StatusEffectHash = StringExtensionMethods.GetStableHashCode("SE_Punctured_bal")
				}
			}
		};

		private static readonly MethodInfo GetWeakSpotMethod = AccessTools.Method(typeof(Character), "GetWeakSpot", new Type[1] { typeof(short) }, (Type[])null);

		private static readonly FieldInfo BackstabTimeField = AccessTools.Field(typeof(Character), "m_backstabTime");

		private static void Prefix(Character __instance, HitData hit)
		{
			if (!((Object)(object)__instance == (Object)null) && hit != null && __instance.IsOwner() && !(__instance.GetHealth() <= 0f) && !__instance.IsDead() && !__instance.IsTeleporting() && !__instance.InCutscene() && (!hit.m_dodgeable || !__instance.IsDodgeInvincible()))
			{
				HitData val = CreateSimulatedHit(__instance, hit);
				if (val != null)
				{
					TryApplyMajorityDamageDebuff(__instance, val);
				}
			}
		}

		private static HitData CreateSimulatedHit(Character target, HitData originalHit)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			HitData val = CloneHit(originalHit);
			if (val == null)
			{
				return null;
			}
			Character attacker = originalHit.GetAttacker();
			if ((Object)(object)attacker != (Object)null && !attacker.IsPlayer())
			{
				float difficultyDamageScalePlayer = Game.instance.GetDifficultyDamageScalePlayer(((Component)target).transform.position);
				val.ApplyModifier(difficultyDamageScalePlayer);
				val.ApplyModifier(Game.m_enemyDamageRate);
			}
			BaseAI baseAI = target.GetBaseAI();
			if ((Object)(object)baseAI != (Object)null && !baseAI.IsAlerted() && val.m_backstabBonus > 1f && Time.time - GetBackstabTime(target) > 300f && (!ZoneSystem.instance.GetGlobalKey((GlobalKeys)25) || !baseAI.CanSeeTarget(attacker)))
			{
				val.ApplyModifier(val.m_backstabBonus);
			}
			if (target.IsStaggering() && !target.IsPlayer())
			{
				val.ApplyModifier(2f);
			}
			WeakSpot weakSpot = GetWeakSpot(target, val.m_weakSpot);
			DamageModifiers damageModifiers = target.GetDamageModifiers(weakSpot);
			DamageModifier val2 = default(DamageModifier);
			val.ApplyResistance(damageModifiers, ref val2);
			if (target.IsPlayer())
			{
				float bodyArmor = target.GetBodyArmor();
				val.ApplyArmor(bodyArmor);
			}
			else if (Game.m_worldLevel > 0)
			{
				val.ApplyArmor((float)(Game.m_worldLevel * Game.instance.m_worldLevelEnemyBaseAC));
			}
			return val;
		}

		private static void TryApplyMajorityDamageDebuff(Character target, HitData simulatedHit)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null || simulatedHit == null)
			{
				return;
			}
			SEMan sEMan = target.GetSEMan();
			if (sEMan == null)
			{
				return;
			}
			float num = default(float);
			DamageType majorityDamageType = ((DamageTypes)(ref simulatedHit.m_damage)).GetMajorityDamageType(ref num);
			bool appliedPrimaryDebuff = false;
			if (ProcConfigs.TryGetValue(majorityDamageType, out var value) && num >= value.DamageThreshold)
			{
				DamageModifiers damageModifiers = target.GetDamageModifiers((WeakSpot)null);
				DamageModifier modifier = ((DamageModifiers)(ref damageModifiers)).GetModifier(majorityDamageType);
				float num2 = (target.IsPlayer() ? 1f : 0.75f);
				float num3 = value.BaseProcChance * GetResistanceChanceMultiplier(modifier) * num2;
				num3 = Mathf.Clamp01(num3);
				if (num3 > 0f && Random.value <= num3 && !sEMan.HaveStatusEffect(value.StatusEffectHash))
				{
					sEMan.AddStatusEffect(value.StatusEffectHash, true, 0, 0f);
					appliedPrimaryDebuff = true;
				}
			}
			TryApplyBleeding(target, simulatedHit, sEMan, majorityDamageType, num, appliedPrimaryDebuff);
		}

		private static float GetBleedChanceFromWounds(int woundCount)
		{
			return woundCount switch
			{
				1 => 0.05f, 
				2 => 0.25f, 
				3 => 0.75f, 
				_ => 0f, 
			};
		}

		private static void TryApplyBleeding(Character target, HitData simulatedHit, SEMan seMan, DamageType majorityType, float majorityDamage, bool appliedPrimaryDebuff)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			if ((Object)(object)target == (Object)null || simulatedHit == null || seMan == null || ((int)majorityType != 2 && (int)majorityType != 4) || seMan.HaveStatusEffect(BleedingStatusHash))
			{
				return;
			}
			bool flag = seMan.HaveStatusEffect(LaceratedStatusHash);
			bool flag2 = seMan.HaveStatusEffect(PuncturedStatusHash);
			bool flag3 = seMan.HaveStatusEffect(FracturedStatusHash);
			int num = 0;
			if (flag)
			{
				num++;
			}
			if (flag2)
			{
				num++;
			}
			if (flag3)
			{
				num++;
			}
			if (num != 0 && !(majorityDamage < 12f))
			{
				float bleedChanceFromWounds = GetBleedChanceFromWounds(num);
				if (!(Random.value > bleedChanceFromWounds))
				{
					seMan.AddStatusEffect(BleedingStatusHash, true, 0, 0f);
				}
			}
		}

		private static HitData CloneHit(HitData original)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (original == null)
			{
				return null;
			}
			HitData val = original.Clone();
			val.m_damage = ((DamageTypes)(ref original.m_damage)).Clone();
			return val;
		}

		private static WeakSpot GetWeakSpot(Character character, short weakSpotIndex)
		{
			if ((Object)(object)character == (Object)null || GetWeakSpotMethod == null)
			{
				return null;
			}
			try
			{
				object? obj = GetWeakSpotMethod.Invoke(character, new object[1] { weakSpotIndex });
				return (WeakSpot)((obj is WeakSpot) ? obj : null);
			}
			catch
			{
				return null;
			}
		}

		private static float GetBackstabTime(Character character)
		{
			if ((Object)(object)character == (Object)null || BackstabTimeField == null)
			{
				return -99999f;
			}
			try
			{
				return (float)BackstabTimeField.GetValue(character);
			}
			catch
			{
				return -99999f;
			}
		}

		private static float GetResistanceChanceMultiplier(DamageModifier modifier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected I4, but got Unknown
			switch ((int)modifier)
			{
			case 3:
			case 4:
				return 0f;
			case 5:
				return 0.11f;
			case 1:
				return 0.33f;
			case 7:
				return 0.66f;
			case 0:
				return 1f;
			case 8:
				return 1.33f;
			case 2:
				return 1.66f;
			case 6:
				return 2f;
			default:
				return 1f;
			}
		}
	}
	[HarmonyPatch]
	internal static class CombatPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Attack), "DoMeleeAttack")]
		private static void Attack_DoMeleeAttack(Attack __instance)
		{
			if (!Compatibility2.IsLoaded())
			{
				Player component = ((Component)__instance.m_character).GetComponent<Player>();
				if (Object.op_Implicit((Object)(object)component) && !((Object)(object)component != (Object)(object)Player.m_localPlayer))
				{
					__instance.m_maxYAngle = 180f;
					__instance.m_attackHeight = 1f;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "AlwaysRotateCamera")]
		private static void Player_AlwaysRotateCamera(Character __instance, ref bool __result)
		{
			if (!Compatibility2.IsLoaded())
			{
				Player component = ((Component)__instance).GetComponent<Player>();
				if (Object.op_Implicit((Object)(object)component) && !((Object)(object)component != (Object)(object)Player.m_localPlayer) && ((Character)component).IsBlocking() && component.m_attackTowardsPlayerLookDir)
				{
					__result = false;
				}
			}
		}
	}
	public class ConversionChanges2
	{
		private enum ConversionType
		{
			smelter,
			fermenter,
			cooking,
			balrondConverter
		}

		private List<GameObject> buildPieces = new List<GameObject>();

		private List<GameObject> items = new List<GameObject>();

		private readonly Dictionary<string, GameObject> _buildPieceByName = new Dictionary<string, GameObject>(256);

		private readonly Dictionary<string, GameObject> _itemByName = new Dictionary<string, GameObject>(1024);

		private readonly Dictionary<string, ItemDrop> _itemDropByName = new Dictionary<string, ItemDrop>(1024);

		private readonly HashSet<string> _missingItemWarned = new HashSet<string>();

		public static readonly List<TutorialText> m_texts = new List<TutorialText>(64);

		private static readonly string[] buildPieceNames = new string[18]
		{
			"portal_wood", "piece_workbench", "forge", "blackforge", "piece_magetable", "piece_artisanstation", "piece_stonecutter", "piece_banner01", "piece_banner02", "piece_banner03",
			"piece_banner04", "piece_banner05", "piece_banner06", "piece_banner07", "piece_banner08", "piece_banner09", "piece_banner10", "piece_banner11"
		};

		private readonly string[] convertToBits = new string[41]
		{
			"WillowSeeds_bal", "WillowBark_bal", "YewBark_bal", "WoodNails_bal", "WaterLilySeeds_bal", "SwampTreeSeeds_bal", "Straw_bal", "StrawSeeds_bal", "Snowleaf_bal", "StrawThread_bal",
			"RedwoodSeeds_bal", "Plantain_bal", "PoplarSeeds_bal", "Peningar_bal", "Sage_bal", "Lavender_bal", "Mint_bal", "OilBase_bal", "Oil_bal", "Nettle_bal",
			"Moss_bal", "Mugwort_bal", "MushroomIcecap_bal", "MushroomInkcap_bal", "Iceberry_bal", "Ignicap_bal", "GarlicSeeds_bal", "Garlic_bal", "CypressSeeds_bal", "CabbageLeaf_bal",
			"CabbageSeeds_bal", "Cabbage_bal", "BirdFeed_bal", "Blackberries_bal", "AppleSeeds_bal", "BasicSeed_bal", "AcaiSeeds_bal", "MapleSeeds_bal", "WaterLily_bal", "Yarrow_bal",
			"MeatScrap_bal"
		};

		private readonly string[] convertToCoal = new string[201]
		{
			"ClayBrickMold_bal", "AcidSludge_bal", "AncientRelic_bal", "AppleVinegar_bal", "Apple_bal", "BatWingCooked_bal", "BatWing_bal", "BeltForester_bal", "BeltMountaineer_bal", "BeltSailor_bal",
			"BlackMetalCultivator_bal", "BlackMetalHoe_bal", "BlackSkin_bal", "BlackTissue_bal", "Bloodfruit_bal", "Bloodshard_bal", "BoarHide_bal", "BoraxCrystal_bal", "BundleBaseItem_bal", "BundleHut_bal",
			"CarvedCarcass_bal", "CarvedDeerSkull_bal", "CeramicMold_bal", "Cheese_bal", "CabbageSoup_bal", "ClamMeat_bal", "ClayBrick_bal", "ClayPot_bal", "Clay_bal", "CoalPowder_bal",
			"CookedCrowMeat_bal", "CookedDragonRibs_bal", "CorruptedEitr_bal", "CrabLegsCooked_bal", "CrabLegs_bal", "CrystalWood_bal", "CultInsignia_bal", "CursedBone_bal", "Darkbul_bal", "DeadEgo_bal",
			"DragonSoul_bal", "DrakeMeatCooked_bal", "DrakeMeat_bal", "DrakeSkin_bal", "DyeKit_bal", "EmberWood_bal", "EnrichedEitr_bal", "EnrichedSoil_bal", "FenringInsygnia_bal", "FenringMeatCooked_bal",
			"FenringMeat_bal", "FireGland_bal", "FishWrapsUncooked_bal", "ForsakenHeart_bal", "FoxFur_bal", "CarvedWood_bal", "WispCore_bal", "GoatMeatCooked_bal", "GoatMeat_bal", "GrayMushroom_bal",
			"GrilledCheese_bal", "HammerBlackmetal_bal", "HammerDverger_bal", "HammerIron_bal", "HammerMythic_bal", "HardWood_bal", "HelmetCrown_bal", "InfusedCarapace_bal", "JotunFinger_bal", "JuteThread_bal",
			"KingMug_bal", "MagmaStone_bal", "MeadBase_bal", "MedPack_bal", "MincedMeat_bal", "NeckSkin_bal", "NorthernFur_bal", "NumbMeal_bal", "PatchworkAsk_bal", "PatchworkBoar_bal",
			"PatchworkDeer_bal", "PatchworkLox_bal", "PatchworkTroll_bal", "PatchworkWolf_bal", "PickaxeFlametal_bal", "RawCrowMeat_bal", "RawDragonRibs_bal", "RawSilkScrap_bal", "RawSilk_bal", "RawSteak_bal",
			"RedKelp_bal", "RefinedOil_bal", "Sapphire_bal", "SawBlade_bal", "Seaberries_bal", "SeekerBrain_bal", "SerpentEgg_bal", "SharkMeatCooked_bal", "SharkMeat_bal", "SilkReinforcedThread_bal",
			"SmallBloodSack_bal", "SoulCore_bal", "SpiceSet_bal", "SpiritShard_bal", "SteakCooked_bal", "StormScale_bal", "TarBase_bal", "ThornHeart_bal", "ThunderGland_bal", "TormentedSoul_bal",
			"TrollMeatCooked_bal", "TrollMeat_bal", "WatcherHeart_bal", "SurtlingCoreCasing_bal", "ApplePieUncooked_bal", "ApplePie_bal", "AshlandCurry_bal", "BlackBerryJuice_bal", "BloodfruitSoup_bal", "BloodyBearJerky_bal",
			"BloodyCreamPie_bal", "BloodyVial_bal", "BlueberryPieUncooked_bal", "BlueberryPie_bal", "Breakfast_bal", "Burger_bal", "ChickenMarsala_bal", "ChickenNuggets_bal", "DragonfireBarbecue_bal", "FishSkewer_bal",
			"FruitPunch_bal", "FruitSalad_bal", "GrilledShrooms_bal", "HappyMeal_bal", "HoneyGlazedApple_bal", "IceBerryPancake_bal", "KingsJam_bal", "Liverwurst_bal", "MagmaCoctail_bal", "MeadBaseWhiteCheese_bal",
			"SeaFoodPlatter_bal", "SpicyBurger_bal", "SpiecedDrakeChop_bal", "SurstrommingBase_bal", "Surstromming_bal", "SwampSkause_bal", "VegetablePuree_bal", "VegetableSoup_bal", "WhiteCheese_bal", "WinterStew_bal",
			"CarrotFries_bal", "PowderedSalt_bal", "PowderedPepper_bal", "BundlePortal_bal", "BundlePortalStone_bal", "HelmetLeatherCap_bal", "HelmetBronzeHorned_bal", "BlackBerryJuiceBase_bal", "MagmaCoctailBase_bal", "FruitPunchBase_bal",
			"VineBerryJuice_bal", "VineBerryJuiceBase_bal", "RostedTrollBits_bal", "RoastedFish_bal", "CabbageWrapDrake_bal", "Cotlet_bal", "RedStew_bal", "GoatStew_bal", "CrustedMeat_bal", "MeatBalls_bal",
			"MeatRoll_bal", "MagnaTarta_bal", "ShrededMeat_bal", "MincedFenringStew_bal", "CarrotCrowSalad_bal", "Bulion_bal", "CookedMeatScrap_bal", "WoodBucket_bal", "BeltVidar_bal", "BeltAssasin_bal",
			"TrophyBattleHog_bal", "TrophyGoat_bal", "TrophyNeckBrute_bal", "TrophyObsidianCrab_bal", "TrophyShark_bal", "TrophySouling_bal", "TrophyCorpseCollector_bal", "TrophyForsaken_bal", "TrophyGreywatcher_bal", "TrophyHaugbui_bal",
			"TrophySpectre_bal", "TrophyStormdrake_bal", "TrophyTrollAshlands_bal", "TrophyTrollSkeleton_bal", "TrophyStag_bal", "TrophyLeechPrimal_bal", "TrophyStagGhost_bal", "Larva_bal", "WaterJugEmpty_bal", "SwordFakeSilver_Bal",
			"MaceFakeSilver_bal"
		};

		private readonly string[] arrowsNbolts = new string[10] { "BoltBlunt_bal", "BoltChitin_bal", "BoltFire_bal", "BoltSilver_bal", "BoltThunder_bal", "ArrowBlizzard_bal", "ArrowBlunt_bal", "ArrowBone_bal", "ArrowChitin_bal", "ArrowFlametal_bal" };

		public void editBuidlPieces(List<GameObject> allPrefabs)
		{
			buildPieces = allPrefabs ?? new List<GameObject>();
			items = allPrefabs ?? new List<GameObject>();
			RebuildCaches();
			editFermenter();
			editOven();
			editKiln();
			editWHeel();
			editSap();
			editBeehive();
			editSmelter();
			editPress();
			editComposter();
			editFurnace();
			editRefinery();
			editCooking();
			editIronCooking();
			editIncinerator();
			EditRecipes();
		}

		private void RebuildCaches()
		{
			_buildPieceByName.Clear();
			_itemByName.Clear();
			_itemDropByName.Clear();
			_missingItemWarned.Clear();
			for (int i = 0; i < buildPieces.Count; i++)
			{
				GameObject val = buildPieces[i];
				if (!((Object)(object)val == (Object)null))
				{
					_buildPieceByName[((Object)val).name] = val;
				}
			}
			if (items == null || items.Count == 0)
			{
				if ((Object)(object)ZNetScene.instance != (Object)null && ZNetScene.instance.m_prefabs != null)
				{
					items = ZNetScene.instance.m_prefabs;
				}
				else
				{
					items = new List<GameObject>();
				}
			}
			for (int j = 0; j < items.Count; j++)
			{
				GameObject val2 = items[j];
				if (!((Object)(object)val2 == (Object)null))
				{
					_itemByName[((Object)val2).name] = val2;
					ItemDrop component = val2.GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null)
					{
						_itemDropByName[((Object)val2).name] = component;
					}
				}
			}
		}

		private void EditRecipes()
		{
			for (int i = 0; i < buildPieceNames.Length; i++)
			{
				GameObject val = FindBuildPiece(buildPieceNames[i]);
				if ((Object)(object)val != (Object)null)
				{
					ModifyBuildPiece(val);
				}
			}
		}

		private void ModifyBuildPiece(GameObject piece)
		{
			if ((Object)(object)piece == (Object)null)
			{
				return;
			}
			string name = ((Object)piece).name;
			switch (name)
			{
			case "forge":
			case "piece_workbench":
			case "blackforge":
			case "piece_magetable":
			case "piece_artisanstation":
			case "piece_stonecutter":
				SetCraftingStationRequiresRoof(piece, requireRoof: false);
				return;
			}
			if (name.StartsWith("piece_banner", StringComparison.Ordinal))
			{
				SetBannerRecipe(piece);
			}
		}

		private void SetCraftingStationRequiresRoof(GameObject piece, bool requireRoof)
		{
			CraftingStation component = piece.GetComponent<CraftingStation>();
			if ((Object)(object)component != (Object)null)
			{
				component.m_craftRequireRoof = requireRoof;
			}
		}

		private void SetBannerRecipe(GameObject piece)
		{
			Piece component = piece.GetComponent<Piece>();
			if (!((Object)(object)component == (Object)null))
			{
				component.m_resources = (Requirement[])(object)new Requirement[4]
				{
					CreateRequirement("DyeKit_bal", 1),
					CreateRequirement("FineWood", 2),
					CreateRequirement("LeatherScraps", 3),
					CreateRequirement("StrawThread_bal", 3)
				};
			}
		}

		private Requirement CreateRequirement(string itemName, int amount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_001a: 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_0029: Expected O, but got Unknown
			return new Requirement
			{
				m_resItem = FindItemDrop(itemName),
				m_amount = amount,
				m_amountPerLevel = 0,
				m_recover = true
			};
		}

		private Requirement createReq(string name, int amount, int amountPerLevel)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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_0029: Expected O, but got Unknown
			return new Requirement
			{
				m_recover = true,
				m_resItem = FindItemDrop(name),
				m_amount = amount,
				m_amountPerLevel = amountPerLevel
			};
		}

		private GameObject FindBuildPiece(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return null;
			}
			GameObject value;
			return _buildPieceByName.TryGetValue(name, out value) ? value : null;
		}

		private GameObject FindItem(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return null;
			}
			if (_itemByName.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			if (_missingItemWarned.Add(name))
			{
				Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood"));
			}
			_itemByName.TryGetValue("Wood", out value);
			return value;
		}

		private ItemDrop FindItemDrop(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return null;
			}
			if (_itemDropByName.TryGetValue(name, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			GameObject val = FindItem(name);
			value = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null);
			if ((Object)(object)value != (Object)null)
			{
				_itemDropByName[name] = value;
			}
			if ((Object)(object)value == (Object)null && name != "Wood")
			{
				return FindItemDrop("Wood");
			}
			return value;
		}

		private void removeConversionFromSmelter(string fromItem, List<ItemConversion> list)
		{
			if (list == null || list.Count == 0 || string.IsNullOrEmpty(fromItem))
			{
				return;
			}
			list.RemoveAll(delegate(ItemConversion x)
			{
				if (x == null)
				{
					return true;
				}
				ItemDrop from = x.m_from;
				if ((Object)(object)from == (Object)null)
				{
					return true;
				}
				ItemData itemData = from.m_itemData;
				if (itemData == null)
				{
					return true;
				}
				GameObject dropPrefab = itemData.m_dropPrefab;
				return (Object)(object)dropPrefab == (Object)null || ((Object)dropPrefab).name == fromItem;
			});
		}

		public void editLeatherRack(BalrondConverter leatherRack = null)
		{
			if ((Object)(object)leatherRack == (Object)null)
			{
				GameObject val = FindBuildPiece("piece_leatherRack_bal");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				leatherRack = val.GetComponent<BalrondConverter>();
			}
			if (!((Object)(object)leatherRack == (Object)null))
			{
				if (leatherRack.m_conversion == null)
				{
					leatherRack.m_conversion = new List<BalrondConverter.ItemConversion>();
				}
				else
				{
					leatherRack.m_conversion.Clear();
				}
				addConversion(((Component)leatherRack).gameObject, "PatchworkDeer_bal", "DeerHide", ConversionType.balrondConverter, 30, 2);
				addConversion(((Component)leatherRack).gameObject, "PatchworkBoar_bal", "BoarHide_bal", ConversionType.balrondConverter, 30, 2);
				addConversion(((Component)leatherRack).gameObject, "PatchworkTroll_bal", "TrollHide", ConversionType.balrondConverter, 30, 2);
				addConversion(((Component)leatherRack).gameObject, "PatchworkWolf_bal", "WolfPelt", ConversionType.balrondConverter, 30, 2);
				addConversion(((Component)leatherRack).gameObject, "PatchworkLox_bal", "LoxPelt", ConversionType.balrondConverter, 30, 2);
				addConversion(((Component)leatherRack).gameObject, "PatchworkAsk_bal", "AskHide", ConversionType.balrondConverter, 30, 2);
			}
		}

		public void editRefinery(Smelter refinery = null)
		{
			if ((Object)(object)refinery == (Object)null)
			{
				GameObject val = FindBuildPiece("eitrrefinery");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				refinery = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)refinery == (Object)null))
			{
				if (refinery.m_maxFuel == 20)
				{
					refinery.m_maxFuel = 60;
				}
				if (refinery.m_maxOre == 20)
				{
					refinery.m_maxOre = 60;
				}
				if (refinery.m_secPerProduct == 40f)
				{
					refinery.m_secPerProduct = 60f;
				}
				StringBuilder stringBuilder = new StringBuilder(128);
				stringBuilder.Append(addConversion(((Component)refinery).gameObject, "Oil_bal", "RefinedOil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)refinery).gameObject, "BlackTissue_bal", "CorruptedEitr_bal", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)refinery).gameObject, stringBuilder.ToString());
			}
		}

		public void editComposter(Smelter composter = null)
		{
			if ((Object)(object)composter == (Object)null)
			{
				GameObject val = FindBuildPiece("composter_bal");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				composter = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)composter == (Object)null))
			{
				if (composter.m_conversion == null)
				{
					composter.m_conversion = new List<ItemConversion>();
				}
				StringBuilder stringBuilder = new StringBuilder(1024);
				addConversion(((Component)composter).gameObject, "TrophyFox_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyHabrok_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyHabrokBirb_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyCrow_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGreywatcher_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySouling_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyCorpseCollector_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyForsaken_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGoat_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyHaugbui_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyNeckBrute_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyObsidianCrab_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySpectre_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyStormdrake_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyShark_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyAbomination", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyBlob", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyBoar", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyBonemass", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyCultist", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyDeathsquito", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyDeer", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyDragonQueen", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyDraugr", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyDraugrElite", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyDvergr", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyEikthyr", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyFenring", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyFrostTroll", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGjall", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGoblin", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGoblinBrute", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGoblinKing", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGoblinShaman", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGreydwarf", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGreydwarfBrute", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGreydwarfShaman", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyGrowth", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyHare", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyHatchling", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyLeech", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyLox", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyNeck", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySeeker", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySeekerBrute", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySeekerQueen", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySerpent", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySGolem", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySkeleton", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySkeletonPoison", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophySurtling", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyTheElder", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyTick", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyUlv", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyWolf", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyWraith", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyTrollSkeleton_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyTrollAshlands_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyStag_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyLeechPrimal_bal", "EnrichedSoil_bal", ConversionType.smelter);
				addConversion(((Component)composter).gameObject, "TrophyStagGhost_bal", "EnrichedSoil_bal", ConversionType.smelter);
				stringBuilder.Append("\n $tag_rottenvegetable_bal_description");
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "RottenMeat", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "RottenVegetable_bal", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "Pukeberries", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "StrawBundle_bal", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "Cabbage_bal", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "Turnip", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "Carrot", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "Onion", "EnrichedSoil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)composter).gameObject, "Garlic_bal", "EnrichedSoil_bal", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)composter).gameObject, stringBuilder.ToString());
			}
		}

		public void editSmelter(Smelter smelter = null)
		{
			if ((Object)(object)smelter == (Object)null)
			{
				GameObject val = FindBuildPiece("smelter");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				smelter = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)smelter == (Object)null))
			{
				if (smelter.m_maxFuel == 20)
				{
					smelter.m_maxFuel = 45;
				}
				if (smelter.m_maxOre == 10)
				{
					smelter.m_maxOre = 15;
				}
				if (smelter.m_secPerProduct == 30f)
				{
					smelter.m_secPerProduct = 40f;
				}
				if (smelter.m_fuelPerProduct == 2)
				{
					smelter.m_fuelPerProduct = 3;
				}
				if (smelter.m_conversion == null)
				{
					smelter.m_conversion = new List<ItemConversion>();
				}
				removeConversionFromSmelter("IronScrap", smelter.m_conversion);
				removeConversionFromSmelter("CopperScrap", smelter.m_conversion);
				removeConversionFromSmelter("BronzeScrap", smelter.m_conversion);
				StringBuilder stringBuilder = new StringBuilder(256);
				stringBuilder.Append("\n Scrap does not go into Furnace/Smelter.  Can be only converted on Forge/Ironworks/Artisan/Blackforge");
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "SurtlingCoreCasing_bal", "SurtlingCore", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "CopperOre", "Copper", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "TinOre", "Tin", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "NickelOre_bal", "Nickel_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "IronOre", "Iron", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "SilverOre", "Silver", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)smelter).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)smelter).gameObject, stringBuilder.ToString(), "smelter");
			}
		}

		public void editFurnace(Smelter furnace = null)
		{
			if ((Object)(object)furnace == (Object)null)
			{
				GameObject val = FindBuildPiece("blastfurnace");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				furnace = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)furnace == (Object)null))
			{
				if (furnace.m_maxFuel == 20)
				{
					furnace.m_maxFuel = 60;
				}
				if (furnace.m_maxOre == 10)
				{
					furnace.m_maxOre = 30;
				}
				if (furnace.m_secPerProduct == 30f)
				{
					furnace.m_secPerProduct = 20f;
				}
				if (furnace.m_conversion == null)
				{
					furnace.m_conversion = new List<ItemConversion>();
				}
				removeConversionFromSmelter("BlackMetalScrap", furnace.m_conversion);
				StringBuilder stringBuilder = new StringBuilder(512);
				stringBuilder.Append("\n Scrap does not go into Furnace/Smelter.  Can be only converted on Forge/Ironworks/Artisan/Blackforge");
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "SurtlingCoreCasing_bal", "SurtlingCore", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "CopperOre", "Copper", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "TinOre", "Tin", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "NickelOre_bal", "Nickel_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "IronOre", "Iron", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "SilverOre", "Silver", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "BlackMetalOre_bal", "BlackMetal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "DarkIron_bal", "DarkSteel_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "CobaltOre_bal", "Cobalt_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "FlametalOre", "Flametal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)furnace).gameObject, "FlametalOreNew", "FlametalNew", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)furnace).gameObject, stringBuilder.ToString(), "smelter");
			}
		}

		public void editFermenter(Fermenter fermenter = null)
		{
			if ((Object)(object)fermenter == (Object)null)
			{
				GameObject val = FindBuildPiece("fermenter");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				fermenter = val.GetComponent<Fermenter>();
			}
			if (!((Object)(object)fermenter == (Object)null))
			{
				fermenter.m_fermentationDuration = 2000f;
				StringBuilder stringBuilder = new StringBuilder(128);
				stringBuilder.Append(addConversion(((Component)fermenter).gameObject, "MeadBaseWhiteCheese_bal", "WhiteCheese_bal", ConversionType.fermenter, 2));
				stringBuilder.Append(addConversion(((Component)fermenter).gameObject, "SurstrommingBase_bal", "Surstromming_bal", ConversionType.fermenter, 2));
				buildConversionStationTutorialTag(((Component)fermenter).gameObject, stringBuilder.ToString());
			}
		}

		public void editOven(CookingStation oven = null)
		{
			if ((Object)(object)oven == (Object)null)
			{
				GameObject val = FindBuildPiece("piece_oven");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				oven = val.GetComponent<CookingStation>();
			}
			if (!((Object)(object)oven == (Object)null))
			{
				if (oven.m_conversion == null)
				{
					oven.m_conversion = new List<ItemConversion>();
				}
				StringBuilder stringBuilder = new StringBuilder(128);
				stringBuilder.Append(addConversion(((Component)oven).gameObject, "FishWrapsUncooked_bal", "FishWraps", ConversionType.cooking, 50));
				stringBuilder.Append(addConversion(((Component)oven).gameObject, "ApplePieUncooked_bal", "ApplePie_bal", ConversionType.cooking, 50));
				stringBuilder.Append(addConversion(((Component)oven).gameObject, "BlueberryPieUncooked_bal", "BlueberryPie_bal", ConversionType.cooking, 50));
				buildConversionStationTutorialTag(((Component)oven).gameObject, stringBuilder.ToString());
			}
		}

		public void editCooking(CookingStation cookingStation = null)
		{
			if ((Object)(object)cookingStation == (Object)null)
			{
				GameObject val = FindBuildPiece("piece_cookingstation");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				cookingStation = val.GetComponent<CookingStation>();
			}
			if (!((Object)(object)cookingStation == (Object)null))
			{
				StringBuilder stringBuilder = new StringBuilder(256);
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 25));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 40));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking, 35));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60));
				buildConversionStationTutorialTag(((Component)cookingStation).gameObject, stringBuilder.ToString());
			}
		}

		public void editIronCooking(CookingStation cookingStation = null)
		{
			if ((Object)(object)cookingStation == (Object)null)
			{
				GameObject val = FindBuildPiece("piece_cookingstation_iron");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				cookingStation = val.GetComponent<CookingStation>();
			}
			if (!((Object)(object)cookingStation == (Object)null))
			{
				StringBuilder stringBuilder = new StringBuilder(256);
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking, 25));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "FenringMeat_bal", "FenringMeatCooked_bal", ConversionType.cooking, 60));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking, 20));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 20));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 35));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "DrakeMeat_bal", "DrakeMeatCooked_bal", ConversionType.cooking));
				stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60));
				buildConversionStationTutorialTag(((Component)cookingStation).gameObject, stringBuilder.ToString());
			}
		}

		public void editWHeel(Smelter wheel = null)
		{
			if ((Object)(object)wheel == (Object)null)
			{
				GameObject val = FindBuildPiece("piece_spinningwheel");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				wheel = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)wheel == (Object)null))
			{
				if (wheel.m_maxOre == 40)
				{
					wheel.m_maxOre = 80;
				}
				if (wheel.m_secPerProduct == 30f)
				{
					wheel.m_secPerProduct = 25f;
				}
				StringBuilder stringBuilder = new StringBuilder(128);
				stringBuilder.Append(addConversion(((Component)wheel).gameObject, "Straw_bal", "StrawThread_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)wheel).gameObject, "RawSilk_bal", "SilkReinforcedThread_bal", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)wheel).gameObject, stringBuilder.ToString());
			}
		}

		public void editSap(SapCollector sap = null)
		{
			if ((Object)(object)sap == (Object)null)
			{
				GameObject val = FindBuildPiece("piece_sapcollector");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				sap = val.GetComponent<SapCollector>();
			}
			if (!((Object)(object)sap == (Object)null))
			{
				if (sap.m_secPerUnit == 60f)
				{
					sap.m_secPerUnit = 90f;
				}
				if (sap.m_maxLevel == 10)
				{
					sap.m_maxLevel = 30;
				}
			}
		}

		public void editKiln(Smelter kiln = null)
		{
			if ((Object)(object)kiln == (Object)null)
			{
				GameObject val = FindBuildPiece("charcoal_kiln");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				kiln = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)kiln == (Object)null))
			{
				if (kiln.m_maxOre == 25)
				{
					kiln.m_maxOre = 50;
				}
				if (kiln.m_secPerProduct == 15f)
				{
					kiln.m_secPerProduct = 10f;
				}
				kiln.m_addOreTooltip = "$piece_smelter_add";
				StringBuilder stringBuilder = new StringBuilder(256);
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "TarBase_bal", "Tar", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "Moss_bal", "CoalPowder_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "ElderBark", "CoalPowder_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "YewBark_bal", "CoalPowder_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "WillowBark_bal", "CoalPowder_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "HardWood_bal", "Coal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "YggdrasilWood", "Coal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "Blackwood", "Coal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "ClayBrickMold_bal", "ClayBrick_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)kiln).gameObject, "CeramicMold_bal", "CeramicPlate", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)kiln).gameObject, stringBuilder.ToString());
			}
		}

		public void editPress(Smelter press = null)
		{
			if ((Object)(object)press == (Object)null)
			{
				GameObject val = FindBuildPiece("oilpress_bal");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				press = val.GetComponent<Smelter>();
			}
			if (!((Object)(object)press == (Object)null))
			{
				StringBuilder stringBuilder = new StringBuilder(256);
				stringBuilder.Append(addConversion(((Component)press).gameObject, "OilBase_bal", "Oil_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)press).gameObject, "BlackBerryJuiceBase_bal", "BlackBerryJuice_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)press).gameObject, "FruitPunchBase_bal", "FruitPunch_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)press).gameObject, "VineBerryJuiceBase_bal", "VineBerryJuice_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)press).gameObject, "MagmaCoctailBase_bal", "MagmaCoctail_bal", ConversionType.smelter));
				stringBuilder.Append(addConversion(((Component)press).gameObject, "PaintBucket_bal", "DyeKit_bal", ConversionType.smelter));
				buildConversionStationTutorialTag(((Component)press).gameObject, stringBuilder.ToString());
			}
		}

		private void editBeehive()
		{
			GameObject val = FindBuildPiece("piece_beehive");
			if (!((Object)(object)val == (Object)null))
			{
				Beehive component = val.GetComponent<Beehive>();
				if (!((Object)(object)component == (Object)null))
				{
					component.m_maxHoney = 20;
				}
			}
		}

		private void editIncinerator(Incinerator incinerator = null)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			if ((Object)(object)incinerator == (Object)null)
			{
				GameObject val = FindBuildPiece("incinerator");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				incinerator = val.GetComponent<Incinerator>();
			}
			if (!((Object)(object)incinerator == (Object)null))
			{
				if (incinerator.m_conversions == null)
				{
					incinerator.m_conversions = new List<IncineratorConversion>();
				}
				IncineratorConversion val2 = new IncineratorConversion
				{
					m_requireOnlyOneIngredient = true,
					m_priority = 2,
					m_requirements = new List<Requirement>(convertToBits.Length),
					m_result = FindItemDrop("CoalPowder_bal")
				};
				for (int i = 0; i < convertToBits.Length; i++)
				{
					val2.m_requirements.Add(new Requirement
					{
						m_amount = 1,
						m_resItem = FindItemDrop(convertToBits[i])
					});
				}
				incinerator.m_conversions.Add(val2);
				IncineratorConversion val3 = new IncineratorConversion
				{
					m_requireOnlyOneIngredient = true,
					m_requirements = new List<Requirement>(convertToCoal.Length),
					m_result = FindItemDrop("Coal")
				};
				for (int j = 0; j < convertToCoal.Length; j++)
				{
					val3.m_requirements.Add(new Requirement
					{
						m_amount = 1,
						m_resItem = FindItemDrop(convertToCoal[j])
					});
				}
				incinerator.m_conversions.Add(val3);
				IncineratorConversion val4 = new IncineratorConversion
				{
					m_requireOnlyOneIngredient = true,
					m_priority = 1,
					m_requirements = new List<Requirement>(arrowsNbolts.Length),
					m_result = FindItemDrop("Coal")
				};
				for (int k = 0; k < arrowsNbolts.Length; k++)
				{
					val4.m_requirements.Add(new Requirement
					{
						m_amount = 20,
						m_resItem = FindItemDrop(arrowsNbolts[k])
					});
				}
				incinerator.m_conversions.Add(val4);
			}
		}

		private string addConversion(GameObject source, string nameIn, string nameOut, ConversionType type, int time = 30, int amount = 5)
		{
			if ((Object)(object)source == (Object)null)
			{
				return "";
			}
			return type switch
			{
				ConversionType.smelter => SmelterConversion(source, nameIn, nameOut), 
				ConversionType.fermenter => FermenterConversion(source, nameIn, nameOut, amount), 
				ConversionType.cooking => CookingConversion(source, nameIn, nameOut, time), 
				ConversionType.balrondConverter => BalrondConversion(source, nameIn, nameOut, amount), 
				_ => "", 
			};
		}

		private void buildConversionStationTutorialTag(GameObject gameObject, string tutorialExtra, string tag = "workbench")
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			if (!((Object)(object)gameObject == (Object)null))
			{
				TutorialText item = new TutorialText
				{
					m_name = "BAN conversions:" + ((Object)gameObject).name,
					m_globalKeyTrigger = "AmazingNature" + ((Object)gameObject).name,
					m_tutorialTrigger = tag,
					m_topic = "BAN-" + ((Object)gameObject).name,
					m_label = "BAN-" + ((Object)gameObject).name,
					m_isMunin = true,
					m_text = "\n  <color=orange>BALROND AMAZING NATURE: </color>" + tutorialExtra
				};
				m_texts.Add(item);
			}
		}

		private string createConversionSingleLine(ItemDrop m_from, ItemDrop m_to, int time = 0, int amount = 0)
		{
			if ((Object)(object)m_from == (Object)null || (Object)(object)m_to == (Object)null)
			{
				return "";
			}
			string name = m_from.m_itemData.m_shared.m_name;
			string name2 = m_to.m_itemData.m_shared.m_name;
			if (time > 0 && amount == 0)
			{
				return "\n $tag_convers_bal " + name + " $tag_to_bal " + name2 + " $tag_in_bal " + time + " $tag_seconds_bal";
			}
			if (time == 0 && amount > 0)
			{
				return "\n $tag_convers_bal " + name + " $tag_to_bal " + amount + " " + name2;
			}
			if (time > 0 && amount > 0)
			{
				return "\n $tag_convers_bal " + name + " $tag_to_bal " + amount + " " + name2 + " $tag_in_bal " + time + " $tag_seconds_bal";
			}
			return "\n $tag_convers_bal " + name + " $tag_to_bal " + name2;
		}

		private bool HasFromPrefabName<T>(List<T> list, string nameIn, Func<T, ItemDrop> fromSelector) where T : class
		{
			if (list == null || list.Count == 0)
			{
				return false;
			}
			for (int i = 0; i < list.Count; i++)
			{
				T val = list[i];
				if (val == null)
				{
					continue;
				}
				ItemDrop val2 = fromSelector(val);
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				ItemData itemData = val2.m_itemData;
				if (itemData != null)
				{
					GameObject dropPrefab = itemData.m_dropPrefab;
					if (!((Object)(object)dropPrefab == (Object)null) && ((Object)dropPrefab).name == nameIn)
					{
						return true;
					}
				}
			}
			return false;
		}

		private string BalrondConversion(GameObject source, string nameIn, string nameOut, int amount = 1, List<GameObject> list = null)
		{
			BalrondConverter component = source.GetComponent<BalrondConverter>();
			if ((Object)(object)component == (Object)null)
			{
				return "";
			}
			if (component.m_conversion == null)
			{
				component.m_conversion = new List<BalrondConverter.ItemConversion>();
			}
			if (HasFromPrefabName(component.m_conversion, nameIn, (BalrondConverter.ItemConversion x) => x.m_from))
			{
				return "";
			}
			ItemDrop from = FindItemDrop(nameIn);
			ItemDrop to = FindItemDrop(nameOut);
			BalrondConverter.ItemConversion item = new BalrondConverter.ItemConversion
			{
				m_from = from,
				m_to = to,
				m_count = amount
			};
			component.m_conversion.Add(item);
			return createConversionSingleLine(from, to, 0, amount);
		}

		private string SmelterConversion(GameObject source, string nameIn, string nameOut)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			Smelter component = source.GetComponent<Smelter>();
			if ((Object)(object)component == (Object)null)
			{
				return "";
			}
			if (component.m_conversion == null)
			{
				component.m_conversion = new List<ItemConversion>();
			}
			if (HasFromPrefabName(component.m_conversion, nameIn, (ItemConversion x) => x.m_from))
			{
				return "";
			}
			ItemDrop from = FindItemDrop(nameIn);
			ItemDrop to = FindItemDrop(nameOut);
			component.m_conversion.Add(new ItemConversion
			{
				m_from = from,
				m_to = to
			});
			return createConversionSingleLine(from, to);
		}

		private string FermenterConversion(GameObject source, string nameIn, string nameOut, int amount = 1)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			Fermenter component = source.GetComponent<Fermenter>();
			if ((Object)(object)component == (Object)null)
			{
				return "";
			}
			if (component.m_conversion == null)
			{
				component.m_conversion = new List<ItemConversion>();
			}
			if (HasFromPrefabName(component.m_conversion, nameIn, (ItemConversion x) => x.m_from))
			{
				return "";
			}
			ItemDrop from = FindItemDrop(nameIn);
			ItemDrop to = FindItemDrop(nameOut);
			component.m_conversion.Add(new ItemConversion
			{
				m_from = from,
				m_to = to,
				m_producedItems = amount
			});
			return createConversionSingleLine(from, to, 0, amount);
		}

		private string CookingConversion(GameObject source, string nameIn, string nameOut, int time = 25)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			CookingStation component = source.GetComponent<CookingStation>();
			if ((Object)(object)component == (Object)null)
			{
				return "";
			}
			if (component.m_conversion == null)
			{
				component.m_conversion = new List<ItemConversion>();
			}
			if (HasFromPrefabName(component.m_conversion, nameIn, (I