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 ValkyrieWeapons v0.0.1
plugins/ValkyrieWeapons.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; 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 Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ValkyrieWeapons")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ValkyrieWeapons")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c8f59af6-eaf4-43a6-a271-9de27f69a218")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ValkyrieWeapons; [BepInPlugin("com.valkyrie.weapons", "Valkyrie's Weapons", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ValkyrieWeapons : BaseUnityPlugin { [HarmonyPatch] private class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(Attack), "Start")] private static void Attack_StartPatch(Attack __instance, Humanoid character) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.m_localPlayer == (Object)null) && ((Character)character).IsPlayer()) { ItemDrop component = PrefabManager.Instance.GetPrefab("QP_DruidStaff").GetComponent<ItemDrop>(); if (!(character.GetCurrentWeapon()?.m_shared.m_name != component.m_itemData.m_shared.m_name)) { bool flag = (int)((object)__instance).GetType()?.GetField("m_currentAttackCainLevel", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(__instance) % 2 == 0; PrefabManager.Instance.GetPrefab("QP_DruidStaff_HolySlash_heal_aoe").transform.Find("slash").eulerAngles = new Vector3(0f, flag ? 90f : 0f, flag ? 180f : 0f); } } } } public const string PluginGUID = "com.valkyrie.weapons"; public const string PluginName = "Valkyrie's Weapons"; public const string PluginVersion = "0.0.1"; private bool addedPrefabs; private static SkillType HealingSkill = (SkillType)0; public static CustomLocalization Localization; public static AssetBundle bundle; public static GameObject[] assets; public static List<GameObject> weapons = new List<GameObject>(); public static List<StatusEffect> statusEffects = new List<StatusEffect>(); public static Dictionary<string, GameObject> vfx = new Dictionary<string, GameObject>(); private static readonly string pluginPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); private static readonly string configPath = Paths.ConfigPath; private static Harmony harm = new Harmony("ValkyrieWeapons"); private void Awake() { bundle = AssetUtils.LoadAssetBundleFromResources("weapons"); assets = bundle.LoadAllAssets<GameObject>(); PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; harm.PatchAll(); AddHealingSkill(); } private void AddHealingSkill() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0043: 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) SkillConfig val = new SkillConfig { Identifier = "com.valkyrie.weapons.healing", Name = "Healing", Description = "Enhances healing weapons", IconPath = "healing-sprite.png", IncreaseStep = 1f }; HealingSkill = SkillManager.Instance.AddSkill(val); } private void OnVanillaPrefabsAvailable() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown if (addedPrefabs) { return; } GameObject[] array = assets; foreach (GameObject val in array) { if ((Object)(object)val.GetComponent<ItemDrop>() != (Object)null) { weapons.Add(val); } else { PrefabManager.Instance.AddPrefab(val); } } AddVFX(); AddStatusEffects(); foreach (GameObject weapon in weapons) { ItemConfig val2 = new ItemConfig(); val2.Enabled = true; val2.CraftingStation = CraftingStations.None; val2.Name = ((Object)weapon).name; val2.Icon = RenderManager.Instance.Render(weapon, RenderManager.IsometricRotation); val2.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Item = "SwordCheat", Amount = 9999 } }; CustomItem val3 = new CustomItem(weapon, false, val2); SetupStats(weapon); ItemManager.Instance.AddItem(val3); Debug.Log((object)("Added Weapon: " + ((Object)weapon).name)); } addedPrefabs = true; } private void AddVFX() { AddHealingAuraVFX(); } private void AddHealingAuraVFX() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = PrefabManager.Instance.GetPrefab("vfx_QP_Healing"); ParticleSystem component = prefab.GetComponent<ParticleSystem>(); MainModule main = component.main; ShapeModule shape = component.shape; ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime; ((ShapeModule)(ref shape)).radius = 0.6f; ((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.2f); Color val = default(Color); ((Color)(ref val))..ctor(5f, 255f, 0f, 67f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val); MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; ((MinMaxGradient)(ref color)).gradient.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.2f), new GradientAlphaKey(0f, 1f) }; color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; ((MinMaxGradient)(ref color)).gradient.colorKeys = (GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(Color.clear, 0f), new GradientColorKey(val, 0.2f), new GradientColorKey(val, 1f) }; vfx.Add("HealingAura", prefab); } private void AddStatusEffects() { AddHealingAuraSE(); AddHolyGroundSE(); } private void AddHealingAuraSE() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00c0: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown SE_Stats obj = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)obj).name = "Healing Aura"; ((StatusEffect)obj).m_name = "Healing Aura"; Texture2D val = new Texture2D(24, 24); Rect val2 = default(Rect); ((Rect)(ref val2)).width = 10f; ((Rect)(ref val2)).height = 10f; ((StatusEffect)obj).m_icon = Sprite.Create(val, val2, default(Vector2)); ((StatusEffect)obj).m_startMessageType = (MessageType)1; ((StatusEffect)obj).m_startMessage = "Healing Aura"; ((StatusEffect)obj).m_stopMessageType = (MessageType)1; ((StatusEffect)obj).m_stopMessage = "Healing Aura expired"; obj.m_healthOverTime = 20f; obj.m_healthOverTimeInterval = 0.5f; ((StatusEffect)obj).m_ttl = 4f; EffectData[] array = (EffectData[])(object)new EffectData[1]; EffectData val3 = new EffectData { m_prefab = GeneralExtensions.GetValueSafe<string, GameObject>(vfx, "HealingAura"), m_enabled = true, m_attach = true, m_inheritParentRotation = false, m_variant = -1, m_scale = true }; array[0] = val3; ((StatusEffect)obj).m_startEffects.m_effectPrefabs = array; CustomStatusEffect val4 = new CustomStatusEffect((StatusEffect)(object)obj, false); statusEffects.Add(val4.StatusEffect); ItemManager.Instance.AddStatusEffect(val4); } private void AddHolyGroundSE() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00c0: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown SE_Stats obj = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)obj).name = "Holy Ground"; ((StatusEffect)obj).m_name = "Holy Ground"; Texture2D val = new Texture2D(24, 24); Rect val2 = default(Rect); ((Rect)(ref val2)).width = 10f; ((Rect)(ref val2)).height = 10f; ((StatusEffect)obj).m_icon = Sprite.Create(val, val2, default(Vector2)); ((StatusEffect)obj).m_startMessageType = (MessageType)1; ((StatusEffect)obj).m_startMessage = "Holy Ground"; ((StatusEffect)obj).m_stopMessageType = (MessageType)1; ((StatusEffect)obj).m_stopMessage = "Exited Holy Ground"; obj.m_healthOverTime = 20f; obj.m_healthOverTimeInterval = 0.5f; ((StatusEffect)obj).m_ttl = 0.1f; EffectData[] array = (EffectData[])(object)new EffectData[1]; EffectData val3 = new EffectData { m_prefab = GeneralExtensions.GetValueSafe<string, GameObject>(vfx, "HealingAura"), m_enabled = true, m_attach = true, m_inheritParentRotation = false, m_variant = -1, m_scale = true }; array[0] = val3; ((StatusEffect)obj).m_startEffects.m_effectPrefabs = array; CustomStatusEffect val4 = new CustomStatusEffect((StatusEffect)(object)obj, false); statusEffects.Add(val4.StatusEffect); ItemManager.Instance.AddStatusEffect(val4); } private void SetupStats(GameObject prefab) { if (((Object)prefab).name == "QP_DruidStaff") { SetupDruidStaff(prefab); } } private void SetupDruidStaff(GameObject prefab) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) SharedData shared = prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_skillType = HealingSkill; shared.m_itemType = (ItemType)3; shared.m_attackStatusEffect = GetStatusEffect("Healing Aura"); shared.m_attack.m_attackType = (AttackType)2; shared.m_attack.m_attackAnimation = "swing_axe"; shared.m_attack.m_attackChainLevels = 3; shared.m_attack.m_launchAngle = -15f; shared.m_attack.m_destroyPreviousProjectile = true; shared.m_attack.m_attackEitr = 20f; GameObject prefab2 = PrefabManager.Instance.GetPrefab("QP_DruidStaff_HolySlash_heal_aoe"); prefab2.transform.Find("collider").localScale = new Vector3(2.5f, 0.2f, 2.5f); prefab2.transform.Find("slash").localScale = new Vector3(1f, 1f, 1f); Aoe component = prefab2.GetComponent<Aoe>(); component.m_useAttackSettings = false; component.m_statusEffect = "Healing Aura"; component.m_hitOwner = false; component.m_hitEnemy = false; component.m_ttl = 1f; GameObject prefab3 = PrefabManager.Instance.GetPrefab("QP_DruidStaff_HolyGround_aoe"); Aoe component2 = prefab3.GetComponent<Aoe>(); component2.m_useAttackSettings = false; component2.m_statusEffect = "Holy Ground"; component2.m_hitEnemy = false; component2.m_radius = 7f; component2.m_ttl = 10f; component2.m_hitInterval = 0.1f; shared.m_secondaryAttack.m_attackProjectile = prefab3; shared.m_secondaryAttack.m_attackAngle = 0f; shared.m_secondaryAttack.m_useCharacterFacing = true; shared.m_secondaryAttack.m_useCharacterFacingYAim = false; shared.m_secondaryAttack.m_destroyPreviousProjectile = true; shared.m_secondaryAttack.m_attackEitr = 30f; } private static StatusEffect GetStatusEffect(string name) { return statusEffects.Find((StatusEffect se) => ((Object)se).name == name); } }