Add MarketBoard service and associated interfaces, test and data widget (#1822)

* Add MarketBoard service and associated interfaces, test and data widget
* Dispose of events properly
* Make listings readonly lists + provide internal list for internal use
* Rename CatalogId to ItemId on interfaces, have kept CatalogId internally as it's technically correct
* Removed RetainerOwnerId from the public interface
* Removed NextCatalogId from the public interface
* Updated test text
* Null events in scoped service disposal
This commit is contained in:
Blair 2024-06-17 03:40:48 +10:00 committed by GitHub
parent a35ae5fdf3
commit e160746d42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1131 additions and 27 deletions

View file

@ -0,0 +1,64 @@
namespace Dalamud.Plugin.Services;
using Game.Network.Structures;
/// <summary>
/// Provides access to market board related events as the client receives/sends them.
/// </summary>
public interface IMarketBoard
{
/// <summary>
/// A delegate type used with the <see cref="HistoryReceived"/> event.
/// </summary>
/// <param name="history">The historical listings for a particular item on the market board.</param>
public delegate void HistoryReceivedDelegate(IMarketBoardHistory history);
/// <summary>
/// A delegate type used with the <see cref="ItemPurchased"/> event.
/// </summary>
/// <param name="purchase">The item that has been purchased.</param>
public delegate void ItemPurchasedDelegate(IMarketBoardPurchase purchase);
/// <summary>
/// A delegate type used with the <see cref="OfferingsReceived"/> event.
/// </summary>
/// <param name="currentOfferings">The current offerings for a particular item on the market board.</param>
public delegate void OfferingsReceivedDelegate(IMarketBoardCurrentOfferings currentOfferings);
/// <summary>
/// A delegate type used with the <see cref="PurchaseRequested"/> event.
/// </summary>
/// <param name="purchaseRequested">The details about the item being purchased.</param>
public delegate void PurchaseRequestedDelegate(IMarketBoardPurchaseHandler purchaseRequested);
/// <summary>
/// A delegate type used with the <see cref="PurchaseRequested"/> event.
/// </summary>
/// <param name="taxRates">The new tax rates.</param>
public delegate void TaxRatesReceivedDelegate(IMarketTaxRates taxRates);
/// <summary>
/// Event that fires when historical sale listings are received for a specific item on the market board.
/// </summary>
public event HistoryReceivedDelegate HistoryReceived;
/// <summary>
/// Event that fires when a item is purchased on the market board.
/// </summary>
public event ItemPurchasedDelegate ItemPurchased;
/// <summary>
/// Event that fires when current offerings are received for a specific item on the market board.
/// </summary>
public event OfferingsReceivedDelegate OfferingsReceived;
/// <summary>
/// Event that fires when a player requests to purchase an item from the market board.
/// </summary>
public event PurchaseRequestedDelegate PurchaseRequested;
/// <summary>
/// Event that fires when the client receives new tax rates. These events only occur when accessing a retainer vocate and requesting the tax rates.
/// </summary>
public event TaxRatesReceivedDelegate TaxRatesReceived;
}