feat(Core/Unit): NPCFlags helpers (#11286)

* cherry-pick commit (TrinityCore/TrinityCore@d611925)
Co-Authored-By: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Kitzunu
2022-04-05 13:52:42 +02:00
committed by GitHub
parent e2370446a5
commit edb7cac19b
75 changed files with 293 additions and 285 deletions

View File

@@ -2062,7 +2062,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
return nullptr;
// appropriate npc type
if (npcflagmask && !creature->HasFlag(UNIT_NPC_FLAGS, npcflagmask))
if (npcflagmask && !creature->HasNpcFlag(NPCFlags(npcflagmask)))
return nullptr;
// not allow interaction under control, but allow with own pets
@@ -7543,7 +7543,7 @@ void Player::SendQuestGiverStatusMultiple()
Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr);
if (!questgiver || questgiver->IsHostileTo(this))
continue;
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
if (!questgiver->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER))
continue;
questStatus = GetQuestDialogStatus(questgiver);
@@ -8826,7 +8826,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->SetCreatorGUID(GetGUID());
pet->SetFaction(GetFaction());
pet->setPowerType(POWER_MANA);
pet->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
pet->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pet->InitStatsForLevel(getLevel());
@@ -13866,7 +13866,7 @@ bool Player::CanResummonPet(uint32 spellid)
bool Player::CanSeeSpellClickOn(Creature const* c) const
{
if (!c->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
if (!c->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK))
return false;
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(c->GetEntry());
@@ -13889,7 +13889,7 @@ bool Player::CanSeeSpellClickOn(Creature const* c) const
bool Player::CanSeeVendor(Creature const* creature) const
{
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR))
if (!creature->HasNpcFlag(UNIT_NPC_FLAG_VENDOR))
return true;
ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), 0);