本文整理匯總了C#中Server.Map.GetItemsInRange方法的典型用法代碼示例。如果您正苦於以下問題:C# Map.GetItemsInRange方法的具體用法?C# Map.GetItemsInRange怎麽用?C# Map.GetItemsInRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Map
的用法示例。
在下文中一共展示了Map.GetItemsInRange方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DeleteMoonGate
private static int DeleteMoonGate(Map map, Point3D p)
{
Queue<Item> m_Queue = new Queue<Item>();
IPooledEnumerable eable = map.GetItemsInRange(p, 0);
foreach (Item item in eable)
{
if (item is PublicMoongate)
{
int delta = item.Z - p.Z;
if (delta >= -12 && delta <= 12)
m_Queue.Enqueue(item);
}
}
eable.Free();
int m_Count = m_Queue.Count;
while (m_Queue.Count > 0)
(m_Queue.Dequeue()).Delete();
return m_Count;
}
示例2: Add_Static
public static void Add_Static( int itemID, Point3D location, Map map, string name )
{
var eable = map.GetItemsInRange( location, 0 );
foreach ( Item item in eable )
{
if ( item is Sign && item.Z == location.Z && item.ItemID == itemID )
m_ToDelete.Enqueue( item );
}
while ( m_ToDelete.Count > 0 )
( (Item) m_ToDelete.Dequeue() ).Delete();
Item sign;
if ( name.StartsWith( "#" ) )
{
sign = new LocalizedSign( itemID, Utility.ToInt32( name.Substring( 1 ) ) );
}
else
{
sign = new Sign( itemID );
sign.Name = name;
}
if ( map == Map.Malas )
{
if ( location.X >= 965 && location.Y >= 502 && location.X <= 1012 && location.Y <= 537 )
sign.Hue = 0x47E;
else if ( location.X >= 1960 && location.Y >= 1278 && location.X < 2106 && location.Y < 1413 )
sign.Hue = 0x44E;
}
sign.MoveToWorld( location, map );
}
示例3: CheckItems
private static bool CheckItems( Point3D loc, Map map, int range, int maxAmount, bool checkTraps )
{
var eable = map.GetItemsInRange( loc, range );
int amount = 0;
foreach ( Item item in eable )
{
if ( !checkTraps || item is FloorTrap )
amount++;
}
return amount < maxAmount;
}
示例4: CheckPlantSeed
public virtual bool CheckPlantSeed( Point3D location, Map map, int range )
{
IPooledEnumerable eable = map.GetItemsInRange( location, range );
int cropCount = 0;
foreach( Item i in eable )
{
if( i is BaseCrop )
cropCount++;
}
eable.Free();
return (cropCount == 0);
}
示例5: ClearSpawners
public static void ClearSpawners( int x, int y, int z, Map map )
{
IPooledEnumerable eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );
foreach ( Item item in eable )
{
if ( item is Spawner && item.Z == z )
m_ToDelete.Enqueue( item );
}
eable.Free();
while ( m_ToDelete.Count > 0 )
((Item)m_ToDelete.Dequeue()).Delete();
}
示例6: FindMarkContainer
private static bool FindMarkContainer( Point3D p, Map map )
{
IPooledEnumerable eable = map.GetItemsInRange( p, 0 );
foreach ( Item item in eable )
{
if ( item.Z == p.Z && item is MarkContainer )
{
eable.Free();
return true;
}
}
eable.Free();
return false;
}
示例7: FindSHTeleporter
public static SHTeleporter FindSHTeleporter(Map map, Point3D p)
{
IPooledEnumerable eable = map.GetItemsInRange(p, 0);
foreach (Item item in eable)
{
if (item is SHTeleporter && item.Z == p.Z)
{
eable.Free();
return (SHTeleporter)item;
}
}
eable.Free();
return null;
}
示例8: FindTeleporter
public static bool FindTeleporter( Map map, Point3D p )
{
IPooledEnumerable eable = map.GetItemsInRange( p, 0 );
foreach ( Item item in eable )
{
if ( item is Teleporter && !(item is KeywordTeleporter) && !(item is SkillTeleporter) )
{
int delta = item.Z - p.Z;
if ( delta >= -12 && delta <= 12 )
m_Queue.Enqueue( item );
}
}
eable.Free();
while ( m_Queue.Count > 0 )
((Item)m_Queue.Dequeue()).Delete();
return false;
}
示例9: FindItem
public static bool FindItem(Point3D p, Map map, Item test)
{
bool result = false;
IPooledEnumerable eable = map.GetItemsInRange(p);
foreach (Item item in eable)
{
if (item.Z == p.Z && item.ItemID == test.ItemID)
{
m_DeleteQueue.Enqueue(item);
result = true;
}
}
eable.Free();
while (m_DeleteQueue.Count > 0)
m_DeleteQueue.Dequeue().Delete();
return result;
}
示例10: MakeUniqueSpawner
//looks at the location provided for a spawner, and returns it if it exists, otherwise makes a new one
public static Spawner MakeUniqueSpawner( Point3D location, Map map )
{
IPooledEnumerable ie = map.GetItemsInRange( location, 0 );
Spawner spawner = null;
foreach( Item item in ie )
{
if( item is Spawner )
{
spawner = (Spawner)item;
break;
}
}
if( spawner == null )
{
spawner = new Spawner();
spawner.MoveToWorld( location, map );
}
return spawner;
}
示例11: CheckForAltar
public static bool CheckForAltar(Point3D p, Map map)
{
IPooledEnumerable eable = map.GetItemsInRange(p, 0);
foreach (Item i in eable)
{
if (i is ShameAltar || i is ShameWall)
{
eable.Free();
return true;
}
}
eable.Free();
return false;
}
示例12: Del_Static
public static void Del_Static( int itemID, Point3D location, Map map )
{
IPooledEnumerable eable = map.GetItemsInRange( location, 0 );
foreach ( Item item in eable )
{
if ( item is Sign && item.Z == location.Z && item.ItemID == itemID )
{
m_ToDelete.Enqueue( item );
m_DelCount++;
}
}
eable.Free();
while ( m_ToDelete.Count > 0 )
m_ToDelete.Dequeue().Delete();
}
示例13: IsValidLocation
public virtual int IsValidLocation( Point3D p, Map m )
{
if( m == null )
return 502956; // You cannot place a trap on that.
if( Core.AOS )
{
foreach( Item item in m.GetItemsInRange( p, 5 ) )
{
if( item is BaseFactionTrap && ((BaseFactionTrap)item).Faction == this.Faction )
return 1075263; // There is already a trap belonging to your faction at this location.;
}
}
switch( AllowedPlacing )
{
case AllowedPlacing.FactionStronghold:
{
StrongholdRegion region = (StrongholdRegion) Region.Find( p, m ).GetRegion( typeof( StrongholdRegion ) );
if ( region != null && region.Faction == m_Faction )
return 0;
return 1010355; // This trap can only be placed in your stronghold
}
case AllowedPlacing.AnyFactionTown:
{
Town town = Town.FromRegion( Region.Find( p, m ) );
if ( town != null )
return 0;
return 1010356; // This trap can only be placed in a faction town
}
case AllowedPlacing.ControlledFactionTown:
{
Town town = Town.FromRegion( Region.Find( p, m ) );
if ( town != null && town.Owner == m_Faction )
return 0;
return 1010357; // This trap can only be placed in a town your faction controls
}
}
return 0;
}
示例14: RemoveItem
public static bool RemoveItem(Point3D p, Map map, Type t)
{
IPooledEnumerable eable = map.GetItemsInRange(p, 0);
foreach (Item i in eable)
{
if (i.GetType() == t)
{
i.Delete();
eable.Free();
return true;
}
}
eable.Free();
return false;
}
示例15: FindItem
public static bool FindItem(Point3D p, Map map, Item test)
{
IPooledEnumerable eable = map.GetItemsInRange(p);
foreach (Item item in eable)
{
if (item.Z == p.Z && item.ItemID == test.ItemID)
{
eable.Free();
return true;
}
}
eable.Free();
return false;
}