Decompiled source of Uruk Hai Weaponry v1.0.0

Uruk_Hai_Weaponry.dll

Decompiled 10 months ago
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using OtherLoader;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
	public bool OnlyDeactivate;

	private void OnEnable()
	{
		((MonoBehaviour)this).StartCoroutine("CheckIfAlive");
	}

	private IEnumerator CheckIfAlive()
	{
		do
		{
			yield return (object)new WaitForSeconds(0.5f);
		}
		while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true));
		if (OnlyDeactivate)
		{
			((Component)this).gameObject.SetActive(false);
		}
		else
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(Light))]
public class CFX_LightIntensityFade : MonoBehaviour
{
	public float duration = 1f;

	public float delay = 0f;

	public float finalIntensity = 0f;

	private float baseIntensity;

	public bool autodestruct;

	private float p_lifetime = 0f;

	private float p_delay;

	private void Start()
	{
		baseIntensity = ((Component)this).GetComponent<Light>().intensity;
	}

	private void OnEnable()
	{
		p_lifetime = 0f;
		p_delay = delay;
		if (delay > 0f)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = false;
		}
	}

	private void Update()
	{
		if (p_delay > 0f)
		{
			p_delay -= Time.deltaTime;
			if (p_delay <= 0f)
			{
				((Behaviour)((Component)this).GetComponent<Light>()).enabled = true;
			}
		}
		else if (p_lifetime / duration < 1f)
		{
			((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration);
			p_lifetime += Time.deltaTime;
		}
		else if (autodestruct)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
[RequireComponent(typeof(MeshFilter))]
public class WFX_BulletHoleDecal : MonoBehaviour
{
	private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4]
	{
		new Vector2(0f, 0f),
		new Vector2(0f, 1f),
		new Vector2(1f, 0f),
		new Vector2(1f, 1f)
	};

	public float lifetime = 10f;

	public float fadeoutpercent = 80f;

	public Vector2 frames;

	public bool randomRotation = false;

	public bool deactivate = false;

	private float life;

	private float fadeout;

	private Color color;

	private float orgAlpha;

	private void Awake()
	{
		//IL_0012: 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)
		color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor");
		orgAlpha = color.a;
	}

	private void OnEnable()
	{
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		int num = Random.Range(0, (int)(frames.x * frames.y));
		int num2 = (int)((float)num % frames.x);
		int num3 = (int)((float)num / frames.y);
		Vector2[] array = (Vector2[])(object)new Vector2[4];
		for (int i = 0; i < 4; i++)
		{
			array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x);
			array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y);
		}
		((Component)this).GetComponent<MeshFilter>().mesh.uv = array;
		if (randomRotation)
		{
			((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1);
		}
		life = lifetime;
		fadeout = life * (fadeoutpercent / 100f);
		color.a = orgAlpha;
		((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine("holeUpdate");
	}

	private IEnumerator holeUpdate()
	{
		while (life > 0f)
		{
			life -= Time.deltaTime;
			if (life <= fadeout)
			{
				color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout);
				((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color);
			}
			yield return null;
		}
	}
}
[RequireComponent(typeof(Light))]
public class WFX_LightFlicker : MonoBehaviour
{
	public float time = 0.05f;

	private float timer;

	private void Start()
	{
		timer = time;
		((MonoBehaviour)this).StartCoroutine("Flicker");
	}

	private IEnumerator Flicker()
	{
		while (true)
		{
			((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled;
			do
			{
				timer -= Time.deltaTime;
				yield return null;
			}
			while (timer > 0f);
			timer = time;
		}
	}
}
namespace Andrew_FTW.Uruk_Hai_Weaponry;

[BepInPlugin("Andrew_FTW.Uruk_Hai_Weaponry", "Uruk_Hai_Weaponry", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Uruk_Hai_WeaponryPlugin : BaseUnityPlugin
{
	private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	internal static ManualLogSource Logger;

	private void Awake()
	{
		Logger = ((BaseUnityPlugin)this).Logger;
		LoadAssets();
	}

	private void LoadAssets()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Andrew_FTW.Uruk_Hai_Weaponry");
		OtherLoader.RegisterDirectLoad(BasePath, "Andrew_FTW.Uruk_Hai_Weaponry", "", "", "", "urukweps");
	}
}
[ExecuteInEditMode]
public class NightVisionPostEffect : MonoBehaviour
{
	public Material nightVisionMat;

	public Material bloom;

	public bool renderNightVision = true;

	public bool renderBloom = true;

	[Range(1f, 16f)]
	public int iterations = 1;

	private const int BoxDownPrefilterPass = 0;

	private const int BoxDownPass = 1;

	private const int BoxUpPass = 2;

	private const int ApplyBloomPass = 3;

	private RenderTexture[] textures = (RenderTexture[])(object)new RenderTexture[16];

	private void OnRenderImage(RenderTexture src, RenderTexture dest)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
		int num = ((Texture)src).width / 2;
		int num2 = ((Texture)src).height / 2;
		RenderTextureFormat format = src.format;
		RenderTexture val = RenderTexture.GetTemporary(num, num2, 0, format);
		if (renderNightVision)
		{
			Graphics.Blit((Texture)(object)src, val, nightVisionMat);
		}
		else
		{
			val = src;
		}
		if (!renderBloom)
		{
			Graphics.Blit((Texture)(object)val, dest);
			RenderTexture.ReleaseTemporary(val);
			return;
		}
		RenderTexture val2 = (textures[0] = RenderTexture.GetTemporary(num, num2, 0, format));
		Graphics.Blit((Texture)(object)val, val2, bloom, 0);
		RenderTexture val3 = val2;
		for (int i = 1; i < iterations; i++)
		{
			num /= 2;
			num2 /= 2;
			if (num2 < 2)
			{
				break;
			}
			val2 = (textures[i] = RenderTexture.GetTemporary(num, num2, 0, format));
			Graphics.Blit((Texture)(object)val3, val2, bloom, 1);
			val3 = val2;
		}
		for (int num3 = iterations - 2; num3 >= 0; num3--)
		{
			val2 = textures[num3];
			textures[num3] = null;
			Graphics.Blit((Texture)(object)val3, val2, bloom, 2);
			RenderTexture.ReleaseTemporary(val3);
			val3 = val2;
		}
		bloom.SetTexture("_SourceTex", (Texture)(object)val);
		Graphics.Blit((Texture)(object)val3, dest, bloom, 3);
		RenderTexture.ReleaseTemporary(val3);
		RenderTexture.ReleaseTemporary(val);
	}
}