Decompiled source of OdinsWrath v1.0.0

Odin's_Wrath.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
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("Valheim Mod Sword")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Valheim Mod Sword")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e01ef2d0-c72e-4083-badc-9c24fa00b4ff")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OdinsWrathMod;

[BepInPlugin("MR_Frank", "OdinsWrathMod", "1.0.0")]
[BepInProcess("valheim.exe")]
public class OdinsWrathPlugin : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("MR_Frank");

	public const string ModName = "Odin's Wrath";

	public const string ModVersion = "1.0.0";

	private const string BasePrefab = "SwordDyrnwyn";

	private const string NewPrefab = "OdinsWrath";

	private void Awake()
	{
		harmony.PatchAll();
		PrefabManager.OnVanillaPrefabsAvailable += CreateOdinsWrath;
	}

	private void CreateOdinsWrath()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Expected O, but got Unknown
		ItemConfig val = new ItemConfig
		{
			Name = "Odin's Wrath",
			Description = "The legendary Dyrnwyn — once shattered, then reforged — was chosen by the Allfather himself, empowered and renamed in the image of his wrath.The flames that once raged around the blade have been absorbed into its core, turning the sword into an instrument of absolute annihilation, capable of incinerating and erasing from existence all that it touches.",
			CraftingStation = CraftingStations.BlackForge,
			MinStationLevel = 2,
			RepairStation = CraftingStations.BlackForge,
			Enabled = true
		};
		val.AddRequirement("SwordDyrnwyn", 1, 1);
		val.AddRequirement("TrophyEikthyr", 10, 1);
		val.AddRequirement("TrophyTheElder", 10, 1);
		val.AddRequirement("TrophyBonemass", 10, 1);
		val.AddRequirement("TrophyDragonQueen", 10, 1);
		val.AddRequirement("TrophyGoblinKing", 10, 1);
		val.AddRequirement("TrophySeekerQueen", 10, 1);
		val.AddRequirement("TrophyFader", 10, 1);
		CustomItem val2 = new CustomItem("OdinsWrath", "SwordDyrnwyn", val);
		ItemManager.Instance.AddItem(val2);
		ApplyWeaponStats(val2.ItemDrop);
		RemoveFireVfx(val2.ItemPrefab);
		PrefabManager.OnVanillaPrefabsAvailable -= CreateOdinsWrath;
	}

	private void Update()
	{
	}

	private static void ApplyWeaponStats(ItemDrop itemDrop)
	{
		SharedData shared = itemDrop.m_itemData.m_shared;
		shared.m_maxQuality = 4;
		shared.m_damages.m_blunt = 175f;
		shared.m_damages.m_pierce = 175f;
		shared.m_damages.m_slash = 175f;
		shared.m_damages.m_fire = 75f;
		shared.m_damages.m_poison = 75f;
		shared.m_damages.m_frost = 75f;
		shared.m_damages.m_spirit = 75f;
		shared.m_damages.m_lightning = 75f;
		shared.m_damagesPerLevel.m_blunt = 25f;
		shared.m_damagesPerLevel.m_pierce = 25f;
		shared.m_damagesPerLevel.m_slash = 25f;
		shared.m_damagesPerLevel.m_fire = 25f;
		shared.m_damagesPerLevel.m_poison = 25f;
		shared.m_damagesPerLevel.m_frost = 25f;
		shared.m_damagesPerLevel.m_spirit = 25f;
		shared.m_damagesPerLevel.m_lightning = 25f;
	}

	private static void RemoveFireVfx(GameObject root)
	{
		if ((Object)(object)root == (Object)null)
		{
			return;
		}
		ParticleSystem[] componentsInChildren = root.GetComponentsInChildren<ParticleSystem>(true);
		ParticleSystem[] array = componentsInChildren;
		foreach (ParticleSystem val in array)
		{
			string text = ((Object)((Component)val).gameObject).name.ToLowerInvariant();
			if (text.Contains("fire") || text.Contains("flame") || text.Contains("ember") || text.Contains("burn"))
			{
				((Component)val).gameObject.SetActive(false);
			}
		}
		Light[] componentsInChildren2 = root.GetComponentsInChildren<Light>(true);
		Light[] array2 = componentsInChildren2;
		foreach (Light val2 in array2)
		{
			string text2 = ((Object)((Component)val2).gameObject).name.ToLowerInvariant();
			if (text2.Contains("fire") || text2.Contains("flame") || text2.Contains("ember") || text2.Contains("burn"))
			{
				((Behaviour)val2).enabled = false;
			}
		}
		TrailRenderer[] componentsInChildren3 = root.GetComponentsInChildren<TrailRenderer>(true);
		TrailRenderer[] array3 = componentsInChildren3;
		foreach (TrailRenderer val3 in array3)
		{
			string text3 = ((Object)((Component)val3).gameObject).name.ToLowerInvariant();
			if (text3.Contains("fire") || text3.Contains("flame") || text3.Contains("ember") || text3.Contains("burn"))
			{
				((Renderer)val3).enabled = false;
			}
		}
	}
}