mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 05:43:40 +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.IO;
|
||||
|
||||
using Dalamud.Game.Network.Structures;
|
||||
|
||||
|
|
@ -9,25 +11,29 @@ namespace Dalamud.Game.Network.Internal.MarketBoardUploaders
|
|||
/// </summary>
|
||||
internal class MarketBoardItemRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; set; }
|
||||
private MarketBoardItemRequest()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount to arrive.
|
||||
/// Gets the catalog ID.
|
||||
/// </summary>
|
||||
public byte AmountToArrive { get; set; }
|
||||
public uint CatalogId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the offered item listings.
|
||||
/// Gets the amount to arrive.
|
||||
/// </summary>
|
||||
public List<MarketBoardCurrentOfferings.MarketBoardItemListing> Listings { get; set; }
|
||||
public byte AmountToArrive { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the historical item listings.
|
||||
/// Gets the offered item listings.
|
||||
/// </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>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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>
|
||||
/// Gets the catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; internal set; }
|
||||
public uint CatalogId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the second catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId2 { get; internal set; }
|
||||
public uint CatalogId2 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of individual item history listings.
|
||||
/// </summary>
|
||||
public List<MarketBoardHistoryListing> HistoryListings { get; internal set; }
|
||||
public List<MarketBoardHistoryListing> HistoryListings { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public static unsafe MarketBoardHistory Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketBoardHistory();
|
||||
|
||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||
using var reader = new BinaryReader(stream);
|
||||
|
||||
var output = new MarketBoardHistory();
|
||||
|
||||
output.CatalogId = reader.ReadUInt32();
|
||||
output.CatalogId2 = reader.ReadUInt32();
|
||||
|
||||
output.HistoryListings = new List<MarketBoardHistoryListing>();
|
||||
|
||||
for (var i = 0; i < 10; i++)
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
var listingEntry = new MarketBoardHistoryListing
|
||||
{
|
||||
|
|
@ -63,10 +61,12 @@ namespace Dalamud.Game.Network.Structures
|
|||
|
||||
listingEntry.OnMannequin = reader.ReadBoolean();
|
||||
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;
|
||||
|
|
@ -90,9 +90,9 @@ namespace Dalamud.Game.Network.Structures
|
|||
public string BuyerName { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the catalog ID.
|
||||
/// Gets the next entry's catalog ID.
|
||||
/// </summary>
|
||||
public uint CatalogId { get; internal set; }
|
||||
public uint NextCatalogId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the item is HQ.
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ namespace Dalamud.Game.Network.Structures
|
|||
/// </summary>
|
||||
internal class MarketBoardPurchase
|
||||
{
|
||||
private MarketBoardPurchase()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the item ID of the item that was purchased.
|
||||
/// </summary>
|
||||
|
|
@ -26,10 +30,11 @@ namespace Dalamud.Game.Network.Structures
|
|||
/// <returns>An object representing the data read.</returns>
|
||||
public static unsafe MarketBoardPurchase Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketBoardPurchase();
|
||||
|
||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||
using var reader = new BinaryReader(stream);
|
||||
|
||||
var output = new MarketBoardPurchase();
|
||||
|
||||
output.CatalogId = reader.ReadUInt32();
|
||||
stream.Position += 4;
|
||||
output.ItemQuantity = reader.ReadUInt32();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ namespace Dalamud.Game.Network.Structures
|
|||
/// </summary>
|
||||
internal class MarketBoardPurchaseHandler
|
||||
{
|
||||
private MarketBoardPurchaseHandler()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object ID of the retainer associated with the sale.
|
||||
/// </summary>
|
||||
|
|
@ -41,10 +45,11 @@ namespace Dalamud.Game.Network.Structures
|
|||
/// <returns>An object representing the data read.</returns>
|
||||
public static unsafe MarketBoardPurchaseHandler Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketBoardPurchaseHandler();
|
||||
|
||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||
using var reader = new BinaryReader(stream);
|
||||
|
||||
var output = new MarketBoardPurchaseHandler();
|
||||
|
||||
output.RetainerId = reader.ReadUInt64();
|
||||
output.ListingId = reader.ReadUInt64();
|
||||
output.CatalogId = reader.ReadUInt32();
|
||||
|
|
|
|||
|
|
@ -8,42 +8,39 @@ namespace Dalamud.Game.Network.Structures
|
|||
/// </summary>
|
||||
public class MarketTaxRates
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MarketTaxRates"/> class.
|
||||
/// </summary>
|
||||
internal MarketTaxRates()
|
||||
private MarketTaxRates()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Limsa Lominsa.
|
||||
/// </summary>
|
||||
public uint LimsaLominsaTax { get; internal set; }
|
||||
public uint LimsaLominsaTax { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Gridania.
|
||||
/// </summary>
|
||||
public uint GridaniaTax { get; internal set; }
|
||||
public uint GridaniaTax { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Ul'dah.
|
||||
/// </summary>
|
||||
public uint UldahTax { get; internal set; }
|
||||
public uint UldahTax { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Ishgard.
|
||||
/// </summary>
|
||||
public uint IshgardTax { get; internal set; }
|
||||
public uint IshgardTax { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in Kugane.
|
||||
/// </summary>
|
||||
public uint KuganeTax { get; internal set; }
|
||||
public uint KuganeTax { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tax rate in the Crystarium.
|
||||
/// </summary>
|
||||
public uint CrystariumTax { get; internal set; }
|
||||
public uint CrystariumTax { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public static unsafe MarketTaxRates Read(IntPtr dataPtr)
|
||||
{
|
||||
var output = new MarketTaxRates();
|
||||
|
||||
using var stream = new UnmanagedMemoryStream((byte*)dataPtr.ToPointer(), 1544);
|
||||
using var reader = new BinaryReader(stream);
|
||||
|
||||
stream.Position += 8;
|
||||
var output = new MarketTaxRates();
|
||||
|
||||
stream.Position += 8;
|
||||
output.LimsaLominsaTax = reader.ReadUInt32();
|
||||
output.GridaniaTax = reader.ReadUInt32();
|
||||
output.UldahTax = reader.ReadUInt32();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue