docs: document public api

This commit is contained in:
Anna 2021-04-11 09:42:59 -04:00
parent 9e8d0276cd
commit 7f34841eee
3 changed files with 60 additions and 1 deletions

View File

@ -12,6 +12,9 @@ namespace XivCommon.Functions {
public delegate void BattleTalkEventDelegate(ref SeString sender, ref SeString message, ref BattleTalkOptions options, ref bool isHandled); public delegate void BattleTalkEventDelegate(ref SeString sender, ref SeString message, ref BattleTalkOptions options, ref bool isHandled);
/// <summary>
/// The event that is fired when a BattleTalk window is shown.
/// </summary>
public event BattleTalkEventDelegate? OnBattleTalk; public event BattleTalkEventDelegate? OnBattleTalk;
private delegate byte AddBattleTalkDelegate(IntPtr uiModule, IntPtr sender, IntPtr message, float duration, byte style); private delegate byte AddBattleTalkDelegate(IntPtr uiModule, IntPtr sender, IntPtr message, float duration, byte style);
@ -67,6 +70,13 @@ namespace XivCommon.Functions {
} }
} }
/// <summary>
/// Show a BattleTalk window with the given options.
/// </summary>
/// <param name="sender">The name to attribute to the message</param>
/// <param name="message">The message to show in the window</param>
/// <param name="options">Optional options for the window</param>
/// <exception cref="InvalidOperationException">If the <see cref="Hooks.BattleTalk"/> hook is not enabled</exception>
public void Show(SeString sender, SeString message, BattleTalkOptions? options = null) { public void Show(SeString sender, SeString message, BattleTalkOptions? options = null) {
this.Show(sender.Encode(), message.Encode(), options); this.Show(sender.Encode(), message.Encode(), options);
} }
@ -98,17 +108,40 @@ namespace XivCommon.Functions {
public class BattleTalkOptions { public class BattleTalkOptions {
/// <summary> /// <summary>
/// Duration of the window in seconds. /// Duration to display the window, in seconds.
/// </summary> /// </summary>
public float Duration { get; set; } = 5f; public float Duration { get; set; } = 5f;
/// <summary>
/// The style of the window.
/// </summary>
public BattleTalkStyle Style { get; set; } = BattleTalkStyle.Normal; public BattleTalkStyle Style { get; set; } = BattleTalkStyle.Normal;
} }
public enum BattleTalkStyle : byte { public enum BattleTalkStyle : byte {
/// <summary>
/// A normal battle talk window with a white background.
/// </summary>
Normal = 0, Normal = 0,
/// <summary>
/// A battle talk window with a blue background and styled edges.
/// </summary>
Aetherial = 6, Aetherial = 6,
/// <summary>
/// A battle talk window styled similarly to a system text message (black background).
/// </summary>
System = 7, System = 7,
/// <summary>
/// <para>
/// A battle talk window with a blue, computer-y background.
/// </para>
/// <para>
/// Used by the Ultima Weapons (Ruby, Emerald, etc.).
/// </para>
/// </summary>
Blue = 9, Blue = 9,
} }
} }

View File

@ -37,6 +37,15 @@ namespace XivCommon.Functions {
return this.RequestPfListingsHook!.Original(agent, categoryIdx); return this.RequestPfListingsHook!.Original(agent, categoryIdx);
} }
/// <summary>
/// <para>
/// Refresh the Party Finder listings. This does not open the Party Finder.
/// </para>
/// <para>
/// This maintains the currently selected category.
/// </para>
/// </summary>
/// <exception cref="InvalidOperationException">If the <see cref="Hooks.PartyFinder"/> hook is not enabled</exception>
public void RefreshListings() { public void RefreshListings() {
if (!this.Enabled) { if (!this.Enabled) {
throw new InvalidOperationException("PartyFinder hooks are not enabled"); throw new InvalidOperationException("PartyFinder hooks are not enabled");

View File

@ -3,8 +3,25 @@
namespace XivCommon { namespace XivCommon {
[Flags] [Flags]
public enum Hooks { public enum Hooks {
/// <summary>
/// No hook.
///
/// This flag is used to disable all hooking.
/// </summary>
None, None,
/// <summary>
/// The BattleTalk hook.
///
/// This hook is used in order to enable all BattleTalk functions.
/// </summary>
BattleTalk, BattleTalk,
/// <summary>
/// The Party Finder hooks.
///
/// This hook is used in order to enable all Party Finder functions.
/// </summary>
PartyFinder, PartyFinder,
} }