fix: show quest name instead of ID in failed/timed-out quest messages

SMSG_QUESTUPDATE_FAILED and SMSG_QUESTUPDATE_FAILEDTIMER were emitting
generic "Quest 12345 failed!" messages. Now looks up the title from
questLog_ and shows e.g. "\"Report to Gryan Stoutmantle\" failed!" for
a much more readable notification. Falls back to the generic form if
the title is not cached.
This commit is contained in:
Kelsi 2026-03-13 06:24:16 -07:00
parent 156ddfad9a
commit 2a52aedbf7

View file

@ -1845,9 +1845,12 @@ void GameHandler::handlePacket(network::Packet& packet) {
// uint32 questId // uint32 questId
if (packet.getSize() - packet.getReadPos() >= 4) { if (packet.getSize() - packet.getReadPos() >= 4) {
uint32_t questId = packet.readUInt32(); uint32_t questId = packet.readUInt32();
char buf[128]; std::string questTitle;
std::snprintf(buf, sizeof(buf), "Quest %u failed!", questId); for (const auto& q : questLog_)
addSystemChatMessage(buf); if (q.questId == questId && !q.title.empty()) { questTitle = q.title; break; }
addSystemChatMessage(questTitle.empty()
? std::string("Quest failed!")
: ('"' + questTitle + "\" failed!"));
} }
break; break;
} }
@ -1855,9 +1858,12 @@ void GameHandler::handlePacket(network::Packet& packet) {
// uint32 questId // uint32 questId
if (packet.getSize() - packet.getReadPos() >= 4) { if (packet.getSize() - packet.getReadPos() >= 4) {
uint32_t questId = packet.readUInt32(); uint32_t questId = packet.readUInt32();
char buf[128]; std::string questTitle;
std::snprintf(buf, sizeof(buf), "Quest %u timed out!", questId); for (const auto& q : questLog_)
addSystemChatMessage(buf); if (q.questId == questId && !q.title.empty()) { questTitle = q.title; break; }
addSystemChatMessage(questTitle.empty()
? std::string("Quest timed out!")
: ('"' + questTitle + "\" has timed out."));
} }
break; break;
} }