Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RailgunnerRebloated v1.0.1
RailgunnerRebloated.dll
Decompiled 4 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AncientScepter; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using EntityStates.Railgunner.Backpack; using EntityStates.Railgunner.Reload; using EntityStates.Railgunner.Weapon; using IL.EntityStates.Railgunner.Backpack; using IL.EntityStates.Railgunner.Weapon; using IL.RoR2.Skills; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Railgunner.Backpack; using On.EntityStates.Railgunner.Reload; using On.EntityStates.Railgunner.Weapon; using On.RoR2; using On.RoR2.Skills; using R2API; using R2API.Utils; using RailgunnerRebloated.Components; using RoR2; using RoR2.HudOverlay; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RailgunnerRebloated")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyProduct("RailgunnerRebloated")] [assembly: AssemblyTitle("RailgunnerRebloated")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace RailgunnerRebloated { internal static class LanguageTokens { public const string ChargeKeywordToken = "KEYWORD_RAILGUNNERREBLOATED_CHARGE"; public const string PrimaryDescToken = "RAILGUNNER_PRIMARY_DESCRIPTION_RAILGUNNERREBLOATED"; public const string ScopeHeavyDescToken = "RAILGUNNER_SECONDARY_DESCRIPTION_RAILGUNNERREBLOATED"; public const string ScopeLightDescToken = "RAILGUNNER_SECONDARY_ALT_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SnipeHeavyDescToken = "RAILGUNNER_SNIPE_HEAVY_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SnipeLightDescToken = "RAILGUNNER_SNIPE_LIGHT_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SpecialDescToken = "RAILGUNNER_SPECIAL_ALT_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SuperchargeDescToken = "RAILGUNNER_SNIPE_CRYO_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SpecialAltDescToken = "RAILGUNNER_SPECIAL_DESCRIPTION_RAILGUNNERREBLOATED"; public const string CryochargeDescToken = "RAILGUNNER_SNIPE_SUPER_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SpecialScepterDescToken = "RAILGUNNER_SPECIAL_SCEPTER_DESCRIPTION_RAILGUNNERREBLOATED"; public const string SpecialAltScepterDescToken = "RAILGUNNER_SPECIAL_SCEPTER_ALT_DESCRIPTION_RAILGUNNERREBLOATED"; internal static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Language.GetLocalizedStringByToken += new hook_GetLocalizedStringByToken(Language_GetLocalizedStringByToken); LanguageAPI.Add("KEYWORD_RAILGUNNERREBLOATED_CHARGE", "<style=cKeywordName>X% Charge</style><style=cSub>The skill draws from a shared Charge pool. Once Charge is depleted, <style=cIsHealth>all your weapons are disabled</style> for <style=cIsHealth>5</style> seconds."); LanguageAPI.Add("RAILGUNNER_PRIMARY_DESCRIPTION_RAILGUNNERREBLOATED", "Fire aggressive tracking rounds that deal <style=cIsDamage>100% damage</style> and restore <style=cIsUtility>Charge</style> on hit."); LanguageAPI.Add("RAILGUNNER_SECONDARY_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>20% Charge</style>. Activate your <style=cIsUtility>long-range scope</style>, highlighting <style=cIsDamage>Weak Points</style> and transforming your weapon into a piercing <style=cIsDamage>900% damage</style> railgun."); LanguageAPI.Add("RAILGUNNER_SNIPE_HEAVY_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>20% Charge</style>. Launch a heavy projectile for <style=cIsDamage>900% damage</style>."); LanguageAPI.Add("RAILGUNNER_SECONDARY_ALT_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>10% Charge</style>. Activate your <style=cIsUtility>short-range scope</style>, highlighting <style=cIsDamage>Weak Points</style> and transforming your weapon into a quick <style=cIsDamage>500% damage</style> railgun."); LanguageAPI.Add("RAILGUNNER_SNIPE_LIGHT_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>10% Charge</style>. Launch a light projectile for <style=cIsDamage>500% damage</style>."); LanguageAPI.Add("RAILGUNNER_SPECIAL_ALT_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>100% Charge</style>. Fire a <style=cIsDamage>piercing</style> round for <style=cIsDamage>1000%-5000% damage</style> based on <style=cIsUtility>Charge</style> consumed. Afterwards, <style=cIsHealth>all your weapons are disabled</style> for <style=cIsHealth>5</style> seconds."); LanguageAPI.Add("RAILGUNNER_SNIPE_CRYO_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>100% Charge</style>. Launch a super-charged projectile for <style=cIsDamage>1000%-5000% damage</style> based on <style=cIsUtility>Charge</style> consumed."); LanguageAPI.Add("RAILGUNNER_SPECIAL_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>40% Charge</style>. <style=cIsUtility>Freezing</style>. Fire a <style=cIsDamage>piercing</style> round for <style=cIsDamage>2500% damage</style>."); LanguageAPI.Add("RAILGUNNER_SNIPE_SUPER_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>40% Charge</style>. <style=cIsUtility>Freezing</style>. Launch a super-cooled projectile for <style=cIsDamage>2500% damage</style>."); LanguageAPI.Add("RAILGUNNER_SPECIAL_SCEPTER_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>100% Charge</style>. Fire a <style=cIsDamage>piercing</style> round for <style=cIsDamage>2000%-10000% damage</style> based on <style=cIsUtility>Charge</style> consumed. Afterwards, <style=cIsHealth>all your weapons are disabled</style> for <style=cIsHealth>5</style> seconds."); LanguageAPI.Add("RAILGUNNER_SPECIAL_SCEPTER_ALT_DESCRIPTION_RAILGUNNERREBLOATED", "<style=cIsHealth>40% Charge</style>. <style=cIsUtility>Freezing</style>. Fire a <style=cIsDamage>piercing</style> round for <style=cIsDamage>5000% damage</style>."); } private static string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token) { string text = orig.Invoke(self, token); if (text != token) { switch (token) { case "RAILGUNNER_SECONDARY_ALT_DESCRIPTION": case "RAILGUNNER_SNIPE_LIGHT_DESCRIPTION": text = text.Replace("400", "600"); break; case "KEYWORD_ACTIVERELOAD": text = text.Replace("500", "300"); break; } } return text; } } internal class PluginUtils { internal static bool scepterLoaded; internal static ItemIndex ScepterIndex = (ItemIndex)(-1); internal static void SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value) { //IL_0016: 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) string fieldName2 = fieldName; string value2 = value; AsyncOperationHandle<EntityStateConfiguration> val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath); val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> handle) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SetAddressableEntityStateField_String_Completed(handle, fieldName2, value2); }; } private static void SetAddressableEntityStateField_String_Completed(AsyncOperationHandle<EntityStateConfiguration> handle, string fieldName, string value) { EntityStateConfiguration result = handle.Result; for (int i = 0; i < result.serializedFieldsCollection.serializedFields.Length; i++) { if (result.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { result.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value; return; } } Debug.LogError((object)("RailgunnerRebloated: " + ((object)result)?.ToString() + " does not have field " + fieldName)); } internal static void SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object newObject) { //IL_0016: 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) string fieldName2 = fieldName; Object newObject2 = newObject; AsyncOperationHandle<EntityStateConfiguration> val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath); val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> handle) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SetAddressableEntityStateField_Object_Completed(handle, fieldName2, newObject2); }; } private static void SetAddressableEntityStateField_Object_Completed(AsyncOperationHandle<EntityStateConfiguration> handle, string fieldName, Object newObject) { EntityStateConfiguration result = handle.Result; for (int i = 0; i < result.serializedFieldsCollection.serializedFields.Length; i++) { if (result.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { result.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject; return; } } Debug.LogError((object)("RailgunnerRebloated: " + ((object)result)?.ToString() + " does not have field " + fieldName)); } internal static void AddChargeKeywordToStart(SkillDef skillDef) { List<string> list = new List<string> { "KEYWORD_RAILGUNNERREBLOATED_CHARGE" }; if (skillDef.keywordTokens != null) { list.AddRange(skillDef.keywordTokens); } skillDef.keywordTokens = list.ToArray(); } internal static void RegisterScepterSkill(SkillDef skill, SkillDef orig) { if (scepterLoaded) { RegisterScepterSkillInternal(skill, orig); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void RegisterScepterSkillInternal(SkillDef skill, SkillDef orig) { if (skill.skillNameToken == "ANCIENTSCEPTER_RAILGUNNER_SNIPESUPERNAME") { skill.icon = SpriteAssets.RailgunnerSupercharge2; } else if (skill.skillNameToken == "ANCIENTSCEPTER_RAILGUNNER_SNIPECRYONAME") { skill.icon = SpriteAssets.RailgunnerCryocharge2; } ItemBase<AncientScepterItem>.instance.RegisterScepterSkill(skill, "RailgunnerBody", orig); } } [BepInPlugin("com.Moffein.RailgunnerRebloated", "RailgunnerRebloated", "1.0.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RailgunnerRebloatedPlugin : BaseUnityPlugin { public static ConfigEntry<bool> scaleOfflineAttackSpeed; public static ModdedDamageType RestoreChargeOnHit; private void ReadConfig() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown scaleOfflineAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Charge Mechanics", "Offline Attack Speed Scaling"), false, new ConfigDescription("When out of Charge, the skill-disable state ends faster with more attack speed. If false, scales with Cooldown instead.", (AcceptableValueBase)null, Array.Empty<object>())); } internal void Awake() { PluginUtils.scepterLoaded = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter"); ReadConfig(); LanguageTokens.Init(); AddPassiveComponent(); ModifyPrimary(); ModifySnipeHeavy(); ModifySnipeLight(); ModifySupercharge(); ModifyCryocharge(); if (PluginUtils.scepterLoaded) { SetupSuperchargeScepter(); SetupCryochargeScepter(); } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoadActions)); } private void OnLoadActions() { //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) PluginUtils.ScepterIndex = ItemCatalog.FindItemIndex("ITEM_ANCIENT_SCEPTER"); } private void AddPassiveComponent() { //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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerBody.prefab").WaitForCompletion(); RailgunnerBatteryController railgunnerBatteryController = val.AddComponent<RailgunnerBatteryController>(); railgunnerBatteryController.overlayPrefab = BuildOverlay(); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Backpack.OnlineCryo.asset", "cooldownParamName", ""); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Backpack.OnlineSuper.asset", "cooldownParamName", ""); Offline.OnEnter += new hook_OnEnter(Offline_OnEnter); Offline.OnExit += new hook_OnExit(Offline_OnExit); if (!scaleOfflineAttackSpeed.Value) { Offline.OnEnter += new Manipulator(Offline_RemoveAttackSpeedScaling); } RailgunSkillDef.OnFixedUpdate += new Manipulator(RailgunSkillDef_DisableVanillaOfflineCooldown); RailgunSkillDef.OnFixedUpdate += new hook_OnFixedUpdate(RailgunSkillDef_OnFixedUpdate); Reloading.FixedUpdate += new hook_FixedUpdate(Reloading_FixedUpdate); BaseCharged.FixedUpdate += new hook_FixedUpdate(BaseCharged_FixedUpdate); SkillLocator.DeductCooldownFromAllSkillsAuthority += new hook_DeductCooldownFromAllSkillsAuthority(SkillLocator_DeductCooldownFromAllSkillsAuthority); SkillLocator.ApplyAmmoPack += new hook_ApplyAmmoPack(SkillLocator_ApplyAmmoPack); BaseCharging.OnEnter += new hook_OnEnter(BaseCharging_OnEnter); BaseCharging.OnExit += new hook_OnExit(BaseCharging_OnExit); BaseCharged.OnEnter += new hook_OnEnter(BaseCharged_OnEnter); BaseCharged.OnExit += new hook_OnExit(BaseCharged_OnExit); } private GameObject BuildOverlay() { //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 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerOverchargeUI.prefab").WaitForCompletion(), "RailgunnerRebloatedUI", false); Transform val2 = val.transform.Find("BarContainer/SoftGlow/Text, Normal"); ((Component)val2).gameObject.SetActive(false); Transform val3 = val.transform.Find("BarContainer/Inner/SpinnySquare"); ((Component)val3).gameObject.SetActive(false); return val; } private void ModifyPrimary() { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Railgunner/RailgunnerCrosshair.prefab").WaitForCompletion(); CrosshairController component = val.GetComponent<CrosshairController>(); for (int i = 0; i < component.skillStockSpriteDisplays.Length; i++) { component.skillStockSpriteDisplays[i].target.transform.localScale = Vector3.zero; component.skillStockSpriteDisplays[i].target.SetActive(false); } component.skillStockSpriteDisplays = (SkillStockSpriteDisplay[])(object)new SkillStockSpriteDisplay[0]; RestoreChargeOnHit = DamageAPI.ReserveDamageType(); GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; FirePistol.FireBullet += new Manipulator(FirePistol_FireBullet); RailgunSkillDef val2 = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFirePistol.asset").WaitForCompletion(); ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_PRIMARY_DESCRIPTION_RAILGUNNERREBLOATED"; PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val2); } private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport) { //IL_000f: 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_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)damageReport.attackerBody) && damageReport.attackerBodyIndex == BodyPrefabs.RailgunnerBody.bodyIndex && DamageAPI.HasModdedDamageType(damageReport.damageInfo, RestoreChargeOnHit)) { RailgunnerBatteryController component = ((Component)damageReport.attackerBody).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.AddChargeServer(0.0115f); } } } private void ModifySnipeHeavy() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0084: Unknown result type (might be due to invalid IL or missing references) PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeHeavy.asset", "bulletRadius", "1"); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeHeavy.asset", "damageCoefficient", "9"); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeHeavy.asset", "piercingDamageCoefficientPerTarget", "1"); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Reload.Boosted.asset", "bonusDamageCoefficient", "3"); FireSnipeHeavy.ModifyBullet += new hook_ModifyBullet(FireSnipeHeavy_ModifyBullet); RailgunSkillDef val = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyScopeHeavy.asset").WaitForCompletion(); RailgunSkillDef val2 = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFireSnipeHeavy.asset").WaitForCompletion(); ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_SNIPE_HEAVY_DESCRIPTION_RAILGUNNERREBLOATED"; ((SkillDef)val).skillDescriptionToken = "RAILGUNNER_SECONDARY_DESCRIPTION_RAILGUNNERREBLOATED"; PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val); PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val2); } private void ModifySnipeLight() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002d: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeLight.asset", "damageCoefficient", "5"); FireSnipeLight.ModifyBullet += new hook_ModifyBullet(FireSnipeLight_ModifyBullet); RailgunSkillDef val = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyScopeLight.asset").WaitForCompletion(); RailgunSkillDef val2 = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFireSnipeLight.asset").WaitForCompletion(); ((SkillDef)val).skillDescriptionToken = "RAILGUNNER_SECONDARY_ALT_DESCRIPTION_RAILGUNNERREBLOATED"; ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_SNIPE_LIGHT_DESCRIPTION_RAILGUNNERREBLOATED"; PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val); PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val2); } private void ModifySupercharge() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) FireSnipeSuper.ModifyBullet += new hook_ModifyBullet(FireSnipeSuper_ModifyBullet); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeSuper.asset", "critDamageMultiplier", "1"); PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeSuper.asset", "procCoefficient", "1.5"); BaseCharging.FixedUpdate += new Manipulator(BaseCharging_FixedUpdate); BaseCharged.OnOverlayInstanceAdded += new hook_OnOverlayInstanceAdded(BaseCharged_OnOverlayInstanceAdded); RailgunSkillDef val = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeSuper.asset").WaitForCompletion(); RailgunSkillDef val2 = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFireSnipeSuper.asset").WaitForCompletion(); ((SkillDef)val).skillDescriptionToken = "RAILGUNNER_SPECIAL_ALT_DESCRIPTION_RAILGUNNERREBLOATED"; ((SkillDef)val).beginSkillCooldownOnSkillEnd = true; ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_SNIPE_CRYO_DESCRIPTION_RAILGUNNERREBLOATED"; PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val); PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val2); } private void ModifyCryocharge() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002d: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) PluginUtils.SetAddressableEntityStateField("RoR2/DLC1/Railgunner/EntityStates.Railgunner.Weapon.FireSnipeCryo.asset", "damageCoefficient", "25"); FireSnipeCryo.ModifyBullet += new hook_ModifyBullet(FireSnipeCryo_ModifyBullet); RailgunSkillDef val = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeCryo.asset").WaitForCompletion(); RailgunSkillDef val2 = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyFireSnipeCryo.asset").WaitForCompletion(); ((SkillDef)val).skillDescriptionToken = "RAILGUNNER_SPECIAL_DESCRIPTION_RAILGUNNERREBLOATED"; ((SkillDef)val).beginSkillCooldownOnSkillEnd = true; ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_SNIPE_SUPER_DESCRIPTION_RAILGUNNERREBLOATED"; PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val); PluginUtils.AddChargeKeywordToStart((SkillDef)(object)val2); } private void SetupSuperchargeScepter() { //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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) RailgunSkillDef val = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeSuper.asset").WaitForCompletion(); RailgunSkillDef val2 = ScriptableObject.CreateInstance<RailgunSkillDef>(); ((SkillDef)val2).skillNameToken = "ANCIENTSCEPTER_RAILGUNNER_SNIPESUPERNAME"; ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_SPECIAL_SCEPTER_DESCRIPTION_RAILGUNNERREBLOATED"; ((SkillDef)val2).icon = null; ((SkillDef)val2).baseRechargeInterval = ((SkillDef)val).baseRechargeInterval; ((SkillDef)val2).beginSkillCooldownOnSkillEnd = ((SkillDef)val).beginSkillCooldownOnSkillEnd; ((SkillDef)val2).baseMaxStock = ((SkillDef)val).baseMaxStock; ((SkillDef)val2).activationState = ((SkillDef)val).activationState; ((SkillDef)val2).activationStateMachineName = ((SkillDef)val).activationStateMachineName; ((SkillDef)val2).attackSpeedBuffsRestockSpeed = ((SkillDef)val).attackSpeedBuffsRestockSpeed; ((SkillDef)val2).attackSpeedBuffsRestockSpeed_Multiplier = ((SkillDef)val).attackSpeedBuffsRestockSpeed_Multiplier; ((SkillDef)val2).autoHandleLuminousShot = ((SkillDef)val).autoHandleLuminousShot; ((SkillDef)val2).cancelSprintingOnActivation = ((SkillDef)val).cancelSprintingOnActivation; ((SkillDef)val2).canceledFromSprinting = ((SkillDef)val).canceledFromSprinting; ((SkillDef)val2).dontAllowPastMaxStocks = ((SkillDef)val).dontAllowPastMaxStocks; ((SkillDef)val2).forceSprintDuringState = ((SkillDef)val).forceSprintDuringState; ((SkillDef)val2).fullRestockOnAssign = ((SkillDef)val).forceSprintDuringState; ((SkillDef)val2).hideCooldown = ((SkillDef)val).hideCooldown; ((SkillDef)val2).hideStockCount = ((SkillDef)val).hideStockCount; ((SkillDef)val2).interruptPriority = ((SkillDef)val).interruptPriority; ((SkillDef)val2).isCombatSkill = ((SkillDef)val).isCombatSkill; ((SkillDef)val2).isCooldownBlockedUntilManuallyReset = ((SkillDef)val).isCooldownBlockedUntilManuallyReset; ((SkillDef)val2).keywordTokens = ((SkillDef)val).keywordTokens; ((SkillDef)val2).mustKeyPress = ((SkillDef)val).mustKeyPress; ((SkillDef)val2).rechargeStock = ((SkillDef)val).rechargeStock; ((SkillDef)val2).requiredStock = ((SkillDef)val).requiredStock; ((SkillDef)val2).resetCooldownTimerOnUse = ((SkillDef)val).resetCooldownTimerOnUse; ((SkillDef)val2).skillName = ((SkillDef)val).skillName + "RebloatedScepter"; ((SkillDef)val2).stockToConsume = ((SkillDef)val).stockToConsume; ((SkillDef)val2).suppressSkillActivation = ((SkillDef)val).suppressSkillActivation; ((SkillDef)val2).triggeredByPressRelease = ((SkillDef)val).triggeredByPressRelease; val2.restockOnReload = val.restockOnReload; val2.offlineIcon = val.offlineIcon; PluginUtils.RegisterScepterSkill((SkillDef)(object)val2, (SkillDef)(object)val); } private void SetupCryochargeScepter() { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) RailgunSkillDef val = Addressables.LoadAssetAsync<RailgunSkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeCryo.asset").WaitForCompletion(); RailgunSkillDef val2 = ScriptableObject.CreateInstance<RailgunSkillDef>(); ((SkillDef)val2).skillNameToken = "ANCIENTSCEPTER_RAILGUNNER_SNIPECRYONAME"; ((SkillDef)val2).skillDescriptionToken = "RAILGUNNER_SPECIAL_SCEPTER_ALT_DESCRIPTION_RAILGUNNERREBLOATED"; ((SkillDef)val2).icon = null; ((SkillDef)val2).baseRechargeInterval = ((SkillDef)val).baseRechargeInterval; ((SkillDef)val2).beginSkillCooldownOnSkillEnd = ((SkillDef)val).beginSkillCooldownOnSkillEnd; ((SkillDef)val2).baseMaxStock = ((SkillDef)val).baseMaxStock; ((SkillDef)val2).activationState = ((SkillDef)val).activationState; ((SkillDef)val2).activationStateMachineName = ((SkillDef)val).activationStateMachineName; ((SkillDef)val2).attackSpeedBuffsRestockSpeed = ((SkillDef)val).attackSpeedBuffsRestockSpeed; ((SkillDef)val2).attackSpeedBuffsRestockSpeed_Multiplier = ((SkillDef)val).attackSpeedBuffsRestockSpeed_Multiplier; ((SkillDef)val2).autoHandleLuminousShot = ((SkillDef)val).autoHandleLuminousShot; ((SkillDef)val2).cancelSprintingOnActivation = ((SkillDef)val).cancelSprintingOnActivation; ((SkillDef)val2).canceledFromSprinting = ((SkillDef)val).canceledFromSprinting; ((SkillDef)val2).dontAllowPastMaxStocks = ((SkillDef)val).dontAllowPastMaxStocks; ((SkillDef)val2).forceSprintDuringState = ((SkillDef)val).forceSprintDuringState; ((SkillDef)val2).fullRestockOnAssign = ((SkillDef)val).forceSprintDuringState; ((SkillDef)val2).hideCooldown = ((SkillDef)val).hideCooldown; ((SkillDef)val2).hideStockCount = ((SkillDef)val).hideStockCount; ((SkillDef)val2).interruptPriority = ((SkillDef)val).interruptPriority; ((SkillDef)val2).isCombatSkill = ((SkillDef)val).isCombatSkill; ((SkillDef)val2).isCooldownBlockedUntilManuallyReset = ((SkillDef)val).isCooldownBlockedUntilManuallyReset; ((SkillDef)val2).keywordTokens = ((SkillDef)val).keywordTokens; ((SkillDef)val2).mustKeyPress = ((SkillDef)val).mustKeyPress; ((SkillDef)val2).rechargeStock = ((SkillDef)val).rechargeStock; ((SkillDef)val2).requiredStock = ((SkillDef)val).requiredStock; ((SkillDef)val2).resetCooldownTimerOnUse = ((SkillDef)val).resetCooldownTimerOnUse; ((SkillDef)val2).skillName = ((SkillDef)val).skillName + "RebloatedScepter"; ((SkillDef)val2).stockToConsume = ((SkillDef)val).stockToConsume; ((SkillDef)val2).suppressSkillActivation = ((SkillDef)val).suppressSkillActivation; ((SkillDef)val2).triggeredByPressRelease = ((SkillDef)val).triggeredByPressRelease; val2.restockOnReload = val.restockOnReload; val2.offlineIcon = val.offlineIcon; PluginUtils.RegisterScepterSkill((SkillDef)(object)val2, (SkillDef)(object)val); } private void FirePistol_FireBullet(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<ProjectileManager>(x, "FireProjectile") })) { val.EmitDelegate<Func<FireProjectileInfo, FireProjectileInfo>>((Func<FireProjectileInfo, FireProjectileInfo>)delegate(FireProjectileInfo info) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (info.damageTypeOverride.HasValue) { DamageTypeCombo value = info.damageTypeOverride.Value; DamageAPI.AddModdedDamageType(ref value, RestoreChargeOnHit); info.damageTypeOverride = value; } return info; }); } else { Debug.LogError((object)"RailgunnerRebloated: FirePistol IL hook failed."); } } private void BaseCharging_FixedUpdate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<ImageFillController>(x, "SetTValue") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, BaseCharging, float>>((Func<float, BaseCharging, float>)delegate(float tVal, BaseCharging self) { RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.SetRechargeDelay(); float storedCharge = component.GetStoredCharge(); float num = Mathf.Max(0f, storedCharge - component.GetStoredChargeToConsume()); float num2 = Mathf.Min(1f, ((EntityState)self).fixedAge / self.duration); return Mathf.Lerp(storedCharge, num, num2); } return tVal; }); } else { Debug.LogError((object)"RailgunnerRebloated: BaseCharging SetTValue IL hook failed."); } } private void SkillLocator_ApplyAmmoPack(orig_ApplyAmmoPack orig, SkillLocator self) { orig.Invoke(self); RailgunnerBatteryController component = ((Component)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.AddCharge(1f); } } private void BaseCharged_OnOverlayInstanceAdded(orig_OnOverlayInstanceAdded orig, BaseCharged self, OverlayController controller, GameObject instance) { orig.Invoke(self, controller, instance); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } float fillAmount = component.GetStoredChargeToConsume(); if (!Object.op_Implicit((Object)(object)instance)) { return; } Transform val = instance.transform.Find("BarContainer/Inner/FillBarDimensions/FillBar"); if (Object.op_Implicit((Object)(object)val)) { Image component2 = ((Component)val).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component2)) { if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special) && Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special.baseSkill) && RailgunnerBatteryController.RailgunnerSpecialChargeDisplayOverrides.TryGetValue(((EntityState)self).skillLocator.special.baseSkill, out var value)) { fillAmount = value; } component2.fillAmount = fillAmount; } } else { Debug.LogError((object)"RailgunnerRebloated: BaseCharged_OnOverlayInstanceAdded could not find target FillBar."); } } private void FireSnipeSuper_ModifyBullet(orig_ModifyBullet orig, FireSnipeSuper self, BulletAttack bulletAttack) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, bulletAttack); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { float storedCharge = component.GetStoredCharge(); float num = Mathf.Lerp(10f, 50f, storedCharge); bulletAttack.damage = ((BaseState)self).damageStat * num; if ((int)PluginUtils.ScepterIndex != -1 && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.inventory) && ((EntityState)self).characterBody.inventory.GetItemCountEffective(PluginUtils.ScepterIndex) > 0) { bulletAttack.damage *= 2f; bulletAttack.procCoefficient *= 2f; bulletAttack.radius *= 1.5f; } } } private void BaseCharging_OnEnter(orig_OnEnter orig, BaseCharging self) { orig.Invoke(self); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { float chargeToConsume = 1f; if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special) && Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.special.baseSkill) && RailgunnerBatteryController.RailgunnerSpecialChargeCosts.TryGetValue(((EntityState)self).skillLocator.special.baseSkill, out var value)) { chargeToConsume = value; } component.StoreCharge(chargeToConsume); component.SetChargeUiEnabled(enabled: false); } } private void SkillLocator_DeductCooldownFromAllSkillsAuthority(orig_DeductCooldownFromAllSkillsAuthority orig, SkillLocator self, float deduction) { orig.Invoke(self, deduction); RailgunnerBatteryController component = ((Component)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.AddCharge(deduction / component.GetScaledRechargeTime()); } } private void FireSnipeLight_ModifyBullet(orig_ModifyBullet orig, FireSnipeLight self, BulletAttack bulletAttack) { orig.Invoke(self, bulletAttack); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { int num = 10; if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.secondary)) { num += 2 * ((EntityState)self).skillLocator.secondary.bonusStockFromBody; } component.SubtractCharge(1.05f / (float)num, canDisableSkills: true); component.SetRechargeDelay(); } } private void FireSnipeHeavy_ModifyBullet(orig_ModifyBullet orig, FireSnipeHeavy self, BulletAttack bulletAttack) { orig.Invoke(self, bulletAttack); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { int num = 5; if (Object.op_Implicit((Object)(object)((EntityState)self).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)self).skillLocator.secondary)) { num += ((EntityState)self).skillLocator.secondary.bonusStockFromBody; } component.SubtractCharge(1.1f / (float)num, canDisableSkills: true); component.SetRechargeDelay(); } } private void FireSnipeCryo_ModifyBullet(orig_ModifyBullet orig, FireSnipeCryo self, BulletAttack bulletAttack) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, bulletAttack); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.ConsumeStoredCharge(); } if ((int)PluginUtils.ScepterIndex != -1 && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.inventory) && ((EntityState)self).characterBody.inventory.GetItemCountEffective(PluginUtils.ScepterIndex) > 0) { bulletAttack.damage *= 2f; bulletAttack.procCoefficient *= 2f; bulletAttack.radius *= 1.5f; } } private void Offline_RemoveAttackSpeedScaling(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<BaseState>(x, "attackSpeedStat") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, Offline, float>>((Func<float, Offline, float>)delegate(float atkSpd, Offline self) { RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); return Object.op_Implicit((Object)(object)component) ? (component.baseRechargeTime / Mathf.Max(0.01f, component.GetScaledRechargeTime())) : 1f; }); } else { Debug.LogError((object)"RailgunnerRebloated: Offline_RemoveAttackSpeedScaling IL hook failed."); } } private void RailgunSkillDef_DisableVanillaOfflineCooldown(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<RailgunSkillDef>(x, "IsBackpackOffline") })) { val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool isOffline) => false)); } else { Debug.LogError((object)"RailgunnerRebloated: RailgunSkillDef_OnFixedUpdate IL Hook failed."); } } private void RailgunSkillDef_OnFixedUpdate(orig_OnFixedUpdate orig, RailgunSkillDef self, GenericSkill skillSlot, float deltaTime) { if (self.IsBackpackOffline(skillSlot)) { deltaTime = 0f; } orig.Invoke(self, skillSlot, deltaTime); } private void BaseCharged_OnExit(orig_OnExit orig, BaseCharged self) { orig.Invoke(self); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.SetChargeUiEnabled(enabled: true); } } private void BaseCharged_OnEnter(orig_OnEnter orig, BaseCharged self) { orig.Invoke(self); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.SetChargeUiEnabled(enabled: false); } } private void BaseCharging_OnExit(orig_OnExit orig, BaseCharging self) { orig.Invoke(self); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.SetChargeUiEnabled(enabled: true); } } private void Reloading_FixedUpdate(orig_FixedUpdate orig, Reloading self) { orig.Invoke(self); SetRechargeDelay((EntityState)(object)self); } private void BaseCharged_FixedUpdate(orig_FixedUpdate orig, BaseCharged self) { orig.Invoke(self); SetRechargeDelay((EntityState)(object)self); } private void Offline_OnEnter(orig_OnEnter orig, Offline self) { orig.Invoke(self); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = false; } } private void Offline_OnExit(orig_OnExit orig, Offline self) { orig.Invoke(self); RailgunnerBatteryController component = ((EntityState)self).GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = true; } } private static void SetRechargeDelay(EntityState state) { RailgunnerBatteryController component = state.GetComponent<RailgunnerBatteryController>(); if (Object.op_Implicit((Object)(object)component)) { component.SetRechargeDelay(); } } } } namespace RailgunnerRebloated.Components { public class RailgunnerBatteryController : NetworkBehaviour { public static Dictionary<SkillDef, float> RailgunnerSpecialChargeCosts; public static Dictionary<SkillDef, float> RailgunnerSpecialChargeDisplayOverrides; public static bool allowZeroCooldown; public float baseRechargeTime = 20f; public float rechargeDelay = 1.2f; public GameObject overlayPrefab; private bool chargeUiEnabled = false; private SkillLocator skillLocator; private CharacterBody body; private EntityStateMachine backpackMachine; private float chargePercent = 1f; private float rechargeDelayTimer = 0f; private Animator animator; private OverlayController overlayController; private List<ImageFillController> fillUiList = new List<ImageFillController>(); private float storedCharge = 0f; private float storedChargeToConsume = 0f; private static int kRpcRpcAddCharge; public void AddChargeServer(float charge) { if (NetworkServer.active) { CallRpcAddCharge(charge); } } [ClientRpc] private void RpcAddCharge(float charge) { AddCharge(charge); } public void StoreCharge(float chargeToConsume) { storedCharge = chargePercent; storedChargeToConsume = Mathf.Min(chargeToConsume, chargePercent); } public float GetStoredCharge() { return storedCharge; } public float GetStoredChargeToConsume() { return storedChargeToConsume; } public void ConsumeStoredCharge() { chargePercent = storedCharge; SubtractCharge(storedChargeToConsume, canDisableSkills: true); } private void OnEnable() { if (!Object.op_Implicit((Object)(object)body)) { body = ((Component)this).GetComponent<CharacterBody>(); } if (!Object.op_Implicit((Object)(object)backpackMachine)) { backpackMachine = EntityStateMachine.FindByCustomName(((Component)this).gameObject, "Backpack"); } if (!Object.op_Implicit((Object)(object)skillLocator)) { skillLocator = ((Component)this).GetComponent<SkillLocator>(); } if (!Object.op_Implicit((Object)(object)animator)) { ModelLocator component = ((Component)this).GetComponent<ModelLocator>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.modelTransform)) { animator = ((Component)component.modelTransform).GetComponent<Animator>(); } } chargePercent = 1f; rechargeDelayTimer = 0f; storedCharge = 0f; storedChargeToConsume = 0f; SetChargeUiEnabled(enabled: true); } private void OnDisable() { SetChargeUiEnabled(enabled: false); } public void SetChargeUiEnabled(bool enabled) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (enabled != chargeUiEnabled) { chargeUiEnabled = enabled; if (overlayController != null) { overlayController.onInstanceAdded -= OnOverlayInstanceAdded; overlayController.onInstanceRemove -= OnOverlayInstanceRemoved; fillUiList.Clear(); HudOverlayManager.RemoveOverlay(overlayController); overlayController = null; } if (enabled) { OverlayCreationParams val = default(OverlayCreationParams); val.prefab = overlayPrefab; val.childLocatorEntry = "CrosshairExtras"; OverlayCreationParams val2 = val; overlayController = HudOverlayManager.AddOverlay(((Component)this).gameObject, val2); overlayController.onInstanceAdded += OnOverlayInstanceAdded; overlayController.onInstanceRemove += OnOverlayInstanceRemoved; } } } private void OnOverlayInstanceAdded(OverlayController controller, GameObject instance) { fillUiList.Add(instance.GetComponent<ImageFillController>()); } private void OnOverlayInstanceRemoved(OverlayController controller, GameObject instance) { fillUiList.Remove(instance.GetComponent<ImageFillController>()); } private void FixedUpdate() { if (rechargeDelayTimer > 0f) { rechargeDelayTimer -= Time.fixedDeltaTime; } else if (chargePercent < 1f) { AddCharge(Time.fixedDeltaTime / GetScaledRechargeTime()); } SetBackpackChargeVisual(chargePercent); foreach (ImageFillController fillUi in fillUiList) { fillUi.SetTValue(chargePercent); } } public float GetScaledRechargeTime() { float num = baseRechargeTime; if (Object.op_Implicit((Object)(object)skillLocator) && Object.op_Implicit((Object)(object)skillLocator.secondary)) { num *= skillLocator.secondary.cooldownScale; num -= skillLocator.secondary.flatCooldownReduction; num = Mathf.Max(allowZeroCooldown ? 0f : 0.5f, num); num += skillLocator.secondary.temporaryCooldownPenalty; } return num; } public void SetRechargeDelay() { rechargeDelayTimer = rechargeDelay; } public float GetChargePercent() { return chargePercent; } public void SetCharge(float charge) { chargePercent = charge; } public void AddCharge(float charge) { chargePercent = Mathf.Min(1f, chargePercent + charge); if (Object.op_Implicit((Object)(object)body) && body.HasBuff(Buffs.NoCooldowns)) { chargePercent = 1f; } } public void SubtractCharge(float charge) { SubtractCharge(charge, canDisableSkills: false); } public void SubtractCharge(float charge, bool canDisableSkills) { if (Object.op_Implicit((Object)(object)body) && body.HasBuff(Buffs.NoCooldowns)) { charge = 0f; } chargePercent = Mathf.Max(0f, chargePercent - charge); if (canDisableSkills && chargePercent <= 0f) { DisableSkillsAuthority(); } } public void DisableSkillsAuthority() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority) { EntityState val = (EntityState)new Offline(); if (Object.op_Implicit((Object)(object)backpackMachine) && val != null) { backpackMachine.SetNextState(val); } } } public void SetBackpackChargeVisual(float charge) { if (Object.op_Implicit((Object)(object)animator)) { animator.SetFloat("SpecialCooldown", 1f - charge); } } static RailgunnerBatteryController() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0056: 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) //IL_0098: Expected O, but got Unknown RailgunnerSpecialChargeCosts = new Dictionary<SkillDef, float> { { Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeSuper.asset").WaitForCompletion(), 1f }, { Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeCryo.asset").WaitForCompletion(), 0.4f } }; RailgunnerSpecialChargeDisplayOverrides = new Dictionary<SkillDef, float> { { Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/Railgunner/RailgunnerBodyChargeSnipeCryo.asset").WaitForCompletion(), 1f } }; kRpcRpcAddCharge = 627875651; NetworkBehaviour.RegisterRpcDelegate(typeof(RailgunnerBatteryController), kRpcRpcAddCharge, new CmdDelegate(InvokeRpcRpcAddCharge)); NetworkCRC.RegisterBehaviour("RailgunnerBatteryController", 0); } private void UNetVersion() { } protected static void InvokeRpcRpcAddCharge(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcAddCharge called on server."); } else { ((RailgunnerBatteryController)(object)obj).RpcAddCharge(reader.ReadSingle()); } } public void CallRpcAddCharge(float charge) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcAddCharge called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcAddCharge); val.Write(((Component)this).GetComponent<NetworkIdentity>().netId); val.Write(charge); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcAddCharge"); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } }