parent
9253a78a06
commit
2fbeb93018
@ -0,0 +1,55 @@
|
|||||||
|
@tool
|
||||||
|
extends DialogicEvent
|
||||||
|
class_name DialogicQuestActivateEvent
|
||||||
|
|
||||||
|
|
||||||
|
# Define properties of the event here
|
||||||
|
var quest_resource: String
|
||||||
|
|
||||||
|
func _execute() -> void:
|
||||||
|
var resource = ResourceLoader.load(quest_resource)
|
||||||
|
QuestManager.ChangeQuestStatus(resource,QuestEventUtils.QuestStatus.ACTIVE)
|
||||||
|
QuestManager.SetFollowQuest(resource)
|
||||||
|
finish() # called to continue with the next event
|
||||||
|
|
||||||
|
|
||||||
|
#region INITIALIZE
|
||||||
|
################################################################################
|
||||||
|
# Set fixed settings of this event
|
||||||
|
func _init() -> void:
|
||||||
|
event_name = "Activate Quest"
|
||||||
|
event_category = "Quest"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SAVING/LOADING
|
||||||
|
################################################################################
|
||||||
|
func get_shortcode() -> String:
|
||||||
|
return "quest_activate"
|
||||||
|
|
||||||
|
func get_shortcode_parameters() -> Dictionary:
|
||||||
|
return {
|
||||||
|
#param_name : property_info
|
||||||
|
"quest_resource" : {"property": "quest_resource", "default": ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
# You can alternatively overwrite these 3 functions: to_text(), from_text(), is_valid_event()
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region EDITOR REPRESENTATION
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
func build_event_editor() -> void:
|
||||||
|
add_header_label("Activate Quest")
|
||||||
|
add_header_edit(
|
||||||
|
"quest_resource",
|
||||||
|
ValueType.DYNAMIC_OPTIONS,
|
||||||
|
{
|
||||||
|
"mode":2,
|
||||||
|
"suggestions_func":QuestEventUtils.quest_resource_suggestrions
|
||||||
|
})
|
||||||
|
|
||||||
|
#endregion
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://br3a7napsjmg3
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
@tool
|
||||||
|
extends DialogicEvent
|
||||||
|
class_name DialogicQuestCompleteEvent
|
||||||
|
|
||||||
|
|
||||||
|
# Define properties of the event here
|
||||||
|
var quest_resource: String
|
||||||
|
|
||||||
|
func _execute() -> void:
|
||||||
|
var resource = ResourceLoader.load(quest_resource)
|
||||||
|
QuestManager.ChangeQuestStatus(resource,QuestEventUtils.QuestStatus.DONE)
|
||||||
|
QuestManager.SetFollowQuest(null)
|
||||||
|
finish() # called to continue with the next event
|
||||||
|
|
||||||
|
|
||||||
|
#region INITIALIZE
|
||||||
|
################################################################################
|
||||||
|
# Set fixed settings of this event
|
||||||
|
func _init() -> void:
|
||||||
|
event_name = "Complete Quest"
|
||||||
|
event_category = "Quest"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region SAVING/LOADING
|
||||||
|
################################################################################
|
||||||
|
func get_shortcode() -> String:
|
||||||
|
return "quest_complete"
|
||||||
|
|
||||||
|
func get_shortcode_parameters() -> Dictionary:
|
||||||
|
return {
|
||||||
|
#param_name : property_info
|
||||||
|
"quest_resource" : {"property": "quest_resource", "default": ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
# You can alternatively overwrite these 3 functions: to_text(), from_text(), is_valid_event()
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region EDITOR REPRESENTATION
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
func build_event_editor() -> void:
|
||||||
|
add_header_label("Complete Quest")
|
||||||
|
add_header_edit(
|
||||||
|
"quest_resource",
|
||||||
|
ValueType.DYNAMIC_OPTIONS,
|
||||||
|
{
|
||||||
|
"mode":2,
|
||||||
|
"suggestions_func":QuestEventUtils.quest_resource_suggestrions
|
||||||
|
})
|
||||||
|
|
||||||
|
#endregion
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://c8mtjwpe7c0h
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
class_name QuestEventUtils
|
||||||
|
|
||||||
|
enum QuestStatus{
|
||||||
|
HIDDEN = 0,
|
||||||
|
ACTIVE = 1,
|
||||||
|
DONE = 2,
|
||||||
|
CANCLED = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static func quest_resource_suggestrions(search_text:String) -> Dictionary:
|
||||||
|
var ret_val = {}
|
||||||
|
var quest_paths = get_all_file_paths("res://resources/quests")
|
||||||
|
|
||||||
|
for path in quest_paths:
|
||||||
|
var res = ResourceLoader.load(path)
|
||||||
|
ret_val[res.id]= {"value":path, "tooltip":res.title + "\n\n" + res.description}
|
||||||
|
|
||||||
|
return ret_val
|
||||||
|
|
||||||
|
static func get_all_file_paths(path: String) -> Array[String]:
|
||||||
|
var file_paths: Array[String] = []
|
||||||
|
var dir = DirAccess.open(path)
|
||||||
|
dir.list_dir_begin()
|
||||||
|
var file_name = dir.get_next()
|
||||||
|
while file_name != "":
|
||||||
|
var file_path = path + "/" + file_name
|
||||||
|
if dir.current_is_dir():
|
||||||
|
file_paths += get_all_file_paths(file_path)
|
||||||
|
else:
|
||||||
|
file_paths.append(file_path)
|
||||||
|
file_name = dir.get_next()
|
||||||
|
return file_paths
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://d1x2343wpkdku
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
@tool
|
||||||
|
extends DialogicIndexer
|
||||||
|
|
||||||
|
func _get_events() -> Array:
|
||||||
|
return [
|
||||||
|
this_folder.path_join('event_quest_activate.gd'),
|
||||||
|
this_folder.path_join('event_quest_complete.gd')
|
||||||
|
]
|
||||||
@ -0,0 +1 @@
|
|||||||
|
uid://wup1fvm05rqv
|
||||||
Loading…
Reference in new issue