muffin v7.38.9
This commit is contained in:
parent
ada27cf05b
commit
8a7847ff37
21 changed files with 1296 additions and 689 deletions
19
NotificationMasterAPI/NotificationMasterAPI.csproj
Normal file
19
NotificationMasterAPI/NotificationMasterAPI.csproj
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>NotificationMasterAPI</AssemblyName>
|
||||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
|
||||
<TargetFramework>netcoreapp9.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="Dalamud">
|
||||
<HintPath>..\..\..\..\..\ffxiv\alyssile-xivl\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
NotificationMasterAPI/NotificationMasterAPI/Data.cs
Normal file
6
NotificationMasterAPI/NotificationMasterAPI/Data.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
namespace NotificationMasterAPI;
|
||||
|
||||
public static class Data
|
||||
{
|
||||
public const string MFAudioFormats = "*.3g2;*.3gp;*.3gp2;*.3gpp;*.asf;*.wma;*.wmv;*.aac;*.adts;*.avi;*.mp3;*.m4a;*.m4v;*.mov;*.mp4;*.sami;*.smi;*.wav;*.aiff";
|
||||
}
|
||||
16
NotificationMasterAPI/NotificationMasterAPI/NMAPINames.cs
Normal file
16
NotificationMasterAPI/NotificationMasterAPI/NMAPINames.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
namespace NotificationMasterAPI;
|
||||
|
||||
public static class NMAPINames
|
||||
{
|
||||
public const string DisplayToastNotification = "NotificationMasterAPI.DisplayToastNotification";
|
||||
|
||||
public const string FlashTaskbarIcon = "NotificationMasterAPI.FlashTaskbarIcon";
|
||||
|
||||
public const string PlaySound = "NotificationMasterAPI.PlaySound";
|
||||
|
||||
public const string BringGameForeground = "NotificationMasterAPI.BringGameForeground";
|
||||
|
||||
public const string StopSound = "NotificationMasterAPI.StopSound";
|
||||
|
||||
public const string Active = "NotificationMasterAPI.Active";
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
using System;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
|
||||
namespace NotificationMasterAPI;
|
||||
|
||||
public class NotificationMasterApi
|
||||
{
|
||||
private IDalamudPluginInterface PluginInterface;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of NotificationMaster API. You do not need to check if NotificationMaster plugin is installed.
|
||||
/// </summary>
|
||||
/// <param name="dalamudPluginInterface">Plugin interface reference</param>
|
||||
public NotificationMasterApi(IDalamudPluginInterface dalamudPluginInterface)
|
||||
{
|
||||
PluginInterface = dalamudPluginInterface;
|
||||
}
|
||||
|
||||
private void Validate()
|
||||
{
|
||||
if (PluginInterface == null)
|
||||
{
|
||||
throw new NullReferenceException("NotificationMaster API was called before it was initialized");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if IPC is ready. You DO NOT need to call this method before invoking any of API functions unless you specifically want to check if plugin is installed and ready to accept requests.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsIPCReady()
|
||||
{
|
||||
Validate();
|
||||
try
|
||||
{
|
||||
PluginInterface.GetIpcSubscriber<object>("NotificationMasterAPI.Active").InvokeAction();
|
||||
return true;
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays tray notification. This function does not throws an exception or displays an error if NotificationMaster is not installed.
|
||||
/// </summary>
|
||||
/// <param name="text">Text of tray notification</param>
|
||||
/// <returns>Whether operation succeed.</returns>
|
||||
public bool DisplayTrayNotification(string text)
|
||||
{
|
||||
return DisplayTrayNotification(null, text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays tray notification. This function does not throws an exception or displays an error if NotificationMaster is not installed.
|
||||
/// </summary>
|
||||
/// <param name="title">Title of tray notification</param>
|
||||
/// <param name="text">Text of tray notification</param>
|
||||
/// <returns>Whether operation succeed.</returns>
|
||||
public bool DisplayTrayNotification(string? title, string text)
|
||||
{
|
||||
Validate();
|
||||
try
|
||||
{
|
||||
return PluginInterface.GetIpcSubscriber<string, string, string, bool>("NotificationMasterAPI.DisplayToastNotification").InvokeFunc(PluginInterface.InternalName, title, text);
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flashes game's taskbar icon. This function does not throws an exception or displays an error if NotificationMaster is not installed.
|
||||
/// </summary>
|
||||
/// <returns>Whether operation succeeded</returns>
|
||||
public bool FlashTaskbarIcon()
|
||||
{
|
||||
Validate();
|
||||
try
|
||||
{
|
||||
return PluginInterface.GetIpcSubscriber<string, bool>("NotificationMasterAPI.FlashTaskbarIcon").InvokeFunc(PluginInterface.InternalName);
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to bring game's window foreground. Due to Windows inconsistencies, it's not guaranteed to work. This function does not throws an exception or displays an error if NotificationMaster is not installed.
|
||||
/// </summary>
|
||||
/// <returns>Whether operation succeeded</returns>
|
||||
public bool TryBringGameForeground()
|
||||
{
|
||||
Validate();
|
||||
try
|
||||
{
|
||||
return PluginInterface.GetIpcSubscriber<string, bool>("NotificationMasterAPI.BringGameForeground").InvokeFunc(PluginInterface.InternalName);
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Begins to play a sound file. If another sound file is already playing, stops previous file and begins playing specified. This function does not throws an exception or displays an error if NotificationMaster is not installed.
|
||||
/// </summary>
|
||||
/// <param name="pathOnDisk">Path to local file. Can not be web URL. See <see cref="F:NotificationMasterAPI.Data.MFAudioFormats" /> for supported formats.</param>
|
||||
/// <param name="volume">Volume between 0.0 and 1.0</param>
|
||||
/// <param name="repeat">Whether to repeat sound file.</param>
|
||||
/// <param name="stopOnGameFocus">Whether to stop file once game is focused. </param>
|
||||
/// <returns>Whether operation succeeded</returns>
|
||||
public bool PlaySound(string pathOnDisk, float volume = 1f, bool repeat = false, bool stopOnGameFocus = true)
|
||||
{
|
||||
Validate();
|
||||
try
|
||||
{
|
||||
return PluginInterface.GetIpcSubscriber<string, string, float, bool, bool, bool>("NotificationMasterAPI.PlaySound").InvokeFunc(PluginInterface.InternalName, pathOnDisk, volume, repeat, stopOnGameFocus);
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops playing sound. This function does not throws an exception or displays an error if NotificationMaster is not installed.
|
||||
/// </summary>
|
||||
/// <returns>Whether operation succeeded</returns>
|
||||
public bool StopSound()
|
||||
{
|
||||
Validate();
|
||||
try
|
||||
{
|
||||
return PluginInterface.GetIpcSubscriber<string, bool>("NotificationMasterAPI.StopSound").InvokeFunc(PluginInterface.InternalName);
|
||||
}
|
||||
catch (IpcNotReadyError)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue