at least show *some* data about a quest
This commit is contained in:
parent
f00fe9ea84
commit
263ec1ac86
@ -43,6 +43,11 @@ end
|
|||||||
-- makes use of yl_speak_up.input_fs_manage_general and is thus pretty short
|
-- makes use of yl_speak_up.input_fs_manage_general and is thus pretty short
|
||||||
yl_speak_up.input_fs_manage_quests = function(player, formname, fields)
|
yl_speak_up.input_fs_manage_quests = function(player, formname, fields)
|
||||||
local pname = player:get_player_name()
|
local pname = player:get_player_name()
|
||||||
|
if(fields and fields.manage_quest_steps and fields.manage_quest_steps ~= "") then
|
||||||
|
-- the quest we're working at is stored in yl_speak_up.speak_to[pname].q_id
|
||||||
|
yl_speak_up.show_fs(player, "manage_quest_steps")
|
||||||
|
return
|
||||||
|
end
|
||||||
local quest_list = yl_speak_up.get_sorted_quest_list(pname)
|
local quest_list = yl_speak_up.get_sorted_quest_list(pname)
|
||||||
local res = yl_speak_up.input_fs_manage_general(player, formname, fields,
|
local res = yl_speak_up.input_fs_manage_general(player, formname, fields,
|
||||||
-- what_is_the_list_about, min_length, max_length, function_add_new_entry,
|
-- what_is_the_list_about, min_length, max_length, function_add_new_entry,
|
||||||
@ -79,10 +84,70 @@ yl_speak_up.get_fs_manage_quests = function(player, param)
|
|||||||
"add and change a human readable description later on.",
|
"add and change a human readable description later on.",
|
||||||
"If you click here, the selected quest will be deleted.\n"..
|
"If you click here, the selected quest will be deleted.\n"..
|
||||||
"This will only be possible if it's not used anywhere.")
|
"This will only be possible if it's not used anywhere.")
|
||||||
if(selected and selected ~= "") then
|
if(not(selected) or selected == "") then
|
||||||
local k = selected
|
return table.concat(formspec, "")
|
||||||
-- index 1 is "Add variable:"
|
|
||||||
table.insert(formspec, "button[12,2.15;4.5,0.6;show_variable;Show and edit this variable]")
|
|
||||||
end
|
end
|
||||||
|
local var_name = yl_speak_up.restore_complete_var_name(selected, pname)
|
||||||
|
local quest = {}
|
||||||
|
for q_id, data in pairs(yl_speak_up.quests) do
|
||||||
|
if(data and data.var_name and data.var_name == var_name) then
|
||||||
|
quest = data
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local quest_state_selected = table.indexof({"created","testing","open","official"}, quest.state)
|
||||||
|
if(quest_state_selected == -1) then
|
||||||
|
quest_state_selected = 1
|
||||||
|
end
|
||||||
|
-- index 1 is "Add variable:"
|
||||||
|
|
||||||
|
table.insert(formspec, "button[12,2.15;4.5,0.6;show_variable;Show and edit this variable]")
|
||||||
|
|
||||||
|
table.insert(formspec, "scroll_container[0,3;18,8;scr0;vertical;1]")
|
||||||
|
table.insert(formspec, "button[12,0.15;4.5,0.6;manage_quest_steps;Manage quest steps]")
|
||||||
|
|
||||||
|
table.insert(formspec, "label[0.5,0.5;Quest ID:]")
|
||||||
|
table.insert(formspec, "label[3.5,0.5;"..minetest.formspec_escape(quest.id or "- ? -").."]")
|
||||||
|
table.insert(formspec, "label[0.5,1.1;State:]")
|
||||||
|
table.insert(formspec, "dropdown[3.5,0.8;4.0,0.5;quest_state;created,testing,open,official;"..tostring(quest_state_selected).."]")
|
||||||
|
table.insert(formspec, "label[0.5,1.7;Creator/Owner:]")
|
||||||
|
table.insert(formspec, "field[3.5,1.4;4.0,0.5;quest_owner;;"..minetest.formspec_escape(quest.owner or "- ? -").."]")
|
||||||
|
table.insert(formspec, "label[0.5,2.3;Name:]")
|
||||||
|
table.insert(formspec, "field[3.5,2.0;13.0,0.5;quest_name;;"..minetest.formspec_escape(quest.name or "- ? -").."]")
|
||||||
|
table.insert(formspec, "label[0.5,2.9;Short Description:]")
|
||||||
|
table.insert(formspec, "field[3.5,2.6;13.0,0.5;quest_short_desc;;"..minetest.formspec_escape(quest.short_desc or "- ? -").."]")
|
||||||
|
table.insert(formspec, "label[0.5,3.5;Full Description:]")
|
||||||
|
table.insert(formspec, "textarea[3.5,3.2;13.0,1.5;quest_desc;;"..minetest.formspec_escape(quest.description or "- ? -").."]")
|
||||||
|
table.insert(formspec, "label[0.5,5.1;Internal comment:]")
|
||||||
|
table.insert(formspec, "textarea[3.5,4.8;13.0,1.5;quest_comment;;"..minetest.formspec_escape(quest.comment or "- ? -").."]")
|
||||||
|
|
||||||
|
table.insert(formspec, "button[3.5,6.5;4.0,0.8;save_changes;TODO Save changes]")
|
||||||
|
table.insert(formspec, "scroll_container_end[]")
|
||||||
|
|
||||||
|
-- TODO: make the content of the fields and textareas more readable (more contrast)
|
||||||
|
-- TODO: actually process and store changed entries
|
||||||
|
--[[
|
||||||
|
-- TODO: entries that are not yet shown:
|
||||||
|
quest.var_name = var_name -- name of the variable where progress is stored for each player
|
||||||
|
quest.step_data = {} -- table containing information about a quest step (=key)
|
||||||
|
-- this may also be information about WHERE a quest step shall
|
||||||
|
-- take place
|
||||||
|
quest.subquests = {} -- list of other quest_ids that contribute to this quest
|
||||||
|
-- -> determined from quests.npcs and quests.locations
|
||||||
|
quest.is_subquest_of = {} -- list of quest_ids this quest contributes to
|
||||||
|
-- -> determined from quests.npcs and quests.locations
|
||||||
|
quest.npcs = {} -- list of NPC that contribute to this quest
|
||||||
|
-- -> derived from quest.var_name
|
||||||
|
quest.locations = {} -- list of locations that contribute to this quest
|
||||||
|
-- -> derived from quest.var_name
|
||||||
|
quest.items = {} -- data of quest items created and accepted
|
||||||
|
quest.rewards = {} -- list of rewards (item stacks) for this ques
|
||||||
|
quest.testers = {} -- list of player names that can test the quest
|
||||||
|
-- -> during the created/testing phase: any player for which
|
||||||
|
-- quest.var_name is set to a value
|
||||||
|
quest.solved_by = {} -- list of names of players that solved the quest at least once
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- store the quest ID so that we know what we're working at
|
||||||
|
yl_speak_up.speak_to[pname].q_id = quest.id
|
||||||
return table.concat(formspec, "")
|
return table.concat(formspec, "")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user