mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Move Game/Network files to the appropriate internal namespaces
Replace WebClient with HttpClient
This commit is contained in:
parent
81b31d71ac
commit
cb73a8f4b4
18 changed files with 375 additions and 117 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.Network;
|
||||
using Dalamud.Hooking;
|
||||
using Serilog;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using Dalamud.Game.Network.Structures;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface binding for the Universalis uploader.
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Network.Structures;
|
||||
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents a submission to a marketboard aggregation website.
|
||||
/// </summary>
|
||||
internal class MarketBoardItemRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount to arrive.
|
||||
/// </summary>
|
||||
public byte AmountToArrive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the offered item listings.
|
||||
/// </summary>
|
||||
public List<MarketBoardCurrentOfferings.MarketBoardItemListing> Listings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the historical item listings.
|
||||
/// </summary>
|
||||
public List<MarketBoardHistory.MarketBoardHistoryListing> History { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the listing request ID.
|
||||
/// </summary>
|
||||
public int ListingsRequestId { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the upload is complete.
|
||||
/// </summary>
|
||||
public bool IsDone => this.Listings.Count == this.AmountToArrive && this.History.Count != 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
|||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Request payload for market board purchases.
|
||||
/// </summary>
|
||||
public class UniversalisItemListingDeleteRequest
|
||||
internal class UniversalisItemListingDeleteRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the object ID of the retainer associated with the sale.
|
||||
|
|
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
|||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
|||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Game.Network.MarketBoardUploaders.Universalis
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A Universalis API structure.
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
using Dalamud.Game.Network.MarketBoardUploaders;
|
||||
using Dalamud.Game.Network.MarketBoardUploaders.Universalis;
|
||||
using Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types;
|
||||
using Dalamud.Game.Network.Structures;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
||||
namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents an uploader for contributing data to Universalis.
|
||||
|
|
@ -16,8 +17,8 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
internal class UniversalisMarketBoardUploader : IMarketBoardUploader
|
||||
{
|
||||
private const string ApiBase = "https://universalis.app";
|
||||
|
||||
// private const string ApiBase = "https://127.0.0.1:443";
|
||||
|
||||
private const string ApiKey = "GGD6RdSfGyRiHM5WDnAo0Nj9Nv7aC5NDhMj3BebT";
|
||||
|
||||
private readonly Dalamud dalamud;
|
||||
|
|
@ -34,14 +35,14 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
/// <inheritdoc/>
|
||||
public void Upload(MarketBoardItemRequest request)
|
||||
{
|
||||
using var client = new WebClient();
|
||||
|
||||
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
|
||||
using var client = new HttpClient();
|
||||
|
||||
Log.Verbose("Starting Universalis upload.");
|
||||
var uploader = this.dalamud.ClientState.LocalContentId;
|
||||
|
||||
var listingsRequestObject = new UniversalisItemListingsUploadRequest
|
||||
// ====================================================================================
|
||||
|
||||
var listingsUploadObject = new UniversalisItemListingsUploadRequest
|
||||
{
|
||||
WorldId = this.dalamud.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0,
|
||||
UploaderId = uploader.ToString(),
|
||||
|
|
@ -76,14 +77,17 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
});
|
||||
}
|
||||
|
||||
listingsRequestObject.Listings.Add(universalisListing);
|
||||
listingsUploadObject.Listings.Add(universalisListing);
|
||||
}
|
||||
|
||||
var upload = JsonConvert.SerializeObject(listingsRequestObject);
|
||||
Log.Verbose(upload);
|
||||
client.UploadString(ApiBase + $"/upload/{ApiKey}", "POST", upload);
|
||||
var listingPath = "/upload";
|
||||
var listingUpload = JsonConvert.SerializeObject(listingsUploadObject);
|
||||
Log.Verbose($"{listingPath}: {listingUpload}");
|
||||
client.PostAsync($"{ApiBase}{listingPath}/{ApiKey}", new StringContent(listingUpload, Encoding.UTF8, "application/json")).GetAwaiter().GetResult();
|
||||
|
||||
var historyRequestObject = new UniversalisHistoryUploadRequest
|
||||
// ====================================================================================
|
||||
|
||||
var historyUploadObject = new UniversalisHistoryUploadRequest
|
||||
{
|
||||
WorldId = this.dalamud.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0,
|
||||
UploaderId = uploader.ToString(),
|
||||
|
|
@ -93,7 +97,7 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
|
||||
foreach (var marketBoardHistoryListing in request.History)
|
||||
{
|
||||
historyRequestObject.Entries.Add(new UniversalisHistoryEntry
|
||||
historyUploadObject.Entries.Add(new UniversalisHistoryEntry
|
||||
{
|
||||
BuyerName = marketBoardHistoryListing.BuyerName,
|
||||
Hq = marketBoardHistoryListing.IsHq,
|
||||
|
|
@ -104,11 +108,12 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
});
|
||||
}
|
||||
|
||||
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
|
||||
var historyPath = "/upload";
|
||||
var historyUpload = JsonConvert.SerializeObject(historyUploadObject);
|
||||
Log.Verbose($"{historyPath}: {historyUpload}");
|
||||
client.PostAsync($"{ApiBase}{historyPath}/{ApiKey}", new StringContent(historyUpload, Encoding.UTF8, "application/json")).GetAwaiter().GetResult();
|
||||
|
||||
var historyUpload = JsonConvert.SerializeObject(historyRequestObject);
|
||||
Log.Verbose(historyUpload);
|
||||
client.UploadString(ApiBase + $"/upload/{ApiKey}", "POST", historyUpload);
|
||||
// ====================================================================================
|
||||
|
||||
Log.Verbose("Universalis data upload for item#{0} completed.", request.CatalogId);
|
||||
}
|
||||
|
|
@ -116,9 +121,11 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
/// <inheritdoc/>
|
||||
public void UploadTax(MarketTaxRates taxRates)
|
||||
{
|
||||
using var client = new WebClient();
|
||||
using var client = new HttpClient();
|
||||
|
||||
var taxRatesRequest = new UniversalisTaxUploadRequest
|
||||
// ====================================================================================
|
||||
|
||||
var taxUploadObject = new UniversalisTaxUploadRequest
|
||||
{
|
||||
WorldId = this.dalamud.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0,
|
||||
UploaderId = this.dalamud.ClientState.LocalContentId.ToString(),
|
||||
|
|
@ -133,26 +140,35 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
},
|
||||
};
|
||||
|
||||
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
|
||||
var taxPath = "/upload";
|
||||
var taxUpload = JsonConvert.SerializeObject(taxUploadObject);
|
||||
Log.Verbose($"{taxPath}: {taxUpload}");
|
||||
|
||||
var historyUpload = JsonConvert.SerializeObject(taxRatesRequest);
|
||||
Log.Verbose(historyUpload);
|
||||
client.UploadString(ApiBase + $"/upload/{ApiKey}", "POST", historyUpload);
|
||||
client.PostAsync($"{ApiBase}{taxPath}/{ApiKey}", new StringContent(taxUpload, Encoding.UTF8, "application/json")).GetAwaiter().GetResult();
|
||||
|
||||
// ====================================================================================
|
||||
|
||||
Log.Verbose("Universalis tax upload completed.");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <remarks>
|
||||
/// It may seem backwards that an upload only performs a delete request, however this is not trying
|
||||
/// to track the available listings, that is done via the listings packet. All this does is remove
|
||||
/// a listing, or delete it, when a purchase has been made.
|
||||
/// </remarks>
|
||||
public void UploadPurchase(MarketBoardPurchaseHandler purchaseHandler)
|
||||
{
|
||||
using var client = new WebClient();
|
||||
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
|
||||
client.Headers.Add(HttpRequestHeader.Authorization, ApiKey);
|
||||
using var client = new HttpClient();
|
||||
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ApiKey);
|
||||
|
||||
var itemId = purchaseHandler.CatalogId;
|
||||
var worldId = this.dalamud.ClientState.LocalPlayer?.CurrentWorld.Id ?? 0;
|
||||
|
||||
var purchaseRequest = new UniversalisItemListingDeleteRequest
|
||||
// ====================================================================================
|
||||
|
||||
var deleteListingObject = new UniversalisItemListingDeleteRequest
|
||||
{
|
||||
PricePerUnit = purchaseHandler.PricePerUnit,
|
||||
Quantity = purchaseHandler.ItemQuantity,
|
||||
|
|
@ -161,11 +177,13 @@ namespace Dalamud.Game.Network.Universalis.MarketBoardUploaders
|
|||
UploaderId = this.dalamud.ClientState.LocalContentId.ToString(),
|
||||
};
|
||||
|
||||
var requestPath = ApiBase + $"/api/{worldId}/{itemId}/delete";
|
||||
var purchaseUpload = JsonConvert.SerializeObject(purchaseRequest);
|
||||
Log.Verbose($"Making request to {requestPath}");
|
||||
Log.Verbose(purchaseUpload);
|
||||
client.UploadString(requestPath, "POST", purchaseUpload);
|
||||
var deletePath = $"/api/{worldId}/{itemId}/delete";
|
||||
var deleteListing = JsonConvert.SerializeObject(deleteListingObject);
|
||||
Log.Verbose($"{deletePath}: {deleteListing}");
|
||||
|
||||
client.PostAsync($"{ApiBase}{deletePath}", new StringContent(deleteListing, Encoding.UTF8, "application/json")).GetAwaiter().GetResult();
|
||||
|
||||
// ====================================================================================
|
||||
|
||||
Log.Verbose("Universalis purchase upload completed.");
|
||||
}
|
||||
|
|
@ -5,14 +5,13 @@ using System.Linq;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Game.Internal.Network;
|
||||
using Dalamud.Game.Network.MarketBoardUploaders;
|
||||
using Dalamud.Game.Network.Internal.MarketBoardUploaders;
|
||||
using Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis;
|
||||
using Dalamud.Game.Network.Structures;
|
||||
using Dalamud.Game.Network.Universalis.MarketBoardUploaders;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.Network
|
||||
namespace Dalamud.Game.Network.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// This class handles network notifications and uploading market board data.
|
||||
|
|
@ -141,7 +140,7 @@ namespace Dalamud.Game.Network
|
|||
|
||||
var request = this.marketBoardRequests.LastOrDefault(r => r.CatalogId == listing.ItemListings[0].CatalogId && !r.IsDone);
|
||||
|
||||
if (request == null)
|
||||
if (request == default)
|
||||
{
|
||||
Log.Error($"Market Board data arrived without a corresponding request: item#{listing.ItemListings[0].CatalogId}");
|
||||
return;
|
||||
|
|
@ -207,17 +206,15 @@ namespace Dalamud.Game.Network
|
|||
|
||||
var request = this.marketBoardRequests.LastOrDefault(r => r.CatalogId == listing.CatalogId);
|
||||
|
||||
if (request == null)
|
||||
if (request == default)
|
||||
{
|
||||
Log.Error(
|
||||
$"Market Board data arrived without a corresponding request: item#{listing.CatalogId}");
|
||||
Log.Error($"Market Board data arrived without a corresponding request: item#{listing.CatalogId}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.ListingsRequestId != -1)
|
||||
{
|
||||
Log.Error(
|
||||
$"Market Board data history sequence break: {request.ListingsRequestId}, {request.Listings.Count}");
|
||||
Log.Error($"Market Board data history sequence break: {request.ListingsRequestId}, {request.Listings.Count}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -243,6 +240,7 @@ namespace Dalamud.Game.Network
|
|||
if (opCode == this.dalamud.Data.ServerOpCodes["MarketTaxRates"])
|
||||
{
|
||||
var category = (uint)Marshal.ReadInt32(dataPtr);
|
||||
|
||||
// Result dialog packet does not contain market tax rates
|
||||
if (category != 720905)
|
||||
{
|
||||
|
|
@ -279,9 +277,9 @@ namespace Dalamud.Game.Network
|
|||
// Transaction succeeded
|
||||
if (purchase.ItemQuantity == this.marketBoardPurchaseHandler.ItemQuantity
|
||||
&& (purchase.CatalogId == this.marketBoardPurchaseHandler.CatalogId
|
||||
|| purchase.CatalogId == this.marketBoardPurchaseHandler.CatalogId + 1000000))
|
||||
|| purchase.CatalogId == this.marketBoardPurchaseHandler.CatalogId + 1_000_000))
|
||||
{ // HQ
|
||||
Log.Information("Bought " + purchase.ItemQuantity + "x " + this.marketBoardPurchaseHandler.CatalogId + " for " + (this.marketBoardPurchaseHandler.PricePerUnit * purchase.ItemQuantity) + " gils, listing id is " + this.marketBoardPurchaseHandler.ListingId);
|
||||
Log.Verbose($"Bought {purchase.ItemQuantity}x {this.marketBoardPurchaseHandler.CatalogId} for {this.marketBoardPurchaseHandler.PricePerUnit * purchase.ItemQuantity} gils, listing id is {this.marketBoardPurchaseHandler.ListingId}");
|
||||
var handler = this.marketBoardPurchaseHandler; // Capture the object so that we don't pass in a null one when the task starts.
|
||||
Task.Run(() => this.uploader.UploadPurchase(handler));
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Network.Structures;
|
||||
|
||||
namespace Dalamud.Game.Network
|
||||
{
|
||||
internal class MarketBoardItemRequest
|
||||
{
|
||||
public uint CatalogId { get; set; }
|
||||
|
||||
public byte AmountToArrive { get; set; }
|
||||
|
||||
public List<MarketBoardCurrentOfferings.MarketBoardItemListing> Listings { get; set; }
|
||||
|
||||
public List<MarketBoardHistory.MarketBoardHistoryListing> History { get; set; }
|
||||
|
||||
public int ListingsRequestId { get; set; } = -1;
|
||||
|
||||
public bool IsDone => this.Listings.Count == this.AmountToArrive && this.History.Count != 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Dalamud.Game.Internal.Network
|
||||
namespace Dalamud.Game.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents the direction of a network message.
|
||||
|
|
@ -5,14 +5,43 @@ using System.Text;
|
|||
|
||||
namespace Dalamud.Game.Network.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the current market board offerings from a game network packet.
|
||||
/// </summary>
|
||||
public class MarketBoardCurrentOfferings
|
||||
{
|
||||
public List<MarketBoardItemListing> ItemListings;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MarketBoardCurrentOfferings"/> class.
|
||||
/// </summary>
|
||||
internal MarketBoardCurrentOfferings()
|
||||
{
|
||||
}
|
||||
|
||||
public int ListingIndexEnd;
|
||||
public int ListingIndexStart;
|
||||
public int RequestId;
|
||||
/// <summary>
|
||||
/// Gets the list of individual item listings.
|
||||
/// </summary>
|
||||
public List<MarketBoardItemListing> ItemListings { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the listing end index.
|
||||
/// </summary>
|
||||
public int ListingIndexEnd { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the listing start index.
|
||||
/// </summary>
|
||||
public int ListingIndexStart { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the request ID.
|
||||
/// </summary>
|
||||
public int RequestId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Read a <see cref="MarketBoardCurrentOfferings"/> object from memory.
|
||||
/// </summary>
|
||||
/// <param name="dataPtr">Address to read.</param>
|
||||
/// <returns>A new <see cref="MarketBoardCurrentOfferings"/> object.</returns>
|
||||
public static unsafe MarketBoardCurrentOfferings Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketBoardCurrentOfferings();
|
||||
|
|
@ -80,32 +109,124 @@ namespace Dalamud.Game.Network.Structures
|
|||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class represents the current market board offering of a single item from the <see cref="MarketBoardCurrentOfferings"/> network packet.
|
||||
/// </summary>
|
||||
public class MarketBoardItemListing
|
||||
{
|
||||
public ulong ArtisanId;
|
||||
public uint CatalogId;
|
||||
public bool IsHq;
|
||||
public uint ItemQuantity;
|
||||
public DateTime LastReviewTime;
|
||||
public ulong ListingId;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MarketBoardItemListing"/> class.
|
||||
/// </summary>
|
||||
internal MarketBoardItemListing()
|
||||
{
|
||||
}
|
||||
|
||||
public List<ItemMateria> Materia;
|
||||
public int MateriaCount;
|
||||
public bool OnMannequin;
|
||||
public string PlayerName;
|
||||
public uint PricePerUnit;
|
||||
public int RetainerCityId;
|
||||
public ulong RetainerId;
|
||||
/// <summary>
|
||||
/// Gets the artisan ID.
|
||||
/// </summary>
|
||||
public ulong ArtisanId { get; internal set; }
|
||||
|
||||
public string RetainerName;
|
||||
public ulong RetainerOwnerId;
|
||||
public int StainId;
|
||||
public uint TotalTax;
|
||||
/// <summary>
|
||||
/// Gets the catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the item is HQ.
|
||||
/// </summary>
|
||||
public bool IsHq { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item quantity.
|
||||
/// </summary>
|
||||
public uint ItemQuantity { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time this offering was last reviewed.
|
||||
/// </summary>
|
||||
public DateTime LastReviewTime { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the listing ID.
|
||||
/// </summary>
|
||||
public ulong ListingId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of materia attached to this item.
|
||||
/// </summary>
|
||||
public List<ItemMateria> Materia { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of attached materia.
|
||||
/// </summary>
|
||||
public int MateriaCount { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this item is on a mannequin.
|
||||
/// </summary>
|
||||
public bool OnMannequin { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player name.
|
||||
/// </summary>
|
||||
public string PlayerName { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the price per unit.
|
||||
/// </summary>
|
||||
public uint PricePerUnit { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the city ID of the retainer selling the item.
|
||||
/// </summary>
|
||||
public int RetainerCityId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ID of the retainer selling the item.
|
||||
/// </summary>
|
||||
public ulong RetainerId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the retainer.
|
||||
/// </summary>
|
||||
public string RetainerName { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ID of the retainer's owner.
|
||||
/// </summary>
|
||||
public ulong RetainerOwnerId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the stain or applied dye of the item.
|
||||
/// </summary>
|
||||
public int StainId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total tax.
|
||||
/// </summary>
|
||||
public uint TotalTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// This represents the materia slotted to an <see cref="MarketBoardItemListing"/>.
|
||||
/// </summary>
|
||||
public class ItemMateria
|
||||
{
|
||||
public int Index;
|
||||
public int MateriaId;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ItemMateria"/> class.
|
||||
/// </summary>
|
||||
internal ItemMateria()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the materia index.
|
||||
/// </summary>
|
||||
public int Index { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the materia ID.
|
||||
/// </summary>
|
||||
public int MateriaId { get; internal set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,38 @@ using System.Text;
|
|||
|
||||
namespace Dalamud.Game.Network.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the market board history from a game network packet.
|
||||
/// </summary>
|
||||
public class MarketBoardHistory
|
||||
{
|
||||
public uint CatalogId;
|
||||
public uint CatalogId2;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MarketBoardHistory"/> class.
|
||||
/// </summary>
|
||||
internal MarketBoardHistory()
|
||||
{
|
||||
}
|
||||
|
||||
public List<MarketBoardHistoryListing> HistoryListings;
|
||||
/// <summary>
|
||||
/// Gets the catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the second catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId2 { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of individual item history listings.
|
||||
/// </summary>
|
||||
public List<MarketBoardHistoryListing> HistoryListings { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Read a <see cref="MarketBoardHistory"/> object from memory.
|
||||
/// </summary>
|
||||
/// <param name="dataPtr">Address to read.</param>
|
||||
/// <returns>A new <see cref="MarketBoardHistory"/> object.</returns>
|
||||
public static unsafe MarketBoardHistory Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketBoardHistory();
|
||||
|
|
@ -47,16 +72,52 @@ namespace Dalamud.Game.Network.Structures
|
|||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class represents the market board history of a single item from the <see cref="MarketBoardHistory"/> network packet.
|
||||
/// </summary>
|
||||
public class MarketBoardHistoryListing
|
||||
{
|
||||
public string BuyerName;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MarketBoardHistoryListing"/> class.
|
||||
/// </summary>
|
||||
internal MarketBoardHistoryListing()
|
||||
{
|
||||
}
|
||||
|
||||
public uint CatalogId;
|
||||
public bool IsHq;
|
||||
public bool OnMannequin;
|
||||
public DateTime PurchaseTime;
|
||||
public uint Quantity;
|
||||
public uint SalePrice;
|
||||
/// <summary>
|
||||
/// Gets the buyer's name.
|
||||
/// </summary>
|
||||
public string BuyerName { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the item is HQ.
|
||||
/// </summary>
|
||||
public bool IsHq { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the item is on a mannequin.
|
||||
/// </summary>
|
||||
public bool OnMannequin { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time of purchase.
|
||||
/// </summary>
|
||||
public DateTime PurchaseTime { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the quantity.
|
||||
/// </summary>
|
||||
public uint Quantity { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sale price.
|
||||
/// </summary>
|
||||
public uint SalePrice { get; internal set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,53 @@ using System.IO;
|
|||
|
||||
namespace Dalamud.Game.Network.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the market tax rates from a game network packet.
|
||||
/// </summary>
|
||||
public class MarketTaxRates
|
||||
{
|
||||
public uint LimsaLominsaTax;
|
||||
public uint GridaniaTax;
|
||||
public uint UldahTax;
|
||||
public uint IshgardTax;
|
||||
public uint KuganeTax;
|
||||
public uint CrystariumTax;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MarketTaxRates"/> class.
|
||||
/// </summary>
|
||||
internal MarketTaxRates()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Limsa Lominsa.
|
||||
/// </summary>
|
||||
public uint LimsaLominsaTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Gridania.
|
||||
/// </summary>
|
||||
public uint GridaniaTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Ul'dah.
|
||||
/// </summary>
|
||||
public uint UldahTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Ishgard.
|
||||
/// </summary>
|
||||
public uint IshgardTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Kugane.
|
||||
/// </summary>
|
||||
public uint KuganeTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in the Crystarium.
|
||||
/// </summary>
|
||||
public uint CrystariumTax { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Read a <see cref="MarketTaxRates"/> object from memory.
|
||||
/// </summary>
|
||||
/// <param name="dataPtr">Address to read.</param>
|
||||
/// <returns>A new <see cref="MarketTaxRates"/> object.</returns>
|
||||
public static unsafe MarketTaxRates Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketTaxRates();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue