Skip to content

Commit

Permalink
Framework, libraries, toc, bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 19, 2024
1 parent db15d82 commit 1cc7f6a
Show file tree
Hide file tree
Showing 22 changed files with 1,073 additions and 203 deletions.
4 changes: 2 additions & 2 deletions WorldQuestTracker.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 110000
## Interface-Mainline: 110000
## Interface: 110002
## Interface-Mainline: 110002
## Interface-Wrath: 30402

## Title: World Quest Tracker
Expand Down
4 changes: 2 additions & 2 deletions WorldQuestTracker_Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ WorldQuestTracker.OnToggleWorldMap = function(self)
elseif (option == "untrack_quests") then
WorldQuestTracker.RemoveAllQuestsFromTracker()

if (TomTom and IsAddOnLoaded("TomTom")) then
if (TomTom and C_AddOns.IsAddOnLoaded("TomTom")) then
for questID, t in pairs(WorldQuestTracker.TomTomUIDs) do
TomTom:RemoveWaypoint(t)
end
Expand Down Expand Up @@ -4022,7 +4022,7 @@ WorldQuestTracker.OnToggleWorldMap = function(self)
--]=]

--
if (TomTom and IsAddOnLoaded("TomTom")) then
if (TomTom and C_AddOns.IsAddOnLoaded("TomTom")) then
GameCooltip:AddLine("$div")

GameCooltip:AddLine("TomTom")
Expand Down
9 changes: 9 additions & 0 deletions WorldQuestTracker_IDs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ WorldQuestTracker.MapData.ExpMaps = {
[zoneIDs.BROKENISLES] = 7,
}

WorldQuestTracker.MapData.HubMapIconsScale = {
[zoneIDs.DRAGONISLES] = 1,
[zoneIDs.THESHADOWLANDS] = 1,
[zoneIDs.ZANDALAR] = 1,
[zoneIDs.KULTIRAS] = 1,
[zoneIDs.AZEROTH] = 1,
[zoneIDs.BROKENISLES] = 0.8,
}

