本文整理汇总了C#中Server.Map.CanSpawnMobile方法的典型用法代码示例。如果您正苦于以下问题:C# Map.CanSpawnMobile方法的具体用法?C# Map.CanSpawnMobile怎么用?C# Map.CanSpawnMobile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Map
的用法示例。
在下文中一共展示了Map.CanSpawnMobile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanTravel
public static bool CanTravel(Mobile from, Map map, Point3D p)
{
bool NonGM = from.AccessLevel < AccessLevel.GameMaster;
if (NonGM && Factions.Sigil.ExistsOn(from))
{
from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
return false;
}
if (NonGM && from.Criminal)
{
from.SendLocalizedMessage(1005561, "", 0x22);
// Thou'rt a criminal and cannot escape so easily.
return false;
}
if (NonGM && SpellHelper.CheckCombat(from))
{
from.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
return false;
}
if (NonGM && Misc.WeightOverloading.IsOverloaded(from))
{
from.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
return false;
}
if (!map.CanSpawnMobile(p.X, p.Y, p.Z))
{
from.SendLocalizedMessage(501942); // That location is blocked.
return false;
}
if (from.Holding != null)
{
from.SendLocalizedMessage(1071955); // You cannot teleport while dragging an object.
return false;
}
return true;
}
示例2: Spawn
public static BaseCreature Spawn( int level, Point3D p, Map map, Mobile target, bool guardian )
{
if ( map == null )
return null;
BaseCreature c = Spawn( level, p, guardian );
if ( c != null )
{
bool spawned = false;
for ( int i = 0; !spawned && i < 10; ++i )
{
int x = p.X - 3 + Utility.Random( 7 );
int y = p.Y - 3 + Utility.Random( 7 );
if ( map.CanSpawnMobile( x, y, p.Z ) )
{
c.MoveToWorld( new Point3D( x, y, p.Z ), map );
spawned = true;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
c.MoveToWorld( new Point3D( x, y, z ), map );
spawned = true;
}
}
}
if ( !spawned )
{
c.Delete();
return null;
}
if ( target != null )
c.Combatant = target;
return c;
}
return null;
}
示例3: Spawn
//25JUL2008 Lord_Greywolf fix for bad X *** START ***
// protected void Spawn( Point2D p, Map map, BaseCreature spawn )
// {
// if ( map == null )
// {
// spawn.Delete();
// return;
// }
// int x = p.X, y = p.Y;
//// for ( int j = 0; j < 5; ++j )
//// {
//// int tx = p.X - 2 + Utility.Random( 5 );
//// int ty = p.Y - 2 + Utility.Random( 5 );
//// }
// spawn.MoveToWorld( new Point3D( x, y, 0 ), map );
// spawn.PackItem( new TreasureMessageChest() );
//}
protected void Spawn(Point2D p, Map map, BaseCreature spawn)
{
if (map == null) { spawn.Delete(); return; }
int x = p.X, y = p.Y;
if (map.CanSpawnMobile(x, y, 0))
{
spawn.MoveToWorld(new Point3D(x, y, 0), map);
}
else
{
int z = map.GetAverageZ(x, y);
if (map.CanSpawnMobile(x, y, z))
{
spawn.MoveToWorld(new Point3D(x, y, z), map);
}
else if (map.CanSpawnMobile(x, y, z + 10))
{
spawn.MoveToWorld(new Point3D(x, y, z + 10), map);
}
else if (map.CanSpawnMobile(x + 1, y + 1, z))
{
spawn.MoveToWorld(new Point3D(x + 1, y + 1, z), map);
}
else if (map.CanSpawnMobile(x + 1, y + 1, z + 10))
{
spawn.MoveToWorld(new Point3D(x + 1, y + 1, z + 10), map);
}
else
{
spawn.MoveToWorld(new Point3D(x - 1, y - 1, 100), map);
}
}
spawn.PackItem(new TreasureMessageChest(Utility.RandomMinMax((((m_Level - 1) * 400) + 100), (((m_Level - 1) * 400) + 500))));
}
示例4: FindValidSpawnLocation
public static bool FindValidSpawnLocation( Map map, ref Point3D p, bool surroundingsOnly )
{
if( map == null ) //sanity
return false;
if( !surroundingsOnly )
{
if( map.CanSpawnMobile( p ) ) //p's fine.
{
p = new Point3D( p );
return true;
}
int z = map.GetAverageZ( p.X, p.Y );
if( map.CanSpawnMobile( p.X, p.Y, z ) )
{
p = new Point3D( p.X, p.Y, z );
return true;
}
}
int offset = Utility.Random( 8 ) * 2;
for( int i = 0; i < m_Offsets.Length; i += 2 )
{
int x = p.X + m_Offsets[(offset + i) % m_Offsets.Length];
int y = p.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
if( map.CanSpawnMobile( x, y, p.Z ) )
{
p = new Point3D( x, y, p.Z );
return true;
}
else
{
int z = map.GetAverageZ( x, y );
if( map.CanSpawnMobile( x, y, z ) )
{
p = new Point3D( x, y, z );
return true;
}
}
}
return false;
}
示例5: Effect
public void Effect( Point3D loc, Map map, bool checkMulti )
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
Caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
}
else if ( map == null || (!Core.AOS && Caster.Map != map) )
{
Caster.SendLocalizedMessage( 1005569 ); // You can not recall to another facet.
}
else if ( !SpellHelper.CheckTravel( Caster, TravelCheckType.RecallFrom ) )
{
}
else if ( !SpellHelper.CheckTravel( Caster, map, loc, TravelCheckType.RecallTo ) )
{
}
else if ( map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young )
{
Caster.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
}
else if ( Caster.Kills >= 5 && map != Map.Felucca )
{
Caster.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
}
else if ( Caster.Criminal )
{
Caster.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
}
else if ( SpellHelper.CheckCombat( Caster ) )
{
Caster.SendLocalizedMessage( 1061282 ); // You cannot use the Sacred Journey ability to flee from combat.
}
else if ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) )
{
Caster.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move.
}
else if ( !map.CanSpawnMobile( loc.X, loc.Y, loc.Z ) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if ( m_Book != null && m_Book.CurCharges <= 0 )
{
Caster.SendLocalizedMessage( 502412 ); // There are no charges left on that item.
}
else if ( CheckSequence() )
{
BaseCreature.TeleportPets( Caster, loc, map, true );
if ( m_Book != null )
--m_Book.CurCharges;
Effects.SendLocationParticles( EffectItem.Create( Caster.Location, Caster.Map, EffectItem.DefaultDuration ), 0, 0, 0, 5033 );
Caster.PlaySound( 0x1FC );
Caster.MoveToWorld( loc, map );
Caster.PlaySound( 0x1FC );
}
FinishSequence();
}
示例6: 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;
}
示例7: Spawn
public static BaseCreature Spawn( int level, Point3D p, Map map, Mobile target, bool guardian )
{
if ( map == null )
return null;
BaseCreature c = Spawn( level, p, guardian );
if ( c != null )
{
bool spawned = false;
for ( int i = 0; !spawned && i < 10; ++i )
{
int x = p.X - 3 + Utility.Random( 7 );
int y = p.Y - 3 + Utility.Random( 7 );
if ( map.CanSpawnMobile( x, y, p.Z ) )
{
c.MoveToWorld( new Point3D( x, y, p.Z ), map );
if (HalloweenEventController.Instance != null && HalloweenEventController.Halloween && HalloweenCorruption.CheckCorrupt(c, new Point3D(x, y, p.Z), map))
c.IsCorrupt = true;
if (!c.IsCorrupt && Paragon.CheckConvert(c, new Point3D(x, y, p.Z), map))
c.IsParagon = true;
spawned = true;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
c.MoveToWorld( new Point3D( x, y, z ), map );
spawned = true;
if (HalloweenEventController.Instance != null && HalloweenEventController.Halloween && HalloweenCorruption.CheckCorrupt(c, new Point3D(x, y, z), map))
c.IsCorrupt = true;
if (!c.IsCorrupt && Paragon.CheckConvert(c, new Point3D(x, y, z), map))
c.IsParagon = true;
}
}
}
if ( !spawned )
{
c.Delete();
return null;
}
c.HomeMap = c.Map;
if ( target != null )
c.Combatant = target;
return c;
}
return null;
}
示例8: GetSpawnPosition
public static Point3D GetSpawnPosition(Point3D from, Map map, int range)
{
if (map == null)
return from;
for (int i = 0; i < 10; i++)
{
int x = from.X + Utility.Random(range);
int y = from.Y + Utility.Random(range);
int z = map.GetAverageZ(x, y);
if (Utility.RandomBool())
x *= -1;
if (Utility.RandomBool())
y *= -1;
Point3D p = new Point3D(x, y, from.Z);
if (map.CanSpawnMobile(p) && map.LineOfSight(from, p))
return p;
p = new Point3D(x, y, z);
if (map.CanSpawnMobile(p) && map.LineOfSight(from, p))
return p;
}
return from;
}
示例9: Spawn
//Main spawn generation function called from any item that needs to generate treasure type spawn.
public static void Spawn( int level, Point3D p, Map map, Mobile target, bool IsThemed, ChestThemeType theme, bool guardian, bool guardian2)
{
//bool guardian is designator for if theme type has special spawn mechanics and thus does not spawn its highest mobs at random
//guardian2 is second flag indicateing to spawn highest mob.
if ( map == null )
return;
BaseCreature c = null;
if(guardian == false) c = Spawn( level, IsThemed, theme, guardian );
if(guardian == true && guardian2 == false) c = Spawn( level, IsThemed, theme, true );
if(guardian == true && guardian2 == true) c = SpawnHighestMob(theme);
if ( c != null )
{
c.Home = p;
c.RangeHome = 8;
bool spawned = false;
for ( int i = 0; !spawned && i < 10; ++i )
{
int x = p.X - 3 + Utility.Random( 7 );
int y = p.Y - 3 + Utility.Random( 7 );
if ( map.CanSpawnMobile( x, y, p.Z ) )
{
c.MoveToWorld( new Point3D( x, y, p.Z ), map );
spawned = true;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
c.MoveToWorld( new Point3D( x, y, z ), map );
spawned = true;
}
}
}
if ( !spawned )
c.Delete();
else if ( target != null )
c.Combatant = target;
}
}
示例10: GetSpawnPosition
public virtual Point3D GetSpawnPosition( ISpawnable spawned, Map map )
{
if ( map == null || map == Map.Internal )
return Location;
bool waterMob, waterOnlyMob;
if ( spawned is Mobile )
{
Mobile mob = (Mobile)spawned;
waterMob = mob.CanSwim;
waterOnlyMob = ( mob.CanSwim && mob.CantWalk );
}
else
{
waterMob = false;
waterOnlyMob = false;
}
// Try 10 times to find a Spawnable location.
for ( int i = 0; i < 10; i++ )
{
int x = Location.X + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
int y = Location.Y + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
int z = Map.GetAverageZ( x, y );
int mapZ = map.GetAverageZ( x, y );
if ( waterMob )
{
if ( IsValidWater( map, x, y, this.Z ) )
return new Point3D( x, y, this.Z );
else if ( IsValidWater( map, x, y, mapZ ) )
return new Point3D( x, y, mapZ );
}
if ( !waterOnlyMob )
{
if ( map.CanSpawnMobile( x, y, this.Z ) )
return new Point3D( x, y, this.Z );
else if ( map.CanSpawnMobile( x, y, mapZ ) )
return new Point3D( x, y, mapZ );
}
}
return this.Location;
}
示例11: Effect
public void Effect( Point3D loc, Map map, bool checkMulti )
{
if ( Factions.Sigil.ExistsOn( Caster ) )
{
}
else if ( map == null || (!Core.AOS && Caster.Map != map) )
{
}
else if ( !SpellHelper.CheckTravel( Caster, TravelCheckType.RecallFrom ) )
{
}
else if ( !SpellHelper.CheckTravel( Caster, map, loc, TravelCheckType.RecallTo ) )
{
}
else if ( map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young )
{
}
else if ( Caster.Kills >= 5 && map != Map.Felucca )
{
}
else if ( Caster.Criminal )
{
}
else if ( SpellHelper.CheckCombat( Caster ) )
{
}
else if ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) )
{
}
else if ( !map.CanSpawnMobile( loc.X, loc.Y, loc.Z ) )
{
}
else if ( (checkMulti && SpellHelper.CheckMulti( loc, map )) )
{
}
else if ( m_Book != null && m_Book.CurCharges <= 0 )
{
}
else if ( CheckSequence() )
{
BaseCreature.TeleportPets( Caster, loc, map, true );
if ( m_Book != null )
--m_Book.CurCharges;
Effects.SendLocationParticles( EffectItem.Create( Caster.Location, Caster.Map, EffectItem.DefaultDuration ), 0, 0, 0, 5033 );
Caster.MoveToWorld( loc, map );
}
FinishSequence();
}
示例12: GetRandomSpawnLocation
public static Point3D GetRandomSpawnLocation( Point3D p, Map map )
{
for ( int i = 0; i < 10; ++i )
{
int x = p.X - 3 + Utility.Random( 7 );
int y = p.Y - 3 + Utility.Random( 7 );
if ( map.CanSpawnMobile( x, y, p.Z ) )
{
return new Point3D( x, y, p.Z );
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
return new Point3D( x, y, z );
}
}
return Point3D.Zero;
}
示例13: GetRandomLocation
public static Point2D GetRandomLocation( Map map )
{
for ( int i = 0; i < 30; ++i )
{
int tx = 0, ty = 0;
if ( map == Map.Trammel || map == Map.Felucca )
{
tx = Utility.RandomMinMax( 0, 4080 );
ty = Utility.RandomMinMax( 0, 5100 );
}
else if ( map == Map.Ilshenar )
{
tx = Utility.RandomMinMax( 220, 1770 );
ty = Utility.RandomMinMax( 200, 1415 );
}
else if ( map == Map.Malas )
{
tx = Utility.RandomMinMax( 600, 2150 );
ty = Utility.RandomMinMax( 70, 1910 );
}
else if ( map == Map.Tokuno )
{
tx = Utility.RandomMinMax( 90, 1410 );
ty = Utility.RandomMinMax( 20, 1400 );
}
else if ( map == Map.TerMur )
{
tx = Utility.RandomMinMax( 300, 1220 );
ty = Utility.RandomMinMax( 2800, 4050 );
}
// First, check for land tile to be valid, for most efficiency
if ( !IsValidLandTile( map, tx, ty ) )
continue;
var loc = new Point3D( tx, ty, map.GetAverageZ( tx, ty ) );
var region = Region.Find( loc, map );
if ( region.IsPartOf<GuardedRegion>() || region.IsPartOf<DungeonRegion>() || region.IsPartOf<HouseRegion>() )
continue;
if ( map.CanSpawnMobile( loc ) )
return new Point2D( tx, ty );
}
return Point2D.Zero;
}
示例14: Effect
public void Effect( Point3D loc, Map map, bool checkMulti )
{
if( map == null || (!Core.AOS && Caster.Map != map) )
{
Caster.SendLocalizedMessage( 1005570 ); // You can not gate to another facet.
}
else if( !SpellHelper.CheckTravel( Caster, TravelCheckType.GateFrom ) )
{
}
else if( !SpellHelper.CheckTravel( Caster, map, loc, TravelCheckType.GateTo ) )
{
}
else if( Caster.Kills >= 5 && map != Map.Felucca )
{
Caster.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
}
else if( SpellHelper.CheckCombat( Caster ) )
{
Caster.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
}
else if( !map.CanSpawnMobile( loc.X, loc.Y, loc.Z ) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if( (checkMulti && SpellHelper.CheckMulti( loc, map )) )
{
Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
}
else if( CheckSequence() )
{
Caster.PublicOverheadMessage( Server.Network.MessageType.Regular, Caster.EmoteHue, true, "*slashes through the air, cutting through the fabric of space and time itself*" );
Effects.PlaySound( Caster.Location, Caster.Map, 476 );
InternalItem firstGate = new InternalItem( loc, map );
firstGate.Hue = 1;
firstGate.MoveToWorld( Caster.Location, Caster.Map );
Effects.PlaySound( loc, map, 476 );
InternalItem secondGate = new InternalItem( Caster.Location, Caster.Map );
secondGate.Hue = 1;
secondGate.MoveToWorld( loc, map );
}
FinishSequence();
}
示例15: GetSpawnPosition
public static Point3D GetSpawnPosition(Map map, Point3D location, int homeRange, bool forceZ, object o)
{
CanFitFlags flags = CanFitFlags.requireSurface;
if (o is Mobile)
{
Mobile m = o as Mobile;
if (m != null && m.CanSwim == true) flags |= CanFitFlags.canSwim;
if (m != null && m.CantWalk == true) flags |= CanFitFlags.cantWalk;
}
if (map == null)
return location;
// Try 10 times to find a Spawnable location.
for (int i = 0; i < 10; i++)
{
int x = location.X + (Utility.Random((homeRange * 2) + 1) - homeRange);
int y = location.Y + (Utility.Random((homeRange * 2) + 1) - homeRange);
int z = map.GetAverageZ(x, y);
if (map.CanSpawnMobile(new Point2D(x, y), location.Z, flags))
return new Point3D(x, y, location.Z);
if (forceZ == false)
if (map.CanSpawnMobile(new Point2D(x, y), z, flags))
return new Point3D(x, y, z);
}
return location;
}