WoWInterface SVN Ara_Broker_Guild_Friends

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 17 to Rev 18
    Reverse comparison

Rev 17 → Rev 18

Ara_Broker_Guild_Friends.toc
1,6 → 1,6
## Interface: 30000
## Title: |cFFFFB366Ara|r - Broker - Guild & Friends
## Version: r15
## Version: r16
## Author: Ara
## Notes: A Data Broker plugin that provides guildmates & friends informations and interactions.
## SavedVariables: AraBrokerGuildFriendsDB
Ara_Broker_Guild_Friends.lua
1,15 → 1,13
-- TODO:
-- scroll large guild members
-- TODO: scroll large guild members
local BUTTON_HEIGHT, ICON_SIZE, GAP, TEXT_OFFSET =
15, 13, 10, 5
 
local f = CreateFrame( "Frame", "AraBrokerGuildFriends", UIParent )
local t = CreateFrame"Frame"
 
local dontShow, block, horde, config, isGuild = true
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 scrollIndex
 
local format, strfind, strupper, GetGuildRosterInfo, GetFriendInfo, RAID_CLASS_COLORS, CLASS_BUTTONS =
format, strfind, strupper, GetGuildRosterInfo, GetFriendInfo, RAID_CLASS_COLORS, CLASS_BUTTONS
53,7 → 51,7
friendEntries[online+1] = new( name, status ~= "" and format("%s %s", tostring(status), tostring(name)) or name, class, level, zone or "Unknown", note and format("[%s]",note) or "-" )
end
end
f.FriendsBlock.text = format(" %d/%d", online, total)
f.FriendsBlock.text = format(config.hideTotalFriends and " %d" or " %d/%d", online, total)
if not isGuild and block then f:FriendsOnEnter(block) end
end
 
75,6 → 73,44
return 1,1,0
end
 
local function ShowBlockHints()
local showBelow = select(2, f:GetCenter()) > UIParent:GetHeight()/2
tip:SetOwner(f, "ANCHOR_NONE")
tip:SetPoint(showBelow and "TOP" or "BOTTOM", f, showBelow and "BOTTOM" or "TOP")
tip:AddLine"Hints [|cffffffffBlock|r]"
tip:AddLine("|cffff8020Click|r to open panel.", .2,1,.2)
tip:AddLine("|cffff8020Ctrl+Click|r to toggle hints.", .2,1,.2)
tip:AddLine("|cffff8020Shift+RightClick|r to toggle total number.", .2,1,.2)
if isGuild then
tip:AddLine("|cffff8020Shift+Click|r to toggle guild name.", .2,1,.2)
tip:AddLine("|cffff8020RightClick|r to toggle note column.", .2,1,.2)
else
tip:AddLine("|cffff8020EverythingElse|r to add a friend.", .2,1,.2)
end
tip:Show()
end
 
local function ShowHints(btn)
if not config.hideHints and btn and btn.unit then
local showBelow = select(2, f:GetCenter()) > UIParent:GetHeight()/2
tip:SetOwner(f, "ANCHOR_NONE")
tip:SetPoint(showBelow and "TOP" or "BOTTOM", f, showBelow and "BOTTOM" or "TOP")
tip:AddLine"Hints"
tip:AddLine("|cffff8020Click|r to whisper.", .2,1,.2)
tip:AddLine("|cffff8020Alt+Click|r to invite.", .2,1,.2)
tip:AddLine("|cffff8020Shift+Click|r to query guild.", .2, 1, .2)
if not isGuild or CanEditPublicNote() then tip:AddLine("|cffff8020Ctrl+Click|r to edit note.", .2, 1, .2) end
if isGuild then
if CanEditOfficerNote() then tip:AddLine("|cffff8020Ctrl+RightClick|r to edit officer note.", .2, 1, .2) end
tip:AddLine("|cffff8020RightClick|r to sort closest column.", .2, 1, .2)
else
tip:AddLine("|cffff8020MiddleClick|r to remove friend.", .2, 1, .2)
end
tip:Show()
tipShown = true
end
end
 
local highlight = f:CreateTexture()
highlight:SetTexture"Interface\\QuestFrame\\UI-QuestTitleHighlight"
highlight:SetBlendMode"ADD"
83,12 → 119,17
local function Menu_OnEnter(b)
if b.index then
highlight:SetAllPoints(b)
if b.index > 1 then highlight:SetAlpha(1) end
if b.index > 1 then
highlight:SetAlpha(1)
ShowHints(b)
end
end
end
 
local function Menu_OnLeave(b)
highlight:ClearAllPoints()
tip:Hide()
tipShown = false
if b.index and b.index > 1 then highlight:SetAlpha(0) end
if not MouseIsOver(f) then block = nil f:Hide() end
end
189,6 → 230,8
config.sortType, config.sortDESC = colpos, false
end
SortGuildRoster( colpos )
elseif button == "MiddleButton" and not isGuild then
RemoveFriend( self.unit ) -- ADDED (TEST)
elseif IsAltKeyDown() then
InviteUnit( self.unit )
elseif IsControlKeyDown() then
276,6 → 319,7
f:ClearAllPoints()
f:SetPoint( showBelow and "TOP" or "BOTTOM", block, showBelow and "BOTTOM" or "TOP" )
for i=#entries+1, #buttons do buttons[i]:Hide() end
if not (tipShown or config.hideHints) then ShowBlockHints() end
end
 
 
300,21 → 344,10
guildEntries[#guildEntries+1] = new( name, status == "" and name or format( "%s %s", status, name ), class, level, zone, notes, rank, i )
end
end
f.GuildBlock.text = IsInGuild() and format( " %s%d/%d", config.showGuildName and GetGuildInfo"player" and GetGuildInfo"player"..": " or "", #guildEntries-1, GetNumGuildMembers(true) ) or " No Guild"
f.GuildBlock.text = IsInGuild and format(config.hideGuildTotal and" %s%d"or" %s%d/%d", config.showGuildName and GetGuildInfo"player" and GetGuildInfo"player"..": " or "", #guildEntries-1, GetNumGuildMembers(true) ) or "No Guild"
if dontShow then dontShow = false else return ShowTablet(self, true, guildEntries) end
end
 
local function OnBlockClick(self, button)
if button == "LeftButton" then
if IsShiftKeyDown() and IsInGuild() then
config.showGuildName = not config.showGuildName
f.GuildBlock.text = format( " %s%d/%d", config.showGuildName and GetGuildInfo"player"..": " or "", #guildEntries-1, GetNumGuildMembers(true) )
else ToggleFriendsFrame(3) end
elseif not InCombatLockdown() then
config.showGuildNotes = not config.showGuildNotes
ShowTablet( block, true, guildEntries )
end
end
 
local ldb = LibStub("LibDataBroker-1.1")
 
324,7 → 357,23
icon = "Interface\\AddOns\\Ara_Broker_Guild_Friends\\guild.tga",
OnEnter = f.GuildOnEnter,
OnLeave = Menu_OnLeave,
OnClick = OnBlockClick,
OnClick = function(self, button)
if button == "LeftButton" then
if IsShiftKeyDown() and IsInGuild() then
config.showGuildName = not config.showGuildName
f.GuildBlock.text = format( " %s%d/%d", config.showGuildName and GetGuildInfo"player"..": " or "", #guildEntries-1, GetNumGuildMembers(true) )
elseif IsControlKeyDown() then
config.hideHints = not config.hideHints
ShowTablet( block, isGuild, isGuild and guildEntries or friendEntries )
else ToggleFriendsFrame(3) end
elseif button == "RightButton" and IsShiftKeyDown() then
config.hideGuildTotal = not config.hideGuildTotal
f:GuildOnEnter()
elseif not InCombatLockdown() then
config.showGuildNotes = not config.showGuildNotes
ShowTablet( block, true, guildEntries )
end
end,
} )
 
f.FriendsBlock = ldb:NewDataObject( "|cFFFFB366Ara|r Friends", {
333,7 → 382,19
icon = "Interface\\AddOns\\Ara_Broker_Guild_Friends\\friends.tga",
OnEnter = f.FriendsOnEnter,
OnLeave = Menu_OnLeave,
OnClick = function() ToggleFriendsFrame(1) end,
OnClick = function(self, btn)
if IsControlKeyDown() then
config.hideHints = not config.hideHints
ShowTablet( block, isGuild, isGuild and guildEntries or friendEntries )
elseif IsShiftKeyDown() then
config.hideTotalFriends = not config.hideTotalFriends
f:FRIENDLIST_UPDATE()
elseif IsModifierKeyDown() or btn~="LeftButton" then
StaticPopup_Show"ADD_FRIEND"
else
ToggleFriendsFrame(1)
end
end,
} )
 
local orgGuildRoster = GuildRoster
364,6 → 425,7
for k, v in next, defaultConfig do if config[k]==nil then config[k]=v end end
if config.reloading then config.reloading = nil else SortGuildRoster(config.sortType) if config.sortDESC then SortGuildRoster(config.sortType) end end
 
tip = _G.GameTooltip
horde = UnitFactionGroup"player" == "Horde"
if _G.Skinner then
_G.Skinner:applySkin(self)