Skip to content

Commit

Permalink
add new optional map pin label option
Browse files Browse the repository at this point in the history
Removed time label option and made it a dropdown. Now we have 3 options: none, time label and reward amount. Hope this somewhat works LanceDH#11
Could be improved in a future.
  • Loading branch information
NanMetal committed Nov 15, 2024
1 parent e450c58 commit b0c9d8f
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 21 deletions.
38 changes: 29 additions & 9 deletions Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1582,7 +1594,7 @@ _V["WQT_DEFAULTS"] = {
filterPoI = true;
scale = 1;
disablePoI = false;
timeLabel = false;
optionalLabel = 1;
continentPins = false;
fadeOnPing = true;
eliteRing = false;
Expand Down Expand Up @@ -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"] = {
Expand Down
7 changes: 6 additions & 1 deletion Locals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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."
Expand Down
50 changes: 40 additions & 10 deletions MapPinProvider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions WorldQuestTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion WorldQuestTab.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b0c9d8f

Please sign in to comment.