From 6de6be1617c568bcde7abfae6a0009a9bcc91be1 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 17 Aug 2024 17:59:01 -0300 Subject: [PATCH] Fixed an issue with player names cache getting 'Unknown' from UnitName() --- Details.toc | 1 + Details_Cata.toc | 1 + Details_Classic.toc | 1 + Details_Wrath.toc | 1 + boot.lua | 4 ++-- core/parser.lua | 19 ++++++++++++++++--- frames/window_pro_file.lua | 6 ++++++ startup.lua | 3 +-- 8 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 frames/window_pro_file.lua diff --git a/Details.toc b/Details.toc index 4d865bd38..9506a81a5 100644 --- a/Details.toc +++ b/Details.toc @@ -129,6 +129,7 @@ frames\window_classcolor.lua frames\window_statistics.lua frames\window_aura_tracker.lua frames\window_debug.lua +frames\window_pro_file.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Cata.toc b/Details_Cata.toc index a41a2bbe7..5b07b185e 100644 --- a/Details_Cata.toc +++ b/Details_Cata.toc @@ -128,6 +128,7 @@ frames\window_classcolor.lua frames\window_statistics.lua frames\window_aura_tracker.lua frames\window_debug.lua +frames\window_pro_file.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Classic.toc b/Details_Classic.toc index 5298605ff..c627ef0fc 100644 --- a/Details_Classic.toc +++ b/Details_Classic.toc @@ -122,6 +122,7 @@ frames\window_bookmark.lua frames\window_classcolor.lua frames\window_statistics.lua frames\window_debug.lua +frames\window_pro_file.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Wrath.toc b/Details_Wrath.toc index 7baa00ee7..767c4cf92 100644 --- a/Details_Wrath.toc +++ b/Details_Wrath.toc @@ -122,6 +122,7 @@ frames\window_bookmark.lua frames\window_classcolor.lua frames\window_statistics.lua frames\window_debug.lua +frames\window_pro_file.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/boot.lua b/boot.lua index 20c924eec..60d12c148 100644 --- a/boot.lua +++ b/boot.lua @@ -19,8 +19,8 @@ local addonName, Details222 = ... local version, build, date, tvs = GetBuildInfo() - Details.build_counter = 12869 - Details.alpha_build_counter = 12869 --if this is higher than the regular counter, use it instead + Details.build_counter = 12877 + Details.alpha_build_counter = 12877 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter diff --git a/core/parser.lua b/core/parser.lua index c4e6cfbb2..4c4cb7b69 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -945,7 +945,7 @@ end end - local spellInfo = C_Spell.GetSpellInfo(spellId) + --local spellInfo = C_Spell.GetSpellInfo(spellId) Details222.StartCombat(sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags) else --entrar em combate se for dot e for do jogador e o ultimo combate ter sido a mais de 10 segundos atr�s @@ -6202,6 +6202,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end local update_persistant_unitname_cache = function() + Details.UpdatePersistantCacheTimer = nil + local unitIdCache if (IsInRaid()) then @@ -6230,7 +6232,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function Details.parser_functions:GROUP_ROSTER_UPDATE(...) local bIsInGroup = IsInGroup() or IsInRaid() - update_persistant_unitname_cache() + if (not Details.UpdatePersistantCacheTimer) then + Details.UpdatePersistantCacheTimer = C_Timer.NewTimer(2, update_persistant_unitname_cache) + end if (not Details.in_group) then Details.in_group = bIsInGroup @@ -6441,8 +6445,17 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end - function Details.parser_functions:UNIT_NAME_UPDATE(...) + function Details.parser_functions:UNIT_NAME_UPDATE(unitId) Details:SchedulePetUpdate(5) + local unitGUID = UnitGUID(unitId) + if (unitGUID) then + if (unitGUID:match("^Pl")) then + local unitFullName = Details:GetFullName(unitId) + if (unitFullName) then + group_roster_name_cache[unitGUID] = unitFullName + end + end + end end function Details.parser_functions:PLAYER_TARGET_CHANGED(...) diff --git a/frames/window_pro_file.lua b/frames/window_pro_file.lua new file mode 100644 index 000000000..c0d024f89 --- /dev/null +++ b/frames/window_pro_file.lua @@ -0,0 +1,6 @@ + +local Details = Details +local addonName, Details222 = ... +---@type detailsframework +local detailsFramework = DetailsFramework +local _ diff --git a/startup.lua b/startup.lua index 172b241f2..0fa1aa790 100644 --- a/startup.lua +++ b/startup.lua @@ -668,8 +668,7 @@ function Details222.StartUp.StartMeUp() tooltipBackgroundColor[4] = 0.8 Details.tooltip.fontshadow = true - - + Details.tooltip.fontsize = 11 end end