diff --git a/Source/Game/Handlers/InspectHandler.cs b/Source/Game/Handlers/InspectHandler.cs index 0348d8487..37ca6cce8 100644 --- a/Source/Game/Handlers/InspectHandler.cs +++ b/Source/Game/Handlers/InspectHandler.cs @@ -43,11 +43,11 @@ namespace Game for (int i = 0; i < pvpTalents.Length; ++i) inspectResult.PvpTalents[i] = (ushort)pvpTalents[i]; - inspectResult.TalentTraits.Level = (int)player.GetLevel(); - inspectResult.TalentTraits.ChrSpecializationID = (int)player.GetPrimarySpecialization(); + inspectResult.TraitsInfo.PlayerLevel = (int)player.GetLevel(); + inspectResult.TraitsInfo.SpecID = (int)player.GetPrimarySpecialization(); TraitConfig traitConfig = player.GetTraitConfig((int)(uint)player.m_activePlayerData.ActiveCombatTraitConfigID); if (traitConfig != null) - inspectResult.TalentTraits.Config = new TraitConfigPacket(traitConfig); + inspectResult.TraitsInfo.ActiveCombatTraits = new TraitConfigPacket(traitConfig); } Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId()); diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index deab53471..7215dac14 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -847,73 +847,24 @@ namespace Game.Maps } } - public class WorldObjectChangeAccumulator : Notifier + public class WorldObjectChangeAccumulator : IDoWork { + Dictionary updateData; + WorldObject worldObject; + HashSet plr_list = new(); + public WorldObjectChangeAccumulator(WorldObject obj, Dictionary d) { updateData = d; worldObject = obj; } - public override void Visit(IList objs) - { - for (var i = 0; i < objs.Count; ++i) - { - Player player = objs[i]; - BuildPacket(player); - - if (!player.GetSharedVisionList().Empty()) - { - foreach (var visionPlayer in player.GetSharedVisionList()) - BuildPacket(visionPlayer); - } - } - } - - public override void Visit(IList objs) - { - for (var i = 0; i < objs.Count; ++i) - { - Creature creature = objs[i]; - if (!creature.GetSharedVisionList().Empty()) - { - foreach (var visionPlayer in creature.GetSharedVisionList()) - BuildPacket(visionPlayer); - } - } - } - - public override void Visit(IList objs) - { - for (var i = 0; i < objs.Count; ++i) - { - DynamicObject dynamicObject = objs[i]; - - ObjectGuid guid = dynamicObject.GetCasterGUID(); - if (guid.IsPlayer()) - { - //Caster may be NULL if DynObj is in removelist - Player caster = Global.ObjAccessor.FindPlayer(guid); - if (caster != null) - if (caster.m_activePlayerData.FarsightObject == dynamicObject.GetGUID()) - BuildPacket(caster); - } - } - } - - void BuildPacket(Player player) + public void Invoke(Player player) { // Only send update once to a player - if (!plr_list.Contains(player.GetGUID()) && player.HaveAtClient(worldObject)) - { + if (player.HaveAtClient(worldObject) && plr_list.Add(player.GetGUID())) worldObject.BuildFieldsUpdate(player, updateData); - plr_list.Add(player.GetGUID()); - } } - - Dictionary updateData; - WorldObject worldObject; - List plr_list = new(); } public class PlayerDistWorker : Notifier diff --git a/Source/Game/Networking/Packets/InspectPackets.cs b/Source/Game/Networking/Packets/InspectPackets.cs index c3581721a..4a83ddce7 100644 --- a/Source/Game/Networking/Packets/InspectPackets.cs +++ b/Source/Game/Networking/Packets/InspectPackets.cs @@ -63,7 +63,7 @@ namespace Game.Networking.Packets if (AzeriteLevel.HasValue) _worldPacket.WriteUInt32(AzeriteLevel.Value); - TalentTraits.Write(_worldPacket); + TraitsInfo.Write(_worldPacket); } public PlayerModelDisplayInfo DisplayInfo; @@ -79,7 +79,7 @@ namespace Game.Networking.Packets public ushort TodayHK; public ushort YesterdayHK; public byte LifetimeMaxRank; - public TraitInspectInfo TalentTraits = new(); + public TraitInspectInfo TraitsInfo = new(); } public class QueryInspectAchievements : ClientPacket @@ -323,15 +323,15 @@ namespace Game.Networking.Packets public class TraitInspectInfo { - public int Level; - public int ChrSpecializationID; - public TraitConfigPacket Config = new(); + public int PlayerLevel; + public int SpecID; + public TraitConfigPacket ActiveCombatTraits = new(); public void Write(WorldPacket data) { - data.WriteInt32(Level); - data.WriteInt32(ChrSpecializationID); - Config.Write(data); + data.WriteInt32(PlayerLevel); + data.WriteInt32(SpecID); + ActiveCombatTraits.Write(data); } }