Quantcast

Added full stat verification

Kevin Lyles [08-23-10 - 18:00]
Added full stat verification
Filename
Locales/enUS/slots.lua
WeightsWatcher.lua
diff --git a/Locales/enUS/slots.lua b/Locales/enUS/slots.lua
index e11127f..a214e64 100644
--- a/Locales/enUS/slots.lua
+++ b/Locales/enUS/slots.lua
@@ -33,6 +33,23 @@ ww_localizedSlotNames = {
 	["leather"] = "leather",
 	["mail"] = "mail",
 	["plate"] = "plate",
+
+	["arrow"] = "arrow",
+	["bow"] = "bow",
+	["bullet"] = "bullet",
+	["crossbow"] = "crossbow",
+	["dagger"] = "dagger",
+	["fishing pole"] = "fishing pole",
+	["fist weapon"] = "fist weapon",
+	["gun"] = "gun",
+	["idol"] = "idol",
+	["libram"] = "libram",
+	["polearm"] = "polearm",
+	["shield"] = "shield",
+	["sigil"] = "sigil",
+	["staff"] = "staff",
+	["totem"] = "totem",
+	["wand"] = "wand",
 }

 ww_englishSlotNames = {}
@@ -71,4 +88,21 @@ ww_slotDisplayNames = {
 	["leather"] = "Leather",
 	["mail"] = "Mail",
 	["plate"] = "Plate",
+
+	["arrow"] = "Arrow",
+	["bow"] = "Bow",
+	["bullet"] = "Bullet",
+	["crossbow"] = "Crossbow",
+	["dagger"] = "Dagger",
+	["fishing pole"] = "Fishing Pole",
+	["fist weapon"] = "Fist Weapon",
+	["gun"] = "Gun",
+	["idol"] = "Idol",
+	["libram"] = "Libram",
+	["polearm"] = "Polearm",
+	["shield"] = "Shield",
+	["sigil"] = "Sigil",
+	["staff"] = "Staff",
+	["totem"] = "Totem",
+	["wand"] = "Wand",
 }
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 0b80541..15df2ff 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -983,7 +983,7 @@ function WeightsWatcher.getGemStats(...)
 	return statTable
 end

-function WeightsWatcher.parseLine(textL, textR, link)
+local function parseLineUnchecked(textL, textR, link)
 	for _, regex in ipairs(ww_IgnoredLines) do
 		if string.find(textL, regex) then
 			ww_ignored_lines[textL][regex] = true
@@ -1039,6 +1039,55 @@ function WeightsWatcher.parseLine(textL, textR, link)
 	ww_unparsed_lines[textL][link] = true
 end

+function WeightsWatcher.parseLine(textL, textR, link)
+	local stats = parseLineUnchecked(textL, textR, link)
+
+	if not stats then
+		return
+	end
+
+	if stats.stats then
+		for stat, value in pairs(stats.stats) do
+			if not ww_statDisplayNames[stat] and not ww_ignoredInvalidStats[ww_englishStats[stat]] then
+				return
+			end
+		end
+	end
+	if stats.info then
+		for name, value in pairs(stats.info) do
+			if (name == "slot" or name == "subslot") and not ww_slotDisplayNames[ww_englishSlotNames[value]] then
+				return
+			end
+		end
+	end
+	if stats.socket then
+		if not ww_socketColorDisplayNames[stats.socket] then
+			return
+		end
+	end
+	if stats.socketBonusStat then
+		for stat, value in pairs(stats.socketBonusStat) do
+			if not ww_statDisplayNames[stat] and not ww_ignoredInvalidStats[ww_englishStats[stat]] then
+				return
+			end
+		end
+	end
+	if stats.useEffect then
+		if not ww_statDisplayNames[stats.useEffect.stat] and not ww_ignoredInvalidStats[ww_englishStats[stats.useEffect.stat]] then
+			return
+		end
+	end
+	if stats.stackingEquipEffects then
+		for i, effect in ipairs(stats.stackingEquipEffects) do
+			if not ww_statDisplayNames[effect.stat] and not ww_ignoredInvalidStats[ww_englishStats[effect.stat]] then
+				return
+			end
+		end
+	end
+
+	return stats
+end
+
 local rangedConversions = {
 	[ww_localizedStats["melee dps"]] = ww_localizedStats["ranged dps"],
 	[ww_localizedStats["average melee weapon damage"]] = ww_localizedStats["average ranged weapon damage"],