tinsert(UISpecialFrames, "CT_RA_SlashCmdFrame");
function CT_RASlashCmd_DisplayDialog()
	table.sort(CT_RA_SlashCmds, function(t1, t2)
		return t1[2] < t2[2]
	end);
	-- Initialize dialog
	local totalHeight = 0;
	for i = 1, 30, 1 do
		local obj = getglobal("CT_RA_SlashCmdFrameScrollFrameCmdsCmd" .. i);
		if ( CT_RA_SlashCmds[i] ) then
			obj.slashCommand = CT_RA_SlashCmds[i][2];
			obj:Show();
			getglobal(obj:GetName() .. "Text"):SetText(CT_RA_SlashCmds[i][2]);
			getglobal(obj:GetName() .. "Description"):SetText(CT_RA_SlashCmds[i][3]);
			if ( strlen(CT_RA_SlashCmds[i][4]) > 0 ) then
				getglobal(obj:GetName() .. "Available"):SetText(CT_RA_SHORTCUTS_AVAILABLE .. "|c00FFFFFF" .. CT_RA_SlashCmds[i][4] .. "|r");
				obj:SetHeight(CT_RA_SlashCmds[i][1]+33);
			else
				getglobal(obj:GetName() .. "Available"):SetText("");
				obj:SetHeight(CT_RA_SlashCmds[i][1]+25);
			end
			getglobal(obj:GetName() .. "Description"):SetHeight(CT_RA_SlashCmds[i][1]);
			totalHeight = totalHeight + CT_RA_SlashCmds[i][1];
		else
			obj:Hide();
		end
		if ( i > 1 ) then
			obj:SetPoint("TOPLEFT", "CT_RA_SlashCmdFrameScrollFrameCmdsCmd" .. (i-1), "BOTTOMLEFT");
		end
	end
	CT_RA_SlashCmdFrameScrollFrameCmds:SetHeight(totalHeight);
	ShowUIPanel(CT_RA_SlashCmdFrame);
	CT_RA_SlashCmdFrameScrollFrame:UpdateScrollChildRect();
	
	local minVal, maxVal = CT_RA_SlashCmdFrameScrollFrameScrollBar:GetMinMaxValues();
	if ( maxVal == 0 ) then
		CT_RA_SlashCmdFrameScrollFrameScrollBar:Hide();
	else
		CT_RA_SlashCmdFrameScrollFrameScrollBar:Show();
	end
end

CT_RA_SlashCmds = { };

function CT_RA_RegisterSlashCmd(title, description, height, identifier, func, ...)
	SlashCmdList[identifier] = func;
	local otherCmds = "";
	for i = 1, arg.n, 1 do
		setglobal("SLASH_" .. identifier .. i, arg[i]);
		if ( i > 1 ) then
			if ( strlen(otherCmds) > 0 ) then
				otherCmds = otherCmds .. ", ";
			end
			otherCmds = otherCmds .. arg[i];
		end
	end
	local num = 0;
	while ( string.find(description, "|b.-|eb") ) do
		description = string.gsub(description, "^(.*)|b(.-)|eb(.*)$", "%1|c00FFD100%2|r%3");
		num = num + 1;
		if ( num > 10 ) then
			break;
		end
	end
	tinsert(CT_RA_SlashCmds, { height, title, description, otherCmds });
end


