fix(Core/Player): Vertical Message distance (#19302)

* cherry-pick commit (297541e9c9)

* Get rid of unused param

* Merge SendMessageToSetInRange_OwnTeam into SendMessageToSetInRange

Co-authored-by: Badgersson <83663557+dekz120@users.noreply.github.com>
This commit is contained in:
Kitzunu
2024-07-06 15:05:34 +02:00
committed by GitHub
parent c41a5ff336
commit 3c50b1a135
9 changed files with 78 additions and 54 deletions

View File

@@ -217,8 +217,14 @@ void MessageDistDeliverer::Visit(PlayerMapType& m)
if (!target->InSamePhase(i_phaseMask))
continue;
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
if (required3dDist)
{
if (target->GetExactDistSq(i_source) > i_distSq)
continue;
}
else
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the player's vision
if (target->HasSharedVision())
@@ -242,8 +248,14 @@ void MessageDistDeliverer::Visit(CreatureMapType& m)
if (!target->HasSharedVision() || !target->InSamePhase(i_phaseMask))
continue;
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
if (required3dDist)
{
if (target->GetExactDistSq(i_source) > i_distSq)
continue;
}
else
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
// Send packet to all who are sharing the creature's vision
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
@@ -265,8 +277,14 @@ void MessageDistDeliverer::Visit(DynamicObjectMapType& m)
if (!target->IsViewpoint())
continue;
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
if (required3dDist)
{
if (target->GetExactDistSq(i_source) > i_distSq)
continue;
}
else
if (target->GetExactDist2dSq(i_source) > i_distSq)
continue;
// Send packet back to the caster if the caster has vision of dynamic object
Player* caster = (Player*)target->GetCaster();

View File

@@ -102,10 +102,11 @@ namespace Acore
float i_distSq;
TeamId teamId;
Player const* skipped_receiver;
MessageDistDeliverer(WorldObject const* src, WorldPacket const* msg, float dist, bool own_team_only = false, Player const* skipped = nullptr)
bool required3dDist;
MessageDistDeliverer(WorldObject const* src, WorldPacket const* msg, float dist, bool own_team_only = false, Player const* skipped = nullptr, bool req3dDist = false)
: i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist)
, teamId((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? src->ToPlayer()->GetTeamId() : TEAM_NEUTRAL)
, skipped_receiver(skipped)
, skipped_receiver(skipped), required3dDist(req3dDist)
{
}
void Visit(PlayerMapType& m);