Quantcast

Re-added display of parsed info, with a hotkey to show it

Kevin Lyles [09-30-09 - 19:33]
Re-added display of parsed info, with a hotkey to show it
Filename
Upgrade.lua
WeightsWatcher.lua
config.xml
defaults.lua
diff --git a/Upgrade.lua b/Upgrade.lua
index aeb4967..45a48d2 100644
--- a/Upgrade.lua
+++ b/Upgrade.lua
@@ -135,6 +135,15 @@ function noop_major_up(vars)
 	return vars
 end

+function upgradeAccountToDebugKey(vars)
+	if vars.options.tooltip.showDebugInfo == nil then
+		vars.options.tooltip.showDebugInfo = "Never"
+	end
+
+	vars.dataMinorVersion = 13
+	return vars
+end
+
 function upgradeAccountToTriggers(vars)
 	if vars.savedTriggers then
 		for _, class in ipairs(vars.savedTriggers) do
@@ -859,6 +868,7 @@ upgradeAccountFunctions = {
 		[9] = upgradeAccountToWorkingMeleeDamage,
 		[10] = upgradeAccountToUseEffectRatio,
 		[11] = upgradeAccountToTriggers,
+		[12] = upgradeAccountToDebugKey,
 	},
 }

@@ -888,6 +898,7 @@ downgradeAccountFunctions = {
 		[10] = noop_down,
 		[11] = noop_down,
 		[12] = downgradeAccountFromTriggers,
+		[13] = noop_down,
 	},
 }

diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 4506cf6..84a8279 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -602,6 +602,7 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
 		bareLink = splitItemLink(link)
 		local bareItemInfo = ww_bareItemCache[bareLink]

+		showDebugInfo = keyDetectors[ww_vars.options.tooltip.showDebugInfo]()
 		showWeights = keyDetectors[ww_vars.options.tooltip.showWeights]()
 		showIdealWeights = keyDetectors[ww_vars.options.tooltip.showIdealWeights]()
 		showIdealGems = keyDetectors[ww_vars.options.tooltip.showIdealGems]()
@@ -634,6 +635,64 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
 			end
 		end

+		if showDebugInfo then
+			for name, value in pairs(bareItemInfo.nonStats) do
+				if value == true then
+					tooltip:AddLine(name)
+				else
+					tooltip:AddDoubleLine(name, value)
+				end
+			end
+			for name, value in pairs(bareItemInfo.normalStats) do
+				tooltip:AddDoubleLine(name, value)
+			end
+			if #(bareItemInfo.useEffects) > 0 then
+				tooltip:AddLine("Use effects:")
+				for _, useEffect in pairs(bareItemInfo.useEffects) do
+					tooltip:AddDoubleLine("  " .. useEffect.value .. " " .. useEffect.stat, useEffect.duration .. "/" .. useEffect.cooldown)
+				end
+			end
+			if #(bareItemInfo.stackingEquipEffects) > 0 then
+				tooltip:AddLine("Stacking equip effects:")
+				for _, effect in pairs(bareItemInfo.stackingEquipEffects) do
+					tooltip:AddDoubleLine("  " .. effect.value .. " " .. effect.stat, effect.numStacks)
+					for trigger in pairs(effect.triggers) do
+						tooltip:AddLine("    on " .. trigger)
+					end
+				end
+			end
+
+			local itemInfo = ww_itemCache[link]
+
+			if #(bareItemInfo.sockets) > 0 then
+				tooltip:AddLine("Sockets:")
+				for _, stat in pairs(bareItemInfo.sockets) do
+					tooltip:AddLine("  " .. stat)
+				end
+				if bareItemInfo.socketBonusStat then
+					if itemInfo.socketBonusActive then
+						tooltip:AddDoubleLine("Socket Bonus:", "Active")
+					else
+						tooltip:AddDoubleLine("Socket Bonus:", "Inactive")
+					end
+					for name, value in pairs(bareItemInfo.socketBonusStat) do
+						tooltip:AddDoubleLine("  " .. name, value)
+					end
+				end
+				if #(itemInfo.gemStats) > 0 then
+					tooltip:AddLine("Gem Stats:")
+					for _, gems in pairs(itemInfo.gemStats) do
+						for _, gem in ipairs(gems) do
+							tooltip:AddLine("  " .. gem[2] .. " (" .. gem[1] .. ")")
+							for stat, value in pairs(gem[3]) do
+								tooltip:AddDoubleLine("    " .. stat, value)
+							end
+						end
+					end
+				end
+			end
+		end
+
 		if showWeights then
 			for _, class in ipairs(ww_charVars.activeWeights) do
 				if ww_vars.weightsList[class] then
@@ -717,7 +776,22 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
 			ttleft = getglobal(ttname .. "TextLeft" .. i)
 			origTextL = ttleft:GetText()
 			textL = WeightsWatcher.preprocess(origTextL:lower())
-			if rawget(ww_unparsed_lines, textL) or rawget(ww_unweighted_lines, textL) then
+			if rawget(ww_unparsed_lines, textL) then
+				if showDebugInfo then
+					ttleft:SetText(origTextL .. " |cffff00ff(U)|r")
+				else
+					ttleft:SetText(origTextL .. " |cffff0000*|r")
+				end
+				numUnweightedEffects = numUnweightedEffects + 1
+			elseif rawget(ww_ignored_lines, textL) then
+				if showDebugInfo then
+					ttleft:SetText(origTextL .. " |cffffff00(I)|r")
+				end
+			elseif rawget(ww_temp_ignored_lines, textL) then
+				if showDebugInfo then
+					ttleft:SetText(origTextL .. " |cffffff00(TI)|r")
+				end
+			elseif rawget(ww_unweighted_lines, textL) then
 				ttleft:SetText(origTextL .. " |cffff0000*|r")
 				numUnweightedEffects = numUnweightedEffects + 1
 			end
@@ -753,6 +827,11 @@ function WeightsWatcher.displayItemStats(tooltip, ttname)
 			elseif ww_vars.options.tooltip.showWeights ~= "Never" then
 				tooltip:AddLine("<Press " .. ww_vars.options.tooltip.showWeights .. " to show weights>")
 			end
+			if not showDebugInfo then
+				if ww_vars.options.tooltip.showDebugInfo ~= "Never" then
+					tooltip:AddLine("<Press " .. ww_vars.options.tooltip.showDebugInfo .. " to show debug info>")
+				end
+			end
 		end

 		tooltip:Show()
diff --git a/config.xml b/config.xml
index 3e09300..af44756 100644
--- a/config.xml
+++ b/config.xml
@@ -118,7 +118,7 @@
 	</FontString>
 	<Frame name="ww_config" parent="UIParent" hidden="true" frameStrata="HIGH">
 		<Size>
-			<AbsDimension x="600" y="400"/>
+			<AbsDimension x="600" y="425"/>
 		</Size>
 		<Anchors>
 			<Anchor point="CENTER"/>
@@ -572,9 +572,25 @@
 							</OnLoad>
 						</Scripts>
 					</Frame>
-					<CheckButton name="$parentHideTooltipHints" parentKey="hideTooltipHints" inherits="ww_checkButton" text="Hide tooltip hints">
+					<Frame name="$parentShowDebugInfo" parentKey="showDebugInfo" inherits="ww_modifierKeyDropDown">
 						<Anchors>
 							<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parentShowIdealGemStats"/>
+							<!--<Anchor point="LEFT" relativePoint="LEFT" relativeTo="$parentShowIdealGems">
+								<Offset>
+									<AbsDimension x="20"/>
+								</Offset>
+							</Anchor>-->
+						</Anchors>
+						<Scripts>
+							<OnLoad>
+								self.label:SetText("Show parser debug information:")
+								self.dropdown:SetText("showDebugInfo")
+							</OnLoad>
+						</Scripts>
+					</Frame>
+					<CheckButton name="$parentHideTooltipHints" parentKey="hideTooltipHints" inherits="ww_checkButton" text="Hide tooltip hints">
+						<Anchors>
+							<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parentShowDebugInfo"/>
 						</Anchors>
 						<Scripts>
 							<OnClick>
diff --git a/defaults.lua b/defaults.lua
index c1e0822..5b8291a 100644
--- a/defaults.lua
+++ b/defaults.lua
@@ -232,7 +232,7 @@ classNameOptions = {

 defaultVars = {
 	dataMajorVersion = 1,
-	dataMinorVersion = 12,
+	dataMinorVersion = 13,
 	weightsList = {
 		[1] = "DEATHKNIGHT",
 		[2] = "DRUID",
@@ -747,6 +747,7 @@ defaultVars = {
 			normalizeWeights = true,
 			showAlternateGems = "Alt",
 			showClassNames = "Others",
+			showDebugInfo = "Never",
 			showDifferences = true,
 			showIdealGems = "Control",
 			showIdealGemStats = "Always",