Skip to content

Commit

Permalink
Fixed nwmp price data.
Browse files Browse the repository at this point in the history
  • Loading branch information
josdemmers committed Nov 11, 2024
1 parent c6cd57f commit 550de9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions NewWorldCompanion.Services/PriceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ public Nwmarketprice GetPriceData(string itemName)
List<PriceData> priceData = new List<PriceData>();
if (_serverPriceData.Daily.TryGetValue(itemId, out priceData))
{
double recentLowestPricePrev = priceData.Count >= 2 ? priceData[priceData.Count - 2].Means[0][1] / 100.0 : 0.0;
double recentLowestPrice = priceData.Count >= 1 ? priceData[priceData.Count - 1].Means[0][1] / 100.0 : 0.0;
double recentLowestPricePrev = priceData.Count >= 2 ? priceData[1].Means[0][1] / 100.0 : 0.0;
double recentLowestPrice = priceData.Count >= 1 ? priceData[0].Means[0][1] / 100.0 : 0.0;
int priceChange = recentLowestPricePrev > 0 ? (int)(((recentLowestPrice - recentLowestPricePrev) / (recentLowestPricePrev))*100.0) : 0;
double recentLowestPriceAvg = priceData.Average(i => i.Means[0][1] / 100.0);

int timeStamp = priceData[priceData.Count - 1].Timestamp;
int timeStamp = priceData[0].Timestamp;
DateTime lastUpdated = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
lastUpdated = lastUpdated.AddSeconds(timeStamp).ToLocalTime();

Expand Down
4 changes: 2 additions & 2 deletions NewWorldCompanion/common.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<FileVersion>1.13.0.0</FileVersion>
<Version>1.13.0.0</Version>
<FileVersion>1.13.1.0</FileVersion>
<Version>1.13.1.0</Version>
<Copyright>Copyright © 2024</Copyright>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
Expand Down

0 comments on commit 550de9b

Please sign in to comment.