Quantcast

Add a "snapshot" debug toggle to only know when a new snapshot is taken.

Johnny C. Lam [08-14-13 - 21:12]
Add a "snapshot" debug toggle to only know when a new snapshot is taken.

Quiet down the debugging for PaperDoll a bit by removing some lines that
were needed solely for debugging the MH/OH damage computation.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1009 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleOptions.lua
OvalePaperDoll.lua
diff --git a/OvaleOptions.lua b/OvaleOptions.lua
index 9be40ee..a5c9825 100644
--- a/OvaleOptions.lua
+++ b/OvaleOptions.lua
@@ -523,6 +523,12 @@ local self_options =
 							desc = L["Debug paper doll"],
 							type = "toggle",
 						},
+						snapshot =
+						{
+							name = "Snapshot updates",
+							desc = L["Debug stat snapshots"],
+							type = "toggle",
+						},
 						unknown_function =
 						{
 							name = "Unknown functions",
diff --git a/OvalePaperDoll.lua b/OvalePaperDoll.lua
index 53fb305..85adeed 100644
--- a/OvalePaperDoll.lua
+++ b/OvalePaperDoll.lua
@@ -47,6 +47,8 @@ local self_snapshot = OvaleQueue:NewDeque("OvalePaperDoll_snapshot")
 local SNAPSHOT_WINDOW = 5

 local OVALE_PAPERDOLL_DEBUG = "paper_doll"
+local OVALE_SNAPSHOT_DEBUG = "snapshot"
+
 local OVALE_SPELLDAMAGE_SCHOOL = {
 	DEATHKNIGHT = 4, -- Nature
 	DRUID = 4, -- Nature
@@ -133,6 +135,7 @@ local function GetSnapshot(t)
 		newStat.snapshotTime = Ovale.now
 		self_snapshot:InsertFront(newStat)
 		stat = self_snapshot:Front()
+		Ovale:DebugPrintf(OVALE_SNAPSHOT_DEBUG, "New snapshot at %f.", Ovale.now)
 	end
 	return stat
 end
@@ -323,8 +326,8 @@ function OvalePaperDoll:UpdateDamage(event)
 		end
 	end
 	self.stat.mainHandWeaponDamage = avgDamage / mainHandWeaponSpeed * normalizedMainHandWeaponSpeed
-	Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "    MH weapon damage = ((%f + %f) / 2 / %f) / %f * %f",
-		minDamage, maxDamage, damageMultiplier, mainHandWeaponSpeed, normalizedMainHandWeaponSpeed)
+	--Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "    MH weapon damage = ((%f + %f) / 2 / %f) / %f * %f",
+	--	minDamage, maxDamage, damageMultiplier, mainHandWeaponSpeed, normalizedMainHandWeaponSpeed)

 	if OvaleEquipement:HasOffHandWeapon() then
 		local avgOffHandDamage = (minOffHandDamage + maxOffHandDamage) / 2 / damageMultiplier
@@ -340,8 +343,8 @@ function OvalePaperDoll:UpdateDamage(event)
 			end
 		end
 		self.stat.offHandWeaponDamage = avgOffHandDamage / offHandWeaponSpeed * normalizedOffHandWeaponSpeed
-		Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "    OH weapon damage = ((%f + %f) / 2 / %f) / %f * %f",
-			minOffHandDamage, maxOffHandDamage, damageMultiplier, offHandWeaponSpeed, normalizedOffHandWeaponSpeed)
+		--Ovale:DebugPrintf(OVALE_PAPERDOLL_DEBUG, "    OH weapon damage = ((%f + %f) / 2 / %f) / %f * %f",
+		--	minOffHandDamage, maxOffHandDamage, damageMultiplier, offHandWeaponSpeed, normalizedOffHandWeaponSpeed)
 	else
 		self.stat.offHandWeaponDamage = 0
 	end
@@ -386,7 +389,7 @@ end
 -- If source is nil, then use the most recent player stats; otherwise, use the given stat table.
 function OvalePaperDoll:SnapshotStats(t, source)
 	if not source then
-		self:UpdateStats()
+		self:UpdateStats("SnapshotStats")
 		source = self_snapshot:Front()
 	end
 	for k in pairs(OVALE_SNAPSHOT_STATS) do