From b8b55e7653ff0ebf994eeb8442cc398c0769874f Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 23 Apr 2022 09:57:39 -0300 Subject: [PATCH] Attempt to fix the issue of Skins installed after Details! initialization --- Libs/LibOpenRaid/LibOpenRaid.lua | 2 +- Libs/LibOpenRaid/ThingsToMantain.lua | 8 ++++---- boot.lua | 7 ++++--- frames/window_main.lua | 25 ++++++++++++++++--------- functions/skins.lua | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 5c68f570..86a58970 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -818,7 +818,7 @@ LIB_OPEN_RAID_CAN_LOAD = false openRaidLib.publicCallback.TriggerCallback("UnitInfoUpdate", openRaidLib.GetUnitID(unitName), openRaidLib.UnitInfoManager.UnitData[unitName], openRaidLib.UnitInfoManager.GetAllUnitsInfo()) end - --triggered when the lib receives a gear information from another player in the raid + --triggered when the lib receives a unit information from another player in the raid --@data: table received from comm --@unitName: player name function openRaidLib.UnitInfoManager.OnReceiveUnitFullInfo(data, unitName) diff --git a/Libs/LibOpenRaid/ThingsToMantain.lua b/Libs/LibOpenRaid/ThingsToMantain.lua index a5bb3458..18098073 100644 --- a/Libs/LibOpenRaid/ThingsToMantain.lua +++ b/Libs/LibOpenRaid/ThingsToMantain.lua @@ -650,7 +650,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = { [108281] = 4, --Ancestral Guidance (talent) [198103] = 2, --Earth Elemental --[79206] = 5, --Spiritwalkers grace - [65992] = 5, --Tremor Totem + [8143] = 5, --Tremor Totem [192058] = 5, --Capacitor Totem [192077] = 5, --Wind Rush Totem (talent) }, @@ -660,7 +660,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = { [114051] = 1, --Ascendance (talent) [108271] = 2, --Astral Shift [198103] = 2, --Earth Elemental - [65992] = 5, --Tremor Totem + [8143] = 5, --Tremor Totem [192058] = 5, --Capacitor Totem }, @@ -673,7 +673,7 @@ LIB_OPEN_RAID_COOLDOWNS_BY_SPEC = { [16191] = 4, --Mana Tide Totem [207399] = 4, --Ancestral Protection Totem (talent) [198103] = 2, --Earth Elemental - [65992] = 5, --Tremor Totem + [8143] = 5, --Tremor Totem }, } @@ -753,7 +753,7 @@ LIB_OPEN_RAID_COOLDOWNS_INFO = { [16191] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Mana Tide Totem [198103] = {cooldown = 300, duration = 60, talent = false, charges = 1, class = "SHAMAN", type = 2}, --Earth Elemental [192058] = {cooldown = 60, duration = false, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Capacitor Totem - [65992] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Tremor Totem + [8143] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Tremor Totem [192077] = {cooldown = 120, duration = 15, talent = 21966, charges = 1, class = "SHAMAN", type = 5}, --Wind Rush Totem (talent) --> monk diff --git a/boot.lua b/boot.lua index 66c7d51a..c646bd8f 100644 --- a/boot.lua +++ b/boot.lua @@ -6,8 +6,8 @@ local version, build, date, tocversion = GetBuildInfo() - _detalhes.build_counter = 9777 - _detalhes.alpha_build_counter = 9777 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 9778 + _detalhes.alpha_build_counter = 9778 --if this is higher than the regular counter, use it instead _detalhes.bcc_counter = 32 _detalhes.dont_open_news = true _detalhes.game_version = version @@ -33,12 +33,13 @@ do local Loc = _G.LibStub("AceLocale-3.0"):GetLocale( "Details" ) local news = { - {"v9.2.0.9777.146", "April 22th, 2022"}, + {"v9.2.0.9778.146", "April 23th, 2022"}, "A cooldown tracker experiment has been added, its options is visible at the Options Panel.", "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.", + "Attempt to fix 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.", diff --git a/frames/window_main.lua b/frames/window_main.lua index b1d7aa6e..853b74f4 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -5218,10 +5218,9 @@ function _detalhes:InstanceColor (red, green, blue, alpha, no_save, change_statu local skin = _detalhes.skins [self.skin] if (not skin) then --the skin isn't available any more - Details:Msg ("Skin " .. (self.skin or "?") .. " not found, changing to 'Dark Theme'.") - Details:Msg ("Recommended to change the skin in the option panel > Skin Selection.") - skin = _detalhes.skins ["Minimalistic"] - self.skin = "Minimalistic" + --put the skin into wait to install + local tempSkin = self:WaitForSkin() + skin = tempSkin end self.baseframe.cabecalho.ball_r:SetVertexColor (red, green, blue) @@ -6870,18 +6869,26 @@ function _detalhes:RefreshMicroDisplays() _detalhes.StatusBar:UpdateOptions (self) end -function _detalhes:ChangeSkin (skin_name) +function Details:WaitForSkin() + Details.waitingForSkins = Details.waitingForSkins or {} + Details.waitingForSkins[self:GetId()] = self.skin + + local defaultSkin = _detalhes.default_skin_to_use + skin = _detalhes.skins[defaultSkin] + self.skin = defaultSkin + return skin +end + +function Details:ChangeSkin(skin_name) if (not skin_name) then skin_name = self.skin end local this_skin = _detalhes.skins [skin_name] - if (not this_skin) then - Details:Msg("error 0x4546", skin_name) - skin_name = _detalhes.default_skin_to_use - this_skin = _detalhes.skins [skin_name] + local tempSkin = Details:WaitForSkin() + this_skin = tempSkin end local just_updating = false diff --git a/functions/skins.lua b/functions/skins.lua index f88ce94d..b81e5f0b 100644 --- a/functions/skins.lua +++ b/functions/skins.lua @@ -21,6 +21,20 @@ local _ skin_table.desc = skin_table.desc or "" _detalhes.skins [skin_name] = skin_table + + --checck instances waiting for a skin + local waitingForSkins = Details.waitingForSkins + if (waitingForSkins) then + for instanceId, skinName in pairs(waitingForSkins) do + if (skinName == skin_name) then + local instance = Details:GetInstance(instanceId) + if (instance) then + instance:ChangeSkin(skin_name) + end + end + end + end + return true end