Core/Spells: Fixed spell effect 93 (SPELL_EFFECT_FORCE_DESELECT)
Port From (https://github.com/TrinityCore/TrinityCore/commit/92e95ddf558db5fdcdf3c54ecd1d694da92c3a44)
This commit is contained in:
@@ -468,6 +468,93 @@ namespace Game.Maps
|
|||||||
Player skipped_receiver;
|
Player skipped_receiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MessageDistDelivererToHostile : Notifier
|
||||||
|
{
|
||||||
|
Unit i_source;
|
||||||
|
ServerPacket i_message;
|
||||||
|
float i_distSq;
|
||||||
|
|
||||||
|
public MessageDistDelivererToHostile(Unit src, ServerPacket msg, float dist)
|
||||||
|
{
|
||||||
|
i_source = src;
|
||||||
|
i_message = msg;
|
||||||
|
i_distSq = dist * dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Visit(IList<Player> objs)
|
||||||
|
{
|
||||||
|
foreach (var target in objs)
|
||||||
|
{
|
||||||
|
if (!target.IsInPhase(i_source))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (target.GetExactDist2dSq(i_source) > i_distSq)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Send packet to all who are sharing the player's vision
|
||||||
|
if (target.HasSharedVision())
|
||||||
|
{
|
||||||
|
foreach (var player in target.GetSharedVisionList())
|
||||||
|
if (player.seerView == target)
|
||||||
|
SendPacket(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target.seerView == target || target.GetVehicle())
|
||||||
|
SendPacket(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Visit(IList<Creature> objs)
|
||||||
|
{
|
||||||
|
foreach (var target in objs)
|
||||||
|
{
|
||||||
|
if (!target.IsInPhase(i_source))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (target.GetExactDist2dSq(i_source) > i_distSq)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Send packet to all who are sharing the creature's vision
|
||||||
|
if (target.HasSharedVision())
|
||||||
|
{
|
||||||
|
foreach (var player in target.GetSharedVisionList())
|
||||||
|
if (player.seerView == target)
|
||||||
|
SendPacket(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Visit(IList<DynamicObject> objs)
|
||||||
|
{
|
||||||
|
foreach (var target in objs)
|
||||||
|
{
|
||||||
|
if (!target.IsInPhase(i_source))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (target.GetExactDist2dSq(i_source) > i_distSq)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Unit caster = target.GetCaster();
|
||||||
|
if (caster != null)
|
||||||
|
{
|
||||||
|
// Send packet back to the caster if the caster has vision of dynamic object
|
||||||
|
Player player = caster.ToPlayer();
|
||||||
|
if (player && player.seerView == target)
|
||||||
|
SendPacket(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendPacket(Player player)
|
||||||
|
{
|
||||||
|
// never send packet to self
|
||||||
|
if (player == i_source || !player.HaveAtClient(i_source) || player.IsFriendlyTo(i_source))
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.SendPacket(i_message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class UpdaterNotifier : Notifier
|
public class UpdaterNotifier : Notifier
|
||||||
{
|
{
|
||||||
public UpdaterNotifier(uint diff)
|
public UpdaterNotifier(uint diff)
|
||||||
|
|||||||
@@ -4010,9 +4010,28 @@ namespace Game.Spells
|
|||||||
if (effectHandleMode != SpellEffectHandleMode.Hit)
|
if (effectHandleMode != SpellEffectHandleMode.Hit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
float dist = m_caster.GetVisibilityRange();
|
||||||
|
|
||||||
|
// clear focus
|
||||||
|
BreakTarget breakTarget = new BreakTarget();
|
||||||
|
breakTarget.UnitGUID = m_caster.GetGUID();
|
||||||
|
MessageDistDelivererToHostile notifierBreak = new MessageDistDelivererToHostile(m_caster, breakTarget, dist);
|
||||||
|
Cell.VisitWorldObjects(m_caster, notifierBreak, dist);
|
||||||
|
|
||||||
|
// and selection
|
||||||
ClearTarget clearTarget = new ClearTarget();
|
ClearTarget clearTarget = new ClearTarget();
|
||||||
clearTarget.Guid = m_caster.GetGUID();
|
clearTarget.Guid = m_caster.GetGUID();
|
||||||
m_caster.SendMessageToSet(clearTarget, true);
|
MessageDistDelivererToHostile notifierClear = new MessageDistDelivererToHostile(m_caster, clearTarget, dist);
|
||||||
|
Cell.VisitWorldObjects(m_caster, notifierClear, dist);
|
||||||
|
|
||||||
|
// we should also force pets to remove us from current target
|
||||||
|
List<Unit> attackerSet = new List<Unit>();
|
||||||
|
foreach (var unit in m_caster.getAttackers())
|
||||||
|
if (unit.GetTypeId() == TypeId.Unit && !unit.CanHaveThreatList())
|
||||||
|
attackerSet.Add(unit);
|
||||||
|
|
||||||
|
foreach (var unit in attackerSet)
|
||||||
|
unit.AttackStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
[SpellEffectHandler(SpellEffectName.SelfResurrect)]
|
[SpellEffectHandler(SpellEffectName.SelfResurrect)]
|
||||||
|
|||||||
Reference in New Issue
Block a user