Decompiled source of RadiantLunesword v2.0.0

BepInEx/plugins/AeehyehssReeper-RadiantLunesword/ReepusSworb.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
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(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace ReepusSworb
{
	public class SwordParticleController : MonoBehaviour
	{
		public ParticleSystem secondaryParticles;

		public ParticleSystem primaryParticles;

		public ParticleSystem bladeParticles;

		private Humanoid wielder;

		private MeleeWeaponTrail trail;

		public void Start()
		{
			Transform root = ((Component)this).transform.root;
			object obj;
			if (root == null)
			{
				obj = null;
			}
			else
			{
				GameObject gameObject = ((Component)root).gameObject;
				obj = ((gameObject != null) ? gameObject.GetComponent<Humanoid>() : null);
			}
			wielder = (Humanoid)obj;
			Transform parent = ((Component)this).transform.parent;
			trail = ((parent != null) ? ((Component)parent).gameObject.GetComponent<MeleeWeaponTrail>() : null);
		}

		public void OnDisable()
		{
			wielder = null;
			trail = null;
		}

		public void FixedUpdate()
		{
			if (!((Object)(object)trail == (Object)null) && !((Object)(object)wielder == (Object)null))
			{
				bool flag = wielder?.m_currentAttack?.m_attackAnimation == "greatsword_secondary";
				if (trail._emit && flag && secondaryParticles.particleCount < 1)
				{
					secondaryParticles.Emit(15);
				}
				else if (!flag && primaryParticles.particleCount < 1 && (trail._emit || ((Character)wielder).m_attack))
				{
					bladeParticles.Emit(1);
					primaryParticles.Emit(1);
				}
			}
		}
	}
}
namespace ReepusSword
{
	[BepInPlugin("ReepusDelmeepusSword", "RadiantClaymore", "2.0.0")]
	public class ReepusDeepusDelmeepusSworb : BaseUnityPlugin
	{
		private const string ModName = "RadiantClaymore";

		private const string ModGUID = "ReepusDelmeepusSword";

		private const string ModVersion = "2.0.0";

		private Assembly assembly;

		public static readonly ManualLogSource SworbLogger = Logger.CreateLogSource("RadiantClaymore");

		public void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			assembly = Assembly.GetExecutingAssembly();
			AssetBundle val = AssetUtils.LoadAssetBundleFromResources("asword", assembly);
			GameObject val2 = val.LoadAsset<GameObject>("THReepusSword");
			ItemConfig val3 = new ItemConfig();
			val3.Name = "Radiant Lunesword";
			val3.CraftingStation = CraftingStations.BlackForge;
			val3.Description = "A strange blade pried from the deep. Frozen threads of light swirl across its surface in inscrutable patterns.";
			val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[4]
			{
				new RequirementConfig
				{
					Item = "Silver",
					Amount = 55,
					AmountPerLevel = 10,
					Recover = true
				},
				new RequirementConfig
				{
					Item = "GemstoneBlue",
					Amount = 1,
					AmountPerLevel = 0,
					Recover = true
				},
				new RequirementConfig
				{
					Item = "Eitr",
					Amount = 15,
					AmountPerLevel = 3,
					Recover = true
				},
				new RequirementConfig
				{
					Item = "BlackCore",
					Amount = 1,
					AmountPerLevel = 0,
					Recover = true
				}
			};
			CustomItem val4 = new CustomItem(val2, false, val3);
			ItemManager.Instance.AddItem(val4);
			PrefabManager.OnVanillaPrefabsAvailable += SetStuff;
			Harmony.CreateAndPatchAll(assembly, (string)null);
		}

		private static void SetStuff()
		{
			string text = "THSwordKrom";
			string text2 = "AtgeirHimminAfl";
			string text3 = "THReepusSword";
			GameObject prefab = PrefabManager.Instance.GetPrefab(text);
			SharedData val = ((prefab == null) ? null : prefab.GetComponent<ItemDrop>()?.m_itemData?.m_shared);
			GameObject prefab2 = PrefabManager.Instance.GetPrefab(text2);
			SharedData val2 = ((prefab2 == null) ? null : prefab2.GetComponent<ItemDrop>()?.m_itemData?.m_shared);
			GameObject prefab3 = PrefabManager.Instance.GetPrefab(text3);
			if ((Object)(object)prefab3 == (Object)null || val == null || val2 == null)
			{
				SworbLogger.LogWarning((object)"Could not replace effects, sworb will be sad.");
				return;
			}
			SharedData shared = prefab3.GetComponent<ItemDrop>().m_itemData.m_shared;
			shared.m_triggerEffect.m_effectPrefabs = val.m_triggerEffect.m_effectPrefabs;
			shared.m_trailStartEffect.m_effectPrefabs = val.m_trailStartEffect.m_effectPrefabs;
			shared.m_blockEffect.m_effectPrefabs = val.m_blockEffect.m_effectPrefabs;
			shared.m_hitEffect.m_effectPrefabs = val.m_hitEffect.m_effectPrefabs.Concat(val2.m_attack.m_hitEffect.m_effectPrefabs).ToArray();
			PrefabManager.OnVanillaPrefabsAvailable -= SetStuff;
		}
	}
}