From 0f42ebab3d56e5dab94203630c8e7ee2b29f2825 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 02:51:12 -0700 Subject: [PATCH] feat(editor): quest objectives now have a Target ID field + spawn picker The SQL exporter writes objective targets to RequiredNpcOrGo/RequiredItem slots based on the objective's targetName field, but the UI never let the user fill that field. Added an InputText for Target ID and, for Kill objectives, a dropdown that auto-fills with the entry of any placed NPC. --- tools/editor/editor_ui.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index ca22ad1c..cd3e5bda 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -2170,6 +2170,24 @@ void EditorUI::renderQuestPanel(EditorApp& app) { if (ImGui::InputText("Desc", objDesc, sizeof(objDesc))) obj.description = objDesc; int cnt = obj.targetCount; if (ImGui::InputInt("Count", &cnt)) obj.targetCount = std::max(1, cnt); + // Target ID input — for Kill objectives this is the creature + // entry, for Collect it's the item ID. SQL export keys off it. + char targetBuf[64] = {}; + std::strncpy(targetBuf, obj.targetName.c_str(), sizeof(targetBuf) - 1); + if (ImGui::InputText("Target ID", targetBuf, sizeof(targetBuf))) + obj.targetName = targetBuf; + // For Kill objectives, offer a dropdown of placed NPC entries. + if (obj.type == QuestObjectiveType::KillCreature) { + if (ImGui::BeginCombo("Pick NPC", "(spawn list)")) { + for (size_t si = 0; si < spawner.spawnCount(); si++) { + const auto& s = spawner.getSpawns()[si]; + char lbl[96]; + std::snprintf(lbl, sizeof(lbl), "%s (id %u)", s.name.c_str(), s.id); + if (ImGui::Selectable(lbl)) obj.targetName = std::to_string(s.id); + } + ImGui::EndCombo(); + } + } if (ImGui::SmallButton("Remove")) tmpl.objectives.erase(tmpl.objectives.begin() + oi--); ImGui::PopID(); ImGui::Separator();