mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Handle SMSG_QUEST_CONFIRM_ACCEPT (shared quest) with accept/decline popup
- Parse SMSG_QUEST_CONFIRM_ACCEPT (questId + title + sharerGuid), show chat notification with quest title and sharer name - acceptSharedQuest() sends CMSG_QUEST_CONFIRM_ACCEPT with questId - renderSharedQuestPopup(): shows sharer name, gold quest title, Accept/Decline buttons (stacked below other social popups)
This commit is contained in:
parent
e793b44151
commit
acde6070cf
4 changed files with 94 additions and 0 deletions
|
|
@ -707,6 +707,14 @@ public:
|
|||
bool hasPendingGroupInvite() const { return pendingGroupInvite; }
|
||||
const std::string& getPendingInviterName() const { return pendingInviterName; }
|
||||
|
||||
// ---- Shared Quest ----
|
||||
bool hasPendingSharedQuest() const { return pendingSharedQuest_; }
|
||||
uint32_t getSharedQuestId() const { return sharedQuestId_; }
|
||||
const std::string& getSharedQuestTitle() const { return sharedQuestTitle_; }
|
||||
const std::string& getSharedQuestSharerName() const { return sharedQuestSharerName_; }
|
||||
void acceptSharedQuest();
|
||||
void declineSharedQuest();
|
||||
|
||||
// ---- Summon ----
|
||||
bool hasPendingSummonRequest() const { return pendingSummonRequest_; }
|
||||
const std::string& getSummonerName() const { return summonerName_; }
|
||||
|
|
@ -1295,6 +1303,7 @@ private:
|
|||
|
||||
// ---- Instance lockout handler ----
|
||||
void handleRaidInstanceInfo(network::Packet& packet);
|
||||
void handleQuestConfirmAccept(network::Packet& packet);
|
||||
void handleSummonRequest(network::Packet& packet);
|
||||
void handleTradeStatus(network::Packet& packet);
|
||||
void handleDuelRequested(network::Packet& packet);
|
||||
|
|
@ -1654,6 +1663,13 @@ private:
|
|||
bool pendingGroupInvite = false;
|
||||
std::string pendingInviterName;
|
||||
|
||||
// Shared quest state
|
||||
bool pendingSharedQuest_ = false;
|
||||
uint32_t sharedQuestId_ = 0;
|
||||
std::string sharedQuestTitle_;
|
||||
std::string sharedQuestSharerName_;
|
||||
uint64_t sharedQuestSharerGuid_ = 0;
|
||||
|
||||
// Summon state
|
||||
bool pendingSummonRequest_ = false;
|
||||
uint64_t summonerGuid_ = 0;
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ private:
|
|||
void renderLootRollPopup(game::GameHandler& gameHandler);
|
||||
void renderTradeRequestPopup(game::GameHandler& gameHandler);
|
||||
void renderSummonRequestPopup(game::GameHandler& gameHandler);
|
||||
void renderSharedQuestPopup(game::GameHandler& gameHandler);
|
||||
void renderBuffBar(game::GameHandler& gameHandler);
|
||||
void renderLootWindow(game::GameHandler& gameHandler);
|
||||
void renderGossipWindow(game::GameHandler& gameHandler);
|
||||
|
|
|
|||
|
|
@ -1994,6 +1994,9 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
case Opcode::SMSG_LOOT_REMOVED:
|
||||
handleLootRemoved(packet);
|
||||
break;
|
||||
case Opcode::SMSG_QUEST_CONFIRM_ACCEPT:
|
||||
handleQuestConfirmAccept(packet);
|
||||
break;
|
||||
case Opcode::SMSG_SUMMON_REQUEST:
|
||||
handleSummonRequest(packet);
|
||||
break;
|
||||
|
|
@ -15043,6 +15046,54 @@ void GameHandler::handleAuctionCommandResult(network::Packet& packet) {
|
|||
" error=", result.errorCode);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SMSG_QUEST_CONFIRM_ACCEPT (shared quest from group member)
|
||||
// uint32 questId + string questTitle + uint64 sharerGuid
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void GameHandler::handleQuestConfirmAccept(network::Packet& packet) {
|
||||
size_t rem = packet.getSize() - packet.getReadPos();
|
||||
if (rem < 4) return;
|
||||
|
||||
sharedQuestId_ = packet.readUInt32();
|
||||
sharedQuestTitle_ = packet.readString();
|
||||
if (packet.getSize() - packet.getReadPos() >= 8) {
|
||||
sharedQuestSharerGuid_ = packet.readUInt64();
|
||||
}
|
||||
|
||||
sharedQuestSharerName_.clear();
|
||||
auto entity = entityManager.getEntity(sharedQuestSharerGuid_);
|
||||
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
||||
sharedQuestSharerName_ = unit->getName();
|
||||
}
|
||||
if (sharedQuestSharerName_.empty()) {
|
||||
char tmp[32];
|
||||
std::snprintf(tmp, sizeof(tmp), "0x%llX",
|
||||
static_cast<unsigned long long>(sharedQuestSharerGuid_));
|
||||
sharedQuestSharerName_ = tmp;
|
||||
}
|
||||
|
||||
pendingSharedQuest_ = true;
|
||||
addSystemChatMessage(sharedQuestSharerName_ + " has shared the quest \"" +
|
||||
sharedQuestTitle_ + "\" with you.");
|
||||
LOG_INFO("SMSG_QUEST_CONFIRM_ACCEPT: questId=", sharedQuestId_,
|
||||
" title=", sharedQuestTitle_, " sharer=", sharedQuestSharerName_);
|
||||
}
|
||||
|
||||
void GameHandler::acceptSharedQuest() {
|
||||
if (!pendingSharedQuest_ || !socket) return;
|
||||
pendingSharedQuest_ = false;
|
||||
network::Packet pkt(wireOpcode(Opcode::CMSG_QUEST_CONFIRM_ACCEPT));
|
||||
pkt.writeUInt32(sharedQuestId_);
|
||||
socket->send(pkt);
|
||||
addSystemChatMessage("Accepted: " + sharedQuestTitle_);
|
||||
}
|
||||
|
||||
void GameHandler::declineSharedQuest() {
|
||||
pendingSharedQuest_ = false;
|
||||
// No response packet needed — just dismiss the UI
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SMSG_SUMMON_REQUEST
|
||||
// uint64 summonerGuid + uint32 zoneId + uint32 timeoutMs
|
||||
|
|
|
|||
|
|
@ -400,6 +400,7 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
|||
renderLootRollPopup(gameHandler);
|
||||
renderTradeRequestPopup(gameHandler);
|
||||
renderSummonRequestPopup(gameHandler);
|
||||
renderSharedQuestPopup(gameHandler);
|
||||
renderGuildInvitePopup(gameHandler);
|
||||
renderGuildRoster(gameHandler);
|
||||
renderBuffBar(gameHandler);
|
||||
|
|
@ -4404,6 +4405,31 @@ void GameScreen::renderDuelRequestPopup(game::GameHandler& gameHandler) {
|
|||
ImGui::End();
|
||||
}
|
||||
|
||||
void GameScreen::renderSharedQuestPopup(game::GameHandler& gameHandler) {
|
||||
if (!gameHandler.hasPendingSharedQuest()) return;
|
||||
|
||||
auto* window = core::Application::getInstance().getWindow();
|
||||
float screenW = window ? static_cast<float>(window->getWidth()) : 1280.0f;
|
||||
|
||||
ImGui::SetNextWindowPos(ImVec2(screenW / 2 - 175, 490), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(350, 0), ImGuiCond_Always);
|
||||
|
||||
if (ImGui::Begin("Shared Quest", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize)) {
|
||||
ImGui::Text("%s has shared a quest with you:", gameHandler.getSharedQuestSharerName().c_str());
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.85f, 0.0f, 1.0f), "\"%s\"", gameHandler.getSharedQuestTitle().c_str());
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ImGui::Button("Accept", ImVec2(130, 30))) {
|
||||
gameHandler.acceptSharedQuest();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Decline", ImVec2(130, 30))) {
|
||||
gameHandler.declineSharedQuest();
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void GameScreen::renderSummonRequestPopup(game::GameHandler& gameHandler) {
|
||||
if (!gameHandler.hasPendingSummonRequest()) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue