#W# [ClearFacet <map#> to clear a specific map. Added readme for the .map files in Data/Spawns/*

This commit is contained in:
WarrentyExpired 2026-07-09 15:01:24 -04:00
parent 6e16c646c5
commit d68d106d0d
3 changed files with 110 additions and 34 deletions

View file

@ -216,7 +216,7 @@ namespace Server.Commands
}
}
[Usage( "ClearFacet" )]
/*[Usage( "ClearFacet" )]
[Description( "Deletes all items and mobiles in your facet. Players and their inventory will not be deleted." )]
public static void ClearFacet_OnCommand( CommandEventArgs e )
{
@ -252,6 +252,64 @@ namespace Server.Commands
{
e.Mobile.SendMessage( "There were no objects found to delete." );
}
}*/
[Usage( "ClearFacet [mapID]" )]
[Description( "Deletes all items and mobiles in your facet, or a specific facet if an ID is provided. Players and their inventory will not be deleted." )]
public static void ClearFacet_OnCommand( CommandEventArgs e )
{
Map map = e.Mobile.Map;
if ( e.Length > 0 )
{
if ( int.TryParse( e.Arguments[0], out int mapIndex ) )
{
if ( mapIndex >= 0 && mapIndex < Map.Maps.Length && Map.Maps[mapIndex] != null && Map.Maps[mapIndex] != Map.Internal )
{
map = Map.Maps[mapIndex];
}
else
{
e.Mobile.SendMessage( "Invalid map ID. Please choose a valid active map (usually 0-4)." );
return;
}
}
else
{
e.Mobile.SendMessage( "Invalid format. You must specify a map number. Example: [ClearFacet 2" );
return;
}
}
if ( map == null || map == Map.Internal )
{
e.Mobile.SendMessage( "You may not run that command here." );
return;
}
List<IEntity> list = new List<IEntity>();
foreach ( Item item in World.Items.Values )
if ( item.Map == map && item.Parent == null )
list.Add( item );
foreach ( Mobile m in World.Mobiles.Values )
if ( m.Map == map && !m.Player )
list.Add( m );
if ( list.Count > 0 )
{
CommandLogging.WriteLine( e.Mobile, "{0} {1} starting facet clear of {2} ({3} object{4})", e.Mobile.AccessLevel, CommandLogging.Format( e.Mobile ), map, list.Count, list.Count == 1 ? "" : "s" );
e.Mobile.SendGump(
new WarningGump( 1060635, 30720,
String.Format( "You are about to delete {0} object{1} from {2}. Do you really wish to continue?",
list.Count, list.Count == 1 ? "" : "s", map.Name ),
0xFFC000, 360, 260, new WarningGumpCallback( DeleteList_Callback ), list ) );
}
else
{
e.Mobile.SendMessage( "There were no objects found to delete on {0}.", map.Name );
}
}
[Usage( "GetFollowers" )]
@ -1015,4 +1073,4 @@ namespace Server.Commands
e.Mobile.SendMessage( "Items: {0}", World.Items.Count );
}
}
}
}