Skip to content

Commit 706bfc7

Browse files
committed
SteamWishlistDiscountNotifier: Only check price changes when old and new items are not discounted, because values are affected by game bundles and makes it unreliable
1 parent 413a0fe commit 706bfc7

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

source/Generic/SteamWishlistDiscountNotifier/SteamWishlistDiscountNotifier.cs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,33 @@ private void ProcessChangedItem(WishlistTrackedItemChangedEventArgs e)
229229
() => OpenDiscountedItemUrl(newItem.AppId)
230230
));
231231
}
232-
else if (_settings.Settings.EnablePriceChangesNotifications && oldItem.FinalPriceInCents != newItem.FinalPriceInCents)
232+
else if (_settings.Settings.EnablePriceChangesNotifications)
233233
{
234-
// Price has changed
235-
var notificationLines = new List<string>
234+
// Skip price change checks if either the old or new item is discounted.
235+
// Discounted prices can be influenced by various game bundles, making it
236+
// impossible to reliably detect changes in the base game price.
237+
if ((oldItem.DiscountPct.HasValue && oldItem.DiscountPct.Value > 0) ||
238+
newItem.DiscountPct.HasValue && newItem.DiscountPct.Value > 0)
236239
{
237-
string.Format(ResourceProvider.GetString("LOCSteam_Wishlist_Notif_GamePriceChangedLabel"), newItem.Name) + "\n",
238-
string.Format("{0} -> {1}", oldItem.FormattedOriginalPrice ?? "-", newItem.FormattedOriginalPrice ?? "-")
239-
};
240+
return;
241+
}
240242

241-
PlayniteApi.Notifications.Add(new NotificationMessage(
242-
e.Id.ToString(),
243-
string.Join("\n", notificationLines),
244-
NotificationType.Info,
245-
() => OpenDiscountedItemUrl(newItem.AppId)
246-
));
243+
if (oldItem.PriceInCents != newItem.PriceInCents)
244+
{
245+
// Price has changed
246+
var notificationLines = new List<string>
247+
{
248+
string.Format(ResourceProvider.GetString("LOCSteam_Wishlist_Notif_GamePriceChangedLabel"), newItem.Name) + "\n",
249+
string.Format("{0} -> {1}", oldItem.FormattedFinalPrice ?? "-", newItem.FormattedFinalPrice ?? "-")
250+
};
251+
252+
PlayniteApi.Notifications.Add(new NotificationMessage(
253+
e.Id.ToString(),
254+
string.Join("\n", notificationLines),
255+
NotificationType.Info,
256+
() => OpenDiscountedItemUrl(newItem.AppId)
257+
));
258+
}
247259
}
248260
}
249261

0 commit comments

Comments
 (0)