Skip to content

Commit

Permalink
Framework Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jan 27, 2020
1 parent 6161cc4 commit 2519ea0
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 68 deletions.
166 changes: 163 additions & 3 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

local dversion = 164
local dversion = 167

local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 changes: 29 additions & 0 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 2519ea0

Please sign in to comment.