diff --git a/Interface/AddOns/SVUI/data/defaults.lua b/Interface/AddOns/SVUI/data/defaults.lua index 98e07dc..839533c 100644 --- a/Interface/AddOns/SVUI/data/defaults.lua +++ b/Interface/AddOns/SVUI/data/defaults.lua @@ -630,7 +630,7 @@ SV.defaults["SVPlate"] = { ["healthBar"] = { ["lowThreshold"] = 0.4, ["width"] = 108, - ["height"] = 9, + ["height"] = 10, ["text"] = { ["enable"] = false, ["format"] = "CURRENT", @@ -640,9 +640,14 @@ SV.defaults["SVPlate"] = { }, }, ["castBar"] = { - ["height"] = 6, + ["height"] = 8, ["color"] = {1, 0.81, 0}, - ["noInterrupt"] = {0.78, 0.25, 0.25}, + ["noInterrupt"] = {1, 0.25, 0.25}, + ["text"] = { + ["enable"] = false, + ["xOffset"] = 2, + ["yOffset"] = 0, + }, }, ["raidHealIcon"] = { ["xOffset"] = -4, @@ -715,6 +720,7 @@ SV.defaults["SVStats"] = { SV.defaults["SVTip"] = { ["enable"] = true, + ["comicStyle"] = true, ["cursorAnchor"] = false, ["targetInfo"] = true, ["playerTitles"] = true, @@ -743,7 +749,8 @@ SV.defaults["SVTools"] = { }; SV.defaults["SVUnit"] = { - ["enable"] = true, + ["enable"] = true, + ["comicStyle"] = true, ["disableBlizzard"] = true, ["smoothbars"] = false, ["statusbar"] = "SVUI BasicBar", @@ -865,10 +872,10 @@ SV.defaults["SVUnit"] = { }, ["buffs"] = { - ["enable"] = false, + ["enable"] = true, ["perrow"] = 8, ["numrows"] = 1, - ["attachTo"] = "DEBUFFS", + ["attachTo"] = "FRAME", ["anchorPoint"] = "TOPLEFT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "RIGHT", @@ -887,7 +894,7 @@ SV.defaults["SVUnit"] = { ["enable"] = true, ["perrow"] = 8, ["numrows"] = 1, - ["attachTo"] = "FRAME", + ["attachTo"] = "BUFFS", ["anchorPoint"] = "TOPLEFT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "RIGHT", @@ -1392,15 +1399,15 @@ SV.defaults["SVUnit"] = { ["font"] = "SVUI Narrator Font", ["fontSize"] = 14, ["fontOutline"] = "OUTLINE", - }, + }, ["buffs"] = { - ["enable"] = false, + ["enable"] = true, ["perrow"] = 7, ["numrows"] = 1, ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMRIGHT", - ["verticalGrowth"] = "DOWN", + ["anchorPoint"] = "TOPRIGHT", + ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "LEFT", ["filterPlayer"] = { @@ -1429,7 +1436,7 @@ SV.defaults["SVUnit"] = { }, ["useFilter"] = "", ["xOffset"] = 0, - ["yOffset"] = -8, + ["yOffset"] = 4, ["sizeOverride"] = 0, }, ["debuffs"] = @@ -1438,7 +1445,7 @@ SV.defaults["SVUnit"] = { ["perrow"] = 5, ["numrows"] = 1, ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPRIGHT", + ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", ["horizontalGrowth"] = "LEFT", ["filterPlayer"] = @@ -1462,16 +1469,16 @@ SV.defaults["SVUnit"] = { enemy = false, }, ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, + ["xOffset"] = -4, + ["yOffset"] = 0, ["sizeOverride"] = 0, }, ["castbar"] = { ["enable"] = true, ["width"] = 170, - ["height"] = 18, - ["icon"] = true, + ["height"] = 10, + ["icon"] = false, ["matchFrameWidth"] = true, ["format"] = "REMAINING", ["spark"] = true, @@ -1528,7 +1535,7 @@ SV.defaults["SVUnit"] = { }, }, ["focustarget"] = { - ["enable"] = false, + ["enable"] = true, ["rangeCheck"] = true, ["threatEnabled"] = false, ["width"] = 150, @@ -1581,16 +1588,16 @@ SV.defaults["SVUnit"] = { ["font"] = "SVUI Narrator Font", ["fontSize"] = 14, ["fontOutline"] = "OUTLINE", - }, + }, ["buffs"] = { - ["enable"] = false, + ["enable"] = true, ["perrow"] = 7, ["numrows"] = 1, ["attachTo"] = "FRAME", - ["anchorPoint"] = "BOTTOMLEFT", - ["verticalGrowth"] = "DOWN", - ["horizontalGrowth"] = "RIGHT", + ["anchorPoint"] = "TOPRIGHT", + ["verticalGrowth"] = "UP", + ["horizontalGrowth"] = "LEFT", ["filterPlayer"] = { friendly = true, @@ -1618,18 +1625,18 @@ SV.defaults["SVUnit"] = { }, ["useFilter"] = "", ["xOffset"] = 0, - ["yOffset"] = -8, + ["yOffset"] = 4, ["sizeOverride"] = 0, }, ["debuffs"] = { - ["enable"] = false, + ["enable"] = true, ["perrow"] = 5, ["numrows"] = 1, ["attachTo"] = "FRAME", - ["anchorPoint"] = "TOPLEFT", + ["anchorPoint"] = "LEFT", ["verticalGrowth"] = "UP", - ["horizontalGrowth"] = "RIGHT", + ["horizontalGrowth"] = "LEFT", ["filterPlayer"] = { friendly = false, @@ -1651,8 +1658,8 @@ SV.defaults["SVUnit"] = { enemy = false, }, ["useFilter"] = "", - ["xOffset"] = 0, - ["yOffset"] = 8, + ["xOffset"] = -4, + ["yOffset"] = 0, ["sizeOverride"] = 0, }, ["icons"] = diff --git a/Interface/AddOns/SVUI/framework/api/api_templates.lua b/Interface/AddOns/SVUI/framework/api/api_templates.lua index 443ea05..e854461 100644 --- a/Interface/AddOns/SVUI/framework/api/api_templates.lua +++ b/Interface/AddOns/SVUI/framework/api/api_templates.lua @@ -732,8 +732,8 @@ local function SetCheckboxTemplate(self, shrink, x, y) local width, height = self:GetSize() if(shrink) then - x = x or 0 - y = y or 0 + x = x or -2 + y = y or -2 end width = width + (x or 0) diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index 47fb070..e5731d2 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -303,13 +303,15 @@ local SlotUpdate = function(self, slotID) end local r,g,b = 0,0,0 - + slot.HasQuestItem = nil if(questId and (not isActiveQuest)) then r,g,b = 1,0.3,0.3 slot.questIcon:Show(); + slot.HasQuestItem = true; elseif(questId or isQuestItem) then r,g,b = 1,0.3,0.3 slot.questIcon:Hide(); + slot.HasQuestItem = true; elseif(bagType) then r,g,b = bagType[1],bagType[2],bagType[3] slot.questIcon:Hide(); @@ -632,6 +634,9 @@ local ContainerFrame_UpdateLayout = function(self) slot.questIcon:SetTexture(TEXTURE_ITEM_QUEST_BANG); slot.questIcon:FillInner(slot); slot.questIcon:SetTexCoord(0.1, 0.9, 0.1, 0.9); + + hooksecurefunc(slot, "SetBackdropColor", function(self, r, g, b, a) if(self.HasQuestItem and (r ~= 1)) then self:SetBackdropColor(1,0.3,0.3,a) end end) + hooksecurefunc(slot, "SetBackdropBorderColor", function(self, r, g, b, a) if(self.HasQuestItem and (r ~= 1)) then self:SetBackdropBorderColor(1,0.3,0.3,a) end end) slot.cooldown = _G[cdName]; @@ -661,9 +666,6 @@ local ContainerFrame_UpdateLayout = function(self) lastButton = slot; - slot:SetBackdropColor(1,0.3,0.3,0.6) - slot:SetBackdropBorderColor(1,0.3,0.3,1) - bag:SlotUpdate(slotID); end else diff --git a/Interface/AddOns/SVUI/packages/plates/SVPlate.lua b/Interface/AddOns/SVUI/packages/plates/SVPlate.lua index 0006b1a..cdf299f 100644 --- a/Interface/AddOns/SVUI/packages/plates/SVPlate.lua +++ b/Interface/AddOns/SVUI/packages/plates/SVPlate.lua @@ -134,8 +134,11 @@ local HBHeight = 9; local NPIcons = 14; local CBColor = {0.1,0.81,0} -local CBNoInterrupt = {0.78,0.25,0.25} +local CBNoInterrupt = {1,0.25,0.25} local CBHeight = 6; +local CBText = true; +local CBXoffset = 0; +local CBYoffset = 0; local AuraFont = [[Interface\AddOns\SVUI\assets\fonts\Roboto.ttf]]; local AuraFSize = 10; @@ -1096,10 +1099,10 @@ do if not PLATE_ARGS.scaled and not PLATE_ARGS.tiny then SVUI_PLATE.health:SetSize(HBWidth, HBHeight) end - SVUI_PLATE.health:SetStatusBarTexture(SV.Media.bar.textured) + SVUI_PLATE.health:SetStatusBarTexture(SV.Media.bar.default) SVUI_PLATE.health.text:FontManager(SV.Media.font.roboto, 8, "OUTLINE") - SVUI_PLATE.cast:SetSize(HBWidth, (CBHeight + 20)) - SVUI_PLATE.cast:SetStatusBarTexture(SV.Media.bar.lazer) + SVUI_PLATE.cast:SetSize(HBWidth, CBHeight) + SVUI_PLATE.cast:SetStatusBarTexture(SV.Media.bar.gradient) SVUI_PLATE.cast.text:SetFont(SV.Media.font.roboto, 8, "OUTLINE") plate.cast.text:SetFont(SV.Media.font.roboto, 8, "OUTLINE") plate.cast.icon:Size((CBHeight + HBHeight) + 5) @@ -1176,8 +1179,8 @@ do cast.icon:SetTexCoord( 0, 0, 0, 0 ) cast.icon:SetWidth(.001) cast.shadow:SetTexture(0,0,0,0) - cast.shadow:Hide() - cast.text:Hide() + --cast.shadow:Hide() + --cast.text:Hide() local frameName = "SVUI_PlateHolder"..numChildren local holder = CreateFrame("Frame", frameName, NPGrip) @@ -1241,21 +1244,21 @@ do --[[ CAST BAR ]]-- frame.cast = CreateFrame("StatusBar", nil, frame) - frame.cast:SetPoint('TOPLEFT', frame.health, 'BOTTOMLEFT', 0, 5) - frame.cast:SetPoint('TOPRIGHT', frame.health, 'BOTTOMRIGHT', 0, 5) - + frame.cast:SetPoint('TOPLEFT', frame.health, 'BOTTOMLEFT', 0, -8) + frame.cast:SetPoint('TOPRIGHT', frame.health, 'BOTTOMRIGHT', 0, -8) frame.cast:SetFrameStrata("BACKGROUND") + frame.cast:SetPanelTemplate('Bar') frame.cast:SetFrameLevel(0) frame.cast.text = frame.cast:CreateFontString(nil, 'OVERLAY') - frame.cast.text:SetPoint("TOPRIGHT", frame.cast, "BOTTOMRIGHT", 6, -2) - frame.cast.text:SetJustifyH("RIGHT") + frame.cast.text:SetPoint("RIGHT", frame.cast, "LEFT", -4, CBYoffset) + frame.cast.text:SetJustifyH("LEFT") cast.text:SetParent(frame.cast) cast.text:ClearAllPoints() - cast.text:SetPoint("TOPLEFT", frame.cast, "BOTTOMLEFT", 0, -2) - cast.text:SetPoint("TOPRIGHT", frame.cast.text, "TOPLEFT", 0, -2) + cast.text:SetPoint("LEFT", frame.cast, "LEFT", CBXoffset, CBYoffset) cast.text:SetJustifyH("LEFT") + cast.icon:SetParent(frame.cast) cast.icon:SetTexCoord(.07, .93, .07, .93) cast.icon:SetDrawLayer("OVERLAY") @@ -1497,6 +1500,9 @@ function MOD:UpdateLocals() CBColor = {db.castBar.color[1], db.castBar.color[2], db.castBar.color[3]} CBNoInterrupt = {db.castBar.noInterrupt[1], db.castBar.noInterrupt[2], db.castBar.noInterrupt[3]} CBHeight = db.castBar.height; + CBText = db.castBar.text.enable; + CBXoffset = db.castBar.text.xOffset; + CBYoffset = db.castBar.text.yOffset; NPUsePointer = db.pointer.enable; NPPointerMatch = db.pointer.colorMatchHealthBar; diff --git a/Interface/AddOns/SVUI/packages/quest/SVQuest.lua b/Interface/AddOns/SVUI/packages/quest/SVQuest.lua new file mode 100644 index 0000000..03701b5 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/quest/SVQuest.lua @@ -0,0 +1,390 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format = string.format; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; +--[[ TABLE METHODS ]]-- +local tremove, twipe = table.remove, table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local LSM = LibStub("LibSharedMedia-3.0") +local MOD = SV:NewPackage("SVQuest", L['Questing']); +--[[ +########################################################## +LOCALS +########################################################## +]]-- +local ShowSubDocklet = function(self) + if(InCombatLockdown()) then return end + if(not ObjectiveTrackerFrame:IsShown()) then ObjectiveTrackerFrame:Show() end +end + +local HideSubDocklet = function(self) + if(InCombatLockdown()) then return end + if(ObjectiveTrackerFrame:IsShown()) then ObjectiveTrackerFrame:Hide() end +end + +local function GetTimerTextColor(duration, elapsed) + local yellowPercent = .66 + local redPercent = .33 + + local percentageLeft = 1 - ( elapsed / duration ) + if(percentageLeft > yellowPercent) then + return 1, 1, 1; + elseif(percentageLeft > redPercent) then + local blueOffset = (percentageLeft - redPercent) / (yellowPercent - redPercent); + return 1, 1, blueOffset; + else + local greenOffset = percentageLeft / redPercent; + return 1, greenOffset, 0; + end +end + +local function CheckAndHideHeader(moduleHeader) + if(moduleHeader and not moduleHeader.added and moduleHeader:IsShown()) then + moduleHeader:Hide(); + if(moduleHeader.animating) then + moduleHeader.animating = nil; + moduleHeader.HeaderOpenAnim:Stop(); + end + end +end +--[[ +########################################################## +SCRIPT HANDLERS +########################################################## +]]-- +local TrackerFrame_OnUpdate = function(self, elapsed) + if(self:GetHeight() > 0) then + self:SetScript("OnUpdate", nil); + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_ALL); + end +end + +local TimerBar_OnUpdate = function(self, elapsed) + local timeNow = GetTime(); + local timeRemaining = self.duration - (timeNow - self.startTime); + self.Bar:SetValue(timeRemaining); + if(timeRemaining < 0) then + -- hold at 0 for a moment + if(timeRemaining > -1) then + timeRemaining = 0; + else + MOD:UpdateTracker(self.block.module.updateReasonModule); + return; + end + end + self.Label:SetText(GetTimeStringFromSeconds(timeRemaining, nil, true)); + self.Label:SetTextColor(GetTimerTextColor(self.duration, self.duration - timeRemaining)); +end +--[[ +########################################################## +TRACKER FUNCTIONS +########################################################## +]]-- +function MOD:SetProgressBarValue(percent) + self.Bar:SetValue(percent); + self.Bar.Label:SetFormattedText(PERCENTAGE_STRING, percent); +end + +local function CreateTrackerLine(parent, anchor, WIDTH) + local newLine = CreateFrame("Frame", nil, parent) + newLine:SetWidth(WIDTH); + newLine:SetHeight(24); + newLine:SetPoint("TOP", anchor, "BOTTOM", 0, -1); + + newLine.Header = CreateFrame("Frame", nil, newLine) + newLine.Header:SetPoint("TOPLEFT", newLine, "TOPLEFT", 2, -2); + newLine.Header:SetPoint("TOPRIGHT", newLine, "TOPRIGHT", -2, -2); + newLine.Header:SetHeight(20); + newLine.Header:SetPanelTemplate("Headline") + + newLine.Title = newLine.Header:CreateFontString(nil,"OVERLAY") + newLine.Title:SetFont(SV.Media.font.roboto, 14, "NONE") + newLine.Title:SetShadowOffset(-1,-1) + newLine.Title:SetShadowColor(0,0,0,0.5) + newLine.Title:SetText('') + newLine.Title:SetAllPoints(newLine.Header) + + newLine.Text = newLine:CreateFontString(nil,"OVERLAY") + newLine.Text:SetFont(SV.Media.font.roboto, 12, "NONE") + newLine.Text:SetShadowOffset(-1,-1) + newLine.Text:SetShadowColor(0,0,0,0.5) + newLine.Text:SetText('') + newLine.Text:SetPoint("TOPLEFT", newLine.Header, "BOTTOMLEFT", 0, -2) + + return newLine; +end + +function MOD:UpdateTracker() + if(not MOD.Tracker.initialized) then return; end + + local tracker = MOD.Tracker; + for i = 1, GetNumQuestWatches() do + local questIndex = GetQuestIndexForWatch(i) + --local questID, title, questLogIndex, numObjectives, requiredMoney, isComplete, startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(i); + local title, level, suggestedGroup = GetQuestLogTitle(questIndex) + local text = ('[%s] %s'):format(level,title) + MOD.Tracker.Quest[i].Title:SetText(text) + end +end +--[[ +########################################################## +EVENT HANDLERS +########################################################## +]]-- +local TrackerFrame_OnEvent = function(self, event, ...) + if(event == "QUEST_LOG_UPDATE") then + MOD:UpdateTracker(); + elseif(event == "TRACKED_ACHIEVEMENT_UPDATE") then + AchievementObjectiveTracker_OnAchievementUpdate(...); + elseif(event == "QUEST_ACCEPTED") then + local questLogIndex, questID = ...; + if(IsQuestTask(questID)) then + MOD:UpdateTracker(); + else + if(AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS) then + AddQuestWatch(questLogIndex); + QuestSuperTracking_OnQuestTracked(questID); + end + end + elseif(event == "TRACKED_ACHIEVEMENT_LIST_CHANGED") then + local achievementID, added = ...; + if(added) then + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, achievementID); + else + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT); + end + elseif(event == "QUEST_WATCH_LIST_CHANGED") then + local questID, added = ...; + if(added) then + if(not IsQuestTask(questID)) then + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID); + end + else + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_QUEST); + end + elseif(event == "QUEST_POI_UPDATE") then + QuestPOIUpdateIcons(); + if(GetCVar("trackQuestSorting") == "proximity") then + SortQuestWatches(); + end + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST); + QuestSuperTracking_OnPOIUpdate(); + elseif(event == "SCENARIO_CRITERIA_UPDATE") then + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_SCENARIO); + elseif(event == "SUPER_TRACKED_QUEST_CHANGED") then + local questID = ...; + QuestPOI_SelectButtonByQuestID(self.BlocksFrame, questID); + elseif(event == "ZONE_CHANGED") then + local inMicroDungeon = IsPlayerInMicroDungeon(); + if(inMicroDungeon ~= self.inMicroDungeon) then + if(not WorldMapFrame:IsShown() and GetCVarBool("questPOI")) then + SetMapToCurrentZone(); + end + SortQuestWatches(); + self.inMicroDungeon = inMicroDungeon; + end + elseif(event == "QUEST_AUTOCOMPLETE") then + local questId = ...; + AutoQuestPopupTracker_AddPopUp(questId, "COMPLETE"); + elseif(event == "SCENARIO_UPDATE") then + local newStage = ...; + if(newStage) then + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE); + else + MOD:UpdateTracker(OBJECTIVE_TRACKER_UPDATE_SCENARIO); + end + elseif(event == "ZONE_CHANGED_NEW_AREA") then + if(not WorldMapFrame:IsShown() and GetCVarBool("questPOI")) then + SetMapToCurrentZone(); + end + SortQuestWatches(); + elseif(event == "QUEST_TURNED_IN") then + local questID, xp, money = ...; + if(IsQuestTask(questID)) then + BonusObjectiveTracker_OnTaskCompleted(...); + end + elseif(event == "PLAYER_MONEY" and self.watchMoneyReasons > 0) then + MOD:UpdateTracker(self.watchMoneyReasons); + elseif(event == "PLAYER_ENTERING_WORLD") then + if(not self.initialized) then + ObjectiveTracker_Initialize(self); + end + MOD:UpdateTracker(); + QuestSuperTracking_ChooseClosestQuest(); + self.inMicroDungeon = IsPlayerInMicroDungeon(); + elseif(event == "VARIABLES_LOADED") then + MOD:UpdateTracker(); + end +end +--[[ +########################################################## +CORE FUNCTIONS +########################################################## +]]-- +function MOD:ReLoad() + -- DO STUFF +end + +function MOD:Load() + -- DO STUFF + self.Tracker = SV.Dock:NewDocklet("BottomRight", "SVUI_QuestTracker", "Quest Tracker", [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-QUESTS]]) + + local listFrame = CreateFrame("ScrollFrame", "SVUI_QuestWatchFrameScrollFrame", self.Tracker); + listFrame:SetPoint("TOPLEFT", self.Tracker, 0, 0); + listFrame:SetPoint("BOTTOMRIGHT", self.Tracker, -31, 21); + listFrame:EnableMouseWheel(true); + + local WIDTH = listFrame:GetWidth(); + + local scrollFrame = CreateFrame("Slider", "SVUI_QuestWatchFrameScrollBar", listFrame); + scrollFrame:SetHeight(listFrame:GetHeight()); + scrollFrame:SetWidth(18); + scrollFrame:SetPoint("TOPRIGHT", self.Tracker, "TOPRIGHT", -3, 0); + scrollFrame:SetBackdrop({bgFile = bgTex, edgeFile = bdTex, edgeSize = 4, insets = {left = 3, right = 3, top = 3, bottom = 3}}); + scrollFrame:SetFrameLevel(6) + scrollFrame:SetFixedPanelTemplate("Transparent", true); + scrollFrame:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob"); + scrollFrame:SetOrientation("VERTICAL"); + scrollFrame:SetValueStep(5); + scrollFrame:SetMinMaxValues(1, 420); + scrollFrame:SetValue(1); + scrollFrame:SetScript("OnValueChanged", function(self, argValue) + listFrame:SetVerticalScroll(argValue) + end) + + listFrame.slider = scrollFrame; + listFrame:SetScript("OnMouseWheel", function(self, delta) + local scroll = self:GetVerticalScroll(); + local value = (scroll - (20 * delta)); + if value < -1 then + value = 0 + end + if value > 420 then + value = 420 + end + --self:SetVerticalScroll(value) + self.slider:SetValue(value) + end) + + local scrollChild = CreateFrame("Frame", nil, listFrame) + scrollChild:SetWidth(WIDTH); + scrollChild:SetClampedToScreen(false) + scrollChild:SetHeight(500) + scrollChild:SetPoint("TOPRIGHT", listFrame, "TOPRIGHT", -2, 0) + scrollChild:SetFrameLevel(listFrame:GetFrameLevel() + 1) + + local quests = CreateFrame("Frame", nil, scrollChild) + quests:SetWidth(WIDTH - 4); + quests:SetHeight(20); + quests:SetPoint("TOP", scrollChild, "TOP", 0, -2); + + quests.Header = CreateFrame("Frame", nil, quests) + quests.Header:SetPoint("TOPLEFT", quests, "TOPLEFT", 2, -2); + quests.Header:SetPoint("TOPRIGHT", quests, "TOPRIGHT", -2, -2); + quests.Header:SetHeight(20); + quests.Header:SetPanelTemplate("Headline") + + quests.Title = quests.Header:CreateFontString(nil,"OVERLAY") + quests.Title:SetFont(SV.Media.font.roboto, 14, "NONE") + quests.Title:SetShadowOffset(-1,-1) + quests.Title:SetShadowColor(0,0,0,0.5) + quests.Title:SetText(TRACKER_HEADER_QUESTS) + quests.Title:SetAllPoints(quests.Header) + + quests[1] = CreateTrackerLine(quests, quests, WIDTH) + for i = 2, 25 do + quests[i] = CreateTrackerLine(quests, quests[i - 1], WIDTH) + end + + -- local achievements = CreateFrame("Frame", nil, scrollChild, "SVUI_QuestTrackerHeaderTemplate") + -- achievements:SetWidth(WIDTH - 4); + -- achievements:SetHeight(20); + -- achievements:SetPoint("TOP", quests[25], "BOTTOM", 0, -2); + -- achievements.Text:SetText(TRACKER_HEADER_ACHIEVEMENTS); + -- achievements[1] = CreateTrackerLine(achievements, achievements) + -- for i = 2, 10 do + -- achievements[i] = CreateTrackerLine(achievements, achievements[i - 1]) + -- end + + -- local scenarios = CreateFrame("Frame", nil, scrollChild, "SVUI_QuestTrackerHeaderTemplate") + -- scenarios:SetWidth(WIDTH - 4); + -- scenarios:SetHeight(20); + -- scenarios:SetPoint("TOP", achievements[10], "BOTTOM", 0, -2); + -- scenarios.Text:SetText(TRACKER_HEADER_SCENARIO); + -- scenarios[1] = CreateTrackerLine(scenarios, scenarios) + -- scenarios[2] = CreateTrackerLine(scenarios, scenarios[1]) + -- scenarios[3] = CreateTrackerLine(scenarios, scenarios[2]) + + listFrame:SetScrollChild(scrollChild) + + self.Tracker.Quest = quests; + --self.Tracker.Achievement = achievements; + --self.Tracker.Scenario = scenarios; + + self.Tracker.DockButton:MakeDefault(); + self.Tracker:Show(); + --self.Tracker:SetScript('OnShow', ShowSubDocklet); + --self.Tracker:SetScript('OnHide', HideSubDocklet); + + --self:InitializeButton() + + -- self.Tracker:RegisterEvent("QUEST_LOG_UPDATE"); + -- self.Tracker:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED"); + -- self.Tracker:RegisterEvent("QUEST_WATCH_LIST_CHANGED"); + -- self.Tracker:RegisterEvent("QUEST_AUTOCOMPLETE"); + -- self.Tracker:RegisterEvent("QUEST_ACCEPTED"); + -- self.Tracker:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED"); + -- self.Tracker:RegisterEvent("SCENARIO_UPDATE"); + -- self.Tracker:RegisterEvent("SCENARIO_CRITERIA_UPDATE"); + -- self.Tracker:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE"); + -- self.Tracker:RegisterEvent("ZONE_CHANGED_NEW_AREA"); + -- self.Tracker:RegisterEvent("ZONE_CHANGED"); + -- self.Tracker:RegisterEvent("QUEST_POI_UPDATE"); + -- self.Tracker:RegisterEvent("VARIABLES_LOADED"); + -- self.Tracker:RegisterEvent("QUEST_TURNED_IN"); + -- self.Tracker:RegisterEvent("PLAYER_MONEY"); + -- self.Tracker:SetScript("OnEvent", TrackerFrame_OnEvent); + + ObjectiveTrackerFrame:HookScript("OnEvent", MOD.UpdateTracker) + + self.Tracker.initialized = true; +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/quest/SVQuest.xml b/Interface/AddOns/SVUI/packages/quest/SVQuest.xml new file mode 100644 index 0000000..80e71c8 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/quest/SVQuest.xml @@ -0,0 +1,67 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + + <Frame name="SVUI_QuestTrackerHeaderTemplate" virtual="true" hidden="true"> + <Size x="235" y="25"/> + <Layers> + <Layer level="ARTWORK"> + <FontString parentKey="Text" inherits="GameFontNormalMed2" justifyH="LEFT"> + <Size x="170" y="16"/> + <Anchors> + <Anchor point="LEFT" x="4" y="-1"/> + </Anchors> + </FontString> + <Texture parentKey="LineGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineGlow" useAtlasSize="true"> + <Anchors> + <Anchor point="LEFT" relativeKey="$parent.Background" x="-50" y="18"/> + </Anchors> + </Texture> + <Texture parentKey="SoftGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_Glow" useAtlasSize="true"> + <Anchors> + <Anchor point="CENTER" relativeKey="$parent.Background" relativePoint="LEFT" x="20" y="20"/> + </Anchors> + </Texture> + <Texture parentKey="StarBurst" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_StarBurst" useAtlasSize="true"> + <Anchors> + <Anchor point="CENTER" relativeKey="$parent.SoftGlow"/> + </Anchors> + </Texture> + <Texture parentKey="LineSheen" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineBurst"> + <Size x="60" y="15"/> + <Anchors> + <Anchor point="CENTER" relativeKey="$parent.SoftGlow" x="0" y="-13"/> + </Anchors> + </Texture> + </Layer> + </Layers> + <Animations> + <AnimationGroup parentKey="HeaderOpenAnim" setToFinalAlpha="true"> + <Alpha childKey="LineGlow" duration="0.15" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="LineGlow" startDelay="0.25" duration="0.65" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="LineGlow" duration="0.15" order="1" fromScaleX="0.1" fromScaleY="1.5" toScaleX="2" toScaleY="1.5"> + <Origin point="CENTER"> + <Offset x="-50" y="0"/> + </Origin> + </Scale> + <Translation childKey="LineGlow" duration="0.75" order="1" offsetX="50" offsetY="0"/> + <Alpha childKey="SoftGlow" duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="SoftGlow" startDelay="0.25" duration="0.5" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="SoftGlow" duration="0.25" order="1" fromScaleX="0.5" fromScaleY="0.5" toScaleX="0.8" toScaleY="0.8"/> + <Alpha childKey="StarBurst" duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="StarBurst" startDelay="0.25" duration="0.5" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="StarBurst" duration="0.25" order="1" fromScaleX="0.5" fromScaleY="0.5" toScaleX="1" toScaleY="1"/> + <Alpha childKey="LineSheen" startDelay="0.15" duration="0.5" order="1" fromAlpha="0" toAlpha="0.75"/> + <Alpha childKey="LineSheen" startDelay="0.75" duration="0.5" order="1" fromAlpha="0.75" toAlpha="0"/> + <Translation childKey="LineSheen" startDelay="0.15" duration="1.5" order="1" offsetX="250" offsetY="0"/> + <Scripts> + <OnFinished> + local header = self:GetParent(); + header.animating = false; + </OnFinished> + </Scripts> + </AnimationGroup> + </Animations> + </Frame> + + <Script file='SVQuest.lua'/> + <Script file='components\button.lua'/> +</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/quest/components/button.lua b/Interface/AddOns/SVUI/packages/quest/components/button.lua new file mode 100644 index 0000000..46b97a4 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/quest/components/button.lua @@ -0,0 +1,325 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format = string.format; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; +--[[ TABLE METHODS ]]-- +local tremove, twipe = table.remove, table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local LSM = LibStub("LibSharedMedia-3.0") +local MOD = SV.SVQuest; +--[[ +########################################################## +EXTRA QUEST ITEM BUTTON +########################################################## +]]-- +local Button = CreateFrame('Button', (...), UIParent, 'SecureActionButtonTemplate, SecureHandlerStateTemplate, SecureHandlerAttributeTemplate') +Button:SetPoint('CENTER', UIParent, 'CENTER', 0, 0) +Button:SetSize(50,50) +Button:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]]) +Button:SetPushedTexture([[Interface\Buttons\CheckButtonHilight]]) +Button:GetPushedTexture():SetBlendMode('ADD') +Button:SetScript('OnLeave', GameTooltip_Hide) +Button:SetAttribute('type', 'item') +Button.updateTimer = 0 +Button.rangeTimer = 0 +--Button:Hide() +Button.updateTimer = 0 +Button.rangeTimer = 0 +RegisterStateDriver(Button, 'visible', '[extrabar] hide; show') +Button:SetAttribute('_onattributechanged', [[ + if(name == 'item') then + if(value and not self:IsShown() and not HasExtraActionBar()) then + self:Show() + elseif(not value) then + self:Hide() + self:ClearBindings() + end + elseif(name == 'state-visible') then + if(value == 'show') then + self:CallMethod('Update') + else + self:Hide() + self:ClearBindings() + end + end + + if(self:IsShown() and (name == 'item' or name == 'binding')) then + self:ClearBindings() + + local key = GetBindingKey('EXTRAACTIONBUTTON1') + if(key) then + self:SetBindingClick(1, key, self, 'LeftButton') + end + end +]]) + +local Icon = Button:CreateTexture('$parentIcon', 'BACKGROUND') +Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) +Icon:SetAllPoints() +Button.Icon = Icon + +local HotKey = Button:CreateFontString('$parentHotKey', nil, 'NumberFontNormal') +HotKey:SetPoint('BOTTOMRIGHT', -5, 5) +Button.HotKey = HotKey + +local Cooldown = CreateFrame('Cooldown', '$parentCooldown', Button, 'CooldownFrameTemplate') +Cooldown:ClearAllPoints() +Cooldown:SetPoint('TOPRIGHT', -2, -3) +Cooldown:SetPoint('BOTTOMLEFT', 2, 1) +Cooldown:Hide() +Button.Cooldown = Cooldown + +local Artwork = Button:CreateTexture('$parentArtwork', 'OVERLAY') +Artwork:SetPoint('CENTER', -2, 0) +Artwork:SetSize(256, 128) +Artwork:SetTexture([[Interface\ExtraButton\Amber]]) +Button.Artwork = Artwork + +local function UpdateCooldown(self) + if(self:IsShown()) then + local start, duration, enable = GetItemCooldown(self.itemID) + if(duration > 0) then + self.Cooldown:SetCooldown(start, duration) + self.Cooldown:Show() + else + self.Cooldown:Hide() + end + end +end + +Button:RegisterEvent('UPDATE_BINDINGS') +Button:RegisterEvent('UPDATE_EXTRA_ACTIONBAR') +Button:RegisterEvent('BAG_UPDATE_COOLDOWN') +Button:RegisterEvent('BAG_UPDATE_DELAYED') +Button:RegisterEvent('WORLD_MAP_UPDATE') +Button:RegisterEvent('QUEST_LOG_UPDATE') +Button:RegisterEvent('QUEST_POI_UPDATE') +Button:SetScript('OnEvent', function(self, event) + if(event == 'BAG_UPDATE_COOLDOWN') then + UpdateCooldown(self) + elseif(event == 'PLAYER_REGEN_ENABLED') then + self:SetAttribute('item', self.attribute) + self:UnregisterEvent(event) + UpdateCooldown(self) + elseif(event == 'UPDATE_BINDINGS') then + if(self:IsShown()) then + self:SetItem() + self:SetAttribute('binding', GetTime()) + end + else + self:Update() + end +end) + +Button:SetScript('OnEnter', function(self) + GameTooltip:SetOwner(self, 'ANCHOR_LEFT') + GameTooltip:SetHyperlink(self.itemLink) +end) + +-- BUG: IsItemInRange() is broken versus friendly npcs (and possibly others) +Button:SetScript('OnUpdate', function(self, elapsed) + if(self.rangeTimer > 0.2) then + local HotKey = self.HotKey + local inRange = IsItemInRange(self.itemLink, 'target') + if(HotKey:GetText() == RANGE_INDICATOR) then + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + HotKey:Show() + elseif(inRange) then + HotKey:SetTextColor(1, 1, 1) + HotKey:Show() + else + HotKey:Hide() + end + else + if(inRange == false) then + HotKey:SetTextColor(1, 0.1, 0.1) + else + HotKey:SetTextColor(1, 1, 1) + end + end + + self.rangeTimer = 0 + else + self.rangeTimer = self.rangeTimer + elapsed + end + + if(self.updateTimer > 5) then + self:Update() + self.updateTimer = 0 + else + self.updateTimer = self.updateTimer + elapsed + end +end) + +local zoneWide = { + [14108] = 541, + [13998] = 11, + [25798] = 61, -- quest is bugged, has no zone + [25799] = 61, -- quest is bugged, has no zone + [25112] = 161, + [25111] = 161, + [24735] = 201, +} + +local blacklist = { + [113191] = true, + [110799] = true, + [109164] = true, +} + +function Button:SetItem(itemLink, texture) + if(itemLink) then + if(itemLink == self.itemLink and self:IsShown()) then + return + end + + self.Icon:SetTexture(texture) + self.itemID, self.itemName = string.match(itemLink, '|Hitem:(.-):.-|h%[(.+)%]|h') + self.itemLink = itemLink + + if(blacklist[self.itemID]) then + return + end + end + + local HotKey = self.HotKey + local key = GetBindingKey('EXTRAACTIONBUTTON1') + if(key) then + HotKey:SetText(GetBindingText(key, 1)) + HotKey:Show() + elseif(ItemHasRange(self.itemLink)) then + HotKey:SetText(RANGE_INDICATOR) + HotKey:Show() + else + HotKey:Hide() + end + + if(InCombatLockdown()) then + self.attribute = self.itemName + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:SetAttribute('item', self.itemName) + UpdateCooldown(self) + end +end + +function Button:RemoveItem() + if(InCombatLockdown()) then + self.attribute = nil + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:SetAttribute('item', nil) + end +end + +local ticker +function Button:Update() + local numItems = 0 + local shortestDistance = 62500 -- 250 yards² + local closestQuestLink, closestQuestTexture + + for index = 1, GetNumQuestWatches() do + local questID, _, questIndex, _, _, isComplete = GetQuestWatchInfo(index) + if(questID and QuestHasPOIInfo(questID)) then + local link, texture, _, showCompleted = GetQuestLogSpecialItemInfo(questIndex) + if(link) then + local areaID = zoneWide[questID] + if(areaID and areaID == GetCurrentMapAreaID()) then + closestQuestLink = link + closestQuestTexture = texture + elseif(not isComplete or (isComplete and showCompleted)) then + local distanceSq, onContinent = GetDistanceSqToQuest(questIndex) + if(onContinent and distanceSq < shortestDistance) then + shortestDistance = distanceSq + closestQuestLink = link + closestQuestTexture = texture + end + end + + numItems = numItems + 1 + end + end + end + + if(closestQuestLink and not HasExtraActionBar()) then + self:SetItem(closestQuestLink, closestQuestTexture) + elseif(self:IsShown()) then + self:RemoveItem() + end + + if(numItems > 0 and not ticker) then + ticker = C_Timer.NewTicker(30, function() -- might want to lower this + Button:Update() + end) + elseif(numItems == 0 and ticker) then + ticker:Cancel() + ticker = nil + end +end +--[[ +########################################################## +PACKAGE CALL +########################################################## +]]-- +function MOD:InitializeButton() + Button:SetPoint('CENTER', UIParent, 'CENTER', 0, 0) + Button:SetSize(50,50) + Button:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]]) + Button:SetPushedTexture([[Interface\Buttons\CheckButtonHilight]]) + Button:GetPushedTexture():SetBlendMode('ADD') + Button:SetScript('OnLeave', GameTooltip_Hide) + Button:SetAttribute('type', 'item') + Button.updateTimer = 0 + Button.rangeTimer = 0 + Button:Hide() + +Button:RegisterEvent('UPDATE_BINDINGS') +Button:RegisterEvent('UPDATE_EXTRA_ACTIONBAR') +Button:RegisterEvent('BAG_UPDATE_COOLDOWN') +Button:RegisterEvent('BAG_UPDATE_DELAYED') +Button:RegisterEvent('WORLD_MAP_UPDATE') +Button:RegisterEvent('QUEST_LOG_UPDATE') +Button:RegisterEvent('QUEST_POI_UPDATE') + + self.QuestItem = Button +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/quest/components/ordering.lua b/Interface/AddOns/SVUI/packages/quest/components/ordering.lua new file mode 100644 index 0000000..0f92e02 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/quest/components/ordering.lua @@ -0,0 +1,223 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format = string.format; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; +--[[ TABLE METHODS ]]-- +local tremove, twipe = table.remove, table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local LSM = LibStub("LibSharedMedia-3.0") +local MOD = SV.SVQuest; +--[[ +########################################################## +EXTRA QUEST ITEM BUTTON +########################################################## +]]-- +local function AnchorBlock(block, anchorBlock, checkFit) + local module = block.module; + local blocksFrame = module.BlocksFrame; + local offsetY = module.blockOffsetY; + block:ClearAllPoints(); + if(anchorBlock) then + if(anchorBlock.isHeader) then + offsetY = module.fromHeaderOffsetY; + end + if(checkFit and (blocksFrame.contentsHeight + block.height - offsetY > blocksFrame.maxHeight)) then + return; + end + if(block.isHeader) then + offsetY = offsetY + anchorBlock.module.fromModuleOffsetY; + block:SetPoint("LEFT", OBJECTIVE_TRACKER_HEADER_OFFSET_X, 0); + else + block:SetPoint("LEFT", module.blockOffsetX, 0); + end + block:SetPoint("TOP", anchorBlock, "BOTTOM", 0, offsetY); + else + offsetY = 0; + if(checkFit and (blocksFrame.contentsHeight + block.height > blocksFrame.maxHeight)) then + return; + end + if(block.isHeader) then + block:SetPoint("TOPLEFT", blocksFrame.ScrollContents or blocksFrame, "TOPLEFT", OBJECTIVE_TRACKER_HEADER_OFFSET_X, offsetY); + else + block:SetPoint("TOPLEFT", blocksFrame.ScrollContents or blocksFrame, "TOPLEFT", module.blockOffsetX, offsetY); + end + end + return offsetY; +end + +local function InternalAddBlock(block) + local module = block.module or MOD.Prototype; + local blocksFrame = module.BlocksFrame; + block.nextBlock = nil; + local offsetY = AnchorBlock(block, blocksFrame.currentBlock, true); + if(not offsetY) then + return false; + end + if(not module.firstBlock and not block.isHeader) then + module.firstBlock = block; + end + if(blocksFrame.currentBlock) then + blocksFrame.currentBlock.nextBlock = block; + end + blocksFrame.currentBlock = block; + blocksFrame.contentsHeight = blocksFrame.contentsHeight + block.height - offsetY; + module.contentsAnimHeight = module.contentsAnimHeight + block.height; + module.contentsHeight = module.contentsHeight + block.height - offsetY; + return true; +end + +local function CanFitBlock(block, header) + local module = block.module; + local blocksFrame = module.BlocksFrame; + local offsetY; + if(not blocksFrame.currentBlock) then + offsetY = 0; + elseif(blocksFrame.currentBlock.isHeader) then + offsetY = module.fromHeaderOffsetY; + else + offsetY = block.module.blockOffsetY; + end + local totalHeight; + if(header) then + totalHeight = header.height - offsetY + block.height - module.fromHeaderOffsetY; + else + totalHeight = block.height - offsetY; + end + return (blocksFrame.contentsHeight + totalHeight) <= blocksFrame.maxHeight; +end + +function MOD:AddBlock(block, forceAdd) + local header = block.module.Header; + local blockAdded = false; + if(not header or header.added) then + blockAdded = InternalAddBlock(block); + elseif(CanFitBlock(block, header)) then + if(InternalAddBlock(header)) then + header.added = true; + if(not header:IsShown()) then + header:Show(); + if(header.animateReason and band(OBJECTIVE_TRACKER_UPDATE_REASON, header.animateReason ) > 0 and not header.animating) then + header.animating = true; + header.HeaderOpenAnim:Stop(); + header.HeaderOpenAnim:Play(); + end + end + blockAdded = InternalAddBlock(block); + end + end + if(not blockAdded) then + block.module.hasSkippedBlocks = true; + end + return blockAdded; +end + +function MOD:PushDown() + if(not BONUS_OBJECTIVE_TRACKER_MODULE.firstBlock or (not AUTO_QUEST_POPUP_TRACKER_MODULE.firstBlock and not QUEST_TRACKER_MODULE.firstBlock)) then + return; + end + local otherHeader, otherModule; + if(QUEST_TRACKER_MODULE.firstBlock) then + otherHeader = QUEST_TRACKER_MODULE.Header; + otherModule = QUEST_TRACKER_MODULE; + else + otherHeader = AUTO_QUEST_POPUP_TRACKER_MODULE.Header; + otherModule = AUTO_QUEST_POPUP_TRACKER_MODULE; + end + BONUS_OBJECTIVE_TRACKER_MODULE.Header:ClearAllPoints(); + otherHeader:ClearAllPoints(); + AnchorBlock(BONUS_OBJECTIVE_TRACKER_MODULE.Header, otherModule.lastBlock); + AnchorBlock(otherHeader, nil); + if(ACHIEVEMENT_TRACKER_MODULE.firstBlock) then + ACHIEVEMENT_TRACKER_MODULE.Header:ClearAllPoints(); + AnchorBlock(ACHIEVEMENT_TRACKER_MODULE.Header, BONUS_OBJECTIVE_TRACKER_MODULE.lastBlock); + end +end +--[[ +########################################################## +PACKAGE CALL +########################################################## +]]-- +function MOD:InitializeButton() + Button:SetPoint('CENTER', ExtraActionButton1) + Button:SetSize(ExtraActionButton1:GetSize()) + Button:SetScale(ExtraActionButton1:GetScale()) + Button:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]]) + Button:SetPushedTexture([[Interface\Buttons\CheckButtonHilight]]) + Button:GetPushedTexture():SetBlendMode('ADD') + Button:SetScript('OnLeave', GameTooltip_Hide) + Button:SetAttribute('type', 'item') + Button.updateTimer = 0 + Button.rangeTimer = 0 + Button:Hide() + + local Icon = Button:CreateTexture('$parentIcon', 'BACKGROUND') + Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + Icon:SetAllPoints() + Button.Icon = Icon + + local HotKey = Button:CreateFontString('$parentHotKey', nil, 'NumberFontNormal') + HotKey:SetPoint('BOTTOMRIGHT', -5, 5) + Button.HotKey = HotKey + + local Cooldown = CreateFrame('Cooldown', '$parentCooldown', Button, 'CooldownFrameTemplate') + Cooldown:ClearAllPoints() + Cooldown:SetPoint('TOPRIGHT', -2, -3) + Cooldown:SetPoint('BOTTOMLEFT', 2, 1) + Cooldown:Hide() + Button.Cooldown = Cooldown + + local Artwork = Button:CreateTexture('$parentArtwork', 'OVERLAY') + Artwork:SetPoint('CENTER', -2, 0) + Artwork:SetSize(256, 128) + Artwork:SetTexture([[Interface\ExtraButton\Amber]]) + Button.Artwork = Artwork + + Button:RegisterEvent('UPDATE_BINDINGS') + Button:RegisterEvent('UPDATE_EXTRA_ACTIONBAR') + Button:RegisterEvent('BAG_UPDATE_COOLDOWN') + Button:RegisterEvent('BAG_UPDATE_DELAYED') + Button:RegisterEvent('WORLD_MAP_UPDATE') + Button:RegisterEvent('QUEST_LOG_UPDATE') + Button:RegisterEvent('QUEST_POI_UPDATE') + + self.QuestItem = Button +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/quest/components/prototype.lua b/Interface/AddOns/SVUI/packages/quest/components/prototype.lua new file mode 100644 index 0000000..92ae576 --- /dev/null +++ b/Interface/AddOns/SVUI/packages/quest/components/prototype.lua @@ -0,0 +1,459 @@ +--[[ +############################################################################## +_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # + ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # + __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # + ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # + ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # + _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # + __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # + _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# + ___\///////////___________\///___________\/////////_____\///////////_# +############################################################################## +S U P E R - V I L L A I N - U I By: Munglunch # +############################################################################## +########################################################## +LOCALIZED LUA FUNCTIONS +########################################################## +]]-- +--[[ GLOBALS ]]-- +local _G = _G; +local unpack = _G.unpack; +local select = _G.select; +local pairs = _G.pairs; +local ipairs = _G.ipairs; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format = string.format; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; +--[[ TABLE METHODS ]]-- +local tremove, twipe = table.remove, table.wipe; +--[[ +########################################################## +GET ADDON DATA +########################################################## +]]-- +local SV = select(2, ...) +local L = SV.L +local LSM = LibStub("LibSharedMedia-3.0") +local MOD = SV.SVQuest; +--[[ +########################################################## +LOCALS +########################################################## +]]-- +MOD.Prototype = { + blockTemplate = "SVUI_QuestTrackerBlockTemplate", + blockType = "Frame", + lineTemplate = "SVUI_QuestTrackerLineTemplate", + lineSpacing = 2, + freeBlocks = {}, + usedBlocks = {}, + freeLines = {}, + blockOffsetX = 0, + blockOffsetY = -6, + fromHeaderOffsetY = -10, + fromModuleOffsetY = -10, + contentsHeight = 0, + contentsAnimHeight = 0, + oldContentsHeight = 0, + hasSkippedBlocks = false, + usedTimerBars = {}, + freeTimerBars = {}, + usedProgressBars = {}, + freeProgressBars = {}, + updateReasonModule = 0, + updateReasonEvents = 0, +}; +--[[ +########################################################## +MODULE PROTOTYPE +########################################################## +]]-- +function MOD.Prototype:BeginLayout(isStaticReanchor) + self.firstBlock = nil; + self.lastBlock = nil; + self.oldContentsHeight = self.contentsHeight; + self.contentsHeight = 0; + self.contentsAnimHeight = 0; + if(not isStaticReanchor) then + self.hasSkippedBlocks = false; + end + self:MarkBlocksUnused(); +end + +function MOD.Prototype:EndLayout(isStaticReanchor) + self.lastBlock = self.BlocksFrame.currentBlock; + self:FreeUnusedBlocks(); +end + +function MOD.Prototype:SetHeader(block, text, animateReason) + block.module = self; + block.isHeader = true; + block.Text:SetText(text); + block.animateReason = animateReason or 0; + self.Header = block; +end + +function MOD.Prototype:GetBlock(id) + local block = self.usedBlocks[id]; + if(not block) then + local numFreeBlocks = #self.freeBlocks; + if(numFreeBlocks > 0) then + block = self.freeBlocks[numFreeBlocks]; + tremove(self.freeBlocks, numFreeBlocks); + else + block = CreateFrame(self.blockType, nil, self.BlocksFrame or ObjectiveTrackerFrame.BlocksFrame, self.blockTemplate); + block.lines = {}; + end + self.usedBlocks[id] = block; + block.module = self; + block.id = id; + end + block.used = true; + block.height = 0; + block.currentLine = nil; + + if(block.lines) then + for objectiveKey, line in pairs(block.lines) do + line.used = nil; + end + end + + return block; +end + +function MOD.Prototype:GetExistingBlock(id) + return self.usedBlocks[id]; +end + +function MOD.Prototype:MarkBlocksUnused() + for _, block in pairs(self.usedBlocks) do + block.used = nil; + end +end + +function MOD.Prototype:FreeBlock(block) + for _, line in pairs(block.lines) do + self:FreeLine(block, line); + end + block.lines = {}; + tinsert(self.freeBlocks, block); + self.usedBlocks[block.id] = nil; + block:Hide(); + if(self.OnFreeBlock) then + self:OnFreeBlock(block); + end +end + +function MOD.Prototype:FreeUnusedBlocks() + for questID, block in pairs(self.usedBlocks) do + if(not block.used) then + self:FreeBlock(block); + end + end +end + +function MOD.Prototype:FreeLine(block, line) + block.lines[line.objectiveKey] = nil; + local freeLines = (line.type and line.type.freeLines) or self.freeLines; + tinsert(freeLines, line); + if(line.TimerBar) then + self:FreeTimerBar(block, line); + end + if(line.ProgressBar) then + self:FreeProgressBar(block, line); + end + if(line.type and self.OnFreeTypedLine) then + self:OnFreeTypedLine(line); + elseif(self.OnFreeLine) then + self:OnFreeLine(line); + end + line:Hide(); +end + +function MOD.Prototype:FreeUnusedLines(block) + for objectiveKey, line in pairs(block.lines) do + if(not line.used) then + self:FreeLine(block, line); + end + end +end + +function MOD.Prototype:GetLine(block, objectiveKey, lineType) + local line = block.lines[objectiveKey]; + if(line and line.type ~= lineType) then + self:FreeLine(block, line); + line = nil; + end + + if(line) then + line.used = true; + return line; + end + + local freeLines = (lineType and lineType.freeLines) or self.freeLines; + local numFreeLines = #freeLines; + local parent = block.ScrollContents or block; + if(numFreeLines > 0) then + line = freeLines[numFreeLines]; + tremove(freeLines, numFreeLines); + line:SetParent(parent); + line:Show(); + else + line = CreateFrame("Frame", nil, parent, (lineType and lineType.template) or self.lineTemplate); + line.type = lineType; + end + block.lines[objectiveKey] = line; + line.objectiveKey = objectiveKey; + line.used = true; + return line; +end + +function MOD.Prototype:AddObjective(block, objectiveKey, text, lineType, useFullHeight, hideDash, colorStyle) + local line = self:GetLine(block, objectiveKey, lineType); + if(block.lineWidth ~= line.width) then + line.Text:SetWidth(block.lineWidth or self.lineWidth); + line.width = block.lineWidth; -- default should be nil + end + if(hideDash and not line.hideDash) then + line.Dash:Hide(); + line.hideDash = true; + elseif(not hideDash and line.hideDash) then + line.Dash:Show(); + line.hideDash = nil; + end + local height = self:SetStringText(line.Text, text, useFullHeight, colorStyle, block.isHighlighted); + line:SetHeight(height); + block.height = block.height + height + block.module.lineSpacing; + local anchor = block.currentLine or block.HeaderText; + if(anchor) then + line:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -block.module.lineSpacing); + else + line:SetPoint("TOPLEFT", 0, -block.module.lineSpacing); + end + block.currentLine = line; + return line; +end + +function MOD.Prototype:SetStringText(fontString, text, useFullHeight, colorStyle, useHighlight) + fontString:SetHeight(0); + fontString:SetText(text); + local stringHeight = fontString:GetHeight(); + if(stringHeight > OBJECTIVE_TRACKER_DOUBLE_LINE_HEIGHT and not useFullHeight) then + fontString:SetHeight(OBJECTIVE_TRACKER_DOUBLE_LINE_HEIGHT); + stringHeight = OBJECTIVE_TRACKER_DOUBLE_LINE_HEIGHT; + end + colorStyle = colorStyle or OBJECTIVE_TRACKER_COLOR["Normal"]; + if(useHighlight and colorStyle.reverse) then + colorStyle = colorStyle.reverse; + end + if(fontString.colorStyle ~= colorStyle) then + fontString:SetTextColor(colorStyle.r, colorStyle.g, colorStyle.b); + fontString.colorStyle = colorStyle; + end + return stringHeight; +end + +function MOD.Prototype:SetBlockHeader(block, text) + local height = self:SetStringText(block.HeaderText, text, nil, OBJECTIVE_TRACKER_COLOR["Header"], block.isHighlighted); + block.height = height; +end + +function MOD.Prototype:OnBlockHeaderClick(block, mouseButton) +end + +function MOD.Prototype:OnBlockHeaderEnter(block) + block.isHighlighted = true; + if(block.HeaderText) then + local headerColorStyle = OBJECTIVE_TRACKER_COLOR["HeaderHighlight"]; + block.HeaderText:SetTextColor(headerColorStyle.r, headerColorStyle.g, headerColorStyle.b); + block.HeaderText.colorStyle = headerColorStyle; + end + for objectiveKey, line in pairs(block.lines) do + local colorStyle = line.Text.colorStyle.reverse; + if(colorStyle) then + line.Text:SetTextColor(colorStyle.r, colorStyle.g, colorStyle.b); + line.Text.colorStyle = colorStyle; + if(line.Dash) then + line.Dash:SetTextColor(OBJECTIVE_TRACKER_COLOR["NormalHighlight"].r, OBJECTIVE_TRACKER_COLOR["NormalHighlight"].g, OBJECTIVE_TRACKER_COLOR["NormalHighlight"].b); + end + end + end +end + +function MOD.Prototype:OnBlockHeaderLeave(block) + block.isHighlighted = nil; + if(block.HeaderText) then + local headerColorStyle = OBJECTIVE_TRACKER_COLOR["Header"]; + block.HeaderText:SetTextColor(headerColorStyle.r, headerColorStyle.g, headerColorStyle.b); + block.HeaderText.colorStyle = headerColorStyle; + end + for objectiveKey, line in pairs(block.lines) do + local colorStyle = line.Text.colorStyle.reverse; + if(colorStyle) then + line.Text:SetTextColor(colorStyle.r, colorStyle.g, colorStyle.b); + line.Text.colorStyle = colorStyle; + if(line.Dash) then + line.Dash:SetTextColor(OBJECTIVE_TRACKER_COLOR["Normal"].r, OBJECTIVE_TRACKER_COLOR["Normal"].g, OBJECTIVE_TRACKER_COLOR["Normal"].b); + end + end + end +end + +function MOD.Prototype:AddTimerBar(block, line, duration, startTime) + local timerBar = self.usedTimerBars[block] and self.usedTimerBars[block][line]; + if(not timerBar) then + local numFreeTimerBars = #self.freeTimerBars; + local parent = block.ScrollContents or block; + if(numFreeTimerBars > 0) then + timerBar = self.freeTimerBars[numFreeTimerBars]; + tremove(self.freeTimerBars, numFreeTimerBars); + timerBar:SetParent(parent); + timerBar:Show(); + else + timerBar = CreateFrame("Frame", nil, parent, "SVUI_QuestTrackerTimerBarTemplate"); + timerBar.Label:SetPoint("LEFT", OBJECTIVE_TRACKER_DASH_WIDTH, 0); + timerBar.height = timerBar:GetHeight(); + end + if(not self.usedTimerBars[block]) then + self.usedTimerBars[block] = {}; + end + self.usedTimerBars[block][line] = timerBar; + timerBar:Show(); + end + local anchor = block.currentLine or block.HeaderText; + if(anchor) then + timerBar:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -block.module.lineSpacing); + else + timerBar:SetPoint("TOPLEFT", 0, -block.module.lineSpacing); + end + + timerBar.Bar:SetMinMaxValues(0, duration); + timerBar.duration = duration; + timerBar.startTime = startTime; + timerBar.block = block; + + line.TimerBar = timerBar; + block.height = block.height + timerBar.height + block.module.lineSpacing; + block.currentLine = timerBar; + return timerBar; +end + +function MOD.Prototype:FreeTimerBar(block, line) + local timerBar = line.TimerBar; + if(timerBar) then + self.usedTimerBars[block][line] = nil; + tinsert(self.freeTimerBars, timerBar); + timerBar:Hide(); + line.TimerBar = nil; + end +end + +function MOD.Prototype:AddProgressBar(block, line, questID) + local progressBar = self.usedProgressBars[block] and self.usedProgressBars[block][line]; + if(not progressBar) then + local numFreeProgressBars = #self.freeProgressBars; + local parent = block.ScrollContents or block; + if(numFreeProgressBars > 0) then + progressBar = self.freeProgressBars[numFreeProgressBars]; + tremove(self.freeProgressBars, numFreeProgressBars); + progressBar:SetParent(parent); + progressBar:Show(); + else + progressBar = CreateFrame("Frame", nil, parent, "SVUI_QuestTrackerProgressBarTemplate"); + progressBar.height = progressBar:GetHeight(); + end + if(not self.usedProgressBars[block]) then + self.usedProgressBars[block] = { }; + end + self.usedProgressBars[block][line] = progressBar; + progressBar:RegisterEvent("QUEST_LOG_UPDATE"); + progressBar:Show(); + progressBar.Bar.Label:Hide(); + progressBar.questID = questID; + MOD.SetProgressBarValue(progressBar, GetQuestProgressBarPercent(questID)); + end + local anchor = block.currentLine or block.HeaderText; + if(anchor) then + progressBar:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -block.module.lineSpacing); + else + progressBar:SetPoint("TOPLEFT", 0, -block.module.lineSpacing); + end + progressBar.block = block; + progressBar.questID = questID; + line.ProgressBar = progressBar; + block.height = block.height + progressBar.height + block.module.lineSpacing; + block.currentLine = progressBar; + return progressBar; +end + +function MOD.Prototype:FreeProgressBar(block, line) + local progressBar = line.ProgressBar; + if(progressBar) then + self.usedProgressBars[block][line] = nil; + tinsert(self.freeProgressBars, progressBar); + progressBar:Hide(); + line.ProgressBar = nil; + progressBar:UnregisterEvent("QUEST_LOG_UPDATE"); + end +end + +function MOD.Prototype:StaticReanchor() + local block = self.firstBlock; + self:BeginLayout(true); + while(block) do + if(block.module == self) then + local nextBlock = block.nextBlock; + if(ObjectiveTracker_AddBlock(block)) then + block.used = true; + block:Show(); + block = nextBlock; + else + block.used = false; + block:Hide(); + break; + end + else + break; + end + end + self:EndLayout(true); +end +--[[ +########################################################## +PACKAGE CALL +########################################################## +]]-- +function MOD:GetModulePrototype() + local info = {}; + setmetatable(info, { __index = self.Prototype; }); + return info; +end + +function MOD:InitializePrototype() + local tracker = self.Tracker + local line = CreateFrame("Frame", nil, tracker, self.Prototype.lineTemplate); + line.Text:SetText("Double line|ntest"); + tinsert(self.Prototype.freeLines, line); + OBJECTIVE_TRACKER_DOUBLE_LINE_HEIGHT = math.ceil(line.Text:GetStringHeight()); + OBJECTIVE_TRACKER_DASH_WIDTH = line.Dash:GetWidth(); + OBJECTIVE_TRACKER_TEXT_WIDTH = OBJECTIVE_TRACKER_LINE_WIDTH - OBJECTIVE_TRACKER_DASH_WIDTH - 12; + self.Prototype.lineWidth = OBJECTIVE_TRACKER_TEXT_WIDTH; + self.Prototype.BlocksFrame = tracker.BlocksFrame; + line.Text:SetWidth(OBJECTIVE_TRACKER_TEXT_WIDTH); + local frameLevel = tracker.BlocksFrame:GetFrameLevel(); + tracker.HeaderMenu:SetFrameLevel(frameLevel + 2); + tracker:RegisterEvent("PLAYER_ENTERING_WORLD"); + UIDropDownMenu_Initialize(tracker.BlockDropDown, nil, "MENU"); + QuestPOI_Initialize(tracker.BlocksFrame, function(self) self:SetScale(0.9); self:RegisterForClicks("LeftButtonUp", "RightButtonUp"); end ); +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua index ca7f83e..e8863df 100644 --- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua +++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua @@ -51,15 +51,16 @@ local _G = getfenv(0); local GameTooltip, GameTooltipStatusBar = _G["GameTooltip"], _G["GameTooltipStatusBar"]; local playerGUID = UnitGUID("player"); local targetList, inspectCache = {}, {}; -local NIL_COLOR = { r = 1, g = 1, b = 1 }; + +local NIL_COLOR = { r = 0, g = 0, b = 0 }; local TAPPED_COLOR = { r = .6, g = .6, b = .6 }; local SKULL_ICON = "|TInterface\\TARGETINGFRAME\\UI-TargetingFrame-Skull.blp:16:16|t"; local TAMABLE_INDICATOR = "|cffFFFF00Tamable|r"; -local TT_BG = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TOOLTIP]] -local TT_TOP = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-TOP]] -local TT_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-BOTTOM]] -local TT_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-RIGHT]] -local TT_LEFT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-LEFT]] +local TT_BG = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]]; +local TT_TOP = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-TOP]]; +local TT_BOTTOM = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-BOTTOM]]; +local TT_RIGHT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-RIGHT]]; +local TT_LEFT = [[Interface\Addons\SVUI\assets\artwork\Template\Tooltip\TT-LEFT]]; local TAMABLE_FAMILIES = { ["Basilisk"] = true, ["Bat"] = true, ["Bear"] = true, ["Beetle"] = true, @@ -74,7 +75,7 @@ local TAMABLE_FAMILIES = { ["Silithid"] = true, ["Spider"] = true, ["Sporebat"] = true, ["Tallstrider"] = true, ["Turtle"] = true, ["Warp Stalker"] = true, ["Wasp"] = true, ["Water strider"] = true, ["Wind Serpent"] = true, ["Wolf"] = true, ["Worm"] = true -} +}; local tooltips = { GameTooltip, ItemRefTooltip, ItemRefShoppingTooltip1, @@ -89,14 +90,40 @@ local tooltips = { GarrisonMissionMechanicTooltip, GarrisonFollowerTooltip, GarrisonMissionMechanicFollowerCounterTooltip, GarrisonFollowerAbilityTooltip, BuildingLevelTooltip -} +}; local classification = { worldboss = format("|cffAF5050%s|r", BOSS), rareelite = format("|cffAF5050+%s|r", ITEM_QUALITY3_DESC), elite = "|cffAF5050+|r", rare = format("|cffAF5050%s|r", ITEM_QUALITY3_DESC) -} +}; +--[[ +########################################################## +LOCAL UPVALUES +########################################################## +]]-- +local COMIC_TIPS = true; +local SPELL_IDS = false; +local ON_CURSOR = false; +local TARGET_INFO = true; +local PLAYER_INFO = true; +local INSPECT_INFO = false; +local GUILD_INFO = true; +local VISIBILITY_UNITS = "NONE"; +local VISIBILITY_COMBAT = false; +local BAR_TEXT = true; +local BAR_HEIGHT = 10; +local BAR_FONT = "Roboto"; +local BAR_FONTSIZE = 10; + +local VisibilityTest = { + NONE = function() return false end, + ALL = function() return true end, + SHIFT = function() return (not IsShiftKeyDown()) end, + CTRL = function() return (not IsControlKeyDown()) end, + ALT = function() return (not IsAltKeyDown()) end, +}; --[[ ########################################################## LOCAL FUNCTIONS @@ -173,7 +200,21 @@ end CORE FUNCTIONS ########################################################## ]]-- -local SetMaskBorder = function(self, r, g, b) +local SetMaskBorderColor = function(self, r, g, b, hasStatusBar) + if(COMIC_TIPS) then + local a = self.ToggleAlpha + if(hasStatusBar) then + self[1]:SetVertexColor(r, g, b, a) + --self[2]:SetVertexColor(r, g, b, a) + self[3]:SetVertexColor(0, 0, 0, 0) + self[4]:SetVertexColor(0, 0, 0, 0) + else + self[1]:SetVertexColor(0, 0, 0, 0) + --self[2]:SetVertexColor(0, 0, 0, 0) + self[3]:SetVertexColor(r, g, b, a) + self[4]:SetVertexColor(r, g, b, a) + end + end r,g,b = (r * 0.5),(g * 0.5),(b * 0.5) self[5]:SetTexture(r, g, b) self[6]:SetTexture(r, g, b) @@ -181,25 +222,18 @@ local SetMaskBorder = function(self, r, g, b) self[8]:SetTexture(r, g, b) end -local SetBurstColor = function(self, r, g, b) - local a = self.ToggleAlpha - self[1]:SetVertexColor(r, g, b, a) - --self[2]:SetVertexColor(r, g, b, a) - self[3]:SetVertexColor(0, 0, 0, 0) - self[4]:SetVertexColor(0, 0, 0, 0) - self:SetMaskBorder(r, g, b) -end - -local SetToneColor = function(self, r, g, b) - local a = self.ToggleAlpha - self[1]:SetVertexColor(0, 0, 0, 0) - --self[2]:SetVertexColor(0, 0, 0, 0) - self[3]:SetVertexColor(r, g, b, a) - self[4]:SetVertexColor(r, g, b, a) - self:SetMaskBorder(r, g, b) -end - local ClearMaskColors = function(self) + self:SetBackdrop({ + bgFile = TT_BG, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = true, + tileSize = 128, + edgeSize = 1, + insets = {left = 1, right = 1, top = 1, bottom = 1} + }) + self:SetBackdropColor(0, 0, 0, 1) + self:SetBackdropBorderColor(0, 0, 0, 1) + self[1]:SetVertexColor(0, 0, 0, 0) --self[2]:SetVertexColor(0, 0, 0, 0) self[3]:SetVertexColor(0, 0, 0, 0) @@ -275,31 +309,66 @@ local function tiplevel(this, start) end end +local function tipbackground(this) + this:SetBackdrop({ + bgFile = TT_BG, + edgeFile = [[Interface\BUTTONS\WHITE8X8]], + tile = true, + tileSize = 128, + edgeSize = 1, + insets = {left = 1, right = 1, top = 1, bottom = 1} + }) + this:SetBackdropColor(0, 0, 0, 0) + this:SetBackdropBorderColor(0, 0, 0, 0) + if(this.SuperBorder) then + --this.SuperBorder:ClearMaskColors() + if(not GameTooltipStatusBar:IsShown()) then + this.SuperBorder:ClearAllPoints() + this.SuperBorder:SetPoint("TOPLEFT", this, "TOPLEFT", 0, 0) + this.SuperBorder:SetPoint("BOTTOMRIGHT", this, "BOTTOMRIGHT", 0, 0) + end + end +end + +local function tipupdate(this, color, hasStatusBar) + if(hasStatusBar) then + local barColor = color or TAPPED_COLOR + GameTooltipStatusBar:SetStatusBarColor(barColor.r, barColor.g, barColor.b) + end + if(this.SuperBorder) then + local mask = this.SuperBorder + local borderColor = color or NIL_COLOR + local yOffset = (hasStatusBar) and mask.ToggleHeight or 0; + mask:ClearMaskColors() + mask:ClearAllPoints() + mask:SetPoint("TOPLEFT", this, "TOPLEFT", 0, 0) + mask:SetPoint("BOTTOMRIGHT", this, "BOTTOMRIGHT", 0, yOffset) + mask:SetMaskBorderColor(borderColor.r, borderColor.g, borderColor.b, hasStatusBar) + end +end + local _hook_GameTooltip_OnTooltipSetUnit = function(self) - local mask = self.SuperBorder - mask:ClearMaskColors() - mask:ClearAllPoints() - mask:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0) + tipbackground(self) local unit = select(2, self:GetUnit()) -- local TamablePet; - if self:GetOwner() ~= UIParent and SV.db.SVTip.visibility.unitFrames ~= "NONE" then - local vis = SV.db.SVTip.visibility.unitFrames; - if vis == "ALL" or not (vis == "SHIFT" and IsShiftKeyDown() or vis == "CTRL" and IsControlKeyDown() or vis == "ALT" and IsAltKeyDown()) then + if(self:GetOwner() ~= UIParent) then + if(VisibilityTest[VISIBILITY_UNITS] and VisibilityTest[VISIBILITY_UNITS]()) then self:Hide() return end - end + end if not unit then local mFocus = GetMouseFocus() if mFocus and mFocus:GetAttribute("unit") then unit = mFocus:GetAttribute("unit") end if not unit or not UnitExists(unit) then return end - end + end + tipcleaner(self) local unitLevel = UnitLevel(unit) - local colors, qColor, totColor; + local colors, burst, qColor, totColor; local lvlLine; local isShiftKeyDown = IsShiftKeyDown() @@ -310,12 +379,9 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) local pvpName = UnitPVPName(unit) local realmRelation = UnitRealmRelationship(unit) colors = RAID_CLASS_COLORS[classToken] + burst = SVUI_CLASS_COLORS[classToken] - local burst = SVUI_CLASS_COLORS[classToken] - - self.SuperBorder:SetBurstColor(burst.r, burst.g, burst.b) - - if SV.db.SVTip.playerTitles and pvpName then + if(PLAYER_INFO and pvpName) then unitName = pvpName end if unitRealm and unitRealm ~= "" then @@ -341,7 +407,7 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) guildName = guildName.."-"..guildRealm end - if guildRankName and SV.db.SVTip.guildRanks then + if(guildRankName and GUILD_INFO) then GameTooltipTextLeft2:SetText(("<|cff00ff10%s|r> [|cff00ff10%s|r]"):format(guildName, guildRankName)) else GameTooltipTextLeft2:SetText(("<|cff00ff10%s|r>"):format(guildName)) @@ -361,7 +427,7 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) lvlLine:SetFormattedText("|cff%02x%02x%02x%s|r %s |c%s%s|r", qColor.r * 255, qColor.g * 255, qColor.b * 255, unitLevel > 0 and unitLevel or SKULL_ICON, race or "", colors.colorStr, className) end - if(not IsAddOnLoaded("HealBot") and (SV.db.SVTip.inspectInfo or isShiftKeyDown)) then + if(not IsAddOnLoaded("HealBot") and (INSPECT_INFO or isShiftKeyDown)) then ShowInspectInfo(self, unit, unitLevel, colors.r, colors.g, colors.b, 0) end else @@ -369,8 +435,8 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) colors = TAPPED_COLOR else colors = FACTION_BAR_COLORS[UnitReaction(unit, "player")] - end - if(colors) then self.SuperBorder:SetToneColor(colors.r, colors.g, colors.b) end + end + lvlLine = tiplevel(self, 2) if(lvlLine) then @@ -412,7 +478,7 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) -- if(TamablePet) then -- self:AddLine(TAMABLE_INDICATOR) -- end - if SV.db.SVTip.targetInfo then + if(TARGET_INFO) then local unitTarget = unit.."target" if(unit ~= "player" and UnitExists(unitTarget)) then if UnitIsPlayer(unitTarget) and not UnitHasVehicleUI(unitTarget) then @@ -438,21 +504,11 @@ local _hook_GameTooltip_OnTooltipSetUnit = function(self) end end - if colors then - GameTooltipStatusBar:SetStatusBarColor(colors.r, colors.g, colors.b) - else - GameTooltipStatusBar:SetStatusBarColor(0.6, 0.6, 0.6) - end - - if(GameTooltipStatusBar:IsShown()) then - mask:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, mask.ToggleHeight) - else - mask:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0) - end + tipupdate(self, colors, GameTooltipStatusBar:IsShown()) end local _hook_GameTooltipStatusBar_OnValueChanged = function(self, value) - if not value or not SV.db.SVTip.healthBar.text or not self.text then return end + if((not value) or (not BAR_TEXT) or (not self.text)) then return end local tooltip = self:GetParent() local unit = select(2, tooltip:GetUnit()) if not unit then @@ -473,17 +529,17 @@ local _hook_GameTooltipStatusBar_OnValueChanged = function(self, value) end local _hook_GameTooltip_OnTooltipSetItem = function(self) + tipbackground(self) + local key,itemLink = self:GetItem() if(key and (not self.itemCleared)) then - self.SuperBorder:ClearMaskColors() - local quality = select(3, GetItemInfo(key)) if(quality) then local r,g,b = GetItemQualityColor(quality) - self.SuperBorder:SetToneColor(r,g,b) + self.SuperBorder:SetMaskBorderColor(r,g,b) end - if itemLink ~= nil and SV.db.SVTip.spellID then + if(SPELL_IDS and (itemLink ~= nil)) then self:AddLine(" ") left = "|cFFCA3C3CSpell ID: |r" local itemID = ("|cFFCA3C3C%s|r %s"):format(left, itemLink):match(":(%w+)") @@ -524,42 +580,46 @@ local _hook_GameTooltip_ShowStatusBar = function(self, ...) end local _hook_OnSetUnitAura = function(self, unit, index, filter) + tipbackground(self) + --self.SuperBorder:ClearMaskColors() + if(not SPELL_IDS) then return; end local _, _, _, _, _, _, _, caster, _, _, spellID = UnitAura(unit, index, filter) - if spellID and SV.db.SVTip.spellID then - self.SuperBorder:ClearMaskColors() + if(spellID) then + --self.SuperBorder:ClearMaskColors() if caster then local name = UnitName(caster) local _, class = UnitClass(caster) local color = RAID_CLASS_COLORS[class] if color then - self.SuperBorder:SetMaskBorder(color.r, color.g, color.b) + self.SuperBorder:SetMaskBorderColor(color.r, color.g, color.b) self:AddDoubleLine(("|cFFCA3C3C%s|r %d"):format(ID, spellID), format("|c%s%s|r", color.colorStr, name)) end else self:AddLine(("|cFFCA3C3C%s|r %d"):format(ID, spellID)) end self:Show() - end + end end local _hook_OnSetHyperUnitAura = function(self, unit, index, filter) + tipbackground(self) + --self.SuperBorder:ClearMaskColors() if unit ~= "player" then return end local auraName, _, _, _, _, _, _, caster, _, shouldConsolidate, spellID = UnitAura(unit, index, filter) if shouldConsolidate then - self.SuperBorder:ClearMaskColors() if caster then local name = UnitName(caster) local _, class = UnitClass(caster) local color = RAID_CLASS_COLORS[class] if color then - self.SuperBorder:SetMaskBorder(color.r, color.g, color.b) + self.SuperBorder:SetMaskBorderColor(color.r, color.g, color.b) self:AddDoubleLine(("|cFFCA3C3C%s|r"):format(auraName), format("|c%s%s|r", color.colorStr, name)) end else self:AddLine(("|cFFCA3C3C%s|r"):format(auraName)) end self:Show() - end + end end local _hook_GameTooltip_OnTooltipSetSpell = function(self) @@ -576,21 +636,21 @@ local _hook_GameTooltip_OnTooltipSetSpell = function(self) end end if not check then + tipbackground(self) self.SuperBorder:ClearMaskColors() self:AddLine(text) self:Show() - end + end end local _hook_GameTooltip_SetDefaultAnchor = function(self, parent) - if SV.db.SVTip.enable ~= true then return end if(self:GetAnchorType() ~= "ANCHOR_NONE") then return end - if InCombatLockdown() and SV.db.SVTip.visibility.combat then + if(InCombatLockdown() and VISIBILITY_COMBAT) then self:Hide() return end if parent then - if(SV.db.SVTip.cursorAnchor) then + if(ON_CURSOR) then self:SetOwner(parent, "ANCHOR_CURSOR") return else @@ -631,6 +691,8 @@ local _hook_BNToastOnShow = function(self,anchor,parent,relative,x,y) end local _hook_OnTipCleared = function(self) + tipbackground(self) + self.SuperBorder:ClearMaskColors() self.itemCleared = nil end @@ -659,57 +721,33 @@ local Override_BorderColor = function(self, r, g, b, a) if(b ~= 0 or (a and a ~= 0)) then self:SetBackdropBorderColor(0, 0, 0, 0) self.SuperBorder:SetBackdropBorderColor(0, 0, 0) - self.SuperBorder:SetToneColor(r, g, b) + self.SuperBorder:SetMaskBorderColor(r, g, b) end end local _hook_OnTipShow = function(self) - local width,height = self:GetSize() - local heightScale = min(64, height) - local widthScale = min(128, width) - local heightWidth = widthScale * 0.35 - - self:SetBackdrop({ - bgFile = TT_BG, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = true, - tileSize = 128, - edgeSize = 1, - insets = {left = 1, right = 1, top = 1, bottom = 1} - }) - self:SetBackdropColor(0, 0, 0, 0) - self:SetBackdropBorderColor(0, 0, 0, 0) - - local mask = self.SuperBorder - - mask[1]:SetSize(widthScale,heightWidth) - mask[2]:SetSize(widthScale,heightWidth) - mask[3]:SetSize(heightScale,heightScale) - mask[4]:SetSize(heightScale,heightScale) - - mask:SetBackdrop({ - bgFile = TT_BG, - edgeFile = [[Interface\BUTTONS\WHITE8X8]], - tile = true, - tileSize = 128, - edgeSize = 1, - insets = {left = 1, right = 1, top = 1, bottom = 1} - }) - mask:SetBackdropColor(0, 0, 0, 1) - mask:SetBackdropBorderColor(0, 0, 0, 1) - - if(not GameTooltipStatusBar:IsShown()) then - mask:ClearAllPoints() - mask:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0) - mask:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0) - end + tipbackground(self) end local _hook_OnTipHide = function(self) + tipbackground(self) self.SuperBorder:ClearMaskColors() wipe(self.InjectedDouble) end +local _hook_OnSizeChanged = function(self) + if((not COMIC_TIPS) or (not self.SuperBorder)) then return; end + local height = self:GetHeight() or 32 + local heightScale = min(64, height) + local width = self:GetWidth() or 64 + local widthScale = min(128, width) + self.SuperBorder[1]:SetSize(widthScale,(widthScale * 0.35)) + self.SuperBorder[2]:SetSize(widthScale,(widthScale * 0.35)) + self.SuperBorder[3]:SetSize(heightScale,heightScale) + self.SuperBorder[4]:SetSize(heightScale,heightScale) +end + + local function ApplyTooltipSkins() local barHeight = GameTooltipStatusBar:GetHeight() @@ -804,9 +842,8 @@ local function ApplyTooltipSkins() mask:SetBackdropColor(0, 0, 0, 1) mask:SetBackdropBorderColor(0, 0, 0) - mask.SetMaskBorder = SetMaskBorder - mask.SetBurstColor = SetBurstColor - mask.SetToneColor = SetToneColor + mask.SetMaskBorderColor = SetMaskBorderColor + mask.SetMaskBurstColor = SetMaskBurstColor mask.ClearMaskColors = ClearMaskColors tooltip.SuperBorder = mask @@ -863,11 +900,11 @@ local function ApplyTooltipSkins() tooltip:SetBackdropColor(0, 0, 0, 0) tooltip:SetBackdropBorderColor(0, 0, 0, 0) - tooltip.SetBackdrop = Override_BG NewHook(tooltip, "SetBackdropColor", Override_BGColor) NewHook(tooltip, "SetBackdropBorderColor", Override_BorderColor) tooltip:HookScript("OnShow", _hook_OnTipShow) tooltip:HookScript("OnHide", _hook_OnTipHide) + tooltip:HookScript("OnSizeChanged", _hook_OnSizeChanged) end tremove(tooltips, i) end @@ -876,6 +913,22 @@ local function ApplyTooltipSkins() end end +function MOD:UpdateLocals() + COMIC_TIPS = SV.db.SVTip.comicStyle; + VISIBILITY_COMBAT = SV.db.SVTip.visibility.combat; + BAR_HEIGHT = SV.db.SVTip.healthBar.height; + BAR_FONT = SV.db.SVTip.healthBar.font; + BAR_FONTSIZE = SV.db.SVTip.healthBar.fontSize; + SPELL_IDS = SV.db.SVTip.spellID; + ON_CURSOR = SV.db.SVTip.cursorAnchor; + BAR_TEXT = SV.db.SVTip.healthBar.text; + TARGET_INFO = SV.db.SVTip.targetInfo; + PLAYER_INFO = SV.db.SVTip.playerTitles; + INSPECT_INFO = SV.db.SVTip.inspectInfo; + GUILD_INFO = SV.db.SVTip.guildRanks; + VISIBILITY_UNITS = SV.db.SVTip.visibility.unitFrames; +end + function MOD:ReLoad() if(not self.AllSkinned) then ApplyTooltipSkins() @@ -883,11 +936,7 @@ function MOD:ReLoad() end function MOD:Load() - BNToastFrame:ClearAllPoints() - BNToastFrame:Point("BOTTOMRIGHT", SV.Dock.BottomLeft, "TOPRIGHT", 0, 20) - SV.Mentalo:Add(BNToastFrame, L["BattleNet Frame"], nil, nil, "BattleNetToasts") - NewHook(BNToastFrame, "SetPoint", _hook_BNToastOnShow) - if not SV.db.SVTip.enable then return end + self:UpdateLocals() local anchor = CreateFrame("Frame", "SVUI_ToolTip", UIParent) anchor:Point("BOTTOMLEFT", SV.Dock.BottomRight, "TOPLEFT", 0, 24) @@ -895,10 +944,14 @@ function MOD:Load() anchor:SetFrameLevel(anchor:GetFrameLevel() + 50) SV.Mentalo:Add(anchor, L["Tooltip"]) - local barHeight = SV.db.SVTip.healthBar.height - GameTooltipStatusBar:SetHeight(barHeight) + GameTooltipStatusBar:SetHeight(BAR_HEIGHT) GameTooltipStatusBar:SetStatusBarTexture(SV.Media.bar.default) + BNToastFrame:ClearAllPoints() + BNToastFrame:Point("BOTTOMRIGHT", SV.Dock.BottomLeft, "TOPRIGHT", 0, 20) + SV.Mentalo:Add(BNToastFrame, L["BattleNet Frame"], nil, nil, "BattleNetToasts") + NewHook(BNToastFrame, "SetPoint", _hook_BNToastOnShow) + ApplyTooltipSkins() GameTooltipStatusBar:ClearAllPoints() @@ -906,7 +959,7 @@ function MOD:Load() GameTooltipStatusBar:SetPoint("BOTTOMRIGHT", GameTooltip.SuperBorder, "BOTTOMRIGHT", -3, 3) GameTooltipStatusBar.text = GameTooltipStatusBar:CreateFontString(nil, "OVERLAY") GameTooltipStatusBar.text:Point("CENTER", GameTooltipStatusBar, "CENTER", 0, 0) - GameTooltipStatusBar.text:FontManager(LSM:Fetch("font", SV.db.SVTip.healthBar.font), SV.db.SVTip.healthBar.fontSize, "OUTLINE") + GameTooltipStatusBar.text:FontManager(LSM:Fetch("font", BAR_FONT), BAR_FONTSIZE, "OUTLINE") if not GameTooltipStatusBar.border then @@ -928,7 +981,7 @@ function MOD:Load() NewHook(GameTooltip, "SetUnitDebuff", _hook_OnSetUnitAura) NewHook(GameTooltip, "SetUnitConsolidatedBuff", _hook_OnSetHyperUnitAura) - if SV.db.SVTip.spellID then + if(SPELL_IDS) then NewHook("SetItemRef", _hook_OnItemRef) GameTooltip:HookScript("OnTooltipSetSpell", _hook_GameTooltip_OnTooltipSetSpell) end diff --git a/Interface/AddOns/SVUI/packages/tools/components/questwatch.lua b/Interface/AddOns/SVUI/packages/tools/components/questwatch.lua index 6dc636d..7a0b791 100644 --- a/Interface/AddOns/SVUI/packages/tools/components/questwatch.lua +++ b/Interface/AddOns/SVUI/packages/tools/components/questwatch.lua @@ -157,11 +157,15 @@ function MOD:LoadQuestWatch() ObjectiveTrackerFrame:SetPoint("TOPRIGHT", listFrame, "TOPRIGHT", -2, 0) ObjectiveTrackerFrame:SetFrameLevel(listFrame:GetFrameLevel() + 1) - hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self, a1, p, a2, x, y) - if(p ~= SVUI_QuestWatchFrameScrollFrame) then - self:SetPoint("TOPRIGHT", SVUI_QuestWatchFrameScrollFrame, "TOPRIGHT", -2, 0) - end + ObjectiveTrackerFrame:HookScript("OnEvent", function(self) + self:SetPoint("TOPRIGHT", SVUI_QuestWatchFrameScrollFrame, "TOPRIGHT", -2, 0) end) + + -- hooksecurefunc(ObjectiveTrackerFrame, "SetPoint", function(self, a1, p, a2, x, y) + -- if(p ~= SVUI_QuestWatchFrameScrollFrame) then + -- self:SetPoint("TOPRIGHT", SVUI_QuestWatchFrameScrollFrame, "TOPRIGHT", -2, 0) + -- end + -- end) --ObjectiveTrackerFrame.SetPoint = function() return end; ObjectiveTrackerFrame.HeaderMenu.MinimizeButton:Hide() diff --git a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua index ce9332a..6f1bc2e 100644 --- a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua +++ b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua @@ -66,6 +66,15 @@ if(not MOD) then return end LOCALS ########################################################## ]]-- +local _hook_ActionPanel_OnSizeChanged = function(self) + local width,height = self:GetSize() + local widthScale = min(128, width) + local heightScale = widthScale * 0.25 + + self.special[1]:SetSize(widthScale, heightScale) + self.special[2]:SetSize(widthScale, heightScale) + self.special[3]:SetSize(height * 0.5, height) +end -- local MISSING_MODEL_FILE = [[Spells\Blackmagic_precast_base.m2]]; -- local MISSING_MODEL_FILE = [[Spells\Crow_baked.m2]]; -- local MISSING_MODEL_FILE = [[Spells\monsterlure01.m2]]; @@ -380,33 +389,37 @@ function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) if(unit == "target") then frame.ActionPanel:SetFrameLevel(1) - frame.ActionPanel.special = CreateFrame("Frame", nil, frame.ActionPanel) - frame.ActionPanel.special:SetAllPoints(frame) - frame.ActionPanel.special:SetFrameStrata("BACKGROUND") - frame.ActionPanel.special:SetFrameLevel(0) - frame.ActionPanel.special[1] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[1]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "TOPLEFT", 0, 0) - frame.ActionPanel.special[1]:SetPoint("BOTTOMRIGHT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) - frame.ActionPanel.special[1]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) - frame.ActionPanel.special[1]:SetTexture(ELITE_TOP) - frame.ActionPanel.special[1]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[1]:SetBlendMode("BLEND") - frame.ActionPanel.special[2] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[2]:SetPoint("TOPLEFT", frame.ActionPanel.special, "BOTTOMLEFT", 0, 0) - frame.ActionPanel.special[2]:SetPoint("TOPRIGHT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) - frame.ActionPanel.special[2]:SetHeight(frame.ActionPanel:GetWidth() * 0.15) - frame.ActionPanel.special[2]:SetTexture(ELITE_BOTTOM) - frame.ActionPanel.special[2]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[2]:SetBlendMode("BLEND") - frame.ActionPanel.special[3] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) - frame.ActionPanel.special[3]:SetPoint("TOPLEFT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) - frame.ActionPanel.special[3]:SetPoint("BOTTOMLEFT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) - frame.ActionPanel.special[3]:SetWidth(frame.ActionPanel:GetHeight() * 2.25) - frame.ActionPanel.special[3]:SetTexture(ELITE_RIGHT) - frame.ActionPanel.special[3]:SetVertexColor(1, 0.75, 0) - frame.ActionPanel.special[3]:SetBlendMode("BLEND") - frame.ActionPanel.special:SetAlpha(0.7) - frame.ActionPanel.special:Hide() + if(SV.db.SVUnit.comicStyle) then + frame.ActionPanel.special = CreateFrame("Frame", nil, frame.ActionPanel) + frame.ActionPanel.special:SetAllPoints(frame) + frame.ActionPanel.special:SetFrameStrata("BACKGROUND") + frame.ActionPanel.special:SetFrameLevel(0) + frame.ActionPanel.special[1] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[1]:SetPoint("BOTTOMRIGHT", frame.ActionPanel.special, "TOPRIGHT", 0, 0) + frame.ActionPanel.special[1]:SetWidth(frame.ActionPanel:GetWidth()) + frame.ActionPanel.special[1]:SetHeight(frame.ActionPanel:GetWidth() * 0.25) + frame.ActionPanel.special[1]:SetTexture(ELITE_TOP) + frame.ActionPanel.special[1]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[1]:SetBlendMode("BLEND") + frame.ActionPanel.special[2] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[2]:SetPoint("TOPRIGHT", frame.ActionPanel.special, "BOTTOMRIGHT", 0, 0) + frame.ActionPanel.special[2]:SetWidth(frame.ActionPanel:GetWidth()) + frame.ActionPanel.special[2]:SetHeight(frame.ActionPanel:GetWidth() * 0.25) + frame.ActionPanel.special[2]:SetTexture(ELITE_BOTTOM) + frame.ActionPanel.special[2]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[2]:SetBlendMode("BLEND") + frame.ActionPanel.special[3] = frame.ActionPanel.special:CreateTexture(nil, "OVERLAY", nil, 1) + frame.ActionPanel.special[3]:SetPoint("LEFT", frame.ActionPanel.special, "RIGHT", 0, 0) + frame.ActionPanel.special[3]:SetHeight(frame.ActionPanel:GetHeight()) + frame.ActionPanel.special[3]:SetWidth(frame.ActionPanel:GetHeight() * 0.5) + frame.ActionPanel.special[3]:SetTexture(ELITE_RIGHT) + frame.ActionPanel.special[3]:SetVertexColor(1, 0.75, 0) + frame.ActionPanel.special[3]:SetBlendMode("BLEND") + frame.ActionPanel.special:SetAlpha(0.7) + frame.ActionPanel.special:Hide() + + frame.ActionPanel:SetScript("OnSizeChanged", _hook_ActionPanel_OnSizeChanged) + end frame.ActionPanel.class = CreateFrame("Frame", nil, frame.InfoPanel) frame.ActionPanel.class:Size(18) diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index b09fe14..5411f14 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -296,6 +296,14 @@ function PLUGIN:RegisterAddonDocklets() self.Docklet.Dock2.FrameLink = nil; if(enabled1) then + local width = self.Docklet:GetWidth(); + if(enabled2) then + self.Docklet.Dock1:SetWidth(width * 0.5) + self.Docklet.Dock2:SetWidth(width * 0.5) + else + self.Docklet.Dock1:SetWidth(width) + end + if(self:DockletReady("Skada", dock1)) then tipLeft = "Skada"; self:Docklet_Skada() @@ -345,16 +353,12 @@ function PLUGIN:RegisterAddonDocklets() if(activated) then self.Docklet:Enable(); - local width = self.Docklet:GetWidth(); if(enabled2) then self.Docklet.Dock1:Show() - self.Docklet.Dock1:SetWidth(width * 0.5) self.Docklet.Dock2:Show() - self.Docklet.Dock2:SetWidth(width * 0.5) else self.Docklet.Dock1:Show() self.Docklet.Dock2:Hide() - self.Docklet.Dock1:SetWidth(width) end self.Docklet.DockButton:SetAttribute("tipText", ("%s%s"):format(tipLeft, tipRight)); @@ -549,8 +553,8 @@ function PLUGIN:Load() local dockWidth = self.Docklet:GetWidth() self.Docklet.Dock1 = CreateFrame("Frame", "SVUI_StyleOMaticDockAddon1", self.Docklet); - self.Docklet.Dock1:SetPoint('TOPLEFT', self.Docklet, 'TOPLEFT', 0, 0); - self.Docklet.Dock1:SetPoint('BOTTOMLEFT', self.Docklet, 'BOTTOMLEFT', 0, 0); + self.Docklet.Dock1:SetPoint('TOPLEFT', self.Docklet, 'TOPLEFT', -4, 0); + self.Docklet.Dock1:SetPoint('BOTTOMLEFT', self.Docklet, 'BOTTOMLEFT', -4, -4); self.Docklet.Dock1:SetWidth(dockWidth); self.Docklet.Dock1:SetScript('OnShow', ShowSubDocklet); self.Docklet.Dock1:SetScript('OnHide', HideSubDocklet); diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Omen.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Omen.lua index e7b4d84..db46b4c 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Omen.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Omen.lua @@ -124,6 +124,7 @@ function PLUGIN:Docklet_Omen(parent) OmenTitle.Panel = nil OmenTitle:SetPanelTemplate("Default") OmenTitle:SetPanelColor("class") + --OmenTitle:GetFontString():SetFont(SVUI.Media.font.roboto, 12, "OUTLINE") OmenBarList:RemoveTextures() OmenAnchor:SetFixedPanelTemplate('Transparent') OmenAnchor:ClearAllPoints() diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua index 9cda01b..b7392dd 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Skada.lua @@ -43,12 +43,12 @@ local function skada_panel_loader(dock, window) local width,height = dock:GetSize() window.db.barspacing = 1; - window.db.barwidth = width - 4; - window.db.background.height = height - (window.db.enabletitle and window.db.title.height or 0) - 1; + window.db.barwidth = width - 10; + window.db.background.height = height - (window.db.enabletitle and window.db.title.height or 0) - 12; window.db.spark = false; window.db.barslocked = true; window.bargroup:ClearAllPoints() - window.bargroup:SetAllPoints(dock) + window.bargroup:FillInner(dock, 3, 3) window.bargroup:SetFrameStrata('LOW') local bgroup = window.bargroup.backdrop; @@ -111,15 +111,19 @@ local function StyleSkada() if(window.db.enabletitle) then panelAnchor = skada.button - skada.button:SetHeight(18) - skada.button:SetButtonTemplate() - skada.button:GetFontString():SetFont(SVUI.Media.font.names, 15, "OUTLINE") + skada.button:Height(22) + skada.button:SetPanelTemplate("Default") + skada.button:SetPanelColor("class") + local titleFont = skada.button:GetFontString() + titleFont:SetFont(SVUI.Media.font.names, 13, "NONE") + titleFont:SetShadowColor(0, 0, 0, 1) + titleFont:SetShadowOffset(1, -1) end skada:SetPanelTemplate("Transparent") skada.Panel:ClearAllPoints() - skada.Panel:SetPoint('TOPLEFT', panelAnchor, 'TOPLEFT', -2, 2) - skada.Panel:SetPoint('BOTTOMRIGHT', skada, 'BOTTOMRIGHT', 2, -2) + skada.Panel:SetPoint('TOPLEFT', panelAnchor, 'TOPLEFT', -3, 3) + skada.Panel:SetPoint('BOTTOMRIGHT', skada, 'BOTTOMRIGHT', 3, -3) end) hooksecurefunc(Skada, 'CreateWindow', function() diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/encounterjournal.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/encounterjournal.lua index ac351b0..4d95241 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/encounterjournal.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/encounterjournal.lua @@ -42,17 +42,14 @@ local function Tab_OnLeave(this) end local function ChangeTabHelper(this, xOffset, yOffset) - this:GetNormalTexture():SetTexCoord(0.1, 0.9, 0.1, 0.9) - this:GetNormalTexture():FillInner() + this:SetNormalTexture([[Interface\Addons\SVUI\assets\artwork\Template\EMPTY]]) + this:SetPushedTexture([[Interface\Addons\SVUI\assets\artwork\Template\EMPTY]]) + this:SetDisabledTexture([[Interface\Addons\SVUI\assets\artwork\Template\EMPTY]]) + this:SetHighlightTexture([[Interface\Addons\SVUI\assets\artwork\Template\EMPTY]]) + this.backdrop = CreateFrame("Frame", nil, this) this.backdrop:FillInner(this) - - local level = this:GetFrameLevel() - if(level > 0) then - this.backdrop:SetFrameLevel(level - 1) - else - this.backdrop:SetFrameLevel(0) - end + this.backdrop:SetFrameLevel(0) this.backdrop:SetPanelTemplate("Component", true) this.backdrop:SetPanelColor("dark") @@ -60,7 +57,8 @@ local function ChangeTabHelper(this, xOffset, yOffset) this:HookScript("OnLeave",Tab_OnLeave) local initialAnchor, anchorParent, relativeAnchor, xPosition, yPosition = this:GetPoint() - this:Point(initialAnchor, anchorParent, relativeAnchor, xOffset or 7, yOffset or yPosition) + this:ClearAllPoints() + this:Point(initialAnchor, anchorParent, relativeAnchor, xOffset or 0, yOffset or 0) end local function Outline(frame, noHighlight) @@ -136,8 +134,10 @@ local function EncounterJournalStyle() EncounterJournalEncounterFrameInfoBossesScrollFrame:RemoveTextures(true) EncounterJournalInstanceSelectDungeonTab:RemoveTextures(true) EncounterJournalInstanceSelectRaidTab:RemoveTextures(true) - ChangeTabHelper(EncounterJournalEncounterFrameInfoOverviewTab) + ChangeTabHelper(EncounterJournalEncounterFrameInfoOverviewTab, 10) ChangeTabHelper(EncounterJournalEncounterFrameInfoLootTab, 0, -10) + ChangeTabHelper(EncounterJournalEncounterFrameInfoBossTab, 0, -10) + ChangeTabHelper(EncounterJournalEncounterFrameInfoModelTab, 0, -20) EncounterJournalEncounterFrameInfoOverviewScrollFrame:RemoveTextures() EncounterJournalEncounterFrameInfoOverviewScrollFrameScrollChildTitle:SetTextColor(1,1,0) @@ -228,7 +228,7 @@ local function EncounterJournalStyle() used.button:SetButtonTemplate() end used.description:SetTextColor(1, 1, 1) - used.button.portrait.icon:Hide() + --used.button.portrait.icon:Hide() end end) diff --git a/Interface/EncounterJournal/UI-ENCOUNTERJOURNALTEXTURES.blp b/Interface/EncounterJournal/UI-ENCOUNTERJOURNALTEXTURES.blp index 5d5f0d0..aa4d4c3 100644 Binary files a/Interface/EncounterJournal/UI-ENCOUNTERJOURNALTEXTURES.blp and b/Interface/EncounterJournal/UI-ENCOUNTERJOURNALTEXTURES.blp differ