using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("ultraCustomizer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Customize stats like your health, damage reduction, and whatnot.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ULTRACUSTOMIZER")]
[assembly: AssemblyTitle("ultraCustomizer")]
[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 ultraCustomizer
{
[BepInPlugin("ultraCustomizer", "ULTRACUSTOMIZER", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("ultraCustomizer");
internal static ManualLogSource Logger;
private static ConfigEntry<bool> healingEnabled;
private static ConfigEntry<int> spawnHealth;
private static ConfigEntry<int> respawnHealth;
private static ConfigEntry<bool> damageReductionEnabled;
private static ConfigEntry<bool> flatReductionEnabled;
private static ConfigEntry<int> flatReduction;
private static ConfigEntry<int> destructiveReduction;
private static ConfigEntry<int> chaoticReduction;
private static ConfigEntry<int> brutalReduction;
private static ConfigEntry<int> anarchicReduction;
private static ConfigEntry<int> supremeReduction;
private static ConfigEntry<int> ssadisticReduction;
private static ConfigEntry<int> ssshitstormReduction;
private static ConfigEntry<int> ultrakillReduction;
private static ConfigEntry<Color> hp100Color;
private static ConfigEntry<Color> hp200Color;
private static ConfigEntry<Color> hp300Color;
private static ConfigEntry<Color> hp400Color;
private static ConfigEntry<Color> hp500Color;
private static ConfigEntry<Color> hp600Color;
private static ConfigEntry<Color> hp700Color;
private static ConfigEntry<Color> hp800Color;
private static ConfigEntry<Color> hp900Color;
private static ConfigEntry<Color> hp1000Color;
private static ConfigEntry<Color> afterHp100Color;
private static ConfigEntry<Color> afterHp200Color;
private static ConfigEntry<Color> afterHp300Color;
private static ConfigEntry<Color> afterHp400Color;
private static ConfigEntry<Color> afterHp500Color;
private static ConfigEntry<Color> afterHp600Color;
private static ConfigEntry<Color> afterHp700Color;
private static ConfigEntry<Color> afterHp800Color;
private static ConfigEntry<Color> afterHp900Color;
private static ConfigEntry<Color> afterHp1000Color;
private static int spawnHp;
private static int respawnHp;
private static readonly GameObject[] hpBars = (GameObject[])(object)new GameObject[10];
private static readonly GameObject[] afterImageBars = (GameObject[])(object)new GameObject[10];
private static readonly ConfigEntry<Color>[] hpColorConfigs = new ConfigEntry<Color>[10];
private static readonly ConfigEntry<Color>[] afterHpColorConfigs = new ConfigEntry<Color>[10];
private static int newDamage;
private static bool preventDeath;
private void Awake()
{
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_033e: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_041e: Unknown result type (might be due to invalid IL or missing references)
//IL_0456: Unknown result type (might be due to invalid IL or missing references)
//IL_048e: Unknown result type (might be due to invalid IL or missing references)
//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0536: Unknown result type (might be due to invalid IL or missing references)
//IL_056e: Unknown result type (might be due to invalid IL or missing references)
//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_0616: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
harmony.PatchAll(typeof(Plugin));
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin ultraCustomizer, version 1.0.0, is loaded!");
healingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Health and Healing", "Healing Enabled", true, "Enables or disables healing from blood.");
spawnHealth = ((BaseUnityPlugin)this).Config.Bind<int>("Health and Healing", "Spawn Health", 100, "Amount of health the player spawns with.\r\nOnly supports values between 1 and 1000. (for now)");
respawnHealth = ((BaseUnityPlugin)this).Config.Bind<int>("Health and Healing", "Respawn Health", 100, "Amount of health the player respawns with.\r\nOnly supports values between 1 and 1000. (for now)");
damageReductionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Damage Reduction", "Damage Reduction Toggle", false, "Turns damage reduction on or off.");
flatReductionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Damage Reduction", "Flat Damage Reduction Toggle", false, "Toggles whether or not damage is always reduced at a flat rate.\r\nDisables all style-based damage reductions when enabled.");
flatReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "Flat Damage Reduction", 0, "Percentage of incoming damage reduced.\r\nOnly works if the above option is enabled.");
destructiveReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "DESTRUCTIVE Damage Reduction", 0, "Percentage of incoming damage reduced at style rank DESTRUCTIVE.");
chaoticReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "CHAOTIC Damage Reduction", 0, "Percentage of incoming damage reduced at style rank CHAOTIC.");
brutalReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "BRUTAL Damage Reduction", 0, "Percentage of incoming damage reduced at style rank BRUTAL.");
anarchicReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "ANARCHIC Damage Reduction", 0, "Percentage of incoming damage reduced at style rank ANARCHIC.");
supremeReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "SUPREME Damage Reduction", 0, "Percentage of incoming damage reduced at style rank SUPREME.");
ssadisticReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "SSADISTIC Damage Reduction", 0, "Percentage of incoming damage reduced at style rank SSADISTIC.");
ssshitstormReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "SSSHITSTORM Damage Reduction", 0, "Percentage of incoming damage reduced at style rank SSSHITSTORM.");
ultrakillReduction = ((BaseUnityPlugin)this).Config.Bind<int>("Damage Reduction", "ULTRAKILL Damage Reduction", 0, "Percentage of incoming damage reduced at style rank ULTRAKILL.");
hp100Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 1", new Color(1f, 0f, 0f, 1f), "Color of the 0-100 HP Bar.");
hp200Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 2", new Color(1f, 0.5882f, 0f, 1f), "Color of the 100-200 HP Bar.");
hp300Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 3", new Color(1f, 1f, 0f, 1f), "Color of the 200-300 HP Bar.");
hp400Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 4", new Color(0f, 1f, 0f, 1f), "Color of the 300-400 HP Bar.");
hp500Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 5", new Color(0f, 0.5882f, 0f, 1f), "Color of the 400-500 HP Bar.");
hp600Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 6", new Color(0f, 0.5882f, 0.3922f, 1f), "Color of the 500-600 HP Bar.");
hp700Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 7", new Color(0f, 0.3922f, 0.5882f, 1f), "Color of the 600-700 HP Bar.");
hp800Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 8", new Color(0f, 0f, 0.7843f, 1f), "Color of the 700-800 HP Bar.");
hp900Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 9", new Color(0.3922f, 0f, 0.3922f, 1f), "Color of the 800-900 HP Bar.");
hp1000Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Health Colors", "Healthbar 10", new Color(0.5882f, 0f, 0.7843f, 1f), "Color of the 900-1000 HP Bar.");
afterHp100Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 1", new Color(1f, 0.3922f, 0f, 1f), "Color of the 0-100 Soft Damage Bar.");
afterHp200Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 2", new Color(1f, 0.3922f, 0f, 1f), "Color of the 100-200 Soft Damage Bar.");
afterHp300Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 3", new Color(1f, 0.3922f, 0f, 1f), "Color of the 200-300 Soft Damage Bar.");
afterHp400Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 4", new Color(1f, 0.3922f, 0f, 1f), "Color of the 300-400 Soft Damage Bar.");
afterHp500Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 5", new Color(1f, 0.3922f, 0f, 1f), "Color of the 400-500 Soft Damage Bar.");
afterHp600Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 6", new Color(1f, 0.3922f, 0f, 1f), "Color of the 500-600 Soft Damage Bar.");
afterHp700Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 7", new Color(1f, 0.3922f, 0f, 1f), "Color of the 600-700 Soft Damage Bar.");
afterHp800Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 8", new Color(1f, 0.3922f, 0f, 1f), "Color of the 700-800 Soft Damage Bar.");
afterHp900Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 9", new Color(1f, 0.3922f, 0f, 1f), "Color of the 800-900 Soft Damage Bar.");
afterHp1000Color = ((BaseUnityPlugin)this).Config.Bind<Color>("Health and Healing/Soft Damage Colors", "Soft Damage 10", new Color(1f, 0.3922f, 0f, 1f), "Color of the 900-1000 Soft Damage Bar.");
hpColorConfigs[0] = hp100Color;
hpColorConfigs[1] = hp200Color;
hpColorConfigs[2] = hp300Color;
hpColorConfigs[3] = hp400Color;
hpColorConfigs[4] = hp500Color;
hpColorConfigs[5] = hp600Color;
hpColorConfigs[6] = hp700Color;
hpColorConfigs[7] = hp800Color;
hpColorConfigs[8] = hp900Color;
hpColorConfigs[9] = hp1000Color;
afterHpColorConfigs[0] = afterHp100Color;
afterHpColorConfigs[1] = afterHp200Color;
afterHpColorConfigs[2] = afterHp300Color;
afterHpColorConfigs[3] = afterHp400Color;
afterHpColorConfigs[4] = afterHp500Color;
afterHpColorConfigs[5] = afterHp600Color;
afterHpColorConfigs[6] = afterHp700Color;
afterHpColorConfigs[7] = afterHp800Color;
afterHpColorConfigs[8] = afterHp900Color;
afterHpColorConfigs[9] = afterHp1000Color;
}
private void Update()
{
HealthbarColorUpdates();
}
private void HealthbarColorUpdates()
{
//IL_003d: 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)
if (!((Object)(object)hpBars[9] == (Object)null))
{
for (int i = 0; i < 10; i++)
{
((Graphic)((Component)hpBars[i].transform.Find("Fill Area/Fill")).GetComponent<Image>()).color = hpColorConfigs[i].Value;
((Graphic)((Component)afterImageBars[i].transform.Find("Fill Area/Fill")).GetComponent<Image>()).color = afterHpColorConfigs[i].Value;
}
}
}
[HarmonyPatch(typeof(NewMovement), "Start")]
[HarmonyPostfix]
private static void NewMovementStartPostfix(NewMovement __instance)
{
int value = spawnHealth.Value;
if (1 == 0)
{
}
int num = ((value > 1000) ? 1000 : ((value < 1) ? 1 : spawnHealth.Value));
if (1 == 0)
{
}
spawnHp = num;
__instance.hp = spawnHp;
}
[HarmonyPatch(typeof(NewMovement), "Respawn")]
[HarmonyPostfix]
private static void NewMovementRestartPostfix(NewMovement __instance)
{
int value = respawnHealth.Value;
if (1 == 0)
{
}
int num = ((value > 1000) ? 1000 : ((value < 1) ? 1 : respawnHealth.Value));
if (1 == 0)
{
}
respawnHp = num;
__instance.hp = respawnHp;
}
[HarmonyPatch(typeof(NewMovement), "GetHealth")]
[HarmonyPrefix]
private static bool NewMovementGetHealthPrefix()
{
return healingEnabled.Value;
}
[HarmonyPatch(typeof(NewMovement), "GetHealth")]
[HarmonyPostfix]
private static void NewMovementGetHealthPostfix(NewMovement __instance, int health, bool silent, bool fromExplosion)
{
if (!healingEnabled.Value)
{
if (!silent && health > 5 && MonoSingleton<PrefsManager>.Instance.GetBoolLocal("bloodEnabled", false))
{
Canvas value = Traverse.Create((object)__instance).Field("fullHud").GetValue<Canvas>();
Object.Instantiate<GameObject>(__instance.scrnBlood, ((Component)value).transform);
}
}
else
{
if (__instance.dead || (__instance.exploded && fromExplosion))
{
return;
}
float num = health;
int sameCheckpointRestarts = __instance.sameCheckpointRestarts;
if (1 == 0)
{
}
int num2 = ((sameCheckpointRestarts != 0) ? respawnHp : spawnHp);
if (1 == 0)
{
}
float num3 = num2;
if (num < 1f)
{
num = 1f;
}
if ((float)__instance.hp <= num3)
{
if ((float)__instance.hp + num < num3 - (float)Mathf.RoundToInt(__instance.antiHp))
{
__instance.hp += Mathf.RoundToInt(num);
}
else if ((float)__instance.hp != num3 - (float)Mathf.RoundToInt(__instance.antiHp))
{
__instance.hp = Mathf.RoundToInt(num3) - Mathf.RoundToInt(__instance.antiHp);
}
}
}
}
[HarmonyPatch(typeof(HealthBar), "Start")]
[HarmonyPostfix]
private static void MakeNewHealthbars(HealthBar __instance)
{
if (Object.op_Implicit((Object)(object)((Component)__instance).transform.Find("Health Slider")))
{
Array.Resize(ref __instance.hpSliders, 10);
Array.Resize(ref __instance.afterImageSliders, 10);
hpBars[0] = ((Component)__instance.hpSliders[0]).gameObject;
hpBars[1] = ((Component)__instance.hpSliders[1]).gameObject;
afterImageBars[0] = ((Component)__instance.afterImageSliders[0]).gameObject;
afterImageBars[1] = ((Component)__instance.afterImageSliders[1]).gameObject;
for (int i = 2; i < 10; i++)
{
hpBars[i] = Object.Instantiate<GameObject>(hpBars[1]);
((Object)hpBars[i]).name = i * 100 + 100 + " Health Slider";
hpBars[i].transform.SetParent(((Component)__instance).transform, false);
hpBars[i].GetComponent<Slider>().minValue = i * 100;
hpBars[i].GetComponent<Slider>().maxValue = i * 100 + 100;
__instance.hpSliders[i] = hpBars[i].GetComponent<Slider>();
afterImageBars[i] = Object.Instantiate<GameObject>(afterImageBars[1]);
((Object)afterImageBars[i]).name = i * 100 + 100 + " AfterHealth Slider";
afterImageBars[i].transform.SetParent(((Component)__instance).transform, false);
afterImageBars[i].GetComponent<Slider>().minValue = i * 100;
afterImageBars[i].GetComponent<Slider>().maxValue = i * 100 + 100;
__instance.afterImageSliders[i] = afterImageBars[i].GetComponent<Slider>();
afterImageBars[i].transform.SetSiblingIndex(2 * i + 1);
hpBars[i].transform.SetSiblingIndex(2 * i + 2);
}
}
}
[HarmonyPatch(typeof(NewMovement), "GetHurt")]
[HarmonyPrefix]
private static void NewMovementGetHurtPrefix(NewMovement __instance, int damage, ref int __state)
{
if (!damageReductionEnabled.Value)
{
return;
}
__state = __instance.hp;
float num;
if (flatReductionEnabled.Value)
{
num = flatReduction.Value;
}
else
{
int rankIndex = MonoSingleton<StyleHUD>.Instance.rankIndex;
if (1 == 0)
{
}
int num2 = rankIndex switch
{
7 => ultrakillReduction.Value,
6 => ssshitstormReduction.Value,
5 => ssadisticReduction.Value,
4 => supremeReduction.Value,
3 => anarchicReduction.Value,
2 => brutalReduction.Value,
1 => chaoticReduction.Value,
0 => destructiveReduction.Value,
_ => 1,
};
if (1 == 0)
{
}
num = num2;
}
num = 1f - num / 100f;
newDamage = Mathf.RoundToInt((float)damage * num);
if (__state - damage <= 0 && __state - newDamage > 0)
{
preventDeath = true;
__instance.hp += damage + 1;
}
else
{
preventDeath = false;
}
}
[HarmonyPatch(typeof(NewMovement), "GetHurt")]
[HarmonyPostfix]
private static void NewMovementGetHurtPostfix(NewMovement __instance, int __state)
{
if (damageReductionEnabled.Value)
{
int num = __state - __instance.hp;
if ((__instance.hp > 0 || preventDeath) && num != 0)
{
__instance.hp = __state - newDamage;
}
}
}
[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
[HarmonyPrefix]
private static bool DisableCyberGrindScoreSubmission()
{
return false;
}
[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
[HarmonyPrefix]
private static bool DisableLevelScoreSubmission()
{
return false;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ultraCustomizer";
public const string PLUGIN_NAME = "ULTRACUSTOMIZER";
public const string PLUGIN_VERSION = "1.0.0";
}
}