Decompiled source of UltraNotifPack v0.1.0

plugins/UltraNotifPack/UltraNotifPack.dll

Decompiled 18 hours ago
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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Notiffy.API;
using Notiffy.Utils;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UltraNotifPack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UltraNotifPack")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bdd19282-1499-46f9-85b8-6cf2de9cb1c0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[BepInPlugin("eepynico.ultranotifpack", "UltraNotifPack", "1.0.0")]
public class UltraNotifPack : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <NotifLoop>d__19 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public UltraNotifPack <>4__this;

		private float <wait>5__1;

		private Notification <notif>5__2;

		private int <randomIcon>5__3;

		private string <iconPath>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <NotifLoop>d__19(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			<notif>5__2 = default(Notification);
			<iconPath>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				break;
			case 2:
				<>1__state = -1;
				break;
			}
			if (intervalEnabled.value)
			{
				<notif>5__2 = Notifications.intervalNotifs[Random.Range(0, Notifications.intervalNotifs.Length)];
				if (totalIcons.value > 0)
				{
					<randomIcon>5__3 = Random.Range(1, totalIcons.value + 1);
					<iconPath>5__4 = Path.Combine(workingDir, "icons", $"notif{<randomIcon>5__3}.png");
					if (File.Exists(<iconPath>5__4))
					{
						<notif>5__2.NotificationIcon = Img2Sprite.LoadNewSprite(<iconPath>5__4, 100f, (SpriteMeshType)1);
					}
					else
					{
						Log.LogWarning((object)$"Icon {<randomIcon>5__3} doesnt exist in {<iconPath>5__4}!");
					}
					<iconPath>5__4 = null;
				}
				NotificationSystem.Notify(<notif>5__2);
				Log.LogInfo((object)"Sending Notification. Type: Interval");
				<notif>5__2 = default(Notification);
			}
			<wait>5__1 = Random.Range(intervalMin.value, intervalMax.value);
			<>2__current = (object)new WaitForSeconds(<wait>5__1);
			<>1__state = 2;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public static UltraNotifPack Instance;

	public static ManualLogSource Log;

	public static IntField totalIcons;

	public static string workingDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	private static PluginConfigurator config;

	private static BoolField intervalEnabled;

	private static IntField intervalMin;

	private static IntField intervalMax;

	public static BoolField actionEnabled;

	public static FloatField notifChance;

	public static BoolField notifDie;

	public static BoolField notifKill;

	public static BoolField notifParry;

	public static BoolField notifHit;

	public static BoolField notifCoin;

	public static BoolField notifDamage;

	public static BoolField notifRank;

	public static BoolField notifStyle;

	private void Awake()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Expected O, but got Unknown
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Expected O, but got Unknown
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Expected O, but got Unknown
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Expected O, but got Unknown
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Expected O, but got Unknown
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Expected O, but got Unknown
		//IL_01b4: 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_01e0: Expected O, but got Unknown
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		Instance = this;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"UltraNotifPack loaded successfully!");
		config = PluginConfigurator.Create("UltraNotifPack", "eepynico.ultranotifpack");
		new ConfigHeader(config.rootPanel, "-- INTERVAL NOTIFICATIONS --", 24);
		intervalEnabled = new BoolField(config.rootPanel, "Enable interval notifications", "intervalEnabled", true);
		intervalMin = new IntField(config.rootPanel, "Min interval (seconds)", "intervalMin", 20);
		intervalMax = new IntField(config.rootPanel, "Max interval (seconds)", "intervalMax", 60);
		new ConfigHeader(config.rootPanel, "-- ACTION NOTIFICATIONS --", 24);
		actionEnabled = new BoolField(config.rootPanel, "Enable action notifications", "actionEnabled", true);
		notifChance = new FloatField(config.rootPanel, "Notification chance (%)", "notifChance", 100f, 0f, 100f);
		new ConfigHeader(config.rootPanel, "Actions", 18);
		notifDie = new BoolField(config.rootPanel, "On death", "notifDie", true);
		notifKill = new BoolField(config.rootPanel, "On kill", "notifKill", true);
		notifParry = new BoolField(config.rootPanel, "On parry", "notifParry", true);
		notifDamage = new BoolField(config.rootPanel, "On damage taken", "notifDamage", true);
		new ConfigHeader(config.rootPanel, "-- ECT --", 24);
		totalIcons = new IntField(config.rootPanel, "Total custom icons", "totalIcons", 30, 0, 999);
		new Harmony("eepynico.ultranotifpack").PatchAll();
		((MonoBehaviour)this).StartCoroutine(NotifLoop());
		NotificationSystem.ActionInvoked += delegate(uint id, string actionIdentifier)
		{
			Log.LogInfo((object)$"Notification {id} action: {actionIdentifier}");
			switch (actionIdentifier)
			{
			case "dies":
				MonoSingleton<NewMovement>.Instance.GetHurt(99999, true, 1f, false, false, 0.35f, false);
				Log.LogInfo((object)"Killed Player");
				break;
			case "reward":
				Spawning.SpawnEnemy("Mannequin", 10);
				Log.LogInfo((object)"Spawned 10 Mannequins");
				break;
			case "allowminos":
				Spawning.SpawnEnemy("Minos Prime");
				Log.LogInfo((object)"Spawned Minos");
				break;
			}
		};
	}

	[IteratorStateMachine(typeof(<NotifLoop>d__19))]
	private IEnumerator NotifLoop()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <NotifLoop>d__19(0)
		{
			<>4__this = this
		};
	}

	public static void SendRandom(Notification[] notifs)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		if (Random.Range(0f, 100f) <= notifChance.value)
		{
			Notification val = notifs[Random.Range(0, notifs.Length)];
			if (totalIcons.value > 0)
			{
				int num = Random.Range(1, totalIcons.value + 1);
				string text = Path.Combine(workingDir, "icons", $"notif{num}.png");
				if (File.Exists(text))
				{
					val.NotificationIcon = Img2Sprite.LoadNewSprite(text, 100f, (SpriteMeshType)1);
				}
				else
				{
					Log.LogWarning((object)$"Icon {num} doesnt exist in {text}!");
				}
			}
			NotificationSystem.Notify(val);
			Log.LogInfo((object)"Action Notification Sending.");
		}
		else
		{
			Log.LogInfo((object)"Action Notification NOT Sending.");
		}
	}
}
public static class Notifications
{
	public static Notification[] intervalNotifs = (Notification[])(object)new Notification[17]
	{
		new Notification
		{
			Summary = "System Alert",
			Body = "You may have vibus",
			Actions = new List<string> { "dies", "*Die*", "installanti", "Install AntiVirus" }
		},
		new Notification
		{
			Summary = "Update Available",
			Body = "ULTRAKILL 2 Is ready to install",
			Actions = new List<string> { "yes", "Install Now", "no", "Maybe Later" }
		},
		new Notification
		{
			Summary = "Hot singles in your area",
			Body = "Hot singles in your area! find them now at https://en.wikipedia.org/wiki/Hot_Singles_in_Your_Area",
			Actions = new List<string> { "idc", "I don't care.", "wiki", "Is that a wikipedia link?" }
		},
		new Notification
		{
			Summary = "Congratulations!",
			Body = "You are the SECOND machine chosen to be hells favorite toy!",
			Actions = new List<string> { "wtf", "The fuck?", "reward", "Earn reward now!" }
		},
		new Notification
		{
			Summary = "Breaking News",
			Body = "Local machine refuses to listen to reason, continues killing"
		},
		new Notification
		{
			Summary = "New Friend Request",
			Body = "Minos Prime would like to know your location",
			Actions = new List<string> { "allowminos", "Allow", "no", "Deny" }
		},
		new Notification
		{
			Summary = "New sale!",
			Body = "Buy 3 skulls for the price of 2 skulls plus the price of 1!",
			Actions = new List<string> { "buy", "Buy", "close", "Close" }
		},
		new Notification
		{
			Summary = "Recommended Video",
			Body = "\"How to parry your taxes\", Uploaded 3 minutes ago.",
			Actions = new List<string> { "watch", "Watch", "Not now", "Later" }
		},
		new Notification
		{
			Summary = "Filth3274 has sent you a message",
			Body = "\"Check behind you\"",
			Actions = new List<string> { "reply", "Reply", "read", "Mark As Read", "block", "Block" }
		},
		new Notification
		{
			Summary = "GabrielOfficial has sent you a message",
			Body = "\"Machine, im taking a photo with the funny rock\"",
			Actions = new List<string> { "reply", "Reply", "read", "Mark As Read", "block", "Block" }
		},
		new Notification
		{
			Summary = "Anonymous has sent you a message",
			Body = "\"Im Approaching.\"",
			Actions = new List<string> { "reply", "Reply", "read", "Mark As Read", "block", "Block" }
		},
		new Notification
		{
			Summary = "LUSTLAYER.XXX has sent you a message",
			Body = "\"Renew Your subscription! you only have EIGHT days left!\"",
			Actions = new List<string> { "renew", "Renew", "ignore", "Ignore", "block", "Block" }
		},
		new Notification
		{
			Summary = "PaintEater has sent you a message",
			Body = "\"the progpess of th  r is go n we aofp l ak\"",
			Actions = new List<string> { "reply", "Reply", "read", "Mark As Read", "block", "Block" }
		},
		new Notification
		{
			Summary = "GPU Warning",
			Body = "GPU Tempurature approaching the surface of the sun."
		},
		new Notification
		{
			Summary = "Performance Waring",
			Body = "Blood Consumption exceeds recommended levels."
		},
		new Notification
		{
			Summary = "Background Process",
			Body = "RECORD_COMBAT.bat is consuming 96.3% CPU.",
			Actions = new List<string> { "close", "Close program", "ignore", "Ignore" }
		},
		new Notification
		{
			Summary = "Security Alert",
			Body = "An unauthorized earthmover has gained access to your file system.",
			Actions = new List<string> { "password", "Change Password", "authorize", "Authorize this" }
		}
	};