-- Functions used by slash commands
function CT_RA_CheckReady()
	if ( CT_RA_Level >= 1 ) then
		SendChatMessage("<CTRaid> " .. UnitName("player") .. CT_RA_MSG_RC_PERFORMED, "RAID");
		CT_RA_AddMessage("CHECKREADY");
		local numValid = 0;
		for i = 1, GetNumRaidMembers(), 1 do
			local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i);
			if ( name ~= UnitName("player") and CT_RA_Stats[name] and CT_RA_Stats[name]["Reporting"] and online and CT_RA_Stats[name]["Version"] and CT_RA_Stats[name]["Version"] >= 1.097 ) then
				numValid = numValid + 1;
				CT_RA_Stats[name]["notready"] = 1;
			end
		end
		if ( numValid == 1 ) then
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RC_CHECKED .. "|c00FFFFFF" .. numValid .. "|r " .. CT_RA_MSG_RAID_MEMBER .. ".", 1, 1, 0);
		else
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RC_CHECKED .. "|c00FFFFFF" .. numValid .. "|r " .. CT_RA_MSG_RAID_MEMBERS .. ".", 1, 1, 0);
		end
		CT_RA_UpdateFrame.readyTimer = 30;
		CT_RA_UpdateRaidGroup(0);
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 1, 0);
	end
end

function CT_RA_CheckVote(question)
	if ( CT_RA_Level >= 1 ) then
		SendChatMessage("<CTRaid> " .. UnitName("player") .. CT_RA_MSG_VOTE_PERFORMED .. question, "RAID");
		CT_RA_AddMessage("VOTE " .. question);
		CT_RA_Print("<CTRaid> " ..CT_RA_MSG_VOTE_PERFORMING .. "|c00FFFFFF" .. question .. "|r", 1, 1, 0);
		CT_RA_UpdateFrame.voteTimer = 30;
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 1, 0);
	end
end

function CT_RA_CheckRly()
	if ( CT_RA_Level >= 1 ) then
--~ 		SendChatMessage("<CTRaid> " .. UnitName("player") .. CT_RA_MSG_ASKS_ORLY, "RAID");
		CT_RA_AddMessage("CHECKRLY");
		local numValid = 0;
		for i = 1, GetNumRaidMembers(), 1 do
			local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i);
			if ( name ~= UnitName("player") and CT_RA_Stats[name] and CT_RA_Stats[name]["Reporting"] and online and CT_RA_Stats[name]["Version"] and CT_RA_Stats[name]["Version"] >= 1.097 ) then
				numValid = numValid + 1;
				CT_RA_Stats[name]["rly"] = 1;
			end
		end
		if ( numValid == 1 ) then
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_ORLY_CHECKED .. "|c00FFFFFF" .. numValid .. "|r " .. CT_RA_MSG_RAID_MEMBER .. ".", 1, 1, 0);
		else
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_ORLY_CHECKED .. "|c00FFFFFF" .. numValid .. "|r " .. CT_RA_MSG_RAID_MEMBERS .. ".", 1, 1, 0);
		end
		CT_RA_UpdateFrame.rlyTimer = 30;
		CT_RA_UpdateRaidGroup(0);
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 1, 0);
	end
end

function CT_RA_Invite(msg)
	if ( not GetGuildInfo("player") ) then
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_GUILD);
		return;
	end
	if ( ( not CT_RA_Level or CT_RA_Level == 0 ) and GetNumRaidMembers() > 0 ) then
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 1, 0);
		return;
	end
	local inZone = "";
	if ( CT_RA_ZoneInvite ) then
		inZone = " in " .. GetRealZoneText();
	end
	local useless, useless, min, max = string.find(msg, "^(%d+)-(%d+)$");
	min = tonumber(min);
	max = tonumber(max);
	if ( min and max ) then
		if ( min > max ) then
			local temp = min;
			min = max;
			max = temp;
		end
		if ( min < 1 ) then min = 1; end
		if ( max > 60 ) then max = 60; end
		if ( min == max ) then
			SendChatMessage(CT_RA_MSG_RAID_INVITE .. min .. inZone .. ", leave your groups.", "GUILD");
		else
			SendChatMessage(CT_RA_MSG_RAID_INVITE .. min .. CT_RA_MSG_RAID_INVITE2 .. max .. inZone .. CT_RA_MSG_RAID_INVITE3, "GUILD");
		end
		GuildRoster();
		CT_RA_MinLevel = min;
		CT_RA_MaxLevel = max;
		CT_RA_UpdateFrame.startinviting = 10;
	else
		useless, useless, min = string.find(msg, "^(%d+)$");
		min = tonumber(min);
		if ( min ) then
			if ( min < 1 ) then min = 1; end
			if ( min > 60 ) then min = 60; end
			GuildRoster();
			SendChatMessage(CT_RA_MSG_RAID_INVITE .. min .. inZone .. CT_RA_MSG_RAID_INVITE3, "GUILD");
			CT_RA_MinLevel = min;
			CT_RA_MaxLevel = min;
			CT_RA_UpdateFrame.startinviting = 10;
		else
			if ( CT_RA_ZoneInvite ) then
				CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RAZINVITE_USAGE, 1, 0.5, 0);
				CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RAZINVITE, 1, 0.5, 0);
			else
				CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RAINVITE_USAGE, 1, 0.5, 0);
				CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RAINVITE, 1, 0.5, 0);
			end
		end
	end
