mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
refactor(Core/Combat): Cleanup DoZoneInCombat function. (#8789)
* Core/Combat: Cleanup DoZoneInCombat function. Updates #7960 * Restore distance parameter. * You don't belong here. * Update
This commit is contained in:
@@ -2549,40 +2549,8 @@ void Creature::SendZoneUnderAttackMessage(Player* attacker)
|
||||
|
||||
void Creature::SetInCombatWithZone()
|
||||
{
|
||||
if (!CanHaveThreatList())
|
||||
{
|
||||
LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
Map* map = GetMap();
|
||||
|
||||
if (!map->IsDungeon())
|
||||
{
|
||||
LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
|
||||
return;
|
||||
}
|
||||
|
||||
Map::PlayerList const& PlList = map->GetPlayers();
|
||||
|
||||
if (PlList.isEmpty())
|
||||
return;
|
||||
|
||||
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
|
||||
{
|
||||
if (Player* player = i->GetSource())
|
||||
{
|
||||
if (player->IsGameMaster())
|
||||
continue;
|
||||
|
||||
if (player->IsAlive())
|
||||
{
|
||||
this->SetInCombatWith(player);
|
||||
player->SetInCombatWith(this);
|
||||
AddThreat(player, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IsAIEnabled)
|
||||
AI()->DoZoneInCombat();
|
||||
}
|
||||
|
||||
void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
|
||||
|
||||
Reference in New Issue
Block a user