Build Bazaar: 4 tabs, sort/filter, art images, USD disabled

- Add Boosters, Decks, Cosmetics, Cards (marketplace) tabs
- Sort per-tab: name, price, card count, type, set (boosters)
- Cards tab: filter by rarity and card type, sort by price/rarity/name
- StoreItemRow gets 72x72 art TextureRect with async HTTP image loading;
  falls back to cdn.aeternalisgames.com/sor-assets/cardart/0_No-Card-Art.jpg
- USD prices shown as greyed "$X.XX (coming soon)" — buy disabled
- "Buy OP" button in header present but disabled (USD flow not yet live)
- setup_listing() on StoreItemRow handles marketplace card listings
  with auction bid count, current bid, and Bid/Buy button labels

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-06 17:46:07 -05:00
co-authored by Claude Happy
parent 9dadeda7c1
commit c4ef720570
4 changed files with 525 additions and 144 deletions
@@ -3,22 +3,31 @@
[ext_resource type="Script" path="res://scenes/bazaar/components/store_item_row.gd" id="1_sir"]
[node name="StoreItemRow" type="PanelContainer"]
custom_minimum_size = Vector2(0, 88)
script = ExtResource("1_sir")
[node name="Margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_bottom = 10
theme_override_constants/margin_top = 8
theme_override_constants/margin_bottom = 8
[node name="HBox" type="HBoxContainer" parent="Margin"]
layout_mode = 2
theme_override_constants/separation = 12
[node name="ArtImage" type="TextureRect" parent="Margin/HBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(72, 72)
expand_mode = 1
stretch_mode = 6
[node name="Info" type="VBoxContainer" parent="Margin/HBox"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_constants/separation = 3
[node name="NameLabel" type="Label" parent="Margin/HBox/Info"]
@@ -43,8 +52,17 @@ visible = false
modulate = Color(0.55, 0.55, 0.60, 1.0)
theme_override_font_sizes/font_size = 11
[node name="TagsLabel" type="Label" parent="Margin/HBox/Info"]
unique_name_in_owner = true
layout_mode = 2
text = ""
visible = false
modulate = Color(0.45, 0.65, 0.90, 1.0)
theme_override_font_sizes/font_size = 10
[node name="PriceBox" type="VBoxContainer" parent="Margin/HBox"]
layout_mode = 2
size_flags_vertical = 4
theme_override_constants/separation = 4
[node name="PriceLabel" type="Label" parent="Margin/HBox/PriceBox"]
@@ -60,3 +78,12 @@ layout_mode = 2
custom_minimum_size = Vector2(76, 32)
text = "Buy"
theme_override_font_sizes/font_size = 13
[node name="UsdLabel" type="Label" parent="Margin/HBox/PriceBox"]
unique_name_in_owner = true
layout_mode = 2
horizontal_alignment = 1
text = ""
visible = false
modulate = Color(0.5, 0.5, 0.55, 0.7)
theme_override_font_sizes/font_size = 10
@@ -1,33 +1,34 @@
extends PanelContainer
## A single row in the Bazaar store listing.
## A single row in the Bazaar store or marketplace listing.
##
## Call setup(item) with a Dictionary from get_store (StorePackDto,
## StoreDeckDto, or CosmeticDto). Emits buy_pressed(item) when the
## Buy button is pressed.
## Call setup(item, fallback_art_url) for store products (packs, decks, cosmetics).
## Call setup_listing(listing, fallback_art_url) for marketplace card listings.
## Emits buy_pressed(item) when the Buy button is pressed.
signal buy_pressed(item: Dictionary)
@onready var name_label : Label = %NameLabel
@onready var desc_label : Label = %DescLabel
@onready var sub_label : Label = %SubLabel
@onready var price_label : Label = %PriceLabel
@onready var buy_btn : Button = %BuyBtn
@onready var art_image : TextureRect = %ArtImage
@onready var name_label : Label = %NameLabel
@onready var desc_label : Label = %DescLabel
@onready var sub_label : Label = %SubLabel
@onready var tags_label : Label = %TagsLabel
@onready var price_label : Label = %PriceLabel
@onready var usd_label : Label = %UsdLabel
@onready var buy_btn : Button = %BuyBtn
var _item: Dictionary = {}
# -- Store product setup -------------------------------------------------------
func setup(item: Dictionary, fallback_art: String = "") -> void:
_item = item
func setup(item: Dictionary) -> void:
_item = item
name_label.text = item.get("name", "—")
var desc: String = item.get("description", "")
if desc.is_empty():
desc_label.visible = false
else:
desc_label.text = desc
desc_label.visible = true
desc_label.text = desc
desc_label.visible = not desc.is_empty()
# Sub-line varies by product type.
var sub := ""
if item.has("totalSlots"):
sub = "%d cards per pack" % int(item.get("totalSlots", 0))
@@ -38,13 +39,87 @@ func setup(item: Dictionary) -> void:
sub += " · Arch: %s" % arch
elif item.has("cosmeticType"):
sub = item.get("cosmeticType", "")
sub_label.text = sub
sub_label.visible = not sub.is_empty()
if sub.is_empty():
sub_label.visible = false
else:
sub_label.text = sub
sub_label.visible = true
var tags := ""
if bool(item.get("isStarterDeck", false)):
tags = "STARTER"
tags_label.text = tags
tags_label.visible = not tags.is_empty()
price_label.text = "◆ %d OP" % int(item.get("originPointPrice", 0))
var usd: float = float(item.get("usdPrice", 0.0))
if usd > 0.0:
usd_label.text = "$%.2f (coming soon)" % usd
usd_label.visible = true
else:
usd_label.visible = false
buy_btn.pressed.connect(func(): buy_pressed.emit(_item))
_load_art(item.get("imageCdnUrl", item.get("previewImageCdnUrl", "")), fallback_art)
# -- Marketplace listing setup -------------------------------------------------
func setup_listing(listing: Dictionary, fallback_art: String = "") -> void:
_item = listing
var masked : bool = bool(listing.get("isMasked", false))
var card_name : String = listing.get("cardName", "") if not masked else "???"
var rarity : String = listing.get("rarity", "")
var card_type : String = listing.get("cardType", "")
var list_type : String = listing.get("listingType", "Fixed")
var bid_count : int = int(listing.get("bidCount", 0))
var cur_bid : float = float(listing.get("currentBid", 0.0))
name_label.text = card_name if not card_name.is_empty() else "Unknown Card"
desc_label.visible = false
var sub := ""
if not rarity.is_empty():
sub = rarity
if not card_type.is_empty():
sub = (sub + " · " + card_type) if not sub.is_empty() else card_type
sub_label.text = sub
sub_label.visible = not sub.is_empty()
var tags := list_type
if list_type == "Auction":
if bid_count > 0:
tags += " · %d bid%s · cur. ◆ %d" % [bid_count, "s" if bid_count != 1 else "", int(cur_bid)]
else:
tags += " · No bids yet"
tags_label.text = tags
tags_label.visible = true
tags_label.modulate = Color(0.45, 0.65, 0.90, 1.0) if list_type == "Fixed" else Color(1.0, 0.72, 0.20, 1.0)
price_label.text = "◆ %d OP" % int(float(listing.get("price", 0.0)))
usd_label.visible = false
buy_btn.text = "Buy" if list_type == "Fixed" else "Bid"
buy_btn.pressed.connect(func(): buy_pressed.emit(_item))
_load_art("", fallback_art)
# -- Art loading ---------------------------------------------------------------
func _load_art(url: String, fallback: String) -> void:
var target := url if not url.is_empty() else fallback
if target.is_empty():
return
var http := HTTPRequest.new()
add_child(http)
http.request_completed.connect(func(result: int, code: int, _headers: PackedStringArray, body: PackedByteArray):
if result == HTTPRequest.RESULT_SUCCESS and code == 200:
var img := Image.new()
var ok := img.load_png_from_buffer(body)
if ok != OK:
ok = img.load_jpg_from_buffer(body)
if ok == OK and is_instance_valid(art_image):
art_image.texture = ImageTexture.create_from_image(img)
http.queue_free()
)
http.request(target)