Skip to content

Commit

Permalink
fixec
Browse files Browse the repository at this point in the history
  • Loading branch information
hatersgit committed Feb 19, 2024
1 parent 34facb5 commit 4c70e88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/server/game/Entities/Player/PlayerUpdates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,8 @@ void Player::UpdateArea(uint32 newArea)
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
pvpInfo.IsInNoPvPArea = true;
CombatStopWithPets();
if (!duel && GetCombatManager().HasPvPCombat())
CombatStopWithPets();
}
else
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
Expand Down
8 changes: 6 additions & 2 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,13 +889,17 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
}
}

// handle updates for creatures in combat with player and are more than X yards away
// handle updates for creatures in combat with player and are more than 60 yards away
if (player->IsInCombat())
{
std::vector<Unit*> toVisit;
for (auto const& pair : player->GetCombatManager().GetPvECombatRefs())
if (Creature* unit = pair.second->GetOther(player)->ToCreature())
if (unit->GetMapId() == player->GetMapId() && !unit->IsWithinDistInMap(player, GetVisibilityRange(), false))
VisitNearbyCellsOf(unit, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
toVisit.push_back(unit);

for (Unit* unit : toVisit)
VisitNearbyCellsOf(unit, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
}
}

Expand Down

0 comments on commit 4c70e88

Please sign in to comment.