/trunk
friendEntries[online+1] = new( name, status ~= "" and format("%s %s", tostring(status), tostring(name)) or name, class:gsub(" ",""):upper(), level, zone or "Unknown", note and format("[%s]",note) or "-", nil, nil, IsGrouped and IsGrouped(name) ) |
end |
end |
f.FriendsBlock.text = total > 0 and format(" %d/%d", online, total) or " No friends." |
f.FriendsBlock.text = format(" %d/%d", online, total) |
if( not isGuild and block )then f:FriendsOnEnter(block) end |
end |
fs:SetFont( font, 12, flags ) |
fs:SetJustifyH( justify ) |
fs:SetTextColor( 1, index == 1 and .8 or 1, 0 ) |
fs:SetShadowColor( 0, 0, 0 ) -- ADDED |
fs:SetShadowOffset( 1, -1 ) -- ADDED |
fs:SetShadowColor( 0, 0, 0 ) |
fs:SetShadowOffset( 1, -1 ) |
if( anchor )then fs:SetPoint( "LEFT", anchor, "RIGHT", GAP, 0 ) end |
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 |
local function SetButtonData( index, name, class, level, zone, notes, rank, isGrouped ) |
local button = buttons[index] |
button.fontName:SetText( name or "" ) |
button:Show() |
button.fontName:SetText( name or "" ) |
if( class )then |
if( index > 1 )then |
local classIcon = CLASS_BUTTONS[class] |
end |
local function ShowTablet( self, _isGuild, entries ) |
f:Show() |
isGuild = _isGuild |
block = not leaving and block or self -- possible source of bugs when fast switching |
if( isGuild and not IsInGuild() or #entries == 0 )then |
GameTooltip:SetOwner(self) |
GameTooltip:AddLine( isGuild and ERR_GUILD_PLAYER_NOT_IN_GUILD or "No friends online." ) |
return GameTooltip:Show() |
end |
local hasEntries = #entries > 0 |
if( not hasEntries )then entries[1] = new( nil, isGuild and ERR_GUILD_PLAYER_NOT_IN_GUILD or "No friends online.", "" ) |
local offsetEntries, button = isGuild and 1 or 0 |
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, motd = 0 |
if( isGuild )then |
motd, extraHeight = SetButtonData( 0, "|cffffffffMOTD:|r " .. GetGuildRosterMOTD() ) |
if( isGuild and hasEntries )then |
motd, extraHeight = SetButtonData( 0, "|cffffffffMOTD:|r "..GetGuildRosterMOTD() ) |
if( CanEditMOTD() )then motd:SetScript( "OnClick", EditMOTD ) end |
motd.fontName:ClearAllPoints() |
end |
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], entry[9] ) |
button:SetScript( "OnClick", OnGuildmateClick ) |
if( hasEntries )then button:SetScript( "OnClick", OnGuildmateClick ) end |
button.unit = entry[1] |
if( nameW > nameC )then nameC = nameW end |
if( levelW )then |
if( levelW and levelW>0 )then |
if( levelW > levelC )then levelC = levelW end |
if( zoneW > zoneC )then zoneC = zoneW end |
if( notesW > notesC )then notesC = notesW end |
end |
if( hideNotes )then notesC = -GAP end |
local maxWidth = ICON_SIZE + TEXT_OFFSET + nameC + levelC + zoneC + notesC + rankC + GAP * (isGuild and 4 or 3) |
local maxWidth = ICON_SIZE + TEXT_OFFSET + nameC + levelC + zoneC + notesC + rankC + GAP * (isGuild and 4 or 3) -- (not hasEntries and 0 or isGuild and 4 or 3) |
extraHeight = ceil( extraHeight / maxWidth ) |
if( isGuild )then |
if( isGuild and hasEntries )then |
motd = buttons[0] |
motd:SetWidth( maxWidth ) |
motd:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, -GAP ) |
motd:SetHeight( (extraHeight+1) * BUTTON_HEIGHT ) |
for i=1, #entries do |
button = buttons[i] |
button:SetWidth( maxWidth ) |
if( not isGuild or i>1 )then button:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, (1-i-extraHeight-offsetEntries) * BUTTON_HEIGHT - GAP ) end |
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) |
local showBelow = select( 2, block:GetCenter() ) > ( UIParent:GetHeight() / 2 ) |
f:ClearAllPoints() |
f:SetPoint( showBelow and "TOP" or "BOTTOM", block, showBelow and "BOTTOM" or "TOP" ) |
f:Show() |
for i=#entries+1, #buttons do buttons[i]:Hide() end |
end |
text = GUILD, |
icon = "Interface\\AddOns\\Ara_Broker_Guild_Friends\\guild.tga", |
OnEnter = f.GuildOnEnter, |
OnLeave = function(self) return IsInGuild() and Menu_OnLeave(self) or GameTooltip:Hide() end, |
OnLeave = Menu_OnLeave, |
OnClick = function(self,button) OnBlockClick(self,button) end, |
} ) |
text = FRIENDS, |
icon = "Interface\\AddOns\\Ara_Broker_Guild_Friends\\friends.tga", |
OnEnter = f.FriendsOnEnter, |
OnLeave = function(self) Menu_OnLeave(self) GameTooltip:Hide() end, |
OnLeave = Menu_OnLeave, |
OnClick = function() ToggleFriendsFrame(1) end, |
} ) |
tile=true, tileSize=12, edgeSize=12, insets = { left=2, right=2, top=2, bottom=2 } } ) |
self:SetBackdropColor( 0, 0, 0, .75 ) |
end |
f:SetScale( UIParent:GetScale() ) |
f:SetFrameStrata"TOOLTIP" |
f:SetClampedToScreen(true) |
f:EnableMouse( true ) |
f:Show() -- possible fix for menu width bug |
t:SetScript( "OnUpdate", OnUpdate ) |
f:SetScript( "OnEnter", Menu_OnEnter ) |
f:RegisterEvent"CHAT_MSG_SYSTEM" |
ShowFriends() |
GuildRoster() |
if( IsInGuild() )then GuildRoster() else t.guildTimer = 0 end |
f:GuildOnEnter(true) |
f.ADDON_LOADED = nil |
end |
## Interface: 30000 |
## Title: |cFFFFB366Ara|r - Guild & Friends |
## Version: r6 |
## Version: r7 |
## Author: Ara |
## Notes: A Data Broker plugin that provides guildmates & friends informations and interactions. |
## SavedVariables: AraBrokerGuildFriendsDB |