--list of map ids for world quest hubs
WorldQuestTracker.MapData.QuestHubs = {
[zoneIDs.DRAGONISLES] = true, --dragon isles hub
Expand Down
2 changes: 1 addition & 1 deletion WorldQuestTracker_Tracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function WorldQuestTracker.AddQuestToTracker(self, questID, mapID)
return
end

if (WorldQuestTracker.db.profile.tomtom.enabled and TomTom and IsAddOnLoaded ("TomTom")) then
if (WorldQuestTracker.db.profile.tomtom.enabled and TomTom and C_AddOns.IsAddOnLoaded("TomTom")) then
WorldQuestTracker.AddQuestTomTom (self.questID, self.mapID or mapID)
--return true
end
Expand Down
6 changes: 5 additions & 1 deletion WorldQuestTracker_WorldMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ local mapRangeValues = {
[WorldQuestTracker.MapData.ZoneIDs.AZEROTH] = {0.18, .38, 5.2, 3.3},
[WorldQuestTracker.MapData.ZoneIDs.ZANDALAR] = {0.18, .38, 5.2, 3.3},
[WorldQuestTracker.MapData.ZoneIDs.KULTIRAS] = {0.18, .38, 5.2, 3.3},
[WorldQuestTracker.MapData.ZoneIDs.BROKENISLES] = {0.18/3.0, .38/3.0, 5.2/3.0, 3.3/3.0},
[WorldQuestTracker.MapData.ZoneIDs.BROKENISLES] = {0.18/3.0, .38/3.0, 5.2/3.0, 3.3/3.0}, --0.06, 0.126, 1.733, 1.1
[WorldQuestTracker.MapData.ZoneIDs.ARGUS] = {0.18/2.5, .38/2.5, 5.2/2.5, 3.3/2.5},
["default"] = {0.18, .38, 5.2, 3.3},
}
Expand Down Expand Up @@ -1557,6 +1557,10 @@ local scheduledIconUpdate = function(questTable)
end

local pinScale = DF:MapRangeClamped(rangeValues[1], rangeValues[2], rangeValues[3], rangeValues[4], mapScale)

local finalScaleScalar = WorldQuestTracker.MapData.HubMapIconsScale[WorldMapFrame.mapID] or 1
pinScale = pinScale * finalScaleScalar

if (WorldMapFrame.mapID == WorldQuestTracker.MapData.ZoneIDs.THESHADOWLANDS) then
pinScale = pinScale - 1
local conduitType = WorldQuestTracker.GetConduitQuestData(questID)
Expand Down
25 changes: 16 additions & 9 deletions WorldQuestTracker_ZoneMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1569,19 +1569,26 @@ ZoneSumaryFrame.Header.BlackBackground:SetSize(150, ZoneSumaryFrame.Header.Backg
ZoneSumaryFrame.Header.BlackBackground:SetPoint("topleft", ZoneSumaryFrame.Header.Background, "topleft", 8, -14)
ZoneSumaryFrame.Header.BlackBackground:SetPoint("bottomright", ZoneSumaryFrame.Header.Background, "bottomright", 0, 0)

local GetOrCreateZoneSummaryWidget = function(index)
function WorldQuestTracker.GetOrCreateZoneSummaryWidget(index, parent, pool)
if (not pool) then
pool = WorldQuestTracker.ZoneSumaryWidgets
end

local widget = WorldQuestTracker.ZoneSumaryWidgets [index]
local widget = pool[index]
if (widget) then
return widget
end

local button = CreateFrame("button", "WorldQuestTrackerZoneSummaryFrame_Widget" .. index, ZoneSumaryFrame, "BackdropTemplate")
parent = parent or ZoneSumaryFrame

local button = CreateFrame("button", "WorldQuestTrackerZoneSummaryFrame_Widget" .. index, parent, "BackdropTemplate")
button:SetAlpha(WorldQuestTracker.db.profile.world_summary_alpha)

pool[index] = button

--button:SetPoint("bottomleft", ZoneSumaryFrame, "bottomleft", 0,((index-1)*(ZoneSumaryFrame.WidgetHeight + 1)) -2) --grow bottom to top
button:SetPoint("topleft", ZoneSumaryFrame, "topleft", 0,(((index-1) *(ZoneSumaryFrame.WidgetHeight + 1)) -2) * -1) --grow top to bottom
button:SetSize(ZoneSumaryFrame.WidgetWidth, ZoneSumaryFrame.WidgetHeight)
button:SetPoint("topleft", parent, "topleft", 0,(((index-1) *(parent.WidgetHeight + 1)) -2) * -1) --grow top to bottom
button:SetSize(parent.WidgetWidth, parent.WidgetHeight)
button:SetFrameLevel(WorldQuestTracker.DefaultFrameLevel + 1)

--create a square icon
Expand All @@ -1590,7 +1597,7 @@ local GetOrCreateZoneSummaryWidget = function(index)
--squareIcon.isWorldMapWidget = false --required when updating borders
squareIcon.IsZoneSummaryQuestButton = true
squareIcon:SetPoint("left", button, "left", 2, 0)
squareIcon:SetSize(ZoneSumaryFrame.IconSize, ZoneSumaryFrame.IconSize)
squareIcon:SetSize(parent.IconSize, parent.IconSize)
squareIcon:SetFrameLevel(WorldQuestTracker.DefaultFrameLevel + 2)
squareIcon.IsZoneSummaryButton = true
button.Icon = squareIcon
Expand Down Expand Up @@ -1700,13 +1707,13 @@ local GetOrCreateZoneSummaryWidget = function(index)
--mouseoverHighlight:Hide()
end)

WorldQuestTracker.ZoneSumaryWidgets [index] = button

--disable mouse click
button:SetMouseClickEnabled(false)
return button
end



function WorldQuestTracker.ClearZoneSummaryButtons()
for _, button in ipairs(WorldQuestTracker.ZoneSumaryWidgets) do
button:Hide()
Expand Down Expand Up @@ -1902,7 +1909,7 @@ function WorldQuestTracker.UpdateZoneSummaryFrame()
if (not isSummaryMinimized) then
for i = 1, #WorldQuestTracker.Cache_ShownWidgetsOnZoneMap do
local zoneWidget = WorldQuestTracker.Cache_ShownWidgetsOnZoneMap [i]
local summaryWidget = GetOrCreateZoneSummaryWidget(index)
local summaryWidget = WorldQuestTracker.GetOrCreateZoneSummaryWidget(index)

summaryWidget._Twin = zoneWidget
WorldQuestTracker.SetupZoneSummaryButton(summaryWidget, zoneWidget)
Expand Down
2 changes: 1 addition & 1 deletion libs/DF/LibDFramework-1.0.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 110000
## Interface: 110002
## Title: Lib: LibDFramework-1.0
## Notes: Base Framework for many Addons

Expand Down
2 changes: 1 addition & 1 deletion libs/DF/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local tinsert = table.insert
local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end
local lower = string.lower
local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {}
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end
local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end
local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player"
local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines
local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end
Expand Down
2 changes: 1 addition & 1 deletion libs/DF/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ end
---@field IsEnabled fun(self: df_button) : boolean returns true if the button is enabled
---@field SetIcon fun(self: df_button,texture: string|number, width: number|nil, height: number|nil, layout: string|nil, texcoord: table|nil, overlay: table|nil, textDistance: number|nil, leftPadding: number|nil, textHeight: number|nil, shortMethod: any|nil)
---@field GetIconTexture fun(self: df_button) : string returns the texture path of the button icon
---@field SetTexture fun(self: df_button, normalTexture: string, highlightTexture: string, pressedTexture: string, disabledTexture: string) set the regular button textures
---@field SetTexture fun(self: df_button, normalTexture: any, highlightTexture: any, pressedTexture: any, disabledTexture: any) set the regular button textures
---@field SetFontFace fun(self: df_button, font: string) set the button font
---@field SetFontSize fun(self: df_button, size: number) set the button font size
---@field SetTextColor fun(self: df_button, color: any) set the button text color
Expand Down
49 changes: 27 additions & 22 deletions libs/DF/charts.examples.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,58 @@
--documentation: see the header of the file charts.lua


--1º example: making a simple chart, just copy and paste this code into a lua file and run it
--1º example: making a simple chart with two lines, just copy and paste this code into a lua file and run it
do
local ChartFrameTest = ChartFrameExample1 or DetailsFramework:CreateGraphicLineFrame(UIParent, "ChartFrameExample1")
local ChartFrameTest = ChartFrameExample1 or DetailsFramework:CreateGraphicMultiLineFrame(UIParent, "ChartFrameExample1")
ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0) --set the position of the chart
ChartFrameTest:SetSize(800, 600) --set the size of the chart
DetailsFramework:ApplyStandardBackdrop(ChartFrameTest) --apply a backdrop to this example hence see the frame size

