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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
129 changed files with 418 additions and 444 deletions

View file

@ -184,7 +184,7 @@ void npc_escortAI::JustRespawned()
//add a small delay before going to first waypoint, normal in near all cases
m_uiWPWaitTimer = 1000;
if (me->getFaction() != me->GetCreatureTemplate()->faction)
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
me->RestoreFaction();
Reset();

View file

@ -144,8 +144,8 @@ void FollowerAI::JustRespawned()
if (!IsCombatMovementAllowed())
SetCombatMovement(true);
if (me->getFaction() != me->GetCreatureTemplate()->faction)
me->setFaction(me->GetCreatureTemplate()->faction);
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
me->SetFaction(me->GetCreatureTemplate()->faction);
Reset();
}
@ -282,7 +282,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
m_uiLeaderGUID = player->GetGUID();
if (factionForFollower)
me->setFaction(factionForFollower);
me->SetFaction(factionForFollower);
m_pQuestForFollow = quest;

View file

@ -729,7 +729,7 @@ void SmartAI::JustRespawned()
mDespawnState = 0;
mEscortState = SMART_ESCORT_NONE;
me->SetVisible(true);
if (me->getFaction() != me->GetCreatureTemplate()->faction)
if (me->GetFaction() != me->GetCreatureTemplate()->faction)
me->RestoreFaction();
mJustReset = true;
JustReachedHome();

View file

@ -422,7 +422,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (e.action.faction.factionID)
{
(*itr)->ToCreature()->setFaction(e.action.faction.factionID);
(*itr)->ToCreature()->SetFaction(e.action.faction.factionID);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u (%s) set faction to %u",
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str(), e.action.faction.factionID);
}
@ -430,9 +430,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate((*itr)->ToCreature()->GetEntry()))
{
if ((*itr)->ToCreature()->getFaction() != ci->faction)
if ((*itr)->ToCreature()->GetFaction() != ci->faction)
{
(*itr)->ToCreature()->setFaction(ci->faction);
(*itr)->ToCreature()->SetFaction(ci->faction);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u (%s) set faction to %u",
(*itr)->GetEntry(), (*itr)->GetGUID().ToString().c_str(), ci->faction);
}

View file

@ -814,7 +814,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
return nullptr;
}
creature->setFaction(BattlefieldFactions[teamId]);
creature->SetFaction(BattlefieldFactions[teamId]);
creature->SetHomePosition(x, y, z, o);
// force using DB speeds -- do we really need this?

View file

@ -238,7 +238,7 @@ void BattlefieldWG::OnBattleStart()
if (Creature* creature = GetCreature(*itr))
{
ShowNpc(creature, true);
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
creature->SetFaction(WintergraspFaction[GetDefenderTeam()]);
}
}
@ -348,7 +348,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
if (Creature* creature = GetCreature(*itr))
{
if (!endByTimer)
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
creature->SetFaction(WintergraspFaction[GetDefenderTeam()]);
HideNpc(creature);
}
}
@ -610,7 +610,7 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
return;
if (Unit* owner = creature->ToTempSummon()->GetSummonerUnit())
creature->setFaction(owner->getFaction());
creature->SetFaction(owner->GetFaction());
break;
}
}
@ -630,9 +630,9 @@ void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
case NPC_WINTERGRASP_DEMOLISHER:
{
uint8 team;
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
if (creature->GetFaction() == WintergraspFaction[TEAM_ALLIANCE])
team = TEAM_ALLIANCE;
else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
else if (creature->GetFaction() == WintergraspFaction[TEAM_HORDE])
team = TEAM_HORDE;
else
return;

View file

@ -1413,7 +1413,7 @@ struct BfWGGameObjectBuilding
{
if (Creature* creature = m_WG->GetCreature(*itr))
{
creature->setFaction(faction);
creature->SetFaction(faction);
if (disable)
m_WG->HideNpc(creature);
else
@ -1425,7 +1425,7 @@ struct BfWGGameObjectBuilding
{
if (Creature* creature = m_WG->GetCreature(*itr))
{
creature->setFaction(faction);
creature->SetFaction(faction);
if (disable)
m_WG->HideNpc(creature);
else

View file

@ -271,7 +271,7 @@ void BattlegroundAB::NodeOccupied(uint8 node)
if (trigger)
{
trigger->setFaction(_capturePointInfo[node]._ownerTeamId == TEAM_ALLIANCE ? 84 : 83);
trigger->SetFaction(_capturePointInfo[node]._ownerTeamId == TEAM_ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}

View file

@ -355,7 +355,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
BG_AV_CreaturePos[triggerSpawnID][2],
BG_AV_CreaturePos[triggerSpawnID][3]))
{
trigger->setFaction(newFaction);
trigger->SetFaction(newFaction);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
@ -786,7 +786,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
DelCreature(node + 302);
return;
}
trigger->setFaction(ownerId == TEAM_ALLIANCE ? 84 : 83);
trigger->SetFaction(ownerId == TEAM_ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}

View file

@ -505,7 +505,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
if (trigger)
{
trigger->setFaction(teamId == TEAM_ALLIANCE ? 84 : 83);
trigger->SetFaction(teamId == TEAM_ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, true);
}
}

View file

@ -467,9 +467,9 @@ bool BattlegroundIC::SetupBattleground()
// setting correct factions for Keep Cannons
for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i <= BG_IC_NPC_KEEP_CANNON_12; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[0]);
GetBGCreature(i)->SetFaction(BG_IC_Factions[0]);
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i <= BG_IC_NPC_KEEP_CANNON_25; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[1]);
GetBGCreature(i)->SetFaction(BG_IC_Factions[1]);
// Flags
if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER))
{
@ -821,7 +821,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_DocksVehiclesGlaives[i].GetPositionX(), BG_IC_DocksVehiclesGlaives[i].GetPositionY(),
BG_IC_DocksVehiclesGlaives[i].GetPositionZ(), BG_IC_DocksVehiclesGlaives[i].GetOrientation(),
RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[nodePoint->faction]);
GetBGCreature(type)->SetFaction(BG_IC_Factions[nodePoint->faction]);
}
// spawning catapults
@ -836,7 +836,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_DocksVehiclesCatapults[i].GetPositionX(), BG_IC_DocksVehiclesCatapults[i].GetPositionY(),
BG_IC_DocksVehiclesCatapults[i].GetPositionZ(), BG_IC_DocksVehiclesCatapults[i].GetOrientation(),
RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
GetBGCreature(type)->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
}
break;
case BG_IC_GO_WORKSHOP_BANNER:
@ -857,7 +857,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
RESPAWN_ONE_DAY))
GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
GetBGCreature(type)->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
}
uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
@ -871,7 +871,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (Creature* siegeEngine = GetBgMap()->GetCreature(BgCreatures[siegeType]))
{
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
siegeEngine->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
siegeEngine->SetCorpseDelay(5 * MINUTE);
if (siegeEngine->IsAlive())

View file

@ -687,13 +687,13 @@ void BattlegroundSA::OverrideGunFaction()
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++)
{
if (Creature* gun = GetBGCreature(i))
gun->setFaction(BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]);
gun->SetFaction(BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]);
}
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
{
if (Creature* dem = GetBGCreature(i))
dem->setFaction(BG_SA_Factions[Attackers]);
dem->SetFaction(BG_SA_Factions[Attackers]);
}
}
@ -959,7 +959,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
if (Creature* dem = GetBGCreature(j))
dem->setFaction(BG_SA_Factions[Attackers]);
dem->SetFaction(BG_SA_Factions[Attackers]);
}
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
@ -987,7 +987,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
if (Creature* dem = GetBGCreature(j))
dem->setFaction(BG_SA_Factions[Attackers]);
dem->SetFaction(BG_SA_Factions[Attackers]);
}
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));

View file

@ -446,7 +446,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
if (!GetCreatureAddon())
SetSheath(SHEATH_STATE_MELEE);
setFaction(cInfo->faction);
SetFaction(cInfo->faction);
uint32 npcflag, unit_flags, dynamicflags;
ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data);
@ -517,7 +517,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
{
if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
{
setFaction(owner->getFaction()); // vehicles should have same as owner faction
SetFaction(owner->GetFaction()); // vehicles should have same as owner faction
owner->VehicleSpellInitialize();
}
}
@ -2280,7 +2280,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
// only from same creature faction
if (checkfaction)
{
if (getFaction() != u->getFaction())
if (GetFaction() != u->GetFaction())
return false;
}
else
@ -2362,7 +2362,7 @@ void Creature::UpdateMoveInLineOfSightState()
}
bool nonHostile = true;
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(getFaction()))
if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(GetFaction()))
if (factionTemplate->hostileMask || factionTemplate->enemyFaction[0] || factionTemplate->enemyFaction[1] || factionTemplate->enemyFaction[2] || factionTemplate->enemyFaction[3])
nonHostile = false;

View file

@ -199,7 +199,7 @@ void TempSummon::InitStats(uint32 duration)
{
if (IsTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetFaction(owner->GetFaction());
SetLevel(owner->getLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
@ -227,9 +227,9 @@ void TempSummon::InitStats(uint32 duration)
}
if (m_Properties->Faction)
setFaction(m_Properties->Faction);
SetFaction(m_Properties->Faction);
else if (IsVehicle() && owner) // properties should be vehicle
setFaction(owner->getFaction());
SetFaction(owner->GetFaction());
}
void TempSummon::InitSummon()
@ -320,7 +320,7 @@ void Minion::InitStats(uint32 duration)
Unit* owner = GetOwner();
SetCreatorGUID(owner->GetGUID());
setFaction(owner->getFaction());
SetFaction(owner->GetFaction());
owner->SetMinion(this, true);
}

View file

@ -2023,7 +2023,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
if (Unit* owner = GetOwner())
{
trigger->SetLevel(owner->getLevel(), false);
trigger->setFaction(owner->getFaction());
trigger->SetFaction(owner->GetFaction());
// needed for GO casts for proper target validation checks
trigger->SetOwnerGUID(owner->GetGUID());
// xinef: fixes some duel bugs with traps]
@ -2042,7 +2042,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
else
{
// xinef: set faction of gameobject, if no faction - assume hostile
trigger->setFaction(GetTemplateAddon() && GetTemplateAddon()->faction ? GetTemplateAddon()->faction : 14);
trigger->SetFaction(GetTemplateAddon() && GetTemplateAddon()->faction ? GetTemplateAddon()->faction : 14);
// Set owner guid for target if no owner availble - needed by trigger auras
// - trigger gets despawned and there's no caster avalible (see AuraEffect::TriggerSpell())
// xinef: set proper orientation, fixes cast against stealthed targets

View file

@ -2256,7 +2256,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
//summon->SetName(GetName());
if (setLevel && (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT))
{
summon->setFaction(((Unit*)this)->getFaction());
summon->SetFaction(((Unit*)this)->GetFaction());
summon->SetLevel(((Unit*)this)->getLevel());
}

View file

@ -2231,7 +2231,7 @@ void Pet::HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 as
if (info->m_createdBySpell)
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, info->m_createdBySpell);
pet->SetCreatorGUID(player->GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->GetFaction());
pet->setPowerType(POWER_MANA);
pet->SetUInt32Value(UNIT_NPC_FLAGS, 0);

View file

@ -517,7 +517,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
m_realRace = createInfo->Race; // set real race flag
m_race = createInfo->Race; // set real race flag
setFactionForRace(createInfo->Race);
SetFactionForRace(createInfo->Race);
if (!IsValidGender(createInfo->Gender))
{
@ -2060,7 +2060,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
// xinef: not needed, CORRECTLY checked above including forced reputations etc
// not unfriendly
//if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(creature->getFaction()))
//if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(creature->GetFaction()))
// if (factionTemplate->faction)
// if (FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction))
// if (faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY)
@ -2150,14 +2150,14 @@ void Player::SetGameMaster(bool on)
{
m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
setFaction(35);
SetFaction(FACTION_FRIENDLY);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet())
{
if (AccountMgr::IsGMAccount(GetSession()->GetSecurity()))
pet->setFaction(35);
pet->SetFaction(FACTION_FRIENDLY);
pet->getHostileRefMgr().setOnlineOfflineState(false);
}
@ -2181,13 +2181,13 @@ void Player::SetGameMaster(bool on)
SetPhaseMask(newPhase, false);
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
setFactionForRace(getRace(true));
SetFactionForRace(getRace(true));
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS);
if (Pet* pet = GetPet())
{
pet->setFaction(getFaction());
pet->SetFaction(GetFaction());
pet->getHostileRefMgr().setOnlineOfflineState(true);
}
@ -5649,7 +5649,7 @@ TeamId Player::TeamIdForRace(uint8 race)
return TEAM_ALLIANCE;
}
void Player::setFactionForRace(uint8 race)
void Player::SetFactionForRace(uint8 race)
{
m_team = TeamIdForRace(race);
@ -5659,7 +5659,7 @@ void Player::setFactionForRace(uint8 race)
return;
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race);
setFaction(rEntry ? rEntry->FactionID : 0);
SetFaction(rEntry ? rEntry->FactionID : 0);
}
ReputationRank Player::GetReputationRank(uint32 faction) const
@ -14442,7 +14442,7 @@ void Player::SetIsSpectator(bool on)
AddAura(SPECTATOR_SPELL_SPEED, this);
m_ExtraFlags |= PLAYER_EXTRA_SPECTATOR_ON;
AddUnitState(UNIT_STATE_ISOLATED);
//setFaction(1100);
//SetFaction(1100);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
ResetContestedPvP();
@ -14459,7 +14459,7 @@ void Player::SetIsSpectator(bool on)
if (!IsGameMaster())
{
//setFactionForRace(getRace());
//SetFactionForRace(getRace());
// restore FFA PvP Server state
// Xinef: it will be removed if necessery in UpdateArea called in WorldPortOpcode

View file

@ -2048,7 +2048,7 @@ public:
static TeamId TeamIdForRace(uint8 race);
[[nodiscard]] TeamId GetTeamId(bool original = false) const { return original ? TeamIdForRace(getRace(true)) : m_team; };
void setFactionForRace(uint8 race);
void SetFactionForRace(uint8 race);
void setTeamId(TeamId teamid) { m_team = teamid; };
void InitDisplayIds();

View file

@ -5104,7 +5104,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
//Need to call it to initialize m_team (m_team can be calculated from race)
//Other way is to saves m_team into characters table.
setFactionForRace(getRace(true));
SetFactionForRace(getRace(true));
// pussywizard: create empty instance bind containers if necessary
sInstanceSaveMgr->PlayerCreateBoundInstancesMaps(playerGuid);

View file

@ -9413,7 +9413,7 @@ void Unit::setPowerType(Powers new_powertype)
FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const
{
FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction());
FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(GetFaction());
if (!entry)
{
static ObjectGuid guid; // prevent repeating spam same faction problem
@ -9421,11 +9421,11 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const
if (GetGUID() != guid)
{
if (Player const* player = ToPlayer())
LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction());
LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), GetFaction());
else if (Creature const* creature = ToCreature())
LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, GetFaction());
else
LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction());
LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), GetFaction());
guid = GetGUID();
}
@ -9433,7 +9433,7 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const
return entry;
}
void Unit::setFaction(uint32 faction)
void Unit::SetFaction(uint32 faction)
{
SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction);
if (GetTypeId() == TYPEID_UNIT)
@ -16519,7 +16519,7 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
{
pet->SetCreatorGUID(GetGUID());
pet->setFaction(getFaction());
pet->SetFaction(GetFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
if (GetTypeId() == TYPEID_PLAYER)
@ -17497,8 +17497,8 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (aurApp && aurApp->GetRemoveMode())
return false;
_oldFactionId = getFaction();
setFaction(charmer->getFaction());
_oldFactionId = GetFaction();
SetFaction(charmer->GetFaction());
// Set charmed
charmer->SetCharm(this, true);
@ -17592,7 +17592,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
creature->RefreshSwimmingFlag();
if (GetTypeId() == TYPEID_PLAYER)
sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->getFaction());
sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction());
return true;
}
@ -17622,7 +17622,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (_oldFactionId)
{
setFaction(_oldFactionId);
SetFaction(_oldFactionId);
_oldFactionId = 0;
}
else
@ -17741,20 +17741,20 @@ void Unit::RemoveCharmedBy(Unit* charmer)
void Unit::RestoreFaction()
{
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->setFactionForRace(getRace());
ToPlayer()->SetFactionForRace(getRace());
else
{
if (HasUnitTypeMask(UNIT_MASK_MINION))
{
if (Unit* owner = GetOwner())
{
setFaction(owner->getFaction());
SetFaction(owner->GetFaction());
return;
}
}
if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
setFaction(cinfo->faction);
SetFaction(cinfo->faction);
}
}
@ -17831,7 +17831,7 @@ bool Unit::IsInPartyWith(Unit const* unit) const
return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
// Xinef: we assume that npcs with the same faction are in party
else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
return u1->getFaction() == u2->getFaction();
return u1->GetFaction() == u2->GetFaction();
// Xinef: creature type_flag should work for party check only if player group is not a raid
else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && (u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) && u2->ToPlayer()->GetGroup() && !u2->ToPlayer()->GetGroup()->isRaidGroup()) ||
(u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && (u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) && u1->ToPlayer()->GetGroup() && !u1->ToPlayer()->GetGroup()->isRaidGroup()))
@ -17854,7 +17854,7 @@ bool Unit::IsInRaidWith(Unit const* unit) const
return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
// Xinef: we assume that npcs with the same faction are in party
else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
return u1->getFaction() == u2->getFaction();
return u1->GetFaction() == u2->GetFaction();
else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) ||
(u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT))
return true;
@ -19903,7 +19903,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
fieldBuffer << (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !!
else
// pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
fieldBuffer << uint32(target->getFaction());
fieldBuffer << uint32(target->GetFaction());
}
else
fieldBuffer << m_uint32Values[index];
@ -19914,7 +19914,7 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
if (index == UNIT_FIELD_BYTES_2)
fieldBuffer << (m_uint32Values[index] & 0xFFFFF2FF); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
else
fieldBuffer << (uint32)target->getFaction();
fieldBuffer << (uint32)target->GetFaction();
}
else
if (!sScriptMgr->IsCustomBuildValuesUpdate(this, updateType, fieldBuffer, target, index))

View file

