diff --git a/DungeonPreQuest/tools/extract.lua b/DungeonPreQuest/tools/extract.lua index 30c9a26..e9a6c51 100644 --- a/DungeonPreQuest/tools/extract.lua +++ b/DungeonPreQuest/tools/extract.lua @@ -262,6 +262,47 @@ do end end +-- Names and classes of quest objective items, for the shopping list. +local itemInfo = {} +do + local raw = {} + run(qdb .. "/data/Forever/foreverItemDB.lua", sandbox({ QuestieLoader = { ImportModule = function() return raw end, CreateModule = function() return raw end } })) + local real = assert(raw.itemKeys) + local chunk = assert(loadstring(assert(raw.itemData), "=itemData")) + setfenv(chunk, {}) + for id, row in pairs(chunk()) do + itemInfo[id] = { name = row[real.name], class = row[real.class] } + end + + local keys = setmetatable({}, { __index = function(_, k) + local base, op = k:match("^(.-)_(add)$") + if not base then base, op = k:match("^(.-)_(remove)$") end + if base then return (real[base] or 900) + (op == "add" and ADD or REMOVE) end + return real[k] or 900 + end }) + modules.QuestieDB.itemKeys = keys + + for _, layer in ipairs({ + { "Forever/legacy/classicItemFixes.lua", "QuestieItemFixes" }, + { "Forever/generated/foreverBaseItem.lua", "ForeverBaseItem" }, + { "Forever/traces/foreverItemTraces.lua", "ForeverItemTraces" }, + { "Forever/foreverItemFixes.lua", "ForeverItemFixes" }, + }) do + run(qdb .. "/src/corrections/" .. layer[1], sandbox(stubs)) + local n = 0 + for id, row in pairs(modules[layer[2]]:Load(keys)) do + n = n + 1 + local name, class = row[real.name], row[real.class] + if type(name) == "string" or type(class) == "number" then + itemInfo[id] = itemInfo[id] or {} + if type(name) == "string" then itemInfo[id].name = name end + if type(class) == "number" then itemInfo[id].class = class end + end + end + io.stderr:write(layer[2], ": ", n, " rows\n") + 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 @@ -349,6 +390,24 @@ local function writeSpawns(label, source, group) end writeSpawns("npcs", npcSpawns, 1) writeSpawns("objects", objectSpawns, 2) +do + local seen = {} + out:write(",\nobjectiveItems={\n") + for _, r in pairs(q) do + local group = type(r.objectives) == "table" and r.objectives[3] + if type(group) == "table" then + for _, objective in ipairs(group) do + local id = type(objective) == "table" and objective[1] + local info = id and itemInfo[id] + if info and info.name and not seen[id] then + seen[id] = true + out:write("[", id, "]={name=", string.format("%q", info.name), ",class=", tostring(info.class or 0), "},\n") + end + end + end + end + out:write("}") +end out:write(",\nareaToMap={") for area, map in pairs(areaToMap) do out:write("[", area, "]=", map, ",") end out:write("},\nraceBits={") diff --git a/QuestShoppingList/Data.lua b/QuestShoppingList/Data.lua new file mode 100644 index 0000000..bb06860 --- /dev/null +++ b/QuestShoppingList/Data.lua @@ -0,0 +1,903 @@ +-- Generated from QuestieDB's Forever data. Do not edit. +-- Lowercased name -> item ID, for quest objective items that aren't quest-only. +local _, ns = ... + +ns.itemIDs = { + ["a luddite's guide to caring for your demonic pet"]=215824, + ["a mind of metal"]=220352, + ["a study of the light"]=228135, + ["a web of lies: debunking myths and legends"]=215816, + ["abyssal crest"]=20513, + ["abyssal scepter"]=20515, + ["abyssal signet"]=20514, + ["accurate scope"]=4407, + ["advanced target dummy"]=4392, + ["alarm-o-bot"]=18645, + ["alliance commendation signet"]=21436, + ["alliance gift collection"]=22262, + ["alterac swiss"]=8932, + ["amber voodoo feather"]=20606, + ["arcane crystal"]=12363, + ["arcane shard"]=20085, + ["arcanic systems manual"]=209847, + ["arcanite bar"]=12360, + ["arcanite skeleton key"]=15872, + ["archmage antonidas: the unabridged autobiography"]=203754, + ["archmage theocritus' research journal"]=203755, + ["arnak's hoof"]=12884, + ["arthas' tears"]=8836, + ["ataeric: on arcane curiosities"]=210177, + ["avelina's heart"]=190179, + ["azerothian diamond"]=12800, + ["azure key"]=20022, + ["azure silk hood"]=7048, + ["baked salmon"]=13935, + ["balnir snapdragons"]=7227, + ["barbaric gloves"]=4254, + ["barbaric harness"]=5739, + ["barbecued buzzard wing"]=4457, + ["basilisks: should petrification be feared?"]=213165, + ["baxtan: on destructive magics"]=208800, + ["bear meat"]=3173, + ["beasts deck"]=19228, + ["beaststalker's belt"]=16680, + ["beaststalker's bindings"]=16681, + ["beaststalker's boots"]=16675, + ["beaststalker's cap"]=16677, + ["beaststalker's gloves"]=16676, + ["beaststalker's mantle"]=16679, + ["beaststalker's pants"]=16678, + ["beaststalker's tunic"]=16674, + ["belt of valor"]=16736, + ["bewitchments and glamours"]=209845, + ["big black mace"]=7945, + ["big bronze bomb"]=4380, + ["big bronze knife"]=3848, + ["big iron bomb"]=4394, + ["big voodoo mask"]=8201, + ["big voodoo robe"]=8200, + ["bindings of elements"]=16671, + ["bindings of the windseeker"]=18563, + ["black diamond"]=11754, + ["black dragonflight molt"]=10575, + ["black dragonscale"]=15416, + ["black mageweave vest"]=9998, + ["black ram"]=13328, + ["blood of the mountain"]=11382, + ["blood shard"]=5075, + ["bloodbelly fish"]=13546, + ["bloodcap"]=22434, + ["bloodshot spider eye"]=20610, + ["bloodvenom essence"]=20614, + ["blue glittering axe"]=7942, + ["blue overalls"]=6263, + ["blue pearl"]=4611, + ["blue power crystal"]=11184, + ["blue sapphire"]=12361, + ["blue voodoo feather"]=20607, + ["boar intestines"]=3172, + ["bolt of runecloth"]=14048, + ["bolt of woolen cloth"]=2997, + ["bone fragments"]=22526, + ["boots of elements"]=16670, + ["boots of valor"]=16734, + ["bracers of valor"]=16735, + ["breastplate of valor"]=16730, + ["breath of wind"]=7081, + ["brightcloth pants"]=14104, + ["brilliant chromatic scale"]=12607, + ["bronze bar"]=2841, + ["bronze battle axe"]=7958, + ["bronze greatsword"]=7957, + ["bronze tube"]=4371, + ["bronze warhammer"]=7956, + ["brownell's blue striped racer"]=19803, + ["burning charm"]=4479, + ["buzzard wing"]=3404, + ["carved centaur totem"]=254432, + ["catseye elixir"]=10592, + ["catseye ultra goggles"]=10501, + ["cenarion herb bag"]=22251, + ["chained essence of eranikus"]=10455, + ["charred razormane wand"]=5092, + ["chest of containment coffers"]=7247, + ["chimaerok tenderloin"]=21024, + ["chimeric vest"]=15075, + ["chromatic carapace"]=12871, + ["chunk of boar meat"]=769, + ["cindercloth robe"]=10042, + ["citrine"]=3864, + ["coal"]=3857, + ["coarse thread"]=2320, + ["coarse weightstone"]=3240, + ["coif of elements"]=16667, + ["cologne bottle"]=21833, + ["colorful kilt"]=10048, + ["comfortable leather hat"]=8174, + ["conjurer's codex"]=220353, + ["copper axe"]=2845, + ["copper bar"]=2840, + ["copper chain belt"]=2851, + ["copper modulator"]=4363, + ["cord of elements"]=16673, + ["core leather"]=17012, + ["core of earth"]=7075, + ["core of elements"]=22527, + ["crafted solid shot"]=8069, + ["craftsman's monocle"]=4393, + ["craftsman's writ: advanced target dummy"]=264081, + ["craftsman's writ: arcanite skeleton key"]=264132, + ["craftsman's writ: azure silk hood"]=264049, + ["craftsman's writ: barbaric gloves"]=264045, + ["craftsman's writ: big bronze bomb"]=264036, + ["craftsman's writ: big bronze knife"]=264027, + ["craftsman's writ: big voodoo mask"]=264100, + ["craftsman's writ: big voodoo robe"]=264101, + ["craftsman's writ: black mageweave vest"]=264110, + ["craftsman's writ: blue glittering axe"]=264072, + ["craftsman's writ: blue overalls"]=264048, + ["craftsman's writ: catseye draught"]=264060, + ["craftsman's writ: catseye ultra goggles"]=264084, + ["craftsman's writ: cenarion herb bag"]=264157, + ["craftsman's writ: chimeric vest"]=264148, + ["craftsman's writ: cindercloth robe"]=264114, + ["craftsman's writ: colorful kilt"]=264053, + ["craftsman's writ: comfortable leather hat"]=264092, + ["craftsman's writ: crafted solid shot"]=264037, + ["craftsman's writ: craftsman's monocle"]=264082, + ["craftsman's writ: crimson silk robe"]=264106, + ["craftsman's writ: dark iron bomb"]=264091, + ["craftsman's writ: dark leather shoulders"]=264044, + ["craftsman's writ: dark leather tunic"]=264041, + ["craftsman's writ: darkrune gauntlets"]=264130, + ["craftsman's writ: distilled firewater"]=264124, + ["craftsman's writ: draught of detect demon"]=264119, + ["craftsman's writ: draught of water breathing"]=264019, + ["craftsman's writ: dreamless sleep potion"]=264117, + ["craftsman's writ: dusky bracers"]=264094, + ["craftsman's writ: earthen silk belt"]=264115, + ["craftsman's writ: ebon shiv"]=264133, + ["craftsman's writ: elixir of agility"]=264066, + ["craftsman's writ: elixir of defense"]=264018, + ["craftsman's writ: elixir of lesser agility"]=264016, + ["craftsman's writ: elixir of ogre's strength"]=264011, + ["craftsman's writ: elixir of wisdom"]=264012, + ["craftsman's writ: enchanted mageweave pouch"]=264108, + ["craftsman's writ: explosive sheep"]=264030, + ["craftsman's writ: felcloth boots"]=264156, + ["craftsman's writ: field repair bot 74a"]=264139, + ["craftsman's writ: fine leather pants"]=264039, + ["craftsman's writ: fire goggles"]=264087, + ["craftsman's writ: fire protection potion"]=264063, + ["craftsman's writ: flash bomb"]=264086, + ["craftsman's writ: flask of chromatic resistance"]=264121, + ["craftsman's writ: free action potion"]=264015, + ["craftsman's writ: frost protection potion"]=264056, + ["craftsman's writ: frostsaber boots"]=264151, + ["craftsman's writ: ghostweave vest"]=264159, + ["craftsman's writ: gift of arthas"]=264120, + ["craftsman's writ: gnomish alarm-o-bot"]=264137, + ["craftsman's writ: gnomish universal remote"]=264035, + ["craftsman's writ: goblin jumper cables xl"]=264138, + ["craftsman's writ: goblin land mine"]=264083, + ["craftsman's writ: goblin rocket fuel"]=264065, + ["craftsman's writ: golden rod"]=264021, + ["craftsman's writ: golden scale coif"]=264074, + ["craftsman's writ: golden scale gauntlets"]=264078, + ["craftsman's writ: gordok ogre suit"]=264144, + ["craftsman's writ: great rage potion"]=264061, + ["craftsman's writ: greater adept's robe"]=264054, + ["craftsman's writ: greater fire protection potion"]=264118, + ["craftsman's writ: green iron boots"]=264028, + ["craftsman's writ: green iron gauntlets"]=264026, + ["craftsman's writ: green lens"]=264135, + ["craftsman's writ: guardian cloak"]=264093, + ["craftsman's writ: gyromatic micro-adjuster"]=264089, + ["craftsman's writ: heavy bronze mace"]=264024, + ["craftsman's writ: heavy leather ball"]=264038, + ["craftsman's writ: heavy mithril axe"]=264079, + ["craftsman's writ: heavy quiver"]=264043, + ["craftsman's writ: heavy scorpid helm"]=264149, + ["craftsman's writ: herbalist's gloves"]=264040, + ["craftsman's writ: huge thorium battleaxe"]=264131, + ["craftsman's writ: imperial plate chest"]=264129, + ["craftsman's writ: inlaid mithril cylinder"]=264069, + ["craftsman's writ: iridescent hammer"]=264022, + ["craftsman's writ: lesser invisibility potion"]=264057, + ["craftsman's writ: lesser mana potion"]=264013, + ["craftsman's writ: lesser stoneshield potion"]=264058, + ["craftsman's writ: lesser troll's blood elixir"]=264017, + ["craftsman's writ: lesser wizard's robe"]=264047, + ["craftsman's writ: lifelike mechanical toad"]=264136, + ["craftsman's writ: limited invulnerability potion"]=264122, + ["craftsman's writ: mageweave bag"]=264104, + ["craftsman's writ: major rejuvenation potion"]=264123, + ["craftsman's writ: mana potion"]=264062, + ["craftsman's writ: masterwork target dummy"]=264134, + ["craftsman's writ: mechanical dragonling"]=264080, + ["craftsman's writ: mechanical repair kit"]=264090, + ["craftsman's writ: minor recombobulator"]=264032, + ["craftsman's writ: mithril frag bomb"]=264088, + ["craftsman's writ: mithril spurs"]=264128, + ["craftsman's writ: moonsight rifle"]=264031, + ["craftsman's writ: moonsteel broadsword"]=264073, + ["craftsman's writ: nature protection potion"]=264059, + ["craftsman's writ: nightscape shoulders"]=264099, + ["craftsman's writ: orange martial shirt"]=264112, + ["craftsman's writ: orcish war leggings"]=264127, + ["craftsman's writ: ornate mithril shoulders"]=264071, + ["craftsman's writ: ornate spyglass"]=264029, + ["craftsman's writ: pearl-handled dagger"]=264020, + ["craftsman's writ: phoenix pants"]=264051, + ["craftsman's writ: pilferer's gloves"]=264042, + ["craftsman's writ: potion of demonslaying"]=264116, + ["craftsman's writ: practice lock"]=264033, + ["craftsman's writ: quickdraw quiver"]=264097, + ["craftsman's writ: radiant belt"]=264126, + ["craftsman's writ: radiant circlet"]=264125, + ["craftsman's writ: red mageweave pants"]=264111, + ["craftsman's writ: red whelp gloves"]=264046, + ["craftsman's writ: red woolen boots"]=264052, + ["craftsman's writ: rough bronze leggings"]=264025, + ["craftsman's writ: runecloth bag"]=264153, + ["craftsman's writ: runecloth boots"]=264154, + ["craftsman's writ: runic leather bracers"]=264150, + ["craftsman's writ: runic leather headband"]=264146, + ["craftsman's writ: shadow goggles"]=264034, + ["craftsman's writ: shadow oil"]=264064, + ["craftsman's writ: shadow protection potion"]=264014, + ["craftsman's writ: shadoweave gloves"]=264105, + ["craftsman's writ: shadoweave mask"]=264158, + ["craftsman's writ: shadoweave robe"]=264107, + ["craftsman's writ: silver skeleton key"]=264023, + ["craftsman's writ: small silk pack"]=264050, + ["craftsman's writ: sniper scope"]=264141, + ["craftsman's writ: solid sharpening stone"]=264075, + ["craftsman's writ: soul pouch"]=264160, + ["craftsman's writ: spider silk slippers"]=264055, + ["craftsman's writ: star belt"]=264109, + ["craftsman's writ: steel plate helm"]=264068, + ["craftsman's writ: steel weapon chain"]=264070, + ["craftsman's writ: swift boots"]=264098, + ["craftsman's writ: thick leather ammo pouch"]=264103, + ["craftsman's writ: tranquil mechanical yeti"]=264142, + ["craftsman's writ: truesilver rod"]=264077, + ["craftsman's writ: truesilver transformer"]=264140, + ["craftsman's writ: turtle scale breastplate"]=264102, + ["craftsman's writ: tuxedo jacket"]=264155, + ["craftsman's writ: unstable trigger"]=264085, + ["craftsman's writ: volcanic breastplate"]=264145, + ["craftsman's writ: white bandit mask"]=264113, + ["craftsman's writ: wicked leather bracers"]=264147, + ["craftsman's writ: wicked leather pants"]=264143, + ["craftsman's writ: wicked mithril blade"]=264076, + ["craftsman's writ: wild leather helmet"]=264095, + ["craftsman's writ: wild leather shoulders"]=264096, + ["craftsman's writ: wildvine potion"]=264067, + ["craftsman's writ: wizardweave turban"]=264152, + ["crag boar rib"]=2886, + ["crate with holes"]=5880, + ["cresting charm"]=4481, + ["crimes against anatomy"]=209849, + ["crimson silk robe"]=7063, + ["crisp spider meat"]=1081, + ["crocolisk meat"]=2924, + ["crude scope"]=4405, + ["crypt fiend parts"]=22525, + ["cured light hide"]=4231, + ["cured rugged hide"]=15407, + ["curved orcish dagger"]=279507, + ["dark iron ale mug"]=11325, + ["dark iron bar"]=11371, + ["dark iron bomb"]=16005, + ["dark iron ore"]=11370, + ["dark iron residue"]=18945, + ["dark iron scraps"]=22528, + ["dark leather shoulders"]=4252, + ["dark leather tunic"]=2317, + ["dark rune"]=20520, + ["darkmoon faire prize ticket"]=19182, + ["darkrune gauntlets"]=20549, + ["darkshore grouper"]=12238, + ["darkspear islands mark of honor"]=274895, + ["deadly blunderbuss"]=4369, + ["deeprock salt"]=8150, + ["defensive magics 101"]=215815, + ["delicate arcanite converter"]=16006, + ["demons and you"]=215817, + ["dense blasting powder"]=15992, + ["dense grinding stone"]=12644, + ["dense weightstone"]=12643, + ["desecrated belt"]=22370, + ["desecrated bindings"]=22369, + ["desecrated boots"]=22365, + ["desecrated bracers"]=22355, + ["desecrated breastplate"]=22349, + ["desecrated circlet"]=22367, + ["desecrated gauntlets"]=22357, + ["desecrated girdle"]=22363, + ["desecrated gloves"]=22371, + ["desecrated handguards"]=22364, + ["desecrated headpiece"]=22360, + ["desecrated helmet"]=22353, + ["desecrated leggings"]=22366, + ["desecrated legguards"]=22359, + ["desecrated legplates"]=22352, + ["desecrated pauldrons"]=22354, + ["desecrated robe"]=22351, + ["desecrated sabatons"]=22358, + ["desecrated sandals"]=22372, + ["desecrated shoulderpads"]=22368, + ["desecrated spaulders"]=22361, + ["desecrated tunic"]=22350, + ["desecrated waistguard"]=22356, + ["desecrated wristguards"]=22362, + ["devout belt"]=16696, + ["devout bracers"]=16697, + ["devout crown"]=16693, + ["devout gloves"]=16692, + ["devout mantle"]=16695, + ["devout robe"]=16690, + ["devout sandals"]=16691, + ["devout skirt"]=16694, + ["dezian queenfish"]=19806, + ["discolored worg heart"]=3164, + ["distilled firewater"]=246948, + ["divino-matic rod"]=8548, + ["dreadmist belt"]=16702, + ["dreadmist bracers"]=16703, + ["dreadmist leggings"]=16699, + ["dreadmist mantle"]=16701, + ["dreadmist mask"]=16698, + ["dreadmist robe"]=16700, + ["dreadmist sandals"]=16704, + ["dreadmist wraps"]=16705, + ["dreamless sleep potion"]=12190, + ["dusky bracers"]=7378, + ["earthen silk belt"]=7061, + ["earthroot"]=2449, + ["ebon shiv"]=7947, + ["elemental air"]=7069, + ["elemental earth"]=7067, + ["elemental fire"]=7068, + ["elemental water"]=7070, + ["elementals deck"]=19267, + ["elementium bar"]=17771, + ["elementium ore"]=18562, + ["elixir of agility"]=8949, + ["elixir of demonslaying"]=9224, + ["elixir of detect demon"]=9233, + ["elixir of fortitude"]=3825, + ["elixir of greater defense"]=8951, + ["elixir of lesser agility"]=3390, + ["elixir of lion's strength"]=2454, + ["elixir of minor defense"]=5997, + ["elixir of minor fortitude"]=2458, + ["elixir of ogre's strength"]=3391, + ["elixir of shadow power"]=9264, + ["elixir of water breathing"]=5996, + ["elixir of wisdom"]=3383, + ["embossed leather boots"]=2309, + ["embossed leather cloak"]=2310, + ["embossed leather gloves"]=4239, + ["emerald dreamcatcher"]=8048, + ["empty vial"]=3371, + ["enchanted leather"]=12810, + ["enchanted mageweave pouch"]=22246, + ["enchanted south seas kelp"]=19610, + ["enchanted thorium bar"]=12655, + ["enriched manna biscuit"]=13724, + ["essence of agony"]=8923, + ["essence of fire"]=7078, + ["essence of the exile"]=6851, + ["essence of water"]=7080, + ["everyday etiquette"]=220348, + ["evil bat eye"]=11404, + ["explosive sheep"]=4384, + ["eye of the tempest"]=212792, + ["fel elemental rod"]=21939, + ["felcloth"]=14256, + ["felcloth boots"]=14108, + ["field repair bot 74a"]=18232, + ["fiery core"]=17010, + ["fine leather pants"]=5958, + ["fine thread"]=2321, + ["fire goggles"]=10500, + ["fire protection potion"]=6049, + ["firebloom"]=4625, + ["fish chunks"]=206345, + ["flagon of mead"]=2594, + ["flash bomb"]=4852, + ["flask of big mojo"]=8152, + ["flask of chromatic resistance"]=13513, + ["flask of oil"]=814, + ["flask of petrification"]=13506, + ["flask of supreme power"]=13512, + ["free action potion"]=5634, + ["frost oil"]=3829, + ["frost protection potion"]=6050, + ["frost ram"]=13329, + ["frostsaber boots"]=15071, + ["frostwolf insignia rank 1"]=17690, + ["frostwolf insignia rank 2"]=17905, + ["frostwolf insignia rank 3"]=17906, + ["frostwolf insignia rank 4"]=17907, + ["frostwolf insignia rank 5"]=17908, + ["frozen rune"]=22682, + ["fury of the land"]=209851, + ["gauntlets of elements"]=16672, + ["gauntlets of valor"]=16737, + ["geomancy: the stone-cold truth"]=215683, + ["ghostweave vest"]=14141, + ["giant egg"]=12207, + ["giant silver vein"]=11405, + ["gift of arthas"]=9088, + ["gingerbread cookie"]=17197, + ["gizzard gum"]=8424, + ["globe of water"]=7079, + ["glowing scorpid blood"]=19933, + ["gnomish battle chicken"]=10725, + ["gnomish universal remote"]=7506, + ["goaz scrolls"]=209848, + ["goblin jumper cables xl"]=18587, + ["goblin land mine"]=4395, + ["goblin rocket fuel"]=9061, + ["goblin sapper charge"]=10646, + ["gold bar"]=3577, + ["golden rod"]=11128, + ["golden scale bracers"]=6040, + ["golden scale coif"]=3837, + ["golden scale gauntlets"]=9366, + ["golem isospring"]=255007, + ["gooey spider leg"]=2251, + ["gordok shackle key"]=18250, + ["goretusk liver"]=723, + ["goretusk snout"]=731, + ["gorishi sting"]=22435, + ["great goretusk snout"]=2296, + ["great rage potion"]=5633, + ["greater adept's robe"]=6264, + ["greater arcane protection potion"]=13461, + ["greater eternal essence"]=16203, + ["greater fire protection potion"]=13457, + ["green firework"]=9313, + ["green hills of stranglethorn - page 1"]=2725, + ["green hills of stranglethorn - page 10"]=2734, + ["green hills of stranglethorn - page 11"]=2735, + ["green hills of stranglethorn - page 14"]=2738, + ["green hills of stranglethorn - page 16"]=2740, + ["green hills of stranglethorn - page 18"]=2742, + ["green hills of stranglethorn - page 20"]=2744, + ["green hills of stranglethorn - page 21"]=2745, + ["green hills of stranglethorn - page 24"]=2748, + ["green hills of stranglethorn - page 25"]=2749, + ["green hills of stranglethorn - page 26"]=2750, + ["green hills of stranglethorn - page 27"]=2751, + ["green hills of stranglethorn - page 4"]=2728, + ["green hills of stranglethorn - page 6"]=2730, + ["green hills of stranglethorn - page 8"]=2732, + ["green iron boots"]=3484, + ["green iron bracers"]=3835, + ["green iron gauntlets"]=3485, + ["green iron helm"]=3836, + ["green iron leggings"]=3842, + ["green kodo"]=15292, + ["green lens"]=10504, + ["green power crystal"]=11185, + ["green voodoo feather"]=20608, + ["gromsblood"]=8846, + ["guardian cloak"]=5965, + ["guardian's moldy card"]=22145, + ["gyrochronatom"]=4389, + ["gyromatic micro-adjustor"]=10498, + ["harvester gyrostabilizer"]=255010, + ["healing potion"]=929, + ["heart of fire"]=7077, + ["heathen's brand"]=19579, + ["heavy armor kit"]=4265, + ["heavy bronze mace"]=3491, + ["heavy copper maul"]=6214, + ["heavy grinding stone"]=3486, + ["heavy junkbox"]=16885, + ["heavy leather"]=4234, + ["heavy leather ball"]=18662, + ["heavy mageweave bandage"]=8545, + ["heavy mithril axe"]=7941, + ["heavy mithril boots"]=7933, + ["heavy mithril breastplate"]=7930, + ["heavy quiver"]=7371, + ["heavy runecloth bandage"]=14530, + ["heavy scorpid helm"]=15080, + ["heavy scorpid scale"]=15408, + ["heavy silk bandage"]=6451, + ["helm of valor"]=16731, + ["herbalist's gloves"]=7349, + ["hi-explosive bomb"]=10562, + ["hillman's cloak"]=3719, + ["horde commendation signet"]=21438, + ["horde gift collection"]=22263, + ["horn of the arctic wolf"]=12351, + ["horn of the red wolf"]=12330, + ["huge emerald"]=12364, + ["huge thorium battleaxe"]=12775, + ["human orphan whistle"]=18598, + ["ice cold milk"]=1179, + ["ichor of undeath"]=7972, + ["icy blue mechanostrider mod a"]=13327, + ["imperial plate chest"]=12422, + ["imperial qiraji armaments"]=21232, + ["imperial qiraji regalia"]=21237, + ["inlaid mithril cylinder"]=9060, + ["insignia of the crusade"]=22524, + ["insignia of the dawn"]=22523, + ["iridescent hammer"]=5541, + ["iron bar"]=3575, + ["ironweb spider silk"]=14227, + ["isaac's heart"]=190180, + ["jade"]=1529, + ["jagged orcish sword"]=279505, + ["joseph's wedding ring"]=12894, + ["jungle remedy"]=2633, + ["junglevine wine"]=4595, + ["ka-boom!"]=228136, + ["keefer's angelfish"]=19805, + ["keg of thunderbrew"]=1262, + ["kezan's taint"]=19602, + ["kilt of elements"]=16668, + ["kingsblood"]=3356, + ["kodo bone"]=13703, + ["large brilliant shard"]=14344, + ["large radiant shard"]=11178, + ["lava core"]=17011, + ["leaded vial"]=3372, + ["lean wolf flank"]=1015, + ["lean wolf steak"]=12209, + ["legends of the tidesages"]=220346, + ["legplates of valor"]=16732, + ["lesser invisibility potion"]=3823, + ["lesser mana potion"]=3385, + ["lesser nether essence"]=11174, + ["lesser stoneshield potion"]=4623, + ["lesser wizard's robe"]=5766, + ["libram of constitution"]=11733, + ["libram of focus"]=18333, + ["libram of protection"]=18334, + ["libram of rapidity"]=18332, + ["libram of resilience"]=11736, + ["libram of rumination"]=11732, + ["libram of tenacity"]=11734, + ["libram of voracity"]=11737, + ["library scrip"]=3898, + ["lifelike mechanical toad"]=15996, + ["liferoot"]=3357, + ["light leather"]=2318, + ["lightforge belt"]=16723, + ["lightforge boots"]=16725, + ["lightforge bracers"]=16722, + ["lightforge breastplate"]=16726, + ["lightforge gauntlets"]=16724, + ["lightforge helm"]=16727, + ["lightforge legplates"]=16728, + ["lightforge spaulders"]=16729, + ["lightning eel"]=13757, + ["limited invulnerability potion"]=3387, + ["linen bandage"]=1251, + ["linen cloth"]=2589, + ["long elegant feather"]=4589, + ["luminous residue"]=247884, + ["lung juice cocktail"]=8411, + ["maelstrom's tendril"]=19618, + ["mageweave bag"]=10050, + ["mageweave bandage"]=8544, + ["mageweave cloth"]=4338, + ["magister's belt"]=16685, + ["magister's bindings"]=16683, + ["magister's boots"]=16682, + ["magister's crown"]=16686, + ["magister's gloves"]=16684, + ["magister's leggings"]=16687, + ["magister's mantle"]=16689, + ["magister's robes"]=16688, + ["magma or lava?"]=228133, + ["major healing potion"]=13446, + ["major mana potion"]=13444, + ["major rejuvenation potion"]=18253, + ["mana potion"]=3827, + ["marshal haggard's badge"]=6782, + ["massive iron axe"]=3855, + ["masterwork target dummy"]=16023, + ["mechanical dragonling"]=4396, + ["mechanical repair kit"]=11590, + ["medium leather"]=2319, + ["minor mana potion"]=2455, + ["minor recombobulator"]=4381, + ["mithril bar"]=3860, + ["mithril casing"]=10561, + ["mithril coif"]=7931, + ["mithril frag bomb"]=10514, + ["mithril spurs"]=7969, + ["mithril tube"]=10559, + ["mooncloth"]=14342, + ["moonsight rifle"]=4383, + ["moonsilver blade"]=268484, + ["moonsteel broadsword"]=3853, + ["moss agate"]=1206, + ["mummies: a guide to the unsavory undead"]=215820, + ["murloc eye"]=730, + ["murloc fin"]=1468, + ["nagmara's filled vial"]=11413, + ["nar'thalas almanac, vol. 74"]=209843, + ["nature protection potion"]=6052, + ["necromancy 101"]=228141, + ["necrotic rune"]=22484, + ["nexus crystal"]=20725, + ["night dragon's breath"]=11952, + ["nightcrawlers"]=6530, + ["nightscape boots"]=8197, + ["nightscape headband"]=8176, + ["nightscape pants"]=8193, + ["nightscape shoulders"]=8192, + ["nightscape tunic"]=8175, + ["northern kalimdor - a comprehensive guide"]=228134, + ["nutritious slime sludge"]=278265, + ["ogre tannin"]=18240, + ["oil of immolation"]=8956, + ["orange martial shirt"]=10052, + ["orcish orphan whistle"]=18597, + ["orcish war leggings"]=7929, + ["ornate mithril boots"]=7936, + ["ornate mithril breastplate"]=7935, + ["ornate mithril gloves"]=7927, + ["ornate mithril helm"]=7937, + ["ornate mithril pants"]=7926, + ["ornate mithril shoulder"]=7928, + ["ornate spyglass"]=5507, + ["palomino bridle"]=12354, + ["pamela's doll"]=12885, + ["patterned bronze bracers"]=2868, + ["pauldrons of elements"]=16669, + ["peacebloom"]=2447, + ["pearl-handled dagger"]=5540, + ["pebble of kajaro"]=19598, + ["perfect courser antler"]=20017, + ["perfume bottle"]=21829, + ["phoenix pants"]=4317, + ["pilferer's gloves"]=7358, + ["pine salve"]=206175, + ["plated armorfish"]=13890, + ["portals deck"]=19277, + ["powdered azurite"]=7127, + ["powerful anti-venom"]=19440, + ["powerful mojo"]=12804, + ["practice lock"]=6712, + ["primal hakkari idol"]=22637, + ["primitive drawing"]=211269, + ["prismatic shell"]=23250, + ["pristine black diamond"]=18335, + ["pristine hide of the beast"]=12731, + ["punctured voodoo doll"]=19813, + ["purple lotus"]=8831, + ["putrid vine"]=22444, + ["qiraji lord's insignia"]=21229, + ["quickdraw quiver"]=8217, + ["radiant belt"]=12416, + ["radiant circlet"]=12417, + ["rainbow fin albacore"]=5095, + ["razormane backstabber"]=5093, + ["razormane war shield"]=5094, + ["red dye"]=2604, + ["red mageweave pants"]=10009, + ["red power crystal"]=11186, + ["red whelp gloves"]=7284, + ["red woolen boots"]=4313, + ["refreshing spring water"]=159, + ["reins of the frostsaber"]=12302, + ["reins of the nightsaber"]=12303, + ["resonating skull"]=13155, + ["rethban ore"]=2798, + ["rhapsody malt"]=2894, + ["righteous orb"]=12811, + ["roast raptor"]=12210, + ["robes of arcana"]=5770, + ["rotting wood"]=20613, + ["rough bronze leggings"]=2865, + ["rough dynamite"]=4358, + ["rough grinding stone"]=3470, + ["rugged armor kit"]=15564, + ["rugged leather"]=8170, + ["rumi of gnomeregan: the collected works"]=208860, + ["rune thread"]=14341, + ["runecloth"]=14047, + ["runecloth bag"]=14046, + ["runecloth bandage"]=14529, + ["runecloth boots"]=13864, + ["runecloth robe"]=13858, + ["runed copper belt"]=2857, + ["runes of the sorcerer-kings"]=209850, + ["runic leather bracers"]=15092, + ["runic leather headband"]=15094, + ["runic leather pants"]=15095, + ["rwlrwlrwlrwl!"]=215822, + ["ryedol's lucky pick"]=4616, + ["sanguine sorcery"]=220345, + ["savage frond"]=22529, + ["scourge: undead menace or misunderstood?"]=228140, + ["seaforium mining charge"]=206157, + ["sealed azure bag"]=19775, + ["secrets of the dreamers"]=209846, + ["shadow goggles"]=4373, + ["shadow hunter knife"]=5040, + ["shadow oil"]=3824, + ["shadow protection potion"]=6048, + ["shadowcraft belt"]=16713, + ["shadowcraft boots"]=16711, + ["shadowcraft bracers"]=16710, + ["shadowcraft cap"]=16707, + ["shadowcraft gloves"]=16712, + ["shadowcraft pants"]=16709, + ["shadowcraft spaulders"]=16708, + ["shadowcraft tunic"]=16721, + ["shadoweave gloves"]=10023, + ["shadoweave mask"]=10025, + ["shadoweave robe"]=10004, + ["sharp claw"]=5635, + ["shellfish"]=13545, + ["shiny bauble"]=6529, + ["shiny red apple"]=4536, + ["signet ring of the bronze dragonflight"]=21196, + ["silk bandage"]=6450, + ["silk cloth"]=4306, + ["silver bar"]=2842, + ["silver skeleton key"]=15869, + ["silver totem of aquementas"]=11522, + ["silvered bronze boots"]=3482, + ["silvered bronze gauntlets"]=3483, + ["silverleaf"]=765, + ["simple wildflowers"]=3421, + ["singed scale"]=6486, + ["small egg"]=6889, + ["small furry paw"]=5134, + ["small silk pack"]=4245, + ["small spider leg"]=5465, + ["smoked desert dumplings"]=20452, + ["smotts' cutlass"]=3935, + ["sniper scope"]=10548, + ["soft bushy tail"]=4582, + ["solid dynamite"]=10507, + ["solid grinding stone"]=7966, + ["solid iron maul"]=3851, + ["solid sharpening stone"]=7964, + ["soothing spices"]=3713, + ["soul pouch"]=21340, + ["soul shard"]=6265, + ["southshore stout"]=3703, + ["spaulders of valor"]=16733, + ["special chicken feed"]=11109, + ["speckled tastyfish"]=19807, + ["spider ichor"]=3174, + ["spider silk slippers"]=4321, + ["spotted yellowtail"]=6887, + ["star belt"]=4329, + ["star ruby"]=7910, + ["steel breastplate"]=7963, + ["steel plate helm"]=7922, + ["steel weapon chain"]=6041, + ["stonescale eel"]=13422, + ["stonescale oil"]=13423, + ["stonewrought design"]=220349, + ["stormpike insignia rank 1"]=17691, + ["stormpike insignia rank 2"]=17900, + ["stormpike insignia rank 3"]=17901, + ["stormpike insignia rank 4"]=17902, + ["stormpike insignia rank 5"]=17903, + ["stormwind guard's card"]=22143, + ["stormwind seasoning herbs"]=2665, + ["stranglekelp"]=3820, + ["strength of mugamba"]=19574, + ["strider meat"]=5469, + ["stringy vulture meat"]=729, + ["strong flux"]=3466, + ["strong troll's blood potion"]=3388, + ["sulfuron ingot"]=17203, + ["sweet nectar"]=1708, + ["swift boots"]=7391, + ["tazan's satchel"]=7209, + ["teal kodo"]=15293, + ["the apothecary's metaphysical primer"]=208185, + ["the dalaran digest, vol. 23"]=209844, + ["the eye of zuldazar"]=19591, + ["the knight and the lady"]=228138, + ["the lessons of ta'zo"]=207972, + ["the liminal and the arcane"]=220347, + ["the scepter of the shifting sands"]=21175, + ["thick armor kit"]=8173, + ["thick black claw"]=20611, + ["thick leather"]=4304, + ["thick leather ammo pouch"]=8218, + ["thorium bar"]=12359, + ["thorium grenade"]=15993, + ["thorium shells"]=15997, + ["thorium tube"]=16000, + ["thorium widget"]=15994, + ["thunder ale"]=2686, + ["thunder applejack"]=247824, + ["thundering charm"]=4480, + ["tigule's strawberry ice cream"]=7228, + ["tin bar"]=3576, + ["tooth of morphaz"]=20019, + ["torn bear pelt"]=11407, + ["tough condor meat"]=1080, + ["tough scorpid breastplate"]=8203, + ["tough scorpid gloves"]=8204, + ["toughened leather armor"]=2314, + ["trader's satchel"]=10467, + ["tranquil mechanical yeti"]=21277, + ["troll tribal necklace"]=9259, + ["truesilver bar"]=6037, + ["truesilver rod"]=11144, + ["truesilver transformer"]=18631, + ["turtle meat"]=3712, + ["turtle scale bracers"]=8198, + ["turtle scale breastplate"]=8189, + ["turtle scale gloves"]=8187, + ["turtle scale helm"]=8191, + ["turtle scale leggings"]=8185, + ["tuxedo jacket"]=10036, + ["twilight cultist robe"]=20407, + ["un'goro soil"]=11018, + ["undead potatoes"]=228132, + ["unstable trigger"]=10560, + ["ur's treatise on shadow magic"]=7266, + ["venomous journeys"]=220350, + ["vest of elements"]=16666, + ["vial of phlogiston"]=6841, + ["vibrant plume"]=5117, + ["vision of voodress"]=19606, + ["volcanic breastplate"]=15053, + ["volcanic hammer"]=12792, + ["wailing essence"]=6464, + ["war horn mouthpiece"]=6074, + ["warlords deck"]=19257, + ["warosh's mojo"]=12712, + ["wartorn chain scrap"]=22374, + ["wartorn cloth scrap"]=22376, + ["wartorn leather scrap"]=22373, + ["wartorn plate scrap"]=22375, + ["wastewander water pouch"]=8483, + ["water sapta"]=6637, + ["wavethrasher scales"]=20087, + ["whipper root tuber"]=11951, + ["whirring bronze gizmo"]=4375, + ["whistle of the ivory raptor"]=13317, + ["whistle of the mottled red raptor"]=8586, + ["white bandit mask"]=10008, + ["white mechanostrider mod a"]=13326, + ["white stallion bridle"]=12353, + ["wicked leather belt"]=15088, + ["wicked leather bracers"]=15084, + ["wicked leather headband"]=15086, + ["wicked leather pants"]=15087, + ["wicked mithril blade"]=7943, + ["wild leather helmet"]=8214, + ["wild leather shoulders"]=8210, + ["wild leather vest"]=8211, + ["wildheart belt"]=16716, + ["wildheart boots"]=16715, + ["wildheart bracers"]=16714, + ["wildheart cowl"]=16720, + ["wildheart gloves"]=16717, + ["wildheart kilt"]=16719, + ["wildheart spaulders"]=16718, + ["wildheart vest"]=16706, + ["wildvine"]=8153, + ["wildvine potion"]=9144, + ["withered scarf"]=190232, + ["wizardweave turban"]=14130, + ["wooden figurine"]=190309, + ["wool bandage"]=3530, + ["wool cloth"]=2592, + ["worn dragonscale"]=8165, + ["yellow power crystal"]=11188, + ["zandalarian shadow talisman"]=19614, + ["zesty clam meat"]=7974, +} diff --git a/QuestShoppingList/QuestShoppingList.lua b/QuestShoppingList/QuestShoppingList.lua new file mode 100644 index 0000000..b63ee5f --- /dev/null +++ b/QuestShoppingList/QuestShoppingList.lua @@ -0,0 +1,463 @@ +-- Quest Shopping List: a panel beside the auction house listing items your +-- active quests still need, with what they'd cost against what the quest pays. + +local _, ns = ... + +local CALLER = "QuestShoppingList" +local AUCTION_KEEP = 0.95 -- what's left of a sale after the auction house cut +local BIND_ON_PICKUP, BIND_QUEST = 1, 4 +local PANEL_WIDTH = 350 +local QUEST_ROW_HEIGHT = 36 +local ITEM_ROW_HEIGHT = 18 +local PRICE_REFRESH_SECONDS = 3 + +local GREEN, RED, WHITE = "|cff40ff40", "|cffff5050", "|cffffffff" + +-- List of { questID, title, level, items = { { id, name, need } } }. +local quests = {} +local panel, content, searchAll +local rowPool = {} +local waitingForItem = {} +local allMissing = {} + +-- "Linen Cloth: 3/5" or "3/5 Linen Cloth (Optional)" -> "Linen Cloth" +local function ObjectiveItemName(text) + local name = text:match("^%d+/%d+%s+(.+)$") or text:match("^(.-):?%s*%d+/%d+") + if name then + name = name:gsub("%s+%(Optional%)$", "") + name = name:match("^%s*(.-)%s*$") + if name ~= "" then + return name + end + end +end + +local function ReadEntries() + local entries = {} + for i = 1, (C_QuestLog.GetNumQuestLogEntries()) do + local info = C_QuestLog.GetInfo(i) + if info then + entries[#entries + 1] = info + end + end + return entries +end + +-- Collapsed headers can hide their quests, so open those long enough to read. +local function ExpandHiddenHeaders(entries) + local reopened + for i = #entries, 1, -1 do + local info, nextInfo = entries[i], entries[i + 1] + if info.isHeader and info.isCollapsed and (not nextInfo or nextInfo.isHeader) then + reopened = reopened or {} + reopened[info.title] = true + ExpandQuestHeader(i) + end + end + return reopened +end + +local function CollapseHeaders(titles) + local entries = ReadEntries() + for i = #entries, 1, -1 do + local info = entries[i] + if info.isHeader and titles[info.title] then + CollapseQuestHeader(i) + end + end +end + +local function ReadQuestItems(questID) + local items = {} + for _, objective in ipairs(C_QuestLog.GetQuestObjectives(questID) or {}) do + local name = objective.type == "item" and objective.text and ObjectiveItemName(objective.text) + local id = name and ns.itemIDs[name:lower()] + if id and objective.numRequired and objective.numRequired > 0 then + items[#items + 1] = { id = id, name = name, need = objective.numRequired } + end + end + return items +end + +local function ScanQuests() + local entries = ReadEntries() + local reopened = ExpandHiddenHeaders(entries) + if reopened then + entries = ReadEntries() + end + + local found = {} + for _, info in ipairs(entries) do + if not info.isHeader and not info.isHidden and info.questID and info.questID > 0 then + local items = ReadQuestItems(info.questID) + if #items > 0 then + found[#found + 1] = { questID = info.questID, title = info.title, level = info.level, items = items } + end + end + end + + if reopened then + CollapseHeaders(reopened) + end + quests = found +end + +local function AuctionPrice(id) + return Auctionator.API.v1.GetAuctionPriceByItemID(CALLER, id) +end + +-- Sell price and bind type, or nil until the client has loaded the item. +local function ItemFacts(id) + local sellPrice, _, _, bindType = select(11, C_Item.GetItemInfo(id)) + if bindType == nil then + if not waitingForItem[id] then + waitingForItem[id] = true + C_Item.RequestLoadItemDataByID(id) + end + return nil + end + return sellPrice or 0, bindType +end + +-- Items not yet loaded stay listed until we know they can't be traded. +local function CanBuy(id) + local _, bindType = ItemFacts(id) + return bindType ~= BIND_ON_PICKUP and bindType ~= BIND_QUEST +end + +-- What a reward is worth to you: vendor it, or auction it if it can be traded. +local function RewardItemValue(id, quantity) + local sellPrice, bindType = ItemFacts(id) + if not sellPrice then + return nil + end + local value = sellPrice * quantity + if bindType ~= BIND_ON_PICKUP and bindType ~= BIND_QUEST then + local price = AuctionPrice(id) + if price then + value = math.max(value, math.floor(price * quantity * AUCTION_KEEP)) + end + end + return value +end + +local function ReadRewards(questID) + local rewards = { money = GetQuestLogRewardMoney(questID) or 0, xp = GetQuestLogRewardXP(questID) or 0, complete = true, details = {} } + rewards.total = rewards.money + if rewards.money > 0 then + rewards.details[#rewards.details + 1] = { "Gold", rewards.money } + end + + for i = 1, GetNumQuestLogRewards(questID) or 0 do + local name, _, quantity, _, _, itemID = GetQuestLogRewardInfo(i, questID) + local value = itemID and RewardItemValue(itemID, quantity or 1) + if value then + rewards.total = rewards.total + value + rewards.details[#rewards.details + 1] = { name, value } + else + rewards.complete = false + end + end + + -- You only get one of the choices, so count the most valuable. + local bestName, bestValue + for i = 1, GetNumQuestLogChoices(questID) or 0 do + local name, _, quantity, _, _, itemID = GetQuestLogChoiceInfo(i, questID) + local value = itemID and RewardItemValue(itemID, quantity or 1) + if not value then + rewards.complete = false + elseif not bestValue or value > bestValue then + bestName, bestValue = name, value + end + end + if bestValue then + rewards.total = rewards.total + bestValue + rewards.details[#rewards.details + 1] = { "Best choice: " .. bestName, bestValue } + end + return rewards +end + +-- Items still to buy for a quest, and what they'd cost. `owned` is shared by +-- all quests in a pass, so one stack isn't counted towards two of them. +local function ReadShopping(quest, owned) + local shopping = { items = {}, cost = 0, costKnown = true } + for _, item in ipairs(quest.items) do + owned[item.id] = owned[item.id] or C_Item.GetItemCount(item.id, true) or 0 + local have = math.min(owned[item.id], item.need) + owned[item.id] = owned[item.id] - have + local missing = item.need - have + if missing > 0 and CanBuy(item.id) then + local price = AuctionPrice(item.id) + local itemCost = price and price * missing + if itemCost then + shopping.cost = shopping.cost + itemCost + else + shopping.costKnown = false + end + shopping.items[#shopping.items + 1] = { + id = item.id, name = item.name, have = have, need = item.need, missing = missing, cost = itemCost, + } + end + end + return shopping +end + +local function Money(copper) + return GetMoneyString(copper) +end + +local function Summary(shopping, rewards) + local costText = shopping.costKnown and Money(shopping.cost) + or (shopping.cost > 0 and Money(shopping.cost) .. " + ?" or "?") + local parts = {} + if rewards.total > 0 then + parts[#parts + 1] = Money(rewards.total) + end + if rewards.xp > 0 then + parts[#parts + 1] = rewards.xp .. " XP" + end + local rewardText = #parts > 0 and table.concat(parts, " + ") or "none" + + local color = WHITE + if shopping.costKnown and rewards.complete then + color = rewards.total >= shopping.cost and GREEN or RED + end + return color .. "Buy " .. costText .. " | Reward " .. rewardText .. "|r" +end + +local function Search(items) + local byName, terms = {}, {} + for _, item in ipairs(items) do + local term = byName[item.name] + if term then + term.quantity = term.quantity + item.missing + else + term = { searchString = item.name, isExact = true, quantity = item.missing } + byName[item.name] = term + terms[#terms + 1] = term + end + end + if #terms > 0 then + Auctionator.API.v1.MultiSearchAdvanced(CALLER, terms) + end +end + +local function OnRowEnter(row) + if not row.details then + return + end + GameTooltip:SetOwner(row, "ANCHOR_RIGHT") + GameTooltip:SetText(row.tooltipTitle) + for _, detail in ipairs(row.details) do + GameTooltip:AddDoubleLine(detail[1], Money(detail[2]), 1, 1, 1, 1, 1, 1) + end + GameTooltip:Show() +end + +local function OnRowLeave() + GameTooltip:Hide() +end + +local function OnRowClick(row) + Search(row.items) +end + +local function GetRow(index) + local row = rowPool[index] + if row then + return row + end + row = CreateFrame("Button", nil, content) + row:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD") + row.right = row:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") + row.right:SetPoint("TOPRIGHT", row, "TOPRIGHT", -4, -3) + row.right:SetJustifyH("RIGHT") + row.left = row:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") + row.left:SetPoint("TOPLEFT", row, "TOPLEFT", 4, -3) + row.left:SetPoint("RIGHT", row.right, "LEFT", -4, 0) + row.left:SetJustifyH("LEFT") + row.sub = row:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall") + row.sub:SetPoint("TOPLEFT", row.left, "BOTTOMLEFT", 0, -3) + row.sub:SetPoint("RIGHT", row, "RIGHT", -4, 0) + row.sub:SetJustifyH("LEFT") + row:SetScript("OnClick", OnRowClick) + row:SetScript("OnEnter", OnRowEnter) + row:SetScript("OnLeave", OnRowLeave) + rowPool[index] = row + return row +end + +local function PlaceRow(row, y, height) + row:ClearAllPoints() + row:SetPoint("TOPLEFT", content, "TOPLEFT", 0, -y) + row:SetPoint("RIGHT", content, "RIGHT", 0, 0) + row:SetHeight(height) + row:Show() + return y + height +end + +local function Render() + if not panel then + return + end + + local used, y = 0, 0 + allMissing = {} + local owned = {} + for _, quest in ipairs(quests) do + local shopping = ReadShopping(quest, owned) + if #shopping.items > 0 then + local rewards = ReadRewards(quest.questID) + + used = used + 1 + local header = GetRow(used) + header.rowKind = "quest" + header.items = shopping.items + header.details = rewards.details + header.tooltipTitle = quest.title + header.left:SetText((quest.level and "[" .. quest.level .. "] " or "") .. quest.title) + header.right:SetText("") + header.sub:SetText(Summary(shopping, rewards)) + header.sub:Show() + y = PlaceRow(header, y, QUEST_ROW_HEIGHT) + + for _, item in ipairs(shopping.items) do + allMissing[#allMissing + 1] = item + used = used + 1 + local row = GetRow(used) + row.rowKind = "item" + row.items = { item } + row.details = nil + row.left:SetText(WHITE .. " " .. item.name .. "|r") + row.right:SetText(WHITE .. item.have .. " / " .. item.need .. " " .. (item.cost and Money(item.cost) or "no price") .. "|r") + row.sub:Hide() + y = PlaceRow(row, y, ITEM_ROW_HEIGHT) + end + end + end + + for i = used + 1, #rowPool do + rowPool[i]:Hide() + end + content:SetHeight(math.max(y, 1)) + if used == 0 then + panel:Hide() + end + return used +end + +local function CreatePanel(parent) + panel = CreateFrame("Frame", "QuestShoppingListPanel", parent, "BackdropTemplate") + panel:SetPoint("TOPLEFT", parent, "TOPRIGHT", 2, 0) + panel:SetPoint("BOTTOMLEFT", parent, "BOTTOMRIGHT", 2, 0) + panel:SetWidth(PANEL_WIDTH) + panel:SetBackdrop({ + bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", + tile = true, tileSize = 16, edgeSize = 16, + insets = { left = 4, right = 4, top = 4, bottom = 4 }, + }) + panel:SetBackdropColor(0, 0, 0, 0.92) + + local title = panel:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") + title:SetPoint("TOPLEFT", panel, "TOPLEFT", 12, -10) + title:SetText("Quest Shopping") + + local close = CreateFrame("Button", nil, panel, "UIPanelCloseButton") + close:SetPoint("TOPRIGHT", panel, "TOPRIGHT", 0, 0) + + searchAll = CreateFrame("Button", nil, panel, "UIPanelButtonTemplate") + searchAll:SetSize(100, 22) + searchAll:SetPoint("TOPRIGHT", close, "TOPLEFT", -2, -4) + searchAll:SetText("Search all") + searchAll:SetScript("OnClick", function() + Search(allMissing) + end) + + local scroll = CreateFrame("ScrollFrame", nil, panel, "UIPanelScrollFrameTemplate") + scroll:SetPoint("TOPLEFT", panel, "TOPLEFT", 8, -36) + scroll:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -28, 8) + + content = CreateFrame("Frame", nil, scroll) + content:SetSize(PANEL_WIDTH - 36, 1) + scroll:SetScrollChild(content) + + C_Timer.NewTicker(PRICE_REFRESH_SECONDS, function() + if panel:IsVisible() then + Render() + end + end) +end + +local function OpenPanel() + local parent = AuctionHouseFrame or AuctionFrame + if not parent then + return + end + if not panel then + CreatePanel(parent) + end + ScanQuests() + if Render() > 0 then + panel:Show() + end +end + +local queuedScan, queuedRender = false, false + +local function QueueRender() + if not queuedRender then + queuedRender = true + C_Timer.After(0.2, function() + queuedRender = false + if panel and panel:IsVisible() then + Render() + end + end) + end +end + +local function QueueScan() + if not queuedScan then + queuedScan = true + C_Timer.After(0.5, function() + queuedScan = false + if panel and panel:IsVisible() then + ScanQuests() + Render() + end + end) + end +end + +local frame = CreateFrame("Frame") +for _, event in ipairs({ "AUCTION_HOUSE_SHOW", "BAG_UPDATE_DELAYED", "ITEM_DATA_LOAD_RESULT", "QUEST_ACCEPTED", "QUEST_REMOVED", "QUEST_TURNED_IN" }) do + if not C_EventUtils or C_EventUtils.IsEventValid(event) then + frame:RegisterEvent(event) + end +end +frame:SetScript("OnEvent", function(_, event, arg1) + if event == "AUCTION_HOUSE_SHOW" then + -- The auction window may not exist until the next frame. + C_Timer.After(0, OpenPanel) + elseif event == "ITEM_DATA_LOAD_RESULT" then + if waitingForItem[arg1] then + waitingForItem[arg1] = nil + QueueRender() + end + elseif event == "BAG_UPDATE_DELAYED" then + QueueRender() + else + QueueScan() + end +end) + +-- /qsl reopens the panel after closing it. +SLASH_QUESTSHOPPINGLIST1 = "/qsl" +SlashCmdList.QUESTSHOPPINGLIST = function() + if (AuctionHouseFrame and AuctionHouseFrame:IsVisible()) or (AuctionFrame and AuctionFrame:IsVisible()) then + OpenPanel() + else + DEFAULT_CHAT_FRAME:AddMessage("|cffffd100QuestShoppingList:|r open the auction house first") + end +end diff --git a/QuestShoppingList/QuestShoppingList.toc b/QuestShoppingList/QuestShoppingList.toc new file mode 100644 index 0000000..2b17728 --- /dev/null +++ b/QuestShoppingList/QuestShoppingList.toc @@ -0,0 +1,8 @@ +## Interface: 16001 +## Title: Quest Shopping List +## Notes: Lists auction house items your active quests need, with cost against reward. +## Version: 1.0 +## Dependencies: Auctionator + +Data.lua +QuestShoppingList.lua diff --git a/QuestShoppingList/tools/generate.lua b/QuestShoppingList/tools/generate.lua new file mode 100644 index 0000000..bd456c1 --- /dev/null +++ b/QuestShoppingList/tools/generate.lua @@ -0,0 +1,29 @@ +-- Writes Data.lua from the merged.lua made by DungeonPreQuest/tools/extract.lua. +-- usage: lua generate.lua merged.lua Data.lua +local data = dofile(arg[1]) +local ITEM_CLASS_QUEST = 12 + +local byName = {} +for id, item in pairs(data.objectiveItems) do + if item.class ~= ITEM_CLASS_QUEST then + local key = item.name:lower() + if not byName[key] or id < byName[key] then + byName[key] = id + end + end +end + +local names = {} +for name in pairs(byName) do names[#names + 1] = name end +table.sort(names) + +local out = assert(io.open(arg[2], "w")) +out:write("-- Generated from QuestieDB's Forever data. Do not edit.\n") +out:write("-- Lowercased name -> item ID, for quest objective items that aren't quest-only.\n") +out:write("local _, ns = ...\n\nns.itemIDs = {\n") +for _, name in ipairs(names) do + out:write(string.format(" [%q]=%d,\n", name, byName[name])) +end +out:write("}\n") +out:close() +print("items", #names) diff --git a/README.md b/README.md index 46f5345..0fb66eb 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ # WoW Forever addons -Four small quality-of-life addons for WoW Forever (client 1.60.1, Interface 16001). +Five small quality-of-life addons for WoW Forever (client 1.60.1, Interface 16001). | Addon | What it does | Check command | | --- | --- | --- | | Quest Item Tip | Item tooltips show the quest, its level and have / need. Warns when a quest item is no longer needed. | `/qit` | | Quest Craft Highlight | Highlights profession recipes whose crafted item an active quest needs. | `/qch` | | Vendor Flag | Marks items for 10 minutes after Auctionator warns they would earn more at a vendor. Requires [Auctionator](https://www.curseforge.com/wow/addons/auctionator). | `/vf` | +| Quest Shopping List | A panel beside the auction house listing items your quests still need, with cost against the quest's reward. Click to search. Requires [Auctionator](https://www.curseforge.com/wow/addons/auctionator). | `/qsl` | | Dungeon Pre-Quest | Marks quests whose chain leads to a dungeon quest, in the quest log, NPC quest lists and the quest offer window, with a purple "!" on the minimap for ones you can pick up now. | `/dpq ` | ## Install -Copy the four addon folders into `World of Warcraft/_forever_/Interface/AddOns/`, then type `/reload` in game. -Each addon works on its own, so copy only the ones you want. Vendor Flag stays disabled unless Auctionator is installed. +Copy the five addon folders into `World of Warcraft/_forever_/Interface/AddOns/`, then type `/reload` in game. +Each addon works on its own, so copy only the ones you want. Vendor Flag and Quest Shopping List stay disabled unless Auctionator is installed. ## Known limits @@ -21,6 +22,7 @@ Each addon works on its own, so copy only the ones you want. Vendor Flag stays d - Quest Craft Highlight doesn't highlight recipes inside collapsed categories until you expand them. - Dungeon Pre-Quest misses chains that QuestieDB has no links for, which includes many quests new to Forever. - Its minimap markers skip quests started by an item, and quests with profession or reputation requirements. +- Quest Shopping List's prices are Auctionator's last-seen prices, so run "Search all" for current ones. Rewards count gold plus item value, not XP. ## Tests @@ -32,6 +34,7 @@ lua tests/test_qch.lua QuestCraftHighlight/QuestCraftHighlight.lua lua tests/test_vf.lua VendorFlag/VendorFlag.lua lua tests/test_dpq.lua DungeonPreQuest/DungeonPreQuest.lua lua tests/test_dpq_minimap.lua DungeonPreQuest/Minimap.lua +lua tests/test_qsl.lua QuestShoppingList/QuestShoppingList.lua ``` ## Regenerating Dungeon Pre-Quest's data @@ -41,6 +44,7 @@ lua tests/test_dpq_minimap.lua DungeonPreQuest/Minimap.lua ``` lua DungeonPreQuest/tools/extract.lua merged.lua lua DungeonPreQuest/tools/generate.lua merged.lua DungeonPreQuest/Data.lua DungeonPreQuest/PinData.lua +lua QuestShoppingList/tools/generate.lua merged.lua QuestShoppingList/Data.lua ``` ## Credits and licence diff --git a/tests/test_qsl.lua b/tests/test_qsl.lua new file mode 100644 index 0000000..59756b5 --- /dev/null +++ b/tests/test_qsl.lua @@ -0,0 +1,297 @@ +-- Runs QuestShoppingList.lua against a mock of the WoW API. +-- arg[1] = addon file + +local log, toggles +local function resetLog() + toggles = 0 + log = { + { title = "Westfall", isHeader = true }, + { title = "Murlocs", questID = 10, level = 12, objs = { + { type = "item", text = "Linen Cloth: 2/5", numRequired = 5 }, + { type = "item", text = "Quest Thing: 0/1", numRequired = 1 }, + { type = "monster", text = "Murloc slain: 0/5", numRequired = 5 }, + } }, + { title = "Silk", questID = 11, level = 20, objs = { + { type = "item", text = "3/4 Silk Cloth (Optional)", numRequired = 4 }, + } }, + { title = "Have It All", questID = 12, level = 5, objs = { + { type = "item", text = "Rough Stone: 3/3", numRequired = 3 }, + } }, + { title = "Soulbound", questID = 13, level = 5, objs = { + { type = "item", text = "Bound Thing: 0/1", numRequired = 1 }, + } }, + { title = "Collapsed", isHeader = true, isCollapsed = true }, + { title = "Hidden Under Header", questID = 14, level = 30, objs = { + { type = "item", text = "Linen Cloth: 0/2", numRequired = 2 }, + } }, + } +end +resetLog() + +local hideCollapsed = true +local function visible() + local out, inCollapsed = {}, false + for _, e in ipairs(log) do + if e.isHeader then + inCollapsed = e.isCollapsed + out[#out + 1] = e + elseif not (hideCollapsed and inCollapsed) then + out[#out + 1] = e + end + end + return out +end + +C_QuestLog = { + GetNumQuestLogEntries = function() return #visible() end, + GetInfo = function(i) return visible()[i] end, + GetQuestObjectives = function(id) + for _, e in ipairs(log) do if e.questID == id then return e.objs end end + end, +} +function ExpandQuestHeader(i) toggles = toggles + 1; visible()[i].isCollapsed = false end +function CollapseQuestHeader(i) toggles = toggles + 1; visible()[i].isCollapsed = true end + +local LINEN, QUESTY, SILK, STONE, BOUND = 2589, 900, 4306, 2835, 901 +local SWORD, RING, CAPE = 7000, 7001, 7002 +local counts = { [LINEN] = 2, [SILK] = 3, [STONE] = 3, [BOUND] = 0 } +local itemInfo = { + [LINEN] = { sell = 13, bind = 0 }, [SILK] = { sell = 150, bind = 0 }, [STONE] = { sell = 2, bind = 0 }, + [BOUND] = { sell = 0, bind = 1 }, + [SWORD] = { sell = 500, bind = 1 }, [RING] = { sell = 100, bind = 2 }, [CAPE] = { sell = 900, bind = 1 }, +} +local requested = {} +C_Item = { + GetItemCount = function(id) return counts[id] or 0 end, + GetItemInfo = function(id) + local i = itemInfo[id] + if not i then return end + return "n", "l", 1, 1, 1, "t", "s", 1, "", 1, i.sell, 0, 0, i.bind + end, + RequestLoadItemDataByID = function(id) requested[id] = (requested[id] or 0) + 1 end, +} + +local prices = { [LINEN] = 40, [SILK] = 1000, [RING] = 2000 } +local searches = {} +Auctionator = { API = { v1 = { + GetAuctionPriceByItemID = function(caller, id) assert(caller == "QuestShoppingList"); return prices[id] end, + MultiSearchAdvanced = function(_, terms) searches[#searches + 1] = terms end, +} } } + +local rewards = { + [10] = { money = 300, xp = 900, items = { { "Sword", SWORD, 1 } } }, + [11] = { money = 10, xp = 0, items = {}, choices = { { "Ring", RING, 1 }, { "Cape", CAPE, 1 } } }, + [13] = { money = 0, xp = 0, items = {} }, + [14] = { money = 0, xp = 50, items = {} }, +} +function GetQuestLogRewardMoney(id) return rewards[id].money end +function GetQuestLogRewardXP(id) return rewards[id].xp, rewards[id].xp end +function GetNumQuestLogRewards(id) return #rewards[id].items end +function GetQuestLogRewardInfo(i, id) local r = rewards[id].items[i]; return r[1], 1, r[3], 1, true, r[2] end +function GetNumQuestLogChoices(id) return #(rewards[id].choices or {}) end +function GetQuestLogChoiceInfo(i, id) local r = rewards[id].choices[i]; return r[1], 1, r[3], 1, true, r[2] end +function GetMoneyString(c) return c .. "c" end + +local timers, tickers = {}, {} +C_Timer = { + After = function(_, fn) timers[#timers + 1] = fn end, + NewTicker = function(_, fn) tickers[#tickers + 1] = fn end, +} +local function flush() + local list = timers + timers = {} + for _, fn in ipairs(list) do fn() end +end + +local created = {} +local function widget(template) + local w = { template = template, shown = true, scripts = {} } + setmetatable(w, { __index = function(_, k) if type(k) == "string" and k:match("^%u") then return function() end end end }) + function w.Show(self) self.shown = true end + function w.Hide(self) self.shown = false end + function w.IsVisible(self) return self.shown end + function w.SetScript(self, name, fn) self.scripts[name] = fn end + function w.SetText(self, t) self.text = t end + function w.CreateFontString() return widget() end + function w.CreateTexture() return widget() end + function w.SetPoint(self, ...) self.point = { ... } end + return w +end + +local main +CreateFrame = function(kind, name, parent, template) + local w = widget(template) + w.kind, w.frameName, w.parent = kind, name, parent + if not main then + main = w + local handler + w.RegisterEvent = function(self, e) self.events = self.events or {}; self.events[e] = true end + w.SetScript = function(self, _, fn) self.handler = fn end + return w + end + created[#created + 1] = w + return w +end + +AuctionHouseFrame = widget() +SlashCmdList = {} +local printed = {} +DEFAULT_CHAT_FRAME = { AddMessage = function(_, m) printed[#printed + 1] = m end } + +local tip = { lines = {} } +GameTooltip = { + SetOwner = function() end, + SetText = function(_, t) tip.title = t end, + AddDoubleLine = function(_, l, r) tip.lines[#tip.lines + 1] = { l, r } end, + Show = function() end, + Hide = function() tip.hidden = true end, +} + +local failures = 0 +local function check(cond, what) + if not cond then failures = failures + 1 end + print((cond and "ok " or "FAIL ") .. what) +end + +local ns = { itemIDs = { ["linen cloth"] = LINEN, ["silk cloth"] = SILK, ["rough stone"] = STONE, ["bound thing"] = BOUND } } +assert(loadfile(arg[1]))("QuestShoppingList", ns) + +local function fire(event, arg1) main.handler(main, event, arg1) end +local function rows() + local out = {} + for _, w in ipairs(created) do + if w.kind == "Button" and w.rowKind and w.shown then out[#out + 1] = w end + end + return out +end +local function panel() + for _, w in ipairs(created) do if w.frameName == "QuestShoppingListPanel" then return w end end +end +local function button(template) + for _, w in ipairs(created) do if w.template == template then return w end end +end + +fire("AUCTION_HOUSE_SHOW") +flush() +check(panel() and panel().shown, "panel opens with the auction house") +check(panel().parent == AuctionHouseFrame, "panel belongs to the auction window") + +local r = rows() +check(#r == 6, "three quests with what they still need: " .. #r) +check(r[1].rowKind == "quest" and r[1].left.text == "[12] Murlocs", "quest row: " .. tostring(r[1].left.text)) +check(r[2].rowKind == "item" and r[2].left.text:find("Linen Cloth", 1, true), "item row: " .. tostring(r[2].left.text)) +check(r[2].right.text:find("2 / 5", 1, true) and r[2].right.text:find("120c", 1, true), "have / need and cost of what's missing: " .. tostring(r[2].right.text)) + +-- Murlocs: 3 x 40 = 120 cost; 300 gold + sword vendor 500 = 800 reward. +check(r[1].sub.text:find("Buy 120c", 1, true) and r[1].sub.text:find("Reward 800c + 900 XP", 1, true), "cost against reward: " .. r[1].sub.text) +check(r[1].sub.text:find("|cff40ff40", 1, true), "worth it is green") + +-- Silk: 1 x 1000 = 1000; 10 gold + best of Ring (2000 x 0.95 = 1900) / Cape (900). +check(r[3].left.text == "[20] Silk", "optional objective format is read") +check(r[3].sub.text:find("Buy 1000c", 1, true) and r[3].sub.text:find("Reward 1910c", 1, true), "best choice counted once, auction cut taken: " .. r[3].sub.text) + +check(r[5].left.text == "[30] Hidden Under Header", "quests under a collapsed header are read") +check(log[6].isCollapsed == true, "collapsed header is restored") +check(toggles == 2, "header opened and closed once: " .. toggles) + +for _, row in ipairs(r) do + check(row.left.text ~= "[5] Have It All" and row.left.text ~= "[5] Soulbound", "row excludes done or soulbound: " .. row.left.text) +end + +-- Tooltip breakdown. +r[1].scripts.OnEnter(r[1]) +check(tip.title == "Murlocs" and #tip.lines == 2 and tip.lines[1][1] == "Gold" and tip.lines[2][1] == "Sword", "tooltip breaks down the reward") +tip.lines = {} +r[3].scripts.OnEnter(r[3]) +check(tip.lines[2][1] == "Best choice: Ring", "tooltip names the best choice: " .. tostring(tip.lines[2] and tip.lines[2][1])) +r[2].scripts.OnEnter(r[2]) + +-- Searching. +r[2].scripts.OnClick(r[2]) +check(#searches == 1 and searches[1][1].searchString == "Linen Cloth" and searches[1][1].isExact and searches[1][1].quantity == 3, "clicking an item searches for it") +r[1].scripts.OnClick(r[1]) +check(#searches == 2 and #searches[2] == 1, "clicking a quest searches for its items") +local all = button("UIPanelButtonTemplate") +all.scripts.OnClick(all) +local s = searches[3] +check(#s == 2 and s[1].searchString == "Linen Cloth" and s[1].quantity == 5, "search all adds up an item shared by quests") + +-- Expensive, unknown prices. +prices[SILK] = 5000 +tickers[1]() +r = rows() +check(r[3].sub.text:find("|cffff5050", 1, true), "not worth it is red") +prices[SILK] = nil +tickers[1]() +r = rows() +check(r[3].sub.text:find("Buy ?", 1, true) and r[4].right.text:find("no price", 1, true), "unseen item says so") +check(not r[3].sub.text:find("|cffff5050", 1, true) and not r[3].sub.text:find("|cff40ff40", 1, true), "unknown cost isn't judged") +prices[SILK] = 1000 + +-- Reward item not loaded yet. +itemInfo[SWORD] = nil +tickers[1]() +r = rows() +check(requested[SWORD] == 1 and r[1].sub.text:find("|cffffffff", 1, true), "reward still loading isn't judged") +tickers[1]() +check(requested[SWORD] == 1, "item is only requested once") +itemInfo[SWORD] = { sell = 500, bind = 1 } +fire("ITEM_DATA_LOAD_RESULT", SWORD) +flush() +r = rows() +check(r[1].sub.text:find("Reward 800c", 1, true), "fills in once the item loads") + +-- An item the client hasn't loaded stays listed, then drops out if it's soulbound. +local saved = itemInfo[BOUND] +itemInfo[BOUND] = nil +panel().shown = false +fire("AUCTION_HOUSE_SHOW") +flush() +local found = false +for _, row in ipairs(rows()) do found = found or row.left.text == "[5] Soulbound" end +check(found, "unloaded item is listed for now") +itemInfo[BOUND] = saved +fire("ITEM_DATA_LOAD_RESULT", BOUND) +flush() +found = false +for _, row in ipairs(rows()) do found = found or row.left.text == "[5] Soulbound" end +check(not found, "soulbound item drops out once known") + +-- Buying. +counts[LINEN] = 5 +fire("BAG_UPDATE_DELAYED") +flush() +r = rows() +check(r[2].right.text:find("5 / 5") == nil and r[1].left.text == "[20] Silk" or r[1].left.text == "[30] Hidden Under Header", "bought items leave the list") +counts[LINEN] = 2 + +-- Quest log changes only rescan when visible. +local before = toggles +fire("QUEST_REMOVED") +flush() +check(toggles == before + 2, "quest change rescans while open") +panel().shown = false +before = toggles +fire("QUEST_REMOVED") +flush() +check(toggles == before, "no rescan while closed") +tickers[1]() + +-- Nothing to buy: no panel. +local savedLog = log +log = { { title = "Empty", isHeader = true } } +panel().shown = false +fire("AUCTION_HOUSE_SHOW") +flush() +check(panel().shown == false, "panel stays closed with nothing to buy") +log = savedLog + +SlashCmdList.QUESTSHOPPINGLIST() +flush() +check(panel().shown == true, "/qsl reopens it") +AuctionHouseFrame.shown = false +SlashCmdList.QUESTSHOPPINGLIST() +check(printed[1] and printed[1]:find("auction house", 1, true), "/qsl explains itself away from the auction house") + +print(failures == 0 and "ALL PASSED" or (failures .. " FAILED")) +os.exit(failures == 0 and 0 or 1)