Decompiled source of Valweed v1.0.0

plugins/Valweed/Valweed.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Valweed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Valweed")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.3.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class Bong : MonoBehaviour, Hoverable, Interactable
{
	private ZNetView m_nview;

	private Transform m_enabledTransform;

	[Header("Bong")]
	public string m_name = "$piece_bong";

	public float m_startFuel = 3f;

	public float m_maxFuel = 10f;

	public ItemDrop m_fuelItem;

	public SmokeSpawner m_smokeSpawner;

	public EffectList m_fuelAddedEffects = new EffectList();

	public EffectList m_smokedEffects = new EffectList();

	[Header("Fireworks / Effects")]
	public ItemDrop m_fireworkItem;

	public int m_fireworkItems = 2;

	public GameObject m_fireworks;

	public float ttl;

	public bool cosmeticOnly;

	public void Awake()
	{
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		m_nview = ((Component)this).GetComponent<ZNetView>();
		if ((Object)(object)m_nview == (Object)null || m_nview.GetZDO() == null)
		{
			return;
		}
		m_enabledTransform = ((Component)this).transform.Find("_enabled");
		if (m_nview.IsOwner() && m_nview.GetZDO().GetFloat("fuel", -1f) == -1f)
		{
			m_nview.GetZDO().Set("fuel", m_startFuel);
			if (m_startFuel > 0f)
			{
				m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1, default(ZDOID));
			}
		}
		m_nview.Register("AddFuel", (Action<long>)RPC_AddFuel);
	}

	public string GetHoverText()
	{
		if ((Object)(object)m_nview == (Object)null)
		{
			return string.Empty;
		}
		float num = m_nview.GetZDO().GetFloat("fuel", 0f);
		string text = (((Object)(object)m_fuelItem != (Object)null && m_fuelItem.m_itemData != null) ? m_fuelItem.m_itemData.m_shared.m_name : string.Empty);
		return Localization.instance.Localize($"{m_name} ( $piece_fire_fuel {Mathf.Ceil(num)}/{(int)m_maxFuel} )\n" + "[<color=yellow><b>$KEY_Use</b></color>] $piece_use " + text + "\n[<color=yellow><b>1-8</b></color>] $piece_useitem");
	}

	public float GetHoverOffset()
	{
		return 1f;
	}

	public string GetHoverName()
	{
		return m_name;
	}

	public bool Interact(Humanoid user, bool hold, bool alt)
	{
		if (hold)
		{
			return false;
		}
		if (!m_nview.HasOwner())
		{
			m_nview.ClaimOwnership();
		}
		Inventory inventory = user.GetInventory();
		if (inventory == null || (Object)(object)m_fuelItem == (Object)null)
		{
			return false;
		}
		string name = m_fuelItem.m_itemData.m_shared.m_name;
		float num = m_nview.GetZDO().GetFloat("fuel", 0f);
		if ((float)Mathf.CeilToInt(num) >= m_maxFuel)
		{
			SmokeBong(user);
			return true;
		}
		if (inventory.HaveItem(name, true))
		{
			((Character)user).Message((MessageType)1, Localization.instance.Localize("$bong_addbud", new string[1] { name }), 0, (Sprite)null, false);
			inventory.RemoveItem(name, 1, -1, true);
			if ((Object)(object)m_enabledTransform != (Object)null)
			{
				((Component)m_enabledTransform).gameObject.SetActive(true);
			}
			m_nview.InvokeRPC("AddFuel", Array.Empty<object>());
			return true;
		}
		((Character)user).Message((MessageType)1, Localization.instance.Localize("$msg_outof", new string[1] { name }), 0, (Sprite)null, false);
		return false;
	}

	private void SmokeBong(Humanoid user)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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_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)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = ((Component)this).transform.position + Vector3.up * 1.65f;
		string name = m_fuelItem.m_itemData.m_shared.m_name;
		((Character)user).Message((MessageType)1, Localization.instance.Localize("$bong_effectstart", new string[1] { name }), 0, (Sprite)null, false);
		((Character)user).GetSEMan().AddStatusEffect("BongStatusEffect".GetHashCode(), true, 0, 0f, (short)(-1));
		m_fuelAddedEffects.Create(val, ((Component)this).transform.rotation, (Transform)null, 1f, -1, default(ZDOID));
		float num = Mathf.Max(0f, m_nview.GetZDO().GetFloat("fuel", 0f) - 1f);
		m_nview.GetZDO().Set("fuel", num);
		if ((Object)(object)m_enabledTransform != (Object)null)
		{
			((Component)m_enabledTransform).gameObject.SetActive(false);
		}
		if (cosmeticOnly)
		{
			return;
		}
		Player val2 = (Player)(object)((user is Player) ? user : null);
		if (val2 == null)
		{
			return;
		}
		SE_Rested val3 = null;
		List<StatusEffect> statusEffects = ((Character)val2).GetSEMan().GetStatusEffects();
		for (int i = 0; i < statusEffects.Count; i++)
		{
			StatusEffect obj = statusEffects[i];
			SE_Rested val4 = (SE_Rested)(object)((obj is SE_Rested) ? obj : null);
			if (val4 != null)
			{
				val3 = val4;
				break;
			}
		}
		if ((Object)(object)val3 != (Object)null)
		{
			SE_Rested obj2 = val3;
			((StatusEffect)obj2).m_ttl = ((StatusEffect)obj2).m_ttl + ttl;
			((StatusEffect)val3).ResetTime();
		}
		else
		{
			((Character)val2).GetSEMan().AddStatusEffect(-1043425941, true, 0, 0f, (short)(-1));
		}
	}

	public bool UseItem(Humanoid user, ItemData item)
	{
		if (item == null || (Object)(object)m_fuelItem == (Object)null)
		{
			return false;
		}
		if (item.m_shared.m_name == m_fuelItem.m_itemData.m_shared.m_name)
		{
			float num = m_nview.GetZDO().GetFloat("fuel", 0f);
			if ((float)Mathf.CeilToInt(num) >= m_maxFuel)
			{
				((Character)user).Message((MessageType)1, Localization.instance.Localize("$msg_cantaddmore", new string[1] { item.m_shared.m_name }), 0, (Sprite)null, false);
				return true;
			}
			user.GetInventory().RemoveItem(item, 1);
			((Character)user).Message((MessageType)1, Localization.instance.Localize("$msg_fireadding", new string[1] { item.m_shared.m_name }), 0, (Sprite)null, false);
			m_nview.InvokeRPC("AddFuel", Array.Empty<object>());
			return true;
		}
		return false;
	}

	private void RPC_AddFuel(long sender)
	{
		if (m_nview.IsOwner())
		{
			float num = m_nview.GetZDO().GetFloat("fuel", 0f);
			if ((float)Mathf.CeilToInt(num) < m_maxFuel)
			{
				num = Mathf.Clamp(num + 1f, 0f, m_maxFuel);
				m_nview.GetZDO().Set("fuel", num);
			}
		}
	}

	public bool CanBeRemoved()
	{
		return true;
	}
}
public class SE_Bong : SE_Stats
{
	[Header("Custom Settings")]
	public int healthRegenVal;

	public int staminaRegenVal;

	public float ttl;

	public bool cosmeticOnly;

	private float m_healthRegenMult;

	private float m_staminaRegenMult;

	public override void Setup(Character character)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		((StatusEffect)this).m_character = character;
		if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
		{
			((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null, false);
		}
		if (base.m_healthOverTime > 0f && base.m_healthOverTimeInterval > 0f && base.m_healthOverTimeDuration <= 0f)
		{
			base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		if (base.m_staminaOverTime > 0f && base.m_staminaOverTimeDuration <= 0f)
		{
			base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		m_healthRegenMult = 1f + (float)healthRegenVal / 100f;
		m_staminaRegenMult = 1f + (float)staminaRegenVal / 100f;
		base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : m_healthRegenMult);
		base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : m_staminaRegenMult);
		((StatusEffect)this).m_ttl = (cosmeticOnly ? 20f : ttl);
		TriggerSmokeEffects();
	}

	public override void ResetTime()
	{
		((SE_Stats)this).ResetTime();
		TriggerSmokeEffects();
	}

	private void TriggerSmokeEffects()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_0059: 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)
		if (!((Object)(object)((StatusEffect)this).m_character == (Object)null))
		{
			Vector3 headPoint = ((StatusEffect)this).m_character.GetHeadPoint();
			float radius = ((StatusEffect)this).m_character.GetRadius();
			((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(headPoint, ((Component)((StatusEffect)this).m_character).transform.rotation, ((Component)((StatusEffect)this).m_character).transform, radius * 2f, -1, default(ZDOID));
		}
	}

	public override void Stop()
	{
		((StatusEffect)this).Stop();
	}
}
public class SE_Hybrid : SE_Stats
{
	[Header("Custom Settings")]
	public int healthRegenVal;

	public int staminaRegenVal;

	public float ttl;

	public bool cosmeticOnly;

	private float m_healthRegenMult;

	private float m_staminaRegenMult;

	public override void Setup(Character character)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		((StatusEffect)this).m_character = character;
		if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
		{
			((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null, false);
		}
		if (base.m_healthOverTime > 0f && base.m_healthOverTimeInterval > 0f && base.m_healthOverTimeDuration <= 0f)
		{
			base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		if (base.m_staminaOverTime > 0f && base.m_staminaOverTimeDuration <= 0f)
		{
			base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		m_healthRegenMult = 1f + (float)healthRegenVal / 100f;
		m_staminaRegenMult = 1f + (float)staminaRegenVal / 100f;
		base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : m_healthRegenMult);
		base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : m_staminaRegenMult);
		((StatusEffect)this).m_ttl = (cosmeticOnly ? 10f : ttl);
		TriggerSmokeEffects();
	}

	public override void ResetTime()
	{
		((SE_Stats)this).ResetTime();
		TriggerSmokeEffects();
	}

	private void TriggerSmokeEffects()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_0059: 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)
		if (!((Object)(object)((StatusEffect)this).m_character == (Object)null))
		{
			Vector3 headPoint = ((StatusEffect)this).m_character.GetHeadPoint();
			float radius = ((StatusEffect)this).m_character.GetRadius();
			((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(headPoint, ((Component)((StatusEffect)this).m_character).transform.rotation, ((Component)((StatusEffect)this).m_character).transform, radius * 2f, -1, default(ZDOID));
		}
	}

	public override void Stop()
	{
		((StatusEffect)this).Stop();
	}
}
public class SE_Indica : SE_Stats
{
	[Header("Custom Settings")]
	public int healthRegenVal;

	public int staminaRegenVal;

	public float ttl;

	public bool cosmeticOnly;

	private float m_healthRegenMult;

	private float m_staminaRegenMult;

	public override void Setup(Character character)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		((StatusEffect)this).m_character = character;
		if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
		{
			((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null, false);
		}
		if (base.m_healthOverTime > 0f && base.m_healthOverTimeInterval > 0f && base.m_healthOverTimeDuration <= 0f)
		{
			base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		if (base.m_staminaOverTime > 0f && base.m_staminaOverTimeDuration <= 0f)
		{
			base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		m_healthRegenMult = 1f + (float)healthRegenVal / 100f;
		m_staminaRegenMult = 1f + (float)staminaRegenVal / 100f;
		base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : m_healthRegenMult);
		base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : m_staminaRegenMult);
		((StatusEffect)this).m_ttl = (cosmeticOnly ? 10f : ttl);
		if (!cosmeticOnly)
		{
			ExtendRestedBuff(ttl);
		}
		TriggerSmokeEffects();
	}

	public override void ResetTime()
	{
		((SE_Stats)this).ResetTime();
		if (!cosmeticOnly)
		{
			ExtendRestedBuff(ttl / 2f);
		}
		TriggerSmokeEffects();
	}

	private void ExtendRestedBuff(float extraTime)
	{
		Character character = ((StatusEffect)this).m_character;
		Player val = (Player)(object)((character is Player) ? character : null);
		if (val == null)
		{
			return;
		}
		SE_Rested val2 = null;
		foreach (StatusEffect statusEffect in ((Character)val).GetSEMan().GetStatusEffects())
		{
			SE_Rested val3 = (SE_Rested)(object)((statusEffect is SE_Rested) ? statusEffect : null);
			if (val3 != null)
			{
				val2 = val3;
				break;
			}
		}
		if ((Object)(object)val2 != (Object)null)
		{
			SE_Rested obj = val2;
			((StatusEffect)obj).m_ttl = ((StatusEffect)obj).m_ttl + extraTime;
			((StatusEffect)val2).ResetTime();
		}
		else
		{
			((Character)val).GetSEMan().AddStatusEffect("Rested".GetHashCode(), true, 0, 0f, (short)(-1));
		}
	}

	private void TriggerSmokeEffects()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_0059: 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)
		if (!((Object)(object)((StatusEffect)this).m_character == (Object)null))
		{
			Vector3 headPoint = ((StatusEffect)this).m_character.GetHeadPoint();
			float radius = ((StatusEffect)this).m_character.GetRadius();
			((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(headPoint, ((Component)((StatusEffect)this).m_character).transform.rotation, ((Component)((StatusEffect)this).m_character).transform, radius * 2f, -1, default(ZDOID));
		}
	}

	public override void Stop()
	{
		((StatusEffect)this).Stop();
	}
}
public class SE_Sativa : SE_Stats
{
	[Header("Custom Settings")]
	public int healthRegenVal;

	public int staminaRegenVal;

	public int hungerSlowRate = 50;

	public float ttl;

	public bool cosmeticOnly;

	private float m_healthRegenMult;

	private float m_staminaRegenMult;

	public override void Setup(Character character)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		((StatusEffect)this).m_character = character;
		if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
		{
			((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null, false);
		}
		if (base.m_healthOverTime > 0f && base.m_healthOverTimeInterval > 0f && base.m_healthOverTimeDuration <= 0f)
		{
			base.m_healthOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		if (base.m_staminaOverTime > 0f && base.m_staminaOverTimeDuration <= 0f)
		{
			base.m_staminaOverTimeDuration = ((StatusEffect)this).m_ttl;
		}
		m_healthRegenMult = 1f + (float)healthRegenVal / 100f;
		m_staminaRegenMult = 1f + (float)staminaRegenVal / 100f;
		base.m_healthRegenMultiplier = (cosmeticOnly ? 1f : m_healthRegenMult);
		base.m_staminaRegenMultiplier = (cosmeticOnly ? 1f : m_staminaRegenMult);
		((StatusEffect)this).m_ttl = (cosmeticOnly ? 10f : ttl);
		TriggerSmokeEffects();
	}

	public override void ResetTime()
	{
		((SE_Stats)this).ResetTime();
		TriggerSmokeEffects();
	}

	private void TriggerSmokeEffects()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_0059: 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)
		if (!((Object)(object)((StatusEffect)this).m_character == (Object)null))
		{
			Vector3 headPoint = ((StatusEffect)this).m_character.GetHeadPoint();
			float radius = ((StatusEffect)this).m_character.GetRadius();
			((StatusEffect)this).m_startEffectInstances = ((StatusEffect)this).m_startEffects.Create(headPoint, ((Component)((StatusEffect)this).m_character).transform.rotation, ((Component)((StatusEffect)this).m_character).transform, radius * 2f, -1, default(ZDOID));
		}
	}

	public override void Stop()
	{
		((StatusEffect)this).Stop();
	}
}
namespace Valweed
{
	[BepInPlugin("com.drod917.Valweed", "Valweed", "0.3.4")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Valweed : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Plant), "HaveRoof")]
		public static class PlantHaveRoof
		{
			public static bool Prefix(Plant __instance, ref bool __result)
			{
				if (__instance.m_name == "$piece_sapling_weed" || __instance.m_name == "$piece_sapling_weed_seeds")
				{
					__result = false;
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Player), "CanConsumeItem")]
		public static class PlayerCanConsumeItem
		{
			public static bool Prefix(Player __instance, ref ItemData item, ref bool __result)
			{
				if (item != null && item.m_shared != null && (Object)(object)item.m_shared.m_consumeStatusEffect != (Object)null)
				{
					StatusEffect consumeStatusEffect = item.m_shared.m_consumeStatusEffect;
					if (consumeStatusEffect.m_name.EndsWith("joint_effectname") && ((Character)__instance).GetSEMan().HaveStatusEffect(((Object)consumeStatusEffect).name.GetHashCode()))
					{
						__result = true;
						return false;
					}
					if (!string.IsNullOrEmpty(consumeStatusEffect.m_category) && ((Character)__instance).GetSEMan().HaveStatusEffectCategory(consumeStatusEffect.m_category))
					{
						__result = true;
						return false;
					}
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Player), "UpdateFood")]
		public static class PlayerUpdateFoodPatch
		{
			public static void Prefix(Player __instance, ref float dt)
			{
				SEMan sEMan = ((Character)__instance).GetSEMan();
				if (sEMan != null && (sEMan.HaveStatusEffect("SativaJointStatusEffect".GetHashCode()) || sEMan.HaveStatusEffect("BongStatusEffect".GetHashCode())))
				{
					dt *= 0.5f;
				}
			}
		}

		public const string PluginGUID = "com.drod917.Valweed";

		public const string PluginName = "Valweed";

		public const string PluginVersion = "0.3.4";

		private readonly Harmony harmony = new Harmony("com.drod917.Valweed");

		private AssetBundle jointResourceBundle;

		private AssetBundle plantResourceBundle;

		private AssetBundle bongResourceBundle;

		private AssetBundle spriteBundle;

		private GameObject hybridJointPrefab;

		private GameObject indicaJointPrefab;

		private GameObject sativaJointPrefab;

		private GameObject weedSaplingPrefab;

		private GameObject weedSeedSaplingPrefab;

		private GameObject pickableWeedPrefab;

		private GameObject pickableSeedWeedPrefab;

		private GameObject weedNugsPrefab;

		private GameObject weedNugPrefab;

		private GameObject weedSeedsPrefab;

		private GameObject weedPaperPrefab;

		private GameObject bongPrefab;

		private GameObject bongNoisePrefab;

		private GameObject bongSmokePrefab;

		private GameObject bongMouthSmokePrefab;

		private GameObject bongInhaleNoisePrefab;

		private GameObject mouthSmokePrefab;

		private GameObject jointNoisePrefab;

		private CustomStatusEffect hybridJointEffect;

		private CustomStatusEffect indicaJointEffect;

		private CustomStatusEffect sativaJointEffect;

		private CustomStatusEffect bongStatusEffect;

		private int jointHealthRegenVal;

		private int jointStamRegenVal;

		private float jointEffectTime;

		private bool cosmeticOnly;

		private int seedGrowTime;

		private int seedYield;

		private int seedYieldBonus;

		private float seedYieldBonusChance;

		private int budGrowTime;

		private int budYield;

		private int budYieldBonus;

		private float budYieldBonusChance;

		private void Awake()
		{
			InitConfig();
			LoadAssets();
			AddStatusEffects();
			CreateItems();
			CreatePieces();
			harmony.PatchAll(typeof(PlantHaveRoof));
			harmony.PatchAll(typeof(PlayerCanConsumeItem));
			harmony.PatchAll(typeof(PlayerUpdateFoodPatch));
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			((BaseUnityPlugin)this).Config.SettingChanged += delegate(object sender, SettingChangedEventArgs args)
			{
				SettingChanged(((BaseUnityPlugin)this).Config, args);
			};
		}

		private void InitConfig()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Expected O, but got Unknown
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Expected O, but got Unknown
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Expected O, but got Unknown
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Expected O, but got Unknown
			jointHealthRegenVal = ((BaseUnityPlugin)this).Config.Bind<int>("Buff Settings", "Joint Health Regen Rate", 50, new ConfigDescription("Percent rate to increase health regen (Default 50 (+50%))", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			jointStamRegenVal = ((BaseUnityPlugin)this).Config.Bind<int>("Buff Settings", "Joint Stamina Regen Rate", 100, new ConfigDescription("Percent rate to increase stamina regen (Default 100 (+100%))", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			jointEffectTime = ((BaseUnityPlugin)this).Config.Bind<int>("Buff Settings", "Joint Buff Duration", 600, new ConfigDescription("Effective time for smoking to last (Default 600s (10m))", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 3600), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			cosmeticOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Buff Settings", "Cosmetic Effects Only", false, new ConfigDescription("Disables health and stamina regen modifiers. (Default Off)", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			seedGrowTime = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Grow Time", 4000, new ConfigDescription("Adjusts how long until seeds can be harvested. (Default 4000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 16000), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			seedYield = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Yield", 2, new ConfigDescription("Adjusts how many seeds are harvested. (Default 2)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			seedYieldBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Yield Bonus", 1, new ConfigDescription("Adjusts how many bonus seeds are harvested. (Default 1)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			seedYieldBonusChance = (float)((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Seed Yield Bonus Chance", 75, new ConfigDescription("Adjusts the chance to harvest bonus seeds. (Default 75%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value / 100f;
			budGrowTime = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Grow Time", 4000, new ConfigDescription("Adjusts how long until buds can be harvested. (Default 4000)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 16000), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			budYield = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Yield", 1, new ConfigDescription("Adjusts how many buds are harvested. (Default 1)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			budYieldBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Yield Bonus", 2, new ConfigDescription("Adjusts how many bonus buds are harvested. (Default 2)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 99), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value;
			budYieldBonusChance = (float)((BaseUnityPlugin)this).Config.Bind<int>("Yield Settings", "Bud Yield Bonus Chance", 75, new ConfigDescription("Adjusts the chance to harvest bonus buds. (Default 75%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { (object)new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			} })).Value / 100f;
		}

		private void SettingChanged(ConfigFile sender, SettingChangedEventArgs args)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			InitConfig();
			GameObject prefab = PrefabManager.Instance.GetPrefab("Bong");
			Bong bong = default(Bong);
			if ((Object)(object)prefab != (Object)null && prefab.TryGetComponent<Bong>(ref bong))
			{
				bong.cosmeticOnly = cosmeticOnly;
			}
			GameObject prefab2 = PrefabManager.Instance.GetPrefab("sapling_weed");
			Plant val = default(Plant);
			if ((Object)(object)prefab2 != (Object)null && prefab2.TryGetComponent<Plant>(ref val))
			{
				val.m_growTime = budGrowTime;
				val.m_growTimeMax = budGrowTime;
				val.m_biome = (Biome)25;
			}
			GameObject prefab3 = PrefabManager.Instance.GetPrefab("Pickable_WeedPlant");
			Pickable val2 = default(Pickable);
			if ((Object)(object)prefab3 != (Object)null && prefab3.TryGetComponent<Pickable>(ref val2))
			{
				val2.m_amount = budYield;
				val2.m_extraDrops.m_dropMin = budYieldBonus;
				val2.m_extraDrops.m_dropMax = budYieldBonus;
				val2.m_extraDrops.m_dropChance = budYieldBonusChance;
			}
			GameObject prefab4 = PrefabManager.Instance.GetPrefab("sapling_seedweed");
			Plant val3 = default(Plant);
			if ((Object)(object)prefab4 != (Object)null && prefab4.TryGetComponent<Plant>(ref val3))
			{
				val3.m_growTime = seedGrowTime;
				val3.m_growTimeMax = seedGrowTime;
				val3.m_biome = (Biome)25;
			}
			GameObject prefab5 = PrefabManager.Instance.GetPrefab("Pickable_SeedWeedPlant");
			Pickable val4 = default(Pickable);
			if ((Object)(object)prefab5 != (Object)null && prefab5.TryGetComponent<Pickable>(ref val4))
			{
				val4.m_amount = seedYield;
				val4.m_extraDrops.m_dropMin = seedYieldBonus;
				val4.m_extraDrops.m_dropMax = seedYieldBonus;
				val4.m_extraDrops.m_dropChance = seedYieldBonusChance;
			}
			SE_Sativa sE_Sativa = ((Resources.FindObjectsOfTypeAll<SE_Sativa>().Length != 0) ? Resources.FindObjectsOfTypeAll<SE_Sativa>()[0] : null);
			if ((Object)(object)sE_Sativa != (Object)null)
			{
				sE_Sativa.cosmeticOnly = cosmeticOnly;
				sE_Sativa.healthRegenVal = jointHealthRegenVal;
				sE_Sativa.staminaRegenVal = jointStamRegenVal;
				sE_Sativa.ttl = jointEffectTime;
				((StatusEffect)sE_Sativa).m_tooltip = "$sativa_joint_tooltip" + (cosmeticOnly ? "" : "\n\nHunger Rate -50%");
			}
			SE_Indica sE_Indica = ((Resources.FindObjectsOfTypeAll<SE_Indica>().Length != 0) ? Resources.FindObjectsOfTypeAll<SE_Indica>()[0] : null);
			if ((Object)(object)sE_Indica != (Object)null)
			{
				sE_Indica.cosmeticOnly = cosmeticOnly;
				sE_Indica.healthRegenVal = jointHealthRegenVal;
				sE_Indica.staminaRegenVal = jointStamRegenVal;
				sE_Indica.ttl = jointEffectTime;
				((StatusEffect)sE_Indica).m_tooltip = "$indica_joint_tooltip";
			}
			SE_Hybrid sE_Hybrid = ((Resources.FindObjectsOfTypeAll<SE_Hybrid>().Length != 0) ? Resources.FindObjectsOfTypeAll<SE_Hybrid>()[0] : null);
			if ((Object)(object)sE_Hybrid != (Object)null)
			{
				sE_Hybrid.cosmeticOnly = cosmeticOnly;
				sE_Hybrid.healthRegenVal = jointHealthRegenVal;
				sE_Hybrid.staminaRegenVal = jointStamRegenVal;
				sE_Hybrid.ttl = jointEffectTime;
				((StatusEffect)sE_Hybrid).m_tooltip = "$hybrid_joint_tooltip";
			}
			SE_Bong sE_Bong = ((Resources.FindObjectsOfTypeAll<SE_Bong>().Length != 0) ? Resources.FindObjectsOfTypeAll<SE_Bong>()[0] : null);
			if ((Object)(object)sE_Bong != (Object)null)
			{
				sE_Bong.cosmeticOnly = cosmeticOnly;
				sE_Bong.healthRegenVal = jointHealthRegenVal;
				sE_Bong.staminaRegenVal = jointStamRegenVal;
				sE_Bong.ttl = jointEffectTime * 3f;
				((StatusEffect)sE_Bong).m_tooltip = "$bong_tooltip" + (cosmeticOnly ? "" : "\nHunger Rate -50%");
			}
		}

		private void LoadAssets()
		{
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			jointResourceBundle = AssetUtils.LoadAssetBundleFromResources("joint", Assembly.GetExecutingAssembly());
			hybridJointPrefab = jointResourceBundle.LoadAsset<GameObject>("JointHybrid");
			indicaJointPrefab = jointResourceBundle.LoadAsset<GameObject>("JointIndica");
			sativaJointPrefab = jointResourceBundle.LoadAsset<GameObject>("JointSativa");
			weedPaperPrefab = jointResourceBundle.LoadAsset<GameObject>("JointPaper");
			jointNoisePrefab = jointResourceBundle.LoadAsset<GameObject>("sfx_hit_joint");
			plantResourceBundle = AssetUtils.LoadAssetBundleFromResources("plant", Assembly.GetExecutingAssembly());
			weedSaplingPrefab = plantResourceBundle.LoadAsset<GameObject>("sapling_weed");
			weedSeedSaplingPrefab = plantResourceBundle.LoadAsset<GameObject>("sapling_seedweed");
			pickableWeedPrefab = plantResourceBundle.LoadAsset<GameObject>("Pickable_WeedPlant");
			pickableSeedWeedPrefab = plantResourceBundle.LoadAsset<GameObject>("Pickable_SeedWeedPlant");
			weedNugsPrefab = plantResourceBundle.LoadAsset<GameObject>("WeedBuds");
			weedSeedsPrefab = plantResourceBundle.LoadAsset<GameObject>("WeedSeeds");
			bongResourceBundle = AssetUtils.LoadAssetBundleFromResources("bong", Assembly.GetExecutingAssembly());
			bongPrefab = bongResourceBundle.LoadAsset<GameObject>("Bong");
			weedNugPrefab = bongResourceBundle.LoadAsset<GameObject>("bud");
			bongNoisePrefab = bongResourceBundle.LoadAsset<GameObject>("sfx_hit_bong");
			bongInhaleNoisePrefab = bongResourceBundle.LoadAsset<GameObject>("sfx_hit_bong_inhale");
			bongSmokePrefab = bongResourceBundle.LoadAsset<GameObject>("vfx_bong_smoke");
			mouthSmokePrefab = bongResourceBundle.LoadAsset<GameObject>("vfx_mouth_smoke");
			bongMouthSmokePrefab = bongResourceBundle.LoadAsset<GameObject>("vfx_mouth_smoke_bong");
			weedSaplingPrefab.GetComponent<Plant>().m_growTime = budGrowTime;
			weedSaplingPrefab.GetComponent<Plant>().m_growTimeMax = budGrowTime;
			weedSaplingPrefab.GetComponent<Plant>().m_biome = (Biome)25;
			pickableWeedPrefab.GetComponent<Pickable>().m_amount = budYield;
			pickableWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMin = budYieldBonus;
			pickableWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMax = budYieldBonus;
			pickableWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropChance = budYieldBonusChance;
			weedSeedSaplingPrefab.GetComponent<Plant>().m_growTime = seedGrowTime;
			weedSeedSaplingPrefab.GetComponent<Plant>().m_growTimeMax = seedGrowTime;
			weedSeedSaplingPrefab.GetComponent<Plant>().m_biome = (Biome)25;
			pickableSeedWeedPrefab.GetComponent<Pickable>().m_amount = seedYield;
			pickableSeedWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMin = seedYieldBonus;
			pickableSeedWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropMax = seedYieldBonus;
			pickableSeedWeedPrefab.GetComponent<Pickable>().m_extraDrops.m_dropChance = seedYieldBonusChance;
			PrefabManager.Instance.AddPrefab(pickableWeedPrefab);
			PrefabManager.Instance.AddPrefab(pickableSeedWeedPrefab);
			PrefabManager.Instance.AddPrefab(weedNugPrefab);
			PrefabManager.Instance.AddPrefab(bongSmokePrefab);
			PrefabManager.Instance.AddPrefab(bongNoisePrefab);
			PrefabManager.Instance.AddPrefab(mouthSmokePrefab);
			PrefabManager.Instance.AddPrefab(jointNoisePrefab);
			PrefabManager.Instance.AddPrefab(bongMouthSmokePrefab);
		}

		private void AddStatusEffects()
		{
			//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_0040: 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_004f: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Expected O, but got Unknown
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Expected O, but got Unknown
			spriteBundle = AssetUtils.LoadAssetBundleFromResources("high_eyes", Assembly.GetExecutingAssembly());
			Sprite icon = spriteBundle.LoadAsset<Sprite>("Assets/Joint/high_eyes.png");
			EffectData[] effectPrefabs = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = mouthSmokePrefab,
					m_attach = true,
					m_enabled = true
				},
				new EffectData
				{
					m_prefab = jointNoisePrefab,
					m_enabled = true
				}
			};
			EffectData[] effectPrefabs2 = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = bongMouthSmokePrefab,
					m_attach = true,
					m_enabled = true
				},
				new EffectData
				{
					m_prefab = bongInhaleNoisePrefab,
					m_attach = true,
					m_enabled = true
				}
			};
			SE_Hybrid sE_Hybrid = ScriptableObject.CreateInstance<SE_Hybrid>();
			sE_Hybrid.healthRegenVal = jointHealthRegenVal;
			sE_Hybrid.staminaRegenVal = jointStamRegenVal;
			sE_Hybrid.ttl = jointEffectTime;
			sE_Hybrid.cosmeticOnly = cosmeticOnly;
			((Object)sE_Hybrid).name = "HybridJointStatusEffect";
			((StatusEffect)sE_Hybrid).m_name = "$hybrid_joint_effectname";
			((StatusEffect)sE_Hybrid).m_icon = icon;
			((StatusEffect)sE_Hybrid).m_startMessageType = (MessageType)2;
			((StatusEffect)sE_Hybrid).m_startMessage = "$joint_effectstart";
			((StatusEffect)sE_Hybrid).m_stopMessageType = (MessageType)2;
			((StatusEffect)sE_Hybrid).m_stopMessage = "$joint_effectstop";
			((StatusEffect)sE_Hybrid).m_tooltip = "$hybrid_joint_tooltip";
			((StatusEffect)sE_Hybrid).m_startEffects.m_effectPrefabs = effectPrefabs;
			hybridJointEffect = new CustomStatusEffect((StatusEffect)(object)sE_Hybrid, false);
			ItemManager.Instance.AddStatusEffect(hybridJointEffect);
			SE_Indica sE_Indica = ScriptableObject.CreateInstance<SE_Indica>();
			sE_Indica.healthRegenVal = jointHealthRegenVal;
			sE_Indica.staminaRegenVal = jointStamRegenVal;
			sE_Indica.ttl = jointEffectTime;
			sE_Indica.cosmeticOnly = cosmeticOnly;
			((Object)sE_Indica).name = "IndicaJointStatusEffect";
			((StatusEffect)sE_Indica).m_name = "$indica_joint_effectname";
			((StatusEffect)sE_Indica).m_icon = icon;
			((StatusEffect)sE_Indica).m_startMessageType = (MessageType)2;
			((StatusEffect)sE_Indica).m_startMessage = "$joint_effectstart";
			((StatusEffect)sE_Indica).m_stopMessageType = (MessageType)2;
			((StatusEffect)sE_Indica).m_stopMessage = "$joint_effectstop";
			((StatusEffect)sE_Indica).m_tooltip = "$indica_joint_tooltip";
			((StatusEffect)sE_Indica).m_startEffects.m_effectPrefabs = effectPrefabs;
			indicaJointEffect = new CustomStatusEffect((StatusEffect)(object)sE_Indica, false);
			ItemManager.Instance.AddStatusEffect(indicaJointEffect);
			SE_Sativa sE_Sativa = ScriptableObject.CreateInstance<SE_Sativa>();
			sE_Sativa.healthRegenVal = jointHealthRegenVal;
			sE_Sativa.staminaRegenVal = jointStamRegenVal;
			sE_Sativa.ttl = jointEffectTime;
			sE_Sativa.cosmeticOnly = cosmeticOnly;
			((Object)sE_Sativa).name = "SativaJointStatusEffect";
			((StatusEffect)sE_Sativa).m_name = "$sativa_joint_effectname";
			((StatusEffect)sE_Sativa).m_icon = icon;
			((StatusEffect)sE_Sativa).m_startMessageType = (MessageType)2;
			((StatusEffect)sE_Sativa).m_startMessage = "$joint_effectstart";
			((StatusEffect)sE_Sativa).m_stopMessageType = (MessageType)2;
			((StatusEffect)sE_Sativa).m_stopMessage = "$joint_effectstop";
			((StatusEffect)sE_Sativa).m_tooltip = "$sativa_joint_tooltip" + (cosmeticOnly ? "" : "\n\nHunger Rate -50%");
			((StatusEffect)sE_Sativa).m_startEffects.m_effectPrefabs = effectPrefabs;
			sativaJointEffect = new CustomStatusEffect((StatusEffect)(object)sE_Sativa, false);
			ItemManager.Instance.AddStatusEffect(sativaJointEffect);
			SE_Bong sE_Bong = ScriptableObject.CreateInstance<SE_Bong>();
			sE_Bong.healthRegenVal = jointHealthRegenVal;
			sE_Bong.staminaRegenVal = jointStamRegenVal;
			sE_Bong.ttl = jointEffectTime * 3f;
			sE_Bong.cosmeticOnly = cosmeticOnly;
			((Object)sE_Bong).name = "BongStatusEffect";
			((StatusEffect)sE_Bong).m_name = "$bong_effectname";
			((StatusEffect)sE_Bong).m_icon = icon;
			((StatusEffect)sE_Bong).m_startMessageType = (MessageType)2;
			((StatusEffect)sE_Bong).m_startMessage = "$bong_effectstart";
			((StatusEffect)sE_Bong).m_stopMessageType = (MessageType)2;
			((StatusEffect)sE_Bong).m_stopMessage = "$joint_effectstop";
			((StatusEffect)sE_Bong).m_tooltip = "$bong_tooltip" + (cosmeticOnly ? "" : "\nHunger Rate -50%");
			((StatusEffect)sE_Bong).m_startEffects.m_effectPrefabs = effectPrefabs2;
			bongStatusEffect = new CustomStatusEffect((StatusEffect)(object)sE_Bong, false);
			ItemManager.Instance.AddStatusEffect(bongStatusEffect);
		}

		private void CreateItems()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//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)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Expected O, but got Unknown
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Expected O, but got Unknown
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Expected O, but got Unknown
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Expected O, but got Unknown
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Expected O, but got Unknown
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Expected O, but got Unknown
			ItemConfig val = new ItemConfig();
			val.Amount = 1;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig
				{
					Item = "JointPaper",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "WeedBuds",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "Raspberry",
					Amount = 1
				}
			};
			ItemConfig val2 = val;
			CustomItem val3 = new CustomItem(hybridJointPrefab, false, val2);
			val3.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
			val3.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = hybridJointEffect.StatusEffect;
			ItemManager.Instance.AddItem(val3);
			val = new ItemConfig();
			val.Amount = 1;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig
				{
					Item = "JointPaper",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "WeedBuds",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "Blueberries",
					Amount = 1
				}
			};
			ItemConfig val4 = val;
			CustomItem val5 = new CustomItem(indicaJointPrefab, false, val4);
			val5.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
			val5.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = indicaJointEffect.StatusEffect;
			ItemManager.Instance.AddItem(val5);
			val = new ItemConfig();
			val.Amount = 1;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3]
			{
				new RequirementConfig
				{
					Item = "JointPaper",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "WeedBuds",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "Honey",
					Amount = 1
				}
			};
			ItemConfig val6 = val;
			CustomItem val7 = new CustomItem(sativaJointPrefab, false, val6);
			val7.ItemDrop.m_itemData.m_shared.m_itemType = (ItemType)2;
			val7.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = sativaJointEffect.StatusEffect;
			ItemManager.Instance.AddItem(val7);
			val = new ItemConfig();
			val.Amount = 1;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "Dandelion",
					Amount = 2
				}
			};
			ItemConfig val8 = val;
			CustomItem val9 = new CustomItem(weedPaperPrefab, false, val8);
			ItemManager.Instance.AddItem(val9);
			CustomItem val10 = new CustomItem(weedNugsPrefab, false);
			ItemManager.Instance.AddItem(val10);
			val = new ItemConfig();
			val.Amount = 1;
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "AncientSeed",
					Amount = 3
				}
			};
			ItemConfig val11 = val;
			CustomItem val12 = new CustomItem(weedSeedsPrefab, false, val11);
			ItemManager.Instance.AddItem(val12);
		}

		private void CreatePieces()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_010e: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Expected O, but got Unknown
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			PieceConfig val = new PieceConfig();
			val.PieceTable = "Cultivator";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "WeedSeeds",
					Amount = 1
				}
			};
			PieceConfig val2 = val;
			CustomPiece val3 = new CustomPiece(weedSaplingPrefab, true, val2);
			PieceManager.Instance.AddPiece(val3);
			val = new PieceConfig();
			val.PieceTable = "Cultivator";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "WeedBuds",
					Amount = 1
				}
			};
			PieceConfig val4 = val;
			CustomPiece val5 = new CustomPiece(weedSeedSaplingPrefab, true, val4);
			PieceManager.Instance.AddPiece(val5);
			val = new PieceConfig();
			val.PieceTable = "Hammer";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig
				{
					Item = "BronzeNails",
					Amount = 5
				},
				new RequirementConfig
				{
					Item = "Resin",
					Amount = 10
				},
				new RequirementConfig
				{
					Item = "TrophySkeleton",
					Amount = 1
				},
				new RequirementConfig
				{
					Item = "GreydwarfEye",
					Amount = 5
				}
			};
			PieceConfig val6 = val;
			CustomPiece val7 = new CustomPiece(bongPrefab, true, val6);
			Piece component = val7.PiecePrefab.GetComponent<Piece>();
			if ((Object)(object)component != (Object)null && component.m_resources != null)
			{
				for (int i = 0; i < component.m_resources.Length; i++)
				{
					component.m_resources[i].m_recover = true;
				}
				component.m_onlyInBiome = (Biome)0;
			}
			Bong bong = val7.PiecePrefab.GetComponent<Bong>();
			if ((Object)(object)bong == (Object)null)
			{
				bong = val7.PiecePrefab.AddComponent<Bong>();
			}
			bong.m_name = "$piece_bong";
			bong.m_startFuel = 0f;
			bong.m_maxFuel = 1f;
			bong.m_fuelItem = weedNugsPrefab.GetComponent<ItemDrop>();
			bong.cosmeticOnly = cosmeticOnly;
			bong.ttl = jointEffectTime / 2f;
			bongSmokePrefab.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
			bong.m_fuelAddedEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
			{
				new EffectData
				{
					m_prefab = bongNoisePrefab,
					m_enabled = true
				},
				new EffectData
				{
					m_prefab = bongSmokePrefab,
					m_enabled = true,
					m_inheritParentScale = true,
					m_attach = true
				}
			};
			PieceManager.Instance.AddPiece(val7);
		}
	}
}