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.Railgunner.Backpack;
using EntityStates.Railgunner.Reload;
using EntityStates.Railgunner.Scope;
using EntityStates.Railgunner.Weapon;
using HIFURailgunnerTweaks.Misc;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.EntityStates.Railgunner.Backpack;
using On.EntityStates.Railgunner.Reload;
using On.EntityStates.Railgunner.Scope;
using On.EntityStates.Railgunner.Weapon;
using On.RoR2;
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("HIFURailgunnerTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HIFURailgunnerTweaks")]
[assembly: AssemblyTitle("HIFURailgunnerTweaks")]
[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 HIFURailgunnerTweaks
{
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.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("HIFU.HIFURailgunnerTweaks", "HIFURailgunnerTweaks", "1.0.8")]
public class Main : BaseUnityPlugin
{
public const string PluginGUID = "HIFU.HIFURailgunnerTweaks";
public const string PluginAuthor = "HIFU";
public const string PluginName = "HIFURailgunnerTweaks";
public const string PluginVersion = "1.0.8";
public static ConfigFile HRGTConfig;
public static ConfigFile HRGTBackupConfig;
public static ManualLogSource HRGTLogger;
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
HRGTLogger = ((BaseUnityPlugin)this).Logger;
HRGTConfig = ((BaseUnityPlugin)this).Config;
HRGTBackupConfig = new ConfigFile(Paths.ConfigPath + "\\HIFU.HIFURailgunnerTweaks.Backup.cfg", true);
HRGTBackupConfig.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 = HRGTConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop HIFURailgunnerTweaks from syncing config whenever a new version is found.");
_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(HRGTConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
latestVersion = HRGTConfig.Bind<string>("Config", "Latest Version", "1.0.8", "DO NOT CHANGE THIS");
if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.0.8"))
{
latestVersion.Value = "1.0.8";
ConfigManager.VersionChanged = true;
HRGTLogger.LogInfo((object)"Config Autosync Enabled.");
}
IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(MiscBase))
select type;
HRGTLogger.LogInfo((object)"==+----------------==MISC==----------------+==");
foreach (Type item in enumerable)
{
MiscBase miscBase = (MiscBase)Activator.CreateInstance(item);
if (ValidateMisc(miscBase))
{
miscBase.Init();
}
}
IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
where !type.IsAbstract && type.IsSubclassOf(typeof(TweakBase))
select type;
HRGTLogger.LogInfo((object)"==+----------------==TWEAKS==----------------+==");
foreach (Type item2 in enumerable2)
{
TweakBase tweakBase = (TweakBase)Activator.CreateInstance(item2);
if (ValidateTweak(tweakBase))
{
tweakBase.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?", true, "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.HRGTConfig.Bind<T>(Name, name, value, description);
ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HRGTBackupConfig, name);
return val.Value;
}
public abstract void Hooks();
public string d(float f)
{
return f * 100f + "%";
}
public virtual void Init()
{
Hooks();
Main.HRGTLogger.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.HRGTConfig.Bind<T>(Name, name, value, description);
ConfigManager.HandleConfig<T>((ConfigEntryBase)(object)val, Main.HRGTBackupConfig, name);
return val.Value;
}
public abstract void Hooks();
public string d(float f)
{
return f * 100f + "%";
}
public virtual void Init()
{
Hooks();
string text = "RAILGUNNER_" + SkillToken.ToUpper() + "_DESCRIPTION";
LanguageAPI.Add(text, DescText);
Main.HRGTLogger.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 HIFURailgunnerTweaks.Skills
{
public class ConcussionDevice : TweakBase
{
public static float SelfKnockback;
public static int Charges;
public static float Cooldown;
public override string Name => ": Utility : Concussion Device";
public override string SkillToken => "utility";
public override string DescText => "Throw out a device that <style=cIsUtility>pushes</style> you and all nearby enemies away. Can hold up to " + Charges + ".";
public override void Init()
{
SelfKnockback = ConfigOption(3200f, "Self Force", "Vanilla is 4000. Higher value is more knockback");
Charges = ConfigOption(2, "Charges", "Vanilla is 2");
Cooldown = ConfigOption(6f, "Cooldown", "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
BaseFireMine.OnEnter += new hook_OnEnter(BaseFireMine_OnEnter);
Changes();
}
private void BaseFireMine_OnEnter(orig_OnEnter orig, BaseFireMine self)
{
if (self is FireMineConcussive)
{
self.force = SelfKnockback;
}
orig.Invoke(self);
}
private 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)
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFireMineConcussive.asset").WaitForCompletion();
val.baseMaxStock = Charges;
val.baseRechargeInterval = Cooldown;
}
}
public class Cryocharge : TweakBase
{
public static float Damage;
public static float CritDamage;
public static float PiercingDamage;
public static float ProcCoefficient;
public static float Radius;
public override string Name => ": Special :: Cryocharge";
public override string SkillToken => "special_alt";
public override string DescText => "<style=cIsUtility>Freezing</style>. Fire a <style=cIsDamage>piercing</style> round for <style=cIsDamage>" + d(Damage) + "-" + d((Damage + ScopeAndReload.Damage) * CritDamage * 2f) + " damage</style>.";
public override void Init()
{
Damage = ConfigOption(20f, "Damage", "Decimal. Vanilla is 20");
CritDamage = ConfigOption(1f, "Crit Damage Multiplier", "Decimal. Vanilla is 1");
PiercingDamage = ConfigOption(1f, "Pierce Damage Falloff", "Decimal. Vanilla is 1. Higher values mean less piercing damage falloff, so more damage overall.");
ProcCoefficient = ConfigOption(1.5f, "Proc Coefficient", "Vanilla is 1.5");
Radius = ConfigOption(2f, "Radius", "Vanilla is 2");
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
BaseFireSnipe.OnEnter += new hook_OnEnter(BaseFireSnipe_OnEnter);
LanguageAPI.Add("RAILGUNNER_SNIPE_CRYO_DESCRIPTION", "<style=cIsUtility>Freezing</style>. Launch a super-cooled projectile for <style=cIsDamage>" + d(Damage) + " damage</style>.");
}
private void BaseFireSnipe_OnEnter(orig_OnEnter orig, BaseFireSnipe self)
{
if (self is FireSnipeCryo)
{
((GenericBulletBaseState)self).damageCoefficient = Damage;
self.piercingDamageCoefficientPerTarget = PiercingDamage;
self.critDamageMultiplier = CritDamage;
((GenericBulletBaseState)self).procCoefficient = ProcCoefficient;
((GenericBulletBaseState)self).bulletRadius = Radius;
}
orig.Invoke(self);
}
}
public class HH44Marksman : TweakBase
{
public static float Damage;
public static float PiercingDamage;
public static float AttackRate;
public static float ZoomFOV;
public override string Name => ": Secondary :: HH44 Marksman";
public override string SkillToken => "secondary_alt";
public override string DescText => "Activate your <style=cIsUtility>short-range scope</style>, highlighting <style=cIsDamage>Weak Points</style> and transforming your weapon into a quick <style=cIsDamage>" + d(Damage) + "-" + d(Damage * 2f) + " damage</style> railgun.";
public override void Init()
{
Damage = ConfigOption(4f, "Damage", "Decimal. Vanilla is 4");
PiercingDamage = ConfigOption(0.5f, "Pierce Damage Falloff", "Decimal. Vanilla is 0.5. Higher values mean less piercing damage falloff, so more damage overall.");
AttackRate = ConfigOption(2f, "Attacks Per Second", "Vanilla is 2");
ZoomFOV = ConfigOption(30f, "Zoom FOV", "Vanilla is 30. Lower value is more zoomed in");
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
BaseFireSnipe.OnEnter += new hook_OnEnter(BaseFireSnipe_OnEnter);
LanguageAPI.Add("RAILGUNNER_SNIPE_LIGHT_DESCRIPTION", "Launch a light projectile for <style=cIsDamage>" + d(Damage) + " damage</style>.");
Changes();
}
private void BaseFireSnipe_OnEnter(orig_OnEnter orig, BaseFireSnipe self)
{
if (self is FireSnipeLight)
{
((GenericBulletBaseState)self).damageCoefficient = Damage;
self.piercingDamageCoefficientPerTarget = PiercingDamage;
self.selfKnockbackForce = 0f;
((GenericBulletBaseState)self).baseDuration = 1f / AttackRate;
((GenericBulletBaseState)self).recoilAmplitudeY = 0.6f;
}
orig.Invoke(self);
}
private 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)
CharacterCameraParams val = Addressables.LoadAssetAsync<CharacterCameraParams>((object)"RoR2/DLC1/Railgunner/ccpRailgunnerScopeLight.asset").WaitForCompletion();
val.data.fov.value = ZoomFOV;
}
}
public class M99Sniper : TweakBase
{
public static float Damage;
public static float PiercingDamage;
public static float ZoomFOV;
public override string Name => ": Secondary : M99 Sniper";
public override string SkillToken => "secondary";
public override string DescText => "Activate your <style=cIsUtility>long-range scope</style>, highlighting <style=cIsDamage>Weak Points</style> and transforming your weapon into a piercing <style=cIsDamage>" + d(Damage) + "-" + d((Damage + ScopeAndReload.Damage) * 2f) + " damage</style> railgun.";
public override void Init()
{
Damage = ConfigOption(6f, "Damage", "Decimal. Vanilla is 10");
PiercingDamage = ConfigOption(0.5f, "Pierce Damage Falloff", "Decimal. Vanilla is 0.5. Higher values mean less piercing damage falloff, so more damage overall.");
ZoomFOV = ConfigOption(18f, "Zoom FOV", "Vanilla is 18. Lower value is more zoomed in");
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
BaseFireSnipe.OnEnter += new hook_OnEnter(BaseFireSnipe_OnEnter);
LanguageAPI.Add("RAILGUNNER_SNIPE_HEAVY_DESCRIPTION", "Launch a heavy projectile for <style=cIsDamage>" + d(Damage) + " damage</style>.");
Changes();
}
private void BaseFireSnipe_OnEnter(orig_OnEnter orig, BaseFireSnipe self)
{
if (self is FireSnipeHeavy)
{
((GenericBulletBaseState)self).damageCoefficient = Damage;
self.piercingDamageCoefficientPerTarget = PiercingDamage;
self.selfKnockbackForce = 0f;
((GenericBulletBaseState)self).recoilAmplitudeY = 4f;
}
orig.Invoke(self);
}
private 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)
CharacterCameraParams val = Addressables.LoadAssetAsync<CharacterCameraParams>((object)"RoR2/DLC1/Railgunner/ccpRailgunnerScopeHeavy.asset").WaitForCompletion();
val.data.fov.value = ZoomFOV;
}
}
public class PolarFieldDevice : TweakBase
{
public static float SpeedBuffVal;
public static float SpeedBuffDur;
public static int Charges;
public static float Cooldown;
public static float Radius;
public static BuffDef SpeedBuff;
public override string Name => ": Utility :: Polar Field Device";
public override string SkillToken => "utility_alt";
public override string DescText => "Throw out a device that <style=cIsUtility>slows down</style> all nearby <style=cIsUtility>enemies and projectiles</style>." + ((SpeedBuffDur > 0f && SpeedBuffVal > 0f) ? (" <style=cIsUtility>Speeds up</style> allies by <style=cIsUtility>" + d(SpeedBuffVal) + "</style> in its radius.") : "") + ((Charges > 1) ? (" Can hold up to " + Charges + ".") : "");
public override void Init()
{
SpeedBuffVal = ConfigOption(0.3f, "Speed Buff", "Decimal. Vanilla is 0");
SpeedBuffDur = ConfigOption(2.5f, "Speed Buff Duration", "Vanilla is 0");
Charges = ConfigOption(1, "Charges", "Vanilla is 1");
Cooldown = ConfigOption(12f, "Cooldown", "Vanilla is 12");
Radius = ConfigOption(16f, "Radius", "Vanilla is 10");
base.Init();
}
public override void Hooks()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
MakeBuff();
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
Changes();
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && sender.GetBuffCount(SpeedBuff) > 0)
{
args.moveSpeedMultAdd += SpeedBuffVal;
}
}
private void MakeBuff()
{
//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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = Addressables.LoadAssetAsync<Texture2D>((object)"RoR2/Base/Common/texMovespeedBuffIcon.tif").WaitForCompletion();
SpeedBuff = ScriptableObject.CreateInstance<BuffDef>();
((Object)SpeedBuff).name = "Polar Field Device Speed";
SpeedBuff.buffColor = Color32.op_Implicit(new Color32((byte)144, (byte)228, byte.MaxValue, (byte)225));
SpeedBuff.canStack = false;
SpeedBuff.iconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f));
SpeedBuff.isDebuff = false;
ContentAddition.AddBuffDef(SpeedBuff);
}
private 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFireMineBlinding.asset").WaitForCompletion();
val.baseMaxStock = Charges;
val.baseRechargeInterval = Cooldown;
GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerMineAltDetonated.prefab").WaitForCompletion();
BuffWard component = val2.GetComponent<BuffWard>();
component.radius = Radius;
BuffWard val3 = val2.AddComponent<BuffWard>();
val3.buffDuration = SpeedBuffDur;
val3.buffDef = SpeedBuff;
val3.radius = Radius;
val3.expires = true;
val3.invertTeamFilter = false;
val3.expireDuration = 10f;
val3.shape = (BuffWardShape)0;
}
}
public class Supercharge : TweakBase
{
public static float Damage;
public static float CritDamage;
public static float PiercingDamage;
public static float ProcCoefficient;
public static float HopooBalance;
public static float Radius;
public override string Name => ": Special : Supercharge";
public override string SkillToken => "special";
public override string DescText => "Fire a <style=cIsDamage>piercing</style> round for <style=cIsDamage>" + d(Damage) + "-" + d((Damage + ScopeAndReload.Damage) * CritDamage * 2f) + " damage</style>. Afterwards, <style=cIsHealth>all your weapons are disabled</style> for <style=cIsHealth>" + HopooBalance + "</style> seconds.";
public override void Init()
{
Damage = ConfigOption(20f, "Damage", "Decimal. Vanilla is 40");
CritDamage = ConfigOption(2f, "Crit Damage Multiplier", "Decimal. Vanilla is 1.5");
PiercingDamage = ConfigOption(1f, "Pierce Damage Falloff", "Decimal. Vanilla is 1. Higher values mean less piercing damage falloff, so more damage overall.");
ProcCoefficient = ConfigOption(1.5f, "Proc Coefficient", "Vanilla is 3");
HopooBalance = ConfigOption(5f, "Disable Duration", "Vanilla is 5");
Radius = ConfigOption(2f, "Radius", "Vanilla is 2");
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
BaseFireSnipe.OnEnter += new hook_OnEnter(BaseFireSnipe_OnEnter);
Offline.OnEnter += new hook_OnEnter(Offline_OnEnter);
LanguageAPI.Add("RAILGUNNER_SNIPE_SUPER_DESCRIPTION", "Launch a super-charged projectile for <style=cIsDamage>" + d(Damage) + " damage</style>. Critical Strike damage is multiplied by <style=cIsDamage>1.5</style>.");
}
private void Offline_OnEnter(orig_OnEnter orig, Offline self)
{
self.baseDuration = 1f + HopooBalance;
orig.Invoke(self);
}
private void BaseFireSnipe_OnEnter(orig_OnEnter orig, BaseFireSnipe self)
{
if (self is FireSnipeSuper)
{
((GenericBulletBaseState)self).damageCoefficient = Damage;
self.piercingDamageCoefficientPerTarget = PiercingDamage;
self.critDamageMultiplier = CritDamage;
((GenericBulletBaseState)self).procCoefficient = ProcCoefficient;
((GenericBulletBaseState)self).recoilAmplitudeY = 7f;
((GenericBulletBaseState)self).bulletRadius = Radius;
}
orig.Invoke(self);
}
}
public class XQRSmartRoundSystem : TweakBase
{
public static float LookCone;
public static float Lifetime;
public static float SelfForce;
public override string Name => ": Primary : XQR Smart Round System";
public override string SkillToken => "primary";
public override string DescText => "Fire aggressive tracking rounds for <style=cIsDamage>100% damage</style>.";
public override void Init()
{
LookCone = ConfigOption(25f, "Max Tracking Angle", "Vanilla is 90");
Lifetime = ConfigOption(0.7f, "Lifetime", "Vanilla is 0.4");
SelfForce = ConfigOption(150f, "Self Force", "Vanilla is 300. Higher value is more knockback");
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
FirePistol.OnEnter += new hook_OnEnter(FirePistol_OnEnter);
Changes();
}
private void FirePistol_OnEnter(orig_OnEnter orig, FirePistol self)
{
self.baseInaccuracyDegrees = 0.4f;
self.selfKnockbackForce = SelfForce;
orig.Invoke(self);
}
private 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)
GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerPistolProjectile.prefab").WaitForCompletion();
val.GetComponent<ProjectileSimple>().lifetime = Lifetime;
val.GetComponent<ProjectileSteerTowardTarget>().rotationSpeed = 9999f;
ProjectileDirectionalTargetFinder component = val.GetComponent<ProjectileDirectionalTargetFinder>();
component.lookCone = LookCone;
component.targetSearchInterval = 0.05f;
}
}
}
namespace HIFURailgunnerTweaks.Misc
{
public class Hitboxes : MiscBase
{
public static float Size;
public override string Name => ":: Misc :: Weakpoints";
public override void Init()
{
base.Init();
Size = ConfigOption(0.75f, "Size Percent", "Decimal. Vanilla is 1");
}
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
HurtBox.OnEnable += new hook_OnEnable(HurtBox_OnEnable);
}
private void HurtBox_OnEnable(orig_OnEnable orig, HurtBox self)
{
orig.Invoke(self);
HurtBox.sniperTargetRadius = Size;
}
}
public class ScopeAndReload : MiscBase
{
public static float Damage;
public static float ReloadBarPercent;
public static float ScopeDurUp;
public static float ScopeDurDown;
public static bool ScaleWithAS;
public override string Name => ":: Misc : Scope and Active Reload";
public override void Init()
{
base.Init();
Damage = ConfigOption(5f, "Damage Bonus", "Decimal. Vanilla is 5");
ReloadBarPercent = ConfigOption(0.13f, "Reload Bar Duration", "Vanilla is 0.25. Formula: (Reload Bar Duration / 1.5) * 100 for actual percent");
ScopeDurUp = ConfigOption(0f, "Scope Duration Wind Up", "Vanilla is 0.1");
ScopeDurDown = ConfigOption(0f, "Scope Duration Wind Down", "Vanilla is 0.2");
ScaleWithAS = ConfigOption(value: false, "Scale Reload Bar Duration with Attack Speed?", "Vanilla is true");
}
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
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
BaseWindUp.OnEnter += new hook_OnEnter(BaseWindUp_OnEnter);
BaseWindDown.OnEnter += new hook_OnEnter(BaseWindDown_OnEnter);
Boosted.OnEnter += new hook_OnEnter(Boosted_OnEnter);
Reloading.OnEnter += new hook_OnEnter(Reloading_OnEnter);
LanguageAPI.Add("RAILGUNNER_ACTIVE_RELOAD_DESCRIPTION", "Perfectly time your reload to recover faster and to boost the damage of your next shot by <style=cIsDamage>+" + d(Damage) + "</style>.");
}
private void Reloading_OnEnter(orig_OnEnter orig, Reloading self)
{
self.boostWindowDuration = ReloadBarPercent;
orig.Invoke(self);
if (!ScaleWithAS)
{
self.duration = self.boostWindowDelay + self.boostWindowDuration + (self.baseDuration - (self.boostWindowDelay + self.boostWindowDuration));
self.adjustedBoostWindowDelay = Mathf.Min(self.boostWindowDelay / self.baseDuration * self.duration, self.boostWindowDelay);
self.adjustedBoostWindowDuration = Mathf.Max((self.boostWindowDelay + self.boostWindowDuration) / self.baseDuration * self.duration, self.boostWindowDelay + self.boostWindowDuration) - self.adjustedBoostWindowDelay;
}
}
private void Boosted_OnEnter(orig_OnEnter orig, Boosted self)
{
self.bonusDamageCoefficient = Damage;
orig.Invoke(self);
}
private void BaseWindDown_OnEnter(orig_OnEnter orig, BaseWindDown self)
{
self.baseDuration = ScopeDurUp;
if (self is WindDownScopeHeavy || self is WindDownScopeLight)
{
self.baseDuration = ScopeDurDown;
}
orig.Invoke(self);
}
private void BaseWindUp_OnEnter(orig_OnEnter orig, BaseWindUp self)
{
self.baseDuration = ScopeDurUp;
if (self is WindUpScopeHeavy || self is WindUpScopeLight)
{
self.baseDuration = ScopeDurUp;
}
orig.Invoke(self);
}
}
}