.
Do i got to change something ion this?
[code:1]
using System;
using System.Collections;
using System.IO;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Scripts.Commands;
using Server.Network;
using Server.Gumps;
namespace Server.Scripts.Commands
{
/// <summary>
/// Summary description for CreateWorld.
/// </summary>
public class CreateWorld
{
public CreateWorld()
{
}
public static void Initialize()
{
Server.Commands.Register( "CreateWorld", AccessLevel.Administrator, new CommandEventHandler( Create_OnCommand ) );
}
[Usage( "Creates a new world from scratch (only run this once!)" )]
[Description( "Creates an entire world based on the commands defined." )]
private static void Create_OnCommand( CommandEventArgs e )
{
// Store the mobiles current map
Map map = e.Mobile.Map;
// Construct the entire world based on the commands below
if( e.Arguments.Length == 0 )
{
string[] Args = new string[1] { Path.Combine( Core.BaseDirectory, "items.wsc" ) };
e = new CommandEventArgs( e.Mobile, e.Command, Args[0], Args );
}
try
{
e.Mobile.SendGump( new CreateWorldGump( e ) );
/*
// Decorate the world first
Decorate.Decorate_OnCommand( e );
// Import the items.wsc file into Felucca
e.Mobile.Map = Map.Felucca;
e.Mobile.Say( "Importing WSC into Felucca from file " + e.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( e );
// Import the items.wsc file into Trammel
e.Mobile.Map = Map.Trammel;
e.Mobile.Say( "Importing WSC into Trammel from file " + e.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( e );
// Generate all of the world signs
e.Mobile.Say( "Generating Signs..." );
SignParser.SignGen_OnCommand( e );
// This isn't necessary anymore
//e.Mobile.Say( "Fixing Dungeon Shame..." );
//FixShame.FixShame_OnCommand( e );
// Generate all of the world moongates
e.Mobile.Say( "Generating Moongates..." );
PublicMoongate.MoonGen_OnCommand( e );
// Generate all of the world teleporters
e.Mobile.Say( "Generating Teleporters..." );
GenTeleporter.GenTeleporter_OnCommand( e );
// Generate all of the world doors
e.Mobile.Say( "Generating Doors..." );
DoorGenerator.DoorGen_OnCommand( e );
e.Mobile.Say( "Generating World Spawns..." );
e.Arguments[0] = "Spawns\\Felucca\\";
LoadSpawns( e );
e.Arguments[0] = "Spawns\\Trammel\\";
LoadSpawns( e );
e.Arguments[0] = "Spawns\\Ilshenar\\";
LoadSpawns( e );
e.Arguments[0] = "Spawns\\Malas\\";
LoadSpawns( e );
e.Mobile.Say( "World Creation Completed!" );
*/
}
finally
{
// Place the mobile back on the original map
e.Mobile.Map = map;
}
}
internal static void LoadSpawns( CommandEventArgs e )
{
try
{
// Search the directory specified for any *.xml files
// and load all spawners from each xml file
string[] SpawnFiles = Directory.GetFiles( e.Arguments[0], "*.xml" );
// Load each file
foreach( string SpawnFile in SpawnFiles )
{
e.Arguments[0] = SpawnFile;
XmlSpawner.Load_OnCommand( e );
}
}
catch( System.Exception se )
{
Console.WriteLine( se.ToString() );
}
return;
}
}
public class CreateWorldGump : Gump
{
private CommandEventArgs m_CommandEventArgs;
public CreateWorldGump( CommandEventArgs e ) : base( 30,30 )
{
m_CommandEventArgs = e;
Closable = true;
Dragable = true;
AddPage(0);
AddBackground( 0, 0, 320, 310, 5054 );
AddLabel( 120, 2, 200, "Create World" );
AddImageTiled( 10, 20, 300, 132, 3004 );
AddLabel( 30, 27, 200, "Facet" );
AddLabel( 172, 27, 200, "Spawn" );
AddLabel( 224, 27, 200, "Import Items" );
AddImageTiled( 20, 45, 280, 2, 10001 );
AddImageTiled( 20, 25, 280, 2, 10001 );
AddImageTiled( 20, 25, 2, 122, 10003 );
AddImageTiled( 163, 25, 2, 122, 10003 );
AddImageTiled( 218, 25, 2, 122, 10003 );
AddImageTiled( 300, 25, 2, 122, 10003 );
AddImageTiled( 20, 70, 280, 2, 10001 );
AddImageTiled( 20, 95, 280, 2, 10001 );
AddImageTiled( 20, 120, 280, 2, 10001 );
AddImageTiled( 20, 145, 280, 2, 10001 );
AddLabel( 35, 51, 200, "Trammel" );
AddLabel( 35, 76, 200, "Felucca" );
AddLabel( 35, 101, 200, "Ilshenar" );
AddLabel( 35, 126, 200, "Malas" );
// Facet level options
AddCheck( 181, 48, 210, 211, true, 101 ); // Spawn Trammel
AddCheck( 181, 73, 210, 211, true, 102 ); // Spawn Felucca
AddCheck( 181, 98, 210, 211, true, 103 ); // Spawn Ilshenar
AddCheck( 181, 123, 210, 211, true, 104 );// Spawn Malas
AddCheck( 250, 48, 210, 211, true, 201 ); // Import items.wsc into Trammel
AddCheck( 250, 73, 210, 211, true, 202 ); // Import items.wsc into Felucca
AddLabel( 248, 101, 200, "N/A" );
AddLabel( 248, 127, 200, "N/A" );
// World level options
AddCheck( 20, 155, 210, 211, true, 11 );
AddLabel( 40, 158, 200, "Decorate World - [Decorate"
AddCheck( 20, 180, 210, 211, true, 12 );
AddLabel( 40, 183, 200, "Moongates - [MoonGen"
AddCheck( 20, 205, 210, 211, true, 13 );
AddLabel( 40, 208, 200, "Teleporters - [TelGen"
AddCheck( 20, 230, 210, 211, true, 14 );
AddLabel( 40, 233, 200, "Signs - [SignGen"
AddCheck( 20, 255, 210, 211, true, 15 );
AddLabel( 40, 258, 200, "Doors - [DoorGen"
AddButton( 170, 280, 247, 249, 1, GumpButtonType.Reply, 0 );
AddButton( 245, 280, 241, 243, 0, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
switch( info.ButtonID )
{
case 0: // Closed or Cancel
{
return;
}
default:
{
// Make sure that the OK, button was pressed
if( info.ButtonID == 1 )
{
// Get the array of switches selected
ArrayList Selections = new ArrayList( info.Switches );
// Decorate the world
if( Selections.Contains( 11 ) == true )
{
from.Say( "Decorating World..." );
Decorate.Decorate_OnCommand( m_CommandEventArgs );
}
// Do any facet specific items creation
if( Selections.Contains( 201 ) == true )
{
// Import Trammels 'items.wsc' file
from.Map = Map.Trammel;
from.Say( "Importing WSC into Trammel from file " + m_CommandEventArgs.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( m_CommandEventArgs );
}
if( Selections.Contains( 202 ) == true )
{
// Import Felucca 'items.wsc' file
from.Map = Map.Felucca;
from.Say( "Importing WSC into Felucca from file " + m_CommandEventArgs.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( m_CommandEventArgs );
}
// Generate all of the world moongates
if( Selections.Contains( 12 ) == true )
{
from.Say( "Generating Moongates..." );
PublicMoongate.MoonGen_OnCommand( m_CommandEventArgs );
}
// Generate all of the world teleporters
if( Selections.Contains( 13 ) == true )
{
from.Say( "Generating Teleporters..." );
GenTeleporter.GenTeleporter_OnCommand( m_CommandEventArgs );
}
// Generate all of the world signs
if( Selections.Contains( 14 ) == true )
{
from.Say( "Generating Signs..." );
SignParser.SignGen_OnCommand( m_CommandEventArgs );
}
// Generate all of the world doors
if( Selections.Contains( 15 ) == true )
{
from.Say( "Generating Doors..." );
DoorGenerator.DoorGen_OnCommand( m_CommandEventArgs );
}
// Now spawn any selected facets
if( Selections.Contains( 101 ) == true )
{
from.Say( "Spawning Trammel..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Trammel\\";
CreateWorld.LoadSpawns( m_CommandEventArgs );
from.Say( "Done Spawning Trammel." );
}
if( Selections.Contains( 102 ) == true )
{
from.Say( "Spawning Felucca..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Felucca\\";
CreateWorld.LoadSpawns( m_CommandEventArgs );
from.Say( "Done Spawning Felucca." );
}
if( Selections.Contains( 103 ) == true )
{
from.Say( "Spawning Ilshenar..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Ilshenar\\";
CreateWorld.LoadSpawns( m_CommandEventArgs );
from.Say( "Done Spawning Ilshenar." );
}
if( Selections.Contains( 104 ) == true )
{
from.Say( "Spawning Malas..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Malas\\";
CreateWorld.LoadSpawns( m_CommandEventArgs);
from.Say( "Done Spawning Malas." );
}
}
from.Say( "World Creation Completed!" );
break;
}
}
}
}
}
[/code:1]
Do i got to change something ion this?
[code:1]
using System;
using System.Collections;
using System.IO;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Scripts.Commands;
using Server.Network;
using Server.Gumps;
namespace Server.Scripts.Commands
{
/// <summary>
/// Summary description for CreateWorld.
/// </summary>
public class CreateWorld
{
public CreateWorld()
{
}
public static void Initialize()
{
Server.Commands.Register( "CreateWorld", AccessLevel.Administrator, new CommandEventHandler( Create_OnCommand ) );
}
[Usage( "Creates a new world from scratch (only run this once!)" )]
[Description( "Creates an entire world based on the commands defined." )]
private static void Create_OnCommand( CommandEventArgs e )
{
// Store the mobiles current map
Map map = e.Mobile.Map;
// Construct the entire world based on the commands below
if( e.Arguments.Length == 0 )
{
string[] Args = new string[1] { Path.Combine( Core.BaseDirectory, "items.wsc" ) };
e = new CommandEventArgs( e.Mobile, e.Command, Args[0], Args );
}
try
{
e.Mobile.SendGump( new CreateWorldGump( e ) );
/*
// Decorate the world first
Decorate.Decorate_OnCommand( e );
// Import the items.wsc file into Felucca
e.Mobile.Map = Map.Felucca;
e.Mobile.Say( "Importing WSC into Felucca from file " + e.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( e );
// Import the items.wsc file into Trammel
e.Mobile.Map = Map.Trammel;
e.Mobile.Say( "Importing WSC into Trammel from file " + e.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( e );
// Generate all of the world signs
e.Mobile.Say( "Generating Signs..." );
SignParser.SignGen_OnCommand( e );
// This isn't necessary anymore
//e.Mobile.Say( "Fixing Dungeon Shame..." );
//FixShame.FixShame_OnCommand( e );
// Generate all of the world moongates
e.Mobile.Say( "Generating Moongates..." );
PublicMoongate.MoonGen_OnCommand( e );
// Generate all of the world teleporters
e.Mobile.Say( "Generating Teleporters..." );
GenTeleporter.GenTeleporter_OnCommand( e );
// Generate all of the world doors
e.Mobile.Say( "Generating Doors..." );
DoorGenerator.DoorGen_OnCommand( e );
e.Mobile.Say( "Generating World Spawns..." );
e.Arguments[0] = "Spawns\\Felucca\\";
LoadSpawns( e );
e.Arguments[0] = "Spawns\\Trammel\\";
LoadSpawns( e );
e.Arguments[0] = "Spawns\\Ilshenar\\";
LoadSpawns( e );
e.Arguments[0] = "Spawns\\Malas\\";
LoadSpawns( e );
e.Mobile.Say( "World Creation Completed!" );
*/
}
finally
{
// Place the mobile back on the original map
e.Mobile.Map = map;
}
}
internal static void LoadSpawns( CommandEventArgs e )
{
try
{
// Search the directory specified for any *.xml files
// and load all spawners from each xml file
string[] SpawnFiles = Directory.GetFiles( e.Arguments[0], "*.xml" );
// Load each file
foreach( string SpawnFile in SpawnFiles )
{
e.Arguments[0] = SpawnFile;
XmlSpawner.Load_OnCommand( e );
}
}
catch( System.Exception se )
{
Console.WriteLine( se.ToString() );
}
return;
}
}
public class CreateWorldGump : Gump
{
private CommandEventArgs m_CommandEventArgs;
public CreateWorldGump( CommandEventArgs e ) : base( 30,30 )
{
m_CommandEventArgs = e;
Closable = true;
Dragable = true;
AddPage(0);
AddBackground( 0, 0, 320, 310, 5054 );
AddLabel( 120, 2, 200, "Create World" );
AddImageTiled( 10, 20, 300, 132, 3004 );
AddLabel( 30, 27, 200, "Facet" );
AddLabel( 172, 27, 200, "Spawn" );
AddLabel( 224, 27, 200, "Import Items" );
AddImageTiled( 20, 45, 280, 2, 10001 );
AddImageTiled( 20, 25, 280, 2, 10001 );
AddImageTiled( 20, 25, 2, 122, 10003 );
AddImageTiled( 163, 25, 2, 122, 10003 );
AddImageTiled( 218, 25, 2, 122, 10003 );
AddImageTiled( 300, 25, 2, 122, 10003 );
AddImageTiled( 20, 70, 280, 2, 10001 );
AddImageTiled( 20, 95, 280, 2, 10001 );
AddImageTiled( 20, 120, 280, 2, 10001 );
AddImageTiled( 20, 145, 280, 2, 10001 );
AddLabel( 35, 51, 200, "Trammel" );
AddLabel( 35, 76, 200, "Felucca" );
AddLabel( 35, 101, 200, "Ilshenar" );
AddLabel( 35, 126, 200, "Malas" );
// Facet level options
AddCheck( 181, 48, 210, 211, true, 101 ); // Spawn Trammel
AddCheck( 181, 73, 210, 211, true, 102 ); // Spawn Felucca
AddCheck( 181, 98, 210, 211, true, 103 ); // Spawn Ilshenar
AddCheck( 181, 123, 210, 211, true, 104 );// Spawn Malas
AddCheck( 250, 48, 210, 211, true, 201 ); // Import items.wsc into Trammel
AddCheck( 250, 73, 210, 211, true, 202 ); // Import items.wsc into Felucca
AddLabel( 248, 101, 200, "N/A" );
AddLabel( 248, 127, 200, "N/A" );
// World level options
AddCheck( 20, 155, 210, 211, true, 11 );
AddLabel( 40, 158, 200, "Decorate World - [Decorate"
AddCheck( 20, 180, 210, 211, true, 12 );
AddLabel( 40, 183, 200, "Moongates - [MoonGen"
AddCheck( 20, 205, 210, 211, true, 13 );
AddLabel( 40, 208, 200, "Teleporters - [TelGen"
AddCheck( 20, 230, 210, 211, true, 14 );
AddLabel( 40, 233, 200, "Signs - [SignGen"
AddCheck( 20, 255, 210, 211, true, 15 );
AddLabel( 40, 258, 200, "Doors - [DoorGen"
AddButton( 170, 280, 247, 249, 1, GumpButtonType.Reply, 0 );
AddButton( 245, 280, 241, 243, 0, GumpButtonType.Reply, 0 );
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
switch( info.ButtonID )
{
case 0: // Closed or Cancel
{
return;
}
default:
{
// Make sure that the OK, button was pressed
if( info.ButtonID == 1 )
{
// Get the array of switches selected
ArrayList Selections = new ArrayList( info.Switches );
// Decorate the world
if( Selections.Contains( 11 ) == true )
{
from.Say( "Decorating World..." );
Decorate.Decorate_OnCommand( m_CommandEventArgs );
}
// Do any facet specific items creation
if( Selections.Contains( 201 ) == true )
{
// Import Trammels 'items.wsc' file
from.Map = Map.Trammel;
from.Say( "Importing WSC into Trammel from file " + m_CommandEventArgs.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( m_CommandEventArgs );
}
if( Selections.Contains( 202 ) == true )
{
// Import Felucca 'items.wsc' file
from.Map = Map.Felucca;
from.Say( "Importing WSC into Felucca from file " + m_CommandEventArgs.Arguments[0] + "..." );
ImportWSC.ImportWSC_OnCommand( m_CommandEventArgs );
}
// Generate all of the world moongates
if( Selections.Contains( 12 ) == true )
{
from.Say( "Generating Moongates..." );
PublicMoongate.MoonGen_OnCommand( m_CommandEventArgs );
}
// Generate all of the world teleporters
if( Selections.Contains( 13 ) == true )
{
from.Say( "Generating Teleporters..." );
GenTeleporter.GenTeleporter_OnCommand( m_CommandEventArgs );
}
// Generate all of the world signs
if( Selections.Contains( 14 ) == true )
{
from.Say( "Generating Signs..." );
SignParser.SignGen_OnCommand( m_CommandEventArgs );
}
// Generate all of the world doors
if( Selections.Contains( 15 ) == true )
{
from.Say( "Generating Doors..." );
DoorGenerator.DoorGen_OnCommand( m_CommandEventArgs );
}
// Now spawn any selected facets
if( Selections.Contains( 101 ) == true )
{
from.Say( "Spawning Trammel..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Trammel\\";
CreateWorld.LoadSpawns( m_CommandEventArgs );
from.Say( "Done Spawning Trammel." );
}
if( Selections.Contains( 102 ) == true )
{
from.Say( "Spawning Felucca..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Felucca\\";
CreateWorld.LoadSpawns( m_CommandEventArgs );
from.Say( "Done Spawning Felucca." );
}
if( Selections.Contains( 103 ) == true )
{
from.Say( "Spawning Ilshenar..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Ilshenar\\";
CreateWorld.LoadSpawns( m_CommandEventArgs );
from.Say( "Done Spawning Ilshenar." );
}
if( Selections.Contains( 104 ) == true )
{
from.Say( "Spawning Malas..." );
m_CommandEventArgs.Arguments[0] = "Spawns\\Malas\\";
CreateWorld.LoadSpawns( m_CommandEventArgs);
from.Say( "Done Spawning Malas." );
}
}
from.Say( "World Creation Completed!" );
break;
}
}
}
}
}
[/code:1]