diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index d5fe852a..8dc1f50a 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 67 +local dversion = 68 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index be63eb77..81bf40cf 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -2576,6 +2576,17 @@ end local realign_labels = function (self) + if (not self.ShowHeader) then + for _, box in ipairs (self.BoxLabels) do + box.check:Hide() + box.button:Hide() + box.border:Hide() + box.box:Hide() + box.text:Hide() + end + return + end + local width = self:GetWidth() - 108 local first_box = self.BoxLabels [1] @@ -2602,6 +2613,14 @@ local realign_labels = function (self) end end + if (self.HeaderOnlyIndicator) then + for _, box in ipairs (self.BoxLabels) do + box.check:Hide() + box.button:Hide() + end + return + end + end local chart_panel_add_label = function (self, color, name, type, number) @@ -2687,7 +2706,7 @@ local chart_panel_add_overlay = function (self, overlayData, color, name, icon) draw_overlay (self, this_overlay, overlayData, color) tinsert (self.OData, {overlayData, color or line_default_color}) - if (name) then + if (name and self.HeaderShowOverlays) then self:AddLabel (color or line_default_color, name, "overlay", #self.OData) end end @@ -2811,7 +2830,7 @@ local chart_panel_onresize = function (self) for i = 1, 17 do local label = self.TimeLabels [i] - label:SetPoint ("bottomleft", self, "bottomleft", 78 + ((i-1)*spacement), 13) + label:SetPoint ("bottomleft", self, "bottomleft", 78 + ((i-1)*spacement), self.TimeLabelsHeight) label.line:SetHeight (height - 45) end @@ -2960,11 +2979,11 @@ local chart_panel_add_data = function (self, graphicData, color, name, elapsed_t f:SetTime (max_time) chart_panel_onresize (f) - end + local chart_panel_vlines_on = function (self) for i = 1, 17 do local label = self.TimeLabels [i] @@ -3049,31 +3068,15 @@ function DF:CreateChartPanel (parent, w, h, name) local title = DF:NewLabel (f, nil, "$parentTitle", "chart_title", "Chart!", nil, 20, {1, 1, 0}) title:SetPoint ("topleft", f, "topleft", 110, -13) - local bottom_texture = DF:NewImage (f, nil, 702, 25, "background", nil, nil, "$parentBottomTexture") - bottom_texture:SetColorTexture (0, 0, 0, .6) - bottom_texture:SetPoint ("bottomleft", f, "bottomleft", 8, 7) - bottom_texture:SetPoint ("bottomright", f, "bottomright", -8, 7) - f.Overlays = {} f.OverlaysAmount = 1 f.BoxLabels = {} f.BoxLabelsAmount = 1 - f.TimeLabels = {} - for i = 1, 17 do - local time = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") - time:SetText ("00:00") - time:SetPoint ("bottomleft", f, "bottomleft", 78 + ((i-1)*36), 13) - f.TimeLabels [i] = time - - local line = f:CreateTexture (nil, "border") - line:SetSize (1, h-45) - line:SetColorTexture (1, 1, 1, .1) - line:SetPoint ("bottomleft", time, "topright", 0, -10) - line:Hide() - time.line = line - end + f.ShowHeader = true + f.HeaderOnlyIndicator = false + f.HeaderShowOverlays = true --graphic local g = LibStub:GetLibrary("LibGraph-2.0"):CreateGraphLine (name .. "Graphic", f, "topleft","topleft", 108, -35, w - 120, h - 67) @@ -3097,11 +3100,12 @@ function DF:CreateChartPanel (parent, w, h, name) f.Graphic = g f.GData = {} f.OData = {} + f.ChartFrames = {} --div lines for i = 1, 8, 1 do local line = g:CreateTexture (nil, "overlay") - line:SetColorTexture (1, 1, 1, .2) + line:SetColorTexture (1, 1, 1, .05) line:SetWidth (670) line:SetHeight (1.1) @@ -3111,9 +3115,35 @@ function DF:CreateChartPanel (parent, w, h, name) s:SetPoint ("topleft", f, "topleft", 27, -61 + (-(24.6*i))) line:SetPoint ("topleft", s, "bottom", -27, 0) + line:SetPoint ("topright", g, "right", 0, 0) s.line = line end + --create time labels and the bottom texture to use as a background to these labels + f.TimeLabels = {} + f.TimeLabelsHeight = 16 + + for i = 1, 17 do + local time = f:CreateFontString (nil, "overlay", "GameFontHighlightSmall") + time:SetText ("00:00") + time:SetPoint ("bottomleft", f, "bottomleft", 78 + ((i-1)*36), f.TimeLabelsHeight) + f.TimeLabels [i] = time + + local line = f:CreateTexture (nil, "border") + line:SetSize (1, h-45) + line:SetColorTexture (1, 1, 1, .1) + line:SetPoint ("bottomleft", time, "topright", 0, -10) + line:Hide() + time.line = line + end + + local bottom_texture = DF:NewImage (f, nil, 702, 25, "background", nil, nil, "$parentBottomTexture") + bottom_texture:SetColorTexture (.1, .1, .1, .7) + bottom_texture:SetPoint ("topright", g, "bottomright", 0, 0) + bottom_texture:SetPoint ("bottomleft", f, "bottomleft", 8, 12) + + + f.SetTime = chart_panel_align_timelabels f.EnableVerticalLines = chart_panel_vlines_on f.DisableVerticalLines = chart_panel_vlines_off diff --git a/Libs/LibGraph-2.0/LibGraph-2.0.lua b/Libs/LibGraph-2.0/LibGraph-2.0.lua index 5150a172..f4658546 100644 --- a/Libs/LibGraph-2.0/LibGraph-2.0.lua +++ b/Libs/LibGraph-2.0/LibGraph-2.0.lua @@ -11,7 +11,7 @@ Description: Allows for easy creation of graphs --Thanks to Nelson Minar for catching several errors where width was being used instead of height (damn copy and paste >_>) local major = "LibGraph-2.0" -local minor = 90000 + tonumber(("$Revision: 54 $"):match("(%d+)")) +local minor = 90000 + tonumber(("$Revision: 55 $"):match("(%d+)")) --Search for just Addon\\ at the front since the interface part often gets trimmed @@ -1747,7 +1747,7 @@ function GraphFunctions:RefreshLineGraph() for k1, series in pairs(self.Data) do local LastPoint LastPoint = nil - + for k2, point in pairs(series.Points) do if LastPoint then local TPoint = {x = point[1]; y = point[2]} @@ -1755,7 +1755,8 @@ function GraphFunctions:RefreshLineGraph() TPoint.x = Width * (TPoint.x - self.XMin) / (self.XMax - self.XMin) TPoint.y = Height * (TPoint.y - self.YMin) / (self.YMax - self.YMin) - self:DrawLine(self, LastPoint.x, LastPoint.y, TPoint.x, TPoint.y, 32, series.Color, nil, series.LineTexture) + --tercioo: send the data index to DrawLine so custom draw functions know what they are drawing + self:DrawLine(self, LastPoint.x, LastPoint.y, TPoint.x, TPoint.y, 32, series.Color, nil, series.LineTexture, k1) LastPoint = TPoint else diff --git a/Libs/NickTag-1.0/NickTag-1.0.lua b/Libs/NickTag-1.0/NickTag-1.0.lua index beae21f8..03c979b9 100644 --- a/Libs/NickTag-1.0/NickTag-1.0.lua +++ b/Libs/NickTag-1.0/NickTag-1.0.lua @@ -48,7 +48,7 @@ end local queue_send = {} local last_queue = 0 local is_updating = false - NickTag.debug = true + NickTag.debug = false local GetGuildRosterInfo = GetGuildRosterInfo @@ -77,8 +77,10 @@ end return target end - function NickTag:Msg (text, text2) - print ("|cFFFFFF00NickTag:|r",text, text2 or "") + function NickTag:Msg (...) + if (NickTag.debug) then + print ("|cFFFFFF00NickTag:|r", ...) + end end local enUS = LibStub("AceLocale-3.0"):NewLocale ("NickTag-1.0", "enUS", true) @@ -226,9 +228,7 @@ end version = name if (not receivedPersona or type (receivedPersona) ~= "table") then - if (NickTag.debug) then - NickTag:Msg ("FULLPERSONA received but it's invalid ", source) - end + NickTag:Msg ("FULLPERSONA received but it's invalid ", source) return end @@ -296,6 +296,8 @@ end else storedPersona [CONST_INDEX_BACKGROUND_COLOR] = {1, 1, 1} end + + NickTag:Msg ("FULLPERSONA received and updated for character: ", source, "new nickname: ", receivedPersona [CONST_INDEX_NICKNAME]) end end @@ -309,9 +311,7 @@ end local receivedRevision = arg3 local storedPersona = NickTag:GetNicknameTable (source) - if (NickTag.debug) then - NickTag:Msg ("LOGONREVISION rev: " .. receivedRevision .. " source: " .. source) - end + NickTag:Msg ("LOGONREVISION rev: ", receivedRevision, " source: ", source) if (type (version) ~= "number" or version ~= minor) then return @@ -321,13 +321,9 @@ end --> put in queue our request for receive a updated persona NickTag:ScheduleTimer ("QueueRequest", math.random (10, 60), source) - if (NickTag.debug) then - NickTag:Msg ("LOGONREVISION from: " .. source .. " |cFFFF0000is out of date|r, queueing a request persona.") - end + NickTag:Msg ("LOGONREVISION from: " .. source .. " |cFFFF0000is out of date|r, queueing a request persona.") else - if (NickTag.debug) then - NickTag:Msg ("LOGONREVISION from: " .. source .. " |cFF00FF00is up to date.") - end + NickTag:Msg ("LOGONREVISION from: " .. source .. " |cFF00FF00is up to date.") end --> 0x3: someone requested my persona, so i need to send to him @@ -337,9 +333,7 @@ end end --> queue to send our persona for requested person - if (NickTag.debug) then - NickTag:Msg ("REQUESTPERSONA from: " .. source .. ", the request has been placed in queue.") - end + NickTag:Msg ("REQUESTPERSONA from: " .. source .. ", the request has been placed in queue.") NickTag:QueueSend (source) end @@ -364,9 +358,7 @@ end local _, numOnlineMembers = GetNumGuildMembers() - if (NickTag.debug) then - NickTag:Msg ("IsOnline(): " .. numOnlineMembers .. " online members.") - end + NickTag:Msg ("IsOnline(): " .. numOnlineMembers .. " online members.") for i = 1, numOnlineMembers do local player_name = GetGuildRosterInfo (i) @@ -406,20 +398,14 @@ end local name = queue_send [1] table.remove (queue_send, 1) - if (NickTag.debug) then - NickTag:Msg ("QUEUE -> ready to send persona to " .. name) - end + NickTag:Msg ("QUEUE -> ready to send persona to " .. name) --> check if the player is online if (NickTag:IsOnline (name)) then - if (NickTag.debug) then - NickTag:Msg ("QUEUE -> " .. name .. " is online, running SendPersona().") - end + NickTag:Msg ("QUEUE -> " .. name .. " is online, running SendPersona().") NickTag:SendPersona (name) else - if (NickTag.debug) then - NickTag:Msg ("QUEUE -> " .. name .. " is offline, cant request his persona.") - end + NickTag:Msg ("QUEUE -> " .. name .. " is offline, cant request his persona.") end if (#queue_send == 0 and #queue_request == 0) then @@ -431,20 +417,14 @@ end local name = queue_request [1] table.remove (queue_request, 1) - if (NickTag.debug) then - NickTag:Msg ("QUEUE -> ready to request the persona of " .. name) - end + NickTag:Msg ("QUEUE -> ready to request the persona of " .. name) --> check if the player is online if (NickTag:IsOnline (name)) then - if (NickTag.debug) then - NickTag:Msg ("QUEUE -> " .. name .. " is online, running RequestPersona().") - end + NickTag:Msg ("QUEUE -> " .. name .. " is online, running RequestPersona().") NickTag:RequestPersona (name) else - if (NickTag.debug) then - NickTag:Msg ("QUEUE -> " .. name .. " is offline, cant request his persona.") - end + NickTag:Msg ("QUEUE -> " .. name .. " is offline, cant request his persona.") end if (#queue_request == 0 and #queue_request == 0) then @@ -458,9 +438,7 @@ end end) function NickTag:StopRosterUpdates() - if (NickTag.debug) then - NickTag:Msg ("ROSTER -> updates has been stopped") - end + NickTag:Msg ("ROSTER -> updates has been stopped") if (NickTag.UpdateRosterTimer) then NickTag:CancelTimer (NickTag.UpdateRosterTimer) end @@ -470,19 +448,13 @@ end end function NickTag:StartRosterUpdates() - if (NickTag.debug) then - NickTag:Msg ("ROSTER -> updates has been actived") - end + NickTag:Msg ("ROSTER -> updates has been actived") event_frame:RegisterEvent ("GUILD_ROSTER_UPDATE") if (not NickTag.UpdateRosterTimer) then NickTag.UpdateRosterTimer = NickTag:ScheduleRepeatingTimer ("UpdateRoster", 12) - if (NickTag.debug) then - NickTag:Msg ("ROSTER -> new update thread created.") - end + NickTag:Msg ("ROSTER -> new update thread created.") else - if (NickTag.debug) then - NickTag:Msg ("ROSTER -> a update thread already exists.") - end + NickTag:Msg ("ROSTER -> a update thread already exists.") end is_updating = true end @@ -506,9 +478,7 @@ end local playerName = UnitName ("player") local myPersona = NickTag:GetNicknameTable (playerName) if (myPersona) then - if (NickTag.debug) then - NickTag:Msg ("SendRevision() -> SENT") - end + NickTag:Msg ("SendRevision() -> SENT") if (IsInGuild()) then NickTag:SendCommMessage ("NickTag", NickTag:Serialize (CONST_COMM_LOGONREVISION, 0, myPersona [CONST_INDEX_REVISION], UnitName ("player"), GetRealmName(), minor), "GUILD") end @@ -517,9 +487,7 @@ end --> i received 0x2 and his persona is out of date here, so i need to send 0x3 to him and him will send 0x1. function NickTag:RequestPersona (target) - if (NickTag.debug) then - NickTag:Msg ("RequestPersona() -> requesting of " .. target) - end + NickTag:Msg ("RequestPersona() -> requesting of " .. target) if (IsInGuild()) then NickTag:SendCommMessage ("NickTag", NickTag:Serialize (CONST_COMM_REQUESTPERSONA, 0, 0, UnitName ("player"), GetRealmName(), minor), "WHISPER", target) end @@ -528,9 +496,9 @@ end --> this broadcast my persona to entire guild when i update my persona or send my persona to someone who doesn't have it or need to update. function NickTag:SendPersona (target) if (target) then - if (NickTag.debug) then - NickTag:Msg ("SendPersona() -> sent to " .. target) - end + NickTag:Msg ("SendPersona() -> sent to " .. target) + else + NickTag:Msg ("SendPersona() -> broadcast") end --> auto change nickname if we have a invalid nickname @@ -549,7 +517,7 @@ end else --> updating my own persona NickTag.send_scheduled = false - --> need to increase 1 revision + --> broadcast only happen when something has changed on the local player persona, it needs to increase the revision before sending NickTag:IncRevision() --> broadcast over guild channel if (IsInGuild()) then @@ -685,9 +653,7 @@ end --> check if the nickname is okey to allowed to use. local okey, errortype = NickTag:CheckName (name) if (not okey) then - if (NickTag.debug) then - NickTag:Msg ("SetNickname() invalid name ", name) - end + NickTag:Msg ("SetNickname() invalid name ", name) return false, errortype end @@ -717,9 +683,7 @@ end end else - if (NickTag.debug) then - NickTag:Msg ("SetNickname() name is the same on the pool ", name, nickTable [CONST_INDEX_NICKNAME]) - end + NickTag:Msg ("SetNickname() name is the same on the pool ", name, nickTable [CONST_INDEX_NICKNAME]) end return true diff --git a/boot.lua b/boot.lua index 74cde06d..67aaa408 100644 --- a/boot.lua +++ b/boot.lua @@ -3,7 +3,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 5373 + _detalhes.build_counter = 5421 _detalhes.userversion = "v7.3.5." .. _detalhes.build_counter _detalhes.realversion = 129 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" diff --git a/functions/dungeon.lua b/functions/dungeon.lua index 49429bae..e980dafc 100644 --- a/functions/dungeon.lua +++ b/functions/dungeon.lua @@ -252,7 +252,7 @@ function mythicDungeonCharts.ShowChart() mythicDungeonCharts.Frame = CreateFrame ("frame", "DetailsMythicDungeonChartFrame", UIParent) local f = mythicDungeonCharts.Frame - f:SetSize (1210, 600) + f:SetSize (1200, 620) f:SetPoint ("center", UIParent, "center", 0, 0) f:SetFrameStrata ("LOW") f:EnableMouse (true) @@ -261,6 +261,23 @@ function mythicDungeonCharts.ShowChart() f:SetBackdropColor (0, 0, 0, 0.9) f:SetBackdropBorderColor (0, 0, 0, 1) + --titlebar + local titlebar = CreateFrame ("frame", nil, f) + titlebar:SetPoint ("topleft", f, "topleft", 2, -3) + titlebar:SetPoint ("topright", f, "topright", -2, -3) + titlebar:SetHeight (20) + titlebar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) + titlebar:SetBackdropColor (.5, .5, .5, 1) + titlebar:SetBackdropBorderColor (0, 0, 0, 1) + + --> title + local titleLabel = _detalhes.gump:NewLabel (titlebar, titlebar, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) + titleLabel:SetPoint ("center", titlebar , "center") + titleLabel:SetPoint ("top", titlebar , "top", 0, -5) + f.TitleText = titleLabel + + _detalhes:FormatBackground (f) + tinsert (UISpecialFrames, "DetailsMythicDungeonChartFrame") --register to libwindow @@ -271,18 +288,42 @@ function mythicDungeonCharts.ShowChart() LibWindow.SavePosition (f) f.ChartFrame = Details:GetFramework():CreateChartPanel (f, 1200, 600, "DetailsMythicDungeonChartGraphicFrame") - f.ChartFrame:SetPoint ("topleft", f, "topleft", 5, 0) + f.ChartFrame:SetPoint ("topleft", f, "topleft", 5, -20) + + f.ChartFrame.FrameInUse = {} + f.ChartFrame.FrameFree = {} + f.ChartFrame.TextureID = 1 + + f.ChartFrame.ShowHeader = true + f.ChartFrame.HeaderOnlyIndicator = true + f.ChartFrame.HeaderShowOverlays = false + + f.ChartFrame.Graphic.DrawLine = mythicDungeonCharts.CustomDrawLine f.ChartFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) f.ChartFrame:SetBackdropColor (0, 0, 0, 0.0) f.ChartFrame:SetBackdropBorderColor (0, 0, 0, 0) + f.ChartFrame:EnableMouse (false) + f.ChartFrame.CloseButton:Hide() f.BossWidgetsFrame = CreateFrame ("frame", "$parentBossFrames", f) f.BossWidgetsFrame:SetFrameLevel (f:GetFrameLevel()+10) f.BossWidgetsFrame.Widgets = {} + f.BossWidgetsFrame.GraphPin = f.BossWidgetsFrame:CreateTexture (nil, "overlay") + f.BossWidgetsFrame.GraphPin:SetTexture ([[Interface\BUTTONS\UI-RadioButton]]) + f.BossWidgetsFrame.GraphPin:SetTexCoord (17/64, 32/64, 0, 1) + f.BossWidgetsFrame.GraphPin:SetSize (16, 16) + + f.BossWidgetsFrame.GraphPinGlow = f.BossWidgetsFrame:CreateTexture (nil, "artwork") + f.BossWidgetsFrame.GraphPinGlow:SetTexture ([[Interface\Calendar\EventNotificationGlow]]) + f.BossWidgetsFrame.GraphPinGlow:SetTexCoord (0, 1, 0, 1) + f.BossWidgetsFrame.GraphPinGlow:SetSize (14, 14) + f.BossWidgetsFrame.GraphPinGlow:SetBlendMode ("ADD") + f.BossWidgetsFrame.GraphPinGlow:SetPoint ("center", f.BossWidgetsFrame.GraphPin, "center", 0, 0) + local closeButton = CreateFrame ("button", "$parentCloseButton", f, "UIPanelCloseButton") closeButton:GetNormalTexture():SetDesaturated (true) closeButton:SetWidth (20) @@ -290,6 +331,49 @@ function mythicDungeonCharts.ShowChart() closeButton:SetPoint ("topright", f, "topright", 0, -3) closeButton:SetFrameLevel (f:GetFrameLevel()+16) + local configButton = CreateFrame ("button", "$parentConfigButton", f) + configButton:SetWidth (14) + configButton:SetHeight (14) + configButton:SetPoint ("right", closeButton, "left", -2, 0) + configButton:SetFrameLevel (f:GetFrameLevel()+16) + configButton:SetScript ("OnClick", function() + local lowerInstance = _detalhes:GetLowerInstanceNumber() + if (lowerInstance) then + _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lowerInstance), false, 15) + _detalhes:OpenOptionsWindow (_detalhes:GetInstance (lowerInstance), false, 15) + else + local instance1 = _detalhes:GetInstance (1) + if (instance1) then + _detalhes:OpenOptionsWindow (instance1, false, 18) + end + end + end) + + local gearImage = configButton:CreateTexture (nil, "overlay") + gearImage:SetAllPoints() + gearImage:SetTexture ([[Interface\BUTTONS\UI-OptionsButton]]) + gearImage:SetDesaturated (true) + gearImage:SetVertexColor (.4, .4, .4, 1) + local gearImage = configButton:CreateTexture (nil, "highlight") + gearImage:SetAllPoints() + gearImage:SetTexture ([[Interface\BUTTONS\UI-OptionsButton]]) + gearImage:SetDesaturated (true) + --gearImage:SetVertexColor (.4, .4, .4, 1) + + local leftDivisorLine = f.BossWidgetsFrame:CreateTexture (nil, "overlay") + leftDivisorLine:SetSize (2, f.ChartFrame.Graphic:GetHeight()) + leftDivisorLine:SetColorTexture (1, 1, 1, 1) + leftDivisorLine:SetPoint ("bottomleft", f.ChartFrame.Graphic.TextFrame, "bottomleft", -2, 0) + + local bottomDivisorLine = f.BossWidgetsFrame:CreateTexture (nil, "overlay") + bottomDivisorLine:SetSize (f.ChartFrame.Graphic:GetWidth(), 2) + bottomDivisorLine:SetColorTexture (1, 1, 1, 1) + bottomDivisorLine:SetPoint ("bottomleft", f.ChartFrame.Graphic.TextFrame, "bottomleft", 0, 0) + + f.ChartFrame.Graphic:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + f.ChartFrame.Graphic:SetBackdropColor (.5, .50, .50, 0.8) + f.ChartFrame.Graphic:SetBackdropBorderColor (0, 0, 0, 0.5) + function f.ChartFrame.RefreshBossTimeline (self, bossTable, elapsedTime) for i, bossTable in ipairs (mythicDungeonCharts.ChartTable.BossDefeated) do @@ -358,20 +442,27 @@ function mythicDungeonCharts.ShowChart() end local charts = mythicDungeonCharts.ChartTable.Players + local classDuplicated = {} + mythicDungeonCharts.PlayerGraphIndex = {} + for playerName, playerTable in pairs (charts) do local chartData = playerTable.ChartData local lineName = playerTable.Name - local lineColor = {1, 1, 1, 1} - local classColor = RAID_CLASS_COLORS [playerTable.Class] - if (classColor) then - lineColor [1] = classColor.r - lineColor [2] = classColor.g - lineColor [3] = classColor.b - - --print (playerName, playerTable.Class) + classDuplicated [playerTable.Class] = (classDuplicated [playerTable.Class] or 0) + 1 + + local lineColor + if (playerTable.Class) then + local classColor = mythicDungeonCharts.ClassColors [playerTable.Class .. classDuplicated [playerTable.Class]] + if (classColor) then + lineColor = {classColor.r, classColor.g, classColor.b} + else + lineColor = {1, 1, 1} + end + else + lineColor = {1, 1, 1} end local combatTime = mythicDungeonCharts.ChartTable.ElapsedTime @@ -389,8 +480,9 @@ function mythicDungeonCharts.ShowChart() end chartData.max_value = maxValue - mythicDungeonCharts.Frame.ChartFrame:AddLine (chartData, lineColor, lineName, combatTime, texture, "SMA") - + mythicDungeonCharts.Frame.ChartFrame:AddLine (chartData, lineColor, lineName, combatTime, texture, "SMA") + tinsert (mythicDungeonCharts.PlayerGraphIndex, playerName) + --[=[ local smoothFactor = 0.075 local forecastSmoothFactor = 1 - smoothFactor @@ -429,12 +521,224 @@ function mythicDungeonCharts.ShowChart() --local phrase = " Average Dps (under development)\npress Escape to hide, Details! Alpha Build." .. _detalhes.build_counter .. "." .. _detalhes.realversion local phrase = "Details!: Average Dps for " - mythicDungeonCharts.Frame.ChartFrame:SetTitle (mythicDungeonCharts.ChartTable.DungeonName and phrase .. mythicDungeonCharts.ChartTable.DungeonName or phrase) + mythicDungeonCharts.Frame.ChartFrame:SetTitle ("") Details:GetFramework():SetFontSize (mythicDungeonCharts.Frame.ChartFrame.chart_title, 14) + mythicDungeonCharts.Frame.TitleText:SetText (mythicDungeonCharts.ChartTable.DungeonName and phrase .. mythicDungeonCharts.ChartTable.DungeonName or phrase) + mythicDungeonCharts.Frame:Show() end +local showID = 0 +local HideTooltip = function (ticker) + if (showID == ticker.ShowID) then + GameCooltip2:Hide() + mythicDungeonCharts.Frame.BossWidgetsFrame.GraphPin:Hide() + mythicDungeonCharts.Frame.BossWidgetsFrame.GraphPinGlow:Hide() + end +end +local PixelFrameOnEnter = function (self) + local playerName = self.PlayerName + --get the percent from the pixel height relative to the chart window + local dps = self.Height / mythicDungeonCharts.Frame.ChartFrame:GetHeight() + --multiply the max dps with the percent + dps = mythicDungeonCharts.Frame.ChartFrame.Graphic.max_value * dps + + mythicDungeonCharts.Frame.BossWidgetsFrame.GraphPin:SetPoint ("center", self, "center", 0, 0) + mythicDungeonCharts.Frame.BossWidgetsFrame.GraphPin:Show() + mythicDungeonCharts.Frame.BossWidgetsFrame.GraphPinGlow:Show() + + GameCooltip2:Preset (2) + GameCooltip2:SetOption ("FixedWidth", 100) + GameCooltip2:SetOption ("TextSize", 10) + local onlyName = _detalhes:GetOnlyName (playerName) + GameCooltip2:AddLine (onlyName) + + local classIcon, L, R, B, T = _detalhes:GetClassIcon (mythicDungeonCharts.ChartTable.Players [playerName].Class) + GameCooltip2:AddIcon (classIcon, 1, 1, 16, 16, L, R, B, T) + + GameCooltip2:AddLine (Details:GetCurrentToKFunction()(nil, floor (dps))) + + GameCooltip2:SetOwner (self) + GameCooltip2:Show() + showID = showID + 1 +end +local PixelFrameOnLeave = function (self) + local timer = C_Timer.NewTimer (1, HideTooltip) + timer.ShowID = showID +end + +local TAXIROUTE_LINEFACTOR = 128 / 126 -- Multiplying factor for texture coordinates +local TAXIROUTE_LINEFACTOR_2 = TAXIROUTE_LINEFACTOR / 2 -- Half of that +function mythicDungeonCharts:CustomDrawLine (C, sx, sy, ex, ey, w, color, layer, linetexture, graphIndex) + local relPoint = "BOTTOMLEFT" + + if sx == ex then + if sy == ey then + return + else + return self:DrawVLine(C, sx, sy, ey, w, color, layer) + end + elseif sy == ey then + return self:DrawHLine(C, sx, ex, sy, w, color, layer) + end + + if not C.GraphLib_Lines then + C.GraphLib_Lines = {} + C.GraphLib_Lines_Used = {} + end + + local T = tremove(C.GraphLib_Lines) or C:CreateTexture(nil, "ARTWORK") + + if linetexture then --> this data series texture + T:SetTexture(linetexture) + elseif C.CustomLine then --> overall chart texture + T:SetTexture(C.CustomLine) + else --> no texture assigned, use default + T:SetTexture(TextureDirectory.."line") + end + + tinsert(C.GraphLib_Lines_Used, T) + + T:SetDrawLayer(layer or "ARTWORK") + + T:SetVertexColor(color[1], color[2], color[3], color[4]) + -- Determine dimensions and center point of line + local dx, dy = ex - sx, ey - sy + local cx, cy = (sx + ex) / 2, (sy + ey) / 2 + + -- Normalize direction if necessary + if (dx < 0) then + dx, dy = -dx, -dy + end + + -- Calculate actual length of line + local l = sqrt((dx * dx) + (dy * dy)) + + -- Sin and Cosine of rotation, and combination (for later) + local s, c = -dy / l, dx / l + local sc = s * c + + -- Calculate bounding box size and texture coordinates + local Bwid, Bhgt, BLx, BLy, TLx, TLy, TRx, TRy, BRx, BRy + if (dy >= 0) then + Bwid = ((l * c) - (w * s)) * TAXIROUTE_LINEFACTOR_2 + Bhgt = ((w * c) - (l * s)) * TAXIROUTE_LINEFACTOR_2 + BLx, BLy, BRy = (w / l) * sc, s * s, (l / w) * sc + BRx, TLx, TLy, TRx = 1 - BLy, BLy, 1 - BRy, 1 - BLx + TRy = BRx + else + Bwid = ((l * c) + (w * s)) * TAXIROUTE_LINEFACTOR_2 + Bhgt = ((w * c) + (l * s)) * TAXIROUTE_LINEFACTOR_2 + BLx, BLy, BRx = s * s, -(l / w) * sc, 1 + (w / l) * sc + BRy, TLx, TLy, TRy = BLx, 1 - BRx, 1 - BLx, 1 - BLy + TRx = TLy + end + + -- Thanks Blizzard for adding (-)10000 as a hard-cap and throwing errors! + -- The cap was added in 3.1.0 and I think it was upped in 3.1.1 + -- (way less chance to get the error) + if TLx > 10000 then TLx = 10000 elseif TLx < -10000 then TLx = -10000 end + if TLy > 10000 then TLy = 10000 elseif TLy < -10000 then TLy = -10000 end + if BLx > 10000 then BLx = 10000 elseif BLx < -10000 then BLx = -10000 end + if BLy > 10000 then BLy = 10000 elseif BLy < -10000 then BLy = -10000 end + if TRx > 10000 then TRx = 10000 elseif TRx < -10000 then TRx = -10000 end + if TRy > 10000 then TRy = 10000 elseif TRy < -10000 then TRy = -10000 end + if BRx > 10000 then BRx = 10000 elseif BRx < -10000 then BRx = -10000 end + if BRy > 10000 then BRy = 10000 elseif BRy < -10000 then BRy = -10000 end + + -- Set texture coordinates and anchors + T:ClearAllPoints() + T:SetTexCoord(TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy) + T:SetPoint("BOTTOMLEFT", C, relPoint, cx - Bwid, cy - Bhgt) + T:SetPoint("TOPRIGHT", C, relPoint, cx + Bwid, cy + Bhgt) + T:Show() + + --[= + + local playerName = mythicDungeonCharts.PlayerGraphIndex [graphIndex] + if (mythicDungeonCharts.Frame.ChartFrame.TextureID % 3 == 0 and playerName) then + + local pixelFrame = tremove (mythicDungeonCharts.Frame.ChartFrame.FrameFree) + if (not pixelFrame) then + local newFrame = CreateFrame ("frame", nil, mythicDungeonCharts.Frame.ChartFrame) + newFrame:SetSize (1, 1) + + --newFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 2, tile = true}) + --newFrame:SetBackdropColor (0, 0, 0, 1) + newFrame:SetScript ("OnEnter", PixelFrameOnEnter) + newFrame:SetScript ("OnLeave", PixelFrameOnLeave) + + pixelFrame = newFrame + end + + pixelFrame:SetPoint("BOTTOMLEFT", C, relPoint, cx - Bwid, cy - Bhgt) + pixelFrame:SetPoint("TOPRIGHT", C, relPoint, cx + Bwid, cy + Bhgt) + + tinsert (mythicDungeonCharts.Frame.ChartFrame.FrameInUse, pixelFrame) + pixelFrame.PlayerName = playerName + pixelFrame.Height = ey + + end + + mythicDungeonCharts.Frame.ChartFrame.TextureID = mythicDungeonCharts.Frame.ChartFrame.TextureID + 1 + --]=] + + return T +end + + +mythicDungeonCharts.ClassColors = { + ["HUNTER1"] = { r = 0.67, g = 0.83, b = 0.45, colorStr = "ffabd473" }, + ["HUNTER2"] = { r = 0.47, g = 0.63, b = 0.25, colorStr = "ffabd473" }, + ["HUNTER3"] = { r = 0.27, g = 0.43, b = 0.05, colorStr = "ffabd473" }, + + ["WARLOCK1"] = { r = 0.53, g = 0.53, b = 0.93, colorStr = "ff8788ee" }, + ["WARLOCK2"] = { r = 0.33, g = 0.33, b = 0.73, colorStr = "ff8788ee" }, + ["WARLOCK3"] = { r = 0.13, g = 0.13, b = 0.53, colorStr = "ff8788ee" }, + + ["PRIEST1"] = { r = 1.0, g = 1.0, b = 1.0, colorStr = "ffffffff" }, + ["PRIEST2"] = { r = 0.8, g = 0.8, b = 0.8, colorStr = "ffffffff" }, + ["PRIEST3"] = { r = 0.6, g = 0.6, b = 0.6, colorStr = "ffffffff" }, + + ["PALADIN1"] = { r = 0.96, g = 0.55, b = 0.73, colorStr = "fff58cba" }, + ["PALADIN2"] = { r = 0.76, g = 0.35, b = 0.53, colorStr = "fff58cba" }, + ["PALADIN3"] = { r = 0.56, g = 0.15, b = 0.33, colorStr = "fff58cba" }, + + ["MAGE1"] = { r = 0.25, g = 0.78, b = 0.92, colorStr = "ff3fc7eb" }, + ["MAGE2"] = { r = 0.05, g = 0.58, b = 0.72, colorStr = "ff3fc7eb" }, + ["MAGE3"] = { r = 0.0, g = 0.38, b = 0.52, colorStr = "ff3fc7eb" }, + + ["ROGUE1"] = { r = 1.0, g = 0.96, b = 0.41, colorStr = "fffff569" }, + ["ROGUE2"] = { r = 0.8, g = 0.76, b = 0.21, colorStr = "fffff569" }, + ["ROGUE3"] = { r = 0.6, g = 0.56, b = 0.01, colorStr = "fffff569" }, + + ["DRUID1"] = { r = 1.0, g = 0.49, b = 0.04, colorStr = "ffff7d0a" }, + ["DRUID2"] = { r = 0.8, g = 0.29, b = 0.04, colorStr = "ffff7d0a" }, + ["DRUID3"] = { r = 0.6, g = 0.09, b = 0.04, colorStr = "ffff7d0a" }, + + ["SHAMAN1"] = { r = 0.0, g = 0.44, b = 0.87, colorStr = "ff0070de" }, + ["SHAMAN2"] = { r = 0.0, g = 0.24, b = 0.67, colorStr = "ff0070de" }, + ["SHAMAN3"] = { r = 0.0, g = 0.04, b = 0.47, colorStr = "ff0070de" }, + + ["WARRIOR1"] = { r = 0.78, g = 0.61, b = 0.43, colorStr = "ffc79c6e" }, + ["WARRIOR2"] = { r = 0.58, g = 0.41, b = 0.23, colorStr = "ffc79c6e" }, + ["WARRIOR3"] = { r = 0.38, g = 0.21, b = 0.03, colorStr = "ffc79c6e" }, + + ["DEATHKNIGHT1"] = { r = 0.77, g = 0.12 , b = 0.23, colorStr = "ffc41f3b" }, + ["DEATHKNIGHT2"] = { r = 0.57, g = 0.02 , b = 0.03, colorStr = "ffc41f3b" }, + ["DEATHKNIGHT3"] = { r = 0.37, g = 0.02 , b = 0.03, colorStr = "ffc41f3b" }, + + ["MONK1"] = { r = 0.0, g = 1.00 , b = 0.59, colorStr = "ff00ff96" }, + ["MONK2"] = { r = 0.0, g = 0.8 , b = 0.39, colorStr = "ff00ff96" }, + ["MONK3"] = { r = 0.0, g = 0.6 , b = 0.19, colorStr = "ff00ff96" }, + + ["DEMONHUNTER1"] = { r = 0.64, g = 0.19, b = 0.79, colorStr = "ffa330c9" }, + ["DEMONHUNTER2"] = { r = 0.44, g = 0.09, b = 0.59, colorStr = "ffa330c9" }, + ["DEMONHUNTER3"] = { r = 0.24, g = 0.09, b = 0.39, colorStr = "ffa330c9" }, +}; + + if (debugmode) then C_Timer.After (1, mythicDungeonCharts.ShowChart) end diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 05584805..5aa17e2b 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -666,7 +666,6 @@ local menus2 = { Loc ["STRING_OPTIONSMENU_SPELLS"], --15 Loc ["STRING_OPTIONSMENU_DATACHART"], --16 Loc ["STRING_OPTIONSMENU_AUTOMATIC"], --17 - --Loc ["STRING_OPTIONSMENU_MISC"], --18 "Streamer Settings", --18 Loc ["STRING_OPTIONSMENU_DATAFEED"], --19 Loc ["STRING_OPTIONSMENU_TOOLTIP"], --20 @@ -12010,9 +12009,14 @@ end --> if not window end if (section) then + + + local button = window.menu_buttons [section] - local mouse_up_hook = button.OnMouseUpHook - mouse_up_hook (button.widget) + button:Click() + + --local mouse_up_hook = button.OnMouseUpHook + --mouse_up_hook (button.widget) end DetailsOptionsWindow.loading_settings = nil