using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("fToParry2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("fToParry2")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b3780545-da19-4ea8-888c-94dcdeffdb15")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 imNotGonnaSugarcoatIt
{
public class ParryScreenOverlay : MonoBehaviour
{
private GameObject customImageObj;
private Image imageComp;
private float timer;
private float duration = 1f;
private bool isShowing;
private void Awake()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_008c: 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)
if (Plugin.CustomParryImages != null && Plugin.CustomParryImages.Count > 0)
{
customImageObj = new GameObject("SugarcoatImageCentered");
customImageObj.transform.SetParent(((Component)this).transform, false);
RectTransform obj = customImageObj.AddComponent<RectTransform>();
obj.anchorMin = new Vector2(0.5f, 0.5f);
obj.anchorMax = new Vector2(0.5f, 0.5f);
obj.pivot = new Vector2(0.5f, 0.5f);
obj.anchoredPosition = Vector2.zero;
obj.sizeDelta = new Vector2(413f, 360f);
customImageObj.AddComponent<CanvasRenderer>();
imageComp = customImageObj.AddComponent<Image>();
customImageObj.SetActive(false);
}
}
public void TriggerParryEffect()
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
timer = duration;
isShowing = true;
if ((Object)(object)customImageObj != (Object)null && (Object)(object)imageComp != (Object)null && Plugin.CustomParryImages.Count > 0)
{
int index = Random.Range(0, Plugin.CustomParryImages.Count);
Texture2D val = Plugin.CustomParryImages[index];
Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
imageComp.sprite = sprite;
Color color = ((Graphic)imageComp).color;
color.a = 1f;
((Graphic)imageComp).color = color;
customImageObj.SetActive(true);
}
}
private void Update()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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 (isShowing && (Object)(object)customImageObj != (Object)null && (Object)(object)imageComp != (Object)null)
{
timer -= Time.deltaTime;
float a = Mathf.Clamp01(timer / duration);
Color color = ((Graphic)imageComp).color;
color.a = a;
((Graphic)imageComp).color = color;
if (timer <= 0f)
{
isShowing = false;
customImageObj.SetActive(false);
}
}
}
}
[BepInPlugin("com.yourname.ultrakill.imnotgonnasugarcoatit", "imNotGonnaSugarcoatIt", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static List<Texture2D> CustomParryImages = new List<Texture2D>();
public static List<AudioClip> CustomParrySounds = new List<AudioClip>();
private void Awake()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string[] files = Directory.GetFiles(directoryName, "parry_image*.png");
for (int i = 0; i < files.Length; i++)
{
byte[] array = File.ReadAllBytes(files[i]);
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
ImageConversion.LoadImage(val, array);
CustomParryImages.Add(val);
}
files = Directory.GetFiles(directoryName, "parry_sound*.mp3");
foreach (string path in files)
{
((MonoBehaviour)this).StartCoroutine(LoadAudioClip(path));
}
new Harmony("com.yourname.ultrakill.ftoparry2").PatchAll();
}
private IEnumerator LoadAudioClip(string path)
{
UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip("file://" + path, (AudioType)13);
try
{
yield return uwr.SendWebRequest();
if ((int)uwr.result == 1)
{
CustomParrySounds.Add(DownloadHandlerAudioClip.GetContent(uwr));
}
}
finally
{
if (uwr != null)
{
uwr.Dispose();
}
}
}
}
[HarmonyPatch(typeof(StyleHUD), "AddPoints")]
public class StyleParryPatch
{
[HarmonyPrefix]
public static void Prefix(object[] __args)
{
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
if (__args == null || __args.Length < 2)
{
return;
}
string text = __args[1]?.ToString();
if (string.IsNullOrEmpty(text) || !text.ToLower().Contains("parry"))
{
return;
}
GameObject val = GameObject.Find("Canvas");
if ((Object)(object)val != (Object)null)
{
ParryScreenOverlay parryScreenOverlay = val.GetComponent<ParryScreenOverlay>();
if ((Object)(object)parryScreenOverlay == (Object)null)
{
parryScreenOverlay = val.AddComponent<ParryScreenOverlay>();
}
parryScreenOverlay.TriggerParryEffect();
}
if (Plugin.CustomParrySounds != null && Plugin.CustomParrySounds.Count > 0)
{
int index = Random.Range(0, Plugin.CustomParrySounds.Count);
AudioClip val2 = Plugin.CustomParrySounds[index];
GameObject val3 = new GameObject("ParrySoundObj");
AudioSource obj = val3.AddComponent<AudioSource>();
obj.clip = val2;
obj.volume = 1f;
obj.Play();
Object.Destroy((Object)val3, val2.length);
}
}
}
}