- More development on the mythic dungeon chart.

- Fixed options panel not opening on the requested section.
This commit is contained in:
Tercio
2018-03-09 15:31:22 -03:00
parent 58c325395d
commit ea5ce81d2f
7 changed files with 414 additions and 111 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
local dversion = 67
local dversion = 68
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
+53 -23
View File
@@ -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
+4 -3
View File
@@ -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
+31 -67
View File
@@ -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