@ -1596,8 +1596,8 @@ public:
virtual void SetSheath(SheathState sheathed) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); }
// faction template id
[[nodiscard]] uint32 getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); }
void setFaction(uint32 faction);
[[nodiscard]] uint32 GetFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); }
void SetFaction(uint32 faction);
[[nodiscard]] FactionTemplateEntry const* GetFactionTemplateEntry() const;
ReputationRank GetReactionTo(Unit const* target) const;

View file

@ -62,7 +62,7 @@ void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit)
if (!sScriptMgr->CanSendAuctionHello(this, guid, unit))
return;
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->getFaction());
AuctionHouseEntry const* ahEntry = AuctionHouseMgr::GetAuctionHouseEntry(unit->GetFaction());
if (!ahEntry)
return;
@ -166,7 +166,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
return;
}
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction());
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->GetFaction());
if (!auctionHouseEntry)
{
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", auctioneer.ToString().c_str());
@ -253,7 +253,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
Item* item = items[i];
uint32 auctionTime = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
if (!_player->HasEnoughMoney(deposit))
@ -417,7 +417,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
Player* player = GetPlayer();
@ -539,7 +539,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
Player* player = GetPlayer();
@ -623,7 +623,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4) + 30000); // pussywizard: ensure there is enough memory
Player* player = GetPlayer();
@ -690,7 +690,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(ObjectGuid creatureGuid)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4 + 4 + 4) + 60000); // pussywizard: ensure there is enough memory
data << (uint32) 0; // amount place holder

View file

@ -997,7 +997,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
SendFullReputation({ 942, 935, 936, 1011, 970, 967, 989, 932, 934, 1038, 1077 });
switch (pCurrChar->getFaction())
switch (pCurrChar->GetFaction())
{
case ALLIANCE:
SendFullReputation({ 72, 47, 69, 930, 730, 978, 54, 946 });

View file

@ -314,7 +314,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
return;
// set faction visible if needed
if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->getFaction()))
if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->GetFaction()))
_player->GetReputationMgr().SetVisible(factionTemplateEntry);
GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);

View file

@ -181,7 +181,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
pet->SetLoading(true);
pet->Relocate(px, py, pz, owner->GetOrientation());
pet->setPetType(pet_type);
pet->setFaction(owner->getFaction());
pet->SetFaction(owner->GetFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
if (pet->IsCritter())

View file

@ -47,7 +47,7 @@ bool AuctionListItemsDelayEvent::Execute()
if (!creature)
return true;
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->GetFaction());
WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4) + 50 * ((16 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3) * 4));
uint32 count = 0;

View file

@ -5532,7 +5532,7 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode,
if (apply)
{
target->setFaction(GetMiscValue());
target->SetFaction(GetMiscValue());
if (target->GetTypeId() == TYPEID_PLAYER)
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
}

View file

@ -2502,7 +2502,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
if (properties->Category == SUMMON_CATEGORY_ALLY)
{
summon->SetOwnerGUID(m_originalCaster->GetGUID());
summon->setFaction(m_originalCaster->getFaction());
summon->SetFaction(m_originalCaster->GetFaction());
}
ExecuteLogEffectSummonObject(effIndex, summon);
@ -2552,9 +2552,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
// xinef: i think this is wrong, found only 2 vehicles with faction override and one of them should inherit caster faction...
//uint32 faction = properties->Faction;
//if (!faction)
uint32 faction = m_originalCaster->getFaction();
uint32 faction = m_originalCaster->GetFaction();
summon->setFaction(faction);
summon->SetFaction(faction);
break;
}
@ -4387,7 +4387,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
return;
}
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction());
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->GetFaction());
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() + 1);
int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
@ -6231,7 +6231,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
}
if (properties && properties->Category == SUMMON_CATEGORY_ALLY)
summon->setFaction(caster->getFaction());
summon->SetFaction(caster->GetFaction());
ExecuteLogEffectSummonObject(i, summon);
}

View file

@ -2932,7 +2932,7 @@ public:
creatureTarget->SetHealth(0); // just for nice GM-mode view
pet->SetGuidValue(UNIT_FIELD_CREATEDBY, player->GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->GetFaction());
if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
{

View file

@ -333,7 +333,7 @@ public:
if (!pfactionid)
{
uint32 factionid = target->getFaction();
uint32 factionid = target->GetFaction();
uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
@ -375,7 +375,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_FACTION, target->GetGUID().GetCounter(), factionid, flag, npcflag, dyflag);
target->setFaction(factionid);
target->SetFaction(factionid);
target->SetUInt32Value(UNIT_FIELD_FLAGS, flag);
target->SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, dyflag);

View file

@ -458,7 +458,7 @@ public:
return false;
}
creature->setFaction(factionId);
creature->SetFaction(factionId);
// Faction is set in creature_template - not inside creature
@ -491,7 +491,8 @@ public:
if (!creature)
return false;
creature->setFaction(tempfaction);
creature->SetFaction(tempfaction);
return true;
}
@ -589,7 +590,7 @@ public:
}
CreatureTemplate const* cInfo = target->GetCreatureTemplate();
uint32 faction = target->getFaction();
uint32 faction = target->GetFaction();
uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS);
uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask;
uint32 spellSchoolImmuneMask = cInfo->SpellSchoolImmuneMask;
@ -607,7 +608,7 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->GetFaction());
handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId);
handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId());

View file

@ -106,7 +106,7 @@ public:
if (!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
player->SetShapeshiftForm(FORM_NONE);
player->setFactionForRace(player->getRace());
player->SetFactionForRace(player->getRace());
player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powerType << 24)));

View file

@ -139,7 +139,7 @@ public:
{
CAST_AI(npc_water_elemental::npc_water_elementalAI, summoned->AI())->balindaGUID = me->GetGUID();
summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true));
summoned->setFaction(me->getFaction());
summoned->SetFaction(me->GetFaction());
summons.Summon(summoned);
}

View file

@ -590,7 +590,7 @@ public:
//spell by trap has effect61, this indicate the bar go hostile
if (Unit* tmp = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_PHALANX)))
tmp->setFaction(14);
tmp->SetFaction(FACTION_MONSTER);
//for later, this event(s) has alot more to it.
//optionally, DONE can trigger bar to go hostile.

View file

@ -21,13 +21,6 @@
#include "CreatureAIImpl.h"
#define BRDScriptName "instance_blackrock_depths"
enum FactionIds
{
FACTION_NEUTRAL = 734,
FACTION_HOSTILE = 754,
FACTION_FRIEND = 35
};
enum BRDBosses
{
BOSS_AMBASSADOR_FLAMELASH = 0,

View file

@ -76,7 +76,7 @@ public:
if (Creature* Moira = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_MOIRA)))
{
Moira->AI()->EnterEvadeMode();
Moira->setFaction(35);
Moira->SetFaction(FACTION_FRIENDLY);
}
}

View file

@ -178,7 +178,7 @@ public:
Voidwalkers = false;
// Reset his gossip menu
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->setFaction(FACTION_FRIEND);
me->SetFaction(FACTION_FRIENDLY);
// was set before event start, so set again
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);

View file

@ -580,7 +580,7 @@ public:
if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter]))
{
++TombEventCounter;
boss->setFaction(FACTION_HOSTILE);
boss->SetFaction(FACTION_DARK_IRON_DWARVES);
boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
// find suitable target here.
@ -614,7 +614,7 @@ public:
boss->GetMotionMaster()->MoveTargetedHome();
boss->SetLootRecipient(nullptr);
}
boss->setFaction(FACTION_FRIEND);
boss->SetFaction(FACTION_FRIENDLY);
boss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // think this is useless
if (i == 6) // doomrel needs explicit reset
{

View file

@ -190,7 +190,7 @@ public:
me->SetVisible(true);
me->SetPhaseMask(1, true);
me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT_HIGH_CHAIR);
me->RemoveAura(SPELL_NEFARIANS_BARRIER);
}
@ -209,7 +209,7 @@ public:
Talk(SAY_GAMESBEGIN_2);
me->setFaction(103);
me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
DoCast(me, SPELL_NEFARIANS_BARRIER);
me->SetStandState(UNIT_STAND_STATE_STAND);
@ -345,7 +345,7 @@ public:
CreatureID = Entry[urand(0, 4)];
if (Creature* dragon = me->SummonCreature(CreatureID, DrakeSpawnLoc[i]))
{
dragon->setFaction(103);
dragon->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
dragon->AI()->AttackStart(me->GetVictim());
}

View file

@ -89,7 +89,7 @@ public:
HasYelled = false;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@ -182,7 +182,7 @@ public:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
break;
case EVENT_SPEECH_7:
me->setFaction(103);
me->SetFaction(FACTION_DRAGONFLIGHT_BLACK);
if (PlayerGUID && ObjectAccessor::GetUnit(*me, PlayerGUID))
AttackStart(ObjectAccessor::GetUnit(*me, PlayerGUID));
break;

View file

@ -106,7 +106,7 @@ public:
if (!me->FindNearestCreature(NPC_FLAMEWAKER_HEALER, 100.0f) && !me->FindNearestCreature(NPC_FLAMEWAKER_ELITE, 100.0f))
{
me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
EnterEvadeMode();
Talk(SAY_DEFEAT);
_JustDied();
@ -184,7 +184,7 @@ public:
}
else if (action == ACTION_START_RAGNAROS_ALT)
{
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
}

View file

@ -177,7 +177,7 @@ public:
{
//Become unbanished again
me->SetReactState(REACT_AGGRESSIVE);
me->setFaction(14);
me->SetFaction(FACTION_MONSTER);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
@ -246,7 +246,7 @@ public:
DoResetThreat();
me->SetReactState(REACT_PASSIVE);
me->InterruptNonMeleeSpells(false);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);

View file

@ -314,7 +314,7 @@ public:
if (infernal)
{
infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE);
infernal->setFaction(me->getFaction());
infernal->SetFaction(me->GetFaction());
infernals.push_back(infernal->GetGUID());
infernal->SetControlled(true, UNIT_STATE_ROOT);
RELAY->AI()->DoCast(infernal, SPELL_INFERNAL_RELAY);

View file

@ -62,7 +62,7 @@ public:
events.Reset();
me->SetVisible(false);
me->SetReactState(REACT_PASSIVE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
_events2.Reset();
_events2.ScheduleEvent(EVENT_CHECK_VISIBILITY, 5000);
if (me->GetEntry() == NPC_HYAKISS_THE_LURKER)

View file

@ -390,7 +390,7 @@ public:
if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000))
{
pSpawn->setFaction(me->getFaction());
pSpawn->SetFaction(me->GetFaction());
pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false);
}
break;
@ -419,7 +419,7 @@ public:
DoStartNoMovement(target);
ElementalOne->SetInCombatWithZone();
ElementalOne->CombatStart(target);
ElementalOne->setFaction(me->getFaction());
ElementalOne->SetFaction(me->GetFaction());
ElementalOne->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalOne->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
}
@ -433,7 +433,7 @@ public:
DoStartNoMovement(target);
ElementalTwo->SetInCombatWithZone();
ElementalTwo->CombatStart(target);
ElementalTwo->setFaction(me->getFaction());
ElementalTwo->SetFaction(me->GetFaction());
ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalTwo->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
}
@ -447,7 +447,7 @@ public:
DoStartNoMovement(target);
ElementalThree->SetInCombatWithZone();
ElementalThree->CombatStart(target);
ElementalThree->setFaction(me->getFaction());
ElementalThree->SetFaction(me->GetFaction());
ElementalThree->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalThree->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
}
@ -461,7 +461,7 @@ public:
DoStartNoMovement(target);
ElementalFour->SetInCombatWithZone();
ElementalFour->CombatStart(target);
ElementalFour->setFaction(me->getFaction());
ElementalFour->SetFaction(me->GetFaction());
ElementalFour->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalFour->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
}
@ -476,7 +476,7 @@ public:
if (Creature* unit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
unit->Attack(me->GetVictim(), true);
unit->setFaction(me->getFaction());
unit->SetFaction(me->GetFaction());
}
}

View file

@ -1384,7 +1384,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
{
Talk(SAY_JULIANNE_AGGRO);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(16);
me->SetFaction(FACTION_MONSTER_2);
AggroYellTimer = 0;
}
else
@ -1416,7 +1416,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(uint32 diff)
CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO;
DoZoneInCombat(pRomulo);
pRomulo->setFaction(16);
pRomulo->SetFaction(FACTION_MONSTER_2);
}
SummonedRomulo = true;
}

View file

@ -173,7 +173,6 @@ enum deathsChallenge
SAY_DUEL = 0,
QUEST_DEATH_CHALLENGE = 12733,
FACTION_HOSTILE = 2068,
DATA_IN_PROGRESS = 0,
@ -337,7 +336,7 @@ public:
Talk(SAY_DUEL + 4, ObjectAccessor::GetPlayer(*me, _duelGUID));
break;
case EVENT_SPEAK+5:
me->setFaction(FACTION_HOSTILE);
me->SetFaction(FACTION_UNDEAD_SCOURGE_2);
if (Player* player = ObjectAccessor::GetPlayer(*me, _duelGUID))
AttackStart(player);
return;
@ -723,7 +722,7 @@ public:
anchorGUID.Clear();
phase = PHASE_CHAINED;
events.Reset();
me->setFaction(7);
me->SetFaction(FACTION_CREATURE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8);
me->LoadEquipment(0, true);
@ -825,7 +824,7 @@ public:
wait_timer -= diff;
else
{
me->setFaction(14);
me->SetFaction(FACTION_MONSTER);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
phase = PHASE_ATTACKING;
@ -947,7 +946,7 @@ public:
npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature)
{
me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
}
@ -970,7 +969,7 @@ public:
me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0);
me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
}
}
@ -1080,7 +1079,7 @@ public:
me->SetFacingToObject(car);
// xinef: add some flags
car->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
car->setFaction(35);
car->SetFaction(FACTION_FRIENDLY);
}
Talk(SAY_SCARLET_MINER_0);
SetRun(true);

View file

@ -86,7 +86,7 @@ public:
playerGUID = player->GetGUID();
speechTimer = 1000;
speechCounter = 1;
me->setFaction(player->getFaction());
me->SetFaction(player->GetFaction());
me->CombatStop(true);
me->GetMotionMaster()->MoveIdle();
me->SetReactState(REACT_PASSIVE);

View file

@ -1054,7 +1054,7 @@ public:
float o = me->GetAngle(tirion);
tirion->GetMotionMaster()->MovePoint(4, me->GetPositionX() + 2.0f * cos(o), me->GetPositionY() + 2.0f * sin(o), me->GetPositionZ(), false);
tirion->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
tirion->setFaction(35);
tirion->SetFaction(FACTION_FRIENDLY);
}
break;
case EVENT_OUTRO_SCENE_48:

View file

