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 Server.Gumps; using System.Collections.Generic; using System.Collections; using System.IO; using System; namespace Server.Scripts.Commands { public class BuildWorld { public static void Initialize() { CommandSystem.Register("BuildWorld", AccessLevel.Counselor, new CommandEventHandler( BuildWorld_OnCommand )); } [Usage("BuildWorld")] [Description("Opens the Vaelen World Builder control panel.")] public static void BuildWorld_OnCommand( CommandEventArgs e ) { Mobile m = e.Mobile; if (m.HasGump(typeof(BuildWorldGump))) m.CloseGump(typeof(BuildWorldGump)); m.SendGump(new BuildWorldGump()); } public static void DoWipe( Mobile m ) { m.SendMessage( "Removing ALL Spawners and wild mobs... This may take a moment." ); Console.WriteLine( "Removing Spawners..." ); ArrayList targets = new ArrayList(); foreach ( Item item in World.Items.Values ) { // Widened net: Catches Premium, Standard, and Proxy Base spawners if ( item is PremiumSpawner || item is Spawner || item is BaseSpawner ) { 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 mob in World.Mobiles.Values ) { if ( mob is BaseCreature ) { BaseCreature bc = (BaseCreature)mob; if ( !bc.Controlled && !bc.IsStabled ) { mobsToDelete.Add( bc ); } } } for ( int i = 0; i < mobsToDelete.Count; ++i ) { Mobile mob = ( Mobile )mobsToDelete[ i ]; mob.Delete(); } m.SendMessage( "Wipe Complete: All Spawners and wild mobs deleted!" ); } public static void DoDecorate( Mobile m ) { m.SendMessage( "Generating World Decorations, Signs & Teleporters..." ); Console.WriteLine( "Decorating the world..."); CommandSystem.Handle(m, String.Format("{0}Decorate", CommandSystem.Prefix)); CommandSystem.Handle(m, String.Format("{0}SignGen", CommandSystem.Prefix)); CommandSystem.Handle(m, String.Format("{0}TelGen", CommandSystem.Prefix)); m.SendMessage( "Decorations, Signs, and Teleporters generated!" ); } public static void DoSpawns( Mobile m ) { m.SendMessage( "Parsing map files and generating spawners..." ); Console.WriteLine( "Spawning Overworld..."); Server.SpawnGenerator.Parse( m, "overworld.map" ); Console.WriteLine( "Spawning Town Animals..."); Server.SpawnGenerator.Parse( m, "townanimals.map" ); Console.WriteLine( "Spawning Camps..." ); Server.SpawnGenerator.Parse( m, "danger.map" ); Console.WriteLine( "Spawning NPC's..." ); Server.SpawnGenerator.Parse( m, "npcs.map" ); Console.WriteLine( "Spawning Dungeons..." ); Server.SpawnGenerator.Parse( m, "dungeons.map" ); Console.WriteLine( "Spawning Dungeon Chests..." ); Server.SpawnGenerator.Parse( m, "chests.map" ); if ( Server.Settings.S_DungeonTraps ) { Console.WriteLine( "Spawining Dungeon Floor Traps..." ); Server.SpawnGenerator.Parse( m, "traps.map" ); } m.SendMessage( "Map parsing complete and world populated!" ); } } // ============================================================================== // --- BUILD WORLD GUMP UI --- // ============================================================================== public class BuildWorldGump : Gump { public BuildWorldGump() : base( 50, 50 ) { Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); // Background 3600: Modern semi-transparent black with border AddBackground(0, 0, 350, 360, 3600); // Header AddHtml(0, 15, 350, 20, "