From: Mikko Rasa Date: Thu, 16 Aug 2018 14:45:00 +0000 (+0300) Subject: Allow lower level items to be considered as upgrades X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=704e8529e2a2a0c2728f0e3e01121bc18a85e032;p=poefilter.git Allow lower level items to be considered as upgrades But only if it doesn't downgrade anything --- diff --git a/scrape-item-data.py b/scrape-item-data.py index f5f67b4..ab8bc09 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()