-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraftingQueueSetup.py
52 lines (44 loc) · 2.18 KB
/
craftingQueueSetup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import requests
from bs4 import BeautifulSoup
# Archetypes with their corresponding classes
archetypes = {
"Mage": ["Coercer", "Conjuror", "Illusionist", "Necromancer", "Warlock", "Wizard"],
"Healer": ["Channeler", "Defiler", "Fury", "Inquisitor", "Mystic", "Templar", "Warden"],
"Scout": ["Assassin", "Beastlord", "Brigand", "Dirge", "Ranger", "Swashbuckler", "Troubador"],
"Fighter": ["Berserker", "Bruiser", "Guardian", "Monk", "Paladin", "Shadowknight"]
}
def scrape_spells(class_name):
url = f"https://u.eq2wire.com/spells/list_spells/{class_name}"
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
filtered_spells = []
for row in soup.find_all('tr', class_=['td-alt0', 'td-alt1']):
cells = row.find_all('td')
if cells and len(cells) >= 2:
level_cell = cells[0].get_text().strip()
if level_cell.isdigit():
level = int(level_cell)
if 126 <= level <= 130:
spell_name_tag = row.find('div', class_='spell_name').find('a')
if spell_name_tag:
spell_name = spell_name_tag.get_text()
filtered_spells.append(spell_name)
return filtered_spells
# Set the target directory , change if needed
target_directory = r"C:\Program Files (x86)\InnerSpace\Scripts\EQ2OgreCraft\RecipeQueues"
os.makedirs(target_directory, exist_ok=True)
# Scrape spells and save the files
for archetype, classes in archetypes.items():
for class_name in classes:
spells = scrape_spells(class_name)
xml_content = "<?xml version='1.0' encoding='UTF-8'?>\n"
xml_content += "<!-- Generated by LavishSettings v2 -->\n"
xml_content += "<InnerSpaceSettings>\n"
for spell in spells:
xml_content += f'<Setting Name="{spell} (Expert)">1</Setting>\n'
xml_content += "</InnerSpaceSettings>\n"
file_path = os.path.join(target_directory, f'{class_name}_126-130.xml')
with open(file_path, 'w') as file:
file.write(xml_content)
print(f"{class_name} spells saved to {file_path}")