diff --git a/Localization/Translations/Options/Tracker.lua b/Localization/Translations/Options/Tracker.lua index 1e85557..2e4ee6f 100644 --- a/Localization/Translations/Options/Tracker.lua +++ b/Localization/Translations/Options/Tracker.lua @@ -864,6 +864,12 @@ local trackerOptionsLocales = { ["esES"] = "Por zona", ["frFR"] = "Par zone", }, + ["By Zone + %% Complete"] = { + ["enUS"] = true, + }, + ["By Zone + %% Complete (Reversed)"] = { + ["enUS"] = true, + }, ["By Zone Prox"] = { ["ptBR"] = "Por proximidade de zona", ["ruRU"] = "По дальности зоны", diff --git a/Modules/Options/TrackerTab/QuestieOptionsTracker.lua b/Modules/Options/TrackerTab/QuestieOptionsTracker.lua index 80647bb..4c2dd36 100644 --- a/Modules/Options/TrackerTab/QuestieOptionsTracker.lua +++ b/Modules/Options/TrackerTab/QuestieOptionsTracker.lua @@ -402,6 +402,8 @@ function QuestieOptions.tabs.tracker:Initialize() ['byProximity'] = l10n('By Proximity'), ['byProximityReversed'] = l10n('By Proximity (Reversed)'), ['byZone'] = l10n('By Zone'), + ['byZoneComplete'] = l10n('By Zone + %% Complete'), + ['byZoneCompleteReversed'] = l10n('By Zone + %% Complete (Reversed)'), ['byZonePlayerProximity'] = l10n('By Zone Prox'), ['byZonePlayerProximityReversed'] = l10n('By Zone Prox (Reversed)'), } diff --git a/Modules/Tracker/TrackerUtils.lua b/Modules/Tracker/TrackerUtils.lua index dc03bea..c4dd9c0 100644 --- a/Modules/Tracker/TrackerUtils.lua +++ b/Modules/Tracker/TrackerUtils.lua @@ -706,7 +706,7 @@ local function _GetZoneName(zoneOrSort, questId, zoneNameOverride) if not zoneOrSort then return "Unknown Zone" end local zoneName local sortObj = Questie.db.profile.trackerSortObjectives - if sortObj == "byZone" or sortObj == "byZonePlayerProximity" or sortObj == "byZonePlayerProximityReversed" then + if sortObj == "byZone" or sortObj == "byZoneComplete" or sortObj == "byZoneCompleteReversed" or sortObj == "byZonePlayerProximity" or sortObj == "byZonePlayerProximityReversed" then if (zoneOrSort) > 0 then zoneName = TrackerUtils:GetZoneNameByID(zoneOrSort) if not zoneName or zoneName == "Unknown Zone" then @@ -964,6 +964,34 @@ function TrackerUtils:GetSortedQuestIds() end end end) + elseif sortObj == "byZoneComplete" or sortObj == "byZoneCompleteReversed" then + table.sort(sortedQuestIds, function(a, b) + local qAZone = questDetails[a].zoneName + local qBZone = questDetails[b].zoneName + + -- Sort by Zone first, then by % Complete within each zone + -- (byZoneComplete: completes at top, 0% at bottom; reversed: opposite) + if qAZone == qBZone then + local vA, vB = questDetails[a].questCompletePercent, questDetails[b].questCompletePercent + if vA == vB then + local qA = questDetails[a].quest + local qB = questDetails[b].quest + return qA and qB and qA.level < qB.level + end + + if sortObj == "byZoneComplete" then + return vA > vB + else + return vA < vB + end + else + if qAZone ~= nil and qBZone ~= nil then + return qAZone < qBZone + else + return qAZone and qBZone + end + end + end) elseif sortObj == "byZonePlayerProximity" or sortObj == "byZonePlayerProximityReversed" then local toSort = {} local continent = _GetContinent(C_Map.GetBestMapForUnit("player")) diff --git a/README.md b/README.md index a86232a..9ab5d9c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Questie-X -Fork of [aron-w/Questie-X](https://github.com/aron-w/Questie-X) with bug fixes. +Fork of [aron-w/Questie-X](https://github.com/aron-w/Questie-X) with bug fixes and personal changes. Made for and tested on CoA, but it should also work on other 3.3.5 clients. -## Changes in this fork +## Fixes - fixed world map icons offset due to Ascension's objective frame and zoom addons like Magnify. - fixed tracker objectives not updating correctly. @@ -12,6 +12,10 @@ Made for and tested on CoA, but it should also work on other 3.3.5 clients. - fixed custom quests not showing (complete) in the tracker. - fixed custom quest items not showing. +## Changes + +- added "By Zone + %% Completed" and "By Zone + %% Completed (Reversed)" tracker sorting options. + ## Credits [aron-w/Questie-X](https://github.com/aron-w/Questie-X)