Decompiled source of ravenimpactfx v1.3.8

personplus.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Attributes;
using BepInEx;
using BepInEx.Configuration;
using Enum;
using HarmonyLib;
using Lua.Wrapper;
using Pathfinding;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Rendering;
using UnityStandardAssets.Characters.FirstPerson;

[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.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("personplus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("personplus")]
[assembly: AssemblyTitle("personplus")]
[assembly: AssemblyVersion("1.0.0.0")]
public class Benchmark : MonoBehaviour
{
	public struct BenchmarkData
	{
		public readonly float Ms;

		public readonly float Fps;

		public float Time;

		public BenchmarkData(float ms, float fps, float timeSinceStart)
		{
			Ms = ms;
			Fps = fps;
			Time = timeSinceStart;
		}
	}

	public struct CSVData
	{
		public FrameData FrameData;

		public BenchmarkData BenchmarkData;

		public CSVData(FrameData frameData, BenchmarkData benchmarkData)
		{
			FrameData = frameData;
			BenchmarkData = benchmarkData;
		}
	}

	public struct FrameData
	{
		public readonly double fogDensityShaderTime;

		public readonly double applyBlurTime;

		public readonly double applySceneTime;

		public readonly double totalFrameTime;

		public FrameData(double fogDensityShaderTime, double applyBlurTime, double applySceneTime, double totalFrameTime)
		{
			this.fogDensityShaderTime = fogDensityShaderTime;
			this.applyBlurTime = applyBlurTime;
			this.applySceneTime = applySceneTime;
			this.totalFrameTime = totalFrameTime;
		}
	}

	public bool benchmarkModeEnabled;

	public Dictionary<float, List<CSVData>> Data;

	private FrameData _currentFrameData;

	private Animator _animator;

	public float TimeSpent;

	private void Awake()
	{
		Data = new Dictionary<float, List<CSVData>>();
		_animator = ((Component)this).GetComponent<Animator>();
		((MonoBehaviour)this).StartCoroutine(benchmarkModeEnabled ? RunBenchmarks() : DisplayFps());
	}

	private IEnumerator DisplayFps()
	{
		while (true)
		{
			TimeSpent += (Time.unscaledDeltaTime - TimeSpent) * 0.1f;
			_ = 1000f * TimeSpent;
			_ = 1f / TimeSpent;
			yield return null;
		}
	}

	private IEnumerator RunBenchmarks()
	{
		Screen.SetResolution(1920, 1080, true);
		yield return ((MonoBehaviour)this).StartCoroutine(StartBench("1080p"));
		Screen.SetResolution(1280, 720, true);
		yield return ((MonoBehaviour)this).StartCoroutine(StartBench("720p"));
		Screen.SetResolution(640, 480, true);
		yield return ((MonoBehaviour)this).StartCoroutine(StartBench("480p"));
		Application.Quit();
	}

	private IEnumerator StartBench(string runName, bool writeToCsv = true)
	{
		TimeSpent = 0f;
		Data = new Dictionary<float, List<CSVData>>();
		float timer = 0f;
		while (true)
		{
			float num;
			timer = (num = timer + Time.deltaTime);
			if (!(num < 4f))
			{
				break;
			}
			TimeSpent += (Time.unscaledDeltaTime - TimeSpent) * 0.1f;
			yield return (object)new WaitForSeconds(Time.deltaTime);
		}
		float time = Time.time;
		_animator.SetTrigger("StartBench");
		yield return (object)new WaitUntil((Func<bool>)delegate
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo2 = _animator.GetCurrentAnimatorStateInfo(0);
			return ((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).IsName("Benchmark");
		});
		yield return (object)new WaitUntil((Func<bool>)delegate
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			TimeSpent += (Time.unscaledDeltaTime - TimeSpent) * 0.1f;
			float ms = 1000f * TimeSpent;
			float fps = 1f / TimeSpent;
			float num2 = Mathf.Round(Time.time - time);
			Data.TryGetValue(num2, out var value);
			if (value == null)
			{
				Data[num2] = new List<CSVData>();
			}
			BenchmarkData benchmarkData = new BenchmarkData(ms, fps, num2);
			FrameData currentFrameData = _currentFrameData;
			Data[num2].Add(new CSVData(currentFrameData, benchmarkData));
			AnimatorStateInfo currentAnimatorStateInfo = _animator.GetCurrentAnimatorStateInfo(0);
			return !((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("Benchmark");
		});
		if (writeToCsv)
		{
			WriteToCsv(runName);
		}
	}

	private void WriteToCsv(string runName)
	{
		string path = Application.persistentDataPath + "/volumetricfog_" + runName + "_" + DateTime.Now.ToFileTimeUtc() + ".csv";
		if (!File.Exists(path))
		{
			File.WriteAllText(path, "Time since start(s).FPS.MS" + Environment.NewLine);
		}
		foreach (KeyValuePair<float, List<CSVData>> datum in Data)
		{
			string text = datum.Value.Average((CSVData val) => val.BenchmarkData.Fps).ToString(CultureInfo.InvariantCulture);
			string text2 = datum.Value.Average((CSVData val) => val.BenchmarkData.Ms).ToString(CultureInfo.InvariantCulture);
			string text3 = datum.Key.ToString(CultureInfo.InvariantCulture);
			File.AppendAllText(path, text3 + "." + text + "." + text2 + Environment.NewLine);
		}
	}
}
public static class EasingFunction
{
	public enum Ease
	{
		EaseInQuad,
		EaseOutQuad,
		EaseInOutQuad,
		EaseInCubic,
		EaseOutCubic,
		EaseInOutCubic,
		EaseInQuart,
		EaseOutQuart,
		EaseInOutQuart,
		EaseInQuint,
		EaseOutQuint,
		EaseInOutQuint,
		EaseInSine,
		EaseOutSine,
		EaseInOutSine,
		EaseInExpo,
		EaseOutExpo,
		EaseInOutExpo,
		EaseInCirc,
		EaseOutCirc,
		EaseInOutCirc,
		Linear,
		Spring,
		EaseInBounce,
		EaseOutBounce,
		EaseInOutBounce,
		EaseInBack,
		EaseOutBack,
		EaseInOutBack,
		EaseInElastic,
		EaseOutElastic,
		EaseInOutElastic
	}

	public delegate float Function(float s, float e, float v);

	private const float NATURAL_LOG_OF_2 = 0.6931472f;

	public static float Linear(float start, float end, float value)
	{
		return Mathf.Lerp(start, end, value);
	}

	public static float Spring(float start, float end, float value)
	{
		value = Mathf.Clamp01(value);
		value = (Mathf.Sin(value * (float)Math.PI * (0.2f + 2.5f * value * value * value)) * Mathf.Pow(1f - value, 2.2f) + value) * (1f + 1.2f * (1f - value));
		return start + (end - start) * value;
	}

	public static float EaseInQuad(float start, float end, float value)
	{
		end -= start;
		return end * value * value + start;
	}

	public static float EaseOutQuad(float start, float end, float value)
	{
		end -= start;
		return (0f - end) * value * (value - 2f) + start;
	}

	public static float EaseInOutQuad(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * 0.5f * value * value + start;
		}
		value -= 1f;
		return (0f - end) * 0.5f * (value * (value - 2f) - 1f) + start;
	}

	public static float EaseInCubic(float start, float end, float value)
	{
		end -= start;
		return end * value * value * value + start;
	}

	public static float EaseOutCubic(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return end * (value * value * value + 1f) + start;
	}

	public static float EaseInOutCubic(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * 0.5f * value * value * value + start;
		}
		value -= 2f;
		return end * 0.5f * (value * value * value + 2f) + start;
	}

	public static float EaseInQuart(float start, float end, float value)
	{
		end -= start;
		return end * value * value * value * value + start;
	}

	public static float EaseOutQuart(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return (0f - end) * (value * value * value * value - 1f) + start;
	}

	public static float EaseInOutQuart(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * 0.5f * value * value * value * value + start;
		}
		value -= 2f;
		return (0f - end) * 0.5f * (value * value * value * value - 2f) + start;
	}

	public static float EaseInQuint(float start, float end, float value)
	{
		end -= start;
		return end * value * value * value * value * value + start;
	}

	public static float EaseOutQuint(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return end * (value * value * value * value * value + 1f) + start;
	}

	public static float EaseInOutQuint(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * 0.5f * value * value * value * value * value + start;
		}
		value -= 2f;
		return end * 0.5f * (value * value * value * value * value + 2f) + start;
	}

	public static float EaseInSine(float start, float end, float value)
	{
		end -= start;
		return (0f - end) * Mathf.Cos(value * ((float)Math.PI / 2f)) + end + start;
	}

	public static float EaseOutSine(float start, float end, float value)
	{
		end -= start;
		return end * Mathf.Sin(value * ((float)Math.PI / 2f)) + start;
	}

	public static float EaseInOutSine(float start, float end, float value)
	{
		end -= start;
		return (0f - end) * 0.5f * (Mathf.Cos((float)Math.PI * value) - 1f) + start;
	}

	public static float EaseInExpo(float start, float end, float value)
	{
		end -= start;
		return end * Mathf.Pow(2f, 10f * (value - 1f)) + start;
	}

	public static float EaseOutExpo(float start, float end, float value)
	{
		end -= start;
		return end * (0f - Mathf.Pow(2f, -10f * value) + 1f) + start;
	}

	public static float EaseInOutExpo(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * 0.5f * Mathf.Pow(2f, 10f * (value - 1f)) + start;
		}
		value -= 1f;
		return end * 0.5f * (0f - Mathf.Pow(2f, -10f * value) + 2f) + start;
	}

	public static float EaseInCirc(float start, float end, float value)
	{
		end -= start;
		return (0f - end) * (Mathf.Sqrt(1f - value * value) - 1f) + start;
	}

	public static float EaseOutCirc(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return end * Mathf.Sqrt(1f - value * value) + start;
	}

	public static float EaseInOutCirc(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return (0f - end) * 0.5f * (Mathf.Sqrt(1f - value * value) - 1f) + start;
		}
		value -= 2f;
		return end * 0.5f * (Mathf.Sqrt(1f - value * value) + 1f) + start;
	}

	public static float EaseInBounce(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		return end - EaseOutBounce(0f, end, num - value) + start;
	}

	public static float EaseOutBounce(float start, float end, float value)
	{
		value /= 1f;
		end -= start;
		if (value < 0.36363637f)
		{
			return end * (7.5625f * value * value) + start;
		}
		if (value < 0.72727275f)
		{
			value -= 0.54545456f;
			return end * (7.5625f * value * value + 0.75f) + start;
		}
		if ((double)value < 0.9090909090909091)
		{
			value -= 0.8181818f;
			return end * (7.5625f * value * value + 0.9375f) + start;
		}
		value -= 21f / 22f;
		return end * (7.5625f * value * value + 63f / 64f) + start;
	}

	public static float EaseInOutBounce(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		if (value < num * 0.5f)
		{
			return EaseInBounce(0f, end, value * 2f) * 0.5f + start;
		}
		return EaseOutBounce(0f, end, value * 2f - num) * 0.5f + end * 0.5f + start;
	}

	public static float EaseInBack(float start, float end, float value)
	{
		end -= start;
		value /= 1f;
		float num = 1.70158f;
		return end * value * value * ((num + 1f) * value - num) + start;
	}

	public static float EaseOutBack(float start, float end, float value)
	{
		float num = 1.70158f;
		end -= start;
		value -= 1f;
		return end * (value * value * ((num + 1f) * value + num) + 1f) + start;
	}

	public static float EaseInOutBack(float start, float end, float value)
	{
		float num = 1.70158f;
		end -= start;
		value /= 0.5f;
		if (value < 1f)
		{
			num *= 1.525f;
			return end * 0.5f * (value * value * ((num + 1f) * value - num)) + start;
		}
		value -= 2f;
		num *= 1.525f;
		return end * 0.5f * (value * value * ((num + 1f) * value + num) + 2f) + start;
	}

	public static float EaseInElastic(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		float num2 = num * 0.3f;
		float num3 = 0f;
		if (value == 0f)
		{
			return start;
		}
		if ((value /= num) == 1f)
		{
			return start + end;
		}
		float num4;
		if (num3 == 0f || num3 < Mathf.Abs(end))
		{
			num3 = end;
			num4 = num2 / 4f;
		}
		else
		{
			num4 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(end / num3);
		}
		return 0f - num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * ((float)Math.PI * 2f) / num2) + start;
	}

	public static float EaseOutElastic(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		float num2 = num * 0.3f;
		float num3 = 0f;
		if (value == 0f)
		{
			return start;
		}
		if ((value /= num) == 1f)
		{
			return start + end;
		}
		float num4;
		if (num3 == 0f || num3 < Mathf.Abs(end))
		{
			num3 = end;
			num4 = num2 * 0.25f;
		}
		else
		{
			num4 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(end / num3);
		}
		return num3 * Mathf.Pow(2f, -10f * value) * Mathf.Sin((value * num - num4) * ((float)Math.PI * 2f) / num2) + end + start;
	}

	public static float EaseInOutElastic(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		float num2 = num * 0.3f;
		float num3 = 0f;
		if (value == 0f)
		{
			return start;
		}
		if ((value /= num * 0.5f) == 2f)
		{
			return start + end;
		}
		float num4;
		if (num3 == 0f || num3 < Mathf.Abs(end))
		{
			num3 = end;
			num4 = num2 / 4f;
		}
		else
		{
			num4 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(end / num3);
		}
		if (value < 1f)
		{
			return -0.5f * (num3 * Mathf.Pow(2f, 10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * ((float)Math.PI * 2f) / num2)) + start;
		}
		return num3 * Mathf.Pow(2f, -10f * (value -= 1f)) * Mathf.Sin((value * num - num4) * ((float)Math.PI * 2f) / num2) * 0.5f + end + start;
	}

	public static float LinearD(float start, float end, float value)
	{
		return end - start;
	}

	public static float EaseInQuadD(float start, float end, float value)
	{
		return 2f * (end - start) * value;
	}

	public static float EaseOutQuadD(float start, float end, float value)
	{
		end -= start;
		return (0f - end) * value - end * (value - 2f);
	}

	public static float EaseInOutQuadD(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * value;
		}
		value -= 1f;
		return end * (1f - value);
	}

	public static float EaseInCubicD(float start, float end, float value)
	{
		return 3f * (end - start) * value * value;
	}

	public static float EaseOutCubicD(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return 3f * end * value * value;
	}

	public static float EaseInOutCubicD(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return 1.5f * end * value * value;
		}
		value -= 2f;
		return 1.5f * end * value * value;
	}

	public static float EaseInQuartD(float start, float end, float value)
	{
		return 4f * (end - start) * value * value * value;
	}

	public static float EaseOutQuartD(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return -4f * end * value * value * value;
	}

	public static float EaseInOutQuartD(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return 2f * end * value * value * value;
		}
		value -= 2f;
		return -2f * end * value * value * value;
	}

	public static float EaseInQuintD(float start, float end, float value)
	{
		return 5f * (end - start) * value * value * value * value;
	}

	public static float EaseOutQuintD(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return 5f * end * value * value * value * value;
	}

	public static float EaseInOutQuintD(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return 2.5f * end * value * value * value * value;
		}
		value -= 2f;
		return 2.5f * end * value * value * value * value;
	}

	public static float EaseInSineD(float start, float end, float value)
	{
		return (end - start) * 0.5f * (float)Math.PI * Mathf.Sin((float)Math.PI / 2f * value);
	}

	public static float EaseOutSineD(float start, float end, float value)
	{
		end -= start;
		return (float)Math.PI / 2f * end * Mathf.Cos(value * ((float)Math.PI / 2f));
	}

	public static float EaseInOutSineD(float start, float end, float value)
	{
		end -= start;
		return end * 0.5f * (float)Math.PI * Mathf.Sin((float)Math.PI * value);
	}

	public static float EaseInExpoD(float start, float end, float value)
	{
		return 6.931472f * (end - start) * Mathf.Pow(2f, 10f * (value - 1f));
	}

	public static float EaseOutExpoD(float start, float end, float value)
	{
		end -= start;
		return 3.465736f * end * Mathf.Pow(2f, 1f - 10f * value);
	}

	public static float EaseInOutExpoD(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return 3.465736f * end * Mathf.Pow(2f, 10f * (value - 1f));
		}
		value -= 1f;
		return 3.465736f * end / Mathf.Pow(2f, 10f * value);
	}

	public static float EaseInCircD(float start, float end, float value)
	{
		return (end - start) * value / Mathf.Sqrt(1f - value * value);
	}

	public static float EaseOutCircD(float start, float end, float value)
	{
		value -= 1f;
		end -= start;
		return (0f - end) * value / Mathf.Sqrt(1f - value * value);
	}

	public static float EaseInOutCircD(float start, float end, float value)
	{
		value /= 0.5f;
		end -= start;
		if (value < 1f)
		{
			return end * value / (2f * Mathf.Sqrt(1f - value * value));
		}
		value -= 2f;
		return (0f - end) * value / (2f * Mathf.Sqrt(1f - value * value));
	}

	public static float EaseInBounceD(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		return EaseOutBounceD(0f, end, num - value);
	}

	public static float EaseOutBounceD(float start, float end, float value)
	{
		value /= 1f;
		end -= start;
		if (value < 0.36363637f)
		{
			return 2f * end * 7.5625f * value;
		}
		if (value < 0.72727275f)
		{
			value -= 0.54545456f;
			return 2f * end * 7.5625f * value;
		}
		if ((double)value < 0.9090909090909091)
		{
			value -= 0.8181818f;
			return 2f * end * 7.5625f * value;
		}
		value -= 21f / 22f;
		return 2f * end * 7.5625f * value;
	}

	public static float EaseInOutBounceD(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		if (value < num * 0.5f)
		{
			return EaseInBounceD(0f, end, value * 2f) * 0.5f;
		}
		return EaseOutBounceD(0f, end, value * 2f - num) * 0.5f;
	}

	public static float EaseInBackD(float start, float end, float value)
	{
		float num = 1.70158f;
		return 3f * (num + 1f) * (end - start) * value * value - 2f * num * (end - start) * value;
	}

	public static float EaseOutBackD(float start, float end, float value)
	{
		float num = 1.70158f;
		end -= start;
		value -= 1f;
		return end * ((num + 1f) * value * value + 2f * value * ((num + 1f) * value + num));
	}

	public static float EaseInOutBackD(float start, float end, float value)
	{
		float num = 1.70158f;
		end -= start;
		value /= 0.5f;
		if (value < 1f)
		{
			num *= 1.525f;
			return 0.5f * end * (num + 1f) * value * value + end * value * ((num + 1f) * value - num);
		}
		value -= 2f;
		num *= 1.525f;
		return 0.5f * end * ((num + 1f) * value * value + 2f * value * ((num + 1f) * value + num));
	}

	public static float EaseInElasticD(float start, float end, float value)
	{
		return EaseOutElasticD(start, end, 1f - value);
	}

	public static float EaseOutElasticD(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		float num2 = num * 0.3f;
		float num3 = 0f;
		float num4;
		if (num3 == 0f || num3 < Mathf.Abs(end))
		{
			num3 = end;
			num4 = num2 * 0.25f;
		}
		else
		{
			num4 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(end / num3);
		}
		return num3 * (float)Math.PI * num * Mathf.Pow(2f, 1f - 10f * value) * Mathf.Cos((float)Math.PI * 2f * (num * value - num4) / num2) / num2 - 3.465736f * num3 * Mathf.Pow(2f, 1f - 10f * value) * Mathf.Sin((float)Math.PI * 2f * (num * value - num4) / num2);
	}

	public static float EaseInOutElasticD(float start, float end, float value)
	{
		end -= start;
		float num = 1f;
		float num2 = num * 0.3f;
		float num3 = 0f;
		float num4;
		if (num3 == 0f || num3 < Mathf.Abs(end))
		{
			num3 = end;
			num4 = num2 / 4f;
		}
		else
		{
			num4 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(end / num3);
		}
		if (value < 1f)
		{
			value -= 1f;
			return -3.465736f * num3 * Mathf.Pow(2f, 10f * value) * Mathf.Sin((float)Math.PI * 2f * (num * value - 2f) / num2) - num3 * (float)Math.PI * num * Mathf.Pow(2f, 10f * value) * Mathf.Cos((float)Math.PI * 2f * (num * value - num4) / num2) / num2;
		}
		value -= 1f;
		return num3 * (float)Math.PI * num * Mathf.Cos((float)Math.PI * 2f * (num * value - num4) / num2) / (num2 * Mathf.Pow(2f, 10f * value)) - 3.465736f * num3 * Mathf.Sin((float)Math.PI * 2f * (num * value - num4) / num2) / Mathf.Pow(2f, 10f * value);
	}

	public static float SpringD(float start, float end, float value)
	{
		value = Mathf.Clamp01(value);
		end -= start;
		return end * (6f * (1f - value) / 5f + 1f) * (-2.2f * Mathf.Pow(1f - value, 1.2f) * Mathf.Sin((float)Math.PI * value * (2.5f * value * value * value + 0.2f)) + Mathf.Pow(1f - value, 2.2f) * ((float)Math.PI * (2.5f * value * value * value + 0.2f) + 23.561945f * value * value * value) * Mathf.Cos((float)Math.PI * value * (2.5f * value * value * value + 0.2f)) + 1f) - 6f * end * (Mathf.Pow(1f - value, 2.2f) * Mathf.Sin((float)Math.PI * value * (2.5f * value * value * value + 0.2f)) + value / 5f);
	}

	public static Function GetEasingFunction(Ease easingFunction)
	{
		return easingFunction switch
		{
			Ease.EaseInQuad => EaseInQuad, 
			Ease.EaseOutQuad => EaseOutQuad, 
			Ease.EaseInOutQuad => EaseInOutQuad, 
			Ease.EaseInCubic => EaseInCubic, 
			Ease.EaseOutCubic => EaseOutCubic, 
			Ease.EaseInOutCubic => EaseInOutCubic, 
			Ease.EaseInQuart => EaseInQuart, 
			Ease.EaseOutQuart => EaseOutQuart, 
			Ease.EaseInOutQuart => EaseInOutQuart, 
			Ease.EaseInQuint => EaseInQuint, 
			Ease.EaseOutQuint => EaseOutQuint, 
			Ease.EaseInOutQuint => EaseInOutQuint, 
			Ease.EaseInSine => EaseInSine, 
			Ease.EaseOutSine => EaseOutSine, 
			Ease.EaseInOutSine => EaseInOutSine, 
			Ease.EaseInExpo => EaseInExpo, 
			Ease.EaseOutExpo => EaseOutExpo, 
			Ease.EaseInOutExpo => EaseInOutExpo, 
			Ease.EaseInCirc => EaseInCirc, 
			Ease.EaseOutCirc => EaseOutCirc, 
			Ease.EaseInOutCirc => EaseInOutCirc, 
			Ease.Linear => Linear, 
			Ease.Spring => Spring, 
			Ease.EaseInBounce => EaseInBounce, 
			Ease.EaseOutBounce => EaseOutBounce, 
			Ease.EaseInOutBounce => EaseInOutBounce, 
			Ease.EaseInBack => EaseInBack, 
			Ease.EaseOutBack => EaseOutBack, 
			Ease.EaseInOutBack => EaseInOutBack, 
			Ease.EaseInElastic => EaseInElastic, 
			Ease.EaseOutElastic => EaseOutElastic, 
			Ease.EaseInOutElastic => EaseInOutElastic, 
			_ => null, 
		};
	}

	public static Function GetEasingFunctionDerivative(Ease easingFunction)
	{
		return easingFunction switch
		{
			Ease.EaseInQuad => EaseInQuadD, 
			Ease.EaseOutQuad => EaseOutQuadD, 
			Ease.EaseInOutQuad => EaseInOutQuadD, 
			Ease.EaseInCubic => EaseInCubicD, 
			Ease.EaseOutCubic => EaseOutCubicD, 
			Ease.EaseInOutCubic => EaseInOutCubicD, 
			Ease.EaseInQuart => EaseInQuartD, 
			Ease.EaseOutQuart => EaseOutQuartD, 
			Ease.EaseInOutQuart => EaseInOutQuartD, 
			Ease.EaseInQuint => EaseInQuintD, 
			Ease.EaseOutQuint => EaseOutQuintD, 
			Ease.EaseInOutQuint => EaseInOutQuintD, 
			Ease.EaseInSine => EaseInSineD, 
			Ease.EaseOutSine => EaseOutSineD, 
			Ease.EaseInOutSine => EaseInOutSineD, 
			Ease.EaseInExpo => EaseInExpoD, 
			Ease.EaseOutExpo => EaseOutExpoD, 
			Ease.EaseInOutExpo => EaseInOutExpoD, 
			Ease.EaseInCirc => EaseInCircD, 
			Ease.EaseOutCirc => EaseOutCircD, 
			Ease.EaseInOutCirc => EaseInOutCircD, 
			Ease.Linear => LinearD, 
			Ease.Spring => SpringD, 
			Ease.EaseInBounce => EaseInBounceD, 
			Ease.EaseOutBounce => EaseOutBounceD, 
			Ease.EaseInOutBounce => EaseInOutBounceD, 
			Ease.EaseInBack => EaseInBackD, 
			Ease.EaseOutBack => EaseOutBackD, 
			Ease.EaseInOutBack => EaseInOutBackD, 
			Ease.EaseInElastic => EaseInElasticD, 
			Ease.EaseOutElastic => EaseOutElasticD, 
			Ease.EaseInOutElastic => EaseInOutElasticD, 
			_ => null, 
		};
	}
}
public class MoveSun : MonoBehaviour
{
	public bool shouldMove;

