62 lines
1.3 KiB
GDScript
62 lines
1.3 KiB
GDScript
extends Control
|
|
|
|
|
|
var quest : Quest
|
|
var selected_location : Quest.Locations = -1
|
|
var min_difficulty : int = 0
|
|
var max_difficulty : int = 5
|
|
@onready var map : QuestMap = $Map
|
|
|
|
func generate_quest() -> void:
|
|
quest = Quest.generate({
|
|
"location":selected_location,
|
|
"min_difficulty": min_difficulty,
|
|
"max_difficulty": max_difficulty,
|
|
})
|
|
|
|
func update_quest_window() -> void:
|
|
if quest:
|
|
%NameField.text = quest.name
|
|
%DifficultyField.text = quest.difficulty_name()
|
|
%LocationField.text = quest.get_location_name()
|
|
#for reward in quest.rewards.:
|
|
|
|
func reset() -> void:
|
|
quest = null
|
|
%DifficultyOptions.select(0)
|
|
%LocationOptions.select(0)
|
|
#TODO: Clear bonus rewards
|
|
|
|
func _on_generate_button_pressed() -> void:
|
|
generate_quest()
|
|
update_quest_window()
|
|
%GenerateQuest.hide()
|
|
%PostQuest.show()
|
|
|
|
func _on_post_button_pressed() -> void:
|
|
Guild.add_quest(quest)
|
|
quest = null
|
|
%GenerateQuest.show()
|
|
%PostQuest.hide()
|
|
hide()
|
|
|
|
func _on_post_back_button_pressed() -> void:
|
|
%GenerateQuest.show()
|
|
%PostQuest.hide()
|
|
|
|
func _on_generate_back_button_pressed() -> void:
|
|
hide()
|
|
reset()
|
|
|
|
|
|
func _on_location_options_pressed() -> void:
|
|
map.visible = true
|
|
|
|
|
|
func _on_map_location_selected(location: Quest.Locations) -> void:
|
|
|
|
selected_location = location
|
|
%LocationOptions.text = Quest.location_name(location)
|
|
map.visible = false
|
|
#TODO: Make Location show up correctly
|