mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix resurrect: correct packet routing and show caster name in dialog
Two bugs fixed: 1. acceptResurrect() was always sending CMSG_SPIRIT_HEALER_ACTIVATE even for player-cast resurrections (Priest/Paladin/Druid). That opcode is only the correct response to SMSG_SPIRIT_HEALER_CONFIRM. For SMSG_RESURRECT_REQUEST the server expects CMSG_RESURRECT_RESPONSE with accept=1. Added resurrectIsSpiritHealer_ to track which path triggered the dialog and send the right packet per type. 2. The resurrect dialog showed a generic "Return to life?" string regardless of who cast the resurrection. Parse the optional CString name from SMSG_RESURRECT_REQUEST (or fall back to playerNameCache) and display "X wishes to resurrect you." when the caster is known.
This commit is contained in:
parent
ede380ec60
commit
c6e39707de
3 changed files with 39 additions and 10 deletions
|
|
@ -2942,6 +2942,8 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
LOG_INFO("Spirit healer confirm from 0x", std::hex, npcGuid, std::dec);
|
||||
if (npcGuid) {
|
||||
resurrectCasterGuid_ = npcGuid;
|
||||
resurrectCasterName_ = "";
|
||||
resurrectIsSpiritHealer_ = true;
|
||||
resurrectRequestPending_ = true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -2952,9 +2954,22 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
break;
|
||||
}
|
||||
uint64_t casterGuid = packet.readUInt64();
|
||||
LOG_INFO("Resurrect request from 0x", std::hex, casterGuid, std::dec);
|
||||
// Optional caster name (CString, may be absent on some server builds)
|
||||
std::string casterName;
|
||||
if (packet.getReadPos() < packet.getSize()) {
|
||||
casterName = packet.readString();
|
||||
}
|
||||
LOG_INFO("Resurrect request from 0x", std::hex, casterGuid, std::dec,
|
||||
" name='", casterName, "'");
|
||||
if (casterGuid) {
|
||||
resurrectCasterGuid_ = casterGuid;
|
||||
resurrectIsSpiritHealer_ = false;
|
||||
if (!casterName.empty()) {
|
||||
resurrectCasterName_ = casterName;
|
||||
} else {
|
||||
auto nit = playerNameCache.find(casterGuid);
|
||||
resurrectCasterName_ = (nit != playerNameCache.end()) ? nit->second : "";
|
||||
}
|
||||
resurrectRequestPending_ = true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -9455,11 +9470,19 @@ void GameHandler::activateSpiritHealer(uint64_t npcGuid) {
|
|||
|
||||
void GameHandler::acceptResurrect() {
|
||||
if (state != WorldState::IN_WORLD || !socket || !resurrectRequestPending_) return;
|
||||
// Send spirit healer activate (correct response to SMSG_SPIRIT_HEALER_CONFIRM)
|
||||
auto activate = SpiritHealerActivatePacket::build(resurrectCasterGuid_);
|
||||
socket->send(activate);
|
||||
LOG_INFO("Sent CMSG_SPIRIT_HEALER_ACTIVATE (0x21C) for 0x",
|
||||
std::hex, resurrectCasterGuid_, std::dec);
|
||||
if (resurrectIsSpiritHealer_) {
|
||||
// Spirit healer resurrection — SMSG_SPIRIT_HEALER_CONFIRM → CMSG_SPIRIT_HEALER_ACTIVATE
|
||||
auto activate = SpiritHealerActivatePacket::build(resurrectCasterGuid_);
|
||||
socket->send(activate);
|
||||
LOG_INFO("Sent CMSG_SPIRIT_HEALER_ACTIVATE for 0x",
|
||||
std::hex, resurrectCasterGuid_, std::dec);
|
||||
} else {
|
||||
// Player-cast resurrection — SMSG_RESURRECT_REQUEST → CMSG_RESURRECT_RESPONSE (accept=1)
|
||||
auto resp = ResurrectResponsePacket::build(resurrectCasterGuid_, true);
|
||||
socket->send(resp);
|
||||
LOG_INFO("Sent CMSG_RESURRECT_RESPONSE (accept) for 0x",
|
||||
std::hex, resurrectCasterGuid_, std::dec);
|
||||
}
|
||||
resurrectRequestPending_ = false;
|
||||
resurrectPending_ = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue