#W# BuildWorld is now a Gump.
This commit is contained in:
parent
69290b8c07
commit
ae4db446ea
2 changed files with 152 additions and 30 deletions
|
|
@ -44,11 +44,11 @@
|
|||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||135|120|0|1|5|10|-1|30|1|15|5|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||256|1343|0|1|5|10|-1|30|1|15|5|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||438|1357|2|1|5|10|-1|15|1|10|0|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||362|1413|1|1|5|10|-1|30|1|15|5|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||362|1413|1|1|5|10|-1|30|1|10|3|3|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||213|1433|1|1|5|10|-1|30|1|15|5|5|3|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||269|1441|1|1|5|10|-1|30|1|15|5|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||358|1462|3|1|5|10|-1|30|1|15|5|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||405|1437|1|1|5|10|-1|30|1|15|0|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||358|1462|3|1|5|10|-1|30|1|10|3|3|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|||405|1437|1|1|5|10|-1|30|1|10|0|5|0|0|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|spawn_d||870|1736|5|1|5|10|-1|30|1|5|5|5|5|2|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|spawn_d||988|1674|3|1|5|10|-1|30|1|5|5|5|5|2|0
|
||||
*|spawnbirds|spawnanimals|spawncritters|spawn_a|spawn_d||997|1711|3|1|5|10|-1|30|1|5|5|5|5|2|0
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ 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;
|
||||
using System.Reflection; // Added to access private variables inside BaseSpawner
|
||||
|
||||
namespace Server.Scripts.Commands
|
||||
{
|
||||
|
|
@ -19,34 +19,52 @@ namespace Server.Scripts.Commands
|
|||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register("BuildWorld", AccessLevel.Counselor, new CommandEventHandler( BuildWorlds ));
|
||||
CommandSystem.Register("BuildWorld", AccessLevel.Counselor, new CommandEventHandler( BuildWorld_OnCommand ));
|
||||
}
|
||||
|
||||
[Usage("BuildWorld")]
|
||||
[Description("This cleans up the world and rebuilds it, leaving players intact.")]
|
||||
public static void BuildWorlds( CommandEventArgs e )
|
||||
[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());
|
||||
}
|
||||
|
||||
// ==============================================================================
|
||||
// --- MODULAR GENERATION METHODS ---
|
||||
// ==============================================================================
|
||||
|
||||
public static void DoWipe( Mobile m )
|
||||
{
|
||||
m.SendMessage( 38, "Removing Premium Spawners and wild mobs... This may take a moment." );
|
||||
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();
|
||||
}
|
||||
|
||||
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 )
|
||||
foreach ( Mobile mob in World.Mobiles.Values )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
if ( mob is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
BaseCreature bc = (BaseCreature)mob;
|
||||
if ( !bc.Controlled && !bc.IsStabled )
|
||||
{
|
||||
mobsToDelete.Add( bc );
|
||||
|
|
@ -55,22 +73,126 @@ namespace Server.Scripts.Commands
|
|||
}
|
||||
for ( int i = 0; i < mobsToDelete.Count; ++i )
|
||||
{
|
||||
Mobile m = ( Mobile )mobsToDelete[ i ];
|
||||
m.Delete();
|
||||
Mobile mob = ( Mobile )mobsToDelete[ i ];
|
||||
mob.Delete();
|
||||
}
|
||||
|
||||
m.SendMessage( 63, "Wipe Complete: Premium Spawners and wild mobs deleted!" );
|
||||
}
|
||||
|
||||
public static void DoDecorate( Mobile m )
|
||||
{
|
||||
m.SendMessage( 38, "Generating World Decorations, Signs & Teleporters..." );
|
||||
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));
|
||||
|
||||
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( 63, "Decorations, Signs, and Teleporters generated!" );
|
||||
}
|
||||
|
||||
public static void DoSpawns( Mobile m )
|
||||
{
|
||||
m.SendMessage( 38, "Parsing map files and generating spawners..." );
|
||||
|
||||
Console.WriteLine( "Spawning Overworld...");
|
||||
Server.SpawnGenerator.Parse( e.Mobile, "overworld.map" );
|
||||
Server.SpawnGenerator.Parse( m, "overworld.map" );
|
||||
|
||||
Console.WriteLine( "Spawning Town Animals...");
|
||||
Server.SpawnGenerator.Parse( e.Mobile, "townanimals.map" );
|
||||
Server.SpawnGenerator.Parse( m, "townanimals.map" );
|
||||
|
||||
Console.WriteLine( "Spawning Camps..." );
|
||||
Server.SpawnGenerator.Parse( e.Mobile, "camps.map" );
|
||||
Server.SpawnGenerator.Parse( m, "camps.map" );
|
||||
|
||||
Console.WriteLine( "Spawning NPC's..." );
|
||||
Console.WriteLine( "Spawning Dungeons..." );
|
||||
Console.WriteLine( "The world has been built." );
|
||||
|
||||
m.SendMessage( 63, "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, "<CENTER><BASEFONT COLOR=#FFFFFF>Vaelen World Builder</BASEFONT></CENTER>", false, false);
|
||||
AddImageTiled(25, 40, 300, 2, 96); // Divider line
|
||||
|
||||
AddHtml(25, 55, 300, 40, "<BASEFONT COLOR=#CCCCCC>Select a specific system to generate, or run the Full Rebuild to wipe and recreate everything.</BASEFONT>", false, false);
|
||||
|
||||
// Button 1: Full Rebuild
|
||||
AddButton(35, 105, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddLabel(75, 106, 1152, "Run Full Rebuild (Wipe & Generate)");
|
||||
|
||||
AddImageTiled(35, 140, 280, 1, 96); // Divider line
|
||||
|
||||
// Button 2: Wipe Only
|
||||
AddButton(35, 155, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddLabel(75, 156, 38, "Surgical Sweep (Wipe Spawners/Mobs)");
|
||||
|
||||
// Button 3: Decorate Only
|
||||
AddButton(35, 195, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddLabel(75, 196, 63, "Generate World Decor & Teleporters");
|
||||
|
||||
// Button 4: Map Spawns Only
|
||||
AddButton(35, 235, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddLabel(75, 236, 63, "Parse Map Files & Generate Spawns");
|
||||
|
||||
AddImageTiled(35, 280, 280, 1, 96); // Divider line
|
||||
|
||||
// Close Button
|
||||
AddButton(125, 305, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddLabel(165, 307, 1152, "Close Panel");
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
Mobile m = sender.Mobile;
|
||||
|
||||
if (m == null || m.Deleted || info.ButtonID == 0)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Full Rebuild
|
||||
BuildWorld.DoWipe( m );
|
||||
BuildWorld.DoDecorate( m );
|
||||
BuildWorld.DoSpawns( m );
|
||||
Console.WriteLine( "The world has been built." );
|
||||
m.SendMessage( 1152, "The world has been completely rebuilt." );
|
||||
break;
|
||||
|
||||
case 2: // Wipe Only
|
||||
BuildWorld.DoWipe( m );
|
||||
m.SendGump(new BuildWorldGump());
|
||||
break;
|
||||
|
||||
case 3: // Decorate Only
|
||||
BuildWorld.DoDecorate( m );
|
||||
m.SendGump(new BuildWorldGump());
|
||||
break;
|
||||
|
||||
case 4: // Spawns Only
|
||||
BuildWorld.DoSpawns( m );
|
||||
m.SendGump(new BuildWorldGump());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue