-- Globals
CT_RAList = { };
CT_RAList.list = { }; -- List of people in the list
CT_RAList.queue = { }; -- List of people to do a /who on to get player data

-- addToList(name)
-- Adds player 'name' to the list.
CT_RAList.addToList = function(name)
	-- Make sure the person is not on the list already
	if ( not CT_RAList.list[name] ) then
		
		CT_RAList.list[name] = { };
		local tbl = CT_RAList.list[name];
		
		-- Fill in the data
		tbl.enteredList = GetTime();
		CT_RAList.requestData(tbl, name);
	end
end

-- requestData(tbl, playerName)
-- Scans the guild list to find data about the player. If not found, schedule a /who check.
CT_RAList.requestData = function(tbl, playerName)
	-- Check the guild to see if the person exists
	local numGuildMembers = GetNumGuildMembers(true);
	local name, rank, rankIndex, level, class, zone;
	for i = 1, numGuildMembers do
	
		name, rank, rankIndex, level, class, zone = GetGuildRosterInfo(index);
		if ( name == playerName ) then
			tbl.rank = rank;
			tbl.level = level;
			tbl.class = class;
			tbl.zone = zone;
			tbl.isInGuild = 1;
		end
	end
end