From d50acba092f15640be5cf1c376ae3c8f00337c94 Mon Sep 17 00:00:00 2001 From: Vladinator89 Date: Sat, 26 Oct 2019 10:58:40 +0200 Subject: [PATCH] Fixed faction for the newest BfA buckets. They are not both neutral anymore. Adjusted the Westfall bucket due to phasing, it has two locations but you can only get one, as expected. Because the phase isn't known, yet, I show a indicator where you should go and check, and they both go away after quest is completed. Added several missing zones like Crystalsong Forest, Vale of Eternal Blossoms, Zuldazar, Dazar'alor, Tiragarde Sound, to show their underlying cities and locations on their parent zone maps. Adding the world view so when you zoom out to look at Azeroth, you will see the locations in all the sub-continents, more or less. Let me know if it's a game breaker, but it seems to be working quite nicely as a completionist view. --- CandyBuckets.toc | 2 +- core.lua | 106 +++++++++++++++++++++++++++++++---------------- db/hallow.lua | 7 ++-- 3 files changed, 76 insertions(+), 39 deletions(-) diff --git a/CandyBuckets.toc b/CandyBuckets.toc index 10aafc3..755fee4 100644 --- a/CandyBuckets.toc +++ b/CandyBuckets.toc @@ -2,7 +2,7 @@ ## Title: CandyBuckets ## Notes: Shows map icons for Lunar Festival, Hallow's End and Midsummer Fire Festival! ## Author: Vladinator -## Version: 8.2.5.191021 +## Version: 8.2.5.191026 ## X-Curse-Project-ID: 44213 ## X-WoWI-ID: 20450 db\hallow.lua diff --git a/core.lua b/core.lua index a64d62c..61c6bcb 100644 --- a/core.lua +++ b/core.lua @@ -40,15 +40,20 @@ do 13, -- Eastern Kingdoms 101, -- Outland 113, -- Northrend + 127, -- Crystalsong Forest 203, -- Vashj'ir 224, -- Stranglethorn Vale + 390, -- Vale of Eternal Blossoms 424, -- Pandaria 572, -- Draenor 619, -- Broken Isles + 862, -- Zuldazar 875, -- Zandalar 876, -- Kul Tiras + 895, -- Tiragarde Sound + 947, -- Azeroth (CPU hog, but it's not too bad?) 948, -- The Maelstrom - -- 947, -- Azeroth (hogs CPU but is kind of neat, though not complete as we only check the direct children of these maps...) + 1165, -- Dazar'alor } for i = 1, #parentMapIDs do @@ -550,18 +555,17 @@ function addon:QueryCalendar(check) end function addon:IsDeliveryLocationExpected(questID) - local quest + local questCollection = {} local questName for i = 1, #ns.QUESTS do - quest = ns.QUESTS[i] + local quest = ns.QUESTS[i] if quest.quest == questID then - break + table.insert(questCollection, quest) end - quest = nil end - if not quest then + if not questCollection[1] then questName = C_QuestLog.GetQuestInfo(questID) if questName then @@ -582,53 +586,85 @@ function addon:IsDeliveryLocationExpected(questID) end if missingFromModule then - quest = { missing = true, module = missingFromModule, quest = questID, side = 3 } + table.insert(questCollection, { missing = true, module = missingFromModule, quest = questID, side = 3 }) end end end - if not quest then - return nil, DEBUG_LOCATION and { error = "Quest not part of any module.", name = questName } or nil + if not questCollection[1] then + return nil, DEBUG_LOCATION and { error = "Quest not part of any module.", name = questName } or nil, nil end local uiMapID, pos = GetPlayerMapAndPosition() if not uiMapID then - return nil, DEBUG_LOCATION and { error = "Player has no uiMapID." } or nil + return nil, DEBUG_LOCATION and { error = "Player has no uiMapID." } or nil, nil elseif not pos then - return nil, DEBUG_LOCATION and { error = "Player is on map " .. uiMapID .. " but not coordinates." } or nil + return nil, DEBUG_LOCATION and { error = "Player is on map " .. uiMapID .. " but not coordinates." } or nil, nil end - if quest.missing then - quest[uiMapID] = { pos.x * 100, pos.y * 100 } + if questCollection[1].missing then + for i = 1, #questCollection do + questCollection[i][uiMapID] = { pos.x * 100, pos.y * 100 } + end end - local qpos = quest[uiMapID] - if type(qpos) == "table" then - local distance = quest.missing and 1 or 0 - - if not quest.missing then - local dx = qpos[1]/100 - pos.x - local dy = qpos[2]/100 - pos.y - - local dd = dx*dx + dy*dy - if dd < 0 then - return nil, DEBUG_LOCATION and { error = "Distance calculated is negative. Can't sqrt negative numbers." } or nil + local returnCount = 0 + local returns = {} + + for i = 1, #questCollection do + local quest = questCollection[i] + local qpos = quest[uiMapID] + + local ret = {} + returnCount = returnCount + 1 + returns[returnCount] = ret + + repeat + if type(qpos) == "table" then + local distance = quest.missing and 1 or 0 + + if not quest.missing then + local dx = qpos[1]/100 - pos.x + local dy = qpos[2]/100 - pos.y + + local dd = dx*dx + dy*dy + if dd < 0 then + ret.has, ret.success, ret.data = true, nil, DEBUG_LOCATION and { error = "Distance calculated is negative. Can't sqrt negative numbers." } or nil + break + end + + distance = sqrt(dd) + end + + if distance > 0.02 then + ret.has, ret.success, ret.data = true, false, { quest = quest, uiMapID = uiMapID, x = pos.x, y = pos.y, distance = distance } + elseif DEBUG_LOCATION then + ret.has, ret.success, ret.data = true, true, { success = "Player turned in quest at an acceptable distance.", quest = quest, uiMapID = uiMapID, x = pos.x, y = pos.y, distance = distance } + else + ret.has, ret.success = true, true + end + + elseif not quest.missing then + ret.has, ret.success, ret.data = true, false, { quest = quest, uiMapID = uiMapID, x = pos.x, y = pos.y, distance = 1 } end + until true + end - distance = sqrt(dd) + for i = 1, returnCount do + local ret = returns[i] + if ret.has and ret.success then + return ret.success, ret.data, returnCount end + end - if distance > 0.02 then - return false, { quest = quest, uiMapID = uiMapID, x = pos.x, y = pos.y, distance = distance } - elseif DEBUG_LOCATION then - return true, { success = "Player turned in quest at an acceptable distance.", quest = quest, uiMapID = uiMapID, x = pos.x, y = pos.y, distance = distance } + for i = 1, returnCount do + local ret = returns[i] + if ret.has then + return ret.success, ret.data, returnCount end - - elseif not quest.missing then - return false, { quest = quest, uiMapID = uiMapID, x = pos.x, y = pos.y, distance = 1 } end - return true, DEBUG_LOCATION and { warning = "Player is not on appropriate map for this quest and can't calculate distance." } or nil + return true, DEBUG_LOCATION and { warning = "Player is not on appropriate map for this quest and can't calculate distance." } or nil, returnCount end -- @@ -685,7 +721,7 @@ end function addon:QUEST_TURNED_IN(event, questID) ns.COMPLETED_QUESTS[questID] = true - local success, info = addon:IsDeliveryLocationExpected(questID) + local success, info, checkedNumQuestPOIs = addon:IsDeliveryLocationExpected(questID) if DEBUG_LOCATION then DEFAULT_CHAT_FRAME:AddMessage("|cffFFFFFF" .. addonName .. "|r quest |cffFFFFFF" .. questID .. "|r turned in" .. (info and ":" or "."), 1, 1, 0) if info then @@ -709,7 +745,7 @@ function addon:QUEST_TURNED_IN(event, questID) end end elseif success == false then - DEFAULT_CHAT_FRAME:AddMessage(format("|cffFFFFFF%s|r quest |cffFFFFFF%s#%d|r turned in at the wrong location. You were at |cffFFFFFF%d/%d/%.2f/%.2f|r roughly |cffFFFFFF%.2f|r units away from the expected location. Please screenshot/copy this message and report it to the author. Thanks!", addonName, info.quest.module.event, questID, ns.FACTION, info.uiMapID, info.x * 100, info.y * 100, info.distance * 100), 1, 1, 0) + DEFAULT_CHAT_FRAME:AddMessage(format("|cffFFFFFF%s|r quest |cffFFFFFF%s#%d|r turned in at the wrong location. You were at |cffFFFFFF%d/%d/%.2f/%.2f|r roughly |cffFFFFFF%.2f|r units away from the expected %s. Please screenshot/copy this message and report it to the author. Thanks!", addonName, info.quest.module.event, questID, ns.FACTION, info.uiMapID, info.x * 100, info.y * 100, info.distance * 100, checkedNumQuestPOIs and checkedNumQuestPOIs > 1 and checkedNumQuestPOIs .. " locations" or "location"), 1, 1, 0) end if addon:RemoveQuestPois(questID) then diff --git a/db/hallow.lua b/db/hallow.lua index 69ac610..5ecd3bd 100644 --- a/db/hallow.lua +++ b/db/hallow.lua @@ -21,7 +21,8 @@ ns.modules["hallow"] = { { quest = 28959, side = 2, [17] = {40.50, 11.40} }, { quest = 12404, side = 3, extra = 3, [111] = {56.20, 81.80} }, { quest = 12409, side = 3, extra = 3, [104] = {56.30, 59.80} }, - { quest = 12340, side = 1, [52] = {56.76, 47.31} }, + { quest = 12340, side = 1, extra = 2, [52] = {56.76, 47.31} }, + { quest = 12340, side = 1, extra = 2, [52] = {52.90, 53.60} }, { quest = 12364, side = 2, [94] = {48.10, 47.80} }, { quest = 12369, side = 2, [110] = {79.60, 57.90} }, { quest = 12370, side = 2, [110] = {67.60, 73.20} }, @@ -225,8 +226,8 @@ ns.modules["hallow"] = { { quest = 43057, side = 2, [627] = {66.80, 30.00} }, { quest = 12409, side = 3, extra = 3, [104] = {61.00, 28.20} }, { quest = 12404, side = 3, extra = 3, [111] = {28.10, 49.00} }, - { quest = 54709, side = 3, [1163] = {50.71, 82.30} }, - { quest = 54710, side = 3, [1161] = {73.66, 12.59} }, + { quest = 54709, side = 2, [1163] = {50.71, 82.30} }, + { quest = 54710, side = 1, [1161] = {73.66, 12.59} }, }, patterns = { "^%s*[Cc][Aa][Nn][Dd][Yy]%s+[Bb][Uu][Cc][Kk][Ee][Tt]%s*$",