Initial addons

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-11-10 13:02:16 +00:00
commit de17b0006e
17 changed files with 3257 additions and 0 deletions

336
DungeonPreQuest/Data.lua Normal file
View file

@ -0,0 +1,336 @@
-- Generated from QuestieDB's Forever quest data. Do not edit.
-- quests[id] = { dungeon, faction, classes, ... }; faction 1 Alliance, 2 Horde, 3 both; classes 0 = all; dungeon 0 = unnamed.
local _, ns = ...
ns.dungeons = {
"Blackfathom Deeps",
"Blackrock Depths",
"Blackrock Spire",
"Dire Maul",
"Gnomeregan",
"Maraudon",
"Ragefire Chasm",
"Razorfen Downs",
"Razorfen Kraul",
"Scarlet Monastery",
"Scholomance",
"Shadowfang Keep",
"Stratholme",
"The Deadmines",
"The Stockade",
"The Temple of Atal'Hakkar",
"Uldaman",
"Wailing Caverns",
"Zul'Farrak",
}
ns.quests = {
[65]={14,1,0},
[132]={14,1,0},
[135]={14,1,0},
[141]={14,1,0},
[142]={14,1,0},
[155]={14,1,0},
[261]={10,1,0},
[303]={15,1,0},
[373]={15,1,0},
[389]={15,1,0},
[707]={17,1,0},
[720]={17,1,0},
[723]={17,1,0},
[724]={17,1,0},
[725]={17,1,0},
[726]={17,1,0},
[738]={17,1,0},
[739]={17,1,0},
[762]={17,1,0},
[865]={18,3,0},
[870]={18,2,0},
[877]={18,2,0},
[880]={18,2,0},
[886]={18,2,0},
[1052]={10,1,0},
[1100]={9,1,0},
[1109]={10,2,0},
[1149]={10,2,0},
[1150]={10,2,0},
[1151]={10,2,0},
[1152]={10,2,0},
[1154]={10,2,0},
[1159]={10,2,0},
[1424]={16,2,0},
[1429]={16,2,0},
[1444]={16,2,0},
[1448]={16,1,0},
[1449]={16,1,0},
[1450]={16,1,0},
[1451]={16,1,0},
[1452]={16,1,0},
[1469]={16,1,0},
[1649]={0,1,2},
[1650]={0,1,2},
[1651]={0,1,2},
[1652]={0,1,2},
[1793]={0,1,2},
[1794]={0,1,2},
[1947]={0,3,128},
[1949]={0,3,128},
[1950]={0,3,128},
[1953]={0,3,128},
[1954]={0,3,128},
[1955]={0,3,128},
[2041]={14,1,0},
[2258]={17,2,0},
[2500]={17,1,0},
[2769]={19,1,0},
[2933]={19,2,0},
[2934]={19,2,0},
[2935]={19,2,0},
[2988]={19,1,0},
[2989]={19,1,0},
[2990]={19,1,0},
[3441]={2,3,0},
[3442]={2,3,0},
[3443]={2,3,0},
[3444]={16,3,0},
[3445]={16,1,0},
[3452]={2,3,0},
[3453]={2,3,0},
[3454]={2,3,0},
[3462]={2,3,0},
[3463]={2,3,0},
[3481]={2,3,0},
[3520]={3,3,0,16,3,0,19,3,0},
[3527]={3,3,0,16,3,0},
[3528]={3,3,0},
[3701]={2,1,0},
[3702]={2,1,0},
[3765]={1,1,0},
[3906]={2,2,0},
[4022]={2,3,0},
[4023]={2,3,0},
[4061]={2,2,0},
[4062]={2,2,0},
[4141]={0,1,0},
[4142]={0,1,0},
[4145]={0,2,0},
[4146]={0,2,0},
[4147]={0,2,0},
[4182]={2,1,0,3,1,0},
[4183]={2,1,0,3,1,0},
[4184]={2,1,0,3,1,0},
[4185]={2,1,0,3,1,0},
[4186]={2,1,0,3,1,0},
[4223]={2,1,0,3,1,0},
[4224]={2,1,0,3,1,0},
[4241]={3,1,0},
[4242]={3,1,0},
[4262]={2,1,0},
[4264]={3,1,0},
[4282]={3,1,0},
[4322]={3,1,0},
[4726]={0,3,0,3,3,0,11,3,0},
[4734]={0,3,0,11,3,0},
[4735]={0,3,0,11,3,0},
[4787]={3,3,0,16,3,0},
[4808]={0,3,0,3,3,0,11,3,0},
[4809]={0,3,0,3,3,0,11,3,0},
[4810]={0,3,0,3,3,0,11,3,0},
[4907]={0,3,0,11,3,0},
[4941]={3,2,0},
[5065]={3,3,0},
[5126]={3,3,67},
[5281]={13,3,0},
[5382]={13,3,0},
[5384]={13,3,0},
[5461]={11,3,0,13,3,0},
[5462]={11,3,0,13,3,0},
[5463]={11,3,0},
[5464]={11,3,0},
[5465]={11,3,0},
[5515]={13,3,0},
[5522]={11,3,0},
[5527]={0,3,0},
[5542]={13,3,0},
[5543]={13,3,0},
[5544]={13,3,0},
[5726]={7,2,0},
[5727]={7,2,0},
[5742]={13,3,0},
[5781]={13,3,0},
[5845]={13,3,0},
[5846]={13,3,0},
[6022]={13,2,0},
[6042]={13,2,0},
[6133]={13,2,0},
[6135]={13,2,0},
[6136]={13,2,0},
[6141]={10,1,0},
[6402]={3,1,0},
[6403]={3,1,0},
[6501]={3,1,0},
[6566]={3,2,0},
[6567]={3,2,0},
[6568]={3,2,0},
[6570]={3,2,0},
[6582]={3,2,0},
[6583]={3,2,0},
[6584]={3,2,0},
[6585]={3,2,0},
[6601]={3,2,0},
[6627]={10,2,0},
[7562]={0,3,256},
[7563]={0,3,256},
[7564]={0,3,256},
[7623]={0,3,256},
[7624]={0,3,256},
[7625]={0,3,256},
[7626]={0,3,256},
[7627]={0,3,256},
[7628]={0,3,256},
[7630]={0,3,256},
[7637]={0,1,2},
[7638]={0,1,2},
[7639]={0,1,2},
[7640]={0,1,2},
[7641]={0,1,2},
[7644]={0,1,2},
[7646]={0,1,2},
[7667]={0,2,64},
[7670]={0,1,2},
[7722]={0,3,0},
[8151]={0,3,4},
[8153]={0,3,4},
[8231]={0,3,4},
[8233]={0,3,8},
[8234]={0,3,8},
[8235]={0,3,8},
[8251]={0,3,128},
[8252]={0,3,128},
[8254]={0,3,16},
[8255]={0,3,16},
[8256]={0,3,16},
[8286]={16,3,0},
[8288]={16,3,0},
[8301]={16,3,0},
[8303]={16,3,0},
[8305]={16,3,0},
[8410]={0,2,64},
[8411]={0,2,64},
[8412]={0,2,64},
[8414]={0,1,2},
[8415]={0,1,2},
[8416]={0,1,2},
[8417]={0,3,1},
[8419]={0,3,256},
[8420]={0,3,256},
[8421]={0,3,256},
[8423]={0,3,1},
[8424]={0,3,1},
[8519]={16,3,0},
[8555]={16,3,0},
[8905]={2,1,1024,3,1,1024,4,1,1024,11,1,1024,13,1,1024},
[8906]={2,1,4,3,1,4,4,1,4,11,1,4,13,1,4},
[8907]={2,1,128,3,1,128,4,1,128,11,1,128,13,1,128},
[8908]={2,1,2,3,1,2,4,1,2,11,1,2,13,1,2},
[8909]={2,1,16,3,1,16,4,1,16,11,1,16,13,1,16},
[8910]={2,1,8,3,1,8,4,1,8,11,1,8,13,1,8},
[8911]={2,1,256,3,1,256,4,1,256,11,1,256,13,1,256},
[8912]={2,1,1,3,1,1,4,1,1,11,1,1,13,1,1},
[8913]={2,2,1024,3,2,1024,4,2,1024,11,2,1024,13,2,1024},
[8914]={2,2,4,3,2,4,4,2,4,11,2,4,13,2,4},
[8915]={2,2,128,3,2,128,4,2,128,11,2,128,13,2,128},
[8916]={2,2,16,3,2,16,4,2,16,11,2,16,13,2,16},
[8917]={2,2,8,3,2,8,4,2,8,11,2,8,13,2,8},
[8918]={2,2,64,3,2,64,4,2,64,11,2,64,13,2,64},
[8919]={2,2,256,3,2,256,4,2,256,11,2,256,13,2,256},
[8920]={2,2,1,3,2,1,4,2,1,11,2,1,13,2,1},
[8921]={0,1,1439,0,2,1501,2,1,1439,2,2,1501,3,1,1439,3,2,1501,4,1,1439,4,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8922]={0,1,1439,2,1,1439,3,1,1439,4,1,1439,11,1,1439,13,1,1439},
[8923]={0,2,1501,2,2,1501,3,2,1501,4,2,1501,11,2,1501,13,2,1501},
[8924]={0,1,1439,0,2,1501,2,1,1439,2,2,1501,3,1,1439,3,2,1501,4,1,1439,4,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8925]={0,1,1439,0,2,1501,2,1,1439,2,2,1501,3,1,1439,3,2,1501,4,1,1439,4,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8926]={2,1,1024,3,1,1024,4,1,1024,11,1,1024,13,1,1024},
[8927]={2,2,1024,3,2,1024,4,2,1024,11,2,1024,13,2,1024},
[8928]={0,1,1439,0,2,1501,2,1,1439,2,2,1501,3,1,1439,3,2,1501,4,1,1439,4,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8929]={0,1,1439,2,1,0,3,1,1439,4,1,0,11,1,1439,13,1,0},
[8930]={0,2,1501,2,2,0,3,2,1501,4,2,0,11,2,1501,13,2,0},
[8931]={2,1,4,3,1,4,4,1,4,11,1,4,13,1,4},
[8932]={2,1,128,3,1,128,4,1,128,11,1,128,13,1,128},
[8933]={2,1,2,3,1,2,4,1,2,11,1,2,13,1,2},
[8934]={2,1,16,3,1,16,4,1,16,11,1,16,13,1,16},
[8935]={2,1,8,3,1,8,4,1,8,11,1,8,13,1,8},
[8936]={2,1,256,3,1,256,4,1,256,11,1,256,13,1,256},
[8937]={2,1,1,3,1,1,4,1,1,11,1,1,13,1,1},
[8938]={2,2,4,3,2,4,4,2,4,11,2,4,13,2,4},
[8939]={2,2,128,3,2,128,4,2,128,11,2,128,13,2,128},
[8940]={2,2,16,3,2,16,4,2,16,11,2,16,13,2,16},
[8941]={2,2,8,3,2,8,4,2,8,11,2,8,13,2,8},
[8942]={2,2,64,3,2,64,4,2,64,11,2,64,13,2,64},
[8943]={2,2,256,3,2,256,4,2,256,11,2,256,13,2,256},
[8944]={2,2,1,3,2,1,4,2,1,11,2,1,13,2,1},
[8945]={0,1,1439,0,2,1501,2,3,0,3,1,1439,3,2,1501,4,3,0,11,1,1439,11,2,1501},
[8946]={0,1,1439,0,2,1501,2,3,0,3,1,1439,3,2,1501,4,3,0,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8947]={0,1,1439,0,2,1501,2,3,0,3,1,1439,3,2,1501,4,3,0,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8948]={0,1,1439,0,2,1501,2,3,0,3,1,1439,3,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8949]={0,1,1439,0,2,1501,2,3,0,3,1,1439,3,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8950]={0,1,1439,0,2,1501,2,3,0,3,1,1439,3,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[8951]={3,1,1024,4,1,1024,11,1,1024,13,1,1024},
[8952]={3,1,4,4,1,4,11,1,4,13,1,4},
[8953]={3,1,128,4,1,128,11,1,128,13,1,128},
[8954]={3,1,2,4,1,2,11,1,2,13,1,2},
[8955]={3,1,16,4,1,16,11,1,16,13,1,16},
[8956]={3,1,8,4,1,8,11,1,8,13,1,8},
[8957]={3,2,64,4,2,64,11,2,64,13,2,64},
[8958]={3,1,256,4,1,256,11,1,256,13,1,256},
[8959]={3,1,1,4,1,1,11,1,1,13,1,1},
[8960]={0,1,1439,3,1,0,4,1,0,11,1,0,13,1,0},
[8961]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8962]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8963]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8964]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8965]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8966]={0,1,1439,0,2,1501,4,3,0,11,3,0,13,3,0},
[8967]={0,1,1439,0,2,1501,3,3,0,11,3,0,13,3,0},
[8968]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0},
[8969]={0,1,1439,0,2,1501,3,3,0,4,3,0,13,3,0},
[8970]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8977]={0,1,1439,2,1,1439,3,1,1439,4,1,1439,11,1,1439,13,1,1439},
[8978]={0,2,1501,2,2,1501,3,2,1501,4,2,1501,11,2,1501,13,2,1501},
[8985]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8986]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8987]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8988]={0,1,1439,0,2,1501,3,3,0,4,3,0,11,3,0,13,3,0},
[8989]={0,1,1439,0,2,1501},
[8990]={0,1,1439,0,2,1501,3,3,0},
[8991]={0,1,1439,0,2,1501,3,3,0},
[8992]={0,1,1439,0,2,1501,3,3,0},
[8994]={0,1,1439,0,2,1501,3,3,0},
[8995]={0,1,1439,0,2,1501},
[8996]={0,1,1439,0,2,1501},
[8997]={0,1,1439},
[8998]={0,2,1501},
[9015]={0,1,1439,0,2,1501,3,1,1439,3,2,1501,4,1,1439,4,2,1501,11,1,1439,11,2,1501,13,1,1439,13,2,1501},
[9016]={3,2,1024,4,2,1024,11,2,1024,13,2,1024},
[9017]={3,2,4,4,2,4,11,2,4,13,2,4},
[9018]={3,2,128,4,2,128,11,2,128,13,2,128},
[9019]={3,2,16,4,2,16,11,2,16,13,2,16},
[9020]={3,2,8,4,2,8,11,2,8,13,2,8},
[9021]={3,2,256,4,2,256,11,2,256,13,2,256},
[9022]={3,2,1,4,2,1,11,2,1,13,2,1},
[9032]={0,2,1501,3,2,0,4,2,0,11,2,0,13,2,0},
[9051]={0,3,1024},
[9052]={0,3,1024},
[9063]={0,3,1024},
[9250]={0,3,1424},
[9251]={0,3,1424},
[92742]={14,1,0},
[92744]={14,1,0},
[92745]={14,1,0},
[92747]={14,1,0},
[92748]={14,1,0},
[92749]={14,1,0},
[92750]={14,1,0},
[92751]={14,1,0},
[92752]={14,1,0},
}

View file

@ -0,0 +1,123 @@
-- Dungeon Pre-Quest: marks quests whose chain leads to a dungeon quest, in the
-- quest log and on the quest offer window. The client has no chain data, so
-- Data.lua is generated ahead of time.
local _, ns = ...
local COLOR = "|cffffd100"
local LABEL = "Dungeon pre-quest"
local function HasClass(mask, classID)
return mask == 0 or math.floor(mask / 2 ^ (classID - 1)) % 2 == 1
end
-- Dungeon names this quest leads to for this character, or nil if none.
-- An empty list means a dungeon quest whose dungeon isn't known.
local function DungeonsFor(questID)
local row = questID and ns.quests[questID]
if not row then
return nil
end
local faction = UnitFactionGroup("player")
local factionBit = faction == "Alliance" and 1 or faction == "Horde" and 2
local classID = select(3, UnitClass("player"))
if not factionBit or not classID then
return nil
end
local names, seen, matched = {}, {}, false
for i = 1, #row, 3 do
local dungeon, factions, classes = row[i], row[i + 1], row[i + 2]
if (factions == 3 or factions == factionBit) and HasClass(classes, classID) then
matched = true
local name = ns.dungeons[dungeon]
if name and not seen[name] then
seen[name] = true
names[#names + 1] = name
end
end
end
return matched and names or nil
end
local function Describe(names)
if #names == 0 then
return LABEL
end
return LABEL .. ": " .. table.concat(names, ", ")
end
local function MarkRow(button)
local names = DungeonsFor(button.questID)
if not names then
if button.dpqMark then
button.dpqMark:Hide()
end
return
end
if not button.dpqMark then
button.dpqMark = button:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
button.dpqMark:SetPoint("TOPLEFT", button, "TOPLEFT", 12, -9)
button.dpqMark:SetText(COLOR .. "D|r")
end
button.dpqMark:Show()
end
local function UpdateRows()
for button in QuestScrollFrame.titleFramePool:EnumerateActive() do
MarkRow(button)
end
end
local banner
local function UpdateBanner()
if not banner then
return
end
local names = DungeonsFor(GetQuestID())
if names then
banner:SetText(COLOR .. Describe(names) .. "|r")
banner:Show()
else
banner:Hide()
end
end
local function Setup()
hooksecurefunc("QuestLogQuests_Update", UpdateRows)
EventRegistry:RegisterCallback("QuestMapLogTitleButton.OnEnter", function(_, button, questID)
local names = DungeonsFor(questID or (button and button.questID))
if names then
GameTooltip:AddLine(Describe(names), 1, 0.82, 0, true)
GameTooltip:Show()
end
end, ns)
-- Sits above the window, where it can't disturb Blizzard's layout. Parented
-- to the detail panel so it goes away with that panel.
banner = QuestFrameDetailPanel:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
banner:SetPoint("BOTTOM", QuestFrame, "TOP", 0, 6)
QuestFrameDetailPanel:HookScript("OnShow", UpdateBanner)
end
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("QUEST_DETAIL")
frame:SetScript("OnEvent", function(_, event)
if event == "PLAYER_LOGIN" then
Setup()
else
UpdateBanner()
end
end)
-- /dpq 123 says what is known about a quest ID.
SLASH_DUNGEONPREQUEST1 = "/dpq"
SlashCmdList.DUNGEONPREQUEST = function(text)
local id = tonumber(text)
local names = DungeonsFor(id)
DEFAULT_CHAT_FRAME:AddMessage(COLOR .. "DungeonPreQuest:|r " .. (id and (names and Describe(names) or "not a pre-quest for you") or "usage: /dpq questID"))
end

View file

@ -0,0 +1,7 @@
## Interface: 16001
## Title: Dungeon Pre-Quest
## Notes: Marks quests whose chain leads to a dungeon quest.
## Version: 1.0
Data.lua
DungeonPreQuest.lua

View file

@ -0,0 +1,232 @@
-- Merges QuestieDB's Forever quest data into plain rows, without running its
-- generator. Each downloaded file runs in an empty environment: no io, os,
-- require, dofile or loadstring.
-- usage: lua extract.lua <qdb dir> <questie dir> <output file>
local qdb, questie, outPath = arg[1], arg[2], arg[3]
local function proxy(name)
local mt = {}
mt.__index = function(t, k)
local child = proxy(name .. "." .. tostring(k))
rawset(t, k, child)
return child
end
mt.__call = function() return proxy(name .. "()") end
mt.__add = function(a) return a end
mt.__sub = mt.__add
mt.__mul = mt.__add
mt.__unm = mt.__add
return setmetatable({}, mt)
end
local function sandbox(extra)
local env = {
pairs = pairs, ipairs = ipairs, type = type, tostring = tostring, tonumber = tonumber,
select = select, unpack = unpack, next = next, assert = assert, error = error,
rawget = rawget, rawset = rawset, setmetatable = setmetatable, getmetatable = getmetatable,
math = math, string = { format = string.format, find = string.find, match = string.match,
gsub = string.gsub, sub = string.sub, lower = string.lower, upper = string.upper,
byte = string.byte, char = string.char, rep = string.rep, len = string.len, gmatch = string.gmatch },
table = table,
}
for k, v in pairs(extra or {}) do env[k] = v end
return env
end
local function read(path)
local f = assert(io.open(path, "rb"), path)
local s = f:read("*a")
f:close()
assert(s:sub(1, 1) ~= "\27", "bytecode refused: " .. path)
return s
end
local function run(path, env, ...)
local chunk = assert(loadstring(read(path), "@" .. path))
setfenv(chunk, env)
return chunk(...)
end
-- Enums, read from QuestieDB's own definition files.
local Lib = { Enum = {} }
local function enumFile(name) run(qdb .. "/src/corrections/enum/" .. name .. ".lua", sandbox(), "QuestieDB", Lib) end
for _, name in ipairs({ "constants", "quests", "zones", "professions", "factions", "expansions" }) do
local ok, err = pcall(enumFile, name)
if not ok then io.stderr:write("enum ", name, ": ", tostring(err), "\n") end
end
local forever = assert(Lib.Enum.byExpansion and Lib.Enum.byExpansion.Forever, "no Forever enum")
forever.classKeys = forever.classKeys or assert(Lib.Enum.byExpansion.Classic.classKeys)
-- Raw rows and field indexes.
local modules = {}
local function module(name)
if not modules[name] then
modules[name] = proxy(name)
end
return modules[name]
end
local loader = {
CreateModule = function(_, name) rawset(modules, name, {}) return modules[name] end,
ImportModule = function(_, name) return module(name) end,
}
local rawQuestDB = {}
modules.QuestieDB = rawQuestDB
run(qdb .. "/data/Forever/foreverQuestDB.lua", sandbox({ QuestieLoader = loader }))
local realKeys = assert(rawQuestDB.questKeys)
local dataText = assert(rawQuestDB.questData)
assert(dataText:sub(1, 6) == "return")
local dataChunk = assert(loadstring(dataText, "=questData"))
setfenv(dataChunk, {})
local quests = dataChunk()
local ADD, REMOVE = 1000, 2000
local keyProxy = setmetatable({}, { __index = function(_, k)
local base, op = k:match("^(.-)_(add)$")
if not base then base, op = k:match("^(.-)_(remove)$") end
if base then
return assert(realKeys[base], k) + (op == "add" and ADD or REMOVE)
end
return assert(realKeys[k], k)
end })
modules = {
QuestieDB = { questKeys = keyProxy, raceKeys = forever.raceKeys, classKeys = forever.classKeys,
sortKeys = Lib.Enum.sortKeys, specialFlags = Lib.Enum.specialFlags, factionIDs = Lib.Enum.factionIDs },
ZoneDB = { zoneIDs = Lib.Enum.zoneIDs },
QuestieProfessions = { professionKeys = Lib.Enum.professionKeys or proxy("prof"),
specializationKeys = Lib.Enum.specializationKeys or proxy("spec") },
}
for k, v in pairs(modules) do
setmetatable(v, { __index = function(t, key) local p = proxy(k .. "." .. key); rawset(t, key, p); return p end })
end
local WANT = { "name", "questLevel", "requiredRaces", "requiredClasses", "preQuestGroup", "preQuestSingle",
"zoneOrSort", "nextQuestInChain", "breadcrumbForQuestId", "breadcrumbs", "objectives", "specialFlags" }
local wanted = {}
for _, n in ipairs(WANT) do wanted[realKeys[n]] = true end
local function contains(list, v) for _, x in ipairs(list) do if x == v then return true end end return false end
local changed = {}
local function apply(id, fixes)
local row = quests[id]
if not row then row = {}; quests[id] = row end
local removes, sets, adds = {}, {}, {}
for k, v in pairs(fixes) do
if k > REMOVE then removes[k - REMOVE] = v
elseif k > ADD then adds[k - ADD] = v
else sets[k] = v end
end
for k, v in pairs(removes) do
if wanted[k] and type(row[k]) == "table" and type(v) == "table" then
local kept = {}
for _, x in ipairs(row[k]) do if not contains(v, x) then kept[#kept + 1] = x end end
row[k] = kept
end
end
for k, v in pairs(sets) do row[k] = v end
for k, v in pairs(adds) do
if wanted[k] and type(v) == "table" then
row[k] = type(row[k]) == "table" and row[k] or {}
for _, x in ipairs(v) do if not contains(row[k], x) then table.insert(row[k], x) end end
end
end
end
local LAYERS = {
{ "Forever/legacy/classicQuestFixes.lua", "QuestieQuestFixes" },
{ "Forever/generated/foreverBaseQuest.lua", "ForeverBaseQuest" },
{ "Forever/traces/foreverQuestTraces.lua", "ForeverQuestTraces" },
{ "Forever/foreverQuestFixes.lua", "ForeverQuestFixes" },
}
local layerLoader = {
CreateModule = function(_, name) local m = {}; rawset(modules, name, m); return m end,
ImportModule = function(_, name) return modules[name] or proxy(name) end,
}
local stubs = { QuestieLoader = layerLoader, UnitFactionGroup = function() return "Alliance" end,
Questie = proxy("Questie") }
for _, layer in ipairs(LAYERS) do
run(qdb .. "/src/corrections/" .. layer[1], sandbox(stubs))
local fixes = modules[layer[2]]:Load()
local n = 0
for id, row in pairs(fixes) do apply(id, row); n = n + 1 end
io.stderr:write(layer[2], ": ", n, " rows\n")
end
-- Quest tags. Questie treats Forever as Era content here.
local tags = {}
do
local private = {}
local Expansions = { Era = 1, Tbc = 2, Wotlk = 3, Cata = 4, MoP = 5, Current = 1 }
local tagLoader = { ImportModule = function(_, name)
if name == "QuestieDB" then return { private = private } end
if name == "Expansions" then return Expansions end
if name == "l10n" then return function(s) return s end end
return proxy(name)
end }
run(questie .. "/Database/Corrections/questTagInfoCorrections.lua", sandbox({ QuestieLoader = tagLoader, Questie = proxy("Questie") }))
private.InitializeQuestTagInfoCorrections()
for id, tag in pairs(private.questTagCorrections) do
if type(tag) == "table" and tag[1] == 81 then tags[id] = true end
end
end
-- Dungeon list is parsed as text, not run.
local zoneNames, allNames = {}, {}
for line in read(qdb .. "/support/Forever/Zones/dungeons.lua"):gmatch("[^\n]+") do
local id, name, rest = line:match('^%s*%[(%d+)%]%s*=%s*{"([^"]+)",(.*)')
if id then
allNames[#allNames + 1] = name
zoneNames[tonumber(id)] = name
local alts = rest:match("^{([%d,%s]+)}")
if alts then for a in alts:gmatch("%d+") do zoneNames[tonumber(a)] = name end end
end
end
table.sort(allNames)
local q = {}
for id, row in pairs(quests) do
local r = {}
for _, n in ipairs(WANT) do r[n] = row[realKeys[n]] end
q[id] = r
end
local function ser(v)
if type(v) == "table" then
local parts, n = {}, 0
for k in pairs(v) do if type(k) == "number" and k > n then n = k end end
for i = 1, n do parts[i] = ser(v[i]) end
return "{" .. table.concat(parts, ",") .. "}"
elseif type(v) == "string" then return string.format("%q", v)
elseif v == nil then return "nil"
else return tostring(v) end
end
local out = assert(io.open(outPath, "w"))
out:write("return {quests={\n")
local ids = {}
for id in pairs(q) do ids[#ids + 1] = id end
table.sort(ids)
for _, id in ipairs(ids) do
local r = q[id]
out:write("[", id, "]={")
for _, n in ipairs(WANT) do
if r[n] ~= nil and n ~= "objectives" then out:write(n, "=", ser(r[n]), ",") end
end
out:write("},\n")
end
out:write("},\ntags={")
for id in pairs(tags) do out:write("[", id, "]=true,") end
out:write("},\nzoneNames={")
for id, name in pairs(zoneNames) do out:write("[", id, "]=", string.format("%q", name), ",") end
out:write("},\nallDungeons=", ser(allNames), ",\n")
out:write("ALL_ALLIANCE=", string.format("%.0f", forever.raceKeys.ALL_ALLIANCE), ",ALL_HORDE=", string.format("%.0f", forever.raceKeys.ALL_HORDE), ",\n")
out:write("classKeys=", "{")
for k, v in pairs(forever.classKeys) do out:write(k, "=", string.format("%.0f", v), ",") end
out:write("}}\n")
out:close()
io.stderr:write("quests: ", #ids, ", dungeon tags: ")
local c = 0; for _ in pairs(tags) do c = c + 1 end
io.stderr:write(c, "\n")

View file

@ -0,0 +1,157 @@
-- Turns merged.lua into the addon's Data.lua.
-- usage: lua generate.lua merged.lua Data.lua
local data = dofile(arg[1])
local q = data.quests
local FIVE_MAN = {}
for _, n in ipairs({ "Ragefire Chasm", "The Deadmines", "Wailing Caverns", "Shadowfang Keep", "Blackfathom Deeps",
"The Stockade", "Gnomeregan", "Razorfen Kraul", "Scarlet Monastery", "Razorfen Downs", "Uldaman", "Zul'Farrak",
"Maraudon", "The Temple of Atal'Hakkar", "Blackrock Depths", "Blackrock Spire", "Dire Maul", "Scholomance",
"Stratholme" }) do FIVE_MAN[n] = true end
local UNNAMED = ""
local dungeon = {}
for id, r in pairs(q) do
local name = r.zoneOrSort and data.zoneNames[r.zoneOrSort]
if name and FIVE_MAN[name] then
dungeon[id] = name
elseif data.tags[id] and not name then
dungeon[id] = UNNAMED
end
end
local function intersects(a, b)
for i = 0, 52 do
local bit = 2 ^ i
if math.floor(a / bit) % 2 == 1 and math.floor(b / bit) % 2 == 1 then return true end
end
return false
end
local nexts = {}
local function edge(a, b)
if a and b and a ~= 0 and b ~= 0 and a ~= b and q[a] and q[b] then
nexts[a] = nexts[a] or {}
nexts[a][b] = true
end
end
for id, r in pairs(q) do
for _, a in ipairs(r.preQuestSingle or {}) do edge(a, id) end
for _, a in ipairs(r.preQuestGroup or {}) do edge(a, id) end
edge(id, r.nextQuestInChain)
edge(id, r.breadcrumbForQuestId)
for _, a in ipairs(r.breadcrumbs or {}) do edge(a, id) end
end
local FACTIONS = { { bit = 1, mask = data.ALL_ALLIANCE }, { bit = 2, mask = data.ALL_HORDE } }
local CLASSES = { "WARRIOR", "PALADIN", "HUNTER", "ROGUE", "PRIEST", "SHAMAN", "MAGE", "WARLOCK", "DRUID" }
local ALL_CLASSES = 0
for _, c in ipairs(CLASSES) do ALL_CLASSES = ALL_CLASSES + data.classKeys[c] end
local function available(r, factionMask, classBit)
local races, classes = r.requiredRaces or 0, r.requiredClasses or 0
if races ~= 0 and not intersects(races, factionMask) then return false end
if classes ~= 0 and not intersects(classes, classBit) then return false end
return true
end
-- result[quest][dungeon][factionBit] = class mask
local result = {}
for _, faction in ipairs(FACTIONS) do
for _, class in ipairs(CLASSES) do
local classBit = data.classKeys[class]
local function walk(id, seen, found)
for b in pairs(nexts[id] or {}) do
if not seen[b] and available(q[b], faction.mask, classBit) then
seen[b] = true
if dungeon[b] then found[dungeon[b]] = true end
walk(b, seen, found)
end
end
end
for id, r in pairs(q) do
if available(r, faction.mask, classBit) then
local found = {}
walk(id, { [id] = true }, found)
found[dungeon[id] or false] = nil
for name in pairs(found) do
result[id] = result[id] or {}
result[id][name] = result[id][name] or {}
result[id][name][faction.bit] = (result[id][name][faction.bit] or 0) + classBit
end
end
end
end
end
local names, nameIndex = {}, {}
for _, n in ipairs(data.allDungeons) do
if FIVE_MAN[n] and not nameIndex[n] then
names[#names + 1] = n
nameIndex[n] = #names
end
end
nameIndex[UNNAMED] = 0
local ids = {}
for id in pairs(result) do ids[#ids + 1] = id end
table.sort(ids)
local out = assert(io.open(arg[2], "w"))
out:write("-- Generated from QuestieDB's Forever quest data. Do not edit.\n")
out:write("-- quests[id] = { dungeon, faction, classes, ... }; faction 1 Alliance, 2 Horde, 3 both; classes 0 = all; dungeon 0 = unnamed.\n")
out:write("local _, ns = ...\n\nns.dungeons = {\n")
for _, n in ipairs(names) do out:write(string.format(" %q,\n", n)) end
out:write("}\n\nns.quests = {\n")
for _, id in ipairs(ids) do
local parts = {}
local dungeonsHere = {}
for name in pairs(result[id]) do dungeonsHere[#dungeonsHere + 1] = name end
table.sort(dungeonsHere)
for _, name in ipairs(dungeonsHere) do
local byFaction = result[id][name]
local a, h = byFaction[1], byFaction[2]
local function emit(faction, mask)
parts[#parts + 1] = nameIndex[name] .. "," .. faction .. "," .. (mask == ALL_CLASSES and 0 or mask)
end
if a and a == h then
emit(3, a)
else
if a then emit(1, a) end
if h then emit(2, h) end
end
end
out:write(" [", id, "]={", table.concat(parts, ","), "},\n")
end
out:write("}\n")
out:close()
local function summary(faction, classBit, label)
local n, named = 0, 0
for id, row in pairs(result) do
local any, anyNamed = false, false
for name, f in pairs(row) do
if f[faction] and intersects(f[faction], classBit) then
any = true
if name ~= UNNAMED then anyNamed = true end
end
end
if any then n = n + 1 end
if anyNamed then named = named + 1 end
end
print(label, "pre-quests", n, "with a named dungeon", named)
end
print("rows", #ids)
summary(1, data.classKeys.SHAMAN, "Alliance shaman")
summary(1, data.classKeys.WARRIOR, "Alliance warrior")
summary(2, data.classKeys.WARRIOR, "Horde warrior")
local function show(id)
local r = result[id]
local list = {}
for name, f in pairs(r or {}) do
list[#list + 1] = (name == UNNAMED and "(unnamed)" or name) .. " A:" .. tostring(f[1]) .. " H:" .. tostring(f[2])
end
print(id, q[id] and q[id].name, table.concat(list, " | "))
end
for _, id in ipairs({ 65, 155, 166, 8928, 8916, 94501 }) do show(id) end