Core/Battlegrounds: Clean up some Team/TeamId parameters to use enums instead of raw integer types (#29535)

* Fix criteria data type bg loss team score
This commit is contained in:
Jeremy
2023-12-29 14:12:15 +01:00
committed by GitHub
parent fb64d7fe8e
commit 1ef0c04520
38 changed files with 218 additions and 212 deletions

View File

@@ -246,7 +246,7 @@ void HPControlZoneHandler::HandleProgressEventHorde(GameObject* controlZone)
if (GuidUnorderedSet const* guidSet = controlZone->GetInsidePlayers())
for (ObjectGuid const& guid : *guidSet)
if (Player* player = ObjectAccessor::GetPlayer(*controlZone, guid))
if (player->GetTeam() == TEAM_HORDE)
if (player->GetTeam() == HORDE)
player->KilledMonsterCredit(_killCredit);
}
@@ -268,7 +268,7 @@ void HPControlZoneHandler::HandleProgressEventAlliance(GameObject* controlZone)
if (GuidUnorderedSet const* guidSet = controlZone->GetInsidePlayers())
for (ObjectGuid const& guid : *guidSet)
if (Player* player = ObjectAccessor::GetPlayer(*controlZone, guid))
if (player->GetTeam() == TEAM_ALLIANCE)
if (player->GetTeam() == ALLIANCE)
player->KilledMonsterCredit(_killCredit);
}

View File

@@ -164,12 +164,12 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() const
return std::count_if(guards.begin(), guards.end(), [](WorldObject* guard) { return guard->IsUnit() && guard->ToUnit()->IsAlive(); });
}
uint32 OPvPCapturePointNA::GetControllingFaction() const
Team OPvPCapturePointNA::GetControllingFaction() const
{
return m_ControllingFaction;
}
void OPvPCapturePointNA::FactionTakeOver(uint32 team)
void OPvPCapturePointNA::FactionTakeOver(Team team)
{
m_ControllingFaction = team;
m_GuardsAlive = NA_GUARDS_MAX;
@@ -207,7 +207,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team)
UpdateWyvernRoostWorldState(NA_ROOST_E);
}
OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0),
OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(TEAM_OTHER), m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0),
m_WyvernStateWest(0), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME)
{

View File

@@ -158,15 +158,15 @@ class OPvPCapturePointNA : public OPvPCapturePoint
int32 HandleOpenGo(Player* player, GameObject* go) override;
uint32 GetAliveGuardsCount() const;
uint32 GetControllingFaction() const;
void FactionTakeOver(uint32 team); // called when a faction takes control
Team GetControllingFaction() const;
void FactionTakeOver(Team team); // called when a faction takes control
void UpdateWyvernRoostWorldState(uint32 roost);
void SetControlZoneGUID(ObjectGuid guid) { _controlZoneGUID = guid; }
private:
bool m_capturable;
uint32 m_GuardsAlive;
uint32 m_ControllingFaction;
Team m_ControllingFaction;
uint32 m_WyvernStateNorth;
uint32 m_WyvernStateSouth;
uint32 m_WyvernStateEast;

View File

@@ -40,7 +40,7 @@ uint32 const OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum] = { 1377, 3428, 342
OutdoorPvPSI::OutdoorPvPSI(Map* map) : OutdoorPvP(map)
{
m_TypeId = OUTDOOR_PVP_SI;
m_LastController = 0;
m_LastController = TEAM_OTHER;
}
void OutdoorPvPSI::SendRemoveWorldStates(Player* player)

View File

@@ -50,7 +50,7 @@ class OutdoorPvPSI : public OutdoorPvP
bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go) override;
private:
uint32 m_LastController;
Team m_LastController;
};
#endif

View File

@@ -276,7 +276,7 @@ void TFControlZoneHandler::HandleProgressEventHorde(GameObject* controlZone)
if (GuidUnorderedSet const* guidSet = controlZone->GetInsidePlayers())
for (ObjectGuid const& guid : *guidSet)
if (Player* player = ObjectAccessor::GetPlayer(*controlZone, guid))
if (player->GetTeam() == TEAM_HORDE)
if (player->GetTeam() == HORDE)
player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
OutdoorPvPControlZoneHandler::HandleProgressEventHorde(controlZone);
@@ -294,7 +294,7 @@ void TFControlZoneHandler::HandleProgressEventAlliance(GameObject* controlZone)
if (GuidUnorderedSet const* guidSet = controlZone->GetInsidePlayers())
for (ObjectGuid const& guid : *guidSet)
if (Player* player = ObjectAccessor::GetPlayer(*controlZone, guid))
if (player->GetTeam() == TEAM_ALLIANCE)
if (player->GetTeam() == ALLIANCE)
player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
OutdoorPvPControlZoneHandler::HandleProgressEventAlliance(controlZone);

View File

@@ -149,6 +149,8 @@ class spell_q6124_6129_apply_salve : public SpellScript
if (creatureTarget->GetEntry() == NPC_SICKLY_DEER)
newEntry = NPC_CURED_DEER;
break;
default:
break;
}
if (newEntry)
{