From b0c9d8f024c8d27949b3d455c374ca1914ca8e9a Mon Sep 17 00:00:00 2001 From: Pastafrola Date: Fri, 15 Nov 2024 00:16:52 -0300 Subject: [PATCH] add new optional map pin label option Removed time label option and made it a dropdown. Now we have 3 options: none, time label and reward amount. Hope this somewhat works #11 Could be improved in a future. --- Data.lua | 38 ++++++++++++++++++++++++++--------- Locals.lua | 7 ++++++- MapPinProvider.lua | 50 ++++++++++++++++++++++++++++++++++++---------- WorldQuestTab.lua | 5 +++++ WorldQuestTab.toc | 2 +- 5 files changed, 81 insertions(+), 21 deletions(-) diff --git a/Data.lua b/Data.lua index 58ce735..e0f052c 100644 --- a/Data.lua +++ b/Data.lua @@ -508,6 +508,18 @@ _V["RING_TYPES_LABELS"] ={ ,[_V["RING_TYPES"].rarity] = {["label"] = RARITY, ["tooltip"] = _L["PIN_RING_QUALITY_TT"]} } +_V["OPTIONAL_LABEL_TYPES"] = { + ["none"] = 1 + ,["time"] = 2 + ,["amount"] = 3 +} + +_V["OPTIONAL_LABEL_LABELS"] ={ + [_V["OPTIONAL_LABEL_TYPES"].none] = {["label"] = NONE, ["tooltip"] = _L["PIN_OPTIONAL_NONE_TT"]} + ,[_V["OPTIONAL_LABEL_TYPES"].time] = {["label"] = _L["PIN_RING_TIME"], ["tooltip"] = _L["PIN_TIME_TT"]} + ,[_V["OPTIONAL_LABEL_TYPES"].amount] = {["label"] = _L["PIN_OPTIONAL_AMOUNT"], ["tooltip"] = _L["PIN_OPTIONAL_AMOUNT_TT"]} +} + _V["ENUM_PIN_CONTINENT"] = { ["none"] = 1 ,["tracked"] = 2 @@ -970,14 +982,6 @@ _V["SETTING_LIST"] = { ,["isDisabled"] = function() return WQT.settings.pin.disablePoI end } - ,{["template"] = "WQT_SettingCheckboxTemplate", ["categoryID"] = "MAPPINS", ["label"] = _L["PIN_TIME"], ["tooltip"] = _L["PIN_TIME_TT"] - , ["valueChangedFunc"] = function(value) - WQT.settings.pin.timeLabel = value; - WQT_WorldQuestFrame.pinDataProvider:RefreshAllData(); - end - ,["getValueFunc"] = function() return WQT.settings.pin.timeLabel end - ,["isDisabled"] = function() return WQT.settings.pin.disablePoI end - } ,{["template"] = "WQT_SettingCheckboxTemplate", ["categoryID"] = "MAPPINS", ["label"] = _L["PIN_ELITE_RING"], ["tooltip"] = _L["PIN_ELITE_RING_TT"] , ["valueChangedFunc"] = function(value) WQT.settings.pin.eliteRing = value; @@ -1010,6 +1014,14 @@ _V["SETTING_LIST"] = { ,["getValueFunc"] = function() return WQT.settings.pin.ringType end ,["isDisabled"] = function() return WQT.settings.pin.disablePoI end } + ,{["template"] = "WQT_SettingDropDownTemplate", ["categoryID"] = "MAPPINS", ["label"] = _L["PIN_OPTIONAL_LABEL"], ["tooltip"] = _L["PIN_OPTIONAL_LABEL_TT"], ["options"] = _V["OPTIONAL_LABEL_LABELS"], ["isNew"] = true + , ["valueChangedFunc"] = function(value) + WQT.settings.pin.optionalLabel = value; + WQT_WorldQuestFrame.pinDataProvider:RefreshAllData(); + end + ,["getValueFunc"] = function() return WQT.settings.pin.optionalLabel end + ,["isDisabled"] = function() return WQT.settings.pin.disablePoI end + } ,{["template"] = "WQT_SettingDropDownTemplate", ["categoryID"] = "MAPPINS", ["label"] = _L["PIN_VISIBILITY_ZONE"], ["tooltip"] = _L["PIN_VISIBILITY_ZONE_TT"], ["options"] = _V["PIN_VISIBILITY_ZONE"] , ["valueChangedFunc"] = function(value) WQT.settings.pin.zoneVisible = value; @@ -1582,7 +1594,7 @@ _V["WQT_DEFAULTS"] = { filterPoI = true; scale = 1; disablePoI = false; - timeLabel = false; + optionalLabel = 1; continentPins = false; fadeOnPing = true; eliteRing = false; @@ -1614,6 +1626,14 @@ end -- This is just easier to maintain than changing the entire string every time _V["PATCH_NOTES"] = { + {["version"] = "11.0.5.1", + ["new"] = { + "Added new pin option to show a label with reward amounts (gold, item level, reputation, etc).", + }, + ["changes"] = { + "Moved close button.", + }, + }, {["version"] = "11.0.5", ["intro"] = { "Update for 11.0.5" }, ["fixes"] = { diff --git a/Locals.lua b/Locals.lua index d764666..da368a2 100644 --- a/Locals.lua +++ b/Locals.lua @@ -78,6 +78,11 @@ L["PIN_ELITE_RING_TT"] = "Replace Blizzard's elite dragon with a spiked ring." L["PIN_FACTION_TT"] = "Use the faction icon." L["PIN_FADE_ON_PING"] = "Fade Irrelevant Pins" L["PIN_FADE_ON_PING_TT"] = "Hovering over a quest in the list will fade out other map pins to more easily spot the relevant one." +L["PIN_OPTIONAL_LABEL"] = "Optional Label" +L["PIN_OPTIONAL_LABEL_TT"] = "Add an optional label below the map pin." +L["PIN_OPTIONAL_NONE_TT"] = "Don't show any label." +L["PIN_OPTIONAL_AMOUNT"] = "Reward Amount" +L["PIN_OPTIONAL_AMOUNT_TT"] = "Add a label with the first reward amount based on reward type (gold, item level, reputation, currency, etc)." L["PIN_RARITY_ICON"] = "Quest Rarity Icon" L["PIN_RARITY_ICON_TT"] = "Add a rarity icon to pins of rare quests." L["PIN_REWARD_TT"] = "Use the texture of the main reward." @@ -103,7 +108,7 @@ L["PIN_SHOW_CONTINENT_TT"] = "Show all quests on continent maps." L["PIN_TIME"] = "Time Left Label" L["PIN_TIME_ICON"] = "Time Remaining Icon" L["PIN_TIME_ICON_TT"] = "Add icon for time remaining, based on time colors." -L["PIN_TIME_TT"] = "Add a short text label with the remaining duration" +L["PIN_TIME_TT"] = "Add a short text label with the remaining duration." L["PIN_TYPE"] = "Quest Type Icon" L["PIN_TYPE_TT"] = "Add a quest type icon to the pin for special quest types." L["PIN_VISIBILITY_ALL_TT"] = "Allow map pins for all quests." diff --git a/MapPinProvider.lua b/MapPinProvider.lua index b83e688..b041d8e 100644 --- a/MapPinProvider.lua +++ b/MapPinProvider.lua @@ -713,16 +713,46 @@ function WQT_PinMixin:UpdateVisuals() end self.CustomTypeIcon:SetDesaturated(isDisliked); - -- Time - local settingPinTimeLabel = WQT_Utils:GetSetting("pin", "timeLabel"); - local showTimeString = settingPinTimeLabel and timeStringShort ~= ""; - self.Time:SetShown(showTimeString); - self.TimeBG:SetShown(showTimeString); - local timeOffset = 4; - if(#self.icons > 0) then - timeOffset = (#self.icons % 2 == 0) and 2 or 0; + -- Optional label + local settingPinOptionalLabel = WQT_Utils:GetSetting("pin", "optionalLabel"); + if settingPinOptionalLabel == _V["OPTIONAL_LABEL_TYPES"].time then + local showTimeString = timeStringShort ~= ""; + self.Time:SetShown(showTimeString); + self.TimeBG:SetShown(showTimeString); + local timeOffset = 4; + if(#self.icons > 0) then + timeOffset = (#self.icons % 2 == 0) and 2 or 0; + end + self.Time:SetPoint("TOP", self, "BOTTOM", 1, timeOffset); + elseif settingPinOptionalLabel == _V["OPTIONAL_LABEL_TYPES"].amount then + local topreward = questInfo.rewardList[1]; + if topreward and topreward.amount > 1 then + local r, g, b = 1, 1, 1; + local amount = topreward.amount; + + if topreward.type == WQT_REWARDTYPE.gold then + amount = floor(amount / 10000); + end + + if topreward.type == WQT_REWARDTYPE.equipment then + r, g, b = topreward.textColor.r, topreward.textColor.g, topreward.textColor.b; + end + + self.Time:Show(); + self.Time:SetText(amount); + self.Time:SetVertexColor(r, g, b); + self.TimeBG:Show(); + + local timeOffset = 4; + if(#self.icons > 0) then + timeOffset = (#self.icons % 2 == 0) and 2 or 0; + end + self.Time:SetPoint("TOP", self, "BOTTOM", 1, timeOffset); + end + else + self.Time:Hide(); + self.TimeBG:Hide(); end - self.Time:SetPoint("TOP", self, "BOTTOM", 1, timeOffset); -- Warband bonus icon local settingPinWarbandBonus = WQT_Utils:GetSetting("pin", "showWarbandBonus"); @@ -772,7 +802,7 @@ function WQT_PinMixin:UpdatePinTime() end -- Time text under pin - if(WQT_Utils:GetSetting("pin", "timeLabel")) then + if(WQT_Utils:GetSetting("pin", "optionalLabel") == _V["OPTIONAL_LABEL_TYPES"].time) then self.Time:SetText(timeStringShort); if (isDisliked) then self.Time:SetVertexColor(1, 1, 1); diff --git a/WorldQuestTab.lua b/WorldQuestTab.lua index 53f341a..2b8e7ca 100644 --- a/WorldQuestTab.lua +++ b/WorldQuestTab.lua @@ -600,6 +600,11 @@ local function ConvertOldSettings(version) WQT.db.global.pin.showWarbandBonus = true; WQT.db.global.list.showWarbandBonus = true; end + + if (version < "11.0.5.1") then + -- Add new pin option + WQT.db.global.pin.optionalLabel = _V["OPTIONAL_LABEL_TYPES"].none; + end end -- Display an indicator on the filter if some official map filters might hide quest diff --git a/WorldQuestTab.toc b/WorldQuestTab.toc index 48837ed..401dda6 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: 11.0.5 +## Version: 11.0.5.1 ## SavedVariables: BWQDB ## X-Website: https://www.curseforge.com/wow/addons/worldquesttab ## X-Curse-Project-ID: 102243