Decompiled source of Torrential Torment v1.0.7

BepInEx/plugins/Torrential_Torment.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 Peak.Afflictions;
using Photon.Pun;
using UnityEngine;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Torrential_Torment")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Torrential_Torment")]
[assembly: AssemblyTitle("Torrential_Torment")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 TorrentialTorment
{
	[HarmonyPatch(typeof(AOE), "Explode")]
	internal static class AOEPatch
	{
		internal static bool Prefix(AOE __instance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.range == 0f)
			{
				return false;
			}
			Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, __instance.range, LayerMask.op_Implicit(HelperFunctions.GetMask(__instance.mask)));
			List<Character> list = new List<Character>();
			Character val = default(Character);
			EventOnItemCollision val6 = default(EventOnItemCollision);
			for (int i = 0; i < array.Length; i++)
			{
				CharacterRagdoll.TryGetCharacterFromCollider(array[i], ref val);
				RaycastHit val2;
				Vector3 val4;
				if ((Object)(object)val != (Object)null && !list.Contains(val))
				{
					float num = Vector3.Distance(((Component)__instance).transform.position, val.Center);
					if (!(num <= __instance.range))
					{
						continue;
					}
					float factor = __instance.GetFactor(num);
					if (!(factor >= __instance.minFactor))
					{
						continue;
					}
					if (__instance.requireLineOfSigh)
					{
						val2 = HelperFunctions.LineCheck(((Component)__instance).transform.position, val.Center, (LayerType)1, 0f, (QueryTriggerInteraction)1);
						if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).transform))
						{
							continue;
						}
					}
					list.Add(val);
					Vector3 val3 = Vector3.zero;
					if (__instance.useSingleDirection)
					{
						val3 = __instance.singleDirectionForwardTF.forward;
					}
					else
					{
						val4 = val.Center - ((Component)__instance).transform.position;
						val3 = ((Vector3)(ref val4)).normalized;
					}
					if (Mathf.Abs(__instance.statusAmount) > 0f)
					{
						if (__instance.illegalStatus != "")
						{
							if (__instance.illegalStatus.ToUpperInvariant().Equals("BLIND"))
							{
								Affliction_Blind val5 = new Affliction_Blind
								{
									totalTime = __instance.statusAmount * factor
								};
								val.refs.afflictions.AddAffliction((Affliction)(object)val5, false);
							}
							else
							{
								val.AddIllegalStatus(__instance.illegalStatus, __instance.statusAmount * factor);
							}
						}
						else
						{
							val.refs.afflictions.AdjustStatus(__instance.statusType, __instance.statusAmount * factor, false);
							if (__instance.addtlStatus.Length != 0)
							{
								for (int j = 0; j < __instance.addtlStatus.Length; j++)
								{
									val.refs.afflictions.AdjustStatus(__instance.addtlStatus[j], __instance.statusAmount * factor, false);
								}
							}
						}
					}
					if (__instance.hasAffliction)
					{
						val.refs.afflictions.AddAffliction(__instance.affliction, false);
					}
					float num2 = 1f;
					if (__instance.knockback > 0f)
					{
						Plugin.ExploPowersForEach.TryGetValue(((Object)__instance).name, out ConfigEntry<float> value);
						if (value != null)
						{
							num2 = value.Value;
						}
					}
					if (Plugin.dastardlySplos.Value)
					{
						val.AddForceAtPosition(new Vector3(Random.Range(-1f, 1f), 0.5f, -1f) * ((Vector3)(ref val3)).magnitude * factor * __instance.knockback * num2, val.Center, 1f);
					}
					else if (!val.IsLocal && PhotonNetwork.IsMasterClient)
					{
						num2 -= 1f;
						val.AddForceAtPosition(val3 * factor * __instance.knockback * num2, val.Center, 1f);
					}
					else
					{
						val.AddForce(val3 * factor * __instance.knockback * num2, 0.7f, 1.3f);
					}
					if (__instance.fallTime > 0f)
					{
						val.Fall(factor * __instance.fallTime, 0f);
					}
				}
				else
				{
					if (!__instance.canLaunchItems)
					{
						continue;
					}
					Item componentInParent = ((Component)array[i]).GetComponentInParent<Item>();
					if (!((Object)(object)componentInParent != (Object)null) || !((MonoBehaviourPun)componentInParent).photonView.IsMine || (int)componentInParent.itemState != 0)
					{
						continue;
					}
					float num3 = Vector3.Distance(((Component)__instance).transform.position, componentInParent.Center());
					if (!(num3 <= __instance.range))
					{
						continue;
					}
					float factor2 = __instance.GetFactor(num3);
					if (!(factor2 >= __instance.minFactor))
					{
						continue;
					}
					if (__instance.requireLineOfSigh)
					{
						val2 = HelperFunctions.LineCheck(((Component)__instance).transform.position, componentInParent.Center(), (LayerType)1, 0f, (QueryTriggerInteraction)1);
						if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).transform))
						{
							continue;
						}
					}
					if (__instance.procCollisionEvents && ((Component)componentInParent).TryGetComponent<EventOnItemCollision>(ref val6))
					{
						val6.TriggerEvent();
					}
					if (__instance.cooksItems)
					{
						componentInParent.cooking.FinishCooking();
					}
					val4 = componentInParent.Center() - ((Component)__instance).transform.position;
					Vector3 normalized = ((Vector3)(ref val4)).normalized;
					componentInParent.rig.AddForce(normalized * factor2 * __instance.knockback * __instance.itemKnockbackMultiplier, (ForceMode)1);
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(DayNightManager), "Update")]
	internal static class DayNightPatch
	{
		internal static bool Prefix(DayNightManager __instance)
		{
			__instance.HazeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)0));
			__instance.RimFresnelDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)1));
			__instance.LavaAlphaDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)2));
			__instance.BandFogDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)3));
			__instance.SunSizeDebug = Shader.GetGlobalFloat(__instance.getShaderValue((ShaderParams)4));
			if (__instance.timeOfDay >= 5.5f && __instance.timeOfDay <= 20f)
			{
				if (Plugin.dayTimeMultiplier.Value == 0f)
				{
					Plugin.dayTimeMultiplier.Value = 1f;
				}
				__instance.timeOfDay += 1f / (__instance.dayLengthInMinutes * 60f) * Time.deltaTime * 24f / Plugin.dayTimeMultiplier.Value;
			}
			else
			{
				if (Plugin.nightTimeMultiplier.Value == 0f)
				{
					Plugin.nightTimeMultiplier.Value = 1f;
				}
				__instance.timeOfDay += 1f / (__instance.dayLengthInMinutes * 60f) * Time.deltaTime * 24f / Plugin.nightTimeMultiplier.Value;
			}
			if (Plugin.eternalNight.Value && __instance.timeOfDay < 2f)
			{
				__instance.timeOfDay = 1f;
			}
			if (__instance.timeOfDay > 24f)
			{
				__instance.timeOfDay -= 24f;
				__instance.passedMidnight = true;
			}
			if (__instance.passedMidnight && __instance.timeOfDay >= 5.5f)
			{
				__instance.dayCount++;
				__instance.passedMidnight = false;
			}
			if (PhotonNetwork.IsMasterClient)
			{
				__instance.syncTimer += Time.deltaTime;
				if (__instance.syncTimer > 5f)
				{
					__instance.photonView.RPC("RPCA_SyncTime", (RpcTarget)0, new object[1] { __instance.timeOfDay });
					__instance.syncTimer = 0f;
				}
			}
			__instance.UpdateCycle();
			return false;
		}
	}
	[HarmonyPatch(typeof(Lava), "FixedUpdate")]
	internal static class LavaPatch
	{
		public static SyncedAnimation lavaAnim;

		public static bool Prefix(Lava __instance)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)lavaAnim == (Object)null)
			{
				lavaAnim = ((Component)__instance).GetComponent<SyncedAnimation>();
			}
			if (!__instance.isKiln)
			{
				if (Plugin.lavaNeverLowers.Value)
				{
					Animator anim = lavaAnim.anim;
					AnimatorStateInfo currentAnimatorStateInfo = lavaAnim.anim.GetCurrentAnimatorStateInfo(0);
					anim.Play(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash, 0, 0.7f);
				}
				lavaAnim.anim.speed = Plugin.lavaCycleSpeedMult.Value;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SyncedAnimation), "Update")]
	internal static class SyncedAnimationPatch
	{
		internal static void Postfix(SyncedAnimation __instance)
		{
			if (PhotonNetwork.IsMasterClient && __instance.syncCounter == 0f)
			{
				__instance.syncCounter -= Plugin.lavaSyncRate.Value - 5f;
			}
		}
	}
	[HarmonyPatch(typeof(BananaPeel), "Update")]
	internal static class NanaPatch
	{
		internal static bool Prefix(BananaPeel __instance)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.unshackledNanas.Value)
			{
				__instance.counter += Time.deltaTime;
				if (__instance.counter < 1f)
				{
					return false;
				}
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if (Vector3.Distance(allCharacter.Center, ((Component)__instance).transform.position) < 1.2f)
					{
						((Component)__instance).GetComponent<PhotonView>().RPC("RPCA_TriggerBanana", (RpcTarget)0, new object[1] { allCharacter.refs.view.ViewID });
					}
				}
				__instance.counter = 0f;
			}
			return !Plugin.unshackledNanas.Value;
		}
	}
	[HarmonyPatch(typeof(BananaPeel), "RPCA_TriggerBanana")]
	internal static class SlipPatch
	{
		internal static void Postfix(BananaPeel __instance, int viewID)
		{
			//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_00a6: 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_00c5: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.nannerPow.Value != 1f && PhotonNetwork.IsMasterClient)
			{
				Character component = ((Component)PhotonView.Find(viewID)).GetComponent<Character>();
				if (Plugin.dastardlyNanas.Value)
				{
					component.AddForceAtPosition(new Vector3(Random.Range(-1f, 1f), 0.5f, -1f) * 40f * (Plugin.nannerPow.Value - 1f), component.Center, 1f);
				}
				else
				{
					component.AddForceAtPosition((component.data.lookDirection_Flat + Vector3.up) * 40f * (Plugin.nannerPow.Value - 1f), component.Center, 1f);
				}
			}
		}
	}
	[BepInPlugin("torrentialtorment", "Torrential_Torment", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigEntry<float> tornadoSpeedMult;

		internal static ConfigEntry<float> tornadoLifetimeIncrease;

		internal static ConfigEntry<float> tumbleSize;

		internal static ConfigEntry<float> tumbleRollForce;

		internal static ConfigEntry<bool> dethornPlayers;

		internal static ConfigEntry<float> dethornRate;

		internal static ConfigEntry<bool> dethornWhilePassedOut;

		internal static ConfigEntry<float> segment2WeatherLength;

		internal static ConfigEntry<float> segment3WeatherLength;

		internal static ConfigEntry<bool> eternalModeAlpine;

		internal static ConfigEntry<bool> eternalModeRoots;

		internal static ConfigEntry<bool> eternalModeTropics;

		internal static ConfigEntry<bool> a14Rain;

		internal static ConfigEntry<float> rainPow;

		internal static ConfigEntry<bool> cycleWindDirection;

		internal static ConfigEntry<bool> allowAnyWindDirection;

		internal static ConfigEntry<float> windForceMultiplier;

		internal static ConfigEntry<float> windForceMultiplierAlpine;

		internal static ConfigEntry<bool> bigGusts;

		internal static ConfigEntry<float> bigGustPowerMult;

		internal static ConfigEntry<float> bigGustChance;

		internal static ConfigEntry<float> bigGustFallTime;

		internal static ConfigEntry<float> dayTimeMultiplier;

		internal static ConfigEntry<float> nightTimeMultiplier;

		internal static ConfigEntry<bool> eternalNight;

		internal static ConfigEntry<bool> windNEVERPushesItems;

		internal static ConfigEntry<bool> homingNanas;

		internal static ConfigEntry<float> homingChance;

		internal static ConfigEntry<float> homingPower;

		internal static ConfigEntry<bool> homingDynamite;

		internal static ConfigEntry<float> lavaCycleSpeedMult;

		internal static ConfigEntry<bool> lavaNeverLowers;

		internal static ConfigEntry<float> lavaSyncRate;

		internal static ConfigEntry<float> dynamitePow;

		internal static ConfigEntry<float> sporePuffPow;

		internal static ConfigEntry<float> nannerPow;

		internal static ConfigEntry<float> geyserPow;

		internal static ConfigEntry<float> energyDrinkPow;

		internal static ConfigEntry<bool> dastardlySplos;

		internal static ConfigEntry<bool> dastardlyNanas;

		internal static ConfigEntry<bool> unshackledNanas;

		public static Dictionary<string, ConfigEntry<float>> ExploPowersForEach = new Dictionary<string, ConfigEntry<float>>();

		internal static ManualLogSource Log { get; private set; } = null;


		private void SetupPowDic()
		{
			ExploPowersForEach.Add("VFX_SporeExploExplo(Clone)", sporePuffPow);
			ExploPowersForEach.Add("VFX_DynamiteExplosion(Clone)", dynamitePow);
			ExploPowersForEach.Add("Explosion", geyserPow);
			ExploPowersForEach.Add("VFX_BalloonPopWithKnockback(Clone)", energyDrinkPow);
		}

		private void Awake()
		{
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Expected O, but got Unknown
			tornadoSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Tornados", "Speed Mult", 1f, (ConfigDescription)null);
			tornadoLifetimeIncrease = ((BaseUnityPlugin)this).Config.Bind<float>("Tornados", "Life Time Increase", 0f, (ConfigDescription)null);
			tumbleRollForce = ((BaseUnityPlugin)this).Config.Bind<float>("Tumbles", "Speed Mult", 1f, (ConfigDescription)null);
			tumbleSize = ((BaseUnityPlugin)this).Config.Bind<float>("Tumbles", "Hit Power Mult", 1f, (ConfigDescription)null);
			dethornPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Tumbles", "Auto Dethorn Players", false, (ConfigDescription)null);
			dethornWhilePassedOut = ((BaseUnityPlugin)this).Config.Bind<bool>("Tumbles", "Dethorn Only While Passed Out", false, (ConfigDescription)null);
			dethornRate = ((BaseUnityPlugin)this).Config.Bind<float>("Tumbles", "Dethorn Rate", 1f, (ConfigDescription)null);
			segment2WeatherLength = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Tropics/Roots Weather Length Multiplier", 1f, (ConfigDescription)null);
			segment3WeatherLength = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Alpine Wind Length Multiplier", 1f, (ConfigDescription)null);
			allowAnyWindDirection = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Allow Any Wind Directions", false, (ConfigDescription)null);
			windForceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Wind Force Multiplier Roots", 1f, (ConfigDescription)null);
			windForceMultiplierAlpine = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Wind Force Multiplier Alpine", 1f, (ConfigDescription)null);
			eternalModeTropics = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Infinite Tropics Rain", false, (ConfigDescription)null);
			a14Rain = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Tropics Has Wind Force That Pushes Down", false, (ConfigDescription)null);
			rainPow = ((BaseUnityPlugin)this).Config.Bind<float>("Weather", "Tropics Rain Pow", 50f, (ConfigDescription)null);
			eternalModeRoots = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Infinite Roots Wind", false, (ConfigDescription)null);
			eternalModeAlpine = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Infinite Alpine Wind", false, (ConfigDescription)null);
			windNEVERPushesItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Prevent Wind From Pushing Items", true, (ConfigDescription)null);
			bigGusts = ((BaseUnityPlugin)this).Config.Bind<bool>("Big Gusts", "Big Gusts Enabled", false, (ConfigDescription)null);
			bigGustPowerMult = ((BaseUnityPlugin)this).Config.Bind<float>("Big Gusts", "Big Gust Power Mult", 5f, (ConfigDescription)null);
			bigGustChance = ((BaseUnityPlugin)this).Config.Bind<float>("Big Gusts", "% Chance (50 rolls per second)", 0.02f, (ConfigDescription)null);
			bigGustFallTime = ((BaseUnityPlugin)this).Config.Bind<float>("Big Gusts", "Big Gust Fall Time", 2f, (ConfigDescription)null);
			dayTimeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Day Night Cycle", "Day Length Multiplier", 1f, (ConfigDescription)null);
			nightTimeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Day Night Cycle", "Night Length Multiplier", 1f, (ConfigDescription)null);
			eternalNight = ((BaseUnityPlugin)this).Config.Bind<bool>("Day Night Cycle", "Eternal Night", false, (ConfigDescription)null);
			lavaCycleSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Lava", "Lava Cycle Speed Mult", 1f, (ConfigDescription)null);
			lavaNeverLowers = ((BaseUnityPlugin)this).Config.Bind<bool>("Lava", "Lava Never Lowers", false, (ConfigDescription)null);
			lavaSyncRate = ((BaseUnityPlugin)this).Config.Bind<float>("Lava", "Lava Sync Rate (Lower equals smoother lava but potentially more server lag.)", 5f, (ConfigDescription)null);
			dynamitePow = ((BaseUnityPlugin)this).Config.Bind<float>("AOE", "Dynamite Explosion Power Mult", 1f, (ConfigDescription)null);
			sporePuffPow = ((BaseUnityPlugin)this).Config.Bind<float>("AOE", "Spore Puff Power Mult", 1f, (ConfigDescription)null);
			geyserPow = ((BaseUnityPlugin)this).Config.Bind<float>("AOE", "Geyser Power Mult", 1f, (ConfigDescription)null);
			energyDrinkPow = ((BaseUnityPlugin)this).Config.Bind<float>("AOE", "Energy Drink Explosion Power Mult", 1f, (ConfigDescription)null);
			dastardlySplos = ((BaseUnityPlugin)this).Config.Bind<bool>("AOE", "Dastardly Explosions (If on, all explosions will try to send you off the mountain)", false, (ConfigDescription)null);
			unshackledNanas = ((BaseUnityPlugin)this).Config.Bind<bool>("Bananas", "Unshackled Bananas", false, (ConfigDescription)null);
			nannerPow = ((BaseUnityPlugin)this).Config.Bind<float>("Bananas", "Banana Slip Power Mult", 1f, (ConfigDescription)null);
			dastardlyNanas = ((BaseUnityPlugin)this).Config.Bind<bool>("Bananas", "Dastardly Bananas (If on, bananas will try to send you off the mountain)", false, (ConfigDescription)null);
			SetupPowDic();
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Plugin Torrential Torment is loaded!");
			Harmony val = new Harmony("torentialtorment");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(Tornado), "Start")]
	internal static class TornadoExtraLifetime
	{
		internal static void Postfix(Tornado __instance)
		{
			__instance.lifeTime += Plugin.tornadoLifetimeIncrease.Value;
		}
	}
	[HarmonyPatch(typeof(Tornado), "Movement")]
	internal static class TornadoSpeedMultApplier
	{
		internal static bool Prefix(Tornado __instance)
		{
			//IL_003a: 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_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)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00b4: 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_00c4: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			bool result = true;
			if (Plugin.tornadoSpeedMult.Value != 1f)
			{
				result = false;
			}
			if ((Object)(object)__instance.target == (Object)null)
			{
				return false;
			}
			Vector3 vel = __instance.vel;
			Vector3 val = __instance.target.position - __instance.tornadoPos;
			__instance.vel = FRILerp.Lerp(vel, ((Vector3)(ref val)).normalized * 15f, 0.15f * Plugin.tornadoSpeedMult.Value, true);
			__instance.tornadoPos += __instance.vel * Time.deltaTime;
			RaycastHit groundPosRaycast = HelperFunctions.GetGroundPosRaycast(__instance.tornadoPos + Vector3.up * 200f, (LayerType)2, 0f);
			if (Object.op_Implicit((Object)(object)((RaycastHit)(ref groundPosRaycast)).transform) && Vector3.Distance(__instance.tornadoPos, ((RaycastHit)(ref groundPosRaycast)).point) < 100f)
			{
				((Component)__instance).transform.position = ((RaycastHit)(ref groundPosRaycast)).point;
				return false;
			}
			((Component)__instance).transform.position = __instance.tornadoPos;
			return result;
		}
	}
	[HarmonyPatch(typeof(TumbleWeed), "Start")]
	internal static class TumblePatch
	{
		internal static void Postfix(TumbleWeed __instance)
		{
			__instance.rollForce *= Plugin.tumbleRollForce.Value;
			__instance.powerMultiplier *= Plugin.tumbleSize.Value;
		}
	}
	[HarmonyPatch(typeof(TumbleWeed), "OnCollisionEnter")]
	internal static class AnotherPatchToTumbles
	{
		internal static void Prefix(TumbleWeed __instance, Collision collision)
		{
			//IL_004d: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_00fb: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			Character componentInParent = collision.gameObject.GetComponentInParent<Character>();
			if (Object.op_Implicit((Object)(object)componentInParent) && !componentInParent.IsLocal && Plugin.tumbleSize.Value != 1f)
			{
				float num = ((Component)__instance).transform.localScale.x / __instance.originalScale;
				if (__instance.originalScale == 0f)
				{
					num = 1f;
				}
				num = Mathf.Clamp01(num);
				Vector3 linearVelocity = __instance.rig.linearVelocity;
				float num2 = Mathf.Clamp01(((Vector3)(ref linearVelocity)).magnitude * num * __instance.powerMultiplier);
				if (__instance.testFullPower)
				{
					num2 = 1f;
				}
				if (!(num2 < 0.2f))
				{
					componentInParent.Fall(2f * num2, 0f);
					linearVelocity = __instance.rig.linearVelocity;
					componentInParent.AddForceAtPosition(((Vector3)(ref linearVelocity)).normalized * __instance.collisionForce * num2, ((ContactPoint)(ref collision.contacts[0])).point, 2f);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Character), "Update")]
	internal static class CharThornPatch
	{
		public static float dethornCount;

		internal static void Prefix(Character __instance)
		{
			if (!__instance.IsLocal || !PhotonNetwork.IsMasterClient)
			{
				return;
			}
			dethornCount += Time.deltaTime;
			if (!(dethornCount > Plugin.dethornRate.Value))
			{
				return;
			}
			foreach (Character allCharacter in Character.AllCharacters)
			{
				List<ThornOnMe> physicalThorns = allCharacter.refs.afflictions.physicalThorns;
				if (physicalThorns.Count > 0 && (__instance.data.passedOut || !Plugin.dethornWhilePassedOut.Value) && Plugin.dethornPlayers.Value)
				{
					Util.RandomSelection<ThornOnMe>((IEnumerable<ThornOnMe>)physicalThorns, (Func<ThornOnMe, int>)((ThornOnMe thorn) => Convert.ToInt32(thorn.stuckIn))).Interact_CastFinished(Character.localCharacter);
					dethornCount = 0f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(WindChillZone), "HandleTime")]
	internal static class AllWeatherPatch
	{
		internal static bool Prefix(WindChillZone __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between Unknown and I4
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Invalid comparison between Unknown and I4
			__instance.untilSwitch -= Time.deltaTime;
			Vector3 zero = Vector3.zero;
			if (__instance.untilSwitch < 0f && PhotonNetwork.IsMasterClient)
			{
				if ((Plugin.eternalModeTropics.Value && ((Object)__instance).name == "RainStorm") || (Plugin.eternalModeRoots.Value && ((Object)__instance).name == "WindStorm") || (Plugin.eternalModeAlpine.Value && ((Object)__instance).name == "SnowStorm"))
				{
					__instance.windActive = false;
				}
				__instance.untilSwitch = __instance.GetNextWindTime(!__instance.windActive);
				Segment currentSegment = Singleton<MapHandler>.Instance.GetCurrentSegment();
				if (!__instance.windActive)
				{
					if ((int)currentSegment == 1)
					{
						__instance.untilSwitch *= Plugin.segment2WeatherLength.Value;
					}
					else if ((int)currentSegment == 2)
					{
						__instance.untilSwitch *= Plugin.segment3WeatherLength.Value;
					}
				}
				if (Plugin.allowAnyWindDirection.Value)
				{
					__instance.view.RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3]
					{
						!__instance.windActive,
						(object)new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f)),
						__instance.untilSwitch
					});
				}
				else
				{
					__instance.view.RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3]
					{
						!__instance.windActive,
						__instance.RandomWindDirection(),
						__instance.untilSwitch
					});
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(WindChillZone), "FixedUpdate")]
	internal static class HandleForceFromHostPatch
	{
		internal static bool Prefix(WindChillZone __instance)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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)
			if ((Object)(object)Character.localCharacter == (Object)null || !PhotonNetwork.IsMasterClient)
			{
				return false;
			}
			__instance.currentForceMult = Mathf.MoveTowards(__instance.currentForceMult, (float)(__instance.windActive ? 1 : 0), Time.fixedDeltaTime);
			if (__instance.timeSpentWaiting >= __instance.delayBeforeForce)
			{
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if (((Bounds)(ref __instance.windZoneBounds)).Contains(allCharacter.Center) && __instance.windActive)
					{
						__instance.windPlayerFactor = WindChillZone.GetWindIntensityAtPoint(allCharacter.Center, __instance.lightVolumeSampleThreshold_lower, __instance.lightVolumeSampleThreshold_margin);
						__instance.AddWindForceToCharacter(allCharacter, __instance.currentForceMult);
					}
				}
				foreach (Character allBotCharacter in Character.AllBotCharacters)
				{
					if (((Bounds)(ref __instance.windZoneBounds)).Contains(allBotCharacter.Center))
					{
						__instance.AddWindForceToCharacter(allBotCharacter, 0.6f * __instance.currentForceMult);
					}
				}
			}
			if (__instance.windMovesItems && !Plugin.windNEVERPushesItems.Value)
			{
				for (int i = 0; i < Item.ALL_ACTIVE_ITEMS.Count; i++)
				{
					Item val = Item.ALL_ACTIVE_ITEMS[i];
					if (ClassExtensionsMethods.UnityObjectExists<Item>(val) && (int)val.itemState == 0 && ((Bounds)(ref __instance.windZoneBounds)).Contains(val.Center()))
					{
						__instance.AddWindForceToItem(val);
					}
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(WindChillZone), "AddWindForceToCharacter")]
	internal static class WindForcePatch
	{
		internal static bool Prefix(WindChillZone __instance, Character character, float mult = 1f)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)__instance).name == "RainStorm" && Plugin.a14Rain.Value)
			{
				Vector3 groundPos = HelperFunctions.GetGroundPos(character.Center + new Vector3(0f, 500f, 0f), (LayerType)1, 0f);
				if (groundPos.y < character.Center.y)
				{
					character.AddForceAtPosition(new Vector3(0f, 0f - Plugin.rainPow.Value, 0f), character.Center, __instance.forceRadius);
				}
				return false;
			}
			if ((!character.IsLocal && Plugin.windForceMultiplier.Value == 1f && Plugin.windForceMultiplierAlpine.Value == 1f) || __instance.windForce <= 0f || __instance.windPlayerFactor <= 0f)
			{
				return false;
			}
			if ((Object)(object)character.data.currentClimbHandle != (Object)null)
			{
				return false;
			}
			float num = (__instance.useIntensityCurve ? (Mathf.Clamp01(__instance.windIntensity - 0.5f) * 2f) : 1f);
			bool flag = false;
			Parasol val = default(Parasol);
			if (Object.op_Implicit((Object)(object)character.data.currentItem) && ((Component)character.data.currentItem).TryGetComponent<Parasol>(ref val) && val.isOpen)
			{
				num *= 10f;
				flag = true;
			}
			if (character.refs.balloons.currentBalloonCount > 0)
			{
				int num2 = 2;
				if (flag)
				{
					num2 = 0;
				}
				num *= (float)(num2 + character.refs.balloons.currentBalloonCount);
			}
			Affliction val2 = default(Affliction);
			if (character.refs.afflictions.HasAfflictionType((AfflictionType)17, ref val2))
			{
				num = 0f;
			}
			if (__instance.useRaycast && Physics.Raycast(character.Center, -__instance.currentWindDirection, ref __instance.hitInfo, __instance.maxRaycastDistance, LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)1))))
			{
				float num3 = Mathf.InverseLerp(__instance.minRaycastDistance, __instance.maxRaycastDistance, ((RaycastHit)(ref __instance.hitInfo)).distance);
				float num4 = Mathf.Clamp01(Vector3.Dot(((RaycastHit)(ref __instance.hitInfo)).normal, __instance.currentWindDirection));
				num3 += 1f - num4;
				num *= Mathf.Clamp01(num3);
			}
			num *= ((character.data.fallSeconds >= 0.01f) ? __instance.ragdolledWindForceMult : 1f);
			num *= mult;
			float num5 = 1f;
			if (!character.IsLocal)
			{
				num5 -= 1f;
			}
			if (((Object)__instance).name == "SnowStorm")
			{
				num5 += Plugin.windForceMultiplierAlpine.Value;
			}
			else if (((Object)__instance).name == "WindStorm")
			{
				num5 += Plugin.windForceMultiplier.Value;
			}
			if (Plugin.bigGusts.Value)
			{
				float num6 = Random.Range(0f, 100f);
				if (Plugin.bigGustChance.Value > num6 && character.data.fallSeconds <= 0f && __instance.windIntensity > 0.5f)
				{
					character.AddForceAtPosition(__instance.currentWindDirection * __instance.windForce * __instance.windPlayerFactor * num * Plugin.bigGustPowerMult.Value * (num5 + 1f), character.Center, __instance.forceRadius);
					character.Fall(Plugin.bigGustFallTime.Value, 0f);
				}
				else
				{
					character.AddForceAtPosition(__instance.currentWindDirection * __instance.windForce * __instance.windPlayerFactor * num * num5, character.Center, __instance.forceRadius);
				}
			}
			else
			{
				character.AddForceAtPosition(__instance.currentWindDirection * __instance.windForce * __instance.windPlayerFactor * num * num5, character.Center, __instance.forceRadius);
			}
			return false;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}