refactor(Core): update getFaction to GetFaction and setFaction to SetFaction (#8708)

This commit is contained in:
Malcrom
2021-11-01 13:04:32 -03:00
committed by GitHub
parent 3396a9da87
commit f106de8788
129 changed files with 418 additions and 444 deletions

View File

@@ -203,7 +203,7 @@ public:
summons.Summon(summon);
if (summon->GetEntry() == NPC_MOLTEN_GOLEM)
{
summon->setFaction(me->getFaction());
summon->SetFaction(me->GetFaction());
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
summon->AI()->AttackStart(target);

View File

@@ -360,7 +360,7 @@ public:
if (Creature* dwarf = me->SummonCreature(NPC_DWARFES_FRIENDLY, RoomPosition[Pos].GetPositionX(), RoomPosition[Pos].GetPositionY(), RoomPosition[Pos].GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
{
if (Player* plr = SelectTargetFromPlayerList(100.0f))
dwarf->setFaction(plr->getFaction());
dwarf->SetFaction(plr->GetFaction());
ActivatePipe(Pos);
dwarf->AI()->AttackStart(me);

View File

@@ -314,7 +314,7 @@ public:
SetDespawnAtEnd(false);
ResetEvent();
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetReactState(REACT_PASSIVE);
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
@@ -341,7 +341,7 @@ public:
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
me->setFaction(i->GetSource()->getFaction());
me->SetFaction(i->GetSource()->GetFaction());
break;
}
@@ -356,7 +356,7 @@ public:
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
break;
case ACTION_START_SJONNIR_FIGHT:
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->Yell("Don't worry! Ol' Brann's got yer back! Keep that metal monstrosity busy, and I'll see if I can't sweet talk this machine into helping ye!", LANG_UNIVERSAL);
me->PlayDirectSound(14274);
SetEscortPaused(false);

View File

@@ -379,7 +379,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetSheath(SHEATH_STATE_UNARMED);
me->setFaction(190);
me->SetFaction(190);
me->CastSpell(me, SPELL_DUAL_WIELD, true);
_phaseTwo = false;
@@ -437,7 +437,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->InterruptNonMeleeSpells(false);
if (m_pInstance)
@@ -602,7 +602,7 @@ public:
damage = 0;
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
events.Reset();
summons.DespawnAll();
@@ -666,7 +666,7 @@ public:
me->CastSpell((Unit*)nullptr, SPELL_SUPERMASSIVE_FAIL, true);
// Hack: _IsValidTarget failed earlier due to flags, call AttackStart again
me->SetReactState(REACT_AGGRESSIVE);
me->setFaction(14);
me->SetFaction(FACTION_MONSTER);
if (Player* target = SelectTargetFromPlayerList(150.0f))
AttackStart(target);
me->SetInCombatWithZone();

View File

@@ -344,7 +344,7 @@ public:
damage = 0;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetHealth(me->GetMaxHealth());
me->CombatStop();
me->RemoveAllAuras();

View File

@@ -347,7 +347,7 @@ public:
}
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->GetMotionMaster()->Clear();
me->AttackStop();
me->CombatStop();
@@ -522,7 +522,7 @@ public:
if( Creature* h_p = me->SummonCreature(hhd[k][i].id, hhd[k][i].x, hhd[k][i].y, 432.69f, M_PI / 2) )
{
h_p->setFaction(1665);
h_p->SetFaction(1665);
if( cnt < 8 )
Helpers[cnt++] = h_p->GetGUID();

View File

@@ -570,7 +570,7 @@ public:
{
_encounterFinished = true;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetHealth(me->GetMaxHealth());
me->CombatStop();
me->RemoveAllAuras();

View File

@@ -267,7 +267,7 @@ public:
void PassengerBoarded(Unit* p, int8 /*seat*/, bool /*apply*/) override
{
me->setFaction(p->getFaction());
me->SetFaction(p->GetFaction());
me->SetReactState(REACT_PASSIVE);
}
@@ -282,7 +282,7 @@ public:
me->CombatStop(true);
me->SetReactState(REACT_PASSIVE);
me->SetRegeneratingHealth(false);
me->setFaction(31);
me->SetFaction(FACTION_PREY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
me->CastSpell(me, 64770, true);
}
@@ -290,13 +290,13 @@ public:
void AttackStart(Unit* who) override
{
if (me->getFaction() == 16)
if (me->GetFaction() == FACTION_MONSTER_2)
ScriptedAI::AttackStart(who);
}
void EnterEvadeMode() override
{
if (me->getFaction() == 16)
if (me->GetFaction() == FACTION_MONSTER_2)
ScriptedAI::EnterEvadeMode();
}
@@ -304,7 +304,7 @@ public:
void UpdateAI(uint32 diff) override
{
if (me->getFaction() != 16)
if (me->GetFaction() != FACTION_MONSTER_2)
{
if (me->IsAlive() && (me->GetExactDist2dSq(2058.0f, 42.0f) < 25.0f * 25.0f || me->GetExactDist2dSq(2203.0f, 292.0f) < 25.0f * 25.0f || me->GetExactDist2dSq(2125.0f, 170.0f) > 160.0f * 160.0f))
Unit::Kill(me, me, false);