/// <summary>Handle the console command.</summary> /// <param name="monitor">The monitor with which to write output..</param> /// <param name="locationUtil">Scans and maps locations in the game world.</param> /// <param name="customizations">Manages customized map recolors, NPCs, sprites, names, etc.</param> /// <param name="mapVectors">The in-world tile coordinates and map pixels which represent the same position for each location name.</param> /// <param name="npcMarkers">The tracked NPC markers.</param> /// <param name="locationsWithoutMapVectors">The outdoor location contexts which don't have any map vectors.</param> public static void Handle(IMonitor monitor, LocationUtil locationUtil, ModCustomizations customizations, IDictionary <string, MapVector[]> mapVectors, Dictionary <string, NpcMarker> npcMarkers, IEnumerable <LocationContext> locationsWithoutMapVectors) { if (!Context.IsWorldReady) { monitor.Log("You must load a save to use this command.", LogLevel.Error); return; } StringBuilder output = new(); output.AppendLine(); // current player { // collect info var player = Game1.player; var location = player.currentLocation; string locationName = locationUtil.GetLocationNameFromLevel(location.NameOrUniqueName) ?? location?.NameOrUniqueName; LocationContext context = locationUtil.TryGetContext(locationName, mapGeneratedLevels: false); Vector2 mapPixel = ModEntry.LocationToMap(locationName, player.getTileX(), player.getTileY(), customizations.MapVectors, customizations.LocationExclusions); // collect alternate location names List <string> altNames = new(); if (location.NameOrUniqueName != location.Name) { altNames.Add($"unique: {location.NameOrUniqueName}"); } if (location.NameOrUniqueName != locationName) { output.Append($"context: {locationName}"); } // build output output.AppendLine(); output.AppendLine("======================"); output.AppendLine("== Current player =="); output.AppendLine("======================"); output.AppendLine($"Player: {player.Name} ({player.UniqueMultiplayerID})"); output.AppendLine($"Location: {location.Name}{(altNames.Any() ? $" ({string.Join(", ", altNames)})" : "")}"); output.AppendLine($"Tile: ({player.getTileX()}, {player.getTileY()})"); output.AppendLine($"Excluded: {customizations.LocationExclusions.Contains(locationName)}"); output.AppendLine($"Map pixel: {(mapPixel != ModEntry.Unknown ? $"({mapPixel.X}, {mapPixel.Y})" : "unknown")}"); output.AppendLine(); output.AppendLine("Configured vectors:"); if (customizations.MapVectors.TryGetValue(locationName, out MapVector[] vectors) && vectors.Any())