mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +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:
@@ -316,7 +316,7 @@ public:
|
||||
c->SetHomePosition(748.309f, 619.488f, 411.172f, 4.71239f);
|
||||
c->SetPosition(748.309f, 619.488f, 411.172f, 4.71239f);
|
||||
c->SetRespawnTime(3);
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
InstanceProgress = INSTANCE_PROGRESS_INITIAL;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
announcer->SetHomePosition(735.81f, 661.92f, 412.39f, 4.714f);
|
||||
announcer->SetPosition(735.81f, 661.92f, 412.39f, 4.714f);
|
||||
announcer->SetRespawnTime(3);
|
||||
announcer->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
announcer->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
for( uint8 i = 0; i < 3; ++i )
|
||||
if( Creature* c = instance->GetCreature(NPC_GrandChampionGUID[i]) )
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
c->SetHomePosition(743.14f, 628.77f, 411.2f, 4.71239f);
|
||||
c->SetPosition(743.14f, 628.77f, 411.2f, 4.71239f);
|
||||
c->SetRespawnTime(3);
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
NPC_MemoryEntry = 0;
|
||||
InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_DEAD;
|
||||
@@ -411,7 +411,7 @@ public:
|
||||
c->SetHomePosition(743.14f, 628.77f, 411.2f, 4.71239f);
|
||||
c->SetPosition(743.14f, 628.77f, 411.2f, 4.71239f);
|
||||
c->SetRespawnTime(3);
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
InstanceProgress = INSTANCE_PROGRESS_ARGENT_CHALLENGE_DIED;
|
||||
}
|
||||
@@ -968,7 +968,7 @@ public:
|
||||
case EVENT_RESTORE_ANNOUNCER_GOSSIP:
|
||||
{
|
||||
if( Creature* announcer = instance->GetCreature(NPC_AnnouncerGUID) )
|
||||
announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
announcer->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
break;
|
||||
case EVENT_START_ARGENT_CHALLENGE_INTRO:
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if (!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
if (!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) override
|
||||
{
|
||||
if(!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
if(!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
if(uiAction == GOSSIP_ACTION_INFO_DEF + 1338 || uiAction == GOSSIP_ACTION_INFO_DEF + 1341 || uiAction == GOSSIP_ACTION_INFO_DEF + 1339 || uiAction == GOSSIP_ACTION_INFO_DEF + 1340)
|
||||
{
|
||||
pInstance->SetData(DATA_ANNOUNCER_GOSSIP_SELECT, (uiAction == GOSSIP_ACTION_INFO_DEF + 1341 ? 1 : 0));
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
CloseGossipMenuFor(player);
|
||||
|
||||
@@ -767,7 +767,7 @@ public:
|
||||
if( Creature* c = instance->GetCreature(NPC_TirionGUID) )
|
||||
c->AI()->Talk(SAY_STAGE_0_06);
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
}
|
||||
case EVENT_SCENE_101:
|
||||
@@ -946,7 +946,7 @@ public:
|
||||
if( Creature* c = instance->GetCreature(NPC_TirionGUID) )
|
||||
c->AI()->Talk(SAY_STAGE_1_11);
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
}
|
||||
case EVENT_SCENE_201:
|
||||
@@ -1120,7 +1120,7 @@ public:
|
||||
if( Creature* c = instance->GetCreature(NPC_TirionGUID) )
|
||||
c->AI()->Talk(SAY_STAGE_2_06);
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
}
|
||||
case EVENT_SCENE_301:
|
||||
@@ -1435,11 +1435,11 @@ public:
|
||||
{
|
||||
case INSTANCE_PROGRESS_INITIAL:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
break;
|
||||
case INSTANCE_PROGRESS_INTRO_DONE:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
if( Creature* c = instance->GetCreature(NPC_GormokGUID) )
|
||||
{
|
||||
c->AI()->DoAction(-1); // despawn summons
|
||||
@@ -1459,7 +1459,7 @@ public:
|
||||
break;
|
||||
case INSTANCE_PROGRESS_BEASTS_DEAD:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
if( Creature* c = instance->GetCreature(NPC_FizzlebangGUID) )
|
||||
c->DespawnOrUnsummon();
|
||||
NPC_FizzlebangGUID.Clear();
|
||||
@@ -1478,7 +1478,7 @@ public:
|
||||
c->DespawnOrUnsummon();
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
{
|
||||
c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
if( Creature* jaraxxus = c->SummonCreature(NPC_JARAXXUS, Locs[LOC_CENTER].GetPositionX(), Locs[LOC_CENTER].GetPositionY(), Locs[LOC_CENTER].GetPositionZ(), Locs[LOC_CENTER].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000) )
|
||||
{
|
||||
jaraxxus->CastSpell(jaraxxus, 67924, true);
|
||||
@@ -1490,7 +1490,7 @@ public:
|
||||
break;
|
||||
case INSTANCE_PROGRESS_JARAXXUS_DEAD:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
for (ObjectGuid const& guid : NPC_ChampionGUIDs)
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
c->DespawnOrUnsummon();
|
||||
@@ -1498,7 +1498,7 @@ public:
|
||||
break;
|
||||
case INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) )
|
||||
{
|
||||
c->AI()->DoAction(-1);
|
||||
@@ -1521,11 +1521,11 @@ public:
|
||||
if (InstanceProgress == INSTANCE_PROGRESS_ANUB_ARAK)
|
||||
{
|
||||
c->SetVisible(false);
|
||||
c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
c->SetVisible(true);
|
||||
c->SetFacingTo(c->GetOrientation());
|
||||
}
|
||||
@@ -1550,7 +1550,7 @@ public:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
{
|
||||
c->SetVisible(false);
|
||||
c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1566,7 +1566,7 @@ public:
|
||||
|
||||
if( instance->IsHeroic() && AttemptsLeft == 0 )
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
c->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
|
||||
HandleGameObject(GO_MainGateGUID, false);
|
||||
HandleGameObject(GO_EnterGateGUID, true);
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
{
|
||||
if(!creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
|
||||
if(!creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP))
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
gossipTextId = MSG_CRUSADERS;
|
||||
break;
|
||||
case INSTANCE_PROGRESS_DONE:
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 uiAction) override
|
||||
{
|
||||
if( !creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP) )
|
||||
if( !creature->HasNpcFlag(UNIT_NPC_FLAG_GOSSIP) )
|
||||
return true;
|
||||
|
||||
InstanceScript* pInstance = creature->GetInstanceScript();
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
if( uiAction == GOSSIP_ACTION_INFO_DEF + 1337 )
|
||||
{
|
||||
pInstance->SetData(TYPE_ANNOUNCER_GOSSIP_SELECT, 0);
|
||||
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
|
||||
}
|
||||
|
||||
CloseGossipMenuFor(player);
|
||||
|
||||
Reference in New Issue
Block a user