Commit bf2c0e52 authored by Simpy's avatar Simpy 🐹
Browse files

Reorganize Objective Tracker Skin

1) make sure we color Scenario and Quest bars to match Color Gradient
2) make sure we dont have excessive code in places we dont need it

~Thanks Merathilis too!
parent cde138a1
......@@ -23,16 +23,6 @@ local function LoadSkin()
WORLD_QUEST_TRACKER_MODULE.Header:StripTextures()
WORLD_QUEST_TRACKER_MODULE.Header.Text:FontTemplate()
local function OnClick(self)
local textObject = self.text
if ObjectiveTrackerFrame.collapsed then
textObject:SetText("+")
else
textObject:SetText("-")
end
end
local minimizeButton = ObjectiveTrackerFrame.HeaderMenu.MinimizeButton
S:HandleButton(minimizeButton)
minimizeButton:Size(16, 14)
......@@ -42,65 +32,25 @@ local function LoadSkin()
minimizeButton.text:SetText("-")
minimizeButton.text:SetJustifyH("CENTER")
minimizeButton.text:SetJustifyV("MIDDLE")
minimizeButton:HookScript('OnClick', OnClick)
-- Various stuff I experimented with
--[[
ObjectiveTrackerBlocksFrame:CreateBackdrop("Transparent")
ObjectiveTrackerBlocksFrame.backdrop:Point("TOPLEFT", -30, 0)
local b = CreateFrame("Button", nil, ObjectiveTrackerFrame)
b.text = b:CreateFontString(nil, 'OVERLAY')
b.text:Point('CENTER', b, 'CENTER')
b.text:FontTemplate()
b.text:SetText(HIDE)
b:Size(50, 20)
S:HandleButton(b)
b:SetTemplate("Transparent")
b:Point("BOTTOMRIGHT", ObjectiveTrackerFrame.HeaderMenu.MinimizeButton, "BOTTOMRIGHT",0, 0)
b:SetScript("OnClick", function()
ObjectiveTrackerFrame.HeaderMenu.MinimizeButton:GetScript("OnClick")()
if ObjectiveTrackerBlocksFrame.QuestHeader:IsVisible() then
b:Width(50)
b.text:SetText(HIDE)
b:ClearAllPoints()
b:Point("BOTTOMRIGHT", ObjectiveTrackerFrame.HeaderMenu.MinimizeButton, "BOTTOMRIGHT",0, 0)
minimizeButton:HookScript('OnClick', function(self)
local textObject = self.text
if ObjectiveTrackerFrame.collapsed then
textObject:SetText("+")
else
b.text:SetText("")
b:Point("TOPLEFT", ObjectiveTrackerFrame.HeaderMenu.Title, "TOPLEFT", -10, 5)
textObject:SetText("-")
end
end)
ObjectiveTrackerBlocksFrame.QuestHeader.Text:SetTextColor(unpack(E.media.rgbvaluecolor))
ObjectiveTrackerBlocksFrame.AchievementHeader:CreateBackdrop("Transparent")
ObjectiveTrackerBlocksFrame.AchievementHeader.backdrop:Point("TOPLEFT", 0, -2)
ObjectiveTrackerBlocksFrame.AchievementHeader.backdrop:Point("BOTTOMRIGHT", 0, 2)
ObjectiveTrackerFrame.HeaderMenu.MinimizeButton:SetAlpha(0)
]]
--Skin ObjectiveTrackerFrame item buttons
hooksecurefunc(QUEST_TRACKER_MODULE, "SetBlockHeader", function(_, block)
local item = block.itemButton
if item and not item.skinned then
item:SetSize(25, 25)
item:SetTemplate("Transparent")
item:StyleButton()
item:SetNormalTexture(nil)
item.icon:SetTexCoord(unpack(E.TexCoords))
item.icon:SetInside()
item.Cooldown:SetInside()
item.Count:ClearAllPoints()
item.Count:SetPoint("TOPLEFT", 1, -1)
item.Count:SetFont(E["media"].normFont, 14, "OUTLINE")
item.Count:SetShadowOffset(5, -5)
E:RegisterCooldown(item.Cooldown)
item.skinned = true
local function ColorProgressBars(self, percent)
if not (self.Bar and self.isSkinned and percent) then return end
local r, g, b = E:ColorGradient(percent/100, 0.8, 0, 0, 0.8, 0.8, 0, 0, 0.8, 0)
self.Bar:SetStatusBarColor(r, g, b)
if self.Bar.backdrop then
self.Bar.backdrop:SetBackdropColor(r*0.25, g*0.25, b*0.25)
end
end)
end
--World Quest Tracker item buttons
hooksecurefunc(WORLD_QUEST_TRACKER_MODULE, "AddObjective", function(_, block)
local function SkinItemButton(self, block)
local item = block.itemButton
if item and not item.skinned then
item:SetSize(25, 25)
......@@ -117,35 +67,9 @@ local function LoadSkin()
E:RegisterCooldown(item.Cooldown)
item.skinned = true
end
end)
--Quest Tracker ProgressBar
hooksecurefunc(DEFAULT_OBJECTIVE_TRACKER_MODULE, "AddProgressBar", function(self, block, line, questID)
local progressBar = self.usedProgressBars[block] and self.usedProgressBars[block][line];
if not progressBar.Bar.backdrop then
progressBar.Bar:CreateBackdrop("Transparent")
progressBar.Bar:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(progressBar.Bar)
progressBar.Bar:DisableDrawLayer("ARTWORK")
progressBar.Bar.Label:SetDrawLayer("OVERLAY")
end
end)
--Color Tracker ProgressBar
local ColorProgressBar = function(self, percent)
if not (self.Bar and self.isSkinned and percent) then return end
local r, g, b = E:ColorGradient(percent/100, 0.8, 0, 0, 0.8, 0.8, 0, 0, 0.8, 0)
self.Bar:SetStatusBarColor(r, g, b)
if self.Bar.backdrop then
self.Bar.backdrop:SetBackdropColor(r*0.25, g*0.25, b*0.25)
end
end
hooksecurefunc("BonusObjectiveTrackerProgressBar_SetValue", ColorProgressBar)
hooksecurefunc("ObjectiveTrackerProgressBar_SetValue", ColorProgressBar)
--hooksecurefunc("ScenarioTrackerProgressBar_SetValue", ColorProgressBar)
--World Quest Tracker/Bonus Objective Tracker ProgressBar
local function SkinProgressBars(line)
local function SkinProgressBars(self, block, line)
local progressBar = line and line.ProgressBar
local bar = progressBar and progressBar.Bar
if not bar then return end
......@@ -195,51 +119,20 @@ local function LoadSkin()
end
end
hooksecurefunc(BONUS_OBJECTIVE_TRACKER_MODULE, "AddProgressBar", function(_, _, line)
SkinProgressBars(line)
end)
hooksecurefunc(WORLD_QUEST_TRACKER_MODULE, "AddProgressBar", function(_, _, line)
SkinProgressBars(line)
end)
--Scenario Tracker ProgressBar
hooksecurefunc(SCENARIO_TRACKER_MODULE, "AddProgressBar", function(_, _, line)
if not line.ProgressBar.Bar.backdrop then
line.ProgressBar.Bar:Height(18)
line.ProgressBar.Bar:CreateBackdrop("Transparent")
line.ProgressBar.Bar:SetStatusBarTexture(E["media"].normTex)
E:RegisterStatusBar(line.ProgressBar.Bar)
line.ProgressBar.Bar.BarFrame:Hide()
line.ProgressBar.Bar.IconBG:SetAlpha(0)
line.ProgressBar.Bar.BarFrame2:Hide()
line.ProgressBar.Bar.BarFrame3:Hide()
line.ProgressBar.Bar.Icon:ClearAllPoints()
line.ProgressBar.Bar.Icon:SetPoint("LEFT", line.ProgressBar.Bar, "RIGHT", E.Border*3, 0)
line.ProgressBar.Bar.Icon:SetMask("")
line.ProgressBar.Bar.Icon:SetTexCoord(unpack(E.TexCoords))
line.ProgressBar:CreateBackdrop("Default")
line.ProgressBar.backdrop:SetOutside(line.ProgressBar.Bar.Icon)
end
line.ProgressBar.backdrop:SetShown(line.ProgressBar.Bar.Icon:IsShown())
end)
local function PositionFindGroupButton(block, button)
if button and button.GetPoint then
local a, b, c, d, e = button:GetPoint()
if block.groupFinderButton and b == block.groupFinderButton and block.itemButton and button == block.itemButton then
-- this fires when there is a group button and a item button to the left of it
-- we push the item button away from the group button (to the left)
button:Point(a, b, c, d-(E.PixelMode and -1 or 1), e);
elseif b == block and block.groupFinderButton and button == block.groupFinderButton then
-- this fires when there is a group button
-- this fires when there is a group finder button
-- we push the group finder button down slightly
button:Point(a, b, c, d, e-(E.PixelMode and 2 or -1));
end
end
end
hooksecurefunc("QuestObjectiveSetupBlockButton_AddRightButton", PositionFindGroupButton)
local function SkinFindGroupButton(block, questID)
if block.hasGroupFinderButton and block.groupFinderButton then
......@@ -250,7 +143,18 @@ local function LoadSkin()
end
end
end
hooksecurefunc("QuestObjectiveSetupBlockButton_FindGroup", SkinFindGroupButton)
hooksecurefunc("BonusObjectiveTrackerProgressBar_SetValue",ColorProgressBars) --[Color]: Bonus Objective Progress Bar
hooksecurefunc("ObjectiveTrackerProgressBar_SetValue",ColorProgressBars) --[Color]: Quest Progress Bar
hooksecurefunc("ScenarioTrackerProgressBar_SetValue",ColorProgressBars) --[Color]: Scenario Progress Bar
hooksecurefunc("QuestObjectiveSetupBlockButton_AddRightButton",PositionFindGroupButton) --[Move]: The eye & quest item to the left of the eye
hooksecurefunc("QuestObjectiveSetupBlockButton_FindGroup",SkinFindGroupButton) --[Skin]: The eye
hooksecurefunc(BONUS_OBJECTIVE_TRACKER_MODULE,"AddProgressBar",SkinProgressBars) --[Skin]: Bonus Objective Progress Bar
hooksecurefunc(WORLD_QUEST_TRACKER_MODULE,"AddProgressBar",SkinProgressBars) --[Skin]: World Quest Progress Bar
hooksecurefunc(DEFAULT_OBJECTIVE_TRACKER_MODULE,"AddProgressBar",SkinProgressBars) --[Skin]: Quest Progress Bar
hooksecurefunc(SCENARIO_TRACKER_MODULE,"AddProgressBar",SkinProgressBars) --[Skin]: Scenario Progress Bar
hooksecurefunc(QUEST_TRACKER_MODULE,"SetBlockHeader",SkinItemButton) --[Skin]: Quest Item Buttons
hooksecurefunc(WORLD_QUEST_TRACKER_MODULE,"AddObjective",SkinItemButton) --[Skin]: World Quest Item Buttons
end
S:AddCallback("ObjectiveTracker", LoadSkin)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment