Permalink
Browse files

Some changes not much.

  • Loading branch information...
Jasje committed Feb 1, 2012
1 parent 7ec4867 commit 6b7b65ada670ce55a5b17cfa566c62cd562f9be9
Showing with 126 additions and 47 deletions.
  1. +0 −1 JasjeUI/modules/chat/chat.lua
  2. +3 −16 JasjeUI/modules/misc/extra.lua
  3. +123 −30 JasjeUI/modules/tooltip/tooltip.lua
@@ -1,6 +1,5 @@
local T, C, L = unpack(Tukui)
-
local function chatsetup()
-- setting chat frames if using Tukui chats.
FCF_ResetChatWindows()
@@ -66,9 +66,9 @@ function DisbandRaidGroup()
end
StaticPopupDialogs.DISBAND_RAID = {
- text = hexa.."Jasje is Disbanding your Raid/Party"..hexb,
- button1 = hexa.."Accept"..hexb,
- button2 = hexa.."Cancel"..hexb,
+ text = "|cffD38D01Jasje is Disbanding your Raid/Party",
+ button1 = "|cffD38D01Accept",
+ button2 = "|cffD38D01Cancel",
OnAccept = DisbandRaidGroup,
timeout = 0,
whileDead = 1,
@@ -80,19 +80,6 @@ SlashCmdList.GROUPDISBAND = function()
StaticPopup_Show("DISBAND_RAID")
end
SLASH_GROUPDISBAND1 = "/rd"
-
--- Profanity
-local p = CreateFrame("FRAME")
-p:RegisterEvent("ADDON_LOADED")
-p:SetScript("OnEvent", function(self, event, addon)
- if BNGetMatureLanguageFilter() == true then
- BNSetMatureLanguageFilter(false)
- end
-end)
-
--- kill the option
-InterfaceOptionsSocialPanelProfanityFilter:Kill()
-
-------------------------------------------------------------------------------------
-- Credit Alleykat
-- Entering combat and allertrun function (can be used in anther ways)
@@ -1,8 +1,35 @@
local T, C, L = unpack(Tukui)
+if not C["tooltip"].enable then return end
local hexa = T.StatColor
local hexb = T.StatColorEnd
+----------------------------------------------------------------------------------------
+-- Displays a players LFD/LFR role(gTooltipRoles by g0st)
+----------------------------------------------------------------------------------------
+local function GetLFDRole(unit)
+ local role = UnitGroupRolesAssigned(unit)
+
+ if role == "NONE" then
+ return "|cFFB5B5B5"..NO_ROLE.."|r"
+ elseif role == "TANK" then
+ return "|cFFE06D1B"..TANK.."|r"
+ elseif role == "HEALER" then
+ return "|cFF1B70E0"..HEALER.."|r"
+ else
+ return "|cFFE01B35"..DAMAGER.."|r"
+ end
+end
+
+GameTooltip:HookScript("OnTooltipSetUnit", function(self, ...)
+ if (IsModifierKeyDown()) then
+ local name, unit = GameTooltip:GetUnit()
+ if unit and UnitIsPlayer(unit) and (UnitInParty(unit) or UnitInRaid(unit)) then
+ GameTooltip:AddLine(hexa..ROLE..": "..hexb..GetLFDRole(unit))
+ end
+ end
+end)
+
-- GuildNote and PvpTitle
local Blah = function()
local unit = "mouseover"
@@ -66,36 +93,102 @@ GameTooltip:HookScript("OnTooltipSetSpell", function(self)
end
end)
--- ilvl on tooltip by Gsuz
-local SlotName = {
- "Head","Neck","Shoulder","Back","Chest","Wrist",
- "Hands","Waist","Legs","Feet","Finger0","Finger1",
- "Trinket0","Trinket1","MainHand","SecondaryHand","Ranged","Ammo"
- }
-local function GetItemLVL(unit)
-local total, item = 0, 0;
- for i in pairs(SlotName) do
- local slot = GetInventoryItemLink(unit, GetInventorySlotInfo(SlotName[i] .. "Slot"));
- if (slot ~= nil) then
- item = item + 1;
- total = total + select(4, GetItemInfo(slot))
- end
- end
- if (item > 0) then
- return floor(total / item);
- end
- return 0;
+----------------------------------------------------------------------------------------
+-- Average item level(AiL by havoc74)
+----------------------------------------------------------------------------------------
+local MINCOLOR, COLORINC, INCMOD, MinIL, MaxIL = 0.5, 0.2, 0.5, 288, 397
+
+local slotName = {
+ "HeadSlot", "NeckSlot", "ShoulderSlot", "BackSlot", "ChestSlot", "WristSlot",
+ "HandsSlot", "WaistSlot", "LegsSlot", "FeetSlot", "Finger0Slot", "Finger1Slot",
+ "Trinket0Slot", "Trinket1Slot", "MainHandSlot", "SecondaryHandSlot", "RangedSlot", "AmmoSlot"
+}
+
+local function GetAiL(unit)
+ local i, total, slot, itn, level = 0, 0, nil, 0
+
+ for i in pairs(slotName) do
+ slot = GetInventoryItemLink(unit, GetInventorySlotInfo(slotName[i]))
+ if slot ~= nil then
+ itn = itn + 1
+ level = select(4, GetItemInfo(slot))
+ total = total + level
+ end
+ end
+
+ if total < 1 or itn < 1 then return 0 end
+
+ return floor(total / itn)
end
+
+local function GetAiLColor(ail)
+ local r, gb
+
+ if ail < MinIL then
+ r = (ail / MinIL)
+ gb = r
+ else
+ r = MINCOLOR + ((ail / MaxIL) * INCMOD)
+ gb = 1 - ((ail / MaxIL) * INCMOD)
+ end
+
+ if r < MINCOLOR then
+ r = MINCOLOR
+ gb = r
+ end
+
+ return r, gb
+end
+
GameTooltip:HookScript("OnTooltipSetUnit", function(self, ...)
- if (IsModifierKeyDown()) then
- local _, unit = GameTooltip:GetUnit();
- if (unit and CanInspect(unit)) then
- if (not ((InspectFrame and InspectFrame:IsShown()) or (Examiner and Examiner:IsShown()))) then
- NotifyInspect(unit);
- GameTooltip:AddLine(hexa.."Item Level: "..hexb.. GetItemLVL(unit));
- ClearInspectPlayer(unit);
- GameTooltip:Show();
- end
- end
+ local ail, r, gb, d
+ local _, unit = GameTooltip:GetUnit()
+
+ if unit and CanInspect(unit) then
+ local isInspectOpen = (InspectFrame and InspectFrame:IsShown()) or (Examiner and Examiner:IsShown())
+ if unit and CanInspect(unit) and not isInspectOpen then
+ NotifyInspect(unit)
+ ail = GetAiL(unit)
+ d = GetAiL(unit) - GetAiL("player")
+ r, gb = GetAiLColor(ail)
+ ClearInspectPlayer(unit)
+ if unit == "player" then
+ GameTooltip:AddLine(format("|cfffed100"..STAT_AVERAGE_ITEM_LEVEL..":|r "..ail), r, gb, gb)
+ else
+ GameTooltip:AddLine(format("|cfffed100"..STAT_AVERAGE_ITEM_LEVEL..":|r "..ail).." ("..((d > 0) and "|cff00ff00+" or "|cffff0000")..d.."|r)", r, gb, gb)
+ end
+ GameTooltip:Show()
+ end
end
-end)
+end)
+
+-- TooltipIcon
+local function AddTooltipIcon(self, icon)
+ if icon then
+ local title = _G[self:GetName() .. "TextLeft1"]
+ if title and not title:GetText():find("|T" .. icon) then
+ title:SetFormattedText("|T%s:20:20:0:0:64:64:5:59:5:59:%d|t %s", icon, 18, title:GetText())
+ end
+ end
+end
+
+local function hookItem(tip)
+ tip:HookScript("OnTooltipSetItem", function(self, ...)
+ local name, link = self:GetItem()
+ local icon = link and GetItemIcon(link)
+ AddTooltipIcon(self, icon)
+ end)
+end
+hookItem(_G["GameTooltip"])
+hookItem(_G["ItemRefTooltip"])
+
+local function hookSpell(tip)
+ tip:HookScript("OnTooltipSetSpell", function(self, ...)
+ if self:GetSpell() then
+ local name, rank, icon = GetSpellInfo(self:GetSpell())
+ AddTooltipIcon(self, icon)
+ end
+ end)
+end
+hookSpell(_G["GameTooltip"])
+hookSpell(_G["ItemRefTooltip"])

0 comments on commit 6b7b65a

Please sign in to comment.