@ -36,7 +36,6 @@ enum AshbringerEventMisc
NPC_FAIRBANKS = 4542,
NPC_COMMANDER_MOGRAINE = 3976,
NPC_INQUISITOR_WHITEMANE = 3977,
FACTION_FRIENDLY_TO_ALL = 35,
DOOR_HIGH_INQUISITOR_ID = 104600,
};
@ -86,8 +85,7 @@ public:
player->GetCreatureListWithEntryInGrid(ScarletList, NPC_COMMANDER_MOGRAINE, 4000.0f);
player->GetCreatureListWithEntryInGrid(ScarletList, NPC_FAIRBANKS, 4000.0f);
if (!ScarletList.empty())
for (std::list<Creature*>::iterator itr = ScarletList.begin(); itr != ScarletList.end(); itr++)
(*itr)->setFaction(FACTION_FRIENDLY_TO_ALL);
for (std::list<Creature*>::iterator itr = ScarletList.begin(); itr != ScarletList.end(); itr++) (*itr)->SetFaction(FACTION_FRIENDLY);
}
}
@ -108,8 +106,7 @@ public:
player->GetCreatureListWithEntryInGrid(ScarletList, NPC_COMMANDER_MOGRAINE, 4000.0f);
player->GetCreatureListWithEntryInGrid(ScarletList, NPC_FAIRBANKS, 4000.0f);
if (!ScarletList.empty())
for (std::list<Creature*>::iterator itr = ScarletList.begin(); itr != ScarletList.end(); itr++)
(*itr)->setFaction(FACTION_FRIENDLY_TO_ALL);
for (std::list<Creature*>::iterator itr = ScarletList.begin(); itr != ScarletList.end(); itr++) (*itr)->SetFaction(FACTION_FRIENDLY);
}
}
@ -221,7 +218,7 @@ public:
if (player->HasAura(AURA_ASHBRINGER) && !SayAshbringer)
{
Talk(SAY_WELCOME);
me->setFaction(FACTION_FRIENDLY_TO_ALL);
me->SetFaction(FACTION_FRIENDLY);
me->SetSheath(SHEATH_STATE_UNARMED);
me->SetFacingToObject(player);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
@ -318,7 +315,7 @@ public:
return 10 * IN_MILLISECONDS;
case 4:
me->SummonCreature(NPC_HIGHLORD_MOGRAINE, 1065.130737f, 1399.350586f, 30.763723f, 6.282961f, TEMPSUMMON_TIMED_DESPAWN, 400000)->SetName("Highlord Mograine");
me->FindNearestCreature(NPC_HIGHLORD_MOGRAINE, 200.0f)->setFaction(FACTION_FRIENDLY_TO_ALL);
me->FindNearestCreature(NPC_HIGHLORD_MOGRAINE, 200.0f)->SetFaction(FACTION_FRIENDLY);
return 30 * IN_MILLISECONDS;
case 5:
mograine->StopMovingOnCurrentPos();
@ -381,7 +378,7 @@ public:
if (Player* player = who->ToPlayer())
if (player->HasAura(AURA_ASHBRINGER) && !SayAshbringer)
{
me->setFaction(FACTION_FRIENDLY_TO_ALL);
me->SetFaction(FACTION_FRIENDLY);
me->SetSheath(SHEATH_STATE_UNARMED);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->SetFacingToObject(player);
@ -783,7 +780,7 @@ public:
if (Player* player = who->ToPlayer())
if (player->HasAura(AURA_ASHBRINGER) && !SayAshbringer)
{
me->setFaction(FACTION_FRIENDLY_TO_ALL);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetSheath(SHEATH_STATE_UNARMED);
me->CastSpell(me, 57767, true);

View file

@ -243,12 +243,12 @@ public:
if (instance->GetData(DATA_MINI_BOSSES) != 6)
{
me->SetVisible(false);
me->setFaction(35);
me->SetFaction(35);
}
else
{
me->SetVisible(true);
me->setFaction(21);
me->SetFaction(21);
}
OpenAllGates();
summons.DespawnAll();

View file

@ -371,7 +371,7 @@ public:
break;
case EVENT_MAD_20:
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
if (Creature* brutallus = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_BRUTALLUS)))
{
brutallus->AI()->Talk(YELL_INTRO_TAUNT);

View file

@ -241,7 +241,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->CombatStop();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
events2.ScheduleEvent(EVENT_TALK_GOOD_2, 1000);
break;
case EVENT_TALK_GOOD_2:

View file

@ -1,4 +1,4 @@
/*
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
@ -186,7 +186,7 @@ public:
y = 1380.0f + rand() % 60;
if (Unit* trigger = me->SummonTrigger(x, y, z, 0, 2000))
{
trigger->setFaction(35);
trigger->SetFaction(FACTION_FRIENDLY);
trigger->SetMaxHealth(100000);
trigger->SetHealth(100000);
trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@ -281,7 +281,7 @@ public:
Cloud->SetDisableGravity(true);
Cloud->StopMoving();
Cloud->SetObjectScale(1.0f);
Cloud->setFaction(35);
Cloud->SetFaction(FACTION_FRIENDLY);
Cloud->SetMaxHealth(9999999);
Cloud->SetHealth(9999999);
Cloud->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

View file

@ -174,7 +174,7 @@ public:
if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LORKHAN)))
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->setFaction(14);
pLorKhan->SetFaction(FACTION_MONSTER);
pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->SetFullHealth();
instance->SetData(DATA_LORKHAN, DONE);
@ -187,7 +187,7 @@ public:
if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ZATH)))
{
pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pZath->setFaction(14);
pZath->SetFaction(FACTION_MONSTER);
pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pZath->SetFullHealth();
instance->SetBossState(DATA_ZATH, DONE);
@ -361,7 +361,7 @@ public:
{
pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pThekal->setFaction(14);
pThekal->SetFaction(FACTION_MONSTER);
pThekal->SetFullHealth();
}
}
@ -373,7 +373,7 @@ public:
{
pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pZath->setFaction(14);
pZath->SetFaction(FACTION_MONSTER);
pZath->SetFullHealth();
}
}
@ -389,7 +389,7 @@ public:
me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->AttackStop();
instance->SetBossState(DATA_LORKHAN, SPECIAL);
@ -514,7 +514,7 @@ public:
{
pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pLorKhan->setFaction(14);
pLorKhan->SetFaction(FACTION_MONSTER);
pLorKhan->SetFullHealth();
}
}
@ -526,7 +526,7 @@ public:
{
pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
pThekal->setFaction(14);
pThekal->SetFaction(FACTION_MONSTER);
pThekal->SetFullHealth();
}
}
@ -542,7 +542,7 @@ public:
me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->AttackStop();
instance->SetBossState(DATA_ZATH, SPECIAL);

View file

@ -51,8 +51,7 @@ enum ProfessorPhizzlethorpe
// Quests
QUEST_SUNKEN_TREASURE = 665,
// Creatures
NPC_VENGEFUL_SURGE = 2776,
FACTION_SUNKEN_TREASURE = 113
NPC_VENGEFUL_SURGE = 2776
};
class npc_professor_phizzlethorpe : public CreatureScript
@ -119,7 +118,7 @@ public:
{
Talk(SAY_PROGRESS_1, player);
npc_escortAI::Start(false, false, player->GetGUID(), quest);
me->setFaction(FACTION_SUNKEN_TREASURE);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
}
}

View file

@ -38,8 +38,7 @@ enum TwilightCorrupter
SPELL_LEVEL_UP = 24312,
EVENT_SOUL_CORRUPTION = 1,
EVENT_CREATURE_OF_NIGHTMARE = 2,
FACTION_HOSTILE = 14
EVENT_CREATURE_OF_NIGHTMARE = 2
};
/*######
@ -83,7 +82,7 @@ public:
{
_introSpoken = true;
Talk(YELL_TWILIGHTCORRUPTOR_RESPAWN, who);
me->setFaction(FACTION_HOSTILE);
me->SetFaction(FACTION_MONSTER);
}
ScriptedAI::MoveInLineOfSight(who);
}

View file

@ -72,7 +72,7 @@ public:
{
if (quest->GetQuestId() == QUEST_BALANCE_OF_LIGHT_AND_SHADOW)
{
creature->AI()->SetData(player->getFaction(), 0);
creature->AI()->SetData(player->GetFaction(), 0);
creature->AI()->SetGUID(player->GetGUID());
}
@ -160,7 +160,7 @@ public:
summons.Summon(creature);
if (creature->GetEntry() == NPC_INJURED_PEASANT || creature->GetEntry() == NPC_PLAGUED_PEASANT)
{
creature->setFaction(_faction);
creature->SetFaction(_faction);
if (!_spoken)
{
_spoken = true;

View file

@ -49,8 +49,7 @@ enum RangerLilatha
GO_CAGE = 181152,
NPC_CAPTAIN_HELIOS = 16220,
NPC_MUMMIFIED_HEADHUNTER = 16342,
NPC_SHADOWPINE_ORACLE = 16343,
FACTION_QUEST_ESCAPE = 113
NPC_SHADOWPINE_ORACLE = 16343
};
class npc_ranger_lilatha : public CreatureScript
@ -130,7 +129,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS)
{
creature->setFaction(FACTION_QUEST_ESCAPE);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilatha::npc_ranger_lilathaAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());

View file

@ -63,7 +63,7 @@ public:
Talk(SAY_CORPORAL_1, player);
npc_escortAI::Start(true, false, player->GetGUID(), quest);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->setFaction(250);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
}
}

View file

@ -240,7 +240,7 @@ public:
if (!target)
target = me;
summoned->setFaction(123);
summoned->SetFaction(FACTION_STORMWIND);
summoned->AddThreat(target, 32.0f);
summoned->AI()->AttackStart(target);
}

View file

@ -43,7 +43,6 @@ EndContentData */
enum Bartleby
{
FACTION_ENEMY = 168,
QUEST_BEAT = 1640
};
@ -56,7 +55,7 @@ public:
{
if (quest->GetQuestId() == QUEST_BEAT)
{
creature->setFaction(FACTION_ENEMY);
creature->SetFaction(FACTION_ENEMY);
creature->AI()->AttackStart(player);
}
return true;
@ -71,15 +70,15 @@ public:
{
npc_bartlebyAI(Creature* creature) : ScriptedAI(creature)
{
m_uiNormalFaction = creature->getFaction();
m_uiNormalFaction = creature->GetFaction();
}
uint32 m_uiNormalFaction;
void Reset() override
{
if (me->getFaction() != m_uiNormalFaction)
me->setFaction(m_uiNormalFaction);
if (me->GetFaction() != m_uiNormalFaction)
me->SetFaction(m_uiNormalFaction);
}
void AttackedBy(Unit* pAttacker) override
@ -259,8 +258,8 @@ public:
if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true))
pTyrion->AI()->Talk(SAY_TYRION_2);
if (Creature* pMarzon = ObjectAccessor::GetCreature(*me, MarzonGUID))
pMarzon->setFaction(14);
me->setFaction(14);
pMarzon->SetFaction(FACTION_MONSTER);
me->SetFaction(FACTION_MONSTER);
uiTimer = 0;
uiPhase = 0;
break;

View file

@ -73,7 +73,7 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN);
me->CombatStop(); //stop combat
me->DeleteThreatList(); //unsure of this
me->setFaction(83); //horde generic
me->SetFaction(FACTION_HORDE_GENERIC);
bReset = true;
Reset_Timer = 60000;
@ -91,7 +91,7 @@ public:
{
EnterEvadeMode();
bReset = false;
me->setFaction(28); //troll, bloodscalp
me->SetFaction(FACTION_TROLL_BLOODSCALP);
return;
}

View file

@ -40,8 +40,7 @@ enum Calvin
{
SAY_COMPLETE = 0,
SPELL_DRINK = 2639, // possibly not correct spell (but iconId is correct)
QUEST_590 = 590,
FACTION_HOSTILE = 168
QUEST_590 = 590
};
class npc_calvin_montague : public CreatureScript
@ -53,7 +52,7 @@ public:
{
if (quest->GetQuestId() == QUEST_590)
{
creature->setFaction(FACTION_HOSTILE);
creature->SetFaction(FACTION_ENEMY);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player);
}

View file

@ -354,12 +354,6 @@ public:
}
};
enum Factions
{
FACTION_HOSTILE = 14,
FACTION_FRIENDLY_TO_ALL = 35
};
/*######
## ALLIANCE
#######*/
@ -1616,7 +1610,7 @@ public:
{
jaina->GetMotionMaster()->MoveFollow(me, 5, PET_FOLLOW_ANGLE);
jaina->SetReactState(REACT_AGGRESSIVE);
jaina->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
jaina->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
}
bStepping = false;
JumpToNextStep(0);
@ -2464,7 +2458,7 @@ public:
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_THRALL_BUFF, true);
summoned->ApplySpellImmune(0, IMMUNITY_ID, SPELL_SYLVANAS_BUFF, true);
if (!EnableAttack)
summoned->setFaction(FACTION_FRIENDLY_TO_ALL);
summoned->SetFaction(FACTION_FRIENDLY);
summoned->AddThreat(me, 100.0f);
me->AddThreat(summoned, 100.0f);
summoned->AI()->AttackStart(me);
@ -2568,7 +2562,7 @@ public:
sylvanas->GetMotionMaster()->Clear();
sylvanas->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_IMMUNE_TO_PC);
sylvanas->SetReactState(REACT_AGGRESSIVE);
sylvanas->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
sylvanas->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
sylvanas->GetMotionMaster()->MoveFollow(me, 1, M_PI * 0.1f);
}
}
@ -3141,8 +3135,7 @@ public:
me->GetCreatureListWithEntryInGrid(HostileEndList, NPC_DOCTOR_H, 1000.0f);
me->GetCreatureListWithEntryInGrid(HostileEndList, NPC_CHEMIST_H, 1000.0f);
if (!HostileEndList.empty())
for (std::list<Creature*>::iterator itr = HostileEndList.begin(); itr != HostileEndList.end(); itr++)
(*itr)->setFaction(FACTION_HOSTILE);
for (std::list<Creature*>::iterator itr = HostileEndList.begin(); itr != HostileEndList.end(); itr++) (*itr)->SetFaction(FACTION_MONSTER);
SpawnWave(4);
JumpToNextStep(10 * IN_MILLISECONDS);
break;

