Commit c0fdbb2c authored by Frederik Holden's avatar Frederik Holden Committed by Daenyth
Browse files

Fix two bugs in the price tag feature



"The price tag feature currently has two bugs.
1. The final price that a card ends up with is the one in the last set
alphabetically, instead of the one from the set with the lowest price.
2. Black Lotus Project sometimes gets in prices for cards from Masters
Edition, for some reason. This set only exists in Magic the Gathering:
Online, i.e., not physically, and should not be considered. This might
be considered a BLP bug and not a Cockatrice bug.

This patch fixes those two bugs. I also changed the price value to be
based on BLP's "price" value instead of the "average" value. Seems more
logical."

Signed-off-by: default avatarDaenyth <Daenyth+git@gmail.com>
parent 347d30a8
......@@ -55,8 +55,16 @@ void PriceUpdater::downloadFinished()
while (it.hasNext()) {
QVariantMap map = it.next().toMap();
QString name = map.value("name").toString().toLower();
float price = map.value("average").toString().toFloat();
cardsPrice.insert(name, price);
float price = map.value("price").toString().toFloat();
QString set = map.value("set_code").toString();
/**
* Make sure Masters Edition (MED) isn't the set, as it doesn't
* physically exist. Also check the price to see that the cheapest set
* ends up as the final price.
*/
if (set != "MED" && (!cardsPrice.contains(name) || cardsPrice.value(name) > price))
cardsPrice.insert(name, price);
}
InnerDecklistNode *listRoot = deck->getRoot();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment