diff --git a/MarketBoardPlugin/GUI/MarketBoardConfigWindow.cs b/MarketBoardPlugin/GUI/MarketBoardConfigWindow.cs index 30d3083..2e4d60f 100644 --- a/MarketBoardPlugin/GUI/MarketBoardConfigWindow.cs +++ b/MarketBoardPlugin/GUI/MarketBoardConfigWindow.cs @@ -58,6 +58,24 @@ public override void Draw() this.Plugin.Config.ItemRefreshTimeout = itemRefreshTimeout; this.Plugin.PluginInterface.SavePluginConfig(this.Plugin.Config); } + + var listingCount = this.Plugin.Config.ListingCount; + ImGui.Text("Listing count :"); + ImGui.InputInt("###listingCount", ref listingCount); + if (this.Plugin.Config.ListingCount != listingCount) + { + this.Plugin.Config.ListingCount = listingCount; + this.Plugin.PluginInterface.SavePluginConfig(this.Plugin.Config); + } + + var historyCount = this.Plugin.Config.HistoryCount; + ImGui.Text("History count :"); + ImGui.InputInt("###historyCount", ref historyCount); + if (this.Plugin.Config.HistoryCount != historyCount) + { + this.Plugin.Config.HistoryCount = historyCount; + this.Plugin.PluginInterface.SavePluginConfig(this.Plugin.Config); + } } private void Checkbox(string label, string description, bool oldValue, Action setter) diff --git a/MarketBoardPlugin/GUI/MarketBoardWindow.cs b/MarketBoardPlugin/GUI/MarketBoardWindow.cs index d538238..ecf1e63 100644 --- a/MarketBoardPlugin/GUI/MarketBoardWindow.cs +++ b/MarketBoardPlugin/GUI/MarketBoardWindow.cs @@ -1173,7 +1173,8 @@ private void RefreshMarketData() .GetMarketData( this.selectedItem.RowId, this.worldList[this.selectedWorld].Item1, - 50, + this.plugin.Config.ListingCount, + this.plugin.Config.HistoryCount, this.currentRefreshCancellationTokenSource.Token) .ConfigureAwait(false); } diff --git a/MarketBoardPlugin/Helpers/UniversalisClient.cs b/MarketBoardPlugin/Helpers/UniversalisClient.cs index a51aaae..229cc0a 100644 --- a/MarketBoardPlugin/Helpers/UniversalisClient.cs +++ b/MarketBoardPlugin/Helpers/UniversalisClient.cs @@ -42,7 +42,7 @@ public UniversalisClient(MBPlugin plugin) this.client = new HttpClient { - BaseAddress = new Uri("https://universalis.app/api/"), + BaseAddress = new Uri("https://universalis.app/api/v2/"), }; this.client.DefaultRequestHeaders.UserAgent.ParseAdd($"MarketBoardPlugin/{this.plugin.PluginInterface.Manifest.AssemblyVersion}"); @@ -62,16 +62,17 @@ public UniversalisClient(MBPlugin plugin) /// /// The ID of the item to retrieve market data for. /// The name of the world to retrieve market data from. + /// The number of current listings to retrieve. /// The number of historical entries to retrieve. /// A cancellation token to cancel the operation. /// A object containing the retrieved market data, or null if the operation fails. - public async Task GetMarketData(uint itemId, string worldName, int historyCount, CancellationToken cancellationToken) + public async Task GetMarketData(uint itemId, string worldName, int listingCount, int historyCount, CancellationToken cancellationToken) { try { using var content = await this.resiliencePipeline.ExecuteAsync( async (ct) => - await this.client.GetStreamAsync(new Uri($"{worldName}/{itemId}?entries={historyCount}", UriKind.Relative), ct).ConfigureAwait(false), + await this.client.GetStreamAsync(new Uri($"{worldName}/{itemId}?listings={listingCount}&entries={historyCount}", UriKind.Relative), ct).ConfigureAwait(false), cancellationToken) .ConfigureAwait(false); diff --git a/MarketBoardPlugin/MBPluginConfig.cs b/MarketBoardPlugin/MBPluginConfig.cs index e976d77..48d8e51 100644 --- a/MarketBoardPlugin/MBPluginConfig.cs +++ b/MarketBoardPlugin/MBPluginConfig.cs @@ -73,5 +73,15 @@ public class MBPluginConfig : IPluginConfiguration /// Gets the favorite items. /// public ICollection Favorites { get; } = new List(); + + /// + /// Gets or sets the number of listings to retrieve. + /// + public int ListingCount { get; set; } = 50; + + /// + /// Gets or sets the number of historical entries to retrieve. + /// + public int HistoryCount { get; set; } = 50; } } diff --git a/MarketBoardPlugin/MarketBoardPlugin.csproj b/MarketBoardPlugin/MarketBoardPlugin.csproj index 75f038b..9657dcd 100644 --- a/MarketBoardPlugin/MarketBoardPlugin.csproj +++ b/MarketBoardPlugin/MarketBoardPlugin.csproj @@ -5,9 +5,9 @@ bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).xml PdbOnly true - 1.7.3 - 1.7.3 - 1.7.3 + 1.8.0 + 1.8.0 + 1.8.0 Florian Maunier Market board plugin for Dalamud. Copyright (c) Florian Maunier. All rights reserved.