Exemplo n.º 1
0
        //Send flash effect to all clients in range (like bolt effect)
        public static void SendFlashEffect(IEntity e, FlashType flash)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            e.ProcessDelta();

            Packet flashEffect = null;

            IPooledEnumerable eable = map.GetClientsInRange(e.Location);

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e) && state.Version >= m_FlashEffectVersion)
                {
                    if (flashEffect == null)
                    {
                        flashEffect = Packet.Acquire(new FlashEffect(flash));
                    }

                    state.Send(flashEffect);
                }
            }

            Packet.Release(flashEffect);

            eable.Free();
        }
Exemplo n.º 2
0
        public static void PlaySound(IPoint3D p, Map map, int soundID)
        {
            if (soundID <= -1)
            {
                return;
            }

            if (map != null)
            {
                Packet playSound = null;

                IPooledEnumerable eable = map.GetClientsInRange(new Point3D(p));

                foreach (NetState state in eable)
                {
                    state.Mobile.ProcessDelta();

                    if (playSound == null)
                    {
                        playSound = Packet.Acquire(new PlaySound(soundID, p));
                    }

                    state.Send(playSound);
                }

                Packet.Release(playSound);

                eable.Free();
            }
        }
Exemplo n.º 3
0
        public static void PlaySound( IPoint3D p, Map map, int soundID )
        {
            if ( soundID <= -1 )
                return;

            if ( map != null )
            {
                Packet playSound = null;

                IPooledEnumerable eable = map.GetClientsInRange( new Point3D( p ) );

                foreach ( NetState state in eable )
                {
                    state.Mobile.ProcessDelta();

                    if ( playSound == null )
                        playSound = Packet.Acquire( new PlaySound( soundID, p ) );

                    state.Send( playSound );
                }

                Packet.Release( playSound );

                eable.Free();
            }
        }
Exemplo n.º 4
0
        public static void PlaySound(Point3D p, Map map, int soundID)
        {
            if (soundID <= -1)
            {
                return;
            }

            if (map != null)
            {
                Span <byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength];
                buffer.InitializePacket();

                var eable = map.GetClientsInRange(new Point3D(p));

                foreach (var state in eable)
                {
                    state.Mobile.ProcessDelta();

                    if (buffer[0] == 0)
                    {
                        OutgoingEffectPackets.CreateSoundEffect(buffer, soundID, p);
                    }

                    state.Send(buffer);
                }

                eable.Free();
            }
        }
Exemplo n.º 5
0
        public static void SendLocationParticles(IEntity e, int itemID, int speed, int duration, int hue, int renderMode, int effect, int unknown)
        {
            Map map1 = e.Map;

            if (map1 == null)
            {
                return;
            }
            Packet            packet1     = null;
            Packet            packet2     = null;
            IPooledEnumerable enumerable1 = map1.GetClientsInRange(e.Location);

            foreach (NetState state1 in enumerable1)
            {
                state1.Mobile.ProcessDelta();
                if (Effects.SendParticlesTo(state1))
                {
                    if (packet1 == null)
                    {
                        packet1 = new LocationParticleEffect(e, itemID, speed, duration, hue, renderMode, effect, unknown);
                    }
                    state1.Send(packet1);
                    continue;
                }
                if (itemID != 0)
                {
                    if (packet2 == null)
                    {
                        packet2 = new LocationEffect(e, itemID, speed, duration, hue, renderMode);
                    }
                    state1.Send(packet2);
                }
            }
            enumerable1.Free();
        }
Exemplo n.º 6
0
        public static void PlaySound(IPoint3D p, Map map, int soundId)
        {
            if (soundId <= -1)
            {
                return;
            }

            if (map != null)
            {
                Packet playSound = null;

                foreach (NetState state in map.GetClientsInRange(p))
                {
                    state.Mobile.ProcessDelta();

                    if (playSound == null)
                    {
                        playSound = Packet.Acquire(GenericPackets.PlaySound(soundId, p));
                    }

                    state.Send(playSound);
                }

                Packet.Release(playSound);
            }
        }