View file

@ -39,7 +39,6 @@ EndContentData */
enum TapokeSlim
{
QUEST_MISSING_DIPLO_PT11 = 1249,
FACTION_ENEMY = 168,
SPELL_STEALTH = 1785,
SPELL_CALL_FRIENDS = 16457, //summons 1x friend
NPC_SLIMS_FRIEND = 4971,
@ -76,7 +75,7 @@ public:
if (me->HasStealthAura())
me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
SetRun();
me->setFaction(FACTION_ENEMY);
me->SetFaction(FACTION_ENEMY);
break;
}
}

View file

@ -1545,7 +1545,6 @@ enum BrewfestRevelerEnum
{
FACTION_ALLIANCE = 1934,
FACTION_HORDE = 1935,
FACTION_FRIENDLY = 35,
SPELL_BREWFEST_REVELER_TRANSFORM_GOBLIN_MALE = 44003,
SPELL_BREWFEST_REVELER_TRANSFORM_GOBLIN_FEMALE = 44004,
@ -1585,7 +1584,7 @@ public:
break;
}
GetTarget()->setFaction(factionId);
GetTarget()->SetFaction(factionId);
}
void Register() override
@ -1714,7 +1713,6 @@ enum DirebrewMisc
GOSSIP_OPTION_APOLOGIZE = 1,
DATA_TARGET_GUID = 1,
MAX_ANTAGONISTS = 3,
FACTION_GOBLIN_DARK_IRON_BAR_PATRON = 736,
DATA_COREN = 33,
GO_MACHINE_SUMMONER = 188508
};
@ -1769,7 +1767,7 @@ public:
_events.Reset();
_summons.DespawnAll();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FRIENDLY);
_events.SetPhase(PHASE_ALL);
for (uint8 i = 0; i < MAX_ANTAGONISTS; ++i)
@ -1808,7 +1806,7 @@ public:
{
_events.SetPhase(PHASE_ONE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->setFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
EntryCheckPredicate pred(NPC_ANTAGONIST);
@ -2032,7 +2030,7 @@ public:
void Reset() override
{
me->setFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
}
@ -2075,7 +2073,7 @@ public:
break;
case ACTION_ANTAGONIST_HOSTILE:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->setFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
me->SetFaction(FACTION_GOBLIN_DARK_IRON_BAR_PATRON);
DoZoneInCombat();
break;
default:

View file

@ -359,7 +359,7 @@ public:
void Reset() override
{
speachTimer = 0;
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
summons.DespawnAll();
events.Reset();
me->SummonCreature(NPC_APOTHECARY_FRYE, -205.449f, 2219.56f, 79.7633f, 0.7f);
@ -383,7 +383,7 @@ public:
void JustSummoned(Creature* cr) override
{
summons.Summon(cr);
cr->setFaction(35);
cr->SetFaction(FACTION_FRIENDLY);
cr->SetControlled(true, UNIT_STATE_STUNNED);
cr->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
@ -407,7 +407,7 @@ public:
{
me->AI()->Talk(SAY_HUMMEL_2);
speachTimer = 0;
me->setFaction(16);
me->SetFaction(FACTION_MONSTER_2);
me->SetInCombatWithZone();
if (Unit* target = SelectTargetFromPlayerList(40.0f))
{
@ -513,7 +513,7 @@ public:
{
me->SetControlled(false, UNIT_STATE_STUNNED);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(16);
me->SetFaction(FACTION_MONSTER_2);
me->SetInCombatWithZone();
if (Unit* target = SelectTargetFromPlayerList(40.0f))
AttackStart(target);

View file

@ -240,7 +240,7 @@ public:
if (Unit* caster = GetCaster())
{
caster->CastSpell(caster, SPELL_APPLY_DIGUISE, true);
caster->setFaction(88);
caster->SetFaction(FACTION_BLACKFATHOM);
}
}

View file

@ -464,7 +464,7 @@ public:
summoned->AI()->AttackStart(me);
else
{
summoned->setFaction(me->getFaction());
summoned->SetFaction(me->GetFaction());
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@ -553,15 +553,15 @@ public:
if (!me->IsInCombat())
{
// Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished.
if ((instance->GetData(DATA_AZGALOREVENT) < DONE) && (me->IsVisible() || (me->getFaction() != 35)))
if ((instance->GetData(DATA_AZGALOREVENT) < DONE) && (me->IsVisible() || (me->GetFaction() != FACTION_FRIENDLY)))
{
me->SetVisible(false);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
}
if ((instance->GetData(DATA_AZGALOREVENT) >= DONE) && (!me->IsVisible() || (me->getFaction() == 35)))
if ((instance->GetData(DATA_AZGALOREVENT) >= DONE) && (!me->IsVisible() || (me->GetFaction() == FACTION_FRIENDLY)))
{
me->setFaction(1720);
me->SetFaction(FACTION_DRAGONKIN);
me->SetVisible(true);
}

View file

@ -910,7 +910,7 @@ void hyjalAI::HideNearPos(float x, float y)
for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{
(*itr)->SetVisible(false);
(*itr)->setFaction(35);//make them friendly so mobs won't attack them
(*itr)->SetFaction(FACTION_FRIENDLY); // make them friendly so mobs won't attack them
}
}
}
@ -988,7 +988,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
if ((*itr) && (*itr)->IsAlive())
{
(*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
(*itr)->setFaction(35);//make them friendly so mobs won't attack them
(*itr)->SetFaction(FACTION_FRIENDLY); // make them friendly so mobs won't attack them
(*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
}

View file

@ -471,7 +471,7 @@ public:
if (trigger)
{
trigger->SetVisible(false);
trigger->setFaction(me->getFaction());
trigger->SetFaction(me->GetFaction());
trigger->SetDisableGravity(true);
trigger->CastSpell(me, SPELL_METEOR, true);
}

View file

@ -45,8 +45,6 @@ enum Belnistrasz
EVENT_FIREBALL = 5,
EVENT_FROST_NOVA = 6,
FACTION_ESCORT = 250,
PATH_ESCORT = 871710,
POINT_REACH_IDOL = 17,
@ -122,7 +120,7 @@ public:
eventInProgress = true;
Talk(SAY_QUEST_ACCEPTED);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_ESCORT);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_ACTIVE);
me->GetMotionMaster()->MovePath(PATH_ESCORT, false);
}
}

View file

@ -105,7 +105,7 @@ public:
//Cast
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
DoCast(me, SPELL_DIRTMOUND_PASSIVE);
Submerged = true;
@ -129,7 +129,7 @@ public:
if (Submerged && Back_Timer <= diff)
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(14);
me->SetFaction(FACTION_MONSTER);
DoCastVictim(SPELL_GROUND_RUPTURE);

View file

@ -319,7 +319,7 @@ struct boss_twinemperorsAI : public ScriptedAI
if (c->isDead())
{
c->Respawn();
c->setFaction(7);
c->SetFaction(FACTION_CREATURE);
c->RemoveAllAuras();
}
if (c->IsWithinDistInMap(me, ABUSE_BUG_RANGE))
@ -414,7 +414,7 @@ public:
void CastSpellOnBug(Creature* target) override
{
target->setFaction(14);
target->SetFaction(FACTION_MONSTER);
target->AI()->AttackStart(me->getThreatMgr().getHostilTarget());
target->AddAura(SPELL_MUTATE_BUG, target);
target->SetFullHealth();
@ -503,7 +503,7 @@ public:
void CastSpellOnBug(Creature* target) override
{
target->setFaction(14);
target->SetFaction(FACTION_MONSTER);
target->AddAura(SPELL_EXPLODEBUG, target);
target->SetFullHealth();
}

View file

@ -65,7 +65,7 @@ public:
void InitializeAI() override
{
startedFight = false;
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
postGossipStep = 0;
Text_Timer = 0;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@ -125,7 +125,7 @@ public:
Text_Timer = 5000;
break;
case 3:
me->setFaction(14);
me->SetFaction(FACTION_MONSTER);
Player* target = ObjectAccessor::GetPlayer(*me, PlayerGUID);
switchFactionIfAlive(NPC_RAVEN, target);
@ -186,7 +186,7 @@ public:
{
if (crew->IsAlive())
{
crew->setFaction(14);
crew->SetFaction(FACTION_MONSTER);
if (target)
{
@ -279,7 +279,7 @@ public:
crew->SetWalk(true);
crew->SetHomePosition(x, y, z, 4.78f);
crew->GetMotionMaster()->MovePoint(1, { x, y, z, 4.78f });
crew->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
crew->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
switch (entry)
{
@ -470,7 +470,7 @@ public:
{
if (me->IsAlive())
{
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->SetWalk(false);
me->GetMotionMaster()->MovePoint(0, { 1858.57f, 1146.35f, 14.745f, 3.85f });
me->SetHomePosition(1858.57f, 1146.35f, 14.745f, 3.85f);

View file

@ -29,7 +29,6 @@ EndScriptData */
enum Muglash
{
FACTION_QUEST = 113,
SAY_MUG_START1 = 0,
SAY_MUG_START2 = 1,
SAY_MUG_BRAZIER = 2,
@ -117,7 +116,7 @@ public:
if (quest->GetQuestId() == QUEST_VORSHA)
{
Talk(SAY_MUG_START1);
me->setFaction(FACTION_QUEST);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
npc_escortAI::Start(true, false, player->GetGUID());
}
}

View file

@ -356,7 +356,7 @@ public:
{
Talk(SAY_RIZZLE_FINAL);
me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
me->GetMotionMaster()->MoveIdle();
me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE);
Reached = true;

View file

@ -228,8 +228,7 @@ enum Magwin
EVENT_STAND = 3,
EVENT_TALK_END = 4,
EVENT_COWLEN_TALK = 5,
QUEST_A_CRY_FOR_HELP = 9528,
FACTION_QUEST = 113
QUEST_A_CRY_FOR_HELP = 9528
};
class npc_magwin : public CreatureScript
@ -297,7 +296,7 @@ public:
{
Talk(SAY_START, player);
}
me->setFaction(FACTION_QUEST);
me->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
_events.ScheduleEvent(EVENT_START_ESCORT, 1000);
break;
case EVENT_START_ESCORT:

View file

@ -176,8 +176,7 @@ enum Kerlonian
SPELL_SLEEP_VISUAL = 25148,
SPELL_AWAKEN = 17536,
QUEST_SLEEPER_AWAKENED = 5321,
NPC_LILADRIS = 11219, //attackers entries unknown
FACTION_KER_ESCORTEE = 113
NPC_LILADRIS = 11219 //attackers entries unknown
};
/// @todo make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road.
@ -280,7 +279,7 @@ public:
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
creature->AI()->Talk(SAY_KER_START, player);
pKerlonianAI->StartFollow(player, FACTION_KER_ESCORTEE, quest);
pKerlonianAI->StartFollow(player, FACTION_ESCORTEE_N_NEUTRAL_PASSIVE, quest);
}
}
@ -313,7 +312,6 @@ enum Remtravel
SAY_REM_REMEMBER = 11,
EMOTE_REM_END = 12,
FACTION_ESCORTEE = 10,
QUEST_ABSENT_MINDED_PT2 = 731,
NPC_GRAVEL_SCOUT = 2158,
NPC_GRAVEL_BONE = 2159,
@ -412,7 +410,7 @@ public:
if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravel::npc_prospector_remtravelAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID());
creature->setFaction(FACTION_ESCORTEE);
creature->SetFaction(FACTION_ESCORTEE_A_NEUTRAL_PASSIVE);
}
return true;

View file

@ -73,7 +73,7 @@ public:
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_BODYGUARD_FOR_HIRE)
creature->AI()->SetGUID(player->GetGUID(), player->getFaction());
creature->AI()->SetGUID(player->GetGUID(), player->GetFaction());
return true;
}
@ -155,7 +155,7 @@ public:
{
if (field == 1 && data == 1)
if (Player* player = me->SelectNearestPlayer(50.0f))
SetGUID(player->GetGUID(), player->getFaction());
SetGUID(player->GetGUID(), player->GetFaction());
}
bool CheckCaravan()
@ -256,7 +256,7 @@ public:
for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
if (Creature* summon = ObjectAccessor::GetCreature(*me, summons[i]))
{
summon->setFaction(faction);
summon->SetFaction(faction);
if (remove)
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
else
@ -266,7 +266,7 @@ public:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
else
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
me->setFaction(faction);
me->SetFaction(faction);
}
void WaypointReached(uint32 waypointId) override

View file

@ -204,7 +204,7 @@ public:
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
me->SetFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
me->GetMotionMaster()->MoveFollow(player, 3.f, M_PI);
_events.ScheduleEvent(EVENT_WANDERING_START, urand(40 * IN_MILLISECONDS, 70 * IN_MILLISECONDS));

View file

@ -44,9 +44,6 @@ enum EternalBoard
{
QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519,
FACTION_HOSTILE = 14,
FACTION_FRIENDLY = 35,
C_ANACHRONOS = 15381,
C_FANDRAL_STAGHELM = 15382,
C_ARYGOS = 15380,
@ -919,7 +916,7 @@ public:
Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0);
Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15420);
Merithra->setFaction(35);
Merithra->SetFaction(FACTION_FRIENDLY);
}
if (Caelestrasz)
@ -927,7 +924,7 @@ public:
Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0);
Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15419);
Caelestrasz->setFaction(35);
Caelestrasz->SetFaction(FACTION_FRIENDLY);
}
if (Arygos)
@ -935,7 +932,7 @@ public:
Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0);
Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15418);
Arygos->setFaction(35);
Arygos->SetFaction(FACTION_FRIENDLY);
}
if (Anachronos)

