mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-23 16:27:44 +01:00
More marketboard work, fix 10 instead of 20 history items
This commit is contained in:
parent
042558aa5e
commit
d180ed005c
5 changed files with 71 additions and 40 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
using Dalamud.Game.Network.Structures;
|
using Dalamud.Game.Network.Structures;
|
||||||
|
|
||||||
|
|
@ -9,25 +11,29 @@ namespace Dalamud.Game.Network.Internal.MarketBoardUploaders
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MarketBoardItemRequest
|
internal class MarketBoardItemRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
private MarketBoardItemRequest()
|
||||||
/// Gets or sets the catalog ID.
|
{
|
||||||
/// </summary>
|
}
|
||||||
public uint CatalogId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the amount to arrive.
|
/// Gets the catalog ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte AmountToArrive { get; set; }
|
public uint CatalogId { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the offered item listings.
|
/// Gets the amount to arrive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<MarketBoardCurrentOfferings.MarketBoardItemListing> Listings { get; set; }
|
public byte AmountToArrive { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the historical item listings.
|
/// Gets the offered item listings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<MarketBoardHistory.MarketBoardHistoryListing> History { get; set; }
|
public List<MarketBoardCurrentOfferings.MarketBoardItemListing> Listings { get; } = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the historical item listings.
|
||||||
|
/// </summary>
|
||||||
|
public List<MarketBoardHistory.MarketBoardHistoryListing> History { get; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the listing request ID.
|
/// Gets or sets the listing request ID.
|
||||||
|
|
@ -38,5 +44,24 @@ namespace Dalamud.Game.Network.Internal.MarketBoardUploaders
|
||||||
/// Gets a value indicating whether the upload is complete.
|
/// Gets a value indicating whether the upload is complete.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDone => this.Listings.Count == this.AmountToArrive && this.History.Count != 0;
|
public bool IsDone => this.Listings.Count == this.AmountToArrive && this.History.Count != 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read a packet off the wire.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataPtr">Packet data.</param>
|
||||||
|
/// <returns>An object representing the data read.</returns>
|
||||||
|
public static unsafe MarketBoardItemRequest Read(IntPtr dataPtr)
|
||||||
|
{
|
||||||
|
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||||
|
using var reader = new BinaryReader(stream);
|
||||||
|
|
||||||
|
var output = new MarketBoardItemRequest();
|
||||||
|
|
||||||
|
output.CatalogId = reader.ReadUInt32();
|
||||||
|
stream.Position += 0x7;
|
||||||
|
output.AmountToArrive = reader.ReadByte();
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,17 +20,17 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the catalog ID.
|
/// Gets the catalog ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint CatalogId { get; internal set; }
|
public uint CatalogId { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the second catalog ID.
|
/// Gets the second catalog ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint CatalogId2 { get; internal set; }
|
public uint CatalogId2 { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of individual item history listings.
|
/// Gets the list of individual item history listings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<MarketBoardHistoryListing> HistoryListings { get; internal set; }
|
public List<MarketBoardHistoryListing> HistoryListings { get; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a <see cref="MarketBoardHistory"/> object from memory.
|
/// Read a <see cref="MarketBoardHistory"/> object from memory.
|
||||||
|
|
@ -39,17 +39,15 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// <returns>A new <see cref="MarketBoardHistory"/> object.</returns>
|
/// <returns>A new <see cref="MarketBoardHistory"/> object.</returns>
|
||||||
public static unsafe MarketBoardHistory Read(IntPtr dataPtr)
|
public static unsafe MarketBoardHistory Read(IntPtr dataPtr)
|
||||||
{
|
{
|
||||||
var output = new MarketBoardHistory();
|
|
||||||
|
|
||||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||||
using var reader = new BinaryReader(stream);
|
using var reader = new BinaryReader(stream);
|
||||||
|
|
||||||
|
var output = new MarketBoardHistory();
|
||||||
|
|
||||||
output.CatalogId = reader.ReadUInt32();
|
output.CatalogId = reader.ReadUInt32();
|
||||||
output.CatalogId2 = reader.ReadUInt32();
|
output.CatalogId2 = reader.ReadUInt32();
|
||||||
|
|
||||||
output.HistoryListings = new List<MarketBoardHistoryListing>();
|
for (var i = 0; i < 20; i++)
|
||||||
|
|
||||||
for (var i = 0; i < 10; i++)
|
|
||||||
{
|
{
|
||||||
var listingEntry = new MarketBoardHistoryListing
|
var listingEntry = new MarketBoardHistoryListing
|
||||||
{
|
{
|
||||||
|
|
@ -63,10 +61,12 @@ namespace Dalamud.Game.Network.Structures
|
||||||
|
|
||||||
listingEntry.OnMannequin = reader.ReadBoolean();
|
listingEntry.OnMannequin = reader.ReadBoolean();
|
||||||
listingEntry.BuyerName = Encoding.UTF8.GetString(reader.ReadBytes(33)).TrimEnd('\u0000');
|
listingEntry.BuyerName = Encoding.UTF8.GetString(reader.ReadBytes(33)).TrimEnd('\u0000');
|
||||||
listingEntry.CatalogId = reader.ReadUInt32();
|
listingEntry.NextCatalogId = reader.ReadUInt32();
|
||||||
|
|
||||||
if (listingEntry.CatalogId != 0)
|
output.HistoryListings.Add(listingEntry);
|
||||||
output.HistoryListings.Add(listingEntry);
|
|
||||||
|
if (listingEntry.NextCatalogId == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
@ -90,9 +90,9 @@ namespace Dalamud.Game.Network.Structures
|
||||||
public string BuyerName { get; internal set; }
|
public string BuyerName { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the catalog ID.
|
/// Gets the next entry's catalog ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint CatalogId { get; internal set; }
|
public uint NextCatalogId { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the item is HQ.
|
/// Gets a value indicating whether the item is HQ.
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MarketBoardPurchase
|
internal class MarketBoardPurchase
|
||||||
{
|
{
|
||||||
|
private MarketBoardPurchase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item ID of the item that was purchased.
|
/// Gets the item ID of the item that was purchased.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -26,10 +30,11 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// <returns>An object representing the data read.</returns>
|
/// <returns>An object representing the data read.</returns>
|
||||||
public static unsafe MarketBoardPurchase Read(IntPtr dataPtr)
|
public static unsafe MarketBoardPurchase Read(IntPtr dataPtr)
|
||||||
{
|
{
|
||||||
var output = new MarketBoardPurchase();
|
|
||||||
|
|
||||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||||
using var reader = new BinaryReader(stream);
|
using var reader = new BinaryReader(stream);
|
||||||
|
|
||||||
|
var output = new MarketBoardPurchase();
|
||||||
|
|
||||||
output.CatalogId = reader.ReadUInt32();
|
output.CatalogId = reader.ReadUInt32();
|
||||||
stream.Position += 4;
|
stream.Position += 4;
|
||||||
output.ItemQuantity = reader.ReadUInt32();
|
output.ItemQuantity = reader.ReadUInt32();
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MarketBoardPurchaseHandler
|
internal class MarketBoardPurchaseHandler
|
||||||
{
|
{
|
||||||
|
private MarketBoardPurchaseHandler()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the object ID of the retainer associated with the sale.
|
/// Gets the object ID of the retainer associated with the sale.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -41,10 +45,11 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// <returns>An object representing the data read.</returns>
|
/// <returns>An object representing the data read.</returns>
|
||||||
public static unsafe MarketBoardPurchaseHandler Read(IntPtr dataPtr)
|
public static unsafe MarketBoardPurchaseHandler Read(IntPtr dataPtr)
|
||||||
{
|
{
|
||||||
var output = new MarketBoardPurchaseHandler();
|
|
||||||
|
|
||||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||||
using var reader = new BinaryReader(stream);
|
using var reader = new BinaryReader(stream);
|
||||||
|
|
||||||
|
var output = new MarketBoardPurchaseHandler();
|
||||||
|
|
||||||
output.RetainerId = reader.ReadUInt64();
|
output.RetainerId = reader.ReadUInt64();
|
||||||
output.ListingId = reader.ReadUInt64();
|
output.ListingId = reader.ReadUInt64();
|
||||||
output.CatalogId = reader.ReadUInt32();
|
output.CatalogId = reader.ReadUInt32();
|
||||||
|
|
|
||||||
|
|
@ -8,42 +8,39 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MarketTaxRates
|
public class MarketTaxRates
|
||||||
{
|
{
|
||||||
/// <summary>
|
private MarketTaxRates()
|
||||||
/// Initializes a new instance of the <see cref="MarketTaxRates"/> class.
|
|
||||||
/// </summary>
|
|
||||||
internal MarketTaxRates()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Limsa Lominsa.
|
/// Gets the tax rate in Limsa Lominsa.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint LimsaLominsaTax { get; internal set; }
|
public uint LimsaLominsaTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Gridania.
|
/// Gets the tax rate in Gridania.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint GridaniaTax { get; internal set; }
|
public uint GridaniaTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Ul'dah.
|
/// Gets the tax rate in Ul'dah.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint UldahTax { get; internal set; }
|
public uint UldahTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Ishgard.
|
/// Gets the tax rate in Ishgard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint IshgardTax { get; internal set; }
|
public uint IshgardTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Kugane.
|
/// Gets the tax rate in Kugane.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint KuganeTax { get; internal set; }
|
public uint KuganeTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in the Crystarium.
|
/// Gets the tax rate in the Crystarium.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint CrystariumTax { get; internal set; }
|
public uint CrystariumTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a <see cref="MarketTaxRates"/> object from memory.
|
/// Read a <see cref="MarketTaxRates"/> object from memory.
|
||||||
|
|
@ -52,13 +49,12 @@ namespace Dalamud.Game.Network.Structures
|
||||||
/// <returns>A new <see cref="MarketTaxRates"/> object.</returns>
|
/// <returns>A new <see cref="MarketTaxRates"/> object.</returns>
|
||||||
public static unsafe MarketTaxRates Read(IntPtr dataPtr)
|
public static unsafe MarketTaxRates Read(IntPtr dataPtr)
|
||||||
{
|
{
|
||||||
var output = new MarketTaxRates();
|
|
||||||
|
|
||||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||||
using var reader = new BinaryReader(stream);
|
using var reader = new BinaryReader(stream);
|
||||||
|
|
||||||
stream.Position += 8;
|
var output = new MarketTaxRates();
|
||||||
|
|
||||||
|
stream.Position += 8;
|
||||||
output.LimsaLominsaTax = reader.ReadUInt32();
|
output.LimsaLominsaTax = reader.ReadUInt32();
|
||||||
output.GridaniaTax = reader.ReadUInt32();
|
output.GridaniaTax = reader.ReadUInt32();
|
||||||
output.UldahTax = reader.ReadUInt32();
|
output.UldahTax = reader.ReadUInt32();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue