-------------------------------------------------------------------------- |
-- GuildNotesTooltip.lua |
-------------------------------------------------------------------------- |
--[[ |
GuildNotesTooltip |
|
-Puts guild member officer and player notes in a tooltip on the Guild Frame. |
|
By: AnduinLothar |
|
Change Log: |
v1.0 (10/14/05) |
-First Release |
v1.1 (10/15/05) |
-Fixed xml loading bug |
v2.0 (05/05/07) |
-Made it WoW 2.x compatible and added more info on tooltip. - Maziel |
v2.1 (09/22/07) |
-Updated to show the tooltip even without a note |
-Updated for WoW 2.2 |
v3.0 (10/14/08) |
-Updated for WoW 3.0 |
-Added tooltip to status list |
|
$Id: $ |
$Rev: $ |
$LastChangedBy: $ |
$Date: $ |
|
]]-- |
|
-- <= == == == == == == == == == == == == => |
-- => Functions |
-- <= == == == == == == == == == == == == => |
|
function GuildNotesTooltip_ShowGuildMemberTooltip(self) |
local name, rank_name, rank_number, level, class, location, guild_note, guild_officernote = GetGuildRosterInfo(self.guildIndex) |
GuildNotesTooltip:SetOwner(self, "ANCHOR_NONE") |
GuildNotesTooltip:ClearAllPoints() |
GuildNotesTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 5, 0) |
local string = "" |
if guild_note and guild_note ~= "" and guild_officernote and guild_officernote ~= "" then |
string = format(GUILD_NOTES_TOOLTIP_FORMAT2, rank_name, name, level, class, location, GUILD_NOTES_TOOLTIP_PUBLIC_NOTE, guild_note, GUILD_NOTES_TOOLTIP_OFFICERS_NOTE, guild_officernote) |
elseif guild_note and guild_note ~= "" then |
string = format(GUILD_NOTES_TOOLTIP_FORMAT1, rank_name, name, level, class, location, GUILD_NOTES_TOOLTIP_PUBLIC_NOTE, guild_note) |
elseif guild_officernote and guild_officernote ~= "" then |
string = format(GUILD_NOTES_TOOLTIP_FORMAT1, rank_name, name, level, class, location, GUILD_NOTES_TOOLTIP_OFFICERS_NOTE, guild_officernote) |
else |
string = format(GUILD_NOTES_TOOLTIP_FORMAT0, rank_name, name, level, class, location) |
end |
GuildNotesTooltip:SetText(string) |
end |
|
function GuildNotesTooltip_HideTooltip() |
if (GuildNotesTooltip:IsVisible()) then |
GuildNotesTooltip:Hide() |
end |
end |
|
-- <= == == == == == == == == == == == == => |
-- => Create Tooltip |
-- <= == == == == == == == == == == == == => |
|
CreateFrame("GameTooltip", "GuildNotesTooltip", UIParent, "GameTooltipTemplate"):Hide() |
|
-- <= == == == == == == == == == == == == => |
-- => Setup Hooks |
-- <= == == == == == == == == == == == == => |
|
for i=1, GUILDMEMBERS_TO_DISPLAY do |
local frame = getglobal("GuildFrameButton"..i) |
frame:HookScript("OnEnter", GuildNotesTooltip_ShowGuildMemberTooltip) |
frame:HookScript("OnLeave", GuildNotesTooltip_HideTooltip) |
|
frame = getglobal("GuildFrameGuildStatusButton"..i) |
frame:SetScript("OnEnter", GuildNotesTooltip_ShowGuildMemberTooltip) |
frame:SetScript("OnLeave", GuildNotesTooltip_HideTooltip) |
end |