View file

@ -152,7 +152,7 @@ public:
pEscortAI->Start(true, false, player->GetGUID());
creature->AI()->Talk(SAY_START);
creature->setFaction(113);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
return true;

View file

@ -75,7 +75,7 @@ public:
{
SendItemTimer = 0;
SwitchFactionTimer = 10000;
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
isFriendly = true;
AquaJetTimer = 5000;
@ -109,7 +109,7 @@ public:
{
if (SwitchFactionTimer <= diff)
{
me->setFaction(91);
me->SetFaction(FACTION_ELEMENTAL);
isFriendly = false;
}
else SwitchFactionTimer -= diff;

View file

@ -91,8 +91,7 @@ enum Gilthares
SAY_GIL_FREED = 7,
QUEST_FREE_FROM_HOLD = 898,
AREA_MERCHANT_COAST = 391,
FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest
AREA_MERCHANT_COAST = 391
};
class npc_gilthares : public CreatureScript
@ -104,7 +103,7 @@ public:
{
if (quest->GetQuestId() == QUEST_FREE_FROM_HOLD)
{
creature->setFaction(FACTION_ESCORTEE);
creature->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE); //guessed, possible not needed for this quest
creature->SetStandState(UNIT_STAND_STATE_STAND);
creature->AI()->Talk(SAY_GIL_START, player);
@ -197,7 +196,7 @@ public:
{
npc_taskmaster_fizzuleAI(Creature* creature) : ScriptedAI(creature)
{
factionNorm = creature->getFaction();
factionNorm = creature->GetFaction();
}
uint32 factionNorm;
@ -210,7 +209,7 @@ public:
IsFriend = false;
ResetTimer = 120000;
FlareCount = 0;
me->setFaction(factionNorm);
me->SetFaction(factionNorm);
}
void DoFriend()
@ -222,7 +221,7 @@ public:
me->StopMoving();
me->GetMotionMaster()->MoveIdle();
me->setFaction(FACTION_FRIENDLY_F);
me->SetFaction(FACTION_FRIENDLY);
me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE);
}
@ -263,7 +262,7 @@ public:
{
if (FlareCount >= 2)
{
if (me->getFaction() == FACTION_FRIENDLY_F)
if (me->GetFaction() == FACTION_FRIENDLY_F)
return;
DoFriend();
@ -408,7 +407,7 @@ public:
Creature* creature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
if (!creature)
continue;
creature->setFaction(35);
creature->SetFaction(FACTION_FRIENDLY);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
@ -450,7 +449,7 @@ public:
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
creature->setFaction(14);
creature->SetFaction(FACTION_MONSTER);
creature->AI()->AttackStart(pWarrior);
}
++Wave;
@ -481,7 +480,7 @@ public:
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
creature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
creature->setFaction(14);
creature->SetFaction(FACTION_MONSTER);
creature->AI()->AttackStart(pWarrior);
}
WaveTimer = 2000;
@ -511,7 +510,6 @@ enum Wizzlecrank
SAY_END = 6,
QUEST_ESCAPE = 863,
FACTION_RATCHET = 637,
NPC_PILOT_WIZZ = 3451,
NPC_MERCENARY = 3282,
};
@ -644,7 +642,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ESCAPE)
{
creature->setFaction(FACTION_RATCHET);
creature->SetFaction(FACTION_RATCHET);
creature->AI()->Talk(SAY_START);
if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());

View file

@ -50,7 +50,6 @@ enum Lakota
QUEST_FREE_AT_LAST = 4904,
NPC_GRIM_BANDIT = 10758,
FACTION_ESCORTEE_LAKO = 232, //guessed
ID_AMBUSH_1 = 0,
ID_AMBUSH_2 = 2,
@ -77,7 +76,7 @@ public:
if (quest->GetQuestId() == QUEST_FREE_AT_LAST)
{
creature->AI()->Talk(SAY_LAKO_START, player);
creature->setFaction(FACTION_ESCORTEE_LAKO);
creature->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE); //guessed
if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsong::npc_lakota_windsongAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
@ -138,8 +137,7 @@ enum Packa
SAY_COMPLETE = 2,
QUEST_HOMEWARD = 4770,
NPC_WYVERN = 4107,
FACTION_ESCORTEE = 232 //guessed
NPC_WYVERN = 4107
};
Position const WyvernLoc[3] =
@ -159,7 +157,7 @@ public:
if (quest->GetQuestId() == QUEST_HOMEWARD)
{
creature->AI()->Talk(SAY_START, player);
creature->setFaction(FACTION_ESCORTEE);
creature->SetFaction(FACTION_ESCORTEE_H_NEUTRAL_ACTIVE); // guessed
if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountain::npc_paoka_swiftmountainAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
@ -212,7 +210,6 @@ public:
enum Plucky
{
FACTION_FRIENDLY = 35,
QUEST_SCOOP = 1950,
SPELL_PLUCKY_HUMAN = 9192,
SPELL_PLUCKY_CHICKEN = 9220
@ -253,7 +250,7 @@ public:
struct npc_pluckyAI : public ScriptedAI
{
npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->getFaction(); }
npc_pluckyAI(Creature* creature) : ScriptedAI(creature) { NormFaction = creature->GetFaction(); }
uint32 NormFaction;
uint32 ResetTimer;
@ -262,8 +259,8 @@ public:
{
ResetTimer = 120000;
if (me->getFaction() != NormFaction)
me->setFaction(NormFaction);
if (me->GetFaction() != NormFaction)
me->SetFaction(NormFaction);
if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@ -277,7 +274,7 @@ public:
{
if (TextEmote == TEXT_EMOTE_BECKON)
{
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
DoCast(me, SPELL_PLUCKY_HUMAN, false);
}
@ -289,7 +286,7 @@ public:
return;
else
{
me->setFaction(FACTION_FRIENDLY);
me->SetFaction(FACTION_FRIENDLY);
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
DoCast(me, SPELL_PLUCKY_HUMAN, false);
me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);

View file

@ -64,7 +64,7 @@ public:
creature->AI()->Talk(SAY_READY, player);
creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
// Change faction so mobs attack
creature->setFaction(113);
creature->SetFaction(FACTION_ESCORTEE_N_NEUTRAL_PASSIVE);
}
return true;
}
@ -164,8 +164,7 @@ enum Ringo
SPELL_REVIVE_RINGO = 15591,
QUEST_A_LITTLE_HELP = 4491,
NPC_SPRAGGLE = 9997,
FACTION_ESCORTEE = 113
NPC_SPRAGGLE = 9997
};
class npc_ringo : public CreatureScript
@ -180,7 +179,7 @@ public:
if (npc_ringoAI* ringoAI = CAST_AI(npc_ringo::npc_ringoAI, creature->AI()))
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
ringoAI->StartFollow(player, FACTION_ESCORTEE, quest);
ringoAI->StartFollow(player, FACTION_ESCORTEE_N_NEUTRAL_PASSIVE, quest);
}
}

View file

@ -297,7 +297,7 @@ public:
if (quest->GetQuestId() == QUEST_GUARDIANS_ALTAR)
{
creature->AI()->Talk(SAY_QUEST_START);
creature->setFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
creature->SetFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE);
if (npc_ranshallaAI* escortAI = dynamic_cast<npc_ranshallaAI*>(creature->AI()))
escortAI->Start(false, false, player->GetGUID(), quest);

View file

@ -148,11 +148,11 @@ public:
if( damage >= me->GetHealth() )
{
damage = me->GetHealth() - 1;
if( me->getFaction() != 35 )
if (me->GetFaction() != FACTION_FRIENDLY)
{
me->CastSpell((Unit*)nullptr, 68575, true); // achievements
me->GetMap()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, 68574, me); // paletress' spell credits encounter, but shouldn't credit achievements
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
events.Reset();
Talk(TEXT_EADRIC_DEATH);
me->getThreatMgr().clearReferences();
@ -296,10 +296,10 @@ public:
{
damage = me->GetHealth() - 1;
if( me->getFaction() != 35 )
if (me->GetFaction() != FACTION_FRIENDLY)
{
me->CastSpell((Unit*)nullptr, 68574, true); // achievements
me->setFaction(35);
me->SetFaction(FACTION_FRIENDLY);
events.Reset();
Talk(TEXT_PALETRESS_DEATH);
me->getThreatMgr().clearReferences();

View file

@ -184,7 +184,7 @@ public:
float dist = rand_norm() * 40.0f;
if( Creature* c = me->SummonCreature(NPC_SCARAB, AnubLocs[0].GetPositionX() + cos(angle) * dist, AnubLocs[0].GetPositionY() + sin(angle) * dist, AnubLocs[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000) )
{
c->setFaction(31);
c->SetFaction(FACTION_PREY);
c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
c->GetMotionMaster()->MoveRandom(15.0f);
}
@ -452,7 +452,7 @@ public:
me->CastSpell(me, SPELL_ACID_MANDIBLE, true);
determinationTimer = urand(10000, 50000);
despawnTimer = 0;
if( me->getFaction() == 16 ) // hostile - it's phase 2
if (me->GetFaction() == FACTION_MONSTER_2) // hostile - it's phase 2
if( Unit* target = me->SelectNearestTarget(250.0f) )
{
AttackStart(target);

View file

@ -318,7 +318,7 @@ public:
{
trigger->SetDisplayId(11686);
trigger->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
trigger->setFaction(14);
trigger->SetFaction(FACTION_MONSTER);
trigger->SetInCombatWithZone();
}
@ -340,7 +340,7 @@ public:
{
trigger->SetDisplayId(11686);
trigger->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
trigger->setFaction(14);
trigger->SetFaction(FACTION_MONSTER);
trigger->SetInCombatWithZone();
}

View file

@ -514,7 +514,7 @@ public:
if (darnavan->IsAlive())
{
darnavan->RemoveAllAuras();
darnavan->setFaction(35);
darnavan->SetFaction(FACTION_FRIENDLY);
darnavan->DeleteThreatList();
darnavan->CombatStop(true);
darnavan->GetMotionMaster()->MoveIdle();

View file

@ -211,7 +211,7 @@ public:
sizeTimer = 0;
auraVisualTimer = 1;
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f);
me->setFaction(21);
me->SetFaction(FACTION_BOOTY_BAY);
}
void KilledUnit(Unit* who) override

View file

@ -698,7 +698,7 @@ public:
case EVENT_DESTROY_PLATFORM_0:
if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 3000))
{
c->setFaction(me->getFaction());
c->SetFaction(me->GetFaction());
c->CastSpell(c, SPELL_DESTROY_PLATFORM_VISUAL, true);
c->CastSpell(c, SPELL_DESTROY_PLATFORM_EFFECT, false);
}
@ -726,7 +726,7 @@ public:
if (Creature* c = me->SummonCreature(NPC_WYRMREST_SKYTALON, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ() - 20.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0))
{
c->setFaction(pPlayer->getFaction());
c->SetFaction(pPlayer->GetFaction());
//pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true);
c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500));
AttackStart(c);

View file

@ -87,7 +87,7 @@ public:
if (Creature* c = pPlayer->SummonCreature(NPC_WYRMREST_SKYTALON, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ() - 20.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0))
{
c->SetCanFly(true);
c->setFaction(pPlayer->getFaction());
c->SetFaction(pPlayer->GetFaction());
//pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true);
c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500));
}

View file

@ -58,27 +58,27 @@ public:
switch (creature->GetEntry())
{
case NPC_ALLIANCE_RANGER:
creature->setFaction(16);
creature->SetFaction(FACTION_MONSTER_2);
if (TeamIdInInstance == TEAM_ALLIANCE)
creature->UpdateEntry(NPC_HORDE_RANGER);
break;
case NPC_ALLIANCE_BERSERKER:
creature->setFaction(16);
creature->SetFaction(FACTION_MONSTER_2);
if (TeamIdInInstance == TEAM_ALLIANCE)
creature->UpdateEntry(NPC_HORDE_BERSERKER);
break;
case NPC_ALLIANCE_COMMANDER:
creature->setFaction(16);
creature->SetFaction(FACTION_MONSTER_2);
if (TeamIdInInstance == TEAM_ALLIANCE)
creature->UpdateEntry(NPC_HORDE_COMMANDER);
break;
case NPC_ALLIANCE_CLERIC:
creature->setFaction(16);
creature->SetFaction(FACTION_MONSTER_2);
if (TeamIdInInstance == TEAM_ALLIANCE)
creature->UpdateEntry(NPC_HORDE_CLERIC);
break;
case NPC_COMMANDER_STOUTBEARD:
creature->setFaction(16);
creature->SetFaction(FACTION_MONSTER_2);
if (TeamIdInInstance == TEAM_ALLIANCE)
creature->UpdateEntry(NPC_COMMANDER_KOLURG);
break;

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);

Some files were not shown because too many files have changed in this diff Show more