Skip to content

Commit

Permalink
Fixed faction for the newest BfA buckets. They are not both neutral a…
Browse files Browse the repository at this point in the history
…nymore.

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.
  • Loading branch information
Vladinator committed Oct 26, 2019
1 parent 8b5b0f9 commit d50acba
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CandyBuckets.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
106 changes: 71 additions & 35 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

--
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions db/hallow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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} },
Expand Down Expand Up @@ -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*$",
Expand Down

0 comments on commit d50acba

Please sign in to comment.