using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Huntress;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.Huntress.Weapon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.EntityStates.Huntress;
using On.EntityStates.Huntress.HuntressWeapon;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("HIFUHuntressTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HIFUHuntressTweaks")]
[assembly: AssemblyTitle("HIFUHuntressTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HIFUHuntressTweaks
{
public class ConfigManager
{
internal static bool ConfigChanged;
internal static bool VersionChanged;
public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
where x.Name == "Bind"
select x).First();
methodInfo = methodInfo.MakeGenericMethod(typeof(T));
object[] parameters = new object[3]
{
(object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + entry.Definition.Section, name),
entry.DefaultValue,
(object)new ConfigDescription(entry.Description.Description, (AcceptableValueBase)null, Array.Empty<object>())
};
ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, parameters);
if (Main._preVersioning)
{
entry.BoxedValue = entry.DefaultValue;
}
if (!ConfigEqual(val.DefaultValue, val.BoxedValue) && VersionChanged)
{
entry.BoxedValue = entry.DefaultValue;
val.BoxedValue = val.DefaultValue;
}
return default(T);
}
private static bool ConfigEqual(object a, object b)
{
if (a.Equals(b))
{
return true;
}
if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001)
{
return true;
}
return false;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("HIFU.HIFUHuntressTweaks", "HIFUHuntressTweaks", "5.0.6")]
public class Main : BaseUnityPlugin
{
public const string PluginGUID = "HIFU.HIFUHuntressTweaks";
public const string PluginAuthor = "HIFU";
public const string PluginName = "HIFUHuntressTweaks";
public const string PluginVersion = "5.0.6";
public static ConfigFile HHTConfig;
public static ConfigFile HHTBackupConfig;
public static ManualLogSource HHTLogger;
public static bool _preVersioning;
public static ConfigEntry<bool> enableAutoConfig { get; set; }
public static ConfigEntry<string> latestVersion { get; set; }
public void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
HHTLogger = ((BaseUnityPlugin)this).Logger;
HHTConfig = ((BaseUnityPlugin)this).Config;
HHTBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFUHuntressTweaks.Backup.cfg", true);
HHTBackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :");
enableAutoConfig = HHTConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFUHuntressTweaks from syncing config whenever a new version is found.");
_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HHTConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
latestVersion = HHTConfig.Bind<string>("Config", "Latest Version", "5.0.6", "DO NOT CHANGE THIS");
if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "5.0.6"))
{
latestVersion.Value = "5.0.6";
ConfigManager.VersionChanged = true;
HHTLogger.LogInfo((object)"Config Autosync Enabled.");
}
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
select type;
HHTLogger.LogInfo((object)"==+----------------==TWEAKS==----------------+==");
foreach (Type item in enumerable)
{
TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item);
if (ValidateTweak(tweakBase))
{
tweakBase.Init();
}
}
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(MiscBase))
select type;
HHTLogger.LogInfo((object)"==+----------------==MISC==----------------+==");
foreach (Type item2 in enumerable2)
{
MiscBase miscBase = (MiscBase)Activator.CreateInstance(item2);
if (ValidateMisc(miscBase))
{
miscBase.Init();
}
}
}
public bool ValidateTweak(TweakBase tb)
{
if (tb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(tb.Name, "Enable?", true, "Vanilla is false").Value)
{
return true;
}
return false;
}
public bool ValidateMisc(MiscBase mb)
{
if (mb.isEnabled && ((BaseUnityPlugin)this).Config.Bind<bool>(mb.Name, "Enable?", false, "Vanilla is false").Value)
{
return true;
}
return false;
}
private void PeripheryMyBeloved()
{
}
}
public abstract class MiscBase
{
public abstract string Name { get; }
public virtual bool isEnabled { get; } = true;
public T ConfigOption<T>(T value, string name, string description)
{
ConfigEntry<T> val = Main.HHTConfig.Bind<T>(Name, name, value, description);
ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HHTBackupConfig, name);
return val.Value;
}
public abstract void Hooks();
public string d(float f)
{
return f * 100f + "%";
}
public virtual void Init()
{
Hooks();
Main.HHTLogger.LogInfo((object)("Added " + Name));
}
}
public abstract class MiscBase<T> : MiscBase where T : MiscBase<T>
{
public static T instance { get; set; }
public MiscBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice");
}
instance = this as T;
}
}
public abstract class TweakBase
{
public abstract string Name { get; }
public abstract string SkillToken { get; }
public abstract string DescText { get; }
public virtual bool isEnabled { get; } = true;
public T ConfigOption<T>(T value, string name, string description)
{
ConfigEntry<T> val = Main.HHTConfig.Bind<T>(Name, name, value, description);
ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HHTBackupConfig, name);
return val.Value;
}
public abstract void Hooks();
public string d(float f)
{
return f * 100f + "%";
}
public virtual void Init()
{
Hooks();
string text = "HUNTRESS_" + SkillToken.ToUpper() + "_DESCRIPTION";
LanguageAPI.Add(text, DescText);
Main.HHTLogger.LogInfo((object)("Added " + Name));
}
}
public abstract class TweakBase<T> : TweakBase where T : TweakBase<T>
{
public static T instance { get; set; }
public TweakBase()
{
if (instance != null)
{
throw new InvalidOperationException("Singleton class " + typeof(T).Name + " was instantiated twice");
}
instance = this as T;
}
}
}
namespace HIFUHuntressTweaks.Skills
{
public class ArrowRain : TweakBase
{
public static float damage;
public static float procCoefficient;
public static float cooldown;
public static float sizeMultiplier;
public static float heightMultiplier;
public override string Name => ": Special : Arrow Rain";
public override string SkillToken => "special";
public override string DescText => "<style=cIsUtility>Teleport</style> into the sky. Target an area to rain arrows, <style=cIsUtility>slowing</style> all enemies and dealing <style=cIsDamage>" + damage * 300f + "% damage per second</style>.";
public override void Init()
{
damage = ConfigOption(1.4f, "Damage", "Decimal. Vanilla is 1.1");
procCoefficient = ConfigOption(0.7f, "Proc Coefficient", "Vanilla is 0.2");
cooldown = ConfigOption(9f, "Cooldown", "Vanilla is 12");
sizeMultiplier = ConfigOption(1.3f, "Hitbox Size Multiplier", "Vanilla is 1");
heightMultiplier = ConfigOption(3f, "Hitbox Height Multiplier", "Vanilla is 1");
base.Init();
}
public override void Hooks()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Changes();
ArrowRain.OnEnter += new hook_OnEnter(ArrowRain_OnEnter);
}
private void ArrowRain_OnEnter(orig_OnEnter orig, ArrowRain self)
{
ArrowRain.damageCoefficient = damage / 0.5f;
orig.Invoke(self);
}
public static void Changes()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
GameObject val = LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/HuntressArrowRain");
ProjectileDotZone component = val.GetComponent<ProjectileDotZone>();
component.overlapProcCoefficient = procCoefficient;
val.transform.localScale = new Vector3(15f * sizeMultiplier, 15f * heightMultiplier, 15f * sizeMultiplier);
LegacyResourcesAPI.Load<SkillDef>("skilldefs/huntressbody/HuntressBodyArrowRain").baseRechargeInterval = cooldown;
}
}
public class Ballista : TweakBase
{
public static float damage;
public static float procCoefficient;
public static float cooldown;
public static int boltCount;
public override string Name => ": Special :: Ballista";
public override string SkillToken => "special_alt1";
public override string DescText => "<style=cIsUtility>Teleport</style> backwards into the sky. Fire up to <style=cIsDamage>" + boltCount + "</style> energy bolts, dealing <style=cIsDamage>" + boltCount + "x" + d(damage) + " damage</style>.";
public override void Init()
{
damage = ConfigOption(7.5f, "Damage", "Decimal. Vanilla is 9");
procCoefficient = ConfigOption(1f, "Proc Coefficient", "Vanilla is 1");
cooldown = ConfigOption(10f, "Cooldown", "Vanilla is 12");
boltCount = ConfigOption(4, "Bolt Count", "Vanilla is 3");
base.Init();
}
public override void Hooks()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Changes();
GenericBulletBaseState.OnEnter += new hook_OnEnter(GenericBulletBaseState_OnEnter);
}
private void GenericBulletBaseState_OnEnter(orig_OnEnter orig, GenericBulletBaseState self)
{
if (self is FireArrowSnipe)
{
self.damageCoefficient = damage;
self.procCoefficient = procCoefficient;
}
orig.Invoke(self);
}
public static void Changes()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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)
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Huntress/AimArrowSnipe.asset").WaitForCompletion();
SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Huntress/FireArrowSnipe.asset").WaitForCompletion();
val.baseRechargeInterval = cooldown;
val2.baseMaxStock = boltCount;
}
}
public class Blink : TweakBase
{
public static float cooldown;
public static float speedCoefficient;
public override string Name => ": Utility : Blink";
public override string SkillToken => "utility";
public override string DescText => "<style=cIsUtility>Agile</style>. <style=cIsUtility>Disappear</style> and <style=cIsUtility>teleport</style> forward.";
public override void Init()
{
cooldown = ConfigOption(6.5f, "Cooldown", "Vanilla is 7");
speedCoefficient = ConfigOption(15f, "Speed Coefficient", "Vanilla is 14");
base.Init();
}
public override void Hooks()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Changes();
BlinkState.OnEnter += new hook_OnEnter(BlinkState_OnEnter);
}
private void BlinkState_OnEnter(orig_OnEnter orig, BlinkState self)
{
if (self != null)
{
self.speedCoefficient = speedCoefficient;
}
orig.Invoke(self);
}
public static void Changes()
{
SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/huntressbody/HuntressBodyBlink");
val.baseRechargeInterval = cooldown;
val.keywordTokens = new string[1] { "KEYWORD_AGILE" };
}
}
public class Flurry : TweakBase
{
public static float damage;
public static float procCoefficient;
public static float fireRate;
public static int minArrows;
public static int maxArrows;
public override string Name => ": Primary :: Flurry";
public override string SkillToken => "primary_alt";
public override string DescText => "<style=cIsUtility>Agile</style>. Draw back a volley of <style=cIsDamage>" + minArrows + "</style> seeking arrows for <style=cIsDamage>" + minArrows + "x" + d(damage) + " damage</style>. Critical Strikes fire <style=cIsDamage>" + maxArrows + "</style> arrows.";
public override void Init()
{
damage = ConfigOption(1.1f, "Damage", "Decimal. Vanilla is 1");
procCoefficient = ConfigOption(1f, "Proc Coefficient", "Vanilla is 0.7");
fireRate = ConfigOption(1f, "Fire Rate", "Vanilla is 1.3");
minArrows = ConfigOption(3, "Minimum Arrows", "Vanilla is 3");
maxArrows = ConfigOption(6, "Maximum Arrows", "Vanilla is 6");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
FireSeekingArrow.OnEnter += new hook_OnEnter(FireSeekingArrow_OnEnter);
FireFlurrySeekingArrow.OnEnter += new hook_OnEnter(FireFlurrySeekingArrow_OnEnter);
}
private void FireFlurrySeekingArrow_OnEnter(orig_OnEnter orig, FireFlurrySeekingArrow self)
{
FireFlurrySeekingArrow.critMaxArrowCount = maxArrows;
orig.Invoke(self);
}
private void FireSeekingArrow_OnEnter(orig_OnEnter orig, FireSeekingArrow self)
{
if (self is FireFlurrySeekingArrow)
{
self.orbDamageCoefficient = damage;
self.orbProcCoefficient = procCoefficient;
self.maxArrowCount = minArrows;
self.baseDuration = fireRate;
}
orig.Invoke(self);
}
}
public class LaserGlaive : TweakBase
{
public static float damage;
public static float procCoefficient;
public static float bounceDamage;
public static int bounceCount;
public static float cooldown;
public static float antigrav;
public static float duration;
public static bool agile;
public override string Name => ": Secondary : Laser Glaive";
public override string SkillToken => "secondary";
public override string DescText => (agile ? "<style=cIsUtility>Agile</style>. " : "") + "Throw a seeking glaive that bounces up to <style=cIsDamage>" + bounceCount + "</style> times for <style=cIsDamage>" + d(damage) + " damage</style>. Damage increases by <style=cIsDamage>" + Math.Round((bounceDamage - 1f) * 100f, 1) + "%</style> per bounce.";
public override void Init()
{
damage = ConfigOption(3.5f, "Damage", "Decimal. Vanilla is 2.5");
procCoefficient = ConfigOption(1f, "Proc Coefficient", "Vanilla is 0.8");
bounceDamage = ConfigOption(1.025f, "Damage Multiplier Per Bounce", "Decimal. Vanilla is 1.1");
bounceCount = ConfigOption(6, "Bounces", "Vanilla is 6");
cooldown = ConfigOption(6f, "Cooldown", "Vanilla is 7");
antigrav = ConfigOption(40f, "Jump Boost", "Vanilla is 30");
duration = ConfigOption(0.8f, "Animation Speed", "Vanilla is 1.1");
agile = ConfigOption(value: true, "Enable Agile?", "Vanilla is false");
base.Init();
}
public override void Hooks()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Changes();
ThrowGlaive.OnEnter += new hook_OnEnter(ThrowGlaive_OnEnter);
}
private void ThrowGlaive_OnEnter(orig_OnEnter orig, ThrowGlaive self)
{
ThrowGlaive.damageCoefficient = damage;
ThrowGlaive.damageCoefficientPerBounce = bounceDamage;
ThrowGlaive.maxBounceCount = bounceCount;
ThrowGlaive.glaiveProcCoefficient = procCoefficient;
ThrowGlaive.antigravityStrength = antigrav / duration;
ThrowGlaive.baseDuration = duration;
orig.Invoke(self);
}
public static void Changes()
{
SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/huntressbody/HuntressBodyGlaive");
val.baseRechargeInterval = cooldown;
if (agile)
{
val.cancelSprintingOnActivation = false;
val.keywordTokens = new string[1] { "KEYWORD_AGILE" };
}
}
}
public class PhaseBlink : TweakBase
{
public static float cooldown;
public static float speedCoefficient;
public static int charges;
public static int chargesToRecharge;
public static bool resetChargeCooldown;
public override string Name => ": Utility :: Phase Blink";
public override string SkillToken => "utility_alt1";
public override string DescText => "<style=cIsUtility>Agile</style>. <style=cIsUtility>Disappear</style> and <style=cIsUtility>teleport</style> a short distance. Can store up to <style=cIsUtility>" + charges + "</style> charges.";
public override void Init()
{
cooldown = ConfigOption(7f, "Cooldown", "Vanilla is 2");
speedCoefficient = ConfigOption(15f, "Speed Coefficient", "Vanilla is 15");
charges = ConfigOption(3, "Charge Count", "Vanilla is 3");
chargesToRecharge = ConfigOption(3, "Charges to Recharge", "Vanilla is 1");
resetChargeCooldown = ConfigOption(value: false, "Reset Charge Cooldown on use?", "Vanilla is false");
base.Init();
}
public override void Hooks()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Changes();
BlinkState.OnEnter += new hook_OnEnter(BlinkState_OnEnter);
}
private void BlinkState_OnEnter(orig_OnEnter orig, BlinkState self)
{
if (self is MiniBlinkState)
{
self.speedCoefficient = speedCoefficient;
}
orig.Invoke(self);
}
public static void Changes()
{
SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/huntressbody/HuntressBodyMiniBlink");
val.baseRechargeInterval = cooldown;
val.baseMaxStock = charges;
val.rechargeStock = chargesToRecharge;
val.resetCooldownTimerOnUse = resetChargeCooldown;
}
}
public class Strafe : TweakBase
{
public static float damage;
public static float procCoefficient;
public static float fireRate;
public override string Name => ": Primary : Strafe";
public override string SkillToken => "primary";
public override string DescText => "<style=cIsUtility>Agile</style>. Quickly fire a seeking arrow for <style=cIsDamage>" + d(damage) + " damage</style>.";
public override void Init()
{
damage = ConfigOption(1.8f, "Damage", "Decimal. Vanilla is 1.5");
procCoefficient = ConfigOption(1f, "Proc Coefficient", "Vanilla is 1");
fireRate = ConfigOption(1f / 3f, "Duration", "Vanilla is 0.5");
base.Init();
}
public override void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
FireSeekingArrow.OnEnter += new hook_OnEnter(FireSeekingArrow_OnEnter);
}
private void FireSeekingArrow_OnEnter(orig_OnEnter orig, FireSeekingArrow self)
{
if (self != null)
{
self.orbDamageCoefficient = damage;
self.orbProcCoefficient = procCoefficient;
self.baseDuration = fireRate;
}
orig.Invoke(self);
}
}
}
namespace HIFUHuntressTweaks.Misc
{
public class FreeSprint : MiscBase
{
public override string Name => ":: Misc : 360 Degree Sprint";
public override void Init()
{
base.Init();
}
public override void Hooks()
{
Changes();
}
public static void Changes()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
CharacterBody component = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/HuntressBody").GetComponent<CharacterBody>();
component.bodyFlags = (BodyFlags)(component.bodyFlags | 0x20);
}
}
}