Exemplo n.º 7
0
        public static void SendTargetParticles(
            IEntity target,
            int itemID,
            int speed,
            int duration,
            int hue,
            int renderMode,
            int effect,
            EffectLayer layer,
            int unknown)
        {
            if (target is Mobile)
            {
                ((Mobile)target).ProcessDelta();
            }

            Map map = target.Map;

            if (map != null)
            {
                Packet particles = null, regular = null;

                var eable = map.GetClientsInRange(target.Location);

                foreach (NetState state in eable)
                {
                    state.Mobile.ProcessDelta();

                    if (SendParticlesTo(state))
                    {
                        if (particles == null)
                        {
                            particles =
                                Packet.Acquire(
                                    new TargetParticleEffect(target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown));
                        }

                        state.Send(particles);
                    }
                    else if (itemID != 0)
                    {
                        if (regular == null)
                        {
                            regular = Packet.Acquire(new TargetEffect(target, itemID, speed, duration, hue, renderMode));
                        }

                        state.Send(regular);
                    }
                }

                Packet.Release(particles);
                Packet.Release(regular);

                eable.Free();
            }

            //SendPacket( target.Location, target.Map, new TargetParticleEffect( target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown ) );
        }
Exemplo n.º 8
0
        public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            if (e is Item)
            {
                ((Item)e).ProcessDelta();
            }
            else if (e is Mobile)
            {
                ((Mobile)e).ProcessDelta();
            }

            Packet preEffect = null, boltEffect = null, playSound = null;

            IPooledEnumerable eable = map.GetClientsInRange(e.Location);

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e))
                {
                    if (SendParticlesTo(state))
                    {
                        if (preEffect == null)
                        {
                            preEffect = new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0);
                        }

                        state.Send(preEffect);
                    }

                    if (boltEffect == null)
                    {
                        boltEffect = new BoltEffect(e, hue);
                    }

                    state.Send(boltEffect);

                    if (sound)
                    {
                        if (playSound == null)
                        {
                            playSound = new PlaySound(0x29, e);
                        }

                        state.Send(playSound);
                    }
                }
            }

            eable.Free();
        }
Exemplo n.º 9
0
        public static void SendMovingParticles(IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound, EffectLayer layer, int unknown)
        {
            if (from is Mobile)
            {
                ((Mobile)from).ProcessDelta();
            }

            if (to is Mobile)
            {
                ((Mobile)to).ProcessDelta();
            }

            Map map = from.Map;

            if (map != null)
            {
                Packet particles = null, regular = null;

                IPooledEnumerable eable = map.GetClientsInRange(from.Location);

                foreach (NetState state in eable)
                {
                    if (!state.Mobile.HasFilter || state.Mobile.InLOS(from.Location))
                    {
                        state.Mobile.ProcessDelta();

                        if (SendParticlesTo(state))
                        {
                            if (particles == null)
                            {
                                particles = Packet.Acquire(new MovingParticleEffect(from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, layer, unknown));
                            }

                            state.Send(particles);
                        }
                        else if (itemID > 1)
                        {
                            if (regular == null)
                            {
                                regular = Packet.Acquire(new MovingEffect(from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode));
                            }

                            state.Send(regular);
                        }
                    }
                }

                Packet.Release(particles);
                Packet.Release(regular);

                eable.Free();
            }

            //SendPacket( from.Location, from.Map, new MovingParticleEffect( from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, unknown ) );
        }
Exemplo n.º 10
0
        public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            e.ProcessDelta();

            Packet preEffect = null, boltEffect = null, playSound = null;

            var eable = map.GetClientsInRange(e.Location);

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e))
                {
                    if (SendParticlesTo(state))
                    {
                        if (preEffect == null)
                        {
                            preEffect = Packet.Acquire(new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0));
                        }

                        state.Send(preEffect);
                    }

                    if (boltEffect == null)
                    {
                        boltEffect = Packet.Acquire(new BoltEffect(e, hue));
                    }

                    state.Send(boltEffect);

                    if (sound)
                    {
                        if (playSound == null)
                        {
                            playSound = Packet.Acquire(new PlaySound(0x29, e));
                        }

                        state.Send(playSound);
                    }
                }
            }

            Packet.Release(preEffect);
            Packet.Release(boltEffect);
            Packet.Release(playSound);

            eable.Free();
        }
Exemplo n.º 11
0
        public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map1 = e.Map;

            if (map1 == null)
            {
                return;
            }
            if ((e is Item))
            {
                ((Item)e).ProcessDelta();
            }
            else if ((e is Mobile))
            {
                ((Mobile)e).ProcessDelta();
            }
            Packet            packet1     = null;
            Packet            packet2     = null;
            Packet            packet3     = null;
            IPooledEnumerable enumerable1 = map1.GetClientsInRange(e.Location);

            foreach (NetState state1 in enumerable1)
            {
                if (state1.Mobile.CanSee(e))
                {
                    if (Effects.SendParticlesTo(state1))
                    {
                        if (packet1 == null)
                        {
                            packet1 = new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0);
                        }
                        state1.Send(packet1);
                    }
                    if (packet2 == null)
                    {
                        packet2 = new BoltEffect(e, hue);
                    }
                    state1.Send(packet2);
                    if (sound)
                    {
                        if (packet3 == null)
                        {
                            packet3 = new PlaySound(41, e);
                        }
                        state1.Send(packet3);
                    }
                }
            }
            enumerable1.Free();
        }
Exemplo n.º 12
0
        public static void SendPacket(Point3D origin, Map map, Packet p)
        {
            if (map == null)
            {
                return;
            }
            IPooledEnumerable enumerable1 = map.GetClientsInRange(origin);

            foreach (NetState state1 in enumerable1)
            {
                state1.Mobile.ProcessDelta();
                state1.Send(p);
            }
            enumerable1.Free();
        }
Exemplo n.º 13
0
        public static void SendPacket(IPoint3D origin, Map map, Packet p)
        {
            if (map != null)
            {
                IPooledEnumerable eable = map.GetClientsInRange(new Point3D(origin));

                foreach (NetState state in eable)
                {
                    state.Mobile.ProcessDelta();

                    state.Send(p);
                }

                eable.Free();
            }
        }
Exemplo n.º 14
0
        public static void SendPacket(Point3D origin, Map map, Span <byte> effectBuffer)
        {
            if (map == null)
            {
                return;
            }

            var eable = map.GetClientsInRange(new Point3D(origin));

            foreach (var state in eable)
            {
                state.Mobile.ProcessDelta();
                state.Send(effectBuffer);
            }

            eable.Free();
        }
Exemplo n.º 15
0
        public static void SendLocationParticles(IEntity e, int itemID, int speed, int duration, int hue, int renderMode, int effect, int unknown)
        {
            Map map = e.Map;

            if (map != null)
            {
                Packet particles = null, regular = null;

                IPooledEnumerable eable = map.GetClientsInRange(e.Location);

                foreach (NetState state in eable)
                {
                    if (!state.Mobile.HasFilter || state.Mobile.InLOS(e.Location))
                    {
                        state.Mobile.ProcessDelta();

                        if (SendParticlesTo(state))
                        {
                            if (particles == null)
                            {
                                particles =
                                    Packet.Acquire(new LocationParticleEffect(e, itemID, speed, duration, hue, renderMode, effect, unknown));
                            }

                            state.Send(particles);
                        }
                        else if (itemID != 0)
                        {
                            if (regular == null)
                            {
                                regular = Packet.Acquire(new LocationEffect(e, itemID, speed, duration, hue, renderMode));
                            }

                            state.Send(regular);
                        }
                    }
                }

                Packet.Release(particles);
                Packet.Release(regular);

                eable.Free();
            }
            //SendPacket( e.Location, e.Map, new LocationParticleEffect( e, itemID, speed, duration, hue, renderMode, effect, unknown ) );
        }
Exemplo n.º 16
0
        public static void SendMovingParticles(IEntity from, IEntity to, int itemID, int speed, int duration, bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound, EffectLayer layer, int unknown)
        {
            if ((from is Mobile))
            {
                ((Mobile)from).ProcessDelta();
            }
            if ((to is Mobile))
            {
                ((Mobile)to).ProcessDelta();
            }
            Map map1 = from.Map;

            if (map1 == null)
            {
                return;
            }
            Packet            packet1     = null;
            Packet            packet2     = null;
            IPooledEnumerable enumerable1 = map1.GetClientsInRange(from.Location);

            foreach (NetState state1 in enumerable1)
            {
                state1.Mobile.ProcessDelta();
                if (Effects.SendParticlesTo(state1))
                {
                    if (packet1 == null)
                    {
                        packet1 = new MovingParticleEffect(from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect, explodeEffect, explodeSound, layer, unknown);
                    }
                    state1.Send(packet1);
                    continue;
                }
                if (itemID > 1)
                {
                    if (packet2 == null)
                    {
                        packet2 = new MovingEffect(from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode);
                    }
                    state1.Send(packet2);
                }
            }
            enumerable1.Free();
        }
Exemplo n.º 17
0
        public static void SendPacket(IPoint3D origin, Map map, Packet p)
        {
            if (map != null)
            {
                var eable = map.GetClientsInRange(new Point3D(origin));

                p.Acquire();

                foreach (NetState state in eable)
                {
                    state.Mobile.ProcessDelta();
                    state.Send(p);
                }

                p.Release();

                eable.Free();
            }
        }
Exemplo n.º 18
0
        public static void SendPacket(Point3D origin, Map map, Packet p)
        {
            if (map == null)
            {
                return;
            }

            var eable = map.GetClientsInRange(origin);

            p.Acquire();

            foreach (var state in eable)
            {
                state.Mobile.ProcessDelta();
                state.Send(p);
            }

            p.Release();

            eable.Free();
        }
Exemplo n.º 19
0
        public static void PlaySound( IPoint3D p, Map map, int soundId )
        {
            if ( soundId <= -1 )
                return;

            if ( map != null )
            {
                Packet playSound = null;

                foreach ( GameClient state in map.GetClientsInRange( p ) )
                {
                    state.Mobile.ProcessDelta();

                    if ( playSound == null )
                        playSound = Packet.Acquire( GenericPackets.PlaySound( soundId, p ) );

                    state.Send( playSound );
                }

                Packet.Release( playSound );
            }
        }
Exemplo n.º 20
0
        public static void SendTargetParticles(IEntity target, int itemID, int speed, int duration, int hue, int renderMode, int effect, EffectLayer layer, int unknown)
        {
            if ((target is Mobile))
            {
                ((Mobile)target).ProcessDelta();
            }
            Map map1 = target.Map;

            if (map1 == null)
            {
                return;
            }
            Packet            packet1     = null;
            Packet            packet2     = null;
            IPooledEnumerable enumerable1 = map1.GetClientsInRange(target.Location);

            foreach (NetState state1 in enumerable1)
            {
                state1.Mobile.ProcessDelta();
                if (Effects.SendParticlesTo(state1))
                {
                    if (packet1 == null)
                    {
                        packet1 = new TargetParticleEffect(target, itemID, speed, duration, hue, renderMode, effect, layer, unknown);
                    }
                    state1.Send(packet1);
                    continue;
                }
                if (itemID != 0)
                {
                    if (packet2 == null)
                    {
                        packet2 = new TargetEffect(target, itemID, speed, duration, hue, renderMode);
                    }
                    state1.Send(packet2);
                }
            }
            enumerable1.Free();
        }
Exemplo n.º 21
0
        public static void SendPacket(Point3D origin, Map map, Packet p)
        {
            if (map != null)
            {
                IPooledEnumerable eable = map.GetClientsInRange(origin);

                p.Acquire();

                foreach (NetState state in eable)
                {
                    if (!state.Mobile.HasFilter || state.Mobile.InLOS(origin))
                    {
                        state.Mobile.ProcessDelta();

                        state.Send(p);
                    }
                }

                p.Release();

                eable.Free();
            }
        }
Exemplo n.º 22
0
        public static void PlaySound(IPoint3D p, Map map, int soundID)
        {
            if (soundID == -1)
            {
                return;
            }
            if (map == null)
            {
                return;
            }
            Packet            packet1     = null;
            IPooledEnumerable enumerable1 = map.GetClientsInRange(new Point3D(p));

            foreach (NetState state1 in enumerable1)
            {
                state1.Mobile.ProcessDelta();
                if (packet1 == null)
                {
                    packet1 = new PlaySound(soundID, p);
                }
                state1.Send(packet1);
            }
            enumerable1.Free();
        }
Exemplo n.º 23
0
        /// <summary>
        /// Moves the Item to a given <paramref name="location" /> and <paramref name="map" />.
        /// </summary>
        public void MoveToWorld( Point3D location, Map map )
        {
            if ( Deleted )
                return;

            Point3D oldLocation = GetWorldLocation();
            Point3D oldRealLocation = m_Location;

            SetLastMoved();

            if ( Parent is Mobile )
                ((Mobile)Parent).RemoveItem( this );
            else if ( Parent is Item )
                ((Item)Parent).RemoveItem( this );

            if ( m_Map != map )
            {
                Map old = m_Map;

                if ( m_Map != null )
                {
                    m_Map.OnLeave( this );

                    if ( oldLocation.m_X != 0 )
                    {
                        Packet remPacket = null;

                        IPooledEnumerable eable = m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() );

                        foreach ( NetState state in eable )
                        {
                            Mobile m = state.Mobile;

                            if ( m.InRange( oldLocation, GetUpdateRange( m ) ) )
                            {
                                if ( remPacket == null )
                                    remPacket = this.RemovePacket;

                                state.Send( remPacket );
                            }
                        }

                        eable.Free();
                    }
                }

                if ( m_Items != null )
                {
                    for ( int i = 0; i < m_Items.Count; ++i )
                        ((Item)m_Items[i]).Map = map;
                }

                m_Location = location;
                this.OnLocationChange( oldRealLocation );
                m_WorldPacket = null;

                m_Map = map;

                if ( m_Map != null )
                    m_Map.OnEnter( this );

                OnMapChange();

                if ( m_Map != null )
                {
                    IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() );

                    foreach ( NetState state in eable )
                    {
                        Mobile m = state.Mobile;

                        if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) )
                            SendInfoTo( state );
                    }

                    eable.Free();
                }

                RemDelta( ItemDelta.Update );

                if ( old == null || old == Map.Internal )
                    InvalidateProperties();
            }
            else if ( m_Map != null )
            {
                IPooledEnumerable eable;

                if ( oldLocation.m_X != 0 )
                {
                    Packet removeThis = null;

                    eable = m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() );

                    foreach ( NetState state in eable )
                    {
                        Mobile m = state.Mobile;

                        if ( !m.InRange( location, GetUpdateRange( m ) ) )
                        {
                            if ( removeThis == null )
                                removeThis = this.RemovePacket;

                            state.Send( removeThis );
                        }
                    }

                    eable.Free();
                }

                Point3D oldInternalLocation = m_Location;

                m_Location = location;
                this.OnLocationChange( oldRealLocation );
                m_WorldPacket = null;

                eable = m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() );

                foreach ( NetState state in eable )
                {
                    Mobile m = state.Mobile;

                    if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) )
                        SendInfoTo( state );
                }

                eable.Free();

                m_Map.OnMove( oldInternalLocation, this );

                RemDelta( ItemDelta.Update );
            }
            else
            {
                Map = map;
                Location = location;
            }
        }
Exemplo n.º 24
0
        public static void SendPacket( IPoint3D origin, Map map, Packet p )
        {
            if ( map != null )
            {
                IPooledEnumerable eable = map.GetClientsInRange( new Point3D( origin ) );

                p.Acquire();

                foreach ( NetState state in eable )
                {
                    state.Mobile.ProcessDelta();

                    state.Send( p );
                }

                p.Release();

                eable.Free();
            }
        }
Exemplo n.º 25
0
        public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            e.ProcessDelta();

            Packet preEffect = null, postEffect = null, boltEffect = null, playSound = null;

            var eable = map.GetClientsInRange(e.Location);

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e))
                {
                    bool sendParticles = SendParticlesTo(state);

                    if (sendParticles)
                    {
                        if (preEffect == null)
                        {
                            preEffect = Packet.Acquire(new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0));
                        }

                        state.Send(preEffect);
                    }

                    if (boltEffect == null)
                    {
                        if (hue == 0)
                        {
                            boltEffect = Packet.Acquire(new BoltEffectNew(e));
                        }
                        else
                        {
                            boltEffect = Packet.Acquire(new BoltEffect(e, hue));
                        }
                    }

                    state.Send(boltEffect);

                    if (sendParticles)
                    {
                        if (postEffect == null)
                        {
                            postEffect = Packet.Acquire(new GraphicalEffect(EffectType.FixedFrom, e.Serial, Serial.Zero, 0, e.Location, e.Location, 0, 0, false, 0));
                        }

                        state.Send(postEffect);
                    }

                    if (sound)
                    {
                        if (playSound == null)
                        {
                            playSound = Packet.Acquire(new PlaySound(0x29, e));
                        }

                        state.Send(playSound);
                    }
                }
            }

            Packet.Release(preEffect);
            Packet.Release(postEffect);
            Packet.Release(boltEffect);
            Packet.Release(playSound);

            eable.Free();
        }
Exemplo n.º 26
0
        public static void SendPacket( Point3D origin, Map map, IPacket p )
        {
            if ( map != null )
            {
                IPooledEnumerable eable = map.GetClientsInRange( origin );

                foreach ( NetState state in eable )
                {
                    state.Mobile.ProcessDelta();

                    state.Send( p );
                }

                eable.Free();
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Moves the Item to a given <paramref name="location" /> and <paramref name="map" />.
        /// </summary>
        public void MoveToWorld( Point3D location, Map map )
        {
            if ( Deleted )
                return;

            Point3D oldLocation = GetWorldLocation();
            Point3D oldRealLocation = m_Location;

            SetLastMoved();

            if ( Parent is Mobile )
                ( (Mobile) Parent ).RemoveItem( this );
            else if ( Parent is Item )
                ( (Item) Parent ).RemoveItem( this );

            if ( m_Map != map )
            {
                Map old = m_Map;

                if ( m_Map != null )
                {
                    m_Map.OnLeave( this );

                    if ( oldLocation.X != 0 )
                    {
                        Packet remPacket = null;

                        foreach ( GameClient state in m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() ) )
                        {
                            Mobile m = state.Mobile;

                            if ( m.InRange( oldLocation, GetUpdateRange( m ) ) )
                            {
                                if ( remPacket == null )
                                    remPacket = this.RemovePacket;

                                state.Send( remPacket );
                            }
                        }
                    }
                }

                m_Location = location;
                this.OnLocationChange( oldRealLocation );

                ReleaseWorldPackets();

                if ( m_Items != null )
                {
                    for ( int i = 0; i < m_Items.Count; ++i )
                        ( (Item) m_Items[i] ).Map = map;
                }

                m_Map = map;

                if ( m_Map != null )
                    m_Map.OnEnter( this );

                OnMapChange();

                EventSink.Instance.InvokeMapChanged( new MapChangedEventArgs( this, old ) );

                if ( m_Map != null )
                {
                    foreach ( GameClient state in m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() ) )
                    {
                        Mobile m = state.Mobile;

                        if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) )
                            SendInfoTo( state );
                    }
                }

                RemDelta( ItemDelta.Update );

                if ( old == null || old == Map.Internal )
                    InvalidateProperties();
            }
            else if ( m_Map != null )
            {
                if ( oldLocation.X != 0 )
                {
                    Packet removeThis = null;

                    foreach ( GameClient state in m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() ) )
                    {
                        Mobile m = state.Mobile;

                        if ( !m.InRange( location, GetUpdateRange( m ) ) )
                        {
                            if ( removeThis == null )
                                removeThis = this.RemovePacket;

                            state.Send( removeThis );
                        }
                    }
                }

                Point3D oldInternalLocation = m_Location;

                m_Location = location;
                this.OnLocationChange( oldRealLocation );

                ReleaseWorldPackets();

                foreach ( GameClient state in m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() ) )
                {
                    Mobile m = state.Mobile;

                    if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) )
                        SendInfoTo( state );
                }

                m_Map.OnMove( oldInternalLocation, this );

                RemDelta( ItemDelta.Update );
            }
            else
            {
                Map = map;
                Location = location;
            }
        }
Exemplo n.º 28
0
		static void HoverExploit(Map map, int x, int y)
		{
			try
			{
				Point3D location = new Point3D(x, y, 0);
				IPooledEnumerable eable = map.GetClientsInRange(location, 0);
				Tile[] tiles = map.Tiles.GetStaticTiles(x, y, true);
				foreach (NetState ns in eable)
				{
					if (ns == null || ns.Mobile == null) continue;
					Mobile m = ns.Mobile;
					if (map.CanSpawnMobile(m.Location, CanFitFlags.requireSurface) == false)
					{
						// Console.WriteLine("Bogus man!!");
						//int averageZ = map.GetAverageZ(m.Location.X, m.Location.Y);
						int averageZ = 0, topZ = 0, z = 0;
						map.GetAverageZ(m.Location.X, m.Location.Y, ref z, ref averageZ, ref topZ);
						while (m.Location.Z > averageZ && TileAtZ(tiles, m.Z) == false)
						{	// drop the player down a notch
							Point3D newLocation = new Point3D(m.Location);
							newLocation.Z--;
							m.MoveToWorld(newLocation, m.Map);
							if (map.CanSpawnMobile(m.Location, CanFitFlags.requireSurface) == true)
								break;
						}
					}
				}
				eable.Free();
			}
			catch (Exception ex) 
			{ 
				// adam: stop logging this to the exception file as it's polluting it.
				// we still need to fix it tho .. meh
				Console.WriteLine(ex.ToString());
				// EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); 
			}

			return;
		}
Exemplo n.º 29
0
		private static void Send(Map map, Point3D loc, int itemID, int hue, string name, string speech)
		{
			Packet p = null;

			var eable = map.GetClientsInRange(loc, Core.GlobalMaxUpdateRange);

			foreach (var state in eable)
			{
				if (p == null)
				{
					p = Packet.Acquire(new UnicodeMessage(Serial.MinusOne, itemID, MessageType.Regular, hue, 3, "ENU", name, speech));
				}

				state.Send(p);
			}

			Packet.Release(p);

			eable.Free();
		}