promotional bannermobile promotional banner

Simple Objective Icons

Adds a simple sword or bag icon to quest objective nameplates, making quest targets easy to identify.
Screenshot 2026-11-11 140953.png

Screenshot 2026-11-11 140953.png

scorpidworker.png

scorpidworker.png

vilefamiliar.png

vilefamiliar.png

Description

Add a sword or bag icon to enemy quest objective nameplates, making quest targets easy to identify.

How it works

The addon checks enemy nameplate tooltips against your active quest objectives and automatically displays the appropriate icon:

Sword: Incomplete kill objectives.

Bag: Incomplete loot objectives.

Icons are automatically removed from enemy nameplates when their corresponding objectives are completed.

To disable

Uninstall the addon.

Code Review for those interested

local KILL_ICON = "Crosshair_Attack_32"
local LOOT_ICON = "Crosshair_pickup_32"
local ICON_SIZE = 20
local ICON_GAP = 3
local PLATE_GAP = 6
local icons = {}
local shownUnits = {}
-- Find an exact matching objective in the player's quest log.
local function ObjectiveOf(text)
    for i = 1, C_QuestLog.GetNumQuestLogEntries() do
        local info = C_QuestLog.GetInfo(i)

        if info and not info.isHeader then
            local objectives = C_QuestLog.GetQuestObjectives(info.questID) or {}

            for _, objective in ipairs(objectives) do
                if objective.text == text then
                    return objective
                end
            end
        end
    end
end
-- Determine which objectives the enemy has for the player.
local function QuestInfo(unit)
    local data = C_TooltipInfo.GetUnit(unit)
    if not data then return false, false end

    if TooltipUtil and TooltipUtil.SurfaceArgs then
        TooltipUtil.SurfaceArgs(data)
    end

    local kill, loot = false, false
    local types = Enum.TooltipDataLineType

    for _, line in ipairs(data.lines or {}) do
        if TooltipUtil and TooltipUtil.SurfaceArgs then
            TooltipUtil.SurfaceArgs(line)
        end

        if line.type == types.QuestObjective and line.leftText then
            local objective = ObjectiveOf(line.leftText)

            if objective and not objective.finished then
                if objective.type == "monster" then
                    kill = true
                elseif objective.type == "item" then
                    loot = true
                end
            end
        end
    end

    return kill, loot
end
-- Create and cache the two icon frames for a nameplate.
local function GetIcons(plate)
    if icons[plate] then return icons[plate] end

    local frames = {}

    for _, atlas in ipairs({ KILL_ICON, LOOT_ICON }) do
        local frame = CreateFrame("Frame", nil, plate)
        frame:SetSize(ICON_SIZE, ICON_SIZE)
        frame:SetFrameLevel(plate:GetFrameLevel() + 5)

        frame.texture = frame:CreateTexture(nil, "OVERLAY")
        frame.texture:SetAllPoints()
        frame.texture:SetAtlas(atlas)

        frames[#frames + 1] = frame
    end

    icons[plate] = frames
    return frames
end
-- Position and display the required icons.
local function ShowObjectives(plate, kill, loot)
    local frames = GetIcons(plate)
    local offset = PLATE_GAP

    frames[1]:Hide()
    frames[2]:Hide()

    if kill then
        frames[1]:ClearAllPoints()
        frames[1]:SetPoint("RIGHT", plate, "LEFT", -offset, 0)
        frames[1]:Show()

        offset = offset + ICON_SIZE + ICON_GAP
    end

    if loot then
        frames[2]:ClearAllPoints()
        frames[2]:SetPoint("RIGHT", plate, "LEFT", -offset, 0)
        frames[2]:Show()
    end
end
-- Update one nameplate.
local function Update(unit)
    local plate = C_NamePlate.GetNamePlateForUnit(unit)
    if not plate then return end

    local kill, loot = QuestInfo(unit)
    ShowObjectives(plate, kill, loot)
end
-- Refresh all currently visible nameplates.
local function UpdateAll()
    for unit in pairs(shownUnits) do
        Update(unit)
    end
end
-- Register events.
local events = CreateFrame("Frame")
events:RegisterEvent("NAME_PLATE_UNIT_ADDED")
events:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
events:RegisterEvent("QUEST_LOG_UPDATE")
events:RegisterEvent("PLAYER_ENTERING_WORLD")
events:SetScript("OnEvent", function(_, event, unit)
    if event == "NAME_PLATE_UNIT_ADDED" then
        shownUnits[unit] = true
        Update(unit)
    elseif event == "NAME_PLATE_UNIT_REMOVED" then
        shownUnits[unit] = nil
    else
        UpdateAll()
    end
end)

 

Simple Objective Icons Team

profile avatar
  • 1
    Followers
  • 4
    Projects
  • 1.7K
    Downloads

I enjoy making micro purpose specific addons focused on accessibility and performance.

More from DharanEmpireAddons