From d22c20d3f850320728d3b409d2d04bc5dacccdb4 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Sat, 24 Jul 2010 20:04:22 -0500 Subject: [PATCH] Skip lines that only sometimes appear, plus blank lines at the end Allows for more consistent data and easier comparisons --- ItemScanner.lua | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ItemScanner.lua b/ItemScanner.lua index 6fd400f..4881580 100644 --- a/ItemScanner.lua +++ b/ItemScanner.lua @@ -14,6 +14,14 @@ local patterns = { "^Technique:", } +local skippedLines = { + "^Already known$", + "^Prospectable$", + "^Disenchanting requires Enchanting %(%d+%)$", + "^Cannot be disenchanted", + "^Collected %(%d/%d%)$", +} + local function scanItemLink(link) local textL, textR @@ -80,11 +88,24 @@ local function scanItemLink(link) helpful = IsHelpfulItem(link), harmful = IsHarmfulItem(link), } + local numSkipped = 0 for i = 1, ItemScannerHiddenTooltip:NumLines() do - IS_item_info[link][i] = { - left = _G["ItemScannerHiddenTooltipTextLeft" .. i]:GetText(), - right = _G["ItemScannerHiddenTooltipTextRight" .. i]:GetText(), - } + textL = _G["ItemScannerHiddenTooltipTextLeft" .. i]:GetText() + textR = _G["ItemScannerHiddenTooltipTextRight" .. i]:GetText() + local skip = false + for _, pattern in ipairs(skippedLines) do + if textL:find(pattern) then + skip = true + numSkipped = numSkipped + 1 + break + end + end + if not skip and (i ~= ItemScannerHiddenTooltip:NumLines() or (textL ~= " " and textL ~= "" and textR ~= " " and textR ~= "")) then + IS_item_info[link][i - numSkipped] = { + left = textL, + right = textR, + } + end end return true -- 1.7.9.5