From 7bf9fab46511cdb82bc902375399468f246b203a Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 13 Sep 2020 00:08:32 +0200 Subject: [PATCH] Implement level requirement, and cost for the trainer window. Also update ESS to get support for it at the c++ side. --- HEADS | 2 +- game/ui/windows/TrainerWindow.gd | 25 +++++++++++++++++-------- game/ui/windows/TrainerWindow.tscn | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/HEADS b/HEADS index 211943a7..c1ae0727 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "57d80dafffd5ea6ca70e86e2cfb067a81b25147b"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "6f8e54879bcab6c628c761b545f6df4cd7534a07"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}} \ No newline at end of file +{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "c7a98e704dd62782b9f8b4a22b74787278574657"}, "entity_spell_system": {"master": "0a1e08f5417cecda5a1163063bf42c325d078cfe"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "6f8e54879bcab6c628c761b545f6df4cd7534a07"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "6c99ddcaa6203e77163b4770e7af95bc2a181e3d"}, "procedural_animations": {"master": "ec465a7a683a047cd373959bb022bde1321fb72d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "bfb60df21570415b1860c25c2dae7722cf158ed9"}, "mesh_utils": {"master": "3365df3faf89a4c29c3b4664b53e9007e4e6267b"}, "broken_seals_module": {"master": "9f89e2a4e7b59351ac4cb4c4dc5f88e5b60a2f15"}, "thread_pool": {"master": "b1030eaf92ba595c56ae8caac90b58081303d16f"}} \ No newline at end of file diff --git a/game/ui/windows/TrainerWindow.gd b/game/ui/windows/TrainerWindow.gd index 2296cea0..97da1c0d 100644 --- a/game/ui/windows/TrainerWindow.gd +++ b/game/ui/windows/TrainerWindow.gd @@ -22,7 +22,7 @@ extends PanelContainer export(NodePath) var spell_entry_container_path : NodePath export(NodePath) var learn_button_path : NodePath -export(NodePath) var cost_points_label_path : NodePath +export(NodePath) var cost_label_path : NodePath export(NodePath) var spell_icon_path : NodePath export(NodePath) var spell_name_label_path : NodePath @@ -33,7 +33,7 @@ var _spell_entry_container : Node var _spell_entries : Array var _learn_button : Button -var _cost_points_label : Label +var _cost_label : Label var _spell_icon : TextureRect var _spell_name_label : Label @@ -60,7 +60,7 @@ func _ready() -> void: _spell_requirements_label = get_node(spell_requirements_label_path) as Label _learn_button = get_node(learn_button_path) - _cost_points_label = get_node(cost_points_label_path) + _cost_label = get_node(cost_label_path) _learn_button.connect("pressed", self, "learn") @@ -122,8 +122,6 @@ func refresh_all() -> void: if _character_class == null: return - _cost_points_label.text = str(_player.getc_money()) - refresh_entries() @@ -178,16 +176,27 @@ func _button_pressed(): _spell_name_label.text = spell.text_name _spell_description_label.text = spell.text_description + var req_str = "Required: " + if spell.training_required_spell: - _spell_requirements_label.text = spell.training_required_spell.text_name + " (rank " + str(spell.training_required_spell.rank) + ")" - else: - _spell_requirements_label.text = "" + req_str += spell.training_required_spell.text_name + " (rank " + str(spell.training_required_spell.rank) + ") " + + if spell.level > 0: + req_str += "level " + str(spell.level) + + _spell_requirements_label.text = req_str + + _cost_label.text = str(spell.get_training_cost()) + else: _spell_icon.texture = null _spell_name_label.text = "" _spell_description_label.text = "" _spell_requirements_label.text = "" + _cost_label.text = "0" + + class CustomSpellSorter: static func sort(a, b): diff --git a/game/ui/windows/TrainerWindow.tscn b/game/ui/windows/TrainerWindow.tscn index 2ae125f6..01dd93c2 100644 --- a/game/ui/windows/TrainerWindow.tscn +++ b/game/ui/windows/TrainerWindow.tscn @@ -15,7 +15,7 @@ __meta__ = { } spell_entry_container_path = NodePath("VBoxContainer/PanelContainer3/ScrollContainer/Spells") learn_button_path = NodePath("VBoxContainer/HBoxContainer/Train") -cost_points_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer2/Price") +cost_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer2/Price") spell_icon_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer/Icon") spell_name_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2/Name") spell_description_label_path = NodePath("VBoxContainer/PanelContainer2/VBoxContainer/HBoxContainer/VBoxContainer2/Description")