Decompiled source of Lightsabers v1.1.2

BepInEx/plugins/Lightsaber/ItemTest.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using LethalLib.Modules;
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("ItemTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ItemTest")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a6c49ce7-8c47-472e-9a14-0488ecb20293")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
public class LightCheck : MonoBehaviour
{
	private MeshRenderer mainRend;

	private Light thisLight;

	private void Start()
	{
		thisLight = ((Component)this).GetComponentInChildren<Light>();
		mainRend = ((Component)this).GetComponentInChildren<MeshRenderer>();
	}

	private void Update()
	{
		((Behaviour)thisLight).enabled = ((Renderer)mainRend).enabled;
	}
}
namespace ModTest;

[BepInPlugin("Mills.ItemTest", "Mod Test", "1.0.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string modGUID = "Mills.ItemTest";

	private const string modName = "Mod Test";

	private const string modVersion = "1.0.0.0";

	internal ManualLogSource nls;

	private static Plugin instance;

	private void Awake()
	{
		if ((Object)(object)instance == (Object)null)
		{
			instance = this;
			nls = Logger.CreateLogSource("Mills.ItemTest");
			nls.LogInfo((object)"Lightsabers awakened!.");
			string[] array = new string[4] { "greenlightsaber", "redlightsaber", "bluelightsaber", "purplelightsaber" };
			string[] array2 = new string[4] { "GreenLightsaber", "RedLightsaber", "BlueLightsaber", "PurpleLightsaber" };
			for (int i = 0; i < 4; i++)
			{
				string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), array[i]);
				AssetBundle val = AssetBundle.LoadFromFile(text);
				string text2 = "Assets/Items/" + array2[i] + ".asset";
				Item val2 = val.LoadAsset<Item>(text2);
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Utilities.FixMixerGroups(val2.spawnPrefab);
				Items.RegisterScrap(val2, 0, (LevelTypes)1);
				TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>();
				val3.clearPreviousText = true;
				val3.displayText = "A f*ckin lightsaber. Unfortunately you haven't been trained to use one so it's no more effective than a mere shovel. It does however glow indefinitely.\n\n";
				Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 40);
				Shovel component = val2.spawnPrefab.GetComponent<Shovel>();
				LightCheck lightCheck = val2.spawnPrefab.AddComponent<LightCheck>();
				nls.LogInfo((object)("Loaded : " + array2[i]));
			}
			nls.LogInfo((object)"Lightsabers loaded!.");
		}
	}
}