Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DyrnwynGreatsword v1.0.0
DyrnwynGreatsword.dll
Decompiled 6 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("DyrnwynGreatsword")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DyrnwynGreatsword")] [assembly: AssemblyTitle("DyrnwynGreatsword")] [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 DyrnwynGreatsword { [BepInPlugin("com.dyrnwyngreatsword", "DyrnwynGreatsword", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "com.dyrnwyngreatsword"; public const string PluginName = "DyrnwynGreatsword"; public const string PluginVersion = "1.0.0"; internal const string ItemName = "SwordDyrnwynGreatsword"; private const string SourceSword = "SwordDyrnwyn"; private const string SourceGreatsword = "THSwordSlayer"; internal static ManualLogSource Log; internal static ConfigEntry<bool> CraftingEnabled; private const float DamageMultiplier = 1.25f; private const float ModelScale = 1.25f; private const float GripShift = -0.037f; private static ItemDrop _item; private static DamageTypes _baseDamage; private static Vector3[] _childPositions; private static Recipe _recipe; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ConfigurationManagerAttributes val = new ConfigurationManagerAttributes { IsAdminOnly = true }; CraftingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CraftingEnabled", true, new ConfigDescription("The two-handed Dyrnwyn can be crafted (next to the normal one, from the same materials).", (AcceptableValueBase)null, new object[1] { val })); CraftingEnabled.SettingChanged += delegate { ApplySettings(); }; PrefabManager.OnVanillaPrefabsAvailable += CreateItem; ItemManager.OnItemsRegistered += AddRecipe; ((BaseUnityPlugin)this).Logger.LogInfo((object)"DyrnwynGreatsword 1.0.0 loaded"); } private static void CreateItem() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) PrefabManager.OnVanillaPrefabsAvailable -= CreateItem; GameObject prefab = PrefabManager.Instance.GetPrefab("THSwordSlayer"); if ((Object)(object)prefab == (Object)null || (Object)(object)PrefabManager.Instance.GetPrefab("SwordDyrnwyn") == (Object)null) { Log.LogError((object)"SwordDyrnwyn or THSwordSlayer not found; the two-handed Dyrnwyn is not added."); return; } ItemConfig val = new ItemConfig { Name = "Dyrnwyn Greatsword", Description = "The fabled blade, reforged to be wielded with both hands." }; CustomItem val2 = new CustomItem("SwordDyrnwynGreatsword", "SwordDyrnwyn", val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; SharedData shared2 = prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_itemType = (ItemType)14; shared.m_animationState = shared2.m_animationState; shared.m_attack = shared2.m_attack.Clone(); shared.m_secondaryAttack = shared2.m_secondaryAttack.Clone(); shared.m_attackForce = shared2.m_attackForce; shared.m_blockPower = shared2.m_blockPower; shared.m_blockPowerPerLevel = shared2.m_blockPowerPerLevel; shared.m_deflectionForce = shared2.m_deflectionForce; shared.m_deflectionForcePerLevel = shared2.m_deflectionForcePerLevel; shared.m_timedBlockBonus = shared2.m_timedBlockBonus; shared.m_equipDuration = shared2.m_equipDuration; _item = val2.ItemDrop; _baseDamage = ((DamageTypes)(ref shared.m_damages)).Clone(); Transform val3 = ((Component)_item).transform.Find("attach"); if ((Object)(object)val3 != (Object)null) { _childPositions = (Vector3[])(object)new Vector3[val3.childCount]; for (int i = 0; i < val3.childCount; i++) { _childPositions[i] = val3.GetChild(i).localPosition; } } ItemManager.Instance.AddItem(val2); ApplySettings(); Log.LogInfo((object)"Added SwordDyrnwynGreatsword"); } private static void ApplySettings() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0094: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_item != (Object)null) { DamageTypes damages = ((DamageTypes)(ref _baseDamage)).Clone(); ((DamageTypes)(ref damages)).Modify(1.25f); _item.m_itemData.m_shared.m_damages = damages; Transform val = ((Component)_item).transform.Find("attach"); if ((Object)(object)val != (Object)null) { val.localScale = Vector3.one * 1.25f; for (int i = 0; i < val.childCount; i++) { if (_childPositions == null) { break; } if (i >= _childPositions.Length) { break; } val.GetChild(i).localPosition = _childPositions[i] + Vector3.forward * -0.037f; } } } if ((Object)(object)_recipe != (Object)null) { _recipe.m_enabled = CraftingEnabled.Value; } } private static void AddRecipe() { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null || (Object)(object)_item == (Object)null) { return; } Recipe val = null; foreach (Recipe recipe in instance.m_recipes) { if (!((Object)(object)recipe == (Object)null) && !((Object)(object)recipe.m_item == (Object)null)) { if (((Object)recipe.m_item).name == "SwordDyrnwynGreatsword") { _recipe = recipe; ApplySettings(); return; } if (((Object)recipe.m_item).name == "SwordDyrnwyn") { val = recipe; } } } if ((Object)(object)val == (Object)null) { Log.LogWarning((object)"No recipe for SwordDyrnwyn found; the two-handed Dyrnwyn cannot be crafted."); return; } Recipe val2 = Object.Instantiate<Recipe>(val); ((Object)val2).name = "Recipe_SwordDyrnwynGreatsword"; val2.m_item = _item; instance.m_recipes.Add(val2); _recipe = val2; ApplySettings(); Log.LogInfo((object)string.Format("Recipe added: {0} materials at {1}", val2.m_resources.Length, Object.op_Implicit((Object)(object)val2.m_craftingStation) ? val2.m_craftingStation.m_name : "no station")); } } }