X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=scrape-item-data.py;h=e78883710705105a06b1127f9d16bafabc14c155;hb=14294b0b2b0cf7cc8aa2c854d612378211057b1a;hp=f5f67b488593515d4b708d3d30351d5df0cd9170;hpb=363461fc5eb9000e386c881cad8d9aed39478f83;p=poefilter.git diff --git a/scrape-item-data.py b/scrape-item-data.py index f5f67b4..e788837 100755 --- a/scrape-item-data.py +++ b/scrape-item-data.py @@ -38,14 +38,15 @@ class Item: return 0 def check_upgrade(self, other): - if self.droplevel<=other.droplevel: - return if not self.is_compatible(other): return mods = self.compare_mods(other) attrs = self.compare_attrs(other) + if self.droplevel0 or (mods==0 and attrs>0): other.upgrades["mods"] = self @@ -150,6 +151,10 @@ class ItemDataParser(html.parser.HTMLParser): self.current_item.check_upgrade(it) elif tag=="h1": self.in_heading = False + elif tag=="html": + for i in range(1, len(self.items)): + for j in range(i): + self.items[j].check_upgrade(self.items[i]) def handle_data(self, data): data = data.strip() @@ -158,6 +163,8 @@ class ItemDataParser(html.parser.HTMLParser): if self.in_heading: self.current_heading = data + if self.current_heading=="Staff": + self.current_heading = "Stave" self.headings.append(self.current_heading) elif self.in_items_table and self.in_cell: if self.mod_row: