diff options
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 33 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 1 |
2 files changed, 11 insertions, 23 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2e60e4065a5..33469a4db7a 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3623,13 +3623,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent else if (IsInWorld()) { if (next_active_spell_id) - { - // update spell ranks in spellbook and action bar - WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); - data << uint32(spellId); - data << uint32(next_active_spell_id); - GetSession()->SendPacket(&data); - } + SendSupercededSpell(spellId, next_active_spell_id); else { WorldPacket data(SMSG_REMOVED_SPELL, 4); @@ -3726,12 +3720,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent if (spellInfo->IsHighRankOf(i_spellInfo)) { if (IsInWorld()) // not send spell (re-/over-)learn packets at loading - { - WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); - data << uint32(itr2->first); - data << uint32(spellId); - GetSession()->SendPacket(&data); - } + SendSupercededSpell(itr2->first, spellId); // mark old spell as disable (SMSG_SUPERCEDED_SPELL replace it in client by new) itr2->second->active = false; @@ -3742,12 +3731,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent else { if (IsInWorld()) // not send spell (re-/over-)learn packets at loading - { - WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); - data << uint32(spellId); - data << uint32(itr2->first); - GetSession()->SendPacket(&data); - } + SendSupercededSpell(spellId, itr2->first); // mark new spell as disable (not learned yet for client and will not learned) newspell->active = false; @@ -4123,10 +4107,7 @@ void Player::RemoveSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if (AddSpell(prev_id, true, false, prev_itr->second->dependent, prev_itr->second->disabled)) { // downgrade spell ranks in spellbook and action bar - WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); - data << uint32(spell_id); - data << uint32(prev_id); - GetSession()->SendPacket(&data); + SendSupercededSpell(spell_id, prev_id); prev_activate = true; } } @@ -26832,3 +26813,9 @@ bool Player::IsLoading() const { return GetSession()->PlayerLoading(); } + +void Player::SendSupercededSpell(uint32 oldSpell, uint32 newSpell) +{ + WorldPacket data(SMSG_SUPERCEDED_SPELL, 8); + data << uint32(oldSpell) << uint32(newSpell); + GetSession()->SendPacket(&data); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 3f349189770..23a0f565a72 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1113,6 +1113,7 @@ class Player : public Unit, public GridObject<Player> void SendInitialPacketsBeforeAddToMap(); void SendInitialPacketsAfterAddToMap(); + void SendSupercededSpell(uint32 oldSpell, uint32 newSpell); void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0); void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time); |
