From 704e8529e2a2a0c2728f0e3e01121bc18a85e032 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 16 Aug 2018 17:45:00 +0300 Subject: [PATCH] Allow lower level items to be considered as upgrades But only if it doesn't downgrade anything --- scrape-item-data.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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() -- 2.45.2