internal static void WorldInfo( Player player, Command cmd ) {
string worldName = cmd.Next();
if( worldName == null ) {
if( player.World == null ) {
player.Message( "Please specify a world name when calling /winfo form console." );
return;
} else {
worldName = player.World.Name;
}
}
World world = WorldManager.FindWorldOrPrintMatches( player, worldName );
if( world == null ) return;
player.Message( "World {0}&S has {1} player(s) on.",
world.GetClassyName(),
world.CountVisiblePlayers(player) );
Map map = world.Map;
// If map is not currently loaded, grab its header from disk
if( map == null ) {
try {
map = MapUtility.LoadHeader( Path.Combine( Paths.MapPath, world.GetMapName() ) );
} catch( Exception ex ) {
player.Message( "Map information could not be loaded: {0}: {1}",
ex.GetType().Name, ex.Message );
}
}
if( map != null ) {
player.Message( "Map dimensions are {0} x {1} x {2}",
map.WidthX, map.WidthY, map.Height );
}
// Print access/build limits
world.AccessSecurity.PrintDescription( player, world, "world", "accessed" );
world.BuildSecurity.PrintDescription( player, world, "world", "modified" );
// Print lock/unlock information
if( world.IsLocked ) {
player.Message( "{0}&S was locked {1} ago by {2}",
world.GetClassyName(),
DateTime.UtcNow.Subtract( world.LockedDate ).ToMiniString(),
world.LockedBy );
} else if( world.UnlockedBy != null ) {
player.Message( "{0}&S was unlocked {1} ago by {2}",
world.GetClassyName(),
DateTime.UtcNow.Subtract( world.UnlockedDate ).ToMiniString(),
world.UnlockedBy );
}
}