FPurchaseQuote Quote = Merchant->QuotePurchase(Player, Item, Qty);
if (!Quote.bSuccess)
{
switch (Quote.ErrorCode)
{
case EMerchantErrorCode::ERR_NO_STOCK:
DisplayToPlayer("Out of stock! Try again later.");
break;
case EMerchantErrorCode::ERR_INSUFFICIENT_FUNDS:
DisplayToPlayer(FString::Printf(
"Need %d gold (you have %d)",
Quote.Total,
PlayerGold
));
break;
case EMerchantErrorCode::ERR_INVENTORY_FULL:
DisplayToPlayer("Inventory full! Free up space.");
break;
case EMerchantErrorCode::ERR_OUT_OF_RANGE:
DisplayToPlayer("Too far from merchant!");
break;
default:
DisplayToPlayer("Cannot complete transaction.");
break;
}
return;
}
// Success - display quote to player
DisplayQuote(Quote);