using 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;
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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BossNBows")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BossNBows")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
namespace BossNBows;
[BepInPlugin("com.jotunn.BossNBows", "BossNBows", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class BossNBows : BaseUnityPlugin
{
public static class BossNBowsConfig
{
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_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_000d: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Expected O, but got Unknown
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Expected O, but got Unknown
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Expected O, but got Unknown
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Expected O, but got Unknown
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Expected O, but got Unknown
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Expected O, but got Unknown
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Expected O, but got Unknown
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Expected O, but got Unknown
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Expected O, but got Unknown
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Expected O, but got Unknown
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Expected O, but got Unknown
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0385: Expected O, but got Unknown
//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
//IL_03b4: Expected O, but got Unknown
//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
//IL_03e3: 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:10:15,Bronze:10:20,SurtlingCore:5:10", 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:25:30", 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:3:2,DragonTear:10:20", 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:30:60,BlackCore:10:10,YggdrasilWood:20:40", 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:20,GemstoneRed:10:20,GemstoneGreen:10:20", new ConfigDescription("Craft requirement", (AcceptableValueBase)null, new object[1] { val }));
}
}
public static class RecipeHelper
{
public static List<RequirementConfig> ParseRequirements(string input)
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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;
public override void ModifyAttack(SkillType skill, ref HitData hitData)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_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)
jump = Vector3.zero;
}
}
public class SE_PoisonShot : SE_Stats
{
public override void ModifySkillLevel(SkillType skill, ref float level)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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;
public override void ModifyAttack(SkillType skill, ref HitData hitData)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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 velocity = component.velocity;
velocity.y = 0f;
if (((Vector3)(ref velocity)).sqrMagnitude > 0.1f)
{
((Vector3)(ref velocity)).Normalize();
component.AddForce(velocity * 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_002a: 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.1f;
}
}
public override void ModifyAttack(SkillType skill, ref HitData hitData)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_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)
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_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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.7f;
}
public override void ModifyAttack(SkillType skill, ref HitData hitData)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Invalid comparison between Unknown and I4
if ((int)skill == 8)
{
((DamageTypes)(ref hitData.m_damage)).Modify(1.25f);
}
}
}
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.BossNBows";
public const string PluginName = "BossNBows";
public const string PluginVersion = "1.0.3";
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()
{
BossNBowsConfig.Bind(((BaseUnityPlugin)this).Config);
CreateConfig();
LoadAssets();
AddStatusEffects();
AddBows();
AddLocalizations();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.jotunn.BossNBows");
}
private void CreateConfig()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Expected O, but got Unknown
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Expected O, but got Unknown
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Expected O, but got Unknown
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Expected O, but got Unknown
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Expected O, but got Unknown
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Expected O, but got Unknown
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Expected O, but got Unknown
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_0372: Expected O, but got Unknown
//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Expected O, but got Unknown
//IL_0400: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Expected O, but got Unknown
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_0450: 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(BossNBowsConfig.EikthyrbowRequirements.Value).ToArray();
val8.CraftingStation = BossNBowsConfig.EikthyrbowCraftingStation.Value;
val8.RepairStation = BossNBowsConfig.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(BossNBowsConfig.ElderbowRequirements.Value).ToArray();
val10.CraftingStation = BossNBowsConfig.ElderbowCraftingStation.Value;
val10.RepairStation = BossNBowsConfig.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(BossNBowsConfig.BonemassbowRequirements.Value).ToArray();
val12.CraftingStation = BossNBowsConfig.BonemassbowCraftingStation.Value;
val12.RepairStation = BossNBowsConfig.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(BossNBowsConfig.ModerbowRequirements.Value).ToArray();
val14.CraftingStation = BossNBowsConfig.ModerbowCraftingStation.Value;
val14.RepairStation = BossNBowsConfig.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(BossNBowsConfig.YagluthbowRequirements.Value).ToArray();
val16.CraftingStation = BossNBowsConfig.YagluthbowCraftingStation.Value;
val16.RepairStation = BossNBowsConfig.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(BossNBowsConfig.QueenbowRequirements.Value).ToArray();
val18.CraftingStation = BossNBowsConfig.QueenbowCraftingStation.Value;
val18.RepairStation = BossNBowsConfig.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(BossNBowsConfig.FaderbowRequirements.Value).ToArray();
val20.CraftingStation = BossNBowsConfig.FaderbowCraftingStation.Value;
val20.RepairStation = BossNBowsConfig.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 AddStatusEffects()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Expected O, but got Unknown
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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), "BossNBows", 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 'BossNBows' 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_0014: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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;
}
}