mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
feat: add hover tooltips to quest kill objective minimap markers
This commit is contained in:
parent
9a08edae09
commit
381fc54c89
1 changed files with 27 additions and 5 deletions
|
|
@ -12945,8 +12945,9 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
||||||
|
|
||||||
// Quest kill objective markers — highlight live NPCs matching active quest kill objectives
|
// Quest kill objective markers — highlight live NPCs matching active quest kill objectives
|
||||||
{
|
{
|
||||||
// Collect NPC entry IDs needed for incomplete kill objectives in tracked quests
|
// Build map of NPC entry → (quest title, current, required) for tooltips
|
||||||
std::unordered_set<uint32_t> killTargetEntries;
|
struct KillInfo { std::string questTitle; uint32_t current = 0; uint32_t required = 0; };
|
||||||
|
std::unordered_map<uint32_t, KillInfo> killInfoMap;
|
||||||
const auto& trackedIds = gameHandler.getTrackedQuestIds();
|
const auto& trackedIds = gameHandler.getTrackedQuestIds();
|
||||||
for (const auto& quest : gameHandler.getQuestLog()) {
|
for (const auto& quest : gameHandler.getQuestLog()) {
|
||||||
if (quest.complete) continue;
|
if (quest.complete) continue;
|
||||||
|
|
@ -12956,16 +12957,20 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
||||||
uint32_t npcEntry = static_cast<uint32_t>(obj.npcOrGoId);
|
uint32_t npcEntry = static_cast<uint32_t>(obj.npcOrGoId);
|
||||||
auto it = quest.killCounts.find(npcEntry);
|
auto it = quest.killCounts.find(npcEntry);
|
||||||
uint32_t current = (it != quest.killCounts.end()) ? it->second.first : 0;
|
uint32_t current = (it != quest.killCounts.end()) ? it->second.first : 0;
|
||||||
if (current < obj.required) killTargetEntries.insert(npcEntry);
|
if (current < obj.required) {
|
||||||
|
killInfoMap[npcEntry] = { quest.title, current, obj.required };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!killTargetEntries.empty()) {
|
if (!killInfoMap.empty()) {
|
||||||
|
ImVec2 mouse = ImGui::GetMousePos();
|
||||||
for (const auto& [guid, entity] : gameHandler.getEntityManager().getEntities()) {
|
for (const auto& [guid, entity] : gameHandler.getEntityManager().getEntities()) {
|
||||||
if (!entity || entity->getType() != game::ObjectType::UNIT) continue;
|
if (!entity || entity->getType() != game::ObjectType::UNIT) continue;
|
||||||
auto unit = std::static_pointer_cast<game::Unit>(entity);
|
auto unit = std::static_pointer_cast<game::Unit>(entity);
|
||||||
if (!unit || unit->getHealth() == 0) continue;
|
if (!unit || unit->getHealth() == 0) continue;
|
||||||
if (!killTargetEntries.count(unit->getEntry())) continue;
|
auto infoIt = killInfoMap.find(unit->getEntry());
|
||||||
|
if (infoIt == killInfoMap.end()) continue;
|
||||||
|
|
||||||
glm::vec3 unitRender = core::coords::canonicalToRender(
|
glm::vec3 unitRender = core::coords::canonicalToRender(
|
||||||
glm::vec3(entity->getX(), entity->getY(), entity->getZ()));
|
glm::vec3(entity->getX(), entity->getY(), entity->getZ()));
|
||||||
|
|
@ -12979,6 +12984,23 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) {
|
||||||
IM_COL32(20, 20, 20, 230), 1.2f);
|
IM_COL32(20, 20, 20, 230), 1.2f);
|
||||||
drawList->AddLine(ImVec2(sx + 2.5f, sy - 2.5f), ImVec2(sx - 2.5f, sy + 2.5f),
|
drawList->AddLine(ImVec2(sx + 2.5f, sy - 2.5f), ImVec2(sx - 2.5f, sy + 2.5f),
|
||||||
IM_COL32(20, 20, 20, 230), 1.2f);
|
IM_COL32(20, 20, 20, 230), 1.2f);
|
||||||
|
|
||||||
|
// Tooltip on hover
|
||||||
|
float mdx = mouse.x - sx, mdy = mouse.y - sy;
|
||||||
|
if (mdx * mdx + mdy * mdy < 64.0f) {
|
||||||
|
const auto& ki = infoIt->second;
|
||||||
|
const std::string& npcName = unit->getName();
|
||||||
|
if (!npcName.empty()) {
|
||||||
|
ImGui::SetTooltip("%s\n%s: %u/%u",
|
||||||
|
npcName.c_str(),
|
||||||
|
ki.questTitle.empty() ? "Quest" : ki.questTitle.c_str(),
|
||||||
|
ki.current, ki.required);
|
||||||
|
} else {
|
||||||
|
ImGui::SetTooltip("%s: %u/%u",
|
||||||
|
ki.questTitle.empty() ? "Quest" : ki.questTitle.c_str(),
|
||||||
|
ki.current, ki.required);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue