Decompiled source of WeaponVariantBinds v1.2.1
WeaponVariantBinds.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WeaponVariantBinds")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WeaponVariantBinds")] [assembly: AssemblyTitle("WeaponVariantBinds")] [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 WeaponVariantBinds { public class ActionSmoothening { [HarmonyPatch(typeof(GunControl), "SwitchWeapon")] public class SwitchWeaponPatch { [HarmonyPrefix] private static bool Prefix(int targetSlotIndex, int? targetVariationIndex = null, bool useRetainedVariation = false, bool cycleSlot = false, bool cycleVariation = false) { if (!Plugin.modEnabled || !actionSmootheningEnabled) { return true; } if (targetSlotIndex > 5) { return true; } return false; } } [HarmonyPatch(typeof(GunControl), "ForceWeapon")] public class ForceWeaponPatch { [HarmonyPrefix] private static bool Prefix(GameObject weapon, bool setActive) { if (!actionSmootheningEnabled || !Plugin.modEnabled) { return true; } shootWhenReady = 0; int[] weaponSlotVariation = PluginConfig.getWeaponSlotVariation(MonoSingleton<GunControl>.Instance.currentWeapon); int num = weaponSlotVariation[0]; int num2 = weaponSlotVariation[1]; if (num < 1 || num2 < 0) { return true; } ActionSmootheningConfig actionSmootheningConfig = PluginConfig.actionSmootheningConfigs[num - 1, num2]; if (switchTime >= 0f) { if (Time.time > switchTime) { PreventWCOrderCycling = false; return true; } if ((Object)(object)weaponToSwitchTo == (Object)(object)weapon) { switchTime = Time.time; } weaponToSwitchTo = weapon; return false; } if (!actionSmootheningConfig.enabled) { return true; } if (actionSmootheningConfig.actionSmootheningTypeSecondary == ActionSmootheningTypeSecondary.FireOnSwitch && timeUntilCurrentWeaponDeploy > 0f - actionSmootheningConfig.maxTime2 && AttemptSecondaryShoot(actionSmootheningConfig)) { return true; } if (actionSmootheningConfig.actionSmootheningTypePrimary == ActionSmootheningTypePrimary.FireOnSwitch && timeUntilCurrentWeaponDeploy > 0f - actionSmootheningConfig.maxTime && AttemptPrimaryShoot(actionSmootheningConfig)) { return true; } if (actionSmootheningConfig.actionSmootheningTypePrimary == ActionSmootheningTypePrimary.WaitOnSwitch) { switchTime = Time.time + actionSmootheningConfig.maxTime; weaponToSwitchTo = weapon; if (!PreventWCOrderCycling) { wcOld = Plugin.newWCThisTick; } PreventWCOrderCycling = true; return false; } if (actionSmootheningConfig.actionSmootheningTypeSecondary == ActionSmootheningTypeSecondary.None) { return true; } if (actionSmootheningConfig.actionSmootheningTypeSecondary == ActionSmootheningTypeSecondary.FireOnReady) { return true; } if (actionSmootheningConfig.actionSmootheningTypePrimary == ActionSmootheningTypePrimary.None) { return true; } if (actionSmootheningConfig.actionSmootheningTypePrimary == ActionSmootheningTypePrimary.FireOnReady) { return true; } return false; } [HarmonyPostfix] private static void Postfix(GameObject weapon, bool setActive) { lastTimeSwitchStarted = Time.time; } } [HarmonyPatch(typeof(RocketLauncher), "Update")] public class RocketLauncherUpdatePatch { [HarmonyPrefix] private static bool Prefix(RocketLauncher __instance) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.modEnabled || !actionSmootheningEnabled) { return true; } if (forceFirceNapalm && ((Component)__instance).GetComponent<RocketLauncher>().variation == 2) { if (!Object.op_Implicit((Object)(object)MonoSingleton<ColorBlindSettings>.Instance)) { return false; } Color val = MonoSingleton<ColorBlindSettings>.Instance.variationColors[__instance.variation]; float num = 1f; if (MonoSingleton<WeaponCharges>.Instance.rocketset && __instance.lookingForValue) { MonoSingleton<WeaponCharges>.Instance.rocketset = false; __instance.lookingForValue = false; __instance.cooldown = (((double)MonoSingleton<WeaponCharges>.Instance.rocketcharge >= 0.25) ? MonoSingleton<WeaponCharges>.Instance.rocketcharge : 0.25f); } else if (__instance.variation == 2) { if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && !GameStateManager.Instance.PlayerInputLocked && !MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame && (double)MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel > 0.0 && (__instance.firingNapalm || (double)MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel >= 0.25)) { if ((double)__instance.cooldown < 0.5) { if (!__instance.firingNapalm) { __instance.napalmMuzzleFlashTransform.localScale = Vector3.one * 3f; __instance.napalmMuzzleFlashParticles.Play(); AudioSource[] napalmMuzzleFlashSounds = __instance.napalmMuzzleFlashSounds; foreach (AudioSource val2 in napalmMuzzleFlashSounds) { val2.pitch = Random.Range(0.9f, 1.1f); val2.Play(); } } __instance.firingNapalm = true; } } else if (__instance.firingNapalm) { __instance.firingNapalm = false; __instance.napalmMuzzleFlashParticles.Stop(); AudioSource[] napalmMuzzleFlashSounds2 = __instance.napalmMuzzleFlashSounds; foreach (AudioSource val3 in napalmMuzzleFlashSounds2) { if (val3.loop) { val3.Stop(); } } __instance.napalmStopSound.pitch = Random.Range(0.9f, 1.1f); __instance.napalmStopSound.Play(); } else { bool flag = false; } if (!__instance.firingNapalm && __instance.napalmMuzzleFlashTransform.localScale != Vector3.zero) { __instance.napalmMuzzleFlashTransform.localScale = Vector3.MoveTowards(__instance.napalmMuzzleFlashTransform.localScale, Vector3.zero, Time.deltaTime * 9f); } if (Object.op_Implicit((Object)(object)__instance.timerArm)) { ((Transform)__instance.timerArm).localRotation = Quaternion.Euler(0f, 0f, Mathf.Lerp(360f, 0f, MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel)); } if (Object.op_Implicit((Object)(object)__instance.timerMeter)) { __instance.timerMeter.fillAmount = MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel; } if ((double)__instance.lastKnownTimerAmount != (double)MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel && (!Object.op_Implicit((Object)(object)__instance.wid) || (double)__instance.wid.delay == 0.0)) { if ((double)MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel >= 0.25 && (double)__instance.lastKnownTimerAmount < 0.25) { Object.Instantiate<AudioSource>(__instance.timerWindupSound); } __instance.lastKnownTimerAmount = MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel; } if (!__instance.firingNapalm && (double)MonoSingleton<WeaponCharges>.Instance.rocketNapalmFuel < 0.25) { val = Color.grey; } } if ((double)__instance.cooldown > 0.0) { __instance.cooldown = Mathf.MoveTowards(__instance.cooldown, 0f, Time.deltaTime); } else if (MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed && MonoSingleton<GunControl>.Instance.activated && !GameStateManager.Instance.PlayerInputLocked) { if (!Object.op_Implicit((Object)(object)__instance.wid) || (double)__instance.wid.delay == 0.0) { __instance.Shoot(); } else { ((MonoBehaviour)__instance).Invoke("Shoot", __instance.wid.delay); __instance.cooldown = 1f; } } for (int k = 0; k < __instance.variationColorables.Length; k++) { ((Graphic)__instance.variationColorables[k]).color = new Color(val.r, val.g, val.b, __instance.colorablesTransparencies[k] * num); } forceFirceNapalm = false; return false; } forceFirceNapalm = false; return true; } [HarmonyPostfix] private static void Postfix(RocketLauncher __instance) { } } [HarmonyPatch(typeof(Railcannon), "Update")] public class RailcannonUpdatePatch { [HarmonyPrefix] private static bool Prefix(Railcannon __instance) { //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.modEnabled || !actionSmootheningEnabled) { return true; } if (forceFirceZoom) { if ((double)__instance.wid.delay > 0.0 && (double)__instance.altCharge < (double)__instance.wc.raicharge) { __instance.altCharge = __instance.wc.raicharge; } float num = __instance.wc.raicharge; if ((double)__instance.wid.delay > 0.0) { num = __instance.altCharge; } if ((double)num < 5.0) { __instance.SetMaterialIntensity(num, true); } else { MonoSingleton<RumbleManager>.Instance.SetVibrationTracked(RumbleProperties.RailcannonIdle, __instance.fullCharge); if (!__instance.fullCharge.activeSelf) { __instance.fullCharge.SetActive(true); if (__instance.variation == 2) { __instance.pitchRise = true; __instance.fullAud.pitch = 0f; } } if (!__instance.wc.railChargePlayed) { __instance.wc.PlayRailCharge(); } ((Component)__instance).transform.localPosition = new Vector3(__instance.wpos.currentDefault.x + Random.Range(-0.005f, 0.005f), __instance.wpos.currentDefault.y + Random.Range(-0.005f, 0.005f), __instance.wpos.currentDefault.z + Random.Range(-0.005f, 0.005f)); __instance.SetMaterialIntensity(1f, false); Color color = MonoSingleton<ColorBlindSettings>.Instance.variationColors[__instance.variation]; __instance.fullChargeLight.color = color; if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame && __instance.gc.activated && !GameStateManager.Instance.PlayerInputLocked) { __instance.fullCharge.SetActive(false); ((Component)__instance).transform.localPosition = __instance.wpos.currentDefault; __instance.wc.raicharge = 0f; __instance.wc.railChargePlayed = false; __instance.altCharge = 0f; if (!Object.op_Implicit((Object)(object)__instance.wid) || (double)__instance.wid.delay == 0.0) { __instance.Shoot(); } else { ((MonoBehaviour)__instance).Invoke("Shoot", __instance.wid.delay); } } } if (!Object.op_Implicit((Object)(object)__instance.wid) || (double)__instance.wid.delay == 0.0) { if (__instance.gc.activated && !GameStateManager.Instance.PlayerInputLocked) { __instance.zooming = true; __instance.cc.Zoom(__instance.cc.defaultFov / 2f); } else if (__instance.zooming) { __instance.zooming = false; __instance.cc.StopZoom(); } } if ((double)__instance.wid.delay != (double)__instance.gotWidDelay) { __instance.gotWidDelay = __instance.wid.delay; if (Object.op_Implicit((Object)(object)__instance.wid) && (double)__instance.wid.delay != 0.0) { AudioSource fullAud = __instance.fullAud; fullAud.volume -= __instance.wid.delay * 2f; if ((double)__instance.fullAud.volume < 0.0) { __instance.fullAud.volume = 0f; } } } if (!__instance.pitchRise) { return false; } __instance.fullAud.pitch = Mathf.MoveTowards(__instance.fullAud.pitch, 2f, Time.deltaTime * 4f); if ((double)__instance.fullAud.pitch != 2.0) { return false; } __instance.pitchRise = false; forceFirceZoom = false; return false; } return true; } } public static bool actionSmootheningEnabled = false; public static GameObject weaponToSwitchTo; public static WeaponCycle wcOld; public static WeaponCycle wcToSwitchTo; public static float switchTime = -1f; public static float timeUntilCurrentWeaponDeploy = 0f; public static bool lastFireStatePrimary = false; public static bool lastFireStateSecondary = false; public static bool forceFirceZoom = false; public static bool forceFirceNapalm = false; public static float lastTimeSwitchStarted = 0f; public static int shootWhenReady = 0; public static bool PreventWCOrderCycling = false; public static bool AttemptRevolverShoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Revolver component = weapon.GetComponent<Revolver>(); if (component.gunReady && ((!component.inman.InputSource.Fire2.WasCanceledThisFrame && (component.inman.PerformingCheatMenuCombo() || GameStateManager.Instance.PlayerInputLocked || !component.inman.InputSource.Fire1.IsPressed)) || !component.shootReady || !((component.gunVariation != 0) ? ((double)component.pierceShotCharge >= 25.0) : ((double)component.pierceShotCharge == 100.0))) && !component.inman.PerformingCheatMenuCombo() && component.inman.InputSource.Fire1.IsPressed && component.shootReady && !component.chargingPierce) { if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.Shoot(1); } else { component.shootReady = false; component.shootCharge = 0f; ((MonoBehaviour)component).Invoke("DelayedShoot", component.wid.delay); } } if (!component.shootReady) { result = true; } return result; } public static bool AttemptShotgunShoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Shotgun val = default(Shotgun); ShotgunHammer val2 = default(ShotgunHammer); if (weapon.TryGetComponent<Shotgun>(ref val)) { if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed && val.gunReady && val.gc.activated && !GameStateManager.Instance.PlayerInputLocked && !val.charging) { if (!Object.op_Implicit((Object)(object)val.wid) || (double)val.wid.delay == 0.0) { val.Shoot(); } else { val.gunReady = false; ((MonoBehaviour)val).Invoke("Shoot", val.wid.delay); } } if (!val.gunReady && !val.meterOverride) { result = true; } } else if (weapon.TryGetComponent<ShotgunHammer>(ref val2)) { MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed = false; if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && !MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed && (double)val2.swingCharge == 1.0 && val2.gunReady && val2.gc.activated && !GameStateManager.Instance.PlayerInputLocked) { val2.chargingSwing = false; val2.swingCharge = 0f; if (!Object.op_Implicit((Object)(object)val2.wid) || (double)val2.wid.delay == 0.0) { val2.Impact(); } else { val2.gunReady = false; ((MonoBehaviour)val2).Invoke("Impact", val2.wid.delay); } } if (!val2.gunReady) { result = true; } } return result; } public static bool AttemptNailgunShoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Nailgun component = weapon.GetComponent<Nailgun>(); if (component.fireCooldown <= 0f) { component.Shoot(); } else { component.fireCooldown = component.currentFireRate; ((MonoBehaviour)component).Invoke("Shoot", component.wid.delay / 10f); } if (component.fireCooldown != 0f) { result = true; } return result; } public static bool AttemptRailcannonShoot(GameObject weapon, ActionSmootheningConfig config1) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) bool result = false; Railcannon component = weapon.GetComponent<Railcannon>(); if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed && component.gc.activated && !GameStateManager.Instance.PlayerInputLocked && MonoSingleton<WeaponCharges>.Instance.raicharge >= 4f) { if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.Shoot(); } else { ((MonoBehaviour)component).Invoke("Shoot", component.wid.delay); } component.fullCharge.SetActive(false); ((Component)component).transform.localPosition = component.wpos.currentDefault; component.wc.raicharge = 0f; component.wc.railChargePlayed = false; component.altCharge = 0f; } if (MonoSingleton<WeaponCharges>.Instance.raicharge == 0f) { result = true; } return result; } public static bool AttemptRocketLauncherShoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; RocketLauncher component = weapon.GetComponent<RocketLauncher>(); if (MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed && MonoSingleton<GunControl>.Instance.activated && !GameStateManager.Instance.PlayerInputLocked && component.cooldown == 0f) { if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.Shoot(); } else { ((MonoBehaviour)component).Invoke("Shoot", component.wid.delay); } result = true; component.cooldown = 1f; } return result; } public static bool AttemptRevolverAlt1Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Revolver component = weapon.GetComponent<Revolver>(); if (component.pierceShotCharge >= 100f) { MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed = true; if ((component.inman.InputSource.Fire2.WasCanceledThisFrame || (!component.inman.PerformingCheatMenuCombo() && !GameStateManager.Instance.PlayerInputLocked && component.inman.InputSource.Fire1.IsPressed)) && component.shootReady && ((component.gunVariation != 0) ? ((double)component.pierceShotCharge >= 25.0) : ((double)component.pierceShotCharge == 100.0))) { result = true; if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.Shoot(2); } else { component.shootReady = false; component.shootCharge = 0f; ((MonoBehaviour)component).Invoke("DelayedShoot2", component.wid.delay); } } } return result; } public static bool AttemptRevolverAlt2Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Revolver component = weapon.GetComponent<Revolver>(); MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if (component.pierceReady && (double)component.coinCharge >= 100.0) { if ((Object)(object)component.cc != (Object)null) { component.cc.StopShake(); } if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { WeaponCharges wc = component.wc; wc.rev1charge -= 100f; } if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { result = true; component.ThrowCoin(); } else { result = true; ((MonoBehaviour)component).Invoke("ThrowCoin", component.wid.delay); component.pierceReady = false; component.pierceCharge = 0f; } } return result; } public static bool AttemptRevolverAlt3Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Revolver component = weapon.GetComponent<Revolver>(); if (component.shootReady && ((component.gunVariation != 0) ? ((double)component.pierceShotCharge >= 25.0) : ((double)component.pierceShotCharge == 100.0)) && component.twirlLevel >= 4f) { result = true; if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.Shoot(2); } else { component.shootReady = false; component.shootCharge = 0f; ((MonoBehaviour)component).Invoke("DelayedShoot2", component.wid.delay); } } return result; } public static bool AttemptShotgunAlt1Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Shotgun val = default(Shotgun); weapon.TryGetComponent<Shotgun>(ref val); ShotgunHammer val2 = default(ShotgunHammer); weapon.TryGetComponent<ShotgunHammer>(ref val2); if ((Object)(object)val != (Object)null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = false; if (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && !GameStateManager.Instance.PlayerInputLocked && val.variation != 1 && val.gunReady && val.gc.activated && val.charging && (val.grenadeForce >= 60f || config1.actionSmootheningTypeSecondary == ActionSmootheningTypeSecondary.FireOnSwitch)) { val.charging = false; result = true; if (!Object.op_Implicit((Object)(object)val.wid) || (double)val.wid.delay == 0.0) { val.ShootSinks(); } else { val.gunReady = false; ((MonoBehaviour)val).Invoke((val.variation == 0) ? "ShootSinks" : "ShootSaw", val.wid.delay); } Object.Destroy((Object)(object)((Component)val.tempChargeSound).gameObject); } } else if ((Object)(object)val2 != (Object)null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = false; MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed && val2.variation != 2 && (val2.variation == 1 || (double)MonoSingleton<WeaponCharges>.Instance.shoAltNadeCharge >= 1.0) && !val2.aboutToSecondary && val2.gunReady && val2.gc.activated && !GameStateManager.Instance.PlayerInputLocked) { val2.gunReady = false; if (!Object.op_Implicit((Object)(object)val2.wid) || (double)val2.wid.delay == 0.0) { result = true; if (val2.variation == 0) { val2.ThrowNade(); } else { val2.Pump(); } } else { val2.aboutToSecondary = true; ((MonoBehaviour)val2).Invoke((val2.variation == 0) ? "ThrowNade" : "Pump", val2.wid.delay); } } } return result; } public static bool AttemptShotgunAlt2Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Shotgun val = default(Shotgun); weapon.TryGetComponent<Shotgun>(ref val); ShotgunHammer val2 = default(ShotgunHammer); weapon.TryGetComponent<ShotgunHammer>(ref val2); if ((Object)(object)val != (Object)null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed && val.variation == 1 && val.gunReady && val.gc.activated && !GameStateManager.Instance.PlayerInputLocked && val.primaryCharge != 3) { val.gunReady = false; result = true; if (!Object.op_Implicit((Object)(object)val.wid) || (double)val.wid.delay == 0.0) { val.Pump(); } else { ((MonoBehaviour)val).Invoke("Pump", val.wid.delay); } } } else if ((Object)(object)val2 != (Object)null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed && val2.variation != 2 && (val2.variation == 1 || (double)MonoSingleton<WeaponCharges>.Instance.shoAltNadeCharge >= 1.0) && !val2.aboutToSecondary && val2.gunReady && val2.gc.activated && !GameStateManager.Instance.PlayerInputLocked && val2.primaryCharge != 3) { val2.gunReady = false; if (!Object.op_Implicit((Object)(object)val2.wid) || (double)val2.wid.delay == 0.0) { result = true; val2.Pump(); } else { val2.aboutToSecondary = true; ((MonoBehaviour)val2).Invoke((val2.variation == 0) ? "ThrowNade" : "Pump", val2.wid.delay); } } } return result; } public static bool AttemptShotgunAlt3Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Shotgun val = default(Shotgun); weapon.TryGetComponent<Shotgun>(ref val); ShotgunHammer val2 = default(ShotgunHammer); weapon.TryGetComponent<ShotgunHammer>(ref val2); if ((Object)(object)val != (Object)null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = false; if (val.variation != 1 && val.gunReady && val.gc.activated && val.charging) { val.charging = false; if (val.variation == 2) { MonoSingleton<WeaponCharges>.Instance.shoSawCharge = 0f; } if (!Object.op_Implicit((Object)(object)val.wid) || (double)val.wid.delay == 0.0) { result = true; if (val.variation == 0) { val.ShootSinks(); } else { val.ShootSaw(); } } else { val.gunReady = false; ((MonoBehaviour)val).Invoke((val.variation == 0) ? "ShootSinks" : "ShootSaw", val.wid.delay); } Object.Destroy((Object)(object)((Component)val.tempChargeSound).gameObject); } } else if ((Object)(object)val2 != (Object)null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = false; if (!MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed && val2.variation == 2 && val2.gunReady && val2.gc.activated && val2.charging) { val2.charging = false; MonoSingleton<WeaponCharges>.Instance.shoSawCharge = 0f; if (!Object.op_Implicit((Object)(object)val2.wid) || (double)val2.wid.delay == 0.0) { result = true; val2.ShootSaw(); } else { val2.gunReady = false; ((MonoBehaviour)val2).Invoke("ShootSaw", val2.wid.delay); } if (Object.op_Implicit((Object)(object)val2.tempChargeSound)) { Object.Destroy((Object)(object)((Component)val2.tempChargeSound).gameObject); } } } return result; } public static bool AttemptNailgunAlt1Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Nailgun component = weapon.GetComponent<Nailgun>(); MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if (component.variation != 0 && component.variation == 1 && (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) && (double)component.wc.naiMagnetCharge >= 1.0) { component.ShootMagnet(); result = true; } return result; } public static bool AttemptNailgunAlt2Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Nailgun component = weapon.GetComponent<Nailgun>(); MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if (component.canShoot && !component.burnOut && (double)component.heatSinks >= 1.0 && (double)component.heatUp >= 0.10000000149011612 && component.variation == 0 && component.gc.activated && !GameStateManager.Instance.PlayerInputLocked) { result = true; if (component.altVersion) { component.SuperSaw(); } else { component.burnOut = true; component.fireCooldown = 0f; component.heatSinks -= 1f; ParticleSystem heatSteam = component.heatSteam; if (heatSteam != null) { heatSteam.Play(); } AudioSource heatSteamAud = component.heatSteamAud; if (heatSteamAud != null) { heatSteamAud.Play(); } component.currentFireRate = component.fireRate - 2.5f; } } return result; } public static bool AttemptNailgunAlt3Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; Nailgun component = weapon.GetComponent<Nailgun>(); MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; if ((double)MonoSingleton<WeaponCharges>.Instance.naiZapperRecharge >= 5.0 && (Object)(object)component.currentZapper == (Object)null) { result = true; if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.ShootZapper(); } else { ((MonoBehaviour)component).Invoke("ShootZapper", component.wid.delay); } } else if ((Object)(object)component.currentZapper == (Object)null && (Object)(object)component.noAmmoSound != (Object)null) { Object.Instantiate<GameObject>(component.noAmmoSound); } return result; } public static bool AttemptRailcannonAltShoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = true; forceFirceZoom = true; return result; } public static bool AttemptRocketLauncherAlt1Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; RocketLauncher component = weapon.GetComponent<RocketLauncher>(); if ((double)MonoSingleton<WeaponCharges>.Instance.rocketFreezeTime > 0.0 && !GameStateManager.Instance.PlayerInputLocked && (!Object.op_Implicit((Object)(object)component.wid) || !component.wid.duplicate)) { result = true; if (MonoSingleton<WeaponCharges>.Instance.rocketFrozen) { component.UnfreezeRockets(); } else { component.FreezeRockets(); } } return result; } public static bool AttemptRocketLauncherAlt2Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = false; RocketLauncher component = weapon.GetComponent<RocketLauncher>(); if ((double)component.cbCharge > 0.0 && !component.firingCannonball && (component.cbCharge >= 1f || config1.actionSmootheningTypeSecondary == ActionSmootheningTypeSecondary.FireOnSwitch)) { component.chargeSound.Stop(); result = true; if (!Object.op_Implicit((Object)(object)component.wid) || (double)component.wid.delay == 0.0) { component.ShootCannonball(); } else { ((MonoBehaviour)component).Invoke("ShootCannonball", component.wid.delay); component.firingCannonball = true; } MonoSingleton<WeaponCharges>.Instance.rocketCannonballCharge = 0f; } return result; } public static bool AttemptRocketLauncherAlt3Shoot(GameObject weapon, ActionSmootheningConfig config1) { bool result = true; RocketLauncher component = weapon.GetComponent<RocketLauncher>(); MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; forceFirceNapalm = true; return result; } public static bool AttemptPrimaryShoot(ActionSmootheningConfig config1) { bool result = false; lastFireStatePrimary = MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed; lastFireStateSecondary = MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed; int[] weaponSlotVariation = PluginConfig.getWeaponSlotVariation(MonoSingleton<GunControl>.Instance.currentWeapon); int num = weaponSlotVariation[0]; int num2 = weaponSlotVariation[1]; List<GameObject> list = new List<GameObject>(); list.Add(MonoSingleton<GunControl>.Instance.currentWeapon); DualWield[] componentsInChildren = ((Component)MonoSingleton<GunControl>.Instance).GetComponentsInChildren<DualWield>(); for (int i = 0; i < componentsInChildren.Length; i++) { list.Add(componentsInChildren[i].currentWeapon); } for (int j = 0; j < list.Count; j++) { GameObject val = list[j]; MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed = true; if (num == 1 && new Func<Revolver>(val.GetComponent<Revolver>) != null) { if (AttemptRevolverShoot(val, config1)) { result = true; } } else if (num == 2 && (new Func<Shotgun>(val.GetComponent<Shotgun>) != null || new Func<ShotgunHammer>(val.GetComponent<ShotgunHammer>) != null)) { if (AttemptShotgunShoot(val, config1)) { result = true; } } else if (num == 3 && new Func<Nailgun>(val.GetComponent<Nailgun>) != null) { if (AttemptNailgunShoot(val, config1)) { result = true; } } else if (num == 4 && new Func<Railcannon>(val.GetComponent<Railcannon>) != null) { if (AttemptRailcannonShoot(val, config1)) { result = true; } } else if (num == 5 && new Func<RocketLauncher>(val.GetComponent<RocketLauncher>) != null && AttemptRocketLauncherShoot(val, config1)) { result = true; } } MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed = lastFireStatePrimary; MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = lastFireStateSecondary; return result; } public static bool AttemptSecondaryShoot(ActionSmootheningConfig config1) { bool result = false; lastFireStatePrimary = MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed; lastFireStateSecondary = MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed; int[] weaponSlotVariation = PluginConfig.getWeaponSlotVariation(MonoSingleton<GunControl>.Instance.currentWeapon); int num = weaponSlotVariation[0]; int num2 = weaponSlotVariation[1]; List<GameObject> list = new List<GameObject>(); list.Add(MonoSingleton<GunControl>.Instance.currentWeapon); DualWield[] componentsInChildren = ((Component)MonoSingleton<GunControl>.Instance).GetComponentsInChildren<DualWield>(); for (int i = 0; i < componentsInChildren.Length; i++) { list.Add(componentsInChildren[i].currentWeapon); } for (int j = 0; j < list.Count; j++) { GameObject val = list[j]; if (num == 1 && new Func<Revolver>(val.GetComponent<Revolver>) != null) { switch (num2) { case 0: AttemptRevolverAlt1Shoot(val, config1); break; case 1: AttemptRevolverAlt2Shoot(val, config1); break; case 2: AttemptRevolverAlt3Shoot(val, config1); break; } } else if (num == 2 && (new Func<Shotgun>(val.GetComponent<Shotgun>) != null || new Func<ShotgunHammer>(val.GetComponent<ShotgunHammer>) != null)) { switch (num2) { case 0: AttemptShotgunAlt1Shoot(val, config1); break; case 1: AttemptShotgunAlt2Shoot(val, config1); break; case 2: AttemptShotgunAlt3Shoot(val, config1); break; } } else if (num == 3 && new Func<Nailgun>(val.GetComponent<Nailgun>) != null) { switch (num2) { case 0: AttemptNailgunAlt1Shoot(val, config1); break; case 1: AttemptNailgunAlt2Shoot(val, config1); break; case 2: AttemptNailgunAlt3Shoot(val, config1); break; } } else if (num == 4 && new Func<Railcannon>(val.GetComponent<Railcannon>) != null) { MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = true; AttemptRailcannonAltShoot(val, config1); } else if (num == 5 && new Func<RocketLauncher>(val.GetComponent<RocketLauncher>) != null) { switch (num2) { case 0: AttemptRocketLauncherAlt1Shoot(val, config1); break; case 1: AttemptRocketLauncherAlt2Shoot(val, config1); break; case 2: AttemptRocketLauncherAlt3Shoot(val, config1); break; } } } MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed = lastFireStatePrimary; MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed = lastFireStateSecondary; return result; } public static float GetCurrentTimeUntilWeaponDeploy() { int[] weaponSlotVariation = PluginConfig.getWeaponSlotVariation(MonoSingleton<GunControl>.Instance.currentWeapon); int num = weaponSlotVariation[0]; int num2 = weaponSlotVariation[1]; float num3 = 0.25f; switch (num) { case 1: num3 = ((!MonoSingleton<GunControl>.Instance.currentWeapon.GetComponent<Revolver>().altVersion) ? 0.36f : 0.4f); break; case 2: num3 = ((!((Object)(object)MonoSingleton<GunControl>.Instance.currentWeapon.GetComponent<ShotgunHammer>() != (Object)null)) ? 0.4f : 0f); break; case 3: num3 = 0.31f; break; case 4: num3 = 0f; break; case 5: num3 = 0.25f; break; } return lastTimeSwitchStarted - Time.time + num3; } public static void ActionSmootheningLogicMAIN() { if (Plugin.modEnabled && actionSmootheningEnabled) { timeUntilCurrentWeaponDeploy = GetCurrentTimeUntilWeaponDeploy(); CheckForFireBeforeDeploy(); AutoShootLogic(); AutoSwitchLogic(); } } public static void AutoSwitchLogic() { if (Time.time > switchTime && switchTime >= 0f) { MonoSingleton<GunControl>.Instance.ForceWeapon(weaponToSwitchTo, true); Plugin.wcArray[0] = wcOld; Plugin.wcArray[1] = wcToSwitchTo; Plugin.weapon = MonoSingleton<GunControl>.Instance.currentWeapon; DualWield[] componentsInChildren = ((Component)MonoSingleton<GunControl>.Instance).GetComponentsInChildren<DualWield>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].UpdateWeapon(Plugin.weapon); } switchTime = -1f; weaponToSwitchTo = null; wcToSwitchTo = null; } } public static void AutoShootLogic() { int[] weaponSlotVariation = PluginConfig.getWeaponSlotVariation(MonoSingleton<GunControl>.Instance.currentWeapon); int num = weaponSlotVariation[0]; int num2 = weaponSlotVariation[1]; if (num < 1 || num2 < 0) { return; } ActionSmootheningConfig actionSmootheningConfig = PluginConfig.actionSmootheningConfigs[num - 1, num2]; if (timeUntilCurrentWeaponDeploy <= 0f && shootWhenReady != 0) { if (shootWhenReady == 1) { if (AttemptPrimaryShoot(actionSmootheningConfig)) { shootWhenReady = 0; } } else if (shootWhenReady == 2 && AttemptSecondaryShoot(actionSmootheningConfig)) { shootWhenReady = 0; } } if (actionSmootheningConfig.enabled && actionSmootheningConfig.actionSmootheningTypePrimary == ActionSmootheningTypePrimary.FireOnReady) { AttemptPrimaryShoot(actionSmootheningConfig); } else if (actionSmootheningConfig.enabled && actionSmootheningConfig.actionSmootheningTypeSecondary == ActionSmootheningTypeSecondary.FireOnReady) { AttemptSecondaryShoot(actionSmootheningConfig); } } public static void CheckForFireBeforeDeploy() { if (!(timeUntilCurrentWeaponDeploy > 0f)) { return; } int[] weaponSlotVariation = PluginConfig.getWeaponSlotVariation(MonoSingleton<GunControl>.Instance.currentWeapon); int num = weaponSlotVariation[0]; int num2 = weaponSlotVariation[1]; if (num < 1 || num2 < 0) { return; } ActionSmootheningConfig actionSmootheningConfig = PluginConfig.actionSmootheningConfigs[num - 1, num2]; if (actionSmootheningConfig.enabled && actionSmootheningConfig.rememberInputBeforeFullSwitch && timeUntilCurrentWeaponDeploy <= actionSmootheningConfig.rememberInputBeforeFullSwitchTime) { if (MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed) { shootWhenReady = 1; } else if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed && !actionSmootheningConfig.rememberPrimaryInputOnly && num != 5) { shootWhenReady = 2; } } } } [BepInPlugin("WeaponVariantBinds", "WeaponVariantBinds", "0.01")] public class Plugin : BaseUnityPlugin { public static bool modEnabled = true; public static GameObject weapon = null; public static bool scrollEnabled = false; public static bool scrollVariation = false; public static bool scrollReversed = false; public static bool scrollWeapons = false; public static ManualLogSource logger; public static WeaponCycle[] wcArray = new WeaponCycle[2]; private static int newSlot = -1; private static int newVariation = -1; public static WeaponCycle oldWCThisTick; public static WeaponCycle newWCThisTick; public static bool VanillaWeaponCyclesDetermined = false; public static long tickUpdateSettings = -1L; public static long tickCount = 0L; public static bool configCreated = false; [HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")] [HarmonyPrefix] public static bool no(LeaderboardController __instance) { return !modEnabled || !PluginConfig.actionSmootheningEnabled; } [HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")] [HarmonyPrefix] public static bool nope(LeaderboardController __instance) { return !modEnabled || !PluginConfig.actionSmootheningEnabled; } [HarmonyPatch(typeof(LeaderboardController), "SubmitFishSize")] [HarmonyPrefix] public static bool notevenfish(LeaderboardController __instance) { return !modEnabled || !PluginConfig.actionSmootheningEnabled; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown logger = new ManualLogSource("WeaponVariantBinds"); Logger.Sources.Add((ILogSource)(object)logger); wcArray[0] = PluginConfig.vanillaWeaponCycles[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[0]; Harmony val = new Harmony("WeaponVariantBinds"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin WeaponVariantBinds is loaded!"); } public static bool IsGameplayScene() { string[] source = new string[6] { "Intro", "Bootstrap", "Main Menu", "Level 2-S", "Intermission1", "Intermission2" }; if (SceneHelper.CurrentScene == null) { return false; } return !source.Contains(SceneHelper.CurrentScene); } public static bool IsMenu() { if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && !MonoSingleton<OptionsManager>.Instance.paused && !MonoSingleton<FistControl>.Instance.shopping && (Object)(object)GameStateManager.Instance != (Object)null && !GameStateManager.Instance.PlayerInputLocked) { return false; } return true; } public static void IfSlotIsIgnoredLogic(bool goingToNext) { if (goingToNext) { for (int i = 0; i < 105; i++) { WeaponCycle weaponCycle = wcArray[1]; if (!weaponCycle.skipOverThisCycle) { break; } if ((PluginConfig.vanillaWeaponCycles.Contains(weaponCycle) && weaponCycle != PluginConfig.vanillaWeaponCycles[4]) || weaponCycle == PluginConfig.weaponCycles[PluginConfig.numWeaponCyclesActive - 2]) { int num = 0; if (weaponCycle == PluginConfig.vanillaWeaponCycles[0]) { num = 1; } if (weaponCycle == PluginConfig.vanillaWeaponCycles[1]) { num = 2; } if (weaponCycle == PluginConfig.vanillaWeaponCycles[2]) { num = 3; } if (weaponCycle == PluginConfig.vanillaWeaponCycles[3]) { num = 4; } wcArray[1] = PluginConfig.vanillaWeaponCycles[num]; continue; } int num2 = 0; for (int j = 0; j < 99; j++) { if (weaponCycle == PluginConfig.weaponCycles[j]) { num2 = j + 1; } } wcArray[1] = PluginConfig.weaponCycles[num2]; } } else { if (goingToNext) { return; } for (int k = 0; k < 105; k++) { WeaponCycle weaponCycle2 = wcArray[1]; if (!weaponCycle2.skipOverThisCycle) { break; } if ((PluginConfig.vanillaWeaponCycles.Contains(weaponCycle2) && weaponCycle2 != PluginConfig.vanillaWeaponCycles[0]) || weaponCycle2 == PluginConfig.weaponCycles[0]) { int num3 = 4; if (weaponCycle2 == PluginConfig.vanillaWeaponCycles[1]) { num3 = 0; } if (weaponCycle2 == PluginConfig.vanillaWeaponCycles[2]) { num3 = 1; } if (weaponCycle2 == PluginConfig.vanillaWeaponCycles[3]) { num3 = 2; } if (weaponCycle2 == PluginConfig.vanillaWeaponCycles[4]) { num3 = 3; } wcArray[1] = PluginConfig.vanillaWeaponCycles[num3]; continue; } int num4 = 0; for (int l = 1; l < 100; l++) { if (weaponCycle2 == PluginConfig.weaponCycles[l]) { num4 = l - 1; } } wcArray[1] = PluginConfig.weaponCycles[num4]; } } } public static void SwitchToNextCustomSlot() { WeaponCycle weaponCycle = wcArray[1]; int num = 0; if (weaponCycle == PluginConfig.vanillaWeaponCycles[0]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[1]; } else if (weaponCycle == PluginConfig.vanillaWeaponCycles[1]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[2]; } else if (weaponCycle == PluginConfig.vanillaWeaponCycles[2]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[3]; } else if (weaponCycle == PluginConfig.vanillaWeaponCycles[3]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[4]; } else { int num2 = 0; while (true) { if (num2 < PluginConfig.numWeaponCyclesActive) { if (weaponCycle == PluginConfig.weaponCycles[num2]) { num = num2 + 1; if (num >= PluginConfig.numWeaponCyclesActive - 1) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[0]; break; } } num2++; continue; } for (int i = 0; i < PluginConfig.numWeaponCyclesActive; i++) { bool flag = true; for (int j = 0; j < PluginConfig.weaponCycles[num].weaponEnums.Length; j++) { if (PluginConfig.weaponCycles[num].weaponEnums[j] != 0) { flag = false; } } if (flag) { num++; if (num >= PluginConfig.numWeaponCyclesActive) { num = 0; } continue; } break; } wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.weaponCycles[num]; break; } } IfSlotIsIgnoredLogic(goingToNext: true); WeaponCycle weaponCycle2 = wcArray[1]; if (!weaponCycle2.rememberVariation) { weaponCycle2.currentIndex = 0; } for (int k = 0; k < weaponCycle2.weaponEnums.Length; k++) { if (weaponCycle2.weaponEnums[weaponCycle2.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle2.ignoreInCycle[weaponCycle2.currentIndex]) { weaponCycle2.currentIndex++; } if (weaponCycle2.currentIndex >= weaponCycle2.weaponEnums.Length) { weaponCycle2.currentIndex = 0; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]); newSlot = array[0]; newVariation = array[1]; } public static void SwitchToPrevCustomSlot() { WeaponCycle weaponCycle = wcArray[1]; int num = PluginConfig.numWeaponCyclesActive - 1; if (weaponCycle == PluginConfig.vanillaWeaponCycles[4]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[3]; } else if (weaponCycle == PluginConfig.vanillaWeaponCycles[3]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[2]; } else if (weaponCycle == PluginConfig.vanillaWeaponCycles[2]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[1]; } else if (weaponCycle == PluginConfig.vanillaWeaponCycles[1]) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[0]; } else { int num2 = PluginConfig.weaponCycles.Length - 1; while (true) { if (num2 >= 0) { if (weaponCycle == PluginConfig.weaponCycles[num2]) { num = num2 - 1; if (num < 0) { wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.vanillaWeaponCycles[4]; break; } } num2 += -1; continue; } for (int i = PluginConfig.weaponCycles.Length - 1; i >= 0; i += -1) { bool flag = true; for (int j = 0; j < PluginConfig.weaponCycles[num].weaponEnums.Length; j++) { if (PluginConfig.weaponCycles[num].weaponEnums[j] != 0) { flag = false; } } if (flag) { num += -1; if (num < 0) { num = PluginConfig.numWeaponCyclesActive - 1; } continue; } break; } wcArray[0] = wcArray[1]; wcArray[1] = PluginConfig.weaponCycles[num]; break; } } IfSlotIsIgnoredLogic(goingToNext: false); WeaponCycle weaponCycle2 = wcArray[1]; if (!weaponCycle2.rememberVariation) { weaponCycle2.currentIndex = 0; } for (int k = 0; k < weaponCycle2.weaponEnums.Length; k++) { if (weaponCycle2.weaponEnums[weaponCycle2.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle2.ignoreInCycle[weaponCycle2.currentIndex]) { weaponCycle2.currentIndex++; } if (weaponCycle2.currentIndex >= weaponCycle2.weaponEnums.Length) { weaponCycle2.currentIndex = 0; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]); newSlot = array[0]; newVariation = array[1]; } public static void VariationBindLogic() { //IL_0024: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) WeaponCycle weaponCycle = wcArray[1]; if (weaponCycle == null) { return; } WeaponActions val = MonoSingleton<InputManager>.Instance.InputSource.Actions.Weapon; if (((WeaponActions)(ref val)).VariationSlot1.WasPressedThisFrame()) { weaponCycle.currentIndex = 0; for (int i = 0; i < weaponCycle.weaponEnums.Length; i++) { if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None) { weaponCycle.currentIndex++; } if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array[0]; newVariation = array[1]; } val = MonoSingleton<InputManager>.Instance.InputSource.Actions.Weapon; if (((WeaponActions)(ref val)).VariationSlot2.WasPressedThisFrame()) { weaponCycle.currentIndex = 1; for (int j = 0; j < weaponCycle.weaponEnums.Length; j++) { if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None) { weaponCycle.currentIndex++; } if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; } } int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array2[0]; newVariation = array2[1]; } val = MonoSingleton<InputManager>.Instance.InputSource.Actions.Weapon; if (((WeaponActions)(ref val)).VariationSlot3.WasPressedThisFrame()) { weaponCycle.currentIndex = 2; for (int k = 0; k < weaponCycle.weaponEnums.Length; k++) { if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None) { weaponCycle.currentIndex++; } if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; } } int[] array3 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array3[0]; newVariation = array3[1]; } for (int l = 3; l < 100; l++) { if (!Input.GetKeyDown(PluginConfig.variationBinds[l])) { continue; } weaponCycle.currentIndex = l; for (int m = 0; m < weaponCycle.weaponEnums.Length; m++) { if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None) { weaponCycle.currentIndex++; } if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; } } int[] array4 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array4[0]; newVariation = array4[1]; } } public static void ScrollLogic() { WeaponCycle weaponCycle = wcArray[1]; if (wcArray[1] == null) { return; } scrollEnabled = MonoSingleton<PrefsManager>.Instance.GetBool("scrollEnabled", false); scrollVariation = MonoSingleton<PrefsManager>.Instance.GetBool("scrollVariations", false); scrollReversed = MonoSingleton<PrefsManager>.Instance.GetBool("scrollReversed", false); scrollWeapons = MonoSingleton<PrefsManager>.Instance.GetBool("scrollWeapons", false); float num = 1f; if (scrollReversed) { num = -1f; } float num2 = Input.GetAxis("Mouse ScrollWheel") * num; if (scrollEnabled && scrollVariation) { if (num2 >= 0.1f) { weaponCycle.currentIndex++; for (int i = 0; i < weaponCycle.weaponEnums.Length; i++) { if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; if (scrollWeapons) { SwitchToNextCustomSlot(); break; } } if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex]) { weaponCycle.currentIndex++; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array[0]; newVariation = array[1]; } if (num2 <= -0.1f) { weaponCycle.currentIndex += -1; for (int j = 0; j < weaponCycle.weaponEnums.Length; j++) { if (weaponCycle.currentIndex < 0) { weaponCycle.currentIndex = weaponCycle.weaponEnums.Length - 1; if (scrollWeapons) { SwitchToPrevCustomSlot(); break; } } if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex]) { weaponCycle.currentIndex += -1; } } int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array2[0]; newVariation = array2[1]; } } if (scrollEnabled && !scrollVariation && scrollWeapons) { if (num2 >= 0.1f) { SwitchToNextCustomSlot(); } if (num2 <= -0.1f) { SwitchToPrevCustomSlot(); } } } public static void AlterVariationLogic() { WeaponCycle weaponCycle = wcArray[1]; if (MonoSingleton<InputManager>.Instance.InputSource.NextVariation.WasPerformedThisFrame) { weaponCycle.currentIndex++; for (int i = 0; i < weaponCycle.weaponEnums.Length; i++) { if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex]) { weaponCycle.currentIndex++; } if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array[0]; newVariation = array[1]; } if (!MonoSingleton<InputManager>.Instance.InputSource.PreviousVariation.WasCanceledThisFrame) { return; } weaponCycle.currentIndex += -1; for (int j = 0; j < weaponCycle.weaponEnums.Length; j++) { if (weaponCycle.currentIndex < 0) { weaponCycle.currentIndex = weaponCycle.weaponEnums.Length - 1; } if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex]) { weaponCycle.currentIndex += -1; } if (weaponCycle.currentIndex < 0) { weaponCycle.currentIndex = weaponCycle.weaponEnums.Length - 1; } } int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array2[0]; newVariation = array2[1]; } public static void AlterWeaponLogic() { if (MonoSingleton<InputManager>.Instance.InputSource.NextWeapon.WasCanceledThisFrame) { SwitchToNextCustomSlot(); } if (MonoSingleton<InputManager>.Instance.InputSource.PrevWeapon.WasCanceledThisFrame) { SwitchToPrevCustomSlot(); } } public static void LastWeaponLogic() { if (wcArray[0] != null && MonoSingleton<InputManager>.Instance.InputSource.LastWeapon.WasCanceledThisFrame) { WeaponCycle weaponCycle = wcArray[1]; wcArray[1] = wcArray[0]; wcArray[0] = weaponCycle; WeaponCycle weaponCycle2 = wcArray[1]; int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]); newSlot = array[0]; newVariation = array[1]; } } public static void SwitchToWeapon(WeaponCycle wc) { bool flag = true; bool flag2 = false; if (wc != wcArray[1] && wc.rememberVariation) { flag2 = true; } if (wc.rememberVariation || wc == wcArray[1]) { flag = false; } if (wc != wcArray[1]) { wcArray[0] = wcArray[1]; wcArray[1] = wc; } if (wc.swapBehavior == SwapBehaviorEnum.NextVariation && !flag2) { wc.currentIndex++; if (flag) { wc.currentIndex = 0; } } else if (wc.swapBehavior == SwapBehaviorEnum.SameVariation && !flag2) { wc.currentIndex = wc.currentIndex; if (flag) { wc.currentIndex = 0; } } else if (wc.swapBehavior == SwapBehaviorEnum.FirstVariation && !flag2) { wc.currentIndex = 0; } for (int i = 0; i < wc.weaponEnums.Length; i++) { if (wc.weaponEnums[wc.currentIndex] == PluginConfig.WeaponEnum.None || wc.ignoreInCycle[wc.currentIndex]) { wc.currentIndex++; } if (wc.currentIndex >= wc.weaponEnums.Length) { wc.currentIndex = 0; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(wc.weaponEnums[wc.currentIndex]); newSlot = array[0]; newVariation = array[1]; } public static void SwitchWeaponLogic() { //IL_0155: Unknown result type (might be due to invalid IL or missing references) if (MonoSingleton<InputManager>.Instance.InputSource.Slot1.WasPerformedThisFrame) { WeaponCycle wc = PluginConfig.vanillaWeaponCycles[0]; SwitchToWeapon(wc); return; } if (MonoSingleton<InputManager>.Instance.InputSource.Slot2.WasPerformedThisFrame) { WeaponCycle wc2 = PluginConfig.vanillaWeaponCycles[1]; SwitchToWeapon(wc2); return; } if (MonoSingleton<InputManager>.Instance.InputSource.Slot3.WasPerformedThisFrame) { WeaponCycle wc3 = PluginConfig.vanillaWeaponCycles[2]; SwitchToWeapon(wc3); return; } if (MonoSingleton<InputManager>.Instance.InputSource.Slot4.WasPerformedThisFrame) { WeaponCycle wc4 = PluginConfig.vanillaWeaponCycles[3]; SwitchToWeapon(wc4); return; } if (MonoSingleton<InputManager>.Instance.InputSource.Slot5.WasPerformedThisFrame) { WeaponCycle wc5 = PluginConfig.vanillaWeaponCycles[4]; SwitchToWeapon(wc5); return; } if (MonoSingleton<InputManager>.Instance.InputSource.Slot6.WasPerformedThisFrame) { WeaponCycle miscVanillaWeaponCycle = PluginConfig.miscVanillaWeaponCycle; if (miscVanillaWeaponCycle != wcArray[1]) { wcArray[0] = wcArray[1]; wcArray[1] = miscVanillaWeaponCycle; } return; } for (int i = 0; i < PluginConfig.weaponCycles.Length; i++) { WeaponCycle weaponCycle = PluginConfig.weaponCycles[i]; if (weaponCycle != null && Input.GetKeyDown(weaponCycle.useCode)) { SwitchToWeapon(weaponCycle); break; } } } public static void SpecificCycleWeaponLogic() { for (int i = 0; i < 5; i++) { for (int j = 0; j < 3; j++) { if (!Input.GetKeyDown(PluginConfig.vanillaWeaponCycles[i].weaponVariantBinds[j])) { continue; } WeaponCycle weaponCycle = PluginConfig.vanillaWeaponCycles[i]; if (weaponCycle != wcArray[1]) { wcArray[0] = wcArray[1]; wcArray[1] = weaponCycle; } weaponCycle.currentIndex = j; for (int k = 0; k < weaponCycle.weaponEnums.Length; k++) { if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None) { weaponCycle.currentIndex++; } if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length) { weaponCycle.currentIndex = 0; } } int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]); newSlot = array[0]; newVariation = array[1]; } } for (int l = 0; l < 99 && PluginConfig.weaponCycles[l].weaponVariantBinds[0]; l++) { for (int m = 0; m < 99 && PluginConfig.weaponCycles[l].weaponVariantBinds[m]; m++) { if (!Input.GetKeyDown(PluginConfig.weaponCycles[l].weaponVariantBinds[m])) { continue; } WeaponCycle weaponCycle2 = PluginConfig.weaponCycles[l]; if (weaponCycle2 != wcArray[1]) { wcArray[0] = wcArray[1]; wcArray[1] = weaponCycle2; } weaponCycle2.currentIndex = m; for (int n = 0; n < weaponCycle2.weaponEnums.Length; n++) { if (weaponCycle2.weaponEnums[weaponCycle2.currentIndex] == PluginConfig.WeaponEnum.None) { weaponCycle2.currentIndex++; } if (weaponCycle2.currentIndex >= weaponCycle2.weaponEnums.Length) { weaponCycle2.currentIndex = 0; } } int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]); newSlot = array2[0]; newVariation = array2[1]; } } } public static void InputLogicMAIN() { if (MonoSingleton<NewMovement>.Instance.hp <= 0) { return; } newSlot = -1; newVariation = -1; oldWCThisTick = wcArray[0]; newWCThisTick = wcArray[1]; VariationBindLogic(); ScrollLogic(); AlterVariationLogic(); AlterWeaponLogic(); LastWeaponLogic(); SwitchWeaponLogic(); SpecificCycleWeaponLogic(); if (newVariation > 100 || newSlot > 100) { logger.LogWarning((object)"Tried to switch to an empty weapon."); } else if (newVariation != -1 && newSlot != -1) { if (newSlot == 0) { MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot1[newVariation], true); } else if (newSlot == 1) { MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot2[newVariation], true); } else if (newSlot == 2) { MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot3[newVariation], true); } else if (newSlot == 3) { MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot4[newVariation], true); } else if (newSlot == 4) { MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot5[newVariation], true); } weapon = MonoSingleton<GunControl>.Instance.currentWeapon; DualWield[] componentsInChildren = ((Component)MonoSingleton<GunControl>.Instance).GetComponentsInChildren<DualWield>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].UpdateWeapon(weapon); } } else if ((Object)(object)weapon != (Object)(object)MonoSingleton<GunControl>.Instance.currentWeapon) { logger.LogWarning((object)"Unaccounted weapon change detected."); weapon = MonoSingleton<GunControl>.Instance.currentWeapon; } if (ActionSmoothening.PreventWCOrderCycling) { wcArray[0] = oldWCThisTick; if (wcArray[1] != newWCThisTick) { ActionSmoothening.wcToSwitchTo = wcArray[1]; } wcArray[1] = newWCThisTick; } } public void Update() { if (!configCreated && (Object)(object)MonoSingleton<ColorBlindSettings>.Instance != (Object)null) { configCreated = true; PluginConfig.InitActionSmootheningConfigs(); PluginConfig.InitVanillaWeaponCycles(); PluginConfig.InitWeaponCycles(); PluginConfig.WeaponVariantBindsConfig(); } if (!modEnabled) { return; } tickCount++; if (tickUpdateSettings == tickCount) { PluginConfig.UpdateSettings(); } if (IsGameplayScene() && !IsMenu()) { if (!VanillaWeaponCyclesDetermined) { PluginConfig.DetermineVanillaWeaponCycles(); } InputLogicMAIN(); ActionSmoothening.ActionSmootheningLogicMAIN(); } } } public enum SwapBehaviorEnum { NextVariation, SameVariation, FirstVariation } public enum ActionSmootheningTypePrimary { None, FireOnSwitch, FireOnReady, WaitOnSwitch } public enum ActionSmootheningTypeSecondary { None, FireOnSwitch, FireOnReady } public class ActionSmootheningConfig { public bool enabled = false; public ActionSmootheningTypePrimary actionSmootheningTypePrimary = ActionSmootheningTypePrimary.None; public ActionSmootheningTypeSecondary actionSmootheningTypeSecondary = ActionSmootheningTypeSecondary.None; public float maxTime = 0f; public float maxTime2 = 0f; public bool rememberInputBeforeFullSwitch = false; public float rememberInputBeforeFullSwitchTime = 0f; public bool rememberedInputMustBeUsed = false; public bool rememberPrimaryInputOnly = true; } public class WeaponCycle { public PluginConfig.WeaponEnum[] weaponEnums = new PluginConfig.WeaponEnum[100]; public KeyCode[] weaponVariantBinds = (KeyCode[])(object)new KeyCode[100]; public bool[] ignoreInCycle = new bool[100]; public int currentIndex = 0; public KeyCode useCode = (KeyCode)0; public bool rememberVariation = false; public SwapBehaviorEnum swapBehavior = SwapBehaviorEnum.NextVariation; public bool skipOverThisCycle = false; } public class PluginConfig { public enum WeaponEnum { None, Piercer_Revolver, Marksman_Revolver, Sharpshooter_Revolver, Core_Eject_Shotgun, Pump_Charge_Shotgun, Sawed_On_Shotgun, Attractor_Nailgun, Overheat_Nailgun, Jumpstart_Nailgun, Electric_Railcannon, Screwdriver, Malicious_Railcannon, Freezeframe_Rocket_Launcher, SRS_Rocket_Launcher, Firestarter_Rocket_Launcher } public enum KeyEnum { None, Backspace, Tab, Escape, Space, UpArrow, DownArrow, RightArrow, LeftArrow, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Alpha1, Alpha2, Alpha3, Alpha4, Alpha5, Alpha6, Alpha7, Alpha8, Alpha9, Alpha0, CapsLock, RightShift, LeftShift, RightControl, LeftControl, RightAlt, LeftAlt, Mouse1, Mouse2, Mouse3, Mouse4, Mouse5, Mouse6, Mouse7, BackQuote, EqualsSign, Minus, LeftBracket, RightBracket, Semicolon, Quote, Comma, Period, Slash, Backslash, Numlock, KeypadDivide, KeypadMultiply, KeypadMinus, KeypadPlus, KeypadEnter, KeypadPeriod, Keypad0, Keypad1, Keypad2, Keypad3, Keypad4, Keypad5, Keypad6, Keypad7, Keypad8, Keypad9, Home, End, PageUp, PageDown, Enter, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, WheelUp, WheelDown } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BoolValueChangeEventDelegate <>9__42_0; internal void <WeaponVariantBindsConfig>b__42_0(BoolValueChangeEvent e) { Plugin.modEnabled = e.value; ((ConfigField)division).interactable = e.value; StartUpdateSettings(); } } public static KeyCode[] variationBinds = (KeyCode[])(object)new KeyCode[100]; public static ActionSmootheningConfig[,] actionSmootheningConfigs = new ActionSmootheningConfig[5, 3]; public static bool actionSmootheningEnabled = false; public static string DefaultParentFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ""; public static WeaponCycle[] weaponCycles = new WeaponCycle[100]; public static WeaponCycle[] vanillaWeaponCycles = new WeaponCycle[5]; public static WeaponCycle miscVanillaWeaponCycle = new WeaponCycle(); public static EnumField<KeyEnum>[] weaponVariantBindFields = new EnumField<KeyEnum>[100]; public static ConfigPanel[] advancedWeaponOptionsFields = (ConfigPanel[])(object)new ConfigPanel[100]; public static ConfigPanel[] configPanels = (ConfigPanel[])(object)new ConfigPanel[100]; public static EnumField<KeyEnum>[] useKeyFields = new EnumField<KeyEnum>[100]; public static EnumField<WeaponEnum>[,] allWeaponFields = new EnumField<WeaponEnum>[100, 100]; public static EnumField<WeaponEnum>[,] vanillaWeaponFields = new EnumField<WeaponEnum>[5, 3]; public static int numWeaponCyclesActive = 0; public static ConfigDivision division = null; public static void InitActionSmootheningConfigs() { for (int i = 0; i < 5; i++) { for (int j = 0; j < 3; j++) { actionSmootheningConfigs[i, j] = new ActionSmootheningConfig(); } } } public static void setWeaponEnumDisplayNames(EnumField<WeaponEnum> field) { field.SetEnumDisplayName(WeaponEnum.Piercer_Revolver, "Piercer Revolver"); field.SetEnumDisplayName(WeaponEnum.Marksman_Revolver, "Marksman Revolver"); field.SetEnumDisplayName(WeaponEnum.Sharpshooter_Revolver, "Sharpshooter Revolver"); field.SetEnumDisplayName(WeaponEnum.Core_Eject_Shotgun, "Core Eject Shotgun"); field.SetEnumDisplayName(WeaponEnum.Pump_Charge_Shotgun, "Pump Charge Shotgun"); field.SetEnumDisplayName(WeaponEnum.Sawed_On_Shotgun, "Sawed-On Shotgun"); field.SetEnumDisplayName(WeaponEnum.Attractor_Nailgun, "Attractor Nailgun"); field.SetEnumDisplayName(WeaponEnum.Overheat_Nailgun, "Overheat Nailgun"); field.SetEnumDisplayName(WeaponEnum.Jumpstart_Nailgun, "Jumpstart Nailgun"); field.SetEnumDisplayName(WeaponEnum.Electric_Railcannon, "Electric Railcannon"); field.SetEnumDisplayName(WeaponEnum.Screwdriver, "Screwdriver"); field.SetEnumDisplayName(WeaponEnum.Malicious_Railcannon, "Malicious Railcannon"); field.SetEnumDisplayName(WeaponEnum.Freezeframe_Rocket_Launcher, "Freezeframe Rocket Launcher"); field.SetEnumDisplayName(WeaponEnum.SRS_Rocket_Launcher, "S.R.S. Rocket Launcher"); field.SetEnumDisplayName(WeaponEnum.Firestarter_Rocket_Launcher, "Firestarter Rocket Launcher"); } public static Color[] GetVariantColors(float opacity, float colorDeepness) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0021: 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) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[3] { Color.black, Color.black, Color.black }; if ((Object)(object)MonoSingleton<ColorBlindSettings>.Instance == (Object)null || MonoSingleton<ColorBlindSettings>.Instance.variationColors == null) { return array; } Color val = default(Color); ((Color)(ref val))..ctor(MonoSingleton<ColorBlindSettings>.Instance.variationColors[0].r * colorDeepness, MonoSingleton<ColorBlindSettings>.Instance.variationColors[0].g * colorDeepness, MonoSingleton<ColorBlindSettings>.Instance.variationColors[0].b * colorDeepness, opacity); Color val2 = default(Color); ((Color)(ref val2))..ctor(MonoSingleton<ColorBlindSettings>.Instance.variationColors[1].r * colorDeepness, MonoSingleton<ColorBlindSettings>.Instance.variationColors[1].g * colorDeepness, MonoSingleton<ColorBlindSettings>.Instance.variationColors[1].b * colorDeepness, opacity); Color val3 = default(Color); ((Color)(ref val3))..ctor(MonoSingleton<ColorBlindSettings>.Instance.variationColors[2].r * colorDeepness, MonoSingleton<ColorBlindSettings>.Instance.variationColors[2].g * colorDeepness, MonoSingleton<ColorBlindSettings>.Instance.variationColors[2].b * colorDeepness, opacity); array[0] = val; array[1] = val2; array[2] = val3; return array; } public static int[] getWeaponSlotVariation(GameObject weapon) { int num = -1; if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null) { num = MonoSingleton<GunControl>.Instance.currentSlotIndex; } int num2 = -1; if ((Object)(object)weapon != (Object)null) { Revolver val = default(Revolver); Shotgun val2 = default(Shotgun); ShotgunHammer val3 = default(ShotgunHammer); Nailgun val4 = default(Nailgun); Railcannon val5 = default(Railcannon); RocketLauncher val6 = default(RocketLauncher); if (weapon.TryGetComponent<Revolver>(ref val)) { num2 = val.gunVariation; } else if (weapon.TryGetComponent<Shotgun>(ref val2)) { num2 = val2.variation; } else if (weapon.TryGetComponent<ShotgunHammer>(ref val3)) { num2 = val3.variation; } else if (weapon.TryGetComponent<Nailgun>(ref val4)) { num2 = val4.variation; switch (num2) { case 1: num2 = 0; break; case 0: num2 = 1; break; } } else if (weapon.TryGetComponent<Railcannon>(ref val5)) { num2 = val5.variation; } else if (weapon.TryGetComponent<RocketLauncher>(ref val6)) { num2 = val6.variation; } } return new int[2] { num, num2 }; } public static WeaponEnum convertWeaponToWeaponEnum(GameObject weapon) { WeaponEnum result = WeaponEnum.None; if ((Object)(object)weapon.GetComponent<Revolver>() != (Object)null) { if (weapon.GetComponent<Revolver>().gunVariation == 0) { result = WeaponEnum.Piercer_Revolver; } if (weapon.GetComponent<Revolver>().gunVariation == 1) { result = WeaponEnum.Marksman_Revolver; } if (weapon.GetComponent<Revolver>().gunVariation == 2) { result = WeaponEnum.Sharpshooter_Revolver; } } if ((Object)(object)weapon.GetComponent<Shotgun>() != (Object)null) { if (weapon.GetComponent<Shotgun>().variation == 0) { result = WeaponEnum.Core_Eject_Shotgun; } if (weapon.GetComponent<Shotgun>().variation == 1) { result = WeaponEnum.Pump_Charge_Shotgun; } if (weapon.GetComponent<Shotgun>().variation == 2) { result = WeaponEnum.Sawed_On_Shotgun; } } if ((Object)(object)weapon.GetComponent<ShotgunHammer>() != (Object)null) { if (weapon.GetComponent<ShotgunHammer>().variation == 0) { result = WeaponEnum.Core_Eject_Shotgun; } if (weapon.GetComponent<ShotgunHammer>().variation == 1) { result = WeaponEnum.Pump_Charge_Shotgun; } if (weapon.GetComponent<ShotgunHammer>().variation == 2) { result = WeaponEnum.Sawed_On_Shotgun; } } if ((Object)(object)weapon.GetComponent<Nailgun>() != (Object)null) { if (weapon.GetComponent<Nailgun>().variation == 1) { result = WeaponEnum.Attractor_Nailgun; } if (weapon.GetComponent<Nailgun>().variation == 0) { result = WeaponEnum.Overheat_Nailgun; } if (weapon.GetComponent<Nailgun>().variation == 2) { result = WeaponEnum.Jumpstart_Nailgun; } } if ((Object)(object)weapon.GetComponent<Railcannon>() != (Object)null) { if (weapon.GetComponent<Railcannon>().variation == 0) { result = WeaponEnum.Electric_Railcannon; } if (weapon.GetComponent<Railcannon>().variation == 1) { result = WeaponEnum.Screwdriver; } if (weapon.GetComponent<Railcannon>().variation == 2) { result = WeaponEnum.Malicious_Railcannon; } } if ((Object)(object)weapon.GetComponent<RocketLauncher>() != (Object)null) { if (weapon.GetComponent<RocketLauncher>().variation == 0) { result = WeaponEnum.Freezeframe_Rocket_Launcher; } if (weapon.GetComponent<RocketLauncher>().variation == 1) { result = WeaponEnum.SRS_Rocket_Launcher; } if (weapon.GetComponent<RocketLauncher>().variation == 2) { result = WeaponEnum.Firestarter_Rocket_Launcher; } } return result; } public static WeaponEnum convertWeaponToWeaponEnum(int slot, int variation) { WeaponEnum result = WeaponEnum.None; switch (slot) { case 1: switch (variation) { case 0: result = WeaponEnum.Piercer_Revolver; break; case 1: result = WeaponEnum.Marksman_Revolver; break; case 2: result = WeaponEnum.Sharpshooter_Revolver; break; } break; case 2: switch (variation) { case 0: result = WeaponEnum.Core_Eject_Shotgun; break; case 1: result = WeaponEnum.Pump_Charge_Shotgun; break; case 2: result = WeaponEnum.Sawed_On_Shotgun; break; } break; case 3: switch (variation) { case 0: result = WeaponEnum.Overheat_Nailgun; break; case 1: result = WeaponEnum.Attractor_Nailgun; break; case 2: result = WeaponEnum.Jumpstart_Nailgun; break; } break; case 4: switch (variation) { case 0: result = WeaponEnum.Electric_Railcannon; break; case 1: result = WeaponEnum.Malicious_Railcannon; break; case 2: result = WeaponEnum.Screwdriver; break; } break; case 5: switch (variation) { case 0: result = WeaponEnum.Freezeframe_Rocket_Launcher; break; case 1: result = WeaponEnum.SRS_Rocket_Launcher; break; case 2: result = WeaponEnum.Firestarter_Rocket_Launcher; break; } break; } return result; } public static int[] convertWeaponEnumToSlotVariation(WeaponEnum code) { int[] array = new int[2] { 500, 500 }; array[0] = (int)(code - 1) / 3; array[1] = -1; for (int i = 0; i < 3; i++) { if (i < MonoSingleton<GunControl>.Instance.slot1.Count) { if (MonoSingleton<GunControl>.Instance.slot1[i].GetComponent<Revolver>().gunVariation == 0 && code == WeaponEnum.Piercer_Revolver) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot1[i].GetComponent<Revolver>().gunVariation == 1 && code == WeaponEnum.Marksman_Revolver) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot1[i].GetComponent<Revolver>().gunVariation == 2 && code == WeaponEnum.Sharpshooter_Revolver) { array[1] = i; } } if (i < MonoSingleton<GunControl>.Instance.slot2.Count) { if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>() != (Object)null) { if (MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>().variation == 0 && code == WeaponEnum.Core_Eject_Shotgun) { array[1] = i; } } else if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>() != (Object)null && MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>().variation == 0 && code == WeaponEnum.Core_Eject_Shotgun) { array[1] = i; } if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>() != (Object)null) { if (MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>().variation == 1 && code == WeaponEnum.Pump_Charge_Shotgun) { array[1] = i; } } else if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>() != (Object)null && MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>().variation == 1 && code == WeaponEnum.Pump_Charge_Shotgun) { array[1] = i; } if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>() != (Object)null) { if (MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>().variation == 2 && code == WeaponEnum.Sawed_On_Shotgun) { array[1] = i; } } else if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>() != (Object)null && MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>().variation == 2 && code == WeaponEnum.Sawed_On_Shotgun) { array[1] = i; } } if (i < MonoSingleton<GunControl>.Instance.slot3.Count) { if (MonoSingleton<GunControl>.Instance.slot3[i].GetComponent<Nailgun>().variation == 1 && code == WeaponEnum.Attractor_Nailgun) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot3[i].GetComponent<Nailgun>().variation == 0 && code == WeaponEnum.Overheat_Nailgun) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot3[i].GetComponent<Nailgun>().variation == 2 && code == WeaponEnum.Jumpstart_Nailgun) { array[1] = i; } } if (i < MonoSingleton<GunControl>.Instance.slot4.Count) { if (MonoSingleton<GunControl>.Instance.slot4[i].GetComponent<Railcannon>().variation == 0 && code == WeaponEnum.Electric_Railcannon) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot4[i].GetComponent<Railcannon>().variation == 1 && code == WeaponEnum.Screwdriver) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot4[i].GetComponent<Railcannon>().variation == 2 && code == WeaponEnum.Malicious_Railcannon) { array[1] = i; } } if (i < MonoSingleton<GunControl>.Instance.slot5.Count) { if (MonoSingleton<GunControl>.Instance.slot5[i].GetComponent<RocketLauncher>().variation == 0 && code == WeaponEnum.Freezeframe_Rocket_Launcher) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot5[i].GetComponent<RocketLauncher>().variation == 1 && code == WeaponEnum.SRS_Rocket_Launcher) { array[1] = i; } if (MonoSingleton<GunControl>.Instance.slot5[i].GetComponent<RocketLauncher>().variation == 2 && code == WeaponEnum.Firestarter_Rocket_Launcher) { array[1] = i; } } } return array; } public static KeyCode convertKeyEnumToKeyCode(KeyEnum value) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0f72: Unknown result type (might be due to invalid IL or missing references) //IL_0f73: 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_0f77: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_086f: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_08b7: Unknown result type (might be due to invalid IL or missing references) //IL_08db: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_09b3: Unknown result type (might be due to invalid IL or missing references) //IL_09d7: Unknown result type (might be due to invalid IL or missing references) //IL_09fe: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0ac1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0b0f: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b5d: Unknown result type (might be due to invalid IL or missing references) //IL_0b84: Unknown result type (might be due to invalid IL or missing references) //IL_0bab: Unknown result type (might be due to invalid IL or missing references) //IL_0bd2: Unknown result type (might be due to invalid IL or missing references) //IL_0bf9: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Unknown result type (might be due to invalid IL or missing references) //IL_0c47: Unknown result type (might be due to invalid IL or missing references) //IL_0c6e: Unknown result type (might be due to invalid IL or missing references) //IL_0c95: Unknown result type (might be due to invalid IL or missing references) //IL_0cbc: Unknown result type (might be due to invalid IL or missing references) //IL_0ce3: Unknown result type (might be due to invalid IL or missing references) //IL_0d0a: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_0d55: Unknown result type (might be due to invalid IL or missing references) //IL_0d7c: Unknown result type (might be due to invalid IL or missing references) //IL_0da3: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0df1: Unknown result type (might be due to invalid IL or missing references) //IL_0e18: Unknown result type (might be due to invalid IL or missing references) //IL_0e3f: Unknown result type (might be due to invalid IL or missing references) //IL_0e66: Unknown result type (might be due to invalid IL or missing references) //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0edb: Unknown result type (might be due to invalid IL or missing references) //IL_0f02: Unknown result type (might be due to invalid IL or missing references) //IL_0f26: Unknown result type (might be due to invalid IL or missing references) //IL_0f4a: Unknown result type (might be due to invalid IL or missing references) //IL_0f6e: Unknown result type (might be due to invalid IL or missing references) KeyCode result = (KeyCode)0; if (value.Equals(KeyEnum.Backspace)) { result = (KeyCode)8; } else if (value.Equals(KeyEnum.Tab)) { result = (KeyCode)9; } else if (value.Equals(KeyEnum.Escape)) { result = (KeyCode)27; } else if (value.Equals(KeyEnum.Space)) { result = (KeyCode)32; } else if (value.Equals(KeyEnum.UpArrow)) { result = (KeyCode)273; } else if (value.Equals(KeyEnum.DownArrow)) { result = (KeyCode)274; } else if (value.Equals(KeyEnum.RightArrow)) { result = (KeyCode)275; } else if (value.Equals(KeyEnum.LeftArrow)) { result = (KeyCode)276; } else if (value.Equals(KeyEnum.A)) { result = (KeyCode)97; } else if (value.Equals(KeyEnum.B)) { result = (KeyCode)98; } else if (value.Equals(KeyEnum.C)) { result = (KeyCode)99; } else if (value.Equals(KeyEnum.D)) { result = (KeyCode)100; } else if (value.Equals(KeyEnum.E)) { result = (KeyCode)101; } else if (value.Equals(KeyEnum.F)) { result = (KeyCode)102; } else if (value.Equals(KeyEnum.G)) { result = (KeyCode)103; } else if (value.Equals(KeyEnum.H)) { result = (KeyCode)104; } else if (value.Equals(KeyEnum.I)) { result = (KeyCode)105; } else if (value.Equals(KeyEnum.J)) { result = (KeyCode)106; } else if (value.Equals(KeyEnum.K)) { result = (KeyCode)107; } else if (value.Equals(KeyEnum.L)) { result = (KeyCode)108; } else if (value.Equals(KeyEnum.M)) { result = (KeyCode)109; } else if (value.Equals(KeyEnum.N)) { result = (KeyCode)110; } else if (value.Equals(KeyEnum.O)) { result = (KeyCode)111; } else if (value.Equals(KeyEnum.P)) { result = (KeyCode)112; } else if (value.Equals(KeyEnum.Q)) { result = (KeyCode)113; } else if (value.Equals(KeyEnum.R)) { result = (KeyCode)114; } else if (value.Equals(KeyEnum.S)) { result = (KeyCode)115; } else if (value.Equals(KeyEnum.T)) { result = (KeyCode)116; } else if (value.Equals(KeyEnum.U)) { result = (KeyCode)117; } else if (value.Equals(KeyEnum.V)) { result = (KeyCode)118; } else if (value.Equals(KeyEnum.W)) { result = (KeyCode)119; } else if (value.Equals(KeyEnum.X)) { result = (KeyCode)120; } else if (value.Equals(KeyEnum.Y)) { result = (KeyCode)121; } else if (value.Equals(KeyEnum.Z)) { result = (KeyCode)122; } else if (value.Equals(KeyEnum.Alpha1)) { result = (KeyCode)49; } else if (value.Equals(KeyEnum.Alpha2)) { result = (KeyCode)50; } else if (value.Equals(KeyEnum.Alpha3)) { result = (KeyCode)51; } else if (value.Equals(KeyEnum.Alpha4)) { result = (KeyCode)52; } else if (value.Equals(KeyEnum.Alpha5)) { result = (KeyCode)53; } else if (value.Equals(KeyEnum.Alpha6)) { result = (KeyCode)54; } else if (value.Equals(KeyEnum.Alpha7)) { result = (KeyCode)55; } else if (value.Equals(KeyEnum.Alpha8)) { result = (KeyCode)56; } else if (value.Equals(KeyEnum.Alpha9)) { result = (KeyCode)57; } else if (value.Equals(KeyEnum.Alpha0)) { result = (KeyCode)48; } else if (value.Equals(KeyEnum.CapsLock)) { result = (KeyCode)301; } else if (value.Equals(KeyEnum.RightShift)) { result = (KeyCode)303; } else if (value.Equals(KeyEnum.LeftShift)) { result = (KeyCode)304; } else if (value.Equals(KeyEnum.RightControl)) { result = (KeyCode)305; } else if (value.Equals(KeyEnum.LeftControl)) { result = (KeyCode)306; } else if (value.Equals(KeyEnum.RightAlt)) { result = (KeyCode)307; } else if (value.Equals(KeyEnum.LeftAlt)) { result = (KeyCode)308; } else if (value.Equals(KeyEnum.Mouse1)) { result = (KeyCode)323; } else if (value.Equals(KeyEnum.Mouse2)) { result = (KeyCode)324; } else if (value.Equals(KeyEnum.Mouse3)) { result = (KeyCode)325; } else if (value.Equals(KeyEnum.Mouse4)) { result = (KeyCode)326; } else if (value.Equals(KeyEnum.Mouse5)) { result = (KeyCode)327; } else if (value.Equals(KeyEnum.Mouse6)) { result = (KeyCode)328; } else if (value.Equals(KeyEnum.Mouse7)) { result = (KeyCode)329; } else { if (value.Equals(KeyEnum.BackQuote)) { return (KeyCode)96; } if (value.Equals(KeyEnum.EqualsSign)) { return (KeyCode)61; } if (value.Equals(KeyEnum.Minus)) { return (KeyCode)45; } if (value.Equals(KeyEnum.LeftBracket)) { return (KeyCode)91; } if (value.Equals(KeyEnum.RightBracket)) { return (KeyCode)93; } if (value.Equals(KeyEnum.Semicolon)) { return (KeyCode)59; } if (value.Equals(KeyEnum.Quote)) { return (KeyCode)39; } if (value.Equals(KeyEnum.Comma)) { return (KeyCode)44; } if (value.Equals(KeyEnum.Period)) { return (KeyCode)46; } if (value.Equals(KeyEnum.Slash)) { return (KeyCode)47; } if (value.Equals(KeyEnum.Backslash)) { return (KeyCode)92; } if (value.Equals(KeyEnum.Numlock)) { return (KeyCode)300; } if (value.Equals(KeyEnum.KeypadDivide)) { return (KeyCode)267; } if (value.Equals(KeyEnum.KeypadMultiply)) { return (KeyCode)268; } if (value.Equals(KeyEnum.KeypadMinus)) { return (KeyCode)269; } if (value.Equals(KeyEnum.KeypadPlus)) { return (