General round of fixes and implementations (16 files modified, SafeRun, Cooltip Cleanup)

This commit is contained in:
Tercio Jose
2022-09-25 14:59:34 -03:00
parent 8afc88f0e7
commit 9fb7445a31
16 changed files with 3735 additions and 3735 deletions
+50 -41
View File
@@ -444,64 +444,73 @@ local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames ["button"]]
function ButtonMetaFunctions:SetBackdropBorderColor(...)
return self.button:SetBackdropBorderColor(...)
end
function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight, short_method)
function ButtonMetaFunctions:SetIcon(texture, width, height, layout, texcoord, overlay, textDistance, leftPadding, textHeight, shortMethod)
if (not self.icon) then
self.icon = self:CreateTexture (nil, "artwork")
self.icon:SetSize (self.height*0.8, self.height*0.8)
self.icon:SetPoint ("left", self.widget, "left", 4 + (leftpadding or 0), 0)
self.icon.leftpadding = leftpadding or 0
self.icon = self:CreateTexture(nil, "artwork")
self.icon:SetSize(self.height * 0.8, self.height * 0.8)
self.icon:SetPoint("left", self.widget, "left", 4 + (leftPadding or 0), 0)
self.icon.leftPadding = leftPadding or 0
self.widget.text:ClearAllPoints()
self.widget.text:SetPoint ("left", self.icon, "right", textdistance or 2, 0 + (textheight or 0))
self.widget.text:SetPoint ("left", self.icon, "right", textDistance or 2, 0 + (textHeight or 0))
end
self.icon:SetTexture (texture)
self.icon:SetSize (width or self.height*0.8, height or self.height*0.8)
self.icon:SetDrawLayer (layout or "artwork")
if (texcoord) then
self.icon:SetTexCoord (unpack (texcoord))
else
self.icon:SetTexCoord (0, 1, 0, 1)
end
if (overlay) then
if (type (overlay) == "string") then
local r, g, b, a = DF:ParseColors (overlay)
self.icon:SetVertexColor (r, g, b, a)
if (type(texture) == "string") then
local isAtlas = C_Texture.GetAtlasInfo(texture)
if (isAtlas) then
self.icon:SetAtlas(texture)
else
self.icon:SetVertexColor (unpack (overlay))
self.icon:SetTexture(texture)
end
else
self.icon:SetVertexColor (1, 1, 1, 1)
self.icon:SetTexture(texture)
end
local w = self.button:GetWidth()
local iconw = self.icon:GetWidth()
local text_width = self.button.text:GetStringWidth()
if (text_width > w-15-iconw) then
if (short_method == false) then
elseif (not short_method) then
local new_width = text_width+15+iconw
self.button:SetWidth (new_width)
elseif (short_method == 1) then
self.icon:SetSize(width or self.height * 0.8, height or self.height * 0.8)
self.icon:SetDrawLayer(layout or "artwork")
if (texcoord) then
self.icon:SetTexCoord(unpack(texcoord))
else
self.icon:SetTexCoord(0, 1, 0, 1)
end
if (overlay) then
if (type(overlay) == "string") then
local r, g, b, a = DF:ParseColors(overlay)
self.icon:SetVertexColor(r, g, b, a)
else
self.icon:SetVertexColor(unpack(overlay))
end
else
self.icon:SetVertexColor(1, 1, 1, 1)
end
local buttonWidth = self.button:GetWidth()
local iconWidth = self.icon:GetWidth()
local textWidth = self.button.text:GetStringWidth()
if (textWidth > buttonWidth - 15 - iconWidth) then
if (shortMethod == false) then
elseif (not shortMethod) then
local new_width = textWidth + 15 + iconWidth
self.button:SetWidth(new_width)
elseif (shortMethod == 1) then
local loop = true
local textsize = 11
local textSize = 11
while (loop) do
if (text_width+15+iconw < w or textsize < 8) then
if (textWidth + 15 + iconWidth < buttonWidth or textSize < 8) then
loop = false
break
else
DF:SetFontSize (self.button.text, textsize)
text_width = self.button.text:GetStringWidth()
textsize = textsize - 1
DF:SetFontSize(self.button.text, textSize)
textWidth = self.button.text:GetStringWidth()
textSize = textSize - 1
end
end
end
end
end
-- frame stratas
+2677 -2934
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 356
local dversion = 359
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
+363 -380
View File
@@ -5,58 +5,57 @@ if (not DF or not DetailsFrameworkCanLoad) then
end
local _
local ttexcoord
local texCoordinates
local CreateImageEditorFrame = function()
local window = DF:NewPanel (UIParent, nil, "DetailsFrameworkImageEdit", nil, 650, 500, false)
window:SetPoint ("center", UIParent, "center")
window:SetResizable (true)
window:SetMovable (true)
window:SetClampedToScreen (true)
local editorWindow = DF:NewPanel (UIParent, nil, "DetailsFrameworkImageEdit", nil, 650, 500, false)
editorWindow:SetPoint("center", UIParent, "center")
editorWindow:SetResizable (true)
editorWindow:SetMovable (true)
editorWindow:SetClampedToScreen (true)
tinsert (UISpecialFrames, "DetailsFrameworkImageEdit")
window:SetFrameStrata ("TOOLTIP")
editorWindow:SetFrameStrata("TOOLTIP")
if (not DetailsFramework.IsDragonflight()) then
window:SetMaxResize(500, 500)
editorWindow:SetMaxResize(500, 500)
else
window:SetResizeBounds(100, 100, 500, 500)
editorWindow:SetResizeBounds(100, 100, 500, 500)
end
_G.DetailsFrameworkImageEditTable = window
_G.DetailsFrameworkImageEditTable = editorWindow
window.hooks = {}
editorWindow.hooks = {}
local background = DF:NewImage (window, nil, nil, nil, "background", nil, "background", "$parentBackground")
local background = DF:NewImage (editorWindow, nil, nil, nil, "background", nil, "background", "$parentBackground")
background:SetAllPoints()
background:SetTexture (0, 0, 0, .8)
background:SetTexture(0, 0, 0, .8)
local edit_texture = DF:NewImage (window, nil, 500, 500, "artwork", nil, "edit_texture", "$parentImage")
local edit_texture = DF:NewImage (editorWindow, nil, 500, 500, "artwork", nil, "edit_texture", "$parentImage")
edit_texture:SetAllPoints()
_G.DetailsFrameworkImageEdit_EditTexture = edit_texture
local background_frame = CreateFrame ("frame", "DetailsFrameworkImageEditBackground", DetailsFrameworkImageEdit, "BackdropTemplate")
background_frame:SetPoint ("topleft", DetailsFrameworkImageEdit, "topleft", -10, 30)
background_frame:SetFrameStrata ("TOOLTIP")
background_frame:SetFrameLevel (window:GetFrameLevel())
background_frame:SetPoint("topleft", DetailsFrameworkImageEdit, "topleft", -10, 30)
background_frame:SetFrameStrata("TOOLTIP")
background_frame:SetFrameLevel (editorWindow:GetFrameLevel())
background_frame:SetSize (790, 560)
background_frame:SetResizable (true)
background_frame:SetMovable (true)
background_frame:SetScript ("OnMouseDown", function()
window:StartMoving()
background_frame:SetScript("OnMouseDown", function()
editorWindow:StartMoving()
end)
background_frame:SetScript ("OnMouseUp", function()
window:StopMovingOrSizing()
background_frame:SetScript("OnMouseUp", function()
editorWindow:StopMovingOrSizing()
end)
DF:CreateTitleBar (background_frame, "Image Editor")
DF:ApplyStandardBackdrop (background_frame, false, 0.98)
DF:CreateStatusBar(background_frame)
background_frame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
background_frame:SetBackdropColor (0, 0, 0, 0.9)
background_frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
background_frame:SetBackdropColor(0, 0, 0, 0.9)
background_frame:SetBackdropBorderColor (0, 0, 0, 1)
local haveHFlip = false
@@ -64,31 +63,31 @@ local CreateImageEditorFrame = function()
--> Top Slider
local topCoordTexture = DF:NewImage (window, nil, nil, nil, "overlay", nil, nil, "$parentImageTopCoord")
topCoordTexture:SetPoint ("topleft", window, "topleft")
topCoordTexture:SetPoint ("topright", window, "topright")
topCoordTexture:SetColorTexture (1, 0, 0)
local topCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageTopCoord")
topCoordTexture:SetPoint("topleft", editorWindow, "topleft")
topCoordTexture:SetPoint("topright", editorWindow, "topright")
topCoordTexture:SetColorTexture(1, 0, 0)
topCoordTexture.height = 1
topCoordTexture.alpha = .2
local topSlider = DF:NewSlider (window, nil, "$parentTopSlider", "topSlider", 100, 100, 0.1, 100, 0.1, 0)
topSlider:SetAllPoints (window.widget)
local topSlider = DF:NewSlider (editorWindow, nil, "$parentTopSlider", "topSlider", 100, 100, 0.1, 100, 0.1, 0)
topSlider:SetAllPoints (editorWindow.widget)
topSlider:SetOrientation ("VERTICAL")
topSlider.backdrop = nil
topSlider.fractional = true
topSlider:SetHook ("OnEnter", function() return true end)
topSlider:SetHook ("OnLeave", function() return true end)
local topSliderThumpTexture = topSlider:CreateTexture (nil, "overlay")
topSliderThumpTexture:SetColorTexture (1, 1, 1)
topSliderThumpTexture:SetWidth (512)
topSliderThumpTexture:SetHeight (1)
local topSliderThumpTexture = topSlider:CreateTexture(nil, "overlay")
topSliderThumpTexture:SetColorTexture(1, 1, 1)
topSliderThumpTexture:SetWidth(512)
topSliderThumpTexture:SetHeight(1)
topSlider:SetThumbTexture (topSliderThumpTexture)
topSlider:SetHook ("OnValueChange", function (_, _, value)
topCoordTexture.image:SetHeight (window.frame:GetHeight()/100*value)
if (window.callback_func) then
window.accept (nil, nil, true)
topSlider:SetHook ("OnValueChange", function(_, _, value)
topCoordTexture.image:SetHeight(editorWindow.frame:GetHeight()/100*value)
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end)
@@ -96,32 +95,32 @@ local CreateImageEditorFrame = function()
--> Bottom Slider
local bottomCoordTexture = DF:NewImage (window, nil, nil, nil, "overlay", nil, nil, "$parentImageBottomCoord")
bottomCoordTexture:SetPoint ("bottomleft", window, "bottomleft", 0, 0)
bottomCoordTexture:SetPoint ("bottomright", window, "bottomright", 0, 0)
bottomCoordTexture:SetColorTexture (1, 0, 0)
local bottomCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageBottomCoord")
bottomCoordTexture:SetPoint("bottomleft", editorWindow, "bottomleft", 0, 0)
bottomCoordTexture:SetPoint("bottomright", editorWindow, "bottomright", 0, 0)
bottomCoordTexture:SetColorTexture(1, 0, 0)
bottomCoordTexture.height = 1
bottomCoordTexture.alpha = .2
local bottomSlider= DF:NewSlider (window, nil, "$parentBottomSlider", "bottomSlider", 100, 100, 0.1, 100, 0.1, 100)
bottomSlider:SetAllPoints (window.widget)
local bottomSlider= DF:NewSlider (editorWindow, nil, "$parentBottomSlider", "bottomSlider", 100, 100, 0.1, 100, 0.1, 100)
bottomSlider:SetAllPoints (editorWindow.widget)
bottomSlider:SetOrientation ("VERTICAL")
bottomSlider.backdrop = nil
bottomSlider.fractional = true
bottomSlider:SetHook ("OnEnter", function() return true end)
bottomSlider:SetHook ("OnLeave", function() return true end)
local bottomSliderThumpTexture = bottomSlider:CreateTexture (nil, "overlay")
bottomSliderThumpTexture:SetColorTexture (1, 1, 1)
bottomSliderThumpTexture:SetWidth (512)
bottomSliderThumpTexture:SetHeight (1)
local bottomSliderThumpTexture = bottomSlider:CreateTexture(nil, "overlay")
bottomSliderThumpTexture:SetColorTexture(1, 1, 1)
bottomSliderThumpTexture:SetWidth(512)
bottomSliderThumpTexture:SetHeight(1)
bottomSlider:SetThumbTexture (bottomSliderThumpTexture)
bottomSlider:SetHook ("OnValueChange", function (_, _, value)
bottomSlider:SetHook ("OnValueChange", function(_, _, value)
value = math.abs (value-100)
bottomCoordTexture.image:SetHeight (math.max (window.frame:GetHeight()/100*value, 1))
if (window.callback_func) then
window.accept (nil, nil, true)
bottomCoordTexture.image:SetHeight(math.max (editorWindow.frame:GetHeight()/100*value, 1))
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end)
@@ -129,30 +128,30 @@ local CreateImageEditorFrame = function()
--> Left Slider
local leftCoordTexture = DF:NewImage (window, nil, nil, nil, "overlay", nil, nil, "$parentImageLeftCoord")
leftCoordTexture:SetPoint ("topleft", window, "topleft", 0, 0)
leftCoordTexture:SetPoint ("bottomleft", window, "bottomleft", 0, 0)
leftCoordTexture:SetColorTexture (1, 0, 0)
local leftCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageLeftCoord")
leftCoordTexture:SetPoint("topleft", editorWindow, "topleft", 0, 0)
leftCoordTexture:SetPoint("bottomleft", editorWindow, "bottomleft", 0, 0)
leftCoordTexture:SetColorTexture(1, 0, 0)
leftCoordTexture.width = 1
leftCoordTexture.alpha = .2
local leftSlider = DF:NewSlider (window, nil, "$parentLeftSlider", "leftSlider", 100, 100, 0.1, 100, 0.1, 0.1)
leftSlider:SetAllPoints (window.widget)
local leftSlider = DF:NewSlider (editorWindow, nil, "$parentLeftSlider", "leftSlider", 100, 100, 0.1, 100, 0.1, 0.1)
leftSlider:SetAllPoints (editorWindow.widget)
leftSlider.backdrop = nil
leftSlider.fractional = true
leftSlider:SetHook ("OnEnter", function() return true end)
leftSlider:SetHook ("OnLeave", function() return true end)
local leftSliderThumpTexture = leftSlider:CreateTexture (nil, "overlay")
leftSliderThumpTexture:SetColorTexture (1, 1, 1)
leftSliderThumpTexture:SetWidth (1)
leftSliderThumpTexture:SetHeight (512)
local leftSliderThumpTexture = leftSlider:CreateTexture(nil, "overlay")
leftSliderThumpTexture:SetColorTexture(1, 1, 1)
leftSliderThumpTexture:SetWidth(1)
leftSliderThumpTexture:SetHeight(512)
leftSlider:SetThumbTexture (leftSliderThumpTexture)
leftSlider:SetHook ("OnValueChange", function (_, _, value)
leftCoordTexture.image:SetWidth (window.frame:GetWidth()/100*value)
if (window.callback_func) then
window.accept (nil, nil, true)
leftSlider:SetHook ("OnValueChange", function(_, _, value)
leftCoordTexture.image:SetWidth(editorWindow.frame:GetWidth()/100*value)
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end)
@@ -160,31 +159,31 @@ local CreateImageEditorFrame = function()
--> Right Slider
local rightCoordTexture = DF:NewImage (window, nil, nil, nil, "overlay", nil, nil, "$parentImageRightCoord")
rightCoordTexture:SetPoint ("topright", window, "topright", 0, 0)
rightCoordTexture:SetPoint ("bottomright", window, "bottomright", 0, 0)
rightCoordTexture:SetColorTexture (1, 0, 0)
local rightCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageRightCoord")
rightCoordTexture:SetPoint("topright", editorWindow, "topright", 0, 0)
rightCoordTexture:SetPoint("bottomright", editorWindow, "bottomright", 0, 0)
rightCoordTexture:SetColorTexture(1, 0, 0)
rightCoordTexture.width = 1
rightCoordTexture.alpha = .2
local rightSlider = DF:NewSlider (window, nil, "$parentRightSlider", "rightSlider", 100, 100, 0.1, 100, 0.1, 100)
rightSlider:SetAllPoints (window.widget)
local rightSlider = DF:NewSlider (editorWindow, nil, "$parentRightSlider", "rightSlider", 100, 100, 0.1, 100, 0.1, 100)
rightSlider:SetAllPoints (editorWindow.widget)
rightSlider.backdrop = nil
rightSlider.fractional = true
rightSlider:SetHook ("OnEnter", function() return true end)
rightSlider:SetHook ("OnLeave", function() return true end)
--[
local rightSliderThumpTexture = rightSlider:CreateTexture (nil, "overlay")
rightSliderThumpTexture:SetColorTexture (1, 1, 1)
rightSliderThumpTexture:SetWidth (1)
rightSliderThumpTexture:SetHeight (512)
local rightSliderThumpTexture = rightSlider:CreateTexture(nil, "overlay")
rightSliderThumpTexture:SetColorTexture(1, 1, 1)
rightSliderThumpTexture:SetWidth(1)
rightSliderThumpTexture:SetHeight(512)
rightSlider:SetThumbTexture (rightSliderThumpTexture)
--]]
rightSlider:SetHook ("OnValueChange", function (_, _, value)
rightSlider:SetHook ("OnValueChange", function(_, _, value)
value = math.abs (value-100)
rightCoordTexture.image:SetWidth (math.max (window.frame:GetWidth()/100*value, 1))
if (window.callback_func) then
window.accept (nil, nil, true)
rightCoordTexture.image:SetWidth(math.max (editorWindow.frame:GetWidth()/100*value, 1))
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end)
@@ -193,12 +192,12 @@ local CreateImageEditorFrame = function()
--> Edit Buttons
local buttonsBackground = DF:NewPanel (UIParent, nil, "DetailsFrameworkImageEditButtonsBg", nil, 115, 230)
--buttonsBackground:SetPoint ("topleft", window, "topright", 2, 0)
buttonsBackground:SetPoint ("topright", background_frame, "topright", -8, -10)
--buttonsBackground:SetPoint("topleft", window, "topright", 2, 0)
buttonsBackground:SetPoint("topright", background_frame, "topright", -8, -10)
buttonsBackground:Hide()
--buttonsBackground:SetMovable (true)
tinsert (UISpecialFrames, "DetailsFrameworkImageEditButtonsBg")
buttonsBackground:SetFrameStrata ("TOOLTIP")
buttonsBackground:SetFrameStrata("TOOLTIP")
local alphaFrameShown = false
@@ -207,12 +206,12 @@ local CreateImageEditorFrame = function()
local alphaFrame
local originalColor = {0.9999, 0.8196, 0}
local enableTexEdit = function (button, b, side)
local enableTexEdit = function(button, bottom, side)
if (alphaFrameShown) then
alphaFrame:Hide()
alphaFrameShown = false
button.text:SetTextColor (unpack (originalColor))
button.text:SetTextColor (unpack(originalColor))
end
if (ColorPickerFrame:IsShown()) then
@@ -220,58 +219,58 @@ local CreateImageEditorFrame = function()
end
if (lastButton) then
lastButton.text:SetTextColor (unpack (originalColor))
lastButton.text:SetTextColor (unpack(originalColor))
end
if (editingSide == side) then
window [editingSide.."Slider"]:Hide()
editorWindow [editingSide.."Slider"]:Hide()
editingSide = nil
return
elseif (editingSide) then
window [editingSide.."Slider"]:Hide()
editorWindow [editingSide.."Slider"]:Hide()
end
editingSide = side
button.text:SetTextColor (1, 1, 1)
lastButton = button
window [side.."Slider"]:Show()
editorWindow [side.."Slider"]:Show()
end
local yMod = -10
local leftTexCoordButton = DF:NewButton (buttonsBackground, nil, "$parentLeftTexButton", nil, 100, 20, enableTexEdit, "left", nil, nil, "Crop Left", 1)
leftTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -10 + yMod)
leftTexCoordButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local leftTexCoordButton = DF:NewButton(buttonsBackground, nil, "$parentLeftTexButton", nil, 100, 20, enableTexEdit, "left", nil, nil, "Crop Left", 1)
leftTexCoordButton:SetPoint("topright", buttonsBackground, "topright", -8, -10 + yMod)
leftTexCoordButton:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local rightTexCoordButton = DF:NewButton (buttonsBackground, nil, "$parentRightTexButton", nil, 100, 20, enableTexEdit, "right", nil, nil, "Crop Right", 1)
rightTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -30 + yMod)
rightTexCoordButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local rightTexCoordButton = DF:NewButton(buttonsBackground, nil, "$parentRightTexButton", nil, 100, 20, enableTexEdit, "right", nil, nil, "Crop Right", 1)
rightTexCoordButton:SetPoint("topright", buttonsBackground, "topright", -8, -30 + yMod)
rightTexCoordButton:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local topTexCoordButton = DF:NewButton (buttonsBackground, nil, "$parentTopTexButton", nil, 100, 20, enableTexEdit, "top", nil, nil, "Crop Top", 1)
topTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -50 + yMod)
topTexCoordButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local topTexCoordButton = DF:NewButton(buttonsBackground, nil, "$parentTopTexButton", nil, 100, 20, enableTexEdit, "top", nil, nil, "Crop Top", 1)
topTexCoordButton:SetPoint("topright", buttonsBackground, "topright", -8, -50 + yMod)
topTexCoordButton:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local bottomTexCoordButton = DF:NewButton (buttonsBackground, nil, "$parentBottomTexButton", nil, 100, 20, enableTexEdit, "bottom", nil, nil, "Crop Bottom", 1)
bottomTexCoordButton:SetPoint ("topright", buttonsBackground, "topright", -8, -70 + yMod)
bottomTexCoordButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local bottomTexCoordButton = DF:NewButton(buttonsBackground, nil, "$parentBottomTexButton", nil, 100, 20, enableTexEdit, "bottom", nil, nil, "Crop Bottom", 1)
bottomTexCoordButton:SetPoint("topright", buttonsBackground, "topright", -8, -70 + yMod)
bottomTexCoordButton:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local Alpha = DF:NewButton (buttonsBackground, nil, "$parentBottomAlphaButton", nil, 100, 20, alpha, nil, nil, nil, "Alpha", 1)
Alpha:SetPoint ("topright", buttonsBackground, "topright", -8, -115 + yMod)
Alpha:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local Alpha = DF:NewButton(buttonsBackground, nil, "$parentBottomAlphaButton", nil, 100, 20, alpha, nil, nil, nil, "Alpha", 1)
Alpha:SetPoint("topright", buttonsBackground, "topright", -8, -115 + yMod)
Alpha:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> overlay color
local selectedColor = function (default)
local selectedColor = function(default)
if (default) then
edit_texture:SetVertexColor (unpack (default))
if (window.callback_func) then
window.accept (nil, nil, true)
edit_texture:SetVertexColor(unpack(default))
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
else
edit_texture:SetVertexColor (ColorPickerFrame:GetColorRGB())
if (window.callback_func) then
window.accept (nil, nil, true)
edit_texture:SetVertexColor(ColorPickerFrame:GetColorRGB())
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end
end
@@ -283,347 +282,331 @@ local CreateImageEditorFrame = function()
ColorPickerFrame.cancelFunc = nil
ColorPickerFrame.previousValues = nil
local r, g, b = edit_texture:GetVertexColor()
ColorPickerFrame:SetColorRGB (r, g, b)
local right, g, bottom = edit_texture:GetVertexColor()
ColorPickerFrame:SetColorRGB (right, g, bottom)
ColorPickerFrame:SetParent (buttonsBackground.widget)
ColorPickerFrame.hasOpacity = false
ColorPickerFrame.previousValues = {r, g, b}
ColorPickerFrame.previousValues = {right, g, bottom}
ColorPickerFrame.func = selectedColor
ColorPickerFrame.cancelFunc = selectedColor
ColorPickerFrame:ClearAllPoints()
ColorPickerFrame:SetPoint ("left", buttonsBackground.widget, "right")
ColorPickerFrame:SetPoint("left", buttonsBackground.widget, "right")
ColorPickerFrame:Show()
if (alphaFrameShown) then
alphaFrame:Hide()
alphaFrameShown = false
Alpha.button.text:SetTextColor (unpack (originalColor))
Alpha.button.text:SetTextColor (unpack(originalColor))
end
if (lastButton) then
lastButton.text:SetTextColor (unpack (originalColor))
lastButton.text:SetTextColor (unpack(originalColor))
if (editingSide) then
window [editingSide.."Slider"]:Hide()
editorWindow [editingSide.."Slider"]:Hide()
end
end
end
local changeColorButton = DF:NewButton (buttonsBackground, nil, "$parentOverlayColorButton", nil, 100, 20, changeColor, nil, nil, nil, "Color", 1)
changeColorButton:SetPoint ("topright", buttonsBackground, "topright", -8, -95 + yMod)
changeColorButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
local changeColorButton = DF:NewButton(buttonsBackground, nil, "$parentOverlayColorButton", nil, 100, 20, changeColor, nil, nil, nil, "Color", 1)
changeColorButton:SetPoint("topright", buttonsBackground, "topright", -8, -95 + yMod)
changeColorButton:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
alphaFrame = DF:NewPanel (buttonsBackground, nil, "DetailsFrameworkImageEditAlphaBg", nil, 40, 225)
alphaFrame:SetPoint ("topleft", buttonsBackground, "topright", 2, 0)
alphaFrame:SetPoint("topleft", buttonsBackground, "topright", 2, 0)
alphaFrame:Hide()
local alphaSlider = DF:NewSlider (alphaFrame, nil, "$parentAlphaSlider", "alphaSlider", 30, 220, 1, 100, 1, edit_texture:GetAlpha()*100)
alphaSlider:SetPoint ("top", alphaFrame, "top", 0, -5)
alphaSlider:SetPoint("top", alphaFrame, "top", 0, -5)
alphaSlider:SetOrientation ("VERTICAL")
alphaSlider.thumb:SetSize (40, 30)
--leftSlider.backdrop = nil
--leftSlider.fractional = true
local alpha = function (button)
local alpha = function(button)
if (ColorPickerFrame:IsShown()) then
ColorPickerFrame:Hide()
end
if (lastButton) then
lastButton.text:SetTextColor (unpack (originalColor))
lastButton.text:SetTextColor (unpack(originalColor))
if (editingSide) then
window [editingSide.."Slider"]:Hide()
editorWindow [editingSide.."Slider"]:Hide()
end
end
if (not alphaFrameShown) then
alphaFrame:Show()
alphaSlider:SetValue (edit_texture:GetAlpha()*100)
alphaSlider:SetValue(edit_texture:GetAlpha()*100)
alphaFrameShown = true
button.text:SetTextColor (1, 1, 1)
else
alphaFrame:Hide()
alphaFrameShown = false
button.text:SetTextColor (unpack (originalColor))
button.text:SetTextColor (unpack(originalColor))
end
end
Alpha.clickfunction = alpha
alphaSlider:SetHook ("OnValueChange", function (_, _, value)
edit_texture:SetAlpha (value/100)
if (window.callback_func) then
window.accept (nil, nil, true)
alphaSlider:SetHook ("OnValueChange", function(_, _, value)
edit_texture:SetAlpha(value/100)
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end)
local resizer = CreateFrame ("Button", nil, window.widget, "BackdropTemplate")
local resizer = CreateFrame ("Button", nil, editorWindow.widget, "BackdropTemplate")
resizer:SetNormalTexture ([[Interface\AddOns\Details\images\skins\default_skin]])
resizer:SetHighlightTexture ([[Interface\AddOns\Details\images\skins\default_skin]])
resizer:GetNormalTexture():SetTexCoord (0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375)
resizer:GetHighlightTexture():SetTexCoord (0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375)
resizer:SetWidth (16)
resizer:SetHeight (16)
resizer:SetPoint ("BOTTOMRIGHT", window.widget, "BOTTOMRIGHT", 0, 0)
resizer:EnableMouse (true)
resizer:SetFrameLevel (window.widget:GetFrameLevel() + 2)
resizer:SetWidth(16)
resizer:SetHeight(16)
resizer:SetPoint("BOTTOMRIGHT", editorWindow.widget, "BOTTOMRIGHT", 0, 0)
resizer:EnableMouse(true)
resizer:SetFrameLevel (editorWindow.widget:GetFrameLevel() + 2)
resizer:SetScript ("OnMouseDown", function (self, button)
window.widget:StartSizing ("BOTTOMRIGHT")
resizer:SetScript("OnMouseDown", function(self, button)
editorWindow.widget:StartSizing ("BOTTOMRIGHT")
end)
resizer:SetScript ("OnMouseUp", function (self, button)
window.widget:StopMovingOrSizing()
resizer:SetScript("OnMouseUp", function(self, button)
editorWindow.widget:StopMovingOrSizing()
end)
window.widget:SetScript ("OnMouseDown", function()
window.widget:StartMoving()
editorWindow.widget:SetScript("OnMouseDown", function()
editorWindow.widget:StartMoving()
end)
window.widget:SetScript ("OnMouseUp", function()
window.widget:StopMovingOrSizing()
editorWindow.widget:SetScript("OnMouseUp", function()
editorWindow.widget:StopMovingOrSizing()
end)
window.widget:SetScript ("OnSizeChanged", function()
edit_texture.width = window.width
edit_texture.height = window.height
leftSliderThumpTexture:SetHeight (window.height)
rightSliderThumpTexture:SetHeight (window.height)
topSliderThumpTexture:SetWidth (window.width)
bottomSliderThumpTexture:SetWidth (window.width)
editorWindow.widget:SetScript("OnSizeChanged", function()
edit_texture.width = editorWindow.width
edit_texture.height = editorWindow.height
leftSliderThumpTexture:SetHeight(editorWindow.height)
rightSliderThumpTexture:SetHeight(editorWindow.height)
topSliderThumpTexture:SetWidth(editorWindow.width)
bottomSliderThumpTexture:SetWidth(editorWindow.width)
rightCoordTexture.image:SetWidth (math.max ( (window.frame:GetWidth() / 100 * math.abs (rightSlider:GetValue()-100)), 1))
leftCoordTexture.image:SetWidth (window.frame:GetWidth()/100*leftSlider:GetValue())
bottomCoordTexture:SetHeight (math.max ( (window.frame:GetHeight() / 100 * math.abs (bottomSlider:GetValue()-100)), 1))
topCoordTexture:SetHeight (window.frame:GetHeight()/100*topSlider:GetValue())
rightCoordTexture.image:SetWidth(math.max ( (editorWindow.frame:GetWidth() / 100 * math.abs (rightSlider:GetValue()-100)), 1))
leftCoordTexture.image:SetWidth(editorWindow.frame:GetWidth()/100*leftSlider:GetValue())
bottomCoordTexture:SetHeight(math.max ( (editorWindow.frame:GetHeight() / 100 * math.abs (bottomSlider:GetValue()-100)), 1))
topCoordTexture:SetHeight(editorWindow.frame:GetHeight()/100*topSlider:GetValue())
if (window.callback_func) then
window.accept (nil, nil, true)
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end)
--> flip
local flip = function (button, b, side)
if (side == 1) then
haveHFlip = not haveHFlip
if (window.callback_func) then
window.accept (nil, nil, true)
end
elseif (side == 2) then
haveVFlip = not haveVFlip
if (window.callback_func) then
window.accept (nil, nil, true)
end
--flip button
local flip = function(button, bottom, side)
if (side == 1) then
haveHFlip = not haveHFlip
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
elseif (side == 2) then
haveVFlip = not haveVFlip
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end
local flipButtonH = DF:NewButton (buttonsBackground, nil, "$parentFlipButton", nil, 100, 20, flip, 1, nil, nil, "Flip H", 1)
flipButtonH:SetPoint ("topright", buttonsBackground, "topright", -8, -140 + yMod)
flipButtonH:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--
--> select area to crop
local DragFrame = CreateFrame ("frame", nil, background_frame, "BackdropTemplate")
DragFrame:EnableMouse (false)
DragFrame:SetFrameStrata ("TOOLTIP")
DragFrame:SetPoint ("topleft", edit_texture.widget, "topleft")
DragFrame:SetPoint ("bottomright", edit_texture.widget, "bottomright")
DragFrame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Worldmap\UI-QuestBlob-Inside]], tileSize = 256, tile = true})
DragFrame:SetBackdropColor (1, 1, 1, .2)
DragFrame:Hide()
local SelectionBox_Up = DragFrame:CreateTexture (nil, "overlay")
SelectionBox_Up:SetHeight (1)
SelectionBox_Up:SetColorTexture (1, 1, 1)
local SelectionBox_Down = DragFrame:CreateTexture (nil, "overlay")
SelectionBox_Down:SetHeight (1)
SelectionBox_Down:SetColorTexture (1, 1, 1)
local SelectionBox_Left = DragFrame:CreateTexture (nil, "overlay")
SelectionBox_Left:SetWidth (1)
SelectionBox_Left:SetColorTexture (1, 1, 1)
local SelectionBox_Right = DragFrame:CreateTexture (nil, "overlay")
SelectionBox_Right:SetWidth (1)
SelectionBox_Right:SetColorTexture (1, 1, 1)
function DragFrame.ClearSelectionBoxPoints()
SelectionBox_Up:ClearAllPoints()
SelectionBox_Down:ClearAllPoints()
SelectionBox_Left:ClearAllPoints()
SelectionBox_Right:ClearAllPoints()
end
local StartCrop = function()
DragFrame:Show()
DragFrame:EnableMouse (true)
end
local CropSelection = DF:NewButton (buttonsBackground, nil, "$parentCropSelection", nil, 100, 20, StartCrop, 2, nil, nil, "Crop Selection", 1)
--CropSelection:SetPoint ("topright", buttonsBackground, "topright", -8, -260)
CropSelection:InstallCustomTexture()
DragFrame.OnTick = function (self, deltaTime)
local x1, y1 = unpack (self.ClickedAt)
local x2, y2 = GetCursorPosition()
DragFrame.ClearSelectionBoxPoints()
print (x1, y1, x2, y2)
if (x2 > x1) then
--right
if (y1 > y2) then
--top
SelectionBox_Up:SetPoint ("topleft", UIParent, "bottomleft", x1, y1)
SelectionBox_Up:SetPoint ("topright", UIParent, "bottomleft", x2, y1)
SelectionBox_Left:SetPoint ("topleft", UIParent, "bottomleft", x1, y1)
SelectionBox_Left:SetPoint ("bottomleft", UIParent, "bottomleft", x1, y2)
else
--bottom
end
else
--left
if (y2 > y1) then
--top
else
--bottom
end
end
end
DragFrame:SetScript ("OnMouseDown", function (self, MouseButton)
if (MouseButton == "LeftButton") then
self.ClickedAt = {GetCursorPosition()}
DragFrame:SetScript ("OnUpdate", DragFrame.OnTick)
end
end)
DragFrame:SetScript ("OnMouseUp", function (self, MouseButton)
if (MouseButton == "LeftButton") then
self.ReleaseAt = {GetCursorPosition()}
DragFrame:EnableMouse (false)
DragFrame:Hide()
DragFrame:SetScript ("OnUpdate", nil)
print (self.ClickedAt[1], self.ClickedAt[2], self.ReleaseAt[1], self.ReleaseAt[2])
end
end)
--> accept
window.accept = function (self, b, keep_editing)
if (not keep_editing) then
buttonsBackground:Hide()
window:Hide()
alphaFrame:Hide()
ColorPickerFrame:Hide()
end
local coords = {}
local l, r, t, b = leftSlider.value/100, rightSlider.value/100, topSlider.value/100, bottomSlider.value/100
if (haveHFlip) then
coords [1] = r
coords [2] = l
else
coords [1] = l
coords [2] = r
end
if (haveVFlip) then
coords [3] = b
coords [4] = t
else
coords [3] = t
coords [4] = b
end
return window.callback_func (edit_texture.width, edit_texture.height, {edit_texture:GetVertexColor()}, edit_texture:GetAlpha(), coords, window.extra_param)
end
local acceptButton = DF:NewButton (buttonsBackground, nil, "$parentAcceptButton", nil, 100, 20, window.accept, nil, nil, nil, "Done", 1)
acceptButton:SetPoint ("topright", buttonsBackground, "topright", -8, -200)
acceptButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
function DF:RefreshImageEditor()
if (edit_texture.maximize) then
DetailsFrameworkImageEdit:SetSize (266, 226)
else
DetailsFrameworkImageEdit:SetSize (edit_texture.width, edit_texture.height)
end
local l, r, t, b = unpack (ttexcoord)
if (l > r) then
haveHFlip = true
leftSlider:SetValue (r * 100)
rightSlider:SetValue (l * 100)
else
haveHFlip = false
leftSlider:SetValue (l * 100)
rightSlider:SetValue (r * 100)
end
if (t > b) then
haveVFlip = true
topSlider:SetValue (b * 100)
bottomSlider:SetValue (t * 100)
else
haveVFlip = false
topSlider:SetValue (t * 100)
bottomSlider:SetValue (b * 100)
end
if (window.callback_func) then
window.accept (nil, nil, true)
end
end
window:Hide()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function DF:ImageEditor (callback, texture, texcoord, colors, width, height, extraParam, alpha, maximize)
if (not _G.DetailsFrameworkImageEdit) then
CreateImageEditorFrame()
local flipButtonH = DF:NewButton(buttonsBackground, nil, "$parentFlipButton", nil, 100, 20, flip, 1, nil, nil, "Flip H", 1)
flipButtonH:SetPoint("topright", buttonsBackground, "topright", -8, -140 + yMod)
flipButtonH:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--select area to crop
local dragFrame = CreateFrame("frame", nil, background_frame, "BackdropTemplate")
dragFrame:EnableMouse(false)
dragFrame:SetFrameStrata("TOOLTIP")
dragFrame:SetPoint("topleft", edit_texture.widget, "topleft")
dragFrame:SetPoint("bottomright", edit_texture.widget, "bottomright")
dragFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Worldmap\UI-QuestBlob-Inside]], tileSize = 256, tile = true})
dragFrame:SetBackdropColor(1, 1, 1, .2)
dragFrame:Hide()
local selectionBoxUp = dragFrame:CreateTexture(nil, "overlay")
selectionBoxUp:SetHeight(1)
selectionBoxUp:SetColorTexture(1, 1, 1)
local selectionBoxDown = dragFrame:CreateTexture(nil, "overlay")
selectionBoxDown:SetHeight(1)
selectionBoxDown:SetColorTexture(1, 1, 1)
local selectionBoxLeft = dragFrame:CreateTexture(nil, "overlay")
selectionBoxLeft:SetWidth(1)
selectionBoxLeft:SetColorTexture(1, 1, 1)
local selectionBoxRight = dragFrame:CreateTexture(nil, "overlay")
selectionBoxRight:SetWidth(1)
selectionBoxRight:SetColorTexture(1, 1, 1)
function dragFrame.ClearSelectionBoxPoints()
selectionBoxUp:ClearAllPoints()
selectionBoxDown:ClearAllPoints()
selectionBoxLeft:ClearAllPoints()
selectionBoxRight:ClearAllPoints()
end
local startCropFunc = function()
dragFrame:Show()
dragFrame:EnableMouse(true)
end
local cropSelection = DF:NewButton(buttonsBackground, nil, "$parentCropSelection", nil, 100, 20, startCropFunc, 2, nil, nil, "Crop Selection", 1)
cropSelection:InstallCustomTexture()
dragFrame.OnTick = function(self, deltaTime)
local x1, y1 = unpack(self.ClickedAt)
local x2, y2 = GetCursorPosition()
dragFrame.ClearSelectionBoxPoints()
if (x2 > x1) then
--right
if (y1 > y2) then
--top
selectionBoxUp:SetPoint("topleft", UIParent, "bottomleft", x1, y1)
selectionBoxUp:SetPoint("topright", UIParent, "bottomleft", x2, y1)
selectionBoxLeft:SetPoint("topleft", UIParent, "bottomleft", x1, y1)
selectionBoxLeft:SetPoint("bottomleft", UIParent, "bottomleft", x1, y2)
else
--bottom
end
else
--left
if (y2 > y1) then
--top
else
--bottom
end
local window = _G.DetailsFrameworkImageEditTable
texcoord = texcoord or {0, 1, 0, 1}
ttexcoord = texcoord
colors = colors or {1, 1, 1, 1}
alpha = alpha or 1
_G.DetailsFrameworkImageEdit_EditTexture:SetTexture (texture)
_G.DetailsFrameworkImageEdit_EditTexture.width = width
_G.DetailsFrameworkImageEdit_EditTexture.height = height
_G.DetailsFrameworkImageEdit_EditTexture.maximize = maximize
_G.DetailsFrameworkImageEdit_EditTexture:SetVertexColor (colors [1], colors [2], colors [3])
_G.DetailsFrameworkImageEdit_EditTexture:SetAlpha (alpha)
DF:ScheduleTimer ("RefreshImageEditor", 0.2)
window:Show()
window.callback_func = callback
window.extra_param = extraParam
DetailsFrameworkImageEditButtonsBg:Show()
DetailsFrameworkImageEditButtonsBg:SetBackdrop (nil)
table.wipe (window.hooks)
end
end
dragFrame:SetScript("OnMouseDown", function(self, MouseButton)
if (MouseButton == "LeftButton") then
self.ClickedAt = {GetCursorPosition()}
dragFrame:SetScript("OnUpdate", dragFrame.OnTick)
end
end)
dragFrame:SetScript("OnMouseUp", function(self, MouseButton)
if (MouseButton == "LeftButton") then
self.ReleaseAt = {GetCursorPosition()}
dragFrame:EnableMouse(false)
dragFrame:Hide()
dragFrame:SetScript("OnUpdate", nil)
print (self.ClickedAt[1], self.ClickedAt[2], self.ReleaseAt[1], self.ReleaseAt[2])
end
end)
--accept
editorWindow.accept = function(self, bottom, keepEditing)
if (not keepEditing) then
buttonsBackground:Hide()
editorWindow:Hide()
alphaFrame:Hide()
ColorPickerFrame:Hide()
end
local coords = {}
local left, right, top, bottom = leftSlider.value/100, rightSlider.value/100, topSlider.value/100, bottomSlider.value/100
if (haveHFlip) then
coords [1] = right
coords [2] = left
else
coords [1] = left
coords [2] = right
end
if (haveVFlip) then
coords [3] = bottom
coords [4] = top
else
coords [3] = top
coords [4] = bottom
end
return editorWindow.callback_func(edit_texture.width, edit_texture.height, {edit_texture:GetVertexColor()}, edit_texture:GetAlpha(), coords, editorWindow.extra_param)
end
local acceptButton = DF:NewButton(buttonsBackground, nil, "$parentAcceptButton", nil, 100, 20, editorWindow.accept, nil, nil, nil, "Done", 1)
acceptButton:SetPoint("topright", buttonsBackground, "topright", -8, -200)
acceptButton:SetTemplate(DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
function DF:RefreshImageEditor()
if (edit_texture.maximize) then
DetailsFrameworkImageEdit:SetSize(266, 226)
else
DetailsFrameworkImageEdit:SetSize(edit_texture.width, edit_texture.height)
end
local left, right, top, bottom = unpack(texCoordinates)
if (left > right) then
haveHFlip = true
leftSlider:SetValue(right * 100)
rightSlider:SetValue(left * 100)
else
haveHFlip = false
leftSlider:SetValue(left * 100)
rightSlider:SetValue(right * 100)
end
if (top > bottom) then
haveVFlip = true
topSlider:SetValue(bottom * 100)
bottomSlider:SetValue(top * 100)
else
haveVFlip = false
topSlider:SetValue(top * 100)
bottomSlider:SetValue(bottom * 100)
end
if (editorWindow.callback_func) then
editorWindow.accept(nil, nil, true)
end
end
editorWindow:Hide()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function DF:ImageEditor(callback, texture, texcoord, colors, width, height, extraParam, alpha, maximize)
if (not _G.DetailsFrameworkImageEdit) then
CreateImageEditorFrame()
end
local window = _G.DetailsFrameworkImageEditTable
texcoord = texcoord or {0, 1, 0, 1}
texCoordinates = texcoord
colors = colors or {1, 1, 1, 1}
alpha = alpha or 1
_G.DetailsFrameworkImageEdit_EditTexture:SetTexture(texture)
_G.DetailsFrameworkImageEdit_EditTexture.width = width
_G.DetailsFrameworkImageEdit_EditTexture.height = height
_G.DetailsFrameworkImageEdit_EditTexture.maximize = maximize
_G.DetailsFrameworkImageEdit_EditTexture:SetVertexColor(colors [1], colors [2], colors [3])
_G.DetailsFrameworkImageEdit_EditTexture:SetAlpha(alpha)
DF.Schedules.NewTimer(0.2, DF.RefreshImageEditor)
window:Show()
window.callback_func = callback
window.extra_param = extraParam
DetailsFrameworkImageEditButtonsBg:Show()
DetailsFrameworkImageEditButtonsBg:SetBackdrop(nil)
table.wipe(window.hooks)
end
+71 -21
View File
@@ -1287,12 +1287,20 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de
end
DF.AdjustmentSliderOptions = {
width = 120,
width = 70,
height = 20,
speed = 20, --speed is how many pixels the mouse has moved
scale_factor = 1,
}
DF.AdjustmentSliderFunctions = {
SetScaleFactor = function(self, scalar)
self.options.scale_factor = scalar or 1
end,
GetScaleFactor = function(self, scalar)
return self.options.scale_factor
end,
SetCallback = function(self, func)
self.callback = func
end,
@@ -1322,11 +1330,13 @@ DF.AdjustmentSliderFunctions = {
local yDelta = adjustmentSlider.MouseY - mouseY
if (adjustmentSlider.buttonPressed ~= "center") then
if (adjustmentSlider.buttonPressedTime+0.5 < GetTime()) then
if (adjustmentSlider.buttonPressedTime + 0.5 < GetTime()) then
local scaleResultBy = adjustmentSlider:GetScaleFactor()
if (adjustmentSlider.buttonPressed == "left") then
DF.AdjustmentSliderFunctions.RunCallback(adjustmentSlider, -1, 0, true)
DF.AdjustmentSliderFunctions.RunCallback(adjustmentSlider, -1 * scaleResultBy, 0, true)
elseif (adjustmentSlider.buttonPressed == "right") then
DF.AdjustmentSliderFunctions.RunCallback(adjustmentSlider, 1, 0, true)
DF.AdjustmentSliderFunctions.RunCallback(adjustmentSlider, 1 * scaleResultBy, 0, true)
end
end
@@ -1338,9 +1348,17 @@ DF.AdjustmentSliderFunctions = {
horizontalValue = DF:MapRangeClamped(-20, 20, -1, 1, xDelta)
verticalValue = DF:MapRangeClamped(-20, 20, -1, 1, yDelta)
local speed = 6 --how fast it moves
local mouseDirection = CreateVector2D(mouseX - adjustmentSlider.initialMouseX, mouseY - adjustmentSlider.initialMouseY)
local length = DF:MapRangeClamped(-100, 100, -1, 1, mouseDirection:GetLength())
mouseDirection:Normalize()
mouseDirection:ScaleBy(speed * length)
adjustmentSlider.centerArrowArtwork:SetPoint("center", adjustmentSlider.centerButton.widget, "center", mouseDirection:GetXY())
end
DF.AdjustmentSliderFunctions.RunCallback(adjustmentSlider, horizontalValue, verticalValue, false)
local scaleResultBy = adjustmentSlider:GetScaleFactor()
DF.AdjustmentSliderFunctions.RunCallback(adjustmentSlider, horizontalValue * scaleResultBy, verticalValue * scaleResultBy, false)
adjustmentSlider.MouseX = mouseX
adjustmentSlider.MouseY = mouseY
@@ -1355,10 +1373,8 @@ DF.AdjustmentSliderFunctions = {
button = button.MyObject
--change the icon
if (button.direction == "left") then
button:SetIcon([[Interface\BUTTONS\UI-SpellbookIcon-PrevPage-Down]])
elseif (button.direction == "right") then
button:SetIcon([[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Down]])
if (button.direction == "center") then
DF:DisableOnEnterScripts()
end
local adjustmentSlider = button:GetParent()
@@ -1368,6 +1384,8 @@ DF.AdjustmentSliderFunctions = {
local mouseX, mouseY = GetCursorPosition()
adjustmentSlider.MouseX = mouseX
adjustmentSlider.MouseY = mouseY
adjustmentSlider.initialMouseX = mouseX
adjustmentSlider.initialMouseY = mouseY
adjustmentSlider.buttonPressed = button.direction
@@ -1381,10 +1399,8 @@ DF.AdjustmentSliderFunctions = {
button = button.MyObject
--change the icon
if (button.direction == "left") then
button:SetIcon([[Interface\BUTTONS\UI-SpellbookIcon-PrevPage-Up]])
elseif (button.direction == "right") then
button:SetIcon([[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Up]])
if (button.direction == "center") then
DF:EnableOnEnterScripts()
end
local adjustmentSlider = button:GetParent()
@@ -1399,6 +1415,8 @@ DF.AdjustmentSliderFunctions = {
end
end
adjustmentSlider.centerArrowArtwork:SetPoint("center", adjustmentSlider.centerButton.widget, "center", 0, 0)
adjustmentSlider:SetScript("OnUpdate", nil)
end,
@@ -1424,10 +1442,8 @@ local createAdjustmentSliderFrames = function(parent, options, name)
DF:Mixin(adjustmentSlider, DF.PayloadMixin)
adjustmentSlider:BuildOptionsTable(DF.AdjustmentSliderOptions, options)
adjustmentSlider:SetSize(adjustmentSlider.options.width, adjustmentSlider.options.height)
--two buttons
local leftButton = DF:CreateButton(adjustmentSlider, function()end, 20, 20, "", "left", -1, nil, nil, name .. "LeftButton")
local rightButton = DF:CreateButton(adjustmentSlider, function()end, 20, 20, "", "right", 1, nil, nil, name .. "RightButton")
@@ -1438,22 +1454,31 @@ local createAdjustmentSliderFrames = function(parent, options, name)
leftButton:SetPoint("left", adjustmentSlider, "left", 0, 0)
rightButton:SetPoint("right", adjustmentSlider, "right", 0, 0)
leftButton:SetIcon([[Interface\BUTTONS\UI-SpellbookIcon-PrevPage-Up]])
rightButton:SetIcon([[Interface\BUTTONS\UI-SpellbookIcon-NextPage-Up]])
leftButton:SetIcon("Minimal_SliderBar_Button_Left", 8, 14)
rightButton:SetIcon("Minimal_SliderBar_Button_Right", 8, 14)
leftButton.direction = "left"
rightButton.direction = "right"
--center button
local centerButton = DF:CreateButton(adjustmentSlider, function()end, 20, 20, "", "center", 0, nil, nil, name .. "CenterButton")
centerButton:SetPoint("center", adjustmentSlider, "center", 0, 0)
centerButton:SetIcon([[Interface\BUTTONS\YellowOrange64_Radial]])
centerButton:SetPoint("center", adjustmentSlider, "center", -3, 0)
centerButton:SetIcon("Minimal_SliderBar_Button", nil, nil, nil, nil, "transparent")
centerButton.direction = "center"
centerButton:SetHook("OnMouseDown", DF.AdjustmentSliderFunctions.OnButtonDownkHook)
centerButton:SetHook("OnMouseUp", DF.AdjustmentSliderFunctions.OnButtonUpHook)
local centerArrowArtwork = centerButton:CreateTexture("$parentCenterArrowArtwork", "artwork")
centerArrowArtwork:SetAtlas("Minimal_SliderBar_Button")
centerArrowArtwork:SetPoint("center", centerButton.widget, "center", 0, 0)
centerArrowArtwork:SetSize(16, 16)
centerArrowArtwork:SetAlpha(1)
adjustmentSlider.leftButton = leftButton
adjustmentSlider.rightButton = rightButton
adjustmentSlider.centerButton = centerButton
adjustmentSlider.centerArrowArtwork = centerArrowArtwork
return adjustmentSlider
end
@@ -1469,11 +1494,36 @@ function DF:CreateAdjustmentSlider(parent, callback, options, name, ...)
DF.SliderCounter = DF.SliderCounter + 1
elseif (not parent) then
return error("Details! FrameWork: parent not found.", 2)
return error("DF:CreateAdjustmentSlider(): parent not found.", 2)
end
local ASFrame = createAdjustmentSliderFrames(parent, options, name)
ASFrame:SetPayload(...)
ASFrame.callback = callback
return ASFrame
end
----------------------------------------------------------------------------------------------------------------
function DF:DisableOnEnterScripts()
local ignoreOnEnterZone = DF:CreateOnEnterIgnoreZone()
ignoreOnEnterZone:Show()
end
function DF:EnableOnEnterScripts()
local ignoreOnEnterZone = DF:CreateOnEnterIgnoreZone()
ignoreOnEnterZone:Hide()
end
function DF:CreateOnEnterIgnoreZone()
if (not _G.DetailsFrameworkIgnoreHoverOverFrame) then
local ignoreOnEnterFrame = CreateFrame("frame", "DetailsFrameworkIgnoreHoverOverFrame", UIParent)
ignoreOnEnterFrame:SetFrameStrata("TOOLTIP")
ignoreOnEnterFrame:SetFrameLevel(9999)
ignoreOnEnterFrame:SetAllPoints()
ignoreOnEnterFrame:EnableMouse(true)
ignoreOnEnterFrame:Hide()
end
return _G.DetailsFrameworkIgnoreHoverOverFrame
end
+20 -10
View File
@@ -18,7 +18,7 @@
_detalhes.BFACORE = 131 --core version on BFA launch
_detalhes.SHADOWLANDSCORE = 143 --core version on Shadowlands launch
--
_detalhes.dragonflight_beta_version = 32
_detalhes.dragonflight_beta_version = 33
Details = _detalhes
@@ -495,7 +495,17 @@ do
{Name = "On Spec Change", Desc = "Run code when the player has changed its specialization.", Value = 5, ProfileKey = "on_specchanged"},
{Name = "On Enter/Leave Group", Desc = "Run code when the player has entered or left a party or raid group.", Value = 6, ProfileKey = "on_groupchange"},
}
--run a function without stopping the execution in case of an error
function Details.SafeRun(func, executionName, ...)
local runToCompletion, errorText = pcall(func, ...)
if (not runToCompletion) then
if (Details.debug) then
Details:Msg("Safe run failed:", executionName, errorText)
end
end
end
--> tooltip
_detalhes.tooltip_backdrop = {
bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]],
@@ -953,26 +963,26 @@ do
--> welcome
function _detalhes:WelcomeMsgLogon()
_detalhes:Msg ("you can always reset the addon running the command |cFFFFFF00'/details reinstall'|r if it does fail to load after being updated.")
function _detalhes:wipe_combat_after_failed_load()
_detalhes.tabela_historico = _detalhes.historico:NovoHistorico()
_detalhes.tabela_overall = _detalhes.combate:NovaTabela()
_detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall)
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
_detalhes:UpdateContainerCombatentes()
_detalhes_database.tabela_overall = nil
_detalhes_database.tabela_historico = nil
_detalhes:Msg ("seems failed to load, please type /reload to try again.")
end
_detalhes:ScheduleTimer ("wipe_combat_after_failed_load", 5)
Details.Schedules.After(5, _detalhes.wipe_combat_after_failed_load)
end
_detalhes.failed_to_load = _detalhes:ScheduleTimer ("WelcomeMsgLogon", 20)
Details.failed_to_load = C_Timer.NewTimer(1, function() Details.Schedules.NewTimer(20, _detalhes.WelcomeMsgLogon) end)
--> key binds
--> header
_G ["BINDING_HEADER_Details"] = "Details!"
+35 -34
View File
@@ -786,24 +786,24 @@
return actor_table.value
end
function atributo_custom:SetValue (actor, actortotal, name_complement)
function atributo_custom:SetValue(actor, actortotal, name_complement)
local actor_table = self:GetActorTable (actor, name_complement)
actor_table.my_actor = actor
actor_table.value = actortotal
end
function atributo_custom:UpdateClass (actors)
function atributo_custom:UpdateClass(actors)
actors.new_actor.classe = actors.actor.classe
end
function atributo_custom:HasActor (actor)
function atributo_custom:HasActor(actor)
return self._NameIndexTable [actor.nome or actor.name] and true or false
end
function atributo_custom:GetNumActors()
return #self._ActorTable
end
function atributo_custom:GetTotalAndHighestValue()
local total, top = 0, 0
for i, actor in ipairs (self._ActorTable) do
@@ -814,19 +814,19 @@
end
return total, top
end
local icon_cache = {}
function atributo_custom:GetActorTable (actor, name_complement)
local index = self._NameIndexTable [actor.nome or actor.name]
function atributo_custom:GetActorTable(actor, name_complement)
local index = self._NameIndexTable[actor.nome or actor.name]
if (index) then
return self._ActorTable [index]
return self._ActorTable[index]
else
--> if is a spell object
--if is a spell object
local class
if (actor.id) then
local spellname, _, icon = _GetSpellInfo (actor.id)
local spellname, _, icon = _GetSpellInfo(actor.id)
if (not icon_cache [spellname] and spellname) then
icon_cache [spellname] = icon
elseif (not spellname) then
@@ -856,7 +856,7 @@
end
end
local new_actor = _setmetatable ({
local newActor = _setmetatable ({
nome = actor.nome or actor.name,
classe = class,
value = _detalhes:GetOrderNumber(),
@@ -864,45 +864,46 @@
color = actor.color,
}, atributo_custom.mt)
new_actor.name_complement = name_complement
new_actor.displayName = actor.displayName or (_detalhes:GetOnlyName (new_actor.nome) .. (name_complement or ""))
new_actor.spec = actor.spec
newActor.name_complement = name_complement
newActor.displayName = actor.displayName or (_detalhes:GetOnlyName (newActor.nome) .. (name_complement or ""))
newActor.spec = actor.spec
new_actor.enemy = actor.enemy
new_actor.role = actor.role
new_actor.arena_enemy = actor.arena_enemy
new_actor.arena_ally = actor.arena_ally
new_actor.arena_team = actor.arena_team
newActor.enemy = actor.enemy
newActor.role = actor.role
newActor.arena_enemy = actor.arena_enemy
newActor.arena_ally = actor.arena_ally
newActor.arena_team = actor.arena_team
if (actor.id) then
new_actor.id = actor.id
newActor.id = actor.id
--icon
if (icon_cache [actor.nome]) then
new_actor.icon = icon_cache [actor.nome]
newActor.icon = icon_cache [actor.nome]
else
local _, _, icon = _GetSpellInfo (actor.id)
if (icon) then
icon_cache [actor.nome] = icon
new_actor.icon = icon
newActor.icon = icon
end
end
else
if (not new_actor.classe) then
new_actor.classe = _detalhes:GetClass (actor.nome or actor.name) or "UNKNOW"
if (not newActor.classe) then
newActor.classe = Details:GetClass(actor.nome or actor.name) or "UNKNOW"
end
if (new_actor.classe == "UNGROUPPLAYER") then
atributo_custom:ScheduleTimer ("UpdateClass", 5, {new_actor = new_actor, actor = actor})
if (newActor.classe == "UNGROUPPLAYER") then
--atributo_custom:ScheduleTimer ("UpdateClass", 5, {newActor = newActor, actor = actor})
Details.Schedules.NewTimer(5, atributo_custom.UpdateClass, {new_actor = newActor, actor = actor})
end
end
index = #self._ActorTable+1
self._ActorTable [index] = new_actor
self._NameIndexTable [actor.nome or actor.name] = index
return new_actor
self._ActorTable[index] = newActor
self._NameIndexTable[actor.nome or actor.name] = index
return newActor
end
end
function atributo_custom:GetInstanceCustomActorContainer (instance)
if (not atributo_custom._InstanceActorContainer [instance:GetId()]) then
atributo_custom._InstanceActorContainer [instance:GetId()] = self:CreateCustomActorContainer()
+57 -56
View File
@@ -182,6 +182,10 @@ function _detalhes:GetWindow (id)
return _detalhes.tabela_instancias [id]
end
function Details:GetNumInstances()
return #_detalhes.tabela_instancias
end
function _detalhes:GetId()
return self.meu_id
end
@@ -2024,43 +2028,45 @@ end
------------------------------------------------------------------------------------------------------------------------
function _detalhes:PostponeSwitchToCurrent (instance)
function Details:PostponeSwitchToCurrent(instance)
if (
not instance.last_interaction or
not instance.last_interaction or
(
(instance.ativa) and
(instance.last_interaction+3 < _detalhes._tempo) and
(not DetailsReportWindow or not DetailsReportWindow:IsShown()) and
(not _detalhes.playerDetailWindow:IsShown())
(instance.last_interaction+3 < Details._tempo) and
(not DetailsReportWindow or not DetailsReportWindow:IsShown()) and
(not Details.playerDetailWindow:IsShown())
)
) then
instance._postponing_switch = nil
if (instance.segmento > 0 and instance.auto_current) then
instance:TrocaTabela (0) --> muda o segmento pra current
instance:InstanceAlert (Loc ["STRING_CHANGED_TO_CURRENT"], {[[Interface\AddOns\Details\images\toolbar_icons]], 18, 18, false, 32/256, 64/256, 0, 1}, 6)
instance:TrocaTabela(0) --> muda o segmento pra current
instance:InstanceAlert(Loc ["STRING_CHANGED_TO_CURRENT"], {[[Interface\AddOns\Details\images\toolbar_icons]], 18, 18, false, 32/256, 64/256, 0, 1}, 6)
return
else
return
end
end
if (instance.is_interacting and instance.last_interaction < _detalhes._tempo) then
instance.last_interaction = _detalhes._tempo
if (instance.is_interacting and instance.last_interaction < Details._tempo) then
instance.last_interaction = Details._tempo
end
instance._postponing_switch = _detalhes:ScheduleTimer ("PostponeSwitchToCurrent", 1, instance)
--instance._postponing_switch = Details:ScheduleTimer ("PostponeSwitchToCurrent", 1, instance)
instance._postponing_switch = Details.Schedules.NewTimer(1, Details.PostponeSwitchToCurrent, instance)
end
function _detalhes:CheckSwitchToCurrent()
for _, instance in _ipairs (_detalhes.tabela_instancias) do
function Details:CheckSwitchToCurrent()
for _, instance in _ipairs (Details.tabela_instancias) do
if (instance.ativa and instance.auto_current and instance.baseframe and instance.segmento > 0) then
if (instance.is_interacting and instance.last_interaction < _detalhes._tempo) then
instance.last_interaction = _detalhes._tempo
if (instance.is_interacting and instance.last_interaction < Details._tempo) then
instance.last_interaction = Details._tempo
end
if ((instance.last_interaction and (instance.last_interaction+3 > _detalhes._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (_detalhes.playerDetailWindow:IsShown())) then
if ((instance.last_interaction and (instance.last_interaction+3 > Details._tempo)) or (DetailsReportWindow and DetailsReportWindow:IsShown()) or (Details.playerDetailWindow:IsShown())) then
--> postpone
instance._postponing_switch = _detalhes:ScheduleTimer ("PostponeSwitchToCurrent", 1, instance)
--instance._postponing_switch = Details:ScheduleTimer ("PostponeSwitchToCurrent", 1, instance)
instance._postponing_switch = Details.Schedules.NewTimer(1, Details.PostponeSwitchToCurrent, instance)
else
instance:TrocaTabela (0) --> muda o segmento pra current
instance:TrocaTabela(0) --> muda o segmento pra current
instance:InstanceAlert (Loc ["STRING_CHANGED_TO_CURRENT"], {[[Interface\AddOns\Details\images\toolbar_icons]], 18, 18, false, 32/256, 64/256, 0, 1}, 6)
instance._postponing_switch = nil
end
@@ -2068,7 +2074,7 @@ function _detalhes:CheckSwitchToCurrent()
end
end
function _detalhes:Freeze (instancia)
function Details:Freeze (instancia)
if (not instancia) then
instancia = self
@@ -2185,11 +2191,11 @@ local function ValidateAttribute (atributo, sub_atributo)
return true
end
function _detalhes:SetDisplay (segmento, atributo, sub_atributo, iniciando_instancia, InstanceMode)
function _detalhes:SetDisplay(segment, attribute, subAttribute, isInstanceStarup, instanceMode)
if (not self.meu_id) then
return
end
return self:TrocaTabela (segmento, atributo, sub_atributo, iniciando_instancia, InstanceMode)
return self:TrocaTabela(self, segment, attribute, subAttribute, isInstanceStarup, instanceMode)
end
function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, iniciando_instancia, InstanceMode)
@@ -2202,11 +2208,11 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
segmento = instancia
instancia = self
end
if (iniciando_instancia == "LeftButton") then
iniciando_instancia = nil
end
if (_type (instancia) == "number") then
sub_atributo = atributo
atributo = segmento
@@ -2214,46 +2220,44 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
instancia = self
end
--Details:GetWindow(1):SetDisplay(DETAILS_SEGMENTID_CURRENT, 1, 1, false, DETAILS_MODE_GROUP) InstanceMode is nil on this example
if (InstanceMode and InstanceMode ~= instancia:GetMode()) then
instancia:AlteraModo (instancia, InstanceMode)
instancia:AlteraModo(instancia, InstanceMode)
end
local update_coolTip = false
local sub_attribute_click = false
if (_type (segmento) == "boolean" and segmento) then --> clicou em um sub atributo
sub_attribute_click = true
segmento = instancia.segmento
elseif (segmento == -2) then --> clicou para mudar de segmento
segmento = instancia.segmento + 1
if (segmento > _detalhes.segments_amount) then
segmento = -1
end
update_coolTip = true
elseif (segmento == -3) then --> clicou para mudar de atributo
segmento = instancia.segmento
atributo = instancia.atributo+1
if (atributo > atributos[0]) then
atributo = 1
end
update_coolTip = true
elseif (segmento == -4) then --> clicou para mudar de sub atributo
segmento = instancia.segmento
sub_atributo = instancia.sub_atributo+1
if (sub_atributo > atributos[instancia.atributo]) then
sub_atributo = 1
end
update_coolTip = true
end
end
--> pega os atributos desta instancia
local current_segmento = instancia.segmento
local current_atributo = instancia.atributo
@@ -2456,37 +2460,36 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
end
if (sub_atributo ~= current_sub_atributo or _detalhes.initializing or iniciando_instancia or atributo_changed) then
instancia.sub_atributo = sub_atributo
if (sub_attribute_click) then
instancia.sub_atributo_last [instancia.atributo] = instancia.sub_atributo
instancia.sub_atributo_last[instancia.atributo] = instancia.sub_atributo
end
if (instancia.atributo == 5) then --> custom
instancia:ChangeIcon()
end
_detalhes:InstanceCall (_detalhes.CheckPsUpdate)
_detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, atributo, sub_atributo)
Details:InstanceCall(Details.CheckPsUpdate)
Details:SendEvent("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, atributo, sub_atributo)
instancia:ChangeIcon()
end
if (_detalhes.playerDetailWindow:IsShown() and instancia == _detalhes.playerDetailWindow.instancia) then
if (Details.playerDetailWindow:IsShown() and instancia == Details.playerDetailWindow.instancia) then
if (not instancia.showing or instancia.atributo > 4) then
_detalhes:FechaJanelaInfo()
Details:FechaJanelaInfo()
else
local actor = instancia.showing (instancia.atributo, _detalhes.playerDetailWindow.jogador.nome)
local actor = instancia.showing (instancia.atributo, Details.playerDetailWindow.jogador.nome)
if (actor) then
instancia:AbreJanelaInfo (actor, true)
else
_detalhes:FechaJanelaInfo()
Details:FechaJanelaInfo()
end
end
--_detalhes:FechaJanelaInfo()
end
--if there's no combat object to show, freeze the window
if (not instancia.showing) then
if (not iniciando_instancia) then
instancia:Freeze()
@@ -2495,16 +2498,14 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
else
--> verificar relogio, precisaria dar refresh no plugin clock
end
instancia.v_barras = true
instancia.showing [atributo].need_refresh = true
instancia.showing[atributo].need_refresh = true
if (not _detalhes.initializing and not iniciando_instancia) then
if (not Details.initializing and not iniciando_instancia) then
instancia:ResetaGump()
instancia:RefreshMainWindow (true)
instancia:RefreshMainWindow(true)
end
end
function _detalhes:GetRaidPluginName()
+121 -15
View File
@@ -9,6 +9,7 @@ local floor = floor
local GetNumGroupMembers = GetNumGroupMembers
local CONST_INSPECT_ACHIEVEMENT_DISTANCE = 1 --Compare Achievements, 28 yards
local CONST_SPELLBOOK_CLASSSPELLS_TABID = 2
local storageDebug = false --remember to turn this to false!
local store_instances = _detalhes.InstancesToStoreData
@@ -2283,16 +2284,20 @@ end
function _detalhes.ilevel:GetInOrder()
local order = {}
for guid, t in pairs (_detalhes.item_level_pool) do
order [#order+1] = {t.name, t.ilvl or 0, t.time}
for guid, t in pairs(_detalhes.item_level_pool) do
order[#order+1] = {t.name, t.ilvl or 0, t.time}
end
table.sort (order, _detalhes.Sort2)
table.sort(order, _detalhes.Sort2)
return order
end
function Details.ilevel:ClearIlvl(guid)
Details.item_level_pool[guid] = nil
end
function _detalhes:GetTalents (guid)
return _detalhes.cached_talents [guid]
end
@@ -2355,8 +2360,8 @@ function Details:DecompressData (data, dataType)
return false
end
end
local dataSerialized = LibDeflate:DecompressDeflate (dataCompressed)
if (not dataSerialized) then
Details:Msg ("couldn't uncompress the data.")
return false
@@ -2787,7 +2792,6 @@ local getSpellList = function(specIndex, completeListOfSpells, sharedSpellsBetwe
end
local configInfo = C_Traits.GetConfigInfo(configId)
--get the spells from the SPEC from talents
for treeIndex, treeId in ipairs(configInfo.treeIDs) do
local treeNodes = C_Traits.GetTreeNodes(treeId)
@@ -2836,7 +2840,7 @@ local getSpellList = function(specIndex, completeListOfSpells, sharedSpellsBetwe
end
--get shared spells from the spell book
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(2)
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(CONST_SPELLBOOK_CLASSSPELLS_TABID)
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
@@ -2868,11 +2872,6 @@ function Details.GenerateSpecSpellList()
local sharedSpellsBetweenSpecs = {}
local specNames = {}
_G.SPELLS_FROM_THIS_CLASS = _G.SPELLS_FROM_THIS_CLASS or {
sharedSpells = {},
specNames = {}
}
local amountSpecs = GetNumSpecializationsForClassID(classId)
local totalTimeToWait = 0
@@ -2938,4 +2937,111 @@ function Details.GenerateSpecSpellList()
Details:Dump({result})
end
end)
end
end
function Details.FillTableWithPlayerSpells(completeListOfSpells)
local specId, specName, _, specIconTexture = GetSpecializationInfo(GetSpecialization())
local classNameLoc, className, classId = UnitClass("player")
--get spells from talents
local configId = C_ClassTalents.GetActiveConfigID()
if (configId) then
local configInfo = C_Traits.GetConfigInfo(configId)
--get the spells from the SPEC from talents
for treeIndex, treeId in ipairs(configInfo.treeIDs) do
local treeNodes = C_Traits.GetTreeNodes(treeId)
for nodeIdIndex, treeNodeID in ipairs(treeNodes) do
local traitNodeInfo = C_Traits.GetNodeInfo(configId, treeNodeID)
if (traitNodeInfo) then
local entryIds = traitNodeInfo.entryIDs
for i = 1, #entryIds do
local entryId = entryIds[i] --number
local traitEntryInfo = C_Traits.GetEntryInfo(configId, entryId)
local borderTypes = Enum.TraitNodeEntryType
if (traitEntryInfo.type == borderTypes.SpendSquare) then
local definitionId = traitEntryInfo.definitionID
local traitDefinitionInfo = C_Traits.GetDefinitionInfo(definitionId)
local spellId = traitDefinitionInfo.overriddenSpellID or traitDefinitionInfo.spellID
local spellName, _, spellTexture = GetSpellInfo(spellId)
if (spellName) then
completeListOfSpells[spellId] = completeListOfSpells[spellId] or true
end
end
end
end
end
end
end
--get spells from the Spec spellbook
for i = 1, GetNumSpellTabs() do
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(i)
if (tabTexture == specIconTexture) then
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
if (spellId) then
if (spellType == "SPELL") then
spellId = C_SpellBook.GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local isPassive = IsPassiveSpell(entryOffset, "player")
if (spellName and not isPassive) then
completeListOfSpells[spellId] = completeListOfSpells[spellId] or true
end
end
end
end
end
end
--get class shared spells from the spell book
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(CONST_SPELLBOOK_CLASSSPELLS_TABID)
offset = offset + 1
local tabEnd = offset + numSpells
for entryOffset = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player")
if (spellId) then
if (spellType == "SPELL") then
spellId = C_SpellBook.GetOverrideSpell(spellId)
local spellName = GetSpellInfo(spellId)
local isPassive = IsPassiveSpell(entryOffset, "player")
if (spellName and not isPassive) then
completeListOfSpells[spellId] = completeListOfSpells[spellId] or true
end
end
end
end
end
function Details.GetPlayTimeOnClass()
local className = select(2, UnitClass("player"))
if (className) then
local playedTime = Details.class_time_played[className]
if (playedTime) then
playedTime = playedTime + (GetTime() - Details.GetStartupTime())
return playedTime
end
end
return 0
end
function Details.GetPlayTimeOnClassString()
local playedTime = Details.GetPlayTimeOnClass()
local days = floor(playedTime / 86400) .. " days"
playedTime = playedTime % 86400
local hours = floor(playedTime / 3600) .. " hours"
playedTime = playedTime % 3600
local minutes = floor(playedTime / 60) .. " minutes"
local expansionLevel = GetExpansionLevel()
local expansionName = _G["EXPANSION_NAME" .. GetExpansionLevel()]
return "|cffffff00Time played this class (" .. expansionName .. "): " .. days .. " " .. hours .. " " .. minutes
end
local timePlayerFrame = CreateFrame("frame")
timePlayerFrame:RegisterEvent("TIME_PLAYED_MSG")
timePlayerFrame:SetScript("OnEvent", function()
C_Timer.After(0, function() print(Details.GetPlayTimeOnClassString()) end)
end)
+12 -12
View File
@@ -870,9 +870,9 @@
end
--end
if (isTBC) then
if (isTBC or isWOTLK) then
--is the target an enemy with judgement of light?
if (TBC_JudgementOfLightCache[alvo_name]) then
if (TBC_JudgementOfLightCache[alvo_name] and false) then
--store the player name which just landed a damage
TBC_JudgementOfLightCache._damageCache[who_name] = {time, alvo_name}
end
@@ -2147,7 +2147,7 @@
cura_efetiva = cura_efetiva + amount - overhealing
end
if (isTBC) then
if (isTBC or isWOTLK) then
--earth shield
if (spellid == SPELLID_SHAMAN_EARTHSHIELD_HEAL) then
--get the information of who placed the buff into this actor
@@ -2169,7 +2169,7 @@
TBC_LifeBloomLatestHeal = cura_efetiva
return
elseif (spellid == 27163) then --Judgement of Light (paladin)
elseif (spellid == 27163 and false) then --Judgement of Light (paladin) --disabled on 25 September 2022
--check if the hit was landed in the same cleu tick
local hitCache = TBC_JudgementOfLightCache._damageCache[who_name]
@@ -2513,14 +2513,14 @@
necro_cheat_deaths[who_serial] = true
end
if (isTBC) then
if (isTBC or isWOTLK) then
if (SHAMAN_EARTHSHIELD_BUFF[spellid]) then
TBC_EarthShieldCache[alvo_name] = {who_serial, who_name, who_flags}
elseif (spellid == SPELLID_PRIEST_POM_BUFF) then
TBC_PrayerOfMendingCache [alvo_name] = {who_serial, who_name, who_flags}
elseif (spellid == 27163) then --Judgement Of Light
elseif (spellid == 27163 and false) then --Judgement Of Light
TBC_JudgementOfLightCache[alvo_name] = {who_serial, who_name, who_flags}
end
end
@@ -2568,8 +2568,8 @@
_detalhes.tabela_pets:Adicionar(alvo_serial, alvo_name, alvo_flags, who_serial, who_name, 0x00000417)
end
if (isTBC) then --buff applied
if (spellid == 27162) then --Judgement Of Light
if (isTBC or isWOTLK) then --buff applied
if (spellid == 27162 and false) then --Judgement Of Light
--which player applied the judgement of light on this mob
TBC_JudgementOfLightCache[alvo_name] = {who_serial, who_name, who_flags}
end
@@ -2845,8 +2845,8 @@
bargastBuffs[alvo_serial] = (bargastBuffs[alvo_serial] or 0) + 1
end
if (isTBC) then --buff refresh
if (spellid == 27162) then --Judgement Of Light
if (isTBC or isWOTLK) then --buff refresh
if (spellid == 27162 and false) then --Judgement Of Light
--which player applied the judgement of light on this mob
TBC_JudgementOfLightCache[alvo_name] = {who_serial, who_name, who_flags}
end
@@ -3020,8 +3020,8 @@
who_serial, who_name, who_flags = "", enemyName, 0xa48
end
if (isTBC) then --buff removed
if (spellid == 27162) then --Judgement Of Light
if (isTBC or isWOTLK) then --buff removed
if (spellid == 27162 and false) then --Judgement Of Light
TBC_JudgementOfLightCache[alvo_name] = nil
end
end
+4 -7
View File
@@ -6021,9 +6021,10 @@ function _detalhes:SetTooltipMinWidth()
end
function _detalhes:FormatCooltipBackdrop()
local CoolTip = GameCooltip
CoolTip:SetBackdrop (1, menus_backdrop, menus_backdropcolor, menus_bordercolor)
CoolTip:SetBackdrop (2, menus_backdrop, menus_backdropcolor_sec, menus_bordercolor)
--local CoolTip = GameCooltip
--CoolTip:SetBackdrop (1, menus_backdrop, menus_backdropcolor, menus_bordercolor)
--CoolTip:SetBackdrop (2, menus_backdrop, menus_backdropcolor_sec, menus_bordercolor)
return true
end
local build_mode_list = function (self, elapsed)
@@ -6042,16 +6043,12 @@ local build_mode_list = function (self, elapsed)
CoolTip:SetOption ("TextSize", _detalhes.font_sizes.menus)
CoolTip:SetOption ("TextFont", _detalhes.font_faces.menus)
CoolTip:SetOption ("ButtonHeightModSub", -2)
CoolTip:SetOption ("ButtonHeightMod", -5)
CoolTip:SetOption ("ButtonsYModSub", -3)
CoolTip:SetOption ("ButtonsYMod", -6)
CoolTip:SetOption ("YSpacingModSub", -3)
CoolTip:SetOption ("YSpacingMod", 1)
CoolTip:SetOption ("HeighMod", 3)
CoolTip:SetOption ("SubFollowButton", true)
+201 -99
View File
@@ -1,4 +1,6 @@
--build data for OpenRaidLibrary, so addons can use it to know about cooldown types
--this code should run only on beta periods of an new expansion
local Details = _G.Details
local DF = _G.DetailsFramework
@@ -8,64 +10,185 @@ local startX = 5
local headerY = -30
local scrollY = headerY - 20
local targetCharacter = ""
local backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}
local backdrop_color = {.2, .2, .2, 0.2}
local backdrop_color_2 = {.4, .4, .4, 0.2}
local backdrop_color_on_enter = {.6, .6, .6, 0.3}
local backdrop_color_is_critical = {.4, .4, .2, 0.2}
local backdrop_color_is_critical_on_enter = {1, 1, .8, 0.4}
local scroll_width = 1180
local windowHeight = 600
local windowHeight = 620
local scrollLines = 26
local scrollLineHeight = 20
function Details.OpenSpellCategoryScreen()
--namespace
Details.Survey = {}
function Details.Survey.GetTargetCharacterForRealm()
return "Fistbirtbrez"
end
function Details.Survey.GetCategorySpellListForClass()
local savedSpellsCategories = Details.spell_category_savedtable
local unitClass = select(2, UnitClass("player"))
local thisClassSavedTable = savedSpellsCategories[unitClass]
if (not thisClassSavedTable) then
thisClassSavedTable = {}
savedSpellsCategories[unitClass] = thisClassSavedTable
end
Details.FillTableWithPlayerSpells(thisClassSavedTable)
return thisClassSavedTable
end
function Details.Survey.SendSpellCatogeryDataToTargetCharacter()
local targetCharacter = Details.Survey.GetTargetCharacterForRealm()
if (not targetCharacter) then
return
end
local thisClassSavedTable = Details.Survey.GetCategorySpellListForClass()
local LibDeflate = LibStub:GetLibrary("LibDeflate", true)
local hasAnyEntry = false
local dataToSend = "SPLS|"
for spellId, value in pairs(thisClassSavedTable) do
if (type(value) == "number" and value > 1) then
hasAnyEntry = true
dataToSend = dataToSend .. spellId .. "." .. value .. ","
end
end
--only send if there's any data to send
if (hasAnyEntry) then
if (Details.spell_category_latest_sent < time() - (3600 * 6)) then --do not allow to send data more than once every six hours
local compressedData = LibDeflate:CompressDeflate(dataToSend, {level = 9})
local encodedData = LibDeflate:EncodeForWoWAddonChannel(compressedData)
Details:SendCommMessage("DTAU", encodedData, "WHISPER", targetCharacter)
if (DetailsSpellCategoryFrame) then
DetailsSpellCategoryFrame:Hide()
end
Details.spell_category_latest_sent = time()
end
end
end
function Details.Survey.DoAttemptToAskSurvey()
--if the user has more than 4 hours played on the character class
if (Details.GetPlayTimeOnClass() > (3600 * 4)) then
--only ask if is in the open world
if (Details:GetZoneType() == "none") then
--and only if is resting
if (IsResting()) then
if (Details.spell_category_latest_query < time() - 524800) then --one week, kinda
Details.spell_category_latest_query = time()
Details.Survey.AskForOpeningSpellCategoryScreen()
end
end
end
end
end
function Details.Survey.OpenSurveyPanel()
return Details.Survey.OpenSpellCategoryScreen()
end
function Details.Survey.InitializeSpellCategoryFeedback()
local targetCharacter = Details.Survey.GetTargetCharacterForRealm()
if (not targetCharacter) then
return
end
local function myChatFilter(self, event, msg, author, ...)
if (msg:find(targetCharacter)) then
return true
end
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", myChatFilter) --system messages = prints or yellow messages, does not include regular chat
Details.Survey.SendSpellCatogeryDataToTargetCharacter()
C_Timer.After(15, Details.Survey.DoAttemptToAskSurvey)
end
function Details.Survey.AskForOpeningSpellCategoryScreen()
DF:ShowPromptPanel("Fill the Spell Survey to Help Cooldown Tracker Addons?", function() Details.Survey.OpenSpellCategoryScreen() end, function() Details:Msg("FINE! won't ask again for another week...") end)
end
function Details.Survey.OpenSpellCategoryScreen()
if (not Details.Survey.GetTargetCharacterForRealm()) then
Details:Msg("No survey at the moment.")
return
end
if (not DetailsSpellCategoryFrame) then
DetailsSpellCategoryFrame = DetailsFramework:CreateSimplePanel(UIParent)
local detailsSpellCategoryFrame = DetailsSpellCategoryFrame
detailsSpellCategoryFrame:SetSize(scroll_width, windowHeight)
detailsSpellCategoryFrame:SetTitle("Details Spell Categories")
detailsSpellCategoryFrame:SetSize(scroll_width, windowHeight+26)
detailsSpellCategoryFrame:SetTitle("Identifying and Categorizing Cooldown Spells")
detailsSpellCategoryFrame.Data = {}
--statusbar
local statusBar = CreateFrame("frame", nil, detailsSpellCategoryFrame, "BackdropTemplate")
statusBar:SetPoint("bottomleft", detailsSpellCategoryFrame, "bottomleft")
statusBar:SetPoint("bottomright", detailsSpellCategoryFrame, "bottomright")
statusBar:SetHeight(20)
statusBar:SetHeight(26)
statusBar:SetAlpha (0.8)
DF:ApplyStandardBackdrop(statusBar)
--statusbar of the statusbar
local statusBar2 = CreateFrame("frame", nil, statusBar, "BackdropTemplate")
statusBar2:SetPoint("topleft", statusBar, "bottomleft")
statusBar2:SetPoint("topright", statusBar, "bottomright")
statusBar2:SetHeight(20)
statusBar2:SetAlpha (0.8)
DF:ApplyStandardBackdrop(statusBar2)
DF:ApplyStandardBackdrop(statusBar2)
local dataInfoLabel = DF:CreateLabel(statusBar2, "This cooldown data is send to people on Details! team and shared in 'Open Raid' library where any weakaura or addon can use it", 12, "silver")
dataInfoLabel:SetPoint("center", 0, 0)
dataInfoLabel.justifyH = "center"
--create the header
local headerTable = {
{text = "Icon", width = 24},
{text = "Spell Name", width = 100},
{text = "NONE", width = 120},
{text = "Offensive CD", width = 120},
{text = "Spell Name", width = 140},
{text = "NONE", width = 70},
{text = "Offensive CD", width = 100},
{text = "Personal Defensive CD", width = 120},
{text = "Targeted Defensive CD", width = 120},
{text = "Raid Defensive CD", width = 120},
{text = "Raid Utility CD", width = 120},
{text = "Interrupt", width = 120},
{text = "Dispel", width = 120},
{text = "CC", width = 120},
{text = "Raid Utility CD", width = 100},
{text = "Interrupt", width = 70},
{text = "Dispel", width = 50},
{text = "CC", width = 50},
}
local headerOptions = {
padding = 2,
}
local savedSpellsCategories = Details.spell_category_savedtable
local unitClass = select(2, UnitClass("player"))
local thisClassSavedTable = savedSpellsCategories[unitClass]
if (not thisClassSavedTable) then
thisClassSavedTable = {}
savedSpellsCategories[unitClass] = thisClassSavedTable
local maxLineWidth = 20
for headerIndex, headerSettings in pairs(headerTable) do
maxLineWidth = maxLineWidth + headerSettings.width
end
detailsSpellCategoryFrame:SetWidth(maxLineWidth + 20)
local thisClassSavedTable = Details.Survey.GetCategorySpellListForClass()
local sendButton = DetailsFramework:CreateButton(statusBar, function() Details.Survey.SendSpellCatogeryDataToTargetCharacter(); DetailsSpellCategoryFrame:Hide() end, 800, 20, "SAVE and SEND")
sendButton:SetPoint("center", statusBar, "center", 0, 0)
detailsSpellCategoryFrame.Header = DetailsFramework:CreateHeader(detailsSpellCategoryFrame, headerTable, headerOptions)
detailsSpellCategoryFrame.Header:SetPoint("topleft", detailsSpellCategoryFrame, "topleft", startX, headerY)
local tooltipDesc = {}
tooltipDesc[2] = "|cffffff00" .. headerTable[4].text .. "|r|n" .. "Examples:\nPower Infusion, Ice Veins, Combustion, Adrenaline Rush" --ofensive cooldowns
tooltipDesc[3] = "|cffffff00" .. headerTable[5].text .. "|r|n" .. "Examples:\nIce Block, Dispersion, Cloak of Shadows, Shield Wall " --personal cooldowns
tooltipDesc[4] = "|cffffff00" .. headerTable[6].text .. "|r|n" .. "Examples:\nBlessing of Sacrifice, Ironbark, Life Cocoon, Pain Suppression" --targetted devense cooldowns
tooltipDesc[5] = "|cffffff00" .. headerTable[7].text .. "|r|n" .. "Examples:\nPower Word: Barrier, Spirit Link Totem, Tranquility, Anti-Magic Zone" --raid wide cooldowns
tooltipDesc[6] = "|cffffff00" .. headerTable[8].text .. "|r|n" .. "Examples:\nStampeding Roar, Leap of Faith"
tooltipDesc[7] = ""
tooltipDesc[8] = ""
tooltipDesc[9] = ""
--create the scroll bar
local scrollRefreshFunc = function(self, data, offset, totalLines)
for i = 1, totalLines do
@@ -74,46 +197,79 @@ function Details.OpenSpellCategoryScreen()
if (spellTable) then
local spellId = spellTable[1]
--get a line
local line = self:GetLine(i)
local spellName, _, spellIcon = GetSpellInfo(spellId)
print(spellName, spellId)
line.Icon:SetTexture(spellIcon)
line.Icon:SetTexCoord(.1, .9, .1, .9)
line.SpellNameText.text = spellName
local radioGroup = line.RadioGroup
line.spellId = spellId
local hasOptionSelected = false
local radioGroupOptions = {}
for o in ipairs({"", "", "", "", "", "", "", "", ""}) do
hasOptionSelected = spellTable[2] ~= 1
radioGroupOptions[o] = {
name = "",
param = o,
get = function() return spellTable[2] == o end,
callback = function(param, optionId) spellTable[2] = param end,
callback = function(param, optionId) spellTable[2] = param; thisClassSavedTable[spellId] = param; Details.spell_category_latest_save = time() end,
}
end
radioGroup:SetOptions(radioGroupOptions)
if (hasOptionSelected) then
line.hasDataBackground:Show()
else
line.hasDataBackground:Hide()
end
local children = {radioGroup:GetChildren()}
local currentWidth = headerTable[1].width + headerTable[2].width
for childId, childrenFrame in ipairs(children) do
childrenFrame:ClearAllPoints()
childrenFrame:SetPoint("left", line, "left", 126 + ((childId-1) * 122), 0)
childrenFrame:SetPoint("left", line, "left", currentWidth, 0)
if (not childrenFrame.haveTooltipAlready and childId > 1) then
if (tooltipDesc[childId] and tooltipDesc[childId] ~= "") then
childrenFrame:SetScript("OnEnter", function()
GameCooltip:Preset(2)
GameCooltip:AddLine(tooltipDesc[childId])
GameCooltip:SetOwner(childrenFrame)
GameCooltip:Show()
GameCooltipFrame1:ClearAllPoints()
GameCooltipFrame1:SetPoint("bottomright", line, "bottomleft", -2, 0)
end)
childrenFrame:SetScript("OnLeave", function()
GameCooltip:Hide()
end)
childrenFrame.haveTooltipAlready = true
end
end
currentWidth = currentWidth + headerTable[childId+2].width + 3
end
end
end
end
local lineOnEnter = function (self)
local lineOnEnter = function(self)
self:SetBackdropColor(unpack(backdrop_color_on_enter))
if (self.spellId) then
GameTooltip:SetOwner(self, "ANCHOR_NONE")
GameTooltip:SetPoint("bottomright", self, "bottomleft", -2, 0)
GameTooltip:SetSpellByID(self.spellId)
GameTooltip:Show()
end
end
local lineOnLeave = function(self)
self:SetBackdropColor(unpack(self.backdropColor))
GameTooltip:Hide()
end
local spellScroll = DF:CreateScrollBox(detailsSpellCategoryFrame, "$parentSpellScroll", scrollRefreshFunc, detailsSpellCategoryFrame.Data, scroll_width - 10, windowHeight - 58, scrollLines, scrollLineHeight)
local spellScroll = DF:CreateScrollBox(detailsSpellCategoryFrame, "$parentSpellScroll", scrollRefreshFunc, detailsSpellCategoryFrame.Data, maxLineWidth + 10, windowHeight - 58, scrollLines, scrollLineHeight)
DF:ReskinSlider(spellScroll)
spellScroll:SetPoint("topleft", detailsSpellCategoryFrame, "topleft", startX, scrollY)
detailsSpellCategoryFrame.SpellScroll = spellScroll
@@ -123,9 +279,15 @@ function Details.OpenSpellCategoryScreen()
DF:Mixin(line, DF.HeaderFunctions)
line:SetPoint("topleft", self, "topleft", 1, -((lineId-1) * (scrollLineHeight+1)) - 1)
line:SetSize(scroll_width - 2, scrollLineHeight)
line:SetScript ("OnEnter", lineOnEnter)
line:SetScript ("OnLeave", lineOnLeave)
line:SetSize(maxLineWidth, scrollLineHeight)
line:SetScript("OnEnter", lineOnEnter)
line:SetScript("OnLeave", lineOnLeave)
local background = line:CreateTexture(nil, "background")
background:SetAllPoints()
background:SetColorTexture(1, 1, 1, 0.08)
line.hasDataBackground = background
background:Hide()
line:SetBackdrop(backdrop)
if (lineId % 2 == 0) then
@@ -144,7 +306,8 @@ function Details.OpenSpellCategoryScreen()
local spellNameText = DF:CreateLabel(line)
--create radio buttons
local radioGroup = DF:CreateRadioGroup(line, {}, "$parentRadioGroup1", {width = scroll_width, height = 20}, {offset_x = 0, amount_per_line = 7})
--164 is the with of the first two headers (icon and spell name)
local radioGroup = DF:CreateRadioGroup(line, {}, "$parentRadioGroup1", {width = maxLineWidth - 164, height = 20}, {offset_x = 0, amount_per_line = 7})
line:AddFrameToHeaderAlignment(icon)
line:AddFrameToHeaderAlignment(spellNameText)
@@ -163,73 +326,12 @@ function Details.OpenSpellCategoryScreen()
spellScroll:CreateLine(scrollCreateline)
end
function detailsSpellCategoryFrame.GetSpellBookSpells()
local spellIdsInSpellBook = {}
for i = 1, GetNumSpellTabs() do
local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(i)
if (offspecId == 0 and tabTexture ~= 136830) then --don't add spells found in the General tab
offset = offset + 1
local tabEnd = offset + numSpells
for j = offset, tabEnd - 1 do
local spellType, spellId = GetSpellBookItemInfo(j, "player")
if (spellId) then
if (spellType ~= "FLYOUT") then
local spellName = GetSpellInfo(spellId)
if (spellName) then
GameTooltip:SetOwner(UIParent, "ANCHOR_TOPLEFT")
GameTooltip:SetSpellByID(spellId)
local spellIsPassive = false
local spellHasCooldown = false
for sideName in pairs({Left = true, Right = true}) do
for fontStringIndex = 1, 3 do
local tooltipFontString = _G["GameTooltipText" .. sideName .. fontStringIndex]
if (tooltipFontString) then
local text = tooltipFontString:GetText()
if (text) then
if (text == "Passive") then
spellIsPassive = true
elseif (text:find("cooldown")) then
spellHasCooldown = true
end
end
end
end
end
if (not spellIsPassive and spellHasCooldown) then --
spellIdsInSpellBook[#spellIdsInSpellBook+1] = {spellId, 0}
end
end
else
local _, _, numSlots, isKnown = GetFlyoutInfo(spellId)
if (isKnown and numSlots > 0) then
for k = 1, numSlots do
local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo(spellId, k)
if (isKnown) then
local spellName = GetSpellInfo(spellID)
--spellIdsInSpellBook[#spellIdsInSpellBook+1] = spellID
end
end
end
end
end
end
end
end
return spellIdsInSpellBook
end
function spellScroll:RefreshScroll()
--create a list of spells from the spell book
local indexedSpells = detailsSpellCategoryFrame.GetSpellBookSpells()
local indexedSpells = {}
for spellId, result in pairs(thisClassSavedTable) do
indexedSpells[#indexedSpells+1] = {spellId, result == true and 1 or result}
end
spellScroll:SetData(indexedSpells)
spellScroll:Refresh()
end
+6
View File
@@ -115,6 +115,12 @@ do
function _detalhes:GetDisplayName (actor)
return self.displayName or actor and actor.displayName
end
function Details:SetDisplayName(actor, newDisplayName)
local thisActor = self.displayName and self or actor
thisActor.displayName = newDisplayName
end
function _detalhes:GetOnlyName (string)
if (string) then
return string:gsub (("%-.*"), "")
+3
View File
@@ -1302,6 +1302,9 @@ local default_global_data = {
--> spell category feedback
spell_category_savedtable = {},
spell_category_latest_query = 0,
spell_category_latest_save = 0,
spell_category_latest_sent = 0,
--> class time played
class_time_played = {},
+3
View File
@@ -1569,6 +1569,9 @@ function SlashCmdList.DETAILS (msg, editbox)
elseif (msg == "generatespelllist") then
Details.GenerateSpecSpellList()
elseif (msg == "survey") then
Details.Survey.OpenSurveyPanel()
elseif (msg == "share") then
local f = {}
+111 -125
View File
@@ -127,51 +127,47 @@ function Details:StartMeUp() --I'll never stop!
self:RefreshMainWindow(-1, true)
Details:RefreshUpdater()
for index = 1, #self.tabela_instancias do
local instance = self.tabela_instancias[index]
if (instance:IsAtiva()) then
for id = 1, Details:GetNumInstances() do
local instance = Details:GetInstance(id)
if (instance:IsEnabled()) then
Details.Schedules.NewTimer(1, Details.RefreshBars, Details, instance)
Details.Schedules.NewTimer(1, Details.InstanceReset, Details, instance)
Details.Schedules.NewTimer(1, Details.InstanceRefreshRows, Details, instance)
--self:ScheduleTimer("RefreshBars", 1, instance)
--self:ScheduleTimer("InstanceReset", 1, instance)
--self: ("InstanceRefreshRows", 1, instance)
end
end
function self:RefreshAfterStartup()
--repair nicknames
--repair nicknames as nicknames aren't saved within the actor when leaving the game
if (not Details.ignore_nicktag) then
local currentCombat = Details:GetCurrentCombat()
local containerDamage = currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
for _, actorObject in containerDamage:ListActors() do
--get the actor nickname
local nickname = Details:GetNickname(actorObject:Name(), false, true)
if (nickname) then
actorObject.displayName = nickname
if (nickname and type(nickname) == "string" and nickname:len() >= 2) then
actorObject:SetDisplayName(nickname)
end
end
end
self:RefreshMainWindow(-1, true)
local refreshAllInstances = -1
local forceRefresh = true
self:RefreshMainWindow(refreshAllInstances, forceRefresh)
local lowerInstance = Details:GetLowerInstanceNumber()
local lower_instance = Details:GetLowerInstanceNumber()
for index = 1, #self.tabela_instancias do
local instance = self.tabela_instancias [index]
if(instance:IsAtiva()) then
for id = 1, Details:GetNumInstances() do
local instance = Details:GetInstance(id)
if (instance:IsEnabled()) then
--refresh wallpaper
if(instance.wallpaper.enabled) then
if (instance.wallpaper.enabled) then
instance:InstanceWallpaper(true)
else
instance:InstanceWallpaper(false)
end
--refresh desaturated icons if is lower instance
if(index == lower_instance) then
--refresh desaturated icons if is lower instance because plugins shall have installed their icons at this point
if (id == lowerInstance) then
instance:DesaturateMenu()
instance:SetAutoHideMenu(nil, nil, true)
end
end
@@ -181,9 +177,9 @@ function Details:StartMeUp() --I'll never stop!
Details.ToolBar:ReorganizeIcons()
--refresh skin for other windows
if (lower_instance) then
for i = lower_instance+1, #self.tabela_instancias do
local instance = self:GetInstance(i)
if (lowerInstance) then
for id = lowerInstance+1, Details:GetNumInstances() do
local instance = Details:GetInstance(id)
if (instance and instance.baseframe and instance.ativa) then
instance:ChangeSkin()
end
@@ -195,77 +191,73 @@ function Details:StartMeUp() --I'll never stop!
function Details:CheckWallpaperAfterStartup()
if (not Details.profile_loaded) then
Details.Schedules.NewTimer(5, Details.CheckWallpaperAfterStartup, Details)
--return Details:ScheduleTimer ("CheckWallpaperAfterStartup", 2)
end
for i = 1, self.instances_amount do
local instance = self:GetInstance (i)
for id = 1, self.instances_amount do
local instance = self:GetInstance(id)
if (instance and instance:IsEnabled()) then
if (not instance.wallpaper.enabled) then
instance:InstanceWallpaper (false)
instance:InstanceWallpaper(false)
end
instance.do_not_snap = true
self.move_janela_func (instance.baseframe, true, instance, true)
self.move_janela_func (instance.baseframe, false, instance, true)
self.move_janela_func(instance.baseframe, true, instance, true)
self.move_janela_func(instance.baseframe, false, instance, true)
instance.do_not_snap = false
end
end
self.CheckWallpaperAfterStartup = nil
Details.profile_loaded = nil
end
--Details:ScheduleTimer ("CheckWallpaperAfterStartup", 5)
Details.Schedules.NewTimer(5, Details.CheckWallpaperAfterStartup, Details)
end
--self:ScheduleTimer ("RefreshAfterStartup", 5)
Details.Schedules.NewTimer(5, Details.RefreshAfterStartup, Details)
--start garbage collector
self.ultima_coleta = 0
self.intervalo_coleta = 720
self.intervalo_memoria = 180
--self.garbagecollect = self:ScheduleRepeatingTimer ("IniciarColetaDeLixo", self.intervalo_coleta) --deprecated
self.garbagecollect = Details.Schedules.NewTicker(self.intervalo_coleta, Details.IniciarColetaDeLixo, Details)
self.next_memory_check = _G.time()+self.intervalo_memoria
self.next_memory_check = _G.time() + self.intervalo_memoria
--player role
self.last_assigned_role = UnitGroupRolesAssigned ("player")
self.last_assigned_role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player")
--> start parser
--> load parser capture options
self:CaptureRefresh()
--> register parser events
self.listener:RegisterEvent ("PLAYER_REGEN_DISABLED")
self.listener:RegisterEvent ("PLAYER_REGEN_ENABLED")
self.listener:RegisterEvent ("UNIT_PET")
self.listener:RegisterEvent("PLAYER_REGEN_DISABLED")
self.listener:RegisterEvent("PLAYER_REGEN_ENABLED")
self.listener:RegisterEvent("UNIT_PET")
self.listener:RegisterEvent ("GROUP_ROSTER_UPDATE")
self.listener:RegisterEvent ("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
self.listener:RegisterEvent ("ZONE_CHANGED_NEW_AREA")
self.listener:RegisterEvent ("PLAYER_ENTERING_WORLD")
self.listener:RegisterEvent ("ENCOUNTER_START")
self.listener:RegisterEvent ("ENCOUNTER_END")
self.listener:RegisterEvent ("START_TIMER")
self.listener:RegisterEvent ("UNIT_NAME_UPDATE")
self.listener:RegisterEvent("GROUP_ROSTER_UPDATE")
self.listener:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
self.listener:RegisterEvent ("PLAYER_ROLES_ASSIGNED")
self.listener:RegisterEvent ("ROLE_CHANGED_INFORM")
self.listener:RegisterEvent ("UNIT_FACTION")
self.listener:RegisterEvent("ZONE_CHANGED_NEW_AREA")
self.listener:RegisterEvent("PLAYER_ENTERING_WORLD")
if (not _G.DetailsFramework.IsTimewalkWoW()) then
self.listener:RegisterEvent ("PET_BATTLE_OPENING_START")
self.listener:RegisterEvent ("PET_BATTLE_CLOSE")
self.listener:RegisterEvent ("PLAYER_SPECIALIZATION_CHANGED")
self.listener:RegisterEvent ("PLAYER_TALENT_UPDATE")
self.listener:RegisterEvent ("CHALLENGE_MODE_START")
self.listener:RegisterEvent ("CHALLENGE_MODE_COMPLETED")
self.listener:RegisterEvent("ENCOUNTER_START")
self.listener:RegisterEvent("ENCOUNTER_END")
self.listener:RegisterEvent("START_TIMER")
self.listener:RegisterEvent("UNIT_NAME_UPDATE")
self.listener:RegisterEvent("PLAYER_ROLES_ASSIGNED")
self.listener:RegisterEvent("ROLE_CHANGED_INFORM")
self.listener:RegisterEvent("UNIT_FACTION")
if (not DetailsFramework.IsTimewalkWoW()) then
self.listener:RegisterEvent("PET_BATTLE_OPENING_START")
self.listener:RegisterEvent("PET_BATTLE_CLOSE")
self.listener:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
self.listener:RegisterEvent("PLAYER_TALENT_UPDATE")
self.listener:RegisterEvent("CHALLENGE_MODE_START")
self.listener:RegisterEvent("CHALLENGE_MODE_COMPLETED")
end
self.parser_frame:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
@@ -281,37 +273,34 @@ function Details:StartMeUp() --I'll never stop!
Details:SchedulePetUpdate(1)
--send messages gathered on initialization
--self:ScheduleTimer ("ShowDelayMsg", 10)
Details.Schedules.NewTimer(10, Details.ShowDelayMsg, Details)
--send instance open signal
for index, instancia in Details:ListInstances() do
for id, instancia in Details:ListInstances() do
if (instancia.ativa) then
self:SendEvent ("DETAILS_INSTANCE_OPEN", nil, instancia)
self:SendEvent("DETAILS_INSTANCE_OPEN", nil, instancia)
end
end
--send details startup done signal
function self:AnnounceStartup()
self:SendEvent ("DETAILS_STARTED", "SEND_TO_ALL")
self:SendEvent("DETAILS_STARTED", "SEND_TO_ALL")
if (Details.in_group) then
Details:SendEvent ("GROUP_ONENTER")
Details:SendEvent("GROUP_ONENTER")
else
Details:SendEvent ("GROUP_ONLEAVE")
Details:SendEvent("GROUP_ONLEAVE")
end
Details.last_zone_type = "INIT"
Details.parser_functions:ZONE_CHANGED_NEW_AREA()
Details.AnnounceStartup = nil
end
--self:ScheduleTimer ("AnnounceStartup", 5)
Details.Schedules.NewTimer(5, Details.AnnounceStartup, Details)
if (Details.failed_to_load) then
Details:CancelTimer (Details.failed_to_load)
Details.failed_to_load:Cancel()
Details.failed_to_load = nil
end
@@ -328,7 +317,7 @@ function Details:StartMeUp() --I'll never stop!
Details:CheckVersion(true)
--restore cooltip anchor position, this is for the custom anchor in the screen
_G.DetailsTooltipAnchor:Restore()
DetailsTooltipAnchor:Restore()
--check is this is the first run
if (self.is_first_run) then
@@ -340,11 +329,11 @@ function Details:StartMeUp() --I'll never stop!
--check is this is the first run of this version
if (self.is_version_first_run) then
local lower_instance = Details:GetLowerInstanceNumber()
if (lower_instance) then
lower_instance = Details:GetInstance (lower_instance)
local lowerInstanceId = Details:GetLowerInstanceIdNumber()
if (lowerInstanceId) then
lowerInstanceId = Details:GetInstance(lowerInstanceId)
if (lower_instance) then
if (lowerInstanceId) then
--check if there's changes in the size of the news string
if (Details.last_changelog_size < #Loc["STRING_VERSION_LOG"]) then
Details.last_changelog_size = #Loc["STRING_VERSION_LOG"]
@@ -355,10 +344,10 @@ function Details:StartMeUp() --I'll never stop!
end)
end
if (lower_instance) then
_G.C_Timer.After(10, function()
if (lower_instance:IsEnabled()) then
lower_instance:InstanceAlert(Loc ["STRING_VERSION_UPDATE"], {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 60, {Details.OpenNewsWindow}, true)
if (lowerInstanceId) then
C_Timer.After(10, function()
if (lowerInstanceId:IsEnabled()) then
lowerInstanceId:InstanceAlert(Loc ["STRING_VERSION_UPDATE"], {[[Interface\GossipFrame\AvailableQuestIcon]], 16, 16, false}, 60, {Details.OpenNewsWindow}, true)
Details:Msg("A new version has been installed: /details news") --localize-me
end
end)
@@ -371,37 +360,37 @@ function Details:StartMeUp() --I'll never stop!
Details:AddDefaultCustomDisplays()
end
local lower = Details:GetLowerInstanceNumber()
if (lower) then
local instance = Details:GetInstance (lower)
local lowerInstanceId = Details:GetLowerInstanceNumber()
if (lowerInstanceId) then
local instance = Details:GetInstance(lowerInstanceId)
if (instance) then
--in development
local dev_icon = instance.bgdisplay:CreateTexture (nil, "overlay")
dev_icon:SetWidth (40)
dev_icon:SetHeight (40)
dev_icon:SetPoint ("bottomleft", instance.baseframe, "bottomleft", 4, 8)
dev_icon:SetAlpha (.3)
local devIcon = instance.bgdisplay:CreateTexture(nil, "overlay")
devIcon:SetWidth(40)
devIcon:SetHeight(40)
devIcon:SetPoint("bottomleft", instance.baseframe, "bottomleft", 4, 8)
devIcon:SetAlpha(.3)
local dev_text = instance.bgdisplay:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
dev_text:SetHeight (64)
dev_text:SetPoint ("left", dev_icon, "right", 5, 0)
dev_text:SetTextColor (1, 1, 1)
dev_text:SetAlpha (.3)
local devText = instance.bgdisplay:CreateFontString(nil, "overlay", "GameFontHighlightSmall")
devText:SetHeight(64)
devText:SetPoint("left", devIcon, "right", 5, 0)
devText:SetTextColor(1, 1, 1)
devText:SetAlpha(.3)
--version
Details.FadeHandler.Fader (instance._version, 0)
instance._version:SetText ("Details! " .. Details.userversion .. " (core " .. self.realversion .. ")")
instance._version:SetTextColor (1, 1, 1, .35)
instance._version:SetPoint ("bottomleft", instance.baseframe, "bottomleft", 5, 1)
Details.FadeHandler.Fader(instance._version, 0)
instance._version:SetText("Details! " .. Details.userversion .. " (core " .. self.realversion .. ")")
instance._version:SetTextColor(1, 1, 1, .35)
instance._version:SetPoint("bottomleft", instance.baseframe, "bottomleft", 5, 1)
if (instance.auto_switch_to_old) then
instance:SwitchBack()
end
function Details:FadeStartVersion()
Details.FadeHandler.Fader (dev_icon, "in", 2)
Details.FadeHandler.Fader (dev_text, "in", 2)
Details.FadeHandler.Fader (instance._version, "in", 2)
Details.FadeHandler.Fader(devIcon, "in", 2)
Details.FadeHandler.Fader(devText, "in", 2)
Details.FadeHandler.Fader(instance._version, "in", 2)
end
Details.Schedules.NewTimer(12, Details.FadeStartVersion, Details)
end
@@ -413,20 +402,14 @@ function Details:StartMeUp() --I'll never stop!
--Details:OpenCustomDisplayWindow()
--Details:OpenWelcomeWindow()
end
--Details:ScheduleTimer ("OpenOptionsWindowAtStart", 2)
Details.Schedules.NewTimer(2, Details.OpenOptionsWindowAtStart, Details)
--Details:OpenCustomDisplayWindow()
--> minimap
pcall (Details.RegisterMinimap, Details)
--minimap registration
Details.SafeRun(Details.RegisterMinimap, "Register Minimap Icon", Details)
--hot corner addon
function Details:RegisterHotCorner()
Details:DoRegisterHotCorner()
end
--Details:ScheduleTimer ("RegisterHotCorner", 5)
Details.Schedules.NewTimer(5, Details.RegisterHotCorner, Details)
Details.Schedules.NewTimer(5, function() Details.SafeRun(Details.DoRegisterHotCorner, "Register on Hot Corner Addon", Details) end, Details)
--restore mythic dungeon state
Details:RestoreState_CurrentMythicDungeonRun()
@@ -452,15 +435,15 @@ function Details:StartMeUp() --I'll never stop!
Details.Schedules.NewTimer(5, Details.BossModsLink, Details)
--limit item level life for 24Hs
local now = _G.time()
for guid, t in pairs(Details.item_level_pool) do
if (t.time + 86400 < now) then
Details.item_level_pool[guid] = nil
local now = time()
for guid, ilevelTable in pairs(Details.ilevel:GetPool()) do
if (ilevelTable.time + 86400 < now) then
Details.ilevel:ClearIlvl(guid)
end
end
--dailly reset of the cache for talents and specs
local today = _G.date("%d")
local today = date("%d")
if (Details.last_day ~= today) then
wipe(Details.cached_specs)
wipe(Details.cached_talents)
@@ -479,10 +462,10 @@ function Details:StartMeUp() --I'll never stop!
end
if (Details.player_details_window.skin ~= "ElvUI") then
local reset_player_detail_window = function()
local setDefaultSkinOnPlayerBreakdownWindow = function()
Details:ApplyPDWSkin("ElvUI")
end
C_Timer.After(2, reset_player_detail_window)
C_Timer.After(2, setDefaultSkinOnPlayerBreakdownWindow)
end
--coach feature startup
@@ -514,8 +497,11 @@ function Details:StartMeUp() --I'll never stop!
Details:InstallHook("HOOK_DEATH", Details.Coach.Client.SendMyDeath)
if (math.random(10) == 1) then
local sentMessageOnStartup = false
if (math.random(20) == 1) then
Details:Msg("use '/details me' macro to open the player breakdown for you!")
sentMessageOnStartup = true
end
if (not DetailsFramework.IsTimewalkWoW()) then
@@ -563,6 +549,15 @@ function Details:StartMeUp() --I'll never stop!
if (DetailsFramework.IsDragonflight()) then
DetailsFramework.Schedules.NewTimer(5, Details.RegisterDragonFlightEditMode)
--run only on beta, remove on 10.0 launch
if (Details.Survey.GetTargetCharacterForRealm()) then
Details.Survey.InitializeSpellCategoryFeedback()
if (not sentMessageOnStartup) then
if (math.random(10) == 1) then
Details:Msg("use '/details survey' to help on identifying cooldown spells.")
end
end
end
end
function Details:InstallOkey()
@@ -575,12 +570,3 @@ function Details:StartMeUp() --I'll never stop!
end
Details.AddOnLoadFilesTime = _G.GetTime()