diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index baa266c8..78f0a34a 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) @@ -2574,6 +2574,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/classes/class_damage.lua b/classes/class_damage.lua index 68ddd51d..81f562cd 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -2028,7 +2028,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 @@ -3769,6 +3769,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 diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 180d904b..d6d669f8 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 "") diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 0d33b725..80af9c92 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 diff --git a/core/parser.lua b/core/parser.lua index f990b6f8..ac44001c 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -3136,8 +3136,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 @@ -3158,7 +3158,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 diff --git a/frames/window_main.lua b/frames/window_main.lua index d29bd49e..33368f78 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -2085,7 +2085,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 diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index bb7a8c76..184cbfd5 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) @@ -364,7 +483,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() @@ -406,6 +525,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 @@ -503,7 +624,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() readyFrame:Hide() ---@type playerbanner[] - readyFrame.playerCacheByName = {} + readyFrame.unitCacheByName = {} do --register to libwindow @@ -742,19 +863,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() end end - --frame to handle loot events - local lootFrame = CreateFrame("frame", "$parentLootFrame", readyFrame) - lootFrame:RegisterEvent("BOSS_KILL"); - - local bossKillEncounterId - - lootFrame:SetScript("OnEvent", function(self, event, ...) - if (event == "BOSS_KILL") then - local encounterID, name = ...; - bossKillEncounterId = encounterID - --print("BOSS_KILL", GetTime(), bossKillEncounterId) - end - end) + --here was the loot frame events ~loot --[=[ Details222.MythicPlus.MapID = mapID @@ -860,7 +969,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() local mythicDungeonInfo = overallMythicDungeonCombat:GetMythicDungeonInfo() - if (not mythicDungeonInfo) then + if (not mythicDungeonInfo and not CONST_DEBUG_MODE) then return end @@ -873,7 +982,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(MYTHIC_PLUS_COMPLETE_BEAT_TIMER .. " | " .. MYTHIC_PLUS_COMPLETE_KEYSTONE_UPGRADED, Details222.MythicPlus.KeystoneUpgradeLevels) --"You beat the timer!"