Quantcast

New feature and optimizations

F16Gaming [12-18-12 - 00:49]
New feature and optimizations

Added new feature: FactsManager
Changed ChatManager to use a better system for RAW-type messages
Filename
ChatManager.lua
Command.lua
CommandManager.lua
FactsLoader.xml
FactsManager.lua
facts/cat.lua
load.xml
diff --git a/ChatManager.lua b/ChatManager.lua
index cc0d2cb..f076fa6 100644
--- a/ChatManager.lua
+++ b/ChatManager.lua
@@ -60,6 +60,10 @@ C.ChatManager = {
 		CHAT_MSG_SAY					= "WHISPER",
 		CHAT_MSG_WHISPER				= "WHISPER",
 		CHAT_MSG_YELL					= "WHISPER"
+	},
+	SpecialOutput = {
+		Raw = 1,
+		RawTable = 2
 	}
 }

@@ -111,6 +115,7 @@ end
 -- @param target Player or channel index to send message to.
 -- @param isBN Is this message targeted to a BNet friend?
 -- @param smartSay Fallback to SAY instead of local logging if not in group
+-- @param raw If true, do not escape pipe characters
 --
 function CM:SendMessage(msg, channel, target, isBN, smartSay, raw)
 	isBN = isBN or false
@@ -227,7 +232,7 @@ function CM:HandleMessage(msg, sender, channel, target, sourceChannel, isBN, pID
 	end
 	local player = PM:GetOrCreatePlayer(sender, realm)
 	local result, arg, errArg, extra = CCM:HandleCommand(cmd, t, sourceChannel, player, bnetInfo)
-	local raw = (extra and type(errArg) == "table") or (errArg and type(arg) == "table") or (arg and type(arg ~= "table"))
+	local raw = (extra and type(errArg) == "table") or (errArg and type(arg) == "table") or (arg and type(arg) ~= "table")
 	if isBN then
 		target = pID
 		sender = pID
@@ -249,7 +254,7 @@ function CM:HandleMessage(msg, sender, channel, target, sourceChannel, isBN, pID
 					self:SendMessage(s, channel, target, isBN, nil, raw)
 				end
 			end
-		elseif result == "RAW_TABLE_OUTPUT" then
+		elseif result == self.SpecialOutput.RawTable then
 			if type(arg) ~= "table" then
 				error("Received RAW_TABLE_OUTPUT request, but arg was of type '" .. type(arg) .. "', expected 'table', aborting...")
 				return
@@ -257,6 +262,12 @@ function CM:HandleMessage(msg, sender, channel, target, sourceChannel, isBN, pID
 			for _,v in ipairs(arg) do
 				self:SendMessage(tostring(v), channel, target, isBN, nil, raw)
 			end
+		elseif result == self.SpecialOutput.Raw then
+			if type(arg) ~= "string" then
+				error("Received RAW_OUTPUT request, but arg was of type '" .. type(arg) .."', expected 'string', aborting...")
+				return
+			end
+			self:SendMessage(arg, channel, target, isBN, nil, raw)
 		else
 			local s = l[result]
 			if type(arg) == "table" then
diff --git a/Command.lua b/Command.lua
index f118be4..3319523 100644
--- a/Command.lua
+++ b/Command.lua
@@ -59,6 +59,7 @@ local AC
 local DM
 local SM
 local IM
+local FM
 local CDM
 local CRM
 local RCM
@@ -83,6 +84,7 @@ function C:Init()
 	DM = self.DeathManager
 	SM = self.SummonManager
 	IM = self.InviteManager
+	FM = self.FactsManager
 	CDM = self.DuelManager
 	CRM = self.RoleManager
 	RCM = self.ReadyCheckManager
@@ -126,6 +128,7 @@ function C:LoadSavedVars()
 	DM:Init()
 	SM:Init()
 	IM:Init()
+	FM:Init()
 	CDM:Init()
 	CRM:Init()
 	RCM:Init()
diff --git a/CommandManager.lua b/CommandManager.lua
index 9837b27..0741392 100644
--- a/CommandManager.lua
+++ b/CommandManager.lua
@@ -73,6 +73,7 @@ local AM = C.AuthManager
 local DM = C.DeathManager
 local SM = C.SummonManager
 local IM = C.InviteManager
+local FM = C.FactsManager
 local CDM = C.DuelManager
 local CRM = C.RoleManager
 local RCM = C.ReadyCheckManager
@@ -242,7 +243,7 @@ CM:Register({"commands", "cmds", "cmdlist", "listcmds", "listcommands", "command
 		all = args[1] == "all"
 	end
 	local cmds = CM:GetCommands(all)
-	return "RAW_TABLE_OUTPUT", CES:Fit(cmds, 240, ", ") -- Max length is 255, "[Command] " takes up 10. This leaves us with 5 characters grace.
+	return Chat.SpecialOutput.RawTable, CES:Fit(cmds, 240, ", ") -- Max length is 255, "[Command] " takes up 10. This leaves us with 5 characters grace.
 end, "CM_COMMANDS_HELP")

 CM:Register({"version", "ver", "v"}, PM.Access.Groups.User.Level, function(args, sender, isChat, bnetInfo)
@@ -1200,7 +1201,6 @@ CM:Register({"emote", "em", "e"}, PM.Access.Groups.User.Level, function(args, se
 	if #args < 1 then
 		return false, "CM_EMOTE_USAGE"
 	end
-
 	return EM:DoEmote(args[1])
 end, "CM_EMOTE_HELP")

@@ -1209,6 +1209,49 @@ CM:Register({"sit"}, PM.Access.Groups.User.Level, function(args, sender, isChat,
 	return EM:DoEmote(EM.Emotes.Sit)
 end, "CM_SIT_HELP")

+CM:Register({"fact", "facts"}, PM.Access.Groups.User.Level, function(args, sender, isChat, bnetInfo)
+	if #args < 1 then
+		return false, "CM_FACT_USAGE"
+	end
+	return FM:AnnounceFact(args[1])
+end, "CM_FACT_HELP")
+
+-- Alias for !fact cat
+CM:Register({"cat", "c", "meow"}, PM.Access.Groups.User.Level, function(args, sender, isChat, bnetInfo)
+	return FM:AnnounceFact("cat")
+end, "CM_CAT_HELP")
+
+CM:Register({"factsettings", "factsetting", "factset"}, PM.Access.Groups.Admin.Level, function(args, sender, isChat, bnetInfo)
+	if #args < 1 then
+		if FM:IsEnabled() then
+			return "CM_FACTSETTINGS_ENABLED"
+		end
+		return "CM_FACTSETTINGS_DISABLED"
+	end
+	local option = args[1]:lower()
+	if option:match("^no") then -- NoDupe
+		if sub:match("^[eay]") then -- Enable NoDupe
+			return FM:EnableNoDupe()
+		elseif sub:match("^[dnc]") then -- Disable NoDupe
+			return FM:DisableNoDupe()
+		elseif sub:match("^t") then -- Toggle NoDupe
+			return FM:ToggleNoDupe()
+		else
+			if FM:IsNoDupeEnabled() then
+				return "CM_FACTSETTINGS_NODUPE_ENABLED"
+			end
+			return "CM_FACTSETTINGS_NODUPE_DISABLED"
+		end
+	elseif option:match("^[eay]") then -- Enable
+		return FM:Enable()
+	elseif option:match("^[dnc][^o]") then -- Disable
+		return FM:Disable()
+	elseif option:match("^t") then -- Toggle
+		return FM:Toggle()
+	end
+	return false, "CM_FACTSETTINGS_USAGE"
+end, "CM_FACTSETTINGS_HELP")
+
 for i,v in ipairs(CM.Slash) do
 	_G["SLASH_" .. C.Name:upper() .. i] = "/" .. v
 end
@@ -1236,10 +1279,12 @@ SlashCmdList[C.Name:upper()] = function(msg, editBox)
 					C.Logger:Normal(s)
 				end
 			end
-		elseif result == "RAW_TABLE_OUTPUT" then
+		elseif result == Chat.SpecialOutput.RawTable then
 			for _,v in ipairs(arg) do
 				C.Logger:Normal(tostring(v))
 			end
+		elseif result == Chat.SpecialOutput.Raw then
+			C.Logger:Normal(tostring(arg))
 		else
 			local s = l[result]
 			if type(arg) == "table" then
diff --git a/FactsLoader.xml b/FactsLoader.xml
new file mode 100644
index 0000000..e59c8b9
--- /dev/null
+++ b/FactsLoader.xml
@@ -0,0 +1,24 @@
+<!--
+	* Copyright (c) 2011-2012 by Adam Hellberg.
+	*
+	* This file is part of Command.
+	*
+	* Command is free software: you can redistribute it and/or modify
+	* it under the terms of the GNU General Public License as published by
+	* the Free Software Foundation, either version 3 of the License, or
+	* (at your option) any later version.
+	*
+	* Command is distributed in the hope that it will be useful,
+	* but WITHOUT ANY WARRANTY; without even the implied warranty of
+	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	* GNU General Public License for more details.
+	*
+	* You should have received a copy of the GNU General Public License
+	* along with Command. If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
+..\FrameXML\UI.xsd">
+	<Script file="FactsManager.lua" />
+	<Script file="facts\cat.lua" />
+</Ui>
diff --git a/FactsManager.lua b/FactsManager.lua
new file mode 100644
index 0000000..0d407d2
--- /dev/null
+++ b/FactsManager.lua
@@ -0,0 +1,158 @@
+--[[
+	* Copyright (c) 2011-2012 by Adam Hellberg.
+	*
+	* This file is part of Command.
+	*
+	* Command is free software: you can redistribute it and/or modify
+	* it under the terms of the GNU General Public License as published by
+	* the Free Software Foundation, either version 3 of the License, or
+	* (at your option) any later version.
+	*
+	* Command is distributed in the hope that it will be useful,
+	* but WITHOUT ANY WARRANTY; without even the implied warranty of
+	* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	* GNU General Public License for more details.
+	*
+	* You should have received a copy of the GNU General Public License
+	* along with Command. If not, see <http://www.gnu.org/licenses/>.
+--]]
+
+-- Upvalues
+
+-- API Upvalues
+
+local C = Command
+
+C.FactsManager = {
+	Facts = {},
+	UsedFacts = {}
+}
+
+local FM = C.FactsManager
+local CM
+local CES = C.Extensions.String
+local CET = C.Extensions.Table
+
+local factMapping = {}
+
+local FactFormat = "%s fact #%d: %s"
+
+function FM:Init()
+	for k,_ in pairs(self.Facts) do
+		factMapping[k:lower()] = k
+		self.UsedFacts[k] = {}
+	end
+
+	CM = C.ChatManager
+
+	self:LoadSavedVars()
+end
+
+function FM:LoadSavedVars()
+	if type(C.Global["FACTS_MANAGER"]) ~= "table" then
+		C.Global["FACTS_MANAGER"] = {}
+	end
+	self.Settings = C.Global["FACTS_MANAGER"]
+	if type(self.Settings.ENABLED) ~= "boolean" then
+		self.Settings.ENABLED = true
+	end
+	if type(self.Settings.NODUPE) ~= "boolean" then
+		self.Settings.NODUPE = true
+	end
+end
+
+function FM:GetFact(topic)
+	if topic then -- Specific topic
+		if not factMapping[topic] then
+			return false, "FM_ERR_TOPIC_NOT_FOUND"
+		elseif #self.Facts[factMapping[topic]] == 0 then
+			return false, "FM_ERR_TOPIC_EMPTY"
+		end
+		topic = factMapping[topic]
+		if self.Settings.NODUPE then
+			if #self.UsedFacts[topic] >= #self.Facts[topic] then
+				wipe(self.UsedFacts[topic])
+			end
+			local index = math.random(1, #self.Facts[topic])
+			while self.UsedFacts[topic][index] do
+				index = math.random(1, #self.Facts[topic])
+			end
+			self.UsedFacts[topic][index] = true
+			return FactFormat:format(topic, index, self.Facts[topic][index])
+		end
+		local rand = math.random(1, #self.Facts[topic])
+		return FactFormat:format(topic, rand, self.Facts[topic][rand])
+	end
+	local topicIndex = math.random(1, CET:GetRealLength(self.Facts))
+	local topicName
+	local i = 1
+	for k,_ in pairs(self.Facts) do
+		topicName = k
+		if i == topicIndex then break end
+		i = i + 1
+	end
+	if not topicName then
+		return false, "FM_ERR_NO_TOPIC_FOUND"
+	elseif #self.Facts[topicName] == 0 then
+		return false, "FM_ERR_TOPIC_EMPTY"
+	end
+	local factIndex = math.random(1, #self.Facts[topicName])
+	return FactFormat:format(topicName, factIndex, self.Facts[topicName][factIndex])
+end
+
+function FM:AnnounceFact(topic)
+	if not self:IsEnabled() then
+		return false, "FM_ERR_DISABLED"
+	end
+
+	local fact, err, args = self:GetFact(topic)
+	if not fact then
+		return false, err, args
+	end
+	if fact:len() > 250 then
+		return CM.SpecialOutput.RawTable, CES:Fit(fact, 240)
+	end
+	return CM.SpecialOutput.Raw, fact
+end
+
+function FM:IsEnabled()
+	return self.Settings.ENABLED
+end
+
+function FM:Enable()
+	self.Settings.ENABLED = true
+	return "FM_ENABLED"
+end
+
+function FM:Disable()
+	self.Settings.ENABLED = false
+	return "FM_DISABLED"
+end
+
+function FM:Toggle()
+	if self:IsEnabled() then
+		return self:Disable()
+	end
+	return self:Enable()
+end
+
+function FM:IsNoDupeEnabled()
+	return self.Settings.NODUPE
+end
+
+function FM:EnableNoDupe()
+	self.Settings.NODUPE = true
+	return "FM_NODUPE_ENABLED"
+end
+
+function FM:DisableNoDupe()
+	self.Settings.NODUPE = false
+	return "FM_NODUPE_DISABLED"
+end
+
+function FM:ToggleNoDupe()
+	if self:IsNoDupeEnabled() then
+		return self:DisableNoDupe()
+	end
+	return self:EnableNoDupe()
+end
diff --git a/facts/cat.lua b/facts/cat.lua
new file mode 100644
index 0000000..00b4495
--- /dev/null
+++ b/facts/cat.lua
@@ -0,0 +1,209 @@
+Command.FactsManager.Facts.Cat = {
+	"Every year, nearly four million cats are eaten in Asia.",
+	"On average, cats spend 2/3 of every day sleeping. That means a nine-year-old cat has been awake for only three years of its life.",
+	"Unlike dogs, cats do not have a sweet tooth. Scientists believe this is due to a mutation in a key taste receptor.",
+	"When a cat chases its prey, it keeps its head level. Dogs and humans bob their heads up and down.",
+	"The technical term for a cat's hairball is a \"bezoar\".",
+	"A group of cats is called a \"clowder\".",
+	"Female cats tend to be right pawed, while male cats are more often left pawed. Interestingly, while 90% of humans are right handed, the remaining 10% of lefties also tend to be male.",
+	"A cat cannot climb head first down a tree because its claws are curved the wrong way.",
+	"A cat can't climb head first down a tree because every claw on a cat's paw points the same way. To get down from a tree, a cat must back down.",
+	"Cats make about 100 different sounds. Dogs make only about 10.",
+	"A cat's brain is biologically more similar to a human brain than it is to a dog's. Both humans and cats have identical regions in their brains that are responsible for emotions.",
+	"There are more than 500 million domestic cats in the world, with approximately 40 recognized breeds.",
+	"Approximately 24 cat skins can make a coat.",
+	"While it is commonly thought that the ancient Egyptians were the first to domesticate cats, the oldest known pet cat was recently found in a 9,500-year-old grave on the Mediterranean island of Cyprus. This grave predates early Egyptian art depicting cats by 4,000 years or more.",
+	"During the time of the Spanish Inquisition, Pope Innocent VIII condemned cats as evil and thousands of cats were burned. Unfortunately, the widespread killing of cats led to an explosion of the rat population, which exacerbated the effects of the Black Death.",
+	"During the Middle Ages, cats were associated with withcraft, and on St. John's Day, people all over Europe would stuff them into sacks and toss the cats into bonfires. On holy days, people celebrated by tossing cats from church towers.",
+	"Cats are North America's most popular pets: there are 73 million cats compared to 63 million dogs. Over 30% of households in North America own a cat.",
+	"The first cat in space was a French cat named Felicette (a.k.a. \"Astrocat\") In 1963, France blasted the cat into outer space. Electrodes implanted in her brains sent neurological signals back to Earth. She survived the trip.",
+	"The group of words associated with cat (catt, cath, chat, katze) stem from the Latin catus, meaning domestic cat, as opposed to feles, or wild cat.",
+	"The term \"puss\" is the root of the principal word for \"cat\" in the Romanian term pisica and the root of secondary words in Lithuanian (puz) and Low German puus. Some scholars suggest that \"puss\" could be imitative of the hissing sound used to get a cat's attention. As a slang word for the female pudenda, it could be associated with the connotation of a cat being soft, warm, and fuzzy.",
+	"Approximately 40,000 people are bitten by cats in the U.S. annually.",
+	"According to Hebrew legend, Noah prayed to God for help protecting all the food he stored on the ark from being eaten by rats. In reply, God made the lion sneeze, and out popped a cat.",
+	"A cat's hearing is better than a dog's. And a cat can hear high-frequency sounds up to two octaves higher than a human.",
+	"A cat can travel at a top speed of approximately 31 mph (49 km) over a short distance.",
+	"A cat can jump up to five times its own height in a single bound.",
+	"Some cats have survived falls of over 65 feet (20 meters), due largely to their \"righting reflex.\" The eyes and balance organs in the inner ear tell it where it is in space so the cat can land on its feet. Even cats without a tail have this ability.",
+	"A cat rubs against people not only to be affectionate but also to mark out its territory with scent glands around its face. The tail area and paws also carry the cat's scent.",
+	"Researchers are unsure exactly how a cat purrs. Most veterinarians believe that a cat purrs by vibrating vocal folds deep in the throat. To do this, a muscle in the larynx opens and closes the air passage about 25 times per second.",
+	"When a family cat died in ancient Egypt, family members would mourn by shaving off their eyebrows. They also held elaborate funerals during which they drank wine and beat their breasts. The cat was embalmed with a sculpted wooden mask and the tiny mummy was placed in the family tomb or in a pet cemetery with tiny mummies of mice.",
+	"In 1888, more than 300,000 mummified cats were found an Egyptian cemetery. They were stripped of their wrappings and carted off to be used by farmers in England and the U.S. for fertilizer.",
+	"Most cats give birth to a litter of between one and nine kittens. The largest known litter ever produced was 19 kittens, of which 15 survived.",
+	"Smuggling a cat out of ancient Egypt was punishable by death. Phoenician traders eventually succeeded in smuggling felines, which they sold to rich people in Athens and other important cities.",
+	"The earliest ancestor of the modern cat lived about 30 million years ago. Scientists called it the Proailurus, which means \"first cat\" in Greek. The group of animals that pet cats belong to emerged around 12 million years ago.",
+	"The biggest wildcat today is the Siberian Tiger. It can be more than 12 feet (3.6 m) long (about the size of a small car) and weigh up to 700 pounds (317 kg).",
+	"The smallest wildcat today is the Black-footed cat. The females are less than 20 inches (50 cm) long and can weigh as little as 2.5 lbs (1.2 kg).",
+	"Many Egyptians worshipped the goddess Bast, who had a woman's body and a cat's head.",
+	"Mohammed loved cats and reportedly his favorite cat, Muezza, was a tabby. Legend says that tabby cats have an \"M\" for Mohammed on top of their heads because Mohammad would often rest his hand on the cat's head.",
+	"While many parts of Europe and North America consider the black cat a sign of bad luck, in Britain and Australia, black cats are considered lucky.",
+	"The most popular pedigreed cat is the Persian cat, followed by the Main Coon cat and the Siamese cat.",
+	"The smallest pedigreed cat is a Singapura, which can weigh just 4 lbs (1.8 kg), or about five large cans of cat food. The largest pedigreed cats are Maine Coon cats, which can weigh 25 lbs (11.3 kg), or nearly twice as much as an average cat weighs.",
+	"Some Siamese cats are cross-eyed to compensate for abnormal optic wiring.",
+	"Some Siamese cats appear cross-eyed because the nerves from the left side of the brain go to mostly the right eye and the nerves from the right side of the brain go mostly to the left eye. This causes some double vision, which the cat tries to correct by \"crossing\" its eyes.",
+	"Researchers believe the word \"tabby\" comes from Attabiyah, a neighborhood in Baghdad, Iraq. Tabbies got their name because their striped coats resembled the famous wavy patterns in the silk produced in this city.",
+	"Cats hate the water because their fur does not insulate well when it's wet. The Turkish Van, however, is one cat that likes swimming. Bred in central Asia, its coat has a unique texture that makes it water resistant.",
+	"The Egyptian Mau is probably the oldest breed of cat. In fact, the breed is so ancient that its name is the Egyptian word for \"cat\".",
+	"The costliest cat ever is named Little Nicky, who cost his owner $50,000. He is a clone of an older cat.",
+	"A cat usually has about 12 whiskers on each side of its face.",
+	"A cat's eyesight is both better and worse than humans. It is better because cats can see in much dimmer light and they have a wider peripheral view. It's worse because they don't see color as well as humans do. Scientists believe grass appears red to cats.",
+	"Spanish-Jewish folklore recounts that Adam's first wife, Lilith, became a black vampire cat, sucking the blood from sleeping babies. This may be the root of the superstition that a cat will smother a sleeping baby or suck out the child's breath.",
+	"Perhaps the most famous comic cat is the Cheshire Cat in Lewis Carroll's Alice in Wonderland. With the ability to disappear, this mysterious character embodies the magic and sorcery historically associated with cats.",
+	"In the original Italian version of Cinderella, the benevolent fairy godmother figure was a cat.",
+	"Two Siamese cats discovered microphones hidden by Russian spies in Holland's embassy in Moscow.",
+	"In Holland's embassy in Moscow, Russia, the staff noticed that the two Siamese cats kept meowing and clawing at the walls of the building. Their owners finally investigated, thinking they would find mice. Instead, they discovered microphones hidden by Russian spies. The cats heard the microphones when they turned on.",
+	"The little tufts of hair in a cat's ear that help keep out dirt direct sounds into the ear, and insulate the ears are called \"ear furnishings\".",
+	"The ability of a cat to find its way home is called \"psi-traveling.\" Experts think cats either use the angle of the sunlight to find their way or that cats have magnetized cells in their brains that act as compasses.",
+	"Isaac Newton invented the cat flap. Newton was experimenting in a pitch-black room. Spithead, one of his cats, kept opening the door and wrecking his experiment. The cat flap kept both Newton and Spithead happy.",
+	"The world's rarest coffee, Kopi Luwak, comes from Indonesia where a wildcat known as the luwak lives. The cat eats coffee berries and the coffee beans inside pass through the stomach. The beans are harvested from the cat's dung heaps and then cleaned and roasted. Kopi Luwak sells for about $500 for a 450 g (1 lb) bag.",
+	"A cat's jaw can't move sideways, so a cat can't chew large chunks of food.",
+	"A cat almost never meows at another cat, mostly just humans. Cats typically will spit, purr, and hiss at other cats.",
+	"A cat's back is extremely flexible because it has up to 53 loosely fitting vertebrae. Humans only have 34.",
+	"Many cat owners think their cats can read their minds.",
+	"Approximately 1/3 of cat owners think their pets are able to read their minds.",
+	"All cats have claws, and all except the cheetah sheath them when at rest.",
+	"Two members of the cat family are distinct from all others: the clouded leopard and the cheetah. The clouded leopard does not roar like other big cats, nor does it groom or rest like small cats. The cheetah is unique because it is a running cat; all others are leaping cats. They are leaping cats because they slowly stalk their prey and then leap on it.",
+	"A cat lover is called an Ailurophilia (Greek: cat+lover).",
+	"In Japan, cats are thought to have the power to turn into super spirits when they die. This may be because according to the Buddhist religion, the body of the cat is the temporary resting place of very spiritual people.",
+	"Most cats had short hair until about 100 years ago, when it became fashionable to own cats and experiment with breeding.",
+	"Cats have 32 muscles that control the outer ear (humans have only 6). A cat can independently rotate its ears 180 degrees.",
+	"During the nearly 18 hours a day that kittens sleep, an important growth hormone is released.",
+	"One reason that kittens sleep so much is because a growth hormone is released only during sleep.",
+	"Cats have about 130,000 hairs per square inch (20,155 hairs per square centimeter).",
+	"The heaviest cat on record is Himmy, a Tabby from Queensland, Australia. He weighed nearly 47 pounds (21 kg). He died at the age of 10.",
+	"The oldest cat on record was Crème Puff from Austin, Texas, who lived from 1967 to August 6, 2005, three days after her 38th birthday. A cat typically can live up to 20 years, which is equivalent to about 96 human years.",
+	"The lightest cat on record is a blue point Himalayan called Tinker Toy, who weighed 1 pound, 6 ounces (616 g). Tinker Toy was 2.75 inches (7 cm) tall and 7.5 inches (19 cm) long.",
+	"The tiniest cat on record is Mr. Pebbles, a 2-year-old cat that weighed 3 lbs (1.3 k) and was 6.1 inches (15.5 cm) high.",
+	"A commemorative tower was built in Scotland for a cat named Towser, who caught nearly 30,000 mice in her lifetime.",
+	"In the 1750s, Europeans introduced cats into the Americas to control pests.",
+	"The first cat show was organized in 1871 in London. Cat shows later became a worldwide craze.",
+	"The first cartoon cat was Felix the Cat in 1919. In 1940, Tom and Jerry starred in the first theatrical cartoon \"Puss Gets the Boot.\" In 1981 Andrew Lloyd Weber created the musical Cats, based on T.S. Eliot's Old Possum's Book of Practical Cats.",
+	"The normal body temperature of a cat is between 100.5 ° and 102.5 °F. A cat is sick if its temperature goes below 100 ° or above 103 °F.",
+	"A cat has 230 bones in its body. A human has 206. A cat has no collarbone, so it can fit through any opening the size of its head.",
+	"A cat's nose pad is ridged with a unique pattern, just like the fingerprint of a human.",
+	"If they have ample water, cats can tolerate temperatures up to 133 °F.",
+	"Foods that should not be given to cats include onions, garlic, green tomatoes, raw potatoes, chocolate, grapes, and raisins. Though milk is not toxic, it can cause an upset stomach and gas. Tylenol and aspirin are extremely toxic to cats, as are many common houseplants. Feeding cats dog food or canned tuna that's for human consumption can cause malnutrition.",
+	"A 2007 Gallup poll revealed that both men and women were equally likely to own a cat.",
+	"A cat's heart beats nearly twice as fast as a human heart, at 110 to 140 beats a minute.",
+	"Cat's sweat only through their paws.",
+	"Cats don't have sweat glands over their bodies like humans do. Instead, they sweat only through their paws.",
+	"In just seven years, a single pair of cats and their offspring could produce a staggering total of 420,000 kittens.",
+	"Relative to its body size, the clouded leopard has the biggest canines of all animals' canines. Its dagger-like teeth can be as long as 1.8 inches (4.5 cm).",
+	"Cats spend nearly 1/3 of their waking hours cleaning themselves.",
+	"Grown cats have 30 teeth. Kittens have about 26 temporary teeth, which they lose when they are about 6 months old.",
+	"A cat called Dusty has the known record for the most kittens. She had more than 420 kittens in her lifetime.",
+	"The largest cat breed is the Ragdoll. Male Ragdolls weigh between 12 and 20 lbs (5.4-9.0 k). Females weigh between 10 and 15 lbs (4.5-6.8 k).",
+	"Cats are extremely sensitive to vibrations. Cats are said to detect earthquake tremors 10 or 15 minutes before humans can.",
+	"In contrast to dogs, cats have not undergone major changes during their domestication process.",
+	"A female cat is called a queen or a molly.",
+	"In the 1930s, two Russian biologists discovered that color change in Siamese kittens depend on their body temperature. Siamese cats carry albino genes that work only when the body temperature is above 98° F. If these kittens are left in a very warm room, their points won't darken and they will stay a creamy white.",
+	"There are up to 60 million feral cats in the United States alone.",
+	"The oldest cat to give birth was Kitty who, at the age of 30, gave birth to two kittens. During her life, she gave birth to 218 kittens.",
+	"The most traveled cat is Hamlet, who escaped from his carrier while on a flight. He hid for seven weeks behind a pane. By the time he was discovered, he had traveled nearly 373,000 miles (600,000 km).",
+	"The most expensive cat was an Asian Leopard cat (ALC)-Domestic Shorthair (DSH) hybrid named Zeus. Zeus, who is 90% ALC and 10% DSH, has an asking price of £100,000 ($154,000).",
+	"The cat who holds the record for the longest non-fatal fall is Andy. He fell from the 16th floor of an apartment building (about 200 ft/.06 km) and survived.",
+	"The richest cat is Blackie who was left £15 million by his owner, Ben Rea.",
+	"The claws on the cat's back paws aren't as sharp as the claws on the front paws because the claws in the back don't retract and, consequently, become worn.",
+	"Both humans and cats have identical regions in the brain responsible for emotion.",
+	"A cat's brain is more similar to a man's brain than that of a dog.",
+	"A cat has more bones than a human; humans have 206, but the cat has 230 (some cites list 245 bones, and state that bones may fuse together as the cat ages).",
+	"Cats have 30 vertebrae (humans have 33 vertebrae during early development; 26 after the sacral and coccygeal regions fuse).",
+	"The cat's clavicle, or collarbone, does not connect with other bones but is buried in the muscles of the shoulder region. This lack of a functioning collarbone allows them to fit through any opening the size of their head.",
+	"The cat has 500 skeletal muscles (humans have 650).",
+	"Cats have 32 muscles that control the outer ear (compared to human's 6 muscles each). A cat can rotate its ears independently 180 degrees, and can turn in the direction of sound 10 times faster than those of the best watchdog.",
+	"Cats' hearing is much more sensitive than humans and dogs.",
+	"Cats' hearing stops at 65 khz (kilohertz); humans' hearing stops at 20 khz.",
+	"A cat sees about 6 times better than a human at night, and needs 1/6 the amount of of light that a human does - it has a layer of extra reflecting cells which absorb light.",
+	"Recent studies have shown that cats can see blue and green. There is disagreement as to whether they can see red.",
+	"A cat's field of vision is about 200 degrees.",
+	"Unlike humans, cats do not need to blink their eyes on a regular basis to keep their eyes lubricated.",
+	"Blue-eyed, pure white cats are frequently deaf.",
+	"It may take as long as 2 weeks for a kitten to be able to hear well.  Their eyes usually open between 7 and 10 days, but sometimes it happens in as little as 2 days.",
+	"Cats can judge within 3 inches the precise location of a sound being made 1 yard away.",
+	"Cats can be right-pawed or left-pawed.",
+	"A cat cannot see directly under its nose.",
+	"Almost 10% of a cat's bones are in its tail, and the tail is used to maintain balance.",
+	"The domestic cat is the only species able to hold its tail vertically while walking. You can also learn about your cat's present state of mind by observing the posture of his tail.",
+	"If a cat is frightened, the hair stands up fairly evenly all over the body; when the cat is threatened or is ready to attack, the hair stands up only in a narrow band along the spine and tail.",
+	"A cat has approximately 60 to 80 million olfactory cells (a human has between 5 and 20 million).",
+	"Cats have a special scent organ located in the roof of their mouth, called the Jacobson's organ. It analyzes smells - and is the reason why you will sometimes see your cat \"sneer\" (called the flehmen response or flehming) when they encounter a strong odor.",
+	"Cats dislike citrus scent.",
+	"A cat has a total of 24 whiskers, 4 rows of whiskers on each side. The upper two rows can move independently of the bottom two rows.",
+	"Cats have 30 teeth (12 incisors, 10 premolars, 4 canines, and 4 molars), while dogs have 42. Kittens have baby teeth, which are replaced by permanent teeth around the age of 7 months.",
+	"A cat's jaw has only up and down motion; it does not have any lateral, side to side motion, like dogs and humans.",
+	"A cat's tongue has tiny barbs on it.",
+	"Cats lap liquid from the underside of their tongue, not from the top.",
+	"Cats purr at the same frequency as an idling diesel engine, about 26 cycles per second.",
+	"Domestic cats purr both when inhaling and when exhaling.",
+	"The cat's front paw has 5 toes, but the back paws have 4. Some cats are born with as many as 7 front toes and extra back toes (polydactl).",
+	"Cats walk on their toes.",
+	"A domestic cat can sprint at about 31 miles per hour.",
+	"A kitten will typically weigh about 3 ounces at birth.  The typical male housecat will weigh between  7 and 9 pounds, slightly less for female housecats.",
+	"Cats take between 20-40 breaths per minute.",
+	"Normal body temperature for a cat is 102 degrees F.",
+	"A cat's normal pulse is 140-240 beats per minute, with an average of 195.",
+	"Cat's urine glows under a black light.",
+	"Cats lose almost as much fluid in the saliva while grooming themselves as they do through urination.",
+	"A cat has two vocal chords, and can make over 100 sounds.",
+	"Miacis, the primitive ancestor of cats, was a small, tree-living creature of the late Eocene period, some 45 to 50 million years ago.",
+	"Phoenician cargo ships are thought to have brought the first domesticated cats to Europe in about 900 BC.",
+	"The first true cats came into existence about 12 million years ago and were the Proailurus.",
+	"Experts traditionally thought that the Egyptians were the first to domesticate the cat, some 3,600 years ago.  But recent genetic and archaeological discoveries indicate that cat domestication began in the Fertile Crescent, perhaps around 10,000 years ago, when agriculture was getting under way. (per Scientific American, 6/10/2009)",
+	"Ancient Egyptian family members shaved their eyebrows in mourning when the family cat died.",
+	"In Siam, the cat was so revered that one rode in a chariot at the head of a parade celebrating the new king.",
+	"The Pilgrims were the first to introduce cats to North America.",
+	"The first breeding pair of Siamese cats arrived in England in 1884.",
+	"The first formal cat show was held in England in 1871; in America, in 1895.",
+	"The Maine Coon cat is America's only natural breed of domestic feline. It is 4 to 5 times larger than the Singapura, the smallest breed of cat.",
+	"There are approximately 100 breeds of cat.",
+	"The life expectancy of cats has nearly doubled since 1930 - from 8 to 16 years.",
+	"Cats have been domesticated for half as long as dogs have been.",
+	"Cats respond most readily to names that end in an \"ee\" sound.",
+	"The female cat reaches sexual maturity within 6 to 10 months; most veterinarians suggest spaying the female at 5 months, before her first heat period. The male cat usually reaches sexual maturity between 9 and 12 months.",
+	"Female cats are \"polyestrous,\" which means they may have many heat periods over the course of a year. A heat period lasts about 4 to 7 days if the female is bred; if she is not, the heat period lasts longer and recurs at regular intervals.",
+	"A female cat will be pregnant for approximately 9 weeks - between 62 and 65 days from conception to delivery.",
+	"Female felines are \"superfecund,\" which means that each of the kittens in her litter can have a different father.",
+	"Many cats love having their forehead gently stroked.",
+	"If a cat is frightened, put your hand over its eyes and forehead, or let him bury his head in your armpit to help calm him.",
+	"A cat will tremble or shiver when it is in extreme pain.",
+    "Cats should not be fed tuna exclusively, as it lacks taurine, an essential nutrient required for good feline health.",
+	"Purring does not always indicate that a cat is happy and healthy - some cats will purr loudly when they are terrified or in pain.",
+	"Not every cat gets \"high\" from catnip. If the cat doesn't have a specific gene, it won't react (about 20% do not have the gene). Catnip is non-addictive.",
+	"Cats must have fat in their diet because they can't produce it on their own.",
+	"While many cats enjoy milk, it will give some cats diarrhea.",
+	"A cat will spend nearly 30% of her life grooming herself.",
+	"When a domestic cat goes after mice, about 1 pounce in 3 results in a catch.",
+	"Mature cats with no health problems are in deep sleep 15 percent of their lives. They are in light sleep 50 percent of the time. That leaves just 35 percent awake time, or roughly 6-8 hours a day.",
+	"Cats come back to full alertness from the sleep state faster than any other creature.",
+	"A cat can jump 5 times as high as it is tall.",
+	"Cats can jump up to 7 times their tail length.",
+	"Spaying a female before her first or second heat will greatly reduce the threat of mammary cancer and uterine disease. A cat does not need to have at least 1 litter to be healthy, nor will they \"miss\" motherhood. A tabby named \"Dusty\" gave birth to 420 documented kittens in her lifetime, while \"Kitty\" gave birth to 2 kittens at the age of 30, having given birth to a documented 218 kittens in her lifetime.",
+	"Neutering a male cat will, in almost all cases, stop him from spraying (territorial marking), fighting with other males (at least over females), as well as lengthen his life and improve its quality.",
+	"Declawing a cat is the same as cutting a human's fingers off at the knuckle. There are several alternatives to a complete declawing, including trimming or a less radical (though more involved) surgery to remove the claws. Instead, train your cat to use a scratching post.",
+	"The average lifespan of an outdoor-only (feral and non-feral) is about 3 years; an indoor-only cat can live 16 years and longer. Some cats have been documented to have a longevity of 34 years.",
+	"Cats with long, lean bodies are more likely to be outgoing, and more protective and vocal than those with a stocky build.",
+	"A steady diet of dog food may cause blindness in your cat - it lacks taurine.",
+    "An estimated 50% of today's cat owners never take their cats to a veterinarian for health care. Too, because cats tend to keep their problems to themselves, many owners think their cat is perfectly healthy when actually they may be suffering from a life-threatening disease. Therefore, cats, on an average, are much sicker than dogs by the time they are brought to your veterinarian for treatment.",
+	"Never give your cat aspirin unless specifically prescribed by your veterinarian; it can be fatal. Never ever give Tylenol to a cat. And be sure to keep anti-freeze away from all animals - it's sweet and enticing, but deadly poison.",
+	"Most cats adore sardines.",
+	"A cat uses its whiskers for measuring distances. The whiskers of a cat are capable of registering very small changes in air pressure.",
+	"It has been scientifically proven that stroking a cat can lower one's blood pressure.",
+	"In 1987, cats overtook dogs as the number one pet in America (about 50 million cats resided in 24 million homes in 1986). About 37% of American homes today have at least one cat.",
+	"If your cat snores or rolls over on his back to expose his belly, it means he trusts you.",
+	"Cats respond better to women than to men, probably due to the fact that women's voices have a higher pitch.",
+	"In an average year, cat owners in the United States spend over $2 billion on cat food.",
+	"According to a Gallup poll, most American pet owners obtain their cats by adopting strays.",
+	"When your cats rubs up against you, she is actually marking you as \"hers\" with her scent. If your cat pushes his face against your head, it is a sign of acceptance and affection.",
+	"Contrary to popular belief, people are not allergic to cat fur, dander, saliva, or urine - they are allergic to \"sebum\", a fatty substance secreted by the cat's sebaceous glands. More interesting, someone who is allergic to one cat may not be allergic to another cat. Though there isn't (yet) a way of predicting which cat is more likely to cause allergic reactions, it has been proven that male cats shed much greater amounts of allergen than females. A neutered male, however, sheds much less than a non-neutered male.",
+	"Cat bites are more likely to become infected than dog bites.",
+	"In just 7 years, one un-spayed female cat and one un-neutered male cat and their offspring can result in 420,000 kittens.",
+	"Some notable people who disliked cats:  Napoleon Bonaparte, Dwight D. Eisenhower, Hitler.",
+	"Six-toed kittens are so common in Boston and surrounding areas of Massachusetts that experts consider it an established mutation.",
+	"The silks created by weavers in Baghdad were inspired by the beautiful and varied colors and markings of cat coats. These fabrics were called \"tabby\" by European traders.",
+	"Cat families usually play best in even numbers. Cats and kittens should be acquired in pairs whenever possible.",
+	"Cats lived with soldiers in trenches, where they killed mice during World War I.",
+    "A male cat is called a \"tom\" (or a \"gib,\" if neutered), and a female is called a \"molly\" or \"queen.\" The father of a cat is its \"sire,\" and mother is its \"dam.\" An immature cat of either sex is called a \"kitten.\" A group of cats is a \"clowder\".",
+    "Cat litter was \"invented\" in 1947 when Edward Lowe asked his neighbor to try a dried, granulated clay used to sop up grease spills in factories. (In 1990, Mr. Lowe sold his business for $200 million.)",
+    "The cat appears to be the only domestic companion animal not mentioned in the Bible.",
+	"The cat does not exist in the Chinese Zodiac, but it does in the Vietnamese version, instead of rabbit."
+}
diff --git a/load.xml b/load.xml
index d465a72..46c749e 100644
--- a/load.xml
+++ b/load.xml
@@ -27,19 +27,20 @@
 	<Script file="Logger.lua" />
 	<Script file="BattleNetTools.lua" />
 	<Script file="GroupTools.lua" />
+	<Script file="AddonComm.lua" />
 	<Script file="AuthManager.lua" />
 	<Script file="PlayerManager.lua" />
 	<Script file="EmoteManager.lua" />
 	<Script file="QueueManager.lua" />
 	<Script file="RollManager.lua" />
 	<Script file="LootManager.lua" />
-	<Script file="AddonComm.lua" />
 	<Script file="DeathManager.lua" />
 	<Script file="SummonManager.lua" />
 	<Script file="InviteManager.lua" />
 	<Script file="DuelManager.lua" />
 	<Script file="RoleManager.lua" />
 	<Script file="ReadyCheckManager.lua" />
+	<Include file="FactsLoader.xml" />
 	<Script file="CommandManager.lua" />
 	<Script file="ChatManager.lua" />
 	<Script file="Events.lua" />