Skip to content

Commit 567fdbd

Browse files
committed
Core/Defines: define faction templates and replace magic numbers from scripts
(cherry picked from commit c34b83a) * This took two freaking days.
1 parent 8af17d0 commit 567fdbd

84 files changed

Lines changed: 220 additions & 272 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/server/game/Battlefield/Zones/BattlefieldWG.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
5757
};
5858

5959
uint32 const ClockWorldState[] = { 3781, 4354 };
60-
uint32 const WintergraspFaction[] = { 1732, 1735, 35 };
60+
uint32 const WintergraspFaction[] = { FACTION_ALLIANCE_GENERIC_WG, FACTION_HORDE_GENERIC_WG, FACTION_FRIENDLY };
6161

6262
Position const WintergraspStalkerPos = { 4948.985f, 2937.789f, 550.5172f, 1.815142f };
6363

‎src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
401401
//aura should only apply to players who have accupied the node, set correct faction for trigger
402402
if (trigger)
403403
{
404-
trigger->SetFaction(team == ALLIANCE ? 84 : 83);
404+
trigger->SetFaction(team == ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
405405
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
406406
}
407407
}

‎src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
780780
DelCreature(node + 302);
781781
return;
782782
}
783-
trigger->SetFaction(owner == ALLIANCE ? 84 : 83);
783+
trigger->SetFaction(owner == ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
784784
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
785785
}
786786
}

‎src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point)
813813
//aura should only apply to players who have accupied the node, set correct faction for trigger
814814
if (trigger)
815815
{
816-
trigger->SetFaction(Team == ALLIANCE ? 84 : 83);
816+
trigger->SetFaction(Team == ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
817817
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
818818
}
819819
}

‎src/server/game/Entities/GameObject/GameObject.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId, TriggerCastFlags trigge
20702070
}
20712071
else
20722072
{
2073-
trigger->SetFaction(spellInfo->IsPositive() ? 35 : 14);
2073+
trigger->SetFaction(spellInfo->IsPositive() ? FACTION_FRIENDLY : FACTION_MONSTER);
20742074
// Set owner guid for target if no owner available - needed by trigger auras
20752075
// - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
20762076
trigger->CastSpell(target ? target : trigger, spellInfo, triggered, nullptr, nullptr, target ? target->GetGUID() : ObjectGuid::Empty);

‎src/server/game/Entities/Player/Player.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,13 +2377,13 @@ void Player::SetGameMaster(bool on)
23772377
if (on)
23782378
{
23792379
m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
2380-
SetFaction(35);
2380+
SetFaction(FACTION_FRIENDLY);
23812381
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
23822382
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
23832383

23842384
if (Pet* pet = GetPet())
23852385
{
2386-
pet->SetFaction(35);
2386+
pet->SetFaction(FACTION_FRIENDLY);
23872387
pet->getHostileRefManager().setOnlineOfflineState(false);
23882388
}
23892389

‎src/server/game/Miscellaneous/SharedDefines.h‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,51 @@ enum ReputationRank
270270
REP_EXALTED = 7
271271
};
272272

273+
enum FactionTemplates
274+
{
275+
FACTION_NONE = 0,
276+
FACTION_CREATURE = 7,
277+
FACTION_ESCORTEE_A_NEUTRAL_PASSIVE = 10,
278+
FACTION_MONSTER = 14,
279+
FACTION_MONSTER_2 = 16,
280+
FACTION_TROLL_BLOODSCALP = 28,
281+
FACTION_PREY = 31,
282+
FACTION_ESCORTEE_H_NEUTRAL_PASSIVE = 33,
283+
FACTION_FRIENDLY = 35,
284+
FACTION_OGRE = 45,
285+
FACTION_ORC_DRAGONMAW = 62,
286+
FACTION_HORDE_GENERIC = 83,
287+
FACTION_ALLIANCE_GENERIC = 84,
288+
FACTION_DEMON = 90,
289+
FACTION_ELEMENTAL = 91,
290+
FACTION_DRAGONFLIGHT_BLACK = 103,
291+
FACTION_ESCORTEE_N_NEUTRAL_PASSIVE = 113,
292+
FACTION_ENEMY = 168,
293+
FACTION_ESCORTEE_A_NEUTRAL_ACTIVE = 231,
294+
FACTION_ESCORTEE_H_NEUTRAL_ACTIVE = 232,
295+
FACTION_ESCORTEE_N_NEUTRAL_ACTIVE = 250,
296+
FACTION_ESCORTEE_N_FRIEND_PASSIVE = 290,
297+
FACTION_TITAN = 415,
298+
FACTION_ESCORTEE_N_FRIEND_ACTIVE = 495,
299+
FACTION_GOBLIN_DARK_IRON_BAR_PATRON = 736,
300+
FACTION_DARK_IRON_DWARVES = 754,
301+
FACTION_ESCORTEE_A_PASSIVE = 774,
302+
FACTION_ESCORTEE_H_PASSIVE = 775,
303+
FACTION_UNDEAD_SCOURGE = 974,
304+
FACTION_EARTHEN_RING = 1726,
305+
FACTION_ALLIANCE_GENERIC_WG = 1732,
306+
FACTION_HORDE_GENERIC_WG = 1735,
307+
FACTION_ARAKKOA = 1738,
308+
FACTION_ASHTONGUE_DEATHSWORN = 1820,
309+
FACTION_FLAYER_HUNTER = 1840,
310+
FACTION_MONSTER_SPAR_BUDDY = 1868,
311+
FACTION_ESCORTEE_N_ACTIVE = 1986,
312+
FACTION_ESCORTEE_H_ACTIVE = 2046,
313+
FACTION_UNDEAD_SCOURGE_2 = 2068,
314+
FACTION_UNDEAD_SCOURGE_3 = 2084,
315+
FACTION_SCARLET_CRUSADE = 2089
316+
};
317+
273318
#define MIN_REPUTATION_RANK (REP_HATED)
274319
#define MAX_REPUTATION_RANK 8
275320

‎src/server/game/Scripting/ScriptSystem.h‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,6 @@ struct SplineChainLink;
2929

3030
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
3131

32-
/// @todo find better namings and definitions.
33-
//N=Neutral, A=Alliance, H=Horde.
34-
//NEUTRAL or FRIEND = Hostility to player surroundings (not a good definition)
35-
//ACTIVE or PASSIVE = Hostility to environment surroundings.
36-
enum eEscortFaction
37-
{
38-
FACTION_ESCORT_A_NEUTRAL_PASSIVE = 10,
39-
FACTION_ESCORT_H_NEUTRAL_PASSIVE = 33,
40-
FACTION_ESCORT_N_NEUTRAL_PASSIVE = 113,
41-
42-
FACTION_ESCORT_A_NEUTRAL_ACTIVE = 231,
43-
FACTION_ESCORT_H_NEUTRAL_ACTIVE = 232,
44-
FACTION_ESCORT_N_NEUTRAL_ACTIVE = 250,
45-
46-
FACTION_ESCORT_N_FRIEND_PASSIVE = 290,
47-
FACTION_ESCORT_N_FRIEND_ACTIVE = 495,
48-
49-
FACTION_ESCORT_A_PASSIVE = 774,
50-
FACTION_ESCORT_H_PASSIVE = 775,
51-
52-
FACTION_ESCORT_N_ACTIVE = 1986,
53-
FACTION_ESCORT_H_ACTIVE = 2046
54-
};
55-
5632
struct ScriptPointMove
5733
{
5834
uint32 uiCreatureEntry;

‎src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ class npc_rocknot : public CreatureScript
600600
//spell by trap has effect61, this indicate the bar go hostile
601601

602602
if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PHALANX)))
603-
tmp->SetFaction(14);
603+
tmp->SetFaction(FACTION_MONSTER);
604604

605605
//for later, this event(s) has alot more to it.
606606
//optionally, DONE can trigger bar to go hostile.

‎src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/boss_coren_direbrew.cpp‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ enum DirebrewEvents
9999

100100
enum DirebrewMisc
101101
{
102-
COREN_DIREBREW_FACTION_HOSTILE = 736,
103-
COREN_DIREBREW_FACTION_FRIEND = 35,
104102
GOSSIP_ID = 11388,
105103
GO_MOLE_MACHINE_TRAP = 188509,
106104
GOSSIP_OPTION_FIGHT = 0,
@@ -143,7 +141,7 @@ class boss_coren_direbrew : public CreatureScript
143141
{
144142
_Reset();
145143
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
146-
me->SetFaction(COREN_DIREBREW_FACTION_FRIEND);
144+
me->SetFaction(FACTION_FRIENDLY);
147145
events.SetPhase(PHASE_ALL);
148146

149147
for (uint8 i = 0; i < MAX_ANTAGONISTS; ++i)
@@ -166,7 +164,7 @@ class boss_coren_direbrew : public CreatureScript
166164
{
167165
events.SetPhase(PHASE_ONE);
168166
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
169-
me->SetFaction(COREN_DIREBREW_FACTION_HOSTILE);
167+
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
170168
me->SetInCombatWithZone();
171169

172170
EntryCheckPredicate pred(NPC_ANTAGONIST);
@@ -357,7 +355,7 @@ class npc_direbrew_minion : public CreatureScript
357355

358356
void Reset() override
359357
{
360-
me->SetFaction(COREN_DIREBREW_FACTION_HOSTILE);
358+
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
361359
DoCastAOE(SPELL_MOLE_MACHINE_EMERGE, true);
362360
me->SetInCombatWithZone();
363361
}
@@ -399,7 +397,7 @@ class npc_direbrew_antagonist : public CreatureScript
399397
break;
400398
case ACTION_ANTAGONIST_HOSTILE:
401399
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
402-
me->SetFaction(COREN_DIREBREW_FACTION_HOSTILE);
400+
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
403401
me->SetInCombatWithZone();
404402
break;
405403
default:

0 commit comments

Comments
 (0)