NAK_CVR_Mods/ClearHudNotifications/HarmonyPatches.cs
NotAKidoS 8c780bb72b init
2023-04-13 19:15:28 -05:00

26 lines
No EOL
1,011 B
C#

using ABI_RC.Core.Savior;
using ABI_RC.Core.UI;
using cohtml;
using HarmonyLib;
namespace NAK.Melons.ClearHudNoficiations.HarmonyPatches;
internal static class CohtmlHudPatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(CohtmlHud), nameof(CohtmlHud.ViewDropText), new Type[] { typeof(string), typeof(string), typeof(string) })]
private static bool Prefix_CohtmlHud_ViewDropText(string cat, string headline, string small, ref CohtmlHud __instance)
{
if (!headline.Contains(MetaPort.Instance.username)) return true; // we only want our username notification
if (small == "A user has joined your Instance." && !MetaPort.Instance.settings.GetSettingsBool("HUDCustomizationPlayerJoins", false))
{
ClearHudNoficiations.ClearHudNotifications();
return false;
}
// clears buffer
if (__instance._isReady) __instance.hudView.View.TriggerEvent("DisplayHudMessageImmediately", cat, headline, small, 3);
return false;
}
}