end

-- Slash commands
	-- /raslash
CT_RA_RegisterSlashCmd("/rahelp", CT_RA_CMD_RAHELP, 15, "RAHELP", CT_RASlashCmd_DisplayDialog, "/rahelp");

	-- /rares
CT_RA_RegisterSlashCmd("/rares", CT_RA_CMD_RARES, 15, "RARES", function(msg)
	if ( msg == "show" ) then
		if ( GetNumRaidMembers() > 0 ) then
			CT_RA_ResFrame:Show();
		end
		CT_RAMenu_Options["temp"]["ShowMonitor"] = 1;
	elseif ( msg == "hide" ) then
		CT_RA_ResFrame:Hide();
		CT_RAMenu_Options["temp"]["ShowMonitor"] = nil;
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RARES_USAGE, 1, 0.5, 0);
	end
end, "/rares");

	-- /rs
CT_RA_RegisterSlashCmd("/rs", CT_RA_CMD_RS, 30, "RS", function(msg)
	if ( CT_RA_Level >= 1 ) then
		if ( CT_RAMenu_Options["temp"]["SendRARS"] ) then
			SendChatMessage(msg, "RAID");
		end
		CT_RA_AddMessage("MS " .. string.gsub(msg, "%%[tT]", UnitName("target") or TARGET_TOKEN_NOT_FOUND));
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 1, 0);
	end
end, "/rs");

	-- /raupdate
CT_RA_RegisterSlashCmd("/raupdate", CT_RA_CMD_RAUPDATE, 30, "RAUPDATE", function()
	if ( CT_RA_Level >= 1 ) then
		CT_RA_AddMessage("SR");
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_STATS_UPDATED, 1, 0.5, 0);
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/raupdate", "/raupd");

	-- /rakeyword
CT_RA_RegisterSlashCmd("/rakeyword", CT_RA_CMD_RAKW, 15, "RAKEYWORD", function(msg)
	if ( msg == "off" ) then
		CT_RAMenu_Options["temp"]["KeyWord"] = nil;
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_KW_OFF, 1, 0.5, 0);
	elseif ( msg == "" ) then
		local kw = CT_RAMenu_Options["temp"]["KeyWord"];
		if ( kw ) then
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_KW_SET1 .. "'|c00FFFFFF" .. kw .. "|r'" .. CT_RA_MSG_KW_SET2, 1, 0.5, 0);
		else
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_KW_NOT, 1, 0.5, 0);
		end
	else
		CT_RAMenu_Options["temp"]["KeyWord"] = msg;
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_KW_SET1 .. "'|c00FFFFFF" .. msg .. "|r'" .. CT_RA_MSG_KW_SET2, 1, 0.5, 0);
	end
end, "/rakeyword", "/rakw");

	-- /radisband
