Hello folks,
today i found a bug so that the script doesn't get the correct "Estimated Value" when the card has a level greater 1 or more than 1 xp(combined cards).
To fix the issue, just replace the foreach loop with the following lines:
foreach ($card in ($cardCollection | where { $_.edition -ne 6 })) { $cardKey = [string]::Format("{0}::{1}::{2}", $card.card_detail_id, $card.gold, $card.xp); $tempCard = $cardArray | where { $_.Key -eq $cardKey } | select -First 1; if ($tempCard -eq $null) { $responseCardInfo = Invoke-RestMethod -Method Get -Uri ([string]::Format("https://api2.splinterlands.com/cards/find?ids={0}", $card.uid)); $lowPriceBcx = -1.0; $cardSaleGroup = ($cardsForSale | where { ($_.card_detail_id -eq $card.card_detail_id) -and ($_.gold -eq $card.gold) -and ($_.level -eq $card.level) }); if ($cardSaleGroup -eq $null) { $cardSaleGroup = ($cardsForSale | where { ($_.card_detail_id -eq $card.card_detail_id) -and ($_.gold -eq $card.gold) }); $lowPriceBcx = $cardSaleGroup.low_price_bcx * $card.xp; } else { $lowPriceBcx = $card.level -gt 1 ? $cardSaleGroup.low_price_bcx : $cardSaleGroup.low_price_bcx * $card.xp; } $cardArray += [PSCustomObject]@{ Key = $cardKey Id = $card.card_detail_id Name = $responseCardInfo.details.name XP = $card.xp "Gold Foil" = $card.gold ? "Yes" : "No" "Estimated Value in $" = $lowPriceBcx -lt 0.0 ? "unknown" : [string]::Format("{0:0.000}", $lowPriceBcx) }; } else { $cardArray += $tempCard; } }
I will update the post soon too.