FRIENDS_MENU_XP_LOADED = "FriendsMenuXP加載成功, 作者Warbaby-聖光之願."
--[[
	text,			--按鈕名稱
	textHeight,		--按鈕字體大小
	icon,			--按鈕圖片路徑
	tCoordLeft, tCoordRight, tCoordTop, tCoordBottom,	--按鈕圖片的相對部分
	textR, textG, textB,	--按鈕文字顔色
	tooltipText,		--提示信息
	show,			--判斷是否顯示該按鈕的函數
	func,			--點擊按鈕所進行的操作
	notClickable,		--不可點擊(灰色按鈕)
	justifyH,		--文字對其方式, LEFT或CENTER
	isSecure,		--是否是安全按鈕
	attributes,		--安全按鈕的屬性, 格式為"屬性1:值1; 屬性2:值2"
]]

--{ "WHISPER", "INVITE", "TARGET", "IGNORE", "REPORT_SPAM", "GUILD_PROMOTE", "GUILD_LEAVE", "CANCEL" };
function NoSelfShow(name) return UnitName("player")~=name; end

FriendsMenuXP_Buttons = {};

FriendsMenuXP_Buttons["WHISPER"] = {
	text = WHISPER,
	func = function(name) ChatFrame_SendTell(name); end,
	--show = NoSelfShow,
};

FriendsMenuXP_Buttons["INVITE"] = {
	text = PARTY_INVITE,
	func = function(name) InviteUnit(name); end,
	show = NoSelfShow,
};

FriendsMenuXP_Buttons["TARGET"] = {
	text = TARGET,
	isSecure = 1,
	attributes = "type: macro;    macrotext: /target $name$",
	func = function(name)
		if(UnitName("target")~=name) then 
			DEFAULT_CHAT_FRAME:AddMessage("FriendsMenuXP無法選定<"..name..">為目標。",1,1,0); 
		end
	end,
};

FriendsMenuXP_Buttons["IGNORE"] = {
	text = IGNORE,
	func = function(name) AddOrDelIgnore(name); end,
	--show = NoSelfShow,
};

FriendsMenuXP_Buttons["REPORT_SPAM"] = {
	text = REPORT_SPAM
	,
	func = function(name,connected,lineID) 
		local dialog = StaticPopup_Show("CONFIRM_REPORT_SPAM_CHAT", name);
		if ( dialog ) then
			dialog.data = lineID;
		end
	end
	,
	show = function(name, connected, lineID) return lineID and CanComplainChat(lineID) end
	,
};

FriendsMenuXP_Buttons["CANCEL"] = {
	text = CANCEL,
};

FriendsMenuXP_Buttons["ADD_FRIEND"] = {
	text = "添加為好友"
	,
	func = function (name) AddFriend(name); end
	,
	show = function(name)
		if(name == UnitName("player")) then return end;
		for i = 1, GetNumFriends() do
			if(name == GetFriendInfo(i)) then
				return nil;
			end
		end
		return 1;
	end
	,
}

FriendsMenuXP_Buttons["SEND_WHO"] = {
	text = "查詢詳情",
	func = function (name) SendWho("n-"..name); end,
}

FriendsMenuXP_Buttons["ADD_GUILD"] = {
	text = "邀請入會",
	func = function (name) GuildInvite(name); end,
	show = function (name) return name~=UnitName("player") and CanGuildInvite() end,
}

FriendsMenuXP_Buttons["GET_NAME"] = {
	text = "獲取名字"	
	,
	func = function (name) 
		if ( ChatFrameEditBox:IsVisible() ) then
			ChatFrameEditBox:Insert(name);
		else
			DEFAULT_CHAT_FRAME.editBox:Hide();
			DEFAULT_CHAT_FRAME.editBox.chatType = "SAY";
			ChatEdit_UpdateHeader(DEFAULT_CHAT_FRAME.editBox);
			if (not DEFAULT_CHAT_FRAME.editBox:IsVisible()) then
				ChatFrame_OpenChat(DEFAULT_CHAT_FRAME.editBox:GetText()..name, DEFAULT_CHAT_FRAME);
			end
		end
	end
	,
}

FriendsMenuXP_Buttons["MAGE_BUFF"] = {
	text = "秘法智慧",
	isSecure = 1,
	icon = "Interface\\Icons\\Spell_Holy_MagicalSentry" ,
	attributes = "type: macro; macrotext: /target $name$\n/cast 秘法智慧\n/targetlasttarget" ,
	show = function() local _, class = UnitClass("player"); if(class == "MAGE") then return 1 end end ,
};
FriendsMenuXP_Buttons["PRIE_BUFF1"] = {
	text = "真言術:韌",
	isSecure = 1,
	attributes = "type: macro; macrotext: /target $name$\n/cast 真言術:韌\n/targetlasttarget" ,
	show = function() local _, class = UnitClass("player"); if(class == "PRIEST") then return 1 end end ,
};


FriendsMenuXP_ButtonSet = {};
FriendsMenuXP_ButtonSet["NORMAL"] = { "WHISPER", "INVITE", "TARGET", "IGNORE", "REPORT_SPAM", "ADD_FRIEND", "SEND_WHO", "ADD_GUILD", "GET_NAME", "MAGE_BUFF", "PRIE_BUFF1", "CANCEL", }