mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 16:26:08 +00:00
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:
@@ -157,7 +157,7 @@ void NPCStaveQuestAI::PrepareForEncounter()
|
||||
SetHomePosition();
|
||||
|
||||
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
void NPCStaveQuestAI::ClearLootIfUnfair(Unit* killer)
|
||||
@@ -233,7 +233,7 @@ void NPCStaveQuestAI::ResetState(uint32 aura = 0)
|
||||
if (InNormalForm())
|
||||
{
|
||||
me->m_Events.KillAllEvents(true);
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
me->RemoveAura(aura);
|
||||
@@ -294,7 +294,7 @@ public:
|
||||
void EnterCombat(Unit* victim) override
|
||||
{
|
||||
RevealForm();
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
if (InNormalForm())
|
||||
{
|
||||
@@ -480,7 +480,7 @@ public:
|
||||
void EnterCombat(Unit* /*victim*/) override
|
||||
{
|
||||
RevealForm();
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) override
|
||||
@@ -646,7 +646,7 @@ public:
|
||||
void EnterCombat(Unit* victim) override
|
||||
{
|
||||
RevealForm();
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
if (!InNormalForm())
|
||||
{
|
||||
@@ -878,7 +878,7 @@ public:
|
||||
void EnterCombat(Unit* victim) override
|
||||
{
|
||||
RevealForm();
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
if (InNormalForm())
|
||||
{
|
||||
@@ -1060,7 +1060,7 @@ public:
|
||||
void EnterCombat(Unit* victim) override
|
||||
{
|
||||
RevealForm();
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
if (!InNormalForm())
|
||||
{
|
||||
|
||||
@@ -675,7 +675,7 @@ public:
|
||||
{
|
||||
ResetFlagTimer = 120000;
|
||||
me->SetFaction(FACTION_PREY);
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override { }
|
||||
@@ -683,7 +683,7 @@ public:
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
// Reset flags after a certain time has passed so that the next player has to start the 'event' again
|
||||
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
|
||||
if (me->HasNpcFlag(UNIT_NPC_FLAG_QUESTGIVER))
|
||||
{
|
||||
if (ResetFlagTimer <= diff)
|
||||
{
|
||||
@@ -705,7 +705,7 @@ public:
|
||||
case TEXT_EMOTE_CHICKEN:
|
||||
if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand() % 30 == 1)
|
||||
{
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->SetFaction(FACTION_FRIENDLY);
|
||||
Talk(EMOTE_HELLO);
|
||||
}
|
||||
@@ -713,7 +713,7 @@ public:
|
||||
case TEXT_EMOTE_CHEER:
|
||||
if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
|
||||
me->SetFaction(FACTION_FRIENDLY);
|
||||
Talk(EMOTE_CLUCK_TEXT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user