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 SendBoltEffect(IEntity e, bool sound = true, int hue = 0) { var map = e.Map; if (map == null) { return; } e.ProcessDelta(); Span <byte> preEffect = stackalloc byte[OutgoingEffectPackets.ParticleEffectLength]; OutgoingEffectPackets.CreateTargetParticleEffect( ref preEffect, e, 0, 10, 5, 0, 0, 5031, 3, 0 ); Span <byte> boltEffect = stackalloc byte[OutgoingEffectPackets.BoltEffectLength]; OutgoingEffectPackets.CreateBoltEffect(ref boltEffect, e, hue); Span <byte> soundEffect = sound ? stackalloc byte[OutgoingEffectPackets.SoundPacketLength] : null; if (sound) { OutgoingEffectPackets.CreateSoundEffect(ref soundEffect, 0x29, e); } var eable = map.GetClientsInRange(e.Location); foreach (var state in eable) { if (state.Mobile.CanSee(e)) { if (SendParticlesTo(state)) { state.Send(preEffect); } state.Send(boltEffect); if (sound) { state.Send(soundEffect); } } } eable.Free(); }