mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Re-query quest giver status after accepting or completing quests
After accepting a quest, re-query the NPC so its marker updates from ! to ?. After completing a quest, re-query all nearby quest NPCs so markers refresh. Also remove completed quests from the log instead of just marking them.
This commit is contained in:
parent
2889e412b3
commit
7054699d21
1 changed files with 24 additions and 4 deletions
|
|
@ -1260,13 +1260,25 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
// Mark quest as complete in local log
|
||||
if (packet.getSize() - packet.getReadPos() >= 4) {
|
||||
uint32_t questId = packet.readUInt32();
|
||||
for (auto& q : questLog_) {
|
||||
if (q.questId == questId) {
|
||||
q.complete = true;
|
||||
for (auto it = questLog_.begin(); it != questLog_.end(); ++it) {
|
||||
if (it->questId == questId) {
|
||||
questLog_.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Re-query all nearby quest giver NPCs so markers refresh
|
||||
if (socket) {
|
||||
for (const auto& [guid, entity] : entityManager.getEntities()) {
|
||||
if (entity->getType() != ObjectType::UNIT) continue;
|
||||
auto unit = std::static_pointer_cast<Unit>(entity);
|
||||
if (unit->getNpcFlags() & 0x02) {
|
||||
network::Packet qsPkt(static_cast<uint16_t>(Opcode::CMSG_QUESTGIVER_STATUS_QUERY));
|
||||
qsPkt.writeUInt64(guid);
|
||||
socket->send(qsPkt);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Opcode::SMSG_QUESTGIVER_REQUEST_ITEMS:
|
||||
|
|
@ -4078,8 +4090,9 @@ void GameHandler::handleQuestDetails(network::Packet& packet) {
|
|||
|
||||
void GameHandler::acceptQuest() {
|
||||
if (!questDetailsOpen || state != WorldState::IN_WORLD || !socket) return;
|
||||
uint64_t npcGuid = currentQuestDetails.npcGuid;
|
||||
auto packet = QuestgiverAcceptQuestPacket::build(
|
||||
currentQuestDetails.npcGuid, currentQuestDetails.questId);
|
||||
npcGuid, currentQuestDetails.questId);
|
||||
socket->send(packet);
|
||||
|
||||
// Add to quest log
|
||||
|
|
@ -4097,6 +4110,13 @@ void GameHandler::acceptQuest() {
|
|||
|
||||
questDetailsOpen = false;
|
||||
currentQuestDetails = QuestDetailsData{};
|
||||
|
||||
// Re-query quest giver status so marker updates (! → ?)
|
||||
if (npcGuid) {
|
||||
network::Packet qsPkt(static_cast<uint16_t>(Opcode::CMSG_QUESTGIVER_STATUS_QUERY));
|
||||
qsPkt.writeUInt64(npcGuid);
|
||||
socket->send(qsPkt);
|
||||
}
|
||||
}
|
||||
|
||||
void GameHandler::declineQuest() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue