From 82be7ed472ec638579e1a1c2a4ee70537604f191 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 27 May 2024 15:11:36 -0300 Subject: [PATCH 1/7] Don't break the death tooltip if the spell isn't in the game client database --- classes/class_utility.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 5fbd6173..9949c71b 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -212,6 +212,15 @@ function Details.ShowDeathTooltip(instance, lineFrame, combatObject, deathTable) local evType = event[1] local spellName, _, spellIcon = _GetSpellInfo(event[2]) + + if (not spellName) then + spellName = _G.UNKNOWN + end + + if (not spellIcon) then + spellIcon = [[Interface\ICONS\INV_MISC_QUESTIONMARK]] + end + local amount = event[3] local eventTime = event[4] local source = Details:GetOnlyName(event[6] or "") From cd16ce759078b5e3c37465be0c7a1ce90ef3c004 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 27 May 2024 18:39:22 -0300 Subject: [PATCH 2/7] Fixed an issue in the backend of the addon --- classes/container_segments.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 64077f68..c6085f48 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -916,7 +916,10 @@ function segmentClass:ResetAllCombatData() for i = #segmentsTable, 1, -1 do ---@type combat local thisCombatObject = segmentsTable[i] - Details:DestroyCombat(thisCombatObject) + --check if the combat is already destroyed + if (not thisCombatObject.__destroyed) then + Details:DestroyCombat(thisCombatObject) + end end --the current combat when finished will be moved to the first index of "segmentsTable", need the check if the current combat was already destroyed From 9605299be0f2a0b356b6c19fdb90eedc6b2b41dd Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 1 Jun 2024 12:52:52 -0300 Subject: [PATCH 3/7] Added tranliterate into the icon tooltip --- Libs/DF/definitions.lua | 2 +- Libs/DF/fw.lua | 3 ++- Libs/DF/label.lua | 5 +++++ Libs/DF/picture.lua | 2 +- frames/window_main.lua | 9 ++++++++- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index fb172eef..d40be5bd 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -301,7 +301,7 @@ ---@field ParseTexture fun(self:table, texture:texturepath|textureid|atlasname|atlasinfo, width: number?, height: number?, leftTexCoord: number?, rightTexCoord: number?, topTexCoord: number?, bottomTexCoord: number?, vertexRed:number|string?, vertexGreenvertexRed:number?, vertexBluevertexRed:number?, vertexAlphavertexRed:number?) : any, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number? ---@field IsTexture fun(self:table, texture:any, bCheckTextureObject: boolean?) : boolean ---@field CreateAtlasString fun(self:table, atlas:atlasinfo|atlasname, textureHeight:number?, textureWidth:number?) : string ----@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid|table) : nil +---@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid|table|string) : nil ---@field GetClientRegion fun(self:table) : string ---@field GetBestFontPathForLanguage fun(self:table, languageId:string) : string ---@field SetTemplate fun(self:table, frame:uiobject, template:string) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 93c9a7d3..d47a87dd 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 537 +local dversion = 538 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -2865,6 +2865,7 @@ end --DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"} DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 10, font = DF:GetBestFontForLanguage()} DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 9.6, font = DF:GetBestFontForLanguage()} +DF.font_templates["SMALL_SILVER"] = {color = "silver", size = 9, font = DF:GetBestFontForLanguage()} --dropdowns DF.dropdown_templates = DF.dropdown_templates or {} diff --git a/Libs/DF/label.lua b/Libs/DF/label.lua index 0c04a82a..e0ac023b 100644 --- a/Libs/DF/label.lua +++ b/Libs/DF/label.lua @@ -408,6 +408,11 @@ function detailsFramework:NewLabel(parent, container, name, member, text, font, --if template has been passed as the third parameter if (size and type(size) == "table") then labelObject:SetTemplate(size) + + --check if a template was passed as the 3rd argument + elseif (size and type(size) == "string") then + local template = detailsFramework:ParseTemplate(labelObject.type, size) + labelObject:SetTemplate(template) end return labelObject diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 15fdb306..7c653807 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -716,7 +716,7 @@ function detailsFramework:SetMask(texture, maskTexture) if (not texture.MaskTexture) then local parent = texture:GetParent() local maskTextureObject = parent:CreateMaskTexture(nil, "artwork") - maskTextureObject:SetAllPoints(texture) + maskTextureObject:SetAllPoints(texture.widget or texture) texture:AddMaskTexture(maskTextureObject) texture.MaskTexture = maskTextureObject end diff --git a/frames/window_main.lua b/frames/window_main.lua index ba964001..d7f2ff6a 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -2106,7 +2106,14 @@ local iconFrame_OnEnter = function(self) end end - GameCooltip:AddLine(name, specName) + if (instance.row_info.textL_translit_text) then + --translate cyrillic alphabet to western alphabet by Vardex (https://github.com/Vardex May 22, 2019) + local Translit = LibStub("LibTranslit-1.0") + GameCooltip:AddLine(Translit:Transliterate(name, "!"), specName) + else + GameCooltip:AddLine(name, specName) + end + if (class == "UNKNOW" or class == "UNGROUPPLAYER") then GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, iconSize, iconSize, 0, 0.25, 0.75, 1) else From 5cfb67f8db2c85bd3c3867738be802caf86257c0 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 1 Jun 2024 15:11:06 -0300 Subject: [PATCH 4/7] Added transliteration to the pet name --- classes/class_damage.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 4596247e..fa4af953 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -4160,6 +4160,11 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) local petDPS = damageTable[3] petName = damageTable[1]:gsub(("%s%<.*"), "") + + if (instance.row_info.textL_translit_text) then + petName = Translit:Transliterate(petName, "!") + end + if (instancia.sub_atributo == 1) then GameCooltip:AddLine(petName, FormatTooltipNumber(_, petDamageDone) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)") else From bdf8901fa2273b60ab806a346f9c2f6de5160b45 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 2 Jun 2024 15:19:51 -0300 Subject: [PATCH 5/7] Attmept to create the _current_combat.alternate_power if it no existant for some reason in Cataclysm classic --- core/parser.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/parser.lua b/core/parser.lua index 995fc9f0..3e4edd80 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -3669,8 +3669,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 [SPELL_POWER_FURY] = {file = [[Interface\PLAYERFRAME\UI-PlayerFrame-Deathknight-Blood-On]], coords = {0, 1, 0, 1}}, } - local alternatePowerEnableFrame = CreateFrame("frame") - local alternatePowerMonitorFrame = CreateFrame("frame") + local alternatePowerEnableFrame = CreateFrame("frame", "DetailsAlternatePowerEventHandler") + local alternatePowerMonitorFrame = CreateFrame("frame", "DetailsAlternatePowerMonitor") alternatePowerEnableFrame:RegisterEvent("UNIT_POWER_BAR_SHOW") alternatePowerEnableFrame:RegisterEvent("ENCOUNTER_END") alternatePowerEnableFrame.IsRunning = false @@ -3691,7 +3691,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (powerType == "ALTERNATE") then local actorName = Details:GetFullName(unitID) if (actorName) then - local power = _current_combat.alternate_power[actorName] + --weird bug on cata as described below + if (not _current_combat.alternate_power) then + _current_combat.alternate_power = {} + end + + local power = _current_combat.alternate_power[actorName] --cata: 120x Details/core/parser.lua:3694: attempt to index field 'alternate_power' (a nil value) if (not power) then power = _current_combat:CreateAlternatePowerTable(actorName) end From 2178cfe357fcfde76830520581d84495eaca5c74 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 6 Jun 2024 21:31:52 -0300 Subject: [PATCH 6/7] Fixed cho'gall friendly fire errors --- classes/class_damage.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index fa4af953..c06c40b9 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -2034,7 +2034,7 @@ function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, b this_spell [2] = this_spell [2] + on_player total = total + on_player else - error("error - no spell id for DTBS friendly fire " .. spellid) + --error("error - no spell id for DTBS friendly fire " .. spellid) end end end From 234bbf458c22c5c895eef66d8cad0a52f51c7d76 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 6 Jun 2024 22:27:13 -0300 Subject: [PATCH 7/7] Overhaul on the loot manager for the end of the mythic dungeon panel --- .../window_mythicplus/window_end_of_run.lua | 190 ++++++++++++------ 1 file changed, 129 insertions(+), 61 deletions(-) diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index da5f82a3..475a2e96 100644 --- a/frames/window_mythicplus/window_end_of_run.lua +++ b/frames/window_mythicplus/window_end_of_run.lua @@ -16,6 +16,7 @@ local UIParent = UIParent local PixelUtil = PixelUtil local C_Timer = C_Timer local GameTooltip = GameTooltip +local SOUNDKIT = SOUNDKIT local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") @@ -69,6 +70,124 @@ _G.MythicDungeonFrames = mythicDungeonFrames ---@field LootItemLevel fontstring ---@field itemLink string +---@class details_loot_cache : table +---@field playerName string +---@field itemLink string +---@field effectiveILvl number +---@field itemQuality number +---@field itemID number +---@field time number + +---@class lootframe : frame +---@field LootCache details_loot_cache[] + +--frame to handle loot events +local lootFrame = CreateFrame("frame", "DetailsEndOfMythicLootFrame", UIParent) +lootFrame:RegisterEvent("BOSS_KILL") +lootFrame:RegisterEvent("ENCOUNTER_LOOT_RECEIVED") + +--register the loot players looted at the end of the mythic dungeon +lootFrame.LootCache = {} + +--currently being called after a updatPlayerBanner() +function lootFrame.UpdateUnitLoot(unitBanner) + local unitId = unitBanner.unitId + local unitName = unitBanner.unitName + + local timeNow = GetTime() + local lootCache = lootFrame.LootCache[unitName] + + ---@type details_loot_cache[] + local lootCandidates = {} + + if (lootCache) then + local lootCacheSize = #lootCache + if (lootCacheSize > 0) then + local lootIndex = 1 + for i = lootCacheSize, 1, -1 do + ---@type details_loot_cache + local lootInfo = lootCache[i] + if (timeNow - lootInfo.time < 10) then + lootCandidates[lootIndex] = lootInfo + lootIndex = lootIndex + 1 + end + end + end + end + + for i = 1, #lootCandidates do + local lootInfo = lootCandidates[i] + local itemLink = lootInfo.itemLink + local effectiveILvl = lootInfo.effectiveILvl + local itemQuality = lootInfo.itemQuality + local itemID = lootInfo.itemID + + local lootSquare = unitBanner:GetLootSquare() + lootSquare.itemLink = itemLink --will error if this the thrid lootSquare (creates only 2 per banner) + + local rarityColor = --[[GLOBAL]]ITEM_QUALITY_COLORS[itemQuality] + lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1) + + lootSquare.LootIcon:SetTexture(GetItemIcon(itemID)) + lootSquare.LootItemLevel:SetText(effectiveILvl or "0") + + mythicDungeonFrames.ReadyFrame.StopTextDotAnimation() + + lootSquare:Show() + end +end + +--debug data to test encounter loot received event: +--/run _G.DetailsEndOfMythicLootFrame:OnEvent("ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, "Fera", "EVOKER") + +lootFrame:SetScript("OnEvent", function(self, event, ...) + if (event == "BOSS_KILL") then + local encounterID, name = ...; + + elseif (event == "ENCOUNTER_LOOT_RECEIVED") then + local lootEncounterId, itemID, itemLink, quantity, unitName, className = ... + + unitName = Ambiguate(unitName, "none") + + local _, instanceType = GetInstanceInfo() + if (instanceType == "party" or CONST_DEBUG_MODE) then + local effectiveILvl, nop, baseItemLevel = GetDetailedItemLevelInfo(itemLink) + + local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, + itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType, + expacID, setID, isCraftingReagent = GetItemInfo(itemLink) + + if (Details.debug) then + Details222.DebugMsg("Loot Received:", unitName, itemLink, effectiveILvl, itemQuality, baseItemLevel, "itemType:", itemType, "itemSubType:", itemSubType, "itemEquipLoc:", itemEquipLoc) + end + + if (effectiveILvl > 300 and baseItemLevel > 5) then --avoid showing loot that isn't items + lootFrame.LootCache[unitName] = lootFrame.LootCache[unitName] or {} + ---@type details_loot_cache + local lootCacheTable = { + playerName = unitName, + itemLink = itemLink, + effectiveILvl = effectiveILvl, + itemQuality = itemQuality, --this is a number + itemID = itemID, + time = time() + } + table.insert(lootFrame.LootCache[unitName], lootCacheTable) + + --check if the end of mythic plus frame is opened and call a function to update the loot frame of the player + if (mythicDungeonFrames.ReadyFrame and mythicDungeonFrames.ReadyFrame:IsVisible()) then + C_Timer.After(1.5, function() + local unitBanner = mythicDungeonFrames.ReadyFrame.unitCacheByName[unitName] + if (unitBanner) then + lootFrame.UpdateUnitLoot(unitBanner) + end + end) + end + end + end + end +end) + local createLootSquare = function(playerBanner, name, parent, lootIndex) ---@type details_lootsquare local lootSquare = CreateFrame("frame", playerBanner:GetName() .. "LootSquare" .. lootIndex, parent) @@ -376,7 +495,7 @@ local updatPlayerBanner = function(unitId, bannerIndex) ---@type playerbanner local playerBanner = readyFrame.PlayerBanners[bannerIndex] - readyFrame.playerCacheByName[unitName] = playerBanner + readyFrame.unitCacheByName[unitName] = playerBanner playerBanner.unitId = unitId playerBanner.unitName = unitName playerBanner:Show() @@ -418,6 +537,8 @@ local updatPlayerBanner = function(unitId, bannerIndex) playerBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) playerBanner.LevelFontString:SetText("") end + + lootFrame.UpdateUnitLoot(playerBanner) return true end end @@ -485,6 +606,9 @@ end if (CONST_DEBUG_MODE) then C_Timer.After(3, function() C_AddOns.LoadAddOn("Blizzard_ChallengesUI"); + _G.DetailsEndOfMythicLootFrame:GetScript("OnEvent")(_G.DetailsEndOfMythicLootFrame, "ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, UnitName("player"), select(2, UnitClass("player"))) + _G.DetailsEndOfMythicLootFrame:GetScript("OnEvent")(_G.DetailsEndOfMythicLootFrame, "ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, UnitName("player"), select(2, UnitClass("player"))) + _G.MythicDungeonFrames.ShowEndOfMythicPlusPanel() end) end @@ -515,7 +639,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() readyFrame:Hide() ---@type playerbanner[] - readyFrame.playerCacheByName = {} + readyFrame.unitCacheByName = {} do --register to libwindow @@ -816,63 +940,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() end end - --frame to handle loot events - local lootFrame = CreateFrame("frame", "$parentLootFrame", readyFrame) - lootFrame:RegisterEvent("BOSS_KILL"); - lootFrame:RegisterEvent("ENCOUNTER_LOOT_RECEIVED") - - local bossKillEncounterId - - lootFrame:SetScript("OnEvent", function(self, event, ...) - if (event == "BOSS_KILL") then - local encounterID, name = ...; - bossKillEncounterId = encounterID - --print("BOSS_KILL", GetTime(), bossKillEncounterId) - - elseif (event == "ENCOUNTER_LOOT_RECEIVED") then - local lootEncounterId, itemID, itemLink, quantity, playerName, className = ... - --print("ENCOUNTER_LOOT_RECEIVED", GetTime(), lootEncounterId, bossKillEncounterId) - - --print("no ambig:", playerName, "with ambig:", Ambiguate(playerName, "none")) --debug - playerName = Ambiguate(playerName, "none") - local unitBanner = readyFrame.playerCacheByName[playerName] - - if (not unitBanner) then - --print("no unitBanner for player", playerName, "aborting.") - return - end - - local _, instanceType = GetInstanceInfo() - --print("Is encounter the same:", lootEncounterId == bossKillEncounterId) - if (instanceType == "party") then -- or instanceType == "raid" --lootEncounterId == bossKillEncounterId and - --print("all good showing loot for player", playerName) - - local effectiveILvl, nop, baseItemLevel = GetDetailedItemLevelInfo(itemLink) - - local itemName, itemLink, itemQuality, itemLevel, itemMinLevel, itemType, itemSubType, - itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType, - expacID, setID, isCraftingReagent = GetItemInfo(itemLink) - - --print("equip loc:", itemEquipLoc) - --unitBanner:ClearLootSquares() - if (effectiveILvl > 300 and baseItemLevel > 5) then --avoid showing loot that isn't items - local lootSquare = unitBanner:GetLootSquare() - lootSquare.itemLink = itemLink --will error if this the thrid lootSquare (creates only 2 per banner) - - local rarityColor = ITEM_QUALITY_COLORS[itemQuality] - lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1) - - lootSquare.LootIcon:SetTexture(GetItemIcon(itemID)) - lootSquare.LootItemLevel:SetText(effectiveILvl or "0") - - readyFrame.StopTextDotAnimation() - - --print("loot info:", itemLink, effectiveILvl, itemQuality) - lootSquare:Show() - end - end - end - end) + --here was the loot frame events ~loot --[=[ Details222.MythicPlus.MapID = mapID @@ -984,7 +1052,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() local mythicDungeonInfo = overallMythicDungeonCombat:GetMythicDungeonInfo() - if (not mythicDungeonInfo) then + if (not mythicDungeonInfo and not CONST_DEBUG_MODE) then return end @@ -997,7 +1065,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() readyFrame.DungeonBackdropTexture:SetTexture(overallMythicDungeonCombat.is_mythic_dungeon.DungeonTexture) end - wipe(readyFrame.playerCacheByName) + wipe(readyFrame.unitCacheByName) if (Details222.MythicPlus.OnTime) then readyFrame.YouBeatTheTimerLabel:SetFormattedText(CHALLENGE_MODE_COMPLETE_BEAT_TIMER .. " | " .. CHALLENGE_MODE_COMPLETE_KEYSTONE_UPGRADED, Details222.MythicPlus.KeystoneUpgradeLevels) --"You beat the timer!"