public static void SendTargetParticles( IEntity target, int itemID, int speed, int duration, int hue, int renderMode, int effect, EffectLayer layer, int unknown = 0 ) { (target as Mobile)?.ProcessDelta(); var map = target.Map; if (map == null) { return; } Span <byte> particles = stackalloc byte[OutgoingEffectPackets.ParticleEffectLength]; particles.InitializePacket(); Span <byte> regular = itemID != 0 ? stackalloc byte[OutgoingEffectPackets.HuedEffectLength] : null; if (itemID != 0) { regular.InitializePacket(); } var eable = map.GetClientsInRange(target.Location); foreach (var state in eable) { state.Mobile.ProcessDelta(); if (SendParticlesTo(state)) { if (particles[0] == 0) { OutgoingEffectPackets.CreateTargetParticleEffect( particles, target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown ); } state.Send(particles); } else if (itemID != 0) { if (regular[0] == 0) { OutgoingEffectPackets.CreateTargetHuedEffect(regular, target, itemID, speed, duration, hue, renderMode); } state.Send(regular); } } eable.Free(); }
public static void SendTargetEffect(IEntity target, int itemID, int speed, int duration, int hue = 0, int renderMode = 0) { (target as Mobile)?.ProcessDelta(); Span <byte> effect = stackalloc byte[OutgoingEffectPackets.HuedEffectLength].InitializePacket(); OutgoingEffectPackets.CreateTargetHuedEffect( effect, target, itemID, speed, duration, hue, renderMode ); SendPacket(target.Location, target.Map, effect); }