@piekasz/wow-mcp 0.0.0-stage → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +674 -0
  2. package/NOTICE +37 -0
  3. package/README.md +41 -2
  4. package/addon/WowMcp/AuctionTooltip.lua +106 -0
  5. package/addon/WowMcp/Commands.lua +259 -0
  6. package/addon/WowMcp/Compat.lua +167 -0
  7. package/addon/WowMcp/Core.lua +50 -0
  8. package/addon/WowMcp/Events.lua +62 -0
  9. package/addon/WowMcp/Items.lua +314 -0
  10. package/addon/WowMcp/Maps.lua +66 -0
  11. package/addon/WowMcp/MinimapButton.lua +114 -0
  12. package/addon/WowMcp/Options.lua +208 -0
  13. package/addon/WowMcp/Panel.lua +294 -0
  14. package/addon/WowMcp/QuestDb.lua +303 -0
  15. package/addon/WowMcp/QuestRewards.lua +137 -0
  16. package/addon/WowMcp/Sections/ActionBars.lua +54 -0
  17. package/addon/WowMcp/Sections/Auctions.lua +305 -0
  18. package/addon/WowMcp/Sections/Bank.lua +48 -0
  19. package/addon/WowMcp/Sections/Buyback.lua +47 -0
  20. package/addon/WowMcp/Sections/Character.lua +177 -0
  21. package/addon/WowMcp/Sections/Cooldowns.lua +76 -0
  22. package/addon/WowMcp/Sections/Currencies.lua +47 -0
  23. package/addon/WowMcp/Sections/Deaths.lua +43 -0
  24. package/addon/WowMcp/Sections/Dungeons.lua +117 -0
  25. package/addon/WowMcp/Sections/EquipmentSets.lua +83 -0
  26. package/addon/WowMcp/Sections/FlightPaths.lua +145 -0
  27. package/addon/WowMcp/Sections/Friends.lua +70 -0
  28. package/addon/WowMcp/Sections/Group.lua +101 -0
  29. package/addon/WowMcp/Sections/Guide.lua +317 -0
  30. package/addon/WowMcp/Sections/Guild.lua +131 -0
  31. package/addon/WowMcp/Sections/Inspect.lua +100 -0
  32. package/addon/WowMcp/Sections/Inventory.lua +64 -0
  33. package/addon/WowMcp/Sections/Legacy.lua +375 -0
  34. package/addon/WowMcp/Sections/Loot.lua +170 -0
  35. package/addon/WowMcp/Sections/Macros.lua +26 -0
  36. package/addon/WowMcp/Sections/Mail.lua +70 -0
  37. package/addon/WowMcp/Sections/Note.lua +38 -0
  38. package/addon/WowMcp/Sections/Pet.lua +127 -0
  39. package/addon/WowMcp/Sections/Played.lua +52 -0
  40. package/addon/WowMcp/Sections/Probe.lua +79 -0
  41. package/addon/WowMcp/Sections/Professions.lua +129 -0
  42. package/addon/WowMcp/Sections/Pvp.lua +45 -0
  43. package/addon/WowMcp/Sections/QuestDb.lua +106 -0
  44. package/addon/WowMcp/Sections/QuestGiver.lua +45 -0
  45. package/addon/WowMcp/Sections/Quests.lua +146 -0
  46. package/addon/WowMcp/Sections/Recipes.lua +195 -0
  47. package/addon/WowMcp/Sections/Reputation.lua +56 -0
  48. package/addon/WowMcp/Sections/Spells.lua +87 -0
  49. package/addon/WowMcp/Sections/Stable.lua +90 -0
  50. package/addon/WowMcp/Sections/Talents.lua +137 -0
  51. package/addon/WowMcp/Sections/Trainer.lua +58 -0
  52. package/addon/WowMcp/Sections/Vendor.lua +72 -0
  53. package/addon/WowMcp/Sections/XpGains.lua +258 -0
  54. package/addon/WowMcp/Snapshot.lua +412 -0
  55. package/addon/WowMcp/Store.lua +142 -0
  56. package/addon/WowMcp/TalentGrid.lua +171 -0
  57. package/addon/WowMcp/Timing.lua +61 -0
  58. package/addon/WowMcp/TraitTree.lua +158 -0
  59. package/addon/WowMcp/WowMcp.lua +24 -0
  60. package/addon/WowMcp/WowMcp.toc +72 -0
  61. package/bin/wow-mcp.js +248 -0
  62. package/package.json +41 -4
