fix: update MarketTaxRates, check category, add sharlayan

This commit is contained in:
goaaats 2021-12-03 14:28:24 +01:00
parent e4bb7a83f0
commit a44e7210bc
No known key found for this signature in database
GPG key ID: F18F057873895461
3 changed files with 27 additions and 4 deletions

View file

@ -42,5 +42,11 @@ namespace Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis.Types
/// </summary>
[JsonProperty("crystarium")]
public uint Crystarium { get; set; }
/// <summary>
/// Gets or sets The Crystarium's current tax rate.
/// </summary>
[JsonProperty("sharlayan")]
public uint Sharlayan { get; set; }
}
}

View file

@ -191,14 +191,18 @@ namespace Dalamud.Game.Network.Internal
var taxes = MarketTaxRates.Read(dataPtr);
if (taxes.Category != 0xb0009)
return;
Log.Verbose(
"MarketTaxRates: limsa#{0} grid#{1} uldah#{2} ish#{3} kugane#{4} cr#{5}",
"MarketTaxRates: limsa#{0} grid#{1} uldah#{2} ish#{3} kugane#{4} cr#{5} sh#{6}",
taxes.LimsaLominsaTax,
taxes.GridaniaTax,
taxes.UldahTax,
taxes.IshgardTax,
taxes.KuganeTax,
taxes.CrystariumTax);
taxes.CrystariumTax,
taxes.SharlayanTax);
Task.Run(() => this.uploader.UploadTax(taxes))
.ContinueWith((task) => Log.Error(task.Exception, "Market Board tax data upload failed."), TaskContinuationOptions.OnlyOnFaulted);

View file

@ -4,7 +4,8 @@ using System.IO;
namespace Dalamud.Game.Network.Structures
{
/// <summary>
/// This class represents the market tax rates from a game network packet.
/// This class represents the "Result Dialog" packet. This is also used e.g. for reduction results, but we only care about tax rates.
/// We can do that by checking the "Category" field.
/// </summary>
public class MarketTaxRates
{
@ -12,6 +13,11 @@ namespace Dalamud.Game.Network.Structures
{
}
/// <summary>
/// Category of this ResultDialog packet.
/// </summary>
public uint Category { get; private set; }
/// <summary>
/// Gets the tax rate in Limsa Lominsa.
/// </summary>
@ -42,6 +48,11 @@ namespace Dalamud.Game.Network.Structures
/// </summary>
public uint CrystariumTax { get; private set; }
/// <summary>
/// Gets the tax rate in the Crystarium.
/// </summary>
public uint SharlayanTax { get; private set; }
/// <summary>
/// Read a <see cref="MarketTaxRates"/> object from memory.
/// </summary>
@ -54,13 +65,15 @@ namespace Dalamud.Game.Network.Structures
var output = new MarketTaxRates();
stream.Position += 8;
output.Category = reader.ReadUInt32();
stream.Position += 4;
output.LimsaLominsaTax = reader.ReadUInt32();
output.GridaniaTax = reader.ReadUInt32();
output.UldahTax = reader.ReadUInt32();
output.IshgardTax = reader.ReadUInt32();
output.KuganeTax = reader.ReadUInt32();
output.CrystariumTax = reader.ReadUInt32();
output.SharlayanTax = reader.ReadUInt32();
return output;
}