From 17f2fdd05a3c260ac3f3e7e4bf56fda8f4dd79a6 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 30 Apr 2023 18:14:26 -0300 Subject: [PATCH] Bug Fixes --- Definitions.lua | 6 ++- Libs/DF/header.lua | 5 +- Libs/LibOpenRaid/LibOpenRaid.lua | 6 ++- .../ThingsToMantain_Dragonflight.lua | 30 +++++++++-- classes/class_combat.lua | 6 ++- classes/class_damage.lua | 8 ++- classes/class_heal.lua | 4 +- core/parser.lua | 3 ++ frames/window_playerbreakdown.lua | 2 +- frames/window_playerbreakdown_spells.lua | 51 +++++++++++++++---- 10 files changed, 98 insertions(+), 23 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 43657d08..68b7b3da 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -253,7 +253,7 @@ ---@field SetColorTexture fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) ---@field SetDesaturated fun(self: texture, desaturate: boolean) ---@field SetBlendMode fun(self: texture, mode: "ADD"|"BLEND"|"DISABLE"|"MOD"|"MOD2X"|"OVERLAY"|"REPLACE"|"SUBTRACT") ----@field SetVertexColor fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number) +---@field SetVertexColor fun(self: texture, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) ---@field GetPoint fun(self: texture, index: number) : string, table, string, number, number ---@field SetShown fun(self: texture, state: boolean) ---@field IsShown fun(self: texture) : boolean @@ -383,6 +383,8 @@ ---@field debuff_uptime_spells table ---@field buff_uptime_spells table ---@field spells table +---@field aID number|string +---@field spellicon number|string ---@field cooldowns_defensive_spells table ---@field nome string ---@field serial string @@ -561,6 +563,8 @@ ---@class breakdownspelltab ---@field selectedSpellBar breakdownspellbar ---@field TabFrame breakdownspellstab +---@field mainAttribute number +---@field subAttribute number ---@field GetActor fun() : actor ---@field GetCombat fun() : combat ---@field GetInstance fun() : instance diff --git a/Libs/DF/header.lua b/Libs/DF/header.lua index 922360ad..eceab551 100644 --- a/Libs/DF/header.lua +++ b/Libs/DF/header.lua @@ -8,6 +8,7 @@ end local unpack = unpack local CreateFrame = CreateFrame local geterrorhandler = geterrorhandler +local wipe = wipe --definitions ---@class df_headerchild : uiobject @@ -69,12 +70,12 @@ detailsFramework.HeaderFunctions = { ---comment ---@param self df_headerchild ResetFramesToHeaderAlignment = function(self) - table.wipe(self.FramesToAlign) + wipe(self.FramesToAlign) end, SetFramesToHeaderAlignment = function(self, ...) ---@cast self df_headerchild - table.wipe(self.FramesToAlign) + wipe(self.FramesToAlign) self.FramesToAlign = {...} end, diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 1c9c7c28..d5129a93 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -37,7 +37,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 98 +local CONST_LIB_VERSION = 99 if (not LIB_OPEN_RAID_MAX_VERSION) then LIB_OPEN_RAID_MAX_VERSION = CONST_LIB_VERSION @@ -1688,7 +1688,9 @@ openRaidLib.internalCallback.RegisterCallback("onLeaveCombat", openRaidLib.UnitI dataToSend = dataToSend .. playerGearInfo[3] .. "," --weapon enchant dataToSend = dataToSend .. openRaidLib.PackTable(playerGearInfo[4]) .. "," --slots without enchant dataToSend = dataToSend .. openRaidLib.PackTable(playerGearInfo[5]) .. "," -- slots with empty gem sockets - dataToSend = dataToSend .. openRaidLib.PackTableAndSubTables(playerGearInfo[6]) --full equipped equipment + dataToSend = dataToSend .. openRaidLib.PackTableAndSubTables(playerGearInfo[6]) .. "," --full equipped equipment + dataToSend = dataToSend .. playerGearInfo[7] .. "," --main hand weapon enchant + dataToSend = dataToSend .. playerGearInfo[8] --off hand weapon enchant --send the data openRaidLib.commHandler.SendCommData(dataToSend) diff --git a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua index fcbbfa98..8805fda9 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua @@ -154,9 +154,33 @@ do --/dump GetWeaponEnchantInfo() LIB_OPEN_RAID_WEAPON_ENCHANT_IDS = { - --need update to dragonflight - [5400] = true, --flametongue - [5401] = true, --windfury + [5401] = {spell=33757}, -- Windfury + [5400] = {spell=318038}, -- Flametongue + [6498] = {spell=382021}, -- Earthliving + -- Runes, whetstones, weightstones + [6512] = {tier = 1, item=194823}, + [6513] = {tier = 2, item=194823}, + [6514] = {tier = 3, item=194823}, + + [6515] = {tier = 1, item=194826}, + [6694] = {tier = 2, item=194826}, + [6695] = {tier = 3, item=194826}, + + [6516] = {tier = 1, item=194820}, + [6517] = {tier = 2, item=194820}, + [6518] = {tier = 3, item=194820}, + + [6529] = {tier = 1, item=198162}, + [6530] = {tier = 2, item=198162}, + [6531] = {tier = 3, item=198162}, + + [6379] = {tier = 1, item=191940}, + [6380] = {tier = 2, item=191940}, + [6381] = {tier = 3, item=191940}, + + [6696] = {tier = 1, item=191945}, + [6697] = {tier = 2, item=191945}, + [6698] = {tier = 3, item=191945}, } --buff spellId, the value of the food is the tier level diff --git a/classes/class_combat.lua b/classes/class_combat.lua index e964dac9..f1f39ef3 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -190,7 +190,11 @@ ---@type actor local actorObject = utilityContainer:GetActor(actorName) if (actorObject) then - return actorObject.spell_cast[spellId] or 0 + if (actorObject.spell_cast) then + return actorObject.spell_cast[spellId] or 0 + else + return 0 + end else return 0 end diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 39edc04e..6f0585a8 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -3126,7 +3126,11 @@ end end end ----@self: actor object +---set the icon of the actor spec, class, pet, enemy, custom icom, spellicon, etc. +---@param self actor +---@param texture texture +---@param instance instance +---@param class string function Details:SetClassIcon(texture, instance, class) --[[ exported]] local customIcon if (Details.immersion_unit_special_icons) then @@ -6097,6 +6101,8 @@ end habilidade_shadow.extra [spellId] = (habilidade_shadow.extra [spellId] or 0) + amount end + habilidade_shadow.spellschool = habilidade.spellschool + --soma todos os demais valores for key, value in pairs(habilidade) do if (type(value) == "number") then diff --git a/classes/class_heal.lua b/classes/class_heal.lua index f563e457..ca7e0199 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -2911,10 +2911,12 @@ end end end + habilidade_shadow.spellschool = habilidade.spellschool + --soma todos os demais valores for key, value in pairs(habilidade) do if (type(value) == "number") then - if (key ~= "id") then + if (key ~= "id" and key ~= "spellschool") then if (not habilidade_shadow [key]) then habilidade_shadow [key] = 0 end diff --git a/core/parser.lua b/core/parser.lua index 003f18f9..80d5d052 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -2312,6 +2312,9 @@ if (bIsShield) then spellTable.is_shield = true end + + spellTable.spellschool = spellType + if (_current_combat.is_boss and sourceFlags and bitBand(sourceFlags, OBJECT_TYPE_ENEMY) ~= 0) then _detalhes.spell_school_cache[spellName] = spellType end diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index ad741bff..b79eaee5 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -509,7 +509,7 @@ function Details:CreateBreakdownWindow() end) --title - DetailsFramework:NewLabel(breakdownWindow, breakdownWindow, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r)", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) + DetailsFramework:NewLabel(breakdownWindow, breakdownWindow, nil, "titleText", Loc ["STRING_PLAYER_DETAILS"] .. " (|cFFFF8811Under Maintenance|r) - Report Bugs At Discord > 'breakdown-bug-report' channel", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) breakdownWindow.titleText:SetPoint("center", breakdownWindow, "center") breakdownWindow.titleText:SetPoint("top", breakdownWindow, "top", 0, -18) diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index 64167616..65f88b96 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -403,7 +403,7 @@ function spellsTab.OnCreateTabCallback(tabButton, tabFrame) --~init optionsButton.textcolor = "white" --open the breakdown window at startup for testing - --[= debug + --[=[ debug C_Timer.After(1, function() Details:OpenPlayerDetails(1) C_Timer.After(1, function() @@ -441,7 +441,7 @@ end ---run this function when the mouse hover over a breakdownspellbar ---@param spellBar breakdownspellbar ---@param motion boolean|nil -local onEnterBreakdownSpellBar = function(spellBar, motion) --parei aqui: precisa por nomes nas funções e formatar as linhas das funcções +local onEnterSpellBar = function(spellBar, motion) --parei aqui: precisa por nomes nas funções e formatar as linhas das funcções --all values from spellBar are cached values --check if there's a spellbar selected, if there's one, ignore the mouseover if (spellsTab.HasSelectedSpellBar() and motion) then @@ -695,7 +695,7 @@ end ---run this function when the mouse leaves a breakdownspellbar ---@param spellBar breakdownspellbar -local onLeaveBreakdownSpellBar = function(spellBar) +local onLeaveSpellBar = function(spellBar) spellsTab.currentSpellBar = nil --remove effects on entering the bar line @@ -1002,7 +1002,7 @@ function spellsTab.CreateSpellBlockContainer(tabFrame) --~create spellsTab.GetSpellBlockFrame():UpdateBlocks() if (spellsTab.GetSelectedSpellBar()) then - onEnterBreakdownSpellBar(spellsTab.GetSelectedSpellBar()) + onEnterSpellBar(spellsTab.GetSelectedSpellBar()) end end end @@ -1039,10 +1039,10 @@ end function spellsTab.UpdateShownSpellBlock() if (spellsTab.currentSpellBar) then - onEnterBreakdownSpellBar(spellsTab.currentSpellBar) + onEnterSpellBar(spellsTab.currentSpellBar) elseif (spellsTab.GetSelectedSpellBar()) then - onEnterBreakdownSpellBar(spellsTab.GetSelectedSpellBar()) + onEnterSpellBar(spellsTab.GetSelectedSpellBar()) end end @@ -1077,7 +1077,7 @@ end ---@param bkTargetData breakdowntargettable ---@param totalValue number ---@param topValue number the amount done of the first target, used to calculate the length of the statusbar -local updateTargetBar = function(targetBar, index, combatObject, scrollFrame, headerTable, bkTargetData, totalValue, topValue) --~target ~update ~targetbar +local updateTargetBar = function(targetBar, index, combatObject, scrollFrame, headerTable, bkTargetData, totalValue, topValue) --~target ~update ~targetbar ~updatetargetbar --scrollFrame is defined as a table which is false, scrollFrame is a frame local textIndex = 1 @@ -1092,6 +1092,9 @@ local updateTargetBar = function(targetBar, index, combatObject, scrollFrame, he ---@type number local combatTime = combatObject:GetCombatTime() + local actorContainer = combatObject:GetContainer(spellsTab.mainAttribute) + local targetActorObject = actorContainer:GetActor(bkTargetData.name) + targetBar.statusBar.backgroundTexture:SetAlpha(Details.breakdown_spell_tab.spellbar_background_alpha) --statusbar size by percent @@ -1112,7 +1115,16 @@ local updateTargetBar = function(targetBar, index, combatObject, scrollFrame, he if (header.name == "icon") then --ok targetBar.Icon:Show() - targetBar.Icon:SetTexture(CONST_TARGET_TEXTURE) + + if (targetActorObject) then + Details.SetClassIcon(targetActorObject, targetBar.Icon, spellsTab.GetInstance(), targetActorObject:Class()) + else + targetBar.Icon:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) + ---@type {key1: number, key2: number, key3: number, key4: number} + local texCoords = Details.class_coords["ENEMY"] + targetBar.Icon:SetTexCoord(unpack(texCoords)) + end + targetBar:AddFrameToHeaderAlignment(targetBar.Icon) elseif (header.name == "rank") then --ok @@ -1175,6 +1187,9 @@ local refreshFuncTargets = function(scrollFrame, scrollData, offset, totalLines) ---@type instance local instanceObject = spellsTab.GetInstance() + ---@type number + local mainAttribute = spellsTab.mainAttribute + local headerTable = spellsTab.targetsHeaderData local lineIndex = 1 @@ -1421,10 +1436,13 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll ---@type number local amtCasts = combatObject:GetSpellCastAmount(actorName, spellId) spellBar.amountCasts = amtCasts + ---@type number local uptime = combatObject:GetSpellUptime(actorName, spellId) + ---@type number local combatTime = combatObject:GetCombatTime() + ---@type string, number, string local spellName, _, spellIcon = Details.GetSpellInfo(spellId) @@ -1445,6 +1463,7 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll end --statusbar color by school + --print("spell school:", spellTable.spellschool) --healing has the spellschool not filled, it's nil local r, g, b = Details:GetSpellSchoolColor(spellTable.spellschool or 1) spellBar.statusBar:SetStatusBarColor(r, g, b, 1) @@ -2248,8 +2267,8 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr spellBar:RegisterForClicks("AnyUp", "AnyDown") spellBar:SetAlpha(0.9) spellBar:SetFrameStrata("HIGH") - spellBar:SetScript("OnEnter", onEnterBreakdownSpellBar) - spellBar:SetScript("OnLeave", onLeaveBreakdownSpellBar) + spellBar:SetScript("OnEnter", onEnterSpellBar) + spellBar:SetScript("OnLeave", onLeaveSpellBar) spellBar:SetScript("OnMouseDown", onMouseDownBreakdownSpellBar) spellBar:SetScript("OnMouseUp", onMouseUpBreakdownSpellBar) spellBar.onMouseUpTime = 0 @@ -2405,6 +2424,12 @@ function Details.InitializeSpellBreakdownTab() spellsTab.currentActor = actorObject spellsTab.combatObject = combatObject spellsTab.instance = instance + + ---@type number, number + local mainAttribute, subAttribute = instance:GetDisplay() + spellsTab.mainAttribute = mainAttribute + spellsTab.subAttribute = subAttribute + spellsTab.GetSpellScrollFrame():RefreshMe(data) end @@ -2413,6 +2438,10 @@ function Details.InitializeSpellBreakdownTab() ---@param combatObject combat ---@param instance instance function tabButton.OnReceiveTargetData(data, actorObject, combatObject, instance) + ---@type number, number + local mainAttribute, subAttribute = instance:GetDisplay() + spellsTab.mainAttribute = mainAttribute + spellsTab.subAttribute = subAttribute spellsTab.GetTargetScrollFrame():RefreshMe(data) end @@ -2427,7 +2456,7 @@ end ----------------------------------------------------------------------------------------------------------------------- --> report data -function spellsTab.CreateReportButtons(tabFrame) +function spellsTab.CreateReportButtons(tabFrame) --deprecated? --spell list report button tabFrame.report_esquerda = Details.gump:NewDetailsButton(tabFrame, tabFrame, nil, _detalhes.Reportar, tabFrame, 1, 16, 16, "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", "Interface\\COMMON\\VOICECHAT-ON", nil, "DetailsJanelaInfoReport2") tabFrame.report_esquerda:SetPoint("bottomleft", spellsTab.GetSpellScrollFrame(), "TOPLEFT", 33, 3)