Quantcast

Made the favorite and leveling tooltip modifications use the double-line function to stack the list vertically for 3 or fewer items, so the tooltip doesn't go super-wide.

pschifferer [11-07-09 - 14:35]
Made the favorite and leveling tooltip modifications use the double-line function to stack the list vertically for 3 or fewer items, so the tooltip doesn't go super-wide.
Filename
CauldronMain.lua
Locale/Cauldron-enUS.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 3973fcb..5657b38 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -996,17 +996,17 @@ function Cauldron:AddToTooltip(tooltip, id)
 	-- add favorite info
 	local favSkills = filterFavoriteSkills(skillList);
 	if favSkills and #favSkills > 0 then
-		local favInfo = "";
 		if #favSkills > 3 then
 			-- if the skill list has more than 3 items, summarize
-			favInfo = string.format(L["Needed for %1$d favorite skills"], #favSkills);
+			local favInfo = string.format(L["Needed for %1$d favorite skills"], #favSkills);
+			tooltip:AddLine("|r"..favInfo.."|r");
 		else
 			-- if the skill list is 3 or less, list all
-			favInfo = L["Needed for favorites: "];
 			for i,skill in ipairs(favSkills) do
 				local skillName,skillLink = string.split(";", skill, 2);
+				local favInfo = L["Needed for favorites:"];
 				if i > 1 then
-					favInfo = favInfo..", ";
+					favInfo = "";
 				end
 				local skillInfo = Cauldron:GetSkillInfoForLink(skillLink);
 				local color;
@@ -1024,26 +1024,25 @@ function Cauldron:AddToTooltip(tooltip, id)
 				if color then
 					colorStr = string.format("|cff%02x%02x%02x", (color.r*255), (color.g*255), (color.b*255));
 				end
-				favInfo = favInfo..colorStr..skillInfo.name.."|r";
+				tooltip:AddDoubleLine(favInfo, colorStr..skillInfo.name.."|r");
 			end
 		end
-		tooltip:AddLine("|r"..favInfo.."|r");
 	end

 	-- add skill-up info
 	local skillups = filterSkillups(skillList);
 	if skillups and #skillups > 0 then
-		local levelInfo = "";
 		if #skillups > 3 then
 			-- if the skill list has more than 3 items, summarize
-			levelInfo = string.format(L["Needed for %1$d skills for leveling"], #skillups);
+			local levelInfo = string.format(L["Needed for %1$d skills for leveling"], #skillups);
+			tooltip:AddLine("|r"..levelInfo.."|r");
 		else
 			-- if the skill list is 3 or less, list all
-			levelInfo = L["Needed for leveling: "];
 			for i,skill in ipairs(skillups) do
 				local skillName,skillLink = string.split(";", skill, 2);
+				local levelInfo = L["Needed for leveling:"];
 				if i > 1 then
-					levelInfo = levelInfo..", ";
+					levelInfo = "";
 				end
 				local skillInfo = Cauldron:GetSkillInfoForLink(skillLink);
 				local color;
@@ -1056,7 +1055,7 @@ function Cauldron:AddToTooltip(tooltip, id)
 				if color then
 					colorStr = string.format("|cff%02x%02x%02x", (color.r*255), (color.g*255), (color.b*255));
 				end
-				levelInfo = levelInfo..colorStr..skillInfo.name.."|r";
+				tooltip:AddDoubleLine(levelInfo, colorStr..skillInfo.name.."|r");
 			end
 		end
 		tooltip:AddLine("|r"..levelInfo.."|r");
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index 773434a..f32aec4 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -136,9 +136,9 @@ L["(%1$d stacks, %2$d total)"] = true
 L["(%1$d total)"] = true

 L["Needed for %1$d favorite skills"] = true
-L["Needed for favorites: "] = true
+L["Needed for favorites:"] = true
 L["Needed for %1$d skills for leveling"] = true
-L["Needed for leveling: "] = true
+L["Needed for leveling:"] = true

 -- error messages
 L["Crafting %1$s requires the %2$s skill."] = true