本文整理汇总了C#中Server.Map.GetSector方法的典型用法代码示例。如果您正苦于以下问题:C# Map.GetSector方法的具体用法?C# Map.GetSector怎么用?C# Map.GetSector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Map
的用法示例。
在下文中一共展示了Map.GetSector方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BoundingBox_Callback
private void BoundingBox_Callback( Mobile from, Map map, Point3D start, Point3D end, object state )
{
Utility.FixPoints( ref start, ref end );
Rectangle2D rect = new Rectangle2D(start, end);
#region MobileSaver
from.SendMessage( "Extracting Mobiles" );
foreach ( Mobile m in map.GetMobilesInBounds( rect ) )
{
if ( m != null && m is BaseCreature )
{
int saveflag = MobileSaver.GetSaveFlag( m );
if ( saveflag > 0 )
{
DesignItem designItem = new DesignItem();
designItem.ItemID = (short)0x1;
designItem.X = m.X;
designItem.Y = m.Y;
designItem.Z = m.Z + saveflag;
designItem.Hue = (short)m.Hue;
}
}
}
#endregion
for ( int x = 0; x <= rect.Width; ++x )
{
for ( int y = 0; y <= rect.Height; ++y )
{
int tileX = rect.Start.X + x;
int tileY = rect.Start.Y + y;
Sector sector = map.GetSector( tileX, tileY );
for ( int i = 0; i < sector.Items.Count; ++i )
{
Item item = (Item)sector.Items[i];
if(_args.UseMinZ && item.Z < _args.MinZ)
continue;
else if(_args.UseMaxZ && item.Z > _args.MaxZ)
continue;
if ( item.Visible && item.X == tileX && item.Y == tileY && !((item is BaseMulti) || (item is HouseSign)) )
{
_itemSerials.Add(item.Serial.Value);
}
}
}
}
if(_itemSerials.Count > 0)
SendResponse(new SelectItemsResponse((int[])_itemSerials.ToArray(typeof(int))));
else
SendResponse(null);
}
示例2: FindBoatAt
public static BaseBoat FindBoatAt( IPoint2D loc, Map map )
{
Sector sector = map.GetSector( loc );
for ( int i = 0; i < sector.Multis.Count; i++ )
{
BaseBoat boat = sector.Multis[i] as BaseBoat;
if ( boat != null && boat.Contains( loc.X, loc.Y ) )
return boat;
}
return null;
}
示例3: CheckMulti
public static bool CheckMulti( Point3D p, Map map, bool houses )
{
if( map == null || map == Map.Internal )
return false;
Sector sector = map.GetSector( p.X, p.Y );
for( int i = 0; i < sector.Multis.Count; ++i )
{
BaseMulti multi = sector.Multis[i];
if( multi is BaseHouse )
{
if( houses && ((BaseHouse)multi).IsInside( p, 16 ) )
return true;
}
else if( multi.Contains( p ) )
{
return true;
}
}
return false;
}
示例4: BoundingBox_Callback
private void BoundingBox_Callback( Mobile from, Map map, Point3D start, Point3D end, object state )
{
Utility.FixPoints( ref start, ref end );
Rectangle2D rect = new Rectangle2D(start, end);
for ( int x = 0; x <= rect.Width; ++x )
{
for ( int y = 0; y <= rect.Height; ++y )
{
int tileX = rect.Start.X + x;
int tileY = rect.Start.Y + y;
Sector sector = map.GetSector( tileX, tileY );
for ( int i = 0; i < sector.Items.Count; ++i )
{
Item item = (Item)sector.Items[i];
if(_args.UseMinZ && item.Z < _args.MinZ)
continue;
else if(_args.UseMaxZ && item.Z > _args.MaxZ)
continue;
if ( item.Visible && item.X == tileX && item.Y == tileY && !((item is BaseMulti) || (item is HouseSign)) )
{
_itemSerials.Add(item.Serial.Value);
}
}
}
}
if(_itemSerials.Count > 0)
SendResponse(new SelectItemsResponse((int[])_itemSerials.ToArray(typeof(int))));
else
SendResponse(null);
}
示例5: CheckMovement
public bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ )
{
if ( map == null || map == Map.Internal )
{
newZ = 0;
return false;
}
int xStart = loc.X;
int yStart = loc.Y;
int xForward = xStart, yForward = yStart;
int xRight = xStart, yRight = yStart;
int xLeft = xStart, yLeft = yStart;
bool checkDiagonals = ((int)d & 0x1) == 0x1;
Offset( d, ref xForward, ref yForward );
Offset( (Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft );
Offset( (Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight );
if ( xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height )
{
newZ = 0;
return false;
}
int startZ, startTop;
List<Item> itemsStart = m_Pools[0];
List<Item> itemsForward = m_Pools[1];
List<Item> itemsLeft = m_Pools[2];
List<Item> itemsRight = m_Pools[3];
bool ignoreMovableImpassables = m_IgnoreMovableImpassables;
TileFlag reqFlags = ImpassableSurface;
if ( m.CanSwim )
reqFlags |= TileFlag.Wet;
List<Mobile> mobsForward = m_MobPools[0];
List<Mobile> mobsLeft = m_MobPools[1];
List<Mobile> mobsRight = m_MobPools[2];
bool checkMobs = ( m is BaseCreature && !((BaseCreature)m).Controlled && ( xForward != m_Goal.X || yForward != m_Goal.Y ) );
if ( checkDiagonals )
{
Sector sectorStart = map.GetSector( xStart, yStart );
Sector sectorForward = map.GetSector( xForward, yForward );
Sector sectorLeft = map.GetSector( xLeft, yLeft );
Sector sectorRight = map.GetSector( xRight, yRight );
List<Sector> sectors = m_Sectors;
sectors.Add( sectorStart );
if ( !sectors.Contains( sectorForward ) )
sectors.Add( sectorForward );
if ( !sectors.Contains( sectorLeft ) )
sectors.Add( sectorLeft );
if ( !sectors.Contains( sectorRight ) )
sectors.Add( sectorRight );
for ( int i = 0; i < sectors.Count; ++i )
{
Sector sector = sectors[i];
for ( int j = 0; j < sector.Items.Count; ++j )
{
Item item = sector.Items[j];
if ( ignoreMovableImpassables && item.Movable && ( item.ItemData.Flags & ImpassableSurface ) != 0 )
continue;
if ( (item.ItemData.Flags & reqFlags) == 0 )
continue;
if ( sector == sectorStart && item.AtWorldPoint( xStart, yStart ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
itemsStart.Add( item );
else if ( sector == sectorForward && item.AtWorldPoint( xForward, yForward ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
itemsForward.Add( item );
else if ( sector == sectorLeft && item.AtWorldPoint( xLeft, yLeft ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
itemsLeft.Add( item );
else if ( sector == sectorRight && item.AtWorldPoint( xRight, yRight ) && !(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue )
itemsRight.Add( item );
}
if ( checkMobs )
{
for ( int j = 0; j < sector.Mobiles.Count; ++j )
{
Mobile mob = sector.Mobiles[j];
if ( sector == sectorForward && mob.X == xForward && mob.Y == yForward )
mobsForward.Add( mob );
else if ( sector == sectorLeft && mob.X == xLeft && mob.Y == yLeft )
mobsLeft.Add( mob );
else if ( sector == sectorRight && mob.X == xRight && mob.Y == yRight )
//.........这里部分代码省略.........
示例6: CheckTravel
//.........这里部分代码省略.........
return false;
if(regstone.NoGateInto && type == TravelCheckType.GateTo)
return false;
Spell spell = new GateTravelSpell(caster, null);
if(regstone.IsRestrictedSpell(spell, caster) && type == TravelCheckType.GateFrom)
return false;
if(regstone.CannotEnter && type == TravelCheckType.TeleportTo)
return false;
}
}
catch(NullReferenceException e)
{
LogHelper.LogException(e);
Console.WriteLine("{0} Caught exception.", e);
}
catch(Exception ex)
{
LogHelper.LogException(ex);
}
}
//Deal with house SecurePremises flag
if ((type == TravelCheckType.GateTo || type == TravelCheckType.RecallTo ||
type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
{
BaseHouse dst_house = null;
Sector sector = map.GetSector( loc );
foreach (BaseMulti mx in sector.Multis.Values)
{
BaseHouse _house = mx as BaseHouse;
if (_house == null)
continue;
if ( _house != null && _house.Region.Contains(loc) )
{
dst_house = _house;
}
}
if( dst_house != null )
{
if( dst_house.SecurePremises )
{
if( !dst_house.IsFriend( caster ) )
{
return false;
}
}
}
}
// Gate inside a PreviewHouse exploit. Go directally to jail, don't collect $200.0
if ((type == TravelCheckType.GateTo ||type == TravelCheckType.RecallTo ||
type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
{
if (PreviewHouseAt(caster.Map, loc))
{
LogHelper.Cheater(caster, "Travel inside a PreviewHouse exploit.", true);
示例7: FindDRDTRegion
public static CustomRegion FindDRDTRegion(Map map, Point3D loc)
{
Point3D p = loc;
if (p == Point3D.Zero)
return null;
if (map == Map.Internal || map == null)
return null;
Sector sector = map.GetSector(p);
if (sector == null || sector.Owner == null || sector == sector.Owner.InvalidSector)
return null;
if (sector.Regions == null) //new check 2/2/07
return null;
ArrayList list = sector.Regions;
if (list == null || list.Count == 0)
return null;
ArrayList list2 = new ArrayList();
for (int i = 0; i < list.Count; ++i)
{
if (list[i] is Region) //new check 2/2/07
{
Region region = (Region)list[i];
if (region == null)
continue;
if (region.Contains(p))
list2.Add(region);
}
}
foreach (Region reg in list2)
{
if (reg == null)
continue;
CustomRegion test = null;
if (reg is CustomRegion)
{
test = reg as CustomRegion;
if (test != null)
return test;
}
}
//no custom region found
return null;
}
示例8: CheckMovement
public bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ )
{
if ( map == null || map == Map.Internal )
{
newZ = 0;
return false;
}
int xStart = loc.X;
int yStart = loc.Y;
int xForward = xStart, yForward = yStart;
int xRight = xStart, yRight = yStart;
int xLeft = xStart, yLeft = yStart;
bool checkDiagonals = ((int)d & 0x1) == 0x1;
Offset( d, ref xForward, ref yForward );
Offset( (Direction)(((int)d - 1) & 0x7), ref xLeft, ref yLeft );
Offset( (Direction)(((int)d + 1) & 0x7), ref xRight, ref yRight );
if ( xForward < 0 || yForward < 0 || xForward >= map.Width || yForward >= map.Height )
{
newZ = 0;
return false;
}
int startZ, startTop;
ArrayList itemsStart = m_Pools[0];
ArrayList itemsForward = m_Pools[1];
ArrayList itemsLeft = m_Pools[2];
ArrayList itemsRight = m_Pools[3];
ArrayList items;
bool ignoreMovableImpassables = m_IgnoreMovableImpassables;
TileFlag reqFlags = ImpassableSurface;
if ( m.CanSwim )
reqFlags |= TileFlag.Wet;
if ( checkDiagonals )
{
Sector sectorStart = map.GetSector( xStart, yStart );
Sector sectorForward = map.GetSector( xForward, yForward );
Sector sectorLeft = map.GetSector( xLeft, yLeft );
Sector sectorRight = map.GetSector( xRight, yRight );
ArrayList sectors = m_Pools[4];
sectors.Add( sectorStart );
if ( !sectors.Contains( sectorForward ) )
sectors.Add( sectorForward );
if ( !sectors.Contains( sectorLeft ) )
sectors.Add( sectorLeft );
if ( !sectors.Contains( sectorRight ) )
sectors.Add( sectorRight );
for ( int i = 0; i < sectors.Count; ++i )
{
Sector sector = (Sector)sectors[i];
items = sector.Items;
for ( int j = 0; j < items.Count; ++j )
{
Item item = (Item)items[j];
if ( ignoreMovableImpassables && item.Movable && item.ItemData.Impassable )
continue;
if ( (item.ItemData.Flags & reqFlags) == 0 )
continue;
if ( sector == sectorStart && item.AtWorldPoint( xStart, yStart ) && item.ItemID < 0x4000 )
itemsStart.Add( item );
else if ( sector == sectorForward && item.AtWorldPoint( xForward, yForward ) && item.ItemID < 0x4000 )
itemsForward.Add( item );
else if ( sector == sectorLeft && item.AtWorldPoint( xLeft, yLeft ) && item.ItemID < 0x4000 )
itemsLeft.Add( item );
else if ( sector == sectorRight && item.AtWorldPoint( xRight, yRight ) && item.ItemID < 0x4000 )
itemsRight.Add( item );
}
}
if ( m_Pools[4].Count > 0 )
m_Pools[4].Clear();
}
else
{
Sector sectorStart = map.GetSector( xStart, yStart );
Sector sectorForward = map.GetSector( xForward, yForward );
if ( sectorStart == sectorForward )
{
items = sectorStart.Items;
for ( int i = 0; i < items.Count; ++i )
//.........这里部分代码省略.........
示例9: GetTilesAt
public static List<StaticTile> GetTilesAt(Map map, Point2D p, bool items, bool land, bool statics)
{
List<StaticTile> list = new List<StaticTile>();
if (map == Map.Internal)
return list;
if (statics)
list.AddRange(map.Tiles.GetStaticTiles(p.X, p.Y, true));
if (items)
{
Sector sector = map.GetSector(p);
foreach (Item item in sector.Items)
if (item.AtWorldPoint(p.X, p.Y))
list.Add(new StaticTile((ushort)item.ItemID, (sbyte)item.Z));
}
return list;
}
示例10: Find
public static Region Find( Point3D p, Map map )
{
if ( map == null )
return Map.Internal.DefaultRegion;
Sector sector = map.GetSector( p );
ArrayList list = sector.Regions;
for ( int i = 0; i < list.Count; ++i )
{
Region region = (Region)list[i];
if ( region.Contains( p ) )
return region;
}
return map.DefaultRegion;
}
示例11: HousePlacementRegionCheck
private static HousePlacementResult HousePlacementRegionCheck(Mobile from, Map map, Point3D testPoint)
{
Sector sector = map.GetSector(testPoint);
ArrayList list = sector.Regions;
for (int i = 0; i < list.Count; ++i)
{
Region region = (Region)list[i];
if (region.Contains(testPoint))
{
if (region is HouseRegion)
return HousePlacementResult.BadRegion;
if (!region.AllowHousing(from, testPoint)) // Cannot place houses in dungeons, towns, treasure map areas etc
{
if (region is TreasureRegion)
return HousePlacementResult.BadRegionHidden;
return HousePlacementResult.BadRegion;
}
if (region is TownshipRegion)
{
if (((TownshipRegion)region).CanBuildHouseInTownship(from) == false)
{
return HousePlacementResult.BadRegionTownship;
}
}
if (region is NoHousingRegion)
return HousePlacementResult.BadRegion;
}
}
return HousePlacementResult.Valid;
}
示例12: FindAll
public static ArrayList FindAll(Point3D p, Map map)
{
ArrayList all = new ArrayList();
if (map == null)
{
all.Add(Map.Internal.DefaultRegion);
return all;
}
Sector sector = map.GetSector(p);
ArrayList list = sector.Regions;
for (int i = 0; i < list.Count; ++i)
{
if (list[i] is Region)
{
Region region = list[i] as Region;
if (region.Contains(p))
all.Add(region);
}
}
all.Add(map.DefaultRegion);
return all;
}
示例13: IsPointInNoMurderZone
private static bool IsPointInNoMurderZone(Point3D p, Map map)
{
if (map == null)
return false;
Sector sector = map.GetSector(p);
ArrayList list = sector.Regions;
bool bReturn = false;
for (int i = 0; i < list.Count; ++i)
{
Region region = (Region)list[i];
if (region.Contains(p))
{
if (region.IsNoMurderZone)
{
bReturn = true;
}
}
}
return bReturn;
}
示例14: IsMobileCountableAtPoint
private static bool IsMobileCountableAtPoint(Mobile m, Point3D p, Map map)
{
if (map == null)
return true;
Sector sector = map.GetSector(p);
ArrayList list = sector.Regions;
bool bReturn = true;
for (int i = 0; i < list.Count; ++i)
{
Region region = (Region)list[i];
if (region.Contains(p))
{
if (region.IsMobileCountable(m) == false)
{
bReturn = false;
}
}
}
return bReturn;
}
示例15: FindHouseAt
public static BaseHouse FindHouseAt(Point3D loc, Map map, int height)
{
if (map == null || map == Map.Internal)
return null;
Sector sector = map.GetSector(loc);
foreach (BaseMulti mult in sector.Multis.Values)
{
BaseHouse house = mult as BaseHouse;
if (house != null && house.IsInside(loc, height))
return house;
}
return null;
}