Updates, please see /details news

This commit is contained in:
Tercio Jose
2022-04-22 13:30:41 -03:00
parent 7762e29d00
commit 694b52ddc4
27 changed files with 2703 additions and 1676 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
## Interface: 20502
## Interface: 20504
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## SavedVariables: _detalhes_global
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 300
local dversion = 306
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
+27 -1
View File
@@ -5392,7 +5392,7 @@ DF.IconRowFunctions = {
iconFrame.spellName = spellName
--add the spell into the cache
self.AuraCache [spellId] = true
self.AuraCache [spellId or -1] = true
self.AuraCache [spellName] = true
--> show the frame
@@ -5458,6 +5458,32 @@ DF.IconRowFunctions = {
else
self.NextIcon = countStillShown + 1
table.sort (iconPool, function(i1, i2) return i1:IsShown() and not i2:IsShown() end)
-- re-anchor not hidden
for i = 1, countStillShown do
local iconFrame = iconPool[i]
local anchor = self.options.anchor
local anchorTo = i == 1 and self or self.IconPool [i - 1]
local xPadding = i == 1 and self.options.left_padding or self.options.icon_padding or 1
local growDirection = self.options.grow_direction
iconFrame:ClearAllPoints()
if (growDirection == 1) then --grow to right
if (i == 1) then
PixelUtil.SetPoint (iconFrame, "left", anchorTo, "left", xPadding, 0)
else
PixelUtil.SetPoint (iconFrame, "left", anchorTo, "right", xPadding, 0)
end
elseif (growDirection == 2) then --grow to left
if (i == 1) then
PixelUtil.SetPoint (iconFrame, "right", anchorTo, "right", xPadding, 0)
else
PixelUtil.SetPoint (iconFrame, "right", anchorTo, "left", xPadding, 0)
end
end
end
end
end,
+1
View File
@@ -623,6 +623,7 @@ if (IS_WOW_PROJECT_NOT_MAINLINE) then
DF.CooldownsBySpec[258][19242] = 5 --desperate prayer Rank 6
DF.CooldownsBySpec[258][19243] = 5 --desperate prayer Rank 7
DF.CooldownsBySpec[258][25437] = 5 --desperate prayer Rank 8
DF.CooldownsBySpec[258][15286] = 5 --vampiric embrace is a debuff in classic, not a buff
--ROGUE - 259
DF.CooldownsBySpec[259][1857] = 2 --vanish Rank 2
+68 -30
View File
@@ -51,7 +51,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
if (not value) then
return _table.statusbar:GetValue()
else
_table.div:SetPoint ("left", _table.statusbar, "left", value * (_table.statusbar:GetWidth()/100) - 18, 0)
_table.spark:SetPoint ("left", _table.statusbar, "left", value * (_table.statusbar:GetWidth()/100) - 18, 0)
return _table.statusbar:SetValue (value)
end
end
@@ -60,12 +60,12 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
if (_type (v1) == "table") then
local v = v1.statusbar:GetValue()
v = v + v2
v1.div:SetPoint ("left", v1.statusbar, "left", value * (v1.statusbar:GetWidth()/100) - 18, 0)
v1.spark:SetPoint ("left", v1.statusbar, "left", value * (v1.statusbar:GetWidth()/100) - 18, 0)
v1.statusbar:SetValue (v)
else
local v = v2.statusbar:GetValue()
v = v + v1
v2.div:SetPoint ("left", v2.statusbar, "left", value * (v2.statusbar:GetWidth()/100) - 18, 0)
v2.spark:SetPoint ("left", v2.statusbar, "left", value * (v2.statusbar:GetWidth()/100) - 18, 0)
v2.statusbar:SetValue (v)
end
end
@@ -74,12 +74,12 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
if (_type (v1) == "table") then
local v = v1.statusbar:GetValue()
v = v - v2
v1.div:SetPoint ("left", v1.statusbar, "left", value * (v1.statusbar:GetWidth()/100) - 18, 0)
v1.spark:SetPoint ("left", v1.statusbar, "left", value * (v1.statusbar:GetWidth()/100) - 18, 0)
v1.statusbar:SetValue (v)
else
local v = v2.statusbar:GetValue()
v = v - v1
v2.div:SetPoint ("left", v2.statusbar, "left", value * (v2.statusbar:GetWidth()/100) - 18, 0)
v2.spark:SetPoint ("left", v2.statusbar, "left", value * (v2.statusbar:GetWidth()/100) - 18, 0)
v2.statusbar:SetValue (v)
end
end
@@ -117,7 +117,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
end
--> right color
local gmember_rcolor = function (_object)
return _object.background.original_colors
return _object.rightTexture.original_colors
end
--> left color
local gmember_lcolor = function (_object)
@@ -218,7 +218,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
--> statusbar value
local smember_value = function (_object, _value)
_object.statusbar:SetValue (_value)
return _object.div:SetPoint ("left", _object.statusbar, "left", _value * (_object.statusbar:GetWidth()/100) - 18, 0)
return _object.spark:SetPoint ("left", _object.statusbar, "left", _value * (_object.statusbar:GetWidth()/100) - 18, 0)
end
--> right text
local smember_rtext = function (_object, _value)
@@ -231,8 +231,8 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
--> right color
local smember_rcolor = function (_object, _value)
local _value1, _value2, _value3, _value4 = DF:ParseColors (_value)
_object.background.original_colors = {_value1, _value2, _value3, _value4}
return _object.background:SetVertexColor (_value1, _value2, _value3, _value4)
_object.rightTexture.original_colors = {_value1, _value2, _value3, _value4}
return _object.rightTexture:SetVertexColor (_value1, _value2, _value3, _value4)
end
--> left color
local smember_lcolor = function (_object, _value)
@@ -273,14 +273,14 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
if (type (_value) == "table") then
local _value1, _value2 = _unpack (_value)
_object.texture:SetTexture (_value1)
_object.background:SetTexture (_value1)
_object.rightTexture:SetTexture (_value1)
if (_value2) then
_object.texture:SetTexCoord (_unpack (_value2))
_object.background:SetTexCoord (_unpack (_value2))
_object.rightTexture:SetTexCoord (_unpack (_value2))
end
else
_object.texture:SetTexture (_value)
_object.background:SetTexture (_value)
_object.rightTexture:SetTexture (_value)
end
return
end
@@ -349,7 +349,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
return
end
self.statusbar:SetValue (value)
self.div:SetPoint ("left", self.statusbar, "left", value * (self.statusbar:GetWidth()/100) - 18, 0)
self.spark:SetPoint ("left", self.statusbar, "left", value * (self.statusbar:GetWidth()/100) - 18, 0)
end
-- setpoint
@@ -374,9 +374,13 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
-- texture
function SplitBarMetaFunctions:SetTexture (texture)
self.background:SetTexture (texture)
self.rightTexture:SetTexture (texture)
self.texture:SetTexture (texture)
end
function SplitBarMetaFunctions:SetBackgroundTexture(texture)
self.background:SetTexture(texture)
end
-- texts
function SplitBarMetaFunctions:SetLeftText (text)
@@ -393,10 +397,24 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
self.texture.original_colors = {r, g, b, a}
end
function SplitBarMetaFunctions:SetRightColor (r, g, b, a)
r, g, b, a = DF:ParseColors (r, g, b, a)
self.rightTexture:SetVertexColor (r, g, b, a)
self.rightTexture.original_colors = {r, g, b, a}
end
function SplitBarMetaFunctions:SetBackgroundColor (r, g, b, a)
r, g, b, a = DF:ParseColors (r, g, b, a)
self.background:SetVertexColor (r, g, b, a)
self.background.original_colors = {r, g, b, a}
end
function SplitBarMetaFunctions:GetLeftColor()
return self.texture:GetVertexColor()
end
function SplitBarMetaFunctions:GetRightColor()
return self.rightTexture:GetVertexColor()
end
-- icons
function SplitBarMetaFunctions:SetLeftIcon (texture, ...)
@@ -460,17 +478,21 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
local valueChange = self.step * (deltaTime * animationMultiplier)
self.currentValue = self.currentValue - valueChange
local barWidth = self:GetWidth()
self.statusbar:SetValue(self.currentValue)
self.rightTexture:SetWidth(barWidth - barWidth*self.currentValue)
if (self.currentValue - 0.001 <= self.targetValue) then
self:SetValue(self.targetValue)
self.currentValue = self.targetValue
self.spark:Hide()
if (not self.SparkAlwaysShow) then
self.spark:Hide()
end
self.widget:SetScript("OnUpdate", nil)
return
end
self.spark:SetPoint("center", self.widget, "left", self.currentValue * self:GetWidth(), 0)
self.spark:SetPoint("center", self.widget, "left", self.currentValue * barWidth, 0)
self.spark:Show()
end
@@ -485,17 +507,22 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
local valueChange = self.step * (deltaTime * animationMultiplier)
self.currentValue = self.currentValue + valueChange
local barWidth = self:GetWidth()
self.statusbar:SetValue(self.currentValue)
local rightTextureSize = barWidth - barWidth*self.currentValue
self.rightTexture:SetWidth(rightTextureSize)
if (self.currentValue + 0.001 >= self.targetValue) then
self:SetValue(self.targetValue)
self.currentValue = self.targetValue
self.spark:Hide()
if (not self.SparkAlwaysShow) then
self.spark:Hide()
end
self.widget:SetScript("OnUpdate", nil)
return
end
self.spark:SetPoint("center", self.widget, "left", self.currentValue * self:GetWidth(), 0)
self.spark:SetPoint("center", self.widget, "left", self.currentValue * barWidth, 0)
self.spark:Show()
end
@@ -523,12 +550,13 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
self.widget:SetScript("OnUpdate", onUpdate)
self.widget:SetMinMaxValues(0, 1)
self.spark:ClearAllPoints()
self.spark:SetHeight(self:GetHeight() * 1.7)
self.spark:SetAlpha(0.6)
self.spark:SetHeight(self:GetHeight() * 2.6)
self.spark:SetAlpha(0.4)
end
self.startValue = self.currentValue
self.step = abs(value - self.currentValue)
self.targetValue = value
self.rightTexture:Show()
end
------------------------------------------------------------------------------------------------------------
@@ -540,8 +568,6 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
if (kill) then
return
end
frame.MyObject.div:SetPoint ("left", frame, "left", frame:GetValue() * (frame:GetWidth()/100) - 18, 0)
if (frame.MyObject.have_tooltip) then
GameCooltip2:Reset()
@@ -607,7 +633,8 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
end
local OnSizeChanged = function (statusbar)
statusbar.MyObject.div:SetPoint ("left", statusbar, "left", statusbar:GetValue() * (statusbar:GetWidth()/100) - 18, 0)
statusbar.MyObject.spark:SetPoint ("left", statusbar, "left", statusbar:GetValue() * (statusbar:GetWidth()/100) - 18, 0)
statusbar.MyObject.rightTexture:SetWidth(statusbar:GetWidth() - statusbar.MyObject.texture:GetWidth())
end
------------------------------------------------------------------------------------------------------------
@@ -615,7 +642,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]
function DetailsFrameworkSplitlBar_OnCreate (self)
self.texture.original_colors = {1, 1, 1, 1}
self.background.original_colors = {.5, .5, .5, 1}
self.rightTexture.original_colors = {.5, .5, .5, 1}
self.spark:SetPoint ("left", self, "left", self:GetValue() * (self:GetWidth()/100) - 18, 0)
return true
end
@@ -629,14 +656,27 @@ local build_statusbar = function (self)
self:SetSize (300, 14)
self.background = self:CreateTexture ("$parent_StatusBarBackground", "BACKGROUND")
self.background:SetAllPoints()
self.background:SetPoint("topright", self, "topright")
self.background:SetPoint("bottomright", self, "bottomright")
self.background:SetPoint("topleft", self, "topleft")
self.background:SetPoint("bottomleft", self, "bottomleft")
self.background:SetTexture ([[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]])
self.background:SetVertexColor (.5, .5, .5, 1)
self.background:SetVertexColor (.3, .3, .3, 1)
self.texture = self:CreateTexture ("$parent_StatusBarTexture", "ARTWORK")
--this is the left texture and it grows to the right, it is embed within the bar by SetStatusBarTexture
self.texture = self:CreateTexture ("$parent_StatusBarTexture", "ARTWORK", nil, 1)
self.texture:Hide()
self.texture:SetSize (300, 14)
self.texture:SetTexture ([[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]])
--this is the right texture and its size is the bar:GetWidth() - self.texture:GetWidth()
self.rightTexture = self:CreateTexture ("$parent_StatusBarTextureRight", "ARTWORK", nil, 2)
self.rightTexture:Hide()
self.rightTexture:SetSize (300, 14)
self.rightTexture:SetTexture ([[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]])
self.rightTexture:SetPoint("topright", self, "topright")
self.rightTexture:SetPoint("bottomright", self, "bottomright")
self.rightTexture:SetVertexColor(1, 0, 0)
self.lefticon = self:CreateTexture ("$parent_IconLeft", "OVERLAY")
self.lefticon:SetSize (14, 14)
@@ -739,9 +779,7 @@ function DF:NewSplitBar (parent, container, name, member, w, h)
SplitBarObject.background = _G [name .. "_StatusBarBackground"]
SplitBarObject.texture = _G [name .. "_StatusBarTexture"]
SplitBarObject.div = _G [name .. "_Spark"]
SplitBarObject.rightTexture = _G [name .. "_StatusBarTextureRight"]
--> hooks
SplitBarObject.HookList = {
+1 -1
View File
@@ -299,6 +299,7 @@ local OnUpdateFunc = function(self, deltaTime)
end
function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime)
self.statusBar:Show()
if (not currentTime or currentTime == 0) then
self:StopTimer()
@@ -352,7 +353,6 @@ function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime)
self.statusBar.hasTimer = true
self.statusBar.direction = self.direction
self.statusBar.throttle = 0
self.statusBar:Show()
self.statusBar:SetScript("OnUpdate", OnUpdateFunc)
+69
View File
@@ -0,0 +1,69 @@
if (not LIB_OPEN_RAID_CAN_LOAD) then
return
end
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
--> deprecated: 'RequestAllPlayersInfo' has been replaced by 'RequestAllData'
function openRaidLib.RequestAllPlayersInfo()
openRaidLib.DeprecatedMessage("openRaidLib.RequestAllPlayersInfo() is deprecated, please use openRaidLib.RequestAllData().")
end
--> deprecated: 'playerInfoManager' has been replaced by 'UnitInfoManager'
openRaidLib.playerInfoManager = {}
local deprecatedMetatable = {
__newindex = function()
openRaidLib.DeprecatedMessage("openRaidLib.playerInfoManager table is deprecated, please use openRaidLib.UnitInfoManager.")
return
end,
__index = function(t, key)
return rawget(t, key) or openRaidLib.DeprecatedMessage("openRaidLib.playerInfoManager table is deprecated, please use openRaidLib.UnitInfoManager.")
end,
}
function openRaidLib.playerInfoManager.GetPlayerInfo()
openRaidLib.DeprecatedMessage("openRaidLib.playerInfoManager.GetPlayerInfo(unitName) is deprecated, please use openRaidLib.GetUnitInfo(unitId).")
end
function openRaidLib.playerInfoManager.GetAllPlayersInfo()
openRaidLib.DeprecatedMessage("openRaidLib.playerInfoManager.GetAllPlayersInfo() is deprecated, please use openRaidLib.GetAllUnitsInfo().")
end
setmetatable(openRaidLib.playerInfoManager, deprecatedMetatable)
--> deprecated: 'gearManager' has been replaced by 'GearManager'
openRaidLib.gearManager = {}
local deprecatedMetatable = {
__newindex = function()
openRaidLib.DeprecatedMessage("openRaidLib.gearManager table is deprecated, please use openRaidLib.GearManager (the G is in upper case).")
return
end,
__index = function(t, key)
return rawget(t, key) or openRaidLib.DeprecatedMessage("openRaidLib.gearManager table is deprecated, please use openRaidLib.GearManager (the G is in upper case).")
end,
}
function openRaidLib.gearManager.GetAllPlayersGear()
openRaidLib.DeprecatedMessage("openRaidLib.gearManager.GetAllPlayersGear() is deprecated, please use openRaidLib.GetAllUnitsGear().")
end
function openRaidLib.gearManager.GetPlayerGear()
openRaidLib.DeprecatedMessage("openRaidLib.gearManager.GetPlayerGear() is deprecated, please use openRaidLib.GetUnitGear(unitId).")
end
setmetatable(openRaidLib.gearManager, deprecatedMetatable)
--> deprecated: 'cooldownManager' has been replaced by 'CooldownManager'
openRaidLib.cooldownManager = {}
local deprecatedMetatable = {
__newindex = function()
openRaidLib.DeprecatedMessage("openRaidLib.cooldownManager table is deprecated, please use openRaidLib.CooldownManager (the C is in upper case).")
return
end,
__index = function(t, key)
return rawget(t, key) or openRaidLib.DeprecatedMessage("openRaidLib.cooldownManager table is deprecated, please use openRaidLib.CooldownManager (the C is in upper case).")
end,
}
function openRaidLib.cooldownManager.GetAllPlayersCooldown()
openRaidLib.DeprecatedMessage("openRaidLib.cooldownManager.GetAllPlayersCooldown() is deprecated, please use openRaidLib.GetAllUnitsCooldown().")
end
function openRaidLib.cooldownManager.GetPlayerCooldowns()
openRaidLib.DeprecatedMessage("openRaidLib.cooldownManager.GetPlayerCooldowns() is deprecated, please use openRaidLib.GetUnitCooldowns(unitId).")
end
setmetatable(openRaidLib.cooldownManager, deprecatedMetatable)
+217
View File
@@ -0,0 +1,217 @@
--[=[
Dumping logical functions here, make the code of the main file smaller
--]=]
if (not LIB_OPEN_RAID_CAN_LOAD) then
return
end
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
local CONST_FRACTION_OF_A_SECOND = 0.01
local CONST_COOLDOWN_TYPE_OFFENSIVE = 1
local CONST_COOLDOWN_TYPE_DEFENSIVE_PERSONAL = 2
local CONST_COOLDOWN_TYPE_DEFENSIVE_TARGET = 3
local CONST_COOLDOWN_TYPE_DEFENSIVE_RAID = 4
local CONST_COOLDOWN_TYPE_UTILITY = 5
--simple non recursive table copy
function openRaidLib.TCopy(tableToReceive, tableToCopy)
if (not tableToCopy) then
print(debugstack())
end
for key, value in pairs(tableToCopy) do
tableToReceive[key] = value
end
end
--find the normalized percent of the value in the range. e.g range of 200-400 and a value of 250 result in 0.25
--from details! framework
function openRaidLib.GetRangePercent(minValue, maxValue, value)
return (value - minValue) / max((maxValue - minValue), 0.0000001)
end
--transform a table index into a string dividing values with a comma
--@table: an indexed table with unknown size
function openRaidLib.PackTable(table)
local tableSize = #table
local newString = "" .. tableSize .. ","
for i = 1, tableSize do
newString = newString .. table[i] .. ","
end
newString = newString:gsub(",$", "")
return newString
end
--return is a number is almost equal to another within a tolerance range
function openRaidLib.isNearlyEqual(value1, value2, tolerance)
tolerance = tolerance or CONST_FRACTION_OF_A_SECOND
return abs(value1 - value2) <= tolerance
end
--return true if the lib is allowed to receive comms from other players
function openRaidLib.IsCommAllowed()
return IsInGroup() or IsInRaid()
end
--stract some indexes of a table
local selectIndexes = function(table, startIndex, amountIndexes)
local values = {}
for i = startIndex, startIndex+amountIndexes do
values[#values+1] = tonumber(table[i]) or 0
end
return values
end
--transform a string table into a regular table
--@table: a table with unknown values
--@index: where in the table is the information we want
--@isPair: if true treat the table as pairs(), ipairs() otherwise
--@valueAsTable: return {value1, value2, value3}
--@amountOfValues: for the parameter above
function openRaidLib.UnpackTable(table, index, isPair, valueIsTable, amountOfValues)
local result = {}
local reservedIndexes = table[index]
if (not reservedIndexes) then
return result
end
local indexStart = index+1
local indexEnd = reservedIndexes+index
if (isPair) then
amountOfValues = amountOfValues or 2
for i = indexStart, indexEnd, amountOfValues do
if (valueIsTable) then
local key = tonumber(table[i])
local values = selectIndexes(table, i+1, max(amountOfValues-2, 1))
result[key] = values
else
local key = tonumber(table[i])
local value = tonumber(table[i+1])
result[key] = value
end
end
else
for i = indexStart, indexEnd do
local value = tonumber(table[i])
result[#result+1] = value
end
end
return result
end
--returns if the player is in group
function openRaidLib.IsInGroup()
local inParty = IsInGroup()
local inRaid = IsInRaid()
return inParty or inRaid
end
function openRaidLib.UpdateUnitIDCache()
openRaidLib.UnitIDCache = {}
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
local unitName = UnitName("raid"..i)
if (unitName) then
openRaidLib.UnitIDCache[unitName] = "raid"..i
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers() - 1 do
local unitName = UnitName("party"..i)
if (unitName) then
openRaidLib.UnitIDCache[unitName] = "party"..i
end
end
end
openRaidLib.UnitIDCache[UnitName("player")] = "player"
end
function openRaidLib.GetUnitID(playerName)
return openRaidLib.UnitIDCache[playerName] or playerName
end
local filterStringToCooldownType = {
["defensive-raid"] = CONST_COOLDOWN_TYPE_DEFENSIVE_RAID,
["defensive-target"] = CONST_COOLDOWN_TYPE_DEFENSIVE_TARGET,
["defensive-personal"] = CONST_COOLDOWN_TYPE_DEFENSIVE_PERSONAL,
["ofensive"] = CONST_COOLDOWN_TYPE_OFFENSIVE,
["utility"] = CONST_COOLDOWN_TYPE_UTILITY
}
function openRaidLib.CooldownManager.DoesSpellPassFilter(spellId, filters)
local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO
local cooldownData = allCooldownsData[spellId]
if (cooldownData) then
for filter in filters:gmatch("([^,%s]+)") do
local cooldownType = filterStringToCooldownType[filter]
if (cooldownData.type == cooldownType) then
return true
end
end
else
return false
end
end
local getCooldownsForFilter = function(unitName, allCooldowns, unitDataFilteredCache, filter)
local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO
local filterTable = unitDataFilteredCache[filter]
--if the unit already sent its full list of cooldowns, the cache can be built
--when NeedRebuildFilters is true, HasFullCooldownList is always true
--bug: filterTable is nil and HasFullCooldownList is also nil, happening after leaving a grou´p internal callback
if ((not filterTable and openRaidLib.CooldownManager.HasFullCooldownList[unitName]) or openRaidLib.CooldownManager.NeedRebuildFilters[unitName]) then
filterTable = {}
unitDataFilteredCache[filter] = filterTable
for spellId, cooldownInfo in pairs(allCooldowns) do
local cooldownData = allCooldownsData[spellId]
if (cooldownData and cooldownData.type == filterStringToCooldownType[filter]) then
filterTable[spellId] = cooldownInfo
end
end
end
return filterTable
end
--@allCooldowns: all cooldowns sent by an unit, {[spellId] = cooldownInfo}
--@filters: string with filters, "defensive-raid, "defensive-personal"
function openRaidLib.FilterCooldowns(unitName, allCooldowns, filters)
local allDataFiltered = openRaidLib.CooldownManager.UnitDataFilterCache --["unitName"] = {defensive-raid = {[spellId = cooldownInfo]}}
local unitDataFilteredCache = allDataFiltered[unitName]
if (not unitDataFilteredCache) then
unitDataFilteredCache = {}
allDataFiltered[unitName] = unitDataFilteredCache
end
--before break the string into parts and build the filters, attempt to get cooldowns from the cache using the whole filter string
local filterAlreadyInCache = unitDataFilteredCache[filters]
if (filterAlreadyInCache and not openRaidLib.CooldownManager.NeedRebuildFilters[unitName]) then
return filterAlreadyInCache
end
local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO
local resultFilters = {}
--break the string into pieces and filter cooldowns
for filter in filters:gmatch("([^,%s]+)") do
local filterTable = getCooldownsForFilter(unitName, allCooldowns, unitDataFilteredCache, filter)
if (filterTable) then
openRaidLib.TCopy(resultFilters, filterTable) --filter table is nil
end
end
--cache the whole filter string
if (next(resultFilters)) then
unitDataFilteredCache[filters] = resultFilters
end
return resultFilters
end
+387
View File
@@ -0,0 +1,387 @@
--[=[
This file has the functions to get player information
Dumping them here, make the code of the main file smaller
--]=]
if (not LIB_OPEN_RAID_CAN_LOAD) then
return
end
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
local isTimewalkWoW = function()
local gameVersion = GetBuildInfo()
if (gameVersion:match("%d") == "1" or gameVersion:match("%d") == "2") then
return true
end
end
--creates two tables, one with indexed talents and another with pairs values ([talentId] = true)
function openRaidLib.UnitInfoManager.GetPlayerTalentsAsPairsTable()
local talentsPairs = {}
for i = 1, 7 do
for o = 1, 3 do
local talentId, _, _, selected = GetTalentInfo(i, o, 1)
if (selected) then
talentsPairs[talentId] = true
break
end
end
end
return talentsPairs
end
function openRaidLib.UnitInfoManager.GetPlayerTalents()
local talents = {0, 0, 0, 0, 0, 0, 0}
for talentTier = 1, 7 do
for talentColumn = 1, 3 do
local talentId, name, texture, selected, available = GetTalentInfo(talentTier, talentColumn, 1)
if (selected) then
talents[talentTier] = talentId
break
end
end
end
return talents
end
function openRaidLib.UnitInfoManager.GetPlayerPvPTalents()
local talentsPvP = {0, 0, 0}
local talentList = C_SpecializationInfo.GetAllSelectedPvpTalentIDs()
for talentIndex, talentId in ipairs(talentList) do
local doesExists = GetPvpTalentInfoByID(talentId)
if (doesExists) then
talentsPvP[talentIndex] = talentId
end
end
return talentsPvP
end
--return the current specId of the player
function openRaidLib.GetPlayerSpecId()
if (isTimewalkWoW()) then
return 0
end
local spec = GetSpecialization()
if (spec) then
local specId = GetSpecializationInfo(spec)
if (specId and specId > 0) then
return specId
end
end
end
function openRaidLib.UnitInfoManager.GetPlayerConduits()
local conduits = {}
local soulbindID = C_Soulbinds.GetActiveSoulbindID()
if (soulbindID ~= 0) then
local soulbindData = C_Soulbinds.GetSoulbindData(soulbindID)
if (soulbindData ~= 0) then
local tree = soulbindData.tree
local nodes = tree.nodes
table.sort(nodes, function(t1, t2) return t1.row < t2.row end)
local C_Soulbinds_GetConduitCollectionData = C_Soulbinds.GetConduitCollectionData
for nodeId, nodeInfo in ipairs(nodes) do
--check if the node is a conduit placed by the player
if (nodeInfo.state == Enum.SoulbindNodeState.Selected) then
local conduitId = nodeInfo.conduitID
local conduitRank = nodeInfo.conduitRank
if (conduitId and conduitRank) then
--have spell id when it's a default conduit from the game
local spellId = nodeInfo.spellID
--have conduit id when is a conduid placed by the player
local conduitId = nodeInfo.conduitID
if (spellId == 0) then
--is player conduit
spellId = C_Soulbinds.GetConduitSpellID(nodeInfo.conduitID, nodeInfo.conduitRank)
conduits[#conduits+1] = spellId
local collectionData = C_Soulbinds_GetConduitCollectionData(conduitId)
conduits[#conduits+1] = collectionData and collectionData.conduitItemLevel or 0
else
--is default conduit
conduits[#conduits+1] = spellId
conduits[#conduits+1] = 0
end
end
end
end
end
end
return conduits
end
function openRaidLib.GearManager.GetPlayerItemLevel()
if (_G.GetAverageItemLevel) then
local _, _itemLevel = GetAverageItemLevel()
itemLevel = floor(_itemLevel)
else
itemLevel = 0
end
return itemLevel
end
--return an integer between zero and one hundret indicating the player gear durability
function openRaidLib.GearManager.GetPlayerGearDurability()
local durabilityTotalPercent, totalItems = 0, 0
for i = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do
local durability, maxDurability = GetInventoryItemDurability(i)
if (durability and maxDurability) then
local itemDurability = durability / maxDurability * 100
durabilityTotalPercent = durabilityTotalPercent + itemDurability
totalItems = totalItems + 1
end
end
if (totalItems == 0) then
return 100
end
return floor(durabilityTotalPercent / totalItems)
end
function openRaidLib.GearManager.GetPlayerWeaponEnchant()
local weaponEnchant = 0
local _, _, _, mainHandEnchantId, _, _, _, offHandEnchantId = GetWeaponEnchantInfo()
if (LIB_OPEN_RAID_WEAPON_ENCHANT_IDS[mainHandEnchantId]) then
weaponEnchant = 1
elseif(LIB_OPEN_RAID_WEAPON_ENCHANT_IDS[offHandEnchantId]) then
weaponEnchant = 1
end
return weaponEnchant
end
function openRaidLib.GearManager.GetPlayerGemsAndEnchantInfo()
--hold equipmentSlotId of equipment with a gem socket but it's empty
local slotsWithoutGems = {}
--hold equipmentSlotId of equipments without an enchant
local slotsWithoutEnchant = {}
for equipmentSlotId = 1, 17 do
local itemLink = GetInventoryItemLink("player", equipmentSlotId)
if (itemLink) then
--get the information from the item
local _, itemId, enchantId, gemId1, gemId2, gemId3, gemId4, suffixId, uniqueId, levelOfTheItem, specId, upgradeInfo, instanceDifficultyId, numBonusIds, restLink = strsplit(":", itemLink)
local gemsIds = {gemId1, gemId2, gemId3, gemId4}
--> enchant
--check if the slot can receive enchat and if the equipment has an enchant
local enchantAttribute = LIB_OPEN_RAID_ENCHANT_SLOTS[equipmentSlotId]
if (enchantAttribute) then --this slot can receive an enchat
--check if this slot is relevant for the class, some slots can have enchants only for Agility which won't matter for Priests as an example
--if the value is an integer it points to an attribute (int, dex, str), otherwise it's true (boolean)
local slotIsRelevant = true
if (type (enchantAttribute) == "number") then
if (specMainAttribute ~= enchantAttribute) then
slotIsRelevant = false
end
end
if (slotIsRelevant) then
--does the slot has any enchant?
if (not enchantId or enchantId == "0" or enchantId == "") then
slotsWithoutEnchant[#slotsWithoutEnchant+1] = equipmentSlotId
else
--convert to integer
local enchantIdInt = tonumber(enchantId)
if (enchantIdInt) then
--does the enchant is relevent for the character?
if (not LIB_OPEN_RAID_ENCHANT_IDS[enchantIdInt]) then
slotsWithoutEnchant[#slotsWithoutEnchant+1] = equipmentSlotId
end
else
--the enchat has an invalid id
slotsWithoutEnchant[#slotsWithoutEnchant+1] = equipmentSlotId
end
end
end
end
--> gems
local itemStatsTable = {}
--fill the table above with information about the item
GetItemStats(itemLink, itemStatsTable)
--check if the item has a socket
if (itemStatsTable.EMPTY_SOCKET_PRISMATIC) then
--check if the socket is empty
for i = 1, itemStatsTable.EMPTY_SOCKET_PRISMATIC do
local gemId = tonumber(gemsIds[i])
if (not gemId or gemId == 0) then
slotsWithoutGems[#slotsWithoutGems+1] = equipmentSlotId
--check if the gem is not a valid gem (deprecated gem)
elseif (not LIB_OPEN_RAID_GEM_IDS[gemId]) then
slotsWithoutGems[#slotsWithoutGems+1] = equipmentSlotId
end
end
end
end
end
return slotsWithoutGems, slotsWithoutEnchant
end
--build a list with the local player cooldowns
--called only from SendAllPlayerCooldowns()
function openRaidLib.CooldownManager.GetPlayerCooldownList()
--get the player specId
local specId = openRaidLib.GetPlayerSpecId()
if (specId) then
--get the cooldowns for the specialization
local playerCooldowns = LIB_OPEN_RAID_COOLDOWNS_BY_SPEC[specId]
if (not playerCooldowns) then
openRaidLib.DiagnosticError("CooldownManager|GetPlayerCooldownList|can't find player cooldowns for specId:", specId)
return {}, {}
end
local cooldowns = {} --table to ship on comm
local cooldownsHash = {} --table with [spellId] = cooldownInfo
local talentsHash = openRaidLib.UnitInfoManager.GetPlayerTalentsAsPairsTable()
local timeNow = GetTime()
for cooldownSpellId, cooldownType in pairs(playerCooldowns) do
--get all the information about this cooldow
local cooldownInfo = LIB_OPEN_RAID_COOLDOWNS_INFO[cooldownSpellId]
if (cooldownInfo) then
--does this cooldown is based on a talent?
local talentId = cooldownInfo.talent
if (talentId) then
--check if the player has the talent selected
if (talentsHash[talentId]) then
cooldowns[#cooldowns+1] = cooldownSpellId
local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(cooldownSpellId)
cooldowns[#cooldowns+1] = timeLeft
cooldowns[#cooldowns+1] = charges
cooldowns[#cooldowns+1] = startTimeOffset
cooldowns[#cooldowns+1] = duration
cooldownsHash[cooldownSpellId] = {timeLeft, charges, startTimeOffset, duration, timeNow}
end
else
cooldowns[#cooldowns+1] = cooldownSpellId
local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(cooldownSpellId)
cooldowns[#cooldowns+1] = timeLeft
cooldowns[#cooldowns+1] = charges
cooldowns[#cooldowns+1] = startTimeOffset
cooldowns[#cooldowns+1] = duration
cooldownsHash[cooldownSpellId] = {timeLeft, charges, startTimeOffset, duration, timeNow}
end
end
end
return cooldowns, cooldownsHash
else
return {}, {}
end
end
--check if a player cooldown is ready or if is in cooldown
--@spellId: the spellId to check for cooldown
function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId)
--check if is a charge spell
local cooldownInfo = LIB_OPEN_RAID_COOLDOWNS_INFO[spellId]
if (cooldownInfo) then
if (cooldownInfo.charges and cooldownInfo.charges > 1) then
local chargesAvailable, chargesTotal, start, duration = GetSpellCharges(spellId)
if (chargesAvailable == chargesTotal) then
return 0, chargesTotal, 0, 0 --all charges are ready to use
else
--return the time to the next charge
local timeLeft = start + duration - GetTime()
local startTimeOffset = start - GetTime()
return ceil(timeLeft), chargesAvailable, startTimeOffset, duration --time left, charges, startTime
end
else
local start, duration = GetSpellCooldown(spellId)
if (start == 0) then --cooldown is ready
return 0, 1, 0, 0 --time left, charges, startTime
else
local timeLeft = start + duration - GetTime()
local startTimeOffset = start - GetTime()
return ceil(timeLeft), 0, ceil(startTimeOffset), duration --time left, charges, startTime, duration
end
end
else
return openRaidLib.DiagnosticError("CooldownManager|GetPlayerCooldownStatus()|cooldownInfo not found|", spellId)
end
end
--which is the main attribute of each spec
--1 Intellect
--2 Agility
--3 Strenth
openRaidLib.specAttribute = {
["DEMONHUNTER"] = {
[577] = 2,
[581] = 2,
},
["DEATHKNIGHT"] = {
[250] = 3,
[251] = 3,
[252] = 3,
},
["WARRIOR"] = {
[71] = 3,
[72] = 3,
[73] = 3,
},
["MAGE"] = {
[62] = 1,
[63] = 1,
[64] = 1,
},
["ROGUE"] = {
[259] = 2,
[260] = 2,
[261] = 2,
},
["DRUID"] = {
[102] = 1,
[103] = 2,
[104] = 2,
[105] = 1,
},
["HUNTER"] = {
[253] = 2,
[254] = 2,
[255] = 2,
},
["SHAMAN"] = {
[262] = 1,
[263] = 2,
[264] = 1,
},
["PRIEST"] = {
[256] = 1,
[257] = 1,
[258] = 1,
},
["WARLOCK"] = {
[265] = 1,
[266] = 1,
[267] =1 ,
},
["PALADIN"] = {
[65] = 1,
[66] = 3,
[70] = 3,
},
["MONK"] = {
[268] = 2,
[269] = 2,
[270] = 1,
}
}
File diff suppressed because it is too large Load Diff
+31 -2
View File
@@ -276,7 +276,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = {
[10060] = 1, --Power Infusion
[34433] = 1, --Shadowfiend
[200174] = 1, --Mindbender
[193223] = 1, --Surrender to Madness
[193223] = 1, --Surrender to Madness (talent)
[47585] = 2, --Dispersion
[15286] = 4, --Vampiric Embrace
[19236] = 5, --Desperate Prayer
@@ -954,4 +954,33 @@ else
--> shadowlands trinkets
[345020] = {name = GetSpellInfo(345020) .. " (" .. L["STRING_TRINKET"] .. ")"},
}
end
end
LIB_OPEN_RAID_SPELL_INTERRUPT = {
[6552] = {class = "WARRIOR", specs = {71, 72, 73}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Pummel
[2139] = {class = "MAGE", specs = {62, 63, 64}, cooldown = 24, silence = 6, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Counterspell
[15487] = {class = "PRIEST", specs = {258}, cooldown = 45, silence = 4, talent = false, cooldownWithTalent = 30, cooldownTalentId = 23137}, --Silence (shadow) Last Word Talent to reduce cooldown in 15 seconds
[1766] = {class = "ROGUE", specs = {259, 260, 261}, cooldown = 15, silence = 5, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Kick
[96231] = {class = "PALADIN", specs = {66, 70}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Rebuke (protection and retribution)
[116705] = {class = "MONK", specs = {268, 269}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Spear Hand Strike (brewmaster and windwalker)
[57994] = {class = "SHAMAN", specs = {262, 263, 264}, cooldown = 12, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Wind Shear
[47528] = {class = "DEATHKNIGHT", specs = {250, 251, 252}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Mind Freeze
[106839] = {class = "DRUID", specs = {103, 104}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Skull Bash (feral, guardian)
[78675] = {class = "DRUID", specs = {102}, cooldown = 60, silence = 8, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Solar Beam (balance)
[147362] = {class = "HUNTER", specs = {253, 254}, cooldown = 24, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Counter Shot (beast mastery, marksmanship)
[187707] = {class = "HUNTER", specs = {255}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Muzzle (survival)
[183752] = {class = "DEMONHUNTER", specs = {577, 581}, cooldown = 15, silence = 3, talent = false, cooldownWithTalent = false, cooldownTalentId = false}, --Disrupt
[19647] = {class = "WARLOCK", specs = {265, 266, 267}, cooldown = 24, silence = 6, talent = false, cooldownWithTalent = false, cooldownTalentId = false, pet = 417}, --Spell Lock (pet felhunter ability)
[89766] = {class = "WARLOCK", specs = {266}, cooldown = 30, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, pet = 17252}, --Axe Toss (pet felguard ability)
}
+166 -114
View File
@@ -14,19 +14,49 @@ With this object, you can start querying the library for information.
Functions:
local sentRequest = openRaidLib.RequestAllPlayersInfo()
Request to all players to send all data infomation: cooldowns, gear and player data.
local sentRequest = openRaidLib.RequestAllData()
Request to all players in the group to send infomation on: cooldowns, gear and player data.
Instants after calling this, expect to receive several callbacks.
COOLDOWNS:
--get all cooldowns from all units
local allUnitsCooldowns = openRaidLib.GetAllUnitsCooldown()
allUnitsCooldowns = {
["playerName1"] = {[cooldownSpellId] = cooldownInfo, [cooldownSpellId] = cooldownInfo, ...}
["playerName2"] = {[cooldownSpellId] = cooldownInfo, [cooldownSpellId] = cooldownInfo, ...}
["playerName3"] = {[cooldownSpellId] = cooldownInfo, [cooldownSpellId] = cooldownInfo, ...}
}
local allPlayersGear = openRaidLib.gearManager.GetAllPlayersGear()
--get all cooldowns from a single unit
local unitCooldows = openRaidLib.GetUnitCooldowns(unitId [,filter])
@unittId: "player", "target", "party2", "raid12", ...
@filter: "defensive-raid", "defensive-target", "defensive-personal", "ofensive", "utility"
can pass more than one filter separating by comma, example: "defensive-raid, defensive-target"
unitCooldows = {
[cooldownSpellId] = cooldownInfo,
[cooldownSpellId] = cooldownInfo,
[cooldownSpellId] = cooldownInfo,
}
--get a cooldownInfo of a single spell from any unit
local cooldownInfo = openRaidLib.GetUnitCooldownInfo(unitId, spellId)
--get cooldown timers to use with progress bar or cooldown frames, percent are normalized (0 to 1), timeLeft is seconds, minValue/maxValue/currentValue are in GetTime() time space, amount of charges
--by using unitID and spellID
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromUnitSpellID(unitId, spellId)
--by using a cooldown info
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
EQUIPMENT:
local allPlayersGear = openRaidLib.GetAllUnitsGear()
allPlayersGear = {
["playerName1"] = playerGear,
["playerName2"] = playerGear,
["playerName3"] = playerGear,
}
local playerGear = openRaidLib.gearManager.GetPlayerGear(playerName)
local playerGear = openRaidLib.GetUnitGear(unitId)
playerGear = {
.durability = number
.ilevel = number
@@ -36,75 +66,58 @@ playerGear = {
}
local allPlayersCooldowns = openRaidLib.cooldownManager.GetAllPlayersCooldown()
allPlayersCooldowns = {
["playerName1"] = playerCooldows,
["playerName2"] = playerCooldows,
["playerName3"] = playerCooldows,
UNIT INFORMATION
local allUnitsInfo = openRaidLib.GetAllUnitsInfo()
allUnitsInfo = {
["unitName1"] = unitInfo,
["unitName2"] = unitInfo,
["unitName3"] = unitInfo,
}
local playerCooldows = openRaidLib.cooldownManager.GetPlayerCooldowns(playerName)
playerCooldows = {
[cooldownSpellId] = {
[1] = time left (number),
[2] = charges (number),
[3] = start time offset (number) - time offset from when the cooldown was used,
[4] = duration (number),
[5] = GetTime() of when the information was received
}
}
local allPlayersInfo = openRaidLib.playerInfoManager.GetAllPlayersInfo()
allPlayersInfo = {
["playerName1"] = playerInfo,
["playerName2"] = playerInfo,
["playerName3"] = playerInfo,
}
local playerInfo = openRaidLib.playerInfoManager.GetPlayerInfo(playerName)
playerInfo = {
local unitInfo = openRaidLib.GetUnitInfo(unitId)
unitInfo = {
.specId = number
.renown = number,
.covenantId = number,
.talents = {talentId},
.conduits = {spellId},
.specName = string
.role = string
.renown = number
.covenantId = number
.talents = {talentId, talentId, talentId, ...}
.pvpTalents = {talentId, talentId, talentId}
.conduits = {spellId, conduitLevel, spellId, conduitLevel, spellId, conduitLevel, ...}
.class = string class eng name 'ROGUE'
.classId = number
.className = string class localized name
.name = string name without realm
.nameFull = string name with realm 'unitName-ServerName'
}
Callbacks:
===================================================================================================================================
"CooldownListUpdate": triggers when the lib received a list of cooldowns from another player in the group.
"CooldownListUpdate": triggers when the lib received a list of cooldowns from another unit in the group.
@unitId: which unit got updated
@unitCooldows: list of cooldowns of the unit
@allUnitsCooldowns: a list of all players with their cooldowns
===================================================================================================================================
function MyAddonObject.OnReceiveCooldownListUpdate(unitName, playerCooldows, allPlayersCooldowns)
--foreach player in the cooldown table
for unitName, playerCooldows in pairs(allPlayersCooldowns) do
for spellId, cooldownInfoTable in pairs(playerCooldows) do
--time left for the cooldown be ready to use, if time left is zero, the spell is ready
local timeLeft = cooldownInfoTable[1]
--in some cases the spell is on cooldown but there's a charge to use
local charges = cooldownInfoTable[2]
--cooldown start time offset (how much time has passed since the cooldown was used)
local startTimeOffset = cooldownInfoTable[3]
--cooldown duration, e.g. 180 for 3 minutes cooldown
local totalDuration = cooldownInfoTable[4]
--time when received this information
local timeReceived = cooldownInfoTable[5]
end
function MyAddonObject.OnReceiveCooldownListUpdate(unitId, unitCooldows, allUnitsCooldowns)
--using the 'unitCooldows' table passed for the updated unit
for spellId, cooldownInfo in pairs(unitCooldows) do
local isReady, timeLeft, charges, normalizedPercent, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
local statusbar = CreateFrame("statusbar", "MyStatusBar", UIParent)
statusbar:SetMinMaxValues(minValue, maxValue)
statusbar:SetValue(currentValue)
end
--get the cooldowns for the unit which got the cooldown update
local playerCooldows = allPlayersCooldowns[unitName]
for spellId, cooldownInfoTable in pairs(playerCooldows) do
--time left for the cooldown be ready to use, if time left is zero, the spell is ready
local timeLeft = cooldownInfoTable[1]
--in some cases the spell is on cooldown but there's a charge to use
local charges = cooldownInfoTable[2]
--cooldown start time
local startTime = cooldownInfoTable[3]
--cooldown duration, e.g. 180 for 3 minutes cooldown
local totalDuration = cooldownInfoTable[4]
--this event also passes a table with all player cooldowns
for unitName, unitCooldows in pairs(allUnitsCooldowns) do
for spellId, cooldownInfo in pairs(unitCooldows) do
local isReady, timeLeft, charges, normalizedPercent, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
local statusbar = CreateFrame("statusbar", "MyStatusBar", UIParent)
statusbar:SetMinMaxValues(0, 1)
statusbar:SetValue(normalizedPercent)
end
end
end
@@ -112,51 +125,50 @@ end
openRaidLib.RegisterCallback(MyAddonObject, "CooldownListUpdate", "OnReceiveCooldownListUpdate")
===================================================================================================================================
"CooldownUpdate": triggered when any unit in the group used a cooldown or the timeleft got an update
"CooldownUpdate": triggered when an unit in the group uses a cooldown or the timeleft of a cooldown of an unit got an update
@unitId: which unit got updated
@spellId: id of the cooldown spell
@cooldownInfo: a table containing information about the cooldown time
@unitCooldows: list of cooldowns of the unit
@allUnitsCooldowns: a list of all players and their cooldowns
===================================================================================================================================
function MyAddonObject.OnReceiveCooldownUpdate(unitName, spellId, cooldownTimeLeft, charges, startTime, totalDuration, playerCooldows, allPlayersCooldowns)
local unitCooldowns = allPlayersCooldowns[unitName] --is the same as using just 'playerCooldows' variable
--get the cooldowns for the unit which got the cooldown update
for spellId, cooldownInfoTable in pairs(playerCooldows) do
--time left for the cooldown be ready to use, if time left is zero, the spell is ready
local timeLeft = cooldownInfoTable[1]
--in some cases the spell is on cooldown but there's a charge to use
local charges = cooldownInfoTable[2]
--cooldown start time
local startTime = cooldownInfoTable[3]
--cooldown duration, e.g. 180 for 3 minutes cooldown
local totalDuration = cooldownInfoTable[4]
end
function MyAddonObject.OnReceiveCooldownUpdate(unitId, spellId, cooldownInfo, unitCooldows, allUnitsCooldowns)
local isReady, timeLeft, charges, normalizedPercent, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
local statusbar = CreateFrame("statusbar", "MyStatusBar", UIParent)
statusbar:SetMinMaxValues(minValue, maxValue)
statusbar:SetValue(currentValue)
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "CooldownUpdate", "OnReceiveCooldownUpdate")
===================================================================================================================================
"CooldownListWiped": when the list of cooldowns get a wipe, usually when the player leave the group
"CooldownListWipe": when the list of cooldowns get a wipe, usually when the player leave the group
===================================================================================================================================
function MyAddonObject.OnCooldownListWipe(allPlayersCooldowns)
--print ("is nil:", next(allPlayersCooldowns))
function MyAddonObject.OnCooldownListWipe(allUnitsCooldowns)
--print ("is nil:", next(allUnitsCooldowns))
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "CooldownListWiped", "OnCooldownListWipe")
openRaidLib.RegisterCallback(MyAddonObject, "CooldownListWipe", "OnCooldownListWipe")
Note: right after the wipe, player cooldowns get an update, so a callback "CooldownListUpdate" is triggered right after this event (on the same tick).
===================================================================================================================================
"GearUpdate": when received an update from a player with all information about the gear
===================================================================================================================================
function MyAddonObject.OnGearUpdate(playerName, playerGear, allPlayersGear)
local itemLevelNumber = playerGear.ilevel
local durabilityNumber = playerGear.durability
function MyAddonObject.OnGearUpdate(unitId, unitGear, allUnitsGear)
local itemLevelNumber = unitGear.ilevel
local durabilityNumber = unitGear.durability
--hasWeaponEnchant is 1 have enchant or 0 is don't
local hasWeaponEnchantNumber = playerGear.weaponEnchant
local noEnchantTable = playerGear.noEnchants
local noGemsTable = playerGear.noGems
local hasWeaponEnchantNumber = unitGear.weaponEnchant
local noEnchantTable = unitGear.noEnchants
local noGemsTable = unitGear.noGems
for index, slotIdWithoutEnchant in ipairs (noEnchantTable) do
end
@@ -172,76 +184,116 @@ openRaidLib.RegisterCallback(MyAddonObject, "GearUpdate", "OnGearUpdate")
"GearDurabilityUpdate": when the gear durability of a player in the group changes
===================================================================================================================================
function MyAddonObject.OnGearDurabilityUpdate(playerName, durability, playerGear, allPlayersGear)
--print(playerName .. " durability is now " .. durability)
function MyAddonObject.OnGearDurabilityUpdate(unitId, durability, unitGear, allUnitsGear)
--print(UnitName(unitId) .. " durability is now " .. durability)
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "GearDurabilityUpdate", "OnGearDurabilityUpdate")
===================================================================================================================================
"GearListWiped": when the list of gear get a wipe, usually when the player leave the group
"GearListWipe": when the list of gear get a wipe, usually when the player leave the group
===================================================================================================================================
function MyAddonObject.OnGearListWiped(allPlayersGear)
--print ("is nil:", next(allPlayersGear))
function MyAddonObject.OnGearListWiped(allUnitsGear)
--print ("is nil:", next(allUnitsGear))
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "GearListWiped", "OnGearListWiped")
openRaidLib.RegisterCallback(MyAddonObject, "GearListWipe", "OnGearListWiped")
Note: right after the wipe, player gear information get an update, so a callback "GearUpdate" is triggered right after this event (on the same tick).
===================================================================================================================================
"PlayerUpdate": received a player information about its spec, talents, etc...
"UnitInfoUpdate": a unit in the group has been updated
===================================================================================================================================
function MyAddonObject.OnPlayerUpdate(playerName, playerInfo, allPlayersInfo)
for unitName, playerInfo in pairs(allPlayersInfo) do
local specId = playerInfo.specId
local renown = playerInfo.renown
local covenantId = playerInfo.covenantId
local talents = playerInfo.talents
local conduits = playerInfo.conduits
function MyAddonObject.OnUnitUpdate(unitId, unitInfo, allUnitsInfo)
for unitName, unitInfo in pairs(allUnitsInfo) do
local specId = unitInfo.specId
local specName = unitInfo.specName
local role = unitInfo.role
local renown = unitInfo.renown
local covenantId = unitInfo.covenantId
local talents = unitInfo.talents
local pvpTalents = unitInfo.pvpTalents
local conduits = unitInfo.conduits
local class = unitInfo.class = string class eng name 'ROGUE'
local classId = unitInfo.classId = number
local className = unitInfo.className
local unitName = unitInfo.name = string name without realm
local unitNameFull = unitInfo.nameFull = string name with realm 'unitName-ServerName'
end
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "PlayerUpdate", "OnPlayerUpdate")
openRaidLib.RegisterCallback(MyAddonObject, "UnitInfoUpdate", "OnUnitUpdate")
===================================================================================================================================
"TalentsUpdate": when a unit changed a talent
"UnitInfoWipe": when the unit info got wipped, usually when the player leave the group
===================================================================================================================================
function MyAddonObject.OnTalentUpdate(playerName, talents, playerInfo, allPlayersInfo)
function MyAddonObject.OnUnitInfoWipe()
--all unit info got wiped
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "UnitInfoWipe", "OnUnitInfoWipe")
Note: a "UnitUpdate" callback is triggered right after this event to notify the player info is updated.
===================================================================================================================================
"TalentUpdate": when a unit changed a talent
===================================================================================================================================
function MyAddonObject.OnTalentUpdate(unitId, talents, unitInfo, allUnitsInfo)
for i = 1, 7 do
local talentId = talents[i]
local talentID, name, texture, selected, available = GetTalentInfoByID(talentId)
print(name)
local talentID, talentName, texture, selected, available = GetTalentInfoByID(talentId)
print(talentName)
end
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "TalentUpdate", "OnTalentUpdate")
===================================================================================================================================
"OnPlayerDeath": when a player dies
"PvPTalentUpdate": when an unit changed a pvp talent
===================================================================================================================================
function MyAddonObject.OnPlayerDeath(playerName)
print(playerName .. " died.")
function MyAddonObject.OnPvPTalentUpdate(unitId, pvpTalents, unitInfo, allUnitsInfo)
for i = 1, 3 do
local talentId = pvpTalents[i]
local talentID, talentName, icon, selected, available, spellID, unlocked, row, column, known, grantedByAura = GetPvpTalentInfoByID(talentId)
print(talentName)
end
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "OnPlayerDeath", "OnPlayerDeath")
openRaidLib.RegisterCallback(MyAddonObject, "PvPTalentUpdate", "OnPvPTalentUpdate")
===================================================================================================================================
"OnPlayerRess": when a player revives
"UnitDeath": when an unit died
===================================================================================================================================
function MyAddonObject.OnPlayerRess(playerName)
print(playerName .. " is alive.")
function MyAddonObject.OnUnitDeath(unitId)
print(UnitName(unitId) .. " died.")
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "OnPlayerRess", "OnPlayerRess")
openRaidLib.RegisterCallback(MyAddonObject, "UnitDeath", "OnUnitDeath")
===================================================================================================================================
"UnitAlive": when an unit revives
===================================================================================================================================
function MyAddonObject.OnUnitRess(unitId)
print(UnitName(unitId) .. " is alive.")
end
--registering the callback:
openRaidLib.RegisterCallback(MyAddonObject, "UnitAlive", "OnUnitRess")
+3
View File
@@ -1,4 +1,7 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
<Script file="LibOpenRaid.lua" />
<Script file="Functions.lua" />
<Script file="GetPlayerInformation.lua" />
<Script file="Deprecated.lua" />
<Script file="ThingsToMantain.lua" />
</Ui>
+12 -3
View File
@@ -6,9 +6,9 @@
local version, build, date, tocversion = GetBuildInfo()
_detalhes.build_counter = 9735
_detalhes.alpha_build_counter = 9735 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 31
_detalhes.build_counter = 9777
_detalhes.alpha_build_counter = 9777 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 32
_detalhes.dont_open_news = true
_detalhes.game_version = version
_detalhes.userversion = version .. _detalhes.build_counter
@@ -33,6 +33,15 @@ do
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" )
local news = {
{"v9.2.0.9777.146", "April 22th, 2022"},
"A cooldown tracker experiment has been added, its options is visible at the Options Panel.",
"When using Details! Death Recap, a message is now printed to chat showing what killed you accordingly to Blizzard Death Recap.",
"Fixed some errors while using Mind Control on an arena match.",
"Fixed encounter phase detection while using voice packs for boss mods addons.",
"Fixed an error after killing a boss encounter on heroic dificulty for the first time.",
"API: added 'UNIT_SPEC' and 'UNIT_TALENTS' event to details! event listener.",
"API: added Details:GetUnitId(unitName) which return the unitId for a given player name.",
{"v9.2.0.9735.146", "April 8th, 2022"},
"Arena Enemy Player deaths has been greatly improved on this version.",
"Added M+ Score into the player info tooltip (hover over the spec icon).",
+1
View File
@@ -2149,6 +2149,7 @@ 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)
end
+5 -3
View File
@@ -1765,10 +1765,10 @@ function Details.Database.StoreEncounter(combat)
local myrole = UnitGroupRolesAssigned ("player")
local mybest, onencounter = _detalhes.storage:GetBestFromPlayer (diff, encounter_id, myrole, _detalhes.playername, true) --> get dps or hps
local mybest2 = mybest and mybest[1] or 0
onencounter = onencounter or 999999
local myBestDps = mybest2 / onencounter.elapsed
if (mybest) then
if (mybest and onencounter) then
local myBestDps = mybest2 / onencounter.elapsed
local d_one = 0
if (myrole == "DAMAGER" or myrole == "TANK") then
d_one = combat (1, _detalhes.playername) and combat (1, _detalhes.playername).total / combat:GetCombatTime()
@@ -1966,6 +1966,7 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout)
spec = GetInspectSpecialization (unitid)
if (spec and spec ~= 0) then
_detalhes.cached_specs [guid] = spec
Details:SendEvent("UNIT_SPEC", nil, unitid, spec, guid)
end
--------------------------------------------------------------------------------------------------------
@@ -1983,6 +1984,7 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout)
if (talents [1]) then
_detalhes.cached_talents [guid] = talents
Details:SendEvent("UNIT_TALENTS", nil, unitid, talents, guid)
--print (UnitName (unitid), "talents:", unpack (talents))
end
end
+11 -10
View File
@@ -99,8 +99,10 @@
local container_pets = {} --> initialize table (placeholder)
--> ignore deaths
local ignore_death = {}
--> temp ignored
local ignore_actors = {}
--> cache
local cacheAnything = {
arenaHealth = {},
}
--> druids kyrian bounds
local druid_kyrian_bounds = {} --remove on 10.0
--> spell containers for special cases
@@ -616,11 +618,6 @@
end
end
--check if the target actor isn't in the temp blacklist
--if (ignore_actors [alvo_serial]) then
-- return
--end
--kyrian weapons
if (Details.KyrianWeaponSpellIds[spellid]) then
who_name = Details.KyrianWeaponActorName
@@ -1113,7 +1110,13 @@
if (not unitId) then
unitId = Details:GuessArenaEnemyUnitId(alvo_name)
end
this_event [5] = _UnitHealth(unitId)
if (unitId) then
this_event [5] = _UnitHealth(unitId)
else
this_event [5] = cacheAnything.arenaHealth[alvo_name] or 100000
end
cacheAnything.arenaHealth[alvo_name] = this_event[5]
else
this_event [5] = _UnitHealth(alvo_name)
end
@@ -5251,7 +5254,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (not OnRegenEnabled) then
_table_wipe (bitfield_swap_cache)
_table_wipe (ignore_actors)
_detalhes:DispatchAutoRunCode ("on_leavecombat")
end
@@ -5935,7 +5937,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_table_wipe (tanks_members_cache)
_table_wipe (auto_regen_cache)
_table_wipe (bitfield_swap_cache)
_table_wipe (ignore_actors)
local roster = _detalhes.tabela_vigente.raid_roster
+454 -388
View File
@@ -4,55 +4,27 @@ local Details = _G.Details
local DF = _G.DetailsFramework
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
local width = 170
local height = 300
local bar_height = 20
--namespace
Details.CooldownTracking = {}
function Details:InitializeCDTrackerWindow()
local DetailsCDTrackerWindow = CreateFrame("frame", "DetailsCDTrackerWindow", UIParent, "BackdropTemplate")
DetailsCDTrackerWindow:SetSize(700, 480)
DetailsCDTrackerWindow.Frame = DetailsCDTrackerWindow
DetailsCDTrackerWindow.__name = "OCD Tracker"
DetailsCDTrackerWindow.real_name = "DETAILS_CDTRACKERWINDOW"
DetailsCDTrackerWindow.__icon = [[Interface\TUTORIALFRAME\UI-TUTORIALFRAME-SPIRITREZ]]
DetailsCDTrackerWindow.__iconcoords = {130/512, 256/512, 0, 1}
DetailsCDTrackerWindow.__iconcolor = "white"
_G.DetailsPluginContainerWindow.EmbedPlugin(DetailsCDTrackerWindow, DetailsCDTrackerWindow, true)
function DetailsCDTrackerWindow.RefreshWindow()
Details.OpenCDTrackerWindow()
end
--check if is enabled at startup
if (Details.CooldownTracking.IsEnabled()) then
Details.CooldownTracking.EnableTracker()
end
DetailsCDTrackerWindow:Hide()
end
--return if the cooldown tracker is enabled
function Details.CooldownTracking.IsEnabled()
return Details.ocd_tracker.enabled
end
--enable the cooldown tracker
function Details.CooldownTracking.EnableTracker()
Details.ocd_tracker.enabled = true
--register callbacks
--openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownListUpdate", "CooldownListUpdateFunc") --nao tem
--openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownListWiped", "CooldownListWipedFunc") --nao tem
--openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownListUpdate", "CooldownUpdateFunc")
--openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownListWiped", "CooldownUpdateFunc")
openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownUpdate", "CooldownUpdateFunc")
--register callbacks with the openRaidLib
openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownListUpdate", "OnReceiveUnitFullCooldownList")
openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownUpdate", "OnReceiveSingleCooldownUpdate")
openRaidLib.RegisterCallback(Details.CooldownTracking, "CooldownListWipe", "OnCooldownListWipe")
Details.CooldownTracking.RefreshCooldownFrames()
end
--disable the cooldown tracker
function Details.CooldownTracking.DisableTracker()
Details.ocd_tracker.enabled = false
@@ -62,103 +34,90 @@ function Details.CooldownTracking.DisableTracker()
end
--unregister callbacks
openRaidLib.UnregisterCallback(Details.CooldownTracking, "CooldownListUpdate", "CooldownUpdateFunc")
openRaidLib.UnregisterCallback(Details.CooldownTracking, "CooldownListWiped", "CooldownUpdateFunc")
openRaidLib.UnregisterCallback(Details.CooldownTracking, "CooldownUpdate", "CooldownUpdateFunc")
end
function Details.CooldownTracking.CooldownUpdateFunc()
Details.CooldownTracking.RefreshCooldowns()
openRaidLib.UnregisterCallback(Details.CooldownTracking, "CooldownListUpdate", "OnReceiveUnitFullCooldownList")
openRaidLib.UnregisterCallback(Details.CooldownTracking, "CooldownUpdate", "OnReceiveSingleCooldownUpdate")
openRaidLib.UnregisterCallback(Details.CooldownTracking, "CooldownListWipe", "OnCooldownListWipe")
end
function Details.CooldownTracking.HideAllBars()
for _, bar in ipairs (DetailsOnlineCDTrackerScreenPanel.bars) do
bar:ClearAllPoints()
bar:Hide()
--> Library Open Raid Callbacks
--callback on the event 'CooldownListUpdate', this is triggered when a player in the group sent the list of cooldowns
--@unitId: which unit got updated
--@unitCooldows: a table with [spellId] = cooldownInfo
--@allUnitsCooldowns: a table containing all units [unitName] = {[spellId] = cooldownInfo}
function Details.CooldownTracking.OnReceiveUnitFullCooldownList(unitId, unitCooldows, allUnitsCooldowns)
Details.CooldownTracking.RefreshCooldownFrames()
end
end
function Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, frameId)
local cooldownFrame = screenPanel.bars[frameId]
if (cooldownFrame) then
--callback on the event 'CooldownUpdate', this is triggered when a player uses a cooldown or a cooldown got updated (time left reduced, etc)
--@unitId: which unit got updated
--@spellId: which cooldown spell got updated
--@cooldownInfo: cooldown information table to be passed with other functions
--@unitCooldows: a table with [spellId] = cooldownInfo
--@allUnitsCooldowns: a table containing all units [unitName] = {[spellId] = cooldownInfo}
function Details.CooldownTracking.OnReceiveSingleCooldownUpdate(unitId, spellId, cooldownInfo, unitCooldows, allUnitsCooldowns)
local screenPanel = DetailsOnlineCDTrackerScreenPanel
local gotUpdated = false
local unitName = GetUnitName(unitId, true)
if (screenPanel) then
local cooldownFrame = screenPanel.playerCache[unitName] and screenPanel.playerCache[unitName][spellId]
if (cooldownFrame) then
--get the cooldown time from the lib, it return data ready to use on statusbar
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
if (not isReady) then
cooldownFrame:SetTimer(currentValue, minValue, maxValue)
else
cooldownFrame:SetTimer()
end
gotUpdated = true
end
end
if (not gotUpdated) then
Details.CooldownTracking.RefreshCooldownFrames()
end
end
--when the list of cooldowns got wiped, usually happens when the player left a group
--@allUnitsCooldowns: a table containing all units [unitName] = {[spellId] = cooldownInfo}
function Details.CooldownTracking.OnCooldownListWipe(allUnitsCooldowns)
Details.CooldownTracking.RefreshCooldownFrames()
end
--> Frames
--hide all bars created
function Details.CooldownTracking.HideAllBars()
for _, bar in ipairs (DetailsOnlineCDTrackerScreenPanel.bars) do
bar:ClearAllPoints()
bar:Hide()
bar.cooldownInfo = nil
bar.spellId = nil
bar.class = nil
bar.unitName = nil
end
end
--get a cooldown frame
function Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, frameId)
local cooldownFrame = screenPanel.bars[frameId]
if (cooldownFrame) then
return cooldownFrame
end
local cooldownFrame = DF:CreateTimeBar(screenPanel, [[Interface\AddOns\Details\images\bar_serenity]], Details.ocd_tracker.width-2, Details.ocd_tracker.height-2, 100, nil, screenPanel:GetName() .. "CDFrame" .. frameId)
tinsert(screenPanel.bars, cooldownFrame)
cooldownFrame:EnableMouse(false)
return cooldownFrame
end
local cooldownFrame = DF:CreateTimeBar(screenPanel, [[Interface\AddOns\Details\images\bar_serenity]], width-2, bar_height-2, 100, nil, screenPanel:GetName() .. "CDFrame" .. frameId)
tinsert(screenPanel.bars, cooldownFrame)
return cooldownFrame
end
function Details.CooldownTracking.SetupCooldownFrame(cooldownFrame, unitName, class, spellId)
local spellIcon = GetSpellTexture(spellId)
if (spellIcon) then
cooldownFrame:SetIcon(spellIcon, .1, .9, .1, .9)
local classColor = C_ClassColor.GetClassColor(class)
cooldownFrame:SetStatusBarColor(classColor.r, classColor.g, classColor.b)
cooldownFrame:SetLeftText(DF:RemoveRealmName(unitName))
cooldownFrame.spellId = spellId
cooldownFrame.class = class
cooldownFrame.unitName = unitName
end
end
function Details.CooldownTracking.SetupCooldownFrameTimer(cooldownFrame, startTime, endTime, currentTime)
if (currentTime == 0) then
cooldownFrame:StopTimer()
else
cooldownFrame:SetTimer(currentTime, startTime, endTime)
end
end
function Details.CooldownTracking.ProcessUnitCooldowns(unitId, statusBarFrameId, cooldownsOrganized)
local screenPanel = DetailsOnlineCDTrackerScreenPanel
if (not screenPanel) then
return
end
local allPlayersInfo = openRaidLib.playerInfoManager.GetAllPlayersInfo()
local allCooldownsFromLib = LIB_RAID_STATUS_COOLDOWNS_BY_SPEC
local cooldownsEnabled = Details.ocd_tracker.cooldowns
local unitName = UnitName(unitId)
local thisPlayerInfo = allPlayersInfo[unitName]
local GUID = UnitGUID(unitId)
local _, unitClassEng, classId = UnitClass(unitId)
local unitSpec = (thisPlayerInfo and thisPlayerInfo.specId) or (Details:GetSpecFromSerial(GUID)) or 0
if (unitSpec and unitSpec ~= 0) then
local unitCooldowns = allCooldownsFromLib[unitSpec]
for spellId, cooldownType in pairs(unitCooldowns) do
if (cooldownsEnabled[spellId]) then
local spellName = GetSpellInfo(spellId)
--print("CD:", spellName, unitName) --problema com shadowfiend do shadowpriest the mostra 2 vezes
local cooldownFrame = Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, statusBarFrameId)
Details.CooldownTracking.SetupCooldownFrame(cooldownFrame, unitName, unitClassEng, spellId)
tinsert(cooldownsOrganized[classId], cooldownFrame)
statusBarFrameId = statusBarFrameId + 1
screenPanel.playerCache[unitName] = screenPanel.playerCache[unitName] or {}
screenPanel.playerCache[unitName][spellId] = cooldownFrame
end
end
end
end
function Details.CooldownTracking.RefreshCooldownFrames()
local screenPanel = DetailsOnlineCDTrackerScreenPanel
if (not screenPanel) then
--screen panel (goes into the UIParent and show cooldowns there)
--create the screen panel, goes into the UIParent and show cooldowns
function Details.CooldownTracking.CreateScreenFrame()
DetailsOnlineCDTrackerScreenPanel = CreateFrame("frame", "DetailsOnlineCDTrackerScreenPanel", UIParent, "BackdropTemplate")
screenPanel = DetailsOnlineCDTrackerScreenPanel
screenPanel:Hide()
screenPanel:SetSize(width, height)
screenPanel:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height)
screenPanel:SetPoint("center", 0, 0)
screenPanel:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
screenPanel:SetBackdropColor(0, 0, 0, .55)
@@ -191,291 +150,398 @@ function Details.CooldownTracking.RefreshCooldownFrames()
screenPanel.bars = {}
screenPanel.cooldownCache = Details.ocd_tracker.current_cooldowns
screenPanel.playerCache = {}
screenPanel.statusBarFrameIndex = 1
return screenPanel
end
screenPanel.scheduleRosterUpdate = nil
if (Details.ocd_tracker.show_conditions.only_in_group) then
if (not IsInGroup()) then
screenPanel:Hide()
return
function Details.CooldownTracking.SetupCooldownFrame(cooldownFrame)
local spellIcon = GetSpellTexture(cooldownFrame.spellId)
if (spellIcon) then
cooldownFrame:SetIcon(spellIcon, .1, .9, .1, .9)
local classColor = C_ClassColor.GetClassColor(cooldownFrame.class)
cooldownFrame:SetStatusBarColor(classColor.r, classColor.g, classColor.b)
cooldownFrame:SetLeftText(DF:RemoveRealmName(cooldownFrame.unitName))
cooldownFrame:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height)
end
end
if (Details.ocd_tracker.show_conditions.only_inside_instance) then
local isInInstanceType = select(2, GetInstanceInfo())
if (isInInstanceType ~= "party" and isInInstanceType ~= "raid" and isInInstanceType ~= "scenario" and isInInstanceType ~= "arena") then
screenPanel:Hide()
return
end
end
function Details.CooldownTracking.ProcessUnitCooldowns(unitId, unitCooldowns, cooldownsOrganized)
if (unitCooldowns) then
local unitInfo = openRaidLib.GetUnitInfo(unitId)
if (unitInfo) then
for spellId, cooldownInfo in pairs(unitCooldowns) do
--get a bar
local cooldownFrame = Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, screenPanel.statusBarFrameIndex)
cooldownFrame.cooldownInfo = cooldownInfo
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
local cooldownsOrganized = {}
for classId = 1, 12 do --12 classes
cooldownsOrganized[classId] = {}
end
local numGroupMembers = GetNumGroupMembers()
local statusBarFrameId = 1
cooldownFrame.spellId = spellId
cooldownFrame.class = unitInfo.class
cooldownFrame.unitName = unitInfo.nameFull
wipe(screenPanel.playerCache)
--setup the cooldown in the bar
Details.CooldownTracking.SetupCooldownFrame(cooldownFrame)
--add the cooldown into the organized by class table
tinsert(cooldownsOrganized[unitInfo.classId], cooldownFrame)
--iterate to the next cooldown frame
screenPanel.statusBarFrameIndex = screenPanel.statusBarFrameIndex + 1
if (IsInRaid()) then
for i = 1, numGroupMembers do
local unitId = "raid"..i
Details.CooldownTracking.ProcessUnitCooldowns(unitId, statusBarFrameId, cooldownsOrganized)
end
elseif (IsInGroup()) then
for i = 1, numGroupMembers - 1 do
local unitId = "party"..i
Details.CooldownTracking.ProcessUnitCooldowns(unitId, statusBarFrameId, cooldownsOrganized)
end
--player
Details.CooldownTracking.ProcessUnitCooldowns("player", statusBarFrameId, cooldownsOrganized)
end
for classId = 1, 12 do --12 classes
table.sort(cooldownsOrganized[classId], function(t1, t2) return t1.spellId < t2.spellId end)
end
Details.CooldownTracking.RefreshCooldowns()
end
--esta passando NIL no startTime para o SetTimer
--o numero de frames criados é menor que o numero de frames mostrados, esta dando erro em local bar = screenPanel.bars[barIndex] 381
function Details.CooldownTracking.RefreshCooldowns()
local screenPanel = DetailsOnlineCDTrackerScreenPanel
if (not screenPanel) then
return
end
--local cache saved with the character savedVariables
local cooldownCache = screenPanel.cooldownCache
local cooldownStatus = openRaidLib.cooldownManager.GetAllPlayersCooldown()
local cooldownIndex = 1
for unitName, allPlayerCooldowns in pairs(cooldownStatus) do
for spellId, cooldownInfo in pairs(allPlayerCooldowns) do
local cooldownFrame = screenPanel.playerCache[unitName] and screenPanel.playerCache[unitName][spellId]
if (cooldownFrame) then
local cooldownCache = cooldownCache[unitName] and cooldownCache[unitName][spellId]
if (not cooldownCache) then
--a cache with cooldown timers is saved within the host addon
screenPanel.cooldownCache[unitName] = screenPanel.cooldownCache[unitName] or {}
screenPanel.cooldownCache[unitName][spellId] = screenPanel.cooldownCache[unitName][spellId] or {}
cooldownCache = screenPanel.cooldownCache[unitName][spellId]
--store the cooldown frame into a cache to get the cooldown frame quicker when a cooldown receives updates
screenPanel.playerCache[unitInfo.nameFull] = screenPanel.playerCache[unitInfo.nameFull] or {}
screenPanel.playerCache[unitInfo.nameFull][spellId] = cooldownFrame
end
end
end
end
local timeLeft = cooldownInfo[1]
local charges = cooldownInfo[2]
local startTime = GetTime() - cooldownInfo[3]
local duration = cooldownInfo[4]
local endTime = startTime + duration
--> update cooldown frames based on the amount of players in the group or raid
function Details.CooldownTracking.RefreshCooldownFrames()
local screenPanel = DetailsOnlineCDTrackerScreenPanel
--save the cooldown data in the host addon
cooldownCache[1] = timeLeft
cooldownCache[2] = charges
cooldownCache[3] = startTime
cooldownCache[4] = endTime
if (not screenPanel) then
screenPanel = Details.CooldownTracking.CreateScreenFrame()
end
cooldownFrame:Show()
if (Details.ocd_tracker.framme_locked) then
screenPanel:EnableMouse(false)
else
screenPanel:EnableMouse(true)
end
if (cooldownFrame.spellId ~= spellId or unitName ~= cooldownFrame.unitName) then
--there's a different spell showing or player using this frame
if (timeLeft ~= 0) then
local spellName = GetSpellInfo(spellId)
--print("set timer 3", spellName, startTime + timeLeft, startTime, endTime)
--cooldownFrame:SetTimer(startTime + timeLeft, startTime, endTime)
end
Details.CooldownTracking.HideAllBars()
screenPanel.scheduleRosterUpdate = nil
wipe(screenPanel.playerCache)
screenPanel.statusBarFrameIndex = 1
if (Details.ocd_tracker.show_conditions.only_in_group) then
if (not IsInGroup()) then
screenPanel:Hide()
return
end
end
if (Details.ocd_tracker.show_conditions.only_inside_instance) then
local isInInstanceType = select(2, GetInstanceInfo())
if (isInInstanceType ~= "party" and isInInstanceType ~= "raid" and isInInstanceType ~= "scenario" and isInInstanceType ~= "arena") then
screenPanel:Hide()
return
end
end
local cooldownsOrganized = {}
for classId = 1, 12 do --12 classes
cooldownsOrganized[classId] = {}
end
local numGroupMembers = GetNumGroupMembers()
local filter = ""
for filterName, isEnabled in pairs(Details.ocd_tracker.filters) do
if (isEnabled) then
filter = filter .. filterName .. ","
end
end
if (IsInRaid()) then
for i = 1, numGroupMembers do
local unitId = "raid"..i
local unitCooldowns = openRaidLib.GetUnitCooldowns(unitId, filter)
Details.CooldownTracking.ProcessUnitCooldowns(unitId, unitCooldowns, cooldownsOrganized)
end
elseif (IsInGroup()) then
for i = 1, numGroupMembers - 1 do
local unitId = "party"..i
local unitCooldowns = openRaidLib.GetUnitCooldowns(unitId, filter)
Details.CooldownTracking.ProcessUnitCooldowns(unitId, unitCooldowns, cooldownsOrganized)
end
--player
local unitCooldowns = openRaidLib.GetUnitCooldowns("player", filter)
local cooldownInfo = unitCooldowns[15286]
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
Details.CooldownTracking.ProcessUnitCooldowns("player", unitCooldowns, cooldownsOrganized)
else
--player
local unitCooldowns = openRaidLib.GetUnitCooldowns("player", filter)
Details.CooldownTracking.ProcessUnitCooldowns("player", unitCooldowns, cooldownsOrganized)
end
for classId = 1, 12 do --12 classes
table.sort(cooldownsOrganized[classId], function(t1, t2) return t1.spellId < t2.spellId end)
end
local xPos = 1
local yPos = 0
local maxHeight = 0
local maxWidth = Details.ocd_tracker.width + 2
local cooldownFrameIndex = 1
for classId = 1, 12 do
local cooldownFrameList = cooldownsOrganized[classId]
for index, cooldownFrame in ipairs(cooldownFrameList) do
local cooldownInfo = cooldownFrame.cooldownInfo
local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo)
--local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, currentValue = openRaidLib.GetCooldownStatusFromUnitSpellID(cooldownFrame.unitName, cooldownFrame.spellId)
if (not isReady) then
cooldownFrame:SetTimer(currentValue, minValue, maxValue)
else
--spell and player are the same
if (timeLeft ~= 0) then
if (cooldownFrame:HasTimer()) then
if (cooldownFrame.timeLeft ~= timeLeft) then
local spellName = GetSpellInfo(spellId)
--print("set timer 1", spellName, startTime + timeLeft, startTime, endTime)
--cooldownFrame:SetTimer(startTime + timeLeft, startTime, endTime)
end
cooldownFrame:SetTimer()
end
--positioning
if (cooldownFrameIndex % Details.ocd_tracker.lines_per_column == 0) then
xPos = xPos + Details.ocd_tracker.width + 2
maxWidth = xPos + Details.ocd_tracker.width + 2
yPos = 0
end
cooldownFrame:SetPoint("topleft", screenPanel, "topleft", xPos, yPos)
yPos = yPos - Details.ocd_tracker.height - 1
if (yPos < maxHeight) then
maxHeight = yPos
end
cooldownFrameIndex = cooldownFrameIndex + 1
end
end
maxHeight = abs(maxHeight)
if (maxHeight == 0) then
screenPanel:Hide()
return
end
screenPanel:SetSize(maxWidth, maxHeight)
screenPanel:Show()
end
--> Options panel
--initialize the cooldown options window and embed it to Details! options panel
function Details:InitializeCDTrackerWindow()
local DetailsCDTrackerWindow = CreateFrame("frame", "DetailsCDTrackerWindow", UIParent, "BackdropTemplate")
DetailsCDTrackerWindow:SetSize(700, 480)
DetailsCDTrackerWindow.Frame = DetailsCDTrackerWindow
DetailsCDTrackerWindow.__name = "Cooldown Tracker"
DetailsCDTrackerWindow.real_name = "DETAILS_CDTRACKERWINDOW"
DetailsCDTrackerWindow.__icon = [[Interface\TUTORIALFRAME\UI-TUTORIALFRAME-SPIRITREZ]]
DetailsCDTrackerWindow.__iconcoords = {130/512, 256/512, 0, 1}
DetailsCDTrackerWindow.__iconcolor = "white"
_G.DetailsPluginContainerWindow.EmbedPlugin(DetailsCDTrackerWindow, DetailsCDTrackerWindow, true)
function DetailsCDTrackerWindow.RefreshWindow()
Details.OpenCDTrackerWindow()
end
--check if is enabled at startup
if (Details.CooldownTracking.IsEnabled()) then
Details.CooldownTracking.EnableTracker()
end
DetailsCDTrackerWindow:Hide()
end
function Details.OpenCDTrackerWindow()
--check if the window exists, if not create it
if (not _G.DetailsCDTrackerWindow or not _G.DetailsCDTrackerWindow.Initialized) then
_G.DetailsCDTrackerWindow.Initialized = true
local f = _G.DetailsCDTrackerWindow or DF:CreateSimplePanel(UIParent, 700, 480, "Details! Online CD Tracker", "DetailsCDTrackerWindow")
DF:ApplyStandardBackdrop(f)
--enabled with a toggle button
--execute to reset position
--misc configs
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local generalOptions = {
{--enable ocd
type = "toggle",
get = function() return Details.ocd_tracker.enabled end,
set = function (self, fixedparam, value)
if (value) then
Details.CooldownTracking.EnableTracker()
else
if (timeLeft ~= 0) then
local spellName = GetSpellInfo(spellId)
--print("set timer 2", spellName, startTime + timeLeft, startTime, endTime)
--cooldownFrame:SetTimer(startTime + timeLeft, startTime, endTime)
end
Details.CooldownTracking.DisableTracker()
end
else
if (cooldownFrame:GetValue() ~= 100) then
cooldownFrame:StopTimer()
end
end
end
end,
name = "Enable Experimental Cooldown Tracker",
desc = "Enable Experimental Cooldown Tracker",
},
cooldownIndex = cooldownIndex + 1
end
end
end
{--show only in group
type = "toggle",
get = function() return Details.ocd_tracker.show_conditions.only_in_group end,
set = function (self, fixedparam, value)
Details.ocd_tracker.show_conditions.only_in_group = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Only in Group",
desc = "Only in Group",
},
cooldownIndex = cooldownIndex - 1
{--show only inside instances
type = "toggle",
get = function() return Details.ocd_tracker.show_conditions.only_inside_instance end,
set = function (self, fixedparam, value)
Details.ocd_tracker.show_conditions.only_inside_instance = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Only Inside Instances",
desc = "Only Inside Instances",
},
{--lock frame
type = "toggle",
get = function() return Details.ocd_tracker.framme_locked end,
set = function (self, fixedparam, value)
Details.ocd_tracker.framme_locked = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Lock Frame",
desc = "Lock Frame",
},
local xAnchor = 1
local defaultY = 0
local xPos = 1
local yPos = 0
local maxHeight = 0
{type = "breakline"},
for barIndex = 1, cooldownIndex do
if (barIndex % 11 == 0) then
xPos = xPos + width + 2
yPos = 0
{--filter: show raid wide defensive cooldowns
type = "toggle",
get = function() return Details.ocd_tracker.filters["defensive-raid"] end,
set = function (self, fixedparam, value)
Details.ocd_tracker.filters["defensive-raid"] = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Defensive: Raid",
desc = "Exanple: druid tranquility.",
},
{--filter: show target defensive cooldowns
type = "toggle",
get = function() return Details.ocd_tracker.filters["defensive-target"] end,
set = function (self, fixedparam, value)
Details.ocd_tracker.filters["defensive-target"] = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Defensive: Target",
desc = "Exanple: priest pain suppression.",
},
{--filter: show personal defensive cooldowns
type = "toggle",
get = function() return Details.ocd_tracker.filters["defensive-personal"] end,
set = function (self, fixedparam, value)
Details.ocd_tracker.filters["defensive-personal"] = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Defensive: Personal",
desc = "Exanple: mage ice block.",
},
{--filter: show ofensive cooldowns
type = "toggle",
get = function() return Details.ocd_tracker.filters["ofensive"] end,
set = function (self, fixedparam, value)
Details.ocd_tracker.filters["ofensive"] = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Offensive Cooldowns",
desc = "Exanple: priest power infusion.",
},
{--filter: show utility cooldowns
type = "toggle",
get = function() return Details.ocd_tracker.filters["utility"] end,
set = function (self, fixedparam, value)
Details.ocd_tracker.filters["utility"] = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Utility Cooldowns",
desc = "Exanple: druid roar.",
},
{type = "breakline"},
{--bar width
type = "range",
get = function() return Details.ocd_tracker.width end,
set = function (self, fixedparam, value)
Details.ocd_tracker.width = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
min = 10,
max = 200,
step = 1,
name = "Width",
desc = "Width",
},
{--bar height
type = "range",
get = function() return Details.ocd_tracker.height end,
set = function (self, fixedparam, value)
Details.ocd_tracker.height = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
min = 10,
max = 200,
step = 1,
name = "Height",
desc = "Height",
},
{--bar height
type = "range",
get = function() return Details.ocd_tracker.lines_per_column end,
set = function (self, fixedparam, value)
Details.ocd_tracker.lines_per_column = floor(value)
Details.CooldownTracking.RefreshCooldownFrames()
end,
min = 1,
max = 30,
step = 1,
name = "Lines Per Column",
desc = "Lines Per Column",
},
}
DF:BuildMenu(f, generalOptions, 5, -35, 150, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
--cooldown selection
local cooldownProfile = Details.ocd_tracker.cooldowns
local cooldownSelectionFrame = CreateFrame("frame", "$parentCooldownSelectionFrame", f, "BackdropTemplate")
cooldownSelectionFrame:SetPoint("topleft", f, "topleft", 0, -150)
cooldownSelectionFrame:SetPoint("bottomright", f, "bottomright", 0, 10)
DF:ApplyStandardBackdrop(cooldownSelectionFrame)
--lib test test warning texts
local warning1 = cooldownSelectionFrame:CreateFontString(nil, "overlay", "GameFontNormal", 5)
warning1:SetPoint("center", f, "center", 0, 0)
warning1:SetText("A cooldown tracker on Details!?\nWhat's next, a Caw counter for Elwynn Forest?")
DF:SetFontColor(warning1, "silver")
DF:SetFontSize(warning1, 14)
local animationHub = DF:CreateAnimationHub(warning1)
local anim1 = DF:CreateAnimation(animationHub, "rotation", 1, 0, 35)
anim1:SetEndDelay(math.huge)
anim1:SetSmoothProgress(1)
animationHub:Play()
animationHub:Pause()
local warning2 = cooldownSelectionFrame:CreateFontString(nil, "overlay", "GameFontNormal", 5)
warning2:SetJustifyH("left")
warning2:SetPoint("topleft", f, "topleft", 5, -160)
DF:SetFontColor(warning2, "lime")
warning2:SetText("This is a concept of a cooldown tracker using the new library 'Open Raid' which uses comms to update cooldown timers.\nThe code to implement is so small that can fit inside a weakaura\nIf you're a coder, the implementation is on Details/frames/window_cdtracker.lua")
end
local bar = screenPanel.bars[barIndex]
bar:SetPoint("topleft", screenPanel, "topleft", xPos, yPos)
yPos = yPos - bar_height
if (yPos < maxHeight) then
maxHeight = yPos
end
end
maxHeight = abs(maxHeight)
if (maxHeight == 0) then
screenPanel:Hide()
return
end
screenPanel:SetSize(width + xAnchor, abs(maxHeight))
screenPanel:Show()
end
function Details.OpenCDTrackerWindow()
--check if the window exists, if not create it
if (not _G.DetailsCDTrackerWindow or not _G.DetailsCDTrackerWindow.Initialized) then
_G.DetailsCDTrackerWindow.Initialized = true
local f = _G.DetailsCDTrackerWindow or DF:CreateSimplePanel(UIParent, 700, 480, "Details! Online CD Tracker", "DetailsCDTrackerWindow")
DF:ApplyStandardBackdrop(f)
--enabled with a toggle button
--execute to reset position
--misc configs
local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local generalOptions = {
{--enable ocd
type = "toggle",
get = function() return Details.ocd_tracker.enabled end,
set = function (self, fixedparam, value)
if (value) then
Details.CooldownTracking.EnableTracker()
else
Details.CooldownTracking.DisableTracker()
end
end,
name = "Enable Online Cooldown Tracker",
desc = "Enable Online Cooldown Tracker",
},
{--show only in group
type = "toggle",
get = function() return Details.ocd_tracker.show_conditions.only_in_group end,
set = function (self, fixedparam, value)
Details.ocd_tracker.show_conditions.only_in_group = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Only in Group",
desc = "Only in Group",
},
{--show only inside instances
type = "toggle",
get = function() return Details.ocd_tracker.show_conditions.only_inside_instance end,
set = function (self, fixedparam, value)
Details.ocd_tracker.show_conditions.only_inside_instance = value
Details.CooldownTracking.RefreshCooldownFrames()
end,
name = "Only Inside Instances",
desc = "Only Inside Instances",
},
}
DF:BuildMenu(f, generalOptions, 5, -35, 150, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
--cooldown selection
local cooldownProfile = Details.ocd_tracker.cooldowns
local cooldownSelectionFrame = CreateFrame("frame", "$parentCooldownSelectionFrame", f, "BackdropTemplate")
cooldownSelectionFrame:SetPoint("topleft", f, "topleft", 0, -150)
cooldownSelectionFrame:SetPoint("bottomright", f, "bottomright", 0, 10)
DF:ApplyStandardBackdrop(cooldownSelectionFrame)
--list of cooldowns to show, each one with a toggle button
local cooldownList = {}
local alreadyAdded = {}
if (LIB_RAID_STATUS_COOLDOWNS_BY_SPEC) then
for specId, cooldownTable in pairs(LIB_RAID_STATUS_COOLDOWNS_BY_SPEC) do
local currentIndex = #cooldownList+1
local cooldownAdded = false
for spellId, cooldownType in pairs(cooldownTable) do
if (not alreadyAdded[spellId]) then
if (cooldownType == 3 or cooldownType == 4 or cooldownType == 1 or cooldownType == 2) then
local spellName, _, spellIcon = GetSpellInfo(spellId)
if (spellName) then
cooldownList[#cooldownList+1] = {
type = "toggle",
get = function()
if (cooldownProfile[spellId] == nil) then
if (cooldownType == 3 or cooldownType == 4 or cooldownType == 1 or cooldownType == 2) then
cooldownProfile[spellId] = true
end
end
return cooldownProfile[spellId]
end,
set = function (self, fixedparam, value)
if (value) then
cooldownProfile[spellId] = value
else
cooldownProfile[spellId] = nil
end
end,
name = "|T" .. spellIcon .. ":" .. (16) .. ":" .. (16) .. ":0:0:64:64:" .. 0.1*64 .. ":" .. 0.9*64 .. ":" .. 0.1*64 .. ":" .. 0.9*64 .. "|t" .. spellName,
desc = spellName,
boxfirst = true,
}
alreadyAdded[spellId] = true
cooldownAdded = true
end
end
end
end
if (cooldownAdded) then
local _, spenName, _, specIcon = GetSpecializationInfoByID(specId)
local iconString = "|T" .. specIcon .. ":" .. (16) .. ":" .. (16) .. ":0:0:64:64:" .. 0.1*64 .. ":" .. 0.9*64 .. ":" .. 0.1*64 .. ":" .. 0.9*64 .. "|t"
tinsert(cooldownList, currentIndex, {type = "label", get = function() return iconString .. " " .. spenName end})
if (currentIndex > 1) then
tinsert(cooldownList, currentIndex, {type = "blank"})
end
end
end
end
DF:BuildMenu(cooldownSelectionFrame, cooldownList, 5, -5, cooldownSelectionFrame:GetHeight() - 40, false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
end
_G.DetailsPluginContainerWindow.OpenPlugin(_G.DetailsCDTrackerWindow)
_G.DetailsCDTrackerWindow:Show()
end
_G.DetailsPluginContainerWindow.OpenPlugin(_G.DetailsCDTrackerWindow)
_G.DetailsCDTrackerWindow:Show()
end
+39 -8
View File
@@ -253,7 +253,7 @@ function Details:OpenCurrentRealDPSOptions(from_options_panel)
},
}
DF:BuildMenu (f, options, 7, -30, 500, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
DF:BuildMenu (f, options, 7, -50, 500, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template)
f:SetScript ("OnHide" , function()
if (DetailsCurrentDpsMeter) then
@@ -361,12 +361,28 @@ function Details:CreateCurrentDpsFrame(parent, name)
f.dpsBarFrame = barFrame
barFrame:SetSize(400, 80)
barFrame:SetPoint("center", f, "center", 0, 0)
barFrame:EnableMouse(false)
barFrame.splitBar = DF:CreateSplitBar(barFrame, 400, 20)
barFrame.splitBar:SetSize(400, 20)
barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0)
barFrame.splitBar.fontsize = 10
barFrame.splitBar:SetTexture(SharedMedia:Fetch("statusbar", "Splitbar"))
barFrame.splitBar:SetTexture(SharedMedia:Fetch("statusbar", "Details Flat"))
barFrame.splitBar:SetBackgroundTexture([[Interface/AddOns/Details/images/bar_textures/chess]])
barFrame.splitBar:SetBackgroundColor(1, 0, 0, 1)
barFrame.splitBar.SparkAlwaysShow = true
barFrame.borderFrame = CreateFrame("frame", "DetailsArenaDpsBarsBorderFrame", barFrame, "BackdropTemplate")
barFrame.borderFrame:SetFrameLevel(barFrame.splitBar:GetFrameLevel()-1)
local backgroundText = barFrame.borderFrame:CreateTexture(nil, "background")
backgroundText:SetColorTexture(0, 0, 0, 0.5)
backgroundText:SetAllPoints()
barFrame.borderFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
barFrame.borderFrame:SetBackdropBorderColor(0, 0, 0, 1)
barFrame.borderFrame:SetPoint("topleft", barFrame.splitBar.widget, "topleft", -1, 1)
barFrame.borderFrame:SetPoint("bottomright", barFrame.splitBar.widget, "bottomright", 1, -1)
--> title bar
local TitleString = f:CreateFontString (nil, "overlay", "GameFontNormal")
@@ -566,7 +582,6 @@ function Details:CreateCurrentDpsFrame(parent, name)
_detalhes:UpdateTheRealCurrentDPSFrame()
local on_tick = function (self, deltaTime)
self.NextUpdate = self.NextUpdate - deltaTime
if (self.NextUpdate <= 0) then
@@ -633,7 +648,7 @@ function Details:CreateCurrentDpsFrame(parent, name)
f.YellowDamage = max (0, f.YellowDamage)
end
self.NextScreenUpdate = self.NextScreenUpdate - time_fraction
self.NextScreenUpdate = self.NextScreenUpdate - time_fraction --always 0.1
--> update double bar
local teamGreenDps = self.PlayerTeamDamage / self.SampleSize
@@ -642,13 +657,29 @@ function Details:CreateCurrentDpsFrame(parent, name)
local dpsBarFrame = DetailsArenaDpsBars.splitBar
--a percenntagem na barra esta sendo setada corretamente, porem a animação não esta funcrtionando ainda
DetailsArenaDpsBars.splitBar:SetValueWithAnimation(teamGreenDps / totalDamage)
local percentValue = teamGreenDps / totalDamage
DetailsArenaDpsBars.splitBar:SetValueWithAnimation(percentValue)
DetailsArenaDpsBars:Show()
if (f.PlayerTeam == 0) then
dpsBarFrame:SetLeftColor(unpack (green_team_color))
dpsBarFrame:SetRightColor(unpack (yellow_team_color))
local team1Alpha = DF:MapRangeClamped(.5, 1, 1, .7, percentValue)
local team2Alpha = DF:MapRangeClamped(0, .5, .7, 1, percentValue)
do
local cR, cG, cB, cA = dpsBarFrame:GetLeftColor()
local alphaTeam1Value = DF:LerpLinearColor(deltaTime, 1, cA, 0, 0, team1Alpha, 0, 0)
local r, g, b = unpack(green_team_color)
dpsBarFrame:SetLeftColor(r, g, b, alphaTeam1Value)
end
do
local cR, cG, cB, cA = dpsBarFrame:GetRightColor()
local alphaTeam2Value = DF:LerpLinearColor(deltaTime, 1, cA, 0, 0, team2Alpha, 0, 0)
local r, g, b = unpack(yellow_team_color)
dpsBarFrame:SetRightColor(r, g, b, alphaTeam2Value)
end
else
--not in use, player team is forced to 0
dpsBarFrame:SetLeftColor(unpack (yellow_team_color))
dpsBarFrame:SetRightColor(unpack (green_team_color))
end
@@ -811,7 +842,7 @@ function DetailsTestSplitBar()
barFrame.splitBar:SetPoint("center", barFrame, "center", 0, 0)
barFrame.splitBar.fontsize = 10
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
barFrame.splitBar:SetTexture(SharedMedia:Fetch("statusbar", "Splitbar"))
barFrame.splitBar:SetTexture(SharedMedia:Fetch("statusbar", "Details Flat"))
barFrame.splitBar:SetLeftColor(unpack (green_team_color))
barFrame.splitBar:SetRightColor(unpack (yellow_team_color))
+11 -50
View File
@@ -39,58 +39,19 @@ end
function Details:BossModsLink()
if (_G.DBM) then
local DBM = _G.DBM
local DBMCallbackPhase = function(event, msg, ...)
local DBMCallbackPhase2 = function(event, mod, modId, phase, encounterId, stageTotal)
local encounterTable = Details.encounter_table
--get the mod from DBM cached within the encounter_table
--note: encounter_table is wipped at ENCOUNTER_END
--note 2: at the moment, the saved table 'DBM_Mod' isn't in use on Details!, need a cleanup in the future
local mod = encounterTable.DBM_Mod
if (not mod) then
local id = Details:GetEncounterIdFromBossIndex(encounterTable.mapid, encounterTable.id)
if (id) then
for index, DBMMod in ipairs(DBM.Mods) do
if (DBMMod.id == id) then
encounterTable.DBM_Mod = DBMMod
mod = DBMMod
end
end
end
end
local newPhase = 1
event = event:lower()
if (event:find("announce")) then
msg = msg:lower()
if (msg:find("stage")) then
msg = msg:gsub("%a", "")
msg = msg:gsub("%s+", "")
newPhase = tonumber(msg)
local ID, msg2, someId, someNumber, aBool = ...
if (msg2 == "stagechange") then
--print(4,"newPhase: " .. newPhase .. "|", ID, msg2, someId, someNumber, aBool)
end
local phase = newPhase
if (phase and encounterTable.phase ~= phase) then
Details:Msg("Current phase is now:", phase)
Details:OnCombatPhaseChanged()
encounterTable.phase = phase
local currentCombat = Details:GetCurrentCombat()
local time = currentCombat:GetCombatTime()
if (time > 5) then
tinsert(currentCombat.PhaseData, {phase, time})
end
Details:SendEvent("COMBAT_ENCOUNTER_PHASE_CHANGED", nil, phase)
end
if (phase and encounterTable.phase ~= phase) then
--Details:Msg("Current phase is now:", phase)
Details:OnCombatPhaseChanged()
encounterTable.phase = phase
local currentCombat = Details:GetCurrentCombat()
local time = currentCombat:GetCombatTime()
if (time > 5) then
tinsert(currentCombat.PhaseData, {phase, time})
end
Details:SendEvent("COMBAT_ENCOUNTER_PHASE_CHANGED", nil, phase)
end
end
@@ -100,8 +61,8 @@ function Details:BossModsLink()
encounterTable.DBM_ModTime = time()
end
DBM:RegisterCallback("DBM_Announce", DBMCallbackPhase)
DBM:RegisterCallback("pull", DBMCallbackPull)
DBM:RegisterCallback("DBM_SetStage", DBMCallbackPhase2)
end
if (BigWigsLoader and not _G.DBM) then
+3 -1
View File
@@ -627,7 +627,9 @@ hooksecurefunc (_G, "DeathRecap_LoadUI", function()
local casterPrestige = evtData.casterPrestige
local spellSchool = evtData.school
--print("Killed by (Blizzard-Debug): ", spellName, "amount:", amountDamage)
if (Details.death_recap.enabled) then
print("Blizzard DeathRecap: ", spellName, "amount:", amountDamage)
end
--recap by Details!
local deathEventsDetails = latestDeath[1]
+5
View File
@@ -22,6 +22,8 @@
--> misc
["DETAILS_OPTIONS_MODIFIED"] = {},
["UNIT_SPEC"] = {},
["UNIT_TALENTS"] = {},
--> data
["DETAILS_DATA_RESET"] = {},
@@ -116,6 +118,9 @@ local common_events = {
["REALM_CHANNEL_LEAVE"] = true,
["COMM_EVENT_RECEIVED"] = true,
["COMM_EVENT_SENT"] = true,
["UNIT_SPEC"] = true,
["UNIT_TALENTS"] = true,
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+44
View File
@@ -10,6 +10,8 @@ do
local _select = select
local _unpack = unpack
local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0")
local unknown_class_coords = {0.75, 1, 0.75, 1}
function Details:GetUnknownClassIcon()
@@ -255,6 +257,34 @@ do
end
end
function Details:GetUnitId(unitName)
unitName = unitName or self.nome
local unitId = openRaidLib.GetUnitID(unitName)
if (unitId) then
return unitId
end
if (IsInRaid()) then
for i = 1, GetNumGroupMembers() do
local unitId = "raid" .. i
if (GetUnitName(unitId, true) == unitName) then
return unitId
end
end
elseif (IsInGroup()) then
for i = 1, GetNumGroupMembers() -1 do
local unitId = "party" .. i
if (GetUnitName(unitId, true) == unitName) then
return unitId
end
end
if (UnitName("player") == unitName) then
return "player"
end
end
end
function _detalhes:ReGuessSpec (t)
local Actor, container = t[1], t[2]
@@ -272,6 +302,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
@@ -296,6 +328,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
@@ -328,6 +362,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
@@ -396,6 +432,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Actor.guessing_spec = nil
@@ -421,6 +459,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
@@ -447,6 +487,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
@@ -479,6 +521,8 @@ do
Actor.spec = spec
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
+15 -4
View File
@@ -820,9 +820,9 @@ local default_profile = {
0.23, -- [3]
},
["ARENA_GREEN"] = {
0.4, -- [1]
1, -- [2]
0.4, -- [3]
0.686, -- [1]
0.372, -- [2]
0.905, -- [3]
},
["ARENA_YELLOW"] = {
1, -- [1]
@@ -1131,8 +1131,19 @@ local default_player_data = {
only_in_group = true,
only_inside_instance = true,
},
show_options = false,
show_options = true,
current_cooldowns = {},
framme_locked = false,
filters = {
["defensive-raid"] = false,
["defensive-target"] = false,
["defensive-personal"] = false,
["ofensive"] = true,
["utility"] = false,
},
width = 120,
height = 18,
lines_per_column = 12,
},
--> force all fonts to have this outline
+13 -1
View File
@@ -29,7 +29,7 @@ function Details:StopTestBarUpdate()
Details.test_bar_update = nil
end
function Details:CreateTestBars (alphabet)
function Details:CreateTestBars (alphabet, isArena)
local current_combat = Details:GetCombat ("current")
local pclass = select (2, UnitClass ("player"))
@@ -178,6 +178,18 @@ function Details:CreateTestBars (alphabet)
robot.grupo = true
robot.classe = who [2]
robot.flag_original = "0x514"
if (isArena) then
if (math.random() > 0.5) then
robot.arena_ally = true
robot.arena_team = 0
else
robot.arena_enemy = true
robot.arena_team = 1
robot.enemy = true
end
end
if (who[3]) then
robot.spec = who[3]
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+2 -2
View File
@@ -54,9 +54,9 @@ function Details:StartMeUp() --I'll never stop!
self:InitializePlaterIntegrationWindow()
self:InitializeMacrosWindow()
if (self.ocd_tracker.show_options) then
--if (self.ocd_tracker.show_options) then
self:InitializeCDTrackerWindow()
end
--end
--custom window
self.custom = self.custom or {}