From ea79b9c2d9462786b5c3af77d9519320b2f5f76e Mon Sep 17 00:00:00 2001 From: "nikosvandenbroek@hotmail.com" Date: Tue, 27 Oct 2020 20:56:14 +0100 Subject: [PATCH] 9.0.02 9.0.02 New: New map pin option: Zone Map Pins (default All). Which quests should be allowed to show map pins on zone maps. (None, Tracked, or All) New map pin option: Continent Map Pins (default None). Which quests should be allowed to show map pins on continent maps. (None, Tracked, or All) Changes The 'Pins On Continent' setting has been replaced by the new 'Continent Map Pins'. Its value has been transfered over. Moved the settings and 'What's new' options from the filters to a separate button. Fixes Fixed Ally Quests in Nazjatar not showing the daily quest icon on their map pins. Fixed the missing backdrop in the debug dump window. 'Fixed' the quest log counter. Fixed an error that could occur when trying to right-click certain quests. Fixed flickering of the quest list background when it's being reloaded Fixed being able to add daily quests to the quest watch list, as the official API doesn't support them. --- Data.lua | 7 ++- Dataprovider.lua | 6 +- Debug.lua | 3 +- Locals.lua | 8 ++- Templates.lua | 46 ++++++++++---- WorldQuestTab.lua | 150 +++++++++++++++++++++++++++------------------- WorldQuestTab.toc | 2 +- WorldQuestTab.xml | 97 ++++++++++++++++++------------ 8 files changed, 196 insertions(+), 123 deletions(-) diff --git a/Data.lua b/Data.lua index e715f44..5c7df31 100644 --- a/Data.lua +++ b/Data.lua @@ -1213,8 +1213,6 @@ for k, v in pairs(_V["WQT_FACTION_DATA"]) do end end - - -- This is just easier to maintain than changing the entire string every time _V["PATCH_NOTES"] = { {["version"] = "9.0.02" @@ -1224,10 +1222,15 @@ _V["PATCH_NOTES"] = { } ,["changes"] = { "The 'Pins On Continent' setting has been replaced by the new 'Continent Map Pins'. Its value has been transfered over." + ,"Moved the settings and 'What's new' options from the filters to a separate button." } ,["fixes"] = { "Fixed Ally Quests in Nazjatar not showing the daily quest icon on their map pins." ,"Fixed the missing backdrop in the debug dump window." + ,"'Fixed' the quest log counter." + ,"Fixed an error that could occur when trying to right-click certain quests." + ,"Fixed flickering of the quest list background when it's being reloaded" + ,"Fixed being able to add daily quests to the quest watch list, as the official API doesn't support them." } } ,{["version"] = "9.0.01" diff --git a/Dataprovider.lua b/Dataprovider.lua index 3fd7a76..9b596f5 100644 --- a/Dataprovider.lua +++ b/Dataprovider.lua @@ -151,9 +151,7 @@ function QuestInfoMixin:Init(questId, isDaily, isCombatAllyQuest, alwaysHide, po self.isValid = HaveQuestData(self.questId); self.time.seconds = WQT_Utils:GetQuestTimeString(self); -- To check if expired or never had a time limit self.passedFilter = true; - --self.isCriteria = WorldMapFrame.overlayFrames[_V["WQT_BOUNDYBOARD_OVERLAYID"]]:IsWorldQuestCriteriaForSelectedBounty(questId); - --self.isCriteriaAny = - + self:LoadRewards(); return self.hasRewardData; @@ -233,7 +231,7 @@ function QuestInfoMixin:LoadRewards() end -- Gold if (GetQuestLogRewardMoney(self.questId) > 0) then - local numItems = floor(abs(GetQuestLogRewardMoney(self.questId) / 10000)) + local numItems = floor(abs(GetQuestLogRewardMoney(self.questId))) self:AddReward(WQT_REWARDTYPE.gold, numItems, 133784, 1, _V["WQT_COLOR_GOLD"]); end -- Currency diff --git a/Debug.lua b/Debug.lua index 462bba7..d925ed8 100644 --- a/Debug.lua +++ b/Debug.lua @@ -150,7 +150,8 @@ local function bts(bool) end local function GetQuestDump() - local counted, limit = WQT_Utils:GetQuestLogInfo() + local removedQuests = {}; + local counted, limit = WQT_Utils:GetQuestLogInfo(removedQuests); local output = FORMAT_QUEST_HEADER:format(counted, limit); local numEntries = C_QuestLog.GetNumQuestLogEntries(); diff --git a/Locals.lua b/Locals.lua index c983476..272f928 100644 --- a/Locals.lua +++ b/Locals.lua @@ -104,8 +104,8 @@ L["PIN_VISIBILITY_CONTINENT_TT"] = "Which quests should be allowed to show map p L["PRECISE_FILTER"] = "Precise Filter" L["PRECISE_FILTER_TT"] = "Filtering only shows quests matching all filter categories, rather than just any of the categories." L["QUEST_COUNTER"] = "Quest Log Counter" -L["QUEST_COUNTER_INFO"] = "Following |cFFFFd100%d|r hidden quests count to your quest cap and can't be abandoned. This is an issue on Blizzard's end." -L["QUEST_COUNTER_TITLE"] = "Hidden quests" +L["QUEST_COUNTER_INFO"] = "This number is an aproximation as the value from the official API isn't guaranteed to be correct.\nSome quests might be hidden yet still count." +L["QUEST_COUNTER_TITLE"] = "Quest Log Limit" L["QUEST_COUNTER_TT"] = "Show the number of quests in your default quest log." L["QUEST_LIST"] = "Quest List" L["SAVE_SETTINGS"] = "Save Filters/Sort" @@ -369,6 +369,10 @@ L["DEFAULT_TAB_TT"] = [=[將WQT設定為預設啟用標籤。 這不適用於等級110以下角色。]=] L["EMISSARY_COUNTER"] = "特使任務計數器" L["EMISSARY_COUNTER_TT"] = "在特使標籤添加計數以指示你每個特使任務的進度。" +L["EMISSARY_REWARD"] = "特使獎勵圖示" +L["EMISSARY_REWARD_TT"] = "在特使標籤頁加上圖示,顯示所提供的獎勵類型。" +L["EMISSARY_SELECTED_ONLY"] = "只有選擇的特使" +L["EMISSARY_SELECTED_ONLY_TT"] = "只標記目前所選特使的任務,關閉此選項時會標示任何現有特使的任務。點一下特使標籤頁仍然只會顯示指定特使相關的任務。" L["FILTER_PINS"] = "過濾地圖顯示" L["FILTER_PINS_TT"] = "將過濾套用到地圖上的任務點" L["FORMAT_GROUP_CREATE"] = "輸入|cFFFFFFFF%d|r 為此任務建立一個隊伍。 或輸入其名稱:|cFFFFFFFF%s|r。考慮兩者兼用,讓沒有插件的玩家也可以找到你的隊伍。" diff --git a/Templates.lua b/Templates.lua index 54ad935..959941f 100644 --- a/Templates.lua +++ b/Templates.lua @@ -575,6 +575,20 @@ function WQT_Utils:RemoveTomTomArrowbyQuestId(questId) end end +function WQT_Utils:QuestIncorrectlyCounts(questLogIndex) + local questInfo = C_QuestLog.GetInfo(questLogIndex); + if (questInfo.isHeader or questInfo.isTask or questInfo.isBounty) then + return false, questInfo.isHidden; + end + + local tagInfo = C_QuestLog.GetQuestTagInfo(questInfo.questID); + + if (tagInfo and tagInfo.tagID == 102) then + return true, questInfo.isHidden; + end + +end + function WQT_Utils:QuestCountsToCap(questLogIndex) local questInfo = C_QuestLog.GetInfo(questLogIndex); @@ -592,22 +606,21 @@ function WQT_Utils:QuestCountsToCap(questLogIndex) return counts, questInfo.isHidden; end --- Count quests counting to the quest log cap and collect hidden ones that can't be abandoned -function WQT_Utils:GetQuestLogInfo(hiddenList) - local _, numEntries = C_QuestLog.GetNumQuestLogEntries(); +-- Count quests counting to the quest log cap and collect the ones that shouldn't count +function WQT_Utils:GetQuestLogInfo(list) + local numEntries, questCount = C_QuestLog.GetNumQuestLogEntries(); local maxQuests = C_QuestLog.GetMaxNumQuestsCanAccept(); - local questCount = 0; - if (hiddenList) then - wipe(hiddenList); + + if (list) then + wipe(list); end + for questLogIndex = 1, numEntries do - local counts, isHidden = WQT_Utils:QuestCountsToCap(questLogIndex); - if (counts) then - questCount = questCount + 1; - - -- hidden quest counting to the cap - if (isHidden and hiddenList) then - tinsert(hiddenList, questLogIndex); + -- Remove the ones that shouldn't be counted + if (WQT_Utils:QuestIncorrectlyCounts(questLogIndex)) then + questCount = questCount - 1; + if (list) then + tinsert(list, questLogIndex); end end end @@ -701,6 +714,13 @@ function WQT_Utils:GetQuestRewardIcon(questID) end end +function WQT_Utils:CalculateWarmodeAmount(rewardType, amount) + if (C_PvP.IsWarModeDesired() and _V["WARMODE_BONUS_REWARD_TYPES"][rewardType]) then + amount = amount + floor(amount * C_PvP.GetWarModeRewardBonus() / 100); + end + return amount; +end + function WQT_Utils:DeepWipeTable(t) for k, v in pairs(t) do if (type(v) == "table") then diff --git a/WorldQuestTab.lua b/WorldQuestTab.lua index 7663e08..28f8361 100644 --- a/WorldQuestTab.lua +++ b/WorldQuestTab.lua @@ -58,6 +58,7 @@ -- Callbacks (WQT_WorldQuestFrame:RegisterCallback(event, func, addonName)) -- -- "InitFilter" (self, level) After InitFilter finishes +-- "InitSettings" (self, level) After InitSettings finishes -- "DisplayQuestList" (skipPins) After all buttons in the list have been updated -- "FilterQuestList" () After the list has been filtered -- "UpdateQuestList" () After the list has been both filtered and updated @@ -188,41 +189,7 @@ local function InitFilter(self, level) info.value = k; ADD:AddButton(info, level) end - - info.hasArrow = false; - - -- Settings button - info.text = SETTINGS; - info.func = function() - WQT_WorldQuestFrame:ShowOverlayFrame(WQT_SettingsFrame); - end - - ADD:AddButton(info, level) - - -- What's new - local newText = WQT.settings.updateSeen and "" or "|TInterface\\FriendsFrame\\InformationIcon:14|t "; - - info.text = newText .. _L["WHATS_NEW"]; - info.tooltipTitle = _L["WHATS_NEW"]; - info.tooltipText = _L["WHATS_NEW_TT"]; - - info.func = function() - local scrollFrame = WQT_VersionFrame; - local blockerText = scrollFrame.Text; - - blockerText:SetText(_V["LATEST_UPDATE"]); - blockerText:SetHeight(blockerText:GetContentHeight()); - scrollFrame.limit = max(0, blockerText:GetHeight() - scrollFrame:GetHeight()); - scrollFrame.scrollBar:SetMinMaxValues(0, scrollFrame.limit) - scrollFrame.scrollBar:SetValue(0); - - WQT.settings.updateSeen = true; - - WQT_WorldQuestFrame:ShowOverlayFrame(scrollFrame, 10, -18, -3, 3); - - end - ADD:AddButton(info, level) - + elseif level == 2 then -- Filters info.keepShownOnClick = true; @@ -413,6 +380,58 @@ local function InitFilter(self, level) WQT_WorldQuestFrame:TriggerCallback("InitFilter", self, level); end +local function InitSettings(self, level) + local info = ADD:CreateInfo(); + info.keepShownOnClick = true; + info.tooltipWhileDisabled = true; + info.tooltipOnButton = true; + info.motionScriptsWhileDisabled = true; + info.disabled = nil; + + if level == 1 then + info.checked = nil; + info.isNotRadio = true; + info.func = nil; + info.hasArrow = false; + info.notCheckable = true; + + -- Settings button + info.text = SETTINGS; + info.func = function() + WQT_WorldQuestFrame:ShowOverlayFrame(WQT_SettingsFrame); + end + + ADD:AddButton(info, level) + + -- What's new + local newText = WQT.db.global.updateSeen and "" or "|TInterface\\FriendsFrame\\InformationIcon:14|t "; + + info.text = newText .. _L["WHATS_NEW"]; + info.tooltipTitle = _L["WHATS_NEW"]; + info.tooltipText = _L["WHATS_NEW_TT"]; + + info.func = function() + local scrollFrame = WQT_VersionFrame; + local blockerText = scrollFrame.Text; + + blockerText:SetText(_V["LATEST_UPDATE"]); + blockerText:SetHeight(blockerText:GetContentHeight()); + scrollFrame.limit = max(0, blockerText:GetHeight() - scrollFrame:GetHeight()); + scrollFrame.scrollBar:SetMinMaxValues(0, scrollFrame.limit) + scrollFrame.scrollBar:SetValue(0); + + WQT.db.global.updateSeen = true; + + WQT_WorldQuestFrame:ShowOverlayFrame(scrollFrame, 10, -18, -3, 3); + + end + ADD:AddButton(info, level) + + end + + WQT_WorldQuestFrame:TriggerCallback("InitSettings", self, level); +end + -- Sort filters alphabetically regardless of localization local function GetSortedFilterOrder(filterId) local filter = WQT.settings.filters[filterId]; @@ -1030,8 +1049,8 @@ function WQT_RewardDisplayMixin:AddReward(rewardType, texture, quality, amount, amount = amount or 1; -- Calculate warmode bonus - if (warmodeBonus and C_PvP.IsWarModeDesired() and _V["WARMODE_BONUS_REWARD_TYPES"][rewardType]) then - amount = amount + floor(amount * C_PvP.GetWarModeRewardBonus() / 100); + if (warmodeBonus) then + amount = WQT_Utils:CalculateWarmodeAmount(rewardType, amount); end self:SetWidth(num * 29 - 1); @@ -1045,6 +1064,10 @@ function WQT_RewardDisplayMixin:AddReward(rewardType, texture, quality, amount, if (amount > 1) then rewardFrame.Amount:Show(); + if (rewardType == WQT_REWARDTYPE.gold) then + amount = floor(amount / 10000); + end + local amountDisplay = GetLocalizedAbbreviatedNumber(amount); if (rewardType == WQT_REWARDTYPE.relic) then @@ -1098,11 +1121,12 @@ function WQT_ListButtonMixin:OnClick(button) if (not self.questId or self.questId== -1) then return end local isBonus = QuestUtils_IsQuestBonusObjective(self.questId); local reward = self.questInfo:GetReward(1); + local tagInfo = C_QuestLog.GetQuestTagInfo(self.questId); -- 'Hard' tracking quests with shift if (IsModifiedClick("QUESTWATCHTOGGLE")) then -- Don't track bonus objectives. The object tracker doesn't like it; - if (not isBonus) then + if (not isBonus and tagInfo and tagInfo.worldQuestType) then -- Only do tracking if we aren't adding the link tot he chat if (not ChatEdit_TryInsertQuestLinkForQuestID(self.questId)) then if (QuestUtils_IsQuestWatched(self.questId)) then @@ -1124,7 +1148,7 @@ function WQT_ListButtonMixin:OnClick(button) -- 'Soft' tracking and jumping map to relevant zone elseif (button == "LeftButton") then -- Don't track bonus objectives. The object tracker doesn't like it; - if (not isBonus) then + if (not isBonus and tagInfo and tagInfo.worldQuestType) then local hardWatched = WQT_Utils:QuestIsWatchedManual(self.questId); -- if it was hard watched, keep it that way @@ -1318,9 +1342,8 @@ function WQT_ListButtonMixin:Update(questInfo, shouldShowZone) -- Show border if quest is tracked local isHardWatched = WQT_Utils:QuestIsWatchedManual(questInfo.questId); - if (C_SuperTrack.GetSuperTrackedQuestID() == questInfo.questId or isHardWatched) then + if (isHardWatched) then self.TrackedBorder:Show(); - self.TrackedBorder:SetAlpha(isHardWatched and 0.6 or 1); else self.TrackedBorder:Hide(); end @@ -1559,17 +1582,22 @@ WQT_QuestCounterMixin = {} function WQT_QuestCounterMixin:OnLoad() self:SetFrameLevel(self:GetParent():GetFrameLevel() +5); - self.hiddenList = {}; + self.falseCounted = {}; + self.numQuests = 0 end -- Entering the hidden quests indicator function WQT_QuestCounterMixin:InfoOnEnter(frame) GameTooltip:SetOwner(frame, "ANCHOR_RIGHT"); - GameTooltip:SetText(_L["QUEST_COUNTER_TITLE"], nil, nil, nil, nil, true); - GameTooltip:AddLine(_L["QUEST_COUNTER_INFO"]:format(#self.hiddenList), 1, 1, 1, true); + GameTooltip:SetText(_L["QUEST_COUNTER_TITLE"], 1, 1, 1, 1, true); + GameTooltip:AddLine(_L["QUEST_COUNTER_INFO"]:format(#self.falseCounted), nil, nil, nil, true); + + local _, questCount = C_QuestLog.GetNumQuestLogEntries(); + GameTooltip:AddDoubleLine("API - Addon = Displayed", ("|cFFFFFFFF%d - %d = %d|r"):format(questCount , #self.falseCounted, self.numQuests), 1, 1, 1, 1, 1, 1, true); + --GameTooltip:AddLine(, nil, nil, nil, true); -- Add culprits - for k, i in ipairs(self.hiddenList) do + for k, i in ipairs(self.falseCounted) do local info = C_QuestLog.GetInfo(i); local tagInfo = C_QuestLog.GetQuestTagInfo(info.questID); GameTooltip:AddDoubleLine(string.format("%s (%s)", info.title, info.questID), tagInfo and tagInfo.tagName or "No tag", 1, 1, 1, 1, 1, 1, true); @@ -1579,13 +1607,11 @@ function WQT_QuestCounterMixin:InfoOnEnter(frame) end function WQT_QuestCounterMixin:UpdateText() - local numQuests, maxQuests, color = WQT_Utils:GetQuestLogInfo(self.hiddenList); + local numQuests, maxQuests, color = WQT_Utils:GetQuestLogInfo(self.falseCounted); self.QuestCount:SetText(GENERIC_FRACTION_STRING_WITH_SPACING:format(numQuests, maxQuests)); self.QuestCount:SetTextColor(color.r, color.g, color.b); - - -- Show or hide the icon - local showIcon = #self.hiddenList > 0; - self.HiddenInfo:SetShown(showIcon); + + self.numQuests = numQuests; end function WQT_QuestCounterMixin:UpdateVisibility() @@ -1864,11 +1890,17 @@ function WQT_CoreMixin:OnLoad() -- Sort self.sortButton = ADD:CreateMenuTemplate("WQT_WorldQuestFrameSortButton", self, nil, "BUTTON"); - self.sortButton:SetSize(110, 22); + self.sortButton:SetSize(100, 22); self.sortButton:SetPoint("RIGHT", "WQT_WorldQuestFrameFilterButton", "LEFT", -2, -1); ADD:Initialize(self.sortButton, function(self, level) WQT:InitSort(self, level) end); + + -- Settings + self.settingsDropDown = ADD:CreateMenuTemplate("WQT_WorldQuestFrameSettingsDropDown", self); + self.settingsDropDown.noResize = true; + ADD:Initialize(self.settingsDropDown, function(dd, level) InitSettings(dd, level) end, "MENU"); + -- Context menu local frame = ADD:CreateMenuTemplate("WQT_TrackDropDown", self); frame:EnableMouse(true); @@ -2333,18 +2365,6 @@ function WQT_CoreMixin:ShouldAllowLFG(questInfo) return tagInfo.worldQuestType and not (tagInfo.worldQuestType == Enum.QuestTagType.PetBattle or tagInfo.worldQuestType == Enum.QuestTagType.Dungeon or tagInfo.worldQuestType == Enum.QuestTagType.Progession or tagInfo.worldQuestType == Enum.QuestTagType.Raid); end ---[[ -function WQT_CoreMixin:HookEvent(event, func) - local list = self.eventHooks[event]; - if (not self.eventHooks[event]) then - list = {}; - self.eventHooks[event] = list; - end - - list[func] = true; -end -]] - function WQT_CoreMixin:UnhookEvent(event, func) local list = self.eventHooks[event]; if (list) then @@ -2534,9 +2554,13 @@ function WQT_CoreMixin:SetCustomEnabled(value) if value then self.FilterButton:Enable(); self.sortButton:Enable(); + self.SettingsButton:Enable(); + self.SettingsButton.darken:SetAlpha(0.15); else self.FilterButton:Disable(); self.sortButton:Disable(); + self.SettingsButton:Disable(); + self.SettingsButton.darken:SetAlpha(0.35); end self.ScrollFrame:SetButtonsEnabled(value); diff --git a/WorldQuestTab.toc b/WorldQuestTab.toc index 1261362..aa5feef 100644 --- a/WorldQuestTab.toc +++ b/WorldQuestTab.toc @@ -2,7 +2,7 @@ ## Title: World Quest Tab ## Notes: Creates a new quest tab to keep track of world quests. ## Author: LanceDH -## Version: 9.0.01 +## Version: 9.0.02 ## SavedVariables: BWQDB WorldQuestTab.xml diff --git a/WorldQuestTab.xml b/WorldQuestTab.xml index 947aa81..f7ba273 100644 --- a/WorldQuestTab.xml +++ b/WorldQuestTab.xml @@ -233,7 +233,7 @@ - + @@ -811,10 +811,47 @@ + + + + @@ -916,10 +953,9 @@ - + - - + @@ -927,7 +963,7 @@ - + @@ -967,14 +1003,7 @@ - - - - - - - - + @@ -983,32 +1012,26 @@ + + + + + + + + + - - - - - - - - - - - - - - self:GetParent():InfoOnEnter(self); - - - GameTooltip:Hide(); - - - - + + self:InfoOnEnter(self); + + + GameTooltip:Hide(); +