Please disclose if your mod was created primarily 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 FehuBows v420.0.2
FehuBows.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using SimpleJson; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FehuBows")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FehuBows")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.4")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] namespace FehuBows; [BepInPlugin("com.jotunn.FehuBows", "FehuBows", "1.0.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class FehuBows : BaseUnityPlugin { public static class FehuBowsConfig { public static ConfigEntry<string> EikthyrbowCraftingStation; public static ConfigEntry<string> EikthyrbowRepairStation; public static ConfigEntry<string> EikthyrbowRequirements; public static ConfigEntry<string> ElderbowCraftingStation; public static ConfigEntry<string> ElderbowRepairStation; public static ConfigEntry<string> ElderbowRequirements; public static ConfigEntry<string> BonemassbowCraftingStation; public static ConfigEntry<string> BonemassbowRepairStation; public static ConfigEntry<string> BonemassbowRequirements; public static ConfigEntry<string> ModerbowCraftingStation; public static ConfigEntry<string> ModerbowRepairStation; public static ConfigEntry<string> ModerbowRequirements; public static ConfigEntry<string> YagluthbowCraftingStation; public static ConfigEntry<string> YagluthbowRepairStation; public static ConfigEntry<string> YagluthbowRequirements; public static ConfigEntry<string> QueenbowCraftingStation; public static ConfigEntry<string> QueenbowRepairStation; public static ConfigEntry<string> QueenbowRequirements; public static ConfigEntry<string> FaderbowCraftingStation; public static ConfigEntry<string> FaderbowRepairStation; public static ConfigEntry<string> FaderbowRequirements; public static void Bind(ConfigFile config) { //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_000f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Expected O, but got Unknown //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Expected O, but got Unknown ConfigurationManagerAttributes val = new ConfigurationManagerAttributes { IsAdminOnly = true }; EikthyrbowCraftingStation = config.Bind<string>("Eikthyrbow", "CraftingStation", "piece_workbench", new ConfigDescription("Crafting station for Eikthyr Bow", (AcceptableValueBase)null, new object[1] { val })); EikthyrbowRepairStation = config.Bind<string>("Eikthyrbow", "RepairStation", "piece_workbench", new ConfigDescription("Repair Station for Eikthyr Bow", (AcceptableValueBase)null, new object[1] { val })); EikthyrbowRequirements = config.Bind<string>("Eikthyrbow", "Requirements", "TrophyEikthyr:1:1,HardAntler:5:10,Bronze:10:15,SurtlingCore:2:4", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); ElderbowCraftingStation = config.Bind<string>("Elderbow", "CraftingStation", "piece_workbench", new ConfigDescription("Crafting station for Elder Bow", (AcceptableValueBase)null, new object[1] { val })); ElderbowRepairStation = config.Bind<string>("Elderbow", "RepairStation", "piece_workbench", new ConfigDescription("Repair Station for Elder Bow", (AcceptableValueBase)null, new object[1] { val })); ElderbowRequirements = config.Bind<string>("Elderbow", "Requirements", "TrophyTheElder:1:1,Iron:30:30,ElderBark:20:30,Chain:2:3", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); BonemassbowCraftingStation = config.Bind<string>("Bonemassbow", "CraftingStation", "piece_workbench", new ConfigDescription("Crafting station for Bonemass Bow", (AcceptableValueBase)null, new object[1] { val })); BonemassbowRepairStation = config.Bind<string>("Bonemassbow", "RepairStation", "piece_workbench", new ConfigDescription("Repair Station for Bonemass Bow", (AcceptableValueBase)null, new object[1] { val })); BonemassbowRequirements = config.Bind<string>("Bonemassbow", "Requirements", "TrophyBonemass:1:1,Silver:30:30,Obsidian:20:25,WolfHairBundle:10:15", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); ModerbowCraftingStation = config.Bind<string>("Moderbow", "CraftingStation", "piece_workbench", new ConfigDescription("Crafting station for Moder Bow", (AcceptableValueBase)null, new object[1] { val })); ModerbowRepairStation = config.Bind<string>("Moderbow", "RepairStation", "piece_workbench", new ConfigDescription("Repair Station for Moder Bow", (AcceptableValueBase)null, new object[1] { val })); ModerbowRequirements = config.Bind<string>("Moderbow", "Requirements", "TrophyDragonQueen:1:1,BlackMetal:30:60,DragonEgg:1:1,DragonTear:5:10", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); YagluthbowCraftingStation = config.Bind<string>("Yagluthbow", "CraftingStation", "blackforge", new ConfigDescription("Crafting station for Yagluth Bow", (AcceptableValueBase)null, new object[1] { val })); YagluthbowRepairStation = config.Bind<string>("Yagluthbow", "RepairStation", "blackforge", new ConfigDescription("Repair Station for Yagluth Bow", (AcceptableValueBase)null, new object[1] { val })); YagluthbowRequirements = config.Bind<string>("Yagluthbow", "Requirements", "TrophyGoblinKing:1:1,Eitr:15:30,BlackCore:5:5,YggdrasilWood:10:20", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); QueenbowCraftingStation = config.Bind<string>("Queenbow", "CraftingStation", "blackforge", new ConfigDescription("Crafting station for Queen Bow", (AcceptableValueBase)null, new object[1] { val })); QueenbowRepairStation = config.Bind<string>("Queenbow", "RepairStation", "blackforge", new ConfigDescription("Repair Station for Queen Bow", (AcceptableValueBase)null, new object[1] { val })); QueenbowRequirements = config.Bind<string>("Queenbow", "Requirements", "TrophySeekerQueen:1:1,FlametalNew:60:120,Blackwood:30:100,Carapace:20:50", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); FaderbowCraftingStation = config.Bind<string>("Faderbow", "CraftingStation", "blackforge", new ConfigDescription("Crafting station for Fader Bow", (AcceptableValueBase)null, new object[1] { val })); FaderbowRepairStation = config.Bind<string>("Faderbow", "RepairStation", "blackforge", new ConfigDescription("Repair Station for Fader Bow", (AcceptableValueBase)null, new object[1] { val })); FaderbowRequirements = config.Bind<string>("Faderbow", "Requirements", "TrophyFader:1:1,GemstoneBlue:10:10,GemstoneRed:10:10,GemstoneGreen:10:10", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val })); } } public static class RecipeHelper { public static List<RequirementConfig> ParseRequirements(string input) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown List<RequirementConfig> list = new List<RequirementConfig>(); string[] array = input.Split(new char[1] { ',' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ':' }); if (array2.Length >= 3 && int.TryParse(array2[1], out var result) && int.TryParse(array2[2], out var result2)) { list.Add(new RequirementConfig(array2[0], result, result2, true)); } } return list; } } public class SE_PiercingShot : StatusEffect { private int shotCount = 0; public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { shotCount++; if (shotCount >= 5) { shotCount = 0; ((DamageTypes)(ref hitData.m_damage)).Modify(2f); } } } public override void ResetTime() { ((StatusEffect)this).ResetTime(); shotCount = 0; } } public class SE_RootShot : SE_Stats { public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed = 0f; } public override void ModifyJump(Vector3 baseJump, ref Vector3 jump) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) jump = Vector3.zero; } } public class SE_PoisonShot : SE_Stats { public override void ModifySkillLevel(SkillType skill, ref float level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { level += 3f; } } public override void ModifyAttack(SkillType skill, ref HitData hitData) { hitData.m_damage.m_pierce *= 1.03f; } } public class SE_FireShot : SE_Stats { public override void ModifySkillLevel(SkillType skill, ref float level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { level += 6f; } } public override void ModifyAttack(SkillType skill, ref HitData hitData) { hitData.m_damage.m_slash *= 1.06f; } } public class SE_LightningShot : SE_Stats { public override void ModifySkillLevel(SkillType skill, ref float level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { level += 10f; } } public override void ModifyAttack(SkillType skill, ref HitData hitData) { hitData.m_damage.m_pierce *= 1.1f; } } public class SE_RegenShot : StatusEffect { private int shotCounter = 0; public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill != 8) { return; } shotCounter++; if (shotCounter >= 4) { shotCounter = 0; if (Object.op_Implicit((Object)(object)base.m_character) && base.m_character.IsPlayer()) { ((Character)Player.m_localPlayer).AddStamina(10f); } } } } [HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")] private static class DashOnShootSystem { private static readonly Dictionary<string, float> _data_DashForce = new Dictionary<string, float>(); public static void RegisterDashWeapon(GameObject weaponPrefab, float dashForce) { if ((Object)(object)weaponPrefab != (Object)null && !_data_DashForce.ContainsKey(((Object)weaponPrefab).name)) { _data_DashForce.Add(((Object)weaponPrefab).name, dashForce); } } private static void Prefix(CharacterAnimEvent __instance) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)localPlayer != (Object)(object)__instance.m_character || !((Character)localPlayer).InAttack() || !((Character)localPlayer).IsOnGround()) { return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon == null) { return; } GameObject dropPrefab = currentWeapon.m_dropPrefab; if ((Object)(object)dropPrefab == (Object)null || ((Character)localPlayer).m_seman.HaveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_HeavyShot")) || !EnableDash.Value || !_data_DashForce.TryGetValue(((Object)dropPrefab).name, out var value)) { return; } Rigidbody component = ((Component)localPlayer).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { Vector3 linearVelocity = component.linearVelocity; linearVelocity.y = 0f; if (((Vector3)(ref linearVelocity)).sqrMagnitude > 0.1f) { ((Vector3)(ref linearVelocity)).Normalize(); component.AddForce(linearVelocity * value, (ForceMode)2); } } } } [HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")] private static class AttackSpeedSystem { private static readonly Dictionary<string, float> _data_Main = new Dictionary<string, float>(); private static readonly Dictionary<string, float> _data_Secondary = new Dictionary<string, float>(); public static void RegisterMainAttacks(GameObject item, float speed) { _data_Main[((Object)item).name] = speed; } public static void RegisterSecondaryAttacks(GameObject item, float speed) { _data_Secondary[((Object)item).name] = speed; } private static void Prefix(CharacterAnimEvent __instance) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer != (Object)(object)__instance.m_character) && ((Character)localPlayer).InAttack()) { GameObject val = ((Humanoid)localPlayer).GetCurrentWeapon()?.m_dropPrefab; float value = 0f; if (Object.op_Implicit((Object)(object)val) && _data_Main.TryGetValue(((Object)val).name, out value) && !((Humanoid)localPlayer).m_currentAttackIsSecondary) { __instance.m_animator.speed = value; } else if (Object.op_Implicit((Object)(object)val) && _data_Secondary.TryGetValue(((Object)val).name, out value) && ((Humanoid)localPlayer).m_currentAttackIsSecondary) { __instance.m_animator.speed = value; } } } } public enum BowFireMode { Normal, Fast, Heavy, Turret } public static class BowFireModeManager { public static BowFireMode CurrentMode; public static void CycleMode(Player player) { if (PlayerUtils.HasBowEquipped(player)) { CurrentMode = (BowFireMode)((int)(CurrentMode + 1) % 4); } } public static void ResetMode(Player player) { CurrentMode = BowFireMode.Normal; if (((Character)(player?)).m_seman != null) { ((Character)player).m_seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(((Object)StatusEffectManager.FastShot).name), false); ((Character)player).m_seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(((Object)StatusEffectManager.TurretShot).name), false); ((Character)player).m_seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(((Object)StatusEffectManager.HeavyShot).name), false); } } } public static class PlayerUtils { public static bool HasBowEquipped(Player player) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if ((Object)(object)player == (Object)null) { return false; } List<ItemData> equippedItems = ((Humanoid)player).GetInventory().GetEquippedItems(); foreach (ItemData item in equippedItems) { if (item != null && (int)item.m_shared.m_itemType == 4) { return true; } } return false; } } [HarmonyPatch(typeof(Player), "Update")] public static class BowModeInputPatch { private static FieldInfo m_inputFieldInfo = typeof(Chat).GetField("m_input", BindingFlags.Instance | BindingFlags.NonPublic); private static bool IsChatFocused() { Chat instance = Chat.instance; if ((Object)(object)instance == (Object)null || m_inputFieldInfo == null) { return false; } object value = m_inputFieldInfo.GetValue(instance); InputField val = (InputField)((value is InputField) ? value : null); if (val != null) { return val.isFocused; } TMP_InputField val2 = (TMP_InputField)((value is TMP_InputField) ? value : null); if (val2 != null) { return val2.isFocused; } return false; } public static void Postfix(Player __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || IsChatFocused()) { return; } if (!PlayerUtils.HasBowEquipped(__instance)) { BowFireModeManager.ResetMode(__instance); return; } if (IsKeyDown(BowModeKey.Value)) { BowFireModeManager.CycleMode(__instance); string text = BowFireModeManager.CurrentMode.ToString(); ((Character)__instance).Message((MessageType)2, "<color=orange>Bow Mode :</color> " + text, 0, (Sprite)null); } ApplyBowFireModeEffect(__instance); } private static void ApplyBowFireModeEffect(Player player) { SEMan seman = ((Character)player).m_seman; seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(((Object)StatusEffectManager.FastShot).name), false); seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(((Object)StatusEffectManager.TurretShot).name), false); seman.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(((Object)StatusEffectManager.HeavyShot).name), false); switch (BowFireModeManager.CurrentMode) { case BowFireMode.Fast: seman.AddStatusEffect((StatusEffect)(object)StatusEffectManager.FastShot, false, 0, 0f); break; case BowFireMode.Heavy: seman.AddStatusEffect((StatusEffect)(object)StatusEffectManager.HeavyShot, false, 0, 0f); break; case BowFireMode.Turret: seman.AddStatusEffect((StatusEffect)(object)StatusEffectManager.TurretShot, false, 0, 0f); break; } } } public class SE_FastShot : StatusEffect { public SE_FastShot() { base.m_name = "SE_FastShot"; } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { if (character is Player) { speed = baseSpeed * 1.2f; } } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { ((DamageTypes)(ref hitData.m_damage)).Modify(0.8f); } } } public class SE_TurretShot : StatusEffect { public SE_TurretShot() { base.m_name = "SE_TurretShot"; base.m_ttl = 0f; } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed = 0f; } public override void ModifyJump(Vector3 baseJump, ref Vector3 jump) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) jump = Vector3.zero; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Character character = base.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { ((Character)val).m_run = false; val.m_autoRun = false; } } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { ((DamageTypes)(ref hitData.m_damage)).Modify(1.5f); } } } public class SE_HeavyShot : StatusEffect { public SE_HeavyShot() { base.m_name = "SE_HeavyShot"; } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { speed = baseSpeed * 0.8f; } public override void ModifyAttack(SkillType skill, ref HitData hitData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)skill == 8) { ((DamageTypes)(ref hitData.m_damage)).Modify(1.35f); } } } public static class StatusEffectManager { public static SE_FastShot FastShot; public static SE_HeavyShot HeavyShot; public static SE_TurretShot TurretShot; static StatusEffectManager() { FastShot = ScriptableObject.CreateInstance<SE_FastShot>(); HeavyShot = ScriptableObject.CreateInstance<SE_HeavyShot>(); TurretShot = ScriptableObject.CreateInstance<SE_TurretShot>(); ((Object)FastShot).name = "SE_FastShot"; ((Object)HeavyShot).name = "SE_HeavyShot"; ((Object)TurretShot).name = "SE_TurretShot"; } } public const string PluginGUID = "com.jotunn.FehuBows"; public const string PluginName = "FehuBows"; public const string PluginVersion = "1.0.4"; public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization(); public static AssetBundle BossNBowBundle; public static CustomStatusEffect PiercingShotStatusEffect; public static CustomStatusEffect RootShotStatusEffect; public static CustomStatusEffect PoisonShotStatusEffect; public static CustomStatusEffect FireShotStatusEffect; public static CustomStatusEffect RegenShotStatusEffect; public static CustomStatusEffect LightningShotStatusEffect; public static ConfigEntry<bool> EnableDash; public static ConfigEntry<KeyboardShortcut> BowModeKey; private void Awake() { FehuBowsConfig.Bind(((BaseUnityPlugin)this).Config); CreateConfig(); LoadAssets(); AddStatusEffects(); AddBows(); AddLocalizations(); AddFortecaCoins(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.jotunn.FehuBows"); } private void CreateConfig() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0064: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown EnableDash = ((BaseUnityPlugin)this).Config.Bind<bool>("Dash Mode", "EnableDash", true, new ConfigDescription("Enable dash ability (local client setting)", (AcceptableValueBase)null, Array.Empty<object>())); BowModeKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Bow Mode Shortcut", "Bow Mode Shortcut", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), new ConfigDescription("Shortcut for bow mode", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = false } })); } private void LoadAssets() { BossNBowBundle = AssetUtils.LoadAssetBundleFromResources("bossnbows"); } private void AddBows() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Expected O, but got Unknown //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Expected O, but got Unknown //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Expected O, but got Unknown //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown GameObject val = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/eikthyrbow.prefab"); GameObject val2 = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/elderbow.prefab"); GameObject val3 = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/bonemassbow.prefab"); GameObject val4 = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/moderbow.prefab"); GameObject val5 = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/yagluthbow.prefab"); GameObject val6 = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/queenbow.prefab"); GameObject val7 = BossNBowBundle.LoadAsset<GameObject>("assets/bossnbows/faderbow.prefab"); ItemConfig val8 = new ItemConfig(); val8.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.EikthyrbowRequirements.Value).ToArray(); val8.CraftingStation = FehuBowsConfig.EikthyrbowCraftingStation.Value; val8.RepairStation = FehuBowsConfig.EikthyrbowRepairStation.Value; CustomItem val9 = new CustomItem(val, true, val8); AttackSpeedSystem.RegisterMainAttacks(val, 2.2f); DashOnShootSystem.RegisterDashWeapon(val, 7f); ItemManager.Instance.AddItem(val9); val9.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = PiercingShotStatusEffect.StatusEffect; ItemConfig val10 = new ItemConfig(); val10.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.ElderbowRequirements.Value).ToArray(); val10.CraftingStation = FehuBowsConfig.ElderbowCraftingStation.Value; val10.RepairStation = FehuBowsConfig.ElderbowRepairStation.Value; CustomItem val11 = new CustomItem(val2, true, val10); AttackSpeedSystem.RegisterMainAttacks(val2, 2.2f); DashOnShootSystem.RegisterDashWeapon(val2, 7f); ItemManager.Instance.AddItem(val11); val11.ItemDrop.m_itemData.m_shared.m_attackStatusEffect = RootShotStatusEffect.StatusEffect; val11.ItemDrop.m_itemData.m_shared.m_attackStatusEffectChance = 0.15f; ItemConfig val12 = new ItemConfig(); val12.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.BonemassbowRequirements.Value).ToArray(); val12.CraftingStation = FehuBowsConfig.BonemassbowCraftingStation.Value; val12.RepairStation = FehuBowsConfig.BonemassbowRepairStation.Value; CustomItem val13 = new CustomItem(val3, true, val12); AttackSpeedSystem.RegisterMainAttacks(val3, 2.2f); DashOnShootSystem.RegisterDashWeapon(val3, 7f); ItemManager.Instance.AddItem(val13); val13.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = PoisonShotStatusEffect.StatusEffect; ItemConfig val14 = new ItemConfig(); val14.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.ModerbowRequirements.Value).ToArray(); val14.CraftingStation = FehuBowsConfig.ModerbowCraftingStation.Value; val14.RepairStation = FehuBowsConfig.ModerbowRepairStation.Value; CustomItem val15 = new CustomItem(val4, true, val14); AttackSpeedSystem.RegisterMainAttacks(val4, 2.2f); DashOnShootSystem.RegisterDashWeapon(val4, 7f); ItemManager.Instance.AddItem(val15); val15.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = PiercingShotStatusEffect.StatusEffect; ItemConfig val16 = new ItemConfig(); val16.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.YagluthbowRequirements.Value).ToArray(); val16.CraftingStation = FehuBowsConfig.YagluthbowCraftingStation.Value; val16.RepairStation = FehuBowsConfig.YagluthbowRepairStation.Value; CustomItem val17 = new CustomItem(val5, true, val16); AttackSpeedSystem.RegisterMainAttacks(val5, 2.2f); DashOnShootSystem.RegisterDashWeapon(val5, 7f); ItemManager.Instance.AddItem(val17); val17.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = FireShotStatusEffect.StatusEffect; ItemConfig val18 = new ItemConfig(); val18.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.QueenbowRequirements.Value).ToArray(); val18.CraftingStation = FehuBowsConfig.QueenbowCraftingStation.Value; val18.RepairStation = FehuBowsConfig.QueenbowRepairStation.Value; CustomItem val19 = new CustomItem(val6, true, val18); AttackSpeedSystem.RegisterMainAttacks(val6, 2.2f); DashOnShootSystem.RegisterDashWeapon(val6, 7f); ItemManager.Instance.AddItem(val19); val19.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = RegenShotStatusEffect.StatusEffect; ItemConfig val20 = new ItemConfig(); val20.Requirements = RecipeHelper.ParseRequirements(FehuBowsConfig.FaderbowRequirements.Value).ToArray(); val20.CraftingStation = FehuBowsConfig.FaderbowCraftingStation.Value; val20.RepairStation = FehuBowsConfig.FaderbowRepairStation.Value; CustomItem val21 = new CustomItem(val7, true, val20); AttackSpeedSystem.RegisterMainAttacks(val7, 2.2f); DashOnShootSystem.RegisterDashWeapon(val7, 7f); ItemManager.Instance.AddItem(val21); val21.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = LightningShotStatusEffect.StatusEffect; } private void AddFortecaCoins() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); GameObject val = BossNBowBundle.LoadAsset<GameObject>("assets/custombb/fehucoins.prefab"); GameObject val2 = BossNBowBundle.LoadAsset<GameObject>("assets/custombb/fortecacoins.prefab"); GameObject val3 = BossNBowBundle.LoadAsset<GameObject>("assets/custombb/runecoins.prefab"); CustomItem val4 = new CustomItem(val, true); ItemManager.Instance.AddItem(val4); CustomItem val5 = new CustomItem(val2, true); ItemManager.Instance.AddItem(val5); CustomItem val6 = new CustomItem(val3, true); ItemManager.Instance.AddItem(val6); } private void AddStatusEffects() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown StatusEffect val = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_PiercingShot>(); ((Object)val).name = "PiercingShot"; val.m_name = "$se_piercingshot"; val.m_tooltip = "$se_piercingshot_tooltip"; PiercingShotStatusEffect = new CustomStatusEffect(val, false); ItemManager.Instance.AddStatusEffect(PiercingShotStatusEffect); StatusEffect val2 = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_RootShot>(); ((Object)val2).name = "RootShot"; val2.m_name = "$se_rootshot"; val2.m_tooltip = "$se_rootshot_tooltip"; val2.m_ttl = 2f; RootShotStatusEffect = new CustomStatusEffect(val2, false); ItemManager.Instance.AddStatusEffect(RootShotStatusEffect); StatusEffect val3 = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_PoisonShot>(); ((Object)val3).name = "PoisonShot"; val3.m_name = "$se_poisonshot"; val3.m_tooltip = "$se_poisonshot_tooltip"; PoisonShotStatusEffect = new CustomStatusEffect(val3, false); ItemManager.Instance.AddStatusEffect(PoisonShotStatusEffect); StatusEffect val4 = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_FireShot>(); ((Object)val4).name = "FireShot"; val4.m_name = "$se_fireshot"; val4.m_tooltip = "$se_fireshot_tooltip"; FireShotStatusEffect = new CustomStatusEffect(val4, false); ItemManager.Instance.AddStatusEffect(FireShotStatusEffect); StatusEffect val5 = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_RegenShot>(); ((Object)val5).name = "RegenShot"; val5.m_name = "$se_regenshot"; val5.m_tooltip = "$se_regenshot_tooltip"; RegenShotStatusEffect = new CustomStatusEffect(val5, false); ItemManager.Instance.AddStatusEffect(RegenShotStatusEffect); StatusEffect val6 = (StatusEffect)(object)ScriptableObject.CreateInstance<SE_LightningShot>(); ((Object)val6).name = "LightningShot"; val6.m_name = "$se_lightningshot"; val6.m_tooltip = "$se_lightningshot_tooltip"; LightningShotStatusEffect = new CustomStatusEffect(val6, false); ItemManager.Instance.AddStatusEffect(LightningShotStatusEffect); } private void AddLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string configPath = Paths.ConfigPath; if (!Directory.Exists(configPath)) { Logger.LogWarning((object)("Config path not found: " + configPath)); return; } List<string> list = (from x in (from dir in Directory.EnumerateDirectories(configPath, "*", SearchOption.AllDirectories) where string.Equals(Path.GetFileName(dir), "FehuBows", StringComparison.OrdinalIgnoreCase) select new { Path = dir, Depth = dir.TrimEnd(new char[1] { Path.DirectorySeparatorChar }).Count((char c) => c == Path.DirectorySeparatorChar) } into x orderby x.Depth select x).ThenBy(x => x.Path, StringComparer.OrdinalIgnoreCase) select x.Path).ToList(); if (list.Count == 0) { Logger.LogWarning((object)("No 'FehuBows' directory for translations found anywhere under: " + configPath)); return; } HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string item in list) { foreach (string item2 in Directory.EnumerateFiles(item, "*.json", SearchOption.AllDirectories).OrderBy<string, string>((string f) => f, StringComparer.OrdinalIgnoreCase)) { if (!hashSet.Add(item2)) { continue; } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item2); try { string text = File.ReadAllText(item2); Dictionary<string, string> dictionary = SimpleJson.DeserializeObject<Dictionary<string, string>>(text); if (dictionary == null) { Logger.LogWarning((object)("Empty or invalid JSON in " + item2)); continue; } int num = 0; foreach (KeyValuePair<string, string> item3 in dictionary) { try { string key = item3.Key; localization.AddTranslation(ref fileNameWithoutExtension, ref key, item3.Value); num++; } catch (Exception ex) { Logger.LogWarning((object)("Could not add key '" + item3.Key + "' from " + item2 + ": " + ex.Message)); } } } catch (Exception ex2) { Logger.LogError((object)("Failed to load localization from " + item2 + ": " + ex2.Message)); } } } } private static bool IsKeyDown(KeyboardShortcut shortcut) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (((object)(KeyboardShortcut)(ref shortcut)).Equals((object?)null)) { return false; } if (!Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey)) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return true; } }