Decompiled source of Knives Master v4.0.5

ColorPickerKnife.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using SideLoader;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ColorPicker;

[BepInPlugin("ColorPicker.thing", "ColorPicker", "1.0.0")]
public class ColorPicker : BaseUnityPlugin
{
	public const string GUID = "ColorPicker.thing";

	public const string NAME = "ColorPicker";

	public const string VERSION = "1.0.0";

	internal static ManualLogSource Log;

	public static ConfigEntry<bool> ExampleConfig;

	internal void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		SL.OnPacksLoaded += SL_OnPacksLoaded;
	}

	private void SL_OnPacksLoaded()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		Log.LogMessage((object)"SL_OnPacksLoaded :: ColorPicker... Modifying Prefabs!");
		Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(-23033);
		UpdateColorAndPS(itemPrefab, new Color(0f, 0f, 0f), new Color(0f, 0f, 0f, 0f));
		Item itemPrefab2 = ResourcesPrefabManager.Instance.GetItemPrefab(-23034);
		UpdateColorAndPS(itemPrefab2, new Color(0f, 0f, 0f), new Color(0f, 0.2f, 0f, 0f));
	}

	private void UpdateColorAndPS(Item Item, Color LightColor, Color PSColor)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		UpdateLightComponentsOnItem(Item.GetItemVisual(), LightColor);
		UpdateParticleSystemComponentsOnItem(Item.GetItemVisual(), PSColor);
	}

	private void UpdateLightComponentsOnItem(Transform ItemVisual, Color LightColor)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		Light[] componentsInChildren = ((Component)ItemVisual).GetComponentsInChildren<Light>();
		foreach (Light val in componentsInChildren)
		{
			val.color = LightColor;
		}
	}

	private void UpdateParticleSystemComponentsOnItem(Transform ItemVisual, Color PSColor)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: 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)
		ParticleSystem[] componentsInChildren = ((Component)ItemVisual).GetComponentsInChildren<ParticleSystem>();
		foreach (ParticleSystem val in componentsInChildren)
		{
			if (!(((Object)((Component)val).gameObject.transform).name == "ItemHighlight"))
			{
				ParticleSystem val2 = val;
				if ((Object)(object)val2 != (Object)null)
				{
					MainModule main = val2.main;
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(PSColor);
				}
			}
		}
	}
}