Restore latest from ProfessorFartsalot/SnowcloakClient
This commit is contained in:
3625
Glamourer.Api/.editorconfig
Normal file
3625
Glamourer.Api/.editorconfig
Normal file
File diff suppressed because it is too large
Load Diff
3
Glamourer.Api/.gitignore
vendored
Normal file
3
Glamourer.Api/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
bin/
|
||||
obj/
|
||||
.vs/
|
14
Glamourer.Api/Api/IGlamourerApi.cs
Normal file
14
Glamourer.Api/Api/IGlamourerApi.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
/// <summary> The full API available. </summary>
|
||||
public interface IGlamourerApi : IGlamourerApiBase
|
||||
{
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns"/>
|
||||
public IGlamourerApiDesigns Designs { get; }
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems"/>
|
||||
public IGlamourerApiItems Items { get; }
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState"/>
|
||||
public IGlamourerApiState State { get; }
|
||||
}
|
11
Glamourer.Api/Api/IGlamourerApiBase.cs
Normal file
11
Glamourer.Api/Api/IGlamourerApiBase.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
/// <summary> Basic API functions. </summary>
|
||||
public interface IGlamourerApiBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the current API version of the Glamourer available in this installation.
|
||||
/// Major version changes indicate incompatibilities, minor version changes are backward-compatible additions.
|
||||
/// </summary>
|
||||
public (int Major, int Minor) ApiVersion { get; }
|
||||
}
|
33
Glamourer.Api/Api/IGlamourerApiDesigns.cs
Normal file
33
Glamourer.Api/Api/IGlamourerApiDesigns.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Glamourer.Api.Enums;
|
||||
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
/// <summary> All functions related to Glamourer designs. </summary>
|
||||
public interface IGlamourerApiDesigns
|
||||
{
|
||||
/// <summary> Obtain a list of all available designs. </summary>
|
||||
/// <returns> A dictionary of all designs from their GUID to their current display name. </returns>
|
||||
public Dictionary<Guid, string> GetDesignList();
|
||||
|
||||
/// <summary> Apply an existing design to an actor. </summary>
|
||||
/// <param name="designId"> The GUID of the design to apply. </param>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once, Equipment, Customization, Lock (see <see cref="ApplyFlag"/>.)</param>
|
||||
/// <returns> DesignNotFound, ActorNotFound, InvalidKey, Success. </returns>
|
||||
public GlamourerApiEc ApplyDesign(Guid designId, int objectIndex, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Apply an existing design to an actor. </summary>
|
||||
/// <param name="designId"> The GUID of the design to apply. </param>
|
||||
/// <param name="playerName"> The name of the players to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once, Equipment, Customization, Lock (see <see cref="ApplyFlag"/>.)</param>
|
||||
/// <returns> DesignNotFound, ActorNotFound, InvalidKey, Success. </returns>
|
||||
/// /// <remarks>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.<br/>
|
||||
/// Only players are checked for name equality, no NPCs.<br/>
|
||||
/// If multiple players of the same name are found, all of them are reverted.<br/>
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public GlamourerApiEc ApplyDesignName(Guid designId, string playerName, uint key, ApplyFlag flags);
|
||||
}
|
80
Glamourer.Api/Api/IGlamourerApiItems.cs
Normal file
80
Glamourer.Api/Api/IGlamourerApiItems.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using Glamourer.Api.Enums;
|
||||
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
/// <summary> All functions related to items. </summary>
|
||||
public interface IGlamourerApiItems
|
||||
{
|
||||
/// <summary> Set a single item on an actor. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="slot"> The slot to apply the item to. </param>
|
||||
/// <param name="itemId"> The (Custom) ID of the item to apply. </param>
|
||||
/// <param name="stains"> The IDs of the stains to apply to the item. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once (see <see cref="ApplyFlag"/>.)</param>
|
||||
/// <returns> ItemInvalid, ActorNotFound, ActorNotHuman, InvalidKey, Success. </returns>
|
||||
/// <remarks> The item ID can be a custom item ID in Glamourer's format for models without an associated item, or a normal game item ID. </remarks>
|
||||
public GlamourerApiEc SetItem(int objectIndex, ApiEquipSlot slot, ulong itemId, IReadOnlyList<byte> stains, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Set a single item on players. </summary>
|
||||
/// <param name="playerName"> The name of the players to be manipulated. </param>
|
||||
/// <param name="slot"> The slot to apply the item to. </param>
|
||||
/// <param name="itemId"> The (Custom) ID of the item to apply. </param>
|
||||
/// <param name="stains"> The IDs of the stains to apply to the item. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once (see <see cref="ApplyFlag"/>.)</param>
|
||||
/// <returns> ItemInvalid, ActorNotFound, ActorNotHuman, InvalidKey, Success. </returns>
|
||||
/// <remarks>
|
||||
/// The item ID can be a custom item ID in Glamourer's format for models without an associated item, or a normal game item ID.<br/>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.<br/>
|
||||
/// Only players are checked for name equality, no NPCs.<br/>
|
||||
/// If multiple players of the same name are found, all of them are modified.<br/>
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public GlamourerApiEc SetItemName(string playerName, ApiEquipSlot slot, ulong itemId, IReadOnlyList<byte> stains, uint key,
|
||||
ApplyFlag flags);
|
||||
|
||||
/// <summary> Set a single bonus item on an actor. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="slot"> The bonus slot to apply the item to. </param>
|
||||
/// <param name="bonusItemId"> The bonus item sheet ID of the item to apply (including stain). </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once (see <see cref="ApplyFlag"/>.)</param>
|
||||
/// <returns> ItemInvalid, ActorNotFound, ActorNotHuman, InvalidKey, Success. </returns>
|
||||
/// <remarks> The bonus item ID can currently not be a custom item ID in Glamourer's format for models without an associated item. Use 0 to remove the bonus item. </remarks>
|
||||
public GlamourerApiEc SetBonusItem(int objectIndex, ApiBonusSlot slot, ulong bonusItemId, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Set a single bonus item on an actor. </summary>
|
||||
/// <param name="playerName"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="slot"> The bonus slot to apply the item to. </param>
|
||||
/// <param name="bonusItemId"> The bonus item sheet ID of the item to apply (including stain). </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once (see <see cref="ApplyFlag"/>.)</param>
|
||||
/// <returns> ItemInvalid, ActorNotFound, ActorNotHuman, InvalidKey, Success. </returns>
|
||||
/// <remarks>
|
||||
/// The bonus item ID can currently not be a custom item ID in Glamourer's format for models without an associated item. Use 0 to remove the bonus item. <br/>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.<br/>
|
||||
/// Only players are checked for name equality, no NPCs.<br/>
|
||||
/// If multiple players of the same name are found, all of them are modified.<br/>
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public GlamourerApiEc SetBonusItemName(string playerName, ApiBonusSlot slot, ulong bonusItemId, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Set the defined Meta State flags to the active or inactive state on actor. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="types"> The flags defining which meta states to update to the new value. This can be multiple at once. </param>
|
||||
/// <param name="newValue"> The new value to update to. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once (see <see cref="ApplyFlag.Once"/>.)</param>
|
||||
/// <returns> ItemInvalid, ActorNotFound, ActorNotHuman, InvalidKey, Success. </returns>
|
||||
public GlamourerApiEc SetMetaState(int objectIndex, MetaFlag types, bool newValue, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Set the defined Meta State flags to the active or inactive state on actor (by name) </summary>
|
||||
/// <param name="playerName"> The name of the players to be manipulated. </param>
|
||||
/// <param name="types"> The flags defining which meta states to update to the new value. This can be multiple at once. </param>
|
||||
/// <param name="newValue"> The new value to update to. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once (see <see cref="ApplyFlag.Once"/>.)</param>
|
||||
/// <returns> ItemInvalid, ActorNotFound, ActorNotHuman, InvalidKey, Success. </returns>
|
||||
public GlamourerApiEc SetMetaStateName(string playerName, MetaFlag types, bool newValue, uint key, ApplyFlag flags);
|
||||
}
|
124
Glamourer.Api/Api/IGlamourerApiState.cs
Normal file
124
Glamourer.Api/Api/IGlamourerApiState.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using Glamourer.Api.Enums;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Glamourer.Api.Api;
|
||||
|
||||
/// <summary> Any functions related to Glamourer's state tracking. </summary>
|
||||
public interface IGlamourerApiState
|
||||
{
|
||||
/// <summary> Get the current Glamourer state of an actor. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the desired actor. </param>
|
||||
/// <param name="key"> A key to unlock the state if necessary. </param>
|
||||
/// <returns> ActorNotFound, InvalidKey or Success, and the state on success. </returns>
|
||||
/// <remarks> The actor does not need to have a prior Glamourer state as long as it can be found. </remarks>
|
||||
public (GlamourerApiEc, JObject?) GetState(int objectIndex, uint key);
|
||||
|
||||
/// <summary> Get the current Glamourer state of a player character. </summary>
|
||||
/// <param name="playerName"> The name of the desired player. </param>
|
||||
/// <param name="key"> A key to unlock the state if necessary. </param>
|
||||
/// <returns> ActorNotFound, InvalidKey or Success, and the state on success. </returns>
|
||||
/// <remarks>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.
|
||||
/// Only players are checked for name equality, no NPCs.
|
||||
/// If multiple players of the same name are found, the first is returned.
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public (GlamourerApiEc, JObject?) GetStateName(string playerName, uint key);
|
||||
|
||||
/// <inheritdoc cref="GetState"/>
|
||||
public (GlamourerApiEc, string?) GetStateBase64(int objectIndex, uint key);
|
||||
|
||||
/// <inheritdoc cref="GetStateName"/>
|
||||
public (GlamourerApiEc, string?) GetStateBase64Name(string objectName, uint key);
|
||||
|
||||
/// <summary> Apply a supplied state to an actor. </summary>
|
||||
/// <param name="applyState"> The state, which can be either a Glamourer-supplied JObject or a Base64 string. </param>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the application. Respects Once, Equipment, Customization and Lock (see <see cref="ApplyFlag"/>.) </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, ActorNotHuman, Success. </returns>
|
||||
public GlamourerApiEc ApplyState(object applyState, int objectIndex, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Apply a supplied state to players. </summary>
|
||||
/// <param name="applyState"> The state, which can be either a Glamourer-supplied JObject or a Base64 string. </param>
|
||||
/// <param name="playerName"> The name of the player to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock or lock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the application. Respects Once, Equipment, Customization and Lock (see <see cref="ApplyFlag"/>.) </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, ActorNotHuman, Success. </returns>
|
||||
/// <remarks>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.<br/>
|
||||
/// Only players are checked for name equality, no NPCs.<br/>
|
||||
/// If multiple players of the same name are found, all of them are manipulated.<br/>
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public GlamourerApiEc ApplyStateName(object applyState, string playerName, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Revert the Glamourer state of an actor to Game state. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Equipment and Customization (see <see cref="ApplyFlag"/>.) </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, Success, NothingDone. </returns>
|
||||
public GlamourerApiEc RevertState(int objectIndex, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Revert the Glamourer state of players to game state. </summary>
|
||||
/// <param name="playerName"> The name of the players to be reverted. </param>
|
||||
/// <param name="key"> A key to unlock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Equipment and Customization (see <see cref="ApplyFlag"/>.) </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, Success, NothingDone. </returns>
|
||||
/// /// <remarks>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.<br/>
|
||||
/// Only players are checked for name equality, no NPCs.<br/>
|
||||
/// If multiple players of the same name are found, all of them are reverted.<br/>
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public GlamourerApiEc RevertStateName(string playerName, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Unlock the Glamourer state of an actor with a key. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock the state. </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, Success, NothingDone. </returns>
|
||||
public GlamourerApiEc UnlockState(int objectIndex, uint key);
|
||||
|
||||
/// <summary> Unlock the Glamourer state of players with a key. </summary>
|
||||
/// <param name="playerName"> The name of the players to be unlocked. </param>
|
||||
/// <param name="key"> A key to unlock the state. </param>
|
||||
/// <returns> InvalidKey, Success, NothingDone. </returns>
|
||||
public GlamourerApiEc UnlockStateName(string playerName, uint key);
|
||||
|
||||
/// <summary> Unlock all active glamourer states with a key. </summary>
|
||||
/// <param name="key"> The key to unlock states with. </param>
|
||||
/// <returns> The number of unlocked states. </returns>
|
||||
public int UnlockAll(uint key);
|
||||
|
||||
/// <summary> Revert the Glamourer state of an actor to automation state. </summary>
|
||||
/// <param name="objectIndex"> The game object index of the actor to be manipulated. </param>
|
||||
/// <param name="key"> A key to unlock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once and Lock (see <see cref="ApplyFlag"/>.) </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, Success, NothingDone. </returns>
|
||||
public GlamourerApiEc RevertToAutomation(int objectIndex, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Revert the Glamourer state of players to automation state. </summary>
|
||||
/// <param name="playerName"> The name of the players to be reverted. </param>
|
||||
/// <param name="key"> A key to unlock the state if necessary. </param>
|
||||
/// <param name="flags"> The flags used for the reversion. Respects Once and Lock (see <see cref="ApplyFlag"/>.) </param>
|
||||
/// <returns> ActorNotFound, InvalidKey, Success, NothingDone. </returns>
|
||||
/// /// <remarks>
|
||||
/// The player does not have to be currently available as long as he has a persisted Glamourer state.<br/>
|
||||
/// Only players are checked for name equality, no NPCs.<br/>
|
||||
/// If multiple players of the same name are found, all of them are reverted.<br/>
|
||||
/// Prefer to use the index-based function unless you need to get the state of someone currently unavailable.
|
||||
/// </remarks>
|
||||
public GlamourerApiEc RevertToAutomationName(string playerName, uint key, ApplyFlag flags);
|
||||
|
||||
/// <summary> Invoked with the game object pointer (if available) whenever an actors tracked state changes. </summary>
|
||||
public event Action<nint> StateChanged;
|
||||
|
||||
/// <summary> Invoked with the game object pointer (if available) whenever an actors tracked state changes, with the type of change. </summary>
|
||||
public event Action<nint, StateChangeType> StateChangedWithType;
|
||||
|
||||
/// <summary> Invoked with the game object pointer (if available) whenever an actors tracked state finalizes a grouped change consisting of multiple smaller changes. </summary>
|
||||
public event Action<nint, StateFinalizationType> StateFinalized;
|
||||
|
||||
/// <summary> Invoked when the player enters or leaves GPose (true => entered GPose, false => left GPose). </summary>
|
||||
public event Action<bool>? GPoseChanged;
|
||||
}
|
11
Glamourer.Api/Enums/ApiBonusSlot.cs
Normal file
11
Glamourer.Api/Enums/ApiBonusSlot.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> Bonus item slots restricted to API-relevant slots. </summary>
|
||||
public enum ApiBonusSlot : byte
|
||||
{
|
||||
/// <summary> No slot. </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary> The Glasses slot. </summary>
|
||||
Glasses = 1,
|
||||
}
|
45
Glamourer.Api/Enums/ApiEquipSlot.cs
Normal file
45
Glamourer.Api/Enums/ApiEquipSlot.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> Equip slots restricted to API-relevant slots, but compatible with GameData.EquipSlots. </summary>
|
||||
public enum ApiEquipSlot : byte
|
||||
{
|
||||
/// <summary> No slot. </summary>
|
||||
Unknown = 0,
|
||||
|
||||
/// <summary> Mainhand, also used for both-handed weapons. </summary>
|
||||
MainHand = 1,
|
||||
|
||||
/// <summary> Offhand, used for shields or if you want to apply the offhand component of certain weapons. </summary>
|
||||
OffHand = 2,
|
||||
|
||||
/// <summary> Head. </summary>
|
||||
Head = 3,
|
||||
|
||||
/// <summary> Body. </summary>
|
||||
Body = 4,
|
||||
|
||||
/// <summary> Hands. </summary>
|
||||
Hands = 5,
|
||||
|
||||
/// <summary> Legs. </summary>
|
||||
Legs = 7,
|
||||
|
||||
/// <summary> Feet. </summary>
|
||||
Feet = 8,
|
||||
|
||||
/// <summary> Ears. </summary>
|
||||
Ears = 9,
|
||||
|
||||
/// <summary> Neck. </summary>
|
||||
Neck = 10,
|
||||
|
||||
/// <summary> Wrists. </summary>
|
||||
Wrists = 11,
|
||||
|
||||
/// <summary> Right Finger. </summary>
|
||||
RFinger = 12,
|
||||
|
||||
/// <summary> Left Finger. </summary>
|
||||
/// <remarks> Not officially existing, means "weapon could be equipped in either hand" for the game. </remarks>
|
||||
LFinger = 14,
|
||||
}
|
31
Glamourer.Api/Enums/ApplyFlag.cs
Normal file
31
Glamourer.Api/Enums/ApplyFlag.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> Application flags that can be used in different situations. </summary>
|
||||
[Flags]
|
||||
public enum ApplyFlag : ulong
|
||||
{
|
||||
/// <summary> Apply the selected manipulation only once, without forcing the state into automation. </summary>
|
||||
Once = 0x01,
|
||||
|
||||
/// <summary> Apply the selected manipulation on the equipment (might be more or less supported). </summary>
|
||||
Equipment = 0x02,
|
||||
|
||||
/// <summary> Apply the selected manipulation on the customizations (might be more or less supported). </summary>
|
||||
Customization = 0x04,
|
||||
|
||||
/// <summary> Lock the state with the given key after applying the selected manipulation </summary>
|
||||
Lock = 0x08,
|
||||
}
|
||||
|
||||
/// <summary> Extensions for apply flags. </summary>
|
||||
public static class ApplyFlagEx
|
||||
{
|
||||
/// <summary> The default application flags for design-based manipulations. </summary>
|
||||
public const ApplyFlag DesignDefault = ApplyFlag.Once | ApplyFlag.Equipment | ApplyFlag.Customization;
|
||||
|
||||
/// <summary> The default application flags for state-based manipulations. </summary>
|
||||
public const ApplyFlag StateDefault = ApplyFlag.Equipment | ApplyFlag.Customization | ApplyFlag.Lock;
|
||||
|
||||
/// <summary> The default application flags for reverse manipulations. </summary>
|
||||
public const ApplyFlag RevertDefault = ApplyFlag.Equipment | ApplyFlag.Customization;
|
||||
}
|
29
Glamourer.Api/Enums/GlamourerApiEc.cs
Normal file
29
Glamourer.Api/Enums/GlamourerApiEc.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> Return codes for API functions. </summary>
|
||||
public enum GlamourerApiEc
|
||||
{
|
||||
/// <summary> The function succeeded. </summary>
|
||||
Success = 0,
|
||||
|
||||
/// <summary> The function did not encounter a problem, but also did not do anything. </summary>
|
||||
NothingDone = 1,
|
||||
|
||||
/// <summary> The requested actor was not found. </summary>
|
||||
ActorNotFound = 2,
|
||||
|
||||
/// <summary> The requested actor was not human, but should have been. </summary>
|
||||
ActorNotHuman,
|
||||
|
||||
/// <summary> The requested design was not found. </summary>
|
||||
DesignNotFound,
|
||||
|
||||
/// <summary> The requested item was not found or could not be applied to the requested slot. </summary>
|
||||
ItemInvalid,
|
||||
|
||||
/// <summary> The state of an actor could not be manipulated because it was locked and the provided key could not unlock it. </summary>
|
||||
InvalidKey,
|
||||
|
||||
/// <summary> The provided object could not be converted into a valid Glamourer state to apply. </summary>
|
||||
InvalidState,
|
||||
}
|
11
Glamourer.Api/Enums/SetMetaFlag.cs
Normal file
11
Glamourer.Api/Enums/SetMetaFlag.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> Application flags for setting the meta state of an actor. </summary>
|
||||
[Flags]
|
||||
public enum MetaFlag : ulong
|
||||
{
|
||||
Wetness = 0x01,
|
||||
HatState = 0x02,
|
||||
VisorState = 0x04,
|
||||
WeaponState = 0x08,
|
||||
}
|
47
Glamourer.Api/Enums/StateChangeType.cs
Normal file
47
Glamourer.Api/Enums/StateChangeType.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> What type of information changed in a state. </summary>
|
||||
public enum StateChangeType
|
||||
{
|
||||
/// <summary> A characters saved state had the model id changed. This means everything may have changed. </summary>
|
||||
Model = 0,
|
||||
|
||||
/// <summary> A characters saved state had multiple customization values changed. </summary>
|
||||
EntireCustomize = 1,
|
||||
|
||||
/// <summary> A characters saved state had a customization value changed. </summary>
|
||||
Customize = 2,
|
||||
|
||||
/// <summary> A characters saved state had an equipment piece changed. </summary>
|
||||
Equip = 3,
|
||||
|
||||
/// <summary> A characters saved state had its weapons changed. </summary>
|
||||
Weapon = 4,
|
||||
|
||||
/// <summary> A characters saved state had a stain changed. </summary>
|
||||
Stains = 5,
|
||||
|
||||
/// <summary> A characters saved state had a crest visibility changed. </summary>
|
||||
Crest = 6,
|
||||
|
||||
/// <summary> A characters saved state had its customize parameter changed. </summary>
|
||||
Parameter = 7,
|
||||
|
||||
/// <summary> A characters saved state had a material color table value changed. </summary>
|
||||
MaterialValue = 8,
|
||||
|
||||
/// <summary> A characters saved state had a design applied. This means everything may have changed. </summary>
|
||||
Design = 9,
|
||||
|
||||
/// <summary> A characters saved state had its state reset to its game values. </summary>
|
||||
Reset = 10,
|
||||
|
||||
/// <summary> A characters saved state had a meta toggle changed. </summary>
|
||||
Other = 11,
|
||||
|
||||
/// <summary> A characters state was reapplied. Data is null. </summary>
|
||||
Reapply = 12,
|
||||
|
||||
/// <summary> A characters saved state had a bonus item changed. </summary>
|
||||
BonusItem = 13,
|
||||
}
|
36
Glamourer.Api/Enums/StateFinalizationType.cs
Normal file
36
Glamourer.Api/Enums/StateFinalizationType.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace Glamourer.Api.Enums;
|
||||
|
||||
/// <summary> What type of Glamourer process was performed on the actors state to update it. </summary>
|
||||
public enum StateFinalizationType
|
||||
{
|
||||
/// <summary> A characters saved state had the model id altered. </summary>
|
||||
ModelChange = 0,
|
||||
|
||||
/// <summary> A singular Design was applied to an actors state. </summary>
|
||||
DesignApplied = 1,
|
||||
|
||||
/// <summary> A characters saved state had been reset to game values. </summary>
|
||||
Revert = 2,
|
||||
|
||||
/// <summary> A characters saved state had only its customization data reset to game state. </summary>
|
||||
RevertCustomize = 3,
|
||||
|
||||
/// <summary> A characters saved state had only its equipment data reset to game state. </summary>
|
||||
RevertEquipment = 4,
|
||||
|
||||
/// <summary> A characters saved state had its advanced values reverted to game state. </summary>
|
||||
RevertAdvanced = 5,
|
||||
|
||||
/// <summary> A characters saved state was reverted to automation state on top of their game state </summary>
|
||||
RevertAutomation = 6,
|
||||
|
||||
/// <summary> A characters saved state had a generic reapply as a single operation. </summary>
|
||||
Reapply = 7,
|
||||
|
||||
/// <summary> A characters saved state had their automation state reapplied over their existing state. </summary>
|
||||
ReapplyAutomation = 8,
|
||||
|
||||
/// <summary> A characters save state finished applying all updated slots for game state on gearset change or initial load. </summary>
|
||||
Gearset = 9,
|
||||
}
|
||||
|
34
Glamourer.Api/Glamourer.Api.csproj
Normal file
34
Glamourer.Api/Glamourer.Api.csproj
Normal file
@@ -0,0 +1,34 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/13.0.0">
|
||||
<PropertyGroup>
|
||||
<AssemblyTitle>Glamourer.Api</AssemblyTitle>
|
||||
<Product>Glamourer</Product>
|
||||
<Copyright>Copyright © 2025</Copyright>
|
||||
<FileVersion>2.4.1.0</FileVersion>
|
||||
<AssemblyVersion>2.4.1.0</AssemblyVersion>
|
||||
<PackageVersion>2.4.1</PackageVersion>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<Title>Glamourer.Api</Title>
|
||||
<Authors>Ottermandias</Authors>
|
||||
<RepositoryUrl>https://github.com/Ottermandias/Glamourer</RepositoryUrl>
|
||||
<Description>Auxiliary functions for Glamourers external API.</Description>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Use_DalamudPackager>false</Use_DalamudPackager>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
2
Glamourer.Api/Glamourer.Api.csproj.DotSettings
Normal file
2
Glamourer.Api/Glamourer.Api.csproj.DotSettings
Normal file
@@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ipc/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
4
Glamourer.Api/GlobalUsings.cs
Normal file
4
Glamourer.Api/GlobalUsings.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
// Global using directives
|
||||
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
114
Glamourer.Api/Helpers/ActionSubscriber.cs
Normal file
114
Glamourer.Api/Helpers/ActionSubscriber.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Specialized subscriber only allowing to invoke actions.
|
||||
/// </summary>
|
||||
public class ActionSubscriber
|
||||
{
|
||||
private readonly ICallGateSubscriber<object?>? _subscriber;
|
||||
|
||||
/// <summary> Whether the subscriber could successfully be created. </summary>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
protected ActionSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<object?>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Invoke the action. See the source of the subscriber for details.</summary>
|
||||
protected void Invoke()
|
||||
=> _subscriber?.InvokeAction();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber"/>
|
||||
public class ActionSubscriber<T1>
|
||||
{
|
||||
private readonly ICallGateSubscriber<T1, object?>? _subscriber;
|
||||
|
||||
/// <summary> Whether the subscriber could successfully be created. </summary>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
protected ActionSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, object?>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Invoke the action. See the source of the subscriber for details.</summary>
|
||||
protected void Invoke(T1 a)
|
||||
=> _subscriber?.InvokeAction(a);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber"/>
|
||||
public class ActionSubscriber<T1, T2>
|
||||
{
|
||||
private readonly ICallGateSubscriber<T1, T2, object?>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber{T1}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
protected ActionSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, object?>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber.Invoke"/>
|
||||
protected void Invoke(T1 a, T2 b)
|
||||
=> _subscriber?.InvokeAction(a, b);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber"/>
|
||||
public class ActionSubscriber<T1, T2, T3>
|
||||
{
|
||||
private readonly ICallGateSubscriber<T1, T2, T3, object?>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber{T1}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
protected ActionSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, T3, object?>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ActionSubscriber.Invoke"/>
|
||||
protected void Invoke(T1 a, T2 b, T3 c)
|
||||
=> _subscriber?.InvokeAction(a, b, c);
|
||||
}
|
234
Glamourer.Api/Helpers/EventProvider.cs
Normal file
234
Glamourer.Api/Helpers/EventProvider.cs
Normal file
@@ -0,0 +1,234 @@
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Specialized disposable Provider for Events.<para />
|
||||
/// Will execute the unsubscriber action on dispose if any is provided.<para />
|
||||
/// Can only be invoked and disposed.
|
||||
/// </summary>
|
||||
public sealed class EventProvider : IDisposable
|
||||
{
|
||||
private readonly IPluginLog _log;
|
||||
private ICallGateProvider<object?>? _provider;
|
||||
private Delegate? _unsubscriber;
|
||||
|
||||
public EventProvider(IDalamudPluginInterface pi, string label, (Action<Action> Add, Action<Action> Del)? subscribe = null)
|
||||
{
|
||||
_unsubscriber = null;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<object?>(label);
|
||||
subscribe?.Add(Invoke);
|
||||
_unsubscriber = subscribe?.Del;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
}
|
||||
|
||||
public EventProvider(IDalamudPluginInterface pi, string label, Action<EventProvider> add, Action<EventProvider> del)
|
||||
{
|
||||
_unsubscriber = null;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<object?>(label);
|
||||
add(this);
|
||||
_unsubscriber = del;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Invoke the event.</summary>
|
||||
public void Invoke()
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider?.SendMessage();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception thrown on IPC event:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
switch (_unsubscriber)
|
||||
{
|
||||
case Action<Action> a:
|
||||
a(Invoke);
|
||||
break;
|
||||
case Action<EventProvider> b:
|
||||
b(this);
|
||||
break;
|
||||
}
|
||||
|
||||
_unsubscriber = null;
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~EventProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="EventProvider"/>
|
||||
public sealed class EventProvider<T1> : IDisposable
|
||||
{
|
||||
private readonly IPluginLog _log;
|
||||
private ICallGateProvider<T1, object?>? _provider;
|
||||
private Delegate? _unsubscriber;
|
||||
|
||||
public EventProvider(IDalamudPluginInterface pi, string label, (Action<Action<T1>> Add, Action<Action<T1>> Del)? subscribe = null)
|
||||
{
|
||||
_unsubscriber = null;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, object?>(label);
|
||||
subscribe?.Add(Invoke);
|
||||
_unsubscriber = subscribe?.Del;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
}
|
||||
|
||||
public EventProvider(IDalamudPluginInterface pi, string label, Action<EventProvider<T1>> add, Action<EventProvider<T1>> del)
|
||||
{
|
||||
_unsubscriber = null;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, object?>(label);
|
||||
add(this);
|
||||
_unsubscriber = del;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="EventProvider.Invoke"/>
|
||||
public void Invoke(T1 a)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider?.SendMessage(a);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception thrown on IPC event:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
switch (_unsubscriber)
|
||||
{
|
||||
case Action<Action<T1>> a:
|
||||
a(Invoke);
|
||||
break;
|
||||
case Action<EventProvider<T1>> b:
|
||||
b(this);
|
||||
break;
|
||||
}
|
||||
|
||||
_unsubscriber = null;
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~EventProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="EventProvider"/>
|
||||
public sealed class EventProvider<T1, T2> : IDisposable
|
||||
{
|
||||
private readonly IPluginLog _log;
|
||||
private ICallGateProvider<T1, T2, object?>? _provider;
|
||||
private Delegate? _unsubscriber;
|
||||
|
||||
public EventProvider(IDalamudPluginInterface pi, string label, (Action<Action<T1, T2>> Add, Action<Action<T1, T2>> Del)? subscribe = null)
|
||||
{
|
||||
_unsubscriber = null;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, object?>(label);
|
||||
subscribe?.Add(Invoke);
|
||||
_unsubscriber = subscribe?.Del;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
}
|
||||
|
||||
public EventProvider(IDalamudPluginInterface pi, string label, Action<EventProvider<T1, T2>> add, Action<EventProvider<T1, T2>> del)
|
||||
{
|
||||
_unsubscriber = null;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, object?>(label);
|
||||
add(this);
|
||||
_unsubscriber = del;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="EventProvider.Invoke"/>
|
||||
public void Invoke(T1 a, T2 b)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider?.SendMessage(a, b);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception thrown on IPC event:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
switch (_unsubscriber)
|
||||
{
|
||||
case Action<Action<T1, T2>> a:
|
||||
a(Invoke);
|
||||
break;
|
||||
case Action<EventProvider<T1, T2>> b:
|
||||
b(this);
|
||||
break;
|
||||
}
|
||||
|
||||
_unsubscriber = null;
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~EventProvider()
|
||||
=> Dispose();
|
||||
}
|
394
Glamourer.Api/Helpers/EventSubscriber.cs
Normal file
394
Glamourer.Api/Helpers/EventSubscriber.cs
Normal file
@@ -0,0 +1,394 @@
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Specialized disposable Subscriber for Events.<para />
|
||||
/// Subscriptions are wrapped to be individually exception-safe.<para/>
|
||||
/// Can be enabled and disabled.<para/>
|
||||
/// </summary>
|
||||
public sealed class EventSubscriber : IDisposable
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly IPluginLog _log;
|
||||
private readonly Dictionary<Action, Action> _delegates = new();
|
||||
private ICallGateSubscriber<object?>? _subscriber;
|
||||
private bool _disabled;
|
||||
|
||||
public EventSubscriber(IDalamudPluginInterface pi, string label, params Action[] actions)
|
||||
{
|
||||
_label = label;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<object?>(label);
|
||||
foreach (var action in actions)
|
||||
Event += action;
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable all currently subscribed actions registered with this EventSubscriber.
|
||||
/// Does nothing if it is already enabled.
|
||||
/// </summary>
|
||||
public void Enable()
|
||||
{
|
||||
if (_disabled && _subscriber != null)
|
||||
{
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Subscribe(action);
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable all subscribed actions registered with this EventSubscriber.
|
||||
/// Does nothing if it is already disabled.
|
||||
/// Does not forget the actions, only disables them.
|
||||
/// </summary>
|
||||
public void Disable()
|
||||
{
|
||||
if (!_disabled)
|
||||
{
|
||||
if (_subscriber != null)
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Unsubscribe(action);
|
||||
|
||||
_disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add or remove an action to the IPC event, if it is valid.
|
||||
/// </summary>
|
||||
public event Action Event
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_subscriber != null && !_delegates.ContainsKey(value))
|
||||
{
|
||||
void Action()
|
||||
{
|
||||
try
|
||||
{
|
||||
value();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception invoking IPC event {_label}:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
if (_delegates.TryAdd(value, Action) && !_disabled)
|
||||
_subscriber.Subscribe(Action);
|
||||
}
|
||||
}
|
||||
remove
|
||||
{
|
||||
if (_subscriber != null && _delegates.Remove(value, out var action))
|
||||
_subscriber.Unsubscribe(action);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Disable();
|
||||
_subscriber = null;
|
||||
_delegates.Clear();
|
||||
}
|
||||
|
||||
~EventSubscriber()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber"/> </summary>
|
||||
public sealed class EventSubscriber<T1> : IDisposable
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly IPluginLog _log;
|
||||
private readonly Dictionary<Action<T1>, Action<T1>> _delegates = new();
|
||||
private ICallGateSubscriber<T1, object?>? _subscriber;
|
||||
private bool _disabled;
|
||||
|
||||
public EventSubscriber(IDalamudPluginInterface pi, string label, params Action<T1>[] actions)
|
||||
{
|
||||
_label = label;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, object?>(label);
|
||||
foreach (var action in actions)
|
||||
Event += action;
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Enable"/> </summary>
|
||||
public void Enable()
|
||||
{
|
||||
if (_disabled && _subscriber != null)
|
||||
{
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Subscribe(action);
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Disable"/> </summary>
|
||||
public void Disable()
|
||||
{
|
||||
if (!_disabled)
|
||||
{
|
||||
if (_subscriber != null)
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Unsubscribe(action);
|
||||
|
||||
_disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Event"/> </summary>
|
||||
public event Action<T1> Event
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_subscriber != null && !_delegates.ContainsKey(value))
|
||||
{
|
||||
void Action(T1 a)
|
||||
{
|
||||
try
|
||||
{
|
||||
value(a);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception invoking IPC event {_label}:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
if (_delegates.TryAdd(value, Action) && !_disabled)
|
||||
_subscriber.Subscribe(Action);
|
||||
}
|
||||
}
|
||||
remove
|
||||
{
|
||||
if (_subscriber != null && _delegates.Remove(value, out var action))
|
||||
_subscriber.Unsubscribe(action);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Disable();
|
||||
_subscriber = null;
|
||||
_delegates.Clear();
|
||||
}
|
||||
|
||||
~EventSubscriber()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber"/> </summary>
|
||||
public sealed class EventSubscriber<T1, T2> : IDisposable
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly IPluginLog _log;
|
||||
private readonly Dictionary<Action<T1, T2>, Action<T1, T2>> _delegates = new();
|
||||
private ICallGateSubscriber<T1, T2, object?>? _subscriber;
|
||||
private bool _disabled;
|
||||
|
||||
public EventSubscriber(IDalamudPluginInterface pi, string label, params Action<T1, T2>[] actions)
|
||||
{
|
||||
_label = label;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, object?>(label);
|
||||
foreach (var action in actions)
|
||||
Event += action;
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Enable"/> </summary>
|
||||
public void Enable()
|
||||
{
|
||||
if (_disabled && _subscriber != null)
|
||||
{
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Subscribe(action);
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Disable"/> </summary>
|
||||
public void Disable()
|
||||
{
|
||||
if (!_disabled)
|
||||
{
|
||||
if (_subscriber != null)
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Unsubscribe(action);
|
||||
|
||||
_disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Event"/> </summary>
|
||||
public event Action<T1, T2> Event
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_subscriber != null && !_delegates.ContainsKey(value))
|
||||
{
|
||||
void Action(T1 a, T2 b)
|
||||
{
|
||||
try
|
||||
{
|
||||
value(a, b);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception invoking IPC event {_label}:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
if (_delegates.TryAdd(value, Action) && !_disabled)
|
||||
_subscriber.Subscribe(Action);
|
||||
}
|
||||
}
|
||||
remove
|
||||
{
|
||||
if (_subscriber != null && _delegates.Remove(value, out var action))
|
||||
_subscriber.Unsubscribe(action);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Disable();
|
||||
_subscriber = null;
|
||||
_delegates.Clear();
|
||||
}
|
||||
|
||||
~EventSubscriber()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber"/> </summary>
|
||||
public sealed class EventSubscriber<T1, T2, T3> : IDisposable
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly IPluginLog _log;
|
||||
private readonly Dictionary<Action<T1, T2, T3>, Action<T1, T2, T3>> _delegates = new();
|
||||
private ICallGateSubscriber<T1, T2, T3, object?>? _subscriber;
|
||||
private bool _disabled;
|
||||
|
||||
public EventSubscriber(IDalamudPluginInterface pi, string label, params Action<T1, T2, T3>[] actions)
|
||||
{
|
||||
_label = label;
|
||||
_log = PluginLogHelper.GetLog(pi);
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, T3, object?>(label);
|
||||
foreach (var action in actions)
|
||||
Event += action;
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Enable"/> </summary>
|
||||
public void Enable()
|
||||
{
|
||||
if (_disabled && _subscriber != null)
|
||||
{
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Subscribe(action);
|
||||
|
||||
_disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Disable"/> </summary>
|
||||
public void Disable()
|
||||
{
|
||||
if (!_disabled)
|
||||
{
|
||||
if (_subscriber != null)
|
||||
foreach (var action in _delegates.Values)
|
||||
_subscriber.Unsubscribe(action);
|
||||
|
||||
_disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary><inheritdoc cref="EventSubscriber.Event"/> </summary>
|
||||
public event Action<T1, T2, T3> Event
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_subscriber != null && !_delegates.ContainsKey(value))
|
||||
{
|
||||
void Action(T1 a, T2 b, T3 c)
|
||||
{
|
||||
try
|
||||
{
|
||||
value(a, b, c);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.Error($"Exception invoking IPC event {_label}:\n{e}");
|
||||
}
|
||||
}
|
||||
|
||||
if (_delegates.TryAdd(value, Action) && !_disabled)
|
||||
_subscriber.Subscribe(Action);
|
||||
}
|
||||
}
|
||||
remove
|
||||
{
|
||||
if (_subscriber != null && _delegates.Remove(value, out var action))
|
||||
_subscriber.Unsubscribe(action);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Disable();
|
||||
_subscriber = null;
|
||||
_delegates.Clear();
|
||||
}
|
||||
|
||||
~EventSubscriber()
|
||||
=> Dispose();
|
||||
}
|
224
Glamourer.Api/Helpers/FuncProvider.cs
Normal file
224
Glamourer.Api/Helpers/FuncProvider.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Specialized disposable Provider for Funcs.
|
||||
/// </summary>
|
||||
public sealed class FuncProvider<TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncProvider{TRet}"/>
|
||||
public sealed class FuncProvider<T1, TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<T1, TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<T1, TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncProvider{TRet}"/>
|
||||
public sealed class FuncProvider<T1, T2, TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<T1, T2, TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<T1, T2, TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncProvider{TRet}"/>
|
||||
public sealed class FuncProvider<T1, T2, T3, TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<T1, T2, T3, TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<T1, T2, T3, TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, T3, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncProvider{TRet}"/>
|
||||
public sealed class FuncProvider<T1, T2, T3, T4, TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<T1, T2, T3, T4, TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<T1, T2, T3, T4, TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, T3, T4, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncProvider{TRet}"/>
|
||||
public sealed class FuncProvider<T1, T2, T3, T4, T5, TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<T1, T2, T3, T4, T5, TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<T1, T2, T3, T4, T5, TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, T3, T4, T5, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc cref="FuncProvider{TRet}"/>
|
||||
public sealed class FuncProvider<T1, T2, T3, T4, T5, T6, TRet> : IDisposable
|
||||
{
|
||||
private ICallGateProvider<T1, T2, T3, T4, T5, T6, TRet>? _provider;
|
||||
|
||||
public FuncProvider(IDalamudPluginInterface pi, string label, Func<T1, T2, T3, T4, T5, T6, TRet> func)
|
||||
{
|
||||
try
|
||||
{
|
||||
_provider = pi.GetIpcProvider<T1, T2, T3, T4, T5, T6, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Provider for {label}\n{e}");
|
||||
_provider = null;
|
||||
}
|
||||
|
||||
_provider?.RegisterFunc(func);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_provider?.UnregisterFunc();
|
||||
_provider = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~FuncProvider()
|
||||
=> Dispose();
|
||||
}
|
217
Glamourer.Api/Helpers/FuncSubscriber.cs
Normal file
217
Glamourer.Api/Helpers/FuncSubscriber.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Specialized subscriber only allowing to invoke functions with a return.
|
||||
/// </summary>
|
||||
public class FuncSubscriber<TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<TRet>? _subscriber;
|
||||
|
||||
/// <summary> Whether the subscriber could successfully be created. </summary>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Invoke the function. See the source of the subscriber for details.</summary>
|
||||
protected TRet Invoke()
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc() : throw new IpcNotReadyError(_label);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
public class FuncSubscriber<T1, TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<T1, TRet>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Invoke"/>
|
||||
protected TRet Invoke(T1 a)
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc(a) : throw new IpcNotReadyError(_label);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
public class FuncSubscriber<T1, T2, TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<T1, T2, TRet>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Invoke"/>
|
||||
protected TRet Invoke(T1 a, T2 b)
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc(a, b) : throw new IpcNotReadyError(_label);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
public class FuncSubscriber<T1, T2, T3, TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<T1, T2, T3, TRet>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, T3, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Invoke"/>
|
||||
protected TRet Invoke(T1 a, T2 b, T3 c)
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc(a, b, c) : throw new IpcNotReadyError(_label);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
public class FuncSubscriber<T1, T2, T3, T4, TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<T1, T2, T3, T4, TRet>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, T3, T4, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Invoke"/>
|
||||
protected TRet Invoke(T1 a, T2 b, T3 c, T4 d)
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc(a, b, c, d) : throw new IpcNotReadyError(_label);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
public class FuncSubscriber<T1, T2, T3, T4, T5, TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<T1, T2, T3, T4, T5, TRet>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, T3, T4, T5, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Invoke"/>
|
||||
protected TRet Invoke(T1 a, T2 b, T3 c, T4 d, T5 e)
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc(a, b, c, d, e) : throw new IpcNotReadyError(_label);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
public class FuncSubscriber<T1, T2, T3, T4, T5, T6, TRet>
|
||||
{
|
||||
private readonly string _label;
|
||||
private readonly ICallGateSubscriber<T1, T2, T3, T4, T5, T6, TRet>? _subscriber;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Valid"/>
|
||||
public bool Valid
|
||||
=> _subscriber != null;
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}"/>
|
||||
protected FuncSubscriber(IDalamudPluginInterface pi, string label)
|
||||
{
|
||||
_label = label;
|
||||
try
|
||||
{
|
||||
_subscriber = pi.GetIpcSubscriber<T1, T2, T3, T4, T5, T6, TRet>(label);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
PluginLogHelper.WriteError(pi, $"Error registering IPC Subscriber for {label}\n{e}");
|
||||
_subscriber = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="FuncSubscriber{TRet}.Invoke"/>
|
||||
protected TRet Invoke(T1 a, T2 b, T3 c, T4 d, T5 e, T6 f)
|
||||
=> _subscriber != null ? _subscriber.InvokeFunc(a, b, c, d, e, f) : throw new IpcNotReadyError(_label);
|
||||
}
|
26
Glamourer.Api/Helpers/PluginLogHelper.cs
Normal file
26
Glamourer.Api/Helpers/PluginLogHelper.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Glamourer.Api.Helpers;
|
||||
|
||||
internal class PluginLogHelper
|
||||
{
|
||||
[PluginService]
|
||||
private static IPluginLog? _log { get; set; }
|
||||
|
||||
private PluginLogHelper(IDalamudPluginInterface pi)
|
||||
=> pi.Inject(this);
|
||||
|
||||
public static void WriteError(IDalamudPluginInterface pi, string errorMessage)
|
||||
=> GetLog(pi).Error(errorMessage);
|
||||
|
||||
public static IPluginLog GetLog(IDalamudPluginInterface pi)
|
||||
{
|
||||
if (_log != null)
|
||||
return _log;
|
||||
|
||||
_ = new PluginLogHelper(pi);
|
||||
return _log!;
|
||||
}
|
||||
}
|
52
Glamourer.Api/IpcSubscribers/Designs.cs
Normal file
52
Glamourer.Api/IpcSubscribers/Designs.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.GetDesignList"/>
|
||||
public sealed class GetDesignList(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<Dictionary<Guid, string>>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetDesignList)}.V2";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.GetDesignList"/>
|
||||
public new Dictionary<Guid, string> Invoke()
|
||||
=> base.Invoke();
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<Dictionary<Guid, string>> Provider(IDalamudPluginInterface pi, IGlamourerApiDesigns api)
|
||||
=> new(pi, Label, api.GetDesignList);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesign"/>
|
||||
public sealed class ApplyDesign(IDalamudPluginInterface pi) : FuncSubscriber<Guid, int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyDesign)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesign"/>
|
||||
public GlamourerApiEc Invoke(Guid designId, int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.DesignDefault)
|
||||
=> (GlamourerApiEc)Invoke(designId, objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<Guid, int, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiDesigns api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyDesign(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesignName"/>
|
||||
public sealed class ApplyDesignName(IDalamudPluginInterface pi) : FuncSubscriber<Guid, string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyDesignName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiDesigns.ApplyDesignName"/>
|
||||
public GlamourerApiEc Invoke(Guid designId, string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.DesignDefault)
|
||||
=> (GlamourerApiEc)Invoke(designId, objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<Guid, string, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiDesigns api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyDesignName(a, b, c, (ApplyFlag)d));
|
||||
}
|
110
Glamourer.Api/IpcSubscribers/Items.cs
Normal file
110
Glamourer.Api/IpcSubscribers/Items.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItem"/>
|
||||
public sealed class SetItem(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, byte, ulong, IReadOnlyList<byte>, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetItem)}.V3";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItem"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, ApiEquipSlot slot, ulong itemId, IReadOnlyList<byte> stain, uint key = 0,
|
||||
ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, (byte)slot, itemId, stain, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, byte, ulong, IReadOnlyList<byte>, uint, ulong, int> Provider(IDalamudPluginInterface pi,
|
||||
IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e, f) => (int)api.SetItem(a, (ApiEquipSlot)b, c, d, e, (ApplyFlag)f));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItemName"/>
|
||||
public sealed class SetItemName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, byte, ulong, IReadOnlyList<byte>, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetItemName)}.V2";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetItem"/>
|
||||
public GlamourerApiEc Invoke(string objectName, ApiEquipSlot slot, ulong itemId, IReadOnlyList<byte> stain, uint key = 0,
|
||||
ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectName, (byte)slot, itemId, stain, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, byte, ulong, IReadOnlyList<byte>, uint, ulong, int> Provider(IDalamudPluginInterface pi,
|
||||
IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e, f) => (int)api.SetItemName(a, (ApiEquipSlot)b, c, d, e, (ApplyFlag)f));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetBonusItem"/>
|
||||
public sealed class SetBonusItem(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, byte, ulong, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetBonusItem)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetBonusItem"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, ApiBonusSlot slot, ulong itemId, uint key = 0, ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, (byte)slot, itemId, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, byte, ulong, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e) => (int)api.SetBonusItem(a, (ApiBonusSlot)b, c, d, (ApplyFlag)e));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetBonusItemName"/>
|
||||
public sealed class SetBonusItemName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, byte, ulong, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetBonusItemName)}.V2";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetBonusItemName"/>
|
||||
public GlamourerApiEc Invoke(string objectName, ApiBonusSlot slot, ulong itemId, uint key = 0, ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectName, (byte)slot, itemId, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, byte, ulong, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e) => (int)api.SetBonusItemName(a, (ApiBonusSlot)b, c, d, (ApplyFlag)e));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetMetaState"/>
|
||||
public sealed class SetMetaState(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, ulong, bool, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetMetaState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetMetaState"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, MetaFlag types, bool newValue, uint key = 0,
|
||||
ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, (ulong)types, newValue, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, ulong, bool, uint, ulong, int> Provider(IDalamudPluginInterface pi,
|
||||
IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e) => (int)api.SetMetaState(a, (MetaFlag)b, c, d, (ApplyFlag)e));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetMetaStateName"/>
|
||||
public sealed class SetMetaStateName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, ulong, bool, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(SetMetaStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiItems.SetMetaStateName"/>
|
||||
public GlamourerApiEc Invoke(string objectName, MetaFlag types, bool newValue, uint key = 0,
|
||||
ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectName, (ulong)types, newValue, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, ulong, bool, uint, ulong, int> Provider(IDalamudPluginInterface pi,
|
||||
IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e) => (int)api.SetMetaStateName(a, (MetaFlag)b, c, d, (ApplyFlag)e));
|
||||
}
|
52
Glamourer.Api/IpcSubscribers/Legacy/Designs.cs
Normal file
52
Glamourer.Api/IpcSubscribers/Legacy/Designs.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers.Legacy;
|
||||
|
||||
public sealed class GetDesignList(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<(string Name, Guid Identifier)[]>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(GetDesignList)}";
|
||||
|
||||
public new (string Name, Guid Identifier)[] Invoke()
|
||||
=> base.Invoke();
|
||||
}
|
||||
|
||||
public sealed class ApplyByGuid(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<Guid, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyByGuid)}";
|
||||
|
||||
public new void Invoke(Guid design, string name)
|
||||
=> base.Invoke(design, name);
|
||||
}
|
||||
|
||||
public sealed class ApplyByGuidOnce(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<Guid, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyByGuidOnce)}";
|
||||
|
||||
public new void Invoke(Guid design, string name)
|
||||
=> base.Invoke(design, name);
|
||||
}
|
||||
|
||||
public sealed class ApplyByGuidToCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<Guid, ICharacter?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyByGuidToCharacter)}";
|
||||
|
||||
public new void Invoke(Guid design, ICharacter? character)
|
||||
=> base.Invoke(design, character);
|
||||
}
|
||||
|
||||
public sealed class ApplyByGuidOnceToCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<Guid, ICharacter?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyByGuidOnceToCharacter)}";
|
||||
|
||||
public new void Invoke(Guid design, ICharacter? character)
|
||||
=> base.Invoke(design, character);
|
||||
}
|
66
Glamourer.Api/IpcSubscribers/Legacy/Items.cs
Normal file
66
Glamourer.Api/IpcSubscribers/Legacy/Items.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers.Legacy;
|
||||
|
||||
public sealed class SetItem(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<ICharacter?, byte, ulong, byte, uint, int>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(SetItem)}";
|
||||
|
||||
public new GlamourerApiEc Invoke(ICharacter? character, byte slot, ulong itemId, byte stainId, uint key)
|
||||
=> (GlamourerApiEc)base.Invoke(character, slot, itemId, stainId, key);
|
||||
}
|
||||
|
||||
public sealed class SetItemOnce(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<ICharacter?, byte, ulong, byte, uint, int>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(SetItemOnce)}";
|
||||
|
||||
public new GlamourerApiEc Invoke(ICharacter? character, byte slot, ulong itemId, byte stainId, uint key)
|
||||
=> (GlamourerApiEc)base.Invoke(character, slot, itemId, stainId, key);
|
||||
}
|
||||
|
||||
public sealed class SetItemByActorName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, byte, ulong, byte, uint, int>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(SetItemByActorName)}";
|
||||
|
||||
public new GlamourerApiEc Invoke(string actorName, byte slot, ulong itemId, byte stainId, uint key)
|
||||
=> (GlamourerApiEc)base.Invoke(actorName, slot, itemId, stainId, key);
|
||||
}
|
||||
|
||||
public sealed class SetItemOnceByActorName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, byte, ulong, byte, uint, int>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(SetItemOnceByActorName)}";
|
||||
|
||||
public new GlamourerApiEc Invoke(string actorName, byte slot, ulong itemId, byte stainId, uint key)
|
||||
=> (GlamourerApiEc)base.Invoke(actorName, slot, itemId, stainId, key);
|
||||
}
|
||||
|
||||
public sealed class SetItemV2(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, byte, ulong, byte, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(SetItem)}.V2";
|
||||
|
||||
public GlamourerApiEc Invoke(int objectIndex, ApiEquipSlot slot, ulong itemId, byte stain, uint key = 0, ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, (byte)slot, itemId, stain, key, (ulong)flags);
|
||||
}
|
||||
|
||||
public sealed class SetItemName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, byte, ulong, byte, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(SetItemName)}";
|
||||
|
||||
public GlamourerApiEc Invoke(string objectName, ApiEquipSlot slot, ulong itemId, byte stain, uint key = 0, ApplyFlag flags = ApplyFlag.Once)
|
||||
=> (GlamourerApiEc)Invoke(objectName, (byte)slot, itemId, stain, key, (ulong)flags);
|
||||
|
||||
public static FuncProvider<string, byte, ulong, byte, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiItems api)
|
||||
=> new(pi, Label, (a, b, c, d, e, f) => (int)api.SetItemName(a, (ApiEquipSlot)b, c, [d], e, (ApplyFlag)f));
|
||||
}
|
15
Glamourer.Api/IpcSubscribers/Legacy/PluginState.cs
Normal file
15
Glamourer.Api/IpcSubscribers/Legacy/PluginState.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers.Legacy;
|
||||
|
||||
public sealed class ApiVersions(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<(int, int)>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApiVersions)}";
|
||||
|
||||
public new (int Major, int Minor) Invoke()
|
||||
=> base.Invoke();
|
||||
}
|
250
Glamourer.Api/IpcSubscribers/Legacy/State.cs
Normal file
250
Glamourer.Api/IpcSubscribers/Legacy/State.cs
Normal file
@@ -0,0 +1,250 @@
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers.Legacy;
|
||||
|
||||
public sealed class Revert(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(Revert)}";
|
||||
|
||||
public new void Invoke(string characterName)
|
||||
=> base.Invoke(characterName);
|
||||
}
|
||||
|
||||
public sealed class RevertCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(RevertCharacter)}";
|
||||
|
||||
public new void Invoke(ICharacter? character)
|
||||
=> base.Invoke(character);
|
||||
}
|
||||
|
||||
public sealed class RevertLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(RevertLock)}";
|
||||
|
||||
public new void Invoke(string characterName, uint key)
|
||||
=> base.Invoke(characterName, key);
|
||||
}
|
||||
|
||||
public sealed class RevertCharacterLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(RevertCharacterLock)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, uint key)
|
||||
=> base.Invoke(character, key);
|
||||
}
|
||||
|
||||
public sealed class RevertToAutomation(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, bool>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(RevertToAutomation)}";
|
||||
|
||||
public new bool Invoke(string characterName, uint key)
|
||||
=> base.Invoke(characterName, key);
|
||||
}
|
||||
|
||||
public sealed class RevertToAutomationCharacter(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<ICharacter?, uint, bool>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(RevertToAutomationCharacter)}";
|
||||
|
||||
public new bool Invoke(ICharacter? character, uint key)
|
||||
=> base.Invoke(character, key);
|
||||
}
|
||||
|
||||
public sealed class Unlock(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<ICharacter?, uint, bool>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(Unlock)}";
|
||||
|
||||
public new bool Invoke(ICharacter? character, uint key)
|
||||
=> base.Invoke(character, key);
|
||||
}
|
||||
|
||||
public sealed class UnlockName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, bool>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(UnlockName)}";
|
||||
|
||||
public new bool Invoke(string characterName, uint key)
|
||||
=> base.Invoke(characterName, key);
|
||||
}
|
||||
|
||||
public static class StateChanged
|
||||
{
|
||||
public const string Label = $"Penumbra.{nameof(StateChanged)}";
|
||||
|
||||
public static EventSubscriber<int, nint, Lazy<string>> Subscriber(IDalamudPluginInterface pi,
|
||||
params Action<int, nint, Lazy<string>>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
}
|
||||
|
||||
public sealed class GetAllCustomization(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, string?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(GetAllCustomization)}";
|
||||
|
||||
public new string? Invoke(string characterName)
|
||||
=> base.Invoke(characterName);
|
||||
}
|
||||
|
||||
public sealed class GetAllCustomizationFromCharacter(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<ICharacter?, string?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(GetAllCustomizationFromCharacter)}";
|
||||
|
||||
public new string? Invoke(ICharacter? character)
|
||||
=> base.Invoke(character);
|
||||
}
|
||||
|
||||
public sealed class GetAllCustomizationLocked(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, string?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(GetAllCustomizationLocked)}";
|
||||
|
||||
public new string? Invoke(string characterName, uint key)
|
||||
=> base.Invoke(characterName, key);
|
||||
}
|
||||
|
||||
public sealed class GetAllCustomizationFromLockedCharacter(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<ICharacter?, uint, string?>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(GetAllCustomizationFromLockedCharacter)}";
|
||||
|
||||
public new string? Invoke(ICharacter? character, uint key)
|
||||
=> base.Invoke(character, key);
|
||||
}
|
||||
|
||||
public sealed class ApplyAll(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyAll)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64)
|
||||
=> base.Invoke(characterName, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyAllOnce(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyAllOnce)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64)
|
||||
=> base.Invoke(characterName, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyAllToCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyAllToCharacter)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64)
|
||||
=> base.Invoke(character, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyAllOnceToCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyAllOnceToCharacter)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64)
|
||||
=> base.Invoke(character, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyEquipment(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyEquipment)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64)
|
||||
=> base.Invoke(characterName, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyEquipmentToCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyEquipmentToCharacter)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64)
|
||||
=> base.Invoke(character, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyCustomization(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyCustomization)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64)
|
||||
=> base.Invoke(characterName, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyCustomizationToCharacter(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyCustomizationToCharacter)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64)
|
||||
=> base.Invoke(character, stateBase64);
|
||||
}
|
||||
|
||||
public sealed class ApplyAllLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyAllLock)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64, uint key)
|
||||
=> base.Invoke(characterName, stateBase64, key);
|
||||
}
|
||||
|
||||
public sealed class ApplyAllToCharacterLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyAllToCharacterLock)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64, uint key)
|
||||
=> base.Invoke(character, stateBase64, key);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyEquipmentLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyEquipmentLock)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64, uint key)
|
||||
=> base.Invoke(characterName, stateBase64, key);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyEquipmentToCharacterLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyEquipmentToCharacterLock)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64, uint key)
|
||||
=> base.Invoke(character, stateBase64, key);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyCustomizationLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<string, string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyCustomizationLock)}";
|
||||
|
||||
public new void Invoke(string characterName, string stateBase64, uint key)
|
||||
=> base.Invoke(characterName, stateBase64, key);
|
||||
}
|
||||
|
||||
public sealed class ApplyOnlyCustomizationToCharacterLock(IDalamudPluginInterface pi)
|
||||
: ActionSubscriber<ICharacter?, string, uint>(pi, Label)
|
||||
{
|
||||
public const string Label = $"Glamourer.{nameof(ApplyOnlyCustomizationToCharacterLock)}";
|
||||
|
||||
public new void Invoke(ICharacter? character, string stateBase64, uint key)
|
||||
=> base.Invoke(character, stateBase64, key);
|
||||
}
|
51
Glamourer.Api/IpcSubscribers/PluginState.cs
Normal file
51
Glamourer.Api/IpcSubscribers/PluginState.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Helpers;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiBase.ApiVersion"/>
|
||||
public sealed class ApiVersion(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<(int, int)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApiVersion)}.V2";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiBase.ApiVersion"/>
|
||||
public new (int Major, int Minor) Invoke()
|
||||
=> base.Invoke();
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<(int, int)> Provider(IDalamudPluginInterface pi, IGlamourerApiBase api)
|
||||
=> new(pi, Label, () => api.ApiVersion);
|
||||
}
|
||||
|
||||
/// <summary> Triggered when the Glamourer API is initialized and ready. </summary>
|
||||
public static class Initialized
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(Initialized)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber Subscriber(IDalamudPluginInterface pi, params Action[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider Provider(IDalamudPluginInterface pi)
|
||||
=> new(pi, Label);
|
||||
}
|
||||
|
||||
/// <summary> Triggered when the Glamourer API is fully disposed and unavailable. </summary>
|
||||
public static class Disposed
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(Disposed)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber Subscriber(IDalamudPluginInterface pi, params Action[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider Provider(IDalamudPluginInterface pi)
|
||||
=> new(pi, Label);
|
||||
}
|
311
Glamourer.Api/IpcSubscribers/State.cs
Normal file
311
Glamourer.Api/IpcSubscribers/State.cs
Normal file
@@ -0,0 +1,311 @@
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Api;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Glamourer.Api.IpcSubscribers;
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetState"/>
|
||||
public sealed class GetState(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, (int, JObject?)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetState"/>
|
||||
public new (GlamourerApiEc, JObject?) Invoke(int objectIndex, uint key = 0)
|
||||
{
|
||||
var (ec, data) = base.Invoke(objectIndex, key);
|
||||
return ((GlamourerApiEc)ec, data);
|
||||
}
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, (int, JObject?)> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) =>
|
||||
{
|
||||
var (ec, data) = api.GetState(a, b);
|
||||
return ((int)ec, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateName"/>
|
||||
public sealed class GetStateName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, (int, JObject?)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateName"/>
|
||||
public new (GlamourerApiEc, JObject?) Invoke(string objectName, uint key = 0)
|
||||
{
|
||||
var (ec, data) = base.Invoke(objectName, key);
|
||||
return ((GlamourerApiEc)ec, data);
|
||||
}
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, (int, JObject?)> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (i, k) =>
|
||||
{
|
||||
var (ec, data) = api.GetStateName(i, k);
|
||||
return ((int)ec, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateBase64"/>
|
||||
public sealed class GetStateBase64(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, (int, string?)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetStateBase64)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateBase64"/>
|
||||
public new (GlamourerApiEc, string?) Invoke(int objectIndex, uint key = 0)
|
||||
{
|
||||
var (ec, data) = base.Invoke(objectIndex, key);
|
||||
return ((GlamourerApiEc)ec, data);
|
||||
}
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, (int, string?)> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) =>
|
||||
{
|
||||
var (ec, data) = api.GetStateBase64(a, b);
|
||||
return ((int)ec, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateBase64Name"/>
|
||||
public sealed class GetStateBase64Name(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, (int, string?)>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(GetStateBase64Name)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GetStateBase64Name"/>
|
||||
public new (GlamourerApiEc, string?) Invoke(string objectName, uint key = 0)
|
||||
{
|
||||
var (ec, data) = base.Invoke(objectName, key);
|
||||
return ((GlamourerApiEc)ec, data);
|
||||
}
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, (int, string?)> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (i, k) =>
|
||||
{
|
||||
var (ec, data) = api.GetStateBase64Name(i, k);
|
||||
return ((int)ec, data);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public sealed class ApplyState(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<object, int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(JObject state, int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(state, objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(string base64State, int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(base64State, objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<object, int, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyState(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyStateName"/>
|
||||
public sealed class ApplyStateName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<object, string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(ApplyStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(JObject state, string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(state, objectName, key, (ulong)flags);
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.ApplyState"/>
|
||||
public GlamourerApiEc Invoke(string base64State, string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.StateDefault)
|
||||
=> (GlamourerApiEc)Invoke(base64State, objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<object, string, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c, d) => (int)api.ApplyStateName(a, b, c, (ApplyFlag)d));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertState"/>
|
||||
public sealed class RevertState(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertState"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertState(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertStateName"/>
|
||||
public sealed class RevertStateName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertStateName"/>
|
||||
public GlamourerApiEc Invoke(string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertStateName(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockState"/>
|
||||
public sealed class UnlockState(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(UnlockState)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockState"/>
|
||||
public new GlamourerApiEc Invoke(int objectIndex, uint key = 0)
|
||||
=> (GlamourerApiEc)base.Invoke(objectIndex, key);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) => (int)api.UnlockState(a, b));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockStateName"/>
|
||||
public sealed class UnlockStateName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(UnlockStateName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockStateName"/>
|
||||
public new GlamourerApiEc Invoke(string objectName, uint key = 0)
|
||||
=> (GlamourerApiEc)base.Invoke(objectName, key);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b) => (int)api.UnlockStateName(a, b));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockAll"/>
|
||||
public sealed class UnlockAll(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<uint, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(UnlockAll)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.UnlockAll"/>
|
||||
public new int Invoke(uint key)
|
||||
=> base.Invoke(key);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<uint, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, api.UnlockAll);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomation"/>
|
||||
public sealed class RevertToAutomation(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<int, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertToAutomation)}.V2";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomation"/>
|
||||
public GlamourerApiEc Invoke(int objectIndex, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectIndex, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<int, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertToAutomation(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomationName"/>
|
||||
public sealed class RevertToAutomationName(IDalamudPluginInterface pi)
|
||||
: FuncSubscriber<string, uint, ulong, int>(pi, Label)
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Glamourer.{nameof(RevertToAutomationName)}";
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.RevertToAutomationName"/>
|
||||
public GlamourerApiEc Invoke(string objectName, uint key = 0, ApplyFlag flags = ApplyFlagEx.RevertDefault)
|
||||
=> (GlamourerApiEc)Invoke(objectName, key, (ulong)flags);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static FuncProvider<string, uint, ulong, int> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (a, b, c) => (int)api.RevertToAutomationName(a, b, (ApplyFlag)c));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.StateChanged" />
|
||||
public static class StateChanged
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Penumbra.{nameof(StateChanged)}.V2";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber<nint> Subscriber(IDalamudPluginInterface pi, params Action<nint>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider<nint> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (t => api.StateChanged += t, t => api.StateChanged -= t));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.StateChangedWithType" />
|
||||
public static class StateChangedWithType
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Penumbra.{nameof(StateChangedWithType)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber<nint, StateChangeType> Subscriber(IDalamudPluginInterface pi, params Action<nint, StateChangeType>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider<nint, StateChangeType> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (t => api.StateChangedWithType += t, t => api.StateChangedWithType -= t));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.StateFinalized" />
|
||||
public static class StateFinalized
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Penumbra.{nameof(StateFinalized)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber<nint, StateFinalizationType> Subscriber(IDalamudPluginInterface pi, params Action<nint, StateFinalizationType>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider<nint, StateFinalizationType> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (t => api.StateFinalized += t, t => api.StateFinalized -= t));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IGlamourerApiState.GPoseChanged" />
|
||||
public static class GPoseChanged
|
||||
{
|
||||
/// <summary> The label. </summary>
|
||||
public const string Label = $"Penumbra.{nameof(GPoseChanged)}";
|
||||
|
||||
/// <summary> Create a new event subscriber. </summary>
|
||||
public static EventSubscriber<bool> Subscriber(IDalamudPluginInterface pi, params Action<bool>[] actions)
|
||||
=> new(pi, Label, actions);
|
||||
|
||||
/// <summary> Create a provider. </summary>
|
||||
public static EventProvider<bool> Provider(IDalamudPluginInterface pi, IGlamourerApiState api)
|
||||
=> new(pi, Label, (t => api.GPoseChanged += t, t => api.GPoseChanged -= t));
|
||||
}
|
4
Glamourer.Api/README.md
Normal file
4
Glamourer.Api/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Glamourer
|
||||
|
||||
This is an auxiliary repository for Glamourers external API.
|
||||
For more information, see the [main repo](https://github.com/Ottermandias/Glamourer).
|
13
Glamourer.Api/packages.lock.json
Normal file
13
Glamourer.Api/packages.lock.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net9.0-windows7.0": {
|
||||
"DotNet.ReproducibleBuilds": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.2.25, )",
|
||||
"resolved": "1.2.25",
|
||||
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
617
LICENSE
Normal file
617
LICENSE
Normal file
@@ -0,0 +1,617 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
21
LICENSE_MIT
Normal file
21
LICENSE_MIT
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Penumbra-Sync
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
350
MareAPI/.gitignore
vendored
Normal file
350
MareAPI/.gitignore
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
21
MareAPI/LICENSE
Normal file
21
MareAPI/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Mare Synchronos
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
36
MareAPI/MareSynchronosAPI/Data/CharacterData.cs
Normal file
36
MareAPI/MareSynchronosAPI/Data/CharacterData.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public class CharacterData
|
||||
{
|
||||
public CharacterData()
|
||||
{
|
||||
DataHash = new(() =>
|
||||
{
|
||||
var json = JsonSerializer.Serialize(this);
|
||||
#pragma warning disable SYSLIB0021 // Type or member is obsolete
|
||||
using SHA256CryptoServiceProvider cryptoProvider = new();
|
||||
#pragma warning restore SYSLIB0021 // Type or member is obsolete
|
||||
return BitConverter.ToString(cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(json))).Replace("-", "", StringComparison.Ordinal);
|
||||
});
|
||||
}
|
||||
|
||||
public Dictionary<ObjectKind, string> CustomizePlusData { get; set; } = new();
|
||||
[JsonIgnore]
|
||||
public Lazy<string> DataHash { get; }
|
||||
|
||||
public Dictionary<ObjectKind, List<FileReplacementData>> FileReplacements { get; set; } = new();
|
||||
public Dictionary<ObjectKind, string> GlamourerData { get; set; } = new();
|
||||
public string HeelsData { get; set; } = string.Empty;
|
||||
public string HonorificData { get; set; } = string.Empty;
|
||||
public string ManipulationData { get; set; } = string.Empty;
|
||||
public string MoodlesData { get; set; } = string.Empty;
|
||||
public string PetNamesData { get; set; } = string.Empty;
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Data/ChatMessage.cs
Normal file
11
MareAPI/MareSynchronosAPI/Data/ChatMessage.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record ChatMessage
|
||||
{
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
public uint SenderHomeWorldId { get; set; } = 0;
|
||||
public byte[] PayloadContent { get; set; } = [];
|
||||
}
|
19
MareAPI/MareSynchronosAPI/Data/Comparer/GroupDataComparer.cs
Normal file
19
MareAPI/MareSynchronosAPI/Data/Comparer/GroupDataComparer.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
public class GroupDataComparer : IEqualityComparer<GroupData>
|
||||
{
|
||||
public static GroupDataComparer Instance => _instance;
|
||||
private static GroupDataComparer _instance = new GroupDataComparer();
|
||||
|
||||
private GroupDataComparer() { }
|
||||
public bool Equals(GroupData? x, GroupData? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
return x.GID.Equals(y.GID, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public int GetHashCode(GroupData obj)
|
||||
{
|
||||
return obj.GID.GetHashCode();
|
||||
}
|
||||
}
|
23
MareAPI/MareSynchronosAPI/Data/Comparer/GroupDtoComparer.cs
Normal file
23
MareAPI/MareSynchronosAPI/Data/Comparer/GroupDtoComparer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
|
||||
namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
|
||||
public class GroupDtoComparer : IEqualityComparer<GroupDto>
|
||||
{
|
||||
public static GroupDtoComparer Instance => _instance;
|
||||
private static GroupDtoComparer _instance = new GroupDtoComparer();
|
||||
|
||||
private GroupDtoComparer() { }
|
||||
|
||||
public bool Equals(GroupDto? x, GroupDto? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
return x.GID.Equals(y.GID, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public int GetHashCode(GroupDto obj)
|
||||
{
|
||||
return obj.Group.GID.GetHashCode();
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
|
||||
namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
public class GroupPairDtoComparer : IEqualityComparer<GroupPairDto>
|
||||
{
|
||||
public static GroupPairDtoComparer Instance => _instance;
|
||||
private static GroupPairDtoComparer _instance = new();
|
||||
private GroupPairDtoComparer() { }
|
||||
public bool Equals(GroupPairDto? x, GroupPairDto? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
return x.GID.Equals(y.GID, StringComparison.Ordinal) && x.UID.Equals(y.UID, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public int GetHashCode(GroupPairDto obj)
|
||||
{
|
||||
return HashCode.Combine(obj.Group.GID.GetHashCode(), obj.User.UID.GetHashCode());
|
||||
}
|
||||
}
|
20
MareAPI/MareSynchronosAPI/Data/Comparer/UserDataComparer.cs
Normal file
20
MareAPI/MareSynchronosAPI/Data/Comparer/UserDataComparer.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
public class UserDataComparer : IEqualityComparer<UserData>
|
||||
{
|
||||
public static UserDataComparer Instance => _instance;
|
||||
private static UserDataComparer _instance = new();
|
||||
|
||||
private UserDataComparer() { }
|
||||
|
||||
public bool Equals(UserData? x, UserData? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
return x.UID.Equals(y.UID, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public int GetHashCode(UserData obj)
|
||||
{
|
||||
return obj.UID.GetHashCode();
|
||||
}
|
||||
}
|
20
MareAPI/MareSynchronosAPI/Data/Comparer/UserDtoComparer.cs
Normal file
20
MareAPI/MareSynchronosAPI/Data/Comparer/UserDtoComparer.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using MareSynchronos.API.Dto.User;
|
||||
|
||||
namespace MareSynchronos.API.Data.Comparer;
|
||||
|
||||
public class UserDtoComparer : IEqualityComparer<UserDto>
|
||||
{
|
||||
public static UserDtoComparer Instance => _instance;
|
||||
private static UserDtoComparer _instance = new();
|
||||
private UserDtoComparer() { }
|
||||
public bool Equals(UserDto? x, UserDto? y)
|
||||
{
|
||||
if (x == null || y == null) return false;
|
||||
return x.User.UID.Equals(y.User.UID, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public int GetHashCode(UserDto obj)
|
||||
{
|
||||
return obj.User.UID.GetHashCode();
|
||||
}
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Data/Enum/GroupPermissions.cs
Normal file
11
MareAPI/MareSynchronosAPI/Data/Enum/GroupPermissions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
[Flags]
|
||||
public enum GroupPermissions
|
||||
{
|
||||
NoneSet = 0x0,
|
||||
DisableAnimations = 0x1,
|
||||
DisableSounds = 0x2,
|
||||
DisableInvites = 0x4,
|
||||
DisableVFX = 0x8,
|
||||
}
|
9
MareAPI/MareSynchronosAPI/Data/Enum/GroupUserInfo.cs
Normal file
9
MareAPI/MareSynchronosAPI/Data/Enum/GroupUserInfo.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
[Flags]
|
||||
public enum GroupUserInfo
|
||||
{
|
||||
None = 0x0,
|
||||
IsModerator = 0x2,
|
||||
IsPinned = 0x4
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Data/Enum/GroupUserPermissions.cs
Normal file
11
MareAPI/MareSynchronosAPI/Data/Enum/GroupUserPermissions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
[Flags]
|
||||
public enum GroupUserPermissions
|
||||
{
|
||||
NoneSet = 0x0,
|
||||
Paused = 0x1,
|
||||
DisableAnimations = 0x2,
|
||||
DisableSounds = 0x4,
|
||||
DisableVFX = 0x8,
|
||||
}
|
8
MareAPI/MareSynchronosAPI/Data/Enum/MessageSeverity.cs
Normal file
8
MareAPI/MareSynchronosAPI/Data/Enum/MessageSeverity.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
public enum MessageSeverity
|
||||
{
|
||||
Information,
|
||||
Warning,
|
||||
Error
|
||||
}
|
9
MareAPI/MareSynchronosAPI/Data/Enum/ObjectKind.cs
Normal file
9
MareAPI/MareSynchronosAPI/Data/Enum/ObjectKind.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
public enum ObjectKind
|
||||
{
|
||||
Player = 0,
|
||||
MinionOrMount = 1,
|
||||
Companion = 2,
|
||||
Pet = 3,
|
||||
}
|
12
MareAPI/MareSynchronosAPI/Data/Enum/UserPermissions.cs
Normal file
12
MareAPI/MareSynchronosAPI/Data/Enum/UserPermissions.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace MareSynchronos.API.Data.Enum;
|
||||
|
||||
[Flags]
|
||||
public enum UserPermissions
|
||||
{
|
||||
NoneSet = 0,
|
||||
Paired = 1,
|
||||
Paused = 2,
|
||||
DisableAnimations = 4,
|
||||
DisableSounds = 8,
|
||||
DisableVFX = 16,
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
|
||||
namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class GroupPermissionsExtensions
|
||||
{
|
||||
public static bool IsDisableAnimations(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableAnimations);
|
||||
}
|
||||
|
||||
public static bool IsDisableSounds(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableSounds);
|
||||
}
|
||||
|
||||
public static bool IsDisableInvites(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableInvites);
|
||||
}
|
||||
|
||||
public static bool IsDisableVFX(this GroupPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupPermissions.DisableVFX);
|
||||
}
|
||||
|
||||
public static void SetDisableAnimations(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableAnimations;
|
||||
else perm &= ~GroupPermissions.DisableAnimations;
|
||||
}
|
||||
|
||||
public static void SetDisableSounds(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableSounds;
|
||||
else perm &= ~GroupPermissions.DisableSounds;
|
||||
}
|
||||
|
||||
public static void SetDisableInvites(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableInvites;
|
||||
else perm &= ~GroupPermissions.DisableInvites;
|
||||
}
|
||||
|
||||
public static void SetDisableVFX(this ref GroupPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupPermissions.DisableVFX;
|
||||
else perm &= ~GroupPermissions.DisableVFX;
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
|
||||
namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class GroupUserInfoExtensions
|
||||
{
|
||||
public static bool IsModerator(this GroupUserInfo info)
|
||||
{
|
||||
return info.HasFlag(GroupUserInfo.IsModerator);
|
||||
}
|
||||
|
||||
public static bool IsPinned(this GroupUserInfo info)
|
||||
{
|
||||
return info.HasFlag(GroupUserInfo.IsPinned);
|
||||
}
|
||||
|
||||
public static void SetModerator(this ref GroupUserInfo info, bool isModerator)
|
||||
{
|
||||
if (isModerator) info |= GroupUserInfo.IsModerator;
|
||||
else info &= ~GroupUserInfo.IsModerator;
|
||||
}
|
||||
|
||||
public static void SetPinned(this ref GroupUserInfo info, bool isPinned)
|
||||
{
|
||||
if (isPinned) info |= GroupUserInfo.IsPinned;
|
||||
else info &= ~GroupUserInfo.IsPinned;
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
|
||||
namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class GroupUserPermissionsExtensions
|
||||
{
|
||||
public static bool IsDisableAnimations(this GroupUserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.DisableAnimations);
|
||||
}
|
||||
|
||||
public static bool IsDisableSounds(this GroupUserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.DisableSounds);
|
||||
}
|
||||
|
||||
public static bool IsPaused(this GroupUserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.Paused);
|
||||
}
|
||||
|
||||
public static bool IsDisableVFX(this GroupUserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(GroupUserPermissions.DisableVFX);
|
||||
}
|
||||
|
||||
public static void SetDisableAnimations(this ref GroupUserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.DisableAnimations;
|
||||
else perm &= ~GroupUserPermissions.DisableAnimations;
|
||||
}
|
||||
|
||||
public static void SetDisableSounds(this ref GroupUserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.DisableSounds;
|
||||
else perm &= ~GroupUserPermissions.DisableSounds;
|
||||
}
|
||||
|
||||
public static void SetPaused(this ref GroupUserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.Paused;
|
||||
else perm &= ~GroupUserPermissions.Paused;
|
||||
}
|
||||
|
||||
public static void SetDisableVFX(this ref GroupUserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= GroupUserPermissions.DisableVFX;
|
||||
else perm &= ~GroupUserPermissions.DisableVFX;
|
||||
}
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
|
||||
namespace MareSynchronos.API.Data.Extensions;
|
||||
|
||||
public static class UserPermissionsExtensions
|
||||
{
|
||||
public static bool IsPaired(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.Paired);
|
||||
}
|
||||
|
||||
public static bool IsPaused(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.Paused);
|
||||
}
|
||||
|
||||
public static bool IsDisableAnimations(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.DisableAnimations);
|
||||
}
|
||||
|
||||
public static bool IsDisableSounds(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.DisableSounds);
|
||||
}
|
||||
|
||||
public static bool IsDisableVFX(this UserPermissions perm)
|
||||
{
|
||||
return perm.HasFlag(UserPermissions.DisableVFX);
|
||||
}
|
||||
|
||||
public static void SetPaired(this ref UserPermissions perm, bool paired)
|
||||
{
|
||||
if (paired) perm |= UserPermissions.Paired;
|
||||
else perm &= ~UserPermissions.Paired;
|
||||
}
|
||||
|
||||
public static void SetPaused(this ref UserPermissions perm, bool paused)
|
||||
{
|
||||
if (paused) perm |= UserPermissions.Paused;
|
||||
else perm &= ~UserPermissions.Paused;
|
||||
}
|
||||
|
||||
public static void SetDisableAnimations(this ref UserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= UserPermissions.DisableAnimations;
|
||||
else perm &= ~UserPermissions.DisableAnimations;
|
||||
}
|
||||
|
||||
public static void SetDisableSounds(this ref UserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= UserPermissions.DisableSounds;
|
||||
else perm &= ~UserPermissions.DisableSounds;
|
||||
}
|
||||
|
||||
public static void SetDisableVFX(this ref UserPermissions perm, bool set)
|
||||
{
|
||||
if (set) perm |= UserPermissions.DisableVFX;
|
||||
else perm &= ~UserPermissions.DisableVFX;
|
||||
}
|
||||
}
|
30
MareAPI/MareSynchronosAPI/Data/FileReplacementData.cs
Normal file
30
MareAPI/MareSynchronosAPI/Data/FileReplacementData.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using MessagePack;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public class FileReplacementData
|
||||
{
|
||||
public FileReplacementData()
|
||||
{
|
||||
DataHash = new(() =>
|
||||
{
|
||||
var json = JsonSerializer.Serialize(this);
|
||||
#pragma warning disable SYSLIB0021 // Type or member is obsolete
|
||||
using SHA256CryptoServiceProvider cryptoProvider = new();
|
||||
#pragma warning restore SYSLIB0021 // Type or member is obsolete
|
||||
return BitConverter.ToString(cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(json))).Replace("-", "", StringComparison.Ordinal);
|
||||
});
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public Lazy<string> DataHash { get; }
|
||||
public string[] GamePaths { get; set; } = Array.Empty<string>();
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
public string FileSwapPath { get; set; } = string.Empty;
|
||||
}
|
10
MareAPI/MareSynchronosAPI/Data/GroupData.cs
Normal file
10
MareAPI/MareSynchronosAPI/Data/GroupData.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupData(string GID, string? Alias = null)
|
||||
{
|
||||
[IgnoreMember]
|
||||
public string AliasOrGID => string.IsNullOrWhiteSpace(Alias) ? GID : Alias;
|
||||
}
|
14
MareAPI/MareSynchronosAPI/Data/SignedChatMessage.cs
Normal file
14
MareAPI/MareSynchronosAPI/Data/SignedChatMessage.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record SignedChatMessage(ChatMessage Message, UserData Sender) : ChatMessage(Message)
|
||||
{
|
||||
// Sender and timestamp are set by the server
|
||||
public UserData Sender { get; set; } = Sender;
|
||||
public long Timestamp { get; set; } = 0;
|
||||
// Signature is generated by the server as SHA256(Sender.UID | Timestamp | Destination | Message)
|
||||
// Where Destination is either the receiver's UID, or the group GID
|
||||
public string Signature { get; set; } = string.Empty;
|
||||
}
|
10
MareAPI/MareSynchronosAPI/Data/UserData.cs
Normal file
10
MareAPI/MareSynchronosAPI/Data/UserData.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Data;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserData(string UID, string? Alias = null)
|
||||
{
|
||||
[IgnoreMember]
|
||||
public string AliasOrUID => string.IsNullOrWhiteSpace(Alias) ? UID : Alias;
|
||||
}
|
12
MareAPI/MareSynchronosAPI/Dto/Account/RegisterReplyDto.cs
Normal file
12
MareAPI/MareSynchronosAPI/Dto/Account/RegisterReplyDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Account;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record RegisterReplyDto
|
||||
{
|
||||
public bool Success { get; set; } = false;
|
||||
public string ErrorMessage { get; set; } = string.Empty;
|
||||
public string UID { get; set; } = string.Empty;
|
||||
public string SecretKey { get; set; } = string.Empty;
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Dto/Account/RegisterReplyV2Dto.cs
Normal file
11
MareAPI/MareSynchronosAPI/Dto/Account/RegisterReplyV2Dto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Account;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record RegisterReplyV2Dto
|
||||
{
|
||||
public bool Success { get; set; } = false;
|
||||
public string ErrorMessage { get; set; } = string.Empty;
|
||||
public string UID { get; set; } = string.Empty;
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Dto/AuthReplyDto.cs
Normal file
11
MareAPI/MareSynchronosAPI/Dto/AuthReplyDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record AuthReplyDto
|
||||
{
|
||||
public string Token { get; set; } = string.Empty;
|
||||
public string? WellKnown { get; set; }
|
||||
}
|
9
MareAPI/MareSynchronosAPI/Dto/CharaData/AccessTypeDto.cs
Normal file
9
MareAPI/MareSynchronosAPI/Dto/CharaData/AccessTypeDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
public enum AccessTypeDto
|
||||
{
|
||||
Individuals,
|
||||
ClosePairs,
|
||||
AllPairs,
|
||||
Public
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record CharaDataDownloadDto(string Id, UserData Uploader) : CharaDataDto(Id, Uploader)
|
||||
{
|
||||
public string GlamourerData { get; init; } = string.Empty;
|
||||
public string CustomizeData { get; init; } = string.Empty;
|
||||
public string ManipulationData { get; set; } = string.Empty;
|
||||
public List<GamePathEntry> FileGamePaths { get; init; } = [];
|
||||
public List<GamePathEntry> FileSwaps { get; init; } = [];
|
||||
}
|
9
MareAPI/MareSynchronosAPI/Dto/CharaData/CharaDataDto.cs
Normal file
9
MareAPI/MareSynchronosAPI/Dto/CharaData/CharaDataDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using MareSynchronos.API.Data;
|
||||
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
public record CharaDataDto(string Id, UserData Uploader)
|
||||
{
|
||||
public string Description { get; init; } = string.Empty;
|
||||
public DateTime UpdatedDate { get; init; }
|
||||
}
|
88
MareAPI/MareSynchronosAPI/Dto/CharaData/CharaDataFullDto.cs
Normal file
88
MareAPI/MareSynchronosAPI/Dto/CharaData/CharaDataFullDto.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record CharaDataFullDto(string Id, UserData Uploader) : CharaDataDto(Id, Uploader)
|
||||
{
|
||||
public DateTime CreatedDate { get; init; }
|
||||
public DateTime ExpiryDate { get; set; }
|
||||
public string GlamourerData { get; set; } = string.Empty;
|
||||
public string CustomizeData { get; set; } = string.Empty;
|
||||
public string ManipulationData { get; set; } = string.Empty;
|
||||
public int DownloadCount { get; set; } = 0;
|
||||
public List<UserData> AllowedUsers { get; set; } = [];
|
||||
public List<GroupData> AllowedGroups { get; set; } = [];
|
||||
public List<GamePathEntry> FileGamePaths { get; set; } = [];
|
||||
public List<GamePathEntry> FileSwaps { get; set; } = [];
|
||||
public List<GamePathEntry> OriginalFiles { get; set; } = [];
|
||||
public AccessTypeDto AccessType { get; set; }
|
||||
public ShareTypeDto ShareType { get; set; }
|
||||
public List<PoseEntry> PoseData { get; set; } = [];
|
||||
}
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GamePathEntry(string HashOrFileSwap, string GamePath);
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record PoseEntry(long? Id)
|
||||
{
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
public string? PoseData { get; set; } = string.Empty;
|
||||
public WorldData? WorldData { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public record struct WorldData
|
||||
{
|
||||
[Key(0)] public LocationInfo LocationInfo { get; set; }
|
||||
[Key(1)] public float PositionX { get; set; }
|
||||
[Key(2)] public float PositionY { get; set; }
|
||||
[Key(3)] public float PositionZ { get; set; }
|
||||
[Key(4)] public float RotationX { get; set; }
|
||||
[Key(5)] public float RotationY { get; set; }
|
||||
[Key(6)] public float RotationZ { get; set; }
|
||||
[Key(7)] public float RotationW { get; set; }
|
||||
[Key(8)] public float ScaleX { get; set; }
|
||||
[Key(9)] public float ScaleY { get; set; }
|
||||
[Key(10)] public float ScaleZ { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public record struct LocationInfo
|
||||
{
|
||||
[Key(0)] public uint ServerId { get; set; }
|
||||
[Key(1)] public uint MapId { get; set; }
|
||||
[Key(2)] public uint TerritoryId { get; set; }
|
||||
[Key(3)] public uint DivisionId { get; set; }
|
||||
[Key(4)] public uint WardId { get; set; }
|
||||
[Key(5)] public uint HouseId { get; set; }
|
||||
[Key(6)] public uint RoomId { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public record struct PoseData
|
||||
{
|
||||
[Key(0)] public bool IsDelta { get; set; }
|
||||
[Key(1)] public Dictionary<string, BoneData> Bones { get; set; }
|
||||
[Key(2)] public Dictionary<string, BoneData> MainHand { get; set; }
|
||||
[Key(3)] public Dictionary<string, BoneData> OffHand { get; set; }
|
||||
[Key(4)] public BoneData ModelDifference { get; set; }
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
public record struct BoneData
|
||||
{
|
||||
[Key(0)] public bool Exists { get; set; }
|
||||
[Key(1)] public float PositionX { get; set; }
|
||||
[Key(2)] public float PositionY { get; set; }
|
||||
[Key(3)] public float PositionZ { get; set; }
|
||||
[Key(4)] public float RotationX { get; set; }
|
||||
[Key(5)] public float RotationY { get; set; }
|
||||
[Key(6)] public float RotationZ { get; set; }
|
||||
[Key(7)] public float RotationW { get; set; }
|
||||
[Key(8)] public float ScaleX { get; set; }
|
||||
[Key(9)] public float ScaleY { get; set; }
|
||||
[Key(10)] public float ScaleZ { get; set; }
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record CharaDataMetaInfoDto(string Id, UserData Uploader) : CharaDataDto(Id, Uploader)
|
||||
{
|
||||
public bool CanBeDownloaded { get; init; }
|
||||
public List<PoseEntry> PoseData { get; set; } = [];
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record CharaDataUpdateDto(string Id)
|
||||
{
|
||||
public string? Description { get; set; }
|
||||
public DateTime? ExpiryDate { get; set; }
|
||||
public string? GlamourerData { get; set; }
|
||||
public string? CustomizeData { get; set; }
|
||||
public string? ManipulationData { get; set; }
|
||||
public List<string>? AllowedUsers { get; set; }
|
||||
public List<string>? AllowedGroups { get; set; }
|
||||
public List<GamePathEntry>? FileGamePaths { get; set; }
|
||||
public List<GamePathEntry>? FileSwaps { get; set; }
|
||||
public AccessTypeDto? AccessType { get; set; }
|
||||
public ShareTypeDto? ShareType { get; set; }
|
||||
public List<PoseEntry>? Poses { get; set; }
|
||||
}
|
7
MareAPI/MareSynchronosAPI/Dto/CharaData/ShareTypeDto.cs
Normal file
7
MareAPI/MareSynchronosAPI/Dto/CharaData/ShareTypeDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace MareSynchronos.API.Dto.CharaData;
|
||||
|
||||
public enum ShareTypeDto
|
||||
{
|
||||
Private,
|
||||
Shared
|
||||
}
|
13
MareAPI/MareSynchronosAPI/Dto/Chat/GroupChatMsgDto.cs
Normal file
13
MareAPI/MareSynchronosAPI/Dto/Chat/GroupChatMsgDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
using MareSynchronos.API.Dto.User;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Chat;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupChatMsgDto(GroupDto Group, SignedChatMessage Message)
|
||||
{
|
||||
public GroupDto Group = Group;
|
||||
public SignedChatMessage Message = Message;
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Dto/Chat/UserChatMsgDto.cs
Normal file
11
MareAPI/MareSynchronosAPI/Dto/Chat/UserChatMsgDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Dto.User;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Chat;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserChatMsgDto(SignedChatMessage Message)
|
||||
{
|
||||
public SignedChatMessage Message = Message;
|
||||
}
|
25
MareAPI/MareSynchronosAPI/Dto/ConnectionDto.cs
Normal file
25
MareAPI/MareSynchronosAPI/Dto/ConnectionDto.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record ConnectionDto(UserData User)
|
||||
{
|
||||
public Version CurrentClientVersion { get; set; } = new(0, 0, 0);
|
||||
public int ServerVersion { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
public bool IsModerator { get; set; }
|
||||
public ServerInfo ServerInfo { get; set; } = new();
|
||||
}
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record ServerInfo
|
||||
{
|
||||
public string ShardName { get; set; } = string.Empty;
|
||||
public int MaxGroupUserCount { get; set; }
|
||||
public int MaxGroupsCreatedByUser { get; set; }
|
||||
public int MaxGroupsJoinedByUser { get; set; }
|
||||
public Uri FileServerAddress { get; set; } = new Uri("http://nonemptyuri");
|
||||
public int MaxCharaData { get; set; }
|
||||
}
|
14
MareAPI/MareSynchronosAPI/Dto/Files/DownloadFileDto.cs
Normal file
14
MareAPI/MareSynchronosAPI/Dto/Files/DownloadFileDto.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Files;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record DownloadFileDto : ITransferFileDto
|
||||
{
|
||||
public bool FileExists { get; set; } = true;
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
public string Url { get; set; } = string.Empty;
|
||||
public long Size { get; set; } = 0;
|
||||
public bool IsForbidden { get; set; } = false;
|
||||
public string ForbiddenBy { get; set; } = string.Empty;
|
||||
}
|
13
MareAPI/MareSynchronosAPI/Dto/Files/FilesSendDto.cs
Normal file
13
MareAPI/MareSynchronosAPI/Dto/Files/FilesSendDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Files;
|
||||
|
||||
public class FilesSendDto
|
||||
{
|
||||
public List<string> FileHashes { get; set; } = new();
|
||||
public List<string> UIDs { get; set; } = new();
|
||||
}
|
8
MareAPI/MareSynchronosAPI/Dto/Files/ITransferFileDto.cs
Normal file
8
MareAPI/MareSynchronosAPI/Dto/Files/ITransferFileDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace MareSynchronos.API.Dto.Files;
|
||||
|
||||
public interface ITransferFileDto
|
||||
{
|
||||
string Hash { get; set; }
|
||||
bool IsForbidden { get; set; }
|
||||
string ForbiddenBy { get; set; }
|
||||
}
|
11
MareAPI/MareSynchronosAPI/Dto/Files/UploadFileDto.cs
Normal file
11
MareAPI/MareSynchronosAPI/Dto/Files/UploadFileDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Files;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UploadFileDto : ITransferFileDto
|
||||
{
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
public bool IsForbidden { get; set; } = false;
|
||||
public string ForbiddenBy { get; set; } = string.Empty;
|
||||
}
|
19
MareAPI/MareSynchronosAPI/Dto/Group/BannedGroupUserDto.cs
Normal file
19
MareAPI/MareSynchronosAPI/Dto/Group/BannedGroupUserDto.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record BannedGroupUserDto : GroupPairDto
|
||||
{
|
||||
public BannedGroupUserDto(GroupData group, UserData user, string reason, DateTime bannedOn, string bannedBy) : base(group, user)
|
||||
{
|
||||
Reason = reason;
|
||||
BannedOn = bannedOn;
|
||||
BannedBy = bannedBy;
|
||||
}
|
||||
|
||||
public string Reason { get; set; }
|
||||
public DateTime BannedOn { get; set; }
|
||||
public string BannedBy { get; set; }
|
||||
}
|
13
MareAPI/MareSynchronosAPI/Dto/Group/GroupDto.cs
Normal file
13
MareAPI/MareSynchronosAPI/Dto/Group/GroupDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupDto(GroupData Group)
|
||||
{
|
||||
public GroupData Group { get; set; } = Group;
|
||||
public string GID => Group.GID;
|
||||
public string? GroupAlias => Group.Alias;
|
||||
public string GroupAliasOrGID => Group.AliasOrGID;
|
||||
}
|
12
MareAPI/MareSynchronosAPI/Dto/Group/GroupFullInfoDto.cs
Normal file
12
MareAPI/MareSynchronosAPI/Dto/Group/GroupFullInfoDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupFullInfoDto(GroupData Group, UserData Owner, GroupPermissions GroupPermissions, GroupUserPermissions GroupUserPermissions, GroupUserInfo GroupUserInfo) : GroupInfoDto(Group, Owner, GroupPermissions)
|
||||
{
|
||||
public GroupUserPermissions GroupUserPermissions { get; set; } = GroupUserPermissions;
|
||||
public GroupUserInfo GroupUserInfo { get; set; } = GroupUserInfo;
|
||||
}
|
16
MareAPI/MareSynchronosAPI/Dto/Group/GroupInfoDto.cs
Normal file
16
MareAPI/MareSynchronosAPI/Dto/Group/GroupInfoDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupInfoDto(GroupData Group, UserData Owner, GroupPermissions GroupPermissions) : GroupDto(Group)
|
||||
{
|
||||
public GroupPermissions GroupPermissions { get; set; } = GroupPermissions;
|
||||
public UserData Owner { get; set; } = Owner;
|
||||
|
||||
public string OwnerUID => Owner.UID;
|
||||
public string? OwnerAlias => Owner.Alias;
|
||||
public string OwnerAliasOrUID => Owner.AliasOrUID;
|
||||
}
|
12
MareAPI/MareSynchronosAPI/Dto/Group/GroupPairDto.cs
Normal file
12
MareAPI/MareSynchronosAPI/Dto/Group/GroupPairDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairDto(GroupData Group, UserData User) : GroupDto(Group)
|
||||
{
|
||||
public string UID => User.UID;
|
||||
public string? UserAlias => User.Alias;
|
||||
public string UserAliasOrUID => User.AliasOrUID;
|
||||
}
|
12
MareAPI/MareSynchronosAPI/Dto/Group/GroupPairFullInfoDto.cs
Normal file
12
MareAPI/MareSynchronosAPI/Dto/Group/GroupPairFullInfoDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairFullInfoDto(GroupData Group, UserData User, GroupUserInfo GroupPairStatusInfo, GroupUserPermissions GroupUserPermissions) : GroupPairDto(Group, User)
|
||||
{
|
||||
public GroupUserInfo GroupPairStatusInfo { get; set; } = GroupPairStatusInfo;
|
||||
public GroupUserPermissions GroupUserPermissions { get; set; } = GroupUserPermissions;
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairUserInfoDto(GroupData Group, UserData User, GroupUserInfo GroupUserInfo) : GroupPairDto(Group, User);
|
@@ -0,0 +1,8 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPairUserPermissionDto(GroupData Group, UserData User, GroupUserPermissions GroupPairPermissions) : GroupPairDto(Group, User);
|
7
MareAPI/MareSynchronosAPI/Dto/Group/GroupPasswordDto.cs
Normal file
7
MareAPI/MareSynchronosAPI/Dto/Group/GroupPasswordDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPasswordDto(GroupData Group, string Password) : GroupDto(Group);
|
@@ -0,0 +1,8 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.Group;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record GroupPermissionDto(GroupData Group, GroupPermissions Permissions) : GroupDto(Group);
|
9
MareAPI/MareSynchronosAPI/Dto/SystemInfoDto.cs
Normal file
9
MareAPI/MareSynchronosAPI/Dto/SystemInfoDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record SystemInfoDto
|
||||
{
|
||||
public int OnlineUsers { get; set; }
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record OnlineUserCharaDataDto(UserData User, CharacterData CharaData) : UserDto(User);
|
7
MareAPI/MareSynchronosAPI/Dto/User/OnlineUserIdentDto.cs
Normal file
7
MareAPI/MareSynchronosAPI/Dto/User/OnlineUserIdentDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record OnlineUserIdentDto(UserData User, string Ident) : UserDto(User);
|
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserCharaDataMessageDto(List<UserData> Recipients, CharacterData CharaData);
|
7
MareAPI/MareSynchronosAPI/Dto/User/UserDto.cs
Normal file
7
MareAPI/MareSynchronosAPI/Dto/User/UserDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserDto(UserData User);
|
12
MareAPI/MareSynchronosAPI/Dto/User/UserPairDto.cs
Normal file
12
MareAPI/MareSynchronosAPI/Dto/User/UserPairDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserPairDto(UserData User, UserPermissions OwnPermissions, UserPermissions OtherPermissions) : UserDto(User)
|
||||
{
|
||||
public UserPermissions OwnPermissions { get; set; } = OwnPermissions;
|
||||
public UserPermissions OtherPermissions { get; set; } = OtherPermissions;
|
||||
}
|
8
MareAPI/MareSynchronosAPI/Dto/User/UserPermissionsDto.cs
Normal file
8
MareAPI/MareSynchronosAPI/Dto/User/UserPermissionsDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserPermissionsDto(UserData User, UserPermissions Permissions) : UserDto(User);
|
7
MareAPI/MareSynchronosAPI/Dto/User/UserProfileDto.cs
Normal file
7
MareAPI/MareSynchronosAPI/Dto/User/UserProfileDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserProfileDto(UserData User, bool Disabled, bool? IsNSFW, string? ProfilePictureBase64, string? Description) : UserDto(User);
|
@@ -0,0 +1,7 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MessagePack;
|
||||
|
||||
namespace MareSynchronos.API.Dto.User;
|
||||
|
||||
[MessagePackObject(keyAsPropertyName: true)]
|
||||
public record UserProfileReportDto(UserData User, string ProfileReport) : UserDto(User);
|
13
MareAPI/MareSynchronosAPI/MareSynchronos.API.csproj
Normal file
13
MareAPI/MareSynchronosAPI/MareSynchronos.API.csproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MessagePack.Annotations" Version="2.5.129" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
MareAPI/MareSynchronosAPI/MareSynchronosAPI.sln
Normal file
25
MareAPI/MareSynchronosAPI/MareSynchronosAPI.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32602.215
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MareSynchronos.API", "MareSynchronos.API.csproj", "{CD05EE19-802F-4490-AAD8-CAD4BF1D630D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CD05EE19-802F-4490-AAD8-CAD4BF1D630D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CD05EE19-802F-4490-AAD8-CAD4BF1D630D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CD05EE19-802F-4490-AAD8-CAD4BF1D630D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CD05EE19-802F-4490-AAD8-CAD4BF1D630D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DFB70C71-AB27-468D-A08B-218CA79BF69D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
14
MareAPI/MareSynchronosAPI/Routes/MareAuth.cs
Normal file
14
MareAPI/MareSynchronosAPI/Routes/MareAuth.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace MareSynchronos.API.Routes;
|
||||
|
||||
public class MareAuth
|
||||
{
|
||||
public const string Auth = "/auth";
|
||||
public const string Auth_CreateIdent = "createWithIdent";
|
||||
public const string Auth_CreateIdentV2 = "createWithIdentV2";
|
||||
public const string Auth_Register = "registerNewKey";
|
||||
public const string Auth_RegisterV2 = "registerNewKeyV2";
|
||||
public static Uri AuthFullPath(Uri baseUri) => new Uri(baseUri, Auth + "/" + Auth_CreateIdent);
|
||||
public static Uri AuthV2FullPath(Uri baseUri) => new Uri(baseUri, Auth + "/" + Auth_CreateIdentV2);
|
||||
public static Uri AuthRegisterFullPath(Uri baseUri) => new Uri(baseUri, Auth + "/" + Auth_Register);
|
||||
public static Uri AuthRegisterV2FullPath(Uri baseUri) => new Uri(baseUri, Auth + "/" + Auth_RegisterV2);
|
||||
}
|
45
MareAPI/MareSynchronosAPI/Routes/MareFiles.cs
Normal file
45
MareAPI/MareSynchronosAPI/Routes/MareFiles.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace MareSynchronos.API.Routes;
|
||||
|
||||
public class MareFiles
|
||||
{
|
||||
public const string Cache = "/cache";
|
||||
public const string Cache_Get = "get";
|
||||
|
||||
public const string Request = "/request";
|
||||
public const string Request_Cancel = "cancel";
|
||||
public const string Request_Check = "check";
|
||||
public const string Request_Enqueue = "enqueue";
|
||||
public const string Request_RequestFile = "file";
|
||||
|
||||
public const string ServerFiles = "/files";
|
||||
public const string ServerFiles_DeleteAll = "deleteAll";
|
||||
public const string ServerFiles_FilesSend = "filesSend";
|
||||
public const string ServerFiles_GetSizes = "getFileSizes";
|
||||
public const string ServerFiles_Upload = "upload";
|
||||
public const string ServerFiles_UploadRaw = "uploadRaw";
|
||||
public const string ServerFiles_UploadMunged = "uploadMunged";
|
||||
|
||||
public const string Distribution = "/dist";
|
||||
public const string Distribution_Get = "get";
|
||||
|
||||
public const string Main = "/main";
|
||||
public const string Main_SendReady = "sendReady";
|
||||
|
||||
public static Uri CacheGetFullPath(Uri baseUri, Guid requestId) => new(baseUri, Cache + "/" + Cache_Get + "?requestId=" + requestId.ToString());
|
||||
|
||||
public static Uri RequestCancelFullPath(Uri baseUri, Guid guid) => new Uri(baseUri, Request + "/" + Request_Cancel + "?requestId=" + guid.ToString());
|
||||
public static Uri RequestCheckQueueFullPath(Uri baseUri, Guid guid) => new Uri(baseUri, Request + "/" + Request_Check + "?requestId=" + guid.ToString());
|
||||
public static Uri RequestEnqueueFullPath(Uri baseUri) => new(baseUri, Request + "/" + Request_Enqueue);
|
||||
public static Uri RequestRequestFileFullPath(Uri baseUri, string hash) => new(baseUri, Request + "/" + Request_RequestFile + "?file=" + hash);
|
||||
|
||||
public static Uri ServerFilesDeleteAllFullPath(Uri baseUri) => new(baseUri, ServerFiles + "/" + ServerFiles_DeleteAll);
|
||||
public static Uri ServerFilesFilesSendFullPath(Uri baseUri) => new(baseUri, ServerFiles + "/" + ServerFiles_FilesSend);
|
||||
public static Uri ServerFilesGetSizesFullPath(Uri baseUri) => new(baseUri, ServerFiles + "/" + ServerFiles_GetSizes);
|
||||
public static Uri ServerFilesUploadFullPath(Uri baseUri, string hash) => new(baseUri, ServerFiles + "/" + ServerFiles_Upload + "/" + hash);
|
||||
public static Uri ServerFilesUploadRawFullPath(Uri baseUri, string hash) => new(baseUri, ServerFiles + "/" + ServerFiles_UploadRaw + "/" + hash);
|
||||
public static Uri ServerFilesUploadMunged(Uri baseUri, string hash) => new(baseUri, ServerFiles + "/" + ServerFiles_UploadMunged + "/" + hash);
|
||||
|
||||
public static Uri DistributionGetFullPath(Uri baseUri, string hash) => new(baseUri, Distribution + "/" + Distribution_Get + "?file=" + hash);
|
||||
|
||||
public static Uri MainSendReadyFullPath(Uri baseUri, string uid, Guid request) => new(baseUri, Main + "/" + Main_SendReady + "/" + "?uid=" + uid + "&requestId=" + request.ToString());
|
||||
}
|
144
MareAPI/MareSynchronosAPI/SignalR/IMareHub.cs
Normal file
144
MareAPI/MareSynchronosAPI/SignalR/IMareHub.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MareSynchronos.API.Dto;
|
||||
using MareSynchronos.API.Dto.CharaData;
|
||||
using MareSynchronos.API.Dto.Chat;
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
using MareSynchronos.API.Dto.User;
|
||||
|
||||
namespace MareSynchronos.API.SignalR;
|
||||
|
||||
public interface IMareHub
|
||||
{
|
||||
const int ApiVersion = 1026;
|
||||
const string Path = "/mare";
|
||||
|
||||
Task<bool> CheckClientHealth();
|
||||
|
||||
Task Client_DownloadReady(Guid requestId);
|
||||
|
||||
Task Client_GroupChangePermissions(GroupPermissionDto groupPermission);
|
||||
|
||||
Task Client_GroupChatMsg(GroupChatMsgDto groupChatMsgDto);
|
||||
|
||||
Task Client_GroupDelete(GroupDto groupDto);
|
||||
|
||||
Task Client_GroupPairChangePermissions(GroupPairUserPermissionDto permissionDto);
|
||||
|
||||
Task Client_GroupPairChangeUserInfo(GroupPairUserInfoDto userInfo);
|
||||
|
||||
Task Client_GroupPairJoined(GroupPairFullInfoDto groupPairInfoDto);
|
||||
|
||||
Task Client_GroupPairLeft(GroupPairDto groupPairDto);
|
||||
|
||||
Task Client_GroupSendFullInfo(GroupFullInfoDto groupInfo);
|
||||
|
||||
Task Client_GroupSendInfo(GroupInfoDto groupInfo);
|
||||
|
||||
Task Client_ReceiveServerMessage(MessageSeverity messageSeverity, string message);
|
||||
|
||||
Task Client_UpdateSystemInfo(SystemInfoDto systemInfo);
|
||||
|
||||
Task Client_UserAddClientPair(UserPairDto dto);
|
||||
|
||||
Task Client_UserChatMsg(UserChatMsgDto chatMsgDto);
|
||||
|
||||
Task Client_UserReceiveCharacterData(OnlineUserCharaDataDto dataDto);
|
||||
|
||||
Task Client_UserReceiveUploadStatus(UserDto dto);
|
||||
|
||||
Task Client_UserRemoveClientPair(UserDto dto);
|
||||
|
||||
Task Client_UserSendOffline(UserDto dto);
|
||||
|
||||
Task Client_UserSendOnline(OnlineUserIdentDto dto);
|
||||
|
||||
Task Client_UserUpdateOtherPairPermissions(UserPermissionsDto dto);
|
||||
|
||||
Task Client_UserUpdateProfile(UserDto dto);
|
||||
|
||||
Task Client_UserUpdateSelfPairPermissions(UserPermissionsDto dto);
|
||||
|
||||
Task Client_GposeLobbyJoin(UserData userData);
|
||||
Task Client_GposeLobbyLeave(UserData userData);
|
||||
Task Client_GposeLobbyPushCharacterData(CharaDataDownloadDto charaDownloadDto);
|
||||
Task Client_GposeLobbyPushPoseData(UserData userData, PoseData poseData);
|
||||
Task Client_GposeLobbyPushWorldData(UserData userData, WorldData worldData);
|
||||
|
||||
Task<ConnectionDto> GetConnectionDto();
|
||||
|
||||
Task GroupBanUser(GroupPairDto dto, string reason);
|
||||
|
||||
Task GroupChangeGroupPermissionState(GroupPermissionDto dto);
|
||||
|
||||
Task GroupChangeIndividualPermissionState(GroupPairUserPermissionDto dto);
|
||||
|
||||
Task GroupChangeOwnership(GroupPairDto groupPair);
|
||||
|
||||
Task<bool> GroupChangePassword(GroupPasswordDto groupPassword);
|
||||
|
||||
Task GroupChatSendMsg(GroupDto group, ChatMessage message);
|
||||
|
||||
Task GroupClear(GroupDto group);
|
||||
|
||||
Task<GroupPasswordDto> GroupCreate();
|
||||
|
||||
Task<List<string>> GroupCreateTempInvite(GroupDto group, int amount);
|
||||
|
||||
Task GroupDelete(GroupDto group);
|
||||
|
||||
Task<List<BannedGroupUserDto>> GroupGetBannedUsers(GroupDto group);
|
||||
|
||||
Task<bool> GroupJoin(GroupPasswordDto passwordedGroup);
|
||||
|
||||
Task GroupLeave(GroupDto group);
|
||||
|
||||
Task GroupRemoveUser(GroupPairDto groupPair);
|
||||
|
||||
Task GroupSetUserInfo(GroupPairUserInfoDto groupPair);
|
||||
|
||||
Task<List<GroupFullInfoDto>> GroupsGetAll();
|
||||
|
||||
Task<List<GroupPairFullInfoDto>> GroupsGetUsersInGroup(GroupDto group);
|
||||
|
||||
Task GroupUnbanUser(GroupPairDto groupPair);
|
||||
Task<int> GroupPrune(GroupDto group, int days, bool execute);
|
||||
|
||||
Task UserAddPair(UserDto user);
|
||||
|
||||
Task UserChatSendMsg(UserDto user, ChatMessage message);
|
||||
|
||||
Task UserDelete();
|
||||
|
||||
Task<List<OnlineUserIdentDto>> UserGetOnlinePairs();
|
||||
|
||||
Task<List<UserPairDto>> UserGetPairedClients();
|
||||
|
||||
Task<UserProfileDto> UserGetProfile(UserDto dto);
|
||||
|
||||
Task UserPushData(UserCharaDataMessageDto dto);
|
||||
|
||||
Task UserRemovePair(UserDto userDto);
|
||||
|
||||
Task UserReportProfile(UserProfileReportDto userDto);
|
||||
|
||||
Task UserSetPairPermissions(UserPermissionsDto userPermissions);
|
||||
|
||||
Task UserSetProfile(UserProfileDto userDescription);
|
||||
|
||||
Task<CharaDataFullDto?> CharaDataCreate();
|
||||
Task<CharaDataFullDto?> CharaDataUpdate(CharaDataUpdateDto updateDto);
|
||||
Task<bool> CharaDataDelete(string id);
|
||||
Task<CharaDataMetaInfoDto?> CharaDataGetMetainfo(string id);
|
||||
Task<CharaDataDownloadDto?> CharaDataDownload(string id);
|
||||
Task<List<CharaDataFullDto>> CharaDataGetOwn();
|
||||
Task<List<CharaDataMetaInfoDto>> CharaDataGetShared();
|
||||
Task<CharaDataFullDto?> CharaDataAttemptRestore(string id);
|
||||
|
||||
Task<string> GposeLobbyCreate();
|
||||
Task<List<UserData>> GposeLobbyJoin(string lobbyId);
|
||||
Task<bool> GposeLobbyLeave();
|
||||
Task GposeLobbyPushCharacterData(CharaDataDownloadDto charaDownloadDto);
|
||||
Task GposeLobbyPushPoseData(PoseData poseData);
|
||||
Task GposeLobbyPushWorldData(WorldData worldData);
|
||||
}
|
62
MareAPI/MareSynchronosAPI/SignalR/IMareHubClient.cs
Normal file
62
MareAPI/MareSynchronosAPI/SignalR/IMareHubClient.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using MareSynchronos.API.Data;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MareSynchronos.API.Dto;
|
||||
using MareSynchronos.API.Dto.CharaData;
|
||||
using MareSynchronos.API.Dto.Chat;
|
||||
using MareSynchronos.API.Dto.Group;
|
||||
using MareSynchronos.API.Dto.User;
|
||||
|
||||
namespace MareSynchronos.API.SignalR;
|
||||
|
||||
public interface IMareHubClient : IMareHub
|
||||
{
|
||||
void OnDownloadReady(Action<Guid> act);
|
||||
|
||||
void OnGroupChangePermissions(Action<GroupPermissionDto> act);
|
||||
|
||||
void OnGroupChatMsg(Action<GroupChatMsgDto> groupChatMsgDto);
|
||||
|
||||
void OnGroupDelete(Action<GroupDto> act);
|
||||
|
||||
void OnGroupPairChangePermissions(Action<GroupPairUserPermissionDto> act);
|
||||
|
||||
void OnGroupPairChangeUserInfo(Action<GroupPairUserInfoDto> act);
|
||||
|
||||
void OnGroupPairJoined(Action<GroupPairFullInfoDto> act);
|
||||
|
||||
void OnGroupPairLeft(Action<GroupPairDto> act);
|
||||
|
||||
void OnGroupSendFullInfo(Action<GroupFullInfoDto> act);
|
||||
|
||||
void OnGroupSendInfo(Action<GroupInfoDto> act);
|
||||
|
||||
void OnReceiveServerMessage(Action<MessageSeverity, string> act);
|
||||
|
||||
void OnUpdateSystemInfo(Action<SystemInfoDto> act);
|
||||
|
||||
void OnUserAddClientPair(Action<UserPairDto> act);
|
||||
|
||||
void OnUserChatMsg(Action<UserChatMsgDto> chatMsgDto);
|
||||
|
||||
void OnUserReceiveCharacterData(Action<OnlineUserCharaDataDto> act);
|
||||
|
||||
void OnUserReceiveUploadStatus(Action<UserDto> act);
|
||||
|
||||
void OnUserRemoveClientPair(Action<UserDto> act);
|
||||
|
||||
void OnUserSendOffline(Action<UserDto> act);
|
||||
|
||||
void OnUserSendOnline(Action<OnlineUserIdentDto> act);
|
||||
|
||||
void OnUserUpdateOtherPairPermissions(Action<UserPermissionsDto> act);
|
||||
|
||||
void OnUserUpdateProfile(Action<UserDto> act);
|
||||
|
||||
void OnUserUpdateSelfPairPermissions(Action<UserPermissionsDto> act);
|
||||
|
||||
void OnGposeLobbyJoin(Action<UserData> act);
|
||||
void OnGposeLobbyLeave(Action<UserData> act);
|
||||
void OnGposeLobbyPushCharacterData(Action<CharaDataDownloadDto> act);
|
||||
void OnGposeLobbyPushPoseData(Action<UserData, PoseData> act);
|
||||
void OnGposeLobbyPushWorldData(Action<UserData, WorldData> act);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user