diff --git a/client/scenes/shell/MainWindowShell.tscn b/client/scenes/shell/MainWindowShell.tscn index f38f727..2845bf3 100644 --- a/client/scenes/shell/MainWindowShell.tscn +++ b/client/scenes/shell/MainWindowShell.tscn @@ -154,10 +154,10 @@ layout_mode = 2 theme_type_variation = &"Mono" text = "MP 18 / 30" -[node name="Gold" type="Label" parent="Split/World/CommandBar/Vitals"] +[node name="Purse" type="Label" parent="Split/World/CommandBar/Vitals"] layout_mode = 2 theme_type_variation = &"Mono" -text = "◈ 1240 gp" +text = "◈ 3s 47c" [node name="Consumables" type="HBoxContainer" parent="Split/World/CommandBar"] layout_mode = 2 diff --git a/client/scripts/ui/shell/main_window_shell.gd b/client/scripts/ui/shell/main_window_shell.gd index fcdce62..1e0920c 100644 --- a/client/scripts/ui/shell/main_window_shell.gd +++ b/client/scripts/ui/shell/main_window_shell.gd @@ -29,7 +29,7 @@ var _http: HTTPRequest @onready var _tokens: HBoxContainer = $Split/World/TurnRail/Col/Tokens @onready var _hp: Label = $Split/World/CommandBar/Vitals/HP @onready var _mp: Label = $Split/World/CommandBar/Vitals/MP -@onready var _gold: Label = $Split/World/CommandBar/Vitals/Gold +@onready var _purse: Label = $Split/World/CommandBar/Vitals/Purse @onready var _consumables: HBoxContainer = $Split/World/CommandBar/Consumables @@ -93,8 +93,8 @@ func _side_color(e: TurnEntry) -> Color: func _bind_vitals() -> void: _hp.text = "HP %d / %d" % [_state.vitals["hp"], _state.vitals["hp_max"]] _mp.text = "MP %d / %d" % [_state.vitals["mp"], _state.vitals["mp_max"]] - _gold.text = "◈ %d gp" % _state.vitals["gold"] - _gold.add_theme_color_override("font_color", Palette.GOLD_BRIGHT) + _purse.text = "◈ %s" % Currency.format(_state.vitals["purse_copper"]) + _purse.add_theme_color_override("font_color", Palette.GOLD_BRIGHT) func _bind_consumables() -> void: diff --git a/client/scripts/ui/shell/shell_state.gd b/client/scripts/ui/shell/shell_state.gd index 27caa65..89b1e7c 100644 --- a/client/scripts/ui/shell/shell_state.gd +++ b/client/scripts/ui/shell/shell_state.gd @@ -4,7 +4,7 @@ extends RefCounted ## 2a; later systems (combat vitals, inventory consumables) become the writers. ## No Luck/LCK value lives here — it is never surfaced (§7). -var vitals: Dictionary = {"hp": 0, "hp_max": 0, "mp": 0, "mp_max": 0, "gold": 0} +var vitals: Dictionary = {"hp": 0, "hp_max": 0, "mp": 0, "mp_max": 0, "purse_copper": 0} var turn_order: Array[TurnEntry] = [] var consumables: Array = [] var round_label: String = "" @@ -19,7 +19,7 @@ func toggle_dock() -> bool: static func seed() -> ShellState: var s := ShellState.new() - s.vitals = {"hp": 42, "hp_max": 60, "mp": 18, "mp_max": 30, "gold": 1240} + s.vitals = {"hp": 42, "hp_max": 60, "mp": 18, "mp_max": 30, "purse_copper": 347} s.turn_order = [ TurnEntry.new("EL", 17, &"you", true, false), TurnEntry.new("DW", 12, &"ally"), diff --git a/client/tests/unit/test_shell_state.gd b/client/tests/unit/test_shell_state.gd index cfea412..2319320 100644 --- a/client/tests/unit/test_shell_state.gd +++ b/client/tests/unit/test_shell_state.gd @@ -16,7 +16,13 @@ func test_seed_vitals(): assert_eq(s.vitals["hp_max"], 60) assert_eq(s.vitals["mp"], 18) assert_eq(s.vitals["mp_max"], 30) - assert_eq(s.vitals["gold"], 1240) + assert_eq(s.vitals["purse_copper"], 347) + assert_false("gold" in s.vitals, "the flat gold placeholder is gone") + + +func test_seed_purse_renders_as_denominations(): + var s := ShellState.seed() + assert_eq(Currency.format(s.vitals["purse_copper"]), "3s 47c") func test_seed_turn_order():