#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
5df497787a
7510 changed files with 416048 additions and 0 deletions
45
Scripts/Engines/Spawner/PSCount.cs
Normal file
45
Scripts/Engines/Spawner/PSCount.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class PSpawnerCount
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
Register( "pscount", AccessLevel.Administrator, new CommandEventHandler( Clearall_OnCommand ) );
|
||||
}
|
||||
|
||||
public static void Register( string command, AccessLevel access, CommandEventHandler handler )
|
||||
{
|
||||
CommandSystem.Register( command, access, handler );
|
||||
}
|
||||
|
||||
[Usage( "pscount" )]
|
||||
[Description( "Count PremiumSpawners." )]
|
||||
public static void Clearall_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
DateTime time = DateTime.Now;
|
||||
|
||||
List<Item> pspawnerlist = new List<Item>();
|
||||
|
||||
foreach ( Item pspawner in World.Items.Values )
|
||||
{
|
||||
if ( pspawner.Parent == null && pspawner is PremiumSpawner)
|
||||
{
|
||||
pspawnerlist.Add( pspawner );
|
||||
}
|
||||
}
|
||||
|
||||
from.SendMessage( "Premium Spawners: {0}", pspawnerlist.Count );
|
||||
}
|
||||
}
|
||||
}
|
||||
1912
Scripts/Engines/Spawner/PremiumSpawner.cs
Normal file
1912
Scripts/Engines/Spawner/PremiumSpawner.cs
Normal file
File diff suppressed because it is too large
Load diff
495
Scripts/Engines/Spawner/PremiumSpawnerGump.cs
Normal file
495
Scripts/Engines/Spawner/PremiumSpawnerGump.cs
Normal file
|
|
@ -0,0 +1,495 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class PremiumSpawnerGump : Gump
|
||||
{
|
||||
private PremiumSpawner m_Spawner;
|
||||
|
||||
public void AddBlackAlpha( int x, int y, int width, int height )
|
||||
{
|
||||
AddImageTiled( x, y, width, height, 2624 );
|
||||
AddAlphaRegion( x, y, width, height );
|
||||
}
|
||||
|
||||
public PremiumSpawnerGump( PremiumSpawner spawner ) : base( 50, 50 )
|
||||
{
|
||||
m_Spawner = spawner;
|
||||
|
||||
AddPage( 1 );
|
||||
|
||||
AddBackground( 0, 0, 350, 360, 5054 );
|
||||
|
||||
AddLabel( 80, 1, 52, "Creatures List 1" );
|
||||
|
||||
AddLabel( 215, 3, 52, "PREMIUM SPAWNER" );
|
||||
AddBlackAlpha( 213, 23, 125, 270 );
|
||||
|
||||
AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 260, 60, 52, "Okay" );
|
||||
|
||||
AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 110, 52, "Bring to Home" );
|
||||
|
||||
AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 160, 52, "Total Respawn" );
|
||||
|
||||
AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 245, 210, 52, "Properties" );
|
||||
|
||||
AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 256, 260, 52, "Cancel" );
|
||||
|
||||
AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 6 );
|
||||
AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 2 );
|
||||
AddLabel( 258, 320, 52, "- 1 -" );
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
// AddButton ( x, y, image, imageOnClick, ButtonID )
|
||||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (1 + i), GumpButtonType.Reply, 0 ); // > (spawn this creature)
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (91 + i), GumpButtonType.Reply, 0 ); // X (remove this creature)
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.CreaturesName.Count )
|
||||
{
|
||||
str = (string)spawner.CreaturesName[i];
|
||||
int count = m_Spawner.CountCreatures( str );
|
||||
|
||||
AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 101 + i, str );
|
||||
}
|
||||
|
||||
AddPage( 2 );
|
||||
|
||||
AddBackground( 0, 0, 350, 360, 5054 );
|
||||
|
||||
AddLabel( 80, 1, 52, "Creatures List 2" );
|
||||
|
||||
AddLabel( 215, 3, 52, "PREMIUM SPAWNER" );
|
||||
AddBlackAlpha( 213, 23, 125, 270 );
|
||||
|
||||
AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 260, 60, 52, "Okay" );
|
||||
|
||||
AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 110, 52, "Bring to Home" );
|
||||
|
||||
AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 160, 52, "Total Respawn" );
|
||||
|
||||
AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 245, 210, 52, "Properties" );
|
||||
|
||||
AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 256, 260, 52, "Cancel" );
|
||||
|
||||
AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 1 );
|
||||
AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 3 );
|
||||
AddLabel( 258, 320, 52, "- 2 -" );
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (16 + i), GumpButtonType.Reply, 0 );
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (106 + i), GumpButtonType.Reply, 0 );
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.SubSpawnerA.Count )
|
||||
{
|
||||
str = (string)spawner.SubSpawnerA[i];
|
||||
int count = m_Spawner.CountCreaturesA( str );
|
||||
|
||||
AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 201 + i, str );
|
||||
}
|
||||
|
||||
AddPage( 3 );
|
||||
|
||||
AddBackground( 0, 0, 350, 360, 5054 );
|
||||
|
||||
AddLabel( 80, 1, 52, "Creatures List 3" );
|
||||
|
||||
AddLabel( 215, 3, 52, "PREMIUM SPAWNER" );
|
||||
AddBlackAlpha( 213, 23, 125, 270 );
|
||||
|
||||
AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 260, 60, 52, "Okay" );
|
||||
|
||||
AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 110, 52, "Bring to Home" );
|
||||
|
||||
AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 160, 52, "Total Respawn" );
|
||||
|
||||
AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 245, 210, 52, "Properties" );
|
||||
|
||||
AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 256, 260, 52, "Cancel" );
|
||||
|
||||
AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 2 );
|
||||
AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 4 );
|
||||
AddLabel( 258, 320, 52, "- 3 -" );
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (31 + i), GumpButtonType.Reply, 0 );
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (121 + i), GumpButtonType.Reply, 0 );
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.SubSpawnerB.Count )
|
||||
{
|
||||
str = (string)spawner.SubSpawnerB[i];
|
||||
int count = m_Spawner.CountCreaturesB( str );
|
||||
|
||||
AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 301 + i, str );
|
||||
}
|
||||
|
||||
AddPage( 4 );
|
||||
|
||||
AddBackground( 0, 0, 350, 360, 5054 );
|
||||
|
||||
AddLabel( 80, 1, 52, "Creatures List 4" );
|
||||
|
||||
AddLabel( 215, 3, 52, "PREMIUM SPAWNER" );
|
||||
AddBlackAlpha( 213, 23, 125, 270 );
|
||||
|
||||
AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 260, 60, 52, "Okay" );
|
||||
|
||||
AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 110, 52, "Bring to Home" );
|
||||
|
||||
AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 160, 52, "Total Respawn" );
|
||||
|
||||
AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 245, 210, 52, "Properties" );
|
||||
|
||||
AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 256, 260, 52, "Cancel" );
|
||||
|
||||
AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 3 );
|
||||
AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 5 );
|
||||
AddLabel( 258, 320, 52, "- 4 -" );
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (46 + i), GumpButtonType.Reply, 0 );
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (136 + i), GumpButtonType.Reply, 0 );
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.SubSpawnerC.Count )
|
||||
{
|
||||
str = (string)spawner.SubSpawnerC[i];
|
||||
int count = m_Spawner.CountCreaturesC( str );
|
||||
|
||||
AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 401 + i, str );
|
||||
}
|
||||
|
||||
AddPage( 5 );
|
||||
|
||||
AddBackground( 0, 0, 350, 360, 5054 );
|
||||
|
||||
AddLabel( 80, 1, 52, "Creatures List 5" );
|
||||
|
||||
AddLabel( 215, 3, 52, "PREMIUM SPAWNER" );
|
||||
AddBlackAlpha( 213, 23, 125, 270 );
|
||||
|
||||
AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 260, 60, 52, "Okay" );
|
||||
|
||||
AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 110, 52, "Bring to Home" );
|
||||
|
||||
AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 160, 52, "Total Respawn" );
|
||||
|
||||
AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 245, 210, 52, "Properties" );
|
||||
|
||||
AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 256, 260, 52, "Cancel" );
|
||||
|
||||
AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 4 );
|
||||
AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 6 );
|
||||
AddLabel( 258, 320, 52, "- 5 -" );
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (61 + i), GumpButtonType.Reply, 0 );
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (151 + i), GumpButtonType.Reply, 0 );
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.SubSpawnerD.Count )
|
||||
{
|
||||
str = (string)spawner.SubSpawnerD[i];
|
||||
int count = m_Spawner.CountCreaturesD( str );
|
||||
|
||||
AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 501 + i, str );
|
||||
}
|
||||
|
||||
AddPage( 6 );
|
||||
|
||||
AddBackground( 0, 0, 350, 360, 5054 );
|
||||
|
||||
AddLabel( 80, 1, 52, "Creatures List 6" );
|
||||
|
||||
AddLabel( 215, 3, 52, "PREMIUM SPAWNER" );
|
||||
AddBlackAlpha( 213, 23, 125, 270 );
|
||||
|
||||
AddButton( 260, 40, 0xFB7, 0xFB9, 1000, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 260, 60, 52, "Okay" );
|
||||
|
||||
AddButton( 260, 90, 0xFB4, 0xFB6, 200, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 110, 52, "Bring to Home" );
|
||||
|
||||
AddButton( 260, 140, 0xFA8, 0xFAA, 300, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 232, 160, 52, "Total Respawn" );
|
||||
|
||||
AddButton( 260, 190, 0xFAB, 0xFAD, 400, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 245, 210, 52, "Properties" );
|
||||
|
||||
AddButton( 260, 240, 0xFB1, 0xFB3, 500, GumpButtonType.Reply, 0 );
|
||||
AddLabel( 256, 260, 52, "Cancel" );
|
||||
|
||||
AddButton( 230, 320, 5603, 5607, 0, GumpButtonType.Page, 5 );
|
||||
AddButton( 302, 320, 5601, 5605, 0, GumpButtonType.Page, 1 );
|
||||
AddLabel( 258, 320, 52, "- 6 -" );
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, (76 + i), GumpButtonType.Reply, 0 );
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, (166 + i), GumpButtonType.Reply, 0 );
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 119, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 117, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.SubSpawnerE.Count )
|
||||
{
|
||||
str = (string)spawner.SubSpawnerE[i];
|
||||
int count = m_Spawner.CountCreaturesE( str );
|
||||
|
||||
AddLabel( 192, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 114, 21, 0, 601 + i, str );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<string> CreateArray( RelayInfo info, Mobile from, int TextIndex )
|
||||
{
|
||||
List<string> creaturesName = new List<string>();
|
||||
|
||||
for ( int i = 0; i < 15; i++ )
|
||||
{
|
||||
TextRelay te = info.GetTextEntry( TextIndex + i );
|
||||
|
||||
if ( te != null )
|
||||
{
|
||||
string str = te.Text;
|
||||
|
||||
if ( str.Length > 0 )
|
||||
{
|
||||
str = str.Trim();
|
||||
|
||||
string t = Spawner.ParseType( str );
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( t );
|
||||
|
||||
if ( type != null )
|
||||
creaturesName.Add( str );
|
||||
else
|
||||
from.SendMessage( "{0} is not a valid type name.", t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return creaturesName;
|
||||
}
|
||||
|
||||
public string GetEntry( int Type, RelayInfo info )
|
||||
{
|
||||
TextRelay entry = info.GetTextEntry( Type );
|
||||
return entry.Text;
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( m_Spawner.Deleted )
|
||||
return;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // Cancel (mouse's right button click anywhere on the gump)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 200: // Bring everything home
|
||||
{
|
||||
m_Spawner.BringToHome();
|
||||
break;
|
||||
}
|
||||
case 300: // Total respawn
|
||||
{
|
||||
// 1st save changes
|
||||
m_Spawner.CreaturesName = CreateArray( info, state.Mobile, 100 );
|
||||
m_Spawner.SubSpawnerA = CreateArray( info, state.Mobile, 200 );
|
||||
m_Spawner.SubSpawnerB = CreateArray( info, state.Mobile, 300 );
|
||||
m_Spawner.SubSpawnerC = CreateArray( info, state.Mobile, 400 );
|
||||
m_Spawner.SubSpawnerD = CreateArray( info, state.Mobile, 500 );
|
||||
m_Spawner.SubSpawnerE = CreateArray( info, state.Mobile, 600 );
|
||||
// then respwan
|
||||
m_Spawner.Respawn();
|
||||
m_Spawner.Running = true;
|
||||
break;
|
||||
}
|
||||
case 400: // Props
|
||||
{
|
||||
state.Mobile.SendGump( new PropertiesGump( state.Mobile, m_Spawner ) );
|
||||
state.Mobile.SendGump( new PremiumSpawnerGump( m_Spawner ) );
|
||||
break;
|
||||
}
|
||||
case 500: // Cancel button
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1000: // Okay
|
||||
{
|
||||
m_Spawner.CreaturesName = CreateArray( info, state.Mobile, 100 );
|
||||
m_Spawner.SubSpawnerA = CreateArray( info, state.Mobile, 200 );
|
||||
m_Spawner.SubSpawnerB = CreateArray( info, state.Mobile, 300 );
|
||||
m_Spawner.SubSpawnerC = CreateArray( info, state.Mobile, 400 );
|
||||
m_Spawner.SubSpawnerD = CreateArray( info, state.Mobile, 500 );
|
||||
m_Spawner.SubSpawnerE = CreateArray( info, state.Mobile, 600 );
|
||||
m_Spawner.Running = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{ //ButtonID: 1-90 spawn; 91-180 remove
|
||||
int ID = info.ButtonID;
|
||||
|
||||
int Type = 0;
|
||||
|
||||
// Spawn creature
|
||||
if ( (ID >= 1) && (ID <= 15) )
|
||||
{
|
||||
Type += 100 + ID;
|
||||
m_Spawner.Spawn( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 16) && (ID <= 30) )
|
||||
{
|
||||
Type += 200 + ID - 15;
|
||||
m_Spawner.SpawnA( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 31) && (ID <= 45) )
|
||||
{
|
||||
Type += 300 + ID - 30;
|
||||
m_Spawner.SpawnB( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 46) && (ID <= 60) )
|
||||
{
|
||||
Type += 400 + ID - 45;
|
||||
m_Spawner.SpawnC( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 61) && (ID <= 75) )
|
||||
{
|
||||
Type += 500 + ID - 60;
|
||||
m_Spawner.SpawnD( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 76) && (ID <= 90) )
|
||||
{
|
||||
Type += 600 + ID - 75;
|
||||
m_Spawner.SpawnE( GetEntry(Type, info) );
|
||||
}
|
||||
// Remove creature
|
||||
else if ( (ID >= 91) && (ID <= 105) )
|
||||
{
|
||||
Type += 100 + ID - 90;
|
||||
m_Spawner.RemoveCreatures( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 106) && (ID <= 120) )
|
||||
{
|
||||
Type += 200 + ID - 105;
|
||||
m_Spawner.RemoveCreaturesA( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 121) && (ID <= 135) )
|
||||
{
|
||||
Type += 300 + ID - 120;
|
||||
m_Spawner.RemoveCreaturesB( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 136) && (ID <= 150) )
|
||||
{
|
||||
Type += 400 + ID - 135;
|
||||
m_Spawner.RemoveCreaturesC( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 151) && (ID <= 165) )
|
||||
{
|
||||
Type += 500 + ID - 150;
|
||||
m_Spawner.RemoveCreaturesD( GetEntry(Type, info) );
|
||||
}
|
||||
else if ( (ID >= 166) && (ID <= 180) )
|
||||
{
|
||||
Type += 600 + ID - 165;
|
||||
m_Spawner.RemoveCreaturesE( GetEntry(Type, info) );
|
||||
}
|
||||
|
||||
string entry = GetEntry(Type, info);
|
||||
|
||||
if ( entry != null && entry.Length > 0 )
|
||||
{
|
||||
m_Spawner.CreaturesName = CreateArray( info, state.Mobile, 100 );
|
||||
m_Spawner.SubSpawnerA = CreateArray( info, state.Mobile, 200 );
|
||||
m_Spawner.SubSpawnerB = CreateArray( info, state.Mobile, 300 );
|
||||
m_Spawner.SubSpawnerC = CreateArray( info, state.Mobile, 400 );
|
||||
m_Spawner.SubSpawnerD = CreateArray( info, state.Mobile, 500 );
|
||||
m_Spawner.SubSpawnerE = CreateArray( info, state.Mobile, 600 );
|
||||
m_Spawner.Running = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
419
Scripts/Engines/Spawner/PremiumSpawnerGumps.cs
Normal file
419
Scripts/Engines/Spawner/PremiumSpawnerGumps.cs
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
// Engine r117
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.Commands;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class OptionsGumps
|
||||
{
|
||||
public OptionsGumps()
|
||||
{
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "GumpSaveRegion", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps1_OnCommand ) );
|
||||
CommandSystem.Register( "GumpSaveCoordinate", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps2_OnCommand ) );
|
||||
CommandSystem.Register( "GumpRemoveID", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps3_OnCommand ) );
|
||||
CommandSystem.Register( "GumpRemoveCoordinate", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps4_OnCommand ) );
|
||||
CommandSystem.Register( "GumpRemoveRegion", AccessLevel.Administrator, new CommandEventHandler( OptionsGumps5_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "[GumpSaveRegion" )]
|
||||
[Description( "Gump to Save inside Region" )]
|
||||
private static void OptionsGumps1_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.SendGump( new GumpSaveRegion( e ) );
|
||||
}
|
||||
|
||||
[Usage( "[GumpSaveCoordinate" )]
|
||||
[Description( "Gump to save by coordinates" )]
|
||||
private static void OptionsGumps2_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.SendGump( new GumpSaveCoordinate( e ) );
|
||||
}
|
||||
|
||||
[Usage( "[GumpRemoveID" )]
|
||||
[Description( "Gump to remove by ID" )]
|
||||
private static void OptionsGumps3_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.SendGump( new GumpRemoveID( e ) );
|
||||
}
|
||||
|
||||
[Usage( "[GumpRemoveCoordinate" )]
|
||||
[Description( "Gump to remove by coordinates" )]
|
||||
private static void OptionsGumps4_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.SendGump( new GumpRemoveCoordinate( e ) );
|
||||
}
|
||||
|
||||
[Usage( "[GumpRemoveRegion" )]
|
||||
[Description( "Gump to remove inside region" )]
|
||||
private static void OptionsGumps5_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
e.Mobile.SendGump( new GumpRemoveRegion( e ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GumpSaveRegion : Gump
|
||||
{
|
||||
private CommandEventArgs m_CommandEventArgs;
|
||||
|
||||
public GumpSaveRegion( CommandEventArgs e ) : base( 50,50 )
|
||||
{
|
||||
m_CommandEventArgs = e;
|
||||
Closable = true;
|
||||
Dragable = true;
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
AddPage(1);
|
||||
//x, y, width, hight
|
||||
AddBackground( 0, 0, 232, 210, 5054 );
|
||||
|
||||
AddImageTiled( 15, 30, 120, 20, 3004 );
|
||||
AddTextEntry( 15, 30, 120, 20, 0, 0, @"region to save");
|
||||
AddLabel( 15, 10, 52, "Enter a Region:" );
|
||||
AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddLabel( 15, 60, 52, "Tip:" );
|
||||
AddHtml( 15, 80, 200, 110, "This will SAVE the spawners, in a specified region, to Data/Spawns/'region name'.map. Type [where if you don't know the region you are. Copy to the text box the name of the region. You also can open Data/Regions.xml to a full list of regions.<BR>Example: you type [where and appear 'your region is town of Britain'. Type 'Britain' in text box.", true, true );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // close the gump
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case 101:
|
||||
{
|
||||
TextRelay oRegion = info.GetTextEntry( 0 );
|
||||
string sRegion = oRegion.Text;
|
||||
if( sRegion != "" )
|
||||
{
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}Spawngen save {1}", prefix, sRegion ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You must specify a region!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpSaveRegion", prefix ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GumpRemoveRegion : Gump
|
||||
{
|
||||
private CommandEventArgs m_CommandEventArgs;
|
||||
|
||||
public GumpRemoveRegion( CommandEventArgs e ) : base( 50,50 )
|
||||
{
|
||||
m_CommandEventArgs = e;
|
||||
Closable = true;
|
||||
Dragable = true;
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddBackground( 0, 0, 232, 210, 5054 );
|
||||
|
||||
AddImageTiled( 15, 30, 120, 20, 3004 );
|
||||
AddTextEntry( 15, 30, 120, 20, 0, 0, @"region to remove");
|
||||
AddLabel( 15, 10, 52, "Enter a Region:" );
|
||||
AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddLabel( 15, 60, 52, "Tip:" );
|
||||
AddHtml( 15, 80, 200, 110, "This will REMOVE the spawners, in a specified region. Type [where if you don't know the region you are. Copy to the text box the name of the region. You also can open Data/Regions.xml to a full list of regions.<BR>Example: you type [where and appear 'your region is town of Britain'. Type 'Britain' in text box.", true, true );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // close the gump
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case 101:
|
||||
{
|
||||
TextRelay oRegion = info.GetTextEntry( 0 );
|
||||
string sRegion = oRegion.Text;
|
||||
if( sRegion != "" )
|
||||
{
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}Spawngen remove {1}", prefix, sRegion ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You must specify a region!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpRemoveRegion", prefix ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GumpRemoveID : Gump
|
||||
{
|
||||
private CommandEventArgs m_CommandEventArgs;
|
||||
|
||||
public GumpRemoveID( CommandEventArgs e ) : base( 50,50 )
|
||||
{
|
||||
m_CommandEventArgs = e;
|
||||
Closable = true;
|
||||
Dragable = true;
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddBackground( 0, 0, 232, 210, 5054 );
|
||||
|
||||
AddImageTiled( 15, 30, 120, 20, 3004 );
|
||||
AddTextEntry( 15, 30, 120, 20, 0, 0, @"SpawnID to remove");
|
||||
AddLabel( 15, 10, 52, "Enter a SpawnID:" );
|
||||
AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddLabel( 15, 60, 52, "Tip:" );
|
||||
AddHtml( 15, 80, 200, 110, "This command was made to UNLOAD your own custom maps. This will REMOVE the spawners with the specified ID. Type '[get spawnid' in a spawner to know your ID. Remember: 'By Hand' spawns, i.e., those done with '[add premiumspawner' have ID = 1.", true, true );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // close the gump
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case 101:
|
||||
{
|
||||
TextRelay oID = info.GetTextEntry( 0 );
|
||||
string sID = oID.Text;
|
||||
if( sID != "" )
|
||||
{
|
||||
try
|
||||
{
|
||||
int UnloadID = Convert.ToInt32( sID );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}Spawngen unload {1}", prefix, UnloadID ) );
|
||||
}
|
||||
catch
|
||||
{
|
||||
from.SendMessage( "SpawnID must be a number!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpRemoveID", prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You must specify an SpawnID!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpRemoveID", prefix ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GumpSaveCoordinate : Gump
|
||||
{
|
||||
private CommandEventArgs m_CommandEventArgs;
|
||||
|
||||
public GumpSaveCoordinate( CommandEventArgs e ) : base( 50,50 )
|
||||
{
|
||||
m_CommandEventArgs = e;
|
||||
Closable = true;
|
||||
Dragable = true;
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddBackground( 0, 0, 232, 235, 5054 );
|
||||
|
||||
AddImageTiled( 15, 30, 37, 20, 3004 );
|
||||
AddTextEntry( 15, 30, 37, 20, 0, 0, @"X1");
|
||||
|
||||
AddImageTiled( 57, 30, 37, 20, 3004 );
|
||||
AddTextEntry( 57, 30, 37, 20, 0, 1, @"Y1");
|
||||
|
||||
AddImageTiled( 15, 55, 37, 20, 3004 );
|
||||
AddTextEntry( 15, 55, 37, 20, 0, 2, @"X2");
|
||||
|
||||
AddImageTiled( 57, 55, 37, 20, 3004 );
|
||||
AddTextEntry( 57, 55, 37, 20, 0, 3, @"Y2");
|
||||
|
||||
AddLabel( 15, 10, 52, "Enter Coordinates:" );
|
||||
AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddLabel( 15, 85, 52, "Tip:" );
|
||||
AddHtml( 15, 105, 200, 110, "This will SAVE spawners inside specified coordinates. You can use [where in the first point and again [where in the second point to get the X and Y coordinates. You need 2: X1, Y1 for first point and X2, Y2 for the second point. The objective is determine a 'box'. This command will save all spawners inside this box.", true, true );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // close the gump
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case 101:
|
||||
{
|
||||
TextRelay oX1 = info.GetTextEntry( 0 );
|
||||
TextRelay oY1 = info.GetTextEntry( 1 );
|
||||
TextRelay oX2 = info.GetTextEntry( 2 );
|
||||
TextRelay oY2 = info.GetTextEntry( 3 );
|
||||
string sX1 = oX1.Text;
|
||||
string sY1 = oY1.Text;
|
||||
string sX2 = oX2.Text;
|
||||
string sY2 = oY2.Text;
|
||||
if( sX1 != "" && sY1 != "" && sX2 != "" && sY2 != "" )
|
||||
{
|
||||
try
|
||||
{
|
||||
int iX1 = Convert.ToInt32( sX1 );
|
||||
int iY1 = Convert.ToInt32( sY1 );
|
||||
int iX2 = Convert.ToInt32( sX2 );
|
||||
int iY2 = Convert.ToInt32( sY2 );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}Spawngen save {1} {2} {3} {4}", prefix, iX1, iY1, iX2, iY2 ) );
|
||||
}
|
||||
catch
|
||||
{
|
||||
from.SendMessage( "Coordinates must be numbers!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpSaveCoordinate", prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You must specify all coordinates!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpSaveCoordinate", prefix ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GumpRemoveCoordinate : Gump
|
||||
{
|
||||
private CommandEventArgs m_CommandEventArgs;
|
||||
|
||||
public GumpRemoveCoordinate( CommandEventArgs e ) : base( 50,50 )
|
||||
{
|
||||
m_CommandEventArgs = e;
|
||||
Closable = true;
|
||||
Dragable = true;
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddBackground( 0, 0, 232, 235, 5054 );
|
||||
|
||||
AddImageTiled( 15, 30, 37, 20, 3004 );
|
||||
AddTextEntry( 15, 30, 37, 20, 0, 0, @"X1");
|
||||
|
||||
AddImageTiled( 57, 30, 37, 20, 3004 );
|
||||
AddTextEntry( 57, 30, 37, 20, 0, 1, @"Y1");
|
||||
|
||||
AddImageTiled( 15, 55, 37, 20, 3004 );
|
||||
AddTextEntry( 15, 55, 37, 20, 0, 2, @"X2");
|
||||
|
||||
AddImageTiled( 57, 55, 37, 20, 3004 );
|
||||
AddTextEntry( 57, 55, 37, 20, 0, 3, @"Y2");
|
||||
|
||||
AddLabel( 15, 10, 52, "Enter Coordinates:" );
|
||||
AddButton( 140, 32, 0x15E1, 0x15E5, 101, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddLabel( 15, 85, 52, "Tip:" );
|
||||
AddHtml( 15, 105, 200, 110, "This will REMOVE spawners inside specified coordinates. You can use [where in the first point and again [where in the second point to get the X and Y coordinates. You need 2: X1, Y1 for first point and X2, Y2 for the second point. The objective is determine a 'box'. This command will remove all spawners inside this box.", true, true );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // close the gump
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case 101:
|
||||
{
|
||||
TextRelay oX1 = info.GetTextEntry( 0 );
|
||||
TextRelay oY1 = info.GetTextEntry( 1 );
|
||||
TextRelay oX2 = info.GetTextEntry( 2 );
|
||||
TextRelay oY2 = info.GetTextEntry( 3 );
|
||||
string sX1 = oX1.Text;
|
||||
string sY1 = oY1.Text;
|
||||
string sX2 = oX2.Text;
|
||||
string sY2 = oY2.Text;
|
||||
if( sX1 != "" && sY1 != "" && sX2 != "" && sY2 != "" )
|
||||
{
|
||||
try
|
||||
{
|
||||
int iX1 = Convert.ToInt32( sX1 );
|
||||
int iY1 = Convert.ToInt32( sY1 );
|
||||
int iX2 = Convert.ToInt32( sX2 );
|
||||
int iY2 = Convert.ToInt32( sY2 );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}Spawngen remove {1} {2} {3} {4}", prefix, iX1, iY1, iX2, iY2 ) );
|
||||
}
|
||||
catch
|
||||
{
|
||||
from.SendMessage( "Coordinates must be numbers!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpRemoveCoordinate", prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You must specify all coordinates!" );
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}GumpRemoveCoordinate", prefix ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
288
Scripts/Engines/Spawner/PremiumSpawnerMainGump.cs
Normal file
288
Scripts/Engines/Spawner/PremiumSpawnerMainGump.cs
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
// Engine r153
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class PremiumSpawnerMainGump : Gump
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("PremiumSpawner", AccessLevel.Administrator, new CommandEventHandler(PremiumSpawner_OnCommand));
|
||||
CommandSystem.Register("Spawner", AccessLevel.Administrator, new CommandEventHandler(PremiumSpawner_OnCommand));
|
||||
}
|
||||
|
||||
[Usage("PremiumSpawner")]
|
||||
[Aliases( "Spawner" )]
|
||||
[Description("PremiumSpawner main gump.")]
|
||||
public static void PremiumSpawner_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
if (from.HasGump(typeof(PremiumSpawnerMainGump)))
|
||||
from.CloseGump(typeof(PremiumSpawnerMainGump));
|
||||
from.SendGump(new PremiumSpawnerMainGump(from));
|
||||
}
|
||||
|
||||
public PremiumSpawnerMainGump(Mobile from) : this()
|
||||
{
|
||||
}
|
||||
|
||||
public void AddBlackAlpha( int x, int y, int width, int height )
|
||||
{
|
||||
AddImageTiled( x, y, width, height, 2624 );
|
||||
AddAlphaRegion( x, y, width, height );
|
||||
}
|
||||
|
||||
public PremiumSpawnerMainGump() : base( 0, 0 )
|
||||
{
|
||||
this.Closable=true;
|
||||
this.Disposable=true;
|
||||
this.Dragable=true;
|
||||
//PAGE 1
|
||||
AddPage(1);
|
||||
AddBackground(93, 68, 256, 423, 9200);
|
||||
AddHtml( 98, 75, 244, 44, " PREMIUM SPAWNER<BR>" + "by Nerun Rev.154", (bool)true, (bool)false);
|
||||
AddBlackAlpha(100, 124, 241, 71);
|
||||
AddLabel(109, 126, 52, @"WORLD CREATION");
|
||||
AddLabel(126, 148, 52, @"Let there be light (Create World)");
|
||||
AddLabel(126, 170, 52, @"Apocalypse now (Clear All Facets)");
|
||||
AddButton(109, 151, 1210, 1209, 101, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 173, 1210, 1209, 102, GumpButtonType.Reply, 0);
|
||||
AddBlackAlpha(100, 200, 241, 89);
|
||||
AddLabel(109, 202, 52, @"SELECT SPAWNS BY EXPANSION");
|
||||
AddLabel(126, 224, 52, @"UO Classic spawns (pre-T2A)");
|
||||
AddLabel(126, 244, 52, @"UO Mondain's Legacy spawns");
|
||||
AddLabel(126, 264, 52, @"UO KR, SA and HS spawns");
|
||||
//AddLabel(238, 224, 52, @"UO:ML spawns");
|
||||
//AddLabel(238, 244, 52, @"UO:KR, SA and HS spawns");
|
||||
//AddLabel(238, 264, 52, @"teste");
|
||||
AddButton(109, 227, 1210, 1209, 103, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 247, 1210, 1209, 104, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 267, 1210, 1209, 105, GumpButtonType.Reply, 0);
|
||||
//AddButton(221, 227, 1210, 1209, 106, GumpButtonType.Reply, 0);
|
||||
//AddButton(221, 247, 1210, 1209, 107, GumpButtonType.Reply, 0);
|
||||
//AddButton(221, 267, 1210, 1209, 108, GumpButtonType.Reply, 0);
|
||||
AddBlackAlpha(100, 294, 241, 89);
|
||||
AddLabel(109, 296, 52, @"REMOVE SPAWNS BY EXPANSION");
|
||||
AddLabel(126, 318, 52, @"UO Classic spawns (pre-T2A)");
|
||||
AddLabel(126, 338, 52, @"UO Mondain's Legacy spawns");
|
||||
AddLabel(126, 358, 52, @"UO KR, SA and HS spawns");
|
||||
//AddLabel(238, 318, 52, @"Ter Mur");
|
||||
//AddLabel(238, 338, 52, @"Tokuno");
|
||||
//AddLabel(238, 358, 52, @"Trammel");
|
||||
AddButton(109, 321, 1210, 1209, 109, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 341, 1210, 1209, 110, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 361, 1210, 1209, 111, GumpButtonType.Reply, 0);
|
||||
//AddButton(221, 321, 1210, 1209, 112, GumpButtonType.Reply, 0);
|
||||
//AddButton(221, 341, 1210, 1209, 113, GumpButtonType.Reply, 0);
|
||||
//AddButton(221, 361, 1210, 1209, 114, GumpButtonType.Reply, 0);
|
||||
AddBlackAlpha(100, 388, 241, 68);
|
||||
AddLabel(109, 391, 52, @"SMART PLAYER RANGE SENSITIVE");
|
||||
AddLabel(126, 413, 52, @"Generate Spawns' Overseer");
|
||||
AddLabel(126, 432, 52, @"Remove Spawns' Overseer");
|
||||
AddButton(109, 416, 1210, 1209, 115, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 435, 1210, 1209, 116, GumpButtonType.Reply, 0);
|
||||
//Page change
|
||||
AddLabel(207, 463, 200, @"1/3");
|
||||
AddButton(235, 465, 5601, 5605, 0, GumpButtonType.Page, 2); //advance
|
||||
|
||||
// PAGE 2
|
||||
AddPage(2);
|
||||
AddBackground(93, 68, 256, 423, 9200);
|
||||
AddHtml( 98, 75, 244, 44, " PREMIUM SPAWNER<BR>" + "by Nerun Rev.154", (bool)true, (bool)false);
|
||||
AddBlackAlpha(100, 124, 241, 114);
|
||||
AddLabel(109, 126, 52, @"SAVE SPAWNERS");
|
||||
AddLabel(126, 148, 52, @"All spawns (spawns.map)");
|
||||
AddLabel(126, 170, 52, @"'By hand' spawns (byhand.map)");
|
||||
AddLabel(126, 192, 52, @"Spawns inside region (region.map)");
|
||||
AddLabel(126, 214, 52, @"Spawns inside coordinates");
|
||||
AddButton(109, 151, 1210, 1209, 117, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 173, 1210, 1209, 118, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 195, 1210, 1209, 119, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 217, 1210, 1209, 120, GumpButtonType.Reply, 0);
|
||||
AddBlackAlpha(100, 244, 241, 134);
|
||||
AddLabel(109, 246, 52, @"REMOVE SPAWNERS");
|
||||
AddLabel(126, 268, 52, @"All spawners in ALL facets");
|
||||
AddLabel(126, 290, 52, @"All spawners in THIS facet");
|
||||
AddLabel(126, 312, 52, @"Remove spawners by SpawnID");
|
||||
AddLabel(126, 334, 52, @"Remove inside coordinates");
|
||||
AddLabel(126, 355, 52, @"Remove spawners inside region");
|
||||
AddButton(109, 271, 1210, 1209, 121, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 293, 1210, 1209, 122, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 315, 1210, 1209, 123, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 337, 1210, 1209, 124, GumpButtonType.Reply, 0);
|
||||
AddButton(109, 358, 1210, 1209, 125, GumpButtonType.Reply, 0);
|
||||
AddBlackAlpha(100, 385, 241, 71);
|
||||
AddLabel(109, 387, 52, @"EDITOR");
|
||||
AddLabel(126, 408, 52, @"Spawn Editor (edit, find and list");
|
||||
AddLabel(126, 427, 52, @"all PremiumSpawners in the world)");
|
||||
AddButton(109, 411, 1210, 1209, 126, GumpButtonType.Reply, 0);
|
||||
//Page change
|
||||
AddLabel(207, 463, 200, @"2/3");
|
||||
AddButton(189, 465, 5603, 5607, 0, GumpButtonType.Page, 1); //back
|
||||
AddButton(235, 465, 5601, 5605, 0, GumpButtonType.Page, 3); //advance
|
||||
|
||||
//PAGE 3
|
||||
AddPage(3);
|
||||
AddBackground(93, 68, 256, 423, 9200);
|
||||
AddHtml( 98, 75, 244, 44, " PREMIUM SPAWNER<BR>" + "by Nerun Rev.154", (bool)true, (bool)false);
|
||||
AddBlackAlpha(101, 124, 241, 47);
|
||||
AddLabel(109, 126, 52, @"CONVERSION UTILITY");
|
||||
AddLabel(127, 148, 52, @"RunUO Spawners to Premium");
|
||||
AddButton(110, 151, 1210, 1209, 127, GumpButtonType.Reply, 0);
|
||||
AddBlackAlpha(101, 177, 241, 134);
|
||||
AddLabel(109, 179, 52, @"CUSTOM REGIONS IN A BOX");
|
||||
AddLabel(127, 201, 52, @"Add a Region Controler");
|
||||
AddLabel(127, 222, 52, @"(double-click the Region");
|
||||
AddLabel(127, 243, 52, @"Controller to configure it region.");
|
||||
AddLabel(127, 264, 52, @"Every Controller control one");
|
||||
AddLabel(127, 286, 52, @"region. Don't forget to prop)");
|
||||
AddButton(110, 204, 1210, 1209, 128, GumpButtonType.Reply, 0);
|
||||
//Page change
|
||||
AddLabel(207, 463, 200, @"3/3");
|
||||
AddButton(189, 465, 5603, 5607, 0, GumpButtonType.Page, 2); //back
|
||||
}
|
||||
|
||||
public static void DoThis( Mobile from, string command)
|
||||
{
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
CommandSystem.Handle( from, String.Format( "{0}{1}", prefix, command ) );
|
||||
CommandSystem.Handle( from, String.Format( "{0}spawner", prefix ) );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
switch(info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
//Quit
|
||||
break;
|
||||
}
|
||||
case 101:
|
||||
{
|
||||
DoThis( from, "createworld" );
|
||||
break;
|
||||
}
|
||||
case 102:
|
||||
{
|
||||
DoThis( from, "clearall" );
|
||||
break;
|
||||
}
|
||||
case 103:
|
||||
{
|
||||
from.Say( "SPAWNING UO Classic..." );
|
||||
DoThis( from, "spawngen uoclassic/UOClassic.map" );
|
||||
break;
|
||||
}
|
||||
case 104:
|
||||
{
|
||||
DoThis( from, "SpawnUOML" );
|
||||
break;
|
||||
}
|
||||
case 105:
|
||||
{
|
||||
DoThis( from, "SpawnCurrent" );
|
||||
break;
|
||||
}
|
||||
//DoThis( from106, "" );
|
||||
//DoThis( from107, "" );
|
||||
//DoThis( from108, "" );
|
||||
case 109:
|
||||
{
|
||||
DoThis( from, "spawngen unload 1000" );
|
||||
break;
|
||||
}
|
||||
case 110:
|
||||
{
|
||||
DoThis( from, "UnloadUOML" );
|
||||
break;
|
||||
}
|
||||
case 111:
|
||||
{
|
||||
DoThis( from, "UnloadCurrent" );
|
||||
break;
|
||||
}
|
||||
//DoThis( from112, "" );
|
||||
//DoThis( from113, "" );
|
||||
//DoThis( from114, "" );
|
||||
case 115:
|
||||
{
|
||||
DoThis( from, "GenSeers" );
|
||||
break;
|
||||
}
|
||||
case 116:
|
||||
{
|
||||
DoThis( from, "RemSeers" );
|
||||
break;
|
||||
}
|
||||
case 117:
|
||||
{
|
||||
DoThis( from, "spawngen save" );
|
||||
break;
|
||||
}
|
||||
case 118:
|
||||
{
|
||||
DoThis( from, "spawngen savebyhand" );
|
||||
break;
|
||||
}
|
||||
case 119:
|
||||
{
|
||||
DoThis( from, "GumpSaveRegion" );
|
||||
break;
|
||||
}
|
||||
case 120:
|
||||
{
|
||||
DoThis( from, "GumpSaveCoordinate" );
|
||||
break;
|
||||
}
|
||||
case 121:
|
||||
{
|
||||
DoThis( from, "spawngen remove" );
|
||||
break;
|
||||
}
|
||||
case 122:
|
||||
{
|
||||
DoThis( from, "spawngen cleanfacet" );
|
||||
break;
|
||||
}
|
||||
case 123:
|
||||
{
|
||||
DoThis( from, "GumpRemoveID" );
|
||||
break;
|
||||
}
|
||||
case 124:
|
||||
{
|
||||
DoThis( from, "GumpRemoveCoordinate" );
|
||||
break;
|
||||
}
|
||||
case 125:
|
||||
{
|
||||
DoThis( from, "GumpRemoveRegion" );
|
||||
break;
|
||||
}
|
||||
case 126:
|
||||
{
|
||||
DoThis( from, "SpawnEditor" );
|
||||
break;
|
||||
}
|
||||
case 127:
|
||||
{
|
||||
DoThis( from, "RunUOSpawnerExporter" );
|
||||
break;
|
||||
}
|
||||
case 128:
|
||||
{
|
||||
DoThis( from, "Add RegionControl" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
156
Scripts/Engines/Spawner/RunUOSpawnerExporter.cs
Normal file
156
Scripts/Engines/Spawner/RunUOSpawnerExporter.cs
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
//Engine r154
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class RunUOSpawnerExporter
|
||||
{
|
||||
public const bool Enabled = true;
|
||||
|
||||
public static bool IsLinux
|
||||
{
|
||||
get
|
||||
{
|
||||
int p = (int) Environment.OSVersion.Platform;
|
||||
return (p == 4) || (p == 6) || (p == 128);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "RunUOSpawnerExporter" , AccessLevel.Administrator, new CommandEventHandler( RunUOSpawnerExporter_OnCommand ) );
|
||||
CommandSystem.Register( "RSE" , AccessLevel.Administrator, new CommandEventHandler( RunUOSpawnerExporter_OnCommand ) );
|
||||
}
|
||||
|
||||
public static int ConvertToInt( TimeSpan ts )
|
||||
{
|
||||
return ( ( ts.Hours * 60 ) + ts.Minutes + (ts.Seconds/60) );
|
||||
}
|
||||
|
||||
[Usage( "RunUOSpawnerExporter" )]
|
||||
[Aliases( "RSE" )]
|
||||
[Description( "Convert RunUO Spawners to PremiumSpawners." )]
|
||||
public static void RunUOSpawnerExporter_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
Map map = e.Mobile.Map;
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
string bar = "\\";
|
||||
|
||||
if (IsLinux == true)
|
||||
bar = "/";
|
||||
|
||||
string path = @"."+bar+"Data"+bar+"Spawns"+bar;
|
||||
|
||||
if ( !Directory.Exists( path ) )
|
||||
Directory.CreateDirectory( path );
|
||||
|
||||
using ( StreamWriter op = new StreamWriter( String.Format( path+"{0}-exported.map", map ) ) )
|
||||
{
|
||||
|
||||
if ( map == null || map == Map.Internal )
|
||||
{
|
||||
e.Mobile.SendMessage( "You may not run that command here." );
|
||||
return;
|
||||
}
|
||||
|
||||
e.Mobile.SendMessage( "Converting Spawners..." );
|
||||
|
||||
foreach ( Item item in World.Items.Values )
|
||||
{
|
||||
if ( item.Map == map && item.Parent == null && item is Spawner )
|
||||
list.Add( item );
|
||||
}
|
||||
|
||||
foreach ( Spawner spawner in list )
|
||||
{
|
||||
string mapfinal = "";
|
||||
|
||||
string walkrange = "";
|
||||
|
||||
if(map == Map.Maps[0])
|
||||
{
|
||||
mapfinal = "1";
|
||||
}
|
||||
else if(map == Map.Maps[1])
|
||||
{
|
||||
mapfinal = "2";
|
||||
}
|
||||
else if(map == Map.Maps[2])
|
||||
{
|
||||
mapfinal = "3";
|
||||
}
|
||||
else if(map == Map.Maps[3])
|
||||
{
|
||||
mapfinal = "4";
|
||||
}
|
||||
else if(map == Map.Maps[4])
|
||||
{
|
||||
mapfinal = "5";
|
||||
}
|
||||
else
|
||||
{
|
||||
mapfinal = "6";
|
||||
}
|
||||
|
||||
if( spawner.WalkingRange == -1 )
|
||||
{
|
||||
walkrange = spawner.HomeRange.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
walkrange = spawner.WalkingRange.ToString();
|
||||
}
|
||||
|
||||
int MinDelay = ConvertToInt(spawner.MinDelay);
|
||||
|
||||
if (MinDelay < 1)
|
||||
{
|
||||
MinDelay = 1;
|
||||
}
|
||||
|
||||
int MaxDelay = ConvertToInt(spawner.MaxDelay);
|
||||
|
||||
if (MaxDelay < MinDelay)
|
||||
{
|
||||
MaxDelay = MinDelay;
|
||||
}
|
||||
|
||||
string towrite = "*|";
|
||||
|
||||
if( spawner.SpawnNames.Count > 0 )
|
||||
{
|
||||
towrite = "*|" + spawner.SpawnNames[0];
|
||||
|
||||
for ( int i = 1; i < spawner.SpawnNames.Count; ++i )
|
||||
{
|
||||
towrite = towrite + ":" + spawner.SpawnNames[i].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
if ( spawner.SpawnNames.Count > 0 && spawner.Running == true )
|
||||
{
|
||||
op.WriteLine( "{0}||||||{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|1|{9}|0|0|0|0|0", towrite, spawner.X, spawner.Y, spawner.Z, mapfinal, MinDelay, MaxDelay, walkrange, spawner.HomeRange, spawner.Count);
|
||||
}
|
||||
|
||||
if( spawner.SpawnNames.Count == 0 )
|
||||
{
|
||||
op.WriteLine( "## Void: {0}||||||{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|1|{9}|0|0|0|0|0", towrite, spawner.X, spawner.Y, spawner.Z, mapfinal, MinDelay, MaxDelay, walkrange, spawner.HomeRange, spawner.Count);
|
||||
}
|
||||
|
||||
if( spawner.SpawnNames.Count > 0 && spawner.Running == false )
|
||||
{
|
||||
op.WriteLine( "## Inactive: {0}||||||{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|1|{9}|0|0|0|0|0", towrite, spawner.X, spawner.Y, spawner.Z, mapfinal, MinDelay, MaxDelay, walkrange, spawner.HomeRange, spawner.Count);
|
||||
}
|
||||
}
|
||||
e.Mobile.SendMessage( String.Format( "You exported {0} RunUO Spawner{1} from this facet.", list.Count, list.Count == 1 ? "" : "s" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1017
Scripts/Engines/Spawner/SpawnEditor.cs
Normal file
1017
Scripts/Engines/Spawner/SpawnEditor.cs
Normal file
File diff suppressed because it is too large
Load diff
646
Scripts/Engines/Spawner/SpawnGen.cs
Normal file
646
Scripts/Engines/Spawner/SpawnGen.cs
Normal file
|
|
@ -0,0 +1,646 @@
|
|||
//Engine r117
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Commands;
|
||||
using Server.Regions;
|
||||
using Server.Misc;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class SpawnGenerator
|
||||
{
|
||||
private static int m_Count;
|
||||
private static int m_MapOverride = -1;
|
||||
private static int m_IDOverride = -1;
|
||||
private static double m_MinTimeOverride = -1;
|
||||
private static double m_MaxTimeOverride = -1;
|
||||
private const bool TotalRespawn = true;
|
||||
private const int Team = 0;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "SpawnGen", AccessLevel.Administrator, new CommandEventHandler( SpawnGen_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "SpawnGen [<filename>]|[unload <id>]|[remove <region>|<rect>]|[save <region>|<rect>][savebyhand][cleanfacet]" )]
|
||||
[Description( "Complex command, it generate and remove spawners." )]
|
||||
private static void SpawnGen_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
//wrong use
|
||||
if ( e.ArgString == null || e.ArgString == "" )
|
||||
{
|
||||
e.Mobile.SendMessage( "Usage: SpawnGen [<filename>]|[remove <region>|<rect>|<ID>]|[save <region>|<rect>|<ID>]" );
|
||||
}
|
||||
//[spawngen remove and [spawngen remove region
|
||||
else if ( e.Arguments[0].ToLower() == "remove" && e.Arguments.Length == 2 )
|
||||
{
|
||||
Remove( e.Mobile, e.Arguments[1].ToLower() );
|
||||
}
|
||||
//[spawngen remove x1 y1 x2 y2
|
||||
else if ( e.Arguments[0].ToLower() == "remove" && e.Arguments.Length == 5 )
|
||||
{
|
||||
int x1 = Utility.ToInt32( e.Arguments[1] );
|
||||
int y1 = Utility.ToInt32( e.Arguments[2] );
|
||||
int x2 = Utility.ToInt32( e.Arguments[3] );
|
||||
int y2 = Utility.ToInt32( e.Arguments[4] );
|
||||
RemoveByCoord( e.Mobile, x1, y1, x2, y2 );
|
||||
}
|
||||
//[spawngen remove
|
||||
else if ( e.ArgString.ToLower() == "remove" )
|
||||
{
|
||||
Remove( e.Mobile, "" );
|
||||
}
|
||||
//[spawngen save and [spawngen save region
|
||||
else if ( e.Arguments[0].ToLower() == "save" && e.Arguments.Length == 2 )
|
||||
{
|
||||
Save( e.Mobile, e.Arguments[1].ToLower() );
|
||||
}
|
||||
//[spawngen unload SpawnID
|
||||
else if ( e.Arguments[0].ToLower() == "unload" && e.Arguments.Length == 2 )
|
||||
{
|
||||
int ID = Utility.ToInt32( e.Arguments[1] );
|
||||
Unload( ID );
|
||||
}
|
||||
//[spawngen savebyhand
|
||||
else if ( e.Arguments[0].ToLower() == "savebyhand" )
|
||||
{
|
||||
SaveByHand();
|
||||
}
|
||||
//[spawngen cleanfacet
|
||||
else if ( e.Arguments[0].ToLower() == "cleanfacet" )
|
||||
{
|
||||
CleanFacet( e.Mobile );
|
||||
}
|
||||
////[spawngen save x1 y1 x2 y2
|
||||
else if ( e.Arguments[0].ToLower() == "save" && e.Arguments.Length == 5 )
|
||||
{
|
||||
int x1 = Utility.ToInt32( e.Arguments[1] );
|
||||
int y1 = Utility.ToInt32( e.Arguments[2] );
|
||||
int x2 = Utility.ToInt32( e.Arguments[3] );
|
||||
int y2 = Utility.ToInt32( e.Arguments[4] );
|
||||
SaveByCoord( e.Mobile, x1, y1, x2, y2 );
|
||||
}
|
||||
//[spawngen save
|
||||
else if ( e.ArgString.ToLower() == "save" )
|
||||
{
|
||||
Save( e.Mobile, "" );
|
||||
}
|
||||
else
|
||||
{
|
||||
Parse( e.Mobile, e.ArgString );
|
||||
}
|
||||
}
|
||||
|
||||
public static void Talk( string alfa )
|
||||
{
|
||||
World.Broadcast( 0x35, true, "Spawns are being {0}, please wait.", alfa );
|
||||
}
|
||||
|
||||
public static string GetRegion(Item item)
|
||||
{
|
||||
Region re = Region.Find(item.Location, item.Map);
|
||||
string regname = re.ToString().ToLower();
|
||||
return regname;
|
||||
}
|
||||
|
||||
//[spawngen remove and [spawngen remove region
|
||||
private static void Remove( Mobile from, string region )
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
|
||||
if( region == null || region == "" )
|
||||
{
|
||||
CommandSystem.Handle( from, String.Format( "{0}Global remove where premiumspawner", prefix ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( Item itemdel in World.Items.Values )
|
||||
{
|
||||
if( itemdel is PremiumSpawner && itemdel.Map == from.Map )
|
||||
{
|
||||
if( GetRegion(itemdel) == region )
|
||||
{
|
||||
itemtodo.Add(itemdel);
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GenericRemove( itemtodo, count, aTime);
|
||||
}
|
||||
}
|
||||
|
||||
//[spawngen unload SpawnID
|
||||
private static void Unload( int ID )
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
|
||||
foreach ( Item itemremove in World.Items.Values )
|
||||
{
|
||||
if ( itemremove is PremiumSpawner && ((PremiumSpawner)itemremove).SpawnID == ID )
|
||||
{
|
||||
itemtodo.Add( itemremove );
|
||||
count +=1;
|
||||
}
|
||||
}
|
||||
|
||||
GenericRemove( itemtodo, count, aTime);
|
||||
}
|
||||
|
||||
//[spawngen remove x1 y1 x2 y2
|
||||
private static void RemoveByCoord( Mobile from, int x1, int y1, int x2, int y2 )
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
|
||||
foreach ( Item itemremove in World.Items.Values )
|
||||
{
|
||||
if ( itemremove is PremiumSpawner && ( ( itemremove.X >= x1 && itemremove.X <= x2 ) && ( itemremove.Y >= y1 && itemremove.Y <= y2 ) && itemremove.Map == from.Map ) )
|
||||
{
|
||||
itemtodo.Add( itemremove );
|
||||
count +=1;
|
||||
}
|
||||
}
|
||||
|
||||
GenericRemove( itemtodo, count, aTime);
|
||||
}
|
||||
|
||||
//[spawngen cleanfacet
|
||||
//this is the old [SpawnRem
|
||||
public static void CleanFacet( Mobile from )
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
|
||||
foreach ( Item itemremove in World.Items.Values )
|
||||
{
|
||||
if ( itemremove is PremiumSpawner && itemremove.Map == from.Map && itemremove.Parent == null )
|
||||
{
|
||||
itemtodo.Add( itemremove );
|
||||
count +=1;
|
||||
}
|
||||
}
|
||||
|
||||
GenericRemove( itemtodo, count, aTime);
|
||||
}
|
||||
|
||||
private static void GenericRemove( List<Item> colecao, int count, DateTime aTime )
|
||||
{
|
||||
if( colecao.Count == 0 )
|
||||
{
|
||||
World.Broadcast( 0x35, true, "There are no PremiumSpawners to be removed." );
|
||||
}
|
||||
else
|
||||
{
|
||||
Talk("removed");
|
||||
|
||||
foreach ( Item item in colecao )
|
||||
{
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
DateTime bTime = DateTime.Now;
|
||||
World.Broadcast( 0x35, true, "{0} PremiumSpawners have been removed in {1:F1} seconds.", count, (bTime - aTime).TotalSeconds );
|
||||
}
|
||||
}
|
||||
|
||||
//[spawngen save and [spawngen save region
|
||||
private static void Save( Mobile from, string region )
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
string mapanome = region;
|
||||
|
||||
if( region == "" )
|
||||
mapanome = "Spawns";
|
||||
|
||||
foreach ( Item itemsave in World.Items.Values )
|
||||
{
|
||||
if ( itemsave is PremiumSpawner && ( region == null || region == "" ) )
|
||||
{
|
||||
itemtodo.Add( itemsave );
|
||||
count +=1;
|
||||
}
|
||||
|
||||
else if ( itemsave is PremiumSpawner && itemsave.Map == from.Map )
|
||||
{
|
||||
if ( GetRegion(itemsave) == region )
|
||||
{
|
||||
itemtodo.Add( itemsave );
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GenericSave( itemtodo, mapanome, count, aTime );
|
||||
}
|
||||
|
||||
//[spawngen SaveByHand
|
||||
private static void SaveByHand()
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
string mapanome = "SpawnsByHand";
|
||||
|
||||
foreach ( Item itemsave in World.Items.Values )
|
||||
{
|
||||
if ( itemsave is PremiumSpawner && ((PremiumSpawner)itemsave).SpawnID == 1 )
|
||||
{
|
||||
itemtodo.Add( itemsave );
|
||||
count +=1;
|
||||
}
|
||||
}
|
||||
|
||||
GenericSave( itemtodo, mapanome, count, aTime );
|
||||
}
|
||||
|
||||
//[spawngen save x1 y1 x2 y2
|
||||
private static void SaveByCoord( Mobile from, int x1, int y1, int x2, int y2 )
|
||||
{
|
||||
DateTime aTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemtodo = new List<Item>();
|
||||
string mapanome = "SpawnsByCoords";
|
||||
|
||||
foreach ( Item itemsave in World.Items.Values )
|
||||
{
|
||||
if ( itemsave is PremiumSpawner && ( ( itemsave.X >= x1 && itemsave.X <= x2 ) && ( itemsave.Y >= y1 && itemsave.Y <= y2 ) && itemsave.Map == from.Map ) )
|
||||
{
|
||||
itemtodo.Add( itemsave );
|
||||
count +=1;
|
||||
}
|
||||
}
|
||||
|
||||
GenericSave( itemtodo, mapanome, count, aTime );
|
||||
}
|
||||
|
||||
private static void GenericSave( List<Item> colecao, string mapa, int count, DateTime startTime )
|
||||
{
|
||||
List<Item> itemssave = new List<Item>( colecao );
|
||||
string mapanome = mapa;
|
||||
|
||||
if( itemssave.Count == 0 )
|
||||
{
|
||||
World.Broadcast( 0x35, true, "There are no PremiumSpawners to be saved." );
|
||||
}
|
||||
else
|
||||
{
|
||||
Talk("saved");
|
||||
|
||||
if ( !Directory.Exists( "Data/Spawns" ) )
|
||||
Directory.CreateDirectory( "Data/Spawns" );
|
||||
|
||||
string escreva = "Data/Spawns/" + mapanome + ".map";
|
||||
|
||||
using ( StreamWriter op = new StreamWriter( escreva ) )
|
||||
{
|
||||
foreach ( PremiumSpawner itemsave2 in itemssave )
|
||||
{
|
||||
int mapnumber = 0;
|
||||
switch ( itemsave2.Map.ToString() )
|
||||
{
|
||||
case "Britannia":
|
||||
mapnumber = 1;
|
||||
break;
|
||||
case "Underworld":
|
||||
mapnumber = 2;
|
||||
break;
|
||||
case "Darkness":
|
||||
mapnumber = 3;
|
||||
break;
|
||||
case "Ocean":
|
||||
mapnumber = 4;
|
||||
break;
|
||||
case "Grassland":
|
||||
mapnumber = 5;
|
||||
break;
|
||||
default:
|
||||
mapnumber = 6;
|
||||
Console.WriteLine( "Monster Parser: Warning, unknown map {0}", itemsave2.Map );
|
||||
break;
|
||||
}
|
||||
|
||||
string timer1a = itemsave2.MinDelay.ToString();
|
||||
string[] timer1b = timer1a.Split( ':' ); //Broke the string hh:mm:ss in an array (hh, mm, ss)
|
||||
int timer1c = ( Utility.ToInt32( timer1b[0] ) * 60 ) + Utility.ToInt32( timer1b[1] ); //multiply hh * 60 to find mm, then add mm
|
||||
string timer1d = timer1c.ToString();
|
||||
if ( Utility.ToInt32( timer1b[0] ) == 0 && Utility.ToInt32( timer1b[1] ) == 0 ) //If hh and mm are 0, use seconds, else drop ss
|
||||
timer1d = Utility.ToInt32( timer1b[2] ) + "s";
|
||||
|
||||
string timer2a = itemsave2.MaxDelay.ToString();
|
||||
string[] timer2b = timer2a.Split( ':' );
|
||||
int timer2c = ( Utility.ToInt32( timer2b[0] ) * 60 ) + Utility.ToInt32( timer2b[1] );
|
||||
string timer2d = timer2c.ToString();
|
||||
if ( Utility.ToInt32( timer2b[0] ) == 0 && Utility.ToInt32( timer2b[1] ) == 0 )
|
||||
timer2d = Utility.ToInt32( timer2b[2] ) + "s";
|
||||
|
||||
string towrite = "";
|
||||
string towriteA = "";
|
||||
string towriteB = "";
|
||||
string towriteC = "";
|
||||
string towriteD = "";
|
||||
string towriteE = "";
|
||||
|
||||
if ( itemsave2.CreaturesName.Count > 0 )
|
||||
towrite = itemsave2.CreaturesName[0].ToString();
|
||||
|
||||
if ( itemsave2.SubSpawnerA.Count > 0 )
|
||||
towriteA = itemsave2.SubSpawnerA[0].ToString();
|
||||
|
||||
if ( itemsave2.SubSpawnerB.Count > 0 )
|
||||
towriteB = itemsave2.SubSpawnerB[0].ToString();
|
||||
|
||||
if ( itemsave2.SubSpawnerC.Count > 0 )
|
||||
towriteC = itemsave2.SubSpawnerC[0].ToString();
|
||||
|
||||
if ( itemsave2.SubSpawnerD.Count > 0 )
|
||||
towriteD = itemsave2.SubSpawnerD[0].ToString();
|
||||
|
||||
if ( itemsave2.SubSpawnerE.Count > 0 )
|
||||
towriteE = itemsave2.SubSpawnerE[0].ToString();
|
||||
|
||||
for ( int i = 1; i < itemsave2.CreaturesName.Count; ++i )
|
||||
{
|
||||
if ( itemsave2.CreaturesName.Count > 0 )
|
||||
towrite = towrite + ":" + itemsave2.CreaturesName[i].ToString();
|
||||
}
|
||||
|
||||
for ( int i = 1; i < itemsave2.SubSpawnerA.Count; ++i )
|
||||
{
|
||||
if ( itemsave2.SubSpawnerA.Count > 0 )
|
||||
towriteA = towriteA + ":" + itemsave2.SubSpawnerA[i].ToString();
|
||||
}
|
||||
|
||||
for ( int i = 1; i < itemsave2.SubSpawnerB.Count; ++i )
|
||||
{
|
||||
if ( itemsave2.SubSpawnerB.Count > 0 )
|
||||
towriteB = towriteB + ":" + itemsave2.SubSpawnerB[i].ToString();
|
||||
}
|
||||
|
||||
for ( int i = 1; i < itemsave2.SubSpawnerC.Count; ++i )
|
||||
{
|
||||
if ( itemsave2.SubSpawnerC.Count > 0 )
|
||||
towriteC = towriteC + ":" + itemsave2.SubSpawnerC[i].ToString();
|
||||
}
|
||||
|
||||
for ( int i = 1; i < itemsave2.SubSpawnerD.Count; ++i )
|
||||
{
|
||||
if ( itemsave2.SubSpawnerD.Count > 0 )
|
||||
towriteD = towriteD + ":" + itemsave2.SubSpawnerD[i].ToString();
|
||||
}
|
||||
|
||||
for ( int i = 1; i < itemsave2.SubSpawnerE.Count; ++i )
|
||||
{
|
||||
if ( itemsave2.SubSpawnerE.Count > 0 )
|
||||
towriteE = towriteE + ":" + itemsave2.SubSpawnerE[i].ToString();
|
||||
}
|
||||
|
||||
op.WriteLine( "*|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}", towrite, towriteA, towriteB, towriteC, towriteD, towriteE, itemsave2.X, itemsave2.Y, itemsave2.Z, mapnumber, timer1d, timer2d, itemsave2.WalkingRange, itemsave2.HomeRange, itemsave2.SpawnID, itemsave2.Count, itemsave2.CountA, itemsave2.CountB, itemsave2.CountC, itemsave2.CountD, itemsave2.CountE );
|
||||
}
|
||||
}
|
||||
|
||||
DateTime endTime = DateTime.Now;
|
||||
World.Broadcast( 0x35, true, "{0} spawns have been saved. The entire process took {1:F1} seconds.", count, (endTime - startTime).TotalSeconds );
|
||||
}
|
||||
}
|
||||
|
||||
public static void Parse( Mobile from, string filename )
|
||||
{
|
||||
string monster_path1 = Path.Combine( Core.BaseDirectory, "Data/Spawns" );
|
||||
string monster_path = Path.Combine( monster_path1, filename );
|
||||
m_Count = 0;
|
||||
|
||||
if ( File.Exists( monster_path ) )
|
||||
{
|
||||
from.SendMessage( "Spawning {0}...", filename );
|
||||
m_MapOverride = -1;
|
||||
m_IDOverride = -1;
|
||||
m_MinTimeOverride = -1;
|
||||
m_MaxTimeOverride = -1;
|
||||
|
||||
using ( StreamReader ip = new StreamReader( monster_path ) )
|
||||
{
|
||||
string line;
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
{
|
||||
string[] split = line.Split( '|' );
|
||||
string[] splitA = line.Split( ' ' );
|
||||
|
||||
if ( splitA.Length == 2 )
|
||||
{
|
||||
if ( splitA[0].ToLower() == "overridemap" )
|
||||
m_MapOverride = Utility.ToInt32( splitA[1] );
|
||||
if ( splitA[0].ToLower() == "overrideid" )
|
||||
m_IDOverride = Utility.ToInt32( splitA[1] );
|
||||
if ( splitA[0].ToLower() == "overridemintime" )
|
||||
m_MinTimeOverride = Utility.ToDouble( splitA[1] );
|
||||
if ( splitA[0].ToLower() == "overridemaxtime" )
|
||||
m_MaxTimeOverride = Utility.ToDouble( splitA[1] );
|
||||
}
|
||||
|
||||
if ( split.Length < 19 )
|
||||
continue;
|
||||
|
||||
switch( split[0].ToLower() )
|
||||
{
|
||||
//Comment Line
|
||||
case "##":
|
||||
break;
|
||||
//Place By class
|
||||
case "*":
|
||||
PlaceNPC( split[2].Split(':'), split[3].Split(':'), split[4].Split(':'), split[5].Split(':'), split[6].Split(':'), split[7], split[8], split[9], split[10], split[11], split[12], split[14], split[13], split[15], split[16], split[17], split[18], split[19], split[20], split[21], split[1].Split(':') );
|
||||
break;
|
||||
//Place By Type
|
||||
case "r":
|
||||
PlaceNPC( split[2].Split(':'), split[3].Split(':'), split[4].Split(':'), split[5].Split(':'), split[6].Split(':'), split[7], split[8], split[9], split[10], split[11], split[12], split[14], split[13], split[15], split[16], split[17], split[18], split[19], split[20], split[1], "bloodmoss", "sulfurousash", "spiderssilk", "mandrakeroot", "gravedust", "nightshade", "ginseng", "garlic", "batwing", "pigiron", "noxcrystal", "daemonblood", "blackpearl");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_MapOverride = -1;
|
||||
m_IDOverride = -1;
|
||||
m_MinTimeOverride = -1;
|
||||
m_MaxTimeOverride = -1;
|
||||
|
||||
from.SendMessage( "Done, added {0} spawners",m_Count );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "{0} not found!", monster_path );
|
||||
}
|
||||
}
|
||||
|
||||
public static void PlaceNPC( string[] fakespawnsA, string[] fakespawnsB, string[] fakespawnsC, string[] fakespawnsD, string[] fakespawnsE, string sx, string sy, string sz, string sm, string smintime, string smaxtime, string swalkingrange, string shomerange, string sspawnid, string snpccount, string sfakecountA, string sfakecountB, string sfakecountC, string sfakecountD, string sfakecountE, params string[] types )
|
||||
{
|
||||
if ( types.Length == 0 )
|
||||
return;
|
||||
|
||||
int x = Utility.ToInt32( sx );
|
||||
int y = Utility.ToInt32( sy );
|
||||
int z = Utility.ToInt32( sz );
|
||||
int map = Utility.ToInt32( sm );
|
||||
|
||||
//MinTime
|
||||
string samintime = smintime;
|
||||
|
||||
if ( smintime.Contains("s") || smintime.Contains("m") || smintime.Contains("h") )
|
||||
samintime = smintime.Remove(smintime.Length - 1);
|
||||
|
||||
if ( samintime == "888" )
|
||||
samintime = (Settings.MonsterSpawn()).ToString();
|
||||
else if ( samintime == "999" )
|
||||
samintime = (Settings.BossSpawn()).ToString();
|
||||
|
||||
double dmintime = Utility.ToDouble( samintime );
|
||||
|
||||
if ( m_MinTimeOverride != -1 )
|
||||
dmintime = m_MinTimeOverride;
|
||||
|
||||
TimeSpan mintime = TimeSpan.FromMinutes( dmintime );
|
||||
|
||||
if ( smintime.Contains("s") )
|
||||
mintime = TimeSpan.FromSeconds( dmintime );
|
||||
else if ( smintime.Contains("m") )
|
||||
mintime = TimeSpan.FromMinutes( dmintime );
|
||||
else if ( smintime.Contains("h") )
|
||||
mintime = TimeSpan.FromHours( dmintime );
|
||||
|
||||
//MaxTime
|
||||
|
||||
string samaxtime = smaxtime;
|
||||
|
||||
if ( smaxtime.Contains("s") || smaxtime.Contains("m") || smaxtime.Contains("h") )
|
||||
samaxtime = smaxtime.Remove(smaxtime.Length - 1);
|
||||
|
||||
if ( smaxtime == "888" )
|
||||
samaxtime = (Settings.MonsterSpawn()+30).ToString();
|
||||
else if ( smaxtime == "999" )
|
||||
samaxtime = (Settings.BossSpawn()+30).ToString();
|
||||
|
||||
double dmaxtime = Utility.ToDouble( samaxtime );
|
||||
|
||||
if ( m_MaxTimeOverride != -1 )
|
||||
{
|
||||
if ( m_MaxTimeOverride < dmintime )
|
||||
dmaxtime = dmintime;
|
||||
else
|
||||
dmaxtime = m_MaxTimeOverride;
|
||||
}
|
||||
|
||||
TimeSpan maxtime = TimeSpan.FromMinutes( dmaxtime );
|
||||
|
||||
if ( smaxtime.Contains("s") )
|
||||
maxtime = TimeSpan.FromSeconds( dmaxtime );
|
||||
else if ( smaxtime.Contains("m") )
|
||||
maxtime = TimeSpan.FromMinutes( dmaxtime );
|
||||
else if ( smaxtime.Contains("h") )
|
||||
maxtime = TimeSpan.FromHours( dmaxtime );
|
||||
|
||||
//
|
||||
int homerange = Utility.ToInt32( shomerange );
|
||||
int walkingrange = Utility.ToInt32( swalkingrange );
|
||||
int spawnid = Utility.ToInt32( sspawnid );
|
||||
int npccount = Utility.ToInt32( snpccount );
|
||||
int fakecountA = Utility.ToInt32( sfakecountA );
|
||||
int fakecountB = Utility.ToInt32( sfakecountB );
|
||||
int fakecountC = Utility.ToInt32( sfakecountC );
|
||||
int fakecountD = Utility.ToInt32( sfakecountD );
|
||||
int fakecountE = Utility.ToInt32( sfakecountE );
|
||||
|
||||
if ( m_MapOverride != -1 )
|
||||
map = m_MapOverride;
|
||||
|
||||
if ( m_IDOverride != -1 )
|
||||
spawnid = m_IDOverride;
|
||||
|
||||
switch ( map )
|
||||
{
|
||||
case 1:
|
||||
MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Britannia, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE );
|
||||
break;
|
||||
case 2:
|
||||
MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Underworld, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE );
|
||||
break;
|
||||
case 3:
|
||||
MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Darkness, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE );
|
||||
break;
|
||||
case 4:
|
||||
MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Ocean, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE );
|
||||
break;
|
||||
case 5:
|
||||
MakeSpawner( types, fakespawnsA, fakespawnsB, fakespawnsC, fakespawnsD, fakespawnsE, x, y, z, Map.Grassland, mintime, maxtime, walkingrange, homerange, spawnid, npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE );
|
||||
break;
|
||||
|
||||
default:
|
||||
Console.WriteLine( "Spawn Parser: Warning, unknown map {0}", map );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void MakeSpawner( string[] types, string[] fakespawnsA, string[] fakespawnsB, string[] fakespawnsC, string[] fakespawnsD, string[] fakespawnsE, int x, int y, int z, Map map, TimeSpan mintime, TimeSpan maxtime, int walkingrange, int homerange, int spawnid, int npccount, int fakecountA, int fakecountB, int fakecountC, int fakecountD, int fakecountE )
|
||||
{
|
||||
if ( types.Length == 0 )
|
||||
return;
|
||||
|
||||
List<string> tipos = new List<string>( types );
|
||||
List<string> noneA = new List<string>();
|
||||
List<string> noneB = new List<string>();
|
||||
List<string> noneC = new List<string>();
|
||||
List<string> noneD = new List<string>();
|
||||
List<string> noneE = new List<string>();
|
||||
|
||||
if ( fakespawnsA[0] != "" )
|
||||
noneA = new List<string>( fakespawnsA );
|
||||
|
||||
if ( fakespawnsB[0] != "" )
|
||||
noneB = new List<string>( fakespawnsB );
|
||||
|
||||
if ( fakespawnsC[0] != "" )
|
||||
noneC = new List<string>( fakespawnsC );
|
||||
|
||||
if ( fakespawnsD[0] != "" )
|
||||
noneD = new List<string>( fakespawnsD );
|
||||
|
||||
if ( fakespawnsE[0] != "" )
|
||||
noneE = new List<string>( fakespawnsE );
|
||||
|
||||
PremiumSpawner spawner = new PremiumSpawner( npccount, fakecountA, fakecountB, fakecountC, fakecountD, fakecountE, spawnid, mintime, maxtime, Team, walkingrange, homerange, tipos, noneA, noneB, noneC, noneD, noneE );
|
||||
|
||||
spawner.MoveToWorld( new Point3D( x, y, z ), map );
|
||||
spawner.Land = spawner.Map;
|
||||
spawner.Spot = spawner.Location;
|
||||
spawner.Layer = Layer.Talisman;
|
||||
|
||||
if ( TotalRespawn )
|
||||
{
|
||||
spawner.Respawn();
|
||||
|
||||
if ( ((PremiumSpawner)spawner).SpawnID == 132 ) // if is ChampionSpawn
|
||||
{
|
||||
spawner.BringToHome();
|
||||
}
|
||||
}
|
||||
|
||||
m_Count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
412
Scripts/Engines/Spawner/SpawnMaps.cs
Normal file
412
Scripts/Engines/Spawner/SpawnMaps.cs
Normal file
|
|
@ -0,0 +1,412 @@
|
|||
// Engine r133
|
||||
#define RunUo2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class SpawnCurrentGump : Gump
|
||||
{
|
||||
Mobile caller;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
#if(RunUo2_0)
|
||||
CommandSystem.Register("SpawnCurrent", AccessLevel.Administrator, new CommandEventHandler(SpawnCurrent_OnCommand));
|
||||
#else
|
||||
Register("SpawnCurrent", AccessLevel.Administrator, new CommandEventHandler(SpawnCurrent_OnCommand));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Usage("SpawnCurrent")]
|
||||
[Description("Generate PremiumSpawners around the world with a gump.")]
|
||||
public static void SpawnCurrent_OnCommand(CommandEventArgs e)
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
if (from.HasGump(typeof(SpawnCurrentGump)))
|
||||
from.CloseGump(typeof(SpawnCurrentGump));
|
||||
from.SendGump(new SpawnCurrentGump(from));
|
||||
}
|
||||
|
||||
public SpawnCurrentGump(Mobile from) : this()
|
||||
{
|
||||
caller = from;
|
||||
}
|
||||
|
||||
public void AddBlackAlpha( int x, int y, int width, int height )
|
||||
{
|
||||
AddImageTiled( x, y, width, height, 2624 );
|
||||
AddAlphaRegion( x, y, width, height );
|
||||
}
|
||||
|
||||
public SpawnCurrentGump() : base( 30, 30 )
|
||||
{
|
||||
this.Closable=true;
|
||||
this.Disposable=true;
|
||||
this.Dragable=true;
|
||||
AddPage(1);
|
||||
AddBackground(58, 22, 474, 540, 9200);
|
||||
AddImage(305, 306, 1418); // Castle
|
||||
AddBlackAlpha(66, 30, 458, 33);
|
||||
AddLabel(213, 37, 52, @"SELECT MAPS TO SPAWN");
|
||||
AddBlackAlpha(66, 87, 239, 447);
|
||||
AddLabel(69, 67, 200, @"DUNGEONS");
|
||||
AddLabel(69, 90, 52, @"Blighted Grove");
|
||||
AddLabel(69, 112, 52, @"Britain Sewer");
|
||||
AddLabel(69, 133, 52, @"Covetous");
|
||||
AddLabel(69, 154, 52, @"Deceit");
|
||||
AddLabel(69, 174, 52, @"Despise");
|
||||
AddLabel(69, 196, 52, @"Destard");
|
||||
AddLabel(69, 217, 52, @"Fire");
|
||||
AddLabel(69, 237, 52, @"Graveyards");
|
||||
AddLabel(69, 258, 52, @"Hythloth");
|
||||
AddLabel(69, 280, 52, @"Ice");
|
||||
AddLabel(69, 301, 52, @"Khaldun");
|
||||
AddLabel(69, 322, 52, @"Orc Caves");
|
||||
AddLabel(69, 343, 52, @"Painted Caves");
|
||||
AddLabel(69, 363, 52, @"Palace of Paroxysmus");
|
||||
AddLabel(69, 384, 52, @"Prism of Light");
|
||||
AddLabel(69, 405, 52, @"Sanctuary");
|
||||
AddLabel(69, 427, 52, @"Shame");
|
||||
AddLabel(69, 448, 52, @"Solen Hive");
|
||||
AddLabel(69, 469, 52, @"Terathan Keep");
|
||||
AddLabel(69, 489, 52, @"Trinsic Passage");
|
||||
AddLabel(69, 510, 52, @"Wrong");
|
||||
AddLabel(194, 66, 200, @"Felucca");
|
||||
AddCheck(210, 91, 210, 211, true, 201);
|
||||
AddCheck(210, 112, 210, 211, true, 202);
|
||||
AddCheck(210, 133, 210, 211, true, 203);
|
||||
AddCheck(210, 154, 210, 211, true, 204);
|
||||
AddCheck(210, 175, 210, 211, true, 205);
|
||||
AddCheck(210, 196, 210, 211, true, 206);
|
||||
AddCheck(210, 217, 210, 211, true, 207);
|
||||
AddCheck(210, 238, 210, 211, true, 208);
|
||||
AddCheck(210, 259, 210, 211, true, 209);
|
||||
AddCheck(210, 280, 210, 211, true, 210);
|
||||
AddCheck(210, 301, 210, 211, true, 228);
|
||||
AddCheck(210, 322, 210, 211, true, 212);
|
||||
AddCheck(210, 343, 210, 211, true, 214);
|
||||
AddCheck(210, 364, 210, 211, true, 215);
|
||||
AddCheck(210, 385, 210, 211, true, 216);
|
||||
AddCheck(210, 406, 210, 211, true, 217);
|
||||
AddCheck(210, 427, 210, 211, true, 219);
|
||||
AddCheck(210, 448, 210, 211, true, 220);
|
||||
AddCheck(210, 469, 210, 211, true, 221);
|
||||
AddCheck(210, 490, 210, 211, true, 224);
|
||||
AddCheck(210, 511, 210, 211, true, 227);
|
||||
AddLabel(250, 66, 200, @"Trammel");
|
||||
AddCheck(268, 91, 210, 211, true, 101);
|
||||
AddCheck(268, 112, 210, 211, true, 102);
|
||||
AddCheck(268, 133, 210, 211, true, 103);
|
||||
AddCheck(268, 154, 210, 211, true, 104);
|
||||
AddCheck(268, 175, 210, 211, true, 105);
|
||||
AddCheck(268, 196, 210, 211, true, 106);
|
||||
AddCheck(268, 217, 210, 211, true, 107);
|
||||
AddCheck(268, 238, 210, 211, true, 108);
|
||||
AddCheck(268, 259, 210, 211, true, 109);
|
||||
AddCheck(268, 280, 210, 211, true, 110);
|
||||
//There is no Khaldun in Trammel (ID 128 reserved)
|
||||
AddCheck(268, 322, 210, 211, true, 112);
|
||||
AddCheck(268, 343, 210, 211, true, 114);
|
||||
AddCheck(268, 364, 210, 211, true, 115);
|
||||
AddCheck(268, 385, 210, 211, true, 116);
|
||||
AddCheck(268, 406, 210, 211, true, 117);
|
||||
AddCheck(268, 427, 210, 211, true, 119);
|
||||
AddCheck(268, 448, 210, 211, true, 120);
|
||||
AddCheck(268, 469, 210, 211, true, 121);
|
||||
AddCheck(268, 490, 210, 211, true, 124);
|
||||
AddCheck(268, 511, 210, 211, true, 127);
|
||||
AddBlackAlpha(311, 87, 213, 70);
|
||||
AddLabel(315, 67, 200, @"TOWNS");
|
||||
AddLabel(315, 91, 52, @"Animals");
|
||||
AddLabel(315, 112, 52, @"People (*)");
|
||||
AddLabel(315, 133, 52, @"Vendors");
|
||||
AddLabel(413, 66, 200, @"Felucca");
|
||||
AddCheck(429, 91, 210, 211, true, 222);
|
||||
AddCheck(429, 112, 210, 211, true, 223);
|
||||
AddCheck(429, 133, 210, 211, true, 225);
|
||||
AddLabel(469, 66, 200, @"Trammel");
|
||||
AddCheck(487, 91, 210, 211, true, 122);
|
||||
AddCheck(487, 112, 210, 211, true, 123);
|
||||
AddCheck(487, 133, 210, 211, true, 125);
|
||||
AddBlackAlpha(311, 183, 213, 114);
|
||||
AddLabel(315, 162, 200, @"OUTDOORS");
|
||||
AddLabel(316, 187, 52, @"Animals");
|
||||
AddLabel(316, 207, 52, @"Lost Lands");
|
||||
AddLabel(316, 229, 52, @"Spawns");
|
||||
AddLabel(316, 249, 52, @"Reagents");
|
||||
AddLabel(316, 270, 52, @"Sea Life");
|
||||
AddLabel(413, 162, 200, @"Felucca");
|
||||
AddCheck(429, 187, 210, 211, true, 226);
|
||||
AddCheck(429, 208, 210, 211, true, 211);
|
||||
AddCheck(429, 229, 210, 211, true, 213);
|
||||
AddCheck(429, 250, 210, 211, true, 229);
|
||||
AddCheck(429, 271, 210, 211, true, 218);
|
||||
AddLabel(469, 162, 200, @"Trammel");
|
||||
AddCheck(487, 187, 210, 211, true, 126);
|
||||
AddCheck(487, 208, 210, 211, true, 111);
|
||||
AddCheck(487, 229, 210, 211, true, 113);
|
||||
AddCheck(487, 250, 210, 211, true, 129);
|
||||
AddCheck(487, 271, 210, 211, true, 118);
|
||||
AddLabel(316, 305, 200, @"(*) Escortables, Hireables,");
|
||||
AddLabel(316, 324, 200, @"Town Criers, Order and Chaos");
|
||||
AddLabel(316, 344, 200, @"guards etc.");
|
||||
// END
|
||||
AddLabel(361, 453, 52, @"Page: 1/2"); //Page
|
||||
AddButton(423, 455, 5601, 5605, 0, GumpButtonType.Page, 2); // Change Page
|
||||
|
||||
//PAGE 2
|
||||
AddPage(2);
|
||||
AddBackground(58, 22, 474, 540, 9200);
|
||||
AddImage(305, 306, 1418); // Castle
|
||||
AddBlackAlpha(66, 30, 458, 33);
|
||||
AddLabel(213, 37, 52, @"SELECT MAPS TO SPAWN");
|
||||
AddBlackAlpha(66, 87, 174, 300);
|
||||
AddLabel(74, 67, 200, @"ILSHENAR");
|
||||
AddLabel(74, 90, 52, @"Ancient Lair");
|
||||
AddLabel(74, 112, 52, @"Ankh");
|
||||
AddLabel(74, 133, 52, @"Blood");
|
||||
AddLabel(74, 154, 52, @"Exodus");
|
||||
AddLabel(74, 174, 52, @"Mushroom");
|
||||
AddLabel(74, 196, 52, @"Outdoors");
|
||||
AddLabel(74, 217, 52, @"Ratman Cave");
|
||||
AddLabel(74, 237, 52, @"Rock");
|
||||
AddLabel(74, 258, 52, @"Sorcerers");
|
||||
AddLabel(74, 280, 52, @"Spectre");
|
||||
AddLabel(74, 301, 52, @"Towns");
|
||||
AddLabel(74, 322, 52, @"Twisted Weald");
|
||||
AddLabel(74, 343, 52, @"Vendors");
|
||||
AddLabel(74, 363, 52, @"Wisp");
|
||||
AddCheck(215, 91, 210, 211, true, 301);
|
||||
AddCheck(215, 112, 210, 211, true, 302);
|
||||
AddCheck(215, 133, 210, 211, true, 303);
|
||||
AddCheck(215, 154, 210, 211, true, 304);
|
||||
AddCheck(215, 175, 210, 211, true, 305);
|
||||
AddCheck(215, 196, 210, 211, true, 306);
|
||||
AddCheck(215, 217, 210, 211, true, 307);
|
||||
AddCheck(215, 238, 210, 211, true, 308);
|
||||
AddCheck(215, 259, 210, 211, true, 309);
|
||||
AddCheck(215, 280, 210, 211, true, 310);
|
||||
AddCheck(215, 301, 210, 211, true, 311);
|
||||
AddCheck(215, 322, 210, 211, true, 314);
|
||||
AddCheck(215, 343, 210, 211, true, 312);
|
||||
AddCheck(215, 364, 210, 211, true, 313);
|
||||
AddBlackAlpha(66, 414, 174, 133);
|
||||
AddLabel(74, 393, 200, @"TOKUNO");
|
||||
AddLabel(74, 416, 52, @"Fan Dancers Dojo");
|
||||
AddLabel(74, 438, 52, @"Outdoors");
|
||||
AddLabel(74, 459, 52, @"Towns Life");
|
||||
AddLabel(74, 480, 52, @"Vendors");
|
||||
AddLabel(74, 500, 52, @"Wild Life");
|
||||
AddLabel(74, 522, 52, @"Yomutso Mines");
|
||||
AddCheck(215, 417, 210, 211, true, 501);
|
||||
AddCheck(215, 438, 210, 211, true, 502);
|
||||
AddCheck(215, 459, 210, 211, true, 503);
|
||||
AddCheck(215, 480, 210, 211, true, 504);
|
||||
AddCheck(215, 501, 210, 211, true, 505);
|
||||
AddCheck(215, 522, 210, 211, true, 506);
|
||||
AddBlackAlpha(246, 87, 174, 178);
|
||||
AddLabel(253, 67, 200, @"MALAS");
|
||||
AddLabel(253, 90, 52, @"Bedlam");
|
||||
AddLabel(253, 112, 52, @"Citadel");
|
||||
AddLabel(253, 133, 52, @"Doom");
|
||||
AddLabel(253, 154, 52, @"Labyrinth");
|
||||
AddLabel(253, 174, 52, @"North (*)");
|
||||
AddLabel(253, 196, 52, @"Orc Forts");
|
||||
AddLabel(253, 217, 52, @"South (*)");
|
||||
AddLabel(253, 238, 52, @"Vendors");
|
||||
AddCheck(394, 91, 210, 211, true, 408);
|
||||
AddCheck(394, 112, 210, 211, true, 406);
|
||||
AddCheck(394, 133, 210, 211, true, 401);
|
||||
AddCheck(394, 154, 210, 211, true, 407);
|
||||
AddCheck(394, 175, 210, 211, true, 402);
|
||||
AddCheck(394, 196, 210, 211, true, 403);
|
||||
AddCheck(394, 217, 210, 211, true, 404);
|
||||
AddCheck(394, 238, 210, 211, true, 405);
|
||||
AddLabel(428, 91, 200, @"(*) Wild");
|
||||
AddLabel(428, 109, 200, @"Animals and");
|
||||
AddLabel(428, 129, 200, @"monsters.");
|
||||
AddBlackAlpha(246, 292, 174, 117);
|
||||
AddLabel(253, 272, 200, @"TER MUR");
|
||||
AddLabel(253, 295, 52, @"Abyss");
|
||||
AddLabel(253, 316, 52, @"TerMur");
|
||||
AddLabel(253, 337, 52, @"Underworld");
|
||||
AddLabel(253, 358, 52, @"Vendors");
|
||||
AddCheck(394, 296, 210, 211, true, 601);
|
||||
AddCheck(394, 317, 210, 211, true, 602);
|
||||
AddCheck(394, 338, 210, 211, true, 603);
|
||||
AddCheck(394, 359, 210, 211, true, 604);
|
||||
//END
|
||||
AddLabel(381, 453, 52, @"Page: 2/2"); //Page
|
||||
AddButton(361, 455, 5603, 5607, 0, GumpButtonType.Page, 1); //Change Page
|
||||
AddButton(282, 452, 240, 239, 1, GumpButtonType.Reply, 0); // Apply
|
||||
}
|
||||
|
||||
public static void SpawnThis( Mobile from, List<int> ListSwitches, int switche, int map, string mapfile)
|
||||
{
|
||||
string folder = "";
|
||||
|
||||
if( map == 1 )
|
||||
folder = "felucca";
|
||||
else if( map == 2)
|
||||
folder = "trammel";
|
||||
else if( map == 3)
|
||||
folder = "ilshenar";
|
||||
else if( map == 4)
|
||||
folder = "malas";
|
||||
else if( map == 5)
|
||||
folder = "tokuno";
|
||||
else if( map == 6)
|
||||
folder = "termur";
|
||||
|
||||
string prefix = Server.Commands.CommandSystem.Prefix;
|
||||
|
||||
if( ListSwitches.Contains( switche ) == true )
|
||||
CommandSystem.Handle( from, String.Format( "{0}Spawngen {1}/{2}.map", prefix, folder, mapfile ) );
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile from = sender.Mobile;
|
||||
|
||||
switch(info.ButtonID)
|
||||
{
|
||||
case 0: //Closed or Cancel
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Make sure that the APPLY button was pressed
|
||||
if( info.ButtonID == 1 )
|
||||
{
|
||||
// Get the array of switches selected
|
||||
List<int> Selections = new List<int>( info.Switches );
|
||||
|
||||
//TRAMMEL
|
||||
from.Say( "SPAWNING TRAMMEL..." );
|
||||
// DUNGEONS
|
||||
SpawnThis(from, Selections, 101, 2, "BlightedGrove");
|
||||
SpawnThis(from, Selections, 102, 2, "BritainSewer");
|
||||
SpawnThis(from, Selections, 103, 2, "Covetous");
|
||||
SpawnThis(from, Selections, 104, 2, "Deceit");
|
||||
SpawnThis(from, Selections, 105, 2, "Despise");
|
||||
SpawnThis(from, Selections, 106, 2, "Destard");
|
||||
SpawnThis(from, Selections, 107, 2, "Fire");
|
||||
SpawnThis(from, Selections, 108, 2, "Graveyards");
|
||||
SpawnThis(from, Selections, 109, 2, "Hythloth");
|
||||
SpawnThis(from, Selections, 110, 2, "Ice");
|
||||
//There is no Khaldun (118)
|
||||
SpawnThis(from, Selections, 112, 2, "OrcCaves");
|
||||
SpawnThis(from, Selections, 114, 2, "PaintedCaves");
|
||||
SpawnThis(from, Selections, 115, 2, "PalaceOfParoxysmus");
|
||||
SpawnThis(from, Selections, 116, 2, "PrismOfLight");
|
||||
SpawnThis(from, Selections, 117, 2, "Sanctuary");
|
||||
SpawnThis(from, Selections, 119, 2, "Shame");
|
||||
SpawnThis(from, Selections, 120, 2, "SolenHive");
|
||||
SpawnThis(from, Selections, 121, 2, "TerathanKeep");
|
||||
SpawnThis(from, Selections, 124, 2, "TrinsicPassage");
|
||||
SpawnThis(from, Selections, 127, 2, "Wrong");
|
||||
//TOWNS
|
||||
SpawnThis(from, Selections, 122, 2, "TownsLife");
|
||||
SpawnThis(from, Selections, 123, 2, "TownsPeople");
|
||||
SpawnThis(from, Selections, 125, 2, "Vendors");
|
||||
//OUTDOORS
|
||||
SpawnThis(from, Selections, 126, 2, "WildLife");
|
||||
SpawnThis(from, Selections, 111, 2, "LostLands");
|
||||
SpawnThis(from, Selections, 113, 2, "Outdoors");
|
||||
SpawnThis(from, Selections, 129, 2, "Reagents");
|
||||
SpawnThis(from, Selections, 118, 2, "SeaLife");
|
||||
|
||||
//FELUCCA
|
||||
from.Say( "SPAWNING FELUCCA..." );
|
||||
// DUNGEONS
|
||||
SpawnThis(from, Selections, 201, 1, "BlightedGrove");
|
||||
SpawnThis(from, Selections, 202, 1, "BritainSewer");
|
||||
SpawnThis(from, Selections, 203, 1, "Covetous");
|
||||
SpawnThis(from, Selections, 204, 1, "Deceit");
|
||||
SpawnThis(from, Selections, 205, 1, "Despise");
|
||||
SpawnThis(from, Selections, 206, 1, "Destard");
|
||||
SpawnThis(from, Selections, 207, 1, "Fire");
|
||||
SpawnThis(from, Selections, 208, 1, "Graveyards");
|
||||
SpawnThis(from, Selections, 209, 1, "Hythloth");
|
||||
SpawnThis(from, Selections, 210, 1, "Ice");
|
||||
SpawnThis(from, Selections, 229, 1, "Khaldun");
|
||||
SpawnThis(from, Selections, 212, 1, "OrcCaves");
|
||||
SpawnThis(from, Selections, 214, 1, "PaintedCaves");
|
||||
SpawnThis(from, Selections, 215, 1, "PalaceOfParoxysmus");
|
||||
SpawnThis(from, Selections, 216, 1, "PrismOfLight");
|
||||
SpawnThis(from, Selections, 217, 1, "Sanctuary");
|
||||
SpawnThis(from, Selections, 219, 1, "Shame");
|
||||
SpawnThis(from, Selections, 220, 1, "SolenHive");
|
||||
SpawnThis(from, Selections, 221, 1, "TerathanKeep");
|
||||
SpawnThis(from, Selections, 224, 1, "TrinsicPassage");
|
||||
SpawnThis(from, Selections, 227, 1, "Wrong");
|
||||
//TOWNS
|
||||
SpawnThis(from, Selections, 222, 1, "TownsLife");
|
||||
SpawnThis(from, Selections, 223, 1, "TownsPeople");
|
||||
SpawnThis(from, Selections, 225, 1, "Vendors");
|
||||
//OUTDOORS
|
||||
SpawnThis(from, Selections, 226, 1, "WildLife");
|
||||
SpawnThis(from, Selections, 211, 1, "LostLands");
|
||||
SpawnThis(from, Selections, 213, 1, "Outdoors");
|
||||
SpawnThis(from, Selections, 229, 1, "Reagents");
|
||||
SpawnThis(from, Selections, 218, 1, "SeaLife");
|
||||
|
||||
//ILSHENAR
|
||||
from.Say( "SPAWNING ILSHENAR..." );
|
||||
SpawnThis(from, Selections, 301, 3, "Ancientlair");
|
||||
SpawnThis(from, Selections, 302, 3, "Ankh");
|
||||
SpawnThis(from, Selections, 303, 3, "Blood");
|
||||
SpawnThis(from, Selections, 304, 3, "Exodus");
|
||||
SpawnThis(from, Selections, 305, 3, "Mushroom");
|
||||
SpawnThis(from, Selections, 306, 3, "Outdoors");
|
||||
SpawnThis(from, Selections, 307, 3, "Ratmancave");
|
||||
SpawnThis(from, Selections, 308, 3, "Rock");
|
||||
SpawnThis(from, Selections, 309, 3, "Sorcerers");
|
||||
SpawnThis(from, Selections, 310, 3, "Spectre");
|
||||
SpawnThis(from, Selections, 311, 3, "Towns");
|
||||
SpawnThis(from, Selections, 314, 3, "TwistedWeald");
|
||||
SpawnThis(from, Selections, 312, 3, "Vendors");
|
||||
SpawnThis(from, Selections, 313, 3, "Wisp");
|
||||
|
||||
//MALAS
|
||||
from.Say( "SPAWNING MALAS..." );
|
||||
SpawnThis(from, Selections, 408, 4, "Bedlam");
|
||||
SpawnThis(from, Selections, 406, 4, "Citadel");
|
||||
SpawnThis(from, Selections, 401, 4, "Doom");
|
||||
SpawnThis(from, Selections, 407, 4, "Labyrinth");
|
||||
SpawnThis(from, Selections, 402, 4, "North");
|
||||
SpawnThis(from, Selections, 403, 4, "OrcForts");
|
||||
SpawnThis(from, Selections, 404, 4, "South");
|
||||
SpawnThis(from, Selections, 405, 4, "Vendors");
|
||||
|
||||
//TOKUNO
|
||||
from.Say( "SPAWNING TOKUNO..." );
|
||||
SpawnThis(from, Selections, 501, 5, "FanDancersDojo");
|
||||
SpawnThis(from, Selections, 502, 5, "Outdoors");
|
||||
SpawnThis(from, Selections, 503, 5, "TownsLife");
|
||||
SpawnThis(from, Selections, 504, 5, "Vendors");
|
||||
SpawnThis(from, Selections, 505, 5, "WildLife");
|
||||
SpawnThis(from, Selections, 506, 5, "YomutsoMines");
|
||||
|
||||
//TER MUR
|
||||
from.Say( "SPAWNING TER MUR..." );
|
||||
SpawnThis(from, Selections, 601, 6, "Abyss");
|
||||
SpawnThis(from, Selections, 602, 6, "TerMur");
|
||||
SpawnThis(from, Selections, 603, 6, "Underworld");
|
||||
SpawnThis(from, Selections, 604, 6, "Vendors");
|
||||
|
||||
from.Say( "SPAWN GENERATION COMPLETED" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
887
Scripts/Engines/Spawner/Spawner.cs
Normal file
887
Scripts/Engines/Spawner/Spawner.cs
Normal file
|
|
@ -0,0 +1,887 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using CPA = Server.CommandPropertyAttribute;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class Spawner : Item, ISpawner
|
||||
{
|
||||
private int m_Team;
|
||||
private int m_HomeRange;
|
||||
private int m_WalkingRange;
|
||||
private int m_Count;
|
||||
private TimeSpan m_MinDelay;
|
||||
private TimeSpan m_MaxDelay;
|
||||
private List<string> m_SpawnNames;
|
||||
private List<ISpawnable> m_Spawned;
|
||||
private DateTime m_End;
|
||||
private InternalTimer m_Timer;
|
||||
private bool m_Running;
|
||||
private bool m_Group;
|
||||
private WayPoint m_WayPoint;
|
||||
|
||||
public bool IsFull{ get{ return ( m_Spawned != null && m_Spawned.Count >= m_Count ); } }
|
||||
|
||||
public List<string> SpawnNames
|
||||
{
|
||||
get { return m_SpawnNames; }
|
||||
set
|
||||
{
|
||||
m_SpawnNames = value;
|
||||
if ( m_SpawnNames.Count < 1 )
|
||||
Stop();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int SpawnNamesCount { get { return m_SpawnNames.Count; } }
|
||||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
Spawner s = newItem as Spawner;
|
||||
|
||||
if ( s == null )
|
||||
return;
|
||||
|
||||
s.m_SpawnNames = new List<string>( m_SpawnNames );
|
||||
s.m_Spawned = new List<ISpawnable>();
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Count
|
||||
{
|
||||
get { return m_Count; }
|
||||
set { m_Count = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public WayPoint WayPoint
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WayPoint;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WayPoint = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Running
|
||||
{
|
||||
get { return m_Running; }
|
||||
set
|
||||
{
|
||||
if ( value )
|
||||
Start();
|
||||
else
|
||||
Stop();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int HomeRange
|
||||
{
|
||||
get { return m_HomeRange; }
|
||||
set { m_HomeRange = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int WalkingRange
|
||||
{
|
||||
get { return m_WalkingRange; }
|
||||
set { m_WalkingRange = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Team
|
||||
{
|
||||
get { return m_Team; }
|
||||
set { m_Team = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan MinDelay
|
||||
{
|
||||
get { return m_MinDelay; }
|
||||
set { m_MinDelay = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan MaxDelay
|
||||
{
|
||||
get { return m_MaxDelay; }
|
||||
set { m_MaxDelay = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan NextSpawn
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Running )
|
||||
return m_End - DateTime.Now;
|
||||
else
|
||||
return TimeSpan.FromSeconds( 0 );
|
||||
}
|
||||
set
|
||||
{
|
||||
Start();
|
||||
DoTimer( value );
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Group
|
||||
{
|
||||
get { return m_Group; }
|
||||
set { m_Group = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Spawner()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Spawner( string spawnName )
|
||||
: this( 1, 5, 10, 0, 4, spawnName)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public Spawner(int amount, int minDelay, int maxDelay, int team, int homeRange, string spawnName)
|
||||
: base(0x1f13)
|
||||
{
|
||||
List<string> spawnNames = new List<string>();
|
||||
|
||||
if (!String.IsNullOrEmpty(spawnName))
|
||||
spawnNames.Add(spawnName);
|
||||
|
||||
InitSpawner(amount, TimeSpan.FromMinutes(minDelay), TimeSpan.FromMinutes(maxDelay), team, homeRange, spawnNames);
|
||||
}
|
||||
|
||||
public Spawner(int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, List<string> spawnNames)
|
||||
: base(0x1f13)
|
||||
{
|
||||
InitSpawner(amount, minDelay, maxDelay, team, homeRange, spawnNames);
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "Spawner"; }
|
||||
}
|
||||
|
||||
private void InitSpawner( int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, List<string> spawnNames )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
m_Running = true;
|
||||
m_Group = false;
|
||||
m_MinDelay = minDelay;
|
||||
m_MaxDelay = maxDelay;
|
||||
m_Count = amount;
|
||||
m_Team = team;
|
||||
m_HomeRange = homeRange;
|
||||
m_WalkingRange = -1;
|
||||
m_SpawnNames = spawnNames;
|
||||
m_Spawned = new List<ISpawnable>();
|
||||
DoTimer( TimeSpan.FromSeconds( 1 ) );
|
||||
}
|
||||
|
||||
public Spawner( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel < AccessLevel.GameMaster )
|
||||
return;
|
||||
|
||||
SpawnerGump g = new SpawnerGump( this );
|
||||
from.SendGump( g );
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( m_Running )
|
||||
{
|
||||
list.Add( 1060742 ); // active
|
||||
|
||||
list.Add( 1060656, m_Count.ToString() ); // amount to make: ~1_val~
|
||||
list.Add( 1061169, m_HomeRange.ToString() ); // range ~1_val~
|
||||
list.Add( 1060658, "walking range\t{0}", m_WalkingRange ); // ~1_val~: ~2_val~
|
||||
|
||||
list.Add( 1060659, "group\t{0}", m_Group ); // ~1_val~: ~2_val~
|
||||
list.Add( 1060660, "team\t{0}", m_Team ); // ~1_val~: ~2_val~
|
||||
list.Add( 1060661, "speed\t{0} to {1}", m_MinDelay, m_MaxDelay ); // ~1_val~: ~2_val~
|
||||
|
||||
for ( int i = 0; i < 2 && i < m_SpawnNames.Count; ++i )
|
||||
list.Add( 1060662 + i, "{0}\t{1}", m_SpawnNames[i], CountCreatures( m_SpawnNames[i] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add( 1060743 ); // inactive
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_Running )
|
||||
LabelTo( from, "[Running]" );
|
||||
else
|
||||
LabelTo( from, "[Off]" );
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if ( !m_Running )
|
||||
{
|
||||
if ( SpawnNamesCount > 0 )
|
||||
{
|
||||
m_Running = true;
|
||||
DoTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if ( m_Running )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Running = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ParseType( string s )
|
||||
{
|
||||
return s.Split( null, 2 )[0];
|
||||
}
|
||||
|
||||
public void Defrag()
|
||||
{
|
||||
bool removed = false;
|
||||
|
||||
for ( int i = 0; i < m_Spawned.Count; ++i )
|
||||
{
|
||||
ISpawnable e = m_Spawned[i];
|
||||
|
||||
bool toRemove = false;
|
||||
|
||||
if( e is Item )
|
||||
{
|
||||
Item item = (Item)e;
|
||||
|
||||
if (item.Deleted || item.Parent != null)
|
||||
toRemove = true;
|
||||
}
|
||||
else if (e is Mobile)
|
||||
{
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
if (m.Deleted)
|
||||
{
|
||||
toRemove = true;
|
||||
}
|
||||
else if (m is BaseCreature)
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if (bc.Controlled || bc.IsStabled)
|
||||
{
|
||||
toRemove = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (toRemove)
|
||||
{
|
||||
m_Spawned.RemoveAt(i);
|
||||
--i;
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( removed )
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
bool ISpawner.UnlinkOnTaming { get { return true; } }
|
||||
|
||||
void ISpawner.Remove( ISpawnable spawn )
|
||||
{
|
||||
m_Spawned.Remove( spawn );
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void OnTick()
|
||||
{
|
||||
DoTimer();
|
||||
|
||||
if ( m_Group )
|
||||
{
|
||||
Defrag();
|
||||
|
||||
if ( m_Spawned.Count == 0 )
|
||||
{
|
||||
Respawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Spawn();
|
||||
}
|
||||
}
|
||||
|
||||
public void Respawn()
|
||||
{
|
||||
RemoveSpawned();
|
||||
|
||||
for ( int i = 0; i < m_Count; i++ )
|
||||
Spawn();
|
||||
}
|
||||
|
||||
public void Spawn()
|
||||
{
|
||||
if ( SpawnNamesCount > 0 )
|
||||
Spawn( Utility.Random( SpawnNamesCount ) );
|
||||
}
|
||||
|
||||
public void Spawn( string creatureName )
|
||||
{
|
||||
for ( int i = 0; i < m_SpawnNames.Count; i++ )
|
||||
{
|
||||
if ( m_SpawnNames[i] == creatureName )
|
||||
{
|
||||
Spawn( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual ISpawnable CreateSpawnedObject( int index )
|
||||
{
|
||||
if ( index >= m_SpawnNames.Count )
|
||||
return null;
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( ParseType( m_SpawnNames[index] ) );
|
||||
|
||||
if ( type != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Build( type, CommandSystem.Split( m_SpawnNames[index] ) );
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ISpawnable Build( Type type, string[] args)
|
||||
{
|
||||
bool isISpawnable = typeof(ISpawnable).IsAssignableFrom( type );
|
||||
|
||||
if (!isISpawnable)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Add.FixArgs( ref args );
|
||||
|
||||
string[,] props = null;
|
||||
|
||||
for ( int i = 0; i < args.Length; ++i )
|
||||
{
|
||||
if ( Insensitive.Equals( args[i], "set" ) )
|
||||
{
|
||||
int remains = args.Length - i - 1;
|
||||
|
||||
if ( remains >= 2 )
|
||||
{
|
||||
props = new string[remains / 2, 2];
|
||||
|
||||
remains /= 2;
|
||||
|
||||
for ( int j = 0; j < remains; ++j )
|
||||
{
|
||||
props[j, 0] = args[i + (j * 2) + 1];
|
||||
props[j, 1] = args[i + (j * 2) + 2];
|
||||
}
|
||||
|
||||
Add.FixSetString( ref args, i );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PropertyInfo[] realProps = null;
|
||||
|
||||
if ( props != null )
|
||||
{
|
||||
realProps = new PropertyInfo[props.GetLength( 0 )];
|
||||
|
||||
PropertyInfo[] allProps = type.GetProperties( BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public );
|
||||
|
||||
for ( int i = 0; i < realProps.Length; ++i )
|
||||
{
|
||||
PropertyInfo thisProp = null;
|
||||
|
||||
string propName = props[i, 0];
|
||||
|
||||
for ( int j = 0; thisProp == null && j < allProps.Length; ++j )
|
||||
{
|
||||
if ( Insensitive.Equals( propName, allProps[j].Name ) )
|
||||
thisProp = allProps[j];
|
||||
}
|
||||
|
||||
if ( thisProp != null )
|
||||
{
|
||||
CPA attr = Properties.GetCPA( thisProp );
|
||||
|
||||
if ( attr != null && AccessLevel.GameMaster >= attr.WriteLevel && thisProp.CanWrite && !attr.ReadOnly )
|
||||
realProps[i] = thisProp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConstructorInfo[] ctors = type.GetConstructors();
|
||||
|
||||
for ( int i = 0; i < ctors.Length; ++i )
|
||||
{
|
||||
ConstructorInfo ctor = ctors[i];
|
||||
|
||||
if ( !Add.IsConstructable( ctor, AccessLevel.GameMaster ) )
|
||||
continue;
|
||||
|
||||
ParameterInfo[] paramList = ctor.GetParameters();
|
||||
|
||||
if ( args.Length == paramList.Length )
|
||||
{
|
||||
object[] paramValues = Add.ParseValues( paramList, args );
|
||||
|
||||
if ( paramValues == null )
|
||||
continue;
|
||||
|
||||
object built = ctor.Invoke( paramValues );
|
||||
|
||||
if ( built != null && realProps != null )
|
||||
{
|
||||
for ( int j = 0; j < realProps.Length; ++j )
|
||||
{
|
||||
if ( realProps[j] == null )
|
||||
continue;
|
||||
|
||||
string result = Properties.InternalSetValue( built, realProps[j], props[j, 1] );
|
||||
}
|
||||
}
|
||||
|
||||
return (ISpawnable)built;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Point3D HomeLocation { get { return this.Location; } }
|
||||
|
||||
public void Spawn( int index )
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
if ( map == null || map == Map.Internal || SpawnNamesCount == 0 || index >= SpawnNamesCount || Parent != null )
|
||||
return;
|
||||
|
||||
Defrag();
|
||||
|
||||
if ( m_Spawned.Count >= m_Count )
|
||||
return;
|
||||
|
||||
ISpawnable spawned = CreateSpawnedObject( index );
|
||||
|
||||
if (spawned == null)
|
||||
return;
|
||||
|
||||
spawned.Spawner = this;
|
||||
m_Spawned.Add(spawned);
|
||||
|
||||
Point3D loc = (spawned is BaseVendor ? this.Location : GetSpawnPosition());
|
||||
|
||||
spawned.OnBeforeSpawn(loc, map);
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
spawned.MoveToWorld(loc, map);
|
||||
spawned.OnAfterSpawn();
|
||||
|
||||
if (spawned is BaseCreature)
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)spawned;
|
||||
|
||||
if( m_WalkingRange >= 0 )
|
||||
bc.RangeHome = m_WalkingRange;
|
||||
else
|
||||
bc.RangeHome = m_HomeRange;
|
||||
|
||||
bc.CurrentWayPoint = m_WayPoint;
|
||||
|
||||
if ( m_Team > 0 )
|
||||
bc.Team = m_Team;
|
||||
|
||||
bc.Home = this.HomeLocation;
|
||||
}
|
||||
}
|
||||
|
||||
public Point3D GetSpawnPosition()
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
if ( map == null )
|
||||
return Location;
|
||||
|
||||
// Try 10 times to find a Spawnable location.
|
||||
for ( int i = 0; i < 10; i++ )
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if ( m_HomeRange > 0 ) {
|
||||
x = Location.X + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
|
||||
y = Location.Y + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
|
||||
} else {
|
||||
x = Location.X;
|
||||
y = Location.Y;
|
||||
}
|
||||
|
||||
int z = Map.GetAverageZ( x, y );
|
||||
|
||||
if ( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
|
||||
return new Point3D( x, y, this.Z );
|
||||
else if ( Map.CanSpawnMobile( new Point2D( x, y ), z ) )
|
||||
return new Point3D( x, y, z );
|
||||
}
|
||||
|
||||
return this.Location;
|
||||
}
|
||||
|
||||
public void DoTimer()
|
||||
{
|
||||
if ( !m_Running )
|
||||
return;
|
||||
|
||||
int minSeconds = (int)m_MinDelay.TotalSeconds;
|
||||
int maxSeconds = (int)m_MaxDelay.TotalSeconds;
|
||||
|
||||
TimeSpan delay = TimeSpan.FromSeconds( Utility.RandomMinMax( minSeconds, maxSeconds ) );
|
||||
DoTimer( delay );
|
||||
}
|
||||
|
||||
public void DoTimer( TimeSpan delay )
|
||||
{
|
||||
if ( !m_Running )
|
||||
return;
|
||||
|
||||
m_End = DateTime.Now + delay;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = new InternalTimer( this, delay );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Spawner m_Spawner;
|
||||
|
||||
public InternalTimer( Spawner spawner, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
if ( spawner.IsFull )
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
else
|
||||
Priority = TimerPriority.OneSecond;
|
||||
|
||||
m_Spawner = spawner;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_Spawner != null )
|
||||
if ( !m_Spawner.Deleted )
|
||||
m_Spawner.OnTick();
|
||||
}
|
||||
}
|
||||
|
||||
public int CountCreatures( string creatureName )
|
||||
{
|
||||
Defrag();
|
||||
|
||||
int count = 0;
|
||||
|
||||
for ( int i = 0; i < m_Spawned.Count; ++i )
|
||||
if ( Insensitive.Equals( creatureName, m_Spawned[i].GetType().Name ) )
|
||||
++count;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public void RemoveSpawned( string creatureName )
|
||||
{
|
||||
Defrag();
|
||||
|
||||
for ( int i = 0; i < m_Spawned.Count; ++i )
|
||||
{
|
||||
IEntity e = m_Spawned[i];
|
||||
|
||||
if ( Insensitive.Equals( creatureName, e.GetType().Name ) )
|
||||
e.Delete();
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void RemoveSpawned()
|
||||
{
|
||||
Defrag();
|
||||
|
||||
for ( int i = 0; i < m_Spawned.Count; ++i )
|
||||
m_Spawned[i].Delete();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public void BringToHome()
|
||||
{
|
||||
Defrag();
|
||||
|
||||
for ( int i = 0; i < m_Spawned.Count; ++i )
|
||||
{
|
||||
ISpawnable e = m_Spawned[i];
|
||||
|
||||
e.MoveToWorld( this.Location, this.Map );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
RemoveSpawned();
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 4 ); // version
|
||||
writer.Write( m_WalkingRange );
|
||||
|
||||
writer.Write( m_WayPoint );
|
||||
|
||||
writer.Write( m_Group );
|
||||
|
||||
writer.Write( m_MinDelay );
|
||||
writer.Write( m_MaxDelay );
|
||||
writer.Write( m_Count );
|
||||
writer.Write( m_Team );
|
||||
writer.Write( m_HomeRange );
|
||||
writer.Write( m_Running );
|
||||
|
||||
if ( m_Running )
|
||||
writer.WriteDeltaTime( m_End );
|
||||
|
||||
writer.Write( m_SpawnNames.Count );
|
||||
|
||||
for ( int i = 0; i < m_SpawnNames.Count; ++i )
|
||||
writer.Write( m_SpawnNames[i] );
|
||||
|
||||
writer.Write( m_Spawned.Count );
|
||||
|
||||
for ( int i = 0; i < m_Spawned.Count; ++i )
|
||||
{
|
||||
IEntity e = m_Spawned[i];
|
||||
|
||||
if ( e is Item )
|
||||
writer.Write( (Item)e );
|
||||
else if ( e is Mobile )
|
||||
writer.Write( (Mobile)e );
|
||||
else
|
||||
writer.Write( Serial.MinusOne );
|
||||
}
|
||||
}
|
||||
|
||||
private static WarnTimer m_WarnTimer;
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
m_WalkingRange = reader.ReadInt();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
case 2:
|
||||
{
|
||||
m_WayPoint = reader.ReadItem() as WayPoint;
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
|
||||
case 1:
|
||||
{
|
||||
m_Group = reader.ReadBool();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
||||
case 0:
|
||||
{
|
||||
m_MinDelay = reader.ReadTimeSpan();
|
||||
m_MaxDelay = reader.ReadTimeSpan();
|
||||
m_Count = reader.ReadInt();
|
||||
m_Team = reader.ReadInt();
|
||||
m_HomeRange = reader.ReadInt();
|
||||
m_Running = reader.ReadBool();
|
||||
|
||||
TimeSpan ts = TimeSpan.Zero;
|
||||
|
||||
if ( m_Running )
|
||||
ts = reader.ReadDeltaTime() - DateTime.Now;
|
||||
|
||||
int size = reader.ReadInt();
|
||||
|
||||
m_SpawnNames = new List<string>( size );
|
||||
|
||||
for ( int i = 0; i < size; ++i )
|
||||
{
|
||||
string creatureString = reader.ReadString();
|
||||
|
||||
m_SpawnNames.Add( creatureString );
|
||||
string typeName = ParseType( creatureString );
|
||||
|
||||
if ( ScriptCompiler.FindTypeByName( typeName ) == null )
|
||||
{
|
||||
if ( m_WarnTimer == null )
|
||||
m_WarnTimer = new WarnTimer();
|
||||
|
||||
m_WarnTimer.Add( Location, Map, typeName );
|
||||
}
|
||||
}
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
m_Spawned = new List<ISpawnable>(count);
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
ISpawnable e = World.FindEntity(reader.ReadInt()) as ISpawnable;
|
||||
|
||||
if (e != null)
|
||||
{
|
||||
e.Spawner = this;
|
||||
m_Spawned.Add(e);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Running )
|
||||
DoTimer( ts );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version < 3 && Weight == 0 )
|
||||
Weight = -1;
|
||||
}
|
||||
|
||||
private class WarnTimer : Timer
|
||||
{
|
||||
private List<WarnEntry> m_List;
|
||||
|
||||
private class WarnEntry
|
||||
{
|
||||
public Point3D m_Point;
|
||||
public Map m_Map;
|
||||
public string m_Name;
|
||||
|
||||
public WarnEntry( Point3D p, Map map, string name )
|
||||
{
|
||||
m_Point = p;
|
||||
m_Map = map;
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public WarnTimer() : base( TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_List = new List<WarnEntry>();
|
||||
Start();
|
||||
}
|
||||
|
||||
public void Add( Point3D p, Map map, string name )
|
||||
{
|
||||
m_List.Add( new WarnEntry( p, map, name ) );
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine( "Warning: {0} bad spawns detected, logged: 'badspawn.log'", m_List.Count );
|
||||
|
||||
using ( StreamWriter op = new StreamWriter( "badspawn.log", true ) )
|
||||
{
|
||||
op.WriteLine( "# Bad spawns : {0}", DateTime.Now );
|
||||
op.WriteLine( "# Format: X Y Z F Name" );
|
||||
op.WriteLine();
|
||||
|
||||
foreach ( WarnEntry e in m_List )
|
||||
op.WriteLine( "{0}\t{1}\t{2}\t{3}\t{4}", e.m_Point.X, e.m_Point.Y, e.m_Point.Z, e.m_Map, e.m_Name );
|
||||
|
||||
op.WriteLine();
|
||||
op.WriteLine();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
140
Scripts/Engines/Spawner/SpawnerGump.cs
Normal file
140
Scripts/Engines/Spawner/SpawnerGump.cs
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Network;
|
||||
using Server.Gumps;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class SpawnerGump : Gump
|
||||
{
|
||||
private Spawner m_Spawner;
|
||||
|
||||
public SpawnerGump( Spawner spawner ) : base( 50, 50 )
|
||||
{
|
||||
m_Spawner = spawner;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 410, 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, 309, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 307, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
if ( i < spawner.SpawnNames.Count )
|
||||
{
|
||||
str = (string)spawner.SpawnNames[i];
|
||||
int count = m_Spawner.CountCreatures( str );
|
||||
|
||||
AddLabel( 382, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 304, 21, 0, i, str );
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> CreateArray( RelayInfo info, Mobile from )
|
||||
{
|
||||
List<string> creaturesName = new List<string>();
|
||||
|
||||
for ( int i = 0; i < 13; i++ )
|
||||
{
|
||||
TextRelay te = info.GetTextEntry( i );
|
||||
|
||||
if ( te != null )
|
||||
{
|
||||
string str = te.Text;
|
||||
|
||||
if ( str.Length > 0 )
|
||||
{
|
||||
str = str.Trim();
|
||||
|
||||
string t = Spawner.ParseType( str );
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( t );
|
||||
|
||||
if ( type != null )
|
||||
creaturesName.Add( str );
|
||||
else
|
||||
from.SendMessage( "{0} is not a valid type name.", t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return creaturesName;
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( m_Spawner.Deleted )
|
||||
return;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: // Closed
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1: // Okay
|
||||
{
|
||||
m_Spawner.SpawnNames = CreateArray( info, state.Mobile );
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Bring everything home
|
||||
{
|
||||
m_Spawner.BringToHome();
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Complete respawn
|
||||
{
|
||||
m_Spawner.Respawn();
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
int buttonID = info.ButtonID - 4;
|
||||
int index = buttonID / 2;
|
||||
int type = buttonID % 2;
|
||||
|
||||
TextRelay entry = info.GetTextEntry( index );
|
||||
|
||||
if ( entry != null && entry.Text.Length > 0 )
|
||||
{
|
||||
if ( type == 0 ) // Spawn creature
|
||||
m_Spawner.Spawn( entry.Text );
|
||||
else // Remove creatures
|
||||
m_Spawner.RemoveSpawned( entry.Text );
|
||||
|
||||
m_Spawner.SpawnNames = CreateArray( info, state.Mobile );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
613
Scripts/Engines/Spawner/SpawnerHowTo.txt
Normal file
613
Scripts/Engines/Spawner/SpawnerHowTo.txt
Normal file
|
|
@ -0,0 +1,613 @@
|
|||
Premium Spawner project was born as a "mod" of "Ultimate Spawner"
|
||||
script created by a brazilian scripter called Atomic, who had a SHARD
|
||||
called AtomicShard. It was based on a script that reads the spawns
|
||||
information from a bunch of "map" files and then place it in the
|
||||
world. The original script was modified by Nerun (myself) and when the
|
||||
number of changes to the original script became great, i changed the
|
||||
name of my version. The Premium is the successor of the Ultimate Spawner
|
||||
v4.0 R5 (until then, the simple addition of "R", followed by a number
|
||||
differentiated my version from original script designed by Atomic).
|
||||
The fundamental differences between the default RunUO Spawner system are:
|
||||
|
||||
- "Premium" has new properties:
|
||||
1. SpawnID - Spawners IDentity: used to unload or save spawns
|
||||
2. OverrideMap - automatically change all map files from the
|
||||
spawners entries bellow it
|
||||
3. OverrideID - works as OverrideMap, but for SpawnID
|
||||
4. OverrideMinTime - works as OverrideMap, but for MinDelay
|
||||
5. OverrideMaxTime - works as OverrideMap, but for MaxDelay
|
||||
|
||||
- "Premium" has it own engine, not using the default "Spawner"
|
||||
that comes with RunUO, instead it uses the "PremiumSpawner". You can
|
||||
use both systems simultaneously.
|
||||
|
||||
- "Premium" has map files (pre-spawned world).
|
||||
|
||||
- "Premium" is user friendly.
|
||||
|
||||
The basics of basics that you need to know is that this system is
|
||||
useful to remain "safe" (in a ".map" file) the spawners that you created
|
||||
with so much effort. Well, suppose you have to erase everything and start
|
||||
the world from scratch. You will have to place more than ten thousand
|
||||
spawns, by hand, again? NO! You just use a command prompt, everything
|
||||
will be generated again, and without effort. All effort is done in the
|
||||
process of map file creation (that you can do in-game).
|
||||
The current release is considered very mature (in terms of stability,
|
||||
reliability, features and ease of use) and complete (in terms of world
|
||||
spawns).
|
||||
|
||||
|
||||
INDEX:
|
||||
1. PREMIUM SPAWNER INSTALATION
|
||||
2. PART I - Main Menu
|
||||
3. PART II - Writing a Map File (Basics)
|
||||
4. PART III - Using Maps "In-Game" (B<>sics)
|
||||
5. PART IV - Writing a Map File (Advanced)
|
||||
6. PART V - Using Maps "In-Game" (Advanced)
|
||||
7. PART VI - Edition Options
|
||||
8. PART VII - Spawns' Overseer
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PREMIUM SPAWNER INSTALATION
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
Spawner creation system, Premium "Spawner" consists in a collection
|
||||
of scripts. As I added many scripts, I will not list them here. Today this
|
||||
system is distributed in a package called "Nerun's Distro". There were
|
||||
several packages in the beginning, but for convenience I have grouped in
|
||||
a single distribution. This package also includes other resources, such as
|
||||
spawns maps for use with this system, as gumps (menus) easy to use to further
|
||||
facilitate the settlement of your world. This distro can be found in the
|
||||
RunUO forum at http://www.runuo.com/.
|
||||
|
||||
To install the distro open READ-ME FIRST.txt and follow its instructions.
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>
|
||||
PART I - Main Menu
|
||||
<<<<<<<<<<<<<<<<<<
|
||||
|
||||
To access the Main Menu wrote "[spawner" (without quotes) in the
|
||||
command prompt. There are a lot of options in the menu, in two pages. These
|
||||
options are self-explained:
|
||||
|
||||
|
||||
GUMP NAME COMMAND PROMPT
|
||||
===========================================================
|
||||
WORLD CREATION:
|
||||
Let there be light (Create world) -- [createworld
|
||||
Apocalypse now (Clear all facets) -- [clearall
|
||||
SELECT SPAWNS BY EXPANSION:
|
||||
UO Classic Spawns (pre-T2A) -------- [spawngen uoclassic/UOClassic.map
|
||||
UO Mondain's Legacy Spawns --------- [SpawnUOML
|
||||
UO KR, SA and HS Spawns ------------ [SpawnCurrent
|
||||
REMOVE SPAWNS BY EXPANSION:
|
||||
UO Classic Spawns (pre-T2A) -------- [spawngen unload 1000
|
||||
UO Mondain's Legacy Spawns --------- [UnloadUOML
|
||||
UO KR, SA and HS Spawns ------------ [UnloadCurrent
|
||||
SMART PLAYER RANGE SENSITIVE:
|
||||
Generate Spawns' Overseer ---------- [GenSeers
|
||||
Remove Spawns' Overseer ------------ [RemSeers
|
||||
SAVE SPAWNERS:
|
||||
All spawns (spawns.map) ------------ [spawngen save
|
||||
'By Hand' spawns (byhand.map) ------ [spawngen savebyhand
|
||||
Spawns inside region (region.map) -- [spawngen save RegionName
|
||||
Spawns inside coordinates ---------- [spawngen save x1 y1 x2 y2
|
||||
REMOVE SPAWNERS:
|
||||
All spawner in ALL facets ---------- [spawngen remove
|
||||
All spawners in THIS facet --------- [spawngen cleanfacet
|
||||
Remove spawners by SpawnID --------- [spawngen unload SpawnID
|
||||
Remove inside Coordinates ---------- [spawngen remove x1 y1 x2 y2
|
||||
Remove spawners inside Region ------ [spawngen remove RegionName
|
||||
EDITOR:
|
||||
Spawn Editor ----------------------- [editor
|
||||
CONVERSION UTILITY:
|
||||
RunUO Spawners to Premium ---------- [rse
|
||||
CUSTOM REGIONS IN A BOX:
|
||||
Add a Region Controller ------------ [Add RegionControl
|
||||
|
||||
|
||||
As you can see, it centered on a single menu all the system commands,
|
||||
you do not know how to write each line to use them, simply click, follow
|
||||
the instructions and it is done. The following sections will describe how to
|
||||
create a map file, and how to use the command line instead of the Menu.
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PART II - Writing a Map File (Basics)
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
Notepad can be used to create map files. You will see the following
|
||||
basic information on a map:
|
||||
|
||||
## Britain Graveyard:
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|4|0|0|0
|
||||
|
||||
This map above provides information from all spawns of the Britain
|
||||
Graveyard. Let's analyze it:
|
||||
|
||||
- 1st Line: Starts with "##", this double "sharp" marks the beginning of
|
||||
a comment. In other words, what comes after him will not be read by the
|
||||
script. It is usually used to provide information about the script:
|
||||
Dungeon map name, actual review and so on.
|
||||
|
||||
- 2nd Line: The spawner itself. Each line is a spawner, but the advantage
|
||||
of PremiumSpawner is that it contains up to 6 FakeSpawners within
|
||||
themselves, which are nothing more than spawners with the same
|
||||
attributes of distance, time etc, but with different creatures and
|
||||
amounts:
|
||||
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|
|
||||
4|0|0|0
|
||||
|
||||
- All Spawners starts with "*" followed by "|". This "|" separates the
|
||||
information into the line. The first 6 spaces are the names of the
|
||||
creatures, which in this case are:
|
||||
|
||||
Spawner 1: Spectre OR Wraith (the ":" serves to add several
|
||||
creatures in a random list)
|
||||
Spawner 2: Skeleton
|
||||
Spawner 3: Zombie
|
||||
Spawner 4: Empty (none)
|
||||
Spawner 5: Empty (none)
|
||||
Spawner 6: Empty (none)
|
||||
|
||||
Each of them are called "Fake Spawner": are 6 spawners inside only
|
||||
one spawner.
|
||||
|
||||
- The three numbers that come after the creatures lists define the place
|
||||
where the spawner will be created. Following the "XYZ" format (all
|
||||
details of Spawners are separated by a "|"). In this case, the spawner
|
||||
will appear at coordinates "1369 | 1475 | 10", in other words,
|
||||
X = 1369, Y = 1475 and Z = 10. If you type "[go 1369 1475 10" you will
|
||||
go to the place where this Spawner will appear.
|
||||
|
||||
- The fourth number says in wich facet the Spawner will be placed. Note
|
||||
that this number is 2. The definition of the maps follow this pattern:
|
||||
|
||||
0 = Felucca AND Trammel
|
||||
1 = Felucca
|
||||
2 = Trammel
|
||||
3 = Ilshenar
|
||||
4 = Malas
|
||||
5 = Tokuno
|
||||
|
||||
So deduct that the spawner will be placed in Trammel, because the room
|
||||
number (the map) is the number 2.
|
||||
|
||||
- Next 2 numbers after facet number: defines respectively the minimum
|
||||
and the maximum respawn time. That is, the creatures that spawn will
|
||||
respawn in a randomly chosen interval between the minimum and maximum
|
||||
time. In the example We have "5 | 10 |" (always a "|"). Time is in
|
||||
minutes, so creatures will respawn between 5 and 10 min after being
|
||||
killed by players.
|
||||
|
||||
But you could write otherwise, time in seconds, minutes or hours:
|
||||
|10s| = ten seconds;
|
||||
|10m| (or just |10|, the default) = ten minutes;
|
||||
|10h| = ten hours.
|
||||
|
||||
- Next 2 numbers after respawn time: defines WalkingRange and HomeRange.
|
||||
In this case, 30 WalkingRange and 20 HomeRange. The creatures will walk
|
||||
for up to 30 "boxes" (those who we see in a maximum zoom in game)
|
||||
away from the spawner. But they will "respawn" randomly within a
|
||||
radius of up to 20 "boxes" from the spawner. Note that the HomeRange
|
||||
is always less than or equal to WalkingRange, NEVER MORE.
|
||||
|
||||
- Next number after Ranges: identifies the spawn, is a "SpawnID", it
|
||||
tell us to which "spawn group" it belongs. By default, it is always
|
||||
1. If you create any spawner in game using the "[add premiumspawner"
|
||||
command, the SpawnID will be the number 1. This identifies the
|
||||
spawners created "by hand". But the maps can have any number of
|
||||
SpawnID. It is advisable that all spawners of the same map, have the
|
||||
same SpawnID. We will see why bellow.
|
||||
|
||||
- The last 6 numbers, also important, say how many monsters defined at
|
||||
the beginning of the spawner (the first 6 spaces) will be generated
|
||||
by that spawner. If the numbers are "2 | 3 | 4 | 0 | 0 | 0" will be
|
||||
generated 2 Specters OR Wraiths (or 1 of each), 3 skeletons and 4
|
||||
Zombies. The latest figures are 0: nothing is created in the past
|
||||
3 spawners, even if you define a value, nothing could be generated,
|
||||
because no creature was listed there (as we saw).
|
||||
|
||||
As observation, note that most of spawner's properties, as
|
||||
described above, can be defined without the need to "see" where the
|
||||
spawner will appear, but the coordinates will need to "see". Because if
|
||||
you choose coordinates randomly, risks creating a spawner in an
|
||||
inaccessible place, for example, in the middle of the ocean! So you must
|
||||
go to the place where you would like spawner appear and use the command
|
||||
"[get location" or "[where" in that place. Then write down the details
|
||||
that will appear on the screen.
|
||||
Made the map, just save it in the folder Data / Monsters (if there
|
||||
isn't a folder Date/Monsters, it's time to create one. Click "Save As",
|
||||
select the Save as Type "All Files" and then type a name for the map, not
|
||||
forgetting to set ".map" at the end of the name. In the above example,
|
||||
if we had made that map, we could give him the name "graveyard.map".
|
||||
|
||||
SUMMARIZING
|
||||
Default spawner format:
|
||||
|
||||
*|List1|List2|List3|List4|List5|List6|X|Y|Z|facet|MinTime|MaxTime|
|
||||
WalkingRange|HomeRange|SpawnID|Count1|Count2|Count3|Count4|Count5|Count6
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PART III - Using Maps "In-Game" (B<>sics)
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
This is simple, are just a commands list to be used in game for
|
||||
the PremiumSpawner's engine generates spawners from the maps created. On
|
||||
the assumption that you already installed the required scripts in RunUO
|
||||
folder, you can use the following commands:
|
||||
|
||||
|
||||
- [spawngen MapName.map
|
||||
Read maps and create spawners. In the example you should use
|
||||
"[spawngen graveyard.map" (no quotes).
|
||||
|
||||
- [spawngen remove
|
||||
Dungerous command! It will DELETE all PremiumSpawners of ALL facets
|
||||
of UO, done "by hand" or "by map"!
|
||||
|
||||
- [spawngen save
|
||||
Usefull command: saves in a file called "Spawns.map" ALL the
|
||||
PremiumSpawners in ALL UO facets, done "by hand" or "by map"!
|
||||
Usefull if tou did a lot of custom maps and use this distro too.
|
||||
After this, a simple "[spawngen spawns.map" will spawn everything
|
||||
again.
|
||||
|
||||
- [spawnrem
|
||||
It will DELETE all PremiumSpawners of actual facet (that one
|
||||
where your character is standing). Other facets will remain
|
||||
spawned.
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PART IV - Writing a Map File (Advanced)
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
Multiple Creatures and Randomness
|
||||
---------------------------------
|
||||
|
||||
You have learned to create maps using the class method, in other
|
||||
words, you type the name of the creature and then the statistics (count,
|
||||
delay, range etc). But what if you want more than one type of creature in
|
||||
the same spawner?
|
||||
|
||||
Use the method of two dots (":"). In this case, simply separate
|
||||
the creatures that you want with a ":" as in the example below:
|
||||
|
||||
*|Spectre:Wraith||||||1369|1475|10|2|5|10|30|20|1|10|0|0|0|0|0
|
||||
|
||||
As a result, the spawner randomly selecs within the amount
|
||||
indicated, among the creatures on the list, separated by two dots.
|
||||
Remembering that you can put as many creatures you like, all separated by
|
||||
":". In the example, we could have 7 Wraith and 3 Specter, or 5 of each,
|
||||
this number will vary, but the tendency is to remain in the ratio of
|
||||
count / creatures. In the example: count = 10, creatures = 2. Ratio 5.
|
||||
So the spawns will tend to 5 Wraith and 5 Specter. Now let's play with
|
||||
statistics. And if we want to have a greater chance of appearing more
|
||||
Spectres than Wraiths? So we can write in this way:
|
||||
|
||||
*|Spectre:Spectre:Wraith||||||1369|1475|10|2|5|10|30|20|1|10|0|0|0|0|0
|
||||
|
||||
The ratio now is 3.3 for creature, so the chances will be now:
|
||||
66.6% Spectres and 33.3% Wraiths.
|
||||
As an advise, never place inside the same Spawner (FakeSpawner),
|
||||
"target" creatures with "non-target" creatures or items. What i want to
|
||||
say is: don't place a Spectre, a Wraith and a dog or a bottle to spawn
|
||||
together:
|
||||
|
||||
*|Spectre:Wraith:Dog||||||1369|1475|10|2|5|10|30|20|1|10|0|0|0|0|0
|
||||
|
||||
If you do it, sometime the players will kill all monsters, but
|
||||
will not kill the dogs, and all the 10 creatures of that spawner will
|
||||
be just dogs! It happens because the Spawner spawn just the remaning
|
||||
amount (amount not spawned). If it spawn 10 creatures: 5 Spectres,
|
||||
3 Wraiths and 2 Dog, and if players kill all monsters except the dogs,
|
||||
next time the spawner will spawn 8 creatures (cause Dogs are alive) and
|
||||
it can spawn a few Spectres and Wraiths and a lot of Dogs again! And
|
||||
so on... I dit it in past releases, already fixed.
|
||||
|
||||
|
||||
Override Maps
|
||||
-------------
|
||||
|
||||
And if you want to do a map that works both in Trammel and Felucca?
|
||||
Instead of edit the facet number in each line (spawner) of your map,
|
||||
you can superscribe the facet number with a simple, only, command line.
|
||||
In our example above, that generates spawns only in Trammel, to generates
|
||||
spawns in Trammel AND Felucca, we adds an "overridemap":
|
||||
|
||||
overridemap 0
|
||||
## Britain Graveyard:
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|4|0|0|0
|
||||
|
||||
Here, the number "2" of that spawner (the facet), will be read as "0"
|
||||
by the spawn generator engine. Facet numbers are the same as described in
|
||||
"PART II - Writing a Map File (Basics)".
|
||||
|
||||
|
||||
Override SpawnID
|
||||
----------------
|
||||
|
||||
Do the same as OverrideMap, but for SpawnIDs. SpawnID "1" will be read
|
||||
as "14", as bellow:
|
||||
|
||||
overrideid 14
|
||||
overridemap 0
|
||||
## Britain Graveyard:
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|4|0|0|0
|
||||
|
||||
|
||||
Override DelayTime
|
||||
------------------
|
||||
|
||||
Do the same as OverrideMap and OverrideID, but for delay time.
|
||||
|
||||
overridemintime
|
||||
|
||||
and or
|
||||
|
||||
overridemaxtime
|
||||
|
||||
Exemple:
|
||||
|
||||
overridemintime 10
|
||||
overridemaxtime 20
|
||||
overrideid 14
|
||||
overridemap 0
|
||||
## Britain Graveyard:
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|4|0|0|0
|
||||
|
||||
The delays (min 5 and max 10 minutes) will be read as 10 and 20
|
||||
minutes.
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PART V - Using Maps "In-Game" (Advanced)
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
Settlement In-Game
|
||||
------------------
|
||||
|
||||
Another way to settlement your world (place spawns) is to go "in-game"
|
||||
and adds spawners by hand, with command [add premiumspawner CreatureName.
|
||||
And "set" the attributes (x = number):
|
||||
|
||||
[set count x homerange x spawnrange x maxdelay x mindelay x
|
||||
|
||||
|
||||
Commands to Save and to Remove Spawns
|
||||
-------------------------------------
|
||||
|
||||
After spawn the desired area, you need to save yours spawns either with
|
||||
[spawngen save or with some advanced options. Just type [spawner and look under
|
||||
SAVE/REMOVE OPTIONS. There is a GUMP for each command. But you can use the
|
||||
command prompt instead:
|
||||
|
||||
[spawngen savebyhand
|
||||
To save spawns done "by hand" ([add premiumspawner... all by hand premium
|
||||
spawners has SpawnID = 1). Spawns will be saved in "byhand.map" file in
|
||||
Data/Monsters folder.
|
||||
|
||||
[spawngen save x1 y1 x2 y2
|
||||
To save all premium spawners in a spawns.map file. All premium spawners
|
||||
inside the rectangle area (x1 y1 x2 y2) will be saved.
|
||||
|
||||
X and Y are coordinates:
|
||||
|
||||
(x1,y1)------+ All premium spawners between coordinates (x1,y1)
|
||||
| | and coordinates (x2,y2) will be saved.
|
||||
| |
|
||||
| |
|
||||
+---------(x2,y2)
|
||||
|
||||
[spawngen save <region>
|
||||
Save premium spawners inside a region defined by RunUO to a spawns.map
|
||||
file, in Data/Monsters.
|
||||
Complete list of regions are in c:/RunUO/Data/Regions.xml.
|
||||
Use [where to see the region where you are.
|
||||
Open Regions.xml to understand regions:
|
||||
|
||||
<region priority="50" name="Minoc">
|
||||
<rect x="2411" y="366" width="135" height="241" />
|
||||
<rect x="2548" y="495" width="72" height="55" />
|
||||
<rect x="2564" y="585" width="3" height="42" />
|
||||
<rect x="2567" y="585" width="61" height="61" />
|
||||
<rect x="2499" y="627" width="68" height="63" />
|
||||
<inn x="2457" y="397" width="40" height="8" />
|
||||
<inn x="2465" y="405" width="8" height="8" />
|
||||
<inn x="2481" y="405" width="8" height="8" />
|
||||
<go location="(2466,544,0)" />
|
||||
<music name="Minoc" />
|
||||
</region>
|
||||
|
||||
As you see, a Region is a lot of rectangles.
|
||||
|
||||
NOTE: "[spawngen remove" can be used with the same options as for
|
||||
"[spawngen save" above, but will remove spawns instead of save.
|
||||
|
||||
NOTE: Go to Data/Monsters and rename spawns.map or byhand.map to another name,
|
||||
because each time you save with those options, the old file will be deleted and
|
||||
a new one will be saved over it.
|
||||
|
||||
EXAMPLE:
|
||||
"[spawngen save minoc" (save spawns inside Minoc region)
|
||||
We can rename the spawns.map to Minoc.map.
|
||||
|
||||
|
||||
Unloading Maps (recommended)
|
||||
----------------------------
|
||||
|
||||
The better way to remove spawns instead of using "[spawngen remove"
|
||||
and other Spartan options is the "Unload" method:
|
||||
|
||||
[spawngen unload SpawnID
|
||||
|
||||
If you define a SpawnID to each custom map you has you can unload
|
||||
or remove the entire map easier. Example: Graveyards.map saw above. All the
|
||||
premium spawners inside that map has SpawnID = 1. Lets see:
|
||||
|
||||
## Britain Graveyard:
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|4|0|0|0
|
||||
|
||||
The problem is that 1 is the default number to "by hand" maps.
|
||||
Lets change the ID of this map. In the example above we just need to change
|
||||
one number (that between numbers 20 and 2). But if the map had 100, maybe
|
||||
1000 premium spawners? hard work uh? Because of it there is the "overrideid"
|
||||
option. It set all the SpawnIDs bellow it to the desired ID. So lets do it:
|
||||
|
||||
overrideid 14
|
||||
## Britain Graveyard:
|
||||
*|Spectre:Wraith|Skeleton|Zombie||||1369|1475|10|2|5|10|30|20|1|2|3|4|0|0|0
|
||||
|
||||
Although each spawner still have 1 as ID on each line, the
|
||||
"overrideid 14" will force the spawn generator engine to read that "1" as
|
||||
if "14". Later in the game, if I want to remove this map is just type
|
||||
"[spawngen unload 14" and ready. None of my other spawns will be changed
|
||||
or removed.
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PART VI - Edition Options
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
[editor
|
||||
Opens the spawn editor of course. This will list all the
|
||||
PremiumSpawners in the left side. In the right column you can see
|
||||
a bunch of options to select only the desired spawners, go to it,
|
||||
see it properties, and see it creatures.
|
||||
|
||||
[clearall
|
||||
Works as [Clearfacet but for ALL facets. Caution here.
|
||||
|
||||
[GMbody
|
||||
Will set some common attributes to GMs. Target yourself. A lot of
|
||||
items, skills, stats, robes, full spellbooks etc, will appear in
|
||||
your backpack. You always set your body to human body. You add
|
||||
titles to [GM], [Admin], etc.
|
||||
|
||||
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
PART VII - SPAWNS' OVERSEER
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
Revision 22 has added Spawners' Overseer engine, the new incarnation of
|
||||
Smart Player Range Sensitive.
|
||||
|
||||
How it works:
|
||||
It has a range, that can be set by a GM or higher. It checks players in
|
||||
range every time the clock time ticks. If there is a player in range (or
|
||||
a non-hidden Staff Member) it will check players again only after 30 min
|
||||
(this time can be changed). If there is no players in range (or if Staff
|
||||
Members are hidden, but in range) it will disable all PremiumSpawners in
|
||||
range, deleting mobiles and items in range, and it will check for
|
||||
players every 5 seconds.
|
||||
|
||||
[GenSeers - generates Overseers crystal by reading configuration files
|
||||
at Data\Monsters\Overseers.
|
||||
|
||||
There is no OverSeers configuration files yet. So it generates no
|
||||
OverSeers. The engine is done, it is working, but you need a config file
|
||||
to tells the engine where to place OverSeers.
|
||||
|
||||
[RemSeers - removes all Overseers.
|
||||
|
||||
|
||||
>>>>>> ADDING >>>>>>
|
||||
|
||||
One option it to add OverSeers yourself, by hand.
|
||||
|
||||
[add SpawnsOverseer
|
||||
- this will add an OverSeer with range 20 (square of 40 x 40).
|
||||
|
||||
[add SpawnsOverseer 50
|
||||
- this will add an OverSeer with range 50 (square of 100 x 100).
|
||||
|
||||
|
||||
>>>>>> CONFIG FILES >>>>>>
|
||||
|
||||
And look at:
|
||||
|
||||
...\Data\Nerun's Distro\Spawns\overseers\trammel\Overseers.cfg
|
||||
|
||||
It is an example of OverSeer config file:
|
||||
|
||||
SpawnsOverseer 7966
|
||||
5433 1102 0
|
||||
|
||||
It is simple: bellow "SpawnsOverseer 7966" write coordinates (x,y,z) where
|
||||
you want to put them.
|
||||
|
||||
|
||||
>>>>>> RANGES >>>>>>
|
||||
|
||||
I thin you can write different ranges too, something like this:
|
||||
|
||||
SpawnsOverseer 7966 (Range=50)
|
||||
5433 1102 0
|
||||
|
||||
Remember that default range is 20 if none specified.
|
||||
|
||||
Range is the seer's "watching range". PremiumSpawners inside it range will
|
||||
be watched by that seer. There is no limit to the range.
|
||||
|
||||
You can place many seers with different ranges:
|
||||
|
||||
SpawnsOverseer 7966
|
||||
5433 1102 0
|
||||
1234 970 0
|
||||
3456 456 0
|
||||
|
||||
SpawnsOverseer 7966 (Range=50)
|
||||
5433 1102 0
|
||||
|
||||
You can change other parameters:
|
||||
|
||||
SpawnsOverseer 7966 (InRangeDelay=30; OutRangeDelay=5)
|
||||
5433 1102 0
|
||||
|
||||
And use all the together:
|
||||
|
||||
SpawnsOverseer 7966 (Range=50; InRangeDelay=30; OutRangeDelay=5)
|
||||
5433 1102 0
|
||||
|
||||
InRangeDelay = time in minutes to next check if players are in range
|
||||
|
||||
OutRangeDelay = time in seconds to next check if there is no players in range
|
||||
|
||||
>>>>>> ITEMID >>>>>>
|
||||
|
||||
Always use "SpawnsOverseer 7966", the number is the ItemID of
|
||||
SpawnsOverseer item.
|
||||
|
||||
>>>>>> COMMENTS >>>>>>
|
||||
|
||||
Use # to add comments that will not be read by [GenSeers:
|
||||
|
||||
# This is a comment line
|
||||
SpawnsOverseer 7966 (Range=50)
|
||||
5433 1102 0
|
||||
|
||||
>>>>>> FOLDERS >>>>>>
|
||||
|
||||
Place the CFG file in the right folder.
|
||||
|
||||
Trammel:
|
||||
...\Data\Nerun's Distro\Spawns\overseers\trammel\Overseers.cfg
|
||||
|
||||
Felucca:
|
||||
...\Data\Nerun's Distro\Spawns\overseers\felucca\Overseers.cfg
|
||||
|
||||
etc
|
||||
|
||||
>>>>>> .CFG FILE NAME >>>>>>
|
||||
|
||||
You can place more then one cfg inside the same folder, and don't
|
||||
need to have the name Overseers.cfg. Files can have any name. You
|
||||
can do a file "Graveyards.cfg" for all graveyards in a facet. Plus
|
||||
another called "Florests.cfg" for florests and open areas etc.
|
||||
14
Scripts/Engines/Spawner/SpawnerType.cs
Normal file
14
Scripts/Engines/Spawner/SpawnerType.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class SpawnerType
|
||||
{
|
||||
public static Type GetType( string name )
|
||||
{
|
||||
return ScriptCompiler.FindTypeByName( name );
|
||||
}
|
||||
}
|
||||
}
|
||||
340
Scripts/Engines/Spawner/SpawnsOverseer.cs
Normal file
340
Scripts/Engines/Spawner/SpawnsOverseer.cs
Normal file
|
|
@ -0,0 +1,340 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SpawnsOverseer : Item
|
||||
{
|
||||
private int m_Range;
|
||||
private int m_InRangeDelay;
|
||||
private int m_OutRangeDelay;
|
||||
private int m_Overseeing;
|
||||
private CheckTimer m_Timer;
|
||||
private bool m_Enable;
|
||||
private TimeSpan m_CurrentDelay; // players out dungeon
|
||||
private DateTime m_End;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Enable
|
||||
{
|
||||
get { return m_Enable; }
|
||||
set
|
||||
{
|
||||
if ( value )
|
||||
Begin();
|
||||
|
||||
else
|
||||
End();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Range
|
||||
{
|
||||
get { return m_Range; }
|
||||
set { m_Range = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan CurrentDelay
|
||||
{
|
||||
get { return m_CurrentDelay; }
|
||||
set { m_CurrentDelay = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan NextDelay
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Enable )
|
||||
return m_End - DateTime.Now;
|
||||
else
|
||||
return TimeSpan.FromSeconds( 0 );
|
||||
}
|
||||
set
|
||||
{
|
||||
Begin();
|
||||
DoTimer( value );
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int InRangeDelay
|
||||
{
|
||||
get { return m_InRangeDelay; }
|
||||
set { m_InRangeDelay = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int OutRangeDelay
|
||||
{
|
||||
get { return m_OutRangeDelay; }
|
||||
set { m_OutRangeDelay = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Overseeing
|
||||
{
|
||||
get { return m_Overseeing; }
|
||||
set { m_Overseeing = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public void Begin()
|
||||
{
|
||||
if ( !m_Enable )
|
||||
{
|
||||
m_Enable = true;
|
||||
DoTimer();
|
||||
}
|
||||
}
|
||||
|
||||
public void End()
|
||||
{
|
||||
if ( m_Enable )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Enable = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
if ( m_Enable )
|
||||
{
|
||||
m_Timer.Stop();
|
||||
DoTimer();
|
||||
}
|
||||
}
|
||||
|
||||
public void DoTimer()
|
||||
{
|
||||
if ( !m_Enable )
|
||||
return;
|
||||
|
||||
int mSeconds = (int)m_CurrentDelay.TotalSeconds;
|
||||
|
||||
TimeSpan delay = TimeSpan.FromSeconds( mSeconds );
|
||||
DoTimer( delay );
|
||||
}
|
||||
|
||||
public void DoTimer( TimeSpan delay )
|
||||
{
|
||||
if ( !m_Enable )
|
||||
return;
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_End = DateTime.Now + delay;
|
||||
|
||||
m_Timer = new CheckTimer( this, delay );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpawnsOverseer() : this( 20, 30, 5, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpawnsOverseer( int startrange ) : this( startrange, 30, 5, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpawnsOverseer( int startrange, int startIRD, int startORD, int startOverseeing ) : base( 0x1F1E )
|
||||
{
|
||||
InitSeer( startrange, startIRD, startORD, startOverseeing );
|
||||
}
|
||||
|
||||
private void InitSeer( int startrange, int startIRD, int startORD, int startOverseeing )
|
||||
{
|
||||
Name = "Spawns' Overseer";
|
||||
Movable = false;
|
||||
Light = LightType.Circle150;
|
||||
Weight = 1;
|
||||
Visible = false;
|
||||
Enable = true;
|
||||
Range = startrange;
|
||||
CurrentDelay = TimeSpan.FromSeconds( 5 );
|
||||
InRangeDelay = startIRD; //minutes
|
||||
OutRangeDelay = startORD; //seconds
|
||||
Overseeing = startOverseeing; //PremiumSpawners under control
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( m_Enable )
|
||||
{
|
||||
list.Add( 1060742 ); // active
|
||||
|
||||
list.Add( 1060662, "Range\t{0}", Range.ToString() );
|
||||
list.Add( 1060663, "In Range Delay\t{0} min", InRangeDelay.ToString() );
|
||||
list.Add( 1060661, "Out Range Delay\t{0} sec", OutRangeDelay.ToString() );
|
||||
list.Add( 1060658, "Overseeing\t{0} PremiumSpawners", Overseeing.ToString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add( 1060743 ); // inactive
|
||||
}
|
||||
}
|
||||
|
||||
private class CheckTimer : Timer
|
||||
{
|
||||
private SpawnsOverseer m_SpawnsOverseer;
|
||||
|
||||
public CheckTimer( SpawnsOverseer Crystal, TimeSpan delay ) : base( delay, delay )
|
||||
{
|
||||
Priority = TimerPriority.OneSecond;
|
||||
|
||||
m_SpawnsOverseer = Crystal;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( ( m_SpawnsOverseer != null ) && ( !m_SpawnsOverseer.Deleted ) )
|
||||
{
|
||||
m_SpawnsOverseer.OnTickDoThis();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTickDoThis()
|
||||
{
|
||||
List<Item> ClosePremiumSpawners = new List<Item>();
|
||||
|
||||
List<Mobile> ClosePlayers = new List<Mobile>();
|
||||
|
||||
List<Mobile> MobsCleaning = new List<Mobile>();
|
||||
|
||||
List<Item> ItemsCleaning = new List<Item>();
|
||||
|
||||
foreach ( Item item in this.GetItemsInRange( Range ) ) // para cada item dentro do raio de alcance
|
||||
{
|
||||
if( item is PremiumSpawner ) // se for um PremiumSpawner
|
||||
ClosePremiumSpawners.Add( item );
|
||||
}
|
||||
|
||||
if ( ClosePremiumSpawners.Count > 0 )
|
||||
{
|
||||
this.Overseeing = ClosePremiumSpawners.Count;
|
||||
|
||||
foreach ( Mobile m in this.GetMobilesInRange( Range ) ) // para cada mobile dentro do raio de alcance
|
||||
{
|
||||
if( m is PlayerMobile && m.AccessLevel == AccessLevel.Player || m is PlayerMobile && m.AccessLevel > AccessLevel.Player && m.Hidden == false ) //se fôr player ou GM não oculto (hidden)
|
||||
ClosePlayers.Add( m );
|
||||
}
|
||||
|
||||
if ( ClosePlayers.Count > 0 ) // há pelo menos um player próximo
|
||||
{
|
||||
this.CurrentDelay = TimeSpan.FromMinutes( InRangeDelay ); // tempo para nova checagem
|
||||
Restart();
|
||||
|
||||
foreach ( Item pspawner in ClosePremiumSpawners ) // pra cada PremiumSpawner próximo (na lista)
|
||||
{
|
||||
if ( ((PremiumSpawner)pspawner).Running == false ) // se estiver desativado
|
||||
{
|
||||
((PremiumSpawner)pspawner).Running = true; // ativar!
|
||||
((PremiumSpawner)pspawner).NextSpawn = TimeSpan.FromSeconds( 1 ); // respawn total!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( ClosePlayers.Count <= 0 ) // não tem ninguém perto
|
||||
{
|
||||
this.CurrentDelay = TimeSpan.FromSeconds( OutRangeDelay ); // tempo para nova checagem
|
||||
Restart();
|
||||
|
||||
foreach ( Item pspawner in ClosePremiumSpawners ) // pra cada Premium PremiumSpawner próximo (na lista)
|
||||
{
|
||||
if ( ((PremiumSpawner)pspawner).Running == true ) // se estiver ativado
|
||||
{
|
||||
((PremiumSpawner)pspawner).Running = false; // desativar!
|
||||
|
||||
foreach ( Mobile mobdel in this.GetMobilesInRange( Range ) )
|
||||
{
|
||||
if( mobdel is BaseCreature || mobdel is TownCrier )
|
||||
MobsCleaning.Add( mobdel );
|
||||
}
|
||||
|
||||
if ( MobsCleaning.Count > 0 )
|
||||
{
|
||||
foreach ( Mobile mDel in MobsCleaning )
|
||||
mDel.Delete();
|
||||
}
|
||||
|
||||
foreach ( Item itemdel in this.GetItemsInRange( Range ) )
|
||||
{
|
||||
if( itemdel.Movable == true ) //se for um item móvel (não decoração)
|
||||
ItemsCleaning.Add( itemdel );
|
||||
}
|
||||
|
||||
if ( ItemsCleaning.Count > 0 )
|
||||
{
|
||||
foreach ( Item iDel in ItemsCleaning )
|
||||
iDel.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ( ClosePremiumSpawners.Count <= 0 )
|
||||
{
|
||||
this.Enable = false;
|
||||
this.CurrentDelay = TimeSpan.FromSeconds( OutRangeDelay );
|
||||
this.Overseeing = ClosePremiumSpawners.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SpawnsOverseer( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( m_Range );
|
||||
writer.Write( m_InRangeDelay );
|
||||
writer.Write( m_OutRangeDelay );
|
||||
writer.Write( m_Overseeing );
|
||||
writer.Write( m_Enable );
|
||||
if ( m_Enable )
|
||||
writer.WriteDeltaTime( m_End );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Range = reader.ReadInt();
|
||||
m_InRangeDelay = reader.ReadInt();
|
||||
m_OutRangeDelay = reader.ReadInt();
|
||||
m_Overseeing = reader.ReadInt();
|
||||
m_Enable = reader.ReadBool();
|
||||
TimeSpan ts = TimeSpan.Zero;
|
||||
if ( m_Enable )
|
||||
ts = reader.ReadDeltaTime() - DateTime.Now;
|
||||
DoTimer( ts );
|
||||
}
|
||||
}
|
||||
}
|
||||
458
Scripts/Engines/Spawner/SpawnsOverseerCommand.cs
Normal file
458
Scripts/Engines/Spawner/SpawnsOverseerCommand.cs
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
// Engine r117
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
public class GenOverseer
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "GenSeers", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) );
|
||||
CommandSystem.Register( "GenOverseers", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) );
|
||||
CommandSystem.Register( "GenSeer", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) );
|
||||
CommandSystem.Register( "GenOverseer", AccessLevel.Administrator, new CommandEventHandler( GenOverseer_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "GenSeers" )]
|
||||
[Aliases( "GenSeer, GenOverseer and GenOverseers" )]
|
||||
[Description( "Generates Spawns' Overseers around the world." )]
|
||||
private static void GenOverseer_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
m_Mobile = e.Mobile;
|
||||
m_Count = 0;
|
||||
|
||||
m_Mobile.SendMessage( "Generating Spawns' Overseers, please wait." );
|
||||
|
||||
Generate( "Data/Spawns/britannia", Map.Britannia );
|
||||
Generate( "Data/Spawns/underworld", Map.Underworld );
|
||||
Generate( "Data/Spawns/darkness", Map.Darkness );
|
||||
Generate( "Data/Spawns/ocean", Map.Ocean );
|
||||
Generate( "Data/Spawns/grassland", Map.Grassland );
|
||||
|
||||
m_Mobile.SendMessage( "Spawns' Overseers generation complete. {0} seers were generated.", m_Count );
|
||||
}
|
||||
|
||||
public static void Generate( string folder, params Map[] maps )
|
||||
{
|
||||
if ( !Directory.Exists( folder ) )
|
||||
return;
|
||||
|
||||
string[] files = Directory.GetFiles( folder, "*.cfg" );
|
||||
|
||||
for ( int i = 0; i < files.Length; ++i )
|
||||
{
|
||||
ArrayList list = DecorationListSeers.ReadAll( files[i] );
|
||||
|
||||
for ( int j = 0; j < list.Count; ++j )
|
||||
m_Count += ((DecorationListSeers)list[j]).Generate( maps );
|
||||
}
|
||||
}
|
||||
|
||||
private static Mobile m_Mobile;
|
||||
private static int m_Count;
|
||||
}
|
||||
|
||||
public class DecorationListSeers
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_ItemID;
|
||||
private string[] m_Params;
|
||||
private ArrayList m_Entries;
|
||||
|
||||
public DecorationListSeers()
|
||||
{
|
||||
}
|
||||
|
||||
private static Type typeofStatic = typeof( Static );
|
||||
private static Type typeofLocalizedStatic = typeof( LocalizedStatic );
|
||||
|
||||
public Item Construct()
|
||||
{
|
||||
Item item;
|
||||
|
||||
try
|
||||
{
|
||||
if ( m_Type == typeofStatic )
|
||||
{
|
||||
item = new Static( m_ItemID );
|
||||
}
|
||||
else if ( m_Type == typeofLocalizedStatic )
|
||||
{
|
||||
int labelNumber = 0;
|
||||
|
||||
for ( int i = 0; i < m_Params.Length; ++i )
|
||||
{
|
||||
if ( m_Params[i].StartsWith( "LabelNumber" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
{
|
||||
labelNumber = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item = new LocalizedStatic( m_ItemID, labelNumber );
|
||||
}
|
||||
else
|
||||
{
|
||||
item = (Item)Activator.CreateInstance( m_Type );
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new Exception( String.Format( "Bad type: {0}", m_Type ), e );
|
||||
}
|
||||
|
||||
if ( item is Server.Items.SpawnsOverseer )
|
||||
{
|
||||
Server.Items.SpawnsOverseer sp = (Server.Items.SpawnsOverseer)item;
|
||||
|
||||
for ( int i = 0; i < m_Params.Length; ++i )
|
||||
{
|
||||
if ( m_Params[i].StartsWith( "Range" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
sp.Range = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) );
|
||||
}
|
||||
else if ( m_Params[i].StartsWith( "InRangeDelay" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
sp.InRangeDelay = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) );
|
||||
}
|
||||
else if ( m_Params[i].StartsWith( "OutRangeDelay" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
sp.OutRangeDelay = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item.Movable = false;
|
||||
|
||||
for ( int i = 0; i < m_Params.Length; ++i )
|
||||
{
|
||||
if ( m_Params[i].StartsWith( "Light" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
item.Light = (LightType)Enum.Parse( typeof( LightType ), m_Params[i].Substring( ++indexOf ), true );
|
||||
}
|
||||
else if ( m_Params[i].StartsWith( "Hue" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
{
|
||||
int hue = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) );
|
||||
|
||||
if ( item is DyeTub )
|
||||
((DyeTub)item).DyedHue = hue;
|
||||
else
|
||||
item.Hue = hue;
|
||||
}
|
||||
}
|
||||
else if ( m_Params[i].StartsWith( "Name" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
item.Name = m_Params[i].Substring( ++indexOf );
|
||||
}
|
||||
else if ( m_Params[i].StartsWith( "Amount" ) )
|
||||
{
|
||||
int indexOf = m_Params[i].IndexOf( '=' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
{
|
||||
// Must supress stackable warnings
|
||||
|
||||
bool wasStackable = item.Stackable;
|
||||
|
||||
item.Stackable = true;
|
||||
item.Amount = Utility.ToInt32( m_Params[i].Substring( ++indexOf ) );
|
||||
item.Stackable = wasStackable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static Queue m_DeleteQueue = new Queue();
|
||||
|
||||
private static bool FindItem( int x, int y, int z, Map map, Item srcItem )
|
||||
{
|
||||
int itemID = srcItem.ItemID;
|
||||
|
||||
bool res = false;
|
||||
|
||||
IPooledEnumerable eable;
|
||||
|
||||
if ( (TileData.ItemTable[itemID & TileData.MaxItemValue].Flags & TileFlag.LightSource) != 0 )
|
||||
{
|
||||
eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );
|
||||
|
||||
LightType lt = srcItem.Light;
|
||||
string srcName = srcItem.ItemData.Name;
|
||||
|
||||
foreach ( Item item in eable )
|
||||
{
|
||||
if ( item.Z == z )
|
||||
{
|
||||
if ( item.ItemID == itemID )
|
||||
{
|
||||
if ( item.Light != lt )
|
||||
m_DeleteQueue.Enqueue( item );
|
||||
else
|
||||
res = true;
|
||||
}
|
||||
else if ( (item.ItemData.Flags & TileFlag.LightSource) != 0 && item.ItemData.Name == srcName )
|
||||
{
|
||||
m_DeleteQueue.Enqueue( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eable = map.GetItemsInRange( new Point3D( x, y, z ), 0 );
|
||||
|
||||
foreach ( Item item in eable )
|
||||
{
|
||||
if ( item.Z == z && item.ItemID == itemID )
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
while ( m_DeleteQueue.Count > 0 )
|
||||
((Item)m_DeleteQueue.Dequeue()).Delete();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public int Generate( Map[] maps )
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
Item item = null;
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
{
|
||||
DecorationEntrySeers entry = (DecorationEntrySeers)m_Entries[i];
|
||||
Point3D loc = entry.Location;
|
||||
string extra = entry.Extra;
|
||||
|
||||
for ( int j = 0; j < maps.Length; ++j )
|
||||
{
|
||||
if ( item == null )
|
||||
item = Construct();
|
||||
|
||||
if ( item == null )
|
||||
continue;
|
||||
|
||||
if ( FindItem( loc.X, loc.Y, loc.Z, maps[j], item ) )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
item.MoveToWorld( loc, maps[j] );
|
||||
++count;
|
||||
|
||||
item = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( item != null )
|
||||
item.Delete();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static ArrayList ReadAll( string path )
|
||||
{
|
||||
using ( StreamReader ip = new StreamReader( path ) )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
for ( DecorationListSeers v = Read( ip ); v != null; v = Read( ip ) )
|
||||
list.Add( v );
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] m_EmptyParams = new string[0];
|
||||
|
||||
public static DecorationListSeers Read( StreamReader ip )
|
||||
{
|
||||
string line;
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
{
|
||||
line = line.Trim();
|
||||
|
||||
if ( line.Length > 0 && !line.StartsWith( "#" ) )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( string.IsNullOrEmpty( line ) )
|
||||
return null;
|
||||
|
||||
DecorationListSeers list = new DecorationListSeers();
|
||||
|
||||
int indexOf = line.IndexOf( ' ' );
|
||||
|
||||
list.m_Type = ScriptCompiler.FindTypeByName( line.Substring( 0, indexOf++ ), true );
|
||||
|
||||
if ( list.m_Type == null )
|
||||
throw new ArgumentException( String.Format( "Type not found for header: '{0}'", line ) );
|
||||
|
||||
line = line.Substring( indexOf );
|
||||
indexOf = line.IndexOf( '(' );
|
||||
if ( indexOf >= 0 )
|
||||
{
|
||||
list.m_ItemID = Utility.ToInt32( line.Substring( 0, indexOf - 1 ) );
|
||||
|
||||
string parms = line.Substring( ++indexOf );
|
||||
|
||||
if ( line.EndsWith( ")" ) )
|
||||
parms = parms.Substring( 0, parms.Length - 1 );
|
||||
|
||||
list.m_Params = parms.Split( ';' );
|
||||
|
||||
for ( int i = 0; i < list.m_Params.Length; ++i )
|
||||
list.m_Params[i] = list.m_Params[i].Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
list.m_ItemID = Utility.ToInt32( line );
|
||||
list.m_Params = m_EmptyParams;
|
||||
}
|
||||
|
||||
list.m_Entries = new ArrayList();
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
{
|
||||
line = line.Trim();
|
||||
|
||||
if ( line.Length == 0 )
|
||||
break;
|
||||
|
||||
if ( line.StartsWith( "#" ) )
|
||||
continue;
|
||||
|
||||
list.m_Entries.Add( new DecorationEntrySeers( line ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public class DecorationEntrySeers
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private string m_Extra;
|
||||
|
||||
public Point3D Location{ get{ return m_Location; } }
|
||||
public string Extra{ get{ return m_Extra; } }
|
||||
|
||||
public DecorationEntrySeers( string line )
|
||||
{
|
||||
string x, y, z;
|
||||
|
||||
Pop( out x, ref line );
|
||||
Pop( out y, ref line );
|
||||
Pop( out z, ref line );
|
||||
|
||||
m_Location = new Point3D( Utility.ToInt32( x ), Utility.ToInt32( y ), Utility.ToInt32( z ) );
|
||||
m_Extra = line;
|
||||
}
|
||||
|
||||
public void Pop( out string v, ref string line )
|
||||
{
|
||||
int space = line.IndexOf( ' ' );
|
||||
|
||||
if ( space >= 0 )
|
||||
{
|
||||
v = line.Substring( 0, space++ );
|
||||
line = line.Substring( space );
|
||||
}
|
||||
else
|
||||
{
|
||||
v = line;
|
||||
line = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class RemOverseer
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "RemOverseers", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) );
|
||||
CommandSystem.Register( "RemSeers", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) );
|
||||
CommandSystem.Register( "RemOverseer", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) );
|
||||
CommandSystem.Register( "RemSeer", AccessLevel.Administrator, new CommandEventHandler( RemOverseers_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "RemSeers" )]
|
||||
[Aliases( "RemSeer, RemOverseer, RemOverseers" )]
|
||||
[Description( "Remove all Overseers in all facets." )]
|
||||
public static void RemOverseers_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
Mobile from = e.Mobile;
|
||||
World.Broadcast( 0x35, true, "Overseers are being removed, please wait." );
|
||||
DateTime startTime = DateTime.Now;
|
||||
int count = 0;
|
||||
List<Item> itemsremove = new List<Item>();
|
||||
|
||||
foreach ( Item itemremove in World.Items.Values )
|
||||
{
|
||||
if ( itemremove is SpawnsOverseer && itemremove.Parent == null )
|
||||
{
|
||||
itemsremove.Add( itemremove );
|
||||
count +=1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( Item itemremove2 in itemsremove )
|
||||
{
|
||||
itemremove2.Delete();
|
||||
}
|
||||
|
||||
foreach ( Item premiums in World.Items.Values )
|
||||
{
|
||||
if ( premiums is PremiumSpawner && premiums.Parent == null && ((PremiumSpawner)premiums).Running == false )
|
||||
{
|
||||
((PremiumSpawner)premiums).Running = true;
|
||||
((PremiumSpawner)premiums).NextSpawn = TimeSpan.FromSeconds( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
DateTime endTime = DateTime.Now;
|
||||
World.Broadcast( 0x35, true, "{0} Overseers has been removed in {1:F1} seconds.", count, (endTime - startTime).TotalSeconds );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue