Generate map points from Alla data

Sometimes the default maps and even custom ones lack a certain mob location. I for one hate running around spamming /loc trying to find a location. Hopefully this helps and if there is an easier way please say!

For this example we'll say we're after a Fine Chain Tunic of the Savvy which drops from an astray hand in the Plane of Mischief. We check the Alla page and see there are multiple spawn groups and locations for this NPC:

Now I don't know PoM very well and I don't really want to be running around the entire zone spamming /loc trying to find these spawn points. Would be a lot easier if I could get these to show up on the in-game map.

Copy and paste this block from the Alla page into a text file and save it locally:

Grab this PowerShell script and save it locally with a .ps1 extension:

```
# Assemblies
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName Microsoft.VisualBasic

# Request the file path of the raw spawn data
[void][System.Windows.MessageBox]::Show('Select the file you pasted the raw spawn data into on the next screen','File',0,64)
$fileBrowser = New-Object System.Windows.Forms.OpenFileDialog
[void]$fileBrowser.ShowDialog()
$fileBrowser.Dispose()
# Get the content of the raw file
$rawData = Get-Content -Path $fileBrowser.FileName
# Check for valid file data, it's a really shitty check but meh!
If(($rawData.Length -le 0) -or (($rawData -like '\*Spawns every\*') -eq $false)) {
    [void][System.Windows.MessageBox]::Show('Error in data file, check you copied it correctly from the Alla site','Error',0,16)
    Exit
}

# Request NPC name for the map label
$mapNpcName = [Microsoft.VisualBasic.Interaction]::InputBox('Enter the NPC name for the map label, if there are multiple spawns the name will be incremented', 'Map label')
# Check for valid input
If($mapNpcName.Length -gt 0) {
    # Map labels can't contain spaces, must be an underscore
    $mapNPCName = $mapNpcName.Replace(' ','\_')
} Else {
    # No input so go with a default
    $mapNPCName = 'default'
}

# Request colour for the map label, defaults to black (0,0,0) if cancelled or OK'd with no selection
[void][System.Windows.MessageBox]::Show('Select a colour for the map labels on the next screen','Colour',0,64)
$colourDialog = New-Object System.Windows.Forms.ColorDialog
[void]$colourDialog.ShowDialog()
$colourDialog.Dispose()

# Create the map file compatible output
$npcIncrement = 1
ForEach($line in $rawData) {
    # Ignore any lines starting with "Spawns"
    If($line.Substring(0,6) -ne 'Spawns') {
    # Split the spawn group from the location, delimited with :
        # Alla lists the loc as y, x, z so swap it around to x, y, z
            # Invert the loc value, negative becomes positive etc. for X and Y but NOT Z
    $mapOutput += "P $([int]((($line.Split(':'))[1]).Split('/'))[1]\*-1).0000, $([int]((($line.Split(':'))[1]).Split('/'))[0]\*-1).0000, $([int]((($line.Split(':'))[1]).Split('/'))[2]).0000, $(($colourDialog.Color.R).ToString()), $(($colourDialog.Color.G).ToString()), $(($colourDialog.Color.B).ToString()), 2, $($mapNPCName)\_#$($npcIncrement)`r`n"
    $npcIncrement ++
    }
}

cls
Write-Host 'Copy the text between the blocks into the map file with the suffix \_1 (for example mischiefplane\_1.txt)'
Write-Host '======================================================================================================='
Write-Host $mapOutput.Substring(0,$mapOutput.Length-2)
Write-Host '======================================================================================================='

```

Run the script, (you'll probably need to amend the PowerShell execution policy), works either via shell or ISE using desktop 5.1, not tried it on Core yet:

2. Select the file you copied the text into when the file browser pops up
3. Enter the label you want on the map, spaces are fine here and handled in the script
5. Pick a colour, we'll go with purple for this example
6. Copy the output between the === block into the map file (back it up first if you want to be safe)
7. Refresh the map in-game (open another map then back to the target map) and you should see the new labels

There's not a huge amount of error handling in the script nor did I spend long writing it but it's worked OK so far. No warranty implied etc! Any issues with it comment here or shout me in-game.