CT_RA_RegisterSlashCmd("/radisband", CT_RA_CMD_RADISBAND, 15, "RADISBAND", function(msg)
	if ( CT_RA_Level and CT_RA_Level >= 1 ) then
		CT_RA_Print("<CTRaid> Disbanding raid...", 1, 0.5, 0);
		SendChatMessage("<CTRaid> Disbanding raid on request by " .. UnitName("player") .. ".", "RAID");
		for i = 1, GetNumRaidMembers(), 1 do
			local name, rank, subgroup, level, class, fileName, zone, online, isDead = GetRaidRosterInfo(i);
			if ( online and rank <= CT_RA_Level and name ~= UnitName("player") ) then
				UninviteByName(name);
			end
		end
		CT_RA_AddMessage("DB");
		LeaveParty();
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/radisband");

	-- /rashow
CT_RA_RegisterSlashCmd("/rashow", CT_RA_CMD_RASHOW, 15, "RASHOW", function(msg)
	if ( msg == "all" ) then
		CT_RAMenu_Options["temp"]["ShowGroups"] = { 1, 1, 1, 1, 1, 1, 1, 1 };
		CT_RACheckAllGroups:SetChecked(1);
		for i = 1, 8, 1 do
			getglobal("CT_RAOptionsGroupCB" .. i):SetChecked(1);
		end
	else
		if ( not CT_RAMenu_Options["temp"]["HiddenGroups"] ) then return; end
		CT_RAMenu_Options["temp"]["ShowGroups"] = CT_RAMenu_Options["temp"]["HiddenGroups"];
		CT_RAMenu_Options["temp"]["HiddenGroups"] = nil;
		local num = 0;
		for k, v in CT_RAMenu_Options["temp"]["ShowGroups"] do
			num = num + 1;
			getglobal("CT_RAOptionsGroupCB" .. k):SetChecked(1);
		end
		if ( num > 0 ) then
			CT_RACheckAllGroups:SetChecked(1);
		else
			CT_RACheckAllGroups:SetChecked(nil);
		end
	end
	CT_RA_UpdateRaidGroup(0);
end, "/rashow");

	-- /rahide
CT_RA_RegisterSlashCmd("/rahide", CT_RA_CMD_RAHIDE, 15, "RAHIDE", function()
	CT_RAMenu_Options["temp"]["HiddenGroups"] = CT_RAMenu_Options["temp"]["ShowGroups"];
	CT_RAMenu_Options["temp"]["ShowGroups"] = { };
	CT_RACheckAllGroups:SetChecked(nil);
	for i = 1, 8, 1 do
		getglobal("CT_RAOptionsGroupCB" .. i):SetChecked(nil);
	end
	CT_RA_UpdateRaidGroup(0);
end, "/rahide");

	-- /raoptions
CT_RA_RegisterSlashCmd("/raoptions", CT_RA_CMD_RAOPT, 20, "RAOPTIONS", function(msg)
	CT_RAMenuFrame:Show();
end, "/raoptions");

	-- /raready
CT_RA_RegisterSlashCmd("/raready", CT_RA_CMD_RAREADY, 30, "RAREADY", CT_RA_CheckReady, "/raready", "/rar");

	-- /ravote
CT_RA_RegisterSlashCmd("/ravote", CT_RA_CMD_RAVOTE, 30, "RAVOTE", CT_RA_CheckVote, "/ravote");

	-- /rarly
CT_RA_RegisterSlashCmd("/rarly", CT_RA_CMD_RARLY, 30, "RARLY", CT_RA_CheckRly, "/rarly", "/rly");

	-- /rainvite
CT_RA_RegisterSlashCmd("/rainvite", CT_RA_CMD_RAINVITE, 30, "RAINVITE", function(msg)
	CT_RA_ZoneInvite = nil;
	CT_RA_Invite(msg);
end, "/rainvite", "/rainv");

	-- /razinvite
CT_RA_RegisterSlashCmd("/razinvite", CT_RA_CMD_RAZINVITE, 30, "RAZINVITE", function(msg)
	CT_RA_ZoneInvite = 1;
	CT_RA_Invite(msg);
end, "/razinvite", "/razinv");

	-- /radur
CT_RA_RegisterSlashCmd("/radur", CT_RA_CMD_RADUR, 30, "RADUR", function()
	if ( CT_RA_Level >= 1 ) then
		CT_RADurability_Shown = { };
		CT_RADurability_Sorting = {
			["curr"] = 4,
			[3] = { "a", "a" },
			[4] = { "a", "a" }
		};
		CT_RA_DurabilityFrame.type = "RADUR";
		CT_RA_DurabilityFrame.arg = nil;
		CT_RADurability_Update();
		ShowUIPanel(CT_RA_DurabilityFrame);
		CT_RA_DurabilityFrameValueTab:SetText(CT_RA_DURABILITY_PERCENT);
		CT_RA_DurabilityFrameValueTab:Show();
		for i = 1, 5, 1 do
			getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
		end
		CT_RA_DurabilityFrameTitle:SetText(CT_RA_DURABILITY_CHECK);
		CT_RA_AddMessage("DURC");
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/radur");

	-- /rareg
CT_RA_RegisterSlashCmd("/rareg", CT_RA_CMD_RAREG, 30, "RAREG", function()
	if ( CT_RA_Level >= 1 ) then
		CT_RADurability_Shown = { };
		CT_RADurability_Sorting = {
			["curr"] = 3,
			[3] = { "a", "a" },
			[4] = { "a", "a" }
		};
		CT_RA_DurabilityFrame.type = "RAREG";
		CT_RA_DurabilityFrame.arg = nil;
		CT_RA_DurabilityFrameValueTab:SetText(CT_RA_REAGENT_COUNT);
		CT_RA_DurabilityFrameValueTab:Show();
		for i = 1, 5, 1 do
			getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
		end
		CT_RADurability_Update();
		ShowUIPanel(CT_RA_DurabilityFrame);
		CT_RA_DurabilityFrameTitle:SetText(CT_RA_REAGENT_CHECK);
		CT_RA_AddMessage("REAC");
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/rareg");


	-- /raitem
CT_RA_RegisterSlashCmd("/raitem", CT_RA_CMD_RAITEM, 45, "RAITEM", function(itemName)
	if ( CT_RA_Level >= 1 ) then
		if ( not itemName ) then
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RAITEM_USAGE, 1, 0.5, 0);
			return;
		end
		local _, _, linkName = string.find(itemName, "%[(.+)%]");
		if ( linkName ) then
			itemName = linkName;
		end
		CT_RADurability_Shown = { };
		CT_RADurability_Sorting = {
			["curr"] = 4,
			[3] = { "a", "a" },
			[4] = { "a", "a" }
		};
		CT_RA_DurabilityFrame.type = "RAITEM";
		CT_RA_DurabilityFrame.arg = itemName;
		CT_RA_DurabilityFrameValueTab:SetText(CT_RA_ITEM_COUNT);
		CT_RA_DurabilityFrameValueTab:Show();
		for i = 1, 5, 1 do
			getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
		end
		CT_RADurability_Update();
		ShowUIPanel(CT_RA_DurabilityFrame);
		CT_RA_DurabilityFrameTitle:SetText(CT_RA_ITEM_CHECK);
		CT_RA_AddMessage("ITMC " .. itemName);
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/raitem");

	-- /raversion
CT_RA_RegisterSlashCmd("/raversion", CT_RA_CMD_RAVERSION, 15, "RAVERSION", function()
		CT_RADurability_Shown = { };
		CT_RADurability_Sorting = {
			["curr"] = 4,
			[3] = { "a", "b" },
			[4] = { "a", "b" }
		};
		CT_RA_DurabilityFrame.type = "RAVERSION";
		CT_RA_DurabilityFrameValueTab:SetText(CT_RA_VERSION_LIST);
		CT_RA_DurabilityFrameValueTab:Show();
		for i = 1, 5, 1 do
			getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
		end
		CT_RADurability_Update();
		ShowUIPanel(CT_RA_DurabilityFrame);
		CT_RA_DurabilityFrameTitle:SetText(CT_RA_VERSION_CHECK);
		for i = 1, GetNumRaidMembers(), 1 do
			local name = UnitName("raid" .. i);
			if ( CT_RA_Stats[name] and CT_RA_Stats[name]["Version"] ) then
				local name, rank, subgroup, level, class, fileName = GetRaidRosterInfo(i);
				CT_RADurability_Add(name, CT_RA_Stats[name]["Version"], fileName, CT_RA_Stats[name]["Version"]);
			else
				local name, rank, subgroup, level, class, fileName = GetRaidRosterInfo(i);
				CT_RADurability_Add(name, "|c00666666" .. CT_RA_NO_CTRA_FOUND.. "|r", fileName, 0);
			end
		end
end, "/raversion", "/raver");

	-- /raresist (Thanks Sudo!)
CT_RA_RegisterSlashCmd("/raresist", CT_RA_CMD_RARESIST, 30, "RARST", function(msg)
	if ( CT_RA_Level >= 1 ) then
		CT_RADurability_Shown = { };
		CT_RADurability_Sorting = {
			["curr"] = 3,
			[3] = { "a", "a" },
			[4] = { "b", "b" },
			[5] = { "b", "b" },
			[6] = { "b", "b" },
			[7] = { "b", "b" },
			[8] = { "b", "b" },
		};
		
		CT_RA_DurabilityFrame.type = "RARST";
		CT_RA_DurabilityFrameValueTab:Hide();
		for i = 1, 5, 1 do
			getglobal("CT_RA_DurabilityFrameResistTab" .. i):Show();
		end
		CT_RADurability_Update();
		ShowUIPanel(CT_RA_DurabilityFrame);
		CT_RA_DurabilityFrameTitle:SetText(CT_RA_RESIST_CHECK);
		CT_RA_AddMessage("RSTC");
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/raresist", "/raresists");

	-- /razone
CT_RA_RegisterSlashCmd("/razone", CT_RA_CMD_RAZONE, 30, "RAZONE", function(msg)
	CT_RADurability_Shown = { };
	CT_RADurability_Sorting = {
		["curr"] = 3,
		[3] = { "a", "a" },
		[4] = { "a", "a" }
	};
	CT_RA_DurabilityFrame.type = "RAZONE";
	CT_RA_DurabilityFrameValueTab:Show();
	for i = 1, 5, 1 do
		getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
	end
	CT_RADurability_Update();
	ShowUIPanel(CT_RA_DurabilityFrame);
	CT_RA_DurabilityFrameTitle:SetText(CT_RA_ZONE_CHECK);
	CT_RA_DurabilityFrameValueTab:SetText(CT_RA_ZONE_NAME);
	
	local name, rank, subgroup, level, class, fileName, zone;
	for i = 1, GetNumRaidMembers(), 1 do
		name, rank, subgroup, level, class, fileName, zone = GetRaidRosterInfo(i);
		if ( name ~= UnitName("player") and zone and zone ~= "" and zone ~= "Offline" and zone ~= GetRealZoneText() ) then
			CT_RADurability_Add(name, zone, fileName);
		end
	end
end, "/razone");

	-- /raping
CT_RA_RegisterSlashCmd("/raping", CT_RA_CMD_RAPING, 30, "RAPING", function(msg)
	if ( CT_RA_Level >= 1 ) then
		CT_RADurability_Shown = { };
		CT_RADurability_Sorting = {
			["curr"] = 4,
			[3] = { "a", "b" },
			[4] = { "a", "b" }
		};
		
		CT_RA_DurabilityFrame.type = "RAPING";
		CT_RA_DurabilityFrameValueTab:Show();
		for i = 1, 5, 1 do
			getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
		end
		CT_RADurability_Update();
		ShowUIPanel(CT_RA_DurabilityFrame);
		CT_RA_DurabilityFrameTitle:SetText(CT_RA_PING_CHECK);
		CT_RA_DurabilityFrameValueTab:SetText(CT_RA_PING_VALUE);
		CT_RA_AddMessage("RAPING");
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/raping", "/ralatency");

	-- /rareput
CT_RA_RegisterSlashCmd("/rareput", CT_RA_CMD_RAREPUT, 30, "RAREPUT", function(playerName)
	if ( CT_RA_Level >= 1 ) then
		if ( playerName and playerName ~= "" ) then
		
			local isInRaid = false;
			for i = 1, GetNumRaidMembers(), 1 do
				local name = GetRaidRosterInfo(i);
				if ( name == playerName ) then
					isInRaid = true;
				end
			end
	
			if ( not isInRaid ) then
				CT_RA_Print("<CTRaid> " .. CT_RA_MSG_PLAYER .. "|c00FFFFFF" .. playerName .. "|r" .. CT_RA_MSG_NOT_IN_RAID, 1, 0.5, 0);
				return;
			end
	
			CT_RADurability_Shown = { };
			CT_RADurability_Sorting = {
				["curr"] = 4,
				[3] = { "a", "a" },
				[4] = { "a", "a" }
			};
			CT_RA_DurabilityFrame.type = "RAREPUT";
			CT_RA_DurabilityFrame.arg = playerName;
			CT_RA_DurabilityFrameNameTab:SetText(CT_RA_REPUT_FACTION);
			CT_RA_DurabilityFrameValueTab:SetText(CT_RA_REPUT_CHECK);
			CT_RA_DurabilityFrameValueTab:Show();
			for i = 1, 5, 1 do
				getglobal("CT_RA_DurabilityFrameResistTab" .. i):Hide();
			end
			CT_RADurability_Update();
			ShowUIPanel(CT_RA_DurabilityFrame);
			CT_RA_DurabilityFrameTitle:SetText(CT_RA_REPUT_CHECK .. ": " .. playerName);
	
			CT_RA_AddMessage("REPUTC " .. playerName);
		end
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/rareput");

	-- /raquiet (by Angarth)
CT_RA_RegisterSlashCmd("/raquiet", CT_RA_CMD_RAQUIET, 30, "RASQUELCH", function()
	if ( CT_RA_Level >= 1 ) then
		if ( CT_RA_Squelch > 0 ) then
			SendChatMessage("<CTRaid> Quiet mode is over.", "RAID");
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_QUIET_DISABLE, 1, 0.5, 0);
			CT_RA_Squelch = 0;
		else
			SendChatMessage("<CTRaid> Quiet mode, no talking.", "RAID");
			CT_RA_Print("<CTRaid> " .. CT_RA_MSG_QUIET_ENABLE, 1, 0.5, 0);
			CT_RA_Squelch = 5*60;
		end
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/raquiet", "/rasquelch");

	-- /rawipe (by Feu)
CT_RA_RegisterSlashCmd("/rawipe", "OMG Wipe!", 15, "RAWIPE", function()
	if ( CT_RA_Level >= 1 ) then
		CT_RA_AddMessage("RAWIPE");
	else
		CT_RA_Print("<CTRaid> " .. CT_RA_MSG_NEED_PROMOTE, 1, 0.5, 0);
	end
end, "/rawipe");

oldSendChatMessage = SendChatMessage;
function SendChatMessage(msg, type, language, target)
		if ( type == "RAID" ) then
			if ( CT_RA_Squelch > 0 and CT_RA_Level < 1 ) then
				CT_RA_Print("<CTRaid> " .. CT_RA_MSG_RAID_CANT_TALK, 1, 0.5, 0);
				return;
			end
		end
		oldSendChatMessage(msg, type, language, target);
end