	public static Notification[] deathNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "You died",
			Body = "Skill issue"
		},
		new Notification
		{
			Summary = "You died",
			Body = "Touch grass"
		},
		new Notification
		{
			Summary = "You died",
			Body = "Get good"
		}
	};

	public static Notification[] damageNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "You got hit",
			Body = "Try avoiding that"
		},
		new Notification
		{
			Summary = "You got hit",
			Body = "Just shoot them dummy"
		},
		new Notification
		{
			Summary = "You got hit",
			Body = "You know this game requires skill, right?"
		}
	};

	public static Notification[] parryNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "You parried",
			Body = "Return to Sender"
		},
		new Notification
		{
			Summary = "You parried",
			Body = "Bonk"
		},
		new Notification
		{
			Summary = "You parried",
			Body = "UltraFisted"
		}
	};

	public static Notification[] rankupNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "Rank changed",
			Body = "Gopro go brrr"
		},
		new Notification
		{
			Summary = "Rank changed",
			Body = "Style on em"
		},
		new Notification
		{
			Summary = "Rank changed",
			Body = "Looking good"
		}
	};

	public static Notification[] rankdownNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "Rank changed",
			Body = "You suck"
		},
		new Notification
		{
			Summary = "Rank changed",
			Body = "Metal Pipe Sound Effect"
		},
		new Notification
		{
			Summary = "Rank changed",
			Body = "Get rekt"
		}
	};

	public static Notification[] styleNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "Style bonus",
			Body = "Fancy moves"
		},
		new Notification
		{
			Summary = "Style bonus",
			Body = "Showoff"
		},
		new Notification
		{
			Summary = "Style bonus",
			Body = "Hit that scrongly"
		}
	};

	public static Notification[] killNotifs = (Notification[])(object)new Notification[3]
	{
		new Notification
		{
			Summary = "Enemy killed",
			Body = "Got em"
		},
		new Notification
		{
			Summary = "Enemy killed",
			Body = "Another one bites the dust"
		},
		new Notification
		{
			Summary = "Enemy killed",
			Body = "Blood for the blood machine"
		}
	};
}
[HarmonyPatch(typeof(NewMovement), "GetHurt")]
internal class PatchPlayerHurt
{
	private static void Postfix(NewMovement __instance)
	{
		if (__instance.dead)
		{
			if (UltraNotifPack.actionEnabled.value && UltraNotifPack.notifDie.value)
			{
				UltraNotifPack.SendRandom(Notifications.deathNotifs);
				UltraNotifPack.Log.LogInfo((object)"Sending Notification. Type: Death");
			}
		}
		else if (UltraNotifPack.actionEnabled.value && UltraNotifPack.notifDamage.value)
		{
			UltraNotifPack.SendRandom(Notifications.damageNotifs);
			UltraNotifPack.Log.LogInfo((object)"Sending Notification. Type: Damage");
		}
	}
}
[HarmonyPatch(typeof(Punch), "ParryProjectile")]
internal class PatchParry
{
	private static void Postfix()
	{
		if (UltraNotifPack.actionEnabled.value && UltraNotifPack.notifParry.value)
		{
			UltraNotifPack.SendRandom(Notifications.parryNotifs);
			UltraNotifPack.Log.LogInfo((object)"Sending Notification. Type: Parry (Proj)");
		}
	}
}
[HarmonyPatch(typeof(EnemyIdentifier), "Death", new Type[] { })]
internal class PatchEnemyDeath
{
	private static void Prefix(EnemyIdentifier __instance)
	{
		if (!__instance.dead && UltraNotifPack.actionEnabled.value && UltraNotifPack.notifKill.value)
		{
			UltraNotifPack.SendRandom(Notifications.killNotifs);
			UltraNotifPack.Log.LogInfo((object)"Sending Notification. Type: Kill");
		}
	}
}
public static class Spawning
{
	public static void SpawnEnemy(string name, int count = 1)
	{
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: 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_00cf: Expected O, but got Unknown
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: 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)
		SpawnMenu instance = MonoSingleton<SpawnMenu>.Instance;
		if ((Object)(object)instance != (Object)null)
		{
			FieldInfo field = typeof(SpawnMenu).GetField("objects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null)
			{
				object value = field.GetValue(instance);
				FieldInfo field2 = value.GetType().GetField("enemies", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field2 != null)
				{
					Array array = (Array)field2.GetValue(value);
					foreach (object item in array)
					{
						FieldInfo field3 = item.GetType().GetField("gameObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						if (field3 == null)
						{
							continue;
						}
						GameObject val = (GameObject)field3.GetValue(item);
						if (!((Object)(object)val != (Object)null) || !((Object)val).name.Contains(name))
						{
							continue;
						}
						for (int i = 0; i < count; i++)
						{
							Object.Instantiate<GameObject>(val, ((Component)MonoSingleton<NewMovement>.Instance).transform.position + Random.insideUnitSphere * 5f, Quaternion.identity);
						}
						return;
					}
				}
			}
		}
		EnemyIdentifier[] array2 = Object.FindObjectsOfType<EnemyIdentifier>();
		EnemyIdentifier[] array3 = array2;
		foreach (EnemyIdentifier val2 in array3)
		{
			if (((Object)((Component)val2).gameObject).name.Contains(name))
			{
				for (int k = 0; k < count; k++)
				{
					Object.Instantiate<GameObject>(((Component)val2).gameObject, ((Component)MonoSingleton<NewMovement>.Instance).transform.position + Random.insideUnitSphere * 5f, Quaternion.identity);
				}
				return;
			}
		}
		GameObject[] array4 = Resources.FindObjectsOfTypeAll<GameObject>();
		GameObject[] array5 = array4;
		foreach (GameObject val3 in array5)
		{
			if (((Object)val3).name == name && (Object)(object)val3.GetComponent<EnemyIdentifier>() != (Object)null)
			{
				for (int m = 0; m < count; m++)
				{
					Object.Instantiate<GameObject>(val3, ((Component)MonoSingleton<NewMovement>.Instance).transform.position + Random.insideUnitSphere * 5f, Quaternion.identity);
				}
				return;
			}
		}
		UltraNotifPack.Log.LogWarning((object)("Prefab " + name + " not found anywhere!"));
	}
}