mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
[3.3.5] CastSpell unclusterfucking (that's a word now) (#21123)
Core/Spell: The giant CastSpell unclusterfucking (that's a word now) of this generation.
- CastSpell now always takes three arguments - target, spellId, and a struct containing extra arguments
- This struct (CastSpellExtraArgs, see SpellDefines.h) serves as a conglomerate of every previous combination of the 20 billion different CastSpell overloads, all merged into one
- It has some great utility constructors - check them out! All of these can be used to implicitly construct the ExtraArgs object.
- A gajillion refactors to make everything behave the way it always has
(cherry picked from commit d507a7e338)
This commit is contained in:
@@ -342,7 +342,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast)
|
||||
spell->m_fromClient = true;
|
||||
spell->m_misc.Raw.Data[0] = cast.Cast.Misc[0];
|
||||
spell->m_misc.Raw.Data[1] = cast.Cast.Misc[1];
|
||||
spell->prepare(&targets);
|
||||
spell->prepare(targets);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCancelCastOpcode(WorldPackets::Spells::CancelCast& packet)
|
||||
@@ -489,14 +489,10 @@ 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
|
||||
|
||||
auto const& selfResSpells = _player->m_activePlayerData->SelfResSpells;
|
||||
if (std::find(selfResSpells.begin(), selfResSpells.end(), selfRes.SpellID) == selfResSpells.end())
|
||||
if (_player->m_activePlayerData->SelfResSpells.FindIndex(selfRes.SpellID) < 0)
|
||||
return;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(selfRes.SpellID, _player->GetMap()->GetDifficultyID());
|
||||
if (spellInfo)
|
||||
_player->CastSpell(_player, spellInfo, false, nullptr);
|
||||
|
||||
_player->CastSpell(_player, selfRes.SpellID, _player->GetMap()->GetDifficultyID());
|
||||
_player->RemoveSelfResSpell(selfRes.SpellID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user