aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWarpten <warpten@tc.contrib>2014-07-17 12:22:50 -0400
committerWarpten <warpten@tc.contrib>2014-07-17 12:35:38 -0400
commit3be239ca41765284d6db0414e049bbeea6cf8dd2 (patch)
tree05cf33c84fd7777c2c190da37d03a96de7919056 /src
parent524cc6c2d93edfff6262aa4f6c1abadd9ab26e9d (diff)
Conflicts fix after cherry pick of previous commit from master branch.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp34
-rw-r--r--src/server/game/Entities/Player/Player.h1
2 files changed, 12 insertions, 23 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 2a1635aea41..f2daab1acf6 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3694,13 +3694,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);
@@ -3797,12 +3791,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;
@@ -3813,12 +3802,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;
@@ -4170,10 +4154,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;
}
}
@@ -27912,3 +27893,10 @@ void Player::UpdatePhasing()
GetSession()->SendSetPhaseShift(GetPhases(), terrainswaps, worldAreaSwaps);
}
+
+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 cdf5d1f277d..d54b9aa9a65 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1264,6 +1264,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);