From 1e8cc9119f99e09ccfd9d0a837e9c9b342e5bdb9 Mon Sep 17 00:00:00 2001 From: yaroot Date: Mon, 18 Oct 2010 19:38:56 +0800 Subject: [PATCH] LFR frame --- core.lua | 5 ++--- friends.lua | 4 ++-- guild.lua | 4 ++-- lfr.lua | 27 ++++++++++++--------------- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/core.lua b/core.lua index b05a960..547e435 100644 --- a/core.lua +++ b/core.lua @@ -75,7 +75,7 @@ ns.diffColor = setmetatable({}, { end }) -ns.classColorHex = setmetatable({}, { +ns.classColor = setmetatable({}, { __index = function(t,i) local c = i and RAID_CLASS_COLORS[BC[i] or i] if not c then return '|cffffffff' end @@ -84,12 +84,11 @@ ns.classColorHex = setmetatable({}, { end }) -ns.classColors = ns.classColorHex if CUSTOM_CLASS_COLORS then local function callBack() wipe(classColorHex) - wipe(classColors) + wipe(classColor) end CUSTOM_CLASS_COLORS:RegisterCallback(callBack) end diff --git a/friends.lua b/friends.lua index d6173a8..e386fca 100644 --- a/friends.lua +++ b/friends.lua @@ -19,7 +19,7 @@ local function friendsFrame() if ( button.buttonType == FRIENDS_BUTTON_TYPE_WOW ) then local name, level, class, area, connected, status, note = GetFriendInfo(button.id) if(connected) then - nameText = ns.classColorHex[class] .. name.."|r, "..format(FRIENDS_LEVEL_TEMPLATE, ns.diffColor[level] .. level .. '|r', class) + nameText = ns.classColor[class] .. name.."|r, "..format(FRIENDS_LEVEL_TEMPLATE, ns.diffColor[level] .. level .. '|r', class) if(areaName == playerArea) then infoText = format('|cff00ff00%s|r', area) end @@ -29,7 +29,7 @@ local function friendsFrame() if(isOnline and client==BNET_CLIENT_WOW) then local hasFocus, toonName, client, realmName, faction, race, class, guild, zoneName, level, gameText, broadcastText, broadcastTime = BNGetToonInfo(toonID) if(givenName and surname and toonName) then - if(enable_friendslist_wowcrossrealmfriend or CanCooperateWithToon(toonID)) then + if CanCooperateWithToon(toonID) then nameText = format(BATTLENET_NAME_FORMAT, givenName, surname) ..' '.. FRIENDS_WOW_NAME_COLOR_CODE .. '(' .. ns.classColorHex[class] .. toonName .. FRIENDS_WOW_NAME_COLOR_CODE .. ')' if(zoneName == playerArea) then infoText = format('|cff00ff00%s|r', zoneName) diff --git a/guild.lua b/guild.lua index 2cf7855..6314bc0 100644 --- a/guild.lua +++ b/guild.lua @@ -34,7 +34,7 @@ local function update() elseif(_VIEW == 'achievement') then button.string1:SetText(ns.diffColor[level] .. level) if(classFileName and name) then - button.string2:SetText(ns.classColors[classFileName] .. name) + button.string2:SetText(ns.classColor[classFileName] .. name) end end end @@ -56,7 +56,7 @@ local function tradeupdate() end end -local loaded = true +local loaded = false hooksecurefunc('GuildFrame_LoadUI', function() if(loaded) then return end loaded = true diff --git a/lfr.lua b/lfr.lua index 76b4ad3..c9476e8 100644 --- a/lfr.lua +++ b/lfr.lua @@ -1,18 +1,15 @@ -if(1) then return end -if(enable_lfrlist) then - hooksecurefunc('LFRBrowseFrameListButton_SetData', function(button, index) - local name, level, areaName, className, comment, partyMembers, status, class, encountersTotal, encountersComplete, isLeader, isTank, isHealer, isDamage = SearchLFGGetResults(index) - - local c = class and classColors[class] - if c then - button.name:SetTextColor(unpack(c)) - button.class:SetTextColor(unpack(c)) - end - if level then - button.level:SetText(diffColor[level] .. level) - end - end) -end +local parent, ns = ... +local myName = UnitName'player' + +hooksecurefunc('LFRBrowseFrameListButton_SetData', function(button, index) + local name, level, areaName, className, comment, partyMembers, status, class, encountersTotal, encountersComplete, isLeader, isTank, isHealer, isDamage = SearchLFGGetResults(index) + + if(index and class and name and level and (name~=myName)) then + button.name:SetText(ns.classColor[class] .. name) + button.class:SetText(ns.classColor[class] .. className) + button.level:SetText(ns.diffColor[level] .. level) + end +end) -- 1.7.9.5