mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 23:07:43 +01:00
Update MarketBoard related packet structs (#1868)
* Update MarketBoardHistory * Update MarketBoardCurrentOfferings * small fix * Update other structs & update widget * Mark obsolete fields as internal
This commit is contained in:
parent
41e3803787
commit
3e950b09fe
11 changed files with 187 additions and 147 deletions
|
|
@ -12,20 +12,10 @@ public interface IMarketBoardCurrentOfferings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IReadOnlyList<IMarketBoardItemListing> ItemListings { get; }
|
IReadOnlyList<IMarketBoardItemListing> ItemListings { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the listing end index.
|
|
||||||
/// </summary>
|
|
||||||
int ListingIndexEnd { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the listing start index.
|
|
||||||
/// </summary>
|
|
||||||
int ListingIndexStart { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the request ID.
|
/// Gets the request ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int RequestId { get; }
|
public int RequestId { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -36,82 +26,77 @@ public interface IMarketBoardItemListing
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the artisan ID.
|
/// Gets the artisan ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ulong ArtisanId { get; }
|
public ulong ArtisanId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item ID.
|
/// Gets the item ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint ItemId { get; }
|
public uint ItemId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the item is HQ.
|
/// Gets a value indicating whether the item is HQ.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsHq { get; }
|
public bool IsHq { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item quantity.
|
/// Gets the item quantity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint ItemQuantity { get; }
|
public uint ItemQuantity { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the time this offering was last reviewed.
|
|
||||||
/// </summary>
|
|
||||||
DateTime LastReviewTime { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the listing ID.
|
/// Gets the listing ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ulong ListingId { get; }
|
public ulong ListingId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of materia attached to this item.
|
/// Gets the list of materia attached to this item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IReadOnlyList<IItemMateria> Materia { get; }
|
public IReadOnlyList<IItemMateria> Materia { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the amount of attached materia.
|
/// Gets the amount of attached materia.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int MateriaCount { get; }
|
public int MateriaCount { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this item is on a mannequin.
|
/// Gets a value indicating whether this item is on a mannequin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool OnMannequin { get; }
|
public bool OnMannequin { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the player name.
|
|
||||||
/// </summary>
|
|
||||||
string PlayerName { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the price per unit.
|
/// Gets the price per unit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint PricePerUnit { get; }
|
public uint PricePerUnit { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the city ID of the retainer selling the item.
|
/// Gets the city ID of the retainer selling the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int RetainerCityId { get; }
|
public int RetainerCityId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the ID of the retainer selling the item.
|
/// Gets the ID of the retainer selling the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ulong RetainerId { get; }
|
public ulong RetainerId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the retainer.
|
/// Gets the name of the retainer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string RetainerName { get; }
|
public string RetainerName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the stain or applied dye of the item.
|
/// Gets the first stain or applied dye of the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int StainId { get; }
|
public int Stain1Id { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the second stain or applied dye of the item.
|
||||||
|
/// </summary>
|
||||||
|
public int Stain2Id { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the total tax.
|
/// Gets the total tax.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint TotalTax { get; }
|
public uint TotalTax { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ public interface IMarketBoardHistory
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item ID.
|
/// Gets the item ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint ItemId { get; }
|
public uint ItemId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of individual item history listings.
|
/// Gets the list of individual item history listings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IReadOnlyList<IMarketBoardHistoryListing> HistoryListings { get; }
|
public IReadOnlyList<IMarketBoardHistoryListing> HistoryListings { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -26,30 +26,30 @@ public interface IMarketBoardHistoryListing
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the buyer's name.
|
/// Gets the buyer's name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string BuyerName { get; }
|
public string BuyerName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the item is HQ.
|
/// Gets a value indicating whether the item is HQ.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsHq { get; }
|
public bool IsHq { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the item is on a mannequin.
|
/// Gets a value indicating whether the item is on a mannequin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool OnMannequin { get; }
|
public bool OnMannequin { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the time of purchase.
|
/// Gets the time of purchase.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DateTime PurchaseTime { get; }
|
public DateTime PurchaseTime { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the quantity.
|
/// Gets the quantity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint Quantity { get; }
|
public uint Quantity { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the sale price.
|
/// Gets the sale price.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint SalePrice { get; }
|
public uint SalePrice { get; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ public interface IMarketBoardPurchase
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item ID of the item that was purchased.
|
/// Gets the item ID of the item that was purchased.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint CatalogId { get; }
|
public uint CatalogId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the quantity of the item that was purchased.
|
/// Gets the quantity of the item that was purchased.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint ItemQuantity { get; }
|
public uint ItemQuantity { get; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,40 @@ public interface IMarketBoardPurchaseHandler
|
||||||
/// <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>
|
||||||
ulong RetainerId { get; }
|
public ulong RetainerId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the object ID of the item listing.
|
/// Gets the object ID of the item listing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ulong ListingId { get; }
|
public ulong ListingId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the item ID of the item that was purchased.
|
/// Gets the item ID of the item that was purchased.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint CatalogId { get; }
|
public uint CatalogId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the quantity of the item that was purchased.
|
/// Gets the quantity of the item that was purchased.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint ItemQuantity { get; }
|
public uint ItemQuantity { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the unit price of the item.
|
/// Gets the unit price of the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint PricePerUnit { get; }
|
public uint PricePerUnit { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the item is HQ.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsHq { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total tax.
|
||||||
|
/// </summary>
|
||||||
|
public uint TotalTax { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the city ID of the retainer selling the item.
|
||||||
|
/// </summary>
|
||||||
|
public int RetainerCityId { get; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,40 +8,50 @@ public interface IMarketTaxRates
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the category of this ResultDialog packet.
|
/// Gets the category of this ResultDialog packet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint Category { get; }
|
public uint Category { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Limsa Lominsa.
|
/// Gets the tax rate in Limsa Lominsa.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint LimsaLominsaTax { get; }
|
public uint LimsaLominsaTax { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Gridania.
|
/// Gets the tax rate in Gridania.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint GridaniaTax { get; }
|
public uint GridaniaTax { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Ul'dah.
|
/// Gets the tax rate in Ul'dah.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint UldahTax { get; }
|
public uint UldahTax { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Ishgard.
|
/// Gets the tax rate in Ishgard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint IshgardTax { get; }
|
public uint IshgardTax { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in Kugane.
|
/// Gets the tax rate in Kugane.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint KuganeTax { get; }
|
public uint KuganeTax { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in the Crystarium.
|
/// Gets the tax rate in the Crystarium.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint CrystariumTax { get; }
|
public uint CrystariumTax { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in the Crystarium.
|
/// Gets the tax rate in the Crystarium.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint SharlayanTax { get; }
|
public uint SharlayanTax { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the tax rate in Tuliyollal.
|
||||||
|
/// </summary>
|
||||||
|
public uint TuliyollalTax { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets until when these values are valid.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime ValidUntil { get; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,6 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IReadOnlyList<IMarketBoardItemListing> IMarketBoardCurrentOfferings.ItemListings => this.InternalItemListings;
|
IReadOnlyList<IMarketBoardItemListing> IMarketBoardCurrentOfferings.ItemListings => this.InternalItemListings;
|
||||||
|
|
||||||
/// <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>
|
/// <summary>
|
||||||
/// Gets the request ID.
|
/// Gets the request ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -43,7 +33,7 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataPtr">Address to read.</param>
|
/// <param name="dataPtr">Address to read.</param>
|
||||||
/// <returns>A new <see cref="MarketBoardCurrentOfferings"/> object.</returns>
|
/// <returns>A new <see cref="MarketBoardCurrentOfferings"/> object.</returns>
|
||||||
public static unsafe MarketBoardCurrentOfferings Read(IntPtr dataPtr)
|
public static unsafe MarketBoardCurrentOfferings Read(nint dataPtr)
|
||||||
{
|
{
|
||||||
var output = new MarketBoardCurrentOfferings();
|
var output = new MarketBoardCurrentOfferings();
|
||||||
|
|
||||||
|
|
@ -60,19 +50,17 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
listingEntry.RetainerId = reader.ReadUInt64();
|
listingEntry.RetainerId = reader.ReadUInt64();
|
||||||
listingEntry.RetainerOwnerId = reader.ReadUInt64();
|
listingEntry.RetainerOwnerId = reader.ReadUInt64();
|
||||||
listingEntry.ArtisanId = reader.ReadUInt64();
|
listingEntry.ArtisanId = reader.ReadUInt64();
|
||||||
|
|
||||||
listingEntry.PricePerUnit = reader.ReadUInt32();
|
listingEntry.PricePerUnit = reader.ReadUInt32();
|
||||||
listingEntry.TotalTax = reader.ReadUInt32();
|
listingEntry.TotalTax = reader.ReadUInt32();
|
||||||
listingEntry.ItemQuantity = reader.ReadUInt32();
|
listingEntry.ItemQuantity = reader.ReadUInt32();
|
||||||
listingEntry.CatalogId = reader.ReadUInt32();
|
listingEntry.CatalogId = reader.ReadUInt32();
|
||||||
listingEntry.LastReviewTime = DateTimeOffset.UtcNow.AddSeconds(-reader.ReadUInt16()).DateTime;
|
|
||||||
|
|
||||||
reader.ReadUInt16(); // container
|
reader.ReadUInt16(); // Slot
|
||||||
reader.ReadUInt32(); // slot
|
reader.ReadUInt16(); // Durability
|
||||||
reader.ReadUInt16(); // durability
|
reader.ReadUInt16(); // Spiritbond
|
||||||
reader.ReadUInt16(); // spiritbond
|
|
||||||
|
|
||||||
var materiaList = new List<IItemMateria>();
|
var materiaList = new List<IItemMateria>();
|
||||||
|
|
||||||
for (var materiaIndex = 0; materiaIndex < 5; materiaIndex++)
|
for (var materiaIndex = 0; materiaIndex < 5; materiaIndex++)
|
||||||
{
|
{
|
||||||
var materiaVal = reader.ReadUInt16();
|
var materiaVal = reader.ReadUInt16();
|
||||||
|
|
@ -88,27 +76,28 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
|
|
||||||
listingEntry.Materia = materiaList;
|
listingEntry.Materia = materiaList;
|
||||||
|
|
||||||
reader.ReadUInt16();
|
reader.ReadBytes(0x6); // Padding
|
||||||
reader.ReadUInt32();
|
|
||||||
|
listingEntry.RetainerName = Encoding.UTF8.GetString(reader.ReadBytes(0x20)).TrimEnd('\u0000');
|
||||||
|
reader.ReadBytes(0x20); // Empty Buffer, was PlayerName pre 7.0
|
||||||
|
|
||||||
listingEntry.RetainerName = Encoding.UTF8.GetString(reader.ReadBytes(32)).TrimEnd('\u0000');
|
|
||||||
listingEntry.PlayerName = Encoding.UTF8.GetString(reader.ReadBytes(32)).TrimEnd('\u0000');
|
|
||||||
listingEntry.IsHq = reader.ReadBoolean();
|
listingEntry.IsHq = reader.ReadBoolean();
|
||||||
listingEntry.MateriaCount = reader.ReadByte();
|
listingEntry.MateriaCount = reader.ReadByte();
|
||||||
listingEntry.OnMannequin = reader.ReadBoolean();
|
listingEntry.OnMannequin = reader.ReadBoolean();
|
||||||
listingEntry.RetainerCityId = reader.ReadByte();
|
listingEntry.RetainerCityId = reader.ReadByte();
|
||||||
listingEntry.StainId = reader.ReadUInt16();
|
|
||||||
|
|
||||||
reader.ReadUInt16();
|
listingEntry.Stain1Id = reader.ReadByte();
|
||||||
reader.ReadUInt32();
|
listingEntry.Stain2Id = reader.ReadByte();
|
||||||
|
|
||||||
|
reader.ReadBytes(0x4); // Padding
|
||||||
|
|
||||||
if (listingEntry.CatalogId != 0)
|
if (listingEntry.CatalogId != 0)
|
||||||
listings.Add(listingEntry);
|
listings.Add(listingEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
output.InternalItemListings = listings;
|
output.InternalItemListings = listings;
|
||||||
output.ListingIndexEnd = reader.ReadByte();
|
reader.ReadByte(); // Was ListingIndexEnd
|
||||||
output.ListingIndexStart = reader.ReadByte();
|
reader.ReadByte(); // Was ListingIndexStart
|
||||||
output.RequestId = reader.ReadUInt16();
|
output.RequestId = reader.ReadUInt16();
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
@ -152,7 +141,8 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the time this offering was last reviewed.
|
/// Gets the time this offering was last reviewed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime LastReviewTime { get; internal set; }
|
[Obsolete("Universalis Compatibility, contains a fake value", false)]
|
||||||
|
internal DateTime LastReviewTime { get; set; } = DateTime.UtcNow;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the listing ID.
|
/// Gets the listing ID.
|
||||||
|
|
@ -177,7 +167,8 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the player name.
|
/// Gets the player name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PlayerName { get; internal set; }
|
[Obsolete("Universalis Compatibility, contains a fake value", false)]
|
||||||
|
internal string PlayerName { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the price per unit.
|
/// Gets the price per unit.
|
||||||
|
|
@ -207,7 +198,18 @@ public class MarketBoardCurrentOfferings : IMarketBoardCurrentOfferings
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the stain or applied dye of the item.
|
/// Gets the stain or applied dye of the item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StainId { get; internal set; }
|
[Obsolete("Universalis Compatibility, use Stain1Id and Stain2Id", false)]
|
||||||
|
internal int StainId => (this.Stain2Id << 8) | this.Stain1Id;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the first stain or applied dye of the item.
|
||||||
|
/// </summary>
|
||||||
|
public int Stain1Id { get; internal set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the second stain or applied dye of the item.
|
||||||
|
/// </summary>
|
||||||
|
public int Stain2Id { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the total tax.
|
/// Gets the total tax.
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,6 @@ public class MarketBoardHistory : IMarketBoardHistory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint CatalogId { get; private set; }
|
public uint CatalogId { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the second catalog ID.
|
|
||||||
/// </summary>
|
|
||||||
public uint CatalogId2 { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the ID (for EXD) for the item being sold.
|
/// Gets the ID (for EXD) for the item being sold.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -39,51 +34,44 @@ public class MarketBoardHistory : IMarketBoardHistory
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a list of individual item listings.
|
/// Gets or sets a list of individual item listings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal List<MarketBoardHistoryListing> InternalHistoryListings { get; set; } = new List<MarketBoardHistoryListing>();
|
internal List<MarketBoardHistoryListing> InternalHistoryListings { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a <see cref="MarketBoardHistory"/> object from memory.
|
/// Read a <see cref="MarketBoardHistory"/> object from memory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataPtr">Address to read.</param>
|
/// <param name="dataPtr">Address to read.</param>
|
||||||
/// <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(nint dataPtr)
|
||||||
{
|
{
|
||||||
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
|
var output = new MarketBoardHistory { CatalogId = reader.ReadUInt32() };
|
||||||
{
|
|
||||||
CatalogId = reader.ReadUInt32(),
|
|
||||||
CatalogId2 = reader.ReadUInt32(),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (output.CatalogId2 == 0)
|
|
||||||
{
|
|
||||||
// No items found in the resulting packet - just return the empty history.
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
var historyListings = new List<MarketBoardHistoryListing>();
|
var historyListings = new List<MarketBoardHistoryListing>();
|
||||||
for (var i = 0; i < 20; i++)
|
for (var i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
|
var price = reader.ReadUInt32();
|
||||||
|
if (price == 0)
|
||||||
|
{
|
||||||
|
// no price means we reached the end of available listings
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var listingEntry = new MarketBoardHistoryListing
|
var listingEntry = new MarketBoardHistoryListing
|
||||||
{
|
{
|
||||||
SalePrice = reader.ReadUInt32(),
|
SalePrice = price,
|
||||||
PurchaseTime = DateTimeOffset.FromUnixTimeSeconds(reader.ReadUInt32()).UtcDateTime,
|
PurchaseTime = DateTimeOffset.FromUnixTimeSeconds(reader.ReadUInt32()).UtcDateTime,
|
||||||
Quantity = reader.ReadUInt32(),
|
Quantity = reader.ReadUInt32(),
|
||||||
IsHq = reader.ReadBoolean(),
|
IsHq = reader.ReadBoolean(),
|
||||||
|
OnMannequin = reader.ReadBoolean(),
|
||||||
|
BuyerName = Encoding.UTF8.GetString(reader.ReadBytes(0x20)).TrimEnd('\u0000'),
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.ReadBoolean();
|
// Skip padding
|
||||||
|
reader.ReadBytes(0x2);
|
||||||
listingEntry.OnMannequin = reader.ReadBoolean();
|
|
||||||
listingEntry.BuyerName = Encoding.UTF8.GetString(reader.ReadBytes(33)).TrimEnd('\u0000');
|
|
||||||
listingEntry.NextCatalogId = reader.ReadUInt32();
|
|
||||||
|
|
||||||
historyListings.Add(listingEntry);
|
historyListings.Add(listingEntry);
|
||||||
|
|
||||||
if (listingEntry.NextCatalogId == 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output.InternalHistoryListings = historyListings;
|
output.InternalHistoryListings = historyListings;
|
||||||
|
|
@ -108,11 +96,6 @@ public class MarketBoardHistory : IMarketBoardHistory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string BuyerName { get; internal set; }
|
public string BuyerName { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the next entry's catalog ID.
|
|
||||||
/// </summary>
|
|
||||||
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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class MarketBoardPurchase : IMarketBoardPurchase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataPtr">A pointer to a struct containing market board purchase information from the server.</param>
|
/// <param name="dataPtr">A pointer to a struct containing market board purchase information from the server.</param>
|
||||||
/// <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(nint dataPtr)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
@ -35,7 +35,7 @@ public class MarketBoardPurchase : IMarketBoardPurchase
|
||||||
var output = new MarketBoardPurchase();
|
var output = new MarketBoardPurchase();
|
||||||
|
|
||||||
output.CatalogId = reader.ReadUInt32();
|
output.CatalogId = reader.ReadUInt32();
|
||||||
stream.Position += 4;
|
reader.ReadBytes(0x4); // Padding
|
||||||
output.ItemQuantity = reader.ReadUInt32();
|
output.ItemQuantity = reader.ReadUInt32();
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
|
||||||
|
|
@ -37,24 +37,45 @@ public class MarketBoardPurchaseHandler : IMarketBoardPurchaseHandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint PricePerUnit { get; private set; }
|
public uint PricePerUnit { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the item is HQ.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsHq { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total tax.
|
||||||
|
/// </summary>
|
||||||
|
public uint TotalTax { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the city ID of the retainer selling the item.
|
||||||
|
/// </summary>
|
||||||
|
public int RetainerCityId { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads market board purchase information from the struct at the provided pointer.
|
/// Reads market board purchase information from the struct at the provided pointer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataPtr">A pointer to a struct containing market board purchase information from the client.</param>
|
/// <param name="dataPtr">A pointer to a struct containing market board purchase information from the client.</param>
|
||||||
/// <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(nint dataPtr)
|
||||||
{
|
{
|
||||||
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
|
var output = new MarketBoardPurchaseHandler();
|
||||||
{
|
|
||||||
RetainerId = reader.ReadUInt64(),
|
output.RetainerId = reader.ReadUInt64();
|
||||||
ListingId = reader.ReadUInt64(),
|
output.ListingId = reader.ReadUInt64();
|
||||||
CatalogId = reader.ReadUInt32(),
|
|
||||||
ItemQuantity = reader.ReadUInt32(),
|
output.CatalogId = reader.ReadUInt32();
|
||||||
PricePerUnit = reader.ReadUInt32(),
|
output.ItemQuantity = reader.ReadUInt32();
|
||||||
};
|
output.PricePerUnit = reader.ReadUInt32();
|
||||||
|
output.TotalTax = reader.ReadUInt32();
|
||||||
|
|
||||||
|
reader.ReadUInt16(); // Slot
|
||||||
|
|
||||||
|
output.IsHq = reader.ReadBoolean();
|
||||||
|
output.RetainerCityId = reader.ReadByte();
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,26 @@ public class MarketTaxRates : IMarketTaxRates
|
||||||
public uint CrystariumTax { get; private set; }
|
public uint CrystariumTax { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the tax rate in the Crystarium.
|
/// Gets the tax rate in Sharlayan.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint SharlayanTax { get; private set; }
|
public uint SharlayanTax { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the tax rate in Tuliyollal.
|
||||||
|
/// </summary>
|
||||||
|
public uint TuliyollalTax { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets until when these values are valid.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime ValidUntil { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a <see cref="MarketTaxRates"/> object from memory.
|
/// Read a <see cref="MarketTaxRates"/> object from memory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataPtr">Address to read.</param>
|
/// <param name="dataPtr">Address to read.</param>
|
||||||
/// <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(nint dataPtr)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
@ -73,6 +83,9 @@ public class MarketTaxRates : IMarketTaxRates
|
||||||
output.KuganeTax = reader.ReadUInt32();
|
output.KuganeTax = reader.ReadUInt32();
|
||||||
output.CrystariumTax = reader.ReadUInt32();
|
output.CrystariumTax = reader.ReadUInt32();
|
||||||
output.SharlayanTax = reader.ReadUInt32();
|
output.SharlayanTax = reader.ReadUInt32();
|
||||||
|
output.TuliyollalTax = reader.ReadUInt32();
|
||||||
|
|
||||||
|
output.ValidUntil = DateTime.Now; // Dalamud never reads this packet, so setting it to Now just to be safe
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
@ -82,14 +95,14 @@ public class MarketTaxRates : IMarketTaxRates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataPtr">The pointer to the relevant CustomTalk data.</param>
|
/// <param name="dataPtr">The pointer to the relevant CustomTalk data.</param>
|
||||||
/// <returns>Returns a wrapped and ready-to-go MarketTaxRates record.</returns>
|
/// <returns>Returns a wrapped and ready-to-go MarketTaxRates record.</returns>
|
||||||
public static unsafe MarketTaxRates ReadFromCustomTalk(IntPtr dataPtr)
|
public static unsafe MarketTaxRates ReadFromCustomTalk(nint dataPtr)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
||||||
return new MarketTaxRates
|
return new MarketTaxRates
|
||||||
{
|
{
|
||||||
Category = 0xb0009, // shim
|
Category = 0xB0009, // shim
|
||||||
LimsaLominsaTax = reader.ReadUInt32(),
|
LimsaLominsaTax = reader.ReadUInt32(),
|
||||||
GridaniaTax = reader.ReadUInt32(),
|
GridaniaTax = reader.ReadUInt32(),
|
||||||
UldahTax = reader.ReadUInt32(),
|
UldahTax = reader.ReadUInt32(),
|
||||||
|
|
@ -97,6 +110,8 @@ public class MarketTaxRates : IMarketTaxRates
|
||||||
KuganeTax = reader.ReadUInt32(),
|
KuganeTax = reader.ReadUInt32(),
|
||||||
CrystariumTax = reader.ReadUInt32(),
|
CrystariumTax = reader.ReadUInt32(),
|
||||||
SharlayanTax = reader.ReadUInt32(),
|
SharlayanTax = reader.ReadUInt32(),
|
||||||
|
TuliyollalTax = reader.ReadUInt32(),
|
||||||
|
ValidUntil = DateTimeOffset.FromUnixTimeSeconds(reader.ReadUInt32()).UtcDateTime,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
this.trackMarketBoard = false;
|
this.trackMarketBoard = false;
|
||||||
this.trackedEvents = 0;
|
this.trackedEvents = 1;
|
||||||
this.marketBoardHistoryQueue.Clear();
|
this.marketBoardHistoryQueue.Clear();
|
||||||
this.marketBoardPurchaseRequestsQueue.Clear();
|
this.marketBoardPurchaseRequestsQueue.Clear();
|
||||||
this.marketBoardPurchasesQueue.Clear();
|
this.marketBoardPurchasesQueue.Clear();
|
||||||
|
|
@ -114,7 +114,7 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketBoardCurrentOfferingsQueue, this.DrawMarketBoardCurrentOfferings, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Quantity", "Is HQ?", "Price Per Unit", "Buyer Name", "Retainer Name", "Last Review Time");
|
ImGuiTable.DrawTable(string.Empty, this.marketBoardCurrentOfferingsQueue, this.DrawMarketBoardCurrentOfferings, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Quantity", "Is HQ?", "Price Per Unit", "Retainer Name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketBoardPurchaseRequestsQueue, this.DrawMarketBoardPurchaseRequests, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Quantity", "Price Per Unit", "Listing ID", "Retainer ID");
|
ImGuiTable.DrawTable(string.Empty, this.marketBoardPurchaseRequestsQueue, this.DrawMarketBoardPurchaseRequests, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Item ID", "Is HQ?", "Quantity", "Price Per Unit", "Total Tax", "City ID", "Listing ID", "Retainer ID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
if (tabItem)
|
if (tabItem)
|
||||||
{
|
{
|
||||||
ImGuiTable.DrawTable(string.Empty, this.marketTaxRatesQueue, this.DrawMarketTaxRates, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Uldah", "Limsa Lominsa", "Gridania", "Ishgard", "Kugane", "Crystarium", "Sharlayan");
|
ImGuiTable.DrawTable(string.Empty, this.marketTaxRatesQueue, this.DrawMarketTaxRates, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg, "Uldah", "Limsa Lominsa", "Gridania", "Ishgard", "Kugane", "Crystarium", "Sharlayan", "Tuliyollal", "Valid Until");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -236,14 +236,8 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.Listing.PricePerUnit.ToString());
|
ImGui.TextUnformatted(data.Listing.PricePerUnit.ToString());
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.TextUnformatted(data.Listing.PlayerName);
|
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.Listing.RetainerName);
|
ImGui.TextUnformatted(data.Listing.RetainerName);
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
|
||||||
ImGui.TextUnformatted(data.Listing.LastReviewTime.ToString(CultureInfo.InvariantCulture));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawMarketBoardPurchases(IMarketBoardPurchase data)
|
private void DrawMarketBoardPurchases(IMarketBoardPurchase data)
|
||||||
|
|
@ -260,12 +254,21 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.CatalogId.ToString());
|
ImGui.TextUnformatted(data.CatalogId.ToString());
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
ImGui.TextUnformatted(data.IsHq.ToString());
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.ItemQuantity.ToString());
|
ImGui.TextUnformatted(data.ItemQuantity.ToString());
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.PricePerUnit.ToString());
|
ImGui.TextUnformatted(data.PricePerUnit.ToString());
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
ImGui.TextUnformatted(data.TotalTax.ToString());
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
ImGui.TextUnformatted(data.RetainerCityId.ToString());
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.ListingId.ToString());
|
ImGui.TextUnformatted(data.ListingId.ToString());
|
||||||
|
|
||||||
|
|
@ -295,5 +298,11 @@ internal class MarketBoardWidget : IDataWindowWidget
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TextUnformatted(data.SharlayanTax.ToString());
|
ImGui.TextUnformatted(data.SharlayanTax.ToString());
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
ImGui.TextUnformatted(data.TuliyollalTax.ToString());
|
||||||
|
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
ImGui.TextUnformatted(data.ValidUntil.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue