Core/Player: Vertical "Say" distance

Port From (https://github.com/TrinityCore/TrinityCore/commit/ab77b1d99254855d690670a4654cacec8b12daf6)
This commit is contained in:
hondacrx
2023-01-22 23:41:15 -05:00
parent 1b04ea97e8
commit 32ea5a96f5
2 changed files with 11 additions and 8 deletions
+4 -4
View File
@@ -5737,13 +5737,13 @@ namespace Game.Entities
Cell.VisitWorldObjects(this, notifier, dist);
}
void SendMessageToSetInRange(ServerPacket data, float dist, bool self, bool own_team_only)
void SendMessageToSetInRange(ServerPacket data, float dist, bool self, bool own_team_only, bool required3dDist = false)
{
if (self)
SendPacket(data);
PacketSenderRef sender = new(data);
var notifier = new MessageDistDeliverer<PacketSenderRef>(this, sender, dist, own_team_only);
var notifier = new MessageDistDeliverer<PacketSenderRef>(this, sender, dist, own_team_only, null, required3dDist);
Cell.VisitWorldObjects(this, notifier, dist);
}
@@ -6000,7 +6000,7 @@ namespace Game.Entities
localizer.Invoke(this);
// Send to players
MessageDistDeliverer<LocalizedDo> notifier = new(this, localizer, range);
MessageDistDeliverer<LocalizedDo> notifier = new(this, localizer, range, false, null, true);
Cell.VisitWorldObjects(this, notifier, range);
}
@@ -6026,7 +6026,7 @@ namespace Game.Entities
ChatPkt data = new();
data.Initialize(ChatMsg.Emote, Language.Universal, this, this, text);
SendMessageToSetInRange(data, WorldConfig.GetFloatValue(WorldCfg.ListenRangeTextemote), !GetSession().HasPermission(RBACPermissions.TwoSideInteractionChat));
SendMessageToSetInRange(data, WorldConfig.GetFloatValue(WorldCfg.ListenRangeTextemote), true, !GetSession().HasPermission(RBACPermissions.TwoSideInteractionChat), true);
}
public override void TextEmote(uint textId, WorldObject target = null, bool isBossEmote = false)
{
+7 -4
View File
@@ -1,6 +1,7 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using Bgs.Protocol.Notification.V1;
using Framework.Constants;
using Game.Chat;
using Game.Entities;
@@ -394,8 +395,9 @@ namespace Game.Maps
float i_distSq;
Team team;
Player skipped_receiver;
bool required3dDist;
public MessageDistDeliverer(WorldObject src, T packetSender, float dist, bool own_team_only = false, Player skipped = null)
public MessageDistDeliverer(WorldObject src, T packetSender, float dist, bool own_team_only = false, Player skipped = null, bool req3dDist = false)
{
i_source = src;
i_packetSender = packetSender;
@@ -405,6 +407,7 @@ namespace Game.Maps
team = src.ToPlayer().GetEffectiveTeam();
skipped_receiver = skipped;
required3dDist = req3dDist;
}
public override void Visit(IList<Player> objs)
@@ -415,7 +418,7 @@ namespace Game.Maps
if (!player.InSamePhase(i_phaseShift))
continue;
if (player.GetExactDist2dSq(i_source.GetPosition()) > i_distSq)
if ((!required3dDist ? player.GetExactDist2dSq(i_source) : player.GetExactDistSq(i_source)) > i_distSq)
continue;
// Send packet to all who are sharing the player's vision
@@ -439,7 +442,7 @@ namespace Game.Maps
if (!creature.InSamePhase(i_phaseShift))
continue;
if (creature.GetExactDist2dSq(i_source.GetPosition()) > i_distSq)
if ((!required3dDist ? creature.GetExactDist2dSq(i_source) : creature.GetExactDistSq(i_source)) > i_distSq)
continue;
// Send packet to all who are sharing the creature's vision
@@ -460,7 +463,7 @@ namespace Game.Maps
if (!dynamicObject.InSamePhase(i_phaseShift))
continue;
if (dynamicObject.GetExactDist2dSq(i_source.GetPosition()) > i_distSq)
if ((!required3dDist ? dynamicObject.GetExactDist2dSq(i_source) : dynamicObject.GetExactDistSq(i_source)) > i_distSq)
continue;
// Send packet back to the caster if the caster has vision of dynamic object