	public float moveSpeed;

	private void Update()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		if (shouldMove)
		{
			((Component)this).transform.Rotate(Vector3.right, moveSpeed * Time.unscaledDeltaTime);
		}
	}
}
public class SpringPlus
{
	public float spring;

	public float drag;

	public float simSpeed = 1f;

	public Vector3 position;

	public Vector3 velocity;

	public Vector3 min;

	public Vector3 max;

	public int iterations;

	public float distanceCoefficient;

	public float control;

	public SpringPlus(float spring, float drag, Vector3 min, Vector3 max, int iterations, float simSpeed, float distanceCoefficient)
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: 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_003f: 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)
		this.spring = spring;
		this.drag = drag;
		position = Vector3.zero;
		velocity = Vector3.zero;
		this.min = min;
		this.max = max;
		this.iterations = iterations;
		this.simSpeed = simSpeed;
		this.distanceCoefficient = distanceCoefficient;
	}

	public void AddVelocity(Vector3 delta)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		velocity += delta;
	}

	public void Update()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: 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_0043: 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_0054: 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_006a: 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_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)
		//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_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_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Distance(position, Vector3.zero) * distanceCoefficient;
		float num2 = Time.deltaTime / (float)iterations * simSpeed * (num + 1f);
		for (int i = 0; i < iterations; i++)
		{
			velocity -= (position * spring + velocity * drag) * num2;
			position = Vector3.Min(Vector3.Max(position + velocity * num2, min), max);
		}
		control -= Time.deltaTime;
		control = ((control < 0f) ? 0f : control);
	}
}
public static class TextureUtilities
{
	public static Texture3D CreateFogLUT3DFrom2DSlices(Texture2D tex, Vector3Int dimensions)
	{
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Expected O, but got Unknown
		//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)
		Texture2D readableTexture = GetReadableTexture(tex);
		Color[] array = (Color[])(object)new Color[((Vector3Int)(ref dimensions)).x * ((Vector3Int)(ref dimensions)).y * ((Vector3Int)(ref dimensions)).z];
		int num = 0;
		for (int i = 0; i < ((Vector3Int)(ref dimensions)).z; i++)
		{
			for (int j = 0; j < ((Vector3Int)(ref dimensions)).y; j++)
			{
				int num2 = 0;
				while (num2 < ((Vector3Int)(ref dimensions)).x)
				{
					array[num] = readableTexture.GetPixel(num2 + i * ((Vector3Int)(ref dimensions)).z, j);
					num2++;
					num++;
				}
			}
		}
		Texture3D val = new Texture3D(((Vector3Int)(ref dimensions)).x, ((Vector3Int)(ref dimensions)).y, ((Vector3Int)(ref dimensions)).z, (TextureFormat)17, true);
		val.SetPixels(array);
		val.Apply();
		return val;
	}

