Framework Update

This commit is contained in:
Tercio Jose
2020-01-27 20:43:18 -03:00
parent 6161cc4517
commit 2519ea0b96
5 changed files with 330 additions and 68 deletions
+163 -3
View File
@@ -1,5 +1,5 @@
local dversion = 164
local dversion = 167
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -18,6 +18,9 @@ local _unpack = unpack
local upper = string.upper
local string_match = string.match
local UnitPlayerControlled = UnitPlayerControlled
local UnitIsTapDenied = UnitIsTapDenied
SMALL_NUMBER = 0.000001
ALPHA_BLEND_AMOUNT = 0.8400251
@@ -2925,6 +2928,157 @@ function DF:GetCLEncounterIDs()
return DF.CLEncounterID
end
DF.ClassSpecs = {
["DEMONHUNTER"] = {
[577] = true,
[581] = true,
},
["DEATHKNIGHT"] = {
[250] = true,
[251] = true,
[252] = true,
},
["WARRIOR"] = {
[71] = true,
[72] = true,
[73] = true,
},
["MAGE"] = {
[62] = true,
[63] = true,
[64] = true,
},
["ROGUE"] = {
[259] = true,
[260] = true,
[261] = true,
},
["DRUID"] = {
[102] = true,
[103] = true,
[104] = true,
[105] = true,
},
["HUNTER"] = {
[253] = true,
[254] = true,
[255] = true,
},
["SHAMAN"] = {
[262] = true,
[263] = true,
[264] = true,
},
["PRIEST"] = {
[256] = true,
[257] = true,
[258] = true,
},
["WARLOCK"] = {
[265] = true,
[266] = true,
[267] = true,
},
["PALADIN"] = {
[65] = true,
[66] = true,
[70] = true,
},
["MONK"] = {
[268] = true,
[269] = true,
[270] = true,
},
}
DF.SpecListByClass = {
["DEMONHUNTER"] = {
577,
581,
},
["DEATHKNIGHT"] = {
250,
251,
252,
},
["WARRIOR"] = {
71,
72,
73,
},
["MAGE"] = {
62,
63,
64,
},
["ROGUE"] = {
259,
260,
261,
},
["DRUID"] = {
102,
103,
104,
105,
},
["HUNTER"] = {
253,
254,
255,
},
["SHAMAN"] = {
262,
263,
264,
},
["PRIEST"] = {
256,
257,
258,
},
["WARLOCK"] = {
265,
266,
267,
},
["PALADIN"] = {
65,
66,
70,
},
["MONK"] = {
268,
269,
270,
},
}
--given a class and a specId, return if the specId is a spec from the class passed
function DF:IsSpecFromClass(class, specId)
return DF.ClassSpecs[class] and DF.ClassSpecs[class][specId]
end
--return a has table where specid is the key and 'true' is the value
function DF:GetClassSpecs(class)
return DF.ClassSpecs [class]
end
--return a numeric table with spec ids
function DF:GetSpecListFromClass(class)
return DF.SpecListByClass [class]
end
--return a list with specIds as keys and spellId as value
function DF:GetSpellsForRangeCheck()
return SpellRangeCheckListBySpec
end
--return a list with specIds as keys and spellId as value
function DF:GetRangeCheckSpellForSpec(specId)
return SpellRangeCheckListBySpec[specId]
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> delta seconds reader
@@ -3034,5 +3188,11 @@ DF.DebugMixin = {
}
--doo elsee
--was doing double loops due to not enought height
-----------------------------------------------------------------------------------------------------------------------------------------------------------
--> returns if the unit is tapped (gray health color when another player hit the unit first)
function DF:IsUnitTapDenied (unitId)
return unitId and not UnitPlayerControlled (unitId) and UnitIsTapDenied (unitId)
end
+29
View File
@@ -5098,6 +5098,7 @@ DF.IconRowFunctions = {
end
iconFrame.CountdownText:SetPoint (self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0)
DF:SetFontSize (iconFrame.CountdownText, self.options.text_size)
iconFrame.CountdownText:SetText (formattedTime)
iconFrame.Cooldown:SetHideCountdownNumbers (true)
else
@@ -5203,6 +5204,7 @@ local default_icon_row_options = {
texcoord = {.1, .9, .1, .9},
show_text = true,
text_color = {1, 1, 1, 1},
text_size = 12,
text_anchor = "center",
text_rel_anchor = "center",
text_x_offset = 0,
@@ -6851,6 +6853,33 @@ function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString)
end
local statusbar_default_options = {
attach = "bottom", --bottomleft from statusbar attach to bottomleft of the frame | other option is "top": topleft attach to bottomleft
}
function DF:CreateStatusBar(f, options)
local statusBar = CreateFrame ("frame", nil, f)
DF:Mixin (statusBar, DF.OptionsFunctions)
DF:Mixin (statusBar, DF.LayoutFrame)
statusBar:BuildOptionsTable (statusbar_default_options, options)
if (statusBar.options.attach == "bottom") then
statusBar:SetPoint ("bottomleft", f, "bottomleft")
statusBar:SetPoint ("bottomright", f, "bottomright")
else
statusBar:SetPoint ("topleft", f, "bottomleft")
statusBar:SetPoint ("topright", f, "bottomright")
end
statusBar:SetHeight (20)
DF:ApplyStandardBackdrop (statusBar)
statusBar:SetAlpha (0.8)
return statusBar
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+82 -59
View File
@@ -5,29 +5,36 @@ if (not DF or not DetailsFrameworkCanLoad) then
end
local _
local ttexcoord
local window = DF:NewPanel (UIParent, nil, "DetailsFrameworkImageEdit", nil, 100, 100, false)
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)
tinsert (UISpecialFrames, "DetailsFrameworkImageEdit")
window:SetFrameStrata ("TOOLTIP")
window:SetMaxResize (650, 500)
window:SetMaxResize (500, 500)
_G.DetailsFrameworkImageEditTable = window
window.hooks = {}
local background = DF:NewImage (window, nil, nil, nil, "background", nil, nil, "$parentBackground")
local background = DF:NewImage (window, nil, nil, nil, "background", nil, "background", "$parentBackground")
background:SetAllPoints()
background:SetTexture (0, 0, 0, .8)
local edit_texture = DF:NewImage (window, nil, 650, 500, "artwork", nil, nil, "$parentImage")
local edit_texture = DF:NewImage (window, nil, 500, 500, "artwork", nil, "edit_texture", "$parentImage")
edit_texture:SetAllPoints()
_G.DetailsFrameworkImageEdit_EditTexture = edit_texture
local background_frame = CreateFrame ("frame", "DetailsFrameworkImageEditBackground", DetailsFrameworkImageEdit)
background_frame:SetPoint ("topleft", DetailsFrameworkImageEdit, "topleft", -10, 12)
background_frame:SetFrameStrata ("DIALOG")
background_frame:SetSize (800, 540)
background_frame:SetPoint ("topleft", DetailsFrameworkImageEdit, "topleft", -10, 30)
background_frame:SetFrameStrata ("TOOLTIP")
background_frame:SetFrameLevel (window:GetFrameLevel())
background_frame:SetSize (790, 560)
background_frame:SetResizable (true)
background_frame:SetMovable (true)
@@ -38,11 +45,15 @@ local _
background_frame:SetScript ("OnMouseUp", function()
window: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:SetBackdropBorderColor (0, 0, 0, 1)
local haveHFlip = false
local haveVFlip = false
@@ -223,22 +234,27 @@ local _
window [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)
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)
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)
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)
leftTexCoordButton:InstallCustomTexture()
rightTexCoordButton:InstallCustomTexture()
topTexCoordButton:InstallCustomTexture()
bottomTexCoordButton:InstallCustomTexture()
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)
Alpha:InstallCustomTexture()
Alpha:SetPoint ("topright", buttonsBackground, "topright", -8, -115 + yMod)
Alpha:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--> overlay color
local selectedColor = function (default)
@@ -288,8 +304,8 @@ local _
end
local changeColorButton = DF:NewButton (buttonsBackground, nil, "$parentOverlayColorButton", nil, 100, 20, changeColor, nil, nil, nil, "Color", 1)
changeColorButton:SetPoint ("topright", buttonsBackground, "topright", -8, -95)
changeColorButton:InstallCustomTexture()
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)
@@ -397,8 +413,8 @@ local _
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)
flipButtonH:InstallCustomTexture()
flipButtonH:SetPoint ("topright", buttonsBackground, "topright", -8, -140 + yMod)
flipButtonH:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
--
@@ -527,43 +543,8 @@ local _
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:InstallCustomTexture()
acceptButton:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
window:Hide()
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local ttexcoord
function DF:ImageEditor (callback, texture, texcoord, colors, width, height, extraParam, alpha, maximize)
texcoord = texcoord or {0, 1, 0, 1}
ttexcoord = texcoord
colors = colors or {1, 1, 1, 1}
alpha = alpha or 1
edit_texture:SetTexture (texture)
edit_texture.width = width
edit_texture.height = height
edit_texture.maximize = maximize
edit_texture:SetVertexColor (colors [1], colors [2], colors [3])
edit_texture:SetAlpha (alpha)
DF:ScheduleTimer ("RefreshImageEditor", 0.2)
window:Show()
window.callback_func = callback
window.extra_param = extraParam
buttonsBackground:Show()
buttonsBackground.widget:SetBackdrop (nil)
table.wipe (window.hooks)
end
function DF:RefreshImageEditor()
if (edit_texture.maximize) then
@@ -598,5 +579,47 @@ window:Hide()
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()
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
+51 -1
View File
@@ -918,7 +918,57 @@ function DF:GetSpellsForEncounterFromJournal (instanceEJID, encounterEJID)
return spellIDs
end
--default spells to use in the range check
DF.SpellRangeCheckListBySpec = {
-- 185245 spellID for Torment, it is always failing to check range with IsSpellInRange()
[577] = 278326, --> havoc demon hunter - Consume Magic
[581] = 278326, --> vengeance demon hunter - Consume Magic
[250] = 56222, --> blood dk - dark command
[251] = 56222, --> frost dk - dark command
[252] = 56222, --> unholy dk - dark command
[102] = 8921, --> druid balance - Moonfire (45 yards)
[103] = 8921, --> druid feral - Moonfire (40 yards)
[104] = 6795, --> druid guardian - Growl
[105] = 8921, --> druid resto - Moonfire (40 yards)
[253] = 193455, --> hunter bm - Cobra Shot
[254] = 19434, --> hunter marks - Aimed Shot
[255] = 271788, --> hunter survivor - Serpent Sting
[62] = 227170, --> mage arcane - arcane blast
[63] = 133, --> mage fire - fireball
[64] = 228597, --> mage frost - frostbolt
[268] = 115546 , --> monk bm - Provoke
[269] = 117952, --> monk ww - Crackling Jade Lightning (40 yards)
[270] = 117952, --> monk mw - Crackling Jade Lightning (40 yards)
[65] = 20473, --> paladin holy - Holy Shock (40 yards)
[66] = 62124, --> paladin protect - Hand of Reckoning
[70] = 62124, --> paladin ret - Hand of Reckoning
[256] = 585, --> priest disc - Smite
[257] = 585, --> priest holy - Smite
[258] = 8092, --> priest shadow - Mind Blast
[259] = 185565, --> rogue assassination - Poisoned Knife (30 yards)
[260] = 185763, --> rogue outlaw - Pistol Shot (20 yards)
[261] = 114014, --> rogue sub - Shuriken Toss (30 yards)
[262] = 188196, --> shaman elemental - Lightning Bolt
[263] = 187837, --> shaman enhancement - Lightning Bolt (instance cast)
[264] = 403, --> shaman resto - Lightning Bolt
[265] = 686, --> warlock aff - Shadow Bolt
[266] = 686, --> warlock demo - Shadow Bolt
[267] = 116858, --> warlock destro - Chaos Bolt
[71] = 355, --> warrior arms - Taunt
[72] = 355, --> warrior fury - Taunt
[73] = 355, --> warrior protect - Taunt
}
+5 -5
View File
File diff suppressed because one or more lines are too long