#W# BuildWorld command.
This commit is contained in:
parent
4e44b70ac1
commit
8b37d93c21
1 changed files with 69 additions and 0 deletions
69
Scripts/Commands/BuildWorld.cs
Normal file
69
Scripts/Commands/BuildWorld.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using Server.Accounting;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Reflection; // Added to access private variables inside BaseSpawner
|
||||
|
||||
namespace Server.Scripts.Commands
|
||||
{
|
||||
public class BuildWorld
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("BuildWorld", AccessLevel.Counselor, new CommandEventHandler( BuildWorlds ));
|
||||
}
|
||||
|
||||
[Usage("BuildWorld")]
|
||||
[Description("This cleans up the world and rebuilds it, leaving players intact.")]
|
||||
public static void BuildWorlds( CommandEventArgs e )
|
||||
{
|
||||
|
||||
Console.WriteLine( "Removing Spawners..." );
|
||||
ArrayList targets = new ArrayList();
|
||||
foreach ( Item item in World.Items.Values )
|
||||
if ( item is PremiumSpawner )
|
||||
{
|
||||
targets.Add( item );
|
||||
}
|
||||
for ( int i = 0; i < targets.Count; ++i )
|
||||
{
|
||||
Item item = ( Item )targets[ i ];
|
||||
item.Delete();
|
||||
}
|
||||
Console.WriteLine( "Removing wild mobs and animals..." );
|
||||
ArrayList mobsToDelete = new ArrayList();
|
||||
|
||||
foreach ( Mobile m in World.Mobiles.Values )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
if ( !bc.Controlled && !bc.IsStabled )
|
||||
{
|
||||
mobsToDelete.Add( bc );
|
||||
}
|
||||
}
|
||||
}
|
||||
for ( int i = 0; i < mobsToDelete.Count; ++i )
|
||||
{
|
||||
Mobile m = ( Mobile )mobsToDelete[ i ];
|
||||
m.Delete();
|
||||
}
|
||||
Console.WriteLine( "Decorating the world...");
|
||||
CommandSystem.Handle(e.Mobile, String.Format("{0}Decorate", CommandSystem.Prefix));
|
||||
CommandSystem.Handle(e.Mobile, String.Format("{0}SignGen", CommandSystem.Prefix));
|
||||
CommandSystem.Handle(e.Mobile, String.Format("{0}TelGen", CommandSystem.Prefix));
|
||||
Console.WriteLine( "Spawning Towns...");
|
||||
Server.SpawnGenerator.Parse( e.Mobile, "towns.map" );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue