@@ -1,5 +1,6 @@
 MAX_ACHIEVEMENT_ALERTS = 2;
 LOOT_WON_ALERT_FRAMES = {};
+LOOT_UPGRADE_ALERT_FRAMES = {};
 MONEY_WON_ALERT_FRAMES = {};
 DELAYED_ACHIEVEMENT_ALERTS = {};
 ACHIEVEMENT_ID_INDEX = 1;
@@ -14,8 +15,13 @@ function AlertFrame_OnLoad (self)
 	self:RegisterEvent("CHALLENGE_MODE_COMPLETED");
 	self:RegisterEvent("LOOT_ITEM_ROLL_WON");
 	self:RegisterEvent("SHOW_LOOT_TOAST");
+	self:RegisterEvent("SHOW_LOOT_TOAST_UPGRADE");
+	self:RegisterEvent("SHOW_PVP_FACTION_LOOT_TOAST");
 	self:RegisterEvent("PET_BATTLE_CLOSE");
 	self:RegisterEvent("STORE_PRODUCT_DELIVERED");
+	self:RegisterEvent("GARRISON_BUILDING_ACTIVATABLE");
+	self:RegisterEvent("GARRISON_MISSION_FINISHED");
+	self:RegisterEvent("GARRISON_FOLLOWER_ADDED");
 end
 
 function AlertFrame_OnEvent (self, event, ...)
@@ -36,7 +42,7 @@ function AlertFrame_OnEvent (self, event
 		
 		CriteriaAlertFrame_ShowAlert(id, criteria);
 	elseif ( event == "LFG_COMPLETION_REWARD" ) then
-		if ( C_Scenario.IsInScenario() ) then
+		if ( C_Scenario.IsInScenario() and not C_Scenario.TreatScenarioAsDungeon() ) then
 			ScenarioAlertFrame_ShowAlert();
 		else
 			DungeonCompletionAlertFrame_ShowAlert();
@@ -49,7 +55,7 @@ function AlertFrame_OnEvent (self, event
 		local itemLink, quantity, rollType, roll = ...;
 		LootWonAlertFrame_ShowAlert(itemLink, quantity, rollType, roll);
 	elseif ( event == "SHOW_LOOT_TOAST" ) then
-		local typeIdentifier, itemLink, quantity, specID, isPersonal = ...;
+		local typeIdentifier, itemLink, quantity, specID, sex, isPersonal = ...;
 		if ( typeIdentifier == "item" ) then
 			LootWonAlertFrame_ShowAlert(itemLink, quantity, nil, nil, specID);
 		elseif ( typeIdentifier == "money" ) then
@@ -58,11 +64,32 @@ function AlertFrame_OnEvent (self, event
 			-- only toast currency for personal loot
 			LootWonAlertFrame_ShowAlert(itemLink, quantity, nil, nil, specID, true);
 		end
+	elseif ( event == "SHOW_PVP_FACTION_LOOT_TOAST" ) then
+		local typeIdentifier, itemLink, quantity, specID, sex, isPersonal = ...;
+		if ( typeIdentifier == "item" ) then
+			LootWonAlertFrame_ShowAlert(itemLink, quantity, nil, nil, specID, false, true);
+		elseif ( typeIdentifier == "money" ) then
+			MoneyWonAlertFrame_ShowAlert(quantity);
+		elseif ( (isPersonal == true) and (typeIdentifier == "currency") ) then
+			-- only toast currency for personal loot
+			LootWonAlertFrame_ShowAlert(itemLink, quantity, nil, nil, specID, false, true);
+		end
+	elseif ( event == "SHOW_LOOT_TOAST_UPGRADE") then
+		local itemLink, quantity, specID, sex, baseQuality, isPersonal = ...;
+		LootUpgradeFrame_ShowAlert(itemLink, quantity, specID, baseQuality);
 	elseif ( event == "PET_BATTLE_CLOSE" ) then
 		AchievementAlertFrame_FireDelayedAlerts();
 	elseif ( event == "STORE_PRODUCT_DELIVERED" ) then
-		local icon, name = ...;
-		StorePurchaseAlertFrame_ShowAlert(icon, name);
+		local icon, name, itemID = ...;
+		StorePurchaseAlertFrame_ShowAlert(icon, name, itemID);
+	elseif ( event == "GARRISON_BUILDING_ACTIVATABLE" ) then
+		local name = ...;
+		GarrisonBuildingAlertFrame_ShowAlert(name);
+	elseif ( event == "GARRISON_MISSION_FINISHED" ) then
+		GarrisonMissionAlertFrame_ShowAlert(...);
+	elseif ( event == "GARRISON_FOLLOWER_ADDED" ) then
+		local name, displayID, level, quality, isUpgraded = ...;
+		GarrisonFollowerAlertFrame_ShowAlert(name, displayID, level, quality, isUpgraded);
 	end
 end
 
@@ -101,6 +128,7 @@ function AlertFrame_FixAnchors()
 	alertAnchor = AlertFrame_SetLootAnchors(alertAnchor); --This needs to be first as it doesn't actually anchor anything.
 	alertAnchor = AlertFrame_SetStorePurchaseAnchors(alertAnchor);
 	alertAnchor = AlertFrame_SetLootWonAnchors(alertAnchor);
+	alertAnchor = AlertFrame_SetLootUpgradeFrameAnchors(alertAnchor);
 	alertAnchor = AlertFrame_SetMoneyWonAnchors(alertAnchor);
 	alertAnchor = AlertFrame_SetAchievementAnchors(alertAnchor);
 	alertAnchor = AlertFrame_SetCriteriaAnchors(alertAnchor);
@@ -109,6 +137,9 @@ function AlertFrame_FixAnchors()
 	alertAnchor = AlertFrame_SetScenarioAnchors(alertAnchor);
 	alertAnchor = AlertFrame_SetGuildChallengeAnchors(alertAnchor);
 	alertAnchor = AlertFrame_SetDigsiteCompleteToastFrameAnchors(alertAnchor);
+	alertAnchor = AlertFrame_SetGarrisonBuildingAlertFrameAnchors(alertAnchor);
+	alertAnchor = AlertFrame_SetGarrisonMissionAlertFrameAnchors(alertAnchor);
+	alertAnchor = AlertFrame_SetGarrisonFollowerAlertFrameAnchors(alertAnchor);
 end
 
 function AlertFrame_SetLootAnchors(alertAnchor)
@@ -147,6 +178,17 @@ function AlertFrame_SetLootWonAnchors(al
 	return alertAnchor;
 end
 
+function AlertFrame_SetLootUpgradeFrameAnchors(alertAnchor)
+	for i=1, #LOOT_UPGRADE_ALERT_FRAMES do
+		local frame = LOOT_UPGRADE_ALERT_FRAMES[i];
+		if ( frame:IsShown() ) then
+			frame:SetPoint("BOTTOM", alertAnchor, "TOP", 0, 10);
+			alertAnchor = frame;
+		end
+	end
+	return alertAnchor;
+end
+
 function AlertFrame_SetMoneyWonAnchors(alertAnchor)
 	for i=1, #MONEY_WON_ALERT_FRAMES do
 		local frame = MONEY_WON_ALERT_FRAMES[i];
@@ -230,6 +272,30 @@ function AlertFrame_SetDigsiteCompleteTo
 	return alertAnchor;
 end
 
+function AlertFrame_SetGarrisonBuildingAlertFrameAnchors(alertAnchor)
+	if ( GarrisonBuildingAlertFrame and GarrisonBuildingAlertFrame:IsShown() ) then
+		GarrisonBuildingAlertFrame:SetPoint("BOTTOM", alertAnchor, "TOP", 0, 10);
+		alertAnchor = GarrisonBuildingAlertFrame;
+	end
+	return alertAnchor;
+end
+
+function AlertFrame_SetGarrisonMissionAlertFrameAnchors(alertAnchor)
+	if ( GarrisonMissionAlertFrame and GarrisonMissionAlertFrame:IsShown() ) then
+		GarrisonMissionAlertFrame:SetPoint("BOTTOM", alertAnchor, "TOP", 0, 10);
+		alertAnchor = GarrisonMissionAlertFrame;
+	end
+	return alertAnchor;
+end
+
+function AlertFrame_SetGarrisonFollowerAlertFrameAnchors(alertAnchor)
+	if ( GarrisonFollowerAlertFrame and GarrisonFollowerAlertFrame:IsShown() ) then
+		GarrisonFollowerAlertFrame:SetPoint("BOTTOM", alertAnchor, "TOP", 0, 10);
+		alertAnchor = GarrisonFollowerAlertFrame;
+	end
+	return alertAnchor;
+end
+
 -- [[ GuildChallengeAlertFrame ]] --
 function GuildChallengeAlertFrame_ShowAlert(...)
 	local challengeType, count, max = ...;
@@ -495,6 +561,7 @@ function ScenarioAlertFrame_ShowAlert()
 	AlertFrame_FixAnchors();
 end
 
+-- [[ ChallengeModeAlertFrameReward ]] --
 function ChallengeModeAlertFrameReward_SetReward(frame, index)
 	local itemID, name, texturePath, quantity, isCurrency = GetChallengeModeCompletionReward(index);
 	SetPortraitToTexture(frame.texture, texturePath);
@@ -775,8 +842,12 @@ function AchievementAlertFrame_OnClick (
 end
 
 -- [[ LootWonAlertFrameTemplate ]] --
-
-function LootWonAlertFrame_ShowAlert(itemLink, quantity, rollType, roll, specID, isCurrency)
+LOOTWONALERTFRAME_VALUES={
+	Default = { bgOffsetX=0, bgOffsetY=0, labelOffsetX=7, labelOffsetY=5, labelText=YOU_WON_LABEL},
+	Horde = { bgOffsetX=-1, bgOffsetY=-1, labelOffsetX=7, labelOffsetY=3, labelText=YOU_EARNED_LABEL, pvpAtlas="loottoast-bg-horde"},
+	Alliance = { bgOffsetX=-1, bgOffsetY=-1, labelOffsetX=7, labelOffsetY=3, labelText=YOU_EARNED_LABEL, pvpAtlas="loottoast-bg-alliance"},
+}
+function LootWonAlertFrame_ShowAlert(itemLink, quantity, rollType, roll, specID, isCurrency, showFactionBG)
 	local frame;
 	for i=1, #LOOT_WON_ALERT_FRAMES do
 		local lootWon = LOOT_WON_ALERT_FRAMES[i];
@@ -791,13 +862,13 @@ function LootWonAlertFrame_ShowAlert(ite
 		table.insert(LOOT_WON_ALERT_FRAMES, frame);
 	end
 
-	LootWonAlertFrame_SetUp(frame, itemLink, quantity, rollType, roll, specID, isCurrency);
+	LootWonAlertFrame_SetUp(frame, itemLink, quantity, rollType, roll, specID, isCurrency, showFactionBG);
 	AlertFrame_AnimateIn(frame);
 	AlertFrame_FixAnchors();
 end
 
 -- NOTE - This may also be called for an externally created frame. (E.g. bonus roll has its own frame)
-function LootWonAlertFrame_SetUp(self, itemLink, quantity, rollType, roll, specID, isCurrency)
+function LootWonAlertFrame_SetUp(self, itemLink, quantity, rollType, roll, specID, isCurrency, showFactionBG)
 	local itemName, itemHyperLink, itemRarity, itemTexture;
 	if (isCurrency == true) then
 		itemName, _, itemTexture, _, _, _, _, itemRarity = GetCurrencyInfo(itemLink);
@@ -807,11 +878,28 @@ function LootWonAlertFrame_SetUp(self, i
 		itemName, itemHyperLink, itemRarity, _, _, _, _, _, _, itemTexture = GetItemInfo(itemLink);
 	end
 
+	local windowInfo = LOOTWONALERTFRAME_VALUES.Default;
+	if( showFactionBG ) then
+		local factionGroup = UnitFactionGroup("player");
+		windowInfo = LOOTWONALERTFRAME_VALUES[factionGroup]
+		self.PvPBackground:SetAtlas(windowInfo.pvpAtlas, true);
+		self.PvPBackground:SetPoint("CENTER", windowInfo.bgOffsetX, windowInfo.bgOffsetY);
+		self.Background:Hide();
+		self.PvPBackground:Show();	
+	else
+		self.Background:Show();
+		self.PvPBackground:Hide();
+	end
+	self.Label:SetText(windowInfo.labelText);
+	self.Label:SetPoint("TOPLEFT", self.Icon, "TOPRIGHT", windowInfo.labelOffsetX, windowInfo.labelOffsetY);
+	
+	self.isCurrency = isCurrency;
+
 	self.Icon:SetTexture(itemTexture);
 	self.ItemName:SetText(itemName);
 	local color = ITEM_QUALITY_COLORS[itemRarity];
 	self.ItemName:SetVertexColor(color.r, color.g, color.b);
-	self.IconBorder:SetTexCoord(unpack(LOOT_BORDER_QUALITY_COORDS[itemRarity] or LOOT_BORDER_QUALITY_COORDS[ITEM_QUALITY_UNCOMMON]));
+	self.IconBorder:SetTexCoord(unpack(LOOT_BORDER_QUALITY_COORDS[itemRarity] or LOOT_BORDER_QUALITY_COORDS[LE_ITEM_QUALITY_UNCOMMON]));
 	
 	if ( specID and specID > 0 ) then
 		local id, name, description, texture, background, role, class = GetSpecializationInfoByID(specID);
@@ -842,6 +930,85 @@ function LootWonAlertFrame_SetUp(self, i
 	PlaySoundKitID(31578);	--UI_EpicLoot_Toast
 end
 
+function LootWonAlertFrame_OnClick(self)
+	if (self.isCurrency) then 
+		return;
+	end
+	local itemID = GetItemIDFromHyperlink(self.hyperlink);
+	local slot = SearchBagsForItem(itemID);
+	if (slot >= 0) then
+		OpenBag(slot);
+	end
+end
+
+-- [[ LootUpgradeFrameTemplate ]] --
+LOOTUPGRADEFRAME_QUALITY_TEXTURES = {
+	[LE_ITEM_QUALITY_UNCOMMON]	= {border = "loottoast-itemborder-green",	arrow = "loottoast-arrow-green"},
+	[LE_ITEM_QUALITY_RARE]		= {border = "loottoast-itemborder-blue",	arrow = "loottoast-arrow-blue"},
+	[LE_ITEM_QUALITY_EPIC]		= {border = "loottoast-itemborder-purple",	arrow = "loottoast-arrow-purple"},
+	[LE_ITEM_QUALITY_LEGENDARY]	= {border = "loottoast-itemborder-orange",	arrow = "loottoast-arrow-orange"},
+}
+function LootUpgradeFrame_ShowAlert(itemLink, quantity, specID, baseQuality)
+	local frame;
+	for i=1, #LOOT_UPGRADE_ALERT_FRAMES do
+		local lootFrame = LOOT_UPGRADE_ALERT_FRAMES[i];
+		if ( not lootFrame:IsShown() ) then
+			frame = lootFrame;
+			break;
+		end
+	end
+
+	if ( not frame ) then
+		frame = CreateFrame("Button", nil, UIParent, "LootUpgradeFrameTemplate");
+		table.insert(LOOT_UPGRADE_ALERT_FRAMES, frame);
+	end
+
+	LootUpgradeFrame_SetUp(frame, itemLink, quantity, specID, baseQuality);
+	AlertFrame_AnimateIn(frame);
+	AlertFrame_FixAnchors();
+end
+
+function LootUpgradeFrame_SetUp(self, itemLink, quantity, specID, baseQuality)
+	local itemName, itemHyperLink, itemRarity, _, _, _, _, _, _, itemTexture = GetItemInfo(itemLink);
+	local baseQualityColor = ITEM_QUALITY_COLORS[baseQuality];
+	local upgradeQualityColor = ITEM_QUALITY_COLORS[itemRarity];
+	
+	self.Icon:SetTexture(itemTexture);
+	self.BaseQualityItemName:SetText(itemName);
+	self.BaseQualityItemName:SetTextColor(baseQualityColor.r, baseQualityColor.g, baseQualityColor.b);
+	self.UpgradeQualityItemName:SetText(itemName);
+	self.UpgradeQualityItemName:SetTextColor(upgradeQualityColor.r, upgradeQualityColor.g, upgradeQualityColor.b);
+	self.WhiteText:SetText(itemName);
+	self.WhiteText2:SetText(itemName);
+	self.TitleText:SetText(format(LOOTUPGRADEFRAME_TITLE, _G["ITEM_QUALITY"..itemRarity.."_DESC"]));
+	self.TitleText:SetTextColor(upgradeQualityColor.r, upgradeQualityColor.g, upgradeQualityColor.b);
+	
+	local baseTexture = LOOTUPGRADEFRAME_QUALITY_TEXTURES[baseQuality] or LOOTUPGRADEFRAME_QUALITY_TEXTURES[LE_ITEM_QUALITY_UNCOMMON];
+	local upgradeTexture = LOOTUPGRADEFRAME_QUALITY_TEXTURES[itemRarity] or LOOTUPGRADEFRAME_QUALITY_TEXTURES[LE_ITEM_QUALITY_UNCOMMON];
+	self.BaseQualityBorder:SetAtlas(baseTexture.border, true);
+	self.UpgradeQualityBorder:SetAtlas(upgradeTexture.border, true);
+	
+	for i = 1, self.numArrows do
+		self["Arrow"..i]:SetAtlas(upgradeTexture.arrow, true);
+	end
+
+	self.hyperlink = itemHyperLink;
+	PlaySoundKitID(31578);	--UI_EpicLoot_Toast
+end
+
+function LootUpgradeFrame_OnClick(self)
+	local itemID = GetItemIDFromHyperlink(self.hyperlink);
+	local slot = SearchBagsForItem(itemID);
+	if (slot >= 0) then
+		OpenBag(slot);
+	end
+end
+
+function LootUpgradeFrame_AnimDone(self)
+	self:GetParent().animIn:Stop();
+	self:GetParent():Hide();
+end
+
 -- [[ MoneyWonAlertFrameTemplate ]] --
 
 function MoneyWonAlertFrame_ShowAlert(amount)
@@ -880,10 +1047,11 @@ function DigsiteCompleteToastFrame_ShowA
 end
 
 -- [[ StorePurchaseAlertFrame ]] --
-function StorePurchaseAlertFrame_ShowAlert(icon, name)
+function StorePurchaseAlertFrame_ShowAlert(icon, name, itemID)
 	StorePurchaseAlertFrame.Icon:SetTexture(icon);
 	StorePurchaseAlertFrame.Title:SetFontObject(GameFontNormalLarge);
 	StorePurchaseAlertFrame.Title:SetText(name);
+	StorePurchaseAlertFrame.itemID = itemID;
 	if ( StorePurchaseAlertFrame.Title:IsTruncated() ) then
 		StorePurchaseAlertFrame.Title:SetFontObject(GameFontNormal);
 	end
@@ -891,3 +1059,84 @@ function StorePurchaseAlertFrame_ShowAle
 	AlertFrame_FixAnchors();
 	PlaySound("UI_igStore_PurchaseDelivered_Toast_01");
 end
+
+function StorePurchaseAlertFrame_OnClick(self)
+	local slot = SearchBagsForItem(self.itemID);
+	if (slot >= 0) then
+		OpenBag(slot);
+	end
+end
+
+-- [[ GarrisonBuildingAlertFrame ]] --
+function GarrisonBuildingAlertFrame_ShowAlert(name)
+	GarrisonLandingPageMinimapButton.MinimapLoopPulseAnim:Play();
+	GarrisonBuildingAlertFrame.Name:SetFormattedText(GARRISON_BUILDING_COMPLETE_TOAST, name);
+	AlertFrame_AnimateIn(GarrisonBuildingAlertFrame);
+	AlertFrame_FixAnchors();
+	PlaySound("AuctionWindowOpen");
+end
+
+-- [[ GarrisonMissionAlertFrame ]] --
+function GarrisonMissionAlertFrame_ShowAlert(missionID)
+	GarrisonLandingPageMinimapButton.MinimapLoopPulseAnim:Play();
+	local missionInfo = C_Garrison.GetBasicMissionInfo(missionID);
+	GarrisonMissionAlertFrame.Name:SetText(missionInfo.name);
+	GarrisonMissionAlertFrame.MissionType:SetAtlas(missionInfo.typeAtlas);
+	AlertFrame_AnimateIn(GarrisonMissionAlertFrame);
+	AlertFrame_FixAnchors();
+	PlaySound("AuctionWindowOpen");
+end
+
+-- [[ GarrisonFollowerAlertFrame ]] --
+GARRISON_FOLLOWER_QUALITY_TEXTURE_SUFFIXES = {
+	[LE_ITEM_QUALITY_UNCOMMON] = "Uncommon",
+	[LE_ITEM_QUALITY_EPIC] = "Epic",
+	[LE_ITEM_QUALITY_RARE] = "Rare",
+}
+function GarrisonFollowerAlertFrame_ShowAlert(name, displayID, level, quality, isUpgraded)
+	GarrisonFollowerAlertFrame.Name:SetText(name);
+	local texSuffix = GARRISON_FOLLOWER_QUALITY_TEXTURE_SUFFIXES[quality]
+	if (texSuffix) then
+		GarrisonFollowerAlertFrame.FollowerBG:SetAtlas("Garr_FollowerToast-"..texSuffix, true);
+		GarrisonFollowerAlertFrame.FollowerBG:Show();
+	else
+		GarrisonFollowerAlertFrame.FollowerBG:Hide();
+	end
+	SetPortraitTexture(GarrisonFollowerAlertFrame.PortraitFrame.Portrait, displayID);
+	GarrisonFollowerAlertFrame.PortraitFrame.Level:SetText(level);
+	local color = BAG_ITEM_QUALITY_COLORS[quality];
+	if (color) then
+		GarrisonFollowerAlertFrame.PortraitFrame.LevelBorder:SetVertexColor(color.r, color.g, color.b);
+		GarrisonFollowerAlertFrame.PortraitFrame.PortraitRing:SetVertexColor(color.r, color.g, color.b);
+	else
+		GarrisonFollowerAlertFrame.PortraitFrame.LevelBorder:SetVertexColor(1, 1, 1);
+		GarrisonFollowerAlertFrame.PortraitFrame.PortraitRing:SetVertexColor(1, 1, 1);
+	end
+	
+	GarrisonFollowerAlertFrame.ArrowsAnim:Stop();	
+	if ( isUpgraded ) then
+		local upgradeTexture = LOOTUPGRADEFRAME_QUALITY_TEXTURES[quality] or LOOTUPGRADEFRAME_QUALITY_TEXTURES[LE_ITEM_QUALITY_UNCOMMON];
+		for i = 1, GarrisonFollowerAlertFrame.Arrows.numArrows do
+			GarrisonFollowerAlertFrame.Arrows["Arrow"..i]:SetAtlas(upgradeTexture.arrow, true);
+		end
+		GarrisonFollowerAlertFrame.Title:SetText(GARRISON_FOLLOWER_ADDED_UPGRADED_TOAST);
+		GarrisonFollowerAlertFrame.DieIcon:Show();
+		GarrisonFollowerAlertFrame.ArrowsAnim:Play();
+	else
+		GarrisonFollowerAlertFrame.Title:SetText(GARRISON_FOLLOWER_ADDED_TOAST);
+		GarrisonFollowerAlertFrame.DieIcon:Hide();
+	end
+
+	AlertFrame_AnimateIn(GarrisonFollowerAlertFrame);
+	
+	AlertFrame_FixAnchors();
+	PlaySound("AuctionWindowOpen");
+end
+
+function GarrisonAlertFrame_OnClick(self)
+	self:Hide();
+	if (not GarrisonLandingPage) then
+		Garrison_LoadUI();
+	end
+	ShowUIPanel(GarrisonLandingPage);
+end