	private static Texture2D GetReadableTexture(Texture2D texture)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1);
		Graphics.Blit((Texture)(object)texture, temporary);
		RenderTexture active = RenderTexture.active;
		RenderTexture.active = temporary;
		Texture2D val = new Texture2D(((Texture)texture).width, ((Texture)texture).height);
		val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
		val.Apply();
		RenderTexture.active = active;
		RenderTexture.ReleaseTemporary(temporary);
		return val;
	}

	public static RenderTexture CreateFogLUT3DFrom2DSlicesCompute(Texture2D fogTexture, Vector3Int dimensions, ComputeShader shader)
	{
		//IL_001e: 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_0031: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		int num = shader.FindKernel("Create3DLUTFrom2D");
		RenderTexture val = new RenderTexture(((Vector3Int)(ref dimensions)).x, ((Vector3Int)(ref dimensions)).y, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)1)
		{
			volumeDepth = ((Vector3Int)(ref dimensions)).z,
			dimension = (TextureDimension)3,
			enableRandomWrite = true,
			name = "FogLUT3DFrom2D"
		};
		val.Create();
		shader.SetTexture(num, "_FogLUT3DFrom2D", (Texture)(object)val);
		shader.SetTexture(num, "_FogTexture2D", (Texture)(object)fogTexture);
		shader.Dispatch(num, ((Vector3Int)(ref dimensions)).x, ((Vector3Int)(ref dimensions)).y, ((Vector3Int)(ref dimensions)).z);
		return val;
	}

	public static RenderTexture CreateFogLUT3DFromSimplexNoise(Vector3Int dimensions, ComputeShader shader)
	{
		//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_0032: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		int num = shader.FindKernel("Create3DLUTSimplexNoise");
		RenderTexture val = new RenderTexture(((Vector3Int)(ref dimensions)).x, ((Vector3Int)(ref dimensions)).y, 0, (RenderTextureFormat)24, (RenderTextureReadWrite)1)
		{
			volumeDepth = ((Vector3Int)(ref dimensions)).z,
			dimension = (TextureDimension)3,
			enableRandomWrite = true,
			name = "FogLUT3DSnoise"
		};
		val.Create();
		shader.SetTexture(num, "_FogLUT3DSNoise", (Texture)(object)val);
		shader.Dispatch(num, ((Vector3Int)(ref dimensions)).x, ((Vector3Int)(ref dimensions)).y, ((Vector3Int)(ref dimensions)).z);
		return val;
	}
}
public struct TimedActionPlus
{
	public float lifetime;

	public float end;

	private bool unscaledTime;

	private bool lied;

	public TimedActionPlus(float lifetime, bool unscaledTime = false)
	{
		this.lifetime = lifetime;
		end = 0f;
		lied = true;
		this.unscaledTime = unscaledTime;
	}

	public void Start()
	{
		end = GetTime() + lifetime;
		lied = false;
	}

	public void StartLifetime(float lifetime)
	{
		this.lifetime = lifetime;
		Start();
	}

	public void Stop()
	{
		end = 0f;
		lied = true;
	}

	public float Remaining()
	{
		return end - GetTime();
	}

	public float Elapsed()
	{
		return lifetime - Remaining();
	}

	public float Ratio()
	{
		return Mathf.Clamp01(1f - (end - GetTime()) / lifetime);
	}

	public bool TrueDone()
	{
		return end <= GetTime();
	}

	private float GetTime()
	{
		if (!unscaledTime)
		{
			return Time.time;
		}
		return Time.unscaledTime;
	}

	public bool Done()
	{
		if (!TrueDone())
		{
			return false;
		}
		if (!lied)
		{
			lied = true;
			return false;
		}
		return true;
	}
}
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class VolumetricFog : MonoBehaviour
{
	private const RenderTextureFormat FormatFogrendertexture = 2;

	[Expandable]
	public VolumetricFogOptions fogOptions;

	[Header("Required assets")]
	public Shader calculateFogShader;

	public Shader applyBlurShader;

	public Shader applyFogShader;

	public ComputeShader create3DLutShader;

	public List<Light> fogLightCasters = new List<Light>();

	public Texture2D fogTexture2D;

	public Texture2D blueNoiseTexture2D;

	[Header("Will be found automatically on startup")]
	public Light sunLight;

	private Material _applyBlurMaterial;

	private Material _calculateFogMaterial;

	private Material _applyFogMaterial;

	private float _kFactor;

	private Texture3D _fogTexture3D;

	private RenderTexture _fogTexture3DCompute;

	private RenderTexture _fogTexture3DSimplex;

	private Benchmark _benchmark;

	private MoveSun _moveSun;

	private Camera _currentCamera;

	private CommandBuffer _afterShadowPass;

	private static readonly int BlueNoiseTexture = Shader.PropertyToID("_BlueNoiseTexture");

	private static readonly int FogSpeed = Shader.PropertyToID("_FogSpeed");

	private static readonly int FogDirection = Shader.PropertyToID("_FogDirection");

	private static readonly int AmbientFog = Shader.PropertyToID("_AmbientFog");

	private static readonly int LightDir = Shader.PropertyToID("_LightDir");

	private static readonly int FogColor = Shader.PropertyToID("_FogColor");

	private static readonly int ShadowColor = Shader.PropertyToID("_ShadowColor");

	private static readonly int LightColor = Shader.PropertyToID("LightColor");

	private static readonly int LightIntensity = Shader.PropertyToID("_LightIntensity");

	private static readonly int FogSize = Shader.PropertyToID("_FogSize");

	private static readonly int FogWorldPosition = Shader.PropertyToID("_FogWorldPosition");

	private static readonly int HeightDensityCoef = Shader.PropertyToID("_HeightDensityCoef");

	private static readonly int BaseHeightDensity = Shader.PropertyToID("_BaseHeightDensity");

	private static readonly int Anisotropy = Shader.PropertyToID("_Anisotropy");

	private static readonly int ExtinctionCoef = Shader.PropertyToID("_ExtinctionCoef");

	private static readonly int NoiseScale = Shader.PropertyToID("_NoiseScale");

	private static readonly int FogDensity = Shader.PropertyToID("_FogDensity");

	private static readonly int RaymarchSteps = Shader.PropertyToID("_RaymarchSteps");

	private static readonly int RayleighScatteringCoef = Shader.PropertyToID("_RayleighScatteringCoef");

	private static readonly int BlurDepthFalloff = Shader.PropertyToID("_BlurDepthFalloff");

	private static readonly int Offsets = Shader.PropertyToID("_BlurOffsets");

	private static readonly int BlurWeights = Shader.PropertyToID("_BlurWeights");

	private static readonly int BlurDir = Shader.PropertyToID("BlurDir");

	private static readonly int FogRendertargetLinear = Shader.PropertyToID("FogRendertargetLinear");

	private static readonly int MieScatteringCoef = Shader.PropertyToID("_MieScatteringCoef");

	private static readonly int KFactor = Shader.PropertyToID("_kFactor");

	private static readonly int NoiseTexture = Shader.PropertyToID("_NoiseTexture");

	private static readonly int NoiseTex3D = Shader.PropertyToID("_NoiseTex3D");

	private static readonly int InverseProjectionMatrix = Shader.PropertyToID("InverseProjectionMatrix");

	private static readonly int InverseViewMatrix = Shader.PropertyToID("InverseViewMatrix");

	public Material ApplyFogMaterial
	{
		get
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)_applyFogMaterial) && Object.op_Implicit((Object)(object)applyFogShader))
			{
				_applyFogMaterial = new Material(applyFogShader)
				{
					hideFlags = (HideFlags)61
				};
			}
			return _applyFogMaterial;
		}
	}

	public Material ApplyBlurMaterial
	{
		get
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)_applyBlurMaterial) && Object.op_Implicit((Object)(object)applyBlurShader))
			{
				_applyBlurMaterial = new Material(applyBlurShader)
				{
					hideFlags = (HideFlags)61
				};
			}
			return _applyBlurMaterial;
		}
	}

	public Material CalculateFogMaterial
	{
		get
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)_calculateFogMaterial) && Object.op_Implicit((Object)(object)calculateFogShader))
			{
				_calculateFogMaterial = new Material(calculateFogShader)
				{
					hideFlags = (HideFlags)61
				};
			}
			return _calculateFogMaterial;
		}
	}

	public Camera CurrentCamera
	{
		get
		{
			if (!Object.op_Implicit((Object)(object)_currentCamera))
			{
				_currentCamera = ((Component)this).GetComponent<Camera>();
			}
			return _currentCamera;
		}
	}

	private void OnEnable()
	{
		sunLight = ((IEnumerable<Light>)Object.FindObjectsOfType<Light>()).FirstOrDefault((Func<Light, bool>)((Light l) => (int)l.type == 1));
		if (!Object.op_Implicit((Object)(object)sunLight))
		{
			sunLight = Object.FindObjectOfType<Light>();
		}
		_moveSun = ((Component)sunLight).GetComponent<MoveSun>() ?? ((Component)sunLight).gameObject.AddComponent<MoveSun>();
		_moveSun.moveSpeed = 0f;
		if (!fogLightCasters.Contains(sunLight))
		{
			fogLightCasters.Add(sunLight);
		}
	}

	private void Start()
	{
		_benchmark = Object.FindObjectOfType<Benchmark>();
		fogLightCasters.ForEach(AddLightCommandBuffer);
		Regenerate3DTexture();
	}

	public void Regenerate3DTexture()
	{
		//IL_0096: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		if (fogOptions.noiseSource.HasFlag(NoiseSource.SimplexNoiseCompute) || fogOptions.noiseSource.HasFlag(NoiseSource.Texture3DCompute) || fogOptions.noiseSource.HasFlag(NoiseSource.Texture3D))
		{
			switch (fogOptions.noiseSource)
			{
			case NoiseSource.Texture3D:
				_fogTexture3D = TextureUtilities.CreateFogLUT3DFrom2DSlices(fogTexture2D, fogOptions.noiseTexture3DDimensions);
				break;
			case NoiseSource.Texture3DCompute:
				_fogTexture3DCompute = TextureUtilities.CreateFogLUT3DFrom2DSlicesCompute(fogTexture2D, fogOptions.noiseTexture3DDimensions, create3DLutShader);
				break;
			case NoiseSource.SimplexNoiseCompute:
				_fogTexture3DSimplex = TextureUtilities.CreateFogLUT3DFromSimplexNoise(fogOptions.noiseTexture3DDimensions, create3DLutShader);
				break;
			}
		}
	}

	private void CalculateKFactor()
	{
		_kFactor = 1.55f * fogOptions.anisotropy - 0.55f * Mathf.Pow(fogOptions.anisotropy, 3f);
	}

	private void OnDestroy()
	{
		fogLightCasters.ForEach(RemoveLightCommandBuffer);
	}

	private void RemoveLightCommandBuffer(Light lightComponent)
	{
		if (_afterShadowPass != null && Object.op_Implicit((Object)(object)lightComponent))
		{
			lightComponent.RemoveCommandBuffer((LightEvent)1, _afterShadowPass);
		}
	}

	private void AddLightCommandBuffer(Light lightComponent)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		_afterShadowPass = new CommandBuffer
		{
			name = "Volumetric Fog ShadowMap"
		};
		_afterShadowPass.SetGlobalTexture("ShadowMap", new RenderTargetIdentifier((BuiltinRenderTextureType)1));
		if (Object.op_Implicit((Object)(object)lightComponent))
		{
			lightComponent.AddCommandBuffer((LightEvent)1, _afterShadowPass);
		}
	}

	private bool HasRequiredAssets()
	{
		return Object.op_Implicit((Object)(object)fogTexture2D) && Object.op_Implicit((Object)(object)ApplyFogMaterial) && Object.op_Implicit((Object)(object)applyFogShader) && Object.op_Implicit((Object)(object)CalculateFogMaterial) && Object.op_Implicit((Object)(object)calculateFogShader) && Object.op_Implicit((Object)(object)ApplyBlurMaterial) && Object.op_Implicit((Object)(object)applyBlurShader);
	}

	[ImageEffectOpaque]
	private void OnRenderImage(RenderTexture source, RenderTexture destination)
	{
		//IL_0181: 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_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: 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_00db: 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)
		if (!HasRequiredAssets())
		{
			Graphics.Blit((Texture)(object)source, destination);
			return;
		}
		if (fogOptions.shadowsEnabled)
		{
			Shader.EnableKeyword("SHADOWS_ON");
			Shader.DisableKeyword("SHADOWS_OFF");
		}
		else
		{
			Shader.DisableKeyword("SHADOWS_ON");
			Shader.EnableKeyword("SHADOWS_OFF");
		}
		if (Object.op_Implicit((Object)(object)sunLight))
		{
			sunLight.intensity = fogOptions.lightIntensity;
			if (fogOptions.sunShouldMove)
			{
				_moveSun.shouldMove = true;
				_moveSun.moveSpeed = fogOptions.moveSpeed;
				VolumetricFogOptions volumetricFogOptions = fogOptions;
				Quaternion rotation = ((Component)sunLight).transform.rotation;
				volumetricFogOptions.sunAngle = ((Quaternion)(ref rotation)).eulerAngles;
			}
			else
			{
				_moveSun.shouldMove = false;
				((Component)sunLight).transform.rotation = Quaternion.Euler(fogOptions.sunAngle);
			}
		}
		int num = ((Texture)source).width >> fogOptions.renderTextureResDivision;
		int num2 = ((Texture)source).height >> fogOptions.renderTextureResDivision;
		RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0, (RenderTextureFormat)2);
		RenderTexture temporary2 = RenderTexture.GetTemporary(num, num2, 0, (RenderTextureFormat)2);
		((Texture)temporary).filterMode = (FilterMode)1;
		((Texture)temporary2).filterMode = (FilterMode)1;
		SetMieScattering();
		SetNoiseSource();
		Shader.SetGlobalMatrix(InverseViewMatrix, CurrentCamera.cameraToWorldMatrix);
		int inverseProjectionMatrix = InverseProjectionMatrix;
		Matrix4x4 projectionMatrix = CurrentCamera.projectionMatrix;
		Shader.SetGlobalMatrix(inverseProjectionMatrix, ((Matrix4x4)(ref projectionMatrix)).inverse);
		RenderFog(temporary, source);
		BlurFog(temporary, temporary2);
		BlendWithScene(source, destination, temporary);
		RenderTexture.ReleaseTemporary(temporary);
		RenderTexture.ReleaseTemporary(temporary2);
	}

	private void RenderFog(RenderTexture fogRenderTexture, RenderTexture source)
	{
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: 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_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		if (fogOptions.useRayleighScattering)
		{
			CalculateFogMaterial.EnableKeyword("RAYLEIGH_SCATTERING");
			CalculateFogMaterial.SetFloat(RayleighScatteringCoef, fogOptions.rayleighScatteringCoef);
		}
		else
		{
			CalculateFogMaterial.DisableKeyword("RAYLEIGH_SCATTERING");
		}
		ToggleShaderKeyword(CalculateFogMaterial, "LIMITFOGSIZE", fogOptions.limitFogInSize);
		ToggleShaderKeyword(CalculateFogMaterial, "HEIGHTFOG", fogOptions.heightFogEnabled);
		float num = CalculateRaymarchStepRatio();
		CalculateFogMaterial.SetFloat(RaymarchSteps, (float)fogOptions.rayMarchSteps * Mathf.Pow(num, 2f));
		CalculateFogMaterial.SetFloat(FogDensity, fogOptions.fogDensityCoef);
		CalculateFogMaterial.SetFloat(NoiseScale, fogOptions.noiseScale);
		CalculateFogMaterial.SetFloat(ExtinctionCoef, fogOptions.extinctionCoef);
		CalculateFogMaterial.SetFloat(Anisotropy, fogOptions.anisotropy);
		CalculateFogMaterial.SetFloat(BaseHeightDensity, fogOptions.baseHeightDensity);
		CalculateFogMaterial.SetFloat(HeightDensityCoef, fogOptions.heightDensityCoef);
		CalculateFogMaterial.SetVector(FogWorldPosition, Vector4.op_Implicit(fogOptions.fogWorldPosition));
		CalculateFogMaterial.SetFloat(FogSize, fogOptions.fogSize);
		CalculateFogMaterial.SetFloat(LightIntensity, fogOptions.lightIntensity);
		CalculateFogMaterial.SetColor(LightColor, sunLight.color);
		CalculateFogMaterial.SetColor(ShadowColor, fogOptions.fogInShadowColor);
		CalculateFogMaterial.SetColor(FogColor, fogOptions.useLightColorForFog ? sunLight.color : fogOptions.fogInLightColor);
		CalculateFogMaterial.SetVector(LightDir, Vector4.op_Implicit(((Component)sunLight).transform.forward));
		CalculateFogMaterial.SetFloat(AmbientFog, fogOptions.ambientFog);
		CalculateFogMaterial.SetVector(FogDirection, Vector4.op_Implicit(fogOptions.windDirection));
		CalculateFogMaterial.SetFloat(FogSpeed, fogOptions.speed);
		CalculateFogMaterial.SetTexture(BlueNoiseTexture, (Texture)(object)blueNoiseTexture2D);
		Graphics.Blit((Texture)(object)source, fogRenderTexture, CalculateFogMaterial);
	}

	private float CalculateRaymarchStepRatio()
	{
		if (!fogOptions.optimizeSettingsFps)
		{
			return 1f;
		}
		float num = 1f / _benchmark.TimeSpent;
		float num2 = 30f;
		switch (fogOptions.fpsTarget)
		{
		case FPSTarget.Max30:
			num2 = 30f;
			break;
		case FPSTarget.Max60:
			num2 = 60f;
			break;
		case FPSTarget.Max120:
			num2 = 120f;
			break;
		case FPSTarget.Unlimited:
			num2 = num;
			break;
		default:
			Debug.Log((object)"FPS Target not found");
			break;
		}
		return Mathf.Clamp01(num / num2);
	}

	private void BlurFog(RenderTexture fogTarget1, RenderTexture fogTarget2)
	{
		//IL_007b: 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_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		if (fogOptions.blurEnabled)
		{
			ApplyBlurMaterial.SetFloat(BlurDepthFalloff, fogOptions.blurDepthFalloff);
			Vector4 val = default(Vector4);
			((Vector4)(ref val))..ctor(0f, fogOptions.blurOffsets.x, fogOptions.blurOffsets.y, fogOptions.blurOffsets.z);
			ApplyBlurMaterial.SetVector(Offsets, val);
			Vector4 val2 = default(Vector4);
			((Vector4)(ref val2))..ctor(fogOptions.blurWeights.x + fogOptions.blurWeights.y + fogOptions.blurWeights.z, fogOptions.blurWeights.x, fogOptions.blurWeights.y, fogOptions.blurWeights.z);
			ApplyBlurMaterial.SetVector(BlurWeights, val2);
			for (int i = 0; i < fogOptions.blurIterations; i++)
			{
				ApplyBlurMaterial.SetVector(BlurDir, Vector4.op_Implicit(new Vector2(0f, 1f)));
				Graphics.Blit((Texture)(object)fogTarget1, fogTarget2, ApplyBlurMaterial);
				ApplyBlurMaterial.SetVector(BlurDir, Vector4.op_Implicit(new Vector2(1f, 0f)));
				Graphics.Blit((Texture)(object)fogTarget2, fogTarget1, ApplyBlurMaterial);
			}
		}
	}

	private void BlendWithScene(RenderTexture source, RenderTexture destination, RenderTexture fogTarget)
	{
		if (!fogOptions.addSceneColor)
		{
			Graphics.Blit((Texture)(object)fogTarget, destination);
			return;
		}
		ApplyFogMaterial.SetTexture(FogRendertargetLinear, (Texture)(object)fogTarget);
		Graphics.Blit((Texture)(object)source, destination, ApplyFogMaterial);
	}

	private void SetMieScattering()
	{
		ToggleShaderKeyword(CalculateFogMaterial, "HG_SCATTERING", shouldEnable: false);
		ToggleShaderKeyword(CalculateFogMaterial, "CS_SCATTERING", shouldEnable: false);
		ToggleShaderKeyword(CalculateFogMaterial, "SCHLICK_HG_SCATTERING", shouldEnable: false);
		switch (fogOptions.mieScatteringApproximation)
		{
		case MieScatteringApproximation.HenyeyGreenstein:
			ToggleShaderKeyword(CalculateFogMaterial, "HG_SCATTERING", shouldEnable: true);
			CalculateFogMaterial.SetFloat(MieScatteringCoef, fogOptions.mieScatteringCoef);
			break;
		case MieScatteringApproximation.CornetteShanks:
			ToggleShaderKeyword(CalculateFogMaterial, "CS_SCATTERING", shouldEnable: true);
			CalculateFogMaterial.SetFloat(MieScatteringCoef, fogOptions.mieScatteringCoef);
			break;
		case MieScatteringApproximation.Schlick:
			CalculateKFactor();
			ToggleShaderKeyword(CalculateFogMaterial, "SCHLICK_HG_SCATTERING", shouldEnable: true);
			CalculateFogMaterial.SetFloat(KFactor, _kFactor);
			CalculateFogMaterial.SetFloat(MieScatteringCoef, fogOptions.mieScatteringCoef);
			break;
		case MieScatteringApproximation.Off:
			break;
		default:
			Debug.LogWarning((object)$"Mie scattering approximation {fogOptions.mieScatteringApproximation} is not handled by SetMieScattering()");
			break;
		}
	}

	private void SetNoiseSource()
	{
		ToggleShaderKeyword(CalculateFogMaterial, "SNOISE", shouldEnable: false);
		ToggleShaderKeyword(CalculateFogMaterial, "NOISE2D", shouldEnable: false);
		ToggleShaderKeyword(CalculateFogMaterial, "NOISE3D", shouldEnable: false);
		switch (fogOptions.noiseSource)
		{
		case NoiseSource.SimplexNoise:
			ToggleShaderKeyword(CalculateFogMaterial, "SNOISE", shouldEnable: true);
			break;
		case NoiseSource.Texture2D:
			CalculateFogMaterial.SetTexture(NoiseTexture, (Texture)(object)fogTexture2D);
			ToggleShaderKeyword(CalculateFogMaterial, "NOISE2D", shouldEnable: true);
			break;
		case NoiseSource.Texture3D:
			CalculateFogMaterial.SetTexture(NoiseTex3D, (Texture)(object)_fogTexture3D);
			ToggleShaderKeyword(CalculateFogMaterial, "NOISE3D", shouldEnable: true);
			break;
		case NoiseSource.SimplexNoiseCompute:
			CalculateFogMaterial.SetTexture(NoiseTex3D, (Texture)(object)_fogTexture3DSimplex);
			ToggleShaderKeyword(CalculateFogMaterial, "NOISE3D", shouldEnable: true);
			break;
		case NoiseSource.Texture3DCompute:
			CalculateFogMaterial.SetTexture(NoiseTex3D, (Texture)(object)_fogTexture3DCompute);
			ToggleShaderKeyword(CalculateFogMaterial, "NOISE3D", shouldEnable: true);
			break;
		}
	}

	private static void ToggleShaderKeyword(Material shaderMat, string keyword, bool shouldEnable)
	{
		if (shouldEnable)
		{
			shaderMat.EnableKeyword(keyword);
		}
		else
		{
			shaderMat.DisableKeyword(keyword);
		}
	}
}
[Serializable]
[CreateAssetMenu(fileName = "VolumetricFogOptions", menuName = "Volumetric Fog/Fog Options")]
public class VolumetricFogOptions : ScriptableObject
{
	[Header("Position and size(in m³)")]
	public bool limitFogInSize;