@@ -0,0 +1,47 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section currencies: currencies and tokens (the Currency window). The client may have C_CurrencyInfo
5
+ -- or the old GetCurrencyListInfo; collapsed headers hide their currencies, so they are skipped.
6
+
7
+ local _, ns = ...
8
+ local plain, callFirst, firstValue = ns.Compat.plain, ns.Compat.callFirst, ns.Compat.firstValue
9
+
10
+ -- Currency list row: name, isHeader, quantity, maxQuantity.
11
+ local function currencyRow(results)
12
+ if type(results[1]) == "table" then
13
+ local info = results[1]
14
+ return plain(info.name), info.isHeader, plain(info.quantity), plain(info.maxQuantity)
15
+ end
16
+ -- Old version: name, isHeader, isExpanded, isUnused, isWatched, count, ...
17
+ return plain(results[1]), results[2], plain(results[6]), nil
18
+ end
19
+
20
+ local function currencyEntry(index, name, quantity, maxQuantity, header)
21
+ local entry = { name = name, quantity = quantity, group = header }
22
+ if type(maxQuantity) == "number" and maxQuantity > 0 then entry.max = maxQuantity end
23
+ local link = firstValue({ "C_CurrencyInfo.GetCurrencyListLink", "GetCurrencyListLink" }, index)
24
+ if type(link) == "string" then entry.id = tonumber(link:match("currency:(%d+)")) end
25
+ return entry
26
+ end
27
+
28
+ local function collectCurrencies()
29
+ local sizeResult = callFirst({ "C_CurrencyInfo.GetCurrencyListSize", "GetCurrencyListSize" })
30
+ local size = sizeResult and plain(sizeResult[1])
31
+ if type(size) ~= "number" then return nil end
32
+ local currencies, header = {}, nil
33
+ for index = 1, size do
34
+ local results = callFirst({ "C_CurrencyInfo.GetCurrencyListInfo", "GetCurrencyListInfo" }, index)
35
+ if results then
36
+ local name, isHeader, quantity, maxQuantity = currencyRow(results)
37
+ if name and isHeader then
38
+ header = name
39
+ elseif name then
40
+ currencies[#currencies + 1] = currencyEntry(index, name, quantity, maxQuantity, header)
41
+ end
42
+ end
43
+ end
44
+ return currencies
45
+ end
46
+
47
+ ns.Snapshot.addSection("currencies", collectCurrencies)
@@ -0,0 +1,43 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section deaths: the character's death counter and the last few (zone, level, time).
5
+ -- Counts the PLAYER_DEAD event; the data lives in the character's saved dump and passes
6
+ -- through subsequent dumps like window sections. The addon only records that you died.
7
+
8
+ local _, ns = ...
9
+ local firstValue = ns.Compat.firstValue
10
+
11
+ local MAX_RECENT = 20
12
+
13
+ local function currentDeaths(current)
14
+ local deaths = current.deaths
15
+ if type(deaths) ~= "table" then deaths = {} end
16
+ if type(deaths.count) ~= "number" then deaths.count = 0 end
17
+ if type(deaths.recent) ~= "table" then deaths.recent = {} end
18
+ return deaths
19
+ end
20
+
21
+ local function deathPlace()
22
+ return {
23
+ zone = firstValue({ "GetRealZoneText" }),
24
+ subZone = firstValue({ "GetSubZoneText" }),
25
+ level = firstValue({ "UnitLevel" }, "player"),
26
+ at = time(),
27
+ }
28
+ end
29
+
30
+ local function trimOldest(recent)
31
+ while #recent > MAX_RECENT do table.remove(recent, 1) end
32
+ end
33
+
34
+ local function onPlayerDead()
35
+ local deaths = currentDeaths(ns.Snapshot.current())
36
+ deaths.count = deaths.count + 1
37
+ deaths.recent[#deaths.recent + 1] = deathPlace()
38
+ trimOldest(deaths.recent)
39
+ ns.Snapshot.current().deaths = deaths
40
+ end
41
+
42
+ ns.Snapshot.addWindowSection("deaths", nil, nil, { quiet = true })
43
+ ns.Events.on("PLAYER_DEAD", ns.Snapshot.whenEnabled("deaths", function() pcall(onPlayerDead) end))
@@ -0,0 +1,117 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section dungeons: what the client itself says about dungeons (the group finder) and
5
+ -- saved lockouts. Level ranges from the game take precedence over the server's table.
6
+
7
+ local _, ns = ...
8
+ local plain, callFirst, firstValue = ns.Compat.plain, ns.Compat.callFirst, ns.Compat.firstValue
9
+
10
+ local MAX_ENTRIES = 200
11
+
12
+ -- A plain number or nil (clients that return fewer values leave the field out).
13
+ local function numberOrNil(value)
14
+ value = plain(value)
15
+ if type(value) == "number" then return value end
16
+ return nil
17
+ end
18
+
19
+ local function lfgCategoryName(categoryID)
20
+ local catInfo = callFirst({ "C_LFGList.GetLfgCategoryInfo", "C_LFGList.GetCategoryInfo" }, categoryID)
21
+ return catInfo and (type(catInfo[1]) == "table" and plain(catInfo[1].name) or plain(catInfo[1]))
22
+ end
23
+
24
+ local function lfgActivity(activityID, categoryName)
25
+ local info = callFirst({ "C_LFGList.GetActivityInfoTable" }, activityID)
26
+ info = info and info[1]
27
+ if not (type(info) == "table" and plain(info.fullName)) then return nil end
28
+ return {
29
+ id = activityID, name = info.fullName, category = categoryName,
30
+ categoryID = plain(info.categoryID), groupID = plain(info.groupFinderActivityGroupID),
31
+ minLevel = plain(info.minLevel), maxLevel = plain(info.maxLevel),
32
+ minLevelSuggestion = plain(info.minLevelSuggestion),
33
+ maxLevelSuggestion = plain(info.maxLevelSuggestion),
34
+ maxPlayers = plain(info.maxNumPlayers),
35
+ }
36
+ end
37
+
38
+ -- Appends the activities of one category; returns true when the list reached the limit.
39
+ local function appendCategoryActivities(activities, categoryID)
40
+ local categoryName = lfgCategoryName(categoryID)
41
+ local acts = callFirst({ "C_LFGList.GetAvailableActivities" }, categoryID)
42
+ for _, activityID in ipairs((acts and type(acts[1]) == "table") and acts[1] or {}) do
43
+ activities[#activities + 1] = lfgActivity(activityID, categoryName)
44
+ if #activities >= MAX_ENTRIES then return true end
45
+ end
46
+ return false
47
+ end
48
+
49
+ -- C_LFGList: categories (Dungeons, Raids, ...) and activities with a level range.
50
+ -- The limit applies to the whole list, not to a single category.
51
+ local function lfgListActivities()
52
+ local cats = callFirst({ "C_LFGList.GetAvailableCategories" })
53
+ if not (cats and type(cats[1]) == "table") then return nil end
54
+ local activities = {}
55
+ for _, categoryID in ipairs(cats[1]) do
56
+ if appendCategoryActivities(activities, categoryID) then break end
57
+ end
58
+ if #activities == 0 then return nil end
59
+ return activities
60
+ end
61
+
62
+ -- Older LFG (GetLFGDungeonInfo) with the ID list from GetLFDChoiceOrder.
63
+ local function lfgDungeons()
64
+ local order = callFirst({ "GetLFDChoiceOrder" })
65
+ if not (order and type(order[1]) == "table" and ns.Compat.resolve("GetLFGDungeonInfo")) then return nil end
66
+ local dungeons = {}
67
+ for _, id in ipairs(order[1]) do
68
+ local r = callFirst({ "GetLFGDungeonInfo" }, id)
69
+ if r and plain(r[1]) then
70
+ -- name, typeID, subtypeID, minLevel, maxLevel, recLevel, minRecLevel, maxRecLevel, expansionLevel, groupID,
71
+ -- texture, difficulty, maxPlayers (13), description, isHoliday, bonusRep, minPlayers, isTimewalker,
72
+ -- name2, minGearLevel, isScalingDungeon, lfgMapID (22: the instance's map ID, same in every language)
73
+ dungeons[#dungeons + 1] = {
74
+ id = id, name = r[1], minLevel = plain(r[4]), maxLevel = plain(r[5]),
75
+ recLevel = plain(r[6]), minRecLevel = plain(r[7]), maxRecLevel = plain(r[8]),
76
+ maxPlayers = plain(r[13]), typeID = numberOrNil(r[2]), groupID = numberOrNil(r[10]),
77
+ mapID = numberOrNil(r[22]),
78
+ }
79
+ end
80
+ if #dungeons >= MAX_ENTRIES then break end
81
+ end
82
+ if #dungeons == 0 then return nil end
83
+ return dungeons
84
+ end
85
+
86
+ -- Saved instance lockouts (raid ID).
87
+ local function savedLockouts()
88
+ local saved = firstValue({ "GetNumSavedInstances" })
89
+ if not (type(saved) == "number" and saved > 0) then return nil end
90
+ local lockouts = {}
91
+ for i = 1, saved do
92
+ local r = callFirst({ "GetSavedInstanceInfo" }, i)
93
+ if r and plain(r[1]) then
94
+ -- name, id, reset, difficultyID, locked, extended, mostsig, isRaid, maxPlayers, difficultyName,
95
+ -- numEncounters, encounterProgress, extendDisabled, instanceID (14: the instance's map ID)
96
+ local reset = plain(r[3])
97
+ lockouts[#lockouts + 1] = {
98
+ name = r[1], id = plain(r[2]), instanceID = numberOrNil(r[14]), difficultyID = numberOrNil(r[4]),
99
+ resetAt = type(reset) == "number" and (time() + reset) or nil,
100
+ locked = r[5] and true or false, raid = r[8] and true or nil, maxPlayers = plain(r[9]),
101
+ difficulty = plain(r[10]), encounters = plain(r[11]), killed = plain(r[12]),
102
+ }
103
+ end
104
+ end
105
+ return lockouts
106
+ end
107
+
108
+ local function collectDungeons()
109
+ local out = {}
110
+ out.activities = lfgListActivities()
111
+ out.lfg = lfgDungeons()
112
+ out.lockouts = savedLockouts()
113
+ if next(out) == nil then return nil end
114
+ return out
115
+ end
116
+
117
+ ns.Snapshot.addSection("dungeons", collectDungeons)
@@ -0,0 +1,83 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section equipmentSets: equipment sets saved by the player (name, items in slots,
5
+ -- whether equipped). Reads C_EquipmentSet, and in older clients the classic functions; without the API
6
+ -- the section is simply absent from the dump. Equips and changes nothing.
7
+
8
+ local _, ns = ...
9
+ local plain, callFirst, firstValue = ns.Compat.plain, ns.Compat.callFirst, ns.Compat.firstValue
10
+ local Items = ns.Items
11
+
12
+ local MAX_SETS = 30
13
+
14
+ -- Set items: a slot -> itemID array. Value 0 is an empty slot, 1 is an ignored slot.
15
+ local function setItems(itemIDs)
16
+ local items = {}
17
+ if type(itemIDs) ~= "table" then return items end
18
+ local slots = {}
19
+ for slot in pairs(itemIDs) do
20
+ if type(slot) == "number" then slots[#slots + 1] = slot end
21
+ end
22
+ table.sort(slots)
23
+ for _, slot in ipairs(slots) do
24
+ local id = plain(itemIDs[slot])
25
+ if type(id) == "number" and id > 1 then
26
+ local name = firstValue({ "C_Item.GetItemNameByID" }, id)
27
+ items[#items + 1] = { slot = Items.EQUIPMENT_SLOTS[slot] or tostring(slot), id = id, name = name }
28
+ end
29
+ end
30
+ return items
31
+ end
32
+
33
+ local function modernSets()
34
+ local ids = callFirst({ "C_EquipmentSet.GetEquipmentSetIDs" })
35
+ if not (ids and type(ids[1]) == "table") then return nil end
36
+ local sets = {}
37
+ for _, setID in ipairs(ids[1]) do
38
+ local info = callFirst({ "C_EquipmentSet.GetEquipmentSetInfo" }, setID)
39
+ local name = info and plain(info[1])
40
+ if name then
41
+ local itemIDs = callFirst({ "C_EquipmentSet.GetItemIDs" }, setID)
42
+ sets[#sets + 1] = {
43
+ name = name,
44
+ id = plain(setID),
45
+ isEquipped = plain(info[4]) and true or false,
46
+ missing = plain(info[8]),
47
+ items = setItems(itemIDs and itemIDs[1]),
48
+ }
49
+ end
50
+ end
51
+ return sets
52
+ end
53
+
54
+ -- Classic API: sets by number, items by set name.
55
+ local function legacySets()
56
+ local count = firstValue({ "GetNumEquipmentSets" })
57
+ if type(count) ~= "number" then return nil end
58
+ local sets = {}
59
+ for index = 1, count do
60
+ local info = callFirst({ "GetEquipmentSetInfo" }, index)
61
+ local name = info and plain(info[1])
62
+ if name then
63
+ local itemIDs = callFirst({ "GetEquipmentSetItemIDs" }, name)
64
+ sets[#sets + 1] = {
65
+ name = name,
66
+ id = plain(info[3]),
67
+ isEquipped = plain(info[4]) and true or false,
68
+ missing = plain(info[8]),
69
+ items = setItems(itemIDs and itemIDs[1]),
70
+ }
71
+ end
72
+ end
73
+ return sets
74
+ end
75
+
76
+ local function collectEquipmentSets()
77
+ local sets = modernSets() or legacySets()
78
+ if not sets then return nil end
79
+ while #sets > MAX_SETS do table.remove(sets) end
80
+ return sets
81
+ end
82
+
83
+ ns.Snapshot.addSection("equipmentSets", collectEquipmentSets)
@@ -0,0 +1,145 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section flightPaths (from the window): flight points visible on the flight master's map.
5
+ -- Diagnostics (0.7.1): taxiMapID, nodeFields (fields of the first raw node with types)
6
+ -- and zoneSources (where the zones came from: node, zoneMap, position). A position that only gives a continent
7
+ -- (0.12.0) goes to the node's continent field, never to zone.
8
+
9
+ local _, ns = ...
10
+ local plain = ns.Compat.plain
11
+
12
+ local NODE_STATES = { [0] = "current", [1] = "reachable", [2] = "unreachable" }
13
+
14
+ -- Node coordinates (0-1 on the continent map): the position field (Vector2D or {x, y}) or x and y on the node itself.
15
+ local function nodePosition(node)
16
+ local position = node.position
17
+ if type(position) == "table" and type(position.GetXY) == "function" then
18
+ local ok, x, y = pcall(position.GetXY, position)
19
+ if ok and type(plain(x)) == "number" and type(plain(y)) == "number" then return x, y end
20
+ end
21
+ if type(position) == "table" and type(plain(position.x)) == "number" and type(plain(position.y)) == "number" then
22
+ return position.x, position.y
23
+ end
24
+ if type(plain(node.x)) == "number" and type(plain(node.y)) == "number" then return node.x, node.y end
25
+ return nil
26
+ end
27
+
28
+ local CONTINENT_MAP_TYPE = 2 -- Enum.UIMapType.Continent
29
+ local ZONE_MAP_TYPE = 3 -- Enum.UIMapType.Zone
30
+ local mapType, playerContinent = ns.Maps.mapType, ns.Maps.playerContinent
31
+
32
+ -- Zone of each flight point from map data: for each map zone (C_Map.GetMapChildrenInfo)
33
+ -- the list of its points (C_TaxiMap.GetTaxiNodesForMap). Only reads map data, asks the server nothing.
34
+ -- Adds to zones: nodeID or point name -> { name = zone name, mapID = the zone's UiMapID }.
35
+ local function addZonesFromChildMaps(zones, mapID)
36
+ if not (mapID and C_Map and C_Map.GetMapChildrenInfo and C_TaxiMap and C_TaxiMap.GetTaxiNodesForMap) then return end
37
+ local ok, children = pcall(C_Map.GetMapChildrenInfo, mapID, mapType("Zone", ZONE_MAP_TYPE), true)
38
+ if not (ok and type(children) == "table") then return end
39
+ for _, child in ipairs(children) do
40
+ local childID, zone = plain(child.mapID), plain(child.name)
41
+ if childID and type(zone) == "string" and zone ~= "" then
42
+ local okNodes, nodes = pcall(C_TaxiMap.GetTaxiNodesForMap, childID)
43
+ for _, node in ipairs(okNodes and type(nodes) == "table" and nodes or {}) do
44
+ local id, name = plain(node.nodeID), plain(node.name)
45
+ local entry = { name = zone, mapID = childID }
46
+ if id and zones[id] == nil then zones[id] = entry end
47
+ if name and zones[name] == nil then zones[name] = entry end
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ -- Zone of a flight point, where it came from and the zone's map ID (nil when unknown): a node field, the zone's
54
+ -- point list or the map at the node's position. A fourth result is the continent name when the position only gave that.
55
+ local function nodeZone(node, mapID, childZones)
56
+ for _, field in ipairs({ "zoneName", "zone", "areaName" }) do
57
+ local zone = plain(node[field])
58
+ if type(zone) == "string" and zone ~= "" then return zone, "node" end
59
+ end
60
+ local id, name = plain(node.nodeID), plain(node.name)
61
+ local known = (id and childZones[id]) or (name and childZones[name])
62
+ if known then return known.name, "zoneMap", known.mapID end
63
+ if not (mapID and C_Map and C_Map.GetMapInfoAtPosition) then return nil end
64
+ local x, y = nodePosition(node)
65
+ if not x then return nil end
66
+ local ok, info = pcall(C_Map.GetMapInfoAtPosition, mapID, x, y)
67
+ if ok and type(info) == "table" then
68
+ local zone, infoType = plain(info.name), plain(info.mapType)
69
+ if type(zone) ~= "string" or zone == "" or plain(info.mapID) == mapID then return nil end
70
+ -- A map above zone level (continent, world) is no zone: addon 0.7.0 wrote "Eastern Kingdoms" as the zone
71
+ -- of every point. Such a name is kept as continent instead.
72
+ if type(infoType) == "number" and infoType < mapType("Zone", ZONE_MAP_TYPE) then
73
+ return nil, nil, nil, (infoType == mapType("Continent", CONTINENT_MAP_TYPE)) and zone or nil
74
+ end
75
+ return zone, "position", plain(info.mapID)
76
+ end
77
+ return nil
78
+ end
79
+
80
+ -- Field names of the first raw node (diagnostics of the client's data shape).
81
+ local function fieldNames(node)
82
+ local names = {}
83
+ for key, value in pairs(node) do
84
+ if type(key) == "string" then names[#names + 1] = key .. ":" .. type(value) end
85
+ end
86
+ table.sort(names)
87
+ return names
88
+ end
89
+
90
+ local function addTaxiMapNodes(flights)
91
+ if not (C_TaxiMap and C_TaxiMap.GetAllTaxiNodes and GetTaxiMapID) then return end
92
+ local mapID = plain(GetTaxiMapID())
93
+ local ok, taxiNodes = pcall(C_TaxiMap.GetAllTaxiNodes, mapID)
94
+ if not (ok and type(taxiNodes) == "table") then return end
95
+ flights.taxiMapID = mapID
96
+ local childZones = {}
97
+ addZonesFromChildMaps(childZones, mapID)
98
+ local continent = playerContinent()
99
+ if continent ~= mapID then addZonesFromChildMaps(childZones, continent) end
100
+ local sources = {}
101
+ for _, node in ipairs(taxiNodes) do
102
+ if not flights.nodeFields and type(node) == "table" then flights.nodeFields = fieldNames(node) end
103
+ local name, state = plain(node.name), plain(node.state)
104
+ if name then
105
+ local entry = { name = name, state = NODE_STATES[state] or state, nodeID = plain(node.nodeID) }
106
+ local zoneOk, zone, source, zoneMapID, continentName = pcall(nodeZone, node, mapID, childZones)
107
+ if zoneOk and zone then
108
+ entry.zone = zone
109
+ entry.zoneMapID = type(zoneMapID) == "number" and zoneMapID or nil
110
+ sources[source] = (sources[source] or 0) + 1
111
+ elseif zoneOk and type(continentName) == "string" then
112
+ entry.continent = continentName
113
+ end
114
+ flights.nodes[#flights.nodes + 1] = entry
115
+ end
116
+ end
117
+ if next(sources) then flights.zoneSources = sources end
118
+ end
119
+
120
+ -- Node type as a short text; empty when the client supplies something other than a plain string.
121
+ local function lowerCase(value)
122
+ value = plain(value)
123
+ if type(value) ~= "string" then return "" end
124
+ return value:lower()
125
+ end
126
+
127
+ local function addLegacyTaxiNodes(nodes)
128
+ if not (NumTaxiNodes and TaxiNodeName) then return end
129
+ for index = 1, NumTaxiNodes() or 0 do
130
+ local node = { name = plain(TaxiNodeName(index)) }
131
+ if TaxiNodeGetType then node.state = lowerCase(TaxiNodeGetType(index)) end
132
+ if TaxiNodeCost then node.costCopper = plain(TaxiNodeCost(index)) end
133
+ if node.name then nodes[#nodes + 1] = node end
134
+ end
135
+ end
136
+
137
+ local function collectFlightPaths()
138
+ local flights = { npc = plain(UnitName("npc")), capturedAt = time(), nodes = {} }
139
+ addTaxiMapNodes(flights)
140
+ if #flights.nodes == 0 then addLegacyTaxiNodes(flights.nodes) end
141
+ if #flights.nodes == 0 then return nil end
142
+ return flights
143
+ end
144
+
145
+ ns.Snapshot.addWindowSection("flightPaths", collectFlightPaths, { "TAXIMAP_OPENED" })
@@ -0,0 +1,70 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section friends (from the window): the friends list the client already has in memory.
5
+ -- Collected on FRIENDLIST_UPDATE (the client sends it e.g. after the social window opens).
6
+ -- The addon never asks the server for the list (no ShowFriends or C_FriendList.ShowFriends).
7
+
8
+ local _, ns = ...
9
+ local plain, callFirst, firstValue = ns.Compat.plain, ns.Compat.callFirst, ns.Compat.firstValue
10
+
11
+ local MAX_FRIENDS = 100
12
+
13
+ local lastSignature
14
+
15
+ local function textOrNil(value)
16
+ value = plain(value)
17
+ if type(value) == "string" and value ~= "" then return value end
18
+ return nil
19
+ end
20
+
21
+ -- C_FriendList.GetFriendInfoByIndex: table { name, level, className, area, connected, notes, ... }.
22
+ local function modernFriend(index)
23
+ local info = callFirst({ "C_FriendList.GetFriendInfoByIndex" }, index)
24
+ local data = info and info[1]
25
+ if type(data) ~= "table" then return nil end
26
+ return {
27
+ name = textOrNil(data.name), level = plain(data.level), class = textOrNil(data.className),
28
+ area = textOrNil(data.area), connected = plain(data.connected) and true or false, notes = textOrNil(data.notes),
29
+ }
30
+ end
31
+
32
+ -- GetFriendInfo: name, level, class, area, connected, status, note.
33
+ local function legacyFriend(index)
34
+ local info = callFirst({ "GetFriendInfo" }, index)
35
+ if not info then return nil end
36
+ return {
37
+ name = textOrNil(info[1]), level = plain(info[2]), class = textOrNil(info[3]), area = textOrNil(info[4]),
38
+ connected = plain(info[5]) and true or false, notes = textOrNil(info[7]),
39
+ }
40
+ end
41
+
42
+ local function signature(friends)
43
+ local parts = {}
44
+ for _, f in ipairs(friends) do
45
+ parts[#parts + 1] = table.concat({ f.name or "", tostring(f.level), f.area or "", tostring(f.connected), f.notes or "" }, "|")
46
+ end
47
+ return table.concat(parts, "\n")
48
+ end
49
+
50
+ local function collectFriends()
51
+ local count = firstValue({ "C_FriendList.GetNumFriends", "GetNumFriends" })
52
+ if type(count) ~= "number" then return nil end
53
+ local friends = {}
54
+ for index = 1, math.min(count, MAX_FRIENDS) do
55
+ local friend = modernFriend(index) or legacyFriend(index)
56
+ if friend and friend.name then friends[#friends + 1] = friend end
57
+ end
58
+ -- The event arrives often (status changes): without changes in the list we do not save again.
59
+ local current = signature(friends)
60
+ if current == lastSignature and type(ns.Snapshot.current().friends) == "table" then return nil end
61
+ lastSignature = current
62
+
63
+ local online = 0
64
+ for _, f in ipairs(friends) do
65
+ if f.connected then online = online + 1 end
66
+ end
67
+ return { capturedAt = time(), total = count, online = online, friends = friends }
68
+ end
69
+
70
+ ns.Snapshot.addWindowSection("friends", collectFriends, { "FRIENDLIST_UPDATE" }, { quiet = true })
@@ -0,0 +1,101 @@
1
+ -- SPDX-License-Identifier: GPL-3.0-or-later
2
+ -- Copyright (C) 2026 Piekasz (GitHub: Piekario). Author attribution must be kept: see NOTICE.
3
+
4
+ -- Section group: party or raid composition at dump time. Solo = nil.
5
+
6
+ local _, ns = ...
7
+ local plain, callFirst, firstValue = ns.Compat.plain, ns.Compat.callFirst, ns.Compat.firstValue
8
+
9
+ -- C_PartyInfo.GetLootMethod (Forever) returns an Enum.LootMethod number; the classic GetLootMethod gives these strings.
10
+ local LOOT_METHODS = { [0] = "freeforall", [1] = "roundrobin", [2] = "master", [3] = "group", [4] = "needbeforegreed", [5] = "personal" }
11
+
12
+ local Group = {}
13
+ ns.Group = Group
14
+
15
+ -- Name, level, class and race of a unit; nil when there is no unit or the name is a secret.
16
+ -- Shared by group members and players from the Inspect window.
17
+ function Group.unitIdentity(unit)
18
+ local name = plain(UnitName(unit))
19
+ if not name then return nil end
20
+ local className, classToken = UnitClass(unit)
21
+ return {
22
+ name = name, level = plain(UnitLevel(unit)), class = plain(className), classToken = plain(classToken),
23
+ race = plain((UnitRace(unit))),
24
+ }
25
+ end
26
+
27
+ local function memberFromUnit(unit)
28
+ if not UnitExists or not UnitExists(unit) then return nil end
29
+ local m = Group.unitIdentity(unit)
30
+ if not m then return nil end
31
+ m.role = firstValue({ "UnitGroupRolesAssigned" }, unit)
32
+ if m.role == "NONE" then m.role = nil end
33
+ m.leader = firstValue({ "UnitIsGroupLeader", "UnitIsPartyLeader" }, unit) and true or nil
34
+ m.online = firstValue({ "UnitIsConnected" }, unit)
35
+ m.dead = firstValue({ "UnitIsDeadOrGhost" }, unit) and true or nil
36
+ m.healthMax = firstValue({ "UnitHealthMax" }, unit)
37
+ m.powerMax = firstValue({ "UnitPowerMax" }, unit)
38
+ local power = callFirst({ "UnitPowerType" }, unit)
39
+ if power then m.powerType = plain(power[2]) end
40
+ if unit ~= "player" then
41
+ local inRange = callFirst({ "UnitInRange" }, unit)
42
+ if inRange and inRange[2] then m.inRange = plain(inRange[1]) and true or false end
43
+ end
44
+ return m
45
+ end
46
+
47
+ local function raidMembers()
48
+ local members = {}
49
+ for i = 1, firstValue({ "GetNumGroupMembers", "GetNumRaidMembers" }) or 0 do
50
+ local m = memberFromUnit("raid" .. i)
51
+ if m then
52
+ local r = callFirst({ "GetRaidRosterInfo" }, i)
53
+ if r then
54
+ -- name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML
55
+ m.raidRank = plain(r[2])
56
+ m.subgroup = plain(r[3])
57
+ m.zone = plain(r[7])
58
+ m.masterLooter = r[11] and true or nil
59
+ end
60
+ members[#members + 1] = m
61
+ end
62
+ end
63
+ return members
64
+ end
65
+
66
+ -- The player and the other group members (party1..N does not include the player).
67
+ local function partyMembers(count)
68
+ local members = {}
69
+ local me = memberFromUnit("player")
70
+ if me then members[#members + 1] = me end
71
+ for i = 1, count do
72
+ local m = memberFromUnit("party" .. i)
73
+ if m then members[#members + 1] = m end
74
+ end
75
+ return members
76
+ end
77
+
78
+ local function collectGroup()
79
+ local inRaid = firstValue({ "IsInRaid" }) or (firstValue({ "GetNumRaidMembers" }) or 0) > 0
80
+ local group = {}
81
+ if inRaid then
82
+ group.type = "raid"
83
+ group.members = raidMembers()
84
+ else
85
+ local n = firstValue({ "GetNumSubgroupMembers", "GetNumPartyMembers" }) or 0
86
+ if n == 0 then return nil end
87
+ group.type = "party"
88
+ group.members = partyMembers(n)
89
+ end
90
+ if #group.members == 0 then return nil end
91
+ group.size = #group.members
92
+ local loot = callFirst({ "C_PartyInfo.GetLootMethod", "GetLootMethod" })
93
+ if loot then
94
+ local method = plain(loot[1])
95
+ group.lootMethod = LOOT_METHODS[method] or method
96
+ end
97
+ group.lootThreshold = firstValue({ "GetLootThreshold" })
98
+ return group
99
+ end
100
+
101
+ ns.Snapshot.addSection("group", collectGroup)