From 8e03076a409ad37a042c8c0d4bd08abc6aaa1710 Mon Sep 17 00:00:00 2001 From: Wetxius Date: Mon, 3 Aug 2020 19:10:59 +0300 Subject: [PATCH] Added new option "Show items level and spec when Shift is pushed" enabled by default. --- ShestakUI/Config/Settings.lua | 3 +- ShestakUI/Modules/Tooltip/ItemLevel.lua | 51 +++++++++++++------------ ShestakUI/Modules/Tooltip/Talents.lua | 22 +++++++---- ShestakUI_Config/Locales/Chinese.lua | 2 + ShestakUI_Config/Locales/English.lua | 2 + ShestakUI_Config/Locales/French.lua | 2 + ShestakUI_Config/Locales/German.lua | 2 + ShestakUI_Config/Locales/Italian.lua | 2 + ShestakUI_Config/Locales/Russian.lua | 2 + ShestakUI_Config/Locales/Spanish.lua | 2 + ShestakUI_Config/Options.lua | 7 +++- 11 files changed, 61 insertions(+), 36 deletions(-) diff --git a/ShestakUI/Config/Settings.lua b/ShestakUI/Config/Settings.lua index 93c7c22694..f62fe59d4e 100644 --- a/ShestakUI/Config/Settings.lua +++ b/ShestakUI/Config/Settings.lua @@ -272,8 +272,9 @@ C["tooltip"] = { ["realm"] = true, -- Player realm name in tooltip ["rank"] = true, -- Player guild-rank in tooltip ["target"] = true, -- Target player in tooltip - ["talents"] = false, -- Show tooltip talents + ["talents"] = false, -- Show specialization ["average_lvl"] = false, -- Average items level + ["show_shift"] = true, -- Show items level and spec when Shift is pushed ["raid_icon"] = false, -- Raid icon ["unit_role"] = false, -- Unit role in tooltip ["who_targetting"] = false, -- Show who is targetting the unit (in raid or party) diff --git a/ShestakUI/Modules/Tooltip/ItemLevel.lua b/ShestakUI/Modules/Tooltip/ItemLevel.lua index 00afea1931..3f9a6445cd 100644 --- a/ShestakUI/Modules/Tooltip/ItemLevel.lua +++ b/ShestakUI/Modules/Tooltip/ItemLevel.lua @@ -275,12 +275,12 @@ for _, slot in pairs(InventorySlots) do GuidCache[guid].neckLevel = SlotCache[2] GuidCache[guid].timestamp = GetTime() - wipe(GuidCache[guid].legos) - for _, link in pairs(ItemCache) do - if IsLegendary(link) then - tinsert(GuidCache[guid].legos, link) - end - end + -- wipe(GuidCache[guid].legos) + -- for _, link in pairs(ItemCache) do + -- if IsLegendary(link) then + -- tinsert(GuidCache[guid].legos, link) + -- end + -- end E("ItemScanComplete", guid, GuidCache[guid]) end @@ -375,15 +375,15 @@ local function DecorateTooltip(guid, isInspect) levelText = format("|cff%2x%2x%2x%.1f|r", r1 * 255, g1 * 255, b1 * 255, averageItemLevel, r2 * 255, g2 * 255, b2 * 255) end - if isInspect then + if isInspect and averageItemLevel > 0 then InspectFrameiLvL:SetText(levelText) end AddLine(Sekret, STAT_AVERAGE_ITEM_LEVEL..": ", levelText, "|cffF9D700", "|cffffffff") - for i, lego in ipairs(cache.legos) do - AddLine("|Hlego" .. i .. "|h", lego, " ", "|cffffffff", "|cffffffff") - end + -- for i, lego in ipairs(cache.legos) do + -- AddLine("|Hlego" .. i .. "|h", lego, " ", "|cffffffff", "|cffffffff") + -- end end end @@ -391,7 +391,7 @@ local function ScanUnit(unitID) ScannedGUID = UnitGUID(unitID) wipe(SlotCache) wipe(ItemCache) - wipe(GuidCache[ScannedGUID].legos) + -- wipe(GuidCache[ScannedGUID].legos) local numEquipped = 0 for _, slot in pairs(InventorySlots) do if GetInventoryItemTexture(unitID, slot) then @@ -420,24 +420,24 @@ function E:INSPECT_READY(guid) ActiveGUID = nil local unitID = GetUnitIDFromGUID(guid) if unitID then - local _, class = UnitClass(unitID) - local colors = class and RAID_CLASS_COLORS[class] - local specID = GetInspectSpecialization(unitID) - local specName - if not specName and specID and specID ~= 0 then - specID, specName = GetSpecializationInfoByID(specID, UnitSex(unitID)) - if colors then - specName = "|c" .. colors.colorStr .. specName .. "|r" - end - end + -- local _, class = UnitClass(unitID) + -- local colors = class and RAID_CLASS_COLORS[class] + -- local specID = GetInspectSpecialization(unitID) + -- local specName + -- if not specName and specID and specID ~= 0 then + -- specID, specName = GetSpecializationInfoByID(specID, UnitSex(unitID)) + -- if colors then + -- specName = "|c" .. colors.colorStr .. specName .. "|r" + -- end + -- end if not GuidCache[guid] then GuidCache[guid] = {ilevel = 0, weaponLevel = 0, timestamp = 0, legos = {}} end - local cache = GuidCache[guid] - cache.specID = specID - cache.class = class - cache.specName = specName + -- local cache = GuidCache[guid] + -- cache.specID = specID + -- cache.class = class + -- cache.specName = specName ScanUnit(unitID) end @@ -469,6 +469,7 @@ function E:ItemScanComplete(guid) end GameTooltip:HookScript("OnTooltipSetUnit", function(self) + if C.tooltip.show_shift and not IsShiftKeyDown() then return end local _, unitID = self:GetUnit() local guid = unitID and UnitGUID(unitID) if guid and UnitIsPlayer(unitID) then diff --git a/ShestakUI/Modules/Tooltip/Talents.lua b/ShestakUI/Modules/Tooltip/Talents.lua index 0c571aba8a..84b7c41ba0 100644 --- a/ShestakUI/Modules/Tooltip/Talents.lua +++ b/ShestakUI/Modules/Tooltip/Talents.lua @@ -8,7 +8,7 @@ if C.tooltip.enable ~= true or C.tooltip.talents ~= true then return end local TALENTS_PREFIX = SPECIALIZATION..":|cffffffff " local CACHE_SIZE = 25 local INSPECT_DELAY = 0.2 -local INSPECT_FREQ = 2 +local INSPECT_FREQ = 1.5 -- Variables local ttt = CreateFrame("Frame", "TipTacTalents") @@ -85,12 +85,9 @@ ttt:SetScript("OnUpdate", function(self, elapsed) self:Hide() -- Make sure the mouseover unit is still our unit if UnitGUID("mouseover") == current.guid then + if (InspectFrame and InspectFrame:IsVisible()) then return end lastInspectRequest = GetTime() self:RegisterEvent("INSPECT_READY") - -- Az: Fix the blizzard inspect copypasta code (Blizzard_InspectUI\InspectPaperDollFrame.lua @ line 23) - if InspectFrame then - InspectFrame.unit = "player" - end NotifyInspect(current.unit) end end @@ -100,6 +97,9 @@ end) GameTooltip:HookScript("OnTooltipSetUnit", function(self) -- Abort any delayed inspect in progress ttt:Hide() + + if C.tooltip.show_shift and not IsShiftKeyDown() then return end + -- Get the unit -- Check the UnitFrame unit if this tip is from a concated unit, such as "targettarget". local _, unit = self:GetUnit() if not unit then @@ -108,10 +108,12 @@ GameTooltip:HookScript("OnTooltipSetUnit", function(self) unit = mFocus.unit end end + -- No Unit or not a Player if not unit or not UnitIsPlayer(unit) then return end + -- Only bother for players over level 9 local level = UnitLevel(unit) if level > 9 or level == -1 then @@ -138,9 +140,13 @@ GameTooltip:HookScript("OnTooltipSetUnit", function(self) end -- Queue an inspect request if CanInspect(unit) and not isInspectOpen then - local lastInspectTime = GetTime() - lastInspectRequest - ttt.nextUpdate = (lastInspectTime > INSPECT_FREQ) and INSPECT_DELAY or (INSPECT_FREQ - lastInspectTime + INSPECT_DELAY) - ttt:Show() + if C.tooltip.average_lvl then + ttt:RegisterEvent("INSPECT_READY") + else + local lastInspectTime = GetTime() - lastInspectRequest + ttt.nextUpdate = (lastInspectTime > INSPECT_FREQ) and INSPECT_DELAY or (INSPECT_FREQ - lastInspectTime + INSPECT_DELAY) + ttt:Show() + end if not cacheLoaded then self:AddLine(TALENTS_PREFIX..L_TOOLTIP_LOADING) end diff --git a/ShestakUI_Config/Locales/Chinese.lua b/ShestakUI_Config/Locales/Chinese.lua index 5b3cc37113..e0f1c2036d 100644 --- a/ShestakUI_Config/Locales/Chinese.lua +++ b/ShestakUI_Config/Locales/Chinese.lua @@ -231,6 +231,8 @@ L.tooltip_hidebuttons = "隐藏动作条提示" L.tooltip_hide_combat = "战斗中隐藏提示" L.tooltip_subheader = "辅助功能" L.tooltip_talents = "天赋" +L.tooltip_show_shift = "Show when Shift is pushed" -- Need review +L.tooltip_show_shift_desc = "Show items level and spec when Shift is pushed" -- Need review L.tooltip_achievements = "成就比较" L.tooltip_target = "目标的目标" L.tooltip_title = "头衔" diff --git a/ShestakUI_Config/Locales/English.lua b/ShestakUI_Config/Locales/English.lua index 5dd0152446..7d93cecc30 100644 --- a/ShestakUI_Config/Locales/English.lua +++ b/ShestakUI_Config/Locales/English.lua @@ -254,6 +254,8 @@ L.tooltip_hidebuttons = "Hide tooltips for actions bars" L.tooltip_hide_combat = "Hide tooltip in combat" L.tooltip_subheader = "Plugins" L.tooltip_talents = "Show tooltip talents" +L.tooltip_show_shift = "Show when Shift is pushed" +L.tooltip_show_shift_desc = "Show items level and spec when Shift is pushed" L.tooltip_achievements = "Comparing achievements in tooltip" L.tooltip_target = "Target player in tooltip" L.tooltip_title = "Player title in tooltip" diff --git a/ShestakUI_Config/Locales/French.lua b/ShestakUI_Config/Locales/French.lua index c32b560e9b..83a77b434d 100644 --- a/ShestakUI_Config/Locales/French.lua +++ b/ShestakUI_Config/Locales/French.lua @@ -231,6 +231,8 @@ L.tooltip_hidebuttons = "Cacher le tooltip pour les barres d'action" L.tooltip_hide_combat = "Cacher les tooltips en combat" L.tooltip_subheader = "Plugins" -- Need review L.tooltip_talents = "Afficher les talents" +L.tooltip_show_shift = "Show when Shift is pushed" -- Need review +L.tooltip_show_shift_desc = "Show items level and spec when Shift is pushed" -- Need review L.tooltip_achievements = "Afficher Comparer les Hauts Faits" L.tooltip_target = "Afficher la cible" L.tooltip_title = "Afficher les titres" diff --git a/ShestakUI_Config/Locales/German.lua b/ShestakUI_Config/Locales/German.lua index a75efc2f94..4d20e5703b 100644 --- a/ShestakUI_Config/Locales/German.lua +++ b/ShestakUI_Config/Locales/German.lua @@ -231,6 +231,8 @@ L.tooltip_hidebuttons = "Tooltips für Aktionsleisten verstecken" L.tooltip_hide_combat = "Verstecke Tooltip im Kampf" L.tooltip_subheader = "Plugins" L.tooltip_talents = "Zeige die Talente im Tooltip an" +L.tooltip_show_shift = "Show when Shift is pushed" -- Need review +L.tooltip_show_shift_desc = "Show items level and spec when Shift is pushed" -- Need review L.tooltip_achievements = "Verlgeichen von Erfolgen in Tooltips" L.tooltip_target = "Ziel des Spielers im Tooltip anzeigen" L.tooltip_title = "Spieler Title im Tooltip" diff --git a/ShestakUI_Config/Locales/Italian.lua b/ShestakUI_Config/Locales/Italian.lua index b9982800f4..9be0c827c6 100644 --- a/ShestakUI_Config/Locales/Italian.lua +++ b/ShestakUI_Config/Locales/Italian.lua @@ -231,6 +231,8 @@ L.tooltip_hidebuttons = "Nascondi i suggerimenti relativi alle barre delle azion L.tooltip_hide_combat = "Nascondi i suggerimenti in combattimento" L.tooltip_subheader = "Plugins" -- Need review L.tooltip_talents = "Mostra i talenti nei suggerimenti" +L.tooltip_show_shift = "Show when Shift is pushed" -- Need review +L.tooltip_show_shift_desc = "Show items level and spec when Shift is pushed" -- Need review L.tooltip_achievements = "Mostra il paragone delle imprese nei suggerimenti" L.tooltip_target = "Mostra nei suggerimenti chi ha il giocatore come bersaglio" L.tooltip_title = "Titolo del giocatore nei suggerimenti" diff --git a/ShestakUI_Config/Locales/Russian.lua b/ShestakUI_Config/Locales/Russian.lua index ffa3ec2025..b6e652c114 100644 --- a/ShestakUI_Config/Locales/Russian.lua +++ b/ShestakUI_Config/Locales/Russian.lua @@ -231,6 +231,8 @@ L.tooltip_hidebuttons = "Прятать подсказку для кнопок L.tooltip_hide_combat = "Прятать подсказку в бою" L.tooltip_subheader = "Плагины" L.tooltip_talents = "Специализация цели в подсказке" +L.tooltip_show_shift = "Только при зажатой кнопке Shift" +L.tooltip_show_shift_desc = "Специализация и уровень предметов отображаются, если зажата кнопка Shift" L.tooltip_achievements = "Сравнивать достижения в чате с вашими" L.tooltip_target = "Цель цели в подсказке" L.tooltip_title = "Звание игрока" diff --git a/ShestakUI_Config/Locales/Spanish.lua b/ShestakUI_Config/Locales/Spanish.lua index 925fddc454..eded9e4e4c 100644 --- a/ShestakUI_Config/Locales/Spanish.lua +++ b/ShestakUI_Config/Locales/Spanish.lua @@ -231,6 +231,8 @@ L.tooltip_hidebuttons = "Ocultar descripciones de las barras de acción" L.tooltip_hide_combat = "Ocultar descripción en combate" L.tooltip_subheader = "Plugins" -- Need review L.tooltip_talents = "Mostrar descripción de los talentos" +L.tooltip_show_shift = "Show when Shift is pushed" -- Need review +L.tooltip_show_shift_desc = "Show items level and spec when Shift is pushed" -- Need review L.tooltip_achievements = "Comparar logros en la descripción" L.tooltip_target = "Jugador objetivo en la descripción" L.tooltip_title = "Player title in tooltip" -- Need review diff --git a/ShestakUI_Config/Options.lua b/ShestakUI_Config/Options.lua index fd85744cab..6c8c5ae9bb 100644 --- a/ShestakUI_Config/Options.lua +++ b/ShestakUI_Config/Options.lua @@ -1091,7 +1091,7 @@ do hide_combat:SetPoint("TOPLEFT", hidebuttons, "BOTTOMLEFT", 0, 0) -- Plugins - local subheader = ns.addSubCategory(parent) + local subheader = ns.addSubCategory(parent, L_GUI_UF_SUBHEADER_PLUGINS) subheader:SetPoint("TOPLEFT", hide_combat, "BOTTOMLEFT", 0, -16) local title = ns.CreateCheckBox(parent, "title") @@ -1112,8 +1112,11 @@ do local average_lvl = ns.CreateCheckBox(parent, "average_lvl", STAT_AVERAGE_ITEM_LEVEL) average_lvl:SetPoint("LEFT", talents, "RIGHT", 320, 0) + local show_shift = ns.CreateCheckBox(parent, "show_shift") + show_shift:SetPoint("TOPLEFT", talents, "BOTTOMLEFT", 20, 0) + local raid_icon = ns.CreateCheckBox(parent, "raid_icon") - raid_icon:SetPoint("TOPLEFT", talents, "BOTTOMLEFT", 0, 0) + raid_icon:SetPoint("TOPLEFT", shift_lvl, "BOTTOMLEFT", -20, 0) local unit_role = ns.CreateCheckBox(parent, "unit_role") unit_role:SetPoint("LEFT", raid_icon, "RIGHT", 320, 0)