Decompiled source of Large WispTorch v1.0.0

plugins\LargeWispTorch\LargeWispTorch.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Large WispTorch")]
[assembly: AssemblyDescription("Adds a large wisp torch to Valheim.")]
[assembly: AssemblyCompany("LEGIOmods")]
[assembly: AssemblyProduct("Large WispTorch")]
[assembly: AssemblyCopyright("Copyright 2026 LEGIOmods")]
[assembly: ComVisible(false)]
[assembly: Guid("7f18856d-7dcb-48d4-b3ea-62d2cc425d49")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI for code, localization, documentation, and package preparation.")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "OpenAI")]
[assembly: AssemblyMetadata("AI_Agent", "OpenAI Codex")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LargeWispTorch
{
	[BepInPlugin("domen.valheim.wisptorchlarge", "Large WispTorch", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class LargeWispTorchPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "domen.valheim.wisptorchlarge";

		public const string PluginName = "Large WispTorch";

		public const string PluginVersion = "1.0.0";

		private const string PrefabName = "piece_wisptorch_large";

		private const string NameToken = "$piece_wisptorch_large";

		private const string DescriptionToken = "$piece_wisptorch_large_description";

		private bool registered;

		private void Awake()
		{
			RegisterLocalizations();
			PrefabManager.OnVanillaPrefabsAvailable += RegisterPiece;
		}

		private void OnDestroy()
		{
			PrefabManager.OnVanillaPrefabsAvailable -= RegisterPiece;
		}

		private static void RegisterLocalizations()
		{
			CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
			string text = "English";
			string text2 = "$piece_wisptorch_large";
			localization.AddTranslation(ref text, ref text2, "Large Wisp Torch");
			text = "English";
			text2 = "$piece_wisptorch_large_description";
			localization.AddTranslation(ref text, ref text2, "A large wisp torch that clears mist across a wide area.");
			text = "German";
			text2 = "$piece_wisptorch_large";
			localization.AddTranslation(ref text, ref text2, "Große Irrlichtfackel");
			text = "German";
			text2 = "$piece_wisptorch_large_description";
			localization.AddTranslation(ref text, ref text2, "Eine große Irrlichtfackel, die Nebel in einem weiten Umkreis vertreibt.");
		}

		private void RegisterPiece()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			if (registered)
			{
				return;
			}
			GameObject val = PrefabManager.Instance.CreateClonedPrefab("piece_wisptorch_large", "piece_groundtorch_mist");
			if (!Object.op_Implicit((Object)(object)val))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Vanilla prefab piece_groundtorch_mist was not found.");
				return;
			}
			Transform transform = val.transform;
			transform.localScale *= 1.25f;
			ParticleSystemForceField[] componentsInChildren = val.GetComponentsInChildren<ParticleSystemForceField>(true);
			foreach (ParticleSystemForceField obj in componentsInChildren)
			{
				obj.startRange *= 3f;
				obj.endRange *= 3f;
			}
			Light[] componentsInChildren2 = val.GetComponentsInChildren<Light>(true);
			foreach (Light obj2 in componentsInChildren2)
			{
				obj2.intensity *= 1.5f;
			}
			PieceManager instance = PieceManager.Instance;
			PieceConfig val2 = new PieceConfig();
			val2.Name = "$piece_wisptorch_large";
			val2.Description = "$piece_wisptorch_large_description";
			val2.PieceTable = "Hammer";
			val2.Category = "Furniture";
			val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig("Wisp", 15, 0, true)
			};
			instance.AddPiece(new CustomPiece(val, false, val2));
			registered = true;
			PrefabManager.OnVanillaPrefabsAvailable -= RegisterPiece;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Large Wisp Torch registered safely through Jotunn.");
		}
	}
}