Decompiled source of WaterGunImprovements v1.2.0

WaterGunImprovements.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WaterGunImprovements")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WaterGunImprovements")]
[assembly: AssemblyTitle("WaterGunImprovements")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[BepInPlugin("watergun.Improvements", "WaterGunImprovements", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class watergunimprovements : BaseUnityPlugin
{
	public static ConfigEntry<float> IgnitionSuccess;

	public static ConfigEntry<bool> DisableCruiserEjectButton;

	public static ConfigEntry<bool> EnableCruiserColor;

	public static ConfigEntry<Color> CruiserColor;

	private void Awake()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Expected O, but got Unknown
		IgnitionSuccess = ((BaseUnityPlugin)this).Config.Bind<float>("Cruiser", "IgnitionSuccess", 500f, "The chance for the car to ignite in %");
		DisableCruiserEjectButton = ((BaseUnityPlugin)this).Config.Bind<bool>("Cruiser", "DisableCruiserEjectButton", true, "Should disable cruiser eject button?");
		CruiserColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Cruiser", "CruiserColor", Color.green, "Set Cruiser color");
		EnableCruiserColor = ((BaseUnityPlugin)this).Config.Bind<bool>("Cruiser", "EnableCruiserColor", true, "Should enable cruisercolor?");
		Mathf.Clamp(IgnitionSuccess.Value, 1f, 500f);
		Harmony val = new Harmony("watergun.Improvements");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"WaterGunImprovements Loaded!!!");
	}
}
[HarmonyPatch(typeof(VehicleController), "Awake")]
internal class patch_cruiser
{
	private static void Postfix(VehicleController __instance)
	{
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		FieldInfo fieldInfo = AccessTools.Field(typeof(VehicleController), "chanceToStartIgnition");
		fieldInfo.SetValue(__instance, watergunimprovements.IgnitionSuccess.Value);
		if (watergunimprovements.DisableCruiserEjectButton.Value)
		{
			Transform obj = ((Component)__instance).transform.Find("Triggers/ButtonAnimContainer");
			if (obj != null)
			{
				((Component)obj).gameObject.SetActive(false);
			}
		}
		if (watergunimprovements.EnableCruiserColor.Value)
		{
			Transform obj2 = ((Component)__instance).transform.Find("Meshes/MainBody");
			MeshRenderer val = ((obj2 != null) ? ((Component)obj2).GetComponent<MeshRenderer>() : null);
			Transform obj3 = ((Component)__instance).transform.Find("Meshes/MainBody/MainBody (1)");
			MeshRenderer val2 = ((obj3 != null) ? ((Component)obj3).GetComponent<MeshRenderer>() : null);
			Transform obj4 = ((Component)__instance).transform.Find("Meshes/MainBody/MainBody (2)");
			MeshRenderer val3 = ((obj4 != null) ? ((Component)obj4).GetComponent<MeshRenderer>() : null);
			Transform obj5 = ((Component)__instance).transform.Find("Meshes/DoorLeftContainer/Door");
			MeshRenderer val4 = ((obj5 != null) ? ((Component)obj5).GetComponent<MeshRenderer>() : null);
			Transform obj6 = ((Component)__instance).transform.Find("Meshes/DoorRightContainer/Door");
			MeshRenderer val5 = ((obj6 != null) ? ((Component)obj6).GetComponent<MeshRenderer>() : null);
			Transform obj7 = ((Component)__instance).transform.Find("Meshes/CarHoodContainer/CarHoodMesh");
			MeshRenderer val6 = ((obj7 != null) ? ((Component)obj7).GetComponent<MeshRenderer>() : null);
			Transform obj8 = ((Component)__instance).transform.Find("Meshes/DriverSeatContainer/Seat/DriverSeat");
			MeshRenderer val7 = ((obj8 != null) ? ((Component)obj8).GetComponent<MeshRenderer>() : null);
			Material[] materials = ((Renderer)val).materials;
			Material[] materials2 = ((Renderer)val2).materials;
			Material[] materials3 = ((Renderer)val3).materials;
			Material[] materials4 = ((Renderer)val4).materials;
			Material[] materials5 = ((Renderer)val5).materials;
			Material[] materials6 = ((Renderer)val6).materials;
			Material[] materials7 = ((Renderer)val7).materials;
			materials[0].color = watergunimprovements.CruiserColor.Value;
			materials2[0].color = watergunimprovements.CruiserColor.Value;
			materials3[0].color = watergunimprovements.CruiserColor.Value;
			materials4[0].color = watergunimprovements.CruiserColor.Value;
			materials5[0].color = watergunimprovements.CruiserColor.Value;
			materials6[0].color = watergunimprovements.CruiserColor.Value;
			materials7[0].color = watergunimprovements.CruiserColor.Value;
		}
	}
}