--set the data (required)
--add a line:
local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24, 18, 17, 14, 15, 8, 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4, 8, 7, 4, 12, 12, 4}
local smoothnessLevel = 1 --(optional, default: 1)
ChartFrameTest:SetData(data, smoothnessLevel)
local smoothingMethod = "sma" --(optional, default: "sma")
local smoothnessLevel = 3 --(optional, default: 1)
local name = "Line 1" --(optional, default: none)
local red, green, blue, alpha = 1, 1, 1, 1 --(optional, default: 1, 1, 1, 1)

ChartFrameTest:AddData(data, smoothingMethod, smoothnessLevel, name, red, green, blue, alpha)

--add another line:
data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
smoothingMethod = "loess" --using a different smoothing method
smoothnessLevel = 50
name = "Line 2"
local color = "red" --using a string with the color name
ChartFrameTest:AddData(data, smoothingMethod, smoothnessLevel, name, color)

--draw the chart
ChartFrameTest:Plot()
end

--2º example: setting the color, thickness and scale of the line:
--2º example: thickness and scale of the line:
do
local ChartFrameTest = ChartFrameExample2 or DetailsFramework:CreateGraphicLineFrame(UIParent, "ChartFrameExample2")
local ChartFrameTest = ChartFrameExample2 or DetailsFramework:CreateGraphicMultiLineFrame(UIParent, "ChartFrameExample2")
ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0) --set the position of the chart
ChartFrameTest:SetSize(800, 600) --set the size of the chart
DetailsFramework:ApplyStandardBackdrop(ChartFrameTest) --apply a backdrop to this example hence see the frame size

--add the data (required)
local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24 ,18, 17 ,14, 15, 8 , 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4 ,8, 7 ,4, 12, 12 , 4}
ChartFrameTest:AddData(data)

--set the line thickness (optional, default: 2)
local lineThickness = 3
ChartFrameTest:SetLineThickness(lineThickness)

--set the chart color (optional, default: "white")
local lineColor = {r = 1, g = 1, b = 0} --set it to "yellow"
ChartFrameTest:SetColor(lineColor) --using {r = 1, g = 1, b = 0}
ChartFrameTest:SetColor("yellow") --using the color name
ChartFrameTest:SetColor(1, 1, 0) --passing the rgb directly
ChartFrameTest:SetColor({1, 1, 0}) --using an index table

--set the data (required)
local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24 ,18, 17 ,14, 15, 8 , 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4 ,8, 7 ,4, 12, 12 , 4}
local smoothnessLevel = 1 --(optional, default: 1)
ChartFrameTest:SetData(data, smoothnessLevel)

--height modifier, if for some reason need to scale the chart height
local heightScale = 1 --(optional, default: 1)
local heightScale = 1.2 --(optional, default: 1)
--draw the chart
ChartFrameTest:Plot(heightScale)
end

--3º example: setting the axes lines and labels
do
local ChartFrameTest = ChartFrameExample3 or DetailsFramework:CreateGraphicLineFrame(UIParent, "ChartFrameExample3")
local ChartFrameTest = ChartFrameExample3 or DetailsFramework:CreateGraphicMultiLineFrame(UIParent, "ChartFrameExample3")
ChartFrameTest:SetPoint("left", UIParent, "left", 10, 0)
ChartFrameTest:SetSize(800, 600)
DetailsFramework:ApplyStandardBackdrop(ChartFrameTest)
Expand Down Expand Up @@ -76,7 +81,7 @@ do

--setting the data, doesn't matter if it is set at the top or right before Plot()
local data = {1, 2, 30, 25, 6, 5, 4, 8, 7, 4, 1, 12, 15, 24 ,18, 17 ,14, 15, 8 , 4, 14, 42, 22, 25, 30, 35, 39, 8, 7, 4, 1, 2, 5, 4 ,8, 7 ,4, 12, 12 , 4}
ChartFrameTest:SetData(data) --smoothnessLevel is absent here, it'll use 1 as default
ChartFrameTest:AddData(data)
ChartFrameTest:Plot()
end

Expand Down
Loading

0 comments on commit 1cc7f6a

Please sign in to comment.