Skip to content

Commit

Permalink
Merge branch 'release/1.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fmauNeko committed Jul 28, 2024
2 parents 1049128 + 91a4d60 commit 4864123
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
18 changes: 18 additions & 0 deletions MarketBoardPlugin/GUI/MarketBoardConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> setter)
Expand Down
3 changes: 2 additions & 1 deletion MarketBoardPlugin/GUI/MarketBoardWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 4 additions & 3 deletions MarketBoardPlugin/Helpers/UniversalisClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");

Expand All @@ -62,16 +62,17 @@ public UniversalisClient(MBPlugin plugin)
/// </summary>
/// <param name="itemId">The ID of the item to retrieve market data for.</param>
/// <param name="worldName">The name of the world to retrieve market data from.</param>
/// <param name="listingCount">The number of current listings to retrieve.</param>
/// <param name="historyCount">The number of historical entries to retrieve.</param>
/// <param name="cancellationToken">A cancellation token to cancel the operation.</param>
/// <returns>A <see cref="MarketDataResponse"/> object containing the retrieved market data, or null if the operation fails.</returns>
public async Task<MarketDataResponse> GetMarketData(uint itemId, string worldName, int historyCount, CancellationToken cancellationToken)
public async Task<MarketDataResponse> 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);

Expand Down
10 changes: 10 additions & 0 deletions MarketBoardPlugin/MBPluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,15 @@ public class MBPluginConfig : IPluginConfiguration
/// Gets the favorite items.
/// </summary>
public ICollection<uint> Favorites { get; } = new List<uint>();

/// <summary>
/// Gets or sets the number of listings to retrieve.
/// </summary>
public int ListingCount { get; set; } = 50;

/// <summary>
/// Gets or sets the number of historical entries to retrieve.
/// </summary>
public int HistoryCount { get; set; } = 50;
}
}
6 changes: 3 additions & 3 deletions MarketBoardPlugin/MarketBoardPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<DocumentationFile>bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).xml</DocumentationFile>
<DebugType>PdbOnly</DebugType>
<GenerateFullPaths>true</GenerateFullPaths>
<AssemblyVersion>1.7.3</AssemblyVersion>
<FileVersion>1.7.3</FileVersion>
<Version>1.7.3</Version>
<AssemblyVersion>1.8.0</AssemblyVersion>
<FileVersion>1.8.0</FileVersion>
<Version>1.8.0</Version>
<Company>Florian Maunier</Company>
<Description>Market board plugin for Dalamud.</Description>
<Copyright>Copyright (c) Florian Maunier. All rights reserved.</Copyright>
Expand Down

0 comments on commit 4864123

Please sign in to comment.