mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
fix: clear lastInteractedGoGuid_ on cast failure, cancel, and world reset
If a gather cast was interrupted by SMSG_SPELL_FAILURE (e.g. player took damage during mining), lastInteractedGoGuid_ was left set. A subsequent timed cast completion would then fire CMSG_LOOT for the stale node even though the gather never completed. Clear lastInteractedGoGuid_ in all cast-termination paths: - SMSG_SPELL_FAILURE (cast interrupted by server) - SMSG_CAST_RESULT non-zero (cast rejected before it started) - cancelCast() (player or system cancelled the cast) - World reset / logout block (state-clear boundary)
This commit is contained in:
parent
cc2b413e22
commit
7a4347dbac
1 changed files with 7 additions and 1 deletions
|
|
@ -2002,6 +2002,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
castIsChannel = false;
|
||||
currentCastSpellId = 0;
|
||||
castTimeRemaining = 0.0f;
|
||||
lastInteractedGoGuid_ = 0;
|
||||
// Pass player's power type so result 85 says "Not enough rage/energy/etc."
|
||||
int playerPowerType = -1;
|
||||
if (auto pe = entityManager.getEntity(playerGuid)) {
|
||||
|
|
@ -3012,10 +3013,12 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
}
|
||||
if (failGuid == playerGuid || failGuid == 0) {
|
||||
// Player's own cast failed
|
||||
// Player's own cast failed — clear gather-node loot target so the
|
||||
// next timed cast doesn't try to loot a stale interrupted gather node.
|
||||
casting = false;
|
||||
castIsChannel = false;
|
||||
currentCastSpellId = 0;
|
||||
lastInteractedGoGuid_ = 0;
|
||||
if (auto* renderer = core::Application::getInstance().getRenderer()) {
|
||||
if (auto* ssm = renderer->getSpellSoundManager()) {
|
||||
ssm->stopPrecast();
|
||||
|
|
@ -7996,6 +7999,7 @@ void GameHandler::selectCharacter(uint64_t characterGuid) {
|
|||
castIsChannel = false;
|
||||
currentCastSpellId = 0;
|
||||
pendingGameObjectInteractGuid_ = 0;
|
||||
lastInteractedGoGuid_ = 0;
|
||||
castTimeRemaining = 0.0f;
|
||||
castTimeTotal = 0.0f;
|
||||
playerDead_ = false;
|
||||
|
|
@ -12219,6 +12223,7 @@ void GameHandler::stopCasting() {
|
|||
castIsChannel = false;
|
||||
currentCastSpellId = 0;
|
||||
pendingGameObjectInteractGuid_ = 0;
|
||||
lastInteractedGoGuid_ = 0;
|
||||
castTimeRemaining = 0.0f;
|
||||
castTimeTotal = 0.0f;
|
||||
|
||||
|
|
@ -15912,6 +15917,7 @@ void GameHandler::cancelCast() {
|
|||
socket->send(packet);
|
||||
}
|
||||
pendingGameObjectInteractGuid_ = 0;
|
||||
lastInteractedGoGuid_ = 0;
|
||||
casting = false;
|
||||
castIsChannel = false;
|
||||
currentCastSpellId = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue