refactor(Core/Spells): Add helpers for HasAuraType (#20802)

This commit is contained in:
Kitzunu
2024-12-01 12:50:59 +01:00
committed by GitHub
parent 55f6bd0972
commit ed008a8780
41 changed files with 183 additions and 140 deletions

View File

@@ -1068,7 +1068,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
// Xinef: fix vendors falling of player vehicle, due to isBeingLoaded checks
if (pCurrChar->IsInWorld())
{
if (pCurrChar->GetMountBlockId() && !pCurrChar->HasAuraType(SPELL_AURA_MOUNTED))
if (pCurrChar->GetMountBlockId() && !pCurrChar->HasMountedAura())
{
pCurrChar->CastSpell(pCurrChar, pCurrChar->GetMountBlockId(), true);
pCurrChar->SetMountBlockId(0);

View File

@@ -63,7 +63,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
if (GetPlayer()->IsAlive() || GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_GHOST))
return;
if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
if (GetPlayer()->HasPreventResurectionAura())
return; // silently return, client should display the error by itself
// the world update order is sessions, players, creatures
@@ -674,7 +674,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
recv_data >> status;
// Xinef: Prevent resurrect with prevent resurrection aura
if (GetPlayer()->IsAlive() || GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION))
if (GetPlayer()->IsAlive() || GetPlayer()->HasPreventResurectionAura())
return;
if (status == 0)

View File

@@ -209,7 +209,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
case COMMAND_ATTACK: //spellId=1792 //ATTACK
{
// Can't attack if owner is pacified
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
if (_player->HasPacifyAura())
{
//pet->SendPetCastFail(spellId, SPELL_FAILED_PACIFIED);
//TODO: Send proper error message to client
@@ -467,7 +467,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
spell->finish(false);
delete spell;
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
if (_player->HasPacifyAura())
return;
bool tempspellIsPositive = false;
@@ -653,7 +653,7 @@ bool WorldSession::CheckStableMaster(ObjectGuid guid)
// spell case or GM
if (guid == GetPlayer()->GetGUID())
{
if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasOpenStableAura())
{
LOG_DEBUG("network.opcode", "Player ({}) attempt open stable in cheating way.", guid.ToString());
return false;

View File

@@ -633,7 +633,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/)
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)))
{
if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION) && !spell->HasAttribute(SPELL_ATTR7_BYPASS_NO_RESURRECTION_AURA))
if (_player->HasPreventResurectionAura() && !spell->HasAttribute(SPELL_ATTR7_BYPASS_NO_RESURRECTION_AURA))
{
return; // silent return, client should display error by itself and not send this opcode
}
@@ -672,7 +672,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
if (!unit)
return;
if (!unit->HasAuraType(SPELL_AURA_CLONE_CASTER))
if (!unit->HasCloneCasterAura())
return;
// Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)