-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed to work with Classic Quest Log 3.1.6
- Loading branch information
Showing
1 changed file
with
245 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,267 @@ | ||
if not ClassicQuestLog then return end | ||
local cql = ClassicQuestLog | ||
local IsAddOnLoaded = C_AddOns and C_AddOns.IsAddOnLoaded or IsAddOnLoaded | ||
|
||
local DEFAULT_TEXT_COLOR = CreateColor(1,1,1,1) | ||
local COMPLETED_TEXT_COLOR = CreateColor(0.2,1,0.2,1) | ||
local RED_TEXT_COLOR = CreateColor(0.5,0,0,1) | ||
|
||
local FUBA_HEADER_COLOR = CreateColor(1,0.8,0.1,1) | ||
local FUBA_QUEST_ACCOUNT_COMPLETED_NOTICE_FONT_COLOR = CreateColor(0.4,0.4,0.4,1) | ||
|
||
local function InvertColor(r, g, b) | ||
return 1 - r, 1 - g, 1 - b | ||
end | ||
|
||
local function SkinForElvUI() | ||
|
||
if (not IsAddOnLoaded("ElvUI")) then return end | ||
if (not IsAddOnLoaded("Classic Quest Log")) then return end | ||
|
||
local E, L, V, P, G = unpack(ElvUI) | ||
local S = E:GetModule('Skins') | ||
|
||
local cql = ClassicQuestLog | ||
|
||
cql:StripTextures() | ||
cql:SetTemplate("Transparent") | ||
cql:StripTextures() | ||
cql:SetTemplate("Transparent") | ||
|
||
-- fix if BackdropTemplate is missing | ||
Mixin(ClassicQuestLogScrollFrame, BackdropTemplateMixin) | ||
Mixin(ClassicQuestLogDetailScrollFrame, BackdropTemplateMixin) | ||
Mixin(cql.detail, BackdropTemplateMixin) | ||
|
||
ClassicQuestLog.detail:StripTextures() | ||
ClassicQuestLog.detail:SetTemplate("Transparent") | ||
----------- | ||
--- Log --- | ||
----------- | ||
|
||
S:HandleCloseButton(cql.CloseButton) | ||
hooksecurefunc(cql.Log, "Update", function(self) | ||
local content = self.ScrollFrame.Content | ||
|
||
for k,v in pairs({"abandonButton","pushButton","trackButton","closeButton","optionsButton","syncButton"}) do | ||
if cql.chrome[v] then | ||
S:HandleButton(cql.chrome[v]) | ||
end | ||
end | ||
self:StripTextures() | ||
self:SetTemplate("Transparent") | ||
|
||
S:HandleTrimScrollBar(self.ScrollFrame.ScrollBar) | ||
|
||
local somethingExpanded = self:IsSomethingExpanded() | ||
local AllButton = self.ScrollFrame.AllButton | ||
AllButton:StripTextures() | ||
AllButton:SetNormalTexture(somethingExpanded and E.Media.Textures.MinusButton or E.Media.Textures.PlusButton) | ||
AllButton:SetPushedTexture(somethingExpanded and E.Media.Textures.MinusButton or E.Media.Textures.PlusButton) | ||
AllButton:ClearAllPoints() | ||
AllButton:SetPoint('BOTTOMLEFT', cql, 'TOPLEFT', 6, -55) | ||
|
||
local buttons = content.Buttons | ||
|
||
-- ClassicQuestLogScrollFrame and ScrollBar | ||
ClassicQuestLogScrollFrame:StripTextures() | ||
ClassicQuestLogScrollFrame:SetTemplate("Transparent") | ||
S:HandleScrollBar(ClassicQuestLogScrollFrameScrollBar) | ||
|
||
-- ClassicQuestLogDetailScrollFrame and ScrollBar | ||
S:HandleTrimScrollBar(ClassicQuestLogDetailScrollFrame.ScrollBar) | ||
|
||
-- ClassicQuestLogLoreScrollFrame and ScrollBar | ||
ClassicQuestLogLoreScrollFrame:SetTemplate("Transparent") | ||
S:HandleScrollBar(ClassicQuestLogLoreScrollFrameScrollBar) | ||
|
||
-- ClassicQuestLogOptionsScrollFrame and ScrollBar | ||
ClassicQuestLogOptionsScrollFrame:StripTextures() | ||
ClassicQuestLogOptionsScrollFrame:SetTemplate("Transparent") | ||
S:HandleScrollBar(ClassicQuestLogOptionsScrollFrameScrollBar) | ||
|
||
-- Custom Scale Slider | ||
S:HandleSliderFrame(ClassicQuestLogOptionsScrollFrame.content.UseCustomScale.ScaleSlider) | ||
S:HandleButton(ClassicQuestLogOptionsScrollFrame.content.UseCustomScale.SetButton) | ||
|
||
for k,v in pairs({"LockWindow","ShowResizeGrip","ShowLevels","ShowTooltips","ShowFromObjectiveTracker","DontOverrideBind","ShowMinimapButton","UseCustomScale"}) do | ||
if ClassicQuestLogOptionsScrollFrame then | ||
local cb = ClassicQuestLogOptionsScrollFrame.content[v].check | ||
if cb then S:HandleCheckBox(cb) end | ||
for index, button in ipairs(buttons) do | ||
local expandButton = button.ExpandButton | ||
local info = button.info | ||
if expandButton and info then | ||
button.expandAtlas = cql.settings.CollapsedHeaders[info.title] and E.Media.Textures.PlusButton or E.Media.Textures.MinusButton | ||
expandButton:SetTexture(cql.settings.CollapsedHeaders[info.title] and E.Media.Textures.PlusButton or E.Media.Textures.MinusButton) | ||
end | ||
end | ||
end | ||
end) | ||
|
||
--------------- | ||
--- Options --- | ||
--------------- | ||
|
||
hooksecurefunc(cql.Options, "Update", function(self) | ||
self:StripTextures() | ||
self:SetTemplate("Transparent") | ||
|
||
S:HandleTrimScrollBar(self.ScrollFrame.ScrollBar) | ||
end) | ||
|
||
--------------- | ||
--- Details --- | ||
--------------- | ||
|
||
hooksecurefunc(cql.Detail, "Update", function(self) | ||
self:StripTextures() | ||
self:SetTemplate("Transparent") | ||
|
||
S:HandleTrimScrollBar(self.ScrollFrame.ScrollBar) | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowTitle", function(self) | ||
local content = self.ScrollFrame.Content | ||
if not content then return end | ||
content.TitleHeader:SetTextColor(FUBA_HEADER_COLOR:GetRGB()) | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowStatusTitle", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
if not (content and questID) then return end | ||
|
||
if questID>0 and C_QuestLog.IsQuestDisabledForSession(questID) then | ||
content.StatusTitle:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowStatusText", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
if not (content and questID) then return end | ||
|
||
if questID>0 and C_QuestLog.IsQuestDisabledForSession(questID) then | ||
content.StatusText:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowObjectivesText", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
if not (content and questID) then return end | ||
|
||
if questID > 0 then | ||
content.ObjectivesText:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
-- skin the Quest Counter | ||
cql.chrome.countFrame:StripTextures() | ||
cql.chrome.countFrame:SetTemplate(nil, true) | ||
cql.chrome.countFrame.isSkinned = true | ||
|
||
-- fix Quest Count for Retail, becasue it is not 35 and Blizzard forgot to Update EVERYTHING at Client side... | ||
hooksecurefunc(cql.chrome, "Update", function(self) | ||
local maxquests = select(4,GetBuildInfo()) > 99999 and 35 or 25 | ||
cql.chrome.countFrame.text:SetText(format("%s \124cffffffff%d/%d",QUESTS_COLON,cql.log.numQuests or 0,maxquests)) | ||
end) | ||
|
||
-- skin the "campaignTooltip" | ||
cql.campaignTooltip:StripTextures() | ||
cql.campaignTooltip:SetTemplate(nil, true) | ||
cql.campaignTooltip.isSkinned = true | ||
|
||
-- hook "UpdateListButton" to Skin the "expand" Buttton from Quest Headers | ||
hooksecurefunc(cql.log, "UpdateListButton", function(self, button, info) | ||
if ((not button) or (not info) or (type(info)~="table")) then return end | ||
|
||
if info.isHeader then | ||
local collapsedHeaders = ClassicQuestLogCollapsedHeaders | ||
if button and button.expand then | ||
local isCollapsed = collapsedHeaders[info.title] | ||
button:StripTextures() | ||
button.expand:StripTextures() | ||
button.expand:SetTexture(isCollapsed and E.Media.Textures.PlusButton or E.Media.Textures.MinusButton) | ||
hooksecurefunc(cql.Detail, "ShowObjectives", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
local numObjectives = GetNumQuestLeaderBoards() | ||
local objective | ||
local text, type, finished | ||
local objectivesTable = content.ObjectivesFrame.Objectives | ||
local numVisibleObjectives = 0 | ||
if not (content and questID) then return end | ||
|
||
if questID > 0 then | ||
local waypointText = C_QuestLog.GetNextWaypointText(questID) | ||
if waypointText then | ||
numVisibleObjectives = numVisibleObjectives + 1 | ||
objective = self:AcquireObjective(numVisibleObjectives) | ||
objective:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
|
||
for i=1,numObjectives do | ||
text,type,finished = GetQuestLogLeaderBoard(i) | ||
if (type~="spell" and type~="log" and numVisibleObjectives<MAX_OBJECTIVES) then | ||
numVisibleObjectives = numVisibleObjectives + 1 | ||
objective = self:AcquireObjective(numVisibleObjectives) | ||
|
||
if finished then | ||
objective:SetTextColor(COMPLETED_TEXT_COLOR:GetRGB()) | ||
else | ||
objective:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end | ||
end | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowSpecialObjectives", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
if not (content and questID) then return end | ||
|
||
local spellID, spellName, spellTexture, finished = GetQuestLogCriteriaSpell() | ||
local spellObjectiveLearnLabel = content.SpecialObjectivesFrame.SpellObjectiveLearnLabel | ||
|
||
if finished then | ||
spellObjectiveLearnLabel:SetTextColor(COMPLETED_TEXT_COLOR:GetRGB()) | ||
else | ||
spellObjectiveLearnLabel:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowRequiredMoney", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
if not (content and questID) then return end | ||
|
||
local requiredMoney = C_QuestLog.GetRequiredMoney() | ||
|
||
if requiredMoney > GetMoney() then | ||
content.RequiredMoneyFrame.RequiredMoneyText:SetTextColor(RED_TEXT_COLOR:GetRGB()) | ||
else | ||
content.RequiredMoneyFrame.RequiredMoneyText:SetTextColor(COMPLETED_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowGroupSize", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
local groupNum = C_QuestLog.GetSuggestedGroupSize(questID) | ||
if not (content and questID and groupNum) then return end | ||
|
||
if (questID > 0) and (groupNum > 0) then | ||
content.GroupSize:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowDescriptionHeader", function(self) | ||
local content = self.ScrollFrame.Content | ||
if not (content and content.DescriptionHeader) then return end | ||
|
||
content.DescriptionHeader:SetTextColor(FUBA_HEADER_COLOR:GetRGB()) | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowDescriptionText", function(self) | ||
local content = self.ScrollFrame.Content | ||
local questID = cql.Log:GetSelectedQuest() | ||
if not (content and questID) then return end | ||
|
||
if (questID > 0) then | ||
content.DescriptionText:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowAccountCompletedNotice", function(self) | ||
local content = self.ScrollFrame.Content | ||
if not content then return end | ||
content.AccountCompletedNotice:SetTextColor(FUBA_QUEST_ACCOUNT_COMPLETED_NOTICE_FONT_COLOR:GetRGB()) | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "ShowSeal", function(self) | ||
local content = self.ScrollFrame.Content | ||
if not content then return end | ||
local frame = content.SealFrame | ||
frame.Text:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "AcquireRewardButton", function(self) | ||
local header = self.ScrollFrame.Content.RewardsFrame.Header | ||
if not header then return end | ||
header:SetTextColor(FUBA_HEADER_COLOR:GetRGB()) | ||
end) | ||
|
||
hooksecurefunc(cql.Detail, "AddTextToRewards", function(self, fontstring) | ||
if not fontstring then return end | ||
fontstring:SetTextColor(DEFAULT_TEXT_COLOR:GetRGB()) | ||
end) | ||
|
||
end) | ||
|
||
-- Skin and repositioning the "expandAll" Button | ||
cql.log.expandAll:StripTextures() | ||
cql.log.expandAll:ClearAllPoints() | ||
cql.log.expandAll:SetPoint('BOTTOMLEFT', cql, 'TOPLEFT', -1, -50) | ||
|
||
hooksecurefunc(cql.log, "HybridScrollFrameUpdate", function(self) | ||
local quests = cql.log.quests | ||
local numEntries = #quests | ||
-------------- | ||
--- Chrome --- | ||
-------------- | ||
|
||
if numEntries ~= 0 then | ||
cql.log.expandAll:SetNormalTexture(cql.log.somethingExpanded and E.Media.Textures.MinusButton or E.Media.Textures.PlusButton) | ||
S:HandleCloseButton(ClassicQuestLogCloseButton) | ||
|
||
for k,v in pairs({"CloseButton","AbandonButton","ShareButton","TrackButton"}) do | ||
if cql.Chrome[v] then | ||
S:HandleButton(cql.Chrome[v]) | ||
end | ||
end) | ||
end | ||
end | ||
|
||
hooksecurefunc(cql.Chrome, "Update", function(self) | ||
self:StripTextures() | ||
self:SetTemplate("Transparent") | ||
|
||
if not self.CountFrame.isSkinned then | ||
self.CountFrame:StripTextures() | ||
self.CountFrame:SetTemplate(nil, true) | ||
self.CountFrame.isSkinned = true | ||
end | ||
end) | ||
|
||
|
||
-- maybe skin but not needed really | ||
--[[ | ||
MapButton | ||
OptionsButton | ||
SyncFrame.Button | ||
]] | ||
|
||
end | ||
|
||
cql:RegisterEvent("PLAYER_LOGIN") | ||
cql:HookScript("OnEvent", function(self, event, addon, ...) | ||
if event == "PLAYER_LOGIN" then | ||
if IsAddOnLoaded("ElvUI") then SkinForElvUI() end | ||
end | ||
end) | ||
EventRegistry:RegisterFrameEventAndCallback("PLAYER_LOGIN", SkinForElvUI) | ||
--EventRegistry:RegisterFrameEventAndCallback("PLAYER_ENTERING_WORLD", SkinForElvUI) |