From 0496df026883f5606bdea1abf9853c6c013820f2 Mon Sep 17 00:00:00 2001 From: "Nathanial.C.Jones" Date: Thu, 9 Feb 2012 03:01:12 +0000 Subject: [PATCH] Implemented functionality to automatically update the tracked elders by keeping track of their associated quests and whether or not the quests have been completed. This works for a brand new character, but is untested on an established character that has previously completed the achievements. Theoretically it should work on such a character, since the quests are annual quests and the completion status should reset each year. Please note that tracking of regular quests is still not working in this branch. QH WILL, repeat WILL break if you have ANY quests in your log. --- QuestHelper/db_get.lua | 2 + QuestHelper/director_find.lua | 220 ++++++++++++++++++++-------------- QuestHelper/main.lua | 9 ++ 3 files changed, 141 insertions(+), 90 deletions(-) diff --git a/QuestHelper/db_get.lua b/QuestHelper/db_get.lua index cc9b3b9..8ed5677 100644 --- a/QuestHelper/db_get.lua +++ b/QuestHelper/db_get.lua @@ -198,6 +198,8 @@ function DB_GetItem(group, id, silent, register) QuestHelper: Assert(id, string.format("%s %s", tostring(group), tostring(id))) local ite = DBC_Get(group, id) + if not ite and group == "flightpaths" then return nil end + if not ite and group == "quest" then -- Loop over zones AND floors -- see QuestRouterLite.lua for specific calls. diff --git a/QuestHelper/director_find.lua b/QuestHelper/director_find.lua index ccdf97f..0919460 100644 --- a/QuestHelper/director_find.lua +++ b/QuestHelper/director_find.lua @@ -136,90 +136,120 @@ local function QH_FindLoc(locd) end local elders = { - ["Alliance"] = { - ["Bladeswift"] = {381, 39, 32}, --"Darnassus 39 32", - ["Bronzebeard"] = {341, 29, 16}, --"Ironforge 29 16", - ["Hammershout"] = {30, 2, 10}, --"Elwynn Forest 34 50" + ["Alliance"] = { -- Achievement 915 + ["Bladeswift"] = {381, 39, 32, 8718}, --"Darnassus 39 32", + ["Bronzebeard"] = {341, 29, 16, 8866}, --"Ironforge 29 16", + ["Hammershout"] = {30, 2, 10, 8646}, --"Elwynn Forest 34 50" }, - ["Horde"] = { - ["Darkhorn"] = {321, 52, 60}, --"Orgrimmar 52 60", - ["Wheathoof"] = {362, 73.0, 23.3}, --"Thunder Bluff 73.0 23.3", - ["Darkcore"] = {382, 67, 38}, --"Undercity 67 38" + ["Horde"] = { -- Achievement 914 + ["Darkhorn"] = {321, 52, 60, 8677}, --"Orgrimmar 52 60", + ["Wheathoof"] = {362, 73.0, 23.3, 8678}, --"Thunder Bluff 73.0 23.3", + ["Darkcore"] = {382, 67, 38, 8648}, --"Undercity 67 38" }, - ["Kalimdor"] = { - ["Riversong"] = {43, 35.5, 48.9}, --"Ashenvale 35.5 48.9", - ["Skygleam"] = {181, 64.8, 79.3}, --"Azshara 64.8 79.3", - ["High Mountain"] = {607, 41.5, 47.5}, --"Southern Barrens 41.5 47.5", - ["Moonwarden"] = {11, 48.5, 59.2}, --"Northern Barrens 48.5 59.2", - ["Windtotem"] = {11, 68.4, 70}, --"Northern Barrens 68.4 70", - ["Starweave"] = {42, 49.5, 19.0}, --"Darkshore 49.5 19.0", NOTE TO SELF -- CONVERTING TO LOOKUP VALUES DON'T FORGET TO CHANGE THE FUNCTION!!!!!!! - ["Runetotem"] = {4, 53.2, 43.6}, --"Durotar 53.2 43.6", - ["Nightwind"] = {182, 38.3, 52.9}, --"Felwood 38.3 52.9", - ["Grimtotem"] = {121, 76.7, 37.9}, --"Feralas 76.7 37.9", - ["Mistwalker"] = {121, 62.6, 31.1}, --"Feralas 62.6 31.1", - ["Bloodhoof"] = {9, 48, 53}, --"Mulgore 48 53", - ["Bladesing"] = {261, 53, 35}, --"Silithus 53 35", - ["Primestone"] = {261, 30.7, 13.3}, --"Silithus 30.7 13.3", - ["Dreamseer"] = {161, 50, 28}, --"Tanaris 50 28", - ["Ragetotem"] = {161, 36, 80}, --"Tanaris 36 80", - ["Bladeleaf"] = {41, 56.8, 53.1}, --"Teldrassil 56.8 53.1", - ["Skyseer"] = {61, 46.3, 51.0}, --"Thousand Needles 46.3 51.0", - ["Morningdew"] = {61, 77.0, 75.6}, --"Thousand Needles 77.0 75.6", - ["Thunderhorn"] = {201, 51, 75}, --"Un'Goro Crater 51 75", - ["Brightspear"] = {281, 53.0, 56.7}, --"Winterspring 53.0 56.7", - ["Stonespire"] = {281, 60.0, 50.0}, --"Winterspring 60.0 50.0", + ["Kalimdor"] = { -- Achievement 911 + ["Riversong"] = {43, 35.5, 48.9, 8725}, --"Ashenvale 35.5 48.9", + ["Skygleam"] = {181, 64.8, 79.3, 8720}, --"Azshara 64.8 79.3", + ["High Mountain"] = {607, 41.5, 47.5, 8686}, --"Southern Barrens 41.5 47.5", + ["Moonwarden"] = {11, 48.5, 59.2, 8717}, --"Northern Barrens 48.5 59.2", + ["Windtotem"] = {11, 68.4, 70, 8680}, --"Northern Barrens 68.4 70", + ["Starweave"] = {42, 49.5, 19.0, 8721}, --"Darkshore 49.5 19.0", + ["Runetotem"] = {4, 53.2, 43.6, 8670}, --"Durotar 53.2 43.6", + ["Nightwind"] = {182, 38.3, 52.9, 8723}, --"Felwood 38.3 52.9", + ["Grimtotem"] = {121, 76.7, 37.9, 8679}, --"Feralas 76.7 37.9", + ["Mistwalker"] = {121, 62.6, 31.1, 8685}, --"Feralas 62.6 31.1", + ["Bloodhoof"] = {9, 48, 53, 8673}, --"Mulgore 48 53", + ["Bladesing"] = {261, 53, 35, 8719}, --"Silithus 53 35", + ["Primestone"] = {261, 30.7, 13.3, 8654}, --"Silithus 30.7 13.3", + ["Dreamseer"] = {161, 50, 28, 8684}, --"Tanaris 50 28", + ["Ragetotem"] = {161, 36, 80, 8671}, --"Tanaris 36 80", + ["Bladeleaf"] = {41, 56.8, 53.1, 8715}, --"Teldrassil 56.8 53.1", + ["Skyseer"] = {61, 46.3, 51.0, 8682}, --"Thousand Needles 46.3 51.0", + ["Morningdew"] = {61, 77.0, 75.6, 8724}, --"Thousand Needles 77.0 75.6", + ["Thunderhorn"] = {201, 51, 75, 8681}, --"Un'Goro Crater 51 75", + ["Brightspear"] = {281, 53.0, 56.7, 8726}, --"Winterspring 53.0 56.7", + ["Stonespire"] = {281, 60.0, 50.0, 8672}, --"Winterspring 60.0 50.0", }, - ["Eastern Kingdoms"] = { - ["Bellowrage"] = {19, 54, 49}, --"Blasted Lands 54 49", - ["Rumblerock"] = {29, 70, 45}, --"Burning Steppes 70 45", - ["Dawnstrider"] = {29, 53, 24}, --"Burning Steppes 53 24", - ["Goldwell"] = {27, 53.9, 49.9}, --"Dun Morogh 53 49", - ["Windrun"] = {23, 35.6, 68.8}, --"Eastern Plaguelands 35 68", - ["Snowcrown"] = {23, 75.7, 54.5}, --"Eastern Plaguelands 75.7 54.5", - ["Stormbrow"] = {30, 40, 63}, --"Elwynn Forest 40 63", - ["Highpeak"] = {26, 50, 48}, --"Hinterlands 50 48", - ["Silvervein"] = {35, 33, 46}, --"Loch Modan 33 46", - ["Ironband"] = {28, 21, 79}, --"Searing Gorge 21 79", - ["Obsidian"] = {21, 45, 41}, --"Silverpine Forest 45 41", - ["Starglade"] = {37, 71, 34}, --"Northern Stranglethorn 71 34" - ["Winterhoof"] = {673, 39, 72}, --"The Cape of Stranglethorn 39 72" - ["Graveborn"] = {20, 61, 53}, --"Tirisfal Glades 61 53", - ["Moonstrike"] = {22, 69, 73}, --"Western Plaguelands 69 73", - ["Meadowrun"] = {22, 63.5, 36.2}, --"Western Plaguelands 63 36", - ["Skychaser"] = {39, 56, 47}, --"Westfall 56 47" + ["Eastern Kingdoms"] = { -- Achievement 912 + ["Bellowrage"] = {19, 54, 49, 8647}, --"Blasted Lands 54 49", + ["Rumblerock"] = {29, 70, 45, 8636}, --"Burning Steppes 70 45", + ["Dawnstrider"] = {29, 53, 24, 8683}, --"Burning Steppes 53 24", + ["Goldwell"] = {27, 53.9, 49.9, 8653}, --"Dun Morogh 53 49", + ["Windrun"] = {23, 35.6, 68.8, 8688}, --"Eastern Plaguelands 35 68", + ["Snowcrown"] = {23, 75.7, 54.5, 8650}, --"Eastern Plaguelands 75.7 54.5", + ["Stormbrow"] = {30, 40, 63, 8649}, --"Elwynn Forest 40 63", + ["Highpeak"] = {26, 50, 48, 8643}, --"Hinterlands 50 48", + ["Silvervein"] = {35, 33, 46, 8642}, --"Loch Modan 33 46", + ["Ironband"] = {28, 21, 79, 8651}, --"Searing Gorge 21 79", + ["Obsidian"] = {21, 45, 41, 8645}, --"Silverpine Forest 45 41", + ["Starglade"] = {37, 71, 34, 8716}, --"Northern Stranglethorn 71 34" + ["Winterhoof"] = {673, 39, 72, 8674}, --"The Cape of Stranglethorn 39 72" + ["Graveborn"] = {20, 61, 53, 8652}, --"Tirisfal Glades 61 53", + ["Moonstrike"] = {22, 69, 73, 8714}, --"Western Plaguelands 69 73", + ["Meadowrun"] = {22, 63.5, 36.2, 8722}, --"Western Plaguelands 63 36", + ["Skychaser"] = {39, 56, 47, 8675}, --"Westfall 56 47" }, - ["Northrend"] = { - ["Arp"] = {486, 57, 44}, --"Borean Tundra 57 44", - ["Northal"] = {486, 34, 34}, --"Borean Tundra 34 34", - ["Pamuya"] = {486, 43, 50}, --"Borean Tundra 43 50", - ["Sardis"] = {486, 59, 66}, --"Borean Tundra 59 66", - ["Morthie"] = {488, 30, 56}, --"Dragonblight 30 56", - ["Skywarden"] = {488, 35, 48}, --"Dragonblight 35 48", - ["Thoim"] = {488, 49, 78}, --"Dragonblight 49 78", - ["Beldak"] = {490, 61, 28}, --"Grizzly Hills 61 28", - ["Lunaro"] = {490, 81, 37}, --"Grizzly Hills 81 37", - ["Whurain"] = {490, 64, 47}, --"Grizzly Hills 64 47", - ["Bluewolf"] = {501, 49, 14}, --"Wintergrasp 49 14", - ["Sandrene"] = {493, 50, 64}, --"Sholazar Basin 50 64", - ["Wanikaya"] = {493, 64, 49}, --"Sholazar Basin 64 49", - ["Fargal"] = {495, 29, 74}, --"Storm Peaks 29 74", - ["Graymane"] = {495, 41, 85}, --"Storm Peaks 41 85", - ["Muraco"] = {495, 64, 51}, --"Storm Peaks 64 51", - ["Stonebeard"] = {495, 31, 38}, --"Storm Peaks 31 38", - ["Tauros"] = {496, 59, 56}, --"Zul'Drak 59 56" + ["Northrend"] = { -- Achievement 1396 + ["Arp"] = {486, 57, 44, 13033}, --"Borean Tundra 57 44", + ["Northal"] = {486, 34, 34, 13016}, --"Borean Tundra 34 34", + ["Pamuya"] = {486, 43, 50, 13029}, --"Borean Tundra 43 50", + ["Sardis"] = {486, 59, 66, 13012}, --"Borean Tundra 59 66", + ["Morthie"] = {488, 30, 56, 13014}, --"Dragonblight 30 56", + ["Skywarden"] = {488, 35, 48, 13031}, --"Dragonblight 35 48", + ["Thoim"] = {488, 49, 78, 13019}, --"Dragonblight 49 78", + ["Beldak"] = {490, 61, 28, 13013}, --"Grizzly Hills 61 28", + ["Lunaro"] = {490, 81, 37, 13025}, --"Grizzly Hills 81 37", + ["Whurain"] = {490, 64, 47, 13030}, --"Grizzly Hills 64 47", + ["Bluewolf"] = {501, 49, 14, 13026}, --"Wintergrasp 49 14", + ["Sandrene"] = {493, 50, 64, 13018}, --"Sholazar Basin 50 64", + ["Wanikaya"] = {493, 64, 49, 13024}, --"Sholazar Basin 64 49", + ["Fargal"] = {495, 29, 74, 13015}, --"Storm Peaks 29 74", + ["Graymane"] = {495, 41, 85, 13028}, --"Storm Peaks 41 85", + ["Muraco"] = {495, 64, 51, 13032}, --"Storm Peaks 64 51", + ["Stonebeard"] = {495, 31, 38, 13020}, --"Storm Peaks 31 38", + ["Tauros"] = {496, 59, 56, 13027}, --"Zul'Drak 59 56" }, - ["Cataclysm"] = { - ["Moonlance"] = {615, 57, 86}, -- Biel'aran Ridge, Shimmering Expanse - ["Windsong"] = {606, 27, 62}, -- Sanctuary of Malorne, Hyjal - ["Evershade"] = {606, 63, 23}, -- Nordrassil, Hyjal - ["Stonebrand"] = {640, 50, 55}, -- Temple of Earth, Deepholm - ["Deepforge"] = {640, 28, 69}, -- Stonehearth, Deepholm - ["Menkhaf"] = {720, 66, 19}, -- Khartut's Tomb, Uldum - ["Sekhemi"] = {720, 32, 63}, -- Ruins of Ammon, Uldum - ["Firebeard"] = {700, 51, 71}, -- Dunward Town Square, Dunward Ruins, Twilight Highlands - ["Darkfeather"] = {700, 52, 33} -- Thundermar Ruins, Twilight Highlands + ["Cataclysm"] = { -- Achievement 6006 + ["Moonlance"] = {615, 57, 86, 29738}, -- Biel'aran Ridge, Shimmering Expanse + ["Windsong"] = {606, 27, 62, 29739}, -- Sanctuary of Malorne, Hyjal + ["Evershade"] = {606, 63, 23, 29740}, -- Nordrassil, Hyjal + ["Stonebrand"] = {640, 50, 55, 29735}, -- Temple of Earth, Deepholm + ["Deepforge"] = {640, 28, 69, 29734}, -- Stonehearth, Deepholm + ["Menkhaf"] = {720, 66, 19, 29742}, -- Khartut's Tomb, Uldum + ["Sekhemi"] = {720, 32, 63, 29741}, -- Ruins of Ammon, Uldum + ["Firebeard"] = {700, 51, 71, 29737}, -- Dunward Town Square, Dunward Ruins, Twilight Highlands + ["Darkfeather"] = {700, 52, 33, 29736} -- Thundermar Ruins, Twilight Highlands }, + --[===[ Placeholder for Elders of the Dungeons. If enabled prior to 2013, stored coordinates should be the map ID of the zone where the instance is located and the coordinates of the entrance. With any luck, by 2013 dungeons will be mapable. Coordinates listed in comment after each elder need to have floor numbers determined, where necessary, ASAP. + ["Dungeons"] = { -- Achievement 910 + ["Wildmane"] = {,,,8676}, -- Zul'Farrak 34.52 39.35 + ["Splitrock"] = {,,,8635}, -- Maraudon 51.47, 93.7 + ["Morndeep"] = {,,,8619}, -- Blackrock Depths 50.52 62.97 + ["Jarten"] = {,,,13017}, -- Utgarde Keep 47.4, 69.54 + ["Nurgen"] = {,,,13022}, -- Azjol-Nerub 21.78 43.62 + ["Ohanzee"] = {,,,13065}, -- Gundrak 45.7 61.55 + ["Chogan'gada"] = {,,,13067}, -- Utgarde Pinnacle 47.71 22.99 + ["Starsong"] = {,,,8713}, -- Sunken Temple 62.92 34.46 + ["Stonefort"] = {,,,8644}, -- Blackrock Spire 61.82 40 + ["Farwhisper"] = {,,,8727}, -- Stratholme 78.62 22.14 + ["Igasho"] = {,,,13021}, -- The Nexus 55.18 64.74 + ["Kilias"] = {,,,13023}, -- Drak'tharon Keep 68.85 79.17 + ["Yurauk"] = {,,,13066} -- Halls of Stone 29.39 62.03 + } + --]===] } +local function UpdateElders() + local qid = GetQuestID() + for achievement, eldrs in pairs(elders) do + for elder, elderinfo in pairs(eldrs) do + local z, x, y, id = unpack(elderinfo) + if id == qid then + QH_FindCoord(x, y, z, elder) + end + end + end +end + +QH_Event("QUEST_COMPLETE", UpdateElders) local function QH_FindElders(elder_or_achievement, all_elders) local achievement_match, elder_match = false, false @@ -228,25 +258,35 @@ local function QH_FindElders(elder_or_achievement, all_elders) if elder_or_achievement == string.upper(achievement) then achievement_match = true end end - for elder, elder_loc in pairs(eldrs) do - if not all_elders then - if achievement_match then -- just add it - local locz, locx, locy = unpack(elder_loc) + for elder, elder_info in pairs(eldrs) do + local locz, locx, locy, qid = unpack(elder_info) + local okToAdd = true + if qid and QHQuestsCompleted and QHQuestsCompleted[qid] then + okToAdd = false + end + if okToAdd then + if not all_elders then + if achievement_match then -- just add it + QH_FindCoord(locx, locy, locz, elder) + elseif elder_or_achievement == string.upper(elder) then -- We have input and it's not an achievement, so it must be an elder. + elder_match = true + QH_FindCoord(locx, locy, locz, elder) + break -- We've found him or her. + end -- No need for else here. We alread know we don't need everything so we either have an achievement or we have an elder. + else -- We came in without an input, therefore we add all. QH_FindCoord(locx, locy, locz, elder) - elseif elder_or_achievement == string.upper(elder) then -- We have input and it's not an achievement, so it must be an elder. - elder_match = true - local locz, locx, locy = unpack(elder_loc) - QH_FindCoord(locx, locy, locz, elder) - break -- We've found him or her. - end -- No need for else here. We alread know we don't need everything so we either have an achievement or we have an elder. - else -- We came in without an input, therefore we add all. - local locz, locx, locy = unpack(elder_loc) - QH_FindCoord(locx, locy, locz, elder) + end end end if achievement_match or elder_match then break end -- We've done our match. end + + local shownEldersCount = 0 + + if shownElders then for k, _ in pairs(shownElders) do shownEldersCount = shownEldersCount + 1 end end + + if shownEldersCount > 0 then shownElders = nil end end function QH_FindName(name) diff --git a/QuestHelper/main.lua b/QuestHelper/main.lua index 3d1df56..b26b2a6 100644 --- a/QuestHelper/main.lua +++ b/QuestHelper/main.lua @@ -182,10 +182,19 @@ local please_submit_enabled = true local please_submit_initted = false local spawned = false + +QHQuestsCompleted = false + QH_Event("ADDON_LOADED", function (addonid) if addonid ~= "QuestHelper" then return end -- ONLY FAST STUFF ALLOWED IN HERE + + QH_Event("QUEST_QUERY_COMPLETE", function () + QHQuestsCompleted = GetQuestsCompleted() + end) + + QueryQuestsCompleted() -- Use DefaultPref as fallback for unset preference keys. setmetatable(QuestHelper_Pref, {__index=QuestHelper_DefaultPref})