From 9555a4a91ae6eda383ba9af9d339618ec2135784 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 5 May 2026 06:26:15 -0700 Subject: [PATCH] feat(editor): quest NPC linking via spawn list dropdowns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Quest giver and turn-in NPC now selected from a dropdown of placed creatures instead of typing raw IDs — shows name + id for each - Links quests directly to NPCs you've already placed on the map - "None" option to unset NPC link - Much more intuitive quest→NPC workflow --- tools/editor/editor_ui.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index 27715a50..3cf9c9ad 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -1101,10 +1101,28 @@ void EditorUI::renderQuestPanel(EditorApp& app) { int lvl = tmpl.requiredLevel; if (ImGui::InputInt("Required Level", &lvl)) tmpl.requiredLevel = std::max(1, lvl); - int giver = tmpl.questGiverNpcId; - if (ImGui::InputInt("Giver NPC ID", &giver)) tmpl.questGiverNpcId = std::max(0, giver); - int turnin = tmpl.turnInNpcId; - if (ImGui::InputInt("Turn-in NPC ID", &turnin)) tmpl.turnInNpcId = std::max(0, turnin); + // Link to NPCs from spawn list + auto& spawner = app.getNpcSpawner(); + if (ImGui::BeginCombo("Quest Giver##qg", + tmpl.questGiverNpcId > 0 ? std::to_string(tmpl.questGiverNpcId).c_str() : "None")) { + if (ImGui::Selectable("None")) tmpl.questGiverNpcId = 0; + for (const auto& s : spawner.getSpawns()) { + char lbl[64]; + std::snprintf(lbl, sizeof(lbl), "%s (id %u)", s.name.c_str(), s.id); + if (ImGui::Selectable(lbl)) tmpl.questGiverNpcId = s.id; + } + ImGui::EndCombo(); + } + if (ImGui::BeginCombo("Turn-in NPC##qt", + tmpl.turnInNpcId > 0 ? std::to_string(tmpl.turnInNpcId).c_str() : "None")) { + if (ImGui::Selectable("None##ti")) tmpl.turnInNpcId = 0; + for (const auto& s : spawner.getSpawns()) { + char lbl[64]; + std::snprintf(lbl, sizeof(lbl), "%s (id %u)", s.name.c_str(), s.id); + if (ImGui::Selectable(lbl)) tmpl.turnInNpcId = s.id; + } + ImGui::EndCombo(); + } ImGui::Separator(); ImGui::Text("Objectives:");