HandyNotes Plugin Documentation

Documentation for the core framework used in Zarillion's HandyNotes expansion plugins.

View the Project on GitHub zarillion/handynotes-plugins

Map System

The Map system provides the foundation for organizing and displaying nodes within specific World of Warcraft zones and areas.

Map Class

ns.Map(attrs)

The base class for all map definitions, providing node management, grouping, and display control.

Properties

Basic Usage

-- Create a new map for Stormwind City
local map = ns.Map({
    id = 84, -- Stormwind City MapID
    settings = true, -- Enable settings panel
    patch = 110000 -- Requires patch 11.0.0+
})

Adding Nodes

Nodes are added to the map using coordinate keys:

-- Add nodes using coordinate notation (XXYY format)
map.nodes[61234567] = ns.node.NPC({
    label = 'Important Vendor',
    icon = 'peg_yw'
})

-- Coordinates: X=61.23, Y=45.67
map.nodes[61234567] = ns.node.Treasure({
    label = 'Hidden Chest',
    icon = 'chest_yw',
    quest = 12345
})

Coordinate System

Coordinates use te 8-digit format from HandyNotes:

-- Examples:
-- 61234567 = X: 61.23, Y: 45.67
-- 50007500 = X: 50.00, Y: 75.00
-- 25759842 = X: 25.75, Y: 98.42

Map Methods

AddNode(coord, node)

Programmatically add a node to the map:

map:AddNode(61234567, ns.node.Rare({
    label = 'Rare Elite',
    icon = 'skull_w'
}))

RemoveNode(coord)

Remove a node from the map:

map:RemoveNode(61234567)

GetNodes()

Get all nodes for the current map:

local nodes = map:GetNodes()
for coord, node in pairs(nodes) do
    print(coord, node.label)
end

Phasing and Availability

Maps support phasing to show different content based on quest progress or other conditions:

local map = ns.Map({
    id = 123,
    phased = function()
        -- Only show if player completed specific quest
        return C_QuestLog.IsQuestFlaggedCompleted(54321)
    end,
    intro = ns.node.Intro({
        label = 'Phase Not Available',
        note = 'Complete quest "Example Quest" to access this content.'
    })
})

Group Integration

Maps work with the Group system to organize and control node visibility:

-- Define groups for this map
map.groups.TREASURES = ns.Group('treasures', 'chest_yw')
map.groups.RARES = ns.Group('rares', 'skull_w')

-- Assign nodes to groups
map.nodes[61234567] = ns.node.Treasure({
    label = 'Treasure Chest',
    group = map.groups.TREASURES
})

map.nodes[71234567] = ns.node.Rare({
    label = 'Rare Monster',
    group = map.groups.RARES
})

Focus Groups

Focus groups allow related nodes to be highlighted together:

-- Create nodes with same focus group
map.nodes[61234567] = ns.node.NPC({
    label = 'Quest Giver',
    fgroup = 'story_chain'
})

map.nodes[71234567] = ns.node.Treasure({
    label = 'Quest Reward',
    fgroup = 'story_chain'
})

-- When hovering one node, all nodes in 'story_chain' will be highlighted

Settings Panel

When settings = true, the map will generate an options panel in the HandyNotes settings:

local map = ns.Map({
    id = 84,
    settings = true -- Creates "Stormwind City" section in settings
})

Map Registration

Maps are automatically registered with the namespace when created:

-- Create map
local stormwind = ns.Map({id = 84})

-- Map is available in namespace
print(ns.maps[84]) -- References the stormwind map

Example: Complete Map Definition

local map = ns.Map({
    id = 84, -- Stormwind City
    settings = true,
    patch = 110000
})

-- Define groups
map.groups.VENDORS = ns.Group('vendors', 'peg_yw')
map.groups.TRAINERS = ns.Group('trainers', 'peg_rd')

-- Add vendor nodes
map.nodes[61234567] = ns.node.Vendor({
    label = 'Armor Vendor',
    group = map.groups.VENDORS,
    rewards = {
        ns.reward.Item(12345),
        ns.reward.Item(12346)
    }
})

-- Add trainer nodes
map.nodes[71234567] = ns.node.NPC({
    label = 'Weapon Master',
    group = map.groups.TRAINERS,
    note = 'Teaches weapon skills'
})