From 582e44d9139444bdb40a0378453d81dda314ceb2 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Tue, 15 Sep 2009 13:57:07 -0500 Subject: [PATCH] Added a lot more stat patterns --- Regexps.lua | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/Regexps.lua b/Regexps.lua index 4d7c520..5b6628d 100644 --- a/Regexps.lua +++ b/Regexps.lua @@ -1,9 +1,51 @@ Preprocess = { {"(.*)|r$", "%1"}, {"^|c[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9](.*)", "%1"}, + {"Improves", "Increases"}, + {"Increases your", "Increases"}, + {"Increases the target's", "Increases"}, + {"Unique%-Equipped", "Unique"}, } ProcessedLines = { + -- TODO: split this into min and max damage + {"(%d+) %- (%d+) Damage", + function(text, pattern) + local start, val1, val2 + start, _, val1, val2 = string.find(text, pattern) + if start then + return {"Damage", val1 .. "-" .. val2} + end + end}, + + {"^Rune of the Stoneskin Gargoyle", + function() + return {"Defense", "25"} + end}, + "^(Classes): (%a[%a ,]+)", + "(Requires %a[%a ]+) %((%d+)%)", + + -- TODO: figure out how to properly handle this and other multi-stat lines + "^Use: .*%. If you spend at least %d+ seconds eating you will become well fed and gain ([%a%d][%a%d, ]+) for .*%.", + + {"Restores (%d+) mana per 5 sec%.", + function(text, pattern) + local start, value + start, _, value = string.find(text, pattern) + if start then + return {"MP5", value} + end + end}, + "^Use: Restores .*%.", + "^Use: Heals %d+ damage over %d+ sec%.", + {"^%((%d[%d.]+) damage per second%)$", + function(text, pattern) + local start, value + start, _, value = string.find(text, pattern) + if start then + return {"DPS", value} + end + end}, {"^%+?(%d+) (%a[%a ]+)", function(text, pattern) local start, name, value @@ -14,7 +56,44 @@ ProcessedLines = { end}, "^(%a[%a ]+) (%d+)", "^Equip: Increases (%a[%a ]+) by (%d+)%.", + "^Use: Increases (%a[%a ]+) by (%d+) for .*%.", "^Soulbound$", + "^Binds when equipped$", + "^Binds when picked up$", + "^Binds when used$", "^Durability %d+ / %d+$", "^<.+>$", + "^\".+\"$", + "^(Unique)$", + "^(Head)$", + "^(Neck)$", + "^(Shoulder)$", + "^(Back)$", + "^(Chest)$", + "^(Shirt)$", + "^(Tabard)$", + "^(Wrist)$", + "^(Hands)$", + "^(Waist)$", + "^(Legs)$", + "^(Feet)$", + "^(Finger)$", + "^(Trinket)$", + "^(Main Hand)$", + "^(Off%-hand)$", + "^Held In (Off%-hand)$", + "^(Relic)$", + "^(Ranged)$", + "^(Two Hand)$", + "^Use: When applied to your fishing pole, increases (Fishing) by (%d+) for ", + {"^Use: Increases mana regeneration by (%d+) mana per 5 seconds for ", + function(text, pattern) + local start, value + start, _, value = string.find(text, pattern) + if start then + return {"MP5", value} + end + end}, + "^Use: Permanently increase the (%a[%a ]+) of .* by (%d+)%.", + "^Use: Permanently enchant .* to increase (%a[%a ]+) by (%d+)%.", } -- 1.7.9.5