Decompiled source of PlayerNotifications v1.0.0

PlayerNotifications.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using ScheduleOne.DevUtilities;
using ScheduleOne.Networking;
using ScheduleOne.UI;
using Steamworks;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PlayerNotifications")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlayerNotifications")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e70ecb94-7b05-441b-9964-ef5dd9387ab1")]
[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 PlayerNotifications;

[BepInPlugin("synq.schedule1.playernotifications", "Player Notifications", "1.0.0")]
public class main : BaseUnityPlugin
{
	private void Start()
	{
		init();
	}

	private void init()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		Debug.Log((object)"shouldve patched!!");
	}
}
[HarmonyPatch(typeof(Lobby), "PlayerEnterOrLeave")]
public static class enterorleavepatch
{
	public static Sprite GetSpriteByName(string spriteName)
	{
		return ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite sprite) => ((Object)sprite).name == spriteName));
	}

	private static void Postfix(LobbyChatUpdate_t result)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: 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_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"entororlvie");
		string friendPersonaName = SteamFriends.GetFriendPersonaName(new CSteamID(result.m_ulSteamIDUserChanged));
		Sprite spriteByName = GetSpriteByName("appicon_contacts");
		Scene activeScene;
		if ((result.m_rgfChatMemberStateChange & (true ? 1u : 0u)) != 0)
		{
			activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name == "Menu"))
			{
				Singleton<NotificationsManager>.Instance.SendNotification("Lobby", friendPersonaName + " joined.", spriteByName, 5f, true);
			}
		}
		else if ((result.m_rgfChatMemberStateChange & 2u) != 0 || (result.m_rgfChatMemberStateChange & 4u) != 0)
		{
			activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name == "Menu"))
			{
				Singleton<NotificationsManager>.Instance.SendNotification("Lobby", friendPersonaName + " left.", spriteByName, 5f, true);
			}
		}
	}
}