using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Nyxpiri.ULTRAKILL.NyxLib;
using Nyxpiri.ULTRAKILL.NyxLib.Assets;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem;
[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: AssemblyVersion("0.0.0.0")]
namespace Nyxpiri.ULTRAKILL.V1Entity;
internal static class Log
{
private static ManualLogSource _logger;
public static void Initialize(ManualLogSource logger)
{
Assert.IsNull((object)_logger, "Log.Initialize called when _logger wasn't null?");
_logger = logger;
}
public static void Fatal(object data)
{
_logger.LogFatal(data);
}
public static void Error(object data)
{
_logger.LogError(data);
}
public static void Warning(object data)
{
_logger.LogWarning(data);
}
public static void Message(object data)
{
_logger.LogMessage(data);
}
public static void Info(object data)
{
_logger.LogInfo(data);
}
public static void Debug(object data)
{
_logger.LogDebug(data);
}
}
[HarmonyPatch(typeof(Punch), "PunchStart")]
internal static class PunchStartPatch
{
public static FieldAccess<Punch, float> cooldownCostFA = new FieldAccess<Punch, float>("cooldownCost", BindingFlags.Instance | BindingFlags.NonPublic);
public static bool Prefix(Punch __instance)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return true;
}
DualFistController.EnsureInitialization();
if ((Object)(object)MonoSingleton<FistControl>.Instance.currentPunch != (Object)(object)__instance)
{
return false;
}
float num = (((int)__instance.type == 0) ? Options.FeedbackerStaminaCostScalar.Value : Options.KnuckleblasterStaminaCostScalar.Value);
if (__instance.ready)
{
WeaponCharges instance = MonoSingleton<WeaponCharges>.Instance;
instance.punchStamina += cooldownCostFA.GetValue(__instance) * (1f - num) * 0.5f;
}
((Component)MonoSingleton<FistControl>.Instance).GetComponent<DualFistController>().PrePunch(__instance);
return true;
}
public static void Postfix(Punch __instance)
{
}
}
[HarmonyPatch(typeof(Punch), "BlastCheck")]
public static class PunchBlastCheckPatch
{
public static bool Prefix(Punch __instance)
{
return true;
}
public static void Postfix(Punch __instance)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
if (__instance.heldAction.IsPressed())
{
try
{
Transform val = ((Component)__instance).transform.Find("Armature/clavicle/wrist/hand/barrel.1/ShootPoint");
GameObject val2 = Object.Instantiate<GameObject>(Gear.CoreEject.DirectPrefab.GetComponent<Shotgun>().muzzleFlash, val.position, ((Component)MonoSingleton<CameraController>.Instance).transform.rotation);
Transform transform = val2.transform;
transform.localScale *= 0.5f;
ScaleNFade component = val2.GetComponent<ScaleNFade>();
component.ChangeFadeSpeed(component.fadeSpeed * 0.5f);
component.ChangeScaleSpeed(component.scaleSpeed * 0.5f);
}
catch (Exception arg)
{
Log.Error($"try failed! {arg}");
}
}
}
}
[HarmonyPatch(typeof(Punch), "Parry")]
public static class PunchParryPatch
{
public static bool Prefix(Punch __instance, bool hook = false, EnemyIdentifier eid = null, string customParryText = "")
{
return true;
}
public static void Postfix(Punch __instance, bool hook = false, EnemyIdentifier eid = null, string customParryText = "")
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity") && (Object)(object)eid != (Object)null)
{
WeaponCharges instance = MonoSingleton<WeaponCharges>.Instance;
instance.punchStamina += Options.ParryMeleeArmStaminaGain.Value;
}
}
}
public class DualFistController : MonoBehaviour
{
[HarmonyPatch(typeof(FistControl), "Start")]
public static class FistControlStartPatch
{
public static bool Prefix(FistControl __instance)
{
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return true;
}
EnsureInitialization();
return true;
}
public static void Postfix(FistControl __instance)
{
}
}
[HarmonyPatch(typeof(FistControl), "ResetFists")]
public static class FistControlResetFistsPatch
{
public static bool Prefix(FistControl __instance)
{
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return true;
}
((Component)__instance).GetComponent<DualFistController>()?.PreResetFists();
return true;
}
public static void Postfix(FistControl __instance)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
EnsureInitialization();
((Component)__instance).GetComponent<DualFistController>()?.PostResetFists();
}
}
}
[HarmonyPatch(typeof(FistControl), "ArmChange")]
public static class FistControlArmChangePatch
{
public static bool Prefix(FistControl __instance)
{
return true;
}
public static void Postfix(FistControl __instance)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
EnsureInitialization();
((Component)MonoSingleton<FistControl>.Instance).GetComponent<DualFistController>().PostArmChange();
}
}
}
[HarmonyPatch(typeof(WeaponCharges), "Charge")]
public static class WeaponChargesChargePatch
{
private static float initialPunchStamina;
public static bool Prefix(WeaponCharges __instance, float amount)
{
initialPunchStamina = __instance.punchStamina;
return true;
}
public static void Postfix(WeaponCharges __instance, float amount)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
float num = __instance.punchStamina - initialPunchStamina;
__instance.punchStamina = initialPunchStamina;
__instance.punchStamina += num * Options.ArmStaminaRegenScalar.Value;
}
}
}
[HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")]
public static class EnemyIdentifierDeliverDamagePatch
{
public static void Prefix(EnemyIdentifier __instance)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity") && __instance.hitter == "punch")
{
((Component)MonoSingleton<FistControl>.Instance).GetComponent<DualFistController>().PrePunchEnemy(__instance);
}
}
public static void Postfix(EnemyIdentifier __instance)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity") && __instance.hitter == "punch")
{
((Component)MonoSingleton<FistControl>.Instance).GetComponent<DualFistController>().PunchedEnemy(__instance);
}
}
}
private bool punchingEnemyDead = false;
public EnemyIdentifier PunchComboEid;
public TimeSince TimeSinceLastComboPunch;
public int PunchCombo = 0;
public GameObject AltParent = null;
public static FieldAccess<FistControl, List<GameObject>> spawnedArmsFA = new FieldAccess<FistControl, List<GameObject>>("spawnedArms", BindingFlags.Instance | BindingFlags.NonPublic);
public static FieldAccess<FistControl, int> currentOrderNumFA = new FieldAccess<FistControl, int>("currentOrderNum", BindingFlags.Instance | BindingFlags.NonPublic);
public float LastPunchTimestamp = 0f;
public float LastPunchDelay = 0f;
public static GameObject PrimeBlastWave = null;
[SerializeField]
private List<GameObject> altSpawnedArms = new List<GameObject>();
[SerializeField]
private List<GameObject> allArms = new List<GameObject>();
public static FistControl fc => MonoSingleton<FistControl>.Instance;
public static List<GameObject> SpawnedArms => spawnedArmsFA.GetValue(fc);
public static int currentOrderNum => currentOrderNumFA.GetValue(fc);
private void PrePunchEnemy(EnemyIdentifier eid)
{
punchingEnemyDead = eid.dead;
}
private void PunchedEnemy(EnemyIdentifier eid)
{
//IL_0034: 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)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity") || punchingEnemyDead)
{
return;
}
if ((Object)(object)PunchComboEid == (Object)(object)eid && TimeSince.op_Implicit(TimeSinceLastComboPunch) < Options.PunchComboDecayTime.Value)
{
PunchCombo++;
}
else
{
PunchComboEid = eid;
PunchCombo = 1;
}
bool flag = false;
if (PunchCombo >= Options.FlamingComboThreshold.Value)
{
eid.StartBurning(1f * (float)PunchCombo - (float)(Options.FlamingComboThreshold.Value - 1));
flag = true;
}
if (PunchCombo > 1)
{
string text = "<color=#ffffff>";
if (PunchCombo >= 3)
{
text = "<color=#e56638>";
}
text = ((!flag) ? text : "<color=#f32109>");
MonoSingleton<StyleHUD>.Instance.AddPoints(10 * Math.Clamp(PunchCombo, 0, 5), text + "RUDE COMBO</color>", (GameObject)null, eid, PunchCombo, "", "");
}
if (PunchCombo > 2)
{
eid.hitter = "";
eid.DeliverDamage(((Component)eid).gameObject, Vector3.zero, Vector3.zero, (float)Math.Clamp(PunchCombo, 0, Options.DamageBoostMaxCombo.Value) * Options.DamageBoostPerCombo.Value, false, 0f, (GameObject)null, false, false);
eid.hitter = "punch";
}
if (eid.dead && PunchCombo > 1)
{
MonoSingleton<StyleHUD>.Instance.AddPoints(20, "<color=#f3cc09>DISMANTLED</color>", (GameObject)null, (EnemyIdentifier)null, -1, "", "");
}
TimeSinceLastComboPunch = TimeSince.op_Implicit(0f);
}
private void PostArmChange()
{
}
protected void Awake()
{
//IL_003b: 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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
if (AltParent == null)
{
AltParent = new GameObject("AltParent");
}
AltParent.transform.parent = ((Component)this).transform;
AltParent.transform.localPosition = Vector3.zero;
AltParent.transform.localRotation = Quaternion.identity;
}
protected void Update()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
AltParent.transform.localScale = new Vector3(-1f, 1f, 1f);
if (MonoSingleton<OptionsManager>.Instance.paused)
{
return;
}
Punch val = default(Punch);
foreach (GameObject spawnedArm in SpawnedArms)
{
float num = Mathf.Clamp01(NyxMath.InverseNormalizeToRange(LastPunchDelay, 0f, 0.5f)) * 5f;
if (spawnedArm.TryGetComponent<Punch>(ref val) && (int)val.type != 1)
{
Animator componentInChildren = spawnedArm.GetComponentInChildren<Animator>();
if (!((Object)(object)componentInChildren == (Object)null))
{
componentInChildren.Update(num * Time.unscaledDeltaTime * Mathf.Clamp01(NyxMath.InverseNormalizeToRange(Time.timeScale, 0f, 1f)));
}
}
}
}
private void PreResetFists()
{
foreach (GameObject altSpawnedArm in altSpawnedArms)
{
Object.Destroy((Object)(object)altSpawnedArm);
}
altSpawnedArms.Clear();
allArms.Clear();
}
private void PostResetFists()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Invalid comparison between Unknown and I4
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
List<GameObject> value = spawnedArmsFA.GetValue(fc);
Punch val = default(Punch);
foreach (GameObject item in value)
{
if (item.TryGetComponent<Punch>(ref val) && (int)val.type == 1)
{
if ((Object)(object)PrimeBlastWave == (Object)null)
{
PrimeBlastWave = Object.Instantiate<GameObject>(val.blastWave, AssetsRoot.Holder);
PrimeBlastWave.AddComponent<PrimeBlastWave>();
PrimeBlastWave.AddComponent<ExplosionRoot>();
}
val.blastWave = PrimeBlastWave;
}
altSpawnedArms.Add(Object.Instantiate<GameObject>(item, AltParent.transform));
altSpawnedArms.Last().transform.localPosition = item.transform.localPosition;
altSpawnedArms.Last().transform.localRotation = item.transform.localRotation;
altSpawnedArms.Last().transform.localScale = item.transform.localScale;
allArms.Add(item);
allArms.Add(altSpawnedArms.Last());
}
}
internal void PrePunch(Punch p)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
List<GameObject> value = spawnedArmsFA.GetValue(fc);
for (int i = 0; i < value.Count; i++)
{
GameObject value2 = value[i];
value[i] = altSpawnedArms[i];
altSpawnedArms[i] = value2;
}
MonoSingleton<FistControl>.Instance.currentPunch = value[currentOrderNum].GetComponent<Punch>();
RefreshArmActiveness(SpawnedArms, deactivate: false);
LastPunchDelay = Time.unscaledTime - LastPunchTimestamp;
LastPunchTimestamp = Time.unscaledTime;
}
}
public static void RefreshArmActiveness(List<GameObject> spawnedArms, bool deactivate = true)
{
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
Punch val = default(Punch);
foreach (GameObject spawnedArm in spawnedArms)
{
if ((Object)(object)MonoSingleton<FistControl>.Instance.currentArmObject == (Object)(object)spawnedArm)
{
spawnedArm.SetActive(true);
}
else if (spawnedArm.TryGetComponent<Punch>(ref val) && deactivate)
{
spawnedArm.SetActive(false);
}
}
}
internal void ReadyArm(FistType? filterToType = null)
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
List<GameObject> value = spawnedArmsFA.GetValue(fc);
foreach (GameObject item in value)
{
if (item.activeInHierarchy)
{
Punch component = item.GetComponent<Punch>();
if (!((Object)(object)component == (Object)null) && filterToType.HasValue && component.type == filterToType.Value)
{
component.ready = true;
}
}
}
}
internal static void EnsureInitialization()
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity") && !((Object)(object)MonoSingleton<FistControl>.Instance == (Object)null) && !((Object)(object)((Component)MonoSingleton<FistControl>.Instance).GetComponent<DualFistController>() != (Object)null))
{
((Component)MonoSingleton<FistControl>.Instance).gameObject.AddComponent<DualFistController>();
MonoSingleton<FistControl>.Instance.ResetFists();
}
}
}
public static class Options
{
private static ConfigFile _config;
private static ConfigFileManager _configFileManager;
public static ConfigEntry<bool> BindPunchToScroll { get; private set; }
public static ConfigEntry<bool> AutoRefreshFeedbacker { get; private set; }
public static ConfigEntry<bool> AutoRefreshKnuckleblaster { get; private set; }
public static ConfigEntry<int> FlamingComboThreshold { get; private set; }
public static ConfigEntry<float> PunchComboDecayTime { get; private set; }
public static ConfigEntry<int> DamageBoostMaxCombo { get; private set; }
public static ConfigEntry<float> DamageBoostPerCombo { get; private set; }
public static ConfigEntry<int> SuperParryThreshold { get; private set; }
public static ConfigEntry<int> ULTRAParryThreshold { get; private set; }
public static ConfigEntry<int> ULTRANukeParryThreshold { get; private set; }
public static ConfigEntry<int> PlayerBulletParryThresholdAdd { get; private set; }
public static ConfigEntry<float> FeedbackerStaminaCostScalar { get; private set; }
public static ConfigEntry<float> KnuckleblasterStaminaCostScalar { get; private set; }
public static ConfigEntry<float> ParryProjectileArmStaminaGain { get; private set; }
public static ConfigEntry<float> ParryMeleeArmStaminaGain { get; private set; }
public static ConfigEntry<float> ArmStaminaRegenScalar { get; private set; }
public static ConfigEntry<int> NumKnuckleblasterShockwaveBullets { get; private set; }
public static ConfigEntry<float> KnuckleblasterShockwaveBulletSpread { get; private set; }
public static ConfigEntry<float> KnuckleblasterShockwaveSizeScalar { get; private set; }
public static ConfigEntry<float> KnuckleblasterShockwaveDamageScalar { get; private set; }
public static ConfigEntry<float> WhipdashWindow { get; private set; }
public static ConfigEntry<float> WhipdashDuration { get; private set; }
public static ConfigEntry<float> WhipdashSpeedScale { get; private set; }
public static ConfigEntry<float> WhipdashMinDistance { get; private set; }
public static ConfigEntry<bool> OuchieShockwaveEnabled { get; private set; }
public static ConfigEntry<float> OuchieShockwaveSpeed { get; private set; }
public static ConfigEntry<float> OuchieShockwaveDamage { get; private set; }
public static ConfigEntry<float> OuchieShockwaveMaxSize { get; private set; }
public static ConfigEntry<float> OuchieShockwaveRequiredAirTime { get; private set; }
public static ConfigEntry<float> OuchieShockwaveRequiredFallTime { get; private set; }
public static ConfigEntry<float> FeedbackerULTRAPunchRate { get; private set; }
public static ConfigEntry<float> KnuckleBlasterULTRAPunchRate { get; private set; }
public static ConfigEntry<float> ULTRAPunchRateVariance { get; private set; }
internal static void Initialize(BaseUnityPlugin plugin)
{
Assert.IsNotNull((Object)(object)plugin, "");
_config = plugin.Config;
_configFileManager = ((Component)plugin).gameObject.AddComponent<ConfigFileManager>();
_configFileManager.Initialize(_config);
ConfigFileManager configFileManager = _configFileManager;
configFileManager.OnReload = (Action)Delegate.Combine(configFileManager.OnReload, new Action(Reload));
FeedbackerULTRAPunchRate = _config.Bind<float>("ULTRAPunch", "FeedbackerULTRAPunchRate", 10f, "Set the amount of punches to be thrown per second when using ULTRAPunch with the Feedbacker (bindable in in-game settings)");
KnuckleBlasterULTRAPunchRate = _config.Bind<float>("ULTRAPunch", "KnuckleblasterULTRAPunchRate", 6f, "Set the amount of punches to be thrown per second when using ULTRAPunch with the Knuckleblaster (bindable in in-game settings)");
ULTRAPunchRateVariance = _config.Bind<float>("ULTRAPunch", "ULTRAPunchRateVariance", 0f, "Random variance for ULTRAPunch");
DamageBoostMaxCombo = _config.Bind<int>("Combos", "DamageBoostMaxCombo", 10, "");
DamageBoostPerCombo = _config.Bind<float>("Combos", "DamageBoostPerCombo", 0.15f, "");
FlamingComboThreshold = _config.Bind<int>("Combos", "FlamingComboThreshold", 4, "");
PunchComboDecayTime = _config.Bind<float>("Combos", "PunchComboTimer", 0.25f, "");
AutoRefreshFeedbacker = _config.Bind<bool>("Cooldowns", "DisableFeedbackerArmCooldown", true, "Disables the very brief cooldown on each individual arm. Doesn't effect arm exhaustion.");
AutoRefreshKnuckleblaster = _config.Bind<bool>("Cooldowns", "DisableKnuckleblasterArmCooldown", false, "Disables the very brief cooldown on each individual arm. Doesn't effect arm exhaustion.");
FeedbackerStaminaCostScalar = _config.Bind<float>("Cooldowns", "FeedbackerStaminaCostScalar", 0.33f, "Scales the amount of arm stamina to be lost by punching with the Feedbacker. Aka arm exhaustion.");
KnuckleblasterStaminaCostScalar = _config.Bind<float>("Cooldowns", "KnuckleblasterStaminaCostScalar", 0.34f, "Scales the amount of arm stamina to be lost by punching with the Knuckleblaster. Aka arm exhaustion.");
ParryProjectileArmStaminaGain = _config.Bind<float>("Cooldowns", "ParryProjectileArmStaminaGain", 0.2f, "How much arm stamina to gain from parrying a projectile");
ParryMeleeArmStaminaGain = _config.Bind<float>("Cooldowns", "ParryMeleeArmStaminaGain", 1.1f, "How much arm stamina to gain from parrying an enemy directly");
ArmStaminaRegenScalar = _config.Bind<float>("Cooldowns", "ArmStaminaRegenScalar", 0.4f, "How much arm stamina to gain from parrying a projectile");
OuchieShockwaveEnabled = _config.Bind<bool>("SlamShockwave", "GroundSlamOuchieShockwaveEnabled", true, "");
OuchieShockwaveSpeed = _config.Bind<float>("SlamShockwave", "GroundSlamOuchieShockwaveSpeed", 100f, "");
OuchieShockwaveRequiredAirTime = _config.Bind<float>("SlamShockwave", "OuchieShockwaveRequiredAirTime", 0.65f, "");
OuchieShockwaveRequiredFallTime = _config.Bind<float>("SlamShockwave", "OuchieShockwaveRequiredFallTime", 0.02f, "");
OuchieShockwaveDamage = _config.Bind<float>("SlamShockwave", "GroundSlamOuchieShockwaveDamage", 1.5f, "");
OuchieShockwaveMaxSize = _config.Bind<float>("SlamShockwave", "GroundSlamOuchieShockwaveMaxSize", 0.25f, "");
PlayerBulletParryThresholdAdd = _config.Bind<int>("Parrying", "PlayerBulletParryThresholdAdd", 1, "");
SuperParryThreshold = _config.Bind<int>("Parrying", "SuperParryThreshold", 2, "");
ULTRAParryThreshold = _config.Bind<int>("Parrying", "ULTRAParryThreshold", 3, "");
ULTRANukeParryThreshold = _config.Bind<int>("Parrying", "ULTRANukeParryThreshold", 4, "");
NumKnuckleblasterShockwaveBullets = _config.Bind<int>("Knuckleblaster", "NumKnuckleblasterShockwaveBullets", 16, "");
KnuckleblasterShockwaveBulletSpread = _config.Bind<float>("Knuckleblaster", "KnuckleblasterShockwaveBulletSpread", 20f, "");
KnuckleblasterShockwaveSizeScalar = _config.Bind<float>("Knuckleblaster", "KnuckleblasterShockwaveSizeScalar", 1f, "");
KnuckleblasterShockwaveDamageScalar = _config.Bind<float>("Knuckleblaster", "KnuckleblasterShockwaveDamageScalar", 1.5f, "");
WhipdashWindow = _config.Bind<float>("Whiplash", "WhipdashWindow", 0.1f, "The amount of time before and after dashing or whiplash pulling in which you can still trigger a Whipdash (dash and whiplash pull at the same time)");
WhipdashDuration = _config.Bind<float>("Whiplash", "WhipdashDuration", 0.4f, "The duration of a whipdash");
WhipdashSpeedScale = _config.Bind<float>("Whiplash", "WhipdashSpeedScale", 3f, "How much extra speed a whipdash offers");
WhipdashMinDistance = _config.Bind<float>("Whiplash", "WhipdashMinDistance", 8f, "Minimum distance for a whipdash to actually boost player momentum");
BindPunchToScroll = _config.Bind<bool>("NotGonnaSugarCoatIt", "BindPunchToScroll", false, "");
}
private static void Reload()
{
}
}
public class PrimeBlastWave : MonoBehaviour
{
protected void Start()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
ExplosionRoot component = ((Component)this).GetComponent<ExplosionRoot>();
component.ScaleSize(Options.KnuckleblasterShockwaveSizeScalar.Value);
component.ScaleSpeed(Options.KnuckleblasterShockwaveSizeScalar.Value);
component.ScaleDamage(Options.KnuckleblasterShockwaveDamageScalar.Value);
GameObject bullet = Gear.CoreEject.DirectPrefab.GetComponent<Shotgun>().bullet;
Vector3 defaultPos = MonoSingleton<CameraController>.Instance.GetDefaultPos();
PhysicsCastResult val = default(PhysicsCastResult);
PortalTraversalV2[] array = default(PortalTraversalV2[]);
PortalPhysicsV2.SphereCast(defaultPos, ((Component)MonoSingleton<CameraController>.Instance).transform.forward, 0.4f, 0.1f, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)3)), ref val, ref array, ref defaultPos, true, (QueryTriggerInteraction)0);
for (int i = 0; i < Options.NumKnuckleblasterShockwaveBullets.Value; i++)
{
GameObject val2 = Object.Instantiate<GameObject>(bullet, defaultPos, ((Component)this).transform.rotation);
float value = Options.KnuckleblasterShockwaveBulletSpread.Value;
val2.transform.Rotate(Random.Range(0f - value, value), Random.Range(0f - value, value), Random.Range(0f - value, value));
}
}
}
}
public class PlayerOuchieShockwave : MonoBehaviour
{
}
[HarmonyPatch(typeof(PhysicalShockwave), "CheckCollision")]
public static class PhysicalShockwaveCheckCollisionPatch
{
private static Vector3 realScale;
public static bool Prefix(PhysicalShockwave __instance)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return true;
}
if ((Object)(object)((Component)__instance).gameObject.GetComponent<PlayerOuchieShockwave>() == (Object)null)
{
return true;
}
realScale = ((Component)__instance).transform.localScale;
((Component)__instance).transform.localScale = Vector3.one;
return true;
}
public static void Postfix(PhysicalShockwave __instance)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity") && !((Object)(object)((Component)__instance).gameObject.GetComponent<PlayerOuchieShockwave>() == (Object)null))
{
((Component)__instance).transform.localScale = realScale;
}
}
}
[HarmonyPatch(typeof(NewMovement), "FixedUpdate")]
public static class NewMovementFixedUpdatePatch
{
public static float TimeSinceGrounded;
public static bool Prefix(NewMovement __instance)
{
return true;
}
public static void Postfix(NewMovement __instance)
{
if (!__instance.gc.onGround)
{
Mathf.MoveTowards(TimeSinceGrounded, Options.OuchieShockwaveRequiredAirTime.Value * 1.01f, Time.deltaTime);
TimeSinceGrounded += Time.deltaTime;
}
else
{
Mathf.MoveTowards(TimeSinceGrounded, 0f, Time.deltaTime * Options.OuchieShockwaveRequiredAirTime.Value);
}
}
}
[HarmonyPatch(typeof(NewMovement), "TryStartSlam")]
public static class NewMovementTryStartSlamPatch
{
public static TimeSince TimeSinceStartedSlam = TimeSince.op_Implicit(0f);
public static bool WasSlamming = false;
public static bool Prefix(NewMovement __instance)
{
WasSlamming = __instance.gc.heavyFall;
return true;
}
public static void Postfix(NewMovement __instance)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (__instance.gc.heavyFall && !WasSlamming)
{
TimeSinceStartedSlam = TimeSince.op_Implicit(0f);
}
}
}
[HarmonyPatch(typeof(NewMovement), "LandingImpact")]
public static class NewMovementLandingImpactPatch
{
private static TimeSince LastWave = TimeSince.op_Implicit(0f);
public static bool Prefix(NewMovement __instance)
{
return true;
}
public static void Postfix(NewMovement __instance)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity") && MonoSingleton<NewMovement>.Instance.stillHolding && Options.OuchieShockwaveEnabled.Value && !(Options.OuchieShockwaveRequiredFallTime.Value > TimeSince.op_Implicit(NewMovementTryStartSlamPatch.TimeSinceStartedSlam)) && !(Options.OuchieShockwaveRequiredAirTime.Value > NewMovementFixedUpdatePatch.TimeSinceGrounded))
{
NewMovementFixedUpdatePatch.TimeSinceGrounded = 0f;
AssetReference stompWave = MonoSingleton<DefaultReferenceManager>.Instance.cerberus.GetComponentInChildren<StatueBoss>().stompWave;
GameObject val = Object.Instantiate<GameObject>(AddressablesExtensions.ToAsset(stompWave), ((Component)__instance.gc).transform.position, Quaternion.identity);
PhysicalShockwave component = val.GetComponent<PhysicalShockwave>();
val.AddComponent<PlayerOuchieShockwave>();
component.enemy = false;
component.hasHurtPlayer = true;
component.ignorePlayerDash = false;
component.noDamageToEnemy = false;
component.enemyType = (EnemyType)10;
component.speed = Options.OuchieShockwaveSpeed.Value;
component.damage = (int)(Options.OuchieShockwaveDamage.Value * 10f);
component.maxSize *= Options.OuchieShockwaveMaxSize.Value;
LastWave = TimeSince.op_Implicit(0f);
}
}
}
[HarmonyPatch(typeof(Punch), "ActiveFrame")]
public static class PunchActiveFramePatch
{
public static bool Prefix(Punch __instance, bool firstFrame)
{
return true;
}
public static void Postfix(Punch __instance, bool firstFrame)
{
}
}
[HarmonyPatch(typeof(Punch), "ParryProjectile")]
public static class PunchParryProjectilePatch
{
public static GameObject UltraParriedExplosion;
public static GameObject UltraParriedExplosionNuke;
public static void Postfix(Punch __instance, Projectile proj)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Expected O, but got Unknown
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
ParryCounter orAddComponent = ComponentExtensions.GetOrAddComponent<ParryCounter>((Component)(object)proj);
orAddComponent.TimesParried++;
int num = (proj.playerBullet ? Options.PlayerBulletParryThresholdAdd.Value : 0);
if (orAddComponent.TimesParried > Options.ULTRANukeParryThreshold.Value + num - 1)
{
if ((Object)(object)UltraParriedExplosionNuke == (Object)null)
{
UltraParriedExplosionNuke = new GameObject("Nyxpiri_V1Entity_UltraParriedExplosionNuke");
UltraParriedExplosionNuke.transform.parent = MonoSingleton<AssetsRoot>.Instance.AssetHolder.transform;
ExplosionRoot val = Explosions.Super.Instantiate(true, UltraParriedExplosionNuke.transform);
Explosions.Normal.Instantiate(true, UltraParriedExplosionNuke.transform);
val.ScaleSize(2f);
val.SetMaxPlayerDamageOverride(0);
}
proj.explosionEffect = UltraParriedExplosionNuke;
Rigidbody component = ((Component)proj).GetComponent<Rigidbody>();
component.collisionDetectionMode = (CollisionDetectionMode)1;
}
else if (orAddComponent.TimesParried > Options.ULTRAParryThreshold.Value + num - 1)
{
if ((Object)(object)UltraParriedExplosion == (Object)null)
{
UltraParriedExplosion = new GameObject("Nyxpiri_V1Entity_UltraParriedExplosion");
UltraParriedExplosion.transform.parent = MonoSingleton<AssetsRoot>.Instance.AssetHolder.transform;
ExplosionRoot val2 = Explosions.Super.Instantiate(true, UltraParriedExplosion.transform);
Explosions.Normal.Instantiate(true, UltraParriedExplosion.transform);
}
proj.explosionEffect = UltraParriedExplosion;
Rigidbody component2 = ((Component)proj).GetComponent<Rigidbody>();
component2.collisionDetectionMode = (CollisionDetectionMode)1;
}
else if (orAddComponent.TimesParried > Options.SuperParryThreshold.Value + num - 1)
{
proj.explosionEffect = ((Component)Explosions.Super.DirectPrefab).gameObject;
Rigidbody component3 = ((Component)proj).GetComponent<Rigidbody>();
if ((Object)(object)component3 != (Object)null)
{
component3.collisionDetectionMode = (CollisionDetectionMode)1;
}
}
WeaponCharges instance = MonoSingleton<WeaponCharges>.Instance;
instance.punchStamina += Options.ParryProjectileArmStaminaGain.Value;
}
}
[HarmonyPatch(typeof(HookArm), "FixedUpdate")]
public static class HookArmFixedUpdatePatch
{
private static bool WasBoosting = false;
private static bool WasBeingPulled = false;
public static TimeSince TimeSinceBoost = TimeSince.op_Implicit(0f);
public static TimeSince TimeSinceStartedBeingPulled = TimeSince.op_Implicit(0f);
private static bool Whipdashing = false;
public static TimeSince TimeSinceWhipdashStart = TimeSince.op_Implicit(0f);
private static MethodInfo GetTotalLineDistanceMI = typeof(HookArm).GetMethod("GetTotalLineDistance", BindingFlags.Instance | BindingFlags.NonPublic);
public static bool Prefix(HookArm __instance)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return true;
}
if (TimeSince.op_Implicit(TimeSinceWhipdashStart) > Options.WhipdashDuration.Value || (float)GetTotalLineDistanceMI.Invoke(MonoSingleton<HookArm>.Instance, null) < Options.WhipdashMinDistance.Value)
{
Whipdashing = false;
}
if (MonoSingleton<NewMovement>.Instance.boost != WasBoosting)
{
WasBoosting = MonoSingleton<NewMovement>.Instance.boost;
if (WasBoosting)
{
TimeSinceBoost = TimeSince.op_Implicit(0f);
if (TimeSince.op_Implicit(TimeSinceStartedBeingPulled) < Options.WhipdashWindow.Value)
{
Whipdashing = true;
TimeSinceWhipdashStart = TimeSince.op_Implicit(0f);
MonoSingleton<NewMovement>.Instance.boost = false;
}
}
}
return true;
}
public static void Postfix(HookArm __instance)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
if (!MonoSingleton<HookArm>.Instance.beingPulled)
{
WasBeingPulled = false;
return;
}
if (!WasBeingPulled)
{
TimeSinceStartedBeingPulled = TimeSince.op_Implicit(0f);
if (TimeSince.op_Implicit(TimeSinceBoost) < Options.WhipdashWindow.Value)
{
Whipdashing = true;
TimeSinceWhipdashStart = TimeSince.op_Implicit(0f);
MonoSingleton<NewMovement>.Instance.boost = false;
}
}
WasBeingPulled = true;
if ((!MonoSingleton<NewMovement>.Instance.boost || MonoSingleton<NewMovement>.Instance.sliding) && Whipdashing)
{
Rigidbody rb = MonoSingleton<NewMovement>.Instance.rb;
rb.velocity *= Options.WhipdashSpeedScale.Value;
}
}
}
public class ParryCounter : MonoBehaviour
{
public int TimesParried = 0;
}
public static class TimeHelper
{
[HarmonyPatch(typeof(TimeController), "TrueStop")]
public static class TimeControllerTrueStopPatch
{
public static bool Prefix(TimeController __instance)
{
LastHitStopTimestamp = Time.unscaledTimeAsDouble;
return true;
}
public static void Postfix(TimeController __instance)
{
}
}
[HarmonyPatch(typeof(TimeController), "HitStop")]
public static class TimeControllerHitStopPatch
{
public static bool Prefix(TimeController __instance)
{
LastHitStopTimestamp = Time.unscaledTimeAsDouble;
return true;
}
public static void Postfix(TimeController __instance)
{
}
}
public static double LastHitStopTimestamp = 0.0;
public static FieldAccess<TimeController, float> currentStopFA = new FieldAccess<TimeController, float>("currentStop", BindingFlags.Instance | BindingFlags.NonPublic);
public static float TimeSinceLastHitStop => (float)(Time.unscaledTimeAsDouble - LastHitStopTimestamp);
public static float currentStop => currentStopFA.GetValue(MonoSingleton<TimeController>.Instance);
public static void RestoreTime()
{
MonoSingleton<TimeController>.Instance.RestoreTime();
((MonoBehaviour)MonoSingleton<TimeController>.Instance).StopCoroutine("ContinueTime");
}
}
[BepInPlugin("nyxpiri.ultrakill.v1-entity", "V1 Entity", "0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("ULTRAKILL.exe")]
public class V1Entity : BaseUnityPlugin
{
[HarmonyPatch(typeof(FistControl), "Update")]
public static class FistControlUpdatePatch
{
public static bool Prefix(FistControl __instance)
{
//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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return true;
}
float punchStamina = MonoSingleton<WeaponCharges>.Instance.punchStamina;
if (Cheats.Enabled && !MonoSingleton<OptionsManager>.Instance.paused && punchStamina > 1f)
{
MonoSingleton<FistControl>.Instance.fistCooldown = 0f;
FistActions fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (((FistActions)(ref fist)).PunchFeedbacker.WasPerformedThisFrame())
{
DualFistController.RefreshArmActiveness(DualFistController.SpawnedArms);
PerhapsRefreshArm((FistType)0);
}
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (((FistActions)(ref fist)).PunchKnuckleblaster.WasPerformedThisFrame())
{
DualFistController.RefreshArmActiveness(DualFistController.SpawnedArms);
PerhapsRefreshArm((FistType)1);
}
fist = MonoSingleton<InputManager>.Instance.InputSource.Actions.Fist;
if (((FistActions)(ref fist)).Punch.WasPerformedThisFrame())
{
DualFistController.RefreshArmActiveness(DualFistController.SpawnedArms);
PerhapsReadyArm();
}
}
return true;
}
private static void PerhapsReadyArm()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Invalid comparison between Unknown and I4
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
GameObject currentArmObject = MonoSingleton<FistControl>.Instance.currentArmObject;
Punch val = ((currentArmObject != null) ? currentArmObject.GetComponent<Punch>() : null);
if (!((Object)(object)val != (Object)null) || (((int)val.type != 0 || Options.AutoRefreshFeedbacker.Value) && ((int)val.type != 1 || Options.AutoRefreshKnuckleblaster.Value)))
{
((Component)MonoSingleton<FistControl>.Instance).GetComponent<DualFistController>().ReadyArm();
}
}
}
private static void PerhapsRefreshArm(FistType? fistType)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Invalid comparison between Unknown and I4
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
GameObject currentArmObject = MonoSingleton<FistControl>.Instance.currentArmObject;
Punch val = ((currentArmObject != null) ? currentArmObject.GetComponent<Punch>() : null);
FistType val2 = (FistType)0;
if (fistType.HasValue)
{
val2 = fistType.Value;
}
else if ((Object)(object)val != (Object)null)
{
val2 = val.type;
}
if (((int)val2 != 0 || Options.AutoRefreshFeedbacker.Value) && ((int)val2 != 1 || Options.AutoRefreshKnuckleblaster.Value))
{
MonoSingleton<FistControl>.Instance.RefreshArm();
}
}
}
public static void Postfix(FistControl __instance)
{
}
}
public const string CheatID = "nyxpiri.v1-entity";
private float punchTimer = 0f;
private float randomTimerAdd = 0f;
public InputAction ULTRAPunch { get; private set; }
protected void Awake()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
Log.Initialize(((BaseUnityPlugin)this).Logger);
Options.Initialize((BaseUnityPlugin)(object)this);
Harmony.CreateAndPatchAll(((object)this).GetType().Assembly, (string)null);
Input.CreateActions += (CreateActionsEventHandler)delegate(ActionCreator creator)
{
ULTRAPunch = creator.CreateInputAction("ULTRA Punch", ActionMaps.Fist, (InputActionType)1);
};
Cheats.ReadyForCheatRegistration += (ReadyForCheatRegistrationEventHandler)delegate(CheatsManager cheatManager)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
cheatManager.RegisterCheat((ICheat)new ToggleCheat("V1 Entity", "nyxpiri.v1-entity", (Action<ToggleCheat>)OnCheatDisable, (Action<ToggleCheat, CheatsManager>)OnCheatEnable), (string)null);
};
}
private void OnCheatEnable(ToggleCheat cheat, CheatsManager manager)
{
DualFistController.EnsureInitialization();
FistControl instance = MonoSingleton<FistControl>.Instance;
if (instance != null)
{
instance.ResetFists();
}
}
private void OnCheatDisable(ToggleCheat cheat)
{
}
protected void Start()
{
}
protected void Update()
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
if (Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
return;
}
FistControl instance = MonoSingleton<FistControl>.Instance;
float num = MonoSingleton<WeaponCharges>.Instance?.punchStamina ?? 0f;
InputAction uLTRAPunch = ULTRAPunch;
if ((((uLTRAPunch != null) ? new bool?(uLTRAPunch.IsPressed()) : ((bool?)null)) ?? false) && (Object)(object)instance != (Object)null && (Object)(object)instance.currentPunch != (Object)null && num > 1f && !MonoSingleton<OptionsManager>.Instance.paused && !GameStateManager.Instance.PlayerInputLocked)
{
punchTimer += Time.unscaledDeltaTime;
ConfigEntry<float> val = (((int)instance.currentPunch.type == 0) ? Options.FeedbackerULTRAPunchRate : Options.KnuckleBlasterULTRAPunchRate);
if (punchTimer > 1f / (val.Value + randomTimerAdd))
{
Punch(instance, ULTRAPunch);
punchTimer = 0f;
randomTimerAdd = Random.Range(Options.ULTRAPunchRateVariance.Value * -0.5f, Options.ULTRAPunchRateVariance.Value * 0.5f);
}
else if (ULTRAPunch.WasPerformedThisFrame())
{
Punch(instance, ULTRAPunch);
}
}
if (Options.BindPunchToScroll.Value && Mathf.Abs(Input.mouseScrollDelta.y) > 0.1f && num > 1f && !MonoSingleton<OptionsManager>.Instance.paused && !GameStateManager.Instance.PlayerInputLocked)
{
Punch(instance, ULTRAPunch);
}
}
private void Punch(FistControl fc, InputAction heldAction)
{
if (!Cheats.IsCheatDisabled("nyxpiri.v1-entity"))
{
if (Options.AutoRefreshFeedbacker.Value)
{
fc.RefreshArm();
}
fc.currentPunch.heldAction = heldAction;
fc.currentPunch.PunchStart();
}
}
protected void FixedUpdate()
{
}
protected void LateUpdate()
{
}
}