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

@@ -94,9 +94,7 @@ enum MiscIds
SPELL_SHADOW_INFERNO_DAMAGE = 39646,
SPELL_CHAOTIC_CHARGE = 41033,
SPELL_DEMENTIA1 = 41406,
SPELL_DEMENTIA2 = 41409,
FACTION_ASHTONGUE = 1820
SPELL_DEMENTIA2 = 41409
};
template <class AI, class T>

View File

@@ -118,7 +118,7 @@ public:
{
ashtongueGUIDs.push_back(creature->GetGUID());
if (GetBossState(DATA_SHADE_OF_AKAMA) == DONE)
creature->setFaction(FACTION_ASHTONGUE);
creature->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
}
}
@@ -202,7 +202,7 @@ public:
{
for (ObjectGuid const& guid : ashtongueGUIDs)
if (Creature* ashtongue = instance->GetCreature(guid))
ashtongue->setFaction(FACTION_ASHTONGUE);
ashtongue->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
}
else if (type == DATA_ILLIDARI_COUNCIL && state == DONE)
{

View File

@@ -326,7 +326,7 @@ public:
void Reset()
{
me->SetDisableGravity(true);
me->setFaction(14);
me->SetFaction(FACTION_MONSTER);
MovementTimer = 0;
ToxicSporeTimer = 5000;
BoltTimer = 5500;
@@ -364,7 +364,7 @@ public:
{
if (Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000))
{
trig->setFaction(14);
trig->SetFaction(FACTION_MONSTER);
trig->CastSpell(trig, SPELL_TOXIC_SPORES, true);
}
}
@@ -382,7 +382,7 @@ public:
// remove
me->setDeathState(DEAD);
me->RemoveCorpse();
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
}
CheckTimer = 1000;

View File

@@ -72,7 +72,7 @@ public:
void JustSummoned(Creature* summoned) override
{
summoned->setFaction(16);
summoned->SetFaction(FACTION_MONSTER_2);
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->CastSpell(summoned, SPELL_POISON, false, 0, 0, me->GetGUID());

View File

@@ -82,8 +82,6 @@ enum Aeranas
{
SAY_SUMMON = 0,
SAY_FREE = 1,
FACTION_HOSTILE = 16,
FACTION_FRIENDLY = 35,
SPELL_ENVELOPING_WINDS = 15535,
SPELL_SHOCK = 12553
};
@@ -104,7 +102,7 @@ public:
shock_Timer = 5000;
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FRIENDLY);
Talk(SAY_SUMMON);
}
@@ -115,7 +113,7 @@ public:
{
if (faction_Timer <= diff)
{
me->setFaction(FACTION_HOSTILE);
me->SetFaction(FACTION_MONSTER_2);
faction_Timer = 0;
}
else faction_Timer -= diff;
@@ -126,7 +124,7 @@ public:
if (HealthBelowPct(30))
{
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->RemoveAllAuras();
me->DeleteThreatList();
@@ -249,8 +247,7 @@ enum WoundedBloodElf
SAY_ELF_AGGRO = 5,
QUEST_ROAD_TO_FALCON_WATCH = 9375,
NPC_HAALESHI_WINDWALKER = 16966,
NPC_HAALESHI_TALONGUARD = 16967,
FACTION_FALCON_WATCH_QUEST = 775
NPC_HAALESHI_TALONGUARD = 16967
};
class npc_wounded_blood_elf : public CreatureScript
@@ -279,7 +276,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
{
me->setFaction(FACTION_FALCON_WATCH_QUEST);
me->SetFaction(FACTION_ESCORTEE_H_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
}
}

View File

@@ -76,7 +76,7 @@ public:
if (npc_maghar_captiveAI* EscortAI = dynamic_cast<npc_maghar_captiveAI*>(creature->AI()))
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
creature->setFaction(232);
creature->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE);
EscortAI->Start(true, false, player->GetGUID(), quest);
creature->AI()->Talk(SAY_MAG_START);

View File

@@ -54,10 +54,7 @@ enum DeathblowToTheLegion
DEATHBLOW_TO_THE_LEGION = 10409, // Quest ID
TURNING_POINT = 10507, // Quest ID
SOCRETHAR_QUEST_CREDIT = 35762, // Quest spell
SOCRETHAR_TP_STONE = 29796,
EXODAR_FACTION = 1806,
EXODAR_ENEMY_FACTION = 90
SOCRETHAR_TP_STONE = 29796
};
enum RoleplayActions
@@ -606,7 +603,7 @@ public:
void Reset() override
{
me->SetReactState(REACT_PASSIVE);
me->setFaction(EXODAR_ENEMY_FACTION);
me->SetFaction(FACTION_DEMON);
adyen = nullptr;
orelis = nullptr;
karja = nullptr;
@@ -750,7 +747,7 @@ public:
case EVENT_FIGHT_ALDOR:
if (GetCreature(KAYLAAN_THE_LOST))
{
kaylaan->setFaction(EXODAR_ENEMY_FACTION);
kaylaan->SetFaction(FACTION_DEMON);
if (GetCreature(ADYEN_THE_LIGHTBRINGER))
kaylaan->AI()->AttackStart(adyen);
}
@@ -758,7 +755,7 @@ public:
case EVENT_END_ALDOR_FIGHT:
if (GetCreature(KAYLAAN_THE_LOST))
{
kaylaan->setFaction(EXODAR_FACTION);
kaylaan->SetFaction(FACTION_DEMON);
kaylaan->GetMotionMaster()->MoveTargetedHome();
kaylaan->CombatStop();
kaylaan->ClearInCombat();
@@ -876,7 +873,7 @@ public:
break;
case EVENT_FINAL_FIGHT:
// Prepare Socrethar for encounter
me->setFaction(EXODAR_ENEMY_FACTION);
me->SetFaction(FACTION_DEMON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
me->SetReactState(REACT_AGGRESSIVE);
@@ -1150,7 +1147,7 @@ public:
{
summons.Summon(*itr);
(*itr)->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
(*itr)->setFaction(250);
(*itr)->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
cl.clear();
me->GetCreaturesWithEntryInRange(cl, 20.0f, NPC_PROTECTORATE_DEFENDER);
@@ -1158,10 +1155,10 @@ public:
{
summons.Summon(*itr);
(*itr)->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
(*itr)->setFaction(250);
(*itr)->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
me->setFaction(250);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
Talk(SAY_SAEED_0);
events.ScheduleEvent(EVENT_START_WALK, 3000);
}
@@ -1824,7 +1821,7 @@ public:
{
if (quest->GetQuestId() == Q_ALMABTRIEB)
{
creature->setFaction(113);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->AI()->Talk(SAY_BESSY_0);
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
@@ -1992,7 +1989,7 @@ public:
{
if (npc_maxx_a_million_escortAI* pEscortAI = CAST_AI(npc_maxx_a_million_escort::npc_maxx_a_million_escortAI, creature->AI()))
{
creature->setFaction(113);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
pEscortAI->Start(false, false, player->GetGUID());
}
}

View File

@@ -75,7 +75,7 @@ public:
Creature* cr2 = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ() + 2.0f, 0.0f, 100);
if (cr2)
{
cr2->setFaction(14);
cr2->SetFaction(FACTION_MONSTER);
cr2->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
GetCaster()->CastSpell(cr2, 38083, true);
}
@@ -428,10 +428,6 @@ public:
enum EnshlavedNetherwingDrake
{
// Factions
FACTION_DEFAULT = 62,
FACTION_FRIENDLY = 1840, // Not sure if this is correct, it was taken off of Mordenai.
// Spells
SPELL_HIT_FORCE_OF_NELTHARAKU = 38762,
SPELL_FORCE_OF_NELTHARAKU = 38775,
@@ -467,7 +463,7 @@ public:
void Reset() override
{
if (!Tapped)
me->setFaction(FACTION_DEFAULT);
me->SetFaction(FACTION_ORC_DRAGONMAW);
FlyTimer = 1000;
me->SetDisableGravity(false);
@@ -484,7 +480,7 @@ public:
Tapped = true;
PlayerGUID = caster->GetGUID();
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FLAYER_HUNTER); // Not sure if this is correct, it was taken off of Mordenai.
Unit* Dragonmaw = me->FindNearestCreature(NPC_DRAGONMAW_SUBJUGATOR, 50);
if (Dragonmaw)
@@ -835,8 +831,7 @@ enum Earthmender
SPELL_HEALING_WAVE = 12491,
QUEST_ESCAPE_COILSCAR = 10451,
NPC_COILSKAR_ASSASSIN = 21044,
FACTION_EARTHEN = 1726 //guessed
NPC_COILSKAR_ASSASSIN = 21044
};
class npc_earthmender_wilda : public CreatureScript
@@ -849,7 +844,7 @@ public:
if (quest->GetQuestId() == QUEST_ESCAPE_COILSCAR)
{
creature->AI()->Talk(SAY_WIL_START, player);
creature->setFaction(FACTION_EARTHEN);
creature->SetFaction(FACTION_EARTHEN_RING); //guessed
if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wilda::npc_earthmender_wildaAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
@@ -1640,11 +1635,7 @@ enum Enraged_Dpirits
NPC_CREDIT_EARTH = 21092,
// Captured Spell / Buff
SPELL_SOUL_CAPTURED = 36115,
// Factions
FACTION_ENRAGED_SOUL_FRIENDLY = 35,
FACTION_ENRAGED_SOUL_HOSTILE = 14
SPELL_SOUL_CAPTURED = 36115
};
class npc_enraged_spirit : public CreatureScript
@@ -1712,7 +1703,7 @@ public:
totemOspirits = me->FindNearestCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS);
if (totemOspirits)
{
Summoned->setFaction(FACTION_ENRAGED_SOUL_FRIENDLY);
Summoned->SetFaction(FACTION_FRIENDLY);
Summoned->GetMotionMaster()->MovePoint(0, totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ());
if (Unit* owner = totemOspirits->GetOwner())

View File

@@ -47,8 +47,7 @@ EndContentData */
enum Raliq
{
SPELL_UPPERCUT = 10966,
QUEST_CRACK_SKULLS = 10009,
FACTION_HOSTILE_RD = 45
QUEST_CRACK_SKULLS = 10009
};
class npc_raliq_the_drunk : public CreatureScript
@@ -62,7 +61,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
creature->setFaction(FACTION_HOSTILE_RD);
creature->SetFaction(FACTION_OGRE);
creature->AI()->AttackStart(player);
}
return true;
@@ -86,7 +85,7 @@ public:
{
npc_raliq_the_drunkAI(Creature* creature) : ScriptedAI(creature)
{
m_uiNormFaction = creature->getFaction();
m_uiNormFaction = creature->GetFaction();
}
uint32 m_uiNormFaction;
@@ -121,10 +120,6 @@ public:
enum Salsalabim
{
// Factions
FACTION_HOSTILE_SA = 90,
FACTION_FRIENDLY_SA = 35,
// Quests
QUEST_10004 = 10004,
@@ -141,7 +136,7 @@ public:
{
if (player->GetQuestStatus(QUEST_10004) == QUEST_STATUS_INCOMPLETE)
{
creature->setFaction(FACTION_HOSTILE_SA);
creature->SetFaction(FACTION_DEMON);
creature->AI()->AttackStart(player);
}
else

View File

@@ -335,7 +335,6 @@ enum UnkorTheRuthless
SAY_SUBMIT = 0,
FACTION_HOSTILE = 45,
FACTION_FRIENDLY = 35,
QUEST_DONTKILLTHEFATONE = 9889,
SPELL_PULVERIZE = 2676
@@ -365,7 +364,7 @@ public:
UnkorUnfriendly_Timer = 0;
Pulverize_Timer = 3000;
me->SetStandState(UNIT_STAND_STATE_STAND);
me->setFaction(FACTION_HOSTILE);
me->SetFaction(FACTION_HOSTILE);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -373,7 +372,7 @@ public:
void DoNice()
{
Talk(SAY_SUBMIT);
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT);
me->RemoveAllAuras();
me->DeleteThreatList();
@@ -527,7 +526,6 @@ enum Floon
SPELL_FROSTBOLT = 9672,
SPELL_FROST_NOVA = 11831,
FACTION_HOSTILE_FL = 1738,
QUEST_CRACK_SKULLS = 10009
};
@@ -547,7 +545,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
CloseGossipMenuFor(player);
creature->setFaction(FACTION_HOSTILE_FL);
creature->SetFaction(FACTION_ARAKKOA);
creature->AI()->Talk(SAY_FLOON_ATTACK, player);
creature->AI()->AttackStart(player);
}
@@ -572,7 +570,7 @@ public:
{
npc_floonAI(Creature* creature) : ScriptedAI(creature)
{
m_uiNormFaction = creature->getFaction();
m_uiNormFaction = creature->GetFaction();
}
uint32 m_uiNormFaction;
@@ -585,8 +583,8 @@ public:
Silence_Timer = 2000;
Frostbolt_Timer = 4000;
FrostNova_Timer = 9000;
if (me->getFaction() != m_uiNormFaction)
me->setFaction(m_uiNormFaction);
if (me->GetFaction() != m_uiNormFaction)
me->SetFaction(m_uiNormFaction);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -754,7 +752,7 @@ public:
if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A)
{
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
creature->setFaction(250);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
return true;
}

View File

@@ -250,8 +250,7 @@ public:
enum Cooshhooosh
{
SPELL_LIGHTNING_BOLT = 9532,
QUEST_CRACK_SKULLS = 10009,
FACTION_HOSTILE_CO = 45
QUEST_CRACK_SKULLS = 10009
};
class npc_cooshcoosh : public CreatureScript
@@ -263,7 +262,7 @@ public:
{
npc_cooshcooshAI(Creature* creature) : ScriptedAI(creature)
{
m_uiNormFaction = creature->getFaction();
m_uiNormFaction = creature->GetFaction();
}
uint32 m_uiNormFaction;
@@ -272,8 +271,8 @@ public:
void Reset() override
{
LightningBolt_Timer = 2000;
if (me->getFaction() != m_uiNormFaction)
me->setFaction(m_uiNormFaction);
if (me->GetFaction() != m_uiNormFaction)
me->SetFaction(m_uiNormFaction);
}
void EnterCombat(Unit* /*who*/) override { }
@@ -314,7 +313,7 @@ public:
if (action == GOSSIP_ACTION_INFO_DEF)
{
CloseGossipMenuFor(player);
creature->setFaction(FACTION_HOSTILE_CO);
creature->SetFaction(FACTION_OGRE);
creature->AI()->AttackStart(player);
}
return true;