Decompiled source of ToriiWind v1.0.1

ToriiWind.dll

Decompiled a month ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ToriiWind")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ToriiWind")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("756c8548-1def-4f05-bd99-5af09d033ba1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ToriiWind;

[BepInPlugin("com.senshisaga.toriiwind", "ToriiWind", "1.0.1")]
public class ToriiWindPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		Harmony.CreateAndPatchAll(typeof(SmokePatch), (string)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"ToriiWind loaded.");
	}
}
[HarmonyPatch(typeof(Smoke), "Awake")]
public static class SmokePatch
{
	public static void Postfix(Smoke __instance)
	{
		((Component)__instance).gameObject.AddComponent<SmokeWindBehavior>();
	}
}
public class SmokeWindBehavior : MonoBehaviour
{
	private Rigidbody _rb;

	private float _groundHeight;

	private const float WindMultiplier = 2.5f;

	private void Start()
	{
		//IL_003c: 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)
		_rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)ZoneSystem.instance != (Object)null)
		{
			_groundHeight = ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position);
		}
		else
		{
			_groundHeight = ((Component)this).transform.position.y;
		}
	}

	private void FixedUpdate()
	{
		//IL_0021: 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_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)_rb == (Object)null) && !((Object)(object)EnvMan.instance == (Object)null))
		{
			Vector3 windDir = EnvMan.instance.GetWindDir();
			float windIntensity = EnvMan.instance.GetWindIntensity();
			float num = Mathf.Clamp(Mathf.Max(0f, ((Component)this).transform.position.y - _groundHeight) / 8f, 0.1f, 1.5f);
			Vector3 val = windDir * (windIntensity * num * 2.5f);
			_rb.AddForce(val * Time.fixedDeltaTime, (ForceMode)2);
		}
	}
}