Skip to content

[Bug Description] Minimap tracking menu lists "Find Herbs" twice #42

Description

@Gruikgruik

pfUI Version: installed from source (## Version: @project-version@ in pfUI.toc brues-code/pfUI, master)

Your ClassicAPI Version: 1.9.11

Your Nampower Version: 4.6.2

Other Addons installed:
Aegis_Courier, Aegis_Exchange, Atlas-CFM, BetterCharacterStats, LevelRange-Octo, Magnify,
NampowerSettings, SuperAPI, TWPulse, UnitXP_SP3_Addon, ZonesLevel, perfboostsettings,
pfExtend, pfQuest, pfQuest-turtle


Bug Description

The pfUI minimap tracking dropdown (right-click on the tracking button) shows the entry
"Find Herbs" twice, even though the spellbook only contains one Find Herbs spell.
Both entries are functional and identical they cast the same spellbook slot.

Expected: one entry per tracking spell actually present in the spellbook.

The cause is in modules/tracking.lua. knownTrackingSpells.any contains two Find Herbs
ranks that share the same icon:

{ id = 2383,  icon = "INV_Misc_Flower_02" }, -- Find Herbs (Rank 1)
{ id = 8387,  icon = "INV_Misc_Flower_02" }, -- Find Herbs (Rank 2)

RefreshSpells() matches spellbook entries by icon path and iterates over the whole
spellIdLookup table without stopping at the first hit, while state.spells is keyed by
spellId. So the single Find Herbs spellbook slot matches both 2383 and 8387, producing
two distinct keys pointing at the same spellIndex, hence two identical menu lines.

Any future pair of tracking spells sharing an icon would hit the same problem.

Suggested fix: key state.spells by spellbook slot index instead of spell ID, and break
out of the lookup loop after the first match:

if spellTexture and not state.spells[spellIndex] then
  local lowerTexture = string.lower(spellTexture)
  for spellId, entry in pairs(spellIdLookup) do
    if validIds[spellId] and strfind(lowerTexture, string.lower(entry.icon)) then
      state.spells[spellIndex] = {
        index   = spellIndex,
        name    = spellName,
        texture = spellTexture,
        spellId = spellId,
      }
      break
    end
  end
end

I applied this locally and the duplicate is gone.


Steps to Reproduce

  1. Play any character with Herbalism (Find Herbs learned tested on a Tauren Shman Octowow).
  2. Make sure the pfUI tracking module is enabled (the tracking button next to the minimap).
  3. Right-click the tracking button to open the "Minimap Tracking" dropdown.
  4. "Find Herbs" is listed twice.

Error Log

none

Screenshot / Video

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions