aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/SpellHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index d3e8db0004a..ca011dfd61f 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -461,19 +461,20 @@ void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& tot
totem->ToTotem()->UnSummon();
}
-void WorldSession::HandleSelfResOpcode(WorldPackets::Spells::SelfRes& /*packet*/)
+void WorldSession::HandleSelfResOpcode(WorldPackets::Spells::SelfRes& selfRes)
{
if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
return; // silent return, client should display error by itself and not send this opcode
- if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL))
- {
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL));
- if (spellInfo)
- _player->CastSpell(_player, spellInfo, false, nullptr);
+ std::vector<uint32> const& selfResSpells = _player->GetDynamicValues(PLAYER_DYNAMIC_FIELD_SELF_RES_SPELLS);
+ if (std::find(selfResSpells.begin(), selfResSpells.end(), selfRes.SpellID) == selfResSpells.end())
+ return;
- _player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0);
- }
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(selfRes.SpellID);
+ if (spellInfo)
+ _player->CastSpell(_player, spellInfo, false, nullptr);
+
+ _player->RemoveDynamicValue(PLAYER_DYNAMIC_FIELD_SELF_RES_SPELLS, selfRes.SpellID);
}
void WorldSession::HandleSpellClick(WorldPackets::Spells::SpellClick& spellClick)