forked from ascott18/TellMeWhen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update weapon enchant suggestion list and icon type for shadowlands (…
…Shaman enchants are back! Oh boy! They were always so fun to deal with!)
- Loading branch information
Showing
6 changed files
with
171 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import re | ||
import json | ||
import urllib.request | ||
import multiprocessing | ||
import itertools | ||
import os | ||
|
||
from slpp import slpp as lua | ||
|
||
base_url = "https://www.wowhead.com" | ||
|
||
max_retries = 1 | ||
|
||
name_blacklist = [ | ||
"armor", | ||
"insoles", | ||
"lure", | ||
"worm", | ||
"hook", | ||
"fish", | ||
"bauble", | ||
"nightcrawler", | ||
"Darkmoon Doughnut", | ||
"Aquatic Enticer", | ||
] | ||
|
||
def try_scrape_url(url, regex, id, tries = 0): | ||
print("getting " + str(id)) | ||
|
||
user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36' | ||
headers = {'User-Agent': user_agent} | ||
req = urllib.request.Request(url, [], headers) | ||
response = urllib.request.urlopen(req) | ||
|
||
content = response.read().decode() | ||
|
||
match = re.search(regex, content) | ||
|
||
if not match: | ||
if tries < max_retries: | ||
print("retrying " + str(id)) | ||
return try_scrape_url(url, regex, id, tries + 1) | ||
else: | ||
raise Exception("no match for " + str(id)) | ||
|
||
data = match.group(1) | ||
data = re.sub(r"frommerge:1", r'"frommerge":1', data) | ||
data = re.sub(r"popularity:", r'"popularity":', data) | ||
data = re.sub(r"firstseenpatch:", r'"firstseenpatch":', data) | ||
data = json.loads(data) | ||
|
||
return data | ||
|
||
|
||
def scrape_consumable_items(): | ||
data = try_scrape_url( | ||
url = base_url + "/items/consumables/item-enhancements-temporary/quality:1:2:3:4:5:6:7", | ||
regex = r"var listviewitems = (\[.*\]);", | ||
id = "item-enhancements-temporary") | ||
|
||
ids = {} | ||
for spell in data: | ||
id = spell["id"] | ||
name = spell["name"] | ||
if not any(sub.upper() in name.upper() for sub in name_blacklist): | ||
ids[id] = name | ||
|
||
return ids | ||
|
||
if __name__ == '__main__': | ||
|
||
items = scrape_consumable_items() | ||
output = "{" | ||
for key in sorted(items, key=lambda k: '%03d' % k if isinstance(k, (int)) else str(k) ): | ||
output += "\t" + str(key) + ", -- " + items[key] + "\n" | ||
output += "}" | ||
open(os.path.join(os.path.dirname(__file__), 'WeaponAugments.lua'), 'w').write(output) | ||
|
||
print("complete. written to WeaponAugments.lua.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ 12404, -- Dense Sharpening Stone | ||
124674, -- Day-Old Darkmoon Doughnut | ||
12643, -- Dense Weightstone | ||
171285, -- Shadowcore Oil | ||
171286, -- Embalmer's Oil | ||
171436, -- Porous Sharpening Stone | ||
171437, -- Shaded Sharpening Stone | ||
171438, -- Porous Weightstone | ||
171439, -- Shaded Weightstone | ||
172038, -- Grim Iron Shackles | ||
177036, -- Aquatic Enticer | ||
18262, -- Elemental Sharpening Stone | ||
20744, -- Minor Wizard Oil | ||
20745, -- Minor Mana Oil | ||
20746, -- Lesser Wizard Oil | ||
20747, -- Lesser Mana Oil | ||
20748, -- Brilliant Mana Oil | ||
20749, -- Brilliant Wizard Oil | ||
20750, -- Wizard Oil | ||
22521, -- Superior Mana Oil | ||
22522, -- Superior Wizard Oil | ||
23122, -- Consecrated Sharpening Stone | ||
23123, -- Blessed Wizard Oil | ||
23528, -- Fel Sharpening Stone | ||
23529, -- Adamantite Sharpening Stone | ||
23559, -- Lesser Rune of Warding | ||
23575, -- Lesser Ward of Shielding | ||
23576, -- Greater Ward of Shielding | ||
25521, -- Greater Rune of Warding | ||
28420, -- Fel Weightstone | ||
28421, -- Adamantite Weightstone | ||
2862, -- Rough Sharpening Stone | ||
2863, -- Coarse Sharpening Stone | ||
2871, -- Heavy Sharpening Stone | ||
31535, -- Bloodboil Poison | ||
3239, -- Rough Weightstone | ||
3240, -- Coarse Weightstone | ||
3241, -- Heavy Weightstone | ||
34538, -- Blessed Weapon Coating | ||
34539, -- Righteous Weapon Coating | ||
36899, -- Exceptional Mana Oil | ||
3824, -- Shadow Oil | ||
3829, -- Frost Oil | ||
7964, -- Solid Sharpening Stone | ||
7965, -- Solid Weightstone | ||
} |