diff --git a/Details.toc b/Details.toc index d6cd18d3..93f53886 100644 --- a/Details.toc +++ b/Details.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details! Damage Meter ## Notes: Essential tool to impress that chick in your raid. ## SavedVariables: _detalhes_global @@ -28,6 +28,7 @@ core\util.lua API.lua functions\events.lua +functions\private.lua functions\profiles.lua functions\hooks.lua functions\bossmods.lua diff --git a/Details_TBC.toc b/Details_TBC.toc index bda10f6e..f6f064c2 100644 --- a/Details_TBC.toc +++ b/Details_TBC.toc @@ -25,6 +25,7 @@ indent.lua core\util.lua API.lua +functions\private.lua functions\profiles.lua functions\hooks.lua functions\bossmods.lua diff --git a/Details_Wrath.toc b/Details_Wrath.toc index 8f3fa5db..ed6b0b09 100644 --- a/Details_Wrath.toc +++ b/Details_Wrath.toc @@ -26,6 +26,7 @@ indent.lua core\util.lua API.lua +functions\private.lua functions\profiles.lua functions\hooks.lua functions\bossmods.lua diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index a8f45c22..fae0155d 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -1029,3 +1029,52 @@ end return colorPickButton end + + function DF:SetRegularButtonTexture(button, texture, left, right, top, bottom) + if (type(left) == "table") then + left, right, top, bottom = unpack(left) + end + + if (not left) then + left, right, top, bottom = 0, 1, 0, 1 + end + + local atlas + if (type(texture) == "string") then + atlas = C_Texture.GetAtlasInfo(texture) + end + + local normalTexture = button:GetNormalTexture() + local pushedTexture = button:GetPushedTexture() + local highlightTexture = button:GetHightlightTexture() + local disabledTexture = button:GetDisabledTexture() + + if (atlas) then + normalTexture:SetAtlas(texture) + pushedTexture:SetAtlas(texture) + highlightTexture:SetAtlas(texture) + disabledTexture:SetAtlas(texture) + else + normalTexture:SetTexture(texture) + pushedTexture:SetTexture(texture) + highlightTexture:SetTexture(texture) + disabledTexture:SetTexture(texture) + normalTexture:SetTexCoord(left, right, top, bottom) + pushedTexture:SetTexCoord(left, right, top, bottom) + highlightTexture:SetTexCoord(left, right, top, bottom) + disabledTexture:SetTexCoord(left, right, top, bottom) + end + end + + function DF:SetRegularButtonVertexColor(button, ...) + local r, g, b, a = DF:ParseColor(...) + local normalTexture = button:GetNormalTexture() + local pushedTexture = button:GetPushedTexture() + local highlightTexture = button:GetHightlightTexture() + local disabledTexture = button:GetDisabledTexture() + + normalTexture:SetVertexColor(r, g, b, a) + pushedTexture:SetVertexColor(r, g, b, a) + highlightTexture:SetVertexColor(r, g, b, a) + disabledTexture:SetVertexColor(r, g, b, a) + end \ No newline at end of file diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 17e5e070..f31d22a3 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -28,6 +28,8 @@ function DF:CreateCoolTip() return end + local maxStatusBarValue = 100000000 + local defaultBackdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} local defaultBackdropColor = {0.1215, 0.1176, 0.1294, 0.8000} @@ -1159,7 +1161,7 @@ function DF:CreateCoolTip() function gameCooltip:StatusBar(menuButton, statusBarSettings) if (statusBarSettings) then - menuButton.statusbar:SetValue(statusBarSettings[1]) + menuButton.statusbar:SetValue(Clamp(statusBarSettings[1], 0, maxStatusBarValue)) menuButton.statusbar:SetStatusBarColor(statusBarSettings[2], statusBarSettings[3], statusBarSettings[4], statusBarSettings[5]) menuButton.statusbar:SetHeight(20 + (gameCooltip.OptionsTable.StatusBarHeightMod or 0)) @@ -1171,7 +1173,7 @@ function DF:CreateCoolTip() end if (statusBarSettings[7]) then - menuButton.statusbar2:SetValue(statusBarSettings[7].value) + menuButton.statusbar2:SetValue(Clamp(statusBarSettings[7].value, 0, maxStatusBarValue)) menuButton.statusbar2.texture:SetTexture(statusBarSettings[7].texture or [[Interface\RaidFrame\Raid-Bar-Hp-Fill]]) if (statusBarSettings[7].specialSpark) then menuButton.spark2:Show() diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index bf47ce38..eb79027f 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -191,10 +191,10 @@ DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin) --menu width and height function DropDownMetaFunctions:SetMenuSize(width, height) if (width) then - return rawset(self, "realsizeW", width) + rawset(self, "realsizeW", width) end if (height) then - return rawset(self, "realsizeH", height) + rawset(self, "realsizeH", height) end end @@ -515,6 +515,18 @@ function DropDownMetaFunctions:Selected(thisOption) self.label:SetPoint("left", self.label:GetParent(), "left", 4, 0) end + if (thisOption.centerTexture) then + self.dropdown.centerTexture:SetTexture(thisOption.centerTexture) + else + self.dropdown.centerTexture:SetTexture("") + end + + if (thisOption.rightTexture) then + self.dropdown.rightTexture:SetTexture(thisOption.rightTexture) + else + self.dropdown.rightTexture:SetTexture("") + end + if (thisOption.statusbar) then self.statusbar:SetTexture(thisOption.statusbar) if (thisOption.statusbarcolor) then @@ -540,6 +552,7 @@ function DropDownMetaFunctions:Selected(thisOption) self:SetValue(thisOption.value) end +--on click on any option in the dropdown function DetailsFrameworkDropDownOptionClick(button) --update name and icon on main frame button.object:Selected(button.table) @@ -555,9 +568,11 @@ function DetailsFrameworkDropDownOptionClick(button) button.object.myvaluelabel = button.table.label end +--on click on the dropdown show the menu frame with the options to select function DropDownMetaFunctions:Open() self.dropdown.dropdownframe:Show() self.dropdown.dropdownborder:Show() + self.opened = true if (lastOpened) then lastOpened:Close() @@ -565,6 +580,7 @@ function DropDownMetaFunctions:Open() lastOpened = self end +--close the menu showing the options function DropDownMetaFunctions:Close() --when menu is being close, just hide the border and the script will call back this again if (self.dropdown.dropdownborder:IsShown()) then @@ -585,6 +601,7 @@ function DetailsFrameworkDropDownOptionsFrameOnHide(self) self:GetParent().MyObject:Close() end +--on enter an option in the menu dropdown function DetailsFrameworkDropDownOptionOnEnter(self) if (self.table.desc) then GameCooltip2:Preset(2) @@ -603,10 +620,22 @@ function DetailsFrameworkDropDownOptionOnEnter(self) self.tooltip = true end + if (self.table.audiocue) then + if (DF.CurrentSoundHandle) then + StopSound(DF.CurrentSoundHandle, 0.1) + end + + local willPlay, soundHandle = PlaySoundFile(self.table.audiocue, "Master") + if (willPlay) then + DF.CurrentSoundHandle = soundHandle + end + end + self:GetParent().mouseover:SetPoint("left", self) self:GetParent().mouseover:Show() end +--on leave an option on the menu dropdown function DetailsFrameworkDropDownOptionOnLeave(frame) if (frame.table.desc) then GameCooltip2:ShowMe(false) @@ -615,6 +644,7 @@ function DetailsFrameworkDropDownOptionOnLeave(frame) end --@button is the raw button frame, object is the button capsule +--click on the main dropdown frame (not the menu options popup) function DetailsFrameworkDropDownOnMouseDown(button, buttontype) local object = button.MyObject @@ -645,9 +675,9 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) end for tindex, thisOption in ipairs(optionsTable) do - local show = isOptionVisible(button, thisOption) + local bIsOptionVisible = isOptionVisible(button, thisOption) - if (show) then + if (bIsOptionVisible) then local thisOptionFrame = object.menus[i] showing = showing + 1 @@ -657,14 +687,26 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) thisOptionFrame = DF:CreateDropdownButton(parent, name) local optionIndex = i - 1 - thisOptionFrame:SetPoint("topleft", parent, "topleft", 1, (-optionIndex*20)-0) - thisOptionFrame:SetPoint("topright", parent, "topright", 0, (-optionIndex*20)-0) + thisOptionFrame:SetPoint("topleft", parent, "topleft", 1, (-optionIndex * 20)) + thisOptionFrame:SetPoint("topright", parent, "topright", 0, (-optionIndex * 20)) thisOptionFrame.object = object object.menus[i] = thisOptionFrame end thisOptionFrame:SetFrameStrata(thisOptionFrame:GetParent():GetFrameStrata()) - thisOptionFrame:SetFrameLevel(thisOptionFrame:GetParent():GetFrameLevel()+10) + thisOptionFrame:SetFrameLevel(thisOptionFrame:GetParent():GetFrameLevel() + 10) + + if (thisOption.rightTexture) then + thisOptionFrame.rightTexture:SetTexture(thisOption.rightTexture) + else + thisOptionFrame.rightTexture:SetTexture("") + end + + if (thisOption.centerTexture) then + thisOptionFrame.centerTexture:SetTexture(thisOption.centerTexture) + else + thisOptionFrame.centerTexture:SetTexture("") + end thisOptionFrame.icon:SetTexture(thisOption.icon) if (thisOption.icon) then @@ -742,8 +784,8 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) thisOptionFrame.table = thisOption local labelwitdh = thisOptionFrame.label:GetStringWidth() - if (labelwitdh+40 > frameWitdh) then - frameWitdh = labelwitdh+40 + if (labelwitdh + 40 > frameWitdh) then + frameWitdh = labelwitdh + 40 end thisOptionFrame:Show() @@ -763,7 +805,7 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) local size = object.realsizeH - if (showing*20 > size) then + if (showing * 20 > size) then --show scrollbar and setup scroll object:ShowScroll() scrollFrame:EnableMouseWheel(true) @@ -817,6 +859,10 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) end object:Open() + + --scrollFrame:SetHeight(300) + --scrollChild:SetHeight(300) + --scrollBorder:SetHeight(300) else --clear menu end @@ -1050,8 +1096,8 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de end dropDownObject.func = func - dropDownObject.realsizeW = 150 - dropDownObject.realsizeH = 150 + dropDownObject.realsizeW = 165 + dropDownObject.realsizeH = 300 dropDownObject.FixedValue = nil dropDownObject.opened = false dropDownObject.menus = {} @@ -1138,6 +1184,16 @@ function DF:CreateNewDropdownFrame(parent, name) icon:SetVertexColor(1, 1, 1, 0.4) newDropdownFrame.icon = icon + local rightTexture = newDropdownFrame:CreateTexture("$parent_RightTexture", "OVERLAY") + rightTexture:SetPoint("right", newDropdownFrame, "right", -2, 0) + rightTexture:SetSize(20, 20) + newDropdownFrame.rightTexture = rightTexture + + local centerTexture = newDropdownFrame:CreateTexture("$parent_CenterTexture", "OVERLAY") + centerTexture:SetPoint("center", newDropdownFrame, "center", 0, 0) + centerTexture:SetSize(20, 20) + newDropdownFrame.centerTexture = centerTexture + local text = newDropdownFrame:CreateFontString("$parent_Text", "ARTWORK", "GameFontHighlightSmall") text:SetPoint("left", icon, "right", 5, 0) text:SetJustifyH("left") @@ -1168,33 +1224,31 @@ function DF:CreateNewDropdownFrame(parent, name) local border = CreateFrame("frame", "$Parent_Border", newDropdownFrame, "BackdropTemplate") border:Hide() border:SetFrameStrata("FULLSCREEN") - border:SetSize(150, 150) + border:SetSize(150, 300) border:SetPoint("topleft", newDropdownFrame, "bottomleft", 0, 0) border:SetBackdrop(borderBackdrop) border:SetScript("OnHide", DetailsFrameworkDropDownOptionsFrameOnHide) border:SetBackdropColor(0, 0, 0, 0.92) - border:SetBackdropBorderColor(0, 0, 0, 1) + border:SetBackdropBorderColor(.2, .2, .2, 0.8) newDropdownFrame.dropdownborder = border local scroll = CreateFrame("ScrollFrame", "$Parent_ScrollFrame", newDropdownFrame, "BackdropTemplate") scroll:SetFrameStrata("FULLSCREEN") - scroll:SetSize(150, 150) + scroll:SetSize(150, 300) scroll:SetPoint("topleft", newDropdownFrame, "bottomleft", 0, 0) scroll:Hide() newDropdownFrame.dropdownframe = scroll local child = CreateFrame("frame", "$Parent_ScrollChild", scroll, "BackdropTemplate") - child:SetSize(150, 150) + --child:SetAllPoints() + child:SetSize(150, 300) child:SetPoint("topleft", scroll, "topleft", 0, 0) - child:SetBackdrop(childBackdrop) - child:SetBackdropColor(0, 0, 0, 1) + DF:ApplyStandardBackdrop(child) local backgroundTexture = child:CreateTexture(nil, "background") backgroundTexture:SetAllPoints() backgroundTexture:SetColorTexture(0, 0, 0, 1) - DF:ApplyStandardBackdrop(child) - local selected = child:CreateTexture("$parent_SelectedTexture", "BACKGROUND") selected:SetSize(150, 16) selected:SetPoint("left", child, "left", 2, 0) @@ -1243,6 +1297,16 @@ function DF:CreateDropdownButton(parent, name) rightButton:SetPoint("right", newButton, "right", -2, 0) rightButton:Hide() + local rightTexture = newButton:CreateTexture("$parent_RightTexture", "OVERLAY") + rightTexture:SetPoint("right", newButton, "right", -2, 0) + rightTexture:SetSize(20, 20) + newButton.rightTexture = rightTexture + + local centerTexture = newButton:CreateTexture("$parent_CenterTexture", "OVERLAY") + centerTexture:SetPoint("center", newButton, "center", 0, 0) + centerTexture:SetSize(20, 20) + newButton.centerTexture = centerTexture + newButton:SetScript("OnMouseDown", DetailsFrameworkDropDownOptionClick) newButton:SetScript("OnEnter", DetailsFrameworkDropDownOptionOnEnter) newButton:SetScript("OnLeave", DetailsFrameworkDropDownOptionOnLeave) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 54b47338..e1bbed6c 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 387 +local dversion = 393 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -694,7 +694,7 @@ function DF:GroupIterator(callback, ...) end end -function DF:IntegerToTimer(value) +function DF:IntegerToTimer(value) --~formattime return "" .. floor(value/60) .. ":" .. format("%02.f", value%60) end @@ -3372,7 +3372,12 @@ end --this is most copied from the wow client code, few changes applied to customize it function DF:CreateGlowOverlay (parent, antsColor, glowColor) - local glowFrame = CreateFrame("frame", parent:GetName() and "$parentGlow2" or "OverlayActionGlow" .. math.random(1, 10000000), parent, "ActionBarButtonSpellActivationAlert") + local pName = parent:GetName() + local fName = pName and (pName.."Glow2") or "OverlayActionGlow" .. math.random(1, 10000000) + if fName and string.len(fName) > 50 then -- shorten to work around too long names + fName = strsub(fName, string.len(fName)-49) + end + local glowFrame = CreateFrame("frame", fName, parent, "ActionBarButtonSpellActivationAlert") glowFrame:HookScript ("OnShow", glow_overlay_onshow) glowFrame:HookScript ("OnHide", glow_overlay_onhide) @@ -4827,6 +4832,7 @@ end ["getglobal"] = true, ["setmetatable"] = true, ["DevTools_DumpCommand"] = true, + ["ChatEdit_SendText"] = true, --avoid creating macros ["SetBindingMacro"] = true, diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 1bf14dcf..e2ba0eaf 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -1971,48 +1971,64 @@ function detailsFramework:CreateScaleBar(frame, config) --~scale end local no_options = {} -function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_options, db) - - if (db and name and not db [name]) then - db [name] = {scale = 1} +--[=[ + options available to panel_options: + NoScripts = false, --if true, won't set OnMouseDown and OnMouseUp (won't be movable) + NoTUISpecialFrame = false, --if true, won't add the frame to 'UISpecialFrames' + DontRightClickClose = false, --if true, won't make the frame close when clicked with the right mouse button + UseScaleBar = false, --if true, will create a scale bar in the top left corner (require a table on 'db' to save the scale) + UseStatusBar = false, --if true, creates a status bar at the bottom of the frame (frame.StatusBar) + NoCloseButton = false, --if true, won't show the close button + NoTitleBar = false, --if true, don't create the title bar +]=] +function detailsFramework:CreateSimplePanel(parent, width, height, title, frameName, panelOptions, savedVariableTable) + if (savedVariableTable and frameName and not savedVariableTable[frameName]) then + savedVariableTable[frameName] = { + scale = 1 + } end - if (not name) then - name = "DetailsFrameworkSimplePanel" .. detailsFramework.SimplePanelCounter + if (not frameName) then + frameName = "DetailsFrameworkSimplePanel" .. detailsFramework.SimplePanelCounter detailsFramework.SimplePanelCounter = detailsFramework.SimplePanelCounter + 1 end if (not parent) then parent = UIParent end - panel_options = panel_options or no_options + panelOptions = panelOptions or no_options - local f = CreateFrame("frame", name, UIParent,"BackdropTemplate") - f:SetSize(w or 400, h or 250) - f:SetPoint("center", UIParent, "center", 0, 0) - f:SetFrameStrata("FULLSCREEN") - f:EnableMouse() - f:SetMovable(true) - f:SetBackdrop(SimplePanel_frame_backdrop) - f:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color)) - f:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color)) + local simplePanel = CreateFrame("frame", frameName, UIParent,"BackdropTemplate") + simplePanel:SetSize(width or 400, height or 250) + simplePanel:SetPoint("center", UIParent, "center", 0, 0) + simplePanel:SetFrameStrata("FULLSCREEN") + simplePanel:EnableMouse() + simplePanel:SetMovable(true) + simplePanel:SetBackdrop(SimplePanel_frame_backdrop) + simplePanel:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color)) + simplePanel:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color)) - f.DontRightClickClose = panel_options.DontRightClickClose + simplePanel.DontRightClickClose = panelOptions.DontRightClickClose - if (not panel_options.NoTUISpecialFrame) then - tinsert(UISpecialFrames, name) + if (not panelOptions.NoTUISpecialFrame) then + tinsert(UISpecialFrames, frameName) end - local title_bar = CreateFrame("frame", name .. "TitleBar", f,"BackdropTemplate") - title_bar:SetPoint("topleft", f, "topleft", 2, -3) - title_bar:SetPoint("topright", f, "topright", -2, -3) - title_bar:SetHeight(20) - title_bar:SetBackdrop(SimplePanel_frame_backdrop) - title_bar:SetBackdropColor(.2, .2, .2, 1) - title_bar:SetBackdropBorderColor(0, 0, 0, 1) - f.TitleBar = title_bar + if (panelOptions.UseStatusBar) then + local statusBar = detailsFramework:CreateStatusBar(simplePanel) + simplePanel.StatusBar = statusBar + end - local close = CreateFrame("button", name and name .. "CloseButton", title_bar) + local titleBar = CreateFrame("frame", frameName .. "TitleBar", simplePanel,"BackdropTemplate") + titleBar:SetPoint("topleft", simplePanel, "topleft", 2, -3) + titleBar:SetPoint("topright", simplePanel, "topright", -2, -3) + titleBar:SetHeight(20) + titleBar:SetBackdrop(SimplePanel_frame_backdrop) + titleBar:SetBackdropColor(.2, .2, .2, 1) + titleBar:SetBackdropBorderColor(0, 0, 0, 1) + simplePanel.TitleBar = titleBar + + local close = CreateFrame("button", frameName and frameName .. "CloseButton", titleBar) close:SetFrameLevel(detailsFramework.FRAMELEVEL_OVERLAY) close:SetSize(16, 16) @@ -2025,31 +2041,37 @@ function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_opt close:SetAlpha(0.7) close:SetScript("OnClick", simple_panel_close_click) - f.Close = close + simplePanel.Close = close - local title_string = title_bar:CreateFontString(name and name .. "Title", "overlay", "GameFontNormal") - title_string:SetTextColor(.8, .8, .8, 1) - title_string:SetText(title or "") - f.Title = title_string + local titleText = titleBar:CreateFontString(frameName and frameName .. "Title", "overlay", "GameFontNormal") + titleText:SetTextColor(.8, .8, .8, 1) + titleText:SetText(title or "") + simplePanel.Title = titleText - if (panel_options.UseScaleBar and db [name]) then - detailsFramework:CreateScaleBar (f, db [name]) - f:SetScale(db [name].scale) + if (panelOptions.UseScaleBar and savedVariableTable [frameName]) then + detailsFramework:CreateScaleBar (simplePanel, savedVariableTable [frameName]) + simplePanel:SetScale(savedVariableTable [frameName].scale) end - f.Title:SetPoint("center", title_bar, "center") - f.Close:SetPoint("right", title_bar, "right", -2, 0) + simplePanel.Title:SetPoint("center", titleBar, "center") + simplePanel.Close:SetPoint("right", titleBar, "right", -2, 0) - if (panel_options.NoCloseButton) then - f.Close:Hide() + if (panelOptions.NoCloseButton) then + simplePanel.Close:Hide() end - f:SetScript("OnMouseDown", simple_panel_mouse_down) - f:SetScript("OnMouseUp", simple_panel_mouse_up) + if (panelOptions.NoTitleBar) then + simplePanel.TitleBar:Hide() + end - f.SetTitle = simple_panel_settitle + if (not panelOptions.NoScripts) then + simplePanel:SetScript("OnMouseDown", simple_panel_mouse_down) + simplePanel:SetScript("OnMouseUp", simple_panel_mouse_up) + end - return f + simplePanel.SetTitle = simple_panel_settitle + + return simplePanel end local Panel1PxBackdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 64, @@ -7622,6 +7644,9 @@ detailsFramework.CastFrameFunctions = { CanLazyTick = true, --if true, it'll execute the lazy tick function, it ticks in a much slower pace comparece with the regular tick LazyUpdateCooldown = 0.2, --amount of time to wait for the next lazy update, this updates non critical things like the cast timer + FillOnInterrupt = true, + HideSparkOnInterrupt = true, + --default size Width = 100, Height = 20, @@ -8268,12 +8293,26 @@ detailsFramework.CastFrameFunctions = { UNIT_SPELLCAST_STOP = function(self, unit, ...) local unitID, castID, spellID = ... if (self.castID == castID) then - self.Spark:Hide() + if (self.interrupted) then + if (self.Settings.HideSparkOnInterrupt) then + self.Spark:Hide() + end + else + self.Spark:Hide() + end + self.percentText:Hide() local value = self:GetValue() local _, maxValue = self:GetMinMaxValues() - self:SetValue(self.maxValue or maxValue or 1) + + if (self.interrupted) then + if (self.Settings.FillOnInterrupt) then + self:SetValue(self.maxValue or maxValue or 1) + end + else + self:SetValue(self.maxValue or maxValue or 1) + end self.casting = nil self.finished = true @@ -8357,12 +8396,18 @@ detailsFramework.CastFrameFunctions = { self.channeling = nil self.interrupted = true self.finished = true - self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1) + + if (self.Settings.FillOnInterrupt) then + self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1) + end + + if (self.Settings.HideSparkOnInterrupt) then + self.Spark:Hide() + end local castColor = self:GetCastColor() self:SetColor (castColor) --SetColor handles with ParseColors() - self.Spark:Hide() self.percentText:Hide() self.Text:SetText(INTERRUPTED) --auto locale within the global namespace diff --git a/Libs/LibOpenRaid/Functions.lua b/Libs/LibOpenRaid/Functions.lua index 216db14c..c8db2b63 100644 --- a/Libs/LibOpenRaid/Functions.lua +++ b/Libs/LibOpenRaid/Functions.lua @@ -19,6 +19,10 @@ local CONST_COOLDOWN_TYPE_DEFENSIVE_RAID = 4 local CONST_COOLDOWN_TYPE_UTILITY = 5 local CONST_COOLDOWN_TYPE_INTERRUPT = 6 +--hold spellIds and which custom caches the spell is in +--map[spellId] = map[filterName] = true +local spellsWithCustomFiltersCache = {} + --simple non recursive table copy function openRaidLib.TCopy(tableToReceive, tableToCopy) if (not tableToCopy) then @@ -137,8 +141,9 @@ function openRaidLib.GetUnitID(playerName) return openRaidLib.UnitIDCache[playerName] or playerName end - -local filterStringToCooldownType = { --report: "filterStringToCooldownType doesn't include the new filters." +--report: "filterStringToCooldownType doesn't include the new filters." +--answer: custom filter does not have a cooldown type, it is a mesh of spells +local filterStringToCooldownType = { ["defensive-raid"] = CONST_COOLDOWN_TYPE_DEFENSIVE_RAID, ["defensive-target"] = CONST_COOLDOWN_TYPE_DEFENSIVE_TARGET, ["defensive-personal"] = CONST_COOLDOWN_TYPE_DEFENSIVE_PERSONAL, @@ -147,34 +152,116 @@ local filterStringToCooldownType = { --report: "filterStringToCooldownType doesn ["interrupt"] = CONST_COOLDOWN_TYPE_INTERRUPT, } -function openRaidLib.CooldownManager.DoesSpellPassFilters(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 - elseif (cooldownData[filter]) then --custom filter - return true - end - end - else - return false +local filterStringToCooldownTypeReverse = { + [CONST_COOLDOWN_TYPE_DEFENSIVE_RAID] = "defensive-raid", + [CONST_COOLDOWN_TYPE_DEFENSIVE_TARGET] = "defensive-target", + [CONST_COOLDOWN_TYPE_DEFENSIVE_PERSONAL] = "defensive-personal", + [CONST_COOLDOWN_TYPE_OFFENSIVE] = "ofensive", + [CONST_COOLDOWN_TYPE_UTILITY] = "utility", + [CONST_COOLDOWN_TYPE_INTERRUPT] = "interrupt", +} + +local removeSpellFromCustomFilterCache = function(spellId, filterName) + local spellFilterCache = spellsWithCustomFiltersCache[spellId] + if (spellFilterCache) then + spellFilterCache[filterName] = nil end end +local addSpellToCustomFilterCache = function(spellId, filterName) + local spellFilterCache = spellsWithCustomFiltersCache[spellId] + if (not spellFilterCache) then + spellFilterCache = {} + spellsWithCustomFiltersCache[spellId] = spellFilterCache + end + spellFilterCache[filterName] = true +end + +local getSpellCustomFiltersFromCache = function(spellId) + local spellFilterCache = spellsWithCustomFiltersCache[spellId] + local result = {} + if (spellFilterCache) then + for filterName in pairs(spellFilterCache) do + result[filterName] = true + end + end + return result +end + +--LIB_OPEN_RAID_COOLDOWNS_INFO store all registered cooldowns in the file ThingsToMantain_ +function openRaidLib.CooldownManager.GetAllRegisteredCooldowns() + return LIB_OPEN_RAID_COOLDOWNS_INFO +end + +function openRaidLib.CooldownManager.GetCooldownInfo(spellId) + return openRaidLib.CooldownManager.GetAllRegisteredCooldowns()[spellId] +end + +--return a map of filter names which the spell is in, map: {[filterName] = true} +--API Call documented in the docs.txt as openRaidLib.GetSpellFilters() the declaration is on the main file of the lib +function openRaidLib.CooldownManager.GetSpellFilters(spellId, defaultFilterOnly, customFiltersOnly) + local result = {} + + if (not customFiltersOnly) then + local thisCooldownInfo = openRaidLib.CooldownManager.GetCooldownInfo(spellId) + local cooldownTypeFilter = filterStringToCooldownTypeReverse[thisCooldownInfo.type] + if (cooldownTypeFilter) then + result[cooldownTypeFilter] = true + end + end + + if (defaultFilterOnly) then + return result + end + + local customFilters = getSpellCustomFiltersFromCache(spellId) + for filterName in pairs(customFilters) do + result[filterName] = true + end + + return result +end + +function openRaidLib.CooldownManager.DoesSpellPassFilters(spellId, filters) + --table with information about a single cooldown + local thisCooldownInfo = openRaidLib.CooldownManager.GetCooldownInfo(spellId) + --check if this spell is registered as a cooldown + if (thisCooldownInfo) then + for filter in filters:gmatch("([^,%s]+)") do + --filterStringToCooldownType is a map where the key is the filter name and value is the cooldown type + local cooldownType = filterStringToCooldownType[filter] + --cooldown type is a number from 1 to 8 telling its type + if (cooldownType == thisCooldownInfo.type) then + return true + + --check for custom filter, the custom filter name is set as a key in the cooldownInfo: cooldownInfo[filterName] = true + elseif (thisCooldownInfo[filter]) then + return true + end + end + end + + return false +end + local getCooldownsForFilter = function(unitName, allCooldowns, unitDataFilteredCache, filter) - local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO + local allCooldownsData = openRaidLib.CooldownManager.GetAllRegisteredCooldowns() 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 + --bug: filterTable is nil and HasFullCooldownList is also nil, happening after leaving a group internal callback + --November 06, 2022 note: is this bug still happening? + + local doesNotHaveFilterYet = not filterTable and openRaidLib.CooldownManager.HasFullCooldownList[unitName] + local isDirty = openRaidLib.CooldownManager.NeedRebuildFilters[unitName] + + if (doesNotHaveFilterYet or isDirty) then + --reset the filterTable filterTable = {} unitDataFilteredCache[filter] = filterTable + -- for spellId, cooldownInfo in pairs(allCooldowns) do local cooldownData = allCooldownsData[spellId] if (cooldownData) then @@ -190,27 +277,41 @@ local getCooldownsForFilter = function(unitName, allCooldowns, unitDataFilteredC return filterTable end +--API Call +--@filterName: a string representing a name of the filter +--@spells: an array of spellIds +--important: a spell can be part of any amount of custom filters, +--declaring a spell on a new filter does NOT remove it from other filters where it was previously added function openRaidLib.AddCooldownFilter(filterName, spells) --integrity check if (type(filterName) ~= "string") then openRaidLib.DiagnosticError("Usage: openRaidLib.AddFilter(string: filterName, table: spells)", debugstack()) return false - end - if (type(spells) ~= "table") then + elseif (type(spells) ~= "table") then openRaidLib.DiagnosticError("Usage: openRaidLib.AddFilter(string: filterName, table: spells)", debugstack()) return false end - --clear previous filter spell table of the same name - for spellId, cooldownData in pairs(LIB_OPEN_RAID_COOLDOWNS_INFO) do + local allCooldownsData = openRaidLib.CooldownManager.GetAllRegisteredCooldowns() + + --iterate among the all cooldowns table and erase the filterName from all spells + for spellId, cooldownData in pairs(allCooldownsData) do cooldownData[filterName] = nil + removeSpellFromCustomFilterCache(spellId, filterName) end - local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO + --iterate among spells passed within the spells table and set the new filter on them + --problem: the filter is set directly into the global cooldown table + --this could in rare cases make an addon to override settings of another addon for spellIndex, spellId in ipairs(spells) do local cooldownData = allCooldownsData[spellId] - cooldownData[filterName] = true + if (cooldownData) then + cooldownData[filterName] = true + addSpellToCustomFilterCache(spellId, filterName) + else + openRaidLib.DiagnosticError("A spellId on your spell list for openRaidLib.AddFilter isn't registered as cooldown:", spellId, debugstack()) + end end --tag all cache filters as dirt @@ -222,8 +323,9 @@ function openRaidLib.AddCooldownFilter(filterName, spells) return true end ---@allCooldowns: all cooldowns sent by an unit, {[spellId] = cooldownInfo} ---@filters: string with filters, "defensive-raid, "defensive-personal" +--API Call +--@allCooldowns: all cooldowns sent by a unit, map{[spellId] = cooldownInfo} +--@filters: string with filter names: array{"defensive-raid, "defensive-personal"} function openRaidLib.FilterCooldowns(unitName, allCooldowns, filters) local allDataFiltered = openRaidLib.CooldownManager.UnitDataFilterCache --["unitName"] = {defensive-raid = {[spellId = cooldownInfo]}} local unitDataFilteredCache = allDataFiltered[unitName] @@ -238,7 +340,6 @@ function openRaidLib.FilterCooldowns(unitName, allCooldowns, filters) return filterAlreadyInCache end - local allCooldownsData = LIB_OPEN_RAID_COOLDOWNS_INFO local resultFilters = {} --break the string into pieces and filter cooldowns diff --git a/Libs/LibOpenRaid/GetPlayerInformation.lua b/Libs/LibOpenRaid/GetPlayerInformation.lua index e276887b..a9ebd010 100644 --- a/Libs/LibOpenRaid/GetPlayerInformation.lua +++ b/Libs/LibOpenRaid/GetPlayerInformation.lua @@ -18,6 +18,7 @@ local CONST_TALENT_VERSION_DRAGONFLIGHT = 5 local CONST_BTALENT_VERSION_COVENANTS = 9 local CONST_SPELLBOOK_CLASSSPELLS_TABID = 2 +local CONST_SPELLBOOK_GENERAL_TABID = 1 local isTimewalkWoW = function() local _, _, _, buildInfo = GetBuildInfo() @@ -418,6 +419,23 @@ local getSpellListAsHashTableFromSpellBook = function() --this line might not be compatible with classic local specId, specName, _, specIconTexture = GetSpecializationInfo(GetSpecialization()) local classNameLoc, className, classId = UnitClass("player") + local locPlayerRace, playerRace, playerRaceId = UnitRace("player") + + --get racials from the general tab + local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(CONST_SPELLBOOK_GENERAL_TABID) + offset = offset + 1 + local tabEnd = offset + numSpells + for entryOffset = offset, tabEnd - 1 do + local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player") + if (spellId and LIB_OPEN_RAID_COOLDOWNS_INFO[spellId] and LIB_OPEN_RAID_COOLDOWNS_INFO[spellId].raceid == playerRaceId) then + spellId = C_SpellBook.GetOverrideSpell(spellId) + local spellName = GetSpellInfo(spellId) + local isPassive = IsPassiveSpell(entryOffset, "player") + if (spellName and not isPassive) then + completeListOfSpells[spellId] = true + end + end + end --get spells from the Spec spellbook for i = 1, GetNumSpellTabs() do @@ -464,13 +482,13 @@ end local updateCooldownAvailableList = function() table.wipe(LIB_OPEN_RAID_PLAYERCOOLDOWNS) - local _, playerClass = UnitClass("player") + local locPlayerRace, playerRace, playerRaceId = UnitRace("player") local spellBookSpellList = getSpellListAsHashTableFromSpellBook() --build a list of all spells assigned as cooldowns for the player class for spellID, spellData in pairs(LIB_OPEN_RAID_COOLDOWNS_INFO) do - if (spellData.class == playerClass) then + if (spellData.class == playerClass or spellData.raceid == playerRaceId) then --need to implement here to get the racial as racial cooldowns does not carry a class if (spellBookSpellList[spellID]) then LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellID] = spellData end @@ -538,32 +556,78 @@ function openRaidLib.CooldownManager.GetPlayerCooldownList() return {} end +--aura frame handles only UNIT_AURA events to grab the duration of the buff placed by the aura +local IS_NEW_UNIT_AURA_AVAILABLE = C_UnitAuras and C_UnitAuras.GetAuraDataBySlot and true + +local auraSpellID +local foundAuraDuration + +local handleBuffAura = function(aura) + local auraInfo = C_UnitAuras.GetAuraDataByAuraInstanceID("player", aura.auraInstanceID) + if (auraInfo) then + local spellId = auraInfo.spellId + if (auraSpellID == spellId) then + auraSpellID = nil + foundAuraDuration = auraInfo.duration + return true + end + end +end + +local getAuraDuration = function(spellId) + --some auras does not have the same spellId of the cast as the spell for its aura duration + --in these cases, it's necessary to declare the buff spellId which tells the duration of the effect by adding 'durationSpellId = spellId' within the cooldown data + local customBuffDuration = LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellId].durationSpellId + --spellId = customBuffDuration or spellId --can't replace the spellId by customBuffDurationSpellId has it wount be found in LIB_OPEN_RAID_PLAYERCOOLDOWNS + + if (IS_NEW_UNIT_AURA_AVAILABLE) then + local batchCount = nil + local usePackedAura = true + auraSpellID = customBuffDuration or spellId + foundAuraDuration = 0 --reset duration + + AuraUtil.ForEachAura("player", "HELPFUL", batchCount, handleBuffAura, usePackedAura) --check auras to find a buff for the spellId + + if (foundAuraDuration == 0) then --if the buff wasn't found, attempt to get the duration from the file + local spellName = GetSpellInfo(spellId) + return LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellId].duration or 0 + end + return foundAuraDuration + else + + end +end + +function openRaidLib.CooldownManager.GetSpellBuffDuration(spellId) + return getAuraDuration(spellId) +end + --check if a player cooldown is ready or if is in cooldown --@spellId: the spellId to check for cooldown +--return timeLeft, charges, startTimeOffset, duration, buffDuration 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) - + local buffDuration = getAuraDuration(spellId) + local chargesAvailable, chargesTotal, start, duration = GetSpellCharges(spellId) + if chargesAvailable then if (chargesAvailable == chargesTotal) then - return 0, chargesTotal, 0, 0 --all charges are ready to use + return 0, chargesTotal, 0, 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 + return ceil(timeLeft), chargesAvailable, startTimeOffset, duration, buffDuration --time left, charges, startTime, duration, buffDuration end - else local start, duration = GetSpellCooldown(spellId) if (start == 0) then --cooldown is ready - return 0, 1, 0, 0 --time left, charges, startTime + return 0, 1, 0, 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 + return ceil(timeLeft), 0, ceil(startTimeOffset), duration, buffDuration --time left, charges, startTime, duration, buffDuration end end else diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 0f6cd720..afde1f30 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -14,7 +14,18 @@ Code Rules: - Internal callbacks are the internal communication of the library, e.g. when an event triggers it send to all modules that registered that event. - Public callbacks are callbacks registered by an external addon. -Change Log: +Change Log (most recent on 2022 Nov 18): + - added racials with cooldown type 9 + - added buff duration in the index 6 of the cooldownInfo table returned on any cooldown event + - added 'durationSpellId' for cooldowns where the duration effect is another spell other than the casted cooldown spellId, add this member on cooldown table at LIB_OPEN_RAID_COOLDOWNS_INFO + +------- Nov 07 and older + - added: + * added openRaidLib.GetSpellFilters(spellId, defaultFilterOnly, customFiltersOnly) (see docs) + - passing a spellId of a non registered cooldown on LIB_OPEN_RAID_COOLDOWNS_INFO will trigger a diagnostic error if diagnostic errors are enabled. + - player cast doesn't check anymore for cooldowns in the player spec, now it check towards the cache LIB_OPEN_RAID_PLAYERCOOLDOWNS. + LIB_OPEN_RAID_PLAYERCOOLDOWNS is a cache built with cooldowns present in the player spellbook. + - things to maintain now has 1 file per expansion - player conduits, covenant internally renamed to playerInfo1 and playerInfo2 to make the lib more future proof - player conduits tree is now Borrowed Talents Tree, for future proof @@ -25,29 +36,14 @@ Change Log: * openRaidLib.GetFlaskTierFromAura(auraInfo) * openRaidLib.GetFoodInfoBySpellId(spellId) * openRaidLib.GetFoodTierFromAura(auraInfo) - - added dragonflight talents support + * added dragonflight talents support + * added openRaidLib.RequestCooldownInfo(spellId) + * added openRaidLib.AddCooldownFilter(filterName, spells) - ensure to register events after 'PLAYER_ENTERING_WORLD' has triggered - - added openRaidLib.RequestCooldownInfo(spellId) - - added openRaidLib.AddCooldownFilter(filterName, spells) - - if Ace Comm is installed, use it - - added "KeystoneWipe" callback - - finished keystone info, see docs - - added interrupts to cooldown tracker, new filter: "interrupt" - - after encounter_end cooldowns now check for cooldowns reset. - - each module now controls what to do with regen_enabled. - - filter cooldowns done. - - move portions of the code to other files to make this one smaller. - - major function and variables rename. - - implemented pvp talents. - - player information is always available even when not in a group. - - added cooldown check to se which cooldown has removed or added into the list. - - added two new callbacks: "CooldownAdded" and "CooldownRemoved", see documents. TODO: - - make talents changes also send only cooldowns added or changed - add into gear info how many tier set parts the player has - raid lockouts normal-heroic-mythic - - soulbind character (covenant choise) - probably not used in 10.0 BUGS: - after a /reload, it is not starting new tickers for spells under cooldown @@ -68,7 +64,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 69 +local CONST_LIB_VERSION = 72 LIB_OPEN_RAID_CAN_LOAD = false local unpack = table.unpack or _G.unpack @@ -133,6 +129,7 @@ local unpack = table.unpack or _G.unpack local CONST_COOLDOWN_INDEX_TIMEOFFSET = 3 local CONST_COOLDOWN_INDEX_DURATION = 4 local CONST_COOLDOWN_INDEX_UPDATETIME = 5 + local CONST_COOLDOWN_INDEX_AURA_DURATION = 6 local GetContainerNumSlots = GetContainerNumSlots or C_Container.GetContainerNumSlots local GetContainerItemID = GetContainerItemID or C_Container.GetContainerItemID @@ -1632,14 +1629,14 @@ local cooldownTimeLeftCheck_Ticker = function(tickerObject) end tickerObject.cooldownTimeLeft = tickerObject.cooldownTimeLeft - CONST_COOLDOWN_CHECK_INTERVAL - local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) + local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) local bUpdateLocally = false --is the spell ready to use? if (timeLeft == 0) then --it's ready - openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, 0, charges, 0, 0) + openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, 0, charges, 0, 0, 0) openRaidLib.CooldownManager.CooldownTickers[spellId] = nil tickerObject:Cancel() bUpdateLocally = true @@ -1647,7 +1644,7 @@ local cooldownTimeLeftCheck_Ticker = function(tickerObject) --check if the time left has changed, this check if the cooldown got its time reduced and if the cooldown time has been slow down by modRate if (not openRaidLib.isNearlyEqual(tickerObject.cooldownTimeLeft, timeLeft, CONST_COOLDOWN_TIMELEFT_HAS_CHANGED)) then --there's a deviation, send a comm to communicate the change in the time left - openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration) + openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration, auraDuration) tickerObject.cooldownTimeLeft = timeLeft bUpdateLocally = true end @@ -1655,9 +1652,9 @@ local cooldownTimeLeftCheck_Ticker = function(tickerObject) if (bUpdateLocally) then --get the cooldown time for this spell - local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) + local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) --return 5 values --update the cooldown - openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, startTimeOffset, duration) + openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, startTimeOffset, duration, auraDuration) --need 7 values local playerCooldownTable = openRaidLib.GetUnitCooldowns(playerName) local cooldownInfo = openRaidLib.GetUnitCooldownInfo(playerName, spellId) @@ -1696,7 +1693,7 @@ end function openRaidLib.CooldownManager.CleanupCooldownTickers() for spellId, tickerObject in pairs(openRaidLib.CooldownManager.CooldownTickers) do - local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) + local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) if (timeLeft == 0) then tickerObject:Cancel() openRaidLib.CooldownManager.CooldownTickers[spellId] = nil @@ -1722,22 +1719,26 @@ end local cooldownGetSpellInfo = function(unitName, spellId) local unitCooldownTable = cooldownGetUnitTable(unitName) - local spellIdTable = unitCooldownTable[spellId] - return spellIdTable + local cooldownInfo = unitCooldownTable[spellId] + return cooldownInfo end --update a single cooldown timer --called when the player casted a cooldown and when received a cooldown update from another player --only update the db, no other action is taken -function openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, newTimeLeft, newCharges, startTimeOffset, duration) +--cooldownInfo: [1] timeLeft [2] charges [3] startOffset [4] duration [5] updateTime [6] auraDuration +function openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, newTimeLeft, newCharges, startTimeOffset, duration, auraDuration) + --get the cooldown table where all cooldowns are stored for this unit local unitCooldownTable = cooldownGetUnitTable(unitName) - local spellIdTable = unitCooldownTable[spellId] or {} - spellIdTable[CONST_COOLDOWN_INDEX_TIMELEFT] = newTimeLeft - spellIdTable[CONST_COOLDOWN_INDEX_CHARGES] = newCharges - spellIdTable[CONST_COOLDOWN_INDEX_TIMEOFFSET] = startTimeOffset - spellIdTable[CONST_COOLDOWN_INDEX_DURATION] = duration - spellIdTable[CONST_COOLDOWN_INDEX_UPDATETIME] = GetTime() - unitCooldownTable[spellId] = spellIdTable + --is this a cooldown info? + local cooldownInfo = unitCooldownTable[spellId] or {} + cooldownInfo[CONST_COOLDOWN_INDEX_TIMELEFT] = newTimeLeft + cooldownInfo[CONST_COOLDOWN_INDEX_CHARGES] = newCharges + cooldownInfo[CONST_COOLDOWN_INDEX_TIMEOFFSET] = startTimeOffset + cooldownInfo[CONST_COOLDOWN_INDEX_DURATION] = duration + cooldownInfo[CONST_COOLDOWN_INDEX_UPDATETIME] = GetTime() + cooldownInfo[CONST_COOLDOWN_INDEX_AURA_DURATION] = auraDuration + unitCooldownTable[spellId] = cooldownInfo end --API Calls @@ -1774,6 +1775,10 @@ end return openRaidLib.CooldownManager.DoesSpellPassFilters(spellId, filter) end + function openRaidLib.GetSpellFilters(spellId, defaultFilterOnly, customFiltersOnly) + return openRaidLib.CooldownManager.GetSpellFilters(spellId, defaultFilterOnly, customFiltersOnly) + end + --return values about the cooldown time --values returned: timeLeft, charges, timeOffset, duration, updateTime function openRaidLib.GetCooldownTimeFromUnitSpellID(unitId, spellId) @@ -1781,7 +1786,7 @@ end if (unitCooldownsTable) then local cooldownInfo = unitCooldownsTable[spellId] if (cooldownInfo) then - return unpack(cooldownInfo) + return openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) end end end @@ -1790,7 +1795,7 @@ end --values returned: timeLeft, charges, timeOffset, duration, updateTime function openRaidLib.GetCooldownTimeFromCooldownInfo(cooldownInfo) if (cooldownInfo) then - return unpack(cooldownInfo) + return openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) end end @@ -1833,12 +1838,12 @@ end --values returned: isReady, timeLeft, charges, normalized percent, minValue, maxValue, currentValue --values are in the GetTime() format function openRaidLib.GetCooldownStatusFromUnitSpellID(unitId, spellId) - local timeLeft, charges, timeOffset, duration, updateTime + local timeLeft, charges, timeOffset, duration, updateTime, auraDuration local unitCooldownsTable = openRaidLib.GetUnitCooldowns(unitId) if (unitCooldownsTable) then local cooldownInfo = unitCooldownsTable[spellId] if (cooldownInfo) then - timeLeft, charges, timeOffset, duration, updateTime = unpack(cooldownInfo) + timeLeft, charges, timeOffset, duration, updateTime, auraDuration = openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) end end @@ -1851,39 +1856,40 @@ end --values are in the GetTime() format --GetPercentFromCooldownInfo function openRaidLib.GetCooldownStatusFromCooldownInfo(cooldownInfo) - local timeLeft, charges, timeOffset, duration, updateTime = unpack(cooldownInfo) + local timeLeft, charges, timeOffset, duration, updateTime, auraDuration = openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) return calculatePercent(timeOffset, duration, updateTime, charges) end --internals + function openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) + local timeLeft, charges, timeOffset, duration, updateTime, auraDuration = unpack(cooldownInfo) + return timeLeft, charges, timeOffset, duration, updateTime, auraDuration + end + function openRaidLib.CooldownManager.OnPlayerCast(event, spellId, isPlayerPet) --~cast --player casted a spell, check if the spell is registered as cooldown - --local playerSpec = openRaidLib.GetPlayerSpecId() --should be deprecated with cooldowns from spellbook - --if (playerSpec) then - --if (LIB_OPEN_RAID_COOLDOWNS_BY_SPEC[playerSpec] and LIB_OPEN_RAID_COOLDOWNS_BY_SPEC[playerSpec][spellId]) then --kinda deprecated with the new spell from spellbook - --issue: pet spells isn't in this table yet, might mess with pet interrupts - if (LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellId]) then --check if the casted spell is a cooldown the player has available - local playerName = UnitName("player") + --issue: pet spells isn't in this table yet, might mess with pet interrupts + if (LIB_OPEN_RAID_PLAYERCOOLDOWNS[spellId]) then --check if the casted spell is a cooldown the player has available + local playerName = UnitName("player") - --get the cooldown time for this spell - local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) + --get the cooldown time for this spell + local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) --return 5 values - --update the cooldown - openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, startTimeOffset, duration) - local cooldownInfo = cooldownGetSpellInfo(playerName, spellId) + --update the cooldown + openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, startTimeOffset, duration, auraDuration) --receive 7 values + local cooldownInfo = cooldownGetSpellInfo(playerName, spellId) - --trigger a public callback - local playerCooldownTable = openRaidLib.GetUnitCooldowns(playerName) - openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", "player", spellId, cooldownInfo, playerCooldownTable, openRaidLib.CooldownManager.UnitData) + --trigger a public callback + local playerCooldownTable = openRaidLib.GetUnitCooldowns(playerName) + openRaidLib.publicCallback.TriggerCallback("CooldownUpdate", "player", spellId, cooldownInfo, playerCooldownTable, openRaidLib.CooldownManager.UnitData) - --send to comm - openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration) + --send to comm + openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration, auraDuration) - --create a timer to monitor the time of this cooldown - --as there's just a few of them to monitor, there's no issue on creating one timer per spell - cooldownStartTicker(spellId, timeLeft) - end - --end + --create a timer to monitor the time of this cooldown + --as there's just a few of them to monitor, there's no issue on creating one timer per spell + cooldownStartTicker(spellId, timeLeft) + end end --when the player is ressed while in a group, send the cooldown list @@ -2015,8 +2021,8 @@ function openRaidLib.CooldownManager.OnReceiveUnitCooldownChanges(data, unitName local cooldownsAddedUnpacked = openRaidLib.UnpackTable(addedCooldowns, 1, true, true, 5) for spellId, cooldownInfo in pairs(cooldownsAddedUnpacked) do --add the spell into the list of cooldowns of this unit - local timeLeft, charges, timeOffset, duration = unpack(cooldownInfo) - openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, timeLeft, charges, timeOffset, duration) + local timeLeft, charges, timeOffset, duration, updateTime, auraDuration = openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) + openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, timeLeft, charges, timeOffset, duration, auraDuration) --mark the filter cache of this unit as dirt openRaidLib.CooldownManager.NeedRebuildFilters[unitName] = true @@ -2054,15 +2060,16 @@ function openRaidLib.CooldownManager.CheckForSpellsAdeedOrRemoved() for spellId, cooldownInfo in pairs(newCooldownList) do if (not currentCooldowns[spellId]) then --a spell has been added - local timeLeft, charges, timeOffset, duration = unpack(cooldownInfo) - openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, timeOffset, duration) + local timeLeft, charges, timeOffset, duration, updateTime, auraDuration = openRaidLib.CooldownManager.GetCooldownInfoValues(cooldownInfo) + openRaidLib.CooldownManager.CooldownSpellUpdate(playerName, spellId, timeLeft, charges, timeOffset, duration, auraDuration) - local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) + local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) --return 5 values spellsAdded[#spellsAdded+1] = spellId spellsAdded[#spellsAdded+1] = timeLeft spellsAdded[#spellsAdded+1] = charges spellsAdded[#spellsAdded+1] = startTimeOffset spellsAdded[#spellsAdded+1] = duration + spellsAdded[#spellsAdded+1] = auraDuration --mark the filter cache of this unit as dirt openRaidLib.CooldownManager.NeedRebuildFilters[playerName] = true @@ -2126,6 +2133,7 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNUPDATE_PREFIX, function( local charges = tonumber(dataAsArray[3]) local startTime = tonumber(dataAsArray[4]) local duration = tonumber(dataAsArray[5]) + local auraDuration = tonumber(dataAsArray[6]) --check integrity if (not spellId or spellId == 0) then @@ -2142,10 +2150,14 @@ openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNUPDATE_PREFIX, function( elseif (not duration) then return openRaidLib.DiagnosticError("CooldownManager|comm received|duration is invalid") + + elseif (not auraDuration) then + return openRaidLib.DiagnosticError("CooldownManager|comm received|auraDuration is invalid") end --update - openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, cooldownTimer, charges, startTime, duration) + --unitName, spellId, cooldownTimer, charges, startTime, duration, auraDuration + openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, cooldownTimer, charges, startTime, duration, auraDuration) local cooldownInfo = cooldownGetSpellInfo(unitName, spellId) local unitCooldownTable = openRaidLib.GetUnitCooldowns(unitName) @@ -2180,8 +2192,8 @@ function openRaidLib.CooldownManager.SendAllPlayerCooldowns() end --send to comm a specific cooldown that was just used, a charge got available or its cooldown is over (ready to use) -function openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, cooldownTimeLeft, charges, startTimeOffset, duration) - local dataToSend = "" .. CONST_COMM_COOLDOWNUPDATE_PREFIX .. "," .. spellId .. "," .. cooldownTimeLeft .. "," .. charges .. "," .. startTimeOffset .. "," .. duration +function openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, cooldownTimeLeft, charges, startTimeOffset, duration, auraDuration) + local dataToSend = "" .. CONST_COMM_COOLDOWNUPDATE_PREFIX .. "," .. spellId .. "," .. cooldownTimeLeft .. "," .. charges .. "," .. startTimeOffset .. "," .. duration .. "," .. auraDuration openRaidLib.commHandler.SendCommData(dataToSend) diagnosticComm("SendPlayerCooldownUpdate| " .. dataToSend) --debug end @@ -2219,8 +2231,8 @@ function openRaidLib.CooldownManager.OnReceiveRequestForCooldownInfoUpdate(data, end --get the cooldown time for this spell - local timeLeft, charges, startTimeOffset, duration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) - openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration) + local timeLeft, charges, startTimeOffset, duration, auraDuration = openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) + openRaidLib.CooldownManager.SendPlayerCooldownUpdate(spellId, timeLeft, charges, startTimeOffset, duration, auraDuration) end openRaidLib.commHandler.RegisterComm(CONST_COMM_COOLDOWNREQUEST_PREFIX, openRaidLib.CooldownManager.OnReceiveRequestForCooldownInfoUpdate) @@ -2533,7 +2545,7 @@ C_Timer.After(0.1, function() --trigger a cooldown usage local duration = cooldownInfo.duration --time left, charges, startTimeOffset, duration - openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, duration, 0, 0, duration) + openRaidLib.CooldownManager.CooldownSpellUpdate(unitName, spellId, duration, 0, 0, duration, 0) local cooldownInfo = cooldownGetSpellInfo(unitName, spellId) local unitCooldownsTable = openRaidLib.GetUnitCooldowns(unitName) diff --git a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua index c3ff23ea..5d51fa7f 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua @@ -260,6 +260,10 @@ LIB_OPEN_RAID_MELEE_SPECS = { --/dump GetTalentInfo (talentTier, talentColumn, 1) --example: to get the second talent of the last talent line, use: /dump GetTalentInfo (7, 2, 1) +--todo: +--get cooldown duration from the buff placed on the player or target player +--spell scanner not getting the spell from the pet spellbook + LIB_OPEN_RAID_COOLDOWNS_INFO = { -- Filter Types: @@ -269,7 +273,53 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { -- 4 raid defensive cooldown -- 5 personal utility cooldown -- 6 interrupt + -- 7 dispel -- 8 crowd control + -- 9 racials + + --racials + --maintanance: login into the new race and type /run Details.GenerateRacialSpellList() + --this command give a formated line to paste here + + [312411] = {cooldown = 90, duration = 0, specs = {}, talent = false, charges = 1, raceid = 35, race = "Vulpera", class = "", type = 9}, --Bag of Tricks (Vulpera) + --[312370] = {cooldown = 600, duration = 0, specs = {}, talent = false, charges = 1, raceid = 35, race = "Vulpera", class = "", type = 9}, --Make Camp (Vulpera) + --[312372] = {cooldown = 3600, duration = 0, specs = {}, talent = false, charges = 1, raceid = 35, race = "Vulpera", class = "", type = 9}, --Return to Camp (Vulpera) + --[312425] = {cooldown = 300, duration = 0, specs = {}, talent = false, charges = 1, raceid = 35, race = "Vulpera", class = "", type = 9}, --Rummage Your Bag (Vulpera) + [274738] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 36, race = "MagharOrc", class = "", type = 9}, --Ancestral Call (MagharOrc) + --[292752] = {cooldown = 432000, duration = 0, specs = {}, talent = false, charges = 1, raceid = 31, race = "ZandalariTroll", class = "", type = 9}, --Embrace of the Loa (ZandalariTroll) + --[281954] = {cooldown = 900, duration = 0, specs = {}, talent = false, charges = 1, raceid = 31, race = "ZandalariTroll", class = "", type = 9}, --Pterrordax Swoop (ZandalariTroll) + [291944] = {cooldown = 150, duration = 0, specs = {}, talent = false, charges = 1, raceid = 31, race = "ZandalariTroll", class = "", type = 9}, --Regeneratin' (ZandalariTroll) + [255654] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 28, race = "HighmountainTauren", class = "", type = 9}, --Bull Rush (HighmountainTauren) + [260364] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = 27, race = "Nightborne", class = "", type = 9}, --Arcane Pulse (Nightborne) + --[255661] = {cooldown = 600, duration = 0, specs = {}, talent = false, charges = 1, raceid = 27, race = "Nightborne", class = "", type = 9}, --Cantrips (Nightborne) + --[69046] = {cooldown = 1800, duration = 0, specs = {}, talent = false, charges = 1, raceid = 9, race = "Goblin", class = "", type = 9}, --Pack Hobgoblin (Goblin) + [69041] = {cooldown = 90, duration = 0, specs = {}, talent = false, charges = 1, raceid = 9, race = "Goblin", class = "", type = 9}, --Rocket Barrage (Goblin) + [69070] = {cooldown = 90, duration = 0, specs = {}, talent = false, charges = 1, raceid = 9, race = "Goblin", class = "", type = 9}, --Rocket Jump (Goblin) + [20549] = {cooldown = 90, duration = 0, specs = {}, talent = false, charges = 1, raceid = 6, race = "Tauren", class = "", type = 9}, --War Stomp (Tauren) + --[20577] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 5, race = "Scourge", class = "", type = 9}, --Cannibalize (Scourge) + [7744] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 5, race = "Scourge", class = "", type = 9}, --Will of the Forsaken (Scourge) + [20572] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 2, race = "Orc", class = "", type = 9}, --Blood Fury (Orc) + [312924] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = 37, race = "Mechagnome", class = "", type = 9}, --Hyper Organic Light Originator (Mechagnome) + --[312890] = {cooldown = 0, duration = 0, specs = {}, talent = false, charges = 1, raceid = 37, race = "Mechagnome", class = "", type = 9}, --Skeleton Pinkie (Mechagnome) + [287712] = {cooldown = 150, duration = 0, specs = {}, talent = false, charges = 1, raceid = 32, race = "KulTiran", class = "", type = 9}, --Haymaker (KulTiran) + [265221] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 34, race = "DarkIronDwarf", class = "", type = 9}, --Fireblood (DarkIronDwarf) + --[265225] = {cooldown = 1800, duration = 0, specs = {}, talent = false, charges = 1, raceid = 34, race = "DarkIronDwarf", class = "", type = 9}, --Mole Machine (DarkIronDwarf) + --[259930] = {cooldown = 900, duration = 0, specs = {}, talent = false, charges = 1, raceid = 30, race = "LightforgedDraenei", class = "", type = 9}, --Forge of Light (LightforgedDraenei) + [255647] = {cooldown = 150, duration = 0, specs = {}, talent = false, charges = 1, raceid = 30, race = "LightforgedDraenei", class = "", type = 9}, --Light's Judgment (LightforgedDraenei) + [256948] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = 29, race = "VoidElf", class = "", type = 9}, --Spatial Rift (VoidElf) + --[358733] = {cooldown = 1, duration = 0, specs = {}, talent = false, charges = 1, raceid = 52, race = "Dracthyr", class = "", type = 9}, --Glide (Dracthyr) + [368970] = {cooldown = 90, duration = 0, specs = {}, talent = false, charges = 1, raceid = 52, race = "Dracthyr", class = "", type = 9}, --Tail Swipe (Dracthyr) + [357214] = {cooldown = 90, duration = 0, specs = {}, talent = false, charges = 1, raceid = 52, race = "Dracthyr", class = "", type = 9}, --Wing Buffet (Dracthyr) + [107079] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 25, race = "Pandaren", class = "", type = 9}, --Quaking Palm (Pandaren) + [68992] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 22, race = "Worgen", class = "", type = 9}, --Darkflight (Worgen) + --[68996] = {cooldown = 1, duration = 0, specs = {}, talent = false, charges = 1, raceid = 22, race = "Worgen", class = "", type = 9}, --Two Forms (Worgen) + [26297] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = 8, race = "Troll", class = "", type = 9}, --Berserking (Troll) + [20589] = {cooldown = 60, duration = 0, specs = {}, talent = false, charges = 1, raceid = 7, race = "Gnome", class = "", type = 9}, --Escape Artist (Gnome) + [232633] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 10, race = "BloodElf", class = "", type = 9}, --Arcane Torrent (BloodElf) + [59752] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = 1, race = "Human", class = "", type = 9}, --Will to Survive (Human) + [20594] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 3, race = "Dwarf", class = "", type = 9}, --Stoneform (Dwarf) + [58984] = {cooldown = 120, duration = 0, specs = {}, talent = false, charges = 1, raceid = 4, race = "NightElf", class = "", type = 9}, --Shadowmeld (NightElf) + [59542] = {cooldown = 180, duration = 0, specs = {}, talent = false, charges = 1, raceid = 11, race = "Draenei", class = "", type = 9}, --Gift of the Naaru (Draenei) --interrupts [6552] = {class = "WARRIOR", specs = {71, 72, 73}, cooldown = 15, silence = 4, talent = false, cooldownWithTalent = false, cooldownTalentId = false, type = 6, charges = 1}, --Pummel @@ -319,6 +369,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { --[343527] = {cooldown = 1 min cooldown, duration = 0, specs = {}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Execution Sentence --[343721] = {cooldown = 1 min cooldown, duration = 0, specs = {}, talent = false, charges = 1, class = "PALADIN", type = 1}, --Final Reckoning --[391054] = {cooldown = 10 min cooldown, duration = 0, specs = {}, talent = false, charges = 1, class = "PALADIN", type = 5}, --Intercession (battle ress) + [20066] = {cooldown = 15, duration = 0, specs = {}, talent = false, charges = 1, class = "PALADIN", type = 8}, --Repentance --warrior -- 71 - Arms @@ -342,6 +393,8 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [376079] = {cooldown = 90, duration = 4, specs = {}, talent = false, charges = 1, class = "WARRIOR", type = 1}, --Spear of Bastion [392966] = {cooldown = 90, duration = 20, specs = {73}, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Spell Block [384318] = {cooldown = 90, duration = 0, specs = {71, 72, 73}, talent = false, charges = 1, class = "WARRIOR", type = 1}, --Thunderous Roar + [46968] = {cooldown = 40, duration = 0, specs = {}, talent = false, charges = 1, class = "WARRIOR", type = 8}, --Shockwave + [23920] = {cooldown = 25, duration = 5, specs = {}, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Shockwave --warlock -- 265 - Affliction @@ -383,6 +436,10 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [192077] = {cooldown = 120, duration = 15, specs = {262, 263, 264}, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Wind Rush Totem --[198838] = {cooldown = 60, duration = 15, specs = {264}, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Earthen Wall Totem [51485] = {cooldown = 60, duration = 20, specs = {262, 263, 264}, talent = false, charges = 1, class = "SHAMAN", type = 8}, --Earthgrab Totem + --[383017] = {cooldown = 30, duration = 0, specs = {}, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Stoneskin Totem + [51514] = {cooldown = 30, duration = 0, specs = {}, talent = false, charges = 1, class = "SHAMAN", type = 8}, --Hex + [108968] = {cooldown = 5*60, duration = 0, specs = {}, talent = false, charges = 1, class = "PRIEST", type = 3}, --Void Shift + --monk -- 268 - Brewmaster @@ -408,6 +465,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [115176] = {cooldown = 300, duration = 8, specs = {268}, talent = false, charges = 1, class = "MONK", type = 2}, --Zen Meditation [388686] = {cooldown = 120, duration = 30, specs = {268, 269, 270}, talent = false, charges = 1, class = "MONK", type = 1}, --Summon White Tiger Statue --[322109] = {cooldown = 180, duration = 0, specs = {268, 269, 270}, talent = false, charges = 1, class = "MONK", type = 1}, --Touch of Death + [116841] = {cooldown = 30, duration = 0, specs = {}, talent = false, charges = 1, class = "MONK", type = 5}, --Tiger's Lust --hunter @@ -422,13 +480,14 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [109248] = {cooldown = 45, duration = 10, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 8}, --Binding Shot [199483] = {cooldown = 60, duration = 60, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 2}, --Camouflage [266779] = {cooldown = 120, duration = 20, specs = {255}, talent = false, charges = 1, class = "HUNTER", type = 1}, --Coordinated Assault - [109304] = {cooldown = 120, duration = 0, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 2}, --Exhilaration + [109304] = {cooldown = 120, duration = 8, durationSpellId = 385540, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 2}, --Exhilaration [187650] = {cooldown = 25, duration = 60, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 8}, --Freezing Trap [19577] = {cooldown = 60, duration = 5, specs = {253, 255}, talent = false, charges = 1, class = "HUNTER", type = 8}, --Intimidation [201430] = {cooldown = 180, duration = 12, specs = {253}, talent = false, charges = 1, class = "HUNTER", type = 1}, --Stampede - [281195] = {cooldown = 180, duration = 6, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest + --[281195] = {cooldown = 180, duration = 6, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest [288613] = {cooldown = 180, duration = 15, specs = {254}, talent = false, charges = 1, class = "HUNTER", type = 1}, --Trueshot [264735] = {cooldown = 180, duration = 0, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest + [187698] = {cooldown = 30, duration = 0, specs = {}, talent = false, charges = 1, class = "HUNTER", type = 8}, --Tar Trap --druid -- 102 - Balance @@ -458,6 +517,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [102793] = {cooldown = 60, duration = 10, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 8}, --Ursol's Vortex [124974] = {cooldown = 90, duration = 0, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 3}, --Nature's Vigil [106898] = {cooldown = 120, duration = 8, specs = {102, 103, 104, 105}, talent = false, charges = 1, class = "DRUID", type = 5}, --Stampeding Roar + [5211] = {cooldown = 60, duration = 0, specs = {}, talent = false, charges = 1, class = "DRUID", type = 8}, --Mighty Bash --death knight -- 252 - Unholy @@ -484,7 +544,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [207289] = {cooldown = 78, duration = 12, specs = {252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Unholy Assault [55233] = {cooldown = 90, duration = 10, specs = {250}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Vampiric Blood [212552] = {cooldown = 60, duration = 4, specs = {250, 251, 252}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Wraith Walk - + [49576] = {cooldown = 25, duration = 0, specs = {}, talent = false, charges = 1, class = "DEATHKNIGHT", type = 8}, --Death Grip --demon hunter -- 577 - Havoc @@ -510,6 +570,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { -- 62 - Arcane -- 63 - Fire -- 64 - Frost + [365350] = {cooldown = 90, duration = 15, specs = {62}, talent = false, charges = 1, class = "MAGE", type = 1}, --Arcane Surge [12042] = {cooldown = 90, duration = 10, specs = {62}, talent = false, charges = 1, class = "MAGE", type = 1}, --Arcane Power [235313] = {cooldown = 25, duration = 60, specs = {63}, talent = false, charges = 1, class = "MAGE", type = 5}, --Blazing Barrier [235219] = {cooldown = 300, duration = 0, specs = {64}, talent = false, charges = 1, class = "MAGE", type = 2}, --Cold Snap @@ -525,6 +586,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [235450] = {cooldown = 25, duration = 60, specs = {62}, talent = false, charges = 1, class = "MAGE", type = 5}, --Prismatic Barrier [205021] = {cooldown = 78, duration = 5, specs = {64}, talent = false, charges = 1, class = "MAGE", type = 1}, --Ray of Frost [113724] = {cooldown = 45, duration = 10, specs = {62, 63, 64}, talent = false, charges = 1, class = "MAGE", type = 8}, --Ring of Frost + [31661] = {cooldown = 45, duration = 0, specs = {}, talent = false, charges = 1, class = "MAGE", type = 8}, --Dragon's Breath --priest -- 256 - Discipline @@ -571,11 +633,14 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [114018] = {cooldown = 360, duration = 15, specs = {259, 260, 261}, talent = false, charges = 1, class = "ROGUE", type = 5}, --Shroud of Concealment [1856] = {cooldown = 120, duration = 3, specs = {259, 260, 261}, talent = false, charges = 1, class = "ROGUE", type = 1}, --Vanish [79140] = {cooldown = 120, duration = 20, specs = {259}, talent = false, charges = 1, class = "ROGUE", type = 1}, --Vendetta + [1776] = {cooldown = 20, duration = 0, specs = {}, talent = false, charges = 1, class = "ROGUE", type = 8}, --Gouge + [408] = {cooldown = 20, duration = 0, specs = {}, talent = false, charges = 1, class = "ROGUE", type = 8}, --Kidney Shot + [1966] = {cooldown = 15, duration = 0, specs = {}, talent = false, charges = 1, class = "ROGUE", type = 2}, --Feint --evoker -- 1467 - Devastation -- 1468 - Preservation - --[374251] = {cooldown = 60, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 7}, --Cauterizing Flame + [374251] = {cooldown = 60, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 7}, --Cauterizing Flame --[365585] = {cooldown = 8, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 7}, --Expunge --[360823] = {cooldown = 8, duration = 0, specs = {1468}, talent = false, charges = 1, class = "EVOKER", type = 7}, --Naturalize [357210] = {cooldown = 120, duration = 0, specs = {1467, 1468}, talent = false, charges = 1, class = "EVOKER", type = 1}, --Deep Breath diff --git a/Libs/LibOpenRaid/docs.txt b/Libs/LibOpenRaid/docs.txt index 5cc7aac4..3c2493df 100644 --- a/Libs/LibOpenRaid/docs.txt +++ b/Libs/LibOpenRaid/docs.txt @@ -55,6 +55,12 @@ local isReady, normalizedPercent, timeLeft, charges, minValue, maxValue, current @spells: a table containing spellIds {spellId, spellId, spellId, ...} openRaidLib.AddCooldownFilter(filterName, spells) +--get a list of filters which a spell has, returns a table in map format: {[filterName] = true} +--@spellId: the ID of a spell +--@defaultFilterOnly (bool): if true only return built-in filters, example: "defensive-raid", "ofensive". +--@customFiltersOnly (bool): if true onlt return a list of custom filters where the spell was added. +local filterListArray = openRaidLib.GetSpellFilters(spellId, defaultFilterOnly, customFiltersOnly) + --request information about a spell for all units in the raid, units which has this cooldown will report back with a "CooldownUpdate" event openRaidLib.RequestCooldownInfo(spellId) diff --git a/boot.lua b/boot.lua index 68cfa9a4..0344e2f2 100644 --- a/boot.lua +++ b/boot.lua @@ -3,11 +3,11 @@ _ = nil _G._detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - + local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - _detalhes.build_counter = 10259 - _detalhes.alpha_build_counter = 10259 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 10277 + _detalhes.alpha_build_counter = 10277 --if this is higher than the regular counter, use it instead _detalhes.dont_open_news = true _detalhes.game_version = version _detalhes.userversion = version .. " " .. _detalhes.build_counter @@ -64,15 +64,45 @@ do local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" ) - --[=[ - - - - - - this is an empty comment section - - - - - --]=] - local news = { + {"v10.0.2.10277.146", "Nov 18th, 2022"}, + "REMINDER: '/details coach' to get damage/healing/deaths in real time as the 21st person (coach) for the next raid tier in dragonflight.", + "", + "New show a time line of spells used by players in the group, Raid Leader: show all attack and defense cooldowns used by the raid.", + "Wago: Details! Standalone version is now hosted on addons.wago.io and WowUp.com.", + "", + + "Details! will count class play time, everyone using Details! from day 1 in Dragonflight should have an accurate play time in the class.", + "Visual updates on default skin.", + "All panels from options to plugins received visual updates.", + "Profiles won't export Auto Hide automations to stop issues with players not knowing why the window is hidding.", + "Details! should decrease the amount of chat spam errors and instead show them in the bug report window like al the other addons.", + "Player Details! Breakdown window: player selection now uses the same font as the regular window.", + "Death log tooltip revamp for more clarity to see the ability name and the damage done.", + "Dragonflight Trinkets damage will show the trinket name after the spell name.", + "'/details scroll' feature: spell name and spell id can now be copied, the frame got a scale bar.", + "Added option: 'Use Dynamic Overall Damage', if enabled swap to Dynamic Overall Damage when combat start while showing Overall Damage.", + "Fixed for most of the user having the problem of the encounter time not showing.", + "Fixed most of the issues with the melee spell name being called 'Word of Recall'.", + "Details! Damage Meter, Deatails! Framework, LibOpenRaid has been successfully updated to Dragonflight.", + "New class Evoker are now fully supported by Details!.", + "", + "Fixed an issue where warlocks was entering in combat from a debug doing damage (Flamanis).", + "Fixed 'Auto of Range' problem in Wrath of the Lich King (Flamanis).", + "Fixed a bug with custom displays when showing players outside the player group (Flamanis).", + "Fixed an issue where specs wheren't sent on Wrath (Flamanis).", + "Fixed Buff Uptime Tooltip where the buff had zero uptime (Flamanis)", + "Fixed shield damage preventing rare error when the absorption was zero (Flamanis).", + "Fixed chat embed system built in Details! from the Skins section (Flamanis).", + "Fixed an issue where damage in battlegrounds was not being sync with battleground score board in Wrath (Flamanis).", + "", + "New Slash Commands:", + "/playedclass: show how much time you have played this class on this expansion.", + "/dumpt : show the value of any table, global, spellId, etc.", + "/details auras: show a panel with your current auras, spell ids and spell payload.", + "/details perf: show performance issues when you get a warning about freezes due to UpdateAddOnMemoryUsage().", + "/details npcid: get the npc id of your target (a box is shown with the number ready to be copied).", + {"v9.2.0.10001.146", "Aug 10th, 2022"}, "New feature: Arena DPS Bar, can be enabled at the Broadcaster Tools section, shows a bar in 'kamehameha' style showing which team is doing more damage in the latest 3 seconds.", "/keystone now has more space for the dungeon name.", @@ -95,225 +125,6 @@ do "Major cleanup and code improvements on dropdowns for library Details! Framework.", "Cleanup on NickTag library.", "Removed LibGroupInSpecT, LibItemUpgradeInfo and LibCompress. These libraries got replaced by OpenRaidLib and LibDeflate.", - - {"v9.2.0.9814.146", "May 15th, 2022"}, - "Added slash command /keystone, this command show keystones of other users with addons using Open Raid library.", - "Added a second Title Bar (disabled by default), is recomended to make the Skin Color (under Window Body) full transparent while using it.", - "Added Overlay Texture and Color options under Bars: General.", - "Added Wallpaper Alignment 'Full Body', this alignment make the wallpaper fill over the title bar.", - "Added Auto Alignment for 'Aligned Text Columns', this option is enabled by default.", - "Added 'Window Area Border' and 'Row Area Border' under 'Window Body' section in the options panel.", - "Added an option to color the Row Border by player class.", - "Added new automation auto hide option: Arena.", - "Blizzard Death Recap kill ability only shows on Dungeons and Raids now.", - "Fixed an issue where player names was overlapping damage numbers with enbaled 'Aligned Text Columns'.", - "Fixed a bug on 'DeathLog Min Healing' option where it was reseting to 1 on each logon.", - "Fixed several bugs with 'Bar Orientation: Right to Left' (fix by Flamanis).", - "Fixed an error on Vanguard plugin.", - "Fixed Spec Icons 'Specialization Alpha' offseted by 2 pixels to the right.", - - {"v9.2.0.9778.146", "April 26th, 2022"}, - --"A cooldown tracker experiment has been added, its options is visible at the Options Panel.", - "Added a search box in the '/details scroll' feature.", - "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.", - "Fixed the issue of skins installed after the window has been loaded and the skin was not found at that 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).", - "Fixed windows ungrouping after a /reload (fix by Flamanis).", - "Opening a tooltip from a bar or a menu in the title bar will close the All Displays Panel (from right clicking the title bar).", - "[TBC] fixed an error given by users using old versions of Details! in the raid.", - - {"v9.2.0.9715.146", "March 6th, 2022"}, - "More Tiny Threat fixes and implementations (by Treeston)", - "Fixed Chinese and Taiwan 'Thousand' abbreviation letter (fix by github user Maioro).", - - {"v9.2.0.9699.146", "March 4th, 2022"}, - "Align Text Columns now have a warning at the bracket and separators option", - "Silence from interrupts shall be counted as a crowd control.", - "More phrases in the options panel has been added to translation.", - "A revamp has beed started on the erase data prompt.", - - {"v9.2.0.9696.146", "February 24th, 2022"}, - "Fixed DPS display when using Aligned Text Columns.", - "Fixed percent showing even it's disabled when using Aligned Text Columns.", - - {"v9.2.0.9255.146", "February 22th, 2022"}, - "Added Cosmic Healing Potion to script 'Health Potion & Stone'.", - - {"v9.1.5.9213.146", "February 15th, 2022"}, - "Added an option to change your own bar color.", - "Added 'Ignore this Npc' into the Npc list under the spell list section.", - "Bookmark window now uses the same scale than the options panel.", - "Class Color window now uses the same scale than the options panel.", - "If not casted on the player itself Power Infusion now shows in the buff list of the target.", - "Allowed nicknames on custom displays (by Flamanis).", - "Aligned Text Columns enabled is now default for new installs.", - "Fodder to the flames DH ability won't count damage done by the player on the add summoned.", - "Fixed the load time for the Npc Ids panel on the spell list section.", - "Fixed all issues with the options panel scale.", - "Fixed tooltips overlap when the window is positioned at the top of the screen (fix by Flamanis).", - "Fixed auto hide windows which wasn't saving its group when unhiding (fix by Flamanis).", - "Fixed some XML Headers which was giving errors on loading (fix by github user h0tw1r3).", - "Fixed '/details me' on TBC, which wasn't working correctly (fix by github user Baugstein).", - "Fixed a typo on Vanguard plugin (fix by github user cruzerthebruzer).", - "Fixed font 'NuevaStd' where something the font didn't work at all.", - "Fixed an issue where for some characters the options panel won't open showing an error in the chat instead.", - "New API: combat:GetPlayerDeaths(deadPlayerName).", - "New API: Details:ShowDeathTooltip(combatObject, deathTable) for Cooltip tooltips.", - - {"v9.1.5.9213.145", "December 9th, 2021"}, - "Fixed an issue where after reloading, overall data won't show the players nickname.", - "Fixed overkill damage on death log tooltip.", - "Fixed the percent bars for the healing done target on the player breakdown window.", - "Fixed an issue with resource tooltips.", - - {"v9.1.5.9108.145", "November 02th, 2021"}, - "Necrotic Wake: weapons damage does not count anymore for the player which uses it.", - "Necrotic Wake: a new 'fake player' is shown showing the damage done of all weapons during combat.", - "Necrotic Wake: these npcs now does not award damage done to players anymore: Brittlebone Mage, Brittlebone Warrior, Brittlebone Crossbowman", - "The Other Side: the npc Volatile Memory does not award anymore damage to players.", - "Plaguefall: the npcs Fungret Shroomtender and Plaguebound Fallen does not award anymore damage to players.", - "Sanguine Affix: the amount of healing done by sanguine pools now shows on all segments (was shown only in the overall).", - "Tiny Threat (plugin): fixed an issue when hidding the pull aggro bar makes the first line be invisible.", - "Statistics: fixed several small bugs with guild statistics (/details stats).", - "Scale slider (top left slider shown on panels) are now more responsible.", - - {"v9.1.0.8888.145", "October 7th, 2021"}, - "Search has been added into the options panel", - "Improvements on overkill amount of damage", - "Fonts 'Oswald' and 'NuevaStd' enabled again.", - "Added critical hits to Death Log (by C. Raethke)", - "Added settings to change the color on death log, they are within the class colors panel.", - "Don't show TaintWarning frame if MiniMapBattlefieldFrame is hidden (by Flamanis).", - - {"v9.1.0.8812.145", "September 5th, 2021"}, - "Fonts 'Oswald' and 'NuevaStd' disabled due to some erros on the client side.", - "Death Knight adds now include the icon of the spell whose summoned them.", - "Fixes and improvements on the backend of the addon.", - - {"v9.1.0.8782.145", "August 11th, 2021"}, - "Clicking on the minimap while the options panel is open will close it.", - "Fixed Raid Check plugin position when the window is anchored at the top of the monitor.", - "Shadow priest Void Erruption spells got merged into only one.", - "Added settings to adjust the scale or font size of the title bar menu (right click): /run Details.all_switch_config.font_size = 12; /run Details.all_switch_config.scale = 1.0;", - "Added transliteration to healing done.", - "Tiny Threat (plugin): added options to Hide the Pull Bar and Use Focus Target.", - - {"v9.0.5.8637.144", "June 22nd, 2021"}, - "Major update on Vanguard plugin.", - "Added utility module to Coach, this module will send interrupt, dispel, cc breaks, cooldown usege and battle resses to the Coach.", - "Added plugins into the title bar display menu.", - - {"v9.0.5.8502.144", "May 21th, 2021"}, - "Added options to change the color of each team during an arena match.", - "Fixed One Segment Battleground.", - "Fixed an error with Howl of Terror on Demo Warlocks.", - - {"v9.0.5.8501.144", "May 17th, 2021"}, - "Complete overhaul and rerritten on Fade In and Out animations, this should fix all bugs related to animations not being consistent.", - "Complete overhaul on the broadcaster tool for arenas 'Current DPS'. It shows now a bar indicating the dps of both teams.", - "Yellow arena team now has purple color.", - "Several updates on the combat log engine and bug fixes.", - - {"v9.0.5.8357.144", "March 15th, 2021"}, - "Max amount of segments raised to 40, was 30.", - "Added a 'Sanguine Heal' actor to show how much the void zone healed enemies, shown on Everything mode.", - "Death events are now ignore after the necrolord triggers Forgeborne Reveries.", - "Mythic dungeon settings are reset after importing a profile.", - "Scripts now support Inline text feature.", - "Fixed a rare bug when exporting a profile would result into a bug.", - "Fixed an issue with Spirit Shell overhealing.", - "Fixed a rare bug on dispel toooltips giving errors.", - "Fixed a bug on exporting scripts.", - "Fixed an error given when an a battleground opponent die.", - "Fixed an issue where sometimes entering an arena cause errors.", - "Fixed some issues with pet detection.", - - {"v9.0.2.8246.144", "February 17th, 2021"}, - "Added healing done to Coach feature (in testing).", - "Ignore Forgeborne Reveries healing done (Necrolords ability).", - "Arena enemy deaths now are shown in the Deaths display.", - "Guild statistics data has been wiped, this system had a major improvement overall.", - "Fixed 'Clear Overall Data' on Logout which wasn't clearing.", - - {"v9.0.2.8192.144", "January 27th, 2021"}, - "If you get issues with nicknames, disable any weakaura which modifies this feature.", - "Advanced Death Logs plugin got some fixes and should work properly.", - "Added the word 'Overall' at the end of the title bar text when the segment is overall.", - "Added covenant and durability into the Raid Check plugin.", - "Added API Window:SetTitleBarText(text) and Window:GetTitleBarText().", - "Fixed some issues where Details! printed 'combat start time not found.'", - "Fixed damage per Phase.", - "Fixed resizing window with no background error.", - "Fixed 'Always Show player' on ascending sort direction.", - "Added more foods into the Ready Check plugin.", - "Fixed some issues with the coach fearure.", - - {"v9.0.2.8154.144", "January 14th, 2021"}, - "Added total damage bars into the player list in the Breakdown window.", - "Added 'Square' or 'Roll' mode to Details! Streamer plugin, to change the statusbar mode to Squares, visit the options panel for the plugin.", - "Added Binding Shot to crowd control (Hunter)", - "Merged all whirlwind damage (Warrior).", - "Fixed errors on the 1-10 tutorial levels while playing Demon Hunters.", - "Fixed some cases of DeathLog not showing healing", - "Fixed windows making a group after '/details toggle', while the option to not make groups enabled.", - "Fixed some issues with the custom display 'Potion Used' and 'Health Potion & Stone'.", - "Fixed the breakdown window where using the comparisson tab sometimes made the frame to overlap with the aura tab.", - - {"v9.0.2.8001.144", "December 19th, 2020"}, - "Added Details! Coach as a new experimental feature, you may want to test using /details coach", - "Coach feature allows the raid leader to stay outside the raid while seeing in real time player deaths and damage information.", - "Fixed issues with some raid encounters in Castle Nathria.", - "Druid Kyrian Spirits ability now has some rules to credit the druid for damage and heal.", - "Several small bug fixes has been done.", - - {"v9.0.1.8001.144", "November 30rd, 2020"}, - "Added back the report to bnet friend.", - "@Flamanis: fixed issues on custom displays.", - - {"v9.0.1.7950.144", "November 3rd, 2020"}, - "Added the baseline for the Coach feature, for testing use '/details coach', all users in the raid must have details! up to date.", - "Added container_spells:GetOrCreateSpell(id, shouldCreate, token).", - "Added Details:GetRaidLeader(), return the RL name.", - "Fixed Tiny Threat not showing threat.", - "Fixed annoucement interrupt enable toggle checkbox was reseting on logon.", - - {"v9.0.1.7938.142", "October 29th, 2020"}, - "Added option to select the icon buttons in the title bar.", - - {"v9.0.1.7739.142", "August 18th, 2020"}, - "More development on the new plugin Cast Timeline.", - "More development on Details! Scroll Damage.", - "Added options to opt-out show pets on solo play.", - "Added back Profiles and Plugins into the options panel.", - "Many framework fixes from retail ported to shadowlands.", - {"v9.0.1.7721.142", "August 14th, 2020"}, - "Encounter time in the title bar got new code and might work now for some people that had issues with it.", - "Fixed an error with the Welcome Window showing errors.", - "Statusbar got fixed, it should now show it's widgets normally.", - "Alignment for the title bar text also got fixed.", - {"v9.0.1.7707.142", "August 11th, 2020"}, - "While in The Concil of Blood, Details! now deletes the damage done to alive bosses when one of them dies. This condition can be turned off with /run Details.exp90temp.delete_damage_TCOB = false", - "Many Important Npcs like Jaina and Thrall shows as group members of your group.", - "More progress on the options panel overhaul.", - "General bug fixes.", - {"v9.0.1.7590.142", "July 31th, 2020"}, - "New options panel in progress", - "Added options for the 'Inline' right texts in the window", - "General round of fixes", - {"v9.0.1.7544.142", "July 25th, 2020"}, - "Changed texts alignment to be parallel.", - "Changed icons to white color.", - "Added player list on the Player Breakdown Window.", - "Added a new plugin: 'Cast Timeline' available at the Player Breakdown Window.", - "Added macro '/Details me' to open your Breakdown Window.", } local newsString = "|cFFF1F1F1" @@ -325,7 +136,11 @@ do local date = line[2] newsString = newsString .. "|cFFFFFF00" .. version .. " (|cFFFF8800" .. date .. "|r):|r\n\n" else - newsString = newsString .. "|cFFFFFF00-|r " .. line .. "\n\n" + if (line ~= "") then + newsString = newsString .. "|cFFFFFF00-|r " .. line .. "\n\n" + else + newsString = newsString .. " \n" + end end end @@ -980,15 +795,16 @@ do SharedMedia:Register("font", "Harry P", [[Interface\Addons\Details\fonts\HARRYP__.TTF]]) SharedMedia:Register("font", "FORCED SQUARE", [[Interface\Addons\Details\fonts\FORCED SQUARE.ttf]]) - SharedMedia:Register("sound", "d_gun1", [[Interface\Addons\Details\sounds\sound_gun2.ogg]]) - SharedMedia:Register("sound", "d_gun2", [[Interface\Addons\Details\sounds\sound_gun3.ogg]]) - SharedMedia:Register("sound", "d_jedi1", [[Interface\Addons\Details\sounds\sound_jedi1.ogg]]) - SharedMedia:Register("sound", "d_whip1", [[Interface\Addons\Details\sounds\sound_whip1.ogg]]) + SharedMedia:Register("sound", "Details Gun1", [[Interface\Addons\Details\sounds\sound_gun2.ogg]]) + SharedMedia:Register("sound", "Details Gun2", [[Interface\Addons\Details\sounds\sound_gun3.ogg]]) + SharedMedia:Register("sound", "Details Jedi1", [[Interface\Addons\Details\sounds\sound_jedi1.ogg]]) + SharedMedia:Register("sound", "Details Whip1", [[Interface\Addons\Details\sounds\sound_whip1.ogg]]) + SharedMedia:Register("sound", "Details Horn", [[Interface\Addons\Details\sounds\Details Horn.ogg]]) - SharedMedia:Register("sound", "Details Threat Warning Volume 1", [[Interface\Addons\Details\sounds\threat_warning_1.ogg]]) - SharedMedia:Register("sound", "Details Threat Warning Volume 2", [[Interface\Addons\Details\sounds\threat_warning_2.ogg]]) - SharedMedia:Register("sound", "Details Threat Warning Volume 3", [[Interface\Addons\Details\sounds\threat_warning_3.ogg]]) - SharedMedia:Register("sound", "Details Threat Warning Volume 4", [[Interface\Addons\Details\sounds\threat_warning_4.ogg]]) + SharedMedia:Register("sound", "Details Warning", [[Interface\Addons\Details\sounds\Details Warning 100.ogg]]) + --SharedMedia:Register("sound", "Details Warning (Volume 75%)", [[Interface\Addons\Details\sounds\Details Warning 75.ogg]]) + --SharedMedia:Register("sound", "Details Warning Volume 50%", [[Interface\Addons\Details\sounds\Details Warning 50.ogg]]) + --SharedMedia:Register("sound", "Details Warning Volume 25%", [[Interface\Addons\Details\sounds\Details Warning 25.ogg]]) @@ -1004,6 +820,14 @@ do end function dumpt(value) --[[GLOBAL]] + --check if this is a spellId + local spellId = tonumber(value) + if (spellId) then + local spellInfo = {GetSpellInfo(spellId)} + if (type(spellInfo[1]) == "string") then + return Details:Dump(spellInfo) + end + end return Details:Dump(value) end diff --git a/classes/class_combat.lua b/classes/class_combat.lua index 0223a661..058c5e3d 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -2,6 +2,7 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ + local addonName, Details222 = ... --[[global]] DETAILS_TOTALS_ONLYGROUP = true diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 68783e3e..eb7e03bf 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -1,7 +1,7 @@ - local _detalhes = _G._detalhes - local _ + local _ = nil _detalhes.custom_function_cache = {} + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers @@ -1160,6 +1160,14 @@ end end + function Details222.GetCustomDisplayIDByName(customDisplayName) + for customDisplayID, customObject in ipairs(_detalhes.custom) do + if (customObject.name == customDisplayName) then + return customDisplayID + end + end + end + function _detalhes:AddDefaultCustomDisplays() local PotionUsed = { @@ -2258,6 +2266,7 @@ local DynamicOverallDamage = { name = Loc ["STRING_CUSTOM_DYNAMICOVERAL"], --"Dynamic Overall Damage", + displayName = Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], icon = [[Interface\Buttons\Spell-Reset]], attribute = false, spellid = false, diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 1a5b934c..d6a229c2 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -3,8 +3,9 @@ local Details = _G.Details local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local Translit = LibStub("LibTranslit-1.0") - local gump = Details.gump - local _ + local gump = Details.gump + local _ = nil + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers @@ -13,12 +14,10 @@ local _math_floor = math.floor --lua local local _table_sort = table.sort --lua local local tinsert = table.insert --lua local - local _table_size = table.getn --lua local local setmetatable = setmetatable --lua local local _getmetatable = getmetatable --lua local local ipairs = ipairs --lua local local pairs = pairs --lua local - local rawget= rawget --lua local local _math_min = math.min --lua local local _math_max = math.max --lua local local abs = math.abs --lua local @@ -39,15 +38,10 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants - local alvo_da_habilidade = Details.alvo_da_habilidade local container_habilidades = Details.container_habilidades - local container_combatentes = Details.container_combatentes local atributo_damage = Details.atributo_damage local atributo_misc = Details.atributo_misc - local habilidade_dano = Details.habilidade_dano - local container_damage_target = Details.container_type.CONTAINER_DAMAGETARGET_CLASS local container_damage = Details.container_type.CONTAINER_DAMAGE_CLASS - local container_friendlyfire = Details.container_type.CONTAINER_FRIENDLYFIRE local modo_GROUP = Details.modos.group local modo_ALL = Details.modos.all @@ -1630,7 +1624,7 @@ end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --main refresh function -function atributo_damage:RefreshWindow (instancia, combatObject, forcar, exportar, refreshRequired) +function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar, refreshRequired) local showing = combatObject[class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable --not have something to show diff --git a/classes/class_error.lua b/classes/class_error.lua index 241e62c2..2052cf48 100644 --- a/classes/class_error.lua +++ b/classes/class_error.lua @@ -1,5 +1,6 @@ do local _detalhes = _G._detalhes + local addonName, Details222 = ... local _error = { ["error"] = true, diff --git a/classes/class_heal.lua b/classes/class_heal.lua index c0588d5c..7dbd6eac 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -1,6 +1,13 @@ +local _detalhes = _G._detalhes +local _ +local addonName, Details222 = ... + +local AceLocale = LibStub("AceLocale-3.0") +local Loc = AceLocale:GetLocale ( "Details" ) +local Translit = LibStub("LibTranslit-1.0") + --lua locals -local _cstr = string.format local _math_floor = math.floor local setmetatable = setmetatable local pairs = pairs @@ -10,7 +17,6 @@ local type = type local _table_sort = table.sort local _cstr = string.format local tinsert = table.insert -local _bit_band = bit.band local _math_min = math.min local _math_ceil = math.ceil --api locals @@ -18,18 +24,8 @@ local GetSpellInfo = GetSpellInfo local _GetSpellInfo = _detalhes.getspellinfo local IsInRaid = IsInRaid local IsInGroup = IsInGroup -local _UnitName = UnitName -local GetNumGroupMembers = GetNumGroupMembers local _string_replace = _detalhes.string.replace --details api - -local _detalhes = _G._detalhes -local _ - -local AceLocale = LibStub("AceLocale-3.0") -local Loc = AceLocale:GetLocale ( "Details" ) -local Translit = LibStub("LibTranslit-1.0") - local gump = _detalhes.gump local alvo_da_habilidade = _detalhes.alvo_da_habilidade diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 263f6a96..881efd46 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -6,7 +6,6 @@ local type= type --lua local local ipairs = ipairs --lua local local pairs = pairs --lua local local _math_floor = math.floor --lua local -local abs = math.abs --lua local local _table_remove = table.remove --lua local local _getmetatable = getmetatable --lua local local setmetatable = setmetatable --lua local @@ -14,27 +13,23 @@ local _string_len = string.len --lua local local _unpack = unpack --lua local local _cstr = string.format --lua local local _SendChatMessage = SendChatMessage --wow api locals -local _GetChannelName = GetChannelName --wow api locals local _UnitExists = UnitExists --wow api locals local _UnitName = UnitName --wow api locals local _UnitIsPlayer = UnitIsPlayer --wow api locals local _UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned --wow api locals local _detalhes = _G._detalhes +local _ +local addonName, Details222 = ... local gump = _detalhes.gump -local historico = _detalhes.historico - local modo_raid = _detalhes._detalhes_props["MODO_RAID"] local modo_alone = _detalhes._detalhes_props["MODO_ALONE"] local modo_grupo = _detalhes._detalhes_props["MODO_GROUP"] local modo_all = _detalhes._detalhes_props["MODO_ALL"] -local _ - local atributos = _detalhes.atributos local sub_atributos = _detalhes.sub_atributos -local segmentos = _detalhes.segmentos --STARTUP reativa as instancias e regenera as tabelas das mesmas function _detalhes:RestartInstances() @@ -2301,6 +2296,29 @@ function _detalhes:TrocaTabela(instancia, segmento, atributo, sub_atributo, inic _detalhes:Msg("invalid attribute, switching to damage done.") end + if (Details.auto_swap_to_dynamic_overall and Details.in_combat and UnitAffectingCombat("player")) then + if (segmento >= 0) then + if (atributo == 5) then + local dynamicOverallDataCustomID = Details222.GetCustomDisplayIDByName(Loc["STRING_CUSTOM_DYNAMICOVERAL"]) + if (dynamicOverallDataCustomID == sub_atributo) then + atributo = 1 + sub_atributo = 1 + end + end + + elseif (segmento == -1) then + if (atributo == 1) then + if (sub_atributo == 1) then + local dynamicOverallDataCustomID = Details222.GetCustomDisplayIDByName(Loc["STRING_CUSTOM_DYNAMICOVERAL"]) + if (dynamicOverallDataCustomID) then + atributo = 5 + sub_atributo = dynamicOverallDataCustomID + end + end + end + end + end + --Muda o segmento caso necess�rio if (segmento ~= current_segmento or _detalhes.initializing or iniciando_instancia) then --na troca de segmento, conferir se a instancia esta frozen @@ -2419,6 +2437,7 @@ function _detalhes:TrocaTabela(instancia, segmento, atributo, sub_atributo, inic _detalhes.popup:Select(2, instancia.sub_atributo, atributo) end + --DEPRECATED if (_detalhes.cloud_process) then if (_detalhes.debug) then _detalhes:Msg("(debug) instancia #"..instancia.meu_id.." found cloud process.") @@ -2426,7 +2445,7 @@ function _detalhes:TrocaTabela(instancia, segmento, atributo, sub_atributo, inic local atributo = instancia.atributo local time_left = (_detalhes.last_data_requested+7) - _detalhes._tempo - + if (atributo == 1 and _detalhes.in_combat and not _detalhes:CaptureGet("damage") and _detalhes.host_by) then if (_detalhes.debug) then _detalhes:Msg("(debug) instancia need damage cloud.") @@ -2446,7 +2465,7 @@ function _detalhes:TrocaTabela(instancia, segmento, atributo, sub_atributo, inic else time_left = nil end - + if (time_left) then if (_detalhes.debug) then _detalhes:Msg("(debug) showing instance alert.") @@ -2454,6 +2473,7 @@ function _detalhes:TrocaTabela(instancia, segmento, atributo, sub_atributo, inic instancia:InstanceAlert (Loc ["STRING_PLEASE_WAIT"], {[[Interface\COMMON\StreamCircle]], 22, 22, true}, time_left) end end + --END OF DEPRECATED _detalhes:InstanceCall(_detalhes.CheckPsUpdate) _detalhes:SendEvent("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, atributo, sub_atributo) diff --git a/classes/class_resources.lua b/classes/class_resources.lua index 17ca06e9..e13b2d11 100644 --- a/classes/class_resources.lua +++ b/classes/class_resources.lua @@ -7,10 +7,6 @@ local tinsert = table.insert local setmetatable = setmetatable local ipairs = ipairs local pairs = pairs -local rawget= rawget -local _math_min = math.min -local _math_max = math.max -local _bit_band = bit.band local _unpack = unpack local type = type --api locals @@ -25,6 +21,7 @@ local _detalhes = _G._detalhes local AceLocale = LibStub("AceLocale-3.0") local Loc = AceLocale:GetLocale ( "Details" ) local _ +local addonName, Details222 = ... local gump = _detalhes.gump diff --git a/classes/class_spelldamage.lua b/classes/class_spelldamage.lua index bd965ec4..a07e1939 100644 --- a/classes/class_spelldamage.lua +++ b/classes/class_spelldamage.lua @@ -1,6 +1,7 @@ -- damage ability file local _detalhes = _G._detalhes local _ + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/classes/class_spellhealing.lua b/classes/class_spellhealing.lua index 0ce6b641..6a1c43bd 100644 --- a/classes/class_spellhealing.lua +++ b/classes/class_spellhealing.lua @@ -2,7 +2,8 @@ local _detalhes = _G._detalhes local _ - + local addonName, Details222 = ... + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants diff --git a/classes/class_spellresources.lua b/classes/class_spellresources.lua index f4097138..ae7b4b53 100644 --- a/classes/class_spellresources.lua +++ b/classes/class_spellresources.lua @@ -2,6 +2,7 @@ local _detalhes = _G._detalhes local _ + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/classes/class_spellutility.lua b/classes/class_spellutility.lua index 1d144e8d..46855cb4 100644 --- a/classes/class_spellutility.lua +++ b/classes/class_spellutility.lua @@ -1,6 +1,7 @@ -- misc ability file local _detalhes = _G._detalhes local _ + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 3fdc7e7d..4e5ed081 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -2,14 +2,9 @@ local _cstr = string.format local _math_floor = math.floor local tinsert = table.insert -local _table_size = table.getn local ipairs = ipairs local pairs = pairs -local rawget= rawget local min = math.min -local _math_max = math.max -local abs = math.abs -local _bit_band = bit.band local unpack = unpack local type = type --api locals @@ -18,7 +13,6 @@ local GameTooltip = GameTooltip local IsInRaid = IsInRaid local IsInGroup = IsInGroup local GetNumGroupMembers = GetNumGroupMembers -local _GetNumSubgroupMembers = GetNumSubgroupMembers local _UnitAura = UnitAura local UnitGUID = UnitGUID local _UnitName = UnitName @@ -32,39 +26,24 @@ local _detalhes = _G._detalhes local Details = _detalhes local AceLocale = LibStub("AceLocale-3.0") local Loc = AceLocale:GetLocale ( "Details" ) +local addonName, Details222 = ... local gump = _detalhes.gump local _ -local alvo_da_habilidade = _detalhes.alvo_da_habilidade local container_habilidades = _detalhes.container_habilidades -local container_combatentes = _detalhes.container_combatentes -local container_pets = _detalhes.container_pets local atributo_misc = _detalhes.atributo_misc -local habilidade_misc = _detalhes.habilidade_misc -local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS -local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS -local container_misc_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS local modo_GROUP = _detalhes.modos.group local modo_ALL = _detalhes.modos.all local class_type = _detalhes.atributos.misc -local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START -local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END - -local div_abre = _detalhes.divisores.abre -local div_fecha = _detalhes.divisores.fecha -local div_lugar = _detalhes.divisores.colocacao - local ToKFunctions = _detalhes.ToKFunctions -local SelectedToKFunction = ToKFunctions[1] local UsingCustomLeftText = false local UsingCustomRightText = false -local FormatTooltipNumber = ToKFunctions[8] local TooltipMaximizedMethod = 1 local info = _detalhes.playerDetailWindow diff --git a/classes/container_actors.lua b/classes/container_actors.lua index d110d440..11cdf4fc 100644 --- a/classes/container_actors.lua +++ b/classes/container_actors.lua @@ -4,6 +4,7 @@ local Details = _G.Details local DF = _G.DetailsFramework local _ + local addonName, Details222 = ... local CONST_CLIENT_LANGUAGE = DF.ClientLanguage diff --git a/classes/container_pets.lua b/classes/container_pets.lua index 0fe953d9..23d0b44c 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -1,6 +1,8 @@ local _detalhes = _G._detalhes local gump = _detalhes.gump local container_pets = _detalhes.container_pets +local _ +local addonName, Details222 = ... -- api locals local UnitGUID = _G.UnitGUID @@ -14,7 +16,6 @@ local GetNumGroupMembers = _G.GetNumGroupMembers local setmetatable = setmetatable local _bit_band = bit.band --lua local local pairs = pairs -local ipairs = ipairs local wipe = table.wipe --details locals diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 68502f8b..26f2fc55 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -6,6 +6,9 @@ local tinsert = table.insert local wipe = table.wipe local Details = _G._detalhes +local _ +local addonName, Details222 = ... + local combatClass = Details.combate local segmentClass = Details.historico local timeMachine = Details.timeMachine diff --git a/classes/container_spells.lua b/classes/container_spells.lua index 63cfcbed..dc4e74cb 100644 --- a/classes/container_spells.lua +++ b/classes/container_spells.lua @@ -2,6 +2,7 @@ local _detalhes = _G._detalhes local _ +local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/classes/custom_damagedone.lua b/classes/custom_damagedone.lua index aea20b3b..bbd5cf7f 100644 --- a/classes/custom_damagedone.lua +++ b/classes/custom_damagedone.lua @@ -12,6 +12,7 @@ local _detalhes = _G._detalhes local _ +local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/classes/custom_healingdone.lua b/classes/custom_healingdone.lua index 970662cb..008c8c0c 100644 --- a/classes/custom_healingdone.lua +++ b/classes/custom_healingdone.lua @@ -5,7 +5,8 @@ local _detalhes = _G._detalhes local _ - + local addonName, Details222 = ... + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/classes/include_instance.lua b/classes/include_instance.lua index a5b8ea31..1a217fb8 100644 --- a/classes/include_instance.lua +++ b/classes/include_instance.lua @@ -6,9 +6,10 @@ --values added into 'instance_skin_ignored_values' won't be passed when the user exports the profile or exports the skin individually. - local _detalhes = _G._detalhes local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") +local addonName, Details222 = ... +local _ = nil function _detalhes:ResetInstanceConfig (maintainsnap) for key, value in pairs(_detalhes.instance_defaults) do @@ -157,6 +158,8 @@ _detalhes.instance_defaults = { menu_icons_alpha = 1, --blackwhiite icons desaturated_menu = false, --mode segment attribute report + --menu icons color + menu_icons_color = {1, 1, 1}, --icons on menu menu_icons = {true, true, true, true, true, false, space = -2, shadow = false}, --mode segment attribute report reset close --menu icons size multiplicator factor diff --git a/core/control.lua b/core/control.lua index bc688a65..37f1ca73 100644 --- a/core/control.lua +++ b/core/control.lua @@ -5,6 +5,7 @@ local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local _tempo = time() local _ + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers diff --git a/core/gears.lua b/core/gears.lua index 50d8fe08..6cb747c3 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -9,6 +9,7 @@ local floor = floor local GetNumGroupMembers = GetNumGroupMembers local CONST_INSPECT_ACHIEVEMENT_DISTANCE = 1 --Compare Achievements, 28 yards +local CONST_SPELLBOOK_GENERAL_TABID = 1 local CONST_SPELLBOOK_CLASSSPELLS_TABID = 2 local storageDebug = false --remember to turn this to false! @@ -2968,6 +2969,35 @@ function Details.GenerateSpecSpellList() end) end +function Details.GenerateRacialSpellList() + local racialsSpells = "|n" + local locClassName, unitClass = UnitClass("player") + local locPlayerRace, playerRace, playerRaceId = UnitRace("player") + --get general spells from the spell book + local tabName, tabTexture, offset, numSpells, isGuild, offspecId = GetSpellTabInfo(CONST_SPELLBOOK_GENERAL_TABID) + offset = offset + 1 + local tabEnd = offset + numSpells + for entryOffset = offset, tabEnd - 1 do + local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player") + if (spellId) then + local spell = Spell:CreateFromSpellID(spellId) + local subSpellName = spell:GetSpellSubtext() + if (subSpellName == "Racial") then + spellId = C_SpellBook.GetOverrideSpell(spellId) + local spellName = GetSpellInfo(spellId) + local isPassive = IsPassiveSpell(entryOffset, "player") + if (spellName and not isPassive) then + local cooldownTime = floor(GetSpellBaseCooldown(spellId) / 1000) + racialsSpells = racialsSpells .. "[" .. spellId .. "] = {cooldown = " .. cooldownTime .. ", duration = 0, specs = {}, talent = false, charges = 1, raceid = " .. playerRaceId .. ", race = \"".. playerRace .."\", class = \"\", type = 9}, --" .. spellName .. " (" .. playerRace .. ")|n" + end + end + end + end + + racialsSpells = racialsSpells .. "|n" + dumpt(racialsSpells) +end + --fill the passed table with spells from talents and spellbook, affect only the active spec function Details.FillTableWithPlayerSpells(completeListOfSpells) local specId, specName, _, specIconTexture = GetSpecializationInfo(GetSpecialization()) diff --git a/core/parser.lua b/core/parser.lua index ee17cea2..1e227ce0 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -2,11 +2,7 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) - local _tempo = time() - local _ local DetailsFramework = DetailsFramework - local isTBC = DetailsFramework.IsTBCWow() - local isWOTLK = DetailsFramework.IsWotLKWow() ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers @@ -33,10 +29,15 @@ local _UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned local _GetSpellInfo = _detalhes.getspellinfo + local isWOTLK = DetailsFramework.IsWotLKWow() + local _tempo = time() + local _, Details222 = ... + _ = nil local escudo = _detalhes.escudos --details local local parser = _detalhes.parser --details local local absorb_spell_list = _detalhes.AbsorbSpells --details local + local trinketData = {} local cc_spell_list = DetailsFramework.CrowdControlSpells local container_habilidades = _detalhes.container_habilidades --details local @@ -186,12 +187,9 @@ } --spellIds override - local override_spellId + local override_spellId = {} - if (isTBC) then - override_spellId = {} - - elseif (isWOTLK) then + if (isWOTLK) then override_spellId = { --Scourge Strike [55090] = 55271, @@ -314,7 +312,6 @@ --tbc spell caches local TBC_PrayerOfMendingCache = {} local TBC_EarthShieldCache = {} - local TBC_LifeBloomLatestHeal local TBC_JudgementOfLightCache = { _damageCache = {} } @@ -440,8 +437,8 @@ --in combat flag local _in_combat = false local _current_encounter_id - local _is_storing_cleu = false local _in_resting_zone = false + local _global_combat_counter = 0 --deathlog local _death_event_amt = 16 @@ -515,7 +512,7 @@ Details.SpecialSpellActorsName = {} --add sanguine affix - if (not isTBC) then + if (not isWOTLK) then if (Details.SanguineHealActorName) then Details.SpecialSpellActorsName[Details.SanguineHealActorName] = SPELLID_SANGUINE_HEAL end @@ -913,7 +910,7 @@ end --end - if (isTBC or isWOTLK) then + if (isWOTLK) then --is the target an enemy with judgement of light? if (TBC_JudgementOfLightCache[alvo_name] and false) then --store the player name which just landed a damage @@ -941,9 +938,9 @@ if (_detalhes.encounter_table.id and _detalhes.encounter_table["start"] >= GetTime() - 3 and _detalhes.announce_firsthit.enabled) then local link if (spellid <= 10) then - link = GetSpellInfo(spellid) + link = _GetSpellInfo(spellid) else - link = GetSpellLink(spellid) + link = _GetSpellInfo(spellid) end if (_detalhes.WhoAggroTimer) then @@ -1395,9 +1392,31 @@ end end - if (_is_storing_cleu) then - _current_combat_cleu_events [_current_combat_cleu_events.n] = {_tempo, _token_ids [token] or 0, who_name, alvo_name or "", spellid, amount} - _current_combat_cleu_events.n = _current_combat_cleu_events.n + 1 + if (trinketData[spellid] and _in_combat) then + local thisData = trinketData[spellid] + if (thisData.lastCombatId == _global_combat_counter) then + if (thisData.lastPlayerName == who_name) then + if (thisData.lastActivation < (time - 40)) then + local cooldownTime = time - thisData.lastActivation + thisData.totalCooldownTime = thisData.totalCooldownTime + cooldownTime + thisData.activations = thisData.activations + 1 + thisData.lastActivation = time + + thisData.averageTime = floor(thisData.totalCooldownTime / thisData.activations) + if (cooldownTime < thisData.minTime) then + thisData.minTime = cooldownTime + end + + if (cooldownTime > thisData.maxTime) then + thisData.maxTime = cooldownTime + end + end + end + else + thisData.lastCombatId = _global_combat_counter + thisData.lastActivation = time + thisData.lastPlayerName = who_name + end end return spell_damage_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, resisted, blocked, absorbed, critical, glacing, token, isoffhand, isreflected) @@ -1925,7 +1944,6 @@ --SUMMON serach key: ~summon | ----------------------------------------------------------------------------------------------------------------------------------------- function parser:summon (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellName) - --[[statistics]]-- _detalhes.statistics.pets_summons = _detalhes.statistics.pets_summons + 1 if (not _detalhes.capture_real ["damage"] and not _detalhes.capture_real ["heal"]) then @@ -2195,15 +2213,7 @@ cura_efetiva = cura_efetiva + amount - overhealing end - if (isTBC) then - --life bloom explosion (second part of the heal) - if (spellid == SPELLID_DRUID_LIFEBLOOM_HEAL) then - TBC_LifeBloomLatestHeal = cura_efetiva - return - end - end - - if (isTBC or isWOTLK) then + if (isWOTLK) then --earth shield if (spellid == SPELLID_SHAMAN_EARTHSHIELD_HEAL) then --get the information of who placed the buff into this actor @@ -2431,11 +2441,6 @@ end end - if (_is_storing_cleu) then - _current_combat_cleu_events [_current_combat_cleu_events.n] = {_tempo, _token_ids [token] or 0, who_name, alvo_name or "", spellid, amount} - _current_combat_cleu_events.n = _current_combat_cleu_events.n + 1 - end - if (is_shield) then --return spell:Add (alvo_serial, alvo_name, alvo_flags, cura_efetiva, who_name, 0, nil, overhealing, true) return spell_heal_func (spell, alvo_serial, alvo_name, alvo_flags, cura_efetiva, who_name, 0, nil, overhealing, true) @@ -2564,7 +2569,7 @@ necro_cheat_deaths[who_serial] = true end - if (isTBC or isWOTLK) then + if (isWOTLK) then if (SHAMAN_EARTHSHIELD_BUFF[spellid]) then TBC_EarthShieldCache[alvo_name] = {who_serial, who_name, who_flags} @@ -2619,7 +2624,7 @@ _detalhes.tabela_pets:Adicionar(alvo_serial, alvo_name, alvo_flags, who_serial, who_name, 0x00000417) end - if (isTBC or isWOTLK) then --buff applied + if (isWOTLK) then --buff applied if (spellid == 27162 and false) then --Judgement Of Light --which player applied the judgement of light on this mob TBC_JudgementOfLightCache[alvo_name] = {who_serial, who_name, who_flags} @@ -2856,15 +2861,6 @@ end end - --buff refresh - if (isTBC) then - if (SHAMAN_EARTHSHIELD_BUFF[spellid]) then - TBC_EarthShieldCache[alvo_name] = {who_serial, who_name, who_flags} - - elseif (spellid == SPELLID_PRIEST_POM_BUFF) then - TBC_PrayerOfMendingCache[alvo_name] = {who_serial, who_name, who_flags} - end - end ------------------------------------------------------------------------------------------------ --recording buffs @@ -2896,7 +2892,7 @@ bargastBuffs[alvo_serial] = (bargastBuffs[alvo_serial] or 0) + 1 end - if (isTBC or isWOTLK) then --buff refresh + if (isWOTLK) then --buff refresh if (spellid == 27162 and false) then --Judgement Of Light --which player applied the judgement of light on this mob TBC_JudgementOfLightCache[alvo_name] = {who_serial, who_name, who_flags} @@ -3001,23 +2997,6 @@ necro_cheat_deaths[who_serial] = nil end - if (isTBC) then - --shaman earth shield - if (SHAMAN_EARTHSHIELD_BUFF[spellid]) then - TBC_EarthShieldCache[alvo_name] = nil - end - - --druid life bloom - if (spellid == SPELLID_DRUID_LIFEBLOOM_BUFF) then - local healAmount = TBC_LifeBloomLatestHeal - if (healAmount) then - --award the heal to the buff caster name - parser:heal("SPELL_HEAL", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spellschool, healAmount, 0, 0, false, false) - TBC_LifeBloomLatestHeal = nil - end - end - end - --druid kyrian empower bounds (9.0 kyrian covenant - probably remove on 10.0) if (spellid == SPELLID_KYRIAN_DRUID and alvo_name) then druid_kyrian_bounds[alvo_name] = nil @@ -3071,7 +3050,7 @@ who_serial, who_name, who_flags = "", enemyName, 0xa48 end - if (isTBC or isWOTLK) then --buff removed + if (isWOTLK) then --buff removed if (spellid == 27162 and false) then --Judgement Of Light TBC_JudgementOfLightCache[alvo_name] = nil end @@ -5248,6 +5227,35 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:SchedulePetUpdate(1) end + local autoSwapDynamicOverallData = function(instance, inCombat) + local mainDisplayGroup, subDisplay = instance:GetDisplay() + local customDisplayAttributeId = 5 + + --entering in combat, swap to dynamic overall damage + if (inCombat) then + if (mainDisplayGroup == DETAILS_ATTRIBUTE_DAMAGE and subDisplay == DETAILS_SUBATTRIBUTE_DAMAGEDONE) then + local segment = instance:GetSegment() + if (segment == DETAILS_SEGMENTID_OVERALL) then + local dynamicOverallDataCustomID = Details222.GetCustomDisplayIDByName(Loc["STRING_CUSTOM_DYNAMICOVERAL"]) + instance:SetDisplay(segment, customDisplayAttributeId, dynamicOverallDataCustomID) + end + end + else + --leaving combat + if (mainDisplayGroup == customDisplayAttributeId) then + local dynamicOverallDataCustomID = Details222.GetCustomDisplayIDByName(Loc["STRING_CUSTOM_DYNAMICOVERAL"]) + if (subDisplay == dynamicOverallDataCustomID) then + local segment = instance:GetSegment() + if (segment == DETAILS_SEGMENTID_OVERALL) then + instance:SetDisplay(true, DETAILS_ATTRIBUTE_DAMAGE, DETAILS_SUBATTRIBUTE_DAMAGEDONE) + end + end + end + + end + end + + function _detalhes.parser_functions:PLAYER_REGEN_DISABLED(...) C_Timer.After(0, function() if (not Details.bossTargetAtPull) then @@ -5260,6 +5268,15 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end) + if (Details.auto_swap_to_dynamic_overall) then + Details:InstanceCall(autoSwapDynamicOverallData, true) + end + + Details.combat_id_global = Details.combat_id_global + 1 + _global_combat_counter = Details.combat_id_global + + trinketData = Details:GetTrinketData() + if (_detalhes.zone_type == "pvp" and not _detalhes.use_battleground_server_parser) then if (_in_combat) then _detalhes:SairDoCombate() @@ -5460,7 +5477,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function _detalhes.parser_functions:CHALLENGE_MODE_START(...) --send mythic dungeon start event - print("parser event", "CHALLENGE_MODE_START", ...) + if (_detalhes.debug) then + print("parser event", "CHALLENGE_MODE_START", ...) + end + local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() if (difficultyID == 8) then _detalhes:SendEvent("COMBAT_MYTHICDUNGEON_START") @@ -5488,6 +5508,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end + if (Details.auto_swap_to_dynamic_overall) then + Details:InstanceCall(autoSwapDynamicOverallData, false) + end + --elapsed combat time _detalhes.LatestCombatDone = GetTime() _detalhes.tabela_vigente.CombatEndedAt = GetTime() @@ -6397,7 +6421,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 for i = 1, players do local name, killingBlows, honorableKills, deaths, honorGained, faction, race, rank, class, classToken, damageDone, healingDone, bgRating, ratingChange, preMatchMMR, mmrChange, talentSpec - if (isTBC or isWOTLK) then + if (isWOTLK) then name, killingBlows, honorableKills, deaths, honorGained, faction, rank, race, class, classToken, damageDone, healingDone, bgRating, ratingChange, preMatchMMR, mmrChange, talentSpec = GetBattlefieldScore(i) else name, killingBlows, honorableKills, deaths, honorGained, faction, race, class, classToken, damageDone, healingDone, bgRating, ratingChange, preMatchMMR, mmrChange, talentSpec = GetBattlefieldScore(i) diff --git a/frames/window_all_in_one.lua b/frames/window_all_in_one.lua new file mode 100644 index 00000000..0d1b9497 --- /dev/null +++ b/frames/window_all_in_one.lua @@ -0,0 +1,552 @@ + --prĂ³ximo: ao criar uma janela AllInOne, precisa criar uma nova instancia no Details! + --na tabela de configuraĂ§Ă£o precisa dizer que Ă© uma all in one e o details vai chamar esse arquivo pra atualizar + + --(ainda aqui) parei atualizando o height da titlebar + --proximo passo: atualizar o resto das propriedade da title bar + --fazer as funcções para setar os valores na titleBar + --verificar se precisa adicionar funcções no mixin dos bottões como SetTexture, SetVertexColor + + --tem que fazer a funĂ§Ă£o de ShowWindow() e ToggleWindows() + --fazer a criaĂ§Ă£o do header e fazer o header ser redirecionado (aumentar ou diminuir o tamanho by dragging) + + local LibWindow = LibStub("LibWindow-1.1") + local df = DetailsFramework + local detailsFramework = DetailsFramework + + local textureCoords = { + show_mainmenu = {0/256, 32/256, 0, 1}, + show_segments = {32/256, 64/256, 0, 1}, + show_report = {96/256, 128/256, 0, 1}, + show_reset = {128/256, 160/256, 0, 1}, + show_displays = {66/256, 93/256, 0, 1}, + show_close = {160/256, 192/256, 0, 1}, + } + + --namespace + Details.AllInOneWindow = { + --store the frame of all AllInOne windows, this table does not same with the addon + FramesCreated = {}, + WindowsOpened = 0, + + --return a table: {{settings}, {settings}, {settings}, {settings}, ...} + GetAllSettings = function() + --setting within profile + return Details.all_in_one_windows + end, + + --return the amount of settings by calling the above function and returning the amount of indexes + GetNumSettings = function() + return #Details.AllInOneWindow.GetAllSettings() + end, + + --return which will be the next settingID if a new setting is added + GetNextSettingID = function() + return #Details.all_in_one_windows + 1 + end, + + --return the settingTable of a settingID + GetSettingsByID = function(ID) + return Details.AllInOneWindow.GetAllSettings()[ID] + end, + + --add a setting and return the settingID + AddSetting = function(newSettingTable) + local allSettings = Details.AllInOneWindow.GetAllSettings() + allSettings[#allSettings+1] = newSettingTable + return #allSettings + end, + + --frames already created on this session + GetAllFrames = function() + return Details.AllInOneWindow.FramesCreated + end, + + GetNumFrames = function() + return #Details.AllInOneWindow.GetAllFrames() + end, + + GetFrameBySettingID = function(settingId) + local numFramesCreated = Details.AllInOneWindow.GetNumFrames() + for id = 1, numFramesCreated do + local window = Details.AllInOneWindow.GetFrameByID(id) + if (window:GetSettingsID() == settingId) then + return window:GetSettings() + end + end + end, + + AddFrame = function(frame) + Details.AllInOneWindow.FramesCreated[#Details.AllInOneWindow.FramesCreated+1] = frame + return #Details.AllInOneWindow.FramesCreated+1 + end, + + GetFrameByID = function(ID) + return Details.AllInOneWindow.FramesCreated[ID] + end, + + RestoreAllWindows = function() + + end, + + ShowWindow = function(settingId) + + end, + + HideWindow = function(settingId) + assert(type(settingId) ~= "number", "Details.AllInOneWindow.HideWindow require a number on 'settingId'") + local settings = Details.AllInOneWindow.GetAllSettings() + local windowSetting = settings[settingId] + assert(type(windowSetting) ~= "table", "Details.AllInOneWindow.HideWindow settings not found for settingId: " .. settingId) + + if (windowSetting) then + if (windowSetting.isOpened) then + windowSetting.isOpened = false + --get the window being used by this setting + local window = Details.AllInOneWindow.GetFrameBySettingID(settingId) + if (window) then + window:Hide() + end + end + end + end, + + HideAllWindows = function() + local numSettings = Details.AllInOneWindow.GetNumSettings() + --table with all the settings for all AllInOne windows in the current profile + local settings = Details.AllInOneWindow.GetAllSettings() + for settingId = 1, numSettings do + local windowSetting = Details.AllInOneWindow.GetSettingsByID(settingId) + if (windowSetting.isOpened) then + Details.AllInOneWindow.HideWindow(settingId) + end + end + end, + + ToggleWindows = function() + + end, + } + + local menuButtonMixin = { + GetSettingName = function(button) + return button.settingName + end, + } + + local menuSupportFrameMixin = { + Constructor = function(menuSupportFrame) + menuSupportFrame:SetSize(1, 1) + menuSupportFrame.allButtons = {} + + menuSupportFrame:CreateMenuButton("CloseMenu", "show_close") + menuSupportFrame:CreateMenuButton("MainMenu", "show_mainmenu") + menuSupportFrame:CreateMenuButton("SegmentsMenu", "show_segments") + menuSupportFrame:CreateMenuButton("DisplaysMenu", "show_report") + menuSupportFrame:CreateMenuButton("ReportMenu", "show_reset") + menuSupportFrame:CreateMenuButton("ResetMenu", "show_displays") + end, + + GetNumButtons = function(supportFrame) + return #supportFrame.allButtons + end, + + GetButtonByIndex = function(supportFrame, buttonIndex) + return supportFrame.allButtons[buttonIndex] + end, + + CreateMenuButton = function(supportFrame, name, settingName) + local newButton = CreateFrame("button", "$parent" .. name, supportFrame) + newButton:SetSize(20, 20) + newButton:SetScale(1) + supportFrame.allButtons[#supportFrame.allButtons+1] = newButton + df:Mixin(newButton, menuButtonMixin) + newButton.settingName = settingName + return newButton + end, + + Refresh = function(supportFrame) + local window = supportFrame:GetParent():GetParent() + --problem: it is getting the settings from the AllInOneWindow settings, it should get from Details! default window settings + --this settings should return the regular window setting from Details! on _detalhes.tabela_instancias[windowId] + local settings = window:GetSettings().titlebar.menu_buttons + + supportFrame:ClearAllPoints() + supportFrame:SetSize(1, 1) + supportFrame:SetScale(settings.scale) + supportFrame:SetAlpha(settings.alpha) + + --buttons currently allowed to show by the user settings + local allShownButtons = {} + for i = 1, supportFrame:GetNumButtons() do + local button = supportFrame:GetButtonByIndex(i) + if (settings[button:GetSettingName()]) then + allShownButtons[#allShownButtons+1] = button + button:Show() + df:SetRegularButtonTexture(button, settings.texture_file, textureCoords[button:GetSettingName()]) + df:SetRegularButtonVertexColor(button, settings.color) + else + button:Hide() + end + end + + --hardcoded to place the menu buttons in the left side of the window + --if needed this can be "right" with the header leave space for it + local attachPoint = "left" + + if (settings.alignment == "horizontal") then + --make it attach to the left side of the title bar or the right side of the title bar + supportFrame:SetPoint(attachPoint, window.TitleBar, attachPoint, settings.x_offset, settings.y_offset) + + local paddingAmount = attachPoint == "left" and settings.padding or (settings.padding * -1) + for i = 1, #allShownButtons do + local button = allShownButtons[i] + if (i ==1) then + button:SetPoint(attachPoint, supportFrame, attachPoint, 0, 0) + else + local previousButton = allShownButtons[i - 1] + local sideToAttach = attachPoint == "left" and "right" or "left" + button:SetPoint(attachPoint, previousButton, sideToAttach, paddingAmount, 0) + end + end + + elseif (settings.alignment == "vertical") then + if (attachPoint == "left") then + supportFrame:SetPoint("topright", window.TitleBar, "topleft", settings.x_offset, settings.y_offset) + else + supportFrame:SetPoint("topleft", window.TitleBar, "topright", settings.x_offset, settings.y_offset) + end + + --here left == top to bottom | right = bottom to top + local paddingAmount = attachPoint == "left" and settings.padding or (settings.padding * -1) + local attachTo = attachPoint == "left" and "top" or "bottom" + for i = 1, #allShownButtons do + local button = allShownButtons[i] + if (i ==1) then + button:SetPoint(attachTo, supportFrame, attachTo, 0, 0) + else + local previousButton = allShownButtons[i - 1] + local sideToAttach = attachTo == "left" and "bottom" or "top" + button:SetPoint(attachTo, previousButton, sideToAttach, paddingAmount, 0) + end + end + end + end, + } + + local titleBarMixin = { + --run when the title bar is created + Constructor = function(titleBar) + titleBar:EnableMouse(false) + + --create support frame for control buttons, it also will create the control buttons as children + titleBar:CreateMenuSupportFrame() + + --create the elapsed time string + titleBar:CreateCombatTimeString() + titleBar:SetCombatTimeText("02:36") --debug + end, + + GetSettings = function(titleBar) + --get the settings from the main window + return titleBar:GetParent():GetSettings() + end, + + SetSetting = function() + --this function exists and get overriden by the SetSetting of the window mixin + end, + + SetTitleBarHeight = function(titleBar, height) + assert(type(height) == "number", "Invalid height, usage: TitleBar:SetTitleBarHeight(height)") + titleBar:SetHeight(height) + titleBar:SetSetting(height, "titlebar", "height") + titleBar:Refresh() + end, + + SetTitleBarTextSize = function(window, size) + if (not size or type(size) ~= "number") then + return + end + df:SetFontSize(window.TitleBar.CombatTime, size) + + end, + + SetTitleBarTextColor = function(window, color) + local r, g, b, a = df:ParseColor(color) + df:SetFontColor(window.TitleBar.CombatTime, r, g, b, a) + end, + + SetTitleBarTextFont = function(window, font) + + end, + + SetTitleBarTextOutline = function(window, outline) + + end, + + SetTitleBarTextShadow = function(window, shadow, xOffset, yOffset) + + end, + + CreateCombatTimeString = function(titleBar) + local combatTimeString = titleBar:CreateFontString("$parentCombatTime", "overlay", "GameFontNormal") + titleBar.CombatTime = combatTimeString + return titleBar.CombatTime + end, + + GetCombatTimeString = function(titleBar) + return titleBar.CombatTime + end, + + SetCombatTimeText = function(titleBar, combatTime) + local combatTimeString = titleBar:GetCombatTimeString() + if (type(combatTime) == "string") then + combatTimeString:SetText(combatTime) + + elseif (type(combatTime) == "number") then + local timeAsString = DetailsFramework:IntegerToTimer(combatTime) + combatTimeString:SetText(timeAsString) + else + --if no valid time passed, clear the timer + combatTimeString:SetText("") + end + end, + + Refresh = function(titleBar) + local config = titleBar:GetSettings() + + --height + local height = config.titlebar.height + titleBar:SetHeight(height) + + local timerShown = config.timer_show + + local menuSupportFrame = titleBar:GetMenuSupportFrame() + menuSupportFrame:Update() + + --[=[ + --height = 20, + timer_show = true, + timer_ignore_openworld = true, + timer_only_encounters = false, + + text_size = 10, + text_font = "Friz Quadrata TT", + text_outline = "NONE", + text_shadow = { + enabled = false, + color = {1, 1, 1, 1}, + x_offset = 1, + y_offset = -1, + }, + --]=] + + end, + + GetMenuSupportFrame = function(titleBar) + return titleBar.MenuSupportFrame + end, + + --menu support frame is the frame which will parent the menu buttons (cogwheel, segments, report button, etc) + CreateMenuSupportFrame = function(titleBar) + local menuSupportFrame = CreateFrame("frame", "$parentMenuSupportFrame", titleBar, "BackdropTemplate") + titleBar.MenuSupportFrame = menuSupportFrame + detailsFramework:Mixin(menuSupportFrame, menuSupportFrameMixin) + menuSupportFrame:Constructor() + return menuSupportFrame + end, + + } + + local AllInOneWindowMixin = { + SetSetting = function(window, value, ...) + local config = window:GetSettings() + local currentTable = config + local lastKey = "" + for index, key in ipairs({...}) do + if (type(currentTable[key]) == "table") then + currentTable = currentTable[value] + else + lastKey = key + end + end + currentTable[lastKey] = value + end, + + IsOpened = function(window) + return Details.AllInOneWindow.GetSettingsByID(window:GetSettingsID()).isOpened + end, + + SetWindowSize = function(self, width, height) + + end, + + GetSettings = function(window) + return window.settings + end, + + SetSettingID = function(window, newSettingId) + assert(type(newSettingId) ~= "number", "window.SetSettingID require a number on 'newSettingId'") + local settings = Details.AllInOneWindow.GetSettingsByID(newSettingId) + if (settings) then + window.id = newSettingId + window.settings = settings + else + error("window.SetSettingID could not find a settings for ID " .. newSettingId) + end + end, + + GetSettingsID = function(window) + return window.id + end, + + CreateTitleBar = function(window) + local titleBar = CreateFrame("frame", "$parentTitleBar", window, "BackdropTemplate") + window.TitleBar = titleBar + df:Mixin(titleBar, titleBarMixin) + titleBar:Constructor() + return titleBar + end, + + GetTitleBar = function(window) + return window.TitleBar + end, + + Refresh = function(window) + local settingsId = window:GetSettingsID() + local settings = window:GetSettings() + + if (not settings.isOpened) then + window:Hide() + return + end + + local titleBar = window:GetTitleBar() + titleBar:Refresh() + end, + } + + --override + titleBarMixin.SetSetting = AllInOneWindowMixin.SetSetting + + local defaultWindowSettings = { + isOpened = true, + + libwindow = {}, + width = 350, -- + height = 150, -- + + titlebar = { + --done here: all options can be retrived from details! settings + menu_buttons = {}, + + }, + + } + + --create only the frame for a new window ~newwindow ñewwindow + function Details.AllInOneWindow.CreateFrame(settingId) + --create the new window + local newWindowFrame = CreateFrame("frame", "DetailsNewWindow" .. settingId, UIParent, "BackdropTemplate") + newWindowFrame.id = settingId + df:Mixin(newWindowFrame, AllInOneWindowMixin) + + newWindowFrame:SetPoint("center", UIParent, "center", -400, 0) + + --create the title bar + newWindowFrame:CreateTitleBar() + + --creare header + + + + --create scroll bar + + + + --create resizers + + + + --add the frame to the frame pool + local frameId = Details.AllInOneWindow.AddFrame(newWindowFrame) + return newWindowFrame + end + + --[=[ + lib window need to be on the AllInOneWindow:Update() so it can register the new libwindow table on profile change + --register on libwindow + LibWindow.RegisterConfig(newWindow, windowSettings.libwindow) + LibWindow.RestorePosition(newWindow) + LibWindow.MakeDraggable(newWindow) + + --set the size using the settings + newWindow:SetSize(windowSettings.width, windowSettings.height) + + --rnable mouse for click through + newWindow:EnableMouse(true) + --setmovable for locked + newWindow:SetMovable(true) + + --title bar position (default on top) + titleBar:SetPoint("topleft", newWindow, "topleft", 0, 0) + titleBar:SetPoint("topright", newWindow, "topright", 0, 0) + --title bar height + titleBar:SetHeight(20) + + --combat time position + combatTimeString:SetPoint("left", titleBar, "left", 2, 0) + --]=] + + --create the settings for a new window plus the frames + function Details:CreateNewAllInOneWindow() + --get profile settings + local profileSettings = Details:GetSettingsForAll_AllInOneWindows() + + --get what is the ID if a new window is added + local nextSettingId = Details.AllInOneWindow.GetNextSettingID() + + --copy the settings prototype + local windowSettings = df.table.deploy({}, defaultWindowSettings) + --add the new settings table into the profile where the new window settings are stored + local settingId = Details.AllInOneWindow.AddSetting(windowSettings) + + --create window body + local windowFrame = Details.AllInOneWindow.CreateFrame(settingId) + + return windowFrame + end + + --assuming this will run when the profile is loaded + + + --used when a profile finished loading + --CURRENT THE ONLY ENTRY POINT + function Details.AllInOneWindow.ReloadAll() + --get the amount of settings + local numSettings = Details.AllInOneWindow.GetNumSettings() + + --table with all window frames already created on this session + local framesCreated = Details.AllInOneWindow.GetAllFrames() + --next frame to be used + local frameIndex = 1 + + for settingId = 1, numSettings do + local windowSetting = Details.AllInOneWindow.GetSettingsByID(settingId) + if (windowSetting.isOpened) then + local windowFrame = framesCreated[frameIndex] + if (not windowFrame) then + windowFrame = Details.AllInOneWindow.CreateFrame(settingId) + end + frameIndex = frameIndex + 1 + windowFrame:SetSettingID(settingId) + --setup the frame using the settings + windowFrame:Refresh() + end + end + end + + + + + + diff --git a/frames/window_aura_tracker.lua b/frames/window_aura_tracker.lua index 0ab460db..7bacc2b9 100644 --- a/frames/window_aura_tracker.lua +++ b/frames/window_aura_tracker.lua @@ -147,7 +147,7 @@ function Details.AuraTracker.CreatePanel() local statusBar = DetailsFramework:CreateStatusBar(auraTrackerFrame) statusBar.text = statusBar:CreateFontString(nil, "overlay", "GameFontNormal") statusBar.text:SetPoint("left", statusBar, "left", 5, 0) - statusBar.text:SetText("Details! Damage Meter") + statusBar.text:SetText("By Terciob | Part of Details! Damage Meter") DetailsFramework:SetFontSize(statusBar.text, 11) DetailsFramework:SetFontColor(statusBar.text, "gray") @@ -156,8 +156,8 @@ function Details.AuraTracker.CreatePanel() {text = "", width = 20}, {text = "Aura Name", width = 162}, {text = "Spell Id", width = 100}, - {text = "Lua Table", width = 250}, - {text = "Points", width = 100}, + {text = "Lua Table", width = 200}, + {text = "Payload (Points)", width = 296}, } local headerOptions = { padding = 2, @@ -260,6 +260,9 @@ local formatToLuaTable = { end, } +--if you need your own table format, override the function below as: function(auraInfo) return "" end +--[[GLOBAL]] DETAILS_AURATRACKER_LUATABLE_FUNC = nil + --[371354] = {[131] = 1, [151] = 2, [174] = 3, [1] = 131, [2] = 151, [3] = 174}, --Phial of the Eye in the Storm function Details.AuraTracker.RefreshScroll(self, data, offset, totalLines) @@ -273,8 +276,13 @@ function Details.AuraTracker.RefreshScroll(self, data, offset, totalLines) line.Icon.texture = auraInfo.icon line.Name.text = auraInfo.name line.SpellId.text = auraInfo.spellId - line.LuaTableEntry.text = formatToLuaTable.doFormat5(auraInfo) --doFormat2NoIndex - line.Points.text = formatToLuaTable.doFormat2NoIndexFromCache(auraInfo) + local globalfunc = DETAILS_AURATRACKER_LUATABLE_FUNC + line.LuaTableEntry.text = globalfunc and globalfunc(auraInfo) or formatToLuaTable.doFormat2NoIndex(auraInfo) --doFormat2NoIndex + line.Points.text = formatToLuaTable.doFormat5(auraInfo) + + line.Name:SetCursorPosition(0) + line.LuaTableEntry:SetCursorPosition(0) + line.Points:SetCursorPosition(0) end end end diff --git a/frames/window_cdtracker.lua b/frames/window_cdtracker.lua index 1d4599ab..0d6d4551 100644 --- a/frames/window_cdtracker.lua +++ b/frames/window_cdtracker.lua @@ -5,13 +5,20 @@ local DF = _G.DetailsFramework local openRaidLib = LibStub:GetLibrary("LibOpenRaid-1.0", true) --namespace -Details.CooldownTracking = {} +Details.CooldownTracking = { + cooldownPanels = {}, +} ---return if the cooldown tracker is enabled +--return truen if the cooldown tracker is enabled function Details.CooldownTracking.IsEnabled() return Details.ocd_tracker.enabled end +--return a hash table with all cooldown panels created [filterName] = Frame +function Details.CooldownTracking.GetAllPanels() + return Details.CooldownTracking.cooldownPanels +end + --enable the cooldown tracker function Details.CooldownTracking.EnableTracker() Details.ocd_tracker.enabled = true @@ -31,8 +38,9 @@ function Details.CooldownTracking.DisableTracker() Details.ocd_tracker.enabled = false --hide the panel - if (DetailsOnlineCDTrackerScreenPanel) then - DetailsOnlineCDTrackerScreenPanel:Hide() + local allPanels = Details.CooldownTracking.GetAllPanels() + for filterName, frameObject in pairs(allPanels) do + frameObject:Hide() end --unregister callbacks @@ -59,7 +67,13 @@ end --@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 + --TODO: make a function inside lib open raid to get the filters the cooldown is in + --I dont known which panel will be used + --need to get the filter name which that spell belong + --and then check if that filter is enabled + local allPanels = Details.CooldownTracking.GetAllPanels() + + local screenPanel = allPanels["main"] --this should be replaced with the cooldown panel local gotUpdated = false local unitName = GetUnitName(unitId, true) @@ -102,8 +116,10 @@ end --Frames --hide all bars created - function Details.CooldownTracking.HideAllBars() - for _, bar in ipairs(DetailsOnlineCDTrackerScreenPanel.bars) do + function Details.CooldownTracking.HideAllBars(filterName) + filterName = filterName or "main" + local allPanels = Details.CooldownTracking.GetAllPanels() + for _, bar in ipairs(allPanels[filterName].bars) do bar:ClearAllPoints() bar:Hide() @@ -126,49 +142,56 @@ end return cooldownFrame end + local eventFrame = CreateFrame("frame") + eventFrame:RegisterEvent("GROUP_ROSTER_UPDATE") + eventFrame:SetScript("OnShow", function() + eventFrame:RegisterEvent("GROUP_ROSTER_UPDATE") + end) + + eventFrame:SetScript("OnHide", function() + eventFrame:UnregisterEvent("GROUP_ROSTER_UPDATE") + end) + + eventFrame:SetScript("OnEvent", function(self, event) + if (event == "GROUP_ROSTER_UPDATE") then + if (eventFrame.scheduleRosterUpdate) then + return + end + eventFrame.scheduleRosterUpdate = C_Timer.NewTimer(1, Details.CooldownTracking.RefreshCooldownFrames) + end + end) + --create the screen panel, goes into the UIParent and show cooldowns - function Details.CooldownTracking.CreateScreenFrame() - DetailsOnlineCDTrackerScreenPanel = CreateFrame("frame", "DetailsOnlineCDTrackerScreenPanel", UIParent, "BackdropTemplate") - local screenPanel = DetailsOnlineCDTrackerScreenPanel - screenPanel:Hide() - 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) - screenPanel:SetBackdropBorderColor(0, 0, 0, .3) - screenPanel:EnableMouse(true) + function Details.CooldownTracking.CreateScreenFrame(filterName) + filterName = filterName or "main" + local frameName = "DetailsOnlineCDTrackerScreenPanel" .. filterName + local cooldownPanel = CreateFrame("frame", frameName, UIParent, "BackdropTemplate") + cooldownPanel:Hide() + cooldownPanel:SetSize(Details.ocd_tracker.width, Details.ocd_tracker.height) + cooldownPanel:SetPoint("center", 0, 0) + DetailsFramework:ApplyStandardBackdrop(cooldownPanel) + cooldownPanel:EnableMouse(true) --register on libwindow local libWindow = LibStub("LibWindow-1.1") - libWindow.RegisterConfig(screenPanel, _detalhes.ocd_tracker.pos) - libWindow.MakeDraggable(screenPanel) - libWindow.RestorePosition(screenPanel) + Details.ocd_tracker.frames[filterName] = Details.ocd_tracker.frames[filterName] or {} + libWindow.RegisterConfig(cooldownPanel, Details.ocd_tracker.frames[filterName]) + libWindow.MakeDraggable(cooldownPanel) + libWindow.RestorePosition(cooldownPanel) - screenPanel:RegisterEvent("GROUP_ROSTER_UPDATE") - screenPanel:SetScript("OnShow", function() - screenPanel:RegisterEvent("GROUP_ROSTER_UPDATE") - end) - screenPanel:SetScript("OnHide", function() - screenPanel:UnregisterEvent("GROUP_ROSTER_UPDATE") - end) + cooldownPanel.bars = {} + cooldownPanel.cooldownCache = Details.ocd_tracker.current_cooldowns + cooldownPanel.playerCache = {} + cooldownPanel.statusBarFrameIndex = 1 - screenPanel:SetScript("OnEvent", function(self, event) - if (event == "GROUP_ROSTER_UPDATE") then - if (screenPanel.scheduleRosterUpdate) then - return - end - screenPanel.scheduleRosterUpdate = C_Timer.NewTimer(1, Details.CooldownTracking.RefreshCooldownFrames) - end - end) + local allPanels = Details.CooldownTracking.GetAllPanels() + allPanels[filterName] = cooldownPanel - screenPanel.bars = {} - screenPanel.cooldownCache = Details.ocd_tracker.current_cooldowns - screenPanel.playerCache = {} - screenPanel.statusBarFrameIndex = 1 - - return screenPanel + return cooldownPanel end + + function Details.CooldownTracking.SetupCooldownFrame(cooldownFrame) local spellIcon = GetSpellTexture(cooldownFrame.spellId) if (spellIcon) then @@ -184,8 +207,10 @@ end function Details.CooldownTracking.ProcessUnitCooldowns(unitId, unitCooldowns, cooldownsOrganized) if (unitCooldowns) then local unitInfo = openRaidLib.GetUnitInfo(unitId) + local filterName = false if (unitInfo) then - local screenPanel = DetailsOnlineCDTrackerScreenPanel + local allPanels = Details.CooldownTracking.GetAllPanels() + local screenPanel = allPanels[filterName or "main"] for spellId, cooldownInfo in pairs(unitCooldowns) do --get a bar local cooldownFrame = Details.CooldownTracking.GetOrCreateNewCooldownFrame(screenPanel, screenPanel.statusBarFrameIndex) @@ -212,8 +237,9 @@ end end --update cooldown frames based on the amount of players in the group or raid - function Details.CooldownTracking.RefreshCooldownFrames() - local screenPanel = DetailsOnlineCDTrackerScreenPanel + function Details.CooldownTracking.RefreshCooldownFrames(filterName) + local allPanels = Details.CooldownTracking.GetAllPanels() + local screenPanel = allPanels[filterName or "main"] if (not screenPanel) then screenPanel = Details.CooldownTracking.CreateScreenFrame() @@ -537,7 +563,8 @@ end } - DF:BuildMenu(f, generalOptions, 5, -30, 150, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template) + generalOptions.always_boxfirst = true + DF:BuildMenu(f, generalOptions, 5, -30, 150, false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template) --cooldown selection local cooldownProfile = Details.ocd_tracker.cooldowns diff --git a/frames/window_main.lua b/frames/window_main.lua index efc7aea5..6f62f787 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -28,6 +28,9 @@ local IsInInstance = _G.IsInInstance local tokFunctions = Details.ToKFunctions +local _, Details222 = ... +_ = nil + --constants local baseframe_strata = "LOW" local defaultBackdropSt = { @@ -7933,7 +7936,10 @@ function Details:RefreshTitleBarText() if (instanceMode == DETAILS_MODE_GROUP or instanceMode == DETAILS_MODE_ALL) then local segment = self:GetSegment() if (segment == DETAILS_SEGMENTID_OVERALL) then - sName = sName .. " " .. Loc["STRING_OVERALL"] + local dynamicOverallDataCustomID = Details222.GetCustomDisplayIDByName(Loc["STRING_CUSTOM_DYNAMICOVERAL"]) + if ((dynamicOverallDataCustomID ~= self.sub_atributo) and self.atributo ~= 5) then + sName = sName .. " " .. Loc["STRING_OVERALL"] + end elseif (segment >= 2) then sName = sName .. " [" .. segment .. "]" diff --git a/frames/window_news.lua b/frames/window_news.lua index 5615ff2c..3c16c1e6 100644 --- a/frames/window_news.lua +++ b/frames/window_news.lua @@ -2,12 +2,17 @@ local Details = _G.Details local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" ) local gump = Details.gump -local _ +local _, Details222 = ... +_ = nil function Details:OpenNewsWindow(textToShow, dumpValues, keeptext) Details.latest_news_saw = Details.userversion local newsFrame = Details:CreateOrOpenNewsWindow() + local animationHub = DetailsFramework:CreateAnimationHub(newsFrame) + local fadeInAnim1 = DetailsFramework:CreateAnimation(animationHub, "alpha", 1, 0.2, 0, 0.2) + local fadeInAnim2 = DetailsFramework:CreateAnimation(animationHub, "alpha", 2, 1.5, 0.5, 1) + fadeInAnim2:SetStartDelay(1.3) if (dumpValues == "change_log" or textToShow == "LeftButton") then newsFrame:Text (Loc ["STRING_VERSION_LOG"]) @@ -57,6 +62,7 @@ function Details:OpenNewsWindow(textToShow, dumpValues, keeptext) end newsFrame:Show() + animationHub:Play() end function Details:CreateOrOpenNewsWindow() diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index e3acbe43..744d9ca4 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -33,9 +33,9 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") local SharedMedia = _G.LibStub:GetLibrary("LibSharedMedia-3.0") local LDB = _G.LibStub("LibDataBroker-1.1", true) local LDBIcon = LDB and _G.LibStub("LibDBIcon-1.0", true) -local _ +local addonName, Details222 = ... +local _ = nil local unpack = _G.unpack - local tinsert = _G.tinsert local startX = 200 @@ -518,6 +518,17 @@ do desc = Loc ["STRING_OPTIONS_OVERALL_LOGOFF_DESC"], boxfirst = true, }, + {--auto switch to dynamic overall data when selecting overall data + type = "toggle", + get = function() return _detalhes.auto_swap_to_dynamic_overall end, + set = function(self, fixedparam, value) + Details.auto_swap_to_dynamic_overall = value + afterUpdate() + end, + name = "Use Dynamic Overall Damage", + desc = "When showing Damage Done Overall, swap to Dynamic Overall Damage on entering combat.", + boxfirst = true, + }, {type = "blank"}, diff --git a/frames/window_playerbreakdown_charts b/frames/window_playerbreakdown_charts new file mode 100644 index 00000000..803a12a3 --- /dev/null +++ b/frames/window_playerbreakdown_charts @@ -0,0 +1,523 @@ + +--whenever it say 'CombatID' it is referencing the Details! unique combatId +--whenever it say 'SegmentID' it is referencing the internal chart data registered for some details! combat + +local Details = _G.Details +local detailsFramework = _G.DetailsFramework +local addonName, detailsInternal = ... + +local CONST_LATEST_SEGMENT = 1 + +local tinsert = table.insert +local tremove = table.remove + +local CONST_TICKER_NAME = "ChartDataTicker" +local CONST_TICKER_INTERVAL = 3 + +--create the chart object +detailsInternal.Charts = {} +local chartsObject = detailsInternal.Charts + +--store all segments data +chartsObject.SegmentsData = {} +--current segment being displayed in the charts +chartsObject.SegmentOnVisualization = 0 + +--this table will hold the saved variable which tells which infomation to get during combat +chartsObject.DataToCapture = {} + +function chartsObject.GetConfigToCaptureData() + return chartsObject.DataToCapture +end + +function chartsObject.SetConfigToCaptureData(configTable) + chartsObject.DataToCapture = configTable +end + +function chartsObject.GetSavedVariable() + return Details.data_harvested_for_charts +end + +function chartsObject.StoreChartsForCurrentCombat() + local savedVariableTable = chartsObject.GetSavedVariable() + + --Details.data_harvested_for_charts +end + +function chartsObject.BuildPlayersTable(playersTable) + if (IsInRaid()) then + for i = 1, GetNumGroupMembers() do + local unitName = GetUnitName("raid" .. i, true) + playersTable[unitName] = {} + end + + elseif (InIsParty()) then + for i = 1, GetNumGroupMembers() - 1 do + local unitName = GetUnitName("party" .. i, true) + playersTable[unitName] = {} + end + playersTable[UnitName("player")] = {} + else + playersTable[UnitName("player")] = {} + end +end + +function chartsObject.CreateTableToReceiveChartData() + local t = {} + + --get the list of players captures + local configsForCaptureData = chartsObject.GetConfigToCaptureData() + + --data set to capture data of each individual player + local playerCaptures = configsForCaptureData.players + --data set to capture data of some combat attribute or totals + local combatTotalCaptures = configsForCaptureData.totals + + if (#playerCaptures > 0) then + t.players = {} + for i = 1, #playerCaptures do + local capturePreset = playerCaptures[i] + local playersTable = {} + t.players[capturePreset.name] = playersTable + chartsObject.BuildPlayersTable(playersTable) + end + end + + if (#combatTotalCaptures > 0) then + t.totals = {} + for i = 1, #combatTotalCaptures do + local capturePreset = combatTotalCaptures[i] + t.totals[capturePreset.name] = {} + end + end + + return t +end + +--function to grab data during combat +function chartsObject.Ticker() + if (chartsObject.HasValidAndOpenCombat()) then + --get Details! combat object + local detaisCurrentCombat = Details:GetCurrentCombat() + + --get the list of players captures + local configsForCaptureData = chartsObject.GetConfigToCaptureData() + + --data set to capture data of each individual player + local playerCaptures = configsForCaptureData.players + --data set to capture data of some combat attribute or totals + local combatTotalCaptures = configsForCaptureData.totals + + local currentSegmentData = chartsObject.GetCurrentSegmentData() + local chartData = currentSegmentData.ChartData + + if (#playerCaptures > 0) then + --PAREI AQUI, PRECISA PEGAR O CAPTURE NAME, A TABELA COM OS NOMES DOS JOGADORES E PEGAR OS DADOS DO SEGMENTO DO DETAILS! + --DEPOIS TEM QUE FECHAR ISSO AQUI E GRAGAR NO SEGMENT DA CHART + --DEPOIS FAZER O MENU DE SELECIONAR O SEGMENTO MOSTRAR OS SEGMENTOS DO DETAILS PARA SELECIONAR + --POR FIM PROGRAMAR AS CHARTS PRA MOSTRAR OS GRAFICOS + for i = 1, #playerCaptures do + local capturePreset = playerCaptures[i] + local thisCaptureTable = chartData[capturePreset.Name] + t.players[capturePreset.name] = playersTable + chartsObject.BuildPlayersTable(playersTable) + end + end + + if (#combatTotalCaptures > 0) then + t.totals = {} + for i = 1, #combatTotalCaptures do + local capturePreset = combatTotalCaptures[i] + t.totals[capturePreset.name] = {} + end + end + + for i = 1, #playerCaptures do + local capturePreset = playerCaptures[i] + if (capturePreset.combatObjectSubTable) then + local subTable = detaisCurrentCombat[capturePreset.combatObjectSubTableName] + local value = subTable[capturePreset.combatObjectSubTableKey] + + end + end + end +end + +--[=[]] + players = { + --damage done by each player + { + name = "Damage of Each Individual Player", + combatObjectContainer = 1, + playerOnly = true, + playerKey = "total", + }, + + --total damage done by the raid group + { + name = "Damage of All Player Combined", + combatObjectSubTableName = "totals", + combatObjectSubTableKey = 1, + }, + }, +--]=] + +function chartsObject.GetConfigToDataCaptureFromDetailsOptions() + local detailsObject = Details + local configTable = detailsObject.data_harvest_for_charsts + chartsObject.SetConfigToCaptureData(configTable) +end + +function chartsObject.StartCombatDataTicker() + detailsInternal.Scheduler.NewTicker(CONST_TICKER_INTERVAL, chartsObject.Ticker, CONST_TICKER_NAME) +end + +function chartsObject.StopCombatDataTicker() + detailsInternal.Scheduler.Cancel(CONST_TICKER_NAME) +end + +--get a segment combat data +function chartsObject.GetSegmentsCombatData(combatIndex) + return chartsObject.SegmentsData[combatIndex] +end + +--get a segment combat data by Details! combatId +function chartsObject.GetSegmentCombatDataByDetailsCombatID(detailsCombatId) + for i = 1, chartsObject.GetNumSegments() do + local thisSegmentCombatData = chartsObject.SegmentsData[i] + if (thisSegmentCombatData.detailsCombatID == detailsCombatId) then + return thisSegmentCombatData + end + end +end + +--select a combat to make the chart frames show +function chartsObject.SelectSegmentDataToShow(segmentId) + segmentId = segmentId or CONST_LATEST_SEGMENT + local numSegments = chartsObject.GetNumSegments() + if (numSegments > 0) then + --pre step before calling the function which will signal the frame to update + chartsObject.ChartFramesShowSegment(CONST_LATEST_SEGMENT) + else + chartsObject.ChartFramesClear() + end +end + +function chartsObject.ChartFramesClear() + --pre step before calling the function which will signal the frame to update + chartsObject.ChartFramesShowSegment(0) +end + +--this function shouldn't be called directly, always call from SelectSegmentDataToShow or ChartFramesClear +function chartsObject.ChartFramesShowSegment(segmentId) + --set the combat data into the charts + chartsObject.SegmentOnVisualization = segmentId + --here go into the frames created and call refresh using the segment data + + local segmentCombatData = chartsObject.GetSegmentsCombatData(segmentId) + if (segmentCombatData) then + --this is the lowest function and will call the frame api to refresh the data + else + chartsObject.SegmentOnVisualization = 0 + --this is the lowest function and will call the frame api to refresh the data + end +end + +--called when Details! reset the data +function chartsObject.ResetSegmentData() + wipe(chartsObject.SegmentsData) + + --stop the ticker + chartsObject.StopCombatDataTicker() + --don't allow anything to be process under the start of a new combat + chartsObject.SetCombatState(false) + --signal the frames to update and shown no data + chartsObject.ChartFramesClear() +end + +--set the combat state +function chartsObject.SetCombatState(state) + chartsObject.InCombat = state +end + +function chartsObject.HasValidAndOpenCombat() + local bCombatState = chartsObject.GetCombatState() + if (bCombatState) then + local detaisCurrentCombat = Details:GetCurrentCombat() + local chartCurrentSegmentData = chartsObject.GetCurrentSegmentData() + if (detaisCurrentCombat:GetCombatId() == chartCurrentSegmentData:GetCombatId()) then + --it's all good + return true + end + end +end + +--return true if in combat +function chartsObject.GetCombatState() + return chartsObject.InCombat +end + +function chartsObject.RemoveSegmentData(segmentId) + tremove(chartsObject.SegmentsData, segmentId) + chartsObject.SelectSegmentDataToShow(CONST_LATEST_SEGMENT) +end + +function chartsObject.GetNumSegments() + return #chartsObject.SegmentsData +end + +function chartsObject.GetCurrentSegmentData() + return chartsObject.segmentData +end + +--add the new combatData into the first index +local segmentDataMixin = { + GetCombatId = function(self) + return self.detailsCombatID + end, +} + +--this is called when the player enter in combat +function chartsObject.CreateNewSegmentData(detailsCombatObject) + chartsObject.segmentData = { + --players Damage for the segment + PlayersDamage = {}, + --players Healing for the segment + PlayersHealing = {}, + --each index is a boss fight + BossTryDamage = 0, + --blood lust timer + BloodLustTimers = {}, + --combatId + detailsCombatID = detailsCombatObject:GetCombatId(), + --charts data captured + ChartData = chartsObject.CreateTableToReceiveChartData(), + } + + detailsFramework:Mixin(chartsObject.segmentData, segmentDataMixin) + tinsert(chartsObject.SegmentsData, 1, chartsObject.segmentData) + + chartsObject.GetConfigToDataCaptureFromDetailsOptions() + chartsObject.SetCombatState(true) + chartsObject.StartCombatDataTicker() + + return chartsObject.segmentData +end + +--when a combat is finished, close and store the current combatData +function chartsObject.CloseSegmentData(bIsInvalid) + --in case a combat_invalid passed by here first + if (not chartsObject.GetCombatState()) then + return + end + + chartsObject.StopCombatDataTicker() + chartsObject.SetCombatState(false) + + local currentCombat = chartsObject.GetSegmentsCombatData(1) + currentCombat.Done = true + + if (bIsInvalid) then + currentCombat.Invalid = true + chartsObject.RemoveSegmentData(1) + else + --check if the window is opened and update the chart current in sight + end +end + +--Details Events: +function chartsObject.OnDetailsEvent(event, ...) + if (event == "COMBAT_PLAYER_ENTER") then --> combat started + local combatObject = select(1, ...) + if (not combatObject and Details) then + combatObject = Details:GetCurrentCombat() + if (not combatObject) then + return + end + end + chartsObject.CreateNewSegmentData(combatObject) + + elseif (event == "COMBAT_PLAYER_LEAVE") then + chartsObject.CloseSegmentData() + + elseif (event == "DETAILS_DATA_RESET") then + chartsObject.ResetSegmentData() + + elseif (event == "COMBAT_INVALID") then + local bIsInvalid = true + chartsObject.CloseSegmentData(bIsInvalid) + + elseif (event == "DETAILS_STARTED") then + --install the new tab on the Player Breakdown + chartsObject.InstallTab() + end +end + + +local eventListener = Details:CreateEventListener() +eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", chartsObject.OnDetailsEvent) +eventListener:RegisterEvent("COMBAT_PLAYER_LEAVE", chartsObject.OnDetailsEvent) +eventListener:RegisterEvent("DETAILS_DATA_RESET", chartsObject.OnDetailsEvent) +eventListener:RegisterEvent("COMBAT_INVALID", chartsObject.OnDetailsEvent) +eventListener:RegisterEvent("DETAILS_STARTED", chartsObject.OnDetailsEvent) + +function chartsObject.InstallTab() + local tabName = "Charts" + local tabNameLoc = "Damage Charts" + + local canShowTab = function(tabOBject, playerObject) + local combatObject = Details:GetCombatFromBreakdownWindow() + if (combatObject) then + local chartsCombatData = chartsObject.GetSegmentCombatDataByDetailsCombatID(combatObject:GetCombatId()) + if (chartsCombatData) then + return true + end + end + return false + end + + local fillTab = function(tab, playerObject, combat) + --update the tab frame with information + + end + + local createdChartsTab = function(tab, frame) + chartsObject.CreateChartFrames(tab, frame) + end + + local iconSettings = { + texture = [[Interface\BUTTONS\UI-GuildButton-OfficerNote-Disabled]], + coords = {0, 1, 0, 1}, + width = 16, + height = 16, + } + + Details:CreatePlayerDetailsTab(tabName, tabNameLoc, canShowTab, fillTab, nil, createdChartsTab, iconSettings) +end + + +function chartsObject.CreateChartFrames(tab, tabFrame) + + --First Option: each player dps chart on each segment, this show the evolution of damage of each player + --Second Option: Total Damage Done by the entire raid comparing with other segments (one line of raid damage per segment) + --Thrid Option: your damage compared with other of the same class (chart damage of each player required) + --Your habilites compared segment by segment (no chart data required) + + --segment scroll in the left + --boss image, boss name, + + --when selecting a boss show the chart for the boss + + local defaultChartSections = { + { + Name = "Raid Damage", + ChartID = 1, + ChartData = "alldamagers-segment", + }, + { + + }, + } + + + local scrollWidth = 200 + local scrollHeight = 500 + local scrollButtonHeight = 20 + local amountScrollLines = floor(scrollHeight / scrollButtonHeight) + local allLinesCreated = {} + local lineSelectedBackdropColor = {.5, .5, .5, .5} + + local onClickLine_SelectChartToView = function(button, mouseButton) + for buttonId, line in ipairs(allLinesCreated) do + line:SetDefaultBackdropColor() + end + end + + local lineMixin = { + SetDefaultBackdropColor = function(line) + line.__background:SetVertexColor(unpack(line.defaultBackgroundColor)) + end, + + SetSelectedBackdropColor = function(line) + line.__background:SetVertexColor(unpack(lineSelectedBackdropColor)) + end, + + OnClickLine = function(line) + --select the chart to view + end, + } + + --function to create a line in the scroll frame + local createScrollLine = function(self, index) + --create a new line + local line = CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate") + detailsFramework:Mixin(line, lineMixin) + + --set its parameters + line:SetPoint("topleft", self, "topleft", 1, -((index-1) * (scrollButtonHeight+1)) - 1) + line:SetSize(scrollWidth-19, scrollButtonHeight) + line:RegisterForClicks("LeftButtonDown", "RightButtonDown") + + line:SetScript("OnClick", line.OnClickLine) + + detailsFramework:ApplyStandardBackdrop(line) + line.defaultBackgroundColor = {line.__background:GetVertexColor()} + + local icon = line:CreateTexture("$parentSpecIcon", "artwork") + icon:SetSize(scrollButtonHeight, scrollButtonHeight) + icon:SetAlpha(0.71) + + local chartData = defaultChartSections[index] + local chartName = detailsFramework:CreateLabel(line, chartData.Name, 11, "white", "GameFontNormal") + + icon:SetPoint("left", line, "left", 0, 0) + chartName:SetPoint("topleft", icon, "topright", 2, -3) + + line.Icon = icon + line.ChartName = chartName + return line + end + + local refreshScroll = function(self, data, offset, totalLines) + for i = 1, totalLines do + local index = i + offset + local chartData = data[index] + if (chartData) then + local line = self:GetLine(i) + line.ChartID = chartData.ChartID + line.ChartData = chartData.ChartData + line.ChartName.text = chartData.Name + end + end + end + + --Create the scrollbox showing the selection for charts + local chartSelectionScrollBox = detailsFramework:CreateScrollBox( + tabFrame, + "$parentChartSelectionScroll", + refreshScroll, + {}, + scrollWidth, + scrollHeight, + amountScrollLines, + scrollButtonHeight + ) + + detailsFramework:ReskinSlider(chartSelectionScrollBox) + chartSelectionScrollBox.ScrollBar:ClearAllPoints() + chartSelectionScrollBox.ScrollBar:SetPoint("topright", chartSelectionScrollBox, "topright", -2, -17) + chartSelectionScrollBox.ScrollBar:SetPoint("bottomright", chartSelectionScrollBox, "bottomright", -2, 17) + chartSelectionScrollBox:SetPoint("topright", tabFrame, "topleft", -1, 0) + chartSelectionScrollBox:SetPoint("bottomright", tabFrame, "bottomleft", -1, 0) + + detailsFramework:ApplyStandardBackdrop(chartSelectionScrollBox) + + tabFrame.chartSelectionScrollBox = chartSelectionScrollBox + + --create the scrollbox lines + for i = 1, amountScrollLines do + chartSelectionScrollBox:CreateLine(createScrollLine) + end + + +end \ No newline at end of file diff --git a/frames/window_scrolldamage.lua b/frames/window_scrolldamage.lua index 5221e7fa..d1888d3c 100644 --- a/frames/window_scrolldamage.lua +++ b/frames/window_scrolldamage.lua @@ -2,18 +2,24 @@ local Details = _G.Details local DF = _G.DetailsFramework -local _ +local _, Details222 = ... +_ = nil +local _GetSpellInfo = Details.GetSpellInfo function Details:ScrollDamage() if (not DetailsScrollDamage) then DetailsScrollDamage = DetailsFramework:CreateSimplePanel(UIParent) DetailsScrollDamage:SetSize(427 - 40 - 20 - 20, 505 - 150 + 20 + 40) - DetailsScrollDamage:SetTitle("Details! Scroll Damage (/details scroll)") + DetailsScrollDamage:SetTitle("/details scroll") DetailsScrollDamage.Data = {} DetailsScrollDamage:ClearAllPoints() DetailsScrollDamage:SetPoint("left", UIParent, "left", 10, 0) DetailsScrollDamage:Hide() + DetailsScrollDamage.Title:SetPoint("center", DetailsScrollDamage.TitleBar, "center", 108, 0) + + DetailsFramework:ApplyStandardBackdrop(DetailsScrollDamage) + local scroll_width = 395 - 40 - 20 - 20 local scroll_height = 340 local scroll_lines = 16 @@ -24,9 +30,12 @@ function Details:ScrollDamage() local backdrop_color_is_critical = {.4, .4, .2, 0.2} local backdrop_color_is_critical_on_enter = {1, 1, .8, 0.4} + local dropdownTemplate = DetailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWNDARK_TEMPLATE") + local y = -15 local headerY = y - 15 local scrollY = headerY - 20 + local fontSize = 10 local LibWindow = _G.LibStub("LibWindow-1.1") DetailsScrollDamage:SetScript("OnMouseDown", nil) @@ -43,12 +52,15 @@ function Details:ScrollDamage() LibWindow.MakeDraggable(DetailsScrollDamage) LibWindow.RestorePosition(DetailsScrollDamage) + local scaleBar = DetailsFramework:CreateScaleBar(DetailsScrollDamage, Details.damage_scroll_position) + DetailsScrollDamage:SetScale(Details.damage_scroll_position.scale) + --header local headerTable = { {text = "", width = 20}, {text = "Spell Name", width = 104}, {text = "Amount", width = 60}, - {text = "Time", width = 60}, + {text = "Time", width = 45}, {text = "Spell ID", width = 80}, } local headerOptions = { @@ -60,7 +72,7 @@ function Details:ScrollDamage() DetailsScrollDamage.searchText = "" DetailsScrollDamage.searchCache = {} - local refreshFunc = function(self, data, offset, totalLines) + local refreshFunc = function(self, data, offset, totalLines) --~refresh local ToK = _detalhes:GetCurrentToKFunction() for i = 1, totalLines do @@ -74,13 +86,14 @@ function Details:ScrollDamage() local spellName, _, spellIcon if (token ~= "SWING_DAMAGE") then - spellName, _, spellIcon = GetSpellInfo(spellID) + spellName, _, spellIcon = _GetSpellInfo(spellID) else - spellName, _, spellIcon = GetSpellInfo(1) + spellName, _, spellIcon = _GetSpellInfo(1) end line.SpellID = spellID line.IsCritical = isCritical + line.IconFrame.SpellID = spellID if (isCritical) then line:SetBackdropColor(unpack(backdrop_color_is_critical)) @@ -91,11 +104,12 @@ function Details:ScrollDamage() if (spellName) then line.Icon:SetTexture(spellIcon) line.Icon:SetTexCoord(.1, .9, .1, .9) - line.DamageText.text = isCritical and "|cFFFFFF00" .. ToK(_, amount) or ToK(_, amount) - line.TimeText.text = format("%.2f", time - DetailsScrollDamage.Data.Started) + line.DamageText.text = isCritical and "|cFFFFFF00 " .. ToK(_, amount) or " " .. ToK(_, amount) + line.TimeText.text = " " .. format("%.2f", time - DetailsScrollDamage.Data.Started) line.SpellIDText.text = spellID + line.SpellIDText:SetCursorPosition(0) line.SpellNameText.text = spellName - DF:TruncateText(line.SpellNameText, 104) + line.SpellNameText:SetCursorPosition(0) else line:Hide() end @@ -103,41 +117,45 @@ function Details:ScrollDamage() end end - local lineOnEnter = function(self) + local lineOnEnter = function(self) --~onenter + --if this does not have IconFrame it means it is the IconFrame itself + if (not self.IconFrame) then + GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") + GameTooltip:SetSpellByID(self.SpellID) + GameTooltip:AddLine(" ") + GameTooltip:Show() + + self = self:GetParent() + end + if (self.IsCritical) then self:SetBackdropColor(unpack(backdrop_color_is_critical_on_enter)) else self:SetBackdropColor(unpack(backdrop_color_on_enter)) end - - if (self.SpellID) then - --spell tooltip removed, it's to much annoying - --GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") - --GameTooltip:SetSpellByID(self.SpellID) - --GameTooltip:AddLine(" ") - --GameTooltip:Show() - end end - local lineOnLeave = function(self) - if (self.IsCritical) then - self:SetBackdropColor(unpack(backdrop_color_is_critical)) - else - self:SetBackdropColor(unpack(backdrop_color)) + local lineOnLeave = function(self) --~onleave + --if this has an icon frame it means its the line itself + if (self.IconFrame) then + if (self.IsCritical) then + self:SetBackdropColor(unpack(backdrop_color_is_critical)) + else + self:SetBackdropColor(unpack(backdrop_color)) + end end - + GameTooltip:Hide() end local createLineFunc = function(self, index) - local line = CreateFrame("button", "$parentLine" .. index, self,"BackdropTemplate") line:SetPoint("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1) line:SetSize(scroll_width - 2, scroll_line_height) line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) line:SetBackdropColor(unpack(backdrop_color)) - + -- ~createline --~line DF:Mixin(line, DF.HeaderFunctions) line:SetScript("OnEnter", lineOnEnter) @@ -147,17 +165,22 @@ function Details:ScrollDamage() local icon = line:CreateTexture("$parentSpellIcon", "overlay") icon:SetSize(scroll_line_height - 2, scroll_line_height - 2) + local iconFrame = CreateFrame("frame", "$parentIconFrame", line) + iconFrame:SetAllPoints(icon) + iconFrame:SetScript("OnEnter", lineOnEnter) + iconFrame:SetScript("OnLeave", lineOnLeave) + --spellname - local spellNameText = DF:CreateLabel(line) + local spellNameText = DetailsFramework:CreateTextEntry(line, function()end, DetailsScrollDamage.Header:GetColumnWidth(2), scroll_line_height, _, _, _, dropdownTemplate) --damage - local damageText = DF:CreateLabel(line) + local damageText = DF:CreateLabel(line, "", fontSize, "white") --time - local timeText = DF:CreateLabel(line) + local timeText = DF:CreateLabel(line, "", fontSize, "white") --spell ID - local spellIDText = DF:CreateLabel(line) + local spellIDText = DetailsFramework:CreateTextEntry(line, function()end, DetailsScrollDamage.Header:GetColumnWidth(5), scroll_line_height, _, _, _, dropdownTemplate) line:AddFrameToHeaderAlignment(icon) line:AddFrameToHeaderAlignment(spellNameText) @@ -168,6 +191,7 @@ function Details:ScrollDamage() line:AlignWithHeader(DetailsScrollDamage.Header, "left") line.Icon = icon + line.IconFrame = iconFrame line.DamageText = damageText line.TimeText = timeText line.SpellIDText = spellIDText @@ -251,7 +275,7 @@ function Details:ScrollDamage() autoOpenCheckbox:SetAsCheckBox() autoOpenCheckbox:SetPoint("left", statusBar, "left", 5, 0) - local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on Training Dummy") + local autoOpenText = DetailsFramework:CreateLabel(statusBar, "Auto Open on Training Dummy", 10) autoOpenText:SetPoint("left", autoOpenCheckbox, "right", 2, 0) --search bar diff --git a/functions/api2.lua b/functions/api2.lua index cf424ad9..d0174682 100644 --- a/functions/api2.lua +++ b/functions/api2.lua @@ -7,6 +7,8 @@ This is a high level API for Details! Damage Meter --]=] +local addonName, Details222 = ... + --local helpers local getCombatObject = function(segmentNumber) local combatObject diff --git a/functions/attributes.lua b/functions/attributes.lua index 335017fd..288203dd 100644 --- a/functions/attributes.lua +++ b/functions/attributes.lua @@ -1,7 +1,8 @@ --[[ Attributes: Damage, Heal, Energy, Miscellaneous ]] -do +do local _detalhes = _G._detalhes + local addonName, Details222 = ... local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) --Globals diff --git a/functions/autorun.lua b/functions/autorun.lua index bd9c5411..ab35cf87 100644 --- a/functions/autorun.lua +++ b/functions/autorun.lua @@ -1,6 +1,7 @@ local Details = _G.Details local DF = _G.DetailsFramework local C_Timer = _G.C_Timer +local addonName, Details222 = ... --auto run scripts Details.AutoRunCode = {} diff --git a/functions/boss.lua b/functions/boss.lua index 026c3731..4b2d6ef8 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -1,7 +1,8 @@ -do +do local _detalhes = _G._detalhes + local addonName, Details222 = ... _detalhes.EncounterInformation = {} local ipairs = ipairs --lua local diff --git a/functions/bossmods.lua b/functions/bossmods.lua index 65cbccb9..8742800f 100644 --- a/functions/bossmods.lua +++ b/functions/bossmods.lua @@ -1,6 +1,6 @@ local Details = _G.Details - +local addonName, Details222 = ... --get the total of damage and healing of a phase of an encounter function Details:OnCombatPhaseChanged() diff --git a/functions/buff.lua b/functions/buff.lua index d0d24ff5..3fe5895d 100644 --- a/functions/buff.lua +++ b/functions/buff.lua @@ -8,6 +8,7 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ + local addonName, Details222 = ... --initialize buffs name container _detalhes.Buffs.BuffsTable = {} -- armazenara o [nome do buff] = { tabela do buff } _detalhes.Buffs.__index = _detalhes.Buffs diff --git a/functions/classes.lua b/functions/classes.lua index 97ebb56f..9286ba57 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -1,7 +1,8 @@ --[[ Declare all Details classes and container indexes ]] -do +do local _detalhes = _G._detalhes + local addonName, Details222 = ... local setmetatable = setmetatable -------- container que armazena o cache de pets _detalhes.container_pets = {} diff --git a/functions/coach.lua b/functions/coach.lua index aa3f80b9..dd9701b5 100644 --- a/functions/coach.lua +++ b/functions/coach.lua @@ -1,5 +1,6 @@ local Details = _G.Details +local addonName, Details222 = ... --stop yellow warning on my editor local IsInRaid = _G.IsInRaid diff --git a/functions/currentdps.lua b/functions/currentdps.lua index 9f2d7fa0..94bdb072 100644 --- a/functions/currentdps.lua +++ b/functions/currentdps.lua @@ -1,6 +1,7 @@ local Details = _G.Details +local addonName, Details222 = ... --namespace Details.CurrentDps = { diff --git a/functions/deathmenu.lua b/functions/deathmenu.lua index 98edb9ce..92d5ed7f 100644 --- a/functions/deathmenu.lua +++ b/functions/deathmenu.lua @@ -1,7 +1,7 @@ local Details = _G.Details - +local addonName, Details222 = ... ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --extra buttons at the death options (release, death recap) diff --git a/functions/deathrecap.lua b/functions/deathrecap.lua index 321d15c0..b10c5ed3 100644 --- a/functions/deathrecap.lua +++ b/functions/deathrecap.lua @@ -4,6 +4,7 @@ local Details = _G.Details local textAlpha = 0.9 local AceLocale = LibStub("AceLocale-3.0") local L = AceLocale:GetLocale ( "Details" ) +local addonName, Details222 = ... local on_deathrecap_line_enter = function(self) if (self.spellid) then diff --git a/functions/dungeon.lua b/functions/dungeon.lua index fb6118ff..46ca4df4 100644 --- a/functions/dungeon.lua +++ b/functions/dungeon.lua @@ -4,6 +4,7 @@ local Details = _G._detalhes local debugmode = false --print debug lines local verbosemode = false --auto open the chart panel local _ +local addonName, Details222 = ... local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" ) diff --git a/functions/editmode.lua b/functions/editmode.lua index 2aef28a6..5b30a959 100644 --- a/functions/editmode.lua +++ b/functions/editmode.lua @@ -2,6 +2,7 @@ local Details = _G.Details local AceLocale = LibStub("AceLocale-3.0") local L = AceLocale:GetLocale("Details") +local addonName, Details222 = ... function Details.RegisterDragonFlightEditMode() if (EventRegistry and type(EventRegistry) == "table") then diff --git a/functions/events.lua b/functions/events.lua index 99ede30e..28c75738 100644 --- a/functions/events.lua +++ b/functions/events.lua @@ -4,7 +4,8 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ - + local addonName, Details222 = ... + --Event types: _detalhes.RegistredEvents = { --instances diff --git a/functions/hooks.lua b/functions/hooks.lua index be36bceb..b92d83ee 100644 --- a/functions/hooks.lua +++ b/functions/hooks.lua @@ -15,7 +15,8 @@ local _detalhes = _G._detalhes local _ - + local addonName, Details222 = ... + _detalhes.hooks ["HOOK_COOLDOWN"] = {} _detalhes.hooks ["HOOK_DEATH"] = {} _detalhes.hooks ["HOOK_BATTLERESS"] = {} diff --git a/functions/immersion.lua b/functions/immersion.lua index 3c865a26..d3bf0ee0 100644 --- a/functions/immersion.lua +++ b/functions/immersion.lua @@ -6,6 +6,7 @@ local Details = _G.Details local C_Timer = _G.C_Timer local C_Map = _G.C_Map local ceil = math.ceil +local addonName, Details222 = ... -- immersion namespace Details.Immersion = {} diff --git a/functions/loaddata.lua b/functions/loaddata.lua index b8796271..999bf016 100644 --- a/functions/loaddata.lua +++ b/functions/loaddata.lua @@ -4,7 +4,8 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ - + local addonName, Details222 = ... + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --On Details! Load: --load default keys into the main object diff --git a/functions/macros.lua b/functions/macros.lua index 4c187feb..10e66774 100644 --- a/functions/macros.lua +++ b/functions/macros.lua @@ -1,4 +1,5 @@ +local addonName, Details222 = ... -- @windowN: number a a window to open the player details breakdown -- /run Details:OpenPlayerDetails(windowN) diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua index a99895b9..564bd36c 100644 --- a/functions/mythicdungeon.lua +++ b/functions/mythicdungeon.lua @@ -5,6 +5,7 @@ local unpack = _G.unpack local GetTime = _G.GetTime local tremove = _G.tremove local GetInstanceInfo = _G.GetInstanceInfo +local addonName, Details222 = ... local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") @@ -774,7 +775,7 @@ function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, even --nothing elseif (event == "COMBAT_MYTHICDUNGEON_START") then - print("COMBAT_MYTHICDUNGEON_START", ...) + --print("COMBAT_MYTHICDUNGEON_START", ...) local lower_instance = _detalhes:GetLowerInstanceNumber() if (lower_instance) then lower_instance = _detalhes:GetInstance(lower_instance) diff --git a/functions/pack.lua b/functions/pack.lua index 2508e7f5..94a2e745 100644 --- a/functions/pack.lua +++ b/functions/pack.lua @@ -19,6 +19,7 @@ local GetNumGroupMembers = _G.GetNumGroupMembers local GetRaidRosterInfo = _G.GetRaidRosterInfo local unpack = _G.unpack local IsInGroup = _G.IsInGroup +local addonName, Details222 = ... Details.packFunctions = {} diff --git a/functions/plater.lua b/functions/plater.lua index 547d632a..3351a551 100644 --- a/functions/plater.lua +++ b/functions/plater.lua @@ -1,7 +1,7 @@ local Details = _G.Details - +local addonName, Details222 = ... local plater_integration_frame = CreateFrame("frame", "DetailsPlaterFrame", UIParent, "BackdropTemplate") diff --git a/functions/playerclass.lua b/functions/playerclass.lua index 02cf4246..4131a5d3 100644 --- a/functions/playerclass.lua +++ b/functions/playerclass.lua @@ -4,6 +4,7 @@ do local _detalhes = _G._detalhes local _ + local addonName, Details222 = ... local pairs = pairs local ipairs = ipairs local unpack = table.unpack or _G.unpack diff --git a/functions/private.lua b/functions/private.lua new file mode 100644 index 00000000..3c7ad6b5 --- /dev/null +++ b/functions/private.lua @@ -0,0 +1,32 @@ + +local addonName, details222 = ... + +details222.Scheduler = { + Names = {}, + Debug = false, +} + +local printDebug = function(...) + if (details222.Scheduler.Debug) then + print("ISE:", ...) + end +end + +function details222.Scheduler.NewTicker(seconds, callback, name) + local tickerHandler = C_Timer.NewTicker(seconds, callback) + if (name) then + details222.Scheduler.Names[name] = tickerHandler + end + return tickerHandler +end + +function details222.Scheduler.Cancel(name) + local ticker = details222.Scheduler.Names[name] + if (ticker) then + ticker:Cancel() + details222.Scheduler.Names[name] = nil + printDebug("Ticker", name, "Cancelled") + else + printDebug("Ticker", name, " Not Found") + end +end \ No newline at end of file diff --git a/functions/profiles.lua b/functions/profiles.lua index 69fec5d2..227e0440 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -4,6 +4,7 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ + local addonName, Details222 = ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --Profiles: @@ -849,9 +850,6 @@ local default_profile = { }, ["EVOKER"] = { - --0.31764705882353, -- [1] - --0.24313725490196, -- [2] - --0.91372549019608, -- [3] --0.2000, --0.4980, --0.5764, @@ -1140,11 +1138,11 @@ local default_profile = { line_height = 17, }, - --new window - all_in_one_windows = { - - }, + --new window system + all_in_one_windows = {}, + --auto show overall data in dynamic mode + auto_swap_to_dynamic_overall = false, } _detalhes.default_profile = default_profile @@ -1157,11 +1155,44 @@ local default_player_data = { last_coach_name = false, }, + --this is used by the new data capture for charts + data_harvest_for_charsts = { + players = { + --damage done by each player + { + name = "Damage of Each Individual Player", + combatObjectContainer = 1, + playerOnly = true, + playerKey = "total", + }, + }, + + totals = { + --total damage done by the raid group + { + name = "Damage of All Player Combined", + combatObjectSubTableName = "totals", + combatObjectSubTableKey = 1, + }, + }, + }, + + data_harvested_for_charts = {}, + + --ocd tracker test ocd_tracker = { enabled = false, cooldowns = {}, - pos = {}, + frames = { + ["defensive-raid"] = {}, + ["defensive-target"] = {}, + ["defensive-personal"] = {}, + ["ofensive"] = {}, + ["utility"] = {}, + ["main"] = {}, --any cooldown that does not have a frame is shown on main frame + }, --panels for each cooldown type + show_conditions = { only_in_group = true, only_inside_instance = true, @@ -1175,7 +1206,16 @@ local default_player_data = { ["defensive-personal"] = false, ["ofensive"] = true, ["utility"] = false, + }, --when creating a filter, add it here and also add to 'own_frame' + + own_frame = { + ["defensive-raid"] = false, + ["defensive-target"] = false, + ["defensive-personal"] = false, + ["ofensive"] = false, + ["utility"] = false, }, + width = 120, height = 18, lines_per_column = 12, @@ -1300,7 +1340,9 @@ local default_global_data = { immersion_unit_special_icons = true, --custom icons for specific units immersion_pets_on_solo_play = false, --pets showing when solo play damage_scroll_auto_open = true, - damage_scroll_position = {}, + damage_scroll_position = { + scale = 1, + }, data_wipes_exp = { ["9"] = false, ["10"] = false, @@ -1312,6 +1354,11 @@ local default_global_data = { current_exp_raid_encounters = {}, installed_skins_cache = {}, + combat_id_global = 0, + + slash_me_used = false, + trinket_data = {}, + --spell category feedback spell_category_savedtable = {}, spell_category_latest_query = 0, @@ -1648,7 +1695,6 @@ local exportProfileBlacklist = { active_profile = true, SoloTablesSaved = true, RaidTablesSaved = true, - savedStyles = true, benchmark_db = true, rank_window = true, last_realversion = true, diff --git a/functions/raidinfo.lua b/functions/raidinfo.lua index 4447c5e9..5ed54b38 100644 --- a/functions/raidinfo.lua +++ b/functions/raidinfo.lua @@ -5,6 +5,7 @@ local C_Timer = _G.C_Timer local DetailsFramework = _G.DetailsFramework local tinsert = _G.tinsert +local addonName, Details222 = ... function Details.InstallRaidInfo() diff --git a/functions/rowanimation.lua b/functions/rowanimation.lua index 56a6d08f..43030cfa 100644 --- a/functions/rowanimation.lua +++ b/functions/rowanimation.lua @@ -10,7 +10,8 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ - + local addonName, Details222 = ... + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --basic functions diff --git a/functions/savedata.lua b/functions/savedata.lua index f4f9addb..d0d57b48 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -1,6 +1,7 @@ --[[this file save the data when player leave the game]] local _detalhes = _G._detalhes +local addonName, Details222 = ... function _detalhes:WipeConfig() local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) diff --git a/functions/schedules.lua b/functions/schedules.lua index 0f73183f..71fefd8d 100644 --- a/functions/schedules.lua +++ b/functions/schedules.lua @@ -5,6 +5,7 @@ local Details = _G.Details local DF = _G.DetailsFramework local C_Timer = _G.C_Timer local unpack = _G.unpack +local addonName, Details222 = ... --make a namespace for schedules Details.Schedules = {} diff --git a/functions/skins.lua b/functions/skins.lua index bb8a5dfb..7b810630 100644 --- a/functions/skins.lua +++ b/functions/skins.lua @@ -2,6 +2,7 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ +local addonName, Details222 = ... --install skin function: function _detalhes:InstallSkin (skin_name, skin_table) diff --git a/functions/slash.lua b/functions/slash.lua index 2d4c6896..2fb9b1a4 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -3,6 +3,7 @@ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) local _ +local addonName, Details222 = ... local CreateFrame = CreateFrame local pairs = pairs @@ -11,11 +12,16 @@ local UnitGUID = UnitGUID local tonumber= tonumber local LoggingCombat = LoggingCombat +SLASH_PLAYEDCLASS1 = "/playedclass" +function SlashCmdList.PLAYEDCLASS(msg, editbox) + print(Details.GetPlayTimeOnClassString()) +end + SLASH_DUMPTABLE1 = "/dumpt" function SlashCmdList.DUMPTABLE(msg, editbox) local result = "return function() return " .. msg .. " end" local extractValue = loadstring(result) - return Details:Dump(extractValue()()) + return dumpt(extractValue()()) end SLASH_DETAILS1, SLASH_DETAILS2, SLASH_DETAILS3 = "/details", "/dt", "/de" @@ -822,66 +828,57 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == "guid") then - - local pass_guid = rest:match("^(%S*)%s*(.-)$") - - if (not _detalhes.id_frame) then - - local backdrop = { - bgFile = "Interface\\ChatFrame\\ChatFrameBackground", - edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", - tile = true, edgeSize = 1, tileSize = 5, - } - - _detalhes.id_frame = CreateFrame("Frame", "DetailsID", UIParent) - _detalhes.id_frame:SetHeight(14) - _detalhes.id_frame:SetWidth(120) - _detalhes.id_frame:SetPoint("center", UIParent, "center") - _detalhes.id_frame:SetBackdrop(backdrop) - - tinsert(UISpecialFrames, "DetailsID") - - _detalhes.id_frame.texto = CreateFrame("editbox", nil, _detalhes.id_frame) - _detalhes.id_frame.texto:SetPoint("topleft", _detalhes.id_frame, "topleft") - _detalhes.id_frame.texto:SetAutoFocus(false) - _detalhes.id_frame.texto:SetFontObject(GameFontHighlightSmall) - _detalhes.id_frame.texto:SetHeight(14) - _detalhes.id_frame.texto:SetWidth(120) - _detalhes.id_frame.texto:SetJustifyH("CENTER") - _detalhes.id_frame.texto:EnableMouse(true) - _detalhes.id_frame.texto:SetBackdrop(ManualBackdrop) - _detalhes.id_frame.texto:SetBackdropColor(0, 0, 0, 0.5) - _detalhes.id_frame.texto:SetBackdropBorderColor(0.3, 0.3, 0.30, 0.80) - _detalhes.id_frame.texto:SetText("") --localize-me - _detalhes.id_frame.texto.perdeu_foco = nil - - _detalhes.id_frame.texto:SetScript("OnEnterPressed", function() - _detalhes.id_frame.texto:ClearFocus() - _detalhes.id_frame:Hide() - end) - - _detalhes.id_frame.texto:SetScript("OnEscapePressed", function() - _detalhes.id_frame.texto:ClearFocus() - _detalhes.id_frame:Hide() - end) - - end - - _detalhes.id_frame:Show() - _detalhes.id_frame.texto:SetFocus() - - if (pass_guid == "-") then - local guid = UnitGUID("target") - if (guid) then - local g = _detalhes:GetNpcIdFromGuid (guid) - _detalhes.id_frame.texto:SetText("" .. g) - _detalhes.id_frame.texto:HighlightText() + if (UnitExists("target")) then + local serial = UnitGUID("target") + if (serial) then + local npcId = serial + if (not Details.id_frame) then + local backdrop = { + bgFile = "Interface\\ChatFrame\\ChatFrameBackground", + edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", + tile = true, edgeSize = 1, tileSize = 5, + } + + Details.id_frame = CreateFrame("Frame", "DetailsID", UIParent, "BackdropTemplate") + Details.id_frame:SetHeight(14) + Details.id_frame:SetWidth(120) + Details.id_frame:SetPoint("center", UIParent, "center") + Details.id_frame:SetBackdrop(backdrop) + + tinsert(UISpecialFrames, "DetailsID") + + Details.id_frame.texto = CreateFrame("editbox", nil, Details.id_frame, "BackdropTemplate") + Details.id_frame.texto:SetPoint("topleft", Details.id_frame, "topleft") + Details.id_frame.texto:SetAutoFocus(false) + Details.id_frame.texto:SetFontObject(GameFontHighlightSmall) + Details.id_frame.texto:SetHeight(14) + Details.id_frame.texto:SetWidth(120) + Details.id_frame.texto:SetJustifyH("CENTER") + Details.id_frame.texto:EnableMouse(true) + Details.id_frame.texto:SetBackdropColor(0, 0, 0, 0.5) + Details.id_frame.texto:SetBackdropBorderColor(0.3, 0.3, 0.30, 0.80) + Details.id_frame.texto:SetText("") + Details.id_frame.texto.perdeu_foco = nil + + Details.id_frame.texto:SetScript("OnEnterPressed", function() + Details.id_frame.texto:ClearFocus() + Details.id_frame:Hide() + end) + + Details.id_frame.texto:SetScript("OnEscapePressed", function() + Details.id_frame.texto:ClearFocus() + Details.id_frame:Hide() + end) + + end + + C_Timer.After(0.1, function() + Details.id_frame:Show() + Details.id_frame.texto:SetFocus() + Details.id_frame.texto:SetText("" .. npcId) + Details.id_frame.texto:HighlightText() + end) end - - else - print(pass_guid.. " -> " .. tonumber(pass_guid:sub(6, 10), 16)) - _detalhes.id_frame.texto:SetText(""..tonumber(pass_guid:sub(6, 10), 16)) - _detalhes.id_frame.texto:HighlightText() end elseif (command == "profile") then @@ -1350,7 +1347,8 @@ function SlashCmdList.DETAILS (msg, editbox) Details:ScrollDamage() elseif (msg == "me" or msg == "ME" or msg == "Me" or msg == "mE") then - local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned + Details.slash_me_used = true + local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned local role = UnitGroupRolesAssigned("player") if (role == "HEALER") then Details:OpenPlayerDetails(2) @@ -1674,6 +1672,9 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (msg == "generatespelllist") then Details.GenerateSpecSpellList() + elseif (msg == "generateracialslist") then + Details.GenerateRacialSpellList() + elseif (msg == "survey") then Details.Survey.OpenSurveyPanel() @@ -1840,22 +1841,24 @@ function Details.RefreshUserList (ignoreIfHidden) Details:UpdateUserPanel (newList) end -function Details:UpdateUserPanel (usersTable) - +function Details:UpdateUserPanel(usersTable) if (not Details.UserPanel) then + local frameWidth, frameHeight = 470, 605 DetailsUserPanel = DetailsFramework:CreateSimplePanel(UIParent) - DetailsUserPanel:SetSize(707, 505) + DetailsUserPanel:SetSize(frameWidth, frameHeight) DetailsUserPanel:SetTitle("Details! Version Check") DetailsUserPanel.Data = {} DetailsUserPanel:ClearAllPoints() - DetailsUserPanel:SetPoint("left", UIParent, "left", 10, 0) + DetailsUserPanel:SetPoint("left", UIParent, "left", 5, 100) DetailsUserPanel:Hide() + DetailsFramework:ApplyStandardBackdrop(DetailsUserPanel) + Details.UserPanel = DetailsUserPanel - - local scroll_width = 675 - local scroll_height = 450 - local scroll_lines = 21 + + local scroll_width = frameWidth - 30 + local scroll_height = 605 - 60 + local scroll_lines = 26 local scroll_line_height = 20 local backdrop_color = {.2, .2, .2, 0.2} @@ -1869,9 +1872,9 @@ function Details:UpdateUserPanel (usersTable) --header local headerTable = { - {text = "User Name", width = 200}, - {text = "Realm", width = 200}, - {text = "Version", width = 200}, + {text = "User Name", width = 160}, + {text = "Realm", width = 130}, + {text = "Version", width = 140}, } local headerOptions = { diff --git a/functions/spellcache.lua b/functions/spellcache.lua index a16f974a..e6b6bf6c 100644 --- a/functions/spellcache.lua +++ b/functions/spellcache.lua @@ -1,12 +1,13 @@ --[[ Spell Cache store all spells shown on frames and make able to change spells name, icons, etc... ]] -do +do -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --On The Fly SpellCache - local _detalhes = _G._detalhes + local Details = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) + local addonName, Details222 = ... local _ local rawget = rawget local rawset = rawset @@ -18,9 +19,9 @@ do local is_classic_exp = DetailsFramework.IsClassicWow() --default container - _detalhes.spellcache = {} + Details.spellcache = {} local unknowSpell = {Loc ["STRING_UNKNOWSPELL"], _, "Interface\\Icons\\Ability_Druid_Eclipse"} --localize-me - + local AllSpellNames if (is_classic_exp) then AllSpellNames = {} @@ -51,18 +52,18 @@ do else spellName, _, spellIcon = GetSpellInfo(spell) end - + if (not spellName) then return spell, _, AllSpellNames [spell] or defaultSpellIcon end - + return spellName, _, AllSpellNames [spell] or spellIcon end --reset spell cache - function _detalhes:ClearSpellCache() - _detalhes.spellcache = setmetatable({}, - {__index = function(tabela, valor) + function Details:ClearSpellCache() + Details.spellcache = setmetatable({}, + {__index = function(tabela, valor) local esta_magia = rawget (tabela, valor) if (esta_magia) then return esta_magia @@ -81,26 +82,26 @@ do else return unknowSpell end - + end}) --default overwrites --rawset (_detalhes.spellcache, 1, {Loc ["STRING_MELEE"], 1, "Interface\\AddOns\\Details\\images\\melee.tga"}) --rawset (_detalhes.spellcache, 2, {Loc ["STRING_AUTOSHOT"], 1, "Interface\\AddOns\\Details\\images\\autoshot.tga"}) - + --built-in overwrites - for spellId, spellTable in pairs(_detalhes.SpellOverwrite) do + for spellId, spellTable in pairs(Details.SpellOverwrite) do local name, _, icon = _GetSpellInfo(spellId) - rawset (_detalhes.spellcache, spellId, {spellTable.name or name, 1, spellTable.icon or icon}) + rawset (Details.spellcache, spellId, {spellTable.name or name, 1, spellTable.icon or icon}) end - + --user overwrites -- [1] spellid [2] spellname [3] spellicon - for index, spellTable in ipairs(_detalhes.savedCustomSpells) do - rawset (_detalhes.spellcache, spellTable [1], {spellTable [2], 1, spellTable [3]}) + for index, spellTable in ipairs(Details.savedCustomSpells) do + rawset (Details.spellcache, spellTable [1], {spellTable [2], 1, spellTable [3]}) end end - + local lightOfTheMartyr_Name, _, lightOfTheMartyr_Icon = _GetSpellInfo(196917) lightOfTheMartyr_Name = lightOfTheMartyr_Name or "Deprecated Spell - Light of the Martyr" lightOfTheMartyr_Icon = lightOfTheMartyr_Icon or "" @@ -183,6 +184,22 @@ do else --retail + local iconSize = 14 --icon size + local coords = {0.14, 0.86, 0.14, 0.86} + + local formatTextForItem = function(itemId) + local result = "" + + local itemIcon = C_Item.GetItemIconByID(itemId) + local itemName = C_Item.GetItemNameByID(itemId) + + if (itemIcon and itemName) then + result = " (" .. CreateTextureMarkup(itemIcon, iconSize, iconSize, iconSize, iconSize, unpack(coords)) .. " " .. itemName .. ")" + end + + return result + end + defaultSpellCustomization = { [1] = {name = Loc ["STRING_MELEE"], icon = [[Interface\ICONS\INV_Sword_04]]}, [2] = {name = Loc ["STRING_AUTOSHOT"], icon = [[Interface\ICONS\INV_Weapon_Bow_07]]}, @@ -198,6 +215,38 @@ do [77535] = {name = GetSpellInfo(77535), icon = "Interface\\Addons\\Details\\images\\icon_blood_shield"}, } + + if (GetSpellInfo(394453)) then + local dragonflightTrinkets = { + [394453] = {name = GetSpellInfo(394453) .. formatTextForItem(195480), isPassive = true, itemId = 195480}, --ring: Seal of Diurna's Chosen + + [382135] = {name = GetSpellInfo(382135) .. formatTextForItem(194308)}, --trinket: Manic Grieftorch + [382058] = {name = GetSpellInfo(382056) .. formatTextForItem(194299)}, --trinket: Decoration of Flame (shield) + [382056] = {name = GetSpellInfo(382056) .. formatTextForItem(194299)}, --trinket: Decoration of Flame + [382090] = {name = GetSpellInfo(382090) .. formatTextForItem(194302)}, --trinket: Storm-Eater's Boon + [381967] = {name = GetSpellInfo(381967) .. formatTextForItem(194305)}, --trinket: Controlled Current Technique + [382426] = {name = GetSpellInfo(382426) .. formatTextForItem(194309), isPassive = true, itemId = 194309}, --trinket: Spiteful Storm + [377455] = {name = GetSpellInfo(377455) .. formatTextForItem(194304)}, --trinket: Iceblood Deathsnare + [377451] = {name = GetSpellInfo(377451) .. formatTextForItem(194300)}, --trinket: Conjured Chillglobe + [382097] = {name = GetSpellInfo(382097) .. formatTextForItem(194303)}, --trinket: Rumbling Ruby + + [385903] = {name = GetSpellInfo(385903) .. formatTextForItem(193639), isPassive = true, itemId = 193639}, --trinket: Umbrelskul's Fractured Heart + [381475] = {name = GetSpellInfo(381475) .. formatTextForItem(193769)}, --trinket: Erupting Spear Fragment + [388739] = {name = GetSpellInfo(388739) .. formatTextForItem(193660), isPassive = true, itemId = 193660}, --trinket: Idol of Pure Decay + [388855] = {name = GetSpellInfo(388855) .. formatTextForItem(193678)}, --trinket: Miniature Singing Stone + [388755] = {name = GetSpellInfo(388755) .. formatTextForItem(193677), isPassive = true, itemId = 193677}, --trinket: Furious Ragefeather + [383934] = {name = GetSpellInfo(383934) .. formatTextForItem(193736)}, --trinket: Water's Beating Heart + [214052] = {name = GetSpellInfo(214052) .. formatTextForItem(133641), isPassive = true, itemId = 133641}, --trinket: Eye of Skovald + [214200] = {name = GetSpellInfo(214200) .. formatTextForItem(133646)}, --trinket: Mote of Sanctification + [387036] = {name = GetSpellInfo(387036) .. formatTextForItem(193748)}, --trinket: Kyrakka's Searing Embers (heal) + [397376] = {name = GetSpellInfo(397376) .. formatTextForItem(193748), isPassive = true, itemId = 193748}, --trinket: Kyrakka's Searing Embers (damage) + --[] = {name = GetSpellInfo() .. formatTextForItem(193757), isPassive = true}, --trinket: Ruby Whelp Shell + } + + for spellId, spellCustomization in pairs(dragonflightTrinkets) do + defaultSpellCustomization[spellId] = spellCustomization + end + end end if (LIB_OPEN_RAID_SPELL_CUSTOM_NAMES) then @@ -209,153 +258,156 @@ do end end - function _detalhes:UserCustomSpellUpdate (index, name, icon) - local t = _detalhes.savedCustomSpells[index] + function Details:GetDefaultCustomSpellsList() + return defaultSpellCustomization + end + + function Details:UserCustomSpellUpdate (index, name, icon) + local t = Details.savedCustomSpells[index] if (t) then t [2], t [3] = name or t [2], icon or t [3] - return rawset (_detalhes.spellcache, t [1], {t [2], 1, t [3]}) + return rawset (Details.spellcache, t [1], {t [2], 1, t [3]}) else return false end end - - function _detalhes:UserCustomSpellReset (index) - local t = _detalhes.savedCustomSpells[index] + + function Details:UserCustomSpellReset (index) + local t = Details.savedCustomSpells[index] if (t) then local spellid = t [1] local name, _, icon = _GetSpellInfo(spellid) - + if (defaultSpellCustomization [spellid]) then name = defaultSpellCustomization [spellid].name icon = defaultSpellCustomization [spellid].icon or icon or [[Interface\InventoryItems\WoWUnknownItem01]] end - + if (not name) then name = "Unknown" end if (not icon) then icon = [[Interface\InventoryItems\WoWUnknownItem01]] end - - rawset (_detalhes.spellcache, spellid, {name, 1, icon}) - + + rawset (Details.spellcache, spellid, {name, 1, icon}) + t[2] = name t[3] = icon end end - - function _detalhes:FillUserCustomSpells() - for spellid, t in pairs(defaultSpellCustomization) do - - local already_have - for index, spelltable in ipairs(_detalhes.savedCustomSpells) do - if (spelltable [1] == spellid) then - already_have = spelltable - end - end - - if (not already_have) then - local name, _, icon = GetSpellInfo(spellid) - _detalhes:UserCustomSpellAdd (spellid, t.name or name or "Unknown", t.icon or icon or [[Interface\InventoryItems\WoWUnknownItem01]]) - end - + + function Details:FillUserCustomSpells() + for spellid, spellTable in pairs(defaultSpellCustomization) do + local spellName, _, spellIcon = Details.GetSpellInfo(spellid) + Details:UserCustomSpellAdd(spellid, spellTable.name or spellName or "Unknown", spellTable.icon or spellIcon or [[Interface\InventoryItems\WoWUnknownItem01]]) end - - for i = #_detalhes.savedCustomSpells, 1, -1 do - local spelltable = _detalhes.savedCustomSpells [i] + + for i = #Details.savedCustomSpells, 1, -1 do + local spelltable = Details.savedCustomSpells [i] local spellid = spelltable [1] if (spellid > 10) then local exists = _GetSpellInfo(spellid) if (not exists) then - tremove(_detalhes.savedCustomSpells, i) + tremove(Details.savedCustomSpells, i) end end end end - - function _detalhes:UserCustomSpellAdd (spellid, name, icon) - local is_overwrite = false - for index, t in ipairs(_detalhes.savedCustomSpells) do - if (t [1] == spellid) then - t[2] = name - t[3] = icon - is_overwrite = true + + C_Timer.After(0, function() + Details:FillUserCustomSpells() + end) + + function Details:UserCustomSpellAdd(spellid, name, icon) + local isOverwrite = false + for index, spellTable in ipairs(Details.savedCustomSpells) do + if (spellTable[1] == spellid) then + spellTable[2] = name + spellTable[3] = icon + isOverwrite = true break end end - if (not is_overwrite) then - tinsert(_detalhes.savedCustomSpells, {spellid, name, icon}) + + if (not isOverwrite) then + tinsert(Details.savedCustomSpells, {spellid, name, icon}) end - return rawset (_detalhes.spellcache, spellid, {name, 1, icon}) + + return rawset(Details.spellcache, spellid, {name, 1, icon}) end - - function _detalhes:UserCustomSpellRemove (index) - local t = _detalhes.savedCustomSpells [index] + + function Details:UserCustomSpellRemove (index) + local t = Details.savedCustomSpells [index] if (t) then local spellid = t [1] local name, _, icon = _GetSpellInfo(spellid) if (name) then - rawset (_detalhes.spellcache, spellid, {name, 1, icon}) + rawset (Details.spellcache, spellid, {name, 1, icon}) end - return tremove(_detalhes.savedCustomSpells, index) + return tremove(Details.savedCustomSpells, index) end - + return false end - + --overwrite for API GetSpellInfo function - - _detalhes.getspellinfo = function(spellid) return _unpack(_detalhes.spellcache[spellid]) end - _detalhes.GetSpellInfo = _detalhes.getspellinfo + + Details.getspellinfo = function(spellid) return _unpack(Details.spellcache[spellid]) end + Details.GetSpellInfo = Details.getspellinfo --overwrite SpellInfo if the spell is a DoT, so Details.GetSpellInfo will return the name modified - function _detalhes:SpellIsDot (spellid) + function Details:SpellIsDot(spellid) + --do nothing if this spell already has a customization + if (defaultSpellCustomization[spellid]) then + return + end local spellName, rank, spellIcon = _GetSpellInfo(spellid) - + if (spellName) then - rawset (_detalhes.spellcache, spellid, {spellName .. Loc ["STRING_DOT"], rank, spellIcon}) + rawset (Details.spellcache, spellid, {spellName .. Loc ["STRING_DOT"], rank, spellIcon}) else - rawset (_detalhes.spellcache, spellid, {"Unknown DoT Spell? " .. Loc ["STRING_DOT"], rank, [[Interface\InventoryItems\WoWUnknownItem01]]}) + rawset (Details.spellcache, spellid, {"Unknown DoT Spell? " .. Loc ["STRING_DOT"], rank, [[Interface\InventoryItems\WoWUnknownItem01]]}) end end -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --Cache All Spells - function _detalhes:BuildSpellListSlow() + function Details:BuildSpellListSlow() local load_frame = _G.DetailsLoadSpellCache if (load_frame and (load_frame.completed or load_frame.inprogress)) then return false end - + local step = 1 local max = 160000 - + if (not load_frame) then load_frame = CreateFrame("frame", "DetailsLoadSpellCache", UIParent) load_frame:SetFrameStrata("DIALOG") - + local progress_label = load_frame:CreateFontString("DetailsLoadSpellCacheProgress", "overlay", "GameFontHighlightSmall") progress_label:SetText("Loading Spells: 0%") - function _detalhes:BuildSpellListSlowTick() + function Details:BuildSpellListSlowTick() progress_label:SetText("Loading Spells: " .. load_frame:GetProgress() .. "%") end - load_frame.tick = _detalhes:ScheduleRepeatingTimer ("BuildSpellListSlowTick", 1) - + load_frame.tick = Details:ScheduleRepeatingTimer ("BuildSpellListSlowTick", 1) + function load_frame:GetProgress() return math.floor(step / max * 100) end end - + local SpellCache = {a={}, b={}, c={}, d={}, e={}, f={}, g={}, h={}, i={}, j={}, k={}, l={}, m={}, n={}, o={}, p={}, q={}, r={}, s={}, t={}, u={}, v={}, w={}, x={}, y={}, z={}} local _string_lower = string.lower local _string_sub = string.sub local blizzGetSpellInfo = GetSpellInfo - + load_frame.inprogress = true - - _detalhes.spellcachefull = SpellCache + + Details.spellcachefull = SpellCache load_frame:SetScript("OnUpdate", function() for spellid = step, step+500 do @@ -368,27 +420,27 @@ do end end end - + step = step + 500 - + if (step > max) then step = max _G.DetailsLoadSpellCache.completed = true _G.DetailsLoadSpellCache.inprogress = false - _detalhes:CancelTimer(_G.DetailsLoadSpellCache.tick) + Details:CancelTimer(_G.DetailsLoadSpellCache.tick) DetailsLoadSpellCacheProgress:Hide() load_frame:SetScript("OnUpdate", nil) end - - end) - - + end) + + + return true end - function _detalhes:BuildSpellList() - + function Details:BuildSpellList() + local SpellCache = {a={}, b={}, c={}, d={}, e={}, f={}, g={}, h={}, i={}, j={}, k={}, l={}, m={}, n={}, o={}, p={}, q={}, r={}, s={}, t={}, u={}, v={}, w={}, x={}, y={}, z={}} local _string_lower = string.lower local _string_sub = string.sub @@ -405,15 +457,15 @@ do end end - _detalhes.spellcachefull = SpellCache + Details.spellcachefull = SpellCache return true end - - function _detalhes:ClearSpellList() - _detalhes.spellcachefull = nil + + function Details:ClearSpellList() + Details.spellcachefull = nil collectgarbage() end - - + + end diff --git a/functions/spells.lua b/functions/spells.lua index 9c154b18..cd1a3838 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -1,7 +1,8 @@ do local _detalhes = _G._detalhes - + local addonName, Details222 = ... + --import potion list from the framework _detalhes.PotionList = {} for spellID, _ in pairs(DetailsFramework.PotionIDs) do @@ -164,7 +165,6 @@ do --Feral Druid: [5217] = 103, --Tiger's Fury [285381] = 103, --Primal Wrath - [213764] = 103, --Swipe [106951] = 103, --Berserk [274837] = 103, --Feral Frenzy @@ -183,7 +183,6 @@ do [191034] = 102, --Starfall [78675] = 102, --Solar Beam [202770] = 102, --Fury of Elune - [323764] = 102, --Convoke the Spirits [102560] = 102, --Incarnation: Chosen of Elune [202347] = 102, --Stellar Flare [194223] = 102, --Celestial Alignment @@ -652,7 +651,7 @@ do [53385] = 70, -- Divine Storm -- Discipline Priest: - [63944] = 256, -- Renewed Hope + --[63944] = 256, -- Renewed Hope [10060] = 256, -- Power Infusion [33206] = 256, -- Pain Suppression [47540] = 256, -- Penance (rank 1) diff --git a/functions/testbars.lua b/functions/testbars.lua index 422d0076..8c3b1382 100644 --- a/functions/testbars.lua +++ b/functions/testbars.lua @@ -1,6 +1,6 @@ local Details = _G.Details - +local addonName, Details222 = ... function Details:TestBarsUpdate() local current_combat = Details:GetCombat("current") diff --git a/functions/timedata.lua b/functions/timedata.lua index 7f39f700..1c10629f 100644 --- a/functions/timedata.lua +++ b/functions/timedata.lua @@ -2,7 +2,8 @@ local _ local _detalhes = _G._detalhes local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) - + local addonName, Details222 = ... + --mantain the enabled time captures _detalhes.timeContainer = {} _detalhes.timeContainer.Exec = {} diff --git a/plugins/Details_DataStorage/Details_DataStorage.toc b/plugins/Details_DataStorage/Details_DataStorage.toc index 70ab25bc..2c96ccc3 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.toc +++ b/plugins/Details_DataStorage/Details_DataStorage.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details!: Storage ## Notes: Stores information for Details! Damage Meter ## DefaultState: Enabled diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc index 2b849173..5afa5607 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details!: Encounter Breakdown (plugin) ## Notes: Show detailed information about a boss encounter. Also provide damage per phase, graphic charts, easy weakauras creation. ## RequiredDeps: Details diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.toc b/plugins/Details_RaidCheck/Details_RaidCheck.toc index 97721a03..9cad0f58 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.toc +++ b/plugins/Details_RaidCheck/Details_RaidCheck.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details!: Raid Check (plugin) ## Notes: Show talents and item level for all members in your group, also shows food and flask state. ## RequiredDeps: Details diff --git a/plugins/Details_Streamer/Details_Streamer.lua b/plugins/Details_Streamer/Details_Streamer.lua index 408c031d..512913b1 100644 --- a/plugins/Details_Streamer/Details_Streamer.lua +++ b/plugins/Details_Streamer/Details_Streamer.lua @@ -1,26 +1,26 @@ local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") -local LDB = LibStub("LibDataBroker-1.1", true) -local LDBIcon = LDB and LibStub("LibDBIcon-1.0", true) -local LibWindow = LibStub("LibWindow-1.1") +local LDB = LibStub ("LibDataBroker-1.1", true) +local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true) +local LibWindow = LibStub ("LibWindow-1.1") local _ ---need cleanup Loc ["STRING_MEMORY_ALERT_BUTTON"], ---create the plugin object +--> create the plugin object -- "Details_StreamOverlay" is the old name local StreamOverlay = _detalhes:NewPluginObject("Details_Streamer", DETAILSPLUGIN_ALWAYSENABLED) ---tinsert(UISpecialFrames, "Details_StreamOverlays") ---main frame (shortcut) +--tinsert (UISpecialFrames, "Details_StreamOverlays") +--> main frame (shortcut) local SOF = StreamOverlay.Frame ---shortcut for details framework +--> shortcut for details framework local playerName StreamOverlay.CurrentVersion = "v1.2" ---mantaing the tables for casts, has hash indexes of numbers pointing to tables, tables inside store data of the UNIT_CAST events ---also mantain information about the cast, if is done, interrupted, channeled, instant. +--> mantaing the tables for casts, has hash indexes of numbers pointing to tables, tables inside store data of the UNIT_CAST events +--> also mantain information about the cast, if is done, interrupted, channeled, instant. --Target = the target of the spell casted or the spellname if is a death table --Id = the CastId from UNIT_CAST events. --CastStart = GetTime from the cast start. @@ -31,9 +31,9 @@ StreamOverlay.CurrentVersion = "v1.2" --Death = this is a event from death tables. local CastsTable = {} ---store bars references +--> store bars references StreamOverlay.battle_lines = {} ---store the information to be shown on bars, like text, icon, colors +--> store the information to be shown on bars, like text, icon, colors StreamOverlay.battle_content = {} StreamOverlay.squares = {} @@ -66,10 +66,10 @@ local function CreatePluginFrames() local fader = Details.FadeHandler.Fader function StreamOverlay:OnDetailsEvent(event, ...) - if (event == "HIDE") then --plugin hidded, disabled + if (event == "HIDE") then --> plugin hidded, disabled self.open = false - elseif (event == "SHOW") then --plugin hidded, disabled + elseif (event == "SHOW") then --> plugin hidded, disabled self.open = true elseif (event == "PLUGIN_DISABLED") then @@ -88,84 +88,84 @@ local function CreatePluginFrames() --show the frame and restore position SOF:Show() - --restore size and location + --> restore size and location StreamOverlay:RestoreWindowSizeAndLocation() - --refresh the frame + --> refresh the frame StreamOverlay:Refresh() StreamOverlay:SetBackgroundColor() StreamOverlay:CreateMinimapIcon() - --enable the minimap icon + --> enable the minimap icon LDBIcon:Refresh("DetailsStreamer", StreamOverlay.db.minimap) StreamOverlay:SetLocked() - --install the death hook + --> install the death hook Details:InstallHook(DETAILS_HOOK_DEATH, StreamOverlay.OnDeath) - --enable event listener + --> enable event listener eventFrame:RegisterMyEvents() - --enable the tick update - eventFrame:SetScript("OnUpdate", eventFrame.track_spell_cast) + --> enable the tick update + eventFrame:SetScript ("OnUpdate", eventFrame.track_spell_cast) - --refresh dps frame + --> refresh dps frame StreamOverlay:UpdateDpsHpsFrameConfig() end function StreamOverlay:OnDisablePlugin() - --shutdown the tick update - eventFrame:SetScript("OnUpdate", nil) + --> shutdown the tick update + eventFrame:SetScript ("OnUpdate", nil) - --disable the event listener + --> disable the event listener eventFrame:UnregisterMyEvents() - --unistall the death hook + --> unistall the death hook Details:UnInstallHook (DETAILS_HOOK_DEATH, StreamOverlay.OnDeath) - --shutdown minimap icon + --> shutdown minimap icon StreamOverlay:CreateMinimapIcon() local realstate = StreamOverlay.db.minimap.hide StreamOverlay.db.minimap.hide = true LDBIcon:Refresh ("DetailsStreamer", StreamOverlay.db.minimap) StreamOverlay.db.minimap.hide = realstate - --save position, size and hide the frame + --> save position, size and hide the frame StreamOverlay:SaveWindowSizeAnLocation() SOF:Hide() - --refresh dps frame + --> refresh dps frame StreamOverlay:UpdateDpsHpsFrameConfig (true) end - --title bar, only shown when the frame isn't locked - local titlebar = CreateFrame("frame", "DetailsStreamerTitlebar", SOF, "BackdropTemplate") - titlebar:SetHeight(20) - titlebar:SetPoint("bottomleft", SOF, "topleft") - titlebar:SetPoint("bottomright", SOF, "topright") - titlebar:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) - titlebar:SetBackdropColor(.1, .1, .1, .9) - titlebar.text = titlebar:CreateFontString(nil, "overlay", "GameFontNormal") - titlebar.text:SetPoint("center", titlebar, "center") - titlebar.text:SetText("Details! Streamer: Action Tracker") - titlebar:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self) - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") - GameTooltip:AddLine("|cFFFF7700Left Click|r: Open Options\n|cFFFF7700Right Click|r: Lock the Frame\n|cFFFF7700Slash Command|r: /streamer") + --> title bar, only shown when the frame isn't locked + local titlebar = CreateFrame ("frame", "DetailsStreamerTitlebar", SOF, "BackdropTemplate") + titlebar:SetHeight (20) + titlebar:SetPoint ("bottomleft", SOF, "topleft") + titlebar:SetPoint ("bottomright", SOF, "topright") + titlebar:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + titlebar:SetBackdropColor (.1, .1, .1, .9) + titlebar.text = titlebar:CreateFontString (nil, "overlay", "GameFontNormal") + titlebar.text:SetPoint ("center", titlebar, "center") + titlebar.text:SetText ("Details! Streamer: Action Tracker") + titlebar:SetScript ("OnEnter", function (self) + GameTooltip:SetOwner (self) + GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT") + GameTooltip:AddLine ("|cFFFF7700Left Click|r: Open Options\n|cFFFF7700Right Click|r: Lock the Frame\n|cFFFF7700Slash Command|r: /streamer") GameTooltip:Show() end) - titlebar:SetScript("OnLeave", function() + titlebar:SetScript ("OnLeave", function() GameTooltip:Hide() end) - SOF:SetScript("OnMouseDown", function(self) + SOF:SetScript ("OnMouseDown", function (self) end) - SOF:SetScript("OnMouseUp", function(self) + SOF:SetScript ("OnMouseUp", function (self) end) - titlebar:SetScript("OnMouseDown", function(self, button) + titlebar:SetScript ("OnMouseDown", function (self, button) if (not SOF.moving and not StreamOverlay.db.main_frame_locked) then SOF:StartMoving() SOF.moving = true @@ -173,7 +173,7 @@ local function CreatePluginFrames() end end) - titlebar:SetScript("OnMouseUp", function(self, button) + titlebar:SetScript ("OnMouseUp", function (self, button) if (SOF.movingAt) then if (SOF.moving) then @@ -200,14 +200,14 @@ local function CreatePluginFrames() end end) - --main frame parameters - SOF:SetPoint("center", UIParent, "center") - SOF:SetSize(300, 500) - SOF:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) - SOF:EnableMouse(true) - SOF:SetMovable(true) - SOF:SetResizable(true) - SOF:SetClampedToScreen(true) + --> main frame parameters + SOF:SetPoint ("center", UIParent, "center") + SOF:SetSize (300, 500) + SOF:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + SOF:EnableMouse (true) + SOF:SetMovable (true) + SOF:SetResizable (true) + SOF:SetClampedToScreen (true) pcall(function() if (DetailsFramework.IsDragonflight()) then @@ -219,56 +219,56 @@ local function CreatePluginFrames() end) function StreamOverlay:SaveWindowSizeAnLocation() - --save size first + --> save size first StreamOverlay.db.main_frame_size [1] = SOF:GetWidth() StreamOverlay.db.main_frame_size [2] = SOF:GetHeight() - --save main frame position - LibWindow.RegisterConfig(SOF, StreamOverlay.db) - LibWindow.SavePosition(SOF) - --save the dps frame position - LibWindow.RegisterConfig(StreamerOverlayDpsHpsFrame, StreamOverlay.db.per_second) - LibWindow.SavePosition(StreamerOverlayDpsHpsFrame) + --> save main frame position + LibWindow.RegisterConfig (SOF, StreamOverlay.db) + LibWindow.SavePosition (SOF) + --> save the dps frame position + LibWindow.RegisterConfig (StreamerOverlayDpsHpsFrame, StreamOverlay.db.per_second) + LibWindow.SavePosition (StreamerOverlayDpsHpsFrame) end function StreamOverlay:RestoreWindowSizeAndLocation() - --restore the size first - SOF:SetSize(unpack(StreamOverlay.db.main_frame_size)) - --set the main window location - LibWindow.RegisterConfig(SOF, StreamOverlay.db) - LibWindow.RestorePosition(SOF) - LibWindow.SavePosition(SOF) - --set the dps frame location - LibWindow.RegisterConfig(StreamerOverlayDpsHpsFrame, StreamOverlay.db.per_second) - LibWindow.RestorePosition(StreamerOverlayDpsHpsFrame) - LibWindow.SavePosition(StreamerOverlayDpsHpsFrame) - --set the frame strata - SOF:SetFrameStrata(StreamOverlay.db.main_frame_strata) - StreamerOverlayDpsHpsFrame:SetFrameStrata(StreamOverlay.db.main_frame_strata) + --> restore the size first + SOF:SetSize (unpack (StreamOverlay.db.main_frame_size)) + --> set the main window location + LibWindow.RegisterConfig (SOF, StreamOverlay.db) + LibWindow.RestorePosition (SOF) + LibWindow.SavePosition (SOF) + --> set the dps frame location + LibWindow.RegisterConfig (StreamerOverlayDpsHpsFrame, StreamOverlay.db.per_second) + LibWindow.RestorePosition (StreamerOverlayDpsHpsFrame) + LibWindow.SavePosition (StreamerOverlayDpsHpsFrame) + --> set the frame strata + SOF:SetFrameStrata (StreamOverlay.db.main_frame_strata) + StreamerOverlayDpsHpsFrame:SetFrameStrata (StreamOverlay.db.main_frame_strata) end - --two resizers - local left_resize = CreateFrame("button", "DetailsStreamerLeftResizer", SOF, "BackdropTemplate") - local right_resize = CreateFrame("button", "DetailsStreamerRightResizer", SOF, "BackdropTemplate") - left_resize:SetPoint("bottomleft", SOF, "bottomleft") - right_resize:SetPoint("bottomright", SOF, "bottomright") - left_resize:SetSize(16, 16) - right_resize:SetSize(16, 16) - right_resize:SetNormalTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) - right_resize:SetHighlightTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) - right_resize:SetPushedTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) - left_resize:SetNormalTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) - left_resize:SetHighlightTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) - left_resize:SetPushedTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) - left_resize:GetNormalTexture():SetTexCoord(1, 0, 0, 1) - left_resize:GetHighlightTexture():SetTexCoord(1, 0, 0, 1) - left_resize:GetPushedTexture():SetTexCoord(1, 0, 0, 1) + --> two resizers + local left_resize = CreateFrame ("button", "DetailsStreamerLeftResizer", SOF, "BackdropTemplate") + local right_resize = CreateFrame ("button", "DetailsStreamerRightResizer", SOF, "BackdropTemplate") + left_resize:SetPoint ("bottomleft", SOF, "bottomleft") + right_resize:SetPoint ("bottomright", SOF, "bottomright") + left_resize:SetSize (16, 16) + right_resize:SetSize (16, 16) + right_resize:SetNormalTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) + right_resize:SetHighlightTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) + right_resize:SetPushedTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) + left_resize:SetNormalTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) + left_resize:SetHighlightTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) + left_resize:SetPushedTexture ([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) + left_resize:GetNormalTexture():SetTexCoord (1, 0, 0, 1) + left_resize:GetHighlightTexture():SetTexCoord (1, 0, 0, 1) + left_resize:GetPushedTexture():SetTexCoord (1, 0, 0, 1) - left_resize:SetScript("OnMouseDown", function(self) + left_resize:SetScript ("OnMouseDown", function (self) if (not SOF.resizing and not StreamOverlay.db.main_frame_locked) then SOF.resizing = true - SOF:StartSizing("bottomleft") + SOF:StartSizing ("bottomleft") end end) - left_resize:SetScript("OnMouseUp", function(self) + left_resize:SetScript ("OnMouseUp", function (self) if (SOF.resizing) then SOF.resizing = false SOF:StopMovingOrSizing() @@ -277,13 +277,13 @@ local function CreatePluginFrames() StreamOverlay:SaveWindowSizeAnLocation() end end) - right_resize:SetScript("OnMouseDown", function(self) + right_resize:SetScript ("OnMouseDown", function (self) if (not SOF.resizing and not StreamOverlay.db.main_frame_locked) then SOF.resizing = true - SOF:StartSizing("bottomright") + SOF:StartSizing ("bottomright") end end) - right_resize:SetScript("OnMouseUp", function(self) + right_resize:SetScript ("OnMouseUp", function (self) if (SOF.resizing) then SOF.resizing = false SOF:StopMovingOrSizing() @@ -293,17 +293,17 @@ local function CreatePluginFrames() end end) - SOF:SetScript("OnSizeChanged", function(self) + SOF:SetScript ("OnSizeChanged", function (self) StreamOverlay:Refresh() end) - SOF:SetScript("OnMouseDown", function(self) + SOF:SetScript ("OnMouseDown", function (self) if (not SOF.moving and not StreamOverlay.db.main_frame_locked) then SOF:StartMoving() SOF.moving = true end end) - SOF:SetScript("OnMouseUp", function(self) + SOF:SetScript ("OnMouseUp", function (self) if (SOF.moving) then SOF.moving = false SOF:StopMovingOrSizing() @@ -313,11 +313,11 @@ local function CreatePluginFrames() end) - --scroll frame - local autoscroll = CreateFrame("scrollframe", "Details_StreamOverlayScrollFrame", SOF, "FauxScrollFrameTemplate, BackdropTemplate") - autoscroll:SetScript("OnVerticalScroll", function(self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, StreamOverlay.UpdateLines) end) + --> scroll frame + local autoscroll = CreateFrame ("scrollframe", "Details_StreamOverlayScrollFrame", SOF, "FauxScrollFrameTemplate, BackdropTemplate") + autoscroll:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, StreamOverlay.UpdateLines) end) - --looks like this isn't working + --> looks like this isn't working function StreamOverlay:ClearAll() if (StreamOverlay.db.use_square_mode) then for index = 1, #StreamOverlay.squares do @@ -454,7 +454,7 @@ local function CreatePluginFrames() end end - --iterate each bar and update its text, icons and statusbar + --> iterate each bar and update its text, icons and statusbar function StreamOverlay:UpdateLines() if (StreamOverlay.db.use_square_mode) then return @@ -463,31 +463,31 @@ local function CreatePluginFrames() FauxScrollFrame_Update(autoscroll, StreamOverlay.total_lines, StreamOverlay.total_lines, 20) for index = 1, StreamOverlay.total_lines do - --here gets the bar and the table with the information to shown on the bar + --> here gets the bar and the table with the information to shown on the bar local data = StreamOverlay.battle_content [index] local line = StreamOverlay.battle_lines [index] if (data) then - --left - line.icon1:SetTexture(data [1]) - line.icon1:SetTexCoord(5/64, 59/64, 5/64, 59/64) + --> left + line.icon1:SetTexture (data [1]) + line.icon1:SetTexCoord (5/64, 59/64, 5/64, 59/64) local text = data [2] - line.text1:SetText(text) + line.text1:SetText (text) local loops = 20 while (line.text1:GetStringWidth() > text1Size and loops > 0) do text = strsub (text, 1, #text-1) - line.text1:SetText(text) + line.text1:SetText (text) loops = loops - 1 --just to be safe end - --right + --> right local text = data [6] - line.text2:SetText(text) + line.text2:SetText (text) local loops = 20 while (line.text2:GetStringWidth() > text2Size and loops > 0) do text = strsub (text, 1, #text-1) - line.text2:SetText(text) + line.text2:SetText (text) loops = loops - 1 --just to be safe end @@ -500,40 +500,40 @@ local function CreatePluginFrames() end if (data[7]) then - line.text2:SetTextColor(data[7].r, data[7].g, data[7].b) + line.text2:SetTextColor (data[7].r, data[7].g, data[7].b) else - line.text2:SetTextColor(1, 1, 1) + line.text2:SetTextColor (1, 1, 1) end - line.icon2:SetTexture(data [4]) - line.icon2:SetTexCoord(unpack(data [5])) + line.icon2:SetTexture (data [4]) + line.icon2:SetTexCoord (unpack (data [5])) if (data [4] == defaultAttackIcon) then - line.icon2:SetSize(iconSize*0.8, iconSize*0.8) - line.icon2:SetPoint("left", line, "center", 8, 0) - line.text2:SetPoint("left", line.icon2, "right", 5, 0) + line.icon2:SetSize (iconSize*0.8, iconSize*0.8) + line.icon2:SetPoint ("left", line, "center", 8, 0) + line.text2:SetPoint ("left", line.icon2, "right", 5, 0) else - line.icon2:SetSize(iconSize, iconSize) - line.icon2:SetPoint("left", line, "center", 8, 0) - line.text2:SetPoint("left", line.icon2, "right", 5, 0) + line.icon2:SetSize (iconSize, iconSize) + line.icon2:SetPoint ("left", line, "center", 8, 0) + line.text2:SetPoint ("left", line.icon2, "right", 5, 0) end - --background - line:SetBackdropColor(unpack(data [8])) + --> background + line:SetBackdropColor (unpack (data [8])) if (data [9]) then - line:SetBackdropBorderColor(unpack(data [9])) + line:SetBackdropBorderColor (unpack (data [9])) else - line:SetBackdropBorderColor(0, 0, 0, 0) + line:SetBackdropBorderColor (0, 0, 0, 0) end - --percentage + --> percentage local castinfo = CastsTable [data.CastID] local percent = castinfo and castinfo.Percent or 0 if (percent > 100) then percent = 100 end - line.statusbar:SetValue(percent) + line.statusbar:SetValue (percent) if (StreamOverlay.db.use_spark) then line.spark:Show() @@ -566,7 +566,7 @@ local function CreatePluginFrames() end --CastStart from the cast_send - table.insert(StreamOverlay.battle_content, 1, {icon1, text1, color1, icon2, icon2coords, text2, color2, backgroundcolor, bordercolor, CastID = ID, CastStart = CastStart, startTime = startTime, endTime = endTime}) + table.insert (StreamOverlay.battle_content, 1, {icon1, text1, color1, icon2, icon2coords, text2, color2, backgroundcolor, bordercolor, CastID = ID, CastStart = CastStart, startTime = startTime, endTime = endTime}) table.remove (StreamOverlay.battle_content, StreamOverlay.total_lines+1) if (StreamOverlay.db.use_square_mode) then @@ -580,48 +580,48 @@ local function CreatePluginFrames() local index = #StreamOverlay.battle_lines+1 - local f = CreateFrame("frame", "StreamOverlayBar" .. index, SOF, "BackdropTemplate") - local statusbar = CreateFrame("StatusBar", "StreamOverlayBar" .. index .. "StatusBar", f, "BackdropTemplate") - local statusbar_texture = statusbar:CreateTexture(nil, "border") - statusbar_texture:SetTexture(1, 1, 1, 0.15) - statusbar:SetStatusBarColor(0, 0, 0, 0) - statusbar:SetStatusBarTexture(statusbar_texture) - statusbar:SetMinMaxValues(0, 100) - statusbar:SetValue(0) - local statusbar_spark = statusbar:CreateTexture(nil, "artwork") - statusbar_spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]]) - statusbar_spark:SetSize(16, 50) - statusbar_spark:SetBlendMode("ADD") + local f = CreateFrame ("frame", "StreamOverlayBar" .. index, SOF, "BackdropTemplate") + local statusbar = CreateFrame ("StatusBar", "StreamOverlayBar" .. index .. "StatusBar", f, "BackdropTemplate") + local statusbar_texture = statusbar:CreateTexture (nil, "border") + statusbar_texture:SetTexture (1, 1, 1, 0.15) + statusbar:SetStatusBarColor (0, 0, 0, 0) + statusbar:SetStatusBarTexture (statusbar_texture) + statusbar:SetMinMaxValues (0, 100) + statusbar:SetValue (0) + local statusbar_spark = statusbar:CreateTexture (nil, "artwork") + statusbar_spark:SetTexture ([[Interface\CastingBar\UI-CastingBar-Spark]]) + statusbar_spark:SetSize (16, 50) + statusbar_spark:SetBlendMode ("ADD") statusbar_spark:Hide() local h = (index-1) * StreamOverlay.db.row_spacement * -1 - f:SetPoint("topleft", SOF, "topleft", 0, h) - f:SetPoint("topright", SOF, "topright", 0, h) + f:SetPoint ("topleft", SOF, "topleft", 0, h) + f:SetPoint ("topright", SOF, "topright", 0, h) --backdrop color not editable - f:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) - f:SetBackdropBorderColor(0, 0, 0, 0) - --f:SetBackdropColor(0, 0, 0, 0) + f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + f:SetBackdropBorderColor (0, 0, 0, 0) + --f:SetBackdropColor (0, 0, 0, 0) - local icon1 = statusbar:CreateTexture(nil, "overlay") - local icon2 = statusbar:CreateTexture(nil, "overlay") + local icon1 = statusbar:CreateTexture (nil, "overlay") + local icon2 = statusbar:CreateTexture (nil, "overlay") - local arrow = statusbar:CreateTexture(nil, "overlay") + local arrow = statusbar:CreateTexture (nil, "overlay") - local text1 = statusbar:CreateFontString(nil, "overlay", "GameFontNormal") - local text2 = statusbar:CreateFontString(nil, "overlay", "GameFontNormal") + local text1 = statusbar:CreateFontString (nil, "overlay", "GameFontNormal") + local text2 = statusbar:CreateFontString (nil, "overlay", "GameFontNormal") - icon1:SetPoint("left", f, "left", 2, 0) --player spell icon - text1:SetPoint("left", icon1, "right", 2, 0) --player spell name + icon1:SetPoint ("left", f, "left", 2, 0) --> player spell icon + text1:SetPoint ("left", icon1, "right", 2, 0) --> player spell name - arrow:SetPoint("center", f, "center") --separate player spell and targets + arrow:SetPoint ("center", f, "center") --> separate player spell and targets - icon2:SetPoint("left", f, "center", 10, 0) - text2:SetPoint("left", icon2, "right", 3, 0) + icon2:SetPoint ("left", f, "center", 10, 0) + text2:SetPoint ("left", icon2, "right", 3, 0) - statusbar:SetPoint("topleft", f, "topleft", 0, 0) - statusbar:SetPoint("bottomright", f, "bottomright", 0, 0) + statusbar:SetPoint ("topleft", f, "topleft", 0, 0) + statusbar:SetPoint ("bottomright", f, "bottomright", 0, 0) f.icon1 = icon1 f.icon2 = icon2 @@ -646,13 +646,13 @@ local function CreatePluginFrames() return end - for i, row in ipairs(StreamOverlay.battle_lines) do + for i, row in ipairs (StreamOverlay.battle_lines) do StreamOverlay:SetBattleLineStyle (row, i) end - --update the dps hps frame text + --> update the dps hps frame text StreamOverlay:SetFontFace (StreamerOverlayDpsHpsFrameText, SharedMedia:Fetch ("font", StreamOverlay.db.font_face)) - StreamOverlay:SetFontColor(StreamerOverlayDpsHpsFrameText, StreamOverlay.db.font_color) + StreamOverlay:SetFontColor (StreamerOverlayDpsHpsFrameText, StreamOverlay.db.font_color) end function StreamOverlay:RefreshAllBoxesStyle() @@ -660,7 +660,7 @@ local function CreatePluginFrames() return end - for i, square in ipairs(StreamOverlay.squares) do + for i, square in ipairs (StreamOverlay.squares) do StreamOverlay:SetSquareStyle(square, i) end end @@ -673,36 +673,36 @@ local function CreatePluginFrames() function StreamOverlay:SetBattleLineStyle (row, index) local options = StreamOverlay.db - row:SetHeight(StreamOverlay.db.row_height) + row:SetHeight (StreamOverlay.db.row_height) if (index) then local h = (index-1) * StreamOverlay.db.row_spacement * -1 - row:SetPoint("topleft", SOF, "topleft", 0, h) - row:SetPoint("topright", SOF, "topright", 0, h) + row:SetPoint ("topleft", SOF, "topleft", 0, h) + row:SetPoint ("topright", SOF, "topright", 0, h) end - StreamOverlay:SetFontSize(row.text1, StreamOverlay.db.font_size) - StreamOverlay:SetFontSize(row.text2, StreamOverlay.db.font_size) + StreamOverlay:SetFontSize (row.text1, StreamOverlay.db.font_size) + StreamOverlay:SetFontSize (row.text2, StreamOverlay.db.font_size) local font = SharedMedia:Fetch ("font", StreamOverlay.db.font_face) StreamOverlay:SetFontFace (row.text1, font) StreamOverlay:SetFontFace (row.text2, font) - StreamOverlay:SetFontColor(row.text1, StreamOverlay.db.font_color) - StreamOverlay:SetFontColor(row.text2, StreamOverlay.db.font_color) + StreamOverlay:SetFontColor (row.text1, StreamOverlay.db.font_color) + StreamOverlay:SetFontColor (row.text2, StreamOverlay.db.font_color) iconSize = StreamOverlay.db.row_height-4 - row.icon1:SetSize(iconSize, iconSize) - row.icon2:SetSize(iconSize, iconSize) + row.icon1:SetSize (iconSize, iconSize) + row.icon2:SetSize (iconSize, iconSize) local current_texture = row.icon2:GetTexture() if (current_texture == defaultAttackIcon) then - row.icon2:SetSize(iconSize*0.8, iconSize*0.8) - row.icon2:SetPoint("left", row, "center", 8, 0) - row.text2:SetPoint("left", row.icon2, "right", 5, 0) + row.icon2:SetSize (iconSize*0.8, iconSize*0.8) + row.icon2:SetPoint ("left", row, "center", 8, 0) + row.text2:SetPoint ("left", row.icon2, "right", 5, 0) else - row.icon2:SetPoint("left", row, "center", 8, 0) - row.text2:SetPoint("left", row.icon2, "right", 5, 0) + row.icon2:SetPoint ("left", row, "center", 8, 0) + row.text2:SetPoint ("left", row.icon2, "right", 5, 0) end if (row.text2:GetText() == "") then @@ -730,7 +730,7 @@ local function CreatePluginFrames() local line_in_use = line.in_use or 1 local content_in_use = StreamOverlay.battle_content [i] and StreamOverlay.battle_content [i].CastStart or 1 - if (max(line_in_use, content_in_use) + 60 < now) then + if (max (line_in_use, content_in_use) + 60 < now) then fader (nil, line, "in") else fader (nil, line, "out") @@ -743,7 +743,7 @@ local function CreatePluginFrames() local line_in_use = line.in_use or 1 local content_in_use = StreamOverlay.battle_content [i] and StreamOverlay.battle_content [i].CastStart or 1 - if (max(line_in_use, content_in_use) + 60 < now) then + if (max (line_in_use, content_in_use) + 60 < now) then fader (nil, StreamOverlay.battle_lines [i], "in") else fader (nil, StreamOverlay.battle_lines [i], "out") @@ -757,7 +757,7 @@ local function CreatePluginFrames() local line_in_use = line.in_use or 1 local content_in_use = StreamOverlay.battle_content[i] and StreamOverlay.battle_content[i].CastStart or 1 - if (max(line_in_use, content_in_use) + 60 < now) then + if (max (line_in_use, content_in_use) + 60 < now) then fader (nil, StreamOverlay.squares[i], "in") else fader (nil, StreamOverlay.squares[i], "out") @@ -960,11 +960,11 @@ local DefaultCoords = {0, 1, 0, 1} local DefaultColor = {r=1, g=1, b=1} local PetCoords = {0.25, 0.49609375, 0.75, 1} -local parse_target_name = function(target) - return StreamOverlay:GetOnlyName(target) +local parse_target_name = function (target) + return StreamOverlay:GetOnlyName (target) end -local parse_target_icon = function(targetObject, target) +local parse_target_icon = function (targetObject, target) local icon2, icon2coords, pclass if (targetObject) then local role = targetObject.role @@ -992,7 +992,7 @@ local parse_target_icon = function(targetObject, target) end end else - local _, class = UnitClass(targetObject.nome) + local _, class = UnitClass (targetObject.nome) if (class) then icon2 = [[Interface\AddOns\Details\images\classes_small_alpha]] icon2coords = Details.class_coords [class] @@ -1003,7 +1003,7 @@ local parse_target_icon = function(targetObject, target) end end else - local _, class = UnitClass(target) + local _, class = UnitClass (target) if (class) then icon2 = [[Interface\AddOns\Details\images\classes_small_alpha]] icon2coords = Details.class_coords [class] @@ -1022,7 +1022,7 @@ local parse_target_icon = function(targetObject, target) return icon2, icon2coords, pclass end -local parse_target_color = function(class) +local parse_target_color = function (class) local color2 = RAID_CLASS_COLORS [class] return color2 end @@ -1040,9 +1040,9 @@ function StreamOverlay:CastStart (castGUID) end local icon, backgroundcolor, bordercolor = StreamOverlay:GetSpellInformation (spellid) - local spellname, _, spellicon = GetSpellInfo(spellid) + local spellname, _, spellicon = GetSpellInfo (spellid) - local targetObject = Details:GetActor("current", 1, target) or Details:GetActor("current", 2, target) + local targetObject = Details:GetActor ("current", 1, target) or Details:GetActor ("current", 2, target) local icon2, icon2coords, class = parse_target_icon (targetObject, target) local color2 @@ -1078,9 +1078,9 @@ function StreamOverlay:CastFinished (castid) --just casted a instant spell local icon, backgroundcolor, bordercolor = StreamOverlay:GetSpellInformation (spellid) - local spellname, _, spellicon = GetSpellInfo(spellid) + local spellname, _, spellicon = GetSpellInfo (spellid) - local targetObject = Details:GetActor("current", 1, target) or Details:GetActor("current", 2, target) + local targetObject = Details:GetActor ("current", 1, target) or Details:GetActor ("current", 2, target) local icon2, icon2coords, class = parse_target_icon (targetObject, target) @@ -1110,23 +1110,23 @@ eventFrame.track_spell_cast = function() if (not castinfo.Done) then - --is being casted? + --> is being casted? if (castinfo.HasCastTime) then if (castinfo.Success) then - --okey it's done + --> okey it's done castinfo.Done = true castinfo.Percent = 100 - line.statusbar:SetValue(100) - line.spark:SetPoint("left", line.statusbar, "left", (line.statusbar:GetWidth() / 100 * 100) - 8, 0) + line.statusbar:SetValue (100) + line.spark:SetPoint ("left", line.statusbar, "left", (line.statusbar:GetWidth() / 100 * 100) - 8, 0) --line.spark:Hide() elseif (castinfo.Interrupted) then - --has been interrupted + --> has been interrupted castinfo.Done = true - line.spark:SetVertexColor(1, 0.7, 0) + line.spark:SetVertexColor (1, 0.7, 0) elseif (castinfo.IsChanneled) then - --casting a channeled spell + --> casting a channeled spell local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo ("player") if (name) then @@ -1136,9 +1136,9 @@ eventFrame.track_spell_cast = function() local diff = endTime - startTime local current = GetTime() - startTime local percent = current / diff * 100 - percent = math.abs(percent - 100) + percent = math.abs (percent - 100) castinfo.Percent = percent - line.statusbar:SetValue(percent) + line.statusbar:SetValue (percent) if (StreamOverlay.db.use_spark) then line.spark:Show() else @@ -1150,7 +1150,7 @@ eventFrame.track_spell_cast = function() end else - --still casting + --> still casting local spell, displayName, icon, startTime, endTime, isTradeSkill, castID, interrupt = UnitCastingInfo("player") if (spell) then startTime = startTime / 1000 @@ -1161,7 +1161,7 @@ eventFrame.track_spell_cast = function() local percent = current / diff * 100 castinfo.Percent = percent - line.statusbar:SetValue(percent) + line.statusbar:SetValue (percent) if (StreamOverlay.db.use_spark) then line.spark:Show() else @@ -1173,12 +1173,12 @@ eventFrame.track_spell_cast = function() end else - --it's instant cast + --> it's instant cast if (castinfo.CastStart+1.2 < GetTime()) then castinfo.Done = true castinfo.Percent = 100 - line.statusbar:SetValue(100) - line.spark:SetPoint("left", line.statusbar, "left", (line.statusbar:GetWidth() / 100 * 100) - 8, 0) + line.statusbar:SetValue (100) + line.spark:SetPoint ("left", line.statusbar, "left", (line.statusbar:GetWidth() / 100 * 100) - 8, 0) --line.spark:Hide() else local startTime = castinfo.CastStart @@ -1189,7 +1189,7 @@ eventFrame.track_spell_cast = function() local percent = current / diff * 100 castinfo.Percent = percent - line.statusbar:SetValue(percent) + line.statusbar:SetValue (percent) if (StreamOverlay.db.use_spark) then line.spark:Show() @@ -1197,8 +1197,8 @@ eventFrame.track_spell_cast = function() line.spark:Hide() end - line.spark:SetVertexColor(1, 1, 1, 1) - line.spark:SetPoint("left", line.statusbar, "left", (line.statusbar:GetWidth() / 100 * percent) - 6, 0) + line.spark:SetVertexColor (1, 1, 1, 1) + line.spark:SetPoint ("left", line.statusbar, "left", (line.statusbar:GetWidth() / 100 * percent) - 6, 0) end end @@ -1215,23 +1215,23 @@ eventFrame.track_spell_cast = function() if (not castinfo.Done and line) then - --is being casted? + --> is being casted? if (castinfo.HasCastTime) then if (castinfo.Success) then - --okey it's done + --> okey it's done castinfo.Done = true castinfo.Percent = 100 StreamOverlay:UpdateCooldownFrame(line, false) elseif (castinfo.Interrupted) then - --has been interrupted + --> has been interrupted castinfo.Done = true local totalTime = castinfo.CastTimeEnd - castinfo.CastTimeStart local pct = castinfo.CastTimeEnd - GetTime() castinfo.InterruptedPct = pct / totalTime elseif (castinfo.IsChanneled) then - --casting a channeled spell + --> casting a channeled spell local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible = UnitChannelInfo ("player") if (name) then @@ -1241,13 +1241,13 @@ eventFrame.track_spell_cast = function() local diff = endTime - startTime local current = GetTime() - startTime local percent = current / diff * 100 - percent = math.abs(percent - 100) + percent = math.abs (percent - 100) castinfo.Percent = percent StreamOverlay:UpdateCooldownFrame(line, true, startTime, endTime, castinfo) end else - --still casting + --> still casting local spell, displayName, icon, startTime, endTime, isTradeSkill, castID, interrupt = UnitCastingInfo ("player") if (spell) then startTime = startTime / 1000 @@ -1261,7 +1261,7 @@ eventFrame.track_spell_cast = function() end else - --it's instant cast + --> it's instant cast if (castinfo.CastStart+1.2 < GetTime()) then castinfo.Done = true castinfo.Percent = 100 @@ -1291,21 +1291,21 @@ eventFrame.track_spell_cast = function() end function eventFrame:RegisterMyEvents() - eventFrame:RegisterEvent("UNIT_SPELLCAST_START") - eventFrame:RegisterEvent("UNIT_SPELLCAST_SENT") - eventFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") - eventFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") - eventFrame:RegisterEvent("UNIT_SPELLCAST_FAILED_QUIET") - eventFrame:RegisterEvent("UNIT_SPELLCAST_FAILED") - eventFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED") - eventFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") - eventFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP") - eventFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE") - eventFrame:RegisterEvent("UNIT_SPELLCAST_STOP") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_START") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_SENT") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_SUCCEEDED") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_INTERRUPTED") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_FAILED_QUIET") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_FAILED") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_DELAYED") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_CHANNEL_START") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_CHANNEL_STOP") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_CHANNEL_UPDATE") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_STOP") if (not DetailsFramework.IsTBCWow() and not DetailsFramework.IsWotLKWow()) then - eventFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE") - eventFrame:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_INTERRUPTIBLE") + eventFrame:RegisterEvent ("UNIT_SPELLCAST_NOT_INTERRUPTIBLE") end end @@ -1335,18 +1335,18 @@ local lastChannelSpell = "" local APM = 0 local ACTIONS = 0 local ACTIONS_EVENT_TIME = {} -local AMP_Tick = C_Timer.NewTicker(1, function() +local AMP_Tick = C_Timer.NewTicker (1, function() APM = ACTIONS * 60 ACTIONS = 0 end) -local APM_FRAME = CreateFrame("frame", "DetailsAPMFrame", UIParent, "BackdropTemplate") -APM_FRAME:RegisterEvent("PLAYER_STARTED_MOVING") -APM_FRAME:RegisterEvent("PLAYER_STOPPED_MOVING") -APM_FRAME:SetScript("OnEvent", function() +local APM_FRAME = CreateFrame ("frame", "DetailsAPMFrame", UIParent, "BackdropTemplate") +APM_FRAME:RegisterEvent ("PLAYER_STARTED_MOVING") +APM_FRAME:RegisterEvent ("PLAYER_STOPPED_MOVING") +APM_FRAME:SetScript ("OnEvent", function() ACTIONS = ACTIONS + 1 end) -eventFrame:SetScript("OnEvent", function(self, event, ...) +eventFrame:SetScript ("OnEvent", function (self, event, ...) if (event ~= "UNIT_SPELLCAST_SENT" and event ~= "UNIT_SPELLCAST_SUCCEEDED" and ACTIONS_EVENT_TIME [event] ~= GetTime()) then ACTIONS = ACTIONS + 1 ACTIONS_EVENT_TIME [event] = GetTime() @@ -1355,7 +1355,7 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) if (event == "UNIT_SPELLCAST_SENT") then local unitID, target, castGUID, spellID = ... --local unitID, spell, rank, target, id = ... - local spell = GetSpellInfo(spellID) + local spell = GetSpellInfo (spellID) if (unitID == "player") then CastsTable [castGUID] = {Target = target or "", Id = castGUID, CastStart = GetTime()} @@ -1389,7 +1389,7 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) CastsTable [castGUID].InterruptedTime = GetTime() end - --channels isn't passing the CastID / cast id for channels is always Zero. + --> channels isn't passing the CastID / cast id for channels is always Zero. elseif (event == "UNIT_SPELLCAST_CHANNEL_STOP") then --local unitID, spell, rank, id, spellID = ... local unitID, castGUID, spellID = ... @@ -1419,7 +1419,7 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) end if (ischanneling) then - --channel updated + --> channel updated CastsTable [lastchannelid].Interrupted = true CastsTable [lastchannelid].InterruptedTime = GetTime() end @@ -1447,16 +1447,16 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) elseif (event == "UNIT_SPELLCAST_SUCCEEDED") then --local unitID, spell, rank, id, spellID = ... local unitID, castGUID, spellID = ... - local spell = GetSpellInfo(spellID) + local spell = GetSpellInfo (spellID) if (unitID == "player" and CastsTable[castGUID] and not channelspells [spell]) then if (CastsTable[castGUID].HasCastTime and not CastsTable[castGUID].IsChanneled) then - --a cast (non channeled) just successful finished + --> a cast (non channeled) just successful finished CastsTable [castGUID].Success = true StreamOverlay:CastFinished (castGUID) elseif (not CastsTable[castGUID].HasCastTime) then - --instant cast finished + --> instant cast finished CastsTable [castGUID].SpellId = spellID CastsTable [castGUID].Success = true StreamOverlay:CastFinished (castGUID) @@ -1466,12 +1466,12 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) end) -local format_time = function(v) return "-" .. format("%.2f", v) end +local format_time = function (v) return "-" .. format ("%.2f", v) end --when the player die, show the events before the death function StreamOverlay.OnDeath (_, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, death_table, last_cooldown, death_at_combattime, max_health) - if (alvo_serial ~= UnitGUID("player")) then + if (alvo_serial ~= UnitGUID ("player")) then return end @@ -1479,8 +1479,8 @@ function StreamOverlay.OnDeath (_, token, time, who_serial, who_name, who_flags, for i = 1, #death_table do local ev = death_table [i] - if (ev and type(ev) == "table" and ev[1] and type(ev[1]) == "boolean") then - --it's a damage + if (ev and type (ev) == "table" and ev[1] and type (ev[1]) == "boolean") then + --> it's a damage local spellid = ev[2] local amount = ev[3] local attime = ev[4] @@ -1489,17 +1489,17 @@ function StreamOverlay.OnDeath (_, token, time, who_serial, who_name, who_flags, local absorbed = ev[7] --get the actor from details - local sourceObject = Details:GetActor("current", 1, source) + local sourceObject = Details:GetActor ("current", 1, source) local classIcon, l, r, t, b if (sourceObject) then - classIcon, l, r, t, b = StreamOverlay:GetClassIcon(sourceObject.classe) + classIcon, l, r, t, b = StreamOverlay:GetClassIcon (sourceObject.classe) else classIcon, l, r, t, b = defaultAttackIcon, 0, 1, 0, 1 end --spellname local spellname, _, spellicon = StreamOverlay.getspellinfo (spellid) - source = StreamOverlay:GetOnlyName(source) + source = StreamOverlay:GetOnlyName (source) local CastInfoIndex = i * -1 @@ -1539,7 +1539,7 @@ function StreamOverlay.OnDeath (_, token, time, who_serial, who_name, who_flags, end ---passes the new lock state +--> passes the new lock state --the window is click throught when locked function StreamOverlay:SetLocked (state) @@ -1548,19 +1548,19 @@ function StreamOverlay:SetLocked (state) end if (state) then - --is locked + --> is locked StreamOverlay.db.main_frame_locked = true DetailsStreamerTitlebar:Hide() DetailsStreamerLeftResizer:Hide() DetailsStreamerRightResizer:Hide() - SOF:EnableMouse(false) + SOF:EnableMouse (false) else - --not locked + --> not locked StreamOverlay.db.main_frame_locked = false DetailsStreamerTitlebar:Show() DetailsStreamerLeftResizer:Show() DetailsStreamerRightResizer:Show() - SOF:EnableMouse(true) + SOF:EnableMouse (true) end StreamOverlay:UpdateDpsHpsFrameConfig() @@ -1569,21 +1569,21 @@ end ---------------------------------------------------------------------------------------------------------------------------------------------------------------- --on screen hps dps -local screen_frame = CreateFrame("frame", "StreamerOverlayDpsHpsFrame", UIParent, "BackdropTemplate") -screen_frame:SetSize(70, 20) -screen_frame:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) -screen_frame:SetBackdropColor(.1, .1, .1, .9) -screen_frame:SetMovable(true) +local screen_frame = CreateFrame ("frame", "StreamerOverlayDpsHpsFrame", UIParent, "BackdropTemplate") +screen_frame:SetSize (70, 20) +screen_frame:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) +screen_frame:SetBackdropColor (.1, .1, .1, .9) +screen_frame:SetMovable (true) screen_frame:Hide() -screen_frame:SetPoint("center", UIParent, "center") -screen_frame:SetScript("OnMouseDown", function(self) +screen_frame:SetPoint ("center", UIParent, "center") +screen_frame:SetScript ("OnMouseDown", function (self) if (not screen_frame.moving and not StreamOverlay.db.main_frame_locked) then screen_frame:StartMoving() screen_frame.moving = true screen_frame.movingAt = GetTime() end end) -screen_frame:SetScript("OnMouseUp", function(self) +screen_frame:SetScript ("OnMouseUp", function (self) if (screen_frame.movingAt) then if (screen_frame.moving) then screen_frame.moving = false @@ -1599,19 +1599,19 @@ screen_frame:SetScript("OnMouseUp", function(self) StreamOverlay.OpenOptionsPanel() end end) -screen_frame:SetScript("OnEnter", function(self) - GameTooltip:SetOwner(self) - GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT") - GameTooltip:AddLine("|cFFFF7700Left Click|r: Open Options\n|cFFFF7700Slash Command|r: /streamer") +screen_frame:SetScript ("OnEnter", function (self) + GameTooltip:SetOwner (self) + GameTooltip:SetOwner (self, "ANCHOR_TOPLEFT") + GameTooltip:AddLine ("|cFFFF7700Left Click|r: Open Options\n|cFFFF7700Slash Command|r: /streamer") GameTooltip:Show() end) -screen_frame:SetScript("OnLeave", function() +screen_frame:SetScript ("OnLeave", function() GameTooltip:Hide() end) -local screen_frame_text = screen_frame:CreateFontString("StreamerOverlayDpsHpsFrameText", "overlay", "GameFontNormal") -screen_frame_text:SetPoint("center", screen_frame, "center") +local screen_frame_text = screen_frame:CreateFontString ("StreamerOverlayDpsHpsFrameText", "overlay", "GameFontNormal") +screen_frame_text:SetPoint ("center", screen_frame, "center") screen_frame.text = screen_frame_text local screen_frame_attribute = 1 @@ -1630,20 +1630,20 @@ function StreamOverlay:UpdateDpsHpsFrameConfig (PluginDisabled) local db = StreamOverlay.db.per_second - StreamOverlay:SetFontSize(screen_frame.text, db.size) + StreamOverlay:SetFontSize (screen_frame.text, db.size) StreamOverlay:SetFontOutline (screen_frame.text, db.font_shadow) - screen_frame:SetScale(db.scale) + screen_frame:SetScale (db.scale) screen_frame_attribute = db.attribute_type format_function = Details:GetCurrentToKFunction() if (StreamOverlay.db.main_frame_locked) then - screen_frame:SetBackdrop(nil) - screen_frame:EnableMouse(false) + screen_frame:SetBackdrop (nil) + screen_frame:EnableMouse (false) else - screen_frame:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) - screen_frame:SetBackdropColor(.1, .1, .1, .9) - screen_frame:EnableMouse(true) + screen_frame:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) + screen_frame:SetBackdropColor (.1, .1, .1, .9) + screen_frame:EnableMouse (true) end if (db.enabled) then @@ -1652,7 +1652,7 @@ function StreamOverlay:UpdateDpsHpsFrameConfig (PluginDisabled) StreamOverlay.DpsHpsTick:Cancel() StreamOverlay.DpsHpsTick = nil end - StreamOverlay.DpsHpsTick = C_Timer.NewTicker(db.update_speed, StreamOverlay.UpdateDpsHpsFrame) + StreamOverlay.DpsHpsTick = C_Timer.NewTicker (db.update_speed, StreamOverlay.UpdateDpsHpsFrame) else screen_frame:Hide() if (StreamOverlay.DpsHpsTick) then @@ -1661,24 +1661,24 @@ function StreamOverlay:UpdateDpsHpsFrameConfig (PluginDisabled) end end - --update the dps hps frame text + --> update the dps hps frame text StreamOverlay:SetFontFace (StreamerOverlayDpsHpsFrameText, SharedMedia:Fetch ("font", StreamOverlay.db.font_face)) - StreamOverlay:SetFontColor(StreamerOverlayDpsHpsFrameText, StreamOverlay.db.font_color) + StreamOverlay:SetFontColor (StreamerOverlayDpsHpsFrameText, StreamOverlay.db.font_color) end function StreamOverlay:UpdateDpsHpsFrame() - --low level actor parsing - we can just use Details:GetActor(), but is faster without having to call functions + --> low level actor parsing - we can just use Details:GetActor(), but is faster without having to call functions local container = _detalhes.tabela_vigente [screen_frame_attribute] local actor = container._ActorTable [container._NameIndexTable [playerName]] if (actor) then - screen_frame_text:SetText(format_function (_, actor.total / _detalhes.tabela_vigente:GetCombatTime())) + screen_frame_text:SetText (format_function (_, actor.total / _detalhes.tabela_vigente:GetCombatTime())) else if (StreamOverlay.db.per_second.attribute_type == 1) then - screen_frame_text:SetText("DPS") + screen_frame_text:SetText ("DPS") else - screen_frame_text:SetText("HPS") + screen_frame_text:SetText ("HPS") end end end @@ -1690,11 +1690,11 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) if (not StreamOverlayOptionsPanel) then local detailsFramework = Details:GetFramework() - local options_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") - local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") - local options_switch_template = detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") - local options_slider_template = detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") - local options_button_template = detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") + local options_text_template = detailsFramework:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") + local options_dropdown_template = detailsFramework:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") + local options_switch_template = detailsFramework:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE") + local options_slider_template = detailsFramework:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE") + local options_button_template = detailsFramework:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") local optionsFrame = StreamOverlay:CreatePluginOptionsFrame("StreamOverlayOptionsPanel", "Details! Streamer: Action Tracker", 1) optionsFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) @@ -1790,7 +1790,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) for name, fontPath in pairs(fontObjects) do fontTable[#fontTable+1] = {value = name, label = name, onclick = setFontFace, font = fontPath, descfont = name} end - table.sort(fontTable, function(t1, t2) return t1.label < t2.label end) + table.sort(fontTable, function (t1, t2) return t1.label < t2.label end) -- select arrow local arrows = { @@ -1825,13 +1825,13 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) end local arrowIconTable = {} - for _, arrow in ipairs(arrows) do - arrowIconTable[#arrowIconTable+1] = {value = arrow, label = arrow:gsub("Interface(.*)\\", ""), onclick = setArrowTextureCallback, icon = arrow} + for _, arrow in ipairs (arrows) do + arrowIconTable[#arrowIconTable+1] = {value = arrow, label = arrow:gsub ("Interface(.*)\\", ""), onclick = setArrowTextureCallback, icon = arrow} end -- - local setWindowStrataCallback = function(_, _, strata) + local setWindowStrataCallback = function (_, _, strata) StreamOverlay.db.main_frame_strata = strata SOF:SetFrameStrata(strata) StreamerOverlayDpsHpsFrame:SetFrameStrata(strata) @@ -1868,7 +1868,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) desc = "Can't move or interact within the frame when it's locked.", order = 1, get = function() return StreamOverlay.db.main_frame_locked end, - set = function(self, fixedParam, val) + set = function (self, fixedParam, val) StreamOverlay:SetLocked (not StreamOverlay.db.main_frame_locked) end, }, @@ -1879,7 +1879,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) desc = "Show/Hide minimap icon.", order = 1, get = function() return not StreamOverlay.db.minimap.hide end, - set = function(self, fixedParam, val) + set = function (self, fixedParam, val) StreamOverlay.db.minimap.hide = not StreamOverlay.db.minimap.hide if (LDBIcon) then LDBIcon:Refresh ("DetailsStreamer", StreamOverlay.db.minimap) @@ -1890,7 +1890,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "color", get = function() return StreamOverlay.db.main_frame_color end, - set = function(self, r, g, b, a) + set = function (self, r, g, b, a) StreamOverlay:SetBackgroundColor (r, g, b, a) end, desc = "Color used on the background.", @@ -1900,7 +1900,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.scale or 1 end, - set = function(self, fixedparam, value) StreamOverlay.db.scale = value; StreamOverlay.Frame:SetScale(value) end, + set = function (self, fixedparam, value) StreamOverlay.db.scale = value; StreamOverlay.Frame:SetScale(value) end, min = 0.6, max = 2, step = 0.1, @@ -1914,7 +1914,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.row_height end, - set = function(self, fixedparam, value) StreamOverlay.db.row_height = value; StreamOverlay:RefreshAllBattleLineStyle() end, + set = function (self, fixedparam, value) StreamOverlay.db.row_height = value; StreamOverlay:RefreshAllBattleLineStyle() end, min = 10, max = 30, step = 1, @@ -1925,7 +1925,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.row_spacement end, - set = function(self, fixedparam, value) StreamOverlay.db.row_spacement = value; StreamOverlay:RefreshAllBattleLineStyle() end, + set = function (self, fixedparam, value) StreamOverlay.db.row_spacement = value; StreamOverlay:RefreshAllBattleLineStyle() end, min = 8, max = 31, step = 1, @@ -1944,7 +1944,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "color", get = function() return StreamOverlay.db.row_color end, - set = function(self, r, g, b, a) + set = function (self, r, g, b, a) local c = StreamOverlay.db.row_color c[1], c[2], c[3], c[4] = r, g, b, a StreamOverlay:RefreshAllBattleLineStyle() @@ -1958,7 +1958,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.font_size end, - set = function(self, fixedparam, value) StreamOverlay.db.font_size = value; StreamOverlay:RefreshAllBattleLineStyle() end, + set = function (self, fixedparam, value) StreamOverlay.db.font_size = value; StreamOverlay:RefreshAllBattleLineStyle() end, min = 8, max = 32, step = 1, @@ -1977,7 +1977,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "color", get = function() return StreamOverlay.db.font_color end, - set = function(self, r, g, b, a) + set = function (self, r, g, b, a) local c = StreamOverlay.db.font_color c[1], c[2], c[3], c[4] = r, g, b, a StreamOverlay:RefreshAllBattleLineStyle() @@ -1994,7 +1994,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) desc = "Show in the screen your current Dps or Hps.", order = 1, get = function() return StreamOverlay.db.per_second.enabled end, - set = function(self, fixedParam, val) + set = function (self, fixedParam, val) StreamOverlay.db.per_second.enabled = not StreamOverlay.db.per_second.enabled -- update hps dps frame StreamOverlay:UpdateDpsHpsFrameConfig() @@ -2012,7 +2012,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.per_second.size end, - set = function(self, fixedparam, value) StreamOverlay.db.per_second.size = value; + set = function (self, fixedparam, value) StreamOverlay.db.per_second.size = value; -- update hps dps frame StreamOverlay:UpdateDpsHpsFrameConfig() end, @@ -2026,7 +2026,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.per_second.scale end, - set = function(self, fixedparam, value) StreamOverlay.db.per_second.scale = value; + set = function (self, fixedparam, value) StreamOverlay.db.per_second.scale = value; -- update hps dps frame StreamOverlay:UpdateDpsHpsFrameConfig() end, @@ -2041,7 +2041,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.per_second.update_speed end, - set = function(self, fixedparam, value) StreamOverlay.db.per_second.update_speed = value; + set = function (self, fixedparam, value) StreamOverlay.db.per_second.update_speed = value; -- update hps dps frame StreamOverlay:UpdateDpsHpsFrameConfig() end, @@ -2059,7 +2059,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) desc = "Enable text shadow.", order = 1, get = function() return StreamOverlay.db.per_second.font_shadow end, - set = function(self, fixedParam, val) + set = function (self, fixedParam, val) StreamOverlay.db.per_second.font_shadow = not StreamOverlay.db.per_second.font_shadow -- update hps dps frame StreamOverlay:UpdateDpsHpsFrameConfig() @@ -2071,7 +2071,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.square_amount end, - set = function(self, fixedparam, value) + set = function (self, fixedparam, value) StreamOverlay.db.square_amount = value StreamOverlay:Refresh() end, @@ -2084,7 +2084,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.square_size end, - set = function(self, fixedparam, value) + set = function (self, fixedparam, value) StreamOverlay.db.square_size = value StreamOverlay:RefreshAllBoxesStyle() end, @@ -2115,7 +2115,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.arrow_size end, - set = function(self, fixedparam, value) StreamOverlay.db.arrow_size = value; StreamOverlay:RefreshAllBattleLineStyle() end, + set = function (self, fixedparam, value) StreamOverlay.db.arrow_size = value; StreamOverlay:RefreshAllBattleLineStyle() end, min = 6, max = 32, step = 1, @@ -2126,7 +2126,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "color", get = function() return StreamOverlay.db.arrow_color end, - set = function(self, r, g, b, a) + set = function (self, r, g, b, a) local c = StreamOverlay.db.arrow_color c[1], c[2], c[3], c[4] = r, g, b, a StreamOverlay:RefreshAllBattleLineStyle() @@ -2138,7 +2138,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.arrow_anchor_x end, - set = function(self, fixedparam, value) StreamOverlay.db.arrow_anchor_x = value; StreamOverlay:RefreshAllBattleLineStyle() end, + set = function (self, fixedparam, value) StreamOverlay.db.arrow_anchor_x = value; StreamOverlay:RefreshAllBattleLineStyle() end, min = -16, max = 16, step = 1, @@ -2149,7 +2149,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.arrow_anchor_y end, - set = function(self, fixedparam, value) StreamOverlay.db.arrow_anchor_y = value; StreamOverlay:RefreshAllBattleLineStyle() end, + set = function (self, fixedparam, value) StreamOverlay.db.arrow_anchor_y = value; StreamOverlay:RefreshAllBattleLineStyle() end, min = -16, max = 16, step = 1, @@ -2162,7 +2162,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.main_frame_size[1] end, - set = function(self, fixedparam, value) StreamOverlay.db.main_frame_size[1] = value; StreamOverlay:RestoreWindowSizeAndLocation() end, + set = function (self, fixedparam, value) StreamOverlay.db.main_frame_size[1] = value; StreamOverlay:RestoreWindowSizeAndLocation() end, min = 150, max = 800, step = 1, @@ -2173,7 +2173,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) { type = "range", get = function() return StreamOverlay.db.main_frame_size[2] end, - set = function(self, fixedparam, value) StreamOverlay.db.main_frame_size[2] = value; StreamOverlay:RestoreWindowSizeAndLocation() end, + set = function (self, fixedparam, value) StreamOverlay.db.main_frame_size[2] = value; StreamOverlay:RestoreWindowSizeAndLocation() end, min = 40, max = 1024, step = 1, @@ -2196,7 +2196,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) desc = "Show or hide the spark at bars", order = 1, get = function() return StreamOverlay.db.use_spark end, - set = function(self, fixedParam, val) + set = function (self, fixedParam, val) StreamOverlay.db.use_spark = not StreamOverlay.db.use_spark @@ -2211,55 +2211,55 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) local selectProfile = function(_, _, profileName) local pname = UnitName("player") .. " - " .. GetRealmName() - --save the current config on the profile + --> save the current config on the profile local current_profile = Details_StreamerDB.characters [pname] local current_ptable = Details_StreamerDB.profiles [current_profile] _detalhes.table.overwrite (current_ptable, StreamOverlay.db) --overwrite the profile with the local settings - --get the selected profile and overwrite the settings + --> get the selected profile and overwrite the settings local ptable = Details_StreamerDB.profiles [profileName] - _detalhes.table.deploy(ptable, StreamOverlay.DefaultConfigTable) --update with any new config from the default table + _detalhes.table.deploy (ptable, StreamOverlay.DefaultConfigTable) --update with any new config from the default table _detalhes.table.overwrite (StreamOverlay.db, ptable) --overwrite the local settings with the profile settings Details_StreamerDB.characters [pname] = profileName - --restore size and location + --> restore size and location StreamOverlay:RestoreWindowSizeAndLocation() - --set locked and the backdrop color + --> set locked and the backdrop color StreamOverlay:SetLocked (StreamOverlay.db.main_frame_locked) - StreamOverlay:SetBackgroundColor (unpack(StreamOverlay.db.main_frame_color)) + StreamOverlay:SetBackgroundColor (unpack (StreamOverlay.db.main_frame_color)) - --update the minimap icon + --> update the minimap icon if (LDBIcon) then LDBIcon:Refresh ("DetailsStreamer", StreamOverlay.db.minimap) end - --update all settings + --> update all settings StreamOverlay:RefreshAllBattleLineStyle() - --update the options panel + --> update the options panel optionsFrame:RefreshOptions() end local select_profile_fill = function() local t = {} - for profileName, _ in pairs(Details_StreamerDB.profiles) do + for profileName, _ in pairs (Details_StreamerDB.profiles) do t [#t+1] = {value = profileName, label = profileName, onclick = selectProfile} end return t end - local label_profile = Details.gump:CreateLabel(optionsFrame, "Profile" .. ": ", Details.gump:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) - local dropdown_profile = Details.gump:CreateDropDown (optionsFrame, select_profile_fill, nil, 160, 20, "dropdown_profile", nil, Details.gump:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - dropdown_profile:SetPoint("left", label_profile, "right", 2, 0) - label_profile:SetPoint("topleft", optionsFrame, "topleft", 15, -65) + local label_profile = Details.gump:CreateLabel (optionsFrame, "Profile" .. ": ", Details.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) + local dropdown_profile = Details.gump:CreateDropDown (optionsFrame, select_profile_fill, nil, 160, 20, "dropdown_profile", nil, Details.gump:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + dropdown_profile:SetPoint ("left", label_profile, "right", 2, 0) + label_profile:SetPoint ("topleft", optionsFrame, "topleft", 15, -65) local pname = UnitName ("player") .. " - " .. GetRealmName() - dropdown_profile:Select(Details_StreamerDB.characters [pname]) + dropdown_profile:Select (Details_StreamerDB.characters [pname]) - --new profile button + --> new profile button if (not Details_StreamerDB.profiles [pname]) then local add_profile = function() --profile name @@ -2269,21 +2269,21 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) --load dbtable Details_StreamerDB.profiles [pname] = {} _detalhes.table.overwrite (Details_StreamerDB.profiles [pname], StreamOverlay.db) - _detalhes.table.deploy(Details_StreamerDB.profiles [pname], StreamOverlay.DefaultConfigTable) --update with any new config from the default table + _detalhes.table.deploy (Details_StreamerDB.profiles [pname], StreamOverlay.DefaultConfigTable) --update with any new config from the default table --StreamOverlay.db = Details_StreamerDB.profiles [pname] --no can't change the local database table optionsFrame.NewProfileButton:Hide() - --update all settings + --> update all settings StreamOverlay:RefreshAllBattleLineStyle() - --update the options panel + --> update the options panel optionsFrame:RefreshOptions() - dropdown_profile:Select(Details_StreamerDB.characters [pname]) + dropdown_profile:Select (Details_StreamerDB.characters [pname]) end - optionsFrame.NewProfileButton = Details.gump:CreateButton(optionsFrame, add_profile, 60, 18, "New Profiile", _, _, _, _, _, _, Details.gump:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"), Details.gump:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) - optionsFrame.NewProfileButton:SetPoint("left", dropdown_profile, "right", 4, 0) + optionsFrame.NewProfileButton = Details.gump:CreateButton (optionsFrame, add_profile, 60, 18, "New Profiile", _, _, _, _, _, _, Details.gump:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"), Details.gump:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) + optionsFrame.NewProfileButton:SetPoint ("left", dropdown_profile, "right", 4, 0) end --enable / disable plugin button @@ -2309,15 +2309,15 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) local pluginStable = Details:GetPluginSavedTable("DETAILS_PLUGIN_STREAM_OVERLAY") local toggleButton = DetailsFramework:CreateButton(optionsFrame, toggle_OnOff, 120, 20, pluginStable.enabled and "Disable Plugin" or "Start Plugin") - toggleButton:SetPoint("topleft", optionsFrame, "topleft", 15, -35) + toggleButton:SetPoint ("topleft", optionsFrame, "topleft", 15, -35) toggleButton:SetTemplate(DetailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) optionsFrame.toggleButton = toggleButton - optionsFrame:SetScript("OnHide", function() + optionsFrame:SetScript ("OnHide", function() if (StreamOverlay.FromOptionsPanel) then - --reopen the options panel - C_Timer.After(0.2, function() + --> reopen the options panel + C_Timer.After (0.2, function() Details:OpenOptionsWindow(Details:GetInstance(1)) end) end @@ -2344,7 +2344,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) StreamOverlay.FromOptionsPanel = fromOptionsPanel if (fromOptionsPanel) then if (DetailsOptionsWindow) then - C_Timer.After(0.2, function() + C_Timer.After (0.2, function() DetailsOptionsWindow:Hide() end) end @@ -2356,7 +2356,7 @@ end function StreamOverlay:OnEvent (_, event, ...) if (event == "ADDON_LOADED") then - local AddonName = select(1, ...) + local AddonName = select (1, ...) if (AddonName == "Details_Streamer") then playerName = UnitName ("player") @@ -2367,10 +2367,10 @@ function StreamOverlay:OnEvent (_, event, ...) return end - --create widgets + --> create widgets CreatePluginFrames() - --core version required + --> core version required local MINIMAL_DETAILS_VERSION_REQUIRED = 80 local default_options_table = { @@ -2416,10 +2416,10 @@ function StreamOverlay:OnEvent (_, event, ...) StreamOverlay.DefaultConfigTable = default_options_table - --Install + --> Install local install, saveddata = _G._detalhes:InstallPlugin ("TOOLBAR", "Action Tracker", [[Interface\MINIMAP\MOVIERECORDINGICON]], StreamOverlay, "DETAILS_PLUGIN_STREAM_OVERLAY", MINIMAL_DETAILS_VERSION_REQUIRED, "Terciob", StreamOverlay.CurrentVersion, default_options_table) - if (type(install) == "table" and install.error) then - print(install.error) + if (type (install) == "table" and install.error) then + print (install.error) end Details_StreamerDB = Details_StreamerDB or {characters = {}, profiles = {}} @@ -2429,7 +2429,7 @@ function StreamOverlay:OnEvent (_, event, ...) StreamOverlay:SetPluginDescription ("Show in real time the spells you are casting.\n\nThe viewer can now follow what you are doing, what spells you are casting, learn your rotation.\n\nAlso tells who is the target and its class/spec on raiding or role if you are in arena.\n\nWhen you die, the panel is filled with your death log.") if (StreamOverlay.db.is_first_run) then --problem with setting the plugin as disabled - if (Details:GetTutorialCVar("STREAMER_PLUGIN_FIRSTRUN")) then + if (Details:GetTutorialCVar ("STREAMER_PLUGIN_FIRSTRUN")) then Details:DisablePlugin ("DETAILS_PLUGIN_STREAM_OVERLAY") StreamOverlay.db.is_first_run = false else @@ -2437,7 +2437,7 @@ function StreamOverlay:OnEvent (_, event, ...) end end - if (StreamOverlay.db.is_first_run and not Details:GetTutorialCVar("STREAMER_PLUGIN_FIRSTRUN")) then + if (StreamOverlay.db.is_first_run and not Details:GetTutorialCVar ("STREAMER_PLUGIN_FIRSTRUN")) then local show_frame = function() if ((DetailsWelcomeWindow and DetailsWelcomeWindow:IsShown()) or not StreamOverlay.db.is_first_run) then @@ -2446,19 +2446,19 @@ function StreamOverlay:OnEvent (_, event, ...) StreamOverlay.ShowWelcomeFrame:Cancel() - local welcomeWindow = CreateFrame("frame", "StreamOverlayWelcomeWindow", UIParent, "BackdropTemplate") - welcomeWindow:SetPoint("center", UIParent, "center") - welcomeWindow:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) - welcomeWindow:SetBackdropColor(0, 0, 0, 0.5) - welcomeWindow:SetBackdropBorderColor(0, 0, 0, 1) - welcomeWindow:SetSize(740, 270) + local welcomeWindow = CreateFrame ("frame", "StreamOverlayWelcomeWindow", UIParent, "BackdropTemplate") + welcomeWindow:SetPoint ("center", UIParent, "center") + welcomeWindow:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + welcomeWindow:SetBackdropColor (0, 0, 0, 0.5) + welcomeWindow:SetBackdropBorderColor (0, 0, 0, 1) + welcomeWindow:SetSize (740, 270) DetailsFramework:ApplyStandardBackdrop(welcomeWindow) - local icon = welcomeWindow:CreateTexture(nil, "overlay") - icon:SetTexture([[Interface\MINIMAP\MOVIERECORDINGICON]]) - local title = welcomeWindow:CreateFontString(nil, "overlay", "GameFontNormal") - title:SetText("Details!: Action Tracker (plugin)") - StreamOverlay:SetFontSize(title, 20) + local icon = welcomeWindow:CreateTexture (nil, "overlay") + icon:SetTexture ([[Interface\MINIMAP\MOVIERECORDINGICON]]) + local title = welcomeWindow:CreateFontString (nil, "overlay", "GameFontNormal") + title:SetText ("Details!: Action Tracker (plugin)") + StreamOverlay:SetFontSize (title, 20) local youtubeTwitchIcons = welcomeWindow:CreateTexture(nil, "overlay") youtubeTwitchIcons:SetTexture([[Interface\AddOns\Details\images\icons2]]) @@ -2466,20 +2466,20 @@ function StreamOverlay:OnEvent (_, event, ...) youtubeTwitchIcons:SetSize(109, 413 - 370) youtubeTwitchIcons:SetPoint("topleft", welcomeWindow, "topleft", 123, -61) - local text1 = welcomeWindow:CreateFontString(nil, "overlay", "GameFontNormal") - text1:SetText("SHOW TO YOUR VIEWERS YOUR ROTATION\nThis way they can learn while watching your content") - local text2 = welcomeWindow:CreateFontString(nil, "overlay", "GameFontNormal") - text2:SetText("Use the command:") - local text3 = welcomeWindow:CreateFontString(nil, "overlay", "GameFontNormal") - text3:SetText("/streamer") + local text1 = welcomeWindow:CreateFontString (nil, "overlay", "GameFontNormal") + text1:SetText ("SHOW TO YOUR VIEWERS YOUR ROTATION\nThis way they can learn while watching your content") + local text2 = welcomeWindow:CreateFontString (nil, "overlay", "GameFontNormal") + text2:SetText ("Use the command:") + local text3 = welcomeWindow:CreateFontString (nil, "overlay", "GameFontNormal") + text3:SetText ("/streamer") DetailsFramework:SetFontSize(text3, 16) - icon:SetPoint("topleft", welcomeWindow, "topleft", 10, -20) - title:SetPoint("left", icon, "right", 10, 0) + icon:SetPoint ("topleft", welcomeWindow, "topleft", 10, -20) + title:SetPoint ("left", icon, "right", 10, 0) - text1:SetPoint("topleft", welcomeWindow, "topleft", 10, -120) - text2:SetPoint("center", text1, "center", 0, -40) - text3:SetPoint("center", text2, "center", 0, -16) + text1:SetPoint ("topleft", welcomeWindow, "topleft", 10, -120) + text2:SetPoint ("center", text1, "center", 0, -40) + text3:SetPoint ("center", text2, "center", 0, -16) local image1 = welcomeWindow:CreateTexture(nil, "overlay") image1:SetTexture([[Interface\AddOns\Details_Streamer\streamer_plugin_lines]]) @@ -2492,15 +2492,15 @@ function StreamOverlay:OnEvent (_, event, ...) welcomeWindow:Hide() end - local close = Details.gump:CreateButton(welcomeWindow, close_func, 120, 20, "Okay", nil, nil, nil, nil, nil, nil, Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) - close:SetPoint("center", text3, "center", 0, -50) + local close = Details.gump:CreateButton (welcomeWindow, close_func, 120, 20, "Okay", nil, nil, nil, nil, nil, nil, Details.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) + close:SetPoint ("center", text3, "center", 0, -50) end - StreamOverlay.ShowWelcomeFrame = C_Timer.NewTicker(5, show_frame) + --StreamOverlay.ShowWelcomeFrame = C_Timer.NewTicker (5, show_frame) end --wipe (StreamOverlay.db) - SOF:RegisterEvent("PLAYER_LOGOUT") + SOF:RegisterEvent ("PLAYER_LOGOUT") --profile name SOF.PlayerNameProfile = UnitName("player") .. " - " .. GetRealmName() @@ -2513,7 +2513,7 @@ function StreamOverlay:OnEvent (_, event, ...) --load dbtable local ptable = Details_StreamerDB.profiles [ Details_StreamerDB.characters [pname] ] or {} --already existen config set or empty table _detalhes.table.overwrite (StreamOverlay.db, ptable) --profile overwrite the local settings - _detalhes.table.deploy(ptable, StreamOverlay.db) --local settings deploy stuff which non exist on profile + _detalhes.table.deploy (ptable, StreamOverlay.db) --local settings deploy stuff which non exist on profile Details_StreamerDB.profiles [ Details_StreamerDB.characters [pname] ] = ptable end @@ -2526,7 +2526,7 @@ function StreamOverlay:OnEvent (_, event, ...) end end ---create minimap icon +--> create minimap icon function StreamOverlay:CreateMinimapIcon() if (StreamOverlay.minimap_icon_created) then @@ -2535,15 +2535,15 @@ function StreamOverlay:CreateMinimapIcon() StreamOverlay.minimap_icon_created = true - local LDB = LibStub("LibDataBroker-1.1", true) - local LDBIcon = LDB and LibStub("LibDBIcon-1.0", true) + local LDB = LibStub ("LibDataBroker-1.1", true) + local LDBIcon = LDB and LibStub ("LibDBIcon-1.0", true) if LDB then local minimapIcon = LDB:NewDataObject ("DetailsStreamer", { type = "data source", icon = [[Interface\MINIMAP\MOVIERECORDINGICON]], - OnClick = function(self, button) + OnClick = function (self, button) if (button == "LeftButton") then StreamOverlay.OpenOptionsPanel() elseif (button == "RightButton") then @@ -2554,10 +2554,10 @@ function StreamOverlay:CreateMinimapIcon() end end, - OnTooltipShow = function(tooltip) - tooltip:AddLine("Details!: Action Tracker", 1, 1, 1) - tooltip:AddLine("|cFFFF7700Left Click|r: open options.") - tooltip:AddLine("|cFFFF7700Right Click|r: hide this icon.") + OnTooltipShow = function (tooltip) + tooltip:AddLine ("Details!: Action Tracker", 1, 1, 1) + tooltip:AddLine ("|cFFFF7700Left Click|r: open options.") + tooltip:AddLine ("|cFFFF7700Right Click|r: hide this icon.") end, }) @@ -2571,25 +2571,25 @@ SLASH_STREAMER1, SLASH_STREAMER2 = "/streamer", "/detailsstreamer" function SlashCmdList.STREAMER (msg, editbox) local command, rest = msg:match ("^(%S*)%s*(.-)$") - --open options panel + --> open options panel StreamOverlay.OpenOptionsPanel() end --[[ extrair lista das magias -local editbox = CreateFrame("editbox", nil, UIParent) -editbox:SetSize(300, 700) -editbox:SetPoint("topleft", UIParent, "topleft") -editbox:SetBackdrop({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) -editbox:SetBackdropColor(0, 0, 0, .2) -editbox:SetAutoFocus(false) +local editbox = CreateFrame ("editbox", nil, UIParent) +editbox:SetSize (300, 700) +editbox:SetPoint ("topleft", UIParent, "topleft") +editbox:SetBackdrop ({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) +editbox:SetBackdropColor (0, 0, 0, .2) +editbox:SetAutoFocus (false) editbox:ClearFocus() editbox:SetMultiLine (true) -editbox:SetFontObject(GameFontHighlightSmall) +editbox:SetFontObject (GameFontHighlightSmall) editbox:SetJustifyH("CENTER") editbox:EnableMouse(true) -editbox:SetText("") -editbox:SetScript("OnEscapePressed", function() editbox:ClearFocus() end) -editbox:SetScript("OnEditFocusGained", function() editbox:HighlightText() end) +editbox:SetText ("") +editbox:SetScript ("OnEscapePressed", function() editbox:ClearFocus() end) +editbox:SetScript ("OnEditFocusGained", function() editbox:HighlightText() end) local list = "" @@ -2597,15 +2597,15 @@ local harmful_spells = StreamOverlay.HarmfulSpells local helpful_spells = StreamOverlay.HelpfulSpells if (not harmful_spells [spellid] and not helpful_spells [spellid]) then - if (bit.band(who_flags, 0x00000400) ~= 0 and who_name) then + if (bit.band (who_flags, 0x00000400) ~= 0 and who_name) then local text = editbox:GetText() - if (not list:find(spellid) and not text:find(spellid)) then + if (not list:find (spellid) and not text:find (spellid)) then - local class = _detalhes:GetClass(who_name) or "unknow" + local class = _detalhes:GetClass (who_name) or "unknow" if (class ~= "unknow") then text = text .. "\n"..spellid .. " " .. spellname .. " " .. class - editbox:SetText(text) + editbox:SetText (text) end end end diff --git a/plugins/Details_Streamer/Details_Streamer.toc b/plugins/Details_Streamer/Details_Streamer.toc index 3461dc81..06f7ebd9 100644 --- a/plugins/Details_Streamer/Details_Streamer.toc +++ b/plugins/Details_Streamer/Details_Streamer.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details!: Streamer (plugin) ## Notes: Show which spells you are casting, viewers can see what are you doing and follow your steps. ## RequiredDeps: Details diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index 348f1e1a..b4d0dda1 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -1,29 +1,29 @@ -local AceLocale = LibStub("AceLocale-3.0") +local AceLocale = LibStub ("AceLocale-3.0") local Loc = AceLocale:GetLocale ("Details_Threat") -local _GetNumSubgroupMembers = GetNumSubgroupMembers --wow api -local GetNumGroupMembers = GetNumGroupMembers --wow api -local _UnitIsFriend = UnitIsFriend --wow api -local _UnitName = UnitName --wow api -local IsInRaid = IsInRaid --wow api -local IsInGroup = IsInGroup --wow api -local _UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned --wow api +local _GetNumSubgroupMembers = GetNumSubgroupMembers --> wow api +local _GetNumGroupMembers = GetNumGroupMembers --> wow api +local _UnitIsFriend = UnitIsFriend --> wow api +local _UnitName = UnitName --> wow api +local _IsInRaid = IsInRaid --> wow api +local _IsInGroup = IsInGroup --> wow api +local _UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned --> wow api local GetUnitName = GetUnitName -local ipairs = ipairs --lua api -local _table_sort = table.sort --lua api -local _cstr = string.format --lua api +local _ipairs = ipairs --> lua api +local _table_sort = table.sort --> lua api +local _cstr = string.format --> lua api local _unpack = unpack local _math_floor = math.floor -local abs = math.abs +local _math_abs = math.abs local RAID_CLASS_COLORS = RAID_CLASS_COLORS ---Create the plugin Object +--> Create the plugin Object local ThreatMeter = _detalhes:NewPluginObject ("Details_TinyThreat") ---Main Frame +--> Main Frame local ThreatMeterFrame = ThreatMeter.Frame ThreatMeter:SetPluginDescription ("Small tool for track the threat you and other raid members have in your current target.") @@ -49,47 +49,47 @@ end local function CreatePluginFrames (data) - --catch Details! main object + --> catch Details! main object local _detalhes = _G._detalhes local DetailsFrameWork = _detalhes.gump - --data + --> data ThreatMeter.data = data or {} - --defaults + --> defaults ThreatMeter.RowWidth = 294 ThreatMeter.RowHeight = 14 - --amount of row wich can be displayed + --> amount of row wich can be displayed ThreatMeter.CanShow = 0 - --all rows already created + --> all rows already created ThreatMeter.Rows = {} - --current shown rows + --> current shown rows ThreatMeter.ShownRows = {} --> ThreatMeter.Actived = false - --localize functions + --> localize functions ThreatMeter.percent_color = ThreatMeter.percent_color ThreatMeter.GetOnlyName = ThreatMeter.GetOnlyName - --window reference + --> window reference local instance local player - --OnEvent Table + --> OnEvent Table function ThreatMeter:OnDetailsEvent (event, ...) if (event == "DETAILS_STARTED") then ThreatMeter:RefreshRows() - elseif (event == "HIDE") then --plugin hidded, disabled + elseif (event == "HIDE") then --> plugin hidded, disabled ThreatMeter.Actived = false ThreatMeter:Cancel() elseif (event == "SHOW") then - instance = ThreatMeter:GetInstance(ThreatMeter.instance_id) + instance = ThreatMeter:GetInstance (ThreatMeter.instance_id) ThreatMeter.RowWidth = instance.baseframe:GetWidth()-6 @@ -98,11 +98,11 @@ local function CreatePluginFrames (data) ThreatMeter:SizeChanged() - player = GetUnitName("player", true) + player = GetUnitName ("player", true) ThreatMeter.Actived = false - if (ThreatMeter:IsInCombat() or UnitAffectingCombat("player")) then + if (ThreatMeter:IsInCombat() or UnitAffectingCombat ("player")) then if (not ThreatMeter.initialized) then return end @@ -118,24 +118,24 @@ local function CreatePluginFrames (data) elseif (event == "DETAILS_INSTANCE_ENDRESIZE" or event == "DETAILS_INSTANCE_SIZECHANGED") then - local what_window = select(1, ...) + local what_window = select (1, ...) if (what_window == instance) then ThreatMeter:SizeChanged() ThreatMeter:RefreshRows() end elseif (event == "DETAILS_OPTIONS_MODIFIED") then - local what_window = select(1, ...) + local what_window = select (1, ...) if (what_window == instance) then ThreatMeter:RefreshRows() end elseif (event == "DETAILS_INSTANCE_STARTSTRETCH") then - ThreatMeterFrame:SetFrameStrata("TOOLTIP") - ThreatMeterFrame:SetFrameLevel(instance.baseframe:GetFrameLevel()+1) + ThreatMeterFrame:SetFrameStrata ("TOOLTIP") + ThreatMeterFrame:SetFrameLevel (instance.baseframe:GetFrameLevel()+1) elseif (event == "DETAILS_INSTANCE_ENDSTRETCH") then - ThreatMeterFrame:SetFrameStrata("MEDIUM") + ThreatMeterFrame:SetFrameStrata ("MEDIUM") elseif (event == "PLUGIN_DISABLED") then ThreatMeterFrame:UnregisterEvent ("PLAYER_TARGET_CHANGED") @@ -143,29 +143,29 @@ local function CreatePluginFrames (data) ThreatMeterFrame:UnregisterEvent ("PLAYER_REGEN_ENABLED") elseif (event == "PLUGIN_ENABLED") then - ThreatMeterFrame:RegisterEvent("PLAYER_TARGET_CHANGED") - ThreatMeterFrame:RegisterEvent("PLAYER_REGEN_DISABLED") - ThreatMeterFrame:RegisterEvent("PLAYER_REGEN_ENABLED") + ThreatMeterFrame:RegisterEvent ("PLAYER_TARGET_CHANGED") + ThreatMeterFrame:RegisterEvent ("PLAYER_REGEN_DISABLED") + ThreatMeterFrame:RegisterEvent ("PLAYER_REGEN_ENABLED") end end - ThreatMeterFrame:SetWidth(300) - ThreatMeterFrame:SetHeight(100) + ThreatMeterFrame:SetWidth (300) + ThreatMeterFrame:SetHeight (100) function ThreatMeter:UpdateContainers() - for _, row in ipairs(ThreatMeter.Rows) do + for _, row in _ipairs (ThreatMeter.Rows) do row:SetContainer (instance.baseframe) end end function ThreatMeter:UpdateRows() - for _, row in ipairs(ThreatMeter.Rows) do + for _, row in _ipairs (ThreatMeter.Rows) do row.width = ThreatMeter.RowWidth end end function ThreatMeter:HideBars() - for _, row in ipairs(ThreatMeter.Rows) do + for _, row in _ipairs (ThreatMeter.Rows) do row:Hide() end end @@ -186,10 +186,10 @@ local function CreatePluginFrames (data) local instance = ThreatMeter:GetPluginInstance() local w, h = instance:GetSize() - ThreatMeterFrame:SetWidth(w) - ThreatMeterFrame:SetHeight(h) + ThreatMeterFrame:SetWidth (w) + ThreatMeterFrame:SetHeight (h) ThreatMeter.RowHeight = instance.row_info.height - ThreatMeter.CanShow = math.floor( h / (instance.row_info.height+1)) + ThreatMeter.CanShow = math.floor ( h / (instance.row_info.height+1)) for i = #ThreatMeter.Rows+1, ThreatMeter.CanShow do ThreatMeter:NewRow (i) @@ -229,8 +229,8 @@ local function CreatePluginFrames (data) row.height = instance.row_info.height local rowHeight = - ( (row.rowId -1) * (instance.row_info.height + 1) ) row:ClearAllPoints() - row:SetPoint("topleft", ThreatMeterFrame, "topleft", 1, rowHeight) - row:SetPoint("topright", ThreatMeterFrame, "topright", -1, rowHeight) + row:SetPoint ("topleft", ThreatMeterFrame, "topleft", 1, rowHeight) + row:SetPoint ("topright", ThreatMeterFrame, "topright", -1, rowHeight) end end @@ -243,7 +243,7 @@ local function CreatePluginFrames (data) function ThreatMeter:NewRow (i) local newrow = DetailsFrameWork:NewBar (ThreatMeterFrame, nil, "DetailsThreatRow"..i, nil, 300, ThreatMeter.RowHeight) - newrow:SetPoint(3, -((i-1)*(ThreatMeter.RowHeight+1))) + newrow:SetPoint (3, -((i-1)*(ThreatMeter.RowHeight+1))) newrow.lefttext = "bar " .. i newrow.color = "skyblue" newrow.fontsize = 9.9 @@ -259,7 +259,7 @@ local function CreatePluginFrames (data) return newrow end - local absoluteSort = function(table1, table2) + local absoluteSort = function (table1, table2) if (table1[6] > table2[6]) then return true else @@ -267,7 +267,7 @@ local function CreatePluginFrames (data) end end - local relativeSort = function(table1, table2) + local relativeSort = function (table1, table2) if (table1[2] > table2[2]) then return true else @@ -322,16 +322,16 @@ local function CreatePluginFrames (data) if (ThreatMeter.Actived and UnitExists(unitId) and not _UnitIsFriend("player", unitId)) then - --get the threat of all players - if (IsInRaid()) then - for i = 1, GetNumGroupMembers(), 1 do + --> get the threat of all players + if (_IsInRaid()) then + for i = 1, _GetNumGroupMembers(), 1 do - local thisplayer_name = GetUnitName("raid"..i, true) + local thisplayer_name = GetUnitName ("raid"..i, true) local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] if (not threat_table) then - --some one joined the group while the player are in combat + --> some one joined the group while the player are in combat ThreatMeter:Start() return end @@ -340,14 +340,14 @@ local function CreatePluginFrames (data) end - elseif (IsInGroup()) then - for i = 1, GetNumGroupMembers()-1, 1 do - local thisplayer_name = GetUnitName("party"..i, true) + elseif (_IsInGroup()) then + for i = 1, _GetNumGroupMembers()-1, 1 do + local thisplayer_name = GetUnitName ("party"..i, true) local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] if (not threat_table) then - --some one joined the group while the player are in combat + --> some one joined the group while the player are in combat ThreatMeter:Start() return end @@ -356,7 +356,7 @@ local function CreatePluginFrames (data) end - local thisplayer_name = GetUnitName("player", true) + local thisplayer_name = GetUnitName ("player", true) local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] @@ -364,16 +364,16 @@ local function CreatePluginFrames (data) else - --player - local thisplayer_name = GetUnitName("player", true) + --> player + local thisplayer_name = GetUnitName ("player", true) local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] UpdateTableFromThreatSituation(threat_table, "player", unitId) - --pet - if (UnitExists("pet")) then - local thisplayer_name = GetUnitName("pet", true) .. " *PET*" + --> pet + if (UnitExists ("pet")) then + local thisplayer_name = GetUnitName ("pet", true) .. " *PET*" local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] @@ -387,23 +387,23 @@ local function CreatePluginFrames (data) local gougeSpellId = (not disableGougeMode) and FindGougeSpellForUnit(unitId) local useAbsoluteMode = gougeSpellId or ThreatMeter.saveddata.absolute_mode - --sort + --> sort _table_sort (ThreatMeter.player_list_indexes, useAbsoluteMode and absoluteSort or relativeSort) local needMainTankDummyBar = true - for index, t in ipairs(ThreatMeter.player_list_indexes) do + for index, t in _ipairs (ThreatMeter.player_list_indexes) do ThreatMeter.player_list_hash [t[1]] = index if t[3] then needMainTankDummyBar = false end end - --no threat on this enemy + --> no threat on this enemy if (ThreatMeter.player_list_indexes [1][7] < 1) then ThreatMeter:HideBars() return end - --find main tank threat, even if they are not in group + --> find main tank threat, even if they are not in group local mainTankAbsoluteThreat = ThreatMeter.player_list_indexes[1][6]/(ThreatMeter.player_list_indexes[1][7]/100) local lastIndex = 0 @@ -415,7 +415,7 @@ local function CreatePluginFrames (data) local needMeleePullBar = (not hidePullBar) and useAbsoluteMode local needRelativePullBar = (not hidePullBar) and (not useAbsoluteMode) and me and (me[2] > 0) and (not me[3]) - --find out scaling factor for bars + --> find out scaling factor for bars local barValueUnit if useAbsoluteMode then barValueUnit = max(ThreatMeter.player_list_indexes[1][7]/100, needRangedPullBar and 1.3 or needMeleePullBar and 1.1 or 1.0) @@ -423,10 +423,10 @@ local function CreatePluginFrames (data) barValueUnit = 1.0 end - --find out gouge threshold (highest offtank threat, divided by 110%; this prevents the offtank from taking the boss back) + --> find out gouge threshold (highest offtank threat, divided by 110%; this prevents the offtank from taking the boss back) local gougeThreshold = nil if gougeSpellId then - for _, t in ipairs(ThreatMeter.player_list_indexes) do + for _, t in _ipairs (ThreatMeter.player_list_indexes) do if not t[3] then gougeThreshold = t[6] / 1.1 break @@ -442,8 +442,8 @@ local function CreatePluginFrames (data) local threatActor = ThreatMeter.player_list_indexes[index-dummyBarCount] if needRelativePullBar then - thisRow._icon:SetTexture([[Interface\PVPFrame\Icon-Combat]]) - thisRow._icon:SetTexCoord(0, 1, 0, 1) + thisRow._icon:SetTexture ([[Interface\PVPFrame\Icon-Combat]]) + thisRow._icon:SetTexCoord (0, 1, 0, 1) local myPullThreat = me[6]*(100/me[2]) local r,g = ThreatMeter:percent_color(me[2], true) @@ -464,8 +464,8 @@ local function CreatePluginFrames (data) if needRangedPullBar and ((not threatActor) or (threatActor[7] < 130)) then - thisRow._icon:SetTexture([[Interface\PaperDoll\UI-PaperDoll-Slot-Ranged]]) - thisRow._icon:SetTexCoord(0, 1, 0, 1) + thisRow._icon:SetTexture ([[Interface\PaperDoll\UI-PaperDoll-Slot-Ranged]]) + thisRow._icon:SetTexCoord (0, 1, 0, 1) thisRow:SetLeftText ("Ranged pull at") thisRow:SetRightText(ThreatMeter:ToK2 (mainTankAbsoluteThreat*1.3) .. " (130.0%)") @@ -482,8 +482,8 @@ local function CreatePluginFrames (data) end if needMeleePullBar and ((not threatActor) or (threatActor[7] < 110)) then - thisRow._icon:SetTexture([[Interface\PaperDoll\UI-PaperDoll-Slot-MainHand]]) - thisRow._icon:SetTexCoord(0, 1, 0, 1) + thisRow._icon:SetTexture ([[Interface\PaperDoll\UI-PaperDoll-Slot-MainHand]]) + thisRow._icon:SetTexCoord (0, 1, 0, 1) thisRow:SetLeftText ("Melee pull at") thisRow:SetRightText(ThreatMeter:ToK2 (mainTankAbsoluteThreat*1.1) .. " (110.0%)") @@ -500,8 +500,8 @@ local function CreatePluginFrames (data) end if needMainTankDummyBar and ((not threatActor) or (not useAbsoluteMode) or (threatActor[6] < mainTankAbsoluteThreat)) then - thisRow._icon:SetTexture([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) - thisRow._icon:SetTexCoord(_unpack(RoleIconCoord ["TANK"])) + thisRow._icon:SetTexture ([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) + thisRow._icon:SetTexCoord (_unpack (RoleIconCoord ["TANK"])) thisRow:SetLeftText ("Current Tank") thisRow:SetRightText(ThreatMeter:ToK2 (mainTankAbsoluteThreat) .. " (100.0%)") @@ -509,10 +509,10 @@ local function CreatePluginFrames (data) -- color main tank based on highest non-tank threat local r,g = 0,1 - for _, t in ipairs(ThreatMeter.player_list_indexes) do + for _, t in _ipairs (ThreatMeter.player_list_indexes) do if not t[3] then local otherPct = t[useAbsoluteMode and 7 or 2] - r,g = (otherPct*0.01), (abs(otherPct-100)*0.01) + r,g = (otherPct*0.01), (_math_abs(otherPct-100)*0.01) break end end @@ -528,9 +528,9 @@ local function CreatePluginFrames (data) end if gougeThreshold and ((not threatActor) or (threatActor[6] < gougeThreshold)) then - local spellName, _, spellTexture = GetSpellInfo(gougeSpellId) - thisRow._icon:SetTexture(spellTexture) - thisRow._icon:SetTexCoord(0, 1, 0, 1) + local spellName, _, spellTexture = GetSpellInfo (gougeSpellId) + thisRow._icon:SetTexture (spellTexture) + thisRow._icon:SetTexCoord (0, 1, 0, 1) local pct = gougeThreshold * 100 / mainTankAbsoluteThreat @@ -550,18 +550,18 @@ local function CreatePluginFrames (data) if (threatActor) then local role = threatActor[4] - thisRow._icon:SetTexture([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) - thisRow._icon:SetTexCoord(_unpack(RoleIconCoord [role])) + thisRow._icon:SetTexture ([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) + thisRow._icon:SetTexCoord (_unpack (RoleIconCoord [role])) - thisRow:SetLeftText (ThreatMeter:GetOnlyName(threatActor [1])) + thisRow:SetLeftText (ThreatMeter:GetOnlyName (threatActor [1])) local pct = threatActor [useAbsoluteMode and 7 or 2] thisRow:SetRightText (ThreatMeter:ToK2 (threatActor [6]) .. " (" .. _cstr ("%.1f", pct) .. "%)") - thisRow:SetValue(pct/barValueUnit) + thisRow:SetValue (pct/barValueUnit) if (options.useplayercolor and threatActor [1] == player) then - thisRow:SetColor (_unpack(options.playercolor)) + thisRow:SetColor (_unpack (options.playercolor)) elseif (options.useclasscolors) then local color = RAID_CLASS_COLORS [threatActor [5]] @@ -574,10 +574,10 @@ local function CreatePluginFrames (data) if threatActor[3] then -- color main tank based on highest non-tank threat local r,g = 0,1 - for _, t in ipairs(ThreatMeter.player_list_indexes) do + for _, t in _ipairs (ThreatMeter.player_list_indexes) do if not t[3] then local otherPct = t[useAbsoluteMode and 7 or 2] - r,g = (otherPct*0.01), (abs(otherPct-100)*0.01) + r,g = (otherPct*0.01), (_math_abs(otherPct-100)*0.01) break end end @@ -602,21 +602,21 @@ local function CreatePluginFrames (data) end if (not shownMe) then - --show my self into last bar + --> show my self into last bar local threat_actor = ThreatMeter.player_list_indexes [ ThreatMeter.player_list_hash [player] ] if (threat_actor) then if (threat_actor [2] and threat_actor [2] > 0.1) then local thisRow = ThreatMeter.ShownRows [#ThreatMeter.ShownRows] thisRow:SetLeftText (player) - --thisRow.textleft:SetTextColor(unpack(RAID_CLASS_COLORS [threat_actor [5]])) + --thisRow.textleft:SetTextColor (unpack (RAID_CLASS_COLORS [threat_actor [5]])) local role = threat_actor [4] - thisRow._icon:SetTexture([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) - thisRow._icon:SetTexCoord(_unpack(RoleIconCoord [role])) + thisRow._icon:SetTexture ([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) + thisRow._icon:SetTexCoord (_unpack (RoleIconCoord [role])) thisRow:SetRightText (ThreatMeter:ToK2 (threat_actor [6]) .. " (" .. _cstr ("%.1f", threat_actor [2]) .. "%)") - thisRow:SetValue(threat_actor [2]) + thisRow:SetValue (threat_actor [2]) if (options.useplayercolor) then - thisRow:SetColor (_unpack(options.playercolor)) + thisRow:SetColor (_unpack (options.playercolor)) else local r, g = ThreatMeter:percent_color (threat_actor [2], true) thisRow:SetColor (r, g, 0, .3) @@ -625,7 +625,7 @@ local function CreatePluginFrames (data) end end else - --print("nao tem target") + --print ("nao tem target") end end @@ -653,50 +653,50 @@ local function CreatePluginFrames (data) ThreatMeter:HideBars() if (ThreatMeter.Actived) then if (ThreatMeter.job_thread) then - ThreatMeter:CancelTimer(ThreatMeter.job_thread) + ThreatMeter:CancelTimer (ThreatMeter.job_thread) ThreatMeter.job_thread = nil end ThreatMeter.player_list_indexes = {} ThreatMeter.player_list_hash = {} - --pre build player list - if (IsInRaid()) then - for i = 1, GetNumGroupMembers(), 1 do - local thisplayer_name = GetUnitName("raid"..i, true) - local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass(thisplayer_name) + --> pre build player list + if (_IsInRaid()) then + for i = 1, _GetNumGroupMembers(), 1 do + local thisplayer_name = GetUnitName ("raid"..i, true) + local role = _UnitGroupRolesAssigned (thisplayer_name) + local _, class = UnitClass (thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes end - elseif (IsInGroup()) then - for i = 1, GetNumGroupMembers()-1, 1 do - local thisplayer_name = GetUnitName("party"..i, true) - local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass(thisplayer_name) + elseif (_IsInGroup()) then + for i = 1, _GetNumGroupMembers()-1, 1 do + local thisplayer_name = GetUnitName ("party"..i, true) + local role = _UnitGroupRolesAssigned (thisplayer_name) + local _, class = UnitClass (thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes end - local thisplayer_name = GetUnitName("player", true) - local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass(thisplayer_name) + local thisplayer_name = GetUnitName ("player", true) + local role = _UnitGroupRolesAssigned (thisplayer_name) + local _, class = UnitClass (thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes else - local thisplayer_name = GetUnitName("player", true) - local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass(thisplayer_name) + local thisplayer_name = GetUnitName ("player", true) + local role = _UnitGroupRolesAssigned (thisplayer_name) + local _, class = UnitClass (thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes - if (UnitExists("pet")) then - local thispet_name = GetUnitName("pet", true) .. " *PET*" + if (UnitExists ("pet")) then + local thispet_name = GetUnitName ("pet", true) .. " *PET*" local role = "DAMAGER" local t = {thispet_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t @@ -712,7 +712,7 @@ local function CreatePluginFrames (data) function ThreatMeter:End() ThreatMeter:HideBars() if (ThreatMeter.job_thread) then - ThreatMeter:CancelTimer(ThreatMeter.job_thread) + ThreatMeter:CancelTimer (ThreatMeter.job_thread) ThreatMeter.job_thread = nil end end @@ -720,7 +720,7 @@ local function CreatePluginFrames (data) function ThreatMeter:Cancel() ThreatMeter:HideBars() if (ThreatMeter.job_thread) then - ThreatMeter:CancelTimer(ThreatMeter.job_thread) + ThreatMeter:CancelTimer (ThreatMeter.job_thread) ThreatMeter.job_thread = nil end ThreatMeter.Actived = false @@ -736,7 +736,7 @@ local build_options_panel = function() { type = "range", get = function() return ThreatMeter.saveddata.updatespeed end, - set = function(self, fixedparam, value) ThreatMeter.saveddata.updatespeed = value end, + set = function (self, fixedparam, value) ThreatMeter.saveddata.updatespeed = value end, min = 0.2, max = 3, step = 0.2, @@ -747,14 +747,14 @@ local build_options_panel = function() { type = "toggle", get = function() return ThreatMeter.saveddata.useplayercolor end, - set = function(self, fixedparam, value) ThreatMeter.saveddata.useplayercolor = value end, + set = function (self, fixedparam, value) ThreatMeter.saveddata.useplayercolor = value end, desc = "When enabled, your bar get the following color.", name = "Player Color Enabled" }, { type = "color", get = function() return ThreatMeter.saveddata.playercolor end, - set = function(self, r, g, b, a) + set = function (self, r, g, b, a) local current = ThreatMeter.saveddata.playercolor current[1], current[2], current[3], current[4] = r, g, b, a end, @@ -764,7 +764,7 @@ local build_options_panel = function() { type = "toggle", get = function() return ThreatMeter.saveddata.useclasscolors end, - set = function(self, fixedparam, value) ThreatMeter.saveddata.useclasscolors = value end, + set = function (self, fixedparam, value) ThreatMeter.saveddata.useclasscolors = value end, desc = "When enabled, threat bars uses the class color of the character.", name = "Use Class Colors" }, @@ -774,14 +774,14 @@ local build_options_panel = function() { type = "toggle", get = function() return ThreatMeter.saveddata.usefocus end, - set = function(self, fixedparam, value) ThreatMeter.saveddata.usefocus = value end, + set = function (self, fixedparam, value) ThreatMeter.saveddata.usefocus = value end, desc = "Show threat for the focus target if there's one.", name = "Track Focus Target (if any)" }, { type = "toggle", get = function() return not ThreatMeter.saveddata.hide_pull_bar end, - set = function(self, fixedparam, value) ThreatMeter.saveddata.hide_pull_bar = not value end, + set = function (self, fixedparam, value) ThreatMeter.saveddata.hide_pull_bar = not value end, desc = "Show Pull Aggro Bar", name = "Show Pull Aggro Bar" }, @@ -805,7 +805,7 @@ local build_options_panel = function() { type = "toggle", get = function() return ThreatMeter.saveddata.playSound end, - set = function(self, fixedparam, value) ThreatMeter.saveddata.playSound = value end, + set = function (self, fixedparam, value) ThreatMeter.saveddata.playSound = value end, desc = "Except for tanks", name = "Play Audio On High Threat" }, @@ -834,15 +834,15 @@ function ThreatMeter:OnEvent (_, event, ...) elseif (event == "PLAYER_REGEN_DISABLED") then ThreatMeter.Actived = true ThreatMeter:Start() - --print("tiny theat: regen disabled") + --print ("tiny theat: regen disabled") elseif (event == "PLAYER_REGEN_ENABLED") then ThreatMeter:End() ThreatMeter.Actived = false - --print("tiny theat: regen enabled") + --print ("tiny theat: regen enabled") elseif (event == "ADDON_LOADED") then - local AddonName = select(1, ...) + local AddonName = select (1, ...) if (AddonName == "Details_TinyThreat") then if (_G._detalhes) then @@ -851,31 +851,31 @@ function ThreatMeter:OnEvent (_, event, ...) --return end - --create widgets + --> create widgets CreatePluginFrames (data) local MINIMAL_DETAILS_VERSION_REQUIRED = 1 - --Install - local install, saveddata = _G._detalhes:InstallPlugin ("RAID", Loc ["STRING_PLUGIN_NAME"], "Interface\\Icons\\Ability_Druid_Cower", ThreatMeter, "DETAILS_PLUGIN_TINY_THREAT", MINIMAL_DETAILS_VERSION_REQUIRED, "Terciob", "v2.01") - if (type(install) == "table" and install.error) then - print(install.error) + --> Install + local install, saveddata = _G._detalhes:InstallPlugin ("RAID", Loc ["STRING_PLUGIN_NAME"], "Interface\\Icons\\Ability_Druid_Cower", ThreatMeter, "DETAILS_PLUGIN_TINY_THREAT", MINIMAL_DETAILS_VERSION_REQUIRED, "Terciob", "v2.20") + if (type (install) == "table" and install.error) then + print (install.error) end - --Register needed events - _G._detalhes:RegisterEvent(ThreatMeter, "COMBAT_PLAYER_ENTER") - _G._detalhes:RegisterEvent(ThreatMeter, "COMBAT_PLAYER_LEAVE") - _G._detalhes:RegisterEvent(ThreatMeter, "DETAILS_INSTANCE_ENDRESIZE") - _G._detalhes:RegisterEvent(ThreatMeter, "DETAILS_INSTANCE_SIZECHANGED") - _G._detalhes:RegisterEvent(ThreatMeter, "DETAILS_INSTANCE_STARTSTRETCH") - _G._detalhes:RegisterEvent(ThreatMeter, "DETAILS_INSTANCE_ENDSTRETCH") - _G._detalhes:RegisterEvent(ThreatMeter, "DETAILS_OPTIONS_MODIFIED") + --> Register needed events + _G._detalhes:RegisterEvent (ThreatMeter, "COMBAT_PLAYER_ENTER") + _G._detalhes:RegisterEvent (ThreatMeter, "COMBAT_PLAYER_LEAVE") + _G._detalhes:RegisterEvent (ThreatMeter, "DETAILS_INSTANCE_ENDRESIZE") + _G._detalhes:RegisterEvent (ThreatMeter, "DETAILS_INSTANCE_SIZECHANGED") + _G._detalhes:RegisterEvent (ThreatMeter, "DETAILS_INSTANCE_STARTSTRETCH") + _G._detalhes:RegisterEvent (ThreatMeter, "DETAILS_INSTANCE_ENDSTRETCH") + _G._detalhes:RegisterEvent (ThreatMeter, "DETAILS_OPTIONS_MODIFIED") - ThreatMeterFrame:RegisterEvent("PLAYER_TARGET_CHANGED") - ThreatMeterFrame:RegisterEvent("PLAYER_REGEN_DISABLED") - ThreatMeterFrame:RegisterEvent("PLAYER_REGEN_ENABLED") + ThreatMeterFrame:RegisterEvent ("PLAYER_TARGET_CHANGED") + ThreatMeterFrame:RegisterEvent ("PLAYER_REGEN_DISABLED") + ThreatMeterFrame:RegisterEvent ("PLAYER_REGEN_ENABLED") - --Saved data + --> Saved data ThreatMeter.saveddata = saveddata or {} ThreatMeter.saveddata.updatespeed = ThreatMeter.saveddata.updatespeed or 1 @@ -894,8 +894,8 @@ function ThreatMeter:OnEvent (_, event, ...) ThreatMeter.options = ThreatMeter.saveddata - --Register slash commands - SLASH_DETAILS_TINYTHREAT1, SLASH_DETAILS_TINYTHREAT2 = "/tinythreat", "/tt" + --> Register slash commands + SLASH_DETAILS_TINYTHREAT1 = "/tinythreat" function SlashCmdList.DETAILS_TINYTHREAT (msg, editbox) @@ -906,7 +906,7 @@ function ThreatMeter:OnEvent (_, event, ...) elseif (command == Loc ["STRING_SLASH_SPEED"]) then if (rest) then - local speed = tonumber(rest) + local speed = tonumber (rest) if (speed) then if (speed > 3) then speed = 3 @@ -915,17 +915,17 @@ function ThreatMeter:OnEvent (_, event, ...) end ThreatMeter.saveddata.updatespeed = speed - ThreatMeter:Msg(Loc ["STRING_SLASH_SPEED_CHANGED"] .. speed) + ThreatMeter:Msg (Loc ["STRING_SLASH_SPEED_CHANGED"] .. speed) else - ThreatMeter:Msg(Loc ["STRING_SLASH_SPEED_CURRENT"] .. ThreatMeter.saveddata.updatespeed) + ThreatMeter:Msg (Loc ["STRING_SLASH_SPEED_CURRENT"] .. ThreatMeter.saveddata.updatespeed) end end elseif (command == Loc ["STRING_SLASH_AMOUNT"]) then else - ThreatMeter:Msg(Loc ["STRING_COMMAND_LIST"]) - print("|cffffaeae/tinythreat " .. Loc ["STRING_SLASH_SPEED"] .. "|r: " .. Loc ["STRING_SLASH_SPEED_DESC"]) + ThreatMeter:Msg (Loc ["STRING_COMMAND_LIST"]) + print ("|cffffaeae/tinythreat " .. Loc ["STRING_SLASH_SPEED"] .. "|r: " .. Loc ["STRING_SLASH_SPEED_DESC"]) end end diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.toc b/plugins/Details_TinyThreat/Details_TinyThreat.toc index 9d8882b7..eb1dcf70 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.toc +++ b/plugins/Details_TinyThreat/Details_TinyThreat.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details!: Tiny Threat (plugin) ## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel. ## RequiredDeps: Details diff --git a/plugins/Details_Vanguard/Details_Vanguard.toc b/plugins/Details_Vanguard/Details_Vanguard.toc index 84266660..fc305e6e 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.toc +++ b/plugins/Details_Vanguard/Details_Vanguard.toc @@ -1,4 +1,4 @@ -## Interface: 100000 +## Interface: 100002 ## Title: Details!: Vanguard (plugin) ## Notes: Show the health and debuffs for tanks in your group. ## SavedVariablesPerCharacter: _detalhes_databaseVanguard diff --git a/sounds/Details Horn.ogg b/sounds/Details Horn.ogg new file mode 100644 index 00000000..26493413 Binary files /dev/null and b/sounds/Details Horn.ogg differ diff --git a/sounds/Details Warning 100.ogg b/sounds/Details Warning 100.ogg new file mode 100644 index 00000000..5503645a Binary files /dev/null and b/sounds/Details Warning 100.ogg differ diff --git a/sounds/Details Warning 25.ogg b/sounds/Details Warning 25.ogg new file mode 100644 index 00000000..2b33aab2 Binary files /dev/null and b/sounds/Details Warning 25.ogg differ diff --git a/sounds/Details Warning 50.ogg b/sounds/Details Warning 50.ogg new file mode 100644 index 00000000..f77befdc Binary files /dev/null and b/sounds/Details Warning 50.ogg differ diff --git a/sounds/Details Warning 75.ogg b/sounds/Details Warning 75.ogg new file mode 100644 index 00000000..04b2e0ac Binary files /dev/null and b/sounds/Details Warning 75.ogg differ diff --git a/sounds/threat_warning_1.ogg b/sounds/threat_warning_1.ogg deleted file mode 100644 index 6a7d6cd4..00000000 Binary files a/sounds/threat_warning_1.ogg and /dev/null differ diff --git a/sounds/threat_warning_2.ogg b/sounds/threat_warning_2.ogg deleted file mode 100644 index 1c1f2491..00000000 Binary files a/sounds/threat_warning_2.ogg and /dev/null differ diff --git a/sounds/threat_warning_3.ogg b/sounds/threat_warning_3.ogg deleted file mode 100644 index a166322f..00000000 Binary files a/sounds/threat_warning_3.ogg and /dev/null differ diff --git a/sounds/threat_warning_4.ogg b/sounds/threat_warning_4.ogg deleted file mode 100644 index 31790834..00000000 Binary files a/sounds/threat_warning_4.ogg and /dev/null differ diff --git a/startup.lua b/startup.lua index 75cafd31..e14452e4 100644 --- a/startup.lua +++ b/startup.lua @@ -1,10 +1,11 @@ - local UnitGroupRolesAssigned = _G.DetailsFramework.UnitGroupRolesAssigned local wipe = _G.wipe local C_Timer = _G.C_Timer local CreateFrame = _G.CreateFrame local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") +local _ +local tocName, Details222 = ... --start funtion function Details:StartMeUp() --I'll never stop! @@ -341,12 +342,10 @@ function Details:StartMeUp() --I'll never stop! local lowerInstanceId = Details:GetLowerInstanceNumber() if (lowerInstanceId) then lowerInstanceId = Details:GetInstance(lowerInstanceId) - if (lowerInstanceId) then --check if there's changes in the size of the news string - if (Details.last_changelog_size < #Loc["STRING_VERSION_LOG"]) then + if (Details.last_changelog_size ~= #Loc["STRING_VERSION_LOG"]) then Details.last_changelog_size = #Loc["STRING_VERSION_LOG"] - if (Details.auto_open_news_window) then C_Timer.After(5, function() Details.OpenNewsWindow() @@ -441,6 +440,33 @@ function Details:StartMeUp() --I'll never stop! Details:LoadFramesForBroadcastTools() Details:BrokerTick() + --build trinket data + function Details:GetTrinketData() + return Details.trinket_data + end + + local customSpellList = Details:GetDefaultCustomSpellsList() + local trinketData = Details:GetTrinketData() + for spellId, trinketTable in pairs(customSpellList) do + if (trinketTable.isPassive) then + if (not trinketData[spellId]) then + local thisTrinketData = { + itemName = C_Item.GetItemNameByID(trinketTable.itemId), + spellName = GetSpellInfo(spellId) or "spell not found", + lastActivation = 0, + lastPlayerName = "", + totalCooldownTime = 0, + activations = 0, + lastCombatId = 0, + minTime = 9999999, + maxTime = 0, + averageTime = 0, + } + trinketData[spellId] = thisTrinketData + end + end + end + --register boss mobs callbacks (DBM and BigWigs) -> functions/bossmods.lua Details.Schedules.NewTimer(5, Details.BossModsLink, Details) @@ -507,11 +533,10 @@ function Details:StartMeUp() --I'll never stop! Details:InstallHook("HOOK_DEATH", Details.Coach.Client.SendMyDeath) - local sentMessageOnStartup = false - - if (math.random(20) == 1) then - Details:Msg("use '/details me' macro to open the player breakdown for you!") - sentMessageOnStartup = true + if (not Details.slash_me_used) then + if (math.random(25) == 1) then + Details:Msg("use '/details me' macro to open the player breakdown for you!") + end end if (not DetailsFramework.IsTimewalkWoW()) then @@ -557,21 +582,6 @@ function Details:StartMeUp() --I'll never stop! end end) - --[=[ --survey for cooldown types are done - if (DetailsFramework.IsDragonflight()) then - DetailsFramework.Schedules.NewTimer(5, Details.RegisterDragonFlightEditMode) - --run only on beta, remove on 10.0 launch - if (Details.Survey.GetTargetCharacterForRealm()) then - Details.Survey.InitializeSpellCategoryFeedback() - if (not sentMessageOnStartup) then - if (math.random(5) == 1) then - Details:Msg("use '/details survey' to help on identifying cooldown spells (Dragonflight Beta).") - end - end - end - end - --]=] - function Details:InstallOkey() return true end @@ -583,13 +593,6 @@ function Details:StartMeUp() --I'll never stop! --shutdown the old OnDeathMenu --cleanup: this line can be removed after the first month of dragonflight Details.on_death_menu = false - - --reset to default the evoker color - local defaultEvokerColor = _detalhes.default_profile.class_colors.EVOKER - local currentEvokerColorTable = _detalhes.class_colors.EVOKER - currentEvokerColorTable[1] = defaultEvokerColor[1] - currentEvokerColorTable[2] = defaultEvokerColor[2] - currentEvokerColorTable[3] = defaultEvokerColor[3] end Details.AddOnLoadFilesTime = _G.GetTime()