	public Vector3 fogWorldPosition;

	public float fogSize = 50f;

	[Header("Performance")]
	[Range(0f, 8f)]
	public int renderTextureResDivision;

	[Range(1f, 1024f)]
	public int rayMarchSteps = 350;

	public bool optimizeSettingsFps;

	public FPSTarget fpsTarget = FPSTarget.Max60;

	[Header("Physical coefficients")]
	public bool useRayleighScattering = true;

	[Range(-1f, 2f)]
	public float rayleighScatteringCoef = 0.003f;

	[Range(-1f, 2f)]
	public float mieScatteringCoef = 0.007f;

	public MieScatteringApproximation mieScatteringApproximation = MieScatteringApproximation.HenyeyGreenstein;

	[Range(0f, 100f)]
	public float fogDensityCoef = 12f;

	[Range(0f, 1f)]
	public float extinctionCoef = 0.01f;

	[Range(-1f, 1f)]
	public float anisotropy = -0.3f;

	[Range(0f, 1f)]
	public float heightDensityCoef = 0.2f;

	[Range(0f, 10000f)]
	public float baseHeightDensity = 6000f;

	[Header("Blur")]
	[Range(1f, 8f)]
	public int blurIterations = 4;

	[Range(0f, 2000f)]
	public float blurDepthFalloff = 100f;

