Quantcast WoWInterface - View Single Post - Sorting Tooltip for money by Faction
View Single Post
12-29-18, 11:31 AM   #12
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 305
so this is the code I use that hides or shows the Factions gold:
Code:
			local totalGold = 0;	
			local totalAlianceGold = 0;
			local totalHordeGold = 0;
			local totalNeutralGold = 0;
			
			if db['Gold'][myPlayerRealm]['Alliance'] == nil then
				GameTooltip:AddDoubleLine(" ", " ")
			else
				GameTooltip:AddLine("Alliance Character's:")
				for k,v in pairs(db['Gold'][myPlayerRealm]['Alliance']) do
					GameTooltip:AddDoubleLine(iconAlliance..k, formatMoney(v), 1, 1, 1, 1, 1, 1)
					totalAlianceGold = totalAlianceGold + v;
				end
				GameTooltip:AddDoubleLine("Total Alliance Gold", formatMoney(totalAlianceGold))
			end
			
			GameTooltip:AddDoubleLine(" ", " ")	
			
			if db['Gold'][myPlayerRealm]['Horde'] == nil then
				GameTooltip:AddDoubleLine(" ", " ")
			else
				GameTooltip:AddLine("Horde Character's:")
				for k,v in pairs(db['Gold'][myPlayerRealm]['Horde']) do
					GameTooltip:AddDoubleLine(iconHorde..k, formatMoney(v), 1, 1, 1, 1, 1, 1)
					totalHordeGold = totalHordeGold + v;
				end
				GameTooltip:AddDoubleLine("Total Horde Gold", formatMoney(totalHordeGold))
			end
			
			GameTooltip:AddDoubleLine(" ", " ")	
			
			if db['Gold'][myPlayerRealm]['Neutral'] == nil then
				GameTooltip:AddDoubleLine(" ", " ")
			else
				GameTooltip:AddLine("Neutral Character's:")
				for k,v in pairs(db['Gold'][myPlayerRealm]['Neutral']) do
					GameTooltip:AddDoubleLine(iconNuetral..k, formatMoney(v), 1, 1, 1, 1, 1, 1)
					totalNeutralGold = totalNeutralGold + v;
				end
				GameTooltip:AddDoubleLine("Total Neutral Gold", formatMoney(totalNeutralGold))
			end
			
			local totalServerGold = totalAlianceGold + totalHordeGold + totalNeutralGold
			
			GameTooltip:AddLine" "
			GameTooltip:AddDoubleLine("Total Gold for "..myPlayerRealm, formatMoney(totalServerGold))
can it be condensed?
  Reply With Quote