add bulk staging to shop sales

This commit is contained in:
Alexander Sellite 2026-08-25 02:05:52 -04:00
parent 046f5e0fdb
commit 0cc3ae9709
2 changed files with 119 additions and 8 deletions

View file

@ -971,12 +971,21 @@ func _test_fishing_shop_sale_ui(
reserved_catch.catch_id,
)
assert(staged.is_empty())
sell_inventory.call(
"_stage",
PlayerInventoryLayout.EntryKind.CATCH,
fish_catch.catch_id,
var sell_button := sell_inventory.get("_sell_button") as Button
var all_button := sell_inventory.get("_all_button") as Button
assert(sell_button != null and sell_button.text == "sell")
assert(all_button != null and all_button.text == "all")
assert(sell_button.get_parent() == all_button.get_parent())
assert(
sell_button.size_flags_horizontal == Control.SIZE_EXPAND_FILL
and all_button.size_flags_horizontal == Control.SIZE_EXPAND_FILL
)
sell_inventory.call("_stage_all_eligible")
assert(staged.has(PlayerInventoryLayout.catch_key(fish_catch.catch_id)))
assert(not staged.has(
PlayerInventoryLayout.catch_key(reserved_catch.catch_id)
))
assert(all_button.disabled)
assert((sell_inventory.get("_feedback") as Label).text.is_empty())
var source_grid := sell_inventory.get("_inventory_grid") as GeneralInventoryGrid
var staged_source_found := false
@ -985,17 +994,19 @@ func _test_fishing_shop_sale_ui(
staged_source_found = bool(source_slot.get("_staged"))
break
assert(staged_source_found)
var expected_all_payout := int(sell_inventory.call("_calculate_total"))
assert(expected_all_payout >= fish_catch.sale_value)
var feedback := sell_inventory.get("_feedback") as Label
var total_label := sell_inventory.get("_total_label") as Label
var sell_button := sell_inventory.get("_sell_button") as Button
var sale_buttons := sell_button.get_parent() as HBoxContainer
assert(feedback.get_index() < total_label.get_parent().get_index())
assert(total_label.get_parent().get_index() < sell_button.get_index())
assert(total_label.get_parent().get_index() < sale_buttons.get_index())
_sale_result.clear()
sell_inventory.call("_submit_sale")
await process_frame
assert(not _sale_result.is_empty() and bool(_sale_result[1]))
assert(not player.inventory.contains_catch_id(fish_catch.catch_id))
assert(player.wallet.get_balance() == balance_before + fish_catch.sale_value)
assert(player.wallet.get_balance() == balance_before + expected_all_payout)
assert(not sale_service.is_local_sale_pending())
assert(reservations.release(reservation_id))
await _activate_pointer_control(shop_tabs[0] as Button, ui_viewport)