local addonName, addonTable = ...
function addonTable:colorize(text, color)
	return string.format("|cff%s%s|r",color and color or 'ffffff',text and text or '')
end
function addonTable:classcolor(text,class)
	class = RAID_CLASS_COLORS[class] and class or "PRIEST"
	return string.format("|c%s%s|r",RAID_CLASS_COLORS[class]['colorStr'],text)
end
function addonTable:round(num, idp)
	return math.floor(num * (10^(idp or 0)) + 0.5) / (10^(idp or 0))
end
function addonTable:sortArray(tmp,dir)
	local newtmp = {}
	local n = 1
	local cnt = 0
	local maximum = 0
	local first
	for k,v in pairs(tmp) do
		cnt = cnt + 1
		if(v > maximum) then
			maximum = v + 1
		end
		first = first or k
	end
	while(cnt > 0) do
		local mx, mn = dir and maximum or 0,first
		for k,v in pairs(tmp) do
			if(dir) then
				if(tonumber(v)<=tonumber(mx)) then
					mx = v
					mn = k
				end
			else
				if(tonumber(v)>=tonumber(mx)) then
					mx = v
					mn = k
				end
			end
		end
		newtmp[n] = mn
		tmp[mn] = nil
		cnt = 0
		for k,v in pairs(tmp) do
			cnt = cnt + 1
		end
		n = n + 1
		mn = 0
		mx = dir and mx or 0
	end
	return newtmp
end
function addonTable:IsTwink(name)
	local realm = GetRealmName()
	local _
	if(self['db']['sv']['profileKeys']) then
		for k,v in pairs(self['db']['sv']['profileKeys']) do
			local n,m = strsplit(" - ",k,2)
			_,m = strsplit(" ",m,2)
			if(n) then
				if(n == name and m == realm) then
					return true
				end
			end
		end
	end
	return false
end