Skip to content

Commit

Permalink
Added new option "Show items level and spec when Shift is pushed" ena…
Browse files Browse the repository at this point in the history
…bled by default.
  • Loading branch information
Wetxius committed Aug 3, 2020
1 parent 121c088 commit 8e03076
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 36 deletions.
3 changes: 2 additions & 1 deletion ShestakUI/Config/Settings.lua
Expand Up @@ -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)
Expand Down
51 changes: 26 additions & 25 deletions ShestakUI/Modules/Tooltip/ItemLevel.lua
Expand Up @@ -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
Expand Down Expand Up @@ -375,23 +375,23 @@ 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

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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 14 additions & 8 deletions ShestakUI/Modules/Tooltip/Talents.lua
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/Chinese.lua
Expand Up @@ -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 = "头衔"
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/English.lua
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/French.lua
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/German.lua
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/Italian.lua
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/Russian.lua
Expand Up @@ -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 = "Звание игрока"
Expand Down
2 changes: 2 additions & 0 deletions ShestakUI_Config/Locales/Spanish.lua
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions ShestakUI_Config/Options.lua
Expand Up @@ -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")
Expand All @@ -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)
Expand Down

0 comments on commit 8e03076

Please sign in to comment.