本文整理汇总了C#中Server.Mobiles.Spawner类的典型用法代码示例。如果您正苦于以下问题:C# Spawner类的具体用法?C# Spawner怎么用?C# Spawner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Spawner类属于Server.Mobiles命名空间,在下文中一共展示了Spawner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpawnAt
public Mobile SpawnAt( Spawner spawner, Mobile mob )
{
Map map = spawner.Map;
if ( map == null || map == Map.Internal )
return null;
if ((mob is BaseCreature) == false)
return null;
try
{
BaseOverland bo = null;
BaseCreature bc = mob as BaseCreature;
// we will make it so this is passed in
if (mob is BaseOverland)
bo = mob as BaseOverland;
// use the spawners homerange except when it is a special 'guard post'
// spawner (HomeRange == 0)
bc.RangeHome = spawner.HomeRange == 0? 10 : spawner.HomeRange;
// could be useful ... but not today
// c.CurrentWayPoint = spawner.WayPoint;
// c.NavDestination = spawner.NavPoint;
bc.Home = spawner.Location;
bc.Spawner = spawner;
//if we have a navdestination as soon as we spawn start on it
if(bc.NavDestination != NavDestinations.None)
bc.AIObject.Think();
/////////////////////////////
// move it to the world
Point3D loc = spawner.GetSpawnPosition(bc);
bc.MoveToWorld( loc, map );
// Okay, indicate that this overland mob should be announced on the Town Crier
// This must be after we are moved off the internal map because the accounce code
// supplies 'world location' information which would be wrong if we were still on the internal map
if (bo != null)
bo.Announce = true;
return bc;
}
catch (Exception e)
{
LogHelper.LogException(e);
Console.WriteLine("Server.Engines.OverlandSpawner : Exception {0}", e);
}
return null;
}
示例2: SpawnerGump
public SpawnerGump( Spawner spawner ) : base( 50, 50 )
{
m_Spawner = spawner;
AddPage( 0 );
AddBackground( 0, 0, 305, 371, 5054 );
AddLabel( 95, 1, 0, "Creatures List" );
AddButton( 5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0 );
AddLabel( 38, 347, 0x384, "Cancel" );
AddButton( 5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0 );
AddLabel( 38, 325, 0x384, "Okay" );
AddButton( 110, 325, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0 );
AddLabel( 143, 325, 0x384, "Bring to Home" );
AddButton( 110, 347, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0 );
AddLabel( 143, 347, 0x384, "Total Respawn" );
for ( int i = 0; i < 13; i++ )
{
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0 );
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0 );
AddImageTiled( 71, ( 22 * i ) + 20, 159, 23, 0xA40 ); //creature text box
AddImageTiled( 72, ( 22 * i ) + 21, 157, 21, 0xBBC ); //creature text box
AddImageTiled(235, (22 * i) + 20, 35, 23, 0xA40); //probability text box
AddImageTiled(236, (22 * i) + 21, 33, 21, 0xBBC); //probability text box
string name = "";
string probability = "";
if ( i < spawner.CreaturesName.Count )
{
name = (string)spawner.CreaturesName[i];
probability = spawner.CreaturesProbability[i].ToString();
int count = m_Spawner.CountCreatures( name );
AddLabel( 277, ( 22 * i ) + 20, 0, count.ToString() );
}
AddTextEntry( 75, ( 22 * i ) + 21, 154, 21, 0, i, name ); //creature
AddTextEntry(239, (22 * i) + 21, 30, 21, 0, i + 20, probability); //probability
}
}
示例3: SpawnerGump
public SpawnerGump( Spawner spawner ) : base( 50, 50 )
{
m_Spawner = spawner;
m_SpawnBefore = new SpawnerMemory();
m_SpawnAfter = new SpawnerMemory();
AddPage( 0 );
AddBackground( 0, 0, 260, 371, 5054 );
AddLabel( 95, 1, 0, "Creatures List" );
AddButton( 5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0 );
AddLabel( 38, 347, 0x384, "Cancel" );
AddButton( 5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0 );
AddLabel( 38, 325, 0x384, "Okay" );
AddButton( 110, 325, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0 );
AddLabel( 143, 325, 0x384, "Bring to Home" );
AddButton( 110, 347, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0 );
AddLabel( 143, 347, 0x384, "Total Respawn" );
for ( int i = 0; i < 13; i++ )
{
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0 );
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0 );
AddImageTiled( 71, ( 22 * i ) + 20, 159, 23, 0xA40 );
AddImageTiled( 72, ( 22 * i ) + 21, 157, 21, 0xBBC );
string str = "";
if ( i < spawner.CreaturesName.Count )
{
str = (string)spawner.CreaturesName[i];
int count = m_Spawner.CountCreatures( str );
if(str!="")
m_SpawnBefore.Add(str);
AddLabel( 232, ( 22 * i ) + 20, 0, count.ToString() );
}
AddTextEntry( 75, ( 22 * i ) + 21, 154, 21, 0, i, str );
}
}
示例4: LoadEntry
public static void LoadEntry( Spawner spawner, XmlElement node )
{
string name = Utility.GetText( node["SpawnedName"], null );
int prob = Utility.GetXMLInt32( Utility.GetText( node["SpawnedProbability"], "100" ), 100 );
int count = Utility.GetXMLInt32( Utility.GetText( node["SpawnedMaxCount"], spawner.Count.ToString() ), spawner.Count );
string parameters = Utility.GetText( node["Parameters"], null );
string properties = Utility.GetText( node["Parameters"], null );
SpawnerEntry entry = new SpawnerEntry( name, prob, count );
entry.Parameters = parameters;
entry.Properties = properties;
spawner.Entries.Add( entry );
}
示例5: CreateBoxSpawn
/// <summary>
/// Converts a BoxSpawn to an actual spawner object. This function is used to generate
/// spawn groups created in Pandora's Box
/// </summary>
/// <param name="spawn">The BoxSpawn object describing the spawn that should be created</param>
/// <returns>A Spawner object - null if not valid</returns>
public static Item CreateBoxSpawn( BoxSpawn spawn )
{
if ( spawn == null || spawn.Entries.Count == 0 )
return null;
Spawner spawner = new Spawner( spawn.Count, spawn.MinDelay, spawn.MaxDelay, spawn.Team, spawn.HomeRange, null );
spawner.Running = false;
spawner.Group = spawn.Group;
foreach ( BoxSpawnEntry entry in spawn.Entries )
{
spawner.CreaturesName.Add( entry.Type );
}
return spawner;
}
示例6: SpawnerGump
public SpawnerGump(Spawner spawner)
: base(50, 50)
{
this.m_Spawner = spawner;
this.AddPage(0);
this.AddBackground(0, 0, 410, 371, 5054);
this.AddLabel(160, 1, 0, "Creatures List");
this.AddButton(5, 347, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0);
this.AddLabel(38, 347, 0x384, "Cancel");
this.AddButton(5, 325, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0);
this.AddLabel(38, 325, 0x384, "Apply");
this.AddButton(110, 325, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0);
this.AddLabel(143, 325, 0x384, "Bring to Home");
this.AddButton(110, 347, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0);
this.AddLabel(143, 347, 0x384, "Total Respawn");
for (int i = 0; i < 13; i++)
{
this.AddButton(5, (22 * i) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0);
this.AddButton(38, (22 * i) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0);
this.AddImageTiled(71, (22 * i) + 20, 309, 23, 0xA40);
this.AddImageTiled(72, (22 * i) + 21, 307, 21, 0xBBC);
string str = "";
if (i < spawner.SpawnNames.Count)
{
str = (string)spawner.SpawnNames[i];
int count = this.m_Spawner.CountCreatures(str);
this.AddLabel(382, (22 * i) + 20, 0, count.ToString());
}
this.AddTextEntry(75, (22 * i) + 21, 304, 21, 0, i, str);
}
}
示例7: LoadSpawner
public static void LoadSpawner( XmlElement node )
{
Spawner spawner = new Spawner();
spawner.Name = Utility.GetText( node["Name"], null );
spawner.Team = Utility.GetXMLInt32( Utility.GetText( node["Team"], "0" ), 0 );
spawner.HomeRange = Utility.GetXMLInt32( Utility.GetText( node["HomeRange"], "0" ), 0 );
spawner.WalkingRange = Utility.GetXMLInt32( Utility.GetText( node["WalkingRange"], "-1" ), -1 );
spawner.Count = Utility.GetXMLInt32( Utility.GetText( node["Count"], "1" ), 1 );
spawner.MinDelay = Utility.GetXMLTimeSpan( Utility.GetText( node["MinDelay"], "00:15:00" ), TimeSpan.FromMinutes( 15.0 ) );
spawner.MaxDelay = Utility.GetXMLTimeSpan( Utility.GetText( node["MaxDelay"], "00:15:00" ), TimeSpan.FromMinutes( 15.0 ) );
spawner.Location = Point3D.Parse( Utility.GetText( node["Location"], "(0,0,0)" ) );
spawner.Map = Map.Parse( Utility.GetText( node["Map"], "Felucca" ) );
XmlElement entries = node["Entries"];
foreach ( XmlElement entry in entries.GetElementsByTagName( "Entry" ) )
LoadEntry( spawner, entry );
}
示例8: CreateArray
public void CreateArray( RelayInfo info, Mobile from, Spawner spawner )
{
spawner.CreaturesName = new ArrayList();
spawner.CreaturesProbability = new ArrayList();
for ( int i = 0; i < 13; i++ )
{
//Creatures names
TextRelay te = info.GetTextEntry(i);
if ( te != null )
{
string str = te.Text;
if ( str.Length > 0 )
{
str = str.Trim();
Type type = SpawnerType.GetType( str );
if (type != null)
{
spawner.CreaturesName.Add(str);
//Creatures probabilities
te = info.GetTextEntry(20 + i);
try
{
if (te != null && te.Text.Length > 0 && Int32.Parse(te.Text) > 0)
spawner.CreaturesProbability.Add(Int32.Parse(te.Text));
else
spawner.CreaturesProbability.Add(DEFAULT_PROBABILTY);
}
catch { spawner.CreaturesProbability.Add(DEFAULT_PROBABILTY); }
}
else
from.SendMessage("{0} is not a valid type name.", str);
}
}
}
if (spawner.CreaturesName.Count > 0) spawner.Start();
}
示例9: 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;
}
示例10: SpawnerEntry
public SpawnerEntry( Spawner parent, GenericReader reader )
{
int version = reader.ReadInt();
m_CreaturesName = reader.ReadString();
m_CreaturesProbability = reader.ReadInt();
m_CreaturesMaxCount = reader.ReadInt();
m_Properties = reader.ReadString();
m_Parameters = reader.ReadString();
int count = reader.ReadInt();
m_Creatures = new List<IEntity>( count );
for ( int i = 0; i < count; ++i )
{
//IEntity e = World.FindEntity( reader.ReadInt() );
IEntity e = reader.ReadEntity();
if ( e != null )
{
if ( e is Item )
((Item)e).Spawner = parent;
else if ( e is Mobile )
{
((Mobile)e).Spawner = parent;
if ( e is BaseCreature )
((BaseCreature)e).RemoveIfUntamed = true;
}
m_Creatures.Add( e );
if ( !parent.Creatures.ContainsKey( e ) )
parent.Creatures.Add( e, this );
}
}
}
示例11: MakeSpawner
private static void MakeSpawner( string[] types, int x, int y, Map map )
{
if ( types.Length == 0 )
return;
int z = GetSpawnerZ( x, y, map );
ClearSpawners( x, y, z, map );
for ( int i = 0; i < types.Length; ++i )
{
bool isGuildmaster = ( types[i].EndsWith( "Guildmaster" ) );
Spawner sp = new Spawner( types[i] );
if ( isGuildmaster )
sp.Count = 1;
else
sp.Count = NPCCount;
sp.MinDelay = MinTime;
sp.MaxDelay = MaxTime;
sp.Team = Team;
sp.HomeRange = HomeRange;
sp.MoveToWorld( new Point3D( x, y, z ), map );
if ( TotalRespawn )
{
sp.Respawn();
sp.BringToHome();
}
++m_Count;
}
}
示例12: SpawnerGump
public SpawnerGump( Spawner spawner, int page ) : this( spawner, null, page )
{
}
示例13: ImportSpawner
private static void ImportSpawner(XmlElement node)
{
int count = int.Parse(GetText(node["count"], "1"));
int homeRange = int.Parse(GetText(node["homerange"], "4"));
int walkingRange = int.Parse(GetText(node["walkingrange"], "-1"));
int team = int.Parse(GetText(node["team"], "0"));
bool group = bool.Parse(GetText(node["group"], "False"));
TimeSpan maxDelay = TimeSpan.Parse(GetText(node["maxdelay"], "10:00"));
TimeSpan minDelay = TimeSpan.Parse(GetText(node["mindelay"], "05:00"));
List<string> creaturesName = LoadCreaturesName(node["creaturesname"]);
string name = GetText(node["name"], "Spawner");
Point3D location = Point3D.Parse(GetText(node["location"], "Error"));
Map map = Map.Parse(GetText(node["map"], "Error"));
Spawner spawner = new Spawner(count, minDelay, maxDelay, team, homeRange, creaturesName);
if (walkingRange >= 0)
spawner.WalkingRange = walkingRange;
spawner.Name = name;
spawner.MoveToWorld(location, map);
if (spawner.Map == Map.Internal)
{
spawner.Delete();
throw new Exception("Spawner created on Internal map.");
}
spawner.Respawn();
}
示例14: OnResponse
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 0:
{
from.CloseGump( typeof( StartStopMontorilsh ) );
from.SendGump( new CityInvasion( from ) );
break;
}
case 1:
{
Point3D loc = new Point3D( 568, 1311, 0 );
WayPoint point = new WayPoint();
WayPoint point1 = new WayPoint();
WayPoint point2 = new WayPoint();
//WayPoint point3 = new WayPoint();
point.Name = "MontorInvasionIlshenar";
point1.Name = "MontorInvasionIlshenar";
point2.Name = "MontorInvasionIlshenar";
Spawner spawner1 = new Spawner( 1, 1440, 1441, 0, 6, "OrcBrute" );
spawner1.MoveToWorld( new Point3D( 950, 284, -90 ), Map.Malas );
spawner1.WayPoint = point;
point.MoveToWorld( new Point3D( 950, 265, -90 ), Map.Malas );
point.NextPoint = point2;
point2.MoveToWorld( new Point3D( 950, 275, -90 ), Map.Malas );
spawner1.Name = "MontorInvasionIlshenar";
spawner1.Respawn();
Spawner spawner2 = new Spawner( 1, 1440, 1441, 0, 6, "OrcBomber" );
spawner2.MoveToWorld( new Point3D( 952, 284, -90 ), Map.Malas );
spawner2.WayPoint = point1;
point1.MoveToWorld( new Point3D( 952, 265, -90 ), Map.Malas );
spawner2.Name = "MontorInvasionIlshenar";
spawner2.Respawn();
Spawner spawner3 = new Spawner( 1, 1440, 1441, 0, 6, "Savage" );
spawner3.MoveToWorld( new Point3D( 950, 244, -90 ), Map.Malas );
spawner3.WayPoint = point;
spawner3.Name = "MontorInvasionIlshenar";
spawner3.Respawn();
Spawner spawner4 = new Spawner( 1, 1440, 1441, 0, 6, "SavageRider" );
spawner4.MoveToWorld( new Point3D( 952, 244, -90 ), Map.Malas );
spawner4.WayPoint = point1;
spawner4.Name = "MontorInvasionIlshenar";
spawner4.Respawn();
World.Broadcast( 33, true, "Montor Ilshenar is under invasion." );
from.SendGump( new CityInvasion( from ) );
break;
}
case 2:
{
MontorInvasionStone monilsh = new MontorInvasionStone();
monilsh.StopMontorIlshenar();
World.Broadcast( 33, true, "Montor Ilshenar's invasion was successfully beaten back. No more invaders are left in the city." );
from.SendGump( new CityInvasion( from ) );
break;
}
}
}
示例15: LoadMobile
public static Spawner LoadMobile(Item item)
{
Type t = GetType(item.Z - Offset);
if (t == null)
{
return null;
}
var spawner = new Spawner();
spawner.SpawnNames.Add(t.ToString());
spawner.Running = true;
spawner.HomeRange = 0;
spawner.WalkingRange = 4;
//spawner.Respawn();
return spawner;
}