WoWInterface SVN Ara_Broker_Guild_Friends

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 19 to Rev 20
    Reverse comparison

Rev 19 → Rev 20

Ara_Broker_Guild_Friends.toc
1,6 → 1,6
## Interface: 30000
## Interface: 30200
## Title: |cFFFFB366Ara|r - Broker - Guild & Friends
## Version: r17
## Version: r19
## Author: Ara
## Notes: A Data Broker plugin that provides guildmates & friends informations and interactions.
## SavedVariables: AraBrokerGuildFriendsDB
Ara_Broker_Guild_Friends.lua
7,10 → 7,11
 
local dontShow, block, horde, config, isGuild, tip, tipShown = true
local defaultConfig = { showGuildNotes = true, showGuildName = true, sortType = "class", sortDESC = false, fontSize=12 }
local guildEntries, friendEntries = {}, {}
local guildEntries, friendEntries, buttons, motd = {}, {}
local RAID_CLASS_COLORS = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS
 
local format, strfind, strupper, GetGuildRosterInfo, GetFriendInfo, RAID_CLASS_COLORS, CLASS_BUTTONS =
format, strfind, strupper, GetGuildRosterInfo, GetFriendInfo, RAID_CLASS_COLORS, CLASS_BUTTONS
local format, strfind, strupper, GetGuildRosterInfo, GetFriendInfo, CLASS_BUTTONS, GetDifficultyColor =
format, strfind, strupper, GetGuildRosterInfo, GetFriendInfo, CLASS_BUTTONS, GetQuestDifficultyColor or GetDifficultyColor
 
local L = setmetatable( _G.ABGF_TC or {}, { __index = function(t,k) return strupper(k) end } )
 
66,7 → 67,7
end
 
local hordeZones = "Orgrimmar,Undercity,Thunder Bluff,Silvermoon City,Durotar,Tirisfal Glades,The Barrens,Silverpine Forest,Mulgore,The Sepulcher,Eversong Woods,Ghostlands,"
local allianceZones = "Ironforge,Stormwind City,Darnassus,Azuremyst Isle,Bloodmyst Isle,Darkshore,Dun Morogh,Loch Modan,Wetlands,Elwynn Forest,Redridge Mountains,Westfall,Teldrassil,Duskwood,Darshire,Thelsamar,Deeprun Tram,The Exodar,Auberdine,Menethil Harbor,Theramore Isle"
local allianceZones = "Ironforge,Stormwind City,Darnassus,Azuremyst Isle,Bloodmyst Isle,Darkshore,Dun Morogh,Loch Modan,Wetlands,Elwynn Forest,Redridge Mountains,Westfall,Teldrassil,Duskwood,Darshire,Thelsamar,Deeprun Tram,The Exodar,Auberdine,Menethil Harbor,Theramore Isle,"
local function GetZoneColor(zone)
if strfind( hordeZones , zone.."," ) then if horde then return 0,1,0 else return 1,0,0 end end
if strfind( allianceZones, zone.."," ) then if horde then return 1,0,0 else return 0,1,0 end end
142,19 → 143,23
return fs
end
 
local buttons = setmetatable( { }, { __index = function( table, key )
buttons = setmetatable( { }, { __index = function( table, key )
local button = CreateFrame( "Button", nil, f )
table[key] = button
button.index = key
button:SetNormalFontObject(GameFontNormal)
button:RegisterForClicks"AnyUp"
button:SetHeight( BUTTON_HEIGHT )
button:SetScript( "OnEnter", Menu_OnEnter )
button:SetScript( "OnLeave", Menu_OnLeave )
button.fontName = CreateFS( key, button, "LEFT" )
if key == 0 then
button.fontName:SetJustifyV"TOP"
motd = button
motd.fontName:SetJustifyV"TOP"
motd.fontName:SetPoint( "TOPLEFT", motd, "TOPLEFT" )
motd:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, -GAP )
else
button:SetHeight( BUTTON_HEIGHT )
button:SetPoint( "TOPLEFT", buttons[key-1], "BOTTOMLEFT" )
button.icon = button:CreateTexture()
button.icon:SetWidth( ICON_SIZE ) button.icon:SetHeight( ICON_SIZE )
button.icon:SetPoint( "LEFT", button, "LEFT" )
182,9 → 187,8
button.icon:SetTexture(isGrouped and "Interface\\Buttons\\UI-CheckBox-Check" or "")
button.icon:SetTexCoord(.15,.85,.15,.85)
else
local classIcon = CLASS_BUTTONS[class]
button.icon:SetTexture"Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes"
local offset, left, right, bottom, top = 0.025, unpack( classIcon )
local offset, left, right, bottom, top = 0.025, unpack( CLASS_BUTTONS[class] )
button.icon:SetTexCoord( left+offset, right-offset, bottom+offset, top-offset )
end
else
231,7 → 235,7
end
SortGuildRoster( colpos )
elseif button == "MiddleButton" and not isGuild then
RemoveFriend( self.unit ) -- ADDED (TEST)
RemoveFriend( self.unit )
elseif IsAltKeyDown() then
InviteUnit( self.unit )
elseif IsControlKeyDown() then
256,21 → 260,14
entries[1] = new( nil, isGuild and ERR_GUILD_PLAYER_NOT_IN_GUILD or "No friends online.", "" )
end
 
local offsetEntries, button = isGuild and hasEntries and 1 or 0
local nameC, levelC, zoneC, notesC, rankC = 0, 0, 0, 0, 0
local nameW, levelW, zoneW, notesW, rankW
local hideNotes = isGuild and not config.showGuildNotes
local extraHeight = 0
 
local extraHeight, motd = 0
if isGuild and hasEntries then
motd, extraHeight = SetButtonData( 0, "|cffffffffMOTD:|r "..GetGuildRosterMOTD() )
if CanEditMOTD() then motd:SetScript( "OnClick", EditMOTD ) end
motd.fontName:ClearAllPoints()
end
 
local isGrouped = GetNumRaidMembers()>0 and UnitInRaid or GetNumPartyMembers()>0 and UnitInParty or nil
for i, entry in ipairs(entries) do
button, nameW, levelW, zoneW, notesW, rankW = SetButtonData( i, entry[2], entry[3], entry[4], entry[5], entry[6], entry[7], isGrouped, isGrouped and entry[1] and isGrouped(entry[1]), isGrouped ) --MOD
button, nameW, levelW, zoneW, notesW, rankW = SetButtonData( i, entry[2], entry[3], entry[4], entry[5], entry[6], entry[7], isGrouped, isGrouped and entry[1] and isGrouped(entry[1]) )
button.unit = entry[1]
button:SetScript( "OnClick", OnGuildmateClick )
if nameW > nameC then nameC = nameW end
286,23 → 283,23
 
if hideNotes then notesC = -GAP end
local maxWidth = ICON_SIZE + TEXT_OFFSET + nameC + levelC + zoneC + notesC + rankC + GAP * (isGuild and 4 or 3)
extraHeight = ceil( extraHeight / maxWidth )
 
if isGuild and hasEntries then
motd = buttons[0]
SetButtonData( 0, "|cffffffffMOTD:|r "..GetGuildRosterMOTD() )
if CanEditMOTD() then motd:SetScript( "OnClick", EditMOTD ) end
motd.fontName:SetWidth( maxWidth )
motd:SetWidth( maxWidth )
motd:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, -GAP )
motd:SetHeight( (extraHeight+1) * BUTTON_HEIGHT )
motd.fontName:SetAllPoints(motd)
motd:SetHeight( motd.fontName:GetHeight() + BUTTON_HEIGHT )
extraHeight = motd:GetHeight() + BUTTON_HEIGHT
buttons[1]:SetPoint( "TOPLEFT", motd, "BOTTOMLEFT" )
elseif rawget( buttons, 0 ) then
else
buttons[0]:Hide()
buttons[1]:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, -GAP )
end
 
for i=1, #entries do
button = buttons[i]
button:SetWidth( maxWidth )
if not isGuild or i>1 or not hasEntries then button:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, (1-i-extraHeight-offsetEntries) * BUTTON_HEIGHT - GAP ) end
button.fontName:SetWidth(nameC)
button.fontLevel:SetWidth(levelC)
button.fontZone:SetWidth(zoneC)
312,7 → 309,7
colspace[2], colspace[3], colspace[4], colspace[5], colspace[6] = nameC, levelC, zoneC, notesC, rankC
 
f:SetWidth( maxWidth + GAP*2 )
f:SetHeight( BUTTON_HEIGHT * (#entries+offsetEntries+extraHeight) + GAP*2 )
f:SetHeight( BUTTON_HEIGHT * ( #entries + (isGuild and hasEntries and -1 or 0) ) + extraHeight + GAP*2 )
 
Menu_OnEnter(self)
local showBelow = select( 2, block:GetCenter() ) > ( UIParent:GetHeight() / 2 )
448,8 → 445,8
f:RegisterEvent"FRIENDLIST_UPDATE"
f:RegisterEvent"CHAT_MSG_SYSTEM"
 
ShowFriends() t.friendTimer = 0
if IsInGuild() then GuildRoster() else t.guildTimer = 0 end
ShowFriends()
if IsInGuild(buttons[0]) then GuildRoster() else t.guildTimer = 0 end
f:GuildOnEnter()
f.ADDON_LOADED = nil
end