From 6c48895b426139be1d12d53964bb3ebc4b51ad7e Mon Sep 17 00:00:00 2001 From: Darthpred Date: Thu, 17 Oct 2013 05:13:43 +0400 Subject: [PATCH] New option for faction icons on tooltip --- ElvUI_SLE/config/profile.lua | 3 +++ ElvUI_SLE/locales/english.lua | 9 +++++++++ ElvUI_SLE/locales/russian.lua | 9 +++++++++ ElvUI_SLE/modules/tooltip/options.lua | 18 +++++++++++++----- ElvUI_SLE/modules/tooltip/tooltip.lua | 16 ++++++++++++++++ 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua index 328e9be..e0a8f02 100755 --- a/ElvUI_SLE/config/profile.lua +++ b/ElvUI_SLE/config/profile.lua @@ -239,6 +239,9 @@ P['sle'] = { ['chat'] = "RAID", ['auto'] = true, }, + + --Tooltip Faction Icon + ["tooltipicon"] = false, } P.chat.editboxhistory = 5 diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua index 57071fb..749fc29 100755 --- a/ElvUI_SLE/locales/english.lua +++ b/ElvUI_SLE/locales/english.lua @@ -274,6 +274,15 @@ L["Flying"] = true L["Flying & Ground"] = true L["Swimming"] = true +--Tooltip-- +L["Tooltip enhancements"] = true +L["Faction Icon"] = true +L["Show faction icon to the left of player's name on tooltip."] = true +L["Tooltip X-offset"] = true +L["Offset the tooltip on the X-axis."] = true +L["Tooltip Y-offset"] = true +L["Offset the tooltip on the Y-axis."] = true + --UI buttons-- L["UI Buttons"] = true L["Additional menu with useful buttons"] = true diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua index a47fb29..edf3132 100755 --- a/ElvUI_SLE/locales/russian.lua +++ b/ElvUI_SLE/locales/russian.lua @@ -280,6 +280,15 @@ L["Flying"] = "Летающие" L["Flying & Ground"] = "Наземные и Летающие" L["Swimming"] = "Водные" +--Tooltip-- +L["Tooltip enhancements"] = "Дополнительные опции подсказки" +L["Faction Icon"] = "Иконка фракции" +L["Show faction icon to the left of player's name on tooltip."] = "Отображать иконку фракции около имени игроков в подсказках" +L["Tooltip X-offset"] = "Смещение подсказки по X" +L["Offset the tooltip on the X-axis."] = "Смещает подсказку по оси X относительно выбранной точки крепления." +L["Tooltip Y-offset"] = "Смещение подсказки по Y" +L["Offset the tooltip on the Y-axis."] = "Смещает подсказку по оси Y относительно выбранной точки крепления." + --UI buttons-- L["UI Buttons"] = "Меню интерфейса" L["Additional menu with useful buttons"] = "Дополнительное меню с полезными кнопками" diff --git a/ElvUI_SLE/modules/tooltip/options.lua b/ElvUI_SLE/modules/tooltip/options.lua index d6bc196..9f6b1e6 100644 --- a/ElvUI_SLE/modules/tooltip/options.lua +++ b/ElvUI_SLE/modules/tooltip/options.lua @@ -16,7 +16,15 @@ local function configTable() intro = { order = 2, type = 'description', - name = "Tooltip description", + name = L["Tooltip enhancements"], + }, + tooltipicon = { + order = 3, + type = 'toggle', + name = L["Faction Icon"], + desc = L["Show faction icon to the left of player's name on tooltip."], + get = function(info) return E.db.sle.tooltipicon end, + set = function(info, value) E.db.sle.tooltipicon = value end, }, offset = { type = "group", @@ -28,16 +36,16 @@ local function configTable() mouseOffsetX = { order = 31, type = 'range', - name = 'Tooltip X-offset', - desc = 'Offset the tooltip on the X-axis.', + name = L["Tooltip X-offset"], + desc = L["Offset the tooltip on the X-axis."], min = -200, max = 200, step = 1, set = function(info, value) E.db.tooltip[ info[#info] ] = value end, }, mouseOffsetY = { order = 32, type = 'range', - name = 'Tooltip Y-offset', - desc = 'Offset the tooltip on the Y-axis.', + name = L["Tooltip Y-offset"], + desc = L["Offset the tooltip on the Y-axis."], min = -200, max = 200, step = 1, set = function(info, value) E.db.tooltip[ info[#info] ] = value end, }, diff --git a/ElvUI_SLE/modules/tooltip/tooltip.lua b/ElvUI_SLE/modules/tooltip/tooltip.lua index 25ab6a8..e816e63 100644 --- a/ElvUI_SLE/modules/tooltip/tooltip.lua +++ b/ElvUI_SLE/modules/tooltip/tooltip.lua @@ -6,6 +6,8 @@ P['tooltip']['mouseOffsetX'] = 0 P['tooltip']['mouseOffsetY'] = 0 P['tooltip']['overrideCombat'] = false +local iconPath = [[Interface\AddOns\ElvUI_SLE\media\textures\]] + TT.GameTooltip_SetDefaultAnchorSLE = TT.GameTooltip_SetDefaultAnchor function TT:GameTooltip_SetDefaultAnchor(tt, parent) TT:GameTooltip_SetDefaultAnchorSLE(tt, parent) @@ -34,6 +36,20 @@ function TT:AnchorFrameToMouse(frame) frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", (x/scale + (E.db.tooltip.mouseOffsetX - tipWidth/2)), (y/scale + E.db.tooltip.mouseOffsetY)); end + + +TT.GameTooltip_OnTooltipSetUnitSLE = TT.GameTooltip_OnTooltipSetUnit +function TT:GameTooltip_OnTooltipSetUnit(tt) + TT:GameTooltip_OnTooltipSetUnitSLE(tt) + if not E.db.sle.tooltipicon then return end + local unit = select(2, tt:GetUnit()) + if(UnitIsPlayer(unit)) then + local text = GameTooltipTextLeft1:GetText() + local faction = UnitFactionGroup(unit) + GameTooltipTextLeft1:SetText("|T"..iconPath..faction..".blp:15:15:0:0:64:64:2:56:2:56|t "..text) + end +end + function TT:AddonName_OnUpdate(self, elapsed) TT:AnchorFrameToMouse(self); end -- 1.7.9.5