	public Vector3 blurOffsets = new Vector3(1f, 2f, 3f);

	public Vector3 blurWeights = new Vector3(0.213f, 0.17f, 0.036f);

	[Header("Color")]
	public bool useLightColorForFog = true;

	public Color fogInShadowColor = Color32.op_Implicit(new Color32((byte)10, (byte)70, (byte)200, byte.MaxValue));

	public Color fogInLightColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)65, (byte)0, byte.MaxValue));

	[Range(0f, 1f)]
	public float ambientFog = 0.4f;

	[Header("Sun")]
	[Range(0f, 10f)]
	public float lightIntensity = 1f;

	public bool sunShouldMove;

	public Vector3 sunAngle = new Vector3(13f, 0f, 0f);

	[Range(-10f, 10f)]
	public float moveSpeed = 2f;

	[Header("Animation")]
	public Vector3 windDirection = Vector3.right;

	public float speed = 1f;

	[Header("Debug")]
	public NoiseSource noiseSource = NoiseSource.Texture3D;

	public bool addSceneColor = true;

	public bool blurEnabled = true;

	public bool shadowsEnabled = true;

	public bool heightFogEnabled;

	[Range(-100f, 100f)]
	public float noiseScale = 0.9f;

	public Vector3Int noiseTexture3DDimensions = new Vector3Int(64, 64, 86);
}
namespace Enum
{
	public enum FPSTarget
	{
		Max30,
		Max60,
		Max120,
		Unlimited
	}
	public enum MieScatteringApproximation
	{
		HenyeyGreenstein,
		CornetteShanks,
		Schlick,
		Off
	}
	public enum NoiseSource
	{
		Texture2D = 1,
		Texture3D = 2,
		Texture3DCompute = 4,
		SimplexNoise = 8,
		SimplexNoiseCompute = 0x10
	}
}
namespace personplus
{
	[BepInPlugin("com.personperhaps.ravenimpactfx", "ravenimpactfx", "1.2")]
	public class ravenimpactfx : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerFpParent), "ApplyWeaponSnap")]
		public class ApplyRecoilPatch
		{
			public static void Prefix(PlayerFpParent __instance, ref float magnitude, ref float duration, ref float frequency)
			{
				magnitude *= instance.weaponSnapMagnitudeMultiplier.Value;
				frequency *= instance.weaponSnapFrequencyMultiplier.Value;
				duration *= instance.weaponSnapDurationMultiplier.Value;
			}
		}

		[HarmonyPatch(typeof(FirstPersonControllerInput), "Update")]
		public class AutoJumpPatch
		{
			public static void Postfix(FirstPersonControllerInput __instance)
			{
				if (instance.autoJump.Value)
				{
					((Component)__instance).gameObject.GetComponent<FirstPersonController>().SetInput(0f - SteelInput.GetAxis((KeyBinds)0), SteelInput.GetAxis((KeyBinds)1), SteelInput.GetButton((KeyBinds)9), 0f - SteelInput.GetAxis((KeyBinds)18), SteelInput.GetAxis((KeyBinds)19));
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "DeployParachute")]
		public class AutoJumpPatch2
		{
			public static void Postfix(FpsActorController __instance, bool __result)
			{
				if (instance.autoJump.Value && !SmoothMovementPatch2.wallRunning && SmoothMovementPatch2.wallJumpCooldown.Done() && SmoothMovementPatch2.leaveGroundCooldown.Done())
				{
					__result = SteelInput.GetButtonDown((KeyBinds)9) && SteelInput.GetButton((KeyBinds)6);
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "Update")]
		public class SmoothCameraPatch
		{
			public static void Prefix(out float __state, FpsActorController __instance)
			{
				__state = __instance.fpParent.lean;
			}

			public static void Postfix(float __state, FpsActorController __instance)
			{
				if (instance.tacticalMovement.Value)
				{
					__instance.fpParent.lean = Mathf.Lerp(__state, ((ActorController)__instance).Lean() * 1.4f, Time.fixedDeltaTime * 5f);
				}
			}
		}

		[HarmonyPatch(typeof(Animator), "SetBool", new Type[]
		{
			typeof(int),
			typeof(bool)
		})]
		public class TuckPatch
		{
			public static bool Prefix(int id, bool value, Animator __instance)
			{
				if (instance.noKickTuck.Value)
				{
					if (id == Animator.StringToHash("tuck"))
					{
						return false;
					}
					return true;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Animator), "SetTrigger", new Type[] { typeof(string) })]
		public class TuckPatch2
		{
			public static bool Prefix(string name, Animator __instance)
			{
				if (name == "kick" && instance.noKickTuck.Value)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "WantsToFire")]
		public class WantsToFirePatch
		{
			public static void Postfix(FpsActorController __instance, ref bool __result)
			{
				if (instance.gungho.Value)
				{
					__result = __instance.inputEnabled && !GameManager.gameOver && SteelInput.GetButton((KeyBinds)2) && !__instance.IsCursorFree();
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "IsReloading")]
		public class ReloadCheckPatch
		{
			public static void Postfix(FpsActorController __instance, ref bool __result)
			{
				if (instance.gungho.Value)
				{
					__result = false;
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "Reload")]
		public class ReloadPatch
		{
			public static void Postfix(FpsActorController __instance, ref bool __result)
			{
				if (instance.reloadDuringKick.Value)
				{
					__result = __instance.inputEnabled && SteelInput.GetButton((KeyBinds)5) && !__instance.IsCursorFree() && !GameManager.gameOver;
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "IsSprinting")]
		public class IsSprintingPatch
		{
			public static void Postfix(FpsActorController __instance, ref bool __result)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				if (instance.noKickTuck.Value)
				{
					__result = (int)((ActorController)__instance).actor.stance == 0 && !((ActorController)__instance).Aiming() && ((ActorController)__instance).HoldingSprint() && !((ActorController)__instance).actor.IsSeated();
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "ReceivedDamage")]
		public class ReceiveDamagePatch
		{
			public static bool Prefix(FpsActorController __instance, bool friendlyFire, float damage, float balanceDamage, Vector3 point, Vector3 direction, Vector3 force)
			{
				//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_00c2: 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_00ce: 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_00d5: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
				if (balanceDamage > 5f)
				{
					__instance.fpParent.ApplyScreenshake(balanceDamage / (6f * instance.damageScreenShakeReduction.Value), Mathf.CeilToInt(balanceDamage / (20f * instance.damageScreenShakeReduction.Value)));
				}
				if (damage > 5f)
				{
					__instance.fpParent.KickCamera(new Vector3(Random.Range(-5f, 5f), Random.Range(-10f, 10f), Random.Range(-5f, 5f)) / instance.damageScreenShakeReduction.Value);
				}
				Matrix4x4 worldToLocalMatrix = ((Component)__instance.GetActiveCamera()).transform.worldToLocalMatrix;
				Vector3 val = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyVector(-direction);
				float num = Mathf.Atan2(val.z, val.x) * 57.29578f - 90f;
				DamageUI.instance.ShowDamageIndicator(num, damage < 2f && balanceDamage > damage);
				return false;
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "UpdateGameplay")]
		public class StancePatch
		{
			private static float beforeCameraHeight = 1.5f;

			private static float beforeTargetCameraHeight = 1.5f;

			public static void Prefix(FpsActorController __instance)
			{
				if (instance.tacticalMovement.Value && !((ActorController)__instance).actor.IsSeated() && !((ActorController)__instance).actor.IsOnLadder())
				{
					beforeCameraHeight = (float)typeof(FpsActorController).GetField("cameraHeight", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
					beforeTargetCameraHeight = (float)typeof(FpsActorController).GetField("targetCameraHeight", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
				}
			}

			public static void Postfix(FpsActorController __instance)
			{
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Expected O, but got Unknown
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				if (instance.tacticalMovement.Value && !((ActorController)__instance).actor.IsSeated() && !((ActorController)__instance).actor.IsOnLadder())
				{
					float num = EasingFunction.EaseOutSine(beforeCameraHeight, beforeTargetCameraHeight, 4f * RealDelta());
					typeof(FpsActorController).GetField("cameraHeight", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, num);
					Transform val = (Transform)typeof(FpsActorController).GetField("fpCameraRoot", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
					val.localPosition = new Vector3(0f, num, 0f);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerFpParent), "Awake")]
		public class FpSpringsPatch
		{
			public static void Postfix(PlayerFpParent __instance)
			{
				//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_002e: 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_003d: 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_0049: Expected O, but got Unknown
				//IL_0085: 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_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Expected O, but got Unknown
				Spring value = new Spring(instance.weaponPositionSpring.Value, instance.weaponPositionDrag.Value, -Vector3.one * 0.2f, Vector3.one * 0.2f, 8);
				typeof(PlayerFpParent).GetField("positionSpring", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, value);
				Spring value2 = new Spring(instance.weaponRotationSpring.Value, instance.weaponRotationDrag.Value, -Vector3.one * 15f, Vector3.one * 15f, 8);
				typeof(PlayerFpParent).GetField("rotationSpring", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, value2);
			}
		}

		[HarmonyPatch(typeof(PlayerFpParent), "FixedUpdate")]
		public class FovPatch
		{
			private static float beforeFovRatio = 1.5f;

			public static float swayAmount = 0f;

			public static void Prefix(PlayerFpParent __instance)
			{
				beforeFovRatio = (float)typeof(PlayerFpParent).GetField("fovRatio", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
			}

			public static void Postfix(PlayerFpParent __instance)
			{
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Expected O, but got Unknown
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				float value = instance.aimSmoothing.Value;
				bool flag = (bool)typeof(PlayerFpParent).GetField("aiming", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
				float num = Mathf.Lerp(beforeFovRatio, flag ? 1f : 0f, RealDelta() * value);
				typeof(PlayerFpParent).GetField("fovRatio", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, num);
				FieldInfo field = typeof(PlayerFpParent).GetField("fpCameraRoot", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					Camera val = (Camera)field.GetValue(__instance);
					if ((Object)(object)val != (Object)null)
					{
						float end = (float)typeof(PlayerFpParent).GetField("zoomFov", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
						float start = (float)typeof(PlayerFpParent).GetField("normalFov", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
						float num2 = EasingFunction.EaseInOutQuint(start, end, num);
						Vector3 kickLocalEuler = __instance.GetKickLocalEuler();
						val.fieldOfView = num2 + ((Vector3)(ref kickLocalEuler)).magnitude * 20f + GetSnap(__instance) * 20f;
					}
				}
				Transform shoulderParent = __instance.shoulderParent;
				shoulderParent.localEulerAngles += Vector3.back * CoolTiltingPatch.slideTilt * -20f;
			}
		}

		[HarmonyPatch(typeof(Weapon), "Equip")]
		public class EquipFix
		{
			public static void Postfix(Weapon __instance)
			{
				//IL_0078: 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_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: 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)
				if (__instance.UserIsPlayer() && (Object)(object)__instance.arms != (Object)null)
				{
					CoolTiltingPatch.bones = __instance.arms.bones.ToDictionary((Transform x) => x, (Transform x) => new Tuple<Vector3, Vector3>(Vector3.zero, Vector3.zero));
					CoolTiltingPatch.ravenCoil.velocity = Vector3.zero;
					CoolTiltingPatch.ravenCoil.position = Vector3.zero;
					CoolTiltingPatch.shakeCoil.velocity = Vector3.zero;
					CoolTiltingPatch.shakeCoil.position = Vector3.zero;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerFpParent), "LateUpdate")]
		public class CoolTiltingPatch
		{
			public static float swayAmount = 0f;

			public static SpringPlus ravenCoil = new SpringPlus(instance.cameraSpring.Value, instance.cameraDrag.Value, -Vector3.one * 20f, Vector3.one * 20f, 16, instance.cameraSimSpeed.Value, 0.5f);

			public static SpringPlus shakeCoil = new SpringPlus(70f, 7f, -Vector3.one * 20f, Vector3.one * 20f, 16, 1f, 0.5f);

			public static Vector3 averageDelta = Vector3.zero;

			public static Dictionary<Transform, Tuple<Vector3, Vector3>> bones = new Dictionary<Transform, Tuple<Vector3, Vector3>>();

			public static float lastSnap = 0f;

			public static Vector3 slideNoise;

			public static Vector3 lerpNoise;

			public static float slideTilt = 0f;

			public static float max = 50f;

			public static float wallTilt = 0f;

			public static Vector3 offsetPos = Vector3.zero;

			public static Vector3 origPos = Vector3.zero;

			public static TimedActionPlus vaultAction = new TimedActionPlus(0.4f);

			public static void Postfix(PlayerFpParent __instance)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_032d: 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_0333: Unknown result type (might be due to invalid IL or missing references)
				//IL_0338: 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)
				//IL_00b3: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: 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)
				//IL_0108: 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_011c: 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_0135: 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_013b: 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_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0369: Unknown result type (might be due to invalid IL or missing references)
				//IL_036e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0371: Unknown result type (might be due to invalid IL or missing references)
				//IL_0376: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0467: Unknown result type (might be due to invalid IL or missing references)
				//IL_046c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0477: Unknown result type (might be due to invalid IL or missing references)
				//IL_0481: Unknown result type (might be due to invalid IL or missing references)
				//IL_0486: Unknown result type (might be due to invalid IL or missing references)
				//IL_048d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0497: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04da: Unknown result type (might be due to invalid IL or missing references)
				//IL_04df: Unknown result type (might be due to invalid IL or missing references)
				//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0502: Unknown result type (might be due to invalid IL or missing references)
				//IL_0516: Unknown result type (might be due to invalid IL or missing references)
				//IL_051b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0520: Unknown result type (might be due to invalid IL or missing references)
				//IL_052a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0534: Unknown result type (might be due to invalid IL or missing references)
				//IL_0539: Unknown result type (might be due to invalid IL or missing references)
				//IL_0543: Unknown result type (might be due to invalid IL or missing references)
				//IL_0548: Unknown result type (might be due to invalid IL or missing references)
				//IL_0552: Unknown result type (might be due to invalid IL or missing references)
				//IL_0557: Unknown result type (might be due to invalid IL or missing references)
				//IL_0568: Unknown result type (might be due to invalid IL or missing references)
				//IL_057f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0596: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Expected O, but got Unknown
				//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_0249: Unknown result type (might be due to invalid IL or missing references)
				//IL_024d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Unknown result type (might be due to invalid IL or missing references)
				//IL_087e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0883: Unknown result type (might be due to invalid IL or missing references)
				//IL_0888: Unknown result type (might be due to invalid IL or missing references)
				//IL_0848: Unknown result type (might be due to invalid IL or missing references)
				//IL_084d: Unknown result type (might be due to invalid IL or missing references)
				//IL_086b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0870: Unknown result type (might be due to invalid IL or missing references)
				//IL_063d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0642: Unknown result type (might be due to invalid IL or missing references)
				//IL_064c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0651: Unknown result type (might be due to invalid IL or missing references)
				//IL_0661: Unknown result type (might be due to invalid IL or missing references)
				//IL_0666: Unknown result type (might be due to invalid IL or missing references)
				//IL_066f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0674: Unknown result type (might be due to invalid IL or missing references)
				//IL_0678: Unknown result type (might be due to invalid IL or missing references)
				//IL_067d: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_06db: Unknown result type (might be due to invalid IL or missing references)
				//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0707: Unknown result type (might be due to invalid IL or missing references)
				//IL_070c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0710: Unknown result type (might be due to invalid IL or missing references)
				//IL_074d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0752: Unknown result type (might be due to invalid IL or missing references)
				//IL_0759: Unknown result type (might be due to invalid IL or missing references)
				//IL_075e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0763: Unknown result type (might be due to invalid IL or missing references)
				//IL_0767: Unknown result type (might be due to invalid IL or missing references)
				//IL_076c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0773: Unknown result type (might be due to invalid IL or missing references)
				//IL_0778: Unknown result type (might be due to invalid IL or missing references)
				//IL_077d: Unknown result type (might be due to invalid IL or missing references)
				//IL_077f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0783: Unknown result type (might be due to invalid IL or missing references)
				//IL_0788: Unknown result type (might be due to invalid IL or missing references)
				//IL_078d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0791: Unknown result type (might be due to invalid IL or missing references)
				//IL_0796: Unknown result type (might be due to invalid IL or missing references)
				//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_07dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0810: Unknown result type (might be due to invalid IL or missing references)
				//IL_0812: Unknown result type (might be due to invalid IL or missing references)
				//IL_0817: Unknown result type (might be due to invalid IL or missing references)
				//IL_082c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0836: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = Vector3.zero;
				if (!((Object)(object)((ActorController)FpsActorController.instance).actor != (Object)null) || GameManager.IsSpectating())
				{
					return;
				}
				if ((Object)(object)((ActorController)FpsActorController.instance).actor.activeWeapon != (Object)null && (Object)(object)((ActorController)FpsActorController.instance).actor.activeWeapon.arms != (Object)null)
				{
					Dictionary<Transform, Tuple<Vector3, Vector3>> dictionary = new Dictionary<Transform, Tuple<Vector3, Vector3>>();
					Quaternion localRotation;
					foreach (Transform key in bones.Keys)
					{
						_ = key.localPosition;
						if (false)
						{
							break;
						}
						Vector3 localPosition = key.localPosition;
						dictionary.Add(key, new Tuple<Vector3, Vector3>(bones[key].Item1, bones[key].Item2));
						Vector3 val2 = val;
						Vector3 item = bones[key].Item1;
						localRotation = key.localRotation;
						val = val2 + Vector3.ClampMagnitude((item - ((Quaternion)(ref localRotation)).eulerAngles) / 5f, max) * instance.cameraParkinsonsAdditiveAmount.Value;
						val += Vector3.ClampMagnitude(key.localPosition - bones[key].Item2, max) * instance.cameraParkinsonsAdditiveAmount.Value;
					}
					Dictionary<Transform, Tuple<Vector3, Vector3>> dictionary2 = ((ActorController)FpsActorController.instance).actor.activeWeapon.arms.bones.ToDictionary((Transform x) => x, delegate(Transform x)
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						//IL_0009: Unknown result type (might be due to invalid IL or missing references)
						//IL_000f: Unknown result type (might be due to invalid IL or missing references)
						Quaternion localRotation2 = x.localRotation;
						return new Tuple<Vector3, Vector3>(((Quaternion)(ref localRotation2)).eulerAngles, x.localPosition);
					});
					foreach (Transform componentInChild in ((Component)((Component)((ActorController)FpsActorController.instance).actor.activeWeapon).transform).GetComponentInChildren<Transform>())
					{
						Transform val3 = componentInChild;
						if (!dictionary2.ContainsKey(val3))
						{
							localRotation = val3.localRotation;
							dictionary2.Add(val3, new Tuple<Vector3, Vector3>(((Quaternion)(ref localRotation)).eulerAngles, val3.localPosition));
						}
					}
					bones = dictionary2;
				}
				if (((Vector3)(ref averageDelta)).sqrMagnitude > 0.1f)
				{
					shakeCoil.AddVelocity(averageDelta);
				}
				else
				{
					averageDelta = Vector3.zero;
				}
				float num = ((((Vector3)(ref val)).magnitude < ((Vector3)(ref averageDelta)).magnitude) ? (Mathf.Pow(2f, Vector3.Distance(averageDelta, Vector3.zero) * -0.4f - 6f) * 400f + 1f) : 1f);
				float num2;
				Vector3 val4;
				if (!((double)((Vector3)(ref val)).magnitude > 0.2))
				{
					num2 = 1f;
				}
				else
				{
					val4 = averageDelta - val;
					num2 = Mathf.Log10(Mathf.Abs(((Vector3)(ref val4)).magnitude + 1f)) + 2.3f;
				}
				float num3 = num2;
				float num4 = RealDelta() * num3 * num / 4f;
				averageDelta = Vector3.Lerp(averageDelta, val, num4);
				ravenCoil.Update();
				shakeCoil.Update();
				swayAmount = Mathf.Lerp(swayAmount, SteelInput.GetAxis((KeyBinds)0), RealDelta() * 2f);
				((Component)__instance.weaponParent).transform.localEulerAngles = ((Component)__instance.weaponParent).transform.localEulerAngles + Vector3.back * (0f - swayAmount) * 6f;
				lastSnap = Mathf.Lerp(lastSnap, GetSnap(__instance), RealDelta() * 10f);
				slideTilt = Mathf.Lerp(slideTilt, (float)((!SmoothMovementPatch2.slidingAction.Done()) ? 1 : 0), RealDelta() * 3f);
				wallTilt = Mathf.Lerp(wallTilt, SmoothMovementPatch2.wallTilt, RealDelta() * 3f);
				__instance.fpCameraParent.localEulerAngles = __instance.fpCameraParent.localEulerAngles + Vector3.back * (0f - swayAmount) * 2f + __instance.GetSpringLocalEuler(true) / 2f * instance.cameraSwing.Value + new Vector3(lastSnap * -6f * instance.cameraSnap.Value, 0f, 0f) + ravenCoil.position + shakeCoil.position * 0.8f * instance.cameraParkinsons.Value + Vector3.back * slideTilt * -5f + wallTilt * Vector3.back * -20f;
				if (__instance.fpCameraParent.localEulerAngles.x == float.NaN || __instance.fpCameraParent.localEulerAngles.y == float.NaN || __instance.fpCameraParent.localEulerAngles.z == float.NaN)
				{
					Debug.Log((object)"SHITE");
				}
				Transform transform = ((Component)__instance.weaponParent).transform;
				transform.localEulerAngles += Vector3.back * slideTilt * -20f;
				FirstPersonController component = ((Component)FpsActorController.instance).GetComponent<FirstPersonController>();
				CharacterController component2 = ((Component)FpsActorController.instance).GetComponent<CharacterController>();
				if (instance.vaulting.Value)
				{
					if (vaultAction.Done())
					{
						Vector3 val5 = __instance.fpCameraParent.position - Vector3.up * 0.6f;
						Vector3 val6 = Extensions.ToGround(__instance.fpCameraParent.forward);
						Bounds bounds = ((Collider)component2).bounds;
						val4 = ((Bounds)(ref bounds)).size;
						RaycastHit val7 = default(RaycastHit);
						if (Physics.SphereCast(val5, 0.3f, val6, ref val7, ((Vector3)(ref val4)).magnitude / 4f, -12945153))
						{
							Vector3 val8 = ((RaycastHit)(ref val7)).point + __instance.fpCameraParent.forward * 0.3f;
							Vector3 val9 = Vector3.up * 1f;
							bounds = ((Collider)component2).bounds;
							Vector3 val10 = val8 + val9 * ((Bounds)(ref bounds)).size.y / 2f;
							Vector3 down = Vector3.down;
							bounds = ((Collider)component2).bounds;
							RaycastHit val11 = default(RaycastHit);
							if (Physics.SphereCast(val10, 0.1f, down, ref val11, ((Bounds)(ref bounds)).size.y * 5f, -12945153))
							{
								float num5 = component2.height / 2f - component2.radius;
								Vector3 val12 = component2.center - Vector3.up * num5;
								Vector3 val13 = component2.center + Vector3.up * num5;
								if (Physics.OverlapCapsule(val12 + ((RaycastHit)(ref val11)).point, val13 + ((RaycastHit)(ref val11)).point, component2.radius, -12945153).Length == 0)
								{
									Vector3 position = PlayerFpParent.instance.fpCameraParent.position;
									((Component)FpsActorController.instance.controller).transform.position = ((RaycastHit)(ref val11)).point;
									((Component)((ActorController)FpsActorController.instance).actor.animator).transform.localPosition = Vector3.zero;
									origPos = PlayerFpParent.instance.fpCameraParent.InverseTransformPoint(position);
									vaultAction.Start();
									PlayerFpParent.instance.KickCamera(Vector3.left * 8f);
								}
							}
						}
					}
					else
					{
						offsetPos = Vector3.Lerp(origPos, Vector3.zero, EasingFunction.EaseOutSine(0f, 1f, vaultAction.Ratio()));
					}
				}
				Transform fpCameraParent = __instance.fpCameraParent;
				fpCameraParent.localPosition += offsetPos;
			}

			public static Vector3 LerpWithoutClamp(Vector3 A, Vector3 B, float t)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				return A + (B - A) * t;
			}

			public static Dictionary<TKey, TValue> CloneDictionaryCloningValues<TKey, TValue>(Dictionary<TKey, TValue> original) where TValue : ICloneable
			{
				Dictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>(original.Count, original.Comparer);
				foreach (KeyValuePair<TKey, TValue> item in original)
				{
					dictionary.Add(item.Key, (TValue)item.Value.Clone());
				}
				return dictionary;
			}
		}

		[HarmonyPatch(typeof(Weapon), "ApplyRecoil")]
		public class BetterRecoilPatch
		{
			public static void Postfix(Weapon __instance)
			{
				//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_0057: 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_0071: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Invalid comparison between Unknown and I4
				//IL_00ba: 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_00c6: 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_00dd: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.UserIsPlayer() || (!__instance.IsMountedWeapon() && !__instance.UserIsAI()))
				{
					float num = (__instance.configuration.auto ? 1.8f : 0.6f);
					Vector3 val = __instance.configuration.kickback * Vector3.back + Random.insideUnitSphere * __instance.configuration.randomKick * 1.4f * __instance.configuration.snapDuration * num;
					if ((int)__instance.user.stance == 2)
					{
						val *= __instance.configuration.kickbackProneMultiplier;
					}
					((Vector3)(ref val))..ctor(val.z, val.x, 0f - val.x);
					CoolTiltingPatch.ravenCoil.AddVelocity(val * 50f);
					CoolTiltingPatch.ravenCoil.distanceCoefficient = __instance.configuration.cooldown / 3f * instance.cameraRecoveryCoefficient.Value;
				}
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "OnJump")]
		public class OnJumpPatch
		{
			public static bool Prefix(FpsActorController __instance)
			{
				//IL_0084: 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)
				//IL_0059: 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_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)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				if (((ActorController)__instance).actor.IsSeated())
				{
					return true;
				}
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0f, 0.2f * instance.jumpScreenShakeMultiplier.Value, 0f);
				if (((ActorController)__instance).IsSprinting())
				{
					Matrix4x4 worldToLocalMatrix = ((Component)__instance.fpCamera).transform.worldToLocalMatrix;
					Vector3 val2 = ((Matrix4x4)(ref worldToLocalMatrix)).MultiplyVector(((ActorController)__instance).Velocity());
					val -= Vector3.ClampMagnitude(val2, 1f);
				}
				__instance.fpParent.ApplyRecoil(val, true);
				SmoothMovementPatch2.wallJumpCooldown.StartLifetime(0.4f);
				return false;
			}
		}

		[HarmonyPatch(typeof(FpsActorController), "OnLand")]
		public class OnLandPatch
		{
			public static bool Prefix(FpsActorController __instance)
			{
				//IL_001e: 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_009e: Unknown result type (might be due to invalid IL or missing references)
				if (((ActorController)__instance).actor.IsSeated())
				{
					return false;
				}
				float num = Mathf.Clamp((0f - ((ActorController)__instance).actor.Velocity().y - 2f) * 0.3f, 0f, 2f) * instance.jumpScreenShakeMultiplier.Value;
				if (((ActorController)__instance).IsSprinting())
				{
					num *= 2f;
				}
				__instance.fpParent.ApplyRecoil(new Vector3(0f, (0f - num) * 0.3f, 0f), true);
				__instance.fpParent.KickCamera(new Vector3(num, 0f, 0f));
				return false;
			}
		}

		[HarmonyPatch(typeof(FirstPersonController), "GetInput")]
		public class SmoothMovementPatch
		{
			private static float beforeSpeed = 1f;

			public static void Postfix(FirstPersonController __instance, out float speed)
			{
				if (instance.tacticalMovement.Value)
				{
					float num = (float)typeof(FirstPersonController).GetField("m_SwamSpeed", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
					bool flag = (bool)typeof(FirstPersonController).GetField("m_IsWalking", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
					float walkSpeed = __instance.m_WalkSpeed;
					walkSpeed = ((!__instance.inWater) ? (flag ? __instance.m_WalkSpeed : __instance.m_RunSpeed) : num);
					speed = Mathf.Lerp(beforeSpeed, walkSpeed, RealDelta() * 5f);
					beforeSpeed = speed;
				}
				else
				{
					float num2 = (float)typeof(FirstPersonController).GetField("m_SwamSpeed", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
					bool flag2 = (bool)typeof(FirstPersonController).GetField("m_IsWalking", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
					if (__instance.inWater)
					{
						speed = num2;
					}
					else
					{
						speed = (flag2 ? __instance.m_WalkSpeed : __instance.m_RunSpeed);
					}
				}
			}
		}

		[HarmonyPatch(typeof(WPlayer), "MoveActor")]
		public class SmoothMovementPatch3
		{
			public static void Prefix(Vector3 delta)
			{
				MoveActorCalled = 1f;
			}
		}

		[HarmonyPatch(typeof(CharacterController), "Move")]
		public class SmoothMovementPatch2
		{
			private static Vector3 beforeSpeed = Vector3.zero;

			private static float playerSpeed = 0f;

			public static TimedActionPlus slidingAction = new TimedActionPlus(2f);

			public static TimedActionPlus wallrunningAction = new TimedActionPlus(5f);

			public static TimedActionPlus wallJumpCooldown = new TimedActionPlus(1f);

			public static TimedActionPlus leaveGroundCooldown = new TimedActionPlus(1f);

			public static Dictionary<Actor, TimedActionPlus> knockOverCooldown = new Dictionary<Actor, TimedActionPlus>();

			private static bool lastAction;

			public static float wallTilt = 0f;

			public static Vector3 slidingVector;

			public static bool wallRunning = false;

			public static bool lastWallRunning = false;

			public static Vector3 extraVelocity = Vector3.zero;

			public static float origGravity = 1.2f;

			public static bool beforeGrounded;

			public static float vaultSpeedMultiplier = 0.8f;

			public float extraSlidePower = 0f;

			public static void Prefix(CharacterController __instance, ref Vector3 motion)
			{
				//IL_03be: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0308: Unknown result type (might be due to invalid IL or missing references)
				//IL_030d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0210: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0462: Unknown result type (might be due to invalid IL or missing references)
				//IL_0472: Unknown result type (might be due to invalid IL or missing references)
				//IL_047c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0490: 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_049f: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0420: Unknown result type (might be due to invalid IL or missing references)
				//IL_0425: Unknown result type (might be due to invalid IL or missing references)
				//IL_042a: Unknown result type (might be due to invalid IL or missing references)
				//IL_076b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0770: Unknown result type (might be due to invalid IL or missing references)
				//IL_0775: Unknown result type (might be due to invalid IL or missing references)
				//IL_077a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0646: Unknown result type (might be due to invalid IL or missing references)
				//IL_064c: Unknown result type (might be due to invalid IL or missing references)
				//IL_066a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0674: Unknown result type (might be due to invalid IL or missing references)
				//IL_0679: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_06a8