当前位置: 首页>>代码示例>>C#>>正文


C# Map.GetClientsInRange方法代码示例

本文整理汇总了C#中Server.Map.GetClientsInRange方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetClientsInRange方法的具体用法?C# Map.GetClientsInRange怎么用?C# Map.GetClientsInRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Map的用法示例。


在下文中一共展示了Map.GetClientsInRange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlaySound

        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();
            }
        }
开发者ID:greeduomacro,项目名称:liberdade-uo-server,代码行数:26,代码来源:Effects.cs

示例2: PlaySound

        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 );
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:22,代码来源:Effects.cs

示例3: MoveToWorld

        /// <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;

//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:101,代码来源:Item.cs

示例4: SendPacket

        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();
            }
        }
开发者ID:greeduomacro,项目名称:liberdade-uo-server,代码行数:20,代码来源:Effects.cs

示例5: SendPacket

        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();
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:16,代码来源:Effects.cs

示例6: MoveToWorld

        /// <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 );
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:101,代码来源:Item.cs

示例7: HoverExploit

		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;
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:39,代码来源:ExploitTracking.cs

示例8: Send

		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();
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:20,代码来源:Say.cs


注:本文中的Server.Map.GetClientsInRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。