using System;
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
{
[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<float> segment2WeatherLength;
internal static ConfigEntry<float> segment3WeatherLength;
internal static ConfigEntry<bool> eternalMode;
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 ManualLogSource Log { get; private set; }
private void Awake()
{
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: 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);
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 Direction", 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);
eternalMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Weather", "Eternal Storm Mode", false, (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);
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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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_00a4: 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_00af: 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_00c9: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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)
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 = Vector3Extensions.Flat(__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(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_0067: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Invalid comparison between Unknown and I4
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Invalid comparison between Unknown and I4
__instance.untilSwitch -= Time.deltaTime;
Vector3 zero = Vector3.zero;
if (__instance.untilSwitch < 0f && PhotonNetwork.IsMasterClient)
{
if (Plugin.eternalMode.Value)
{
__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_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: 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)
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.AddWindForceToCharacter(Character.localCharacter, __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)
{
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_0133: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: 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_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
if (!character.IsLocal && Plugin.windForceMultiplier.Value == 1f && Plugin.windForceMultiplierAlpine.Value == 1f)
{
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)
{
character.AddForceAtPosition(__instance.currentWindDirection * __instance.windForce * __instance.windPlayerFactor * num * Plugin.bigGustPowerMult.Value, 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)
{
}
}
}