From ce9a3b875bd0665d257490277bbd1971b12d6175 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 22 Dec 2022 22:18:28 -0300 Subject: [PATCH] Visualize better mythic plus segments --- Libs/DF/cooltip.lua | 41 +++++--- Libs/DF/fw.lua | 2 +- core/control.lua | 12 +-- core/windows.lua | 7 -- frames/window_main.lua | 48 +++++++-- functions/boss.lua | 96 ++++++++++++++++-- images/empty16.tga | Bin 0 -> 1068 bytes images/empty32.tga | Bin 0 -> 4140 bytes .../Details_EncounterDetails.lua | 3 - 9 files changed, 165 insertions(+), 44 deletions(-) create mode 100644 images/empty16.tga create mode 100644 images/empty32.tga diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 57cae134..36fc756f 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -15,7 +15,7 @@ local max = math.max --api locals local PixelUtil = PixelUtil or DFPixelUtil -local version = 10 +local version = 11 local CONST_MENU_TYPE_MAINMENU = "main" local CONST_MENU_TYPE_SUBMENU = "sub" @@ -2628,23 +2628,32 @@ function DF:CreateCoolTip() wallpaperTable[7] = desaturate end - function gameCooltip:SetBannerText(index, text, anchor, color, fontSize, fontFace, fontFlag) + function gameCooltip:SetBannerText(menuType, index, text, anchor, color, fontSize, fontFace, fontFlag) + menuType = gameCooltip:ParseMenuType(menuType) + + local frame + if (menuType == CONST_MENU_TYPE_MAINMENU) then + frame = frame1 + elseif (menuType == CONST_MENU_TYPE_SUBMENU) then + frame = frame2 + end + local fontstring if (index == 1) then - fontstring = frame1.upperImageText + fontstring = frame.upperImageText elseif (index == 2) then - fontstring = frame1.upperImageText2 + fontstring = frame.upperImageText2 end fontstring:SetText(text or "") if (anchor and index == 1) then local myAnchor, hisAnchor, x, y = unpack(anchor) - fontstring:SetPoint(myAnchor, frame1.upperImage, hisAnchor or myAnchor, x or 0, y or 0) + fontstring:SetPoint(myAnchor, frame.upperImage, hisAnchor or myAnchor, x or 0, y or 0) elseif (anchor and index == 2) then local myAnchor, hisAnchor, x, y = unpack(anchor) - fontstring:SetPoint(myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) + fontstring:SetPoint(myAnchor, frame, hisAnchor or myAnchor, x or 0, y or 0) end if (color) then @@ -2667,7 +2676,6 @@ function DF:CreateCoolTip() if (menuType == CONST_MENU_TYPE_MAINMENU) then frame = frame1 - elseif (menuType == CONST_MENU_TYPE_SUBMENU) then frame = frame2 end @@ -2685,12 +2693,21 @@ function DF:CreateCoolTip() end end - function gameCooltip:SetBannerImage(index, texturePath, width, height, anchor, texCoord, overlay) + function gameCooltip:SetBannerImage(menuType, index, texturePath, width, height, anchor, texCoord, overlay) + menuType = gameCooltip:ParseMenuType(menuType) + + local frame + if (menuType == CONST_MENU_TYPE_MAINMENU) then + frame = frame1 + elseif(menuType == CONST_MENU_TYPE_SUBMENU) then + frame = frame2 + end + local texture if (index == 1) then - texture = frame1.upperImage + texture = frame.upperImage elseif (index == 2) then - texture = frame1.upperImage2 + texture = frame.upperImage2 end if (texturePath) then @@ -2708,11 +2725,11 @@ function DF:CreateCoolTip() if (type(anchor[1]) == "table") then for anchorIndex, anchorPoints in ipairs(anchor) do local myAnchor, hisAnchor, x, y = unpack(anchorPoints) - texture:SetPoint(myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) + texture:SetPoint(myAnchor, frame, hisAnchor or myAnchor, x or 0, y or 0) end else local myAnchor, hisAnchor, x, y = unpack(anchor) - texture:SetPoint(myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) + texture:SetPoint(myAnchor, frame, hisAnchor or myAnchor, x or 0, y or 0) end end diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index cfc3174c..84cbf1df 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 405 +local dversion = 406 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/core/control.lua b/core/control.lua index 3d50c1b8..b0442e4a 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1727,16 +1727,10 @@ local avatar = NickTag:GetNicknameTable (objeto.serial, true) if (avatar and not Details.ignore_nicktag) then if (avatar [2] and avatar [4] and avatar [1]) then - GameCooltip:SetBannerImage (1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path - GameCooltip:SetBannerImage (2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --background - GameCooltip:SetBannerText (1, (not Details.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname + GameCooltip:SetBannerImage (1, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path + GameCooltip:SetBannerImage (1, 2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --background + GameCooltip:SetBannerText (1, 1, (not Details.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname end - else - --if (Details.remove_realm_from_name and objeto.displayName:find("%*")) then - -- GameCooltip:SetBannerImage (1, [[Interface\AddOns\Details\images\background]], 20, 30, avatarPoint, avatarTexCoord, {0, 0, 0, 0}) --overlay [2] avatar path - -- GameCooltip:SetBannerImage (2, [[Interface\PetBattles\Weather-BurntEarth]], 160, 30, {{"bottomleft", "topleft", 0, -5}, {"bottomright", "topright", 0, -5}}, {0.12, 0.88, 1, 0}, {0, 0, 0, 0.1}) --overlay [2] avatar path {0, 0, 0, 0} - -- GameCooltip:SetBannerText (1, objeto.nome, {"left", "left", 11, -8}, {1, 1, 1, 0.7}, 10, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname - --end end end diff --git a/core/windows.lua b/core/windows.lua index 99e219bd..349e332c 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -1366,13 +1366,6 @@ GameCooltip:SetOption("HeighMod", 5) GameCooltip:SetOption("TextSize", 10) - --344 427 200 268 0.0009765625 - --0.672851, 0.833007, 0.391601, 0.522460 - - --GameCooltip:SetBannerImage (1, [[Interface\AddOns\Details\images\icons]], 83*.5, 68*.5, {"bottomleft", "topleft", 1, -4}, {0.672851, 0.833007, 0.391601, 0.522460}, nil) - --GameCooltip:SetBannerImage (2, "Interface\\PetBattles\\Weather-Windy", 512*.35, 128*.3, {"bottomleft", "topleft", -25, -4}, {0, 1, 1, 0}) - --GameCooltip:SetBannerText (1, "Mini Map Menu", {"left", "right", 2, -5}, "white", 10) - --reset GameCooltip:AddMenu (1, Details.tabela_historico.resetar, true, nil, nil, Loc ["STRING_ERASE_DATA"], nil, true) GameCooltip:AddIcon ([[Interface\COMMON\VOICECHAT-MUTED]], 1, 1, 14, 14) diff --git a/frames/window_main.lua b/frames/window_main.lua index 019f426a..6cc5c9d0 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -6361,22 +6361,50 @@ local buildSegmentTooltip = function(self, deltaTime) end end + local addIconAndStatusBar = function(redTint) + gameCooltip:AddIcon([[Interface\AddOns\Details\images\empty16]], 2, 1, 12, 12) + gameCooltip:AddStatusBar(100, 2, redTint or 0, 0, 0, 0.85, false, false, "Skyline") + end + --is mythic overall if (isMythicOverallSegment) then - --mostrar o tempo da dungeon - local totalTime = elapsedCombatTime - gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeonColor) + local overallIcon = "|TInterface\\GLUES\\CharacterSelect\\Glues-AddOn-Icons:16:16:0:0:64:16:48:64:0:16|t" + + gameCooltip:AddLine(overallIcon .. zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeonColor) gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512) + gameCooltip:AddStatusBar(100, 1, .5, .1, 0, 0.55, false, false, "Skyline") + gameCooltip:AddLine(zoneName .. " +" .. mythicLevel .. " (" .. Loc["STRING_SEGMENTS_LIST_OVERALL"] .. ")", nil, 2, "white", "white") + gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.85, false, false, "Skyline") else if (segmentID == "trashoverall") then local trashIcon = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:14:58:98:160|t" gameCooltip:AddLine(trashIcon .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", Details.gump:IntegerToTimer(endedAt - startedAt), 1, dungeonColor, "gray") + addIconAndStatusBar() gameCooltip:AddLine((encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_TRASH"] .. ")", nil, 2, "white", "white") + addIconAndStatusBar() else local skull = "|TInterface\\AddOns\\Details\\images\\icons:16:16:0:0:512:512:496:512:0:16|t" gameCooltip:AddLine(skull .. "" .. (encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", Details.gump:IntegerToTimer(elapsedCombatTime), 1, dungeonColor, "gray") + addIconAndStatusBar() gameCooltip:AddLine((encounterName or Loc["STRING_UNKNOW"]) .. " (" .. Loc["STRING_SEGMENTS_LIST_BOSS"] .. ")", nil, 2, "white", "white") + addIconAndStatusBar() + + do + local avatarPoint = {"bottomleft", "topleft", -3, -4} + local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}} + local textPoint = {"left", "right", -11, -5} + local avatarTexCoord = {0, 1, 0, 1} + local backgroundColor = {0, 0, 0, 0.6} + local avatarTextColor = {1, 1, 1, 1} + + --gameCooltip:SetBannerImage(2, 1, avatar [2], 80, 40, avatarPoint, avatarTexCoord, nil) --overlay [2] avatar path + local anchor = {"bottom", "top", 0, 0} + + --these need to be per line, current are per frame + --gameCooltip:SetBannerImage(2, 2, [[Interface\PetBattles\Weather-Windy]], 200, 55, anchor, {1, 0.129609375, 1, 0}) + --gameCooltip:SetBannerText(2, 2, encounterName, textPoint, avatarTextColor, 14, SharedMedia:Fetch("font", Details.tooltip.fontface)) + end end gameCooltip:AddIcon([[Interface\AddOns\Details\images\icons]], "main", "left", 14, 10, 479/512, 510/512, 24/512, 51/512) end @@ -6404,35 +6432,43 @@ local buildSegmentTooltip = function(self, deltaTime) if (segmentID == "trashoverall") then gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white") + addIconAndStatusBar() local totalRealTime = endedAt - startedAt local wasted = totalRealTime - decorrido --wasted time gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. Details.gump:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white") - gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.35, false, false, "Skyline") + addIconAndStatusBar(0.15) gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", Details.gump:IntegerToTimer(endedAt - startedAt), 2, "white", "white") + addIconAndStatusBar() elseif (isMythicOverallSegment) then gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TIMEINCOMBAT"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white") + addIconAndStatusBar() local totalRealTime = endedAt - startedAt local wasted = totalRealTime - decorrido --wasted time gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_WASTED_TIME"] .. ":", "|cFFFF3300" .. Details.gump:IntegerToTimer(wasted) .. " (" .. floor(wasted / totalRealTime * 100) .. "%)|r", 2, "white", "white") - gameCooltip:AddStatusBar(100, 2, 0, 0, 0, 0.35, false, false, "Skyline") + addIconAndStatusBar(0.15) gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_TOTALTIME"] .. ":", Details.gump:IntegerToTimer(totalRealTime), 2, "white", "white") + addIconAndStatusBar() else gameCooltip:AddLine(Loc["STRING_SEGMENTS_LIST_COMBATTIME"] .. ":", Details.gump:IntegerToTimer(decorrido), 2, "white", "white") + addIconAndStatusBar() end if (thisCombat.is_boss) then gameCooltip:AddLine("", "", 2, "white", "white") + addIconAndStatusBar() end gameCooltip:AddLine(Loc["STRING_SEGMENT_START"] .. ":", thisCombat.data_inicio, 2, "white", "white") + addIconAndStatusBar() gameCooltip:AddLine(Loc["STRING_SEGMENT_END"] .. ":", thisCombat.data_fim or "in progress", 2, "white", "white") - gameCooltip:AddStatusBar (100, 1, .3, .3, .3, 0.2, false, false, "Skyline") + addIconAndStatusBar() + --gameCooltip:AddStatusBar(100, 1, .3, .3, .3, 0.2, false, false, "Skyline") else --the combat has mythic dungeon tag but doesn't have a mythic dungeon table information --so this is a trash cleanup segment diff --git a/functions/boss.lua b/functions/boss.lua index 0f84aac6..d3f6e099 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -535,6 +535,11 @@ do Details222.EJCache.CacheDungeonData_ByInstanceName = {} Details222.EJCache.CacheDungeonData_ByMapId = {} + --exit this function if is classic wow using DetailsFramework + if (DetailsFramework.IsClassicWow()) then + return + end + --todo generate encounter spells cache --check if the encounter journal added is loaded @@ -545,6 +550,10 @@ do do --iterate among all raid instances, by passing true in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get raid instances local bGetRaidInstances = true + + EncounterJournalRaidTab:Click() + EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight + for instanceIndex = 10, 2, -1 do local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances) @@ -615,11 +624,10 @@ do end do - --iterate among all dungeon instances, by passing false in the second argument of EJ_GetInstanceByIndex, indicates to the API we want to get dungeon instances - - --issue: not getting vintage dungoen like Halls of Valor - local bGetRaidInstances = false + EncounterJournalDungeonTab:Click() + EncounterJournal_TierDropDown_Select(_, 11) --select mythic+ + for instanceIndex = 20, 1, -1 do local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances) @@ -688,14 +696,90 @@ do end end end + + EncounterJournal_TierDropDown_Select(_, 10) --select Dragonflight + + for instanceIndex = 20, 1, -1 do + local journalInstanceID, instanceName, description, bgImage, buttonImage1, loreImage, buttonImage2, dungeonAreaMapID = EJ_GetInstanceByIndex(instanceIndex, bGetRaidInstances) + + if (journalInstanceID and not Details222.EJCache.CacheDungeonData_ByInstanceId[journalInstanceID]) then + --tell the encounter journal to display the dungeon instance by the instanceId + EncounterJournal_DisplayInstance(journalInstanceID) + + --build a table with data of the raid instance + local instanceData = { + name = instanceName, + mapId = dungeonAreaMapID, + bgImage = bgImage, + instanceId = journalInstanceID, + + encountersArray = {}, + encountersByName = {}, + encountersByDungeonEncounterId = {}, + encountersByJournalEncounterId = {}, + + icon = buttonImage1, + iconSize = {70, 36}, + iconCoords = {0.01, .67, 0.025, .725}, + + iconLore = loreImage, + iconLoreSize = {70, 36}, + iconLoreCoords = {0, 1, 0, 0.95}, + + iconTexture = buttonImage2, + iconTextureSize = {70, 36}, + iconTextureCoords = {0, 1, 0, 0.95}, + } + + --cache the raidData on different tables using different indexes + Details222.EJCache.CacheDungeonData_ByInstanceId[journalInstanceID] = instanceData + Details222.EJCache.CacheDungeonData_ByInstanceName[instanceName] = instanceData + Details222.EJCache.CacheDungeonData_ByMapId[dungeonAreaMapID] = instanceData + + --iterate among all encounters of the dungeon instance + for encounterIndex = 1, 20 do + local name, description, journalEncounterID, rootSectionID, link, journalInstanceID, dungeonEncounterID, UiMapID = _G.EJ_GetEncounterInfoByIndex(encounterIndex, journalInstanceID) + if (name) then + + local encounterData = { + name = name, + mapId = dungeonAreaMapID, + uiMapId = UiMapID, + dungeonEncounterId = dungeonEncounterID, + journalEncounterId = journalEncounterID, + journalInstanceId = journalInstanceID, + } + + local journalEncounterCreatureId, creatureName, creatureDescription, creatureDisplayID, iconImage, uiModelSceneID = EJ_GetCreatureInfo(1, journalEncounterID) + if (journalEncounterCreatureId) then + encounterData.creatureName = creatureName + encounterData.creatureIcon = iconImage + encounterData.creatureId = journalEncounterCreatureId + encounterData.creatureDisplayId = creatureDisplayID + encounterData.creatureUIModelSceneId = uiModelSceneID + end + + instanceData.encountersArray[#instanceData.encountersArray+1] = encounterData + instanceData.encountersByName[name] = encounterData + instanceData.encountersByDungeonEncounterId[dungeonEncounterID] = encounterData + instanceData.encountersByJournalEncounterId[journalEncounterID] = encounterData + end + end + end + end + end + + --reset the dungeon journal to the default state + if (EncounterJournalSuggestTab) then + EncounterJournalSuggestTab:Click() end end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --core - function _detalhes:InstallEncounter (InstanceTable) - _detalhes.EncounterInformation [InstanceTable.id] = InstanceTable + function _detalhes:InstallEncounter(InstanceTable) + _detalhes.EncounterInformation[InstanceTable.id] = InstanceTable return true end end diff --git a/images/empty16.tga b/images/empty16.tga new file mode 100644 index 0000000000000000000000000000000000000000..e1376596182b04abdf641be1dc1542a12deb10f6 GIT binary patch literal 1068 wcmZQzU}As)0R{mE1q~Q)lpYO%(GVE9ArKN2>Kf)5?CI~P8{y{Z overlay [2] avatar path - --CoolTip:SetBannerText (1, Loc ["STRING_PLUGIN_NAME"], textPoint, {1, 1, 1}, 14, SharedMedia:Fetch ("font", _detalhes.tooltip.fontface)) --> text [1] nickname --apply the backdrop settings to the menu Details:FormatCooltipBackdrop()