Decompiled source of NatureCalls v1.0.3

plugins\NatureCalls.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("RitzPlaza")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("QoL mod with full ConfigurationManager support. Auto-sort, fast farming, infinite stamina, and more!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NatureCalls")]
[assembly: AssemblyTitle("NatureCalls")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace NatureCalls
{
	[BepInPlugin("sirdoucher.mods.naturecalls", "Nature Calls", "1.0.3")]
	[BepInProcess("valheim.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGUID = "sirdoucher.mods.naturecalls";

		public const string PluginName = "Nature Calls";

		public const string PluginVersion = "1.0.3";

		public static ManualLogSource Log;

		public static Plugin Instance;

		private Harmony _harmony;

		public static ConfigEntry<KeyboardShortcut> SortKey;

		public static ConfigEntry<KeyboardShortcut> PeeKey;

		public static ConfigEntry<bool> EnableBladderMechanic;

		public static ConfigEntry<bool> PeeToggleMode;

		public static ConfigEntry<float> BladderFillTime;

		public static ConfigEntry<bool> ShowBladderMeter;

		public static ConfigEntry<bool> PeeReliefBonus;

		public static ConfigEntry<bool> PeeAppliesWet;

		public static ConfigEntry<float> PeeDistanceMin;

		public static ConfigEntry<float> PeeDistanceMax;

		public static ConfigEntry<bool> PeeFertilizesPickables;

		public static ConfigEntry<bool> PeeFillsBeehives;

		public static ConfigEntry<bool> PeeRegrowsStumps;

		public static ConfigEntry<bool> PeeScoresBoars;

		public static ConfigEntry<bool> PeeExtinguishesFire;

		public static ConfigEntry<bool> PeeScaresGreydwarfs;

		public static ConfigEntry<bool> PeeEnragesTrolls;

		public static ConfigEntry<bool> PeeTamesWolves;

		public static ConfigEntry<bool> PeeScoresNecks;

		public static ConfigEntry<bool> PeeFreezesMountains;

		public static ConfigEntry<bool> PeeEvaporatesAshlands;

		public static ConfigEntry<bool> PeeAttractsLeeches;

		public static ConfigEntry<bool> PeeGlowsMistlands;

		public static ConfigEntry<KeyCode> LeaderboardKey;

		public static ConfigEntry<bool> EnableLeaderboard;

		public static ConfigEntry<bool> EnableAutoSort;

		public static ConfigEntry<bool> ShowSortMessage;

		public static ConfigEntry<bool> EnableInfiniteBuildStamina;

		public static ConfigEntry<bool> EnableInfiniteFarmStamina;

		public static ConfigEntry<bool> EnableNoBuildingRainDamage;

		public static ConfigEntry<bool> EnableDebugLogs;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			InitializeConfig();
			_harmony = new Harmony("sirdoucher.mods.naturecalls");
			_harmony.PatchAll();
			Log.LogInfo((object)"Nature Calls v1.0.3 loaded!");
			Log.LogInfo((object)"Press F1 (ConfigurationManager) to customize settings.");
		}

		private void InitializeConfig()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			SortKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("1. Hotkeys", "Sort Key", new KeyboardShortcut((KeyCode)114, Array.Empty<KeyCode>()), "Press while container is open to sort");
			PeeKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("1. Hotkeys", "Pee Key", new KeyboardShortcut((KeyCode)112, Array.Empty<KeyCode>()), "Press to pee (P for Pee!)");
			EnableBladderMechanic = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Enable Bladder Mechanic", true, "ARK-style bladder - pee on your friends!");
			PeeToggleMode = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Toggle Mode", true, "If ON: tap to start/stop peeing (can run while peeing). If OFF: hold to pee.");
			BladderFillTime = ((BaseUnityPlugin)this).Config.Bind<float>("2. Bladder", "Bladder Fill Time", 20f, new ConfigDescription("Minutes until forced pee", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 60f), Array.Empty<object>()));
			ShowBladderMeter = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Show Bladder Meter", true, "Show bladder meter on right side of screen");
			PeeReliefBonus = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Relief Stamina Bonus", true, "+15 stamina after peeing");
			PeeAppliesWet = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Pee Applies Wet", true, "Peeing on players makes them Wet");
			PeeDistanceMin = ((BaseUnityPlugin)this).Config.Bind<float>("2. Bladder", "Pee Distance (Min)", 5f, new ConfigDescription("Minimum pee stream distance in feet (at low bladder)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>()));
			PeeDistanceMax = ((BaseUnityPlugin)this).Config.Bind<float>("2. Bladder", "Pee Distance (Max)", 10f, new ConfigDescription("Maximum pee stream distance in feet (at full bladder)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 20f), Array.Empty<object>()));
			PeeFertilizesPickables = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Pee Fertilizes Bushes", true, "Peeing on harvested berry bushes makes them regrow instantly");
			PeeFillsBeehives = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Pee Fills Beehives", true, "Peeing on beehives fills them with honey instantly");
			PeeRegrowsStumps = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Bladder", "Pee Regrows Tree Stumps", true, "Peeing on tree stumps spawns a new tree!");
			PeeScoresBoars = ((BaseUnityPlugin)this).Config.Bind<bool>("2a. Creature Effects", "Pee Scares Boars", true, "Peeing on boars makes them drop loot (without killing them)");
			PeeExtinguishesFire = ((BaseUnityPlugin)this).Config.Bind<bool>("2a. Creature Effects", "Pee Extinguishes Fire", true, "Peeing on campfires/torches puts them out, peeing on burning players/creatures removes burning");
			PeeScaresGreydwarfs = ((BaseUnityPlugin)this).Config.Bind<bool>("2a. Creature Effects", "Pee Scares Greydwarfs", true, "Peeing on Greydwarfs makes them flee in disgust");
			PeeEnragesTrolls = ((BaseUnityPlugin)this).Config.Bind<bool>("2a. Creature Effects", "Pee Enrages Trolls", true, "Peeing on Trolls makes them go berserk!");
			PeeTamesWolves = ((BaseUnityPlugin)this).Config.Bind<bool>("2a. Creature Effects", "Pee Tames Wolves", true, "Peeing on wolves speeds up taming - marking territory = respect");
			PeeScoresNecks = ((BaseUnityPlugin)this).Config.Bind<bool>("2a. Creature Effects", "Pee Scares Necks", true, "Peeing on Necks makes them drop tails without dying");
			PeeFreezesMountains = ((BaseUnityPlugin)this).Config.Bind<bool>("2b. Biome Effects", "Pee Freezes in Mountains", true, "Peeing in the Mountains creates a yellow ice patch");
			PeeEvaporatesAshlands = ((BaseUnityPlugin)this).Config.Bind<bool>("2b. Biome Effects", "Pee Evaporates in Ashlands", true, "Peeing in the Ashlands creates a steam cloud effect");
			PeeAttractsLeeches = ((BaseUnityPlugin)this).Config.Bind<bool>("2b. Biome Effects", "Pee Attracts Leeches", true, "Peeing in the Swamp attracts leeches - danger!");
			PeeGlowsMistlands = ((BaseUnityPlugin)this).Config.Bind<bool>("2b. Biome Effects", "Pee Glows in Mistlands", true, "Peeing in the Mistlands creates bioluminescent glow");
			EnableLeaderboard = ((BaseUnityPlugin)this).Config.Bind<bool>("2c. Leaderboard", "Enable Leaderboard", true, "Track total pee amounts and show Top Pisser rankings");
			LeaderboardKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("2c. Leaderboard", "Leaderboard Key", (KeyCode)108, "Press to show/hide the Top Pisser leaderboard");
			EnableAutoSort = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Containers", "Enable Auto-Sort", true, "Enable chest sorting with hotkey");
			ShowSortMessage = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Containers", "Show Sort Message", true, "Show 'Container sorted!' message");
			EnableInfiniteBuildStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Stamina", "Infinite Building Stamina", true, "No stamina cost with hammer");
			EnableInfiniteFarmStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Stamina", "Infinite Farming Stamina", true, "No stamina cost with cultivator/hoe");
			EnableNoBuildingRainDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("5. Buildings", "Disable Rain Damage", true, "Prevent rain from damaging buildings");
			EnableDebugLogs = ((BaseUnityPlugin)this).Config.Bind<bool>("6. General", "Enable Debug Logs", false, "Show debug messages in console");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		public static bool IsServer()
		{
			return (Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer();
		}

		public static bool IsInGame()
		{
			return (Object)(object)ZNet.instance != (Object)null && (Object)(object)Player.m_localPlayer != (Object)null;
		}

		public static void LogDebug(string message)
		{
			if (EnableDebugLogs.Value)
			{
				Log.LogInfo((object)("[DEBUG] " + message));
			}
		}
	}
}
namespace NatureCalls.Patches
{
	[HarmonyPatch]
	public static class BuildingPlantPatch
	{
		[HarmonyPatch(typeof(WearNTear), "UpdateWear")]
		[HarmonyPrefix]
		public static void UpdateWear_Prefix(WearNTear __instance)
		{
			if (Plugin.EnableNoBuildingRainDamage.Value)
			{
				__instance.m_noRoofWear = false;
			}
		}
	}
	[HarmonyPatch]
	public static class ChestSortPatch
	{
		public static Container CurrentContainer;

		[HarmonyPatch(typeof(InventoryGui), "Show")]
		[HarmonyPostfix]
		public static void Show_Postfix(Container container)
		{
			CurrentContainer = container;
		}

		[HarmonyPatch(typeof(InventoryGui), "Hide")]
		[HarmonyPostfix]
		public static void Hide_Postfix()
		{
			CurrentContainer = null;
		}

		public static void SortCurrentContainer()
		{
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CurrentContainer == (Object)null)
			{
				return;
			}
			Inventory inventory = CurrentContainer.GetInventory();
			if (inventory == null)
			{
				return;
			}
			List<ItemData> allItems = inventory.GetAllItems();
			if (allItems == null || allItems.Count == 0)
			{
				return;
			}
			List<ItemData> source = (from item in allItems
				orderby Localization.instance.Localize(item.m_shared.m_name), item.m_quality descending, item.m_stack descending
				select item).ToList();
			List<ItemData> list = source.Select((ItemData item) => item.Clone()).ToList();
			int width = inventory.GetWidth();
			int height = inventory.GetHeight();
			inventory.RemoveAll();
			int num = 0;
			int num2 = 0;
			foreach (ItemData item in list)
			{
				if (num2 >= height)
				{
					break;
				}
				item.m_gridPos = new Vector2i(num, num2);
				inventory.AddItem(item);
				num++;
				if (num >= width)
				{
					num = 0;
					num2++;
				}
			}
		}
	}
	public class NatureCallsUpdater : MonoBehaviour
	{
		private static NatureCallsUpdater _instance;

		private float _bladderLevel = 0f;

		private float _bladderLevelAtStart = 0f;

		private bool _isPeeing = false;

		private bool _wasForcedPee = false;

		private GameObject _peeStream = null;

		private LineRenderer _peeRenderer = null;

		private HashSet<int> _fertilizedPickables = new HashSet<int>();

		private HashSet<int> _fertilizedBeehives = new HashSet<int>();

		private HashSet<int> _fertilizedStumps = new HashSet<int>();

		private HashSet<int> _scaredBoars = new HashSet<int>();

		private HashSet<int> _scaredNecks = new HashSet<int>();

		private HashSet<int> _scaredGreydwarfs = new HashSet<int>();

		private HashSet<int> _enragedTrolls = new HashSet<int>();

		private HashSet<int> _tamedWolves = new HashSet<int>();

		private HashSet<int> _extinguishedFires = new HashSet<int>();

		private HashSet<long> _peedOnPlayersThisSession = new HashSet<long>();

		private float _lastBiomeEffectTime = 0f;

		private float _totalPeeAmount = 0f;

		private bool _showLeaderboard = false;

		private float _leaderboardHideTime = 0f;

		private const float LEADERBOARD_DISPLAY_TIME = 5f;

		private static readonly int PeeAmountHash = StringExtensionMethods.GetStableHashCode("NatureCalls_PeeAmount");

		private bool _shownUrgentWarning = false;

		private static Dictionary<long, GameObject> _otherPlayerPeeStreams = new Dictionary<long, GameObject>();

		private static readonly int PeeingHashCode = StringExtensionMethods.GetStableHashCode("naturecalls_peeing");

		private float _lastPeeOnMeCheck = 0f;

		private float _lastOtherPlayerPeeCheck = 0f;

		private static Texture2D _meterBgTexture;

		private static Texture2D _meterFillTexture;

		private static Texture2D _meterUrgentTexture;

		private static Texture2D _borderTexture;

		private static GUIStyle _meterLabelStyle;

		private static readonly string[] StartMessages = new string[4] { "Ahhhh... sweet relief!", "*unzips*", "Nature calls!", "Marking territory..." };

		private static readonly string[] ForcedMessages = new string[3] { "You couldn't hold it any longer!", "Your bladder has betrayed you!", "The dam has broken!" };

		private static readonly string[] FertilizeMessages = new string[4] { "The bush appreciates your... contribution!", "Nature's fertilizer at work!", "Instant regrowth!", "Your golden gift brings new life!" };

		private static readonly string[] DribbleMessages = new string[4] { "*squeezes* ...just a little...", "Running on empty!", "*drip drip*", "Nothing left in the tank!" };

		private static readonly string[] VictimMessages = new string[5] { "{0} marked you as territory!", "{0} just peed on you!", "Ewww! {0} got you!", "{0} claims you as their own!", "You've been baptized by {0}!" };

		private static readonly string[] BeehiveMessages = new string[4] { "The bees appreciate your... hydration!", "Instant honey! The bees are confused but grateful.", "Golden liquid in, golden liquid out!", "Nature's honey accelerator!" };

		private static readonly string[] BoarMessages = new string[6] { "The boar is so startled it drops everything!", "Surprise! Free loot!", "The boar didn't see that coming...", "Territorial marking: successful!", "The boar leaves you a 'gift' in return!", "R. Kelly would be proud!" };

		private static readonly string[] NeckMessages = new string[4] { "The Neck drops its tail in shock!", "Surprise sushi!", "The Neck didn't see that coming...", "Free tail, no murder required!" };

		private static readonly string[] GreydwarfMessages = new string[4] { "The Greydwarf flees in disgust!", "Even monsters have standards!", "Greydwarf: 'That's just wrong, man!'", "Nature's pest repellent!" };

		private static readonly string[] TrollMessages = new string[4] { "THE TROLL IS ENRAGED!", "You've made a terrible mistake...", "Troll SMASH the pee-er!", "That troll looks REALLY angry now!" };

		private static readonly string[] WolfMessages = new string[4] { "The wolf respects your territory marking!", "Alpha move! Taming accelerated!", "The wolf seems... impressed?", "Dominance established!" };

		private static readonly string[] FireMessages = new string[4] { "Fire extinguished! Nature's firefighter!", "Psssshhh! Fire's out!", "You're a real hero... sort of.", "Emergency services: bladder edition!" };

		private static readonly string[] MountainMessages = new string[4] { "Your pee freezes instantly! Yellow ice!", "Forbidden popsicle created!", "The cold preserves your... contribution.", "Don't eat the yellow snow!" };

		private static readonly string[] AshlandMessages = new string[4] { "Your pee evaporates into steam!", "Ssssss! Too hot!", "Instant evaporation!", "The Ashlands reject your offering!" };

		private static readonly string[] SwampMessages = new string[4] { "Oh no... leeches incoming!", "Your pee attracts unwanted attention!", "The swamp hungers for your fluids!", "Bad idea in the swamp!" };

		private static readonly string[] MistlandMessages = new string[4] { "Your pee glows mysteriously!", "Bioluminescent bladder!", "The Mistlands make everything weird...", "Glowing golden stream!" };

		private static readonly string[] UrgentPeeMessages = new string[6] { "Nature is REALLY calling!", "Your bladder is about to burst!", "Find a bush... NOW!", "Emergency! Code Yellow!", "The dam is about to break!", "You're doing the pee-pee dance!" };

		private static readonly string[] StumpMessages = new string[4] { "A new tree sprouts from the stump!", "Life springs forth from your offering!", "Nature accepts your... gift!", "The forest thanks you!" };

		public static void EnsureExists()
		{
			if ((Object)(object)_instance == (Object)null && (Object)(object)Player.m_localPlayer != (Object)null)
			{
				_instance = ((Component)Player.m_localPlayer).gameObject.GetComponent<NatureCallsUpdater>();
				if ((Object)(object)_instance == (Object)null)
				{
					_instance = ((Component)Player.m_localPlayer).gameObject.AddComponent<NatureCallsUpdater>();
				}
			}
		}

		public static bool IsLocalPlayerPeeing()
		{
			return (Object)(object)_instance != (Object)null && _instance._isPeeing;
		}

		public static void AddBladder(float amount)
		{
			if ((Object)(object)_instance != (Object)null)
			{
				_instance._bladderLevel = Mathf.Clamp(_instance._bladderLevel + amount, 0f, 100f);
			}
		}

		private void Awake()
		{
			InitializeGUITextures();
		}

		private void Update()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			if (_totalPeeAmount == 0f && Plugin.EnableLeaderboard.Value)
			{
				LoadPeeAmount(Player.m_localPlayer);
			}
			HandleSortInput();
			if (Plugin.EnableLeaderboard.Value && Input.GetKeyDown(Plugin.LeaderboardKey.Value))
			{
				_showLeaderboard = !_showLeaderboard;
				if (_showLeaderboard)
				{
					_leaderboardHideTime = Time.time + 5f;
				}
			}
			if (_showLeaderboard && Time.time > _leaderboardHideTime)
			{
				_showLeaderboard = false;
			}
			if (Plugin.EnableBladderMechanic.Value)
			{
				HandleBladder();
				if (Plugin.PeeAppliesWet.Value)
				{
					CheckIfSomeoneIsPeeingOnMe();
				}
				UpdateOtherPlayersPeeVisuals();
			}
		}

		private void OnGUI()
		{
			if (!((Object)(object)Player.m_localPlayer == (Object)null))
			{
				if (Plugin.EnableBladderMechanic.Value && Plugin.ShowBladderMeter.Value)
				{
					DrawBladderMeter();
				}
				if (Plugin.EnableLeaderboard.Value && _showLeaderboard)
				{
					DrawLeaderboard();
				}
			}
		}

		private void OnDestroy()
		{
			DestroyPeeVisual();
			foreach (KeyValuePair<long, GameObject> otherPlayerPeeStream in _otherPlayerPeeStreams)
			{
				if ((Object)(object)otherPlayerPeeStream.Value != (Object)null)
				{
					Object.Destroy((Object)(object)otherPlayerPeeStream.Value);
				}
			}
			_otherPlayerPeeStreams.Clear();
			_instance = null;
		}

		private void InitializeGUITextures()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0028: 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_004a: Expected O, but got Unknown
			//IL_0065: 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_0087: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			_meterBgTexture = new Texture2D(1, 1);
			_meterBgTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.1f, 0.8f));
			_meterBgTexture.Apply();
			_meterFillTexture = new Texture2D(1, 1);
			_meterFillTexture.SetPixel(0, 0, new Color(1f, 0.85f, 0.1f, 0.9f));
			_meterFillTexture.Apply();
			_meterUrgentTexture = new Texture2D(1, 1);
			_meterUrgentTexture.SetPixel(0, 0, new Color(1f, 0.4f, 0.1f, 0.9f));
			_meterUrgentTexture.Apply();
			_borderTexture = new Texture2D(1, 1);
			_borderTexture.SetPixel(0, 0, Color.black);
			_borderTexture.Apply();
		}

		private void DrawBladderMeter()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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)
			float num = 20f;
			float num2 = 150f;
			float num3 = 30f;
			float num4 = 20f;
			float num5 = (float)Screen.width - num - num3;
			float num6 = (float)Screen.height / 2f - num2 / 2f;
			GUI.DrawTexture(new Rect(num5 - 2f, num6 - 2f, num + 4f, num2 + 4f), (Texture)(object)_meterBgTexture);
			float num7 = num2 * (_bladderLevel / 100f);
			float num8 = num6 + num2 - num7;
			Texture2D val = ((_bladderLevel > 80f) ? _meterUrgentTexture : _meterFillTexture);
			if (_bladderLevel > 80f)
			{
				float num9 = Mathf.Sin(Time.time * 5f) * 0.3f + 0.7f;
				GUI.color = new Color(1f, num9, num9, 1f);
			}
			GUI.DrawTexture(new Rect(num5, num8, num, num7), (Texture)(object)val);
			GUI.color = Color.white;
			DrawBorder(new Rect(num5 - 2f, num6 - 2f, num + 4f, num2 + 4f), 2);
			if (_meterLabelStyle == null)
			{
				_meterLabelStyle = new GUIStyle(GUI.skin.label);
				_meterLabelStyle.alignment = (TextAnchor)4;
				_meterLabelStyle.fontStyle = (FontStyle)1;
				_meterLabelStyle.normal.textColor = Color.white;
				_meterLabelStyle.fontSize = 14;
			}
			string text = (_isPeeing ? "PEE" : "BLD");
			GUI.Label(new Rect(num5 - 10f, num6 - num4 - 5f, num + 20f, num4), text, _meterLabelStyle);
			string text2 = $"{_bladderLevel:F0}%";
			GUI.Label(new Rect(num5 - 15f, num6 + num2 + 5f, num + 30f, num4), text2, _meterLabelStyle);
		}

		private void DrawBorder(Rect rect, int thickness)
		{
			//IL_0018: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, (float)thickness), (Texture)(object)_borderTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - (float)thickness, ((Rect)(ref rect)).width, (float)thickness), (Texture)(object)_borderTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, (float)thickness, ((Rect)(ref rect)).height), (Texture)(object)_borderTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - (float)thickness, ((Rect)(ref rect)).y, (float)thickness, ((Rect)(ref rect)).height), (Texture)(object)_borderTexture);
		}

		private void DrawLeaderboard()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00c2: 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_00d6: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Expected O, but got Unknown
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			float num = 250f;
			float num2 = 300f;
			float num3 = 20f;
			float num4 = num3;
			float num5 = (float)Screen.height / 2f - num2 / 2f;
			GUI.DrawTexture(new Rect(num4, num5, num, num2), (Texture)(object)_meterBgTexture);
			DrawBorder(new Rect(num4, num5, num, num2), 2);
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.alignment = (TextAnchor)4;
			val.fontStyle = (FontStyle)1;
			val.fontSize = 18;
			val.normal.textColor = new Color(1f, 0.85f, 0.1f);
			GUIStyle val2 = new GUIStyle(GUI.skin.label);
			val2.fontSize = 14;
			val2.normal.textColor = Color.white;
			GUIStyle val3 = new GUIStyle(val2);
			val3.fontStyle = (FontStyle)1;
			GUI.Label(new Rect(num4, num5 + 10f, num, 30f), "\ud83c\udfc6 LEAK OF LEGENDS \ud83c\udfc6", val);
			List<KeyValuePair<string, float>> leaderboardEntries = GetLeaderboardEntries();
			float num6 = num5 + 50f;
			float num7 = 25f;
			int num8 = 1;
			string[] array = new string[3] { "\ud83e\udd47", "\ud83e\udd48", "\ud83e\udd49" };
			foreach (KeyValuePair<string, float> item in leaderboardEntries)
			{
				if (num8 > 10)
				{
					break;
				}
				string text = ((num8 <= 3) ? array[num8 - 1] : $"{num8}.");
				string key = item.Key;
				string text2 = FormatPeeAmount(item.Value);
				if ((Object)(object)Player.m_localPlayer != (Object)null && key == Player.m_localPlayer.GetPlayerName())
				{
					GUI.color = new Color(1f, 0.85f, 0.1f);
				}
				GUI.Label(new Rect(num4 + 10f, num6, 30f, num7), text, val3);
				GUI.Label(new Rect(num4 + 45f, num6, 120f, num7), key, val2);
				GUI.Label(new Rect(num4 + 170f, num6, 70f, num7), text2, val2);
				GUI.color = Color.white;
				num6 += num7;
				num8++;
			}
			GUIStyle val4 = new GUIStyle(GUI.skin.label);
			val4.fontSize = 11;
			val4.alignment = (TextAnchor)4;
			val4.normal.textColor = new Color(0.7f, 0.7f, 0.7f);
			GUI.Label(new Rect(num4, num5 + num2 - 30f, num, 20f), $"Press {Plugin.LeaderboardKey.Value} to hide", val4);
		}

		private List<KeyValuePair<string, float>> GetLeaderboardEntries()
		{
			List<KeyValuePair<string, float>> list = new List<KeyValuePair<string, float>>();
			if ((Object)(object)Player.m_localPlayer != (Object)null)
			{
				list.Add(new KeyValuePair<string, float>(Player.m_localPlayer.GetPlayerName(), _totalPeeAmount));
			}
			foreach (Player allPlayer in Player.GetAllPlayers())
			{
				if (!((Object)(object)allPlayer == (Object)(object)Player.m_localPlayer) && !((Object)(object)allPlayer == (Object)null))
				{
					ZNetView component = ((Component)allPlayer).GetComponent<ZNetView>();
					if (!((Object)(object)component == (Object)null) && component.IsValid())
					{
						float @float = component.GetZDO().GetFloat(PeeAmountHash, 0f);
						string playerName = allPlayer.GetPlayerName();
						list.Add(new KeyValuePair<string, float>(playerName, @float));
					}
				}
			}
			list.Sort((KeyValuePair<string, float> a, KeyValuePair<string, float> b) => b.Value.CompareTo(a.Value));
			return list;
		}

		private string FormatPeeAmount(float amount)
		{
			float num = amount / 50f;
			float num2 = num / 16f;
			if (num2 >= 100f)
			{
				return $"{num2:F0} gal";
			}
			if (num2 >= 10f)
			{
				return $"{num2:F1} gal";
			}
			if (num2 >= 1f)
			{
				return $"{num2:F2} gal";
			}
			if (num >= 1f)
			{
				return $"{num:F1} cups";
			}
			return $"{num:F2} cups";
		}

		private void SavePeeAmount(Player player)
		{
			if (!((Object)(object)player == (Object)null))
			{
				ZNetView component = ((Component)player).GetComponent<ZNetView>();
				if (!((Object)(object)component == (Object)null) && component.IsValid() && Time.frameCount % 60 == 0)
				{
					component.GetZDO().Set(PeeAmountHash, _totalPeeAmount);
				}
			}
		}

		private void LoadPeeAmount(Player player)
		{
			if (!((Object)(object)player == (Object)null))
			{
				ZNetView component = ((Component)player).GetComponent<ZNetView>();
				if (!((Object)(object)component == (Object)null) && component.IsValid())
				{
					_totalPeeAmount = component.GetZDO().GetFloat(PeeAmountHash, 0f);
					Plugin.LogDebug($"Loaded pee amount: {_totalPeeAmount}");
				}
			}
		}

		private void NotifyClosestPlayerOfUrgency(Player localPlayer)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			Player val = null;
			float num = float.MaxValue;
			foreach (Player allPlayer in Player.GetAllPlayers())
			{
				if (!((Object)(object)allPlayer == (Object)null) && !((Object)(object)allPlayer == (Object)(object)localPlayer))
				{
					float num2 = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)allPlayer).transform.position);
					if (num2 < num && num2 <= 30f)
					{
						num = num2;
						val = allPlayer;
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				string playerName = localPlayer.GetPlayerName();
				Chat instance = Chat.instance;
				if (instance != null)
				{
					instance.SendText((Type)1, playerName + " has to tinkle!");
				}
				Plugin.LogDebug("Notified nearby players that " + playerName + " has to tinkle");
			}
		}

		private void HandleSortInput()
		{
			//IL_004b: 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)
			if (!Plugin.EnableAutoSort.Value || (Object)(object)ChestSortPatch.CurrentContainer == (Object)null)
			{
				return;
			}
			InventoryGui instance = InventoryGui.instance;
			if ((Object)(object)instance == (Object)null || !instance.IsContainerOpen())
			{
				return;
			}
			KeyboardShortcut value = Plugin.SortKey.Value;
			if (!((KeyboardShortcut)(ref value)).IsDown())
			{
				return;
			}
			ChestSortPatch.SortCurrentContainer();
			if (Plugin.ShowSortMessage.Value)
			{
				Player localPlayer = Player.m_localPlayer;
				if (localPlayer != null)
				{
					((Character)localPlayer).Message((MessageType)1, "Container sorted!", 0, (Sprite)null);
				}
			}
		}

		private void HandleBladder()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			float num = 100f / (Plugin.BladderFillTime.Value * 60f);
			if (((Character)localPlayer).IsRunning())
			{
				num *= 0.5f;
			}
			KeyboardShortcut value = Plugin.PeeKey.Value;
			KeyCode mainKey = ((KeyboardShortcut)(ref value)).MainKey;
			if (Plugin.PeeToggleMode.Value)
			{
				if (Input.GetKeyDown(mainKey))
				{
					if (!_isPeeing)
					{
						StartPeeing(localPlayer, forced: false);
					}
					else
					{
						StopPeeing(localPlayer);
					}
				}
			}
			else if (Input.GetKey(mainKey))
			{
				if (!_isPeeing)
				{
					StartPeeing(localPlayer, forced: false);
				}
			}
			else if (_isPeeing)
			{
				StopPeeing(localPlayer);
			}
			if (!_isPeeing)
			{
				_bladderLevel += num * Time.deltaTime;
				_bladderLevel = Mathf.Clamp(_bladderLevel, 0f, 100f);
				if (_bladderLevel >= 90f && !_shownUrgentWarning)
				{
					((Character)localPlayer).Message((MessageType)2, UrgentPeeMessages[Random.Range(0, UrgentPeeMessages.Length)], 0, (Sprite)null);
					NotifyClosestPlayerOfUrgency(localPlayer);
					_shownUrgentWarning = true;
				}
				if (_bladderLevel < 90f)
				{
					_shownUrgentWarning = false;
				}
				if (_bladderLevel >= 100f)
				{
					((Character)localPlayer).Message((MessageType)2, ForcedMessages[Random.Range(0, ForcedMessages.Length)], 0, (Sprite)null);
					StartPeeing(localPlayer, forced: true);
				}
			}
			if (_isPeeing)
			{
				UpdatePeeing(localPlayer);
			}
		}

		private void StartPeeing(Player player, bool forced)
		{
			_isPeeing = true;
			_wasForcedPee = forced;
			_bladderLevelAtStart = _bladderLevel;
			_fertilizedPickables.Clear();
			_fertilizedStumps.Clear();
			SetPeeingState(player, isPeeing: true);
			_peedOnPlayersThisSession.Clear();
			_fertilizedBeehives.Clear();
			_scaredBoars.Clear();
			_scaredNecks.Clear();
			_scaredGreydwarfs.Clear();
			_enragedTrolls.Clear();
			_tamedWolves.Clear();
			_extinguishedFires.Clear();
			if (!forced)
			{
				if (_bladderLevel <= 5f)
				{
					((Character)player).Message((MessageType)2, DribbleMessages[Random.Range(0, DribbleMessages.Length)], 0, (Sprite)null);
				}
				else
				{
					((Character)player).Message((MessageType)2, StartMessages[Random.Range(0, StartMessages.Length)], 0, (Sprite)null);
				}
			}
			CreatePeeVisual();
		}

		private void StopPeeing(Player player)
		{
			_isPeeing = false;
			_wasForcedPee = false;
			_fertilizedPickables.Clear();
			_fertilizedBeehives.Clear();
			_fertilizedStumps.Clear();
			_scaredBoars.Clear();
			_scaredNecks.Clear();
			_scaredGreydwarfs.Clear();
			_enragedTrolls.Clear();
			_tamedWolves.Clear();
			_extinguishedFires.Clear();
			_peedOnPlayersThisSession.Clear();
			SetPeeingState(player, isPeeing: false);
			DestroyPeeVisual();
			float num = _bladderLevelAtStart - _bladderLevel;
			if (Plugin.PeeReliefBonus.Value && num >= 20f)
			{
				((Character)player).AddStamina(15f);
				((Character)player).Message((MessageType)1, "Relief! +15 stamina", 0, (Sprite)null);
			}
			_bladderLevelAtStart = 0f;
		}

		private void SetPeeingState(Player player, bool isPeeing)
		{
			ZNetView component = ((Component)player).GetComponent<ZNetView>();
			if ((Object)(object)component != (Object)null && component.IsValid() && component.IsOwner())
			{
				component.GetZDO().Set(PeeingHashCode, isPeeing);
				Plugin.LogDebug($"Set peeing state to {isPeeing} in ZDO");
			}
		}

		private static bool IsPlayerPeeing(Player player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			if ((Object)(object)player == (Object)(object)Player.m_localPlayer)
			{
				NatureCallsUpdater component = ((Component)player).GetComponent<NatureCallsUpdater>();
				return (Object)(object)component != (Object)null && component._isPeeing;
			}
			ZNetView component2 = ((Component)player).GetComponent<ZNetView>();
			if ((Object)(object)component2 != (Object)null && component2.IsValid())
			{
				bool @bool = component2.GetZDO().GetBool(PeeingHashCode, false);
				if (@bool)
				{
					Plugin.LogDebug("Read peeing=true from ZDO for player " + player.GetPlayerName());
				}
				return @bool;
			}
			return false;
		}

		private void UpdateOtherPlayersPeeVisuals()
		{
			if (Time.time - _lastOtherPlayerPeeCheck < 0.1f)
			{
				return;
			}
			_lastOtherPlayerPeeCheck = Time.time;
			HashSet<long> hashSet = new HashSet<long>();
			foreach (Player allPlayer in Player.GetAllPlayers())
			{
				if ((Object)(object)allPlayer == (Object)null || (Object)(object)allPlayer == (Object)(object)Player.m_localPlayer)
				{
					continue;
				}
				ZNetView component = ((Component)allPlayer).GetComponent<ZNetView>();
				if (!((Object)(object)component == (Object)null) && component.IsValid())
				{
					long num = ((ZDOID)(ref component.GetZDO().m_uid)).ID;
					hashSet.Add(num);
					bool flag = IsPlayerPeeing(allPlayer);
					bool flag2 = _otherPlayerPeeStreams.ContainsKey(num);
					if (flag && !flag2)
					{
						CreateOtherPlayerPeeVisual(allPlayer, num);
					}
					else if (!flag && flag2)
					{
						DestroyOtherPlayerPeeVisual(num);
					}
					else if (flag && flag2)
					{
						UpdateOtherPlayerPeeVisual(allPlayer, num);
					}
				}
			}
			List<long> list = new List<long>();
			foreach (KeyValuePair<long, GameObject> otherPlayerPeeStream in _otherPlayerPeeStreams)
			{
				if (!hashSet.Contains(otherPlayerPeeStream.Key))
				{
					list.Add(otherPlayerPeeStream.Key);
				}
			}
			foreach (long item in list)
			{
				DestroyOtherPlayerPeeVisual(item);
			}
		}

		private void CreateOtherPlayerPeeVisual(Player player, long playerId)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0049: 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)
			GameObject val = new GameObject($"OtherPlayerPeeStream_{playerId}");
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			((Renderer)val2).material = new Material(Shader.Find("Sprites/Default"));
			val2.startColor = new Color(1f, 0.9f, 0.2f, 0.8f);
			val2.endColor = new Color(1f, 0.85f, 0.1f, 0.6f);
			val2.startWidth = 0.08f;
			val2.endWidth = 0.04f;
			val2.positionCount = 10;
			val2.useWorldSpace = true;
			_otherPlayerPeeStreams[playerId] = val;
			UpdateOtherPlayerPeeVisual(player, playerId);
		}

		private void UpdateOtherPlayerPeeVisual(Player player, long playerId)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			//IL_006c: 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_007b: 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_0088: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			if (!_otherPlayerPeeStreams.TryGetValue(playerId, out var value) || (Object)(object)value == (Object)null)
			{
				return;
			}
			LineRenderer component = value.GetComponent<LineRenderer>();
			if (!((Object)(object)component == (Object)null))
			{
				Vector3 val = ((Component)player).transform.position + Vector3.up * 0.8f + ((Component)player).transform.forward * 0.3f;
				Vector3 val2 = val + ((Component)player).transform.forward * 2.5f + Vector3.down * 1.5f;
				for (int i = 0; i < 10; i++)
				{
					float num = (float)i / 9f;
					Vector3 val3 = Vector3.Lerp(val, val2, num);
					float num2 = Mathf.Sin(num * (float)Math.PI) * 0.3f;
					val3.y += num2 - num * num * 1.5f;
					component.SetPosition(i, val3);
				}
			}
		}

		private void DestroyOtherPlayerPeeVisual(long playerId)
		{
			if (_otherPlayerPeeStreams.TryGetValue(playerId, out var value))
			{
				if ((Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)value);
				}
				_otherPlayerPeeStreams.Remove(playerId);
			}
		}

		private void UpdatePeeing(Player player)
		{
			if (_bladderLevel > 0f)
			{
				float num = 5f;
				float num2 = 1f;
				float num3 = Mathf.Lerp(num2, num, _bladderLevel / 100f);
				float num4 = Mathf.Max(5f, _bladderLevel / num3);
				float num5 = num4 * Time.deltaTime;
				_bladderLevel -= num5;
				_bladderLevel = Mathf.Max(0f, _bladderLevel);
				if (Plugin.EnableLeaderboard.Value)
				{
					_totalPeeAmount += num5;
					SavePeeAmount(player);
				}
				if (_bladderLevel <= 0f && _wasForcedPee)
				{
					StopPeeing(player);
					return;
				}
			}
			UpdatePeeVisual(player);
			if (Time.frameCount % 5 == 0)
			{
				if (Plugin.PeeFertilizesPickables.Value)
				{
					CheckPeePickables(player);
				}
				if (Plugin.PeeFillsBeehives.Value)
				{
					CheckPeeBeehives(player);
				}
				if (Plugin.PeeRegrowsStumps.Value)
				{
					CheckPeeStumps(player);
				}
				if (Plugin.PeeScoresBoars.Value)
				{
					CheckPeeBoars(player);
				}
				if (Plugin.PeeScoresNecks.Value)
				{
					CheckPeeNecks(player);
				}
				if (Plugin.PeeScaresGreydwarfs.Value)
				{
					CheckPeeGreydwarfs(player);
				}
				if (Plugin.PeeEnragesTrolls.Value)
				{
					CheckPeeTrolls(player);
				}
				if (Plugin.PeeTamesWolves.Value)
				{
					CheckPeeWolves(player);
				}
				if (Plugin.PeeExtinguishesFire.Value)
				{
					CheckPeeFires(player);
				}
				if (Plugin.PeeAppliesWet.Value)
				{
					CheckIfImPeeingOnSomeone(player);
				}
				CheckBiomeEffects(player);
			}
		}

		private void CheckIfImPeeingOnSomeone(Player localPlayer)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			//IL_0056: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			Vector3 val = ((Component)localPlayer).transform.position + Vector3.up * 0.8f + ((Component)localPlayer).transform.forward * 0.3f;
			Vector3 forward = ((Component)localPlayer).transform.forward;
			float num = Plugin.PeeDistanceMax.Value * 0.3f;
			foreach (Player allPlayer in Player.GetAllPlayers())
			{
				if ((Object)(object)allPlayer == (Object)null || (Object)(object)allPlayer == (Object)(object)localPlayer)
				{
					continue;
				}
				ZNetView component = ((Component)allPlayer).GetComponent<ZNetView>();
				if ((Object)(object)component == (Object)null || !component.IsValid())
				{
					continue;
				}
				long item = ((ZDOID)(ref component.GetZDO().m_uid)).ID;
				if (_peedOnPlayersThisSession.Contains(item))
				{
					continue;
				}
				Vector3 val2 = ((Component)allPlayer).transform.position - val;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				if (magnitude > num)
				{
					continue;
				}
				float num2 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized);
				if (!(num2 < 0.3f))
				{
					_peedOnPlayersThisSession.Add(item);
					string playerName = allPlayer.GetPlayerName();
					Chat instance = Chat.instance;
					if (instance != null)
					{
						instance.SendText((Type)1, "I peed on " + playerName + "!");
					}
					Plugin.LogDebug("Peed on " + playerName + "!");
				}
			}
		}

		private void CheckIfSomeoneIsPeeingOnMe()
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0112: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time - _lastPeeOnMeCheck < 0.2f)
			{
				return;
			}
			_lastPeeOnMeCheck = Time.time;
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			SEMan sEMan = ((Character)localPlayer).GetSEMan();
			if (sEMan != null && sEMan.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Wet")))
			{
				return;
			}
			foreach (Player allPlayer in Player.GetAllPlayers())
			{
				if ((Object)(object)allPlayer == (Object)null || (Object)(object)allPlayer == (Object)(object)localPlayer || !IsPlayerPeeing(allPlayer))
				{
					continue;
				}
				Plugin.LogDebug("Player " + allPlayer.GetPlayerName() + " is peeing!");
				Vector3 val = ((Component)allPlayer).transform.position + Vector3.up * 0.8f + ((Component)allPlayer).transform.forward * 0.3f;
				Vector3 forward = ((Component)allPlayer).transform.forward;
				float num = Plugin.PeeDistanceMax.Value * 0.3f;
				Vector3 val2 = ((Component)localPlayer).transform.position - val;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				Plugin.LogDebug($"Distance to me: {magnitude:F2}, peeRange: {num:F2}");
				if (magnitude > num)
				{
					continue;
				}
				float num2 = Vector3.Dot(forward, ((Vector3)(ref val2)).normalized);
				Plugin.LogDebug($"Dot product: {num2:F2}");
				if (num2 < 0.3f)
				{
					continue;
				}
				Plugin.LogDebug("GOT PEED ON by " + allPlayer.GetPlayerName() + "!");
				if (sEMan != null)
				{
					sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
					string text = string.Format(VictimMessages[Random.Range(0, VictimMessages.Length)], allPlayer.GetPlayerName());
					((Character)localPlayer).Message((MessageType)2, text, 0, (Sprite)null);
				}
				break;
			}
		}

		private float GetCurrentPeeDistance()
		{
			float value = Plugin.PeeDistanceMin.Value;
			float value2 = Plugin.PeeDistanceMax.Value;
			float num = _bladderLevel / 100f;
			float result = 1f;
			if (_bladderLevel <= 1f)
			{
				return result;
			}
			return Mathf.Lerp(value, value2, num);
		}

		private void CreatePeeVisual()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0081: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Expected O, but got Unknown
			if (!((Object)(object)_peeStream != (Object)null))
			{
				_peeStream = new GameObject("PeeStream");
				_peeRenderer = _peeStream.AddComponent<LineRenderer>();
				_peeRenderer.startWidth = 0.08f;
				_peeRenderer.endWidth = 0.03f;
				_peeRenderer.positionCount = 12;
				_peeRenderer.startColor = new Color(1f, 0.9f, 0.2f, 0.9f);
				_peeRenderer.endColor = new Color(1f, 0.8f, 0.1f, 0.6f);
				((Renderer)_peeRenderer).material = new Material(Shader.Find("Sprites/Default"));
			}
		}

		private void UpdatePeeVisual(Player player)
		{
			//IL_0060: 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_006f: 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_007f: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_peeRenderer == (Object)null)
			{
				return;
			}
			float num = Mathf.Lerp(0.3f, 1f, _bladderLevel / 100f);
			_peeRenderer.startWidth = 0.08f * num;
			_peeRenderer.endWidth = 0.03f * num;
			Vector3 val = ((Component)player).transform.position + Vector3.up * 0.8f + ((Component)player).transform.forward * 0.3f;
			float currentPeeDistance = GetCurrentPeeDistance();
			float num2 = currentPeeDistance * 0.3f;
			float num3 = num2 * 0.2f;
			for (int i = 0; i < _peeRenderer.positionCount; i++)
			{
				float num4 = (float)i / (float)(_peeRenderer.positionCount - 1);
				Vector3 val2 = val + ((Component)player).transform.forward * (num4 * num2);
				float num5 = 0.25f;
				float num6;
				if (num4 < num5)
				{
					num6 = num3 * (num4 / num5);
				}
				else
				{
					float num7 = (num4 - num5) / (1f - num5);
					num6 = num3 * (1f - num7 * num7 * 1.5f);
				}
				Vector3 val3 = val2 + Vector3.up * num6;
				_peeRenderer.SetPosition(i, val3);
			}
		}

		private void DestroyPeeVisual()
		{
			if ((Object)(object)_peeStream != (Object)null)
			{
				Object.Destroy((Object)(object)_peeStream);
				_peeStream = null;
				_peeRenderer = null;
			}
		}

		private Vector3 GetPeeEndPosition(Player player)
		{
			//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_0026: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_004f: 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_005a: 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_0069: 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_0073: 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)
			Vector3 val = ((Component)player).transform.position + Vector3.up * 0.8f + ((Component)player).transform.forward * 0.3f;
			float num = GetCurrentPeeDistance() * 0.3f;
			return val + ((Component)player).transform.forward * num + Vector3.down * 0.5f;
		}

		private void CheckPeePickables(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Pickable componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Pickable>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_fertilizedPickables.Contains(instanceID))
					{
						TryFertilizePickable(componentInParent, source);
						_fertilizedPickables.Add(instanceID);
					}
				}
			}
		}

		private void TryFertilizePickable(Pickable pickable, Player source)
		{
			if ((Object)(object)pickable == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)pickable).GetComponent<ZNetView>();
			if (!((Object)(object)component == (Object)null) && component.IsValid() && component.GetZDO().GetBool(ZDOVars.s_picked, false))
			{
				if (!component.IsOwner())
				{
					component.ClaimOwnership();
				}
				component.GetZDO().Set(ZDOVars.s_picked, false);
				component.GetZDO().Set(ZDOVars.s_pickedTime, 0L);
				pickable.SetPicked(false);
				((Character)source).Message((MessageType)2, FertilizeMessages[Random.Range(0, FertilizeMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug("Fertilized pickable: " + ((Object)pickable).name);
			}
		}

		private void CheckPeeBeehives(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Beehive componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Beehive>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_fertilizedBeehives.Contains(instanceID))
					{
						TryFillBeehive(componentInParent, source);
						_fertilizedBeehives.Add(instanceID);
					}
				}
			}
		}

		private void TryFillBeehive(Beehive beehive, Player source)
		{
			if ((Object)(object)beehive == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)beehive).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null || !component.IsValid())
			{
				return;
			}
			int @int = component.GetZDO().GetInt(ZDOVars.s_level, 0);
			int maxHoney = beehive.m_maxHoney;
			if (@int < maxHoney)
			{
				if (!component.IsOwner())
				{
					component.ClaimOwnership();
				}
				component.GetZDO().Set(ZDOVars.s_level, maxHoney, false);
				((Character)source).Message((MessageType)2, BeehiveMessages[Random.Range(0, BeehiveMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug($"Filled beehive: {((Object)beehive).name} to {maxHoney} honey");
			}
		}

		private void CheckPeeBoars(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Character componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent != (Object)null) || componentInParent.IsPlayer())
				{
					continue;
				}
				string text = ((Object)componentInParent).name.ToLower();
				if (text.Contains("boar"))
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_scaredBoars.Contains(instanceID))
					{
						TryScareBoar(componentInParent, source);
						_scaredBoars.Add(instanceID);
					}
				}
			}
		}

		private void TryScareBoar(Character boar, Player source)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)boar == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)boar).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null || !component.IsValid())
			{
				return;
			}
			CharacterDrop component2 = ((Component)boar).GetComponent<CharacterDrop>();
			if ((Object)(object)component2 == (Object)null)
			{
				return;
			}
			if (!component.IsOwner())
			{
				component.ClaimOwnership();
			}
			SEMan sEMan = boar.GetSEMan();
			if (sEMan != null)
			{
				sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
			}
			Vector3 val = ((Component)boar).transform.position + Vector3.up * 0.5f;
			List<KeyValuePair<GameObject, int>> list = component2.GenerateDropList();
			Vector3 val2 = default(Vector3);
			foreach (KeyValuePair<GameObject, int> item in list)
			{
				if ((Object)(object)item.Key != (Object)null)
				{
					for (int i = 0; i < item.Value; i++)
					{
						((Vector3)(ref val2))..ctor(Random.Range(-0.5f, 0.5f), Random.Range(0.2f, 0.5f), Random.Range(-0.5f, 0.5f));
						Object.Instantiate<GameObject>(item.Key, val + val2, Quaternion.identity);
					}
				}
			}
			((Character)source).Message((MessageType)2, BoarMessages[Random.Range(0, BoarMessages.Length)], 0, (Sprite)null);
			Plugin.LogDebug("Scared boar: " + ((Object)boar).name + " - dropped loot!");
		}

		private void CheckPeeNecks(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Character componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent != (Object)null) || componentInParent.IsPlayer())
				{
					continue;
				}
				string text = ((Object)componentInParent).name.ToLower();
				if (text.Contains("neck"))
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_scaredNecks.Contains(instanceID))
					{
						TryScareNeck(componentInParent, source);
						_scaredNecks.Add(instanceID);
					}
				}
			}
		}

		private void TryScareNeck(Character neck, Player source)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)neck == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)neck).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null || !component.IsValid())
			{
				return;
			}
			CharacterDrop component2 = ((Component)neck).GetComponent<CharacterDrop>();
			if ((Object)(object)component2 == (Object)null)
			{
				return;
			}
			if (!component.IsOwner())
			{
				component.ClaimOwnership();
			}
			SEMan sEMan = neck.GetSEMan();
			if (sEMan != null)
			{
				sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
			}
			Vector3 val = ((Component)neck).transform.position + Vector3.up * 0.5f;
			List<KeyValuePair<GameObject, int>> list = component2.GenerateDropList();
			Vector3 val2 = default(Vector3);
			foreach (KeyValuePair<GameObject, int> item in list)
			{
				if ((Object)(object)item.Key != (Object)null)
				{
					for (int i = 0; i < item.Value; i++)
					{
						((Vector3)(ref val2))..ctor(Random.Range(-0.5f, 0.5f), Random.Range(0.2f, 0.5f), Random.Range(-0.5f, 0.5f));
						Object.Instantiate<GameObject>(item.Key, val + val2, Quaternion.identity);
					}
				}
			}
			((Character)source).Message((MessageType)2, NeckMessages[Random.Range(0, NeckMessages.Length)], 0, (Sprite)null);
			Plugin.LogDebug("Scared neck: " + ((Object)neck).name + " - dropped loot!");
		}

		private void CheckPeeGreydwarfs(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Character componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent != (Object)null) || componentInParent.IsPlayer())
				{
					continue;
				}
				string text = ((Object)componentInParent).name.ToLower();
				if (text.Contains("greydwarf") && !text.Contains("brute") && !text.Contains("shaman"))
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_scaredGreydwarfs.Contains(instanceID))
					{
						TryScareGreydwarf(componentInParent, source);
						_scaredGreydwarfs.Add(instanceID);
					}
				}
			}
		}

		private void TryScareGreydwarf(Character greydwarf, Player source)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)greydwarf == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)greydwarf).GetComponent<ZNetView>();
			if (!((Object)(object)component == (Object)null) && component.IsValid())
			{
				if (!component.IsOwner())
				{
					component.ClaimOwnership();
				}
				SEMan sEMan = greydwarf.GetSEMan();
				if (sEMan != null)
				{
					sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
				}
				BaseAI component2 = ((Component)greydwarf).GetComponent<BaseAI>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.Alert();
					greydwarf.Stagger(((Component)source).transform.position - ((Component)greydwarf).transform.position);
				}
				((Character)source).Message((MessageType)2, GreydwarfMessages[Random.Range(0, GreydwarfMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug("Scared greydwarf: " + ((Object)greydwarf).name);
			}
		}

		private void CheckPeeTrolls(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Character componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent != (Object)null) || componentInParent.IsPlayer())
				{
					continue;
				}
				string text = ((Object)componentInParent).name.ToLower();
				if (text.Contains("troll"))
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_enragedTrolls.Contains(instanceID))
					{
						TryEnrageTroll(componentInParent, source);
						_enragedTrolls.Add(instanceID);
					}
				}
			}
		}

		private void TryEnrageTroll(Character troll, Player source)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00d8: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)troll == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)troll).GetComponent<ZNetView>();
			if (!((Object)(object)component == (Object)null) && component.IsValid())
			{
				if (!component.IsOwner())
				{
					component.ClaimOwnership();
				}
				SEMan sEMan = troll.GetSEMan();
				if (sEMan != null)
				{
					sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
				}
				BaseAI component2 = ((Component)troll).GetComponent<BaseAI>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.Alert();
				}
				HitData val = new HitData();
				val.m_damage.m_damage = 1f;
				val.m_attacker = ((Character)source).GetZDOID();
				Vector3 val2 = ((Component)troll).transform.position - ((Component)source).transform.position;
				val.m_dir = ((Vector3)(ref val2)).normalized;
				val.m_point = ((Component)troll).transform.position;
				troll.Damage(val);
				((Character)source).Message((MessageType)2, TrollMessages[Random.Range(0, TrollMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug("Enraged troll: " + ((Object)troll).name);
			}
		}

		private void CheckPeeWolves(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Character componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent != (Object)null) || componentInParent.IsPlayer())
				{
					continue;
				}
				string text = ((Object)componentInParent).name.ToLower();
				if (text.Contains("wolf"))
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_tamedWolves.Contains(instanceID))
					{
						TryTameWolf(componentInParent, source);
						_tamedWolves.Add(instanceID);
					}
				}
			}
		}

		private void TryTameWolf(Character wolf, Player source)
		{
			if ((Object)(object)wolf == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)wolf).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null || !component.IsValid())
			{
				return;
			}
			Tameable component2 = ((Component)wolf).GetComponent<Tameable>();
			if (!((Object)(object)component2 == (Object)null))
			{
				if (!component.IsOwner())
				{
					component.ClaimOwnership();
				}
				SEMan sEMan = wolf.GetSEMan();
				if (sEMan != null)
				{
					sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
				}
				float @float = component.GetZDO().GetFloat(ZDOVars.s_tameTimeLeft, 0f);
				float tamingTime = component2.m_tamingTime;
				float num = tamingTime * 0.2f;
				component.GetZDO().Set(ZDOVars.s_tameTimeLeft, Mathf.Max(0f, @float - num));
				((Character)source).Message((MessageType)2, WolfMessages[Random.Range(0, WolfMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug("Taming wolf: " + ((Object)wolf).name + " - boosted taming!");
			}
		}

		private void CheckPeeFires(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Fireplace componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Fireplace>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_extinguishedFires.Contains(instanceID))
					{
						TryExtinguishFire(componentInParent, source);
						_extinguishedFires.Add(instanceID);
					}
				}
				Character componentInParent2 = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>();
				if (!((Object)(object)componentInParent2 != (Object)null))
				{
					continue;
				}
				SEMan sEMan = componentInParent2.GetSEMan();
				if (sEMan != null && sEMan.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("Burning")))
				{
					sEMan.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Burning"), false);
					sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("Wet"), false, 0, 0f);
					if (componentInParent2.IsPlayer())
					{
						((Character)source).Message((MessageType)2, "Fire extinguished! You're welcome!", 0, (Sprite)null);
					}
					Plugin.LogDebug("Extinguished burning on: " + ((Object)componentInParent2).name);
				}
			}
		}

		private void TryExtinguishFire(Fireplace fireplace, Player source)
		{
			if ((Object)(object)fireplace == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)fireplace).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null || !component.IsValid())
			{
				return;
			}
			float @float = component.GetZDO().GetFloat(ZDOVars.s_fuel, 0f);
			if (!(@float <= 0f))
			{
				if (!component.IsOwner())
				{
					component.ClaimOwnership();
				}
				component.GetZDO().Set(ZDOVars.s_fuel, 0f);
				((Character)source).Message((MessageType)2, FireMessages[Random.Range(0, FireMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug("Extinguished fire: " + ((Object)fireplace).name);
			}
		}

		private void CheckBiomeEffects(Player source)
		{
			//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_0025: Unknown result type (might be due to invalid IL or missing references)
			//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_002e: 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_0031: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Invalid comparison between Unknown and I4
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Invalid comparison between Unknown and I4
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time - _lastBiomeEffectTime < 2f)
			{
				return;
			}
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Biome val = Heightmap.FindBiome(peeEndPosition);
			bool flag = false;
			Biome val2 = val;
			Biome val3 = val2;
			if ((int)val3 <= 4)
			{
				if ((int)val3 != 2)
				{
					if ((int)val3 == 4 && Plugin.PeeFreezesMountains.Value)
					{
						CreateFrozenPeePatch(source, peeEndPosition);
						flag = true;
					}
				}
				else if (Plugin.PeeAttractsLeeches.Value)
				{
					AttractLeeches(source, peeEndPosition);
					flag = true;
				}
			}
			else if ((int)val3 != 32)
			{
				if ((int)val3 == 512 && Plugin.PeeGlowsMistlands.Value)
				{
					CreateGlowEffect(source);
					flag = true;
				}
			}
			else if (Plugin.PeeEvaporatesAshlands.Value)
			{
				CreateSteamEffect(source, peeEndPosition);
				flag = true;
			}
			if (flag)
			{
				_lastBiomeEffectTime = Time.time;
			}
		}

		private void CreateFrozenPeePatch(Player source, Vector3 position)
		{
			//IL_001e: 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)
			GameObject prefab = ZNetScene.instance.GetPrefab("vfx_Place_stone_floor");
			if ((Object)(object)prefab != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity);
				Object.Destroy((Object)(object)val, 5f);
			}
			((Character)source).Message((MessageType)2, MountainMessages[Random.Range(0, MountainMessages.Length)], 0, (Sprite)null);
			Plugin.LogDebug("Created frozen pee patch in Mountains");
		}

		private void CreateSteamEffect(Player source, Vector3 position)
		{
			//IL_001e: 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)
			GameObject prefab = ZNetScene.instance.GetPrefab("vfx_FireAddFuel");
			if ((Object)(object)prefab != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity);
				Object.Destroy((Object)(object)val, 3f);
			}
			((Character)source).Message((MessageType)2, AshlandMessages[Random.Range(0, AshlandMessages.Length)], 0, (Sprite)null);
			Plugin.LogDebug("Pee evaporated in Ashlands");
		}

		private void AttractLeeches(Player source, Vector3 position)
		{
			//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)
			List<Character> allCharacters = Character.GetAllCharacters();
			int num = 0;
			foreach (Character item in allCharacters)
			{
				if ((Object)(object)item == (Object)null || item.IsPlayer())
				{
					continue;
				}
				string text = ((Object)item).name.ToLower();
				if (!text.Contains("leech"))
				{
					continue;
				}
				float num2 = Vector3.Distance(((Component)item).transform.position, position);
				if (!(num2 > 30f))
				{
					BaseAI component = ((Component)item).GetComponent<BaseAI>();
					if ((Object)(object)component != (Object)null)
					{
						component.Alert();
						num++;
					}
				}
			}
			if (num > 0)
			{
				((Character)source).Message((MessageType)2, SwampMessages[Random.Range(0, SwampMessages.Length)], 0, (Sprite)null);
				Plugin.LogDebug($"Attracted {num} leeches in Swamp!");
			}
		}

		private void CreateGlowEffect(Player source)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0033: 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_0042: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_peeRenderer != (Object)null)
			{
				Gradient val = new Gradient();
				val.SetKeys((GradientColorKey[])(object)new GradientColorKey[3]
				{
					new GradientColorKey(new Color(0.5f, 1f, 0.5f), 0f),
					new GradientColorKey(new Color(0f, 1f, 0.8f), 0.5f),
					new GradientColorKey(new Color(0.2f, 0.8f, 1f), 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[3]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(1f, 0.7f),
					new GradientAlphaKey(0.5f, 1f)
				});
				_peeRenderer.colorGradient = val;
			}
			((Character)source).Message((MessageType)2, MistlandMessages[Random.Range(0, MistlandMessages.Length)], 0, (Sprite)null);
			Plugin.LogDebug("Pee glowing in Mistlands");
		}

		private void CheckPeeStumps(Player source)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)source).transform.position + Vector3.up * 0.8f;
			Vector3 peeEndPosition = GetPeeEndPosition(source);
			Vector3 val2 = peeEndPosition - val;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			float num = Vector3.Distance(val, peeEndPosition);
			RaycastHit[] array = Physics.SphereCastAll(val, 0.5f, normalized, num);
			RaycastHit[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				RaycastHit val3 = array2[i];
				Destructible componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Destructible>();
				if (!((Object)(object)componentInParent != (Object)null))
				{
					continue;
				}
				string text = ((Object)componentInParent).name.ToLower();
				if (text.Contains("stub") || text.Contains("stump"))
				{
					int instanceID = ((Object)componentInParent).GetInstanceID();
					if (!_fertilizedStumps.Contains(instanceID))
					{
						TryRegrowStump(componentInParent, source);
						_fertilizedStumps.Add(instanceID);
					}
				}
			}
		}

		private void TryRegrowStump(Destructible stump, Player source)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)stump == (Object)null)
			{
				return;
			}
			ZNetView component = ((Component)stump).GetComponent<ZNetView>();
			if ((Object)(object)component == (Object)null || !component.IsValid())
			{
				return;
			}
			Vector3 position = ((Component)stump).transform.position;
			Quaternion val = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			string stumpName = ((Object)stump).name.ToLower();
			string saplingForStump = GetSaplingForStump(stumpName);
			if (string.IsNullOrEmpty(saplingForStump))
			{
				Plugin.LogDebug("No sapling found for stump: " + ((Object)stump).name);
				return;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(saplingForStump);
			if ((Object)(object)prefab == (Object)null)
			{
				Plugin.LogDebug("Sapling prefab not found: " + saplingForStump);
				return;
			}
			if (!component.IsOwner())
			{
				component.ClaimOwnership();
			}
			Object.Instantiate<GameObject>(prefab, position, val);
			component.Destroy();
			((Character)source).Message((MessageType)2, StumpMessages[Random.Range(0, StumpMessages.Length)], 0, (Sprite)null);
			Plugin.LogDebug("Regrew stump " + ((Object)stump).name + " with " + saplingForStump);
		}

		private string GetSaplingForStump(string stumpName)
		{
			if (stumpName.Contains("beech"))
			{
				return "Beech_Sapling";
			}
			if (stumpName.Contains("birch"))
			{
				return "Birch_Sapling";
			}
			if (stumpName.Contains("