Skip to content

Commit

Permalink
Replaced BC Classic support with WotLK Classic
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Aug 30, 2022
1 parent a960c47 commit e0ef078
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

linux:
name: Linux
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
Expand All @@ -52,7 +52,7 @@ jobs:

macos:
name: macOS
runs-on: macos-10.15
runs-on: macos-11
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.idea/
__pycache__/
Interface/
WTF/
WTF-Backup/
Interface
WTF
WTF-Backup
/Wow.exe
/CurseBreaker.reg
/Build.sh
Expand Down
42 changes: 15 additions & 27 deletions CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def update_config(self):
# 3.3.0
if 'Development' in addon.keys() and isinstance(addon['Development'], bool):
addon['Development'] = 1
# 4.3.0
if addon['URL'].startswith('https://www.tukui.org/classic-tbc-addons.php?id='):
addon['URL'] = addon['URL'].replace('https://www.tukui.org/classic-tbc-addons.php?id=',
'https://www.tukui.org/classic-wotlk-addons.php?id=')
for add in [['2.1.0', 'WAUsername', ''],
['2.2.0', 'WAAccountName', ''],
['2.2.0', 'WAAPIKey', ''],
Expand Down Expand Up @@ -185,7 +189,6 @@ def cleanup(self, directories):
for directory in directories:
shutil.rmtree(self.path / directory, ignore_errors=True)

# TODO WotLK Cleanup
def parse_url(self, url):
if url.startswith('https://addons.wago.io/addons/'):
return WagoAddonsAddon(url, self.wagoCache, 'retail' if url in self.config['IgnoreClientVersion'].keys()
Expand All @@ -204,8 +207,8 @@ def parse_url(self, url):
raise RuntimeError('ElvUI and Tukui cannot be installed this way.')
self.bulk_tukui_check()
return TukuiAddon(url, self.tukuiCache)
elif url.startswith('https://www.tukui.org/classic-tbc-addons.php?id='):
if self.clientType != 'bc':
elif url.startswith('https://www.tukui.org/classic-wotlk-addons.php?id='):
if self.clientType != 'wotlk':
raise RuntimeError('Unsupported client version.')
elif url.endswith('=1') or url.endswith('=2'):
raise RuntimeError('ElvUI and Tukui cannot be installed this way.')
Expand All @@ -216,27 +219,16 @@ def parse_url(self, url):
elif url.lower() == 'elvui':
if self.clientType == 'retail':
return TukuiAddon('ElvUI', self.tukuiCache, 'elvui')
elif self.clientType == 'wotlk':
raise RuntimeError('Unsupported client version.')
else:
self.bulk_tukui_check()
return TukuiAddon('2', self.tukuiCache)
elif url.lower() == 'elvui:dev':
return GitHubAddonRaw('tukui-org/ElvUI', 'development', ['ElvUI', 'ElvUI_OptionsUI'],
self.config['GHAPIKey'])
elif url.lower() == 'tukui':
if self.clientType == 'retail':
return TukuiAddon('Tukui', self.tukuiCache, 'tukui')
elif self.clientType == 'wotlk':
raise RuntimeError('Unsupported client version.')
else:
self.bulk_tukui_check()
return TukuiAddon('1', self.tukuiCache)
return TukuiAddon('Tukui', self.tukuiCache, 'tukui')
elif url.lower() == 'tukui:dev':
if self.clientType != 'wotlk':
return GitHubAddonRaw('tukui-org/Tukui', 'Live', ['Tukui'], self.config['GHAPIKey'])
else:
raise RuntimeError('Unsupported client version.')
return GitHubAddonRaw('tukui-org/Tukui', 'Live', ['Tukui'], self.config['GHAPIKey'])
elif url.lower() == 'shadow&light:dev':
if self.clientType == 'retail':
return GitHubAddonRaw('Shadow-and-Light/shadow-and-light', 'dev', ['ElvUI_SLE'],
Expand All @@ -250,15 +242,14 @@ def parse_url(self, url):
else:
raise NotImplementedError('Provided URL is not supported.')

# TODO WotLK Cleanup
def parse_url_source(self, url):
if url.startswith('https://addons.wago.io/addons/'):
return 'Wago', url
elif url.startswith('https://www.wowinterface.com/downloads/'):
return 'WoWI', url
elif url.startswith('https://www.tukui.org/addons.php?id=') or \
url.startswith('https://www.tukui.org/classic-addons.php?id=') or \
url.startswith('https://www.tukui.org/classic-tbc-addons.php?id='):
url.startswith('https://www.tukui.org/classic-wotlk-addons.php?id='):
return 'Tukui', url
elif url.lower() == 'elvui:dev':
return 'GitHub', 'https://github.com/tukui-org/ElvUI'
Expand All @@ -275,7 +266,6 @@ def parse_url_source(self, url):
else:
return '?', None

# TODO WotLK Cleanup
def add_addon(self, url, ignore):
if url.endswith(':'):
raise NotImplementedError('Provided URL is not supported.')
Expand All @@ -289,8 +279,8 @@ def add_addon(self, url, ignore):
url = f'https://www.tukui.org/addons.php?id={url[3:]}'
elif url.startswith('tuc:'):
url = f'https://www.tukui.org/classic-addons.php?id={url[4:]}'
elif url.startswith('tubc:'):
url = f'https://www.tukui.org/classic-tbc-addons.php?id={url[5:]}'
elif url.startswith('tuwc:'):
url = f'https://www.tukui.org/classic-wotlk-addons.php?id={url[5:]}'
elif url.startswith('gh:'):
url = f'https://github.com/{url[3:]}'
if url.endswith('/'):
Expand Down Expand Up @@ -597,14 +587,13 @@ def bulk_check(self, addons):
self.wagoCache[addon['slug']] = payload['addons'][addonid]
break

# TODO WotLK Cleanup
@retry(custom_error='Failed to parse Tukui API data')
def bulk_tukui_check(self):
if not self.tukuiCache:
if self.clientType == 'classic':
endpoint = 'classic-addons'
elif self.clientType == 'bc':
endpoint = 'classic-tbc-addons'
elif self.clientType == 'wotlk':
endpoint = 'classic-wotlk-addons'
else:
endpoint = 'addons'
self.tukuiCache = requests.get(f'https://www.tukui.org/api.php?{endpoint}',
Expand Down Expand Up @@ -667,7 +656,6 @@ def detect_addons(self):

return names, slugs, namesinstalled

# TODO WotLK Cleanup
def export_addons(self):
addons = []
for addon in self.config['Addons']:
Expand All @@ -679,8 +667,8 @@ def export_addons(self):
url = f'tu:{addon["URL"].split("?id=")[-1]}'
elif addon['URL'].startswith('https://www.tukui.org/classic-addons.php?id='):
url = f'tuc:{addon["URL"].split("?id=")[-1]}'
elif addon['URL'].startswith('https://www.tukui.org/classic-tbc-addons.php?id='):
url = f'tubc:{addon["URL"].split("?id=")[-1]}'
elif addon['URL'].startswith('https://www.tukui.org/classic-wotlk-addons.php?id='):
url = f'tuwc:{addon["URL"].split("?id=")[-1]}'
elif addon['URL'].startswith('https://github.com/'):
url = f'gh:{addon["URL"].replace("https://github.com/", "")}'
else:
Expand Down
8 changes: 0 additions & 8 deletions CB/GitHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def get_latest_package(self):
targetfile = None
if self.clientType == 'classic':
targetflavor = 'classic'
elif self.clientType == 'bc':
targetflavor = 'bcc'
elif self.clientType == 'wotlk':
targetflavor = 'wrath'
else:
Expand Down Expand Up @@ -102,7 +100,6 @@ def get_latest_package(self):
else:
latest = None
latestclassic = None
latestbc = None
latestwrath = None
for release in self.payloads[self.releaseDepth]['assets']:
if release['name'] and '-nolib' not in release['name'] \
Expand All @@ -113,19 +110,14 @@ def get_latest_package(self):
latest = release['url']
elif not latestclassic and release['name'].endswith('-classic.zip'):
latestclassic = release['url']
elif not latestbc and (release['name'].endswith('-bc.zip') or release['name'].endswith('-bcc.zip')):
latestbc = release['url']
elif not latestwrath and release['name'].endswith('-wrath.zip'):
latestwrath = release['url']
if (self.clientType == 'retail' and latest) \
or (self.clientType == 'classic' and latest and not latestclassic) \
or (self.clientType == 'bc' and latest and not latestbc) \
or (self.clientType == 'wotlk' and latest and not latestwrath):
self.downloadUrl = latest
elif self.clientType == 'classic' and latestclassic:
self.downloadUrl = latestclassic
elif self.clientType == 'bc' and latestbc:
self.downloadUrl = latestbc
elif self.clientType == 'wotlk' and latestwrath:
self.downloadUrl = latestwrath
else:
Expand Down
2 changes: 1 addition & 1 deletion CB/Wago.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ def parse_storage(self):


class WagoUpdater:
# noinspection PyTypeChecker
def __init__(self, config, clienttoc):
self.username = config['WAUsername']
self.accountName = config['WAAccountName']
self.stash = config['WAStash']
self.clientTOC = clienttoc
self.bbParser = bbcode.Parser()
Markdown.output_formats['plain'] = markdown_unmark_element
# noinspection PyTypeChecker
self.mdParser = Markdown(output_format='plain')
self.mdParser.stripTopLevelTags = False
self.headers = HEADERS
Expand Down
2 changes: 1 addition & 1 deletion CB/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
from rich.terminal_theme import TerminalTheme

__version__ = '4.2.1'
__version__ = '4.3.0'
__license__ = 'GPLv3'
__copyright__ = '2019-2022, Paweł Jastrzębski <pawelj@iosphe.re>'
__docformat__ = 'restructuredtext en'
Expand Down
30 changes: 12 additions & 18 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,15 @@ def start(self):
pause(self.headless)
sys.exit(1)
# Detect client flavor
# TODO WotLK Cleanup
if 'CURSEBREAKER_FLAVOR' in os.environ:
flavor = os.environ.get('CURSEBREAKER_FLAVOR')
else:
flavor = os.path.basename(os.getcwd())
if flavor in {'_retail_', '_ptr_', '_beta_'}:
if flavor in {'_retail_', '_ptr_'}:
self.core.clientType = 'retail'
elif flavor in {'_classic_beta_'}:
elif flavor in {'_classic_', '_classic_ptr_'}:
self.core.clientType = 'wotlk'
set_terminal_title(f'CurseBreaker v{__version__} - Wrath of the Lich King')
elif flavor in {'_classic_', '_classic_ptr_'}:
self.core.clientType = 'bc'
set_terminal_title(f'CurseBreaker v{__version__} - Burning Crusade')
elif flavor in {'_classic_era_', '_classic_era_ptr_'}:
self.core.clientType = 'classic'
set_terminal_title(f'CurseBreaker v{__version__} - Classic')
Expand Down Expand Up @@ -427,7 +423,6 @@ def parse_link(self, text, link, dev=None, authors=None, uiversion=None):
obj.no_wrap = True
return obj

# TODO WotLK Cleanup
def c_install(self, args):
if args:
optignore = False
Expand Down Expand Up @@ -473,11 +468,11 @@ def c_install(self, args):
'interface.com/downloads/\[addon_name] [bold white]|[/bold white] wowi:\[addon_id]\n\tht'
'tps://www.tukui.org/addons.php?id=\[addon_id] [bold white]|[/bold white] tu:\[addon_id]'
'\n\thttps://www.tukui.org/classic-addons.php?id=\[addon_id] [bold white]|[/bold white] '
'tuc:\[addon_id]\n\thttps://www.tukui.org/classic-tbc-addons.php?id=\[addon_id] [bold wh'
'ite]|[/bold white] tubc:\[addon_id]\n\thttps://github.com/\[username]/\[repository_name'
'] [bold white]|[/bold white] gh:\[username]/\[repository_name]\n\tElvUI [bold white]|[/'
'bold white] ElvUI:Dev\n\tTukui [bold white]|[/bold white] Tukui:Dev\n\tShadow&Light:Dev'
'', highlight=False)
'tuc:\[addon_id]\n\thttps://www.tukui.org/classic-wotlk-addons.php?id=\[addon_id] [bold '
'white]|[/bold white] tuwc:\[addon_id]\n\thttps://github.com/\[username]/\[repository_na'
'me] [bold white]|[/bold white] gh:\[username]/\[repository_name]\n\tElvUI [bold white]|'
'[/bold white] ElvUI:Dev\n\tTukui [bold white]|[/bold white] Tukui:Dev\n\tShadow&Light:D'
'ev', highlight=False)

def c_uninstall(self, args):
if args:
Expand Down Expand Up @@ -897,7 +892,6 @@ def c_export(self, _):
pyperclip.copy(payload)
self.console.print(f'{payload}\n\nThe command above was copied to the clipboard.', highlight=False)

# TODO WotLK Cleanup
def c_help(self, _):
self.console.print('[green]install [URL][/green]\n\tCommand accepts a space-separated list of links.\n\t[bold w'
'hite]Flags:[/bold white]\n\t'
Expand Down Expand Up @@ -953,11 +947,11 @@ def c_help(self, _):
'te] wa:\[addon_name]\n\thttps://www.wowinterface.com/downloads/\[addon_name] [bold white]|['
'/bold white] wowi:\[addon_id]\n\thttps://www.tukui.org/addons.php?id=\[addon_id] [bold whit'
'e]|[/bold white] tu:\[addon_id]\n\thttps://www.tukui.org/classic-addons.php?id=\[addon_id] '
'[bold white]|[/bold white] tuc:\[addon_id]\n\thttps://www.tukui.org/classic-tbc-addons.php?'
'id=\[addon_id] [bold white]|[/bold white] tubc:\[addon_id]\n\thttps://github.com/\[username'
']/\[repository_name] [bold white]|[/bold white] gh:\[username]/\[repository_name]\n\tElvUI '
'[bold white]|[/bold white] ElvUI:Dev\n\tTukui [bold white]|[/bold white] Tukui:Dev\n\tShado'
'w&Light:Dev', highlight=False)
'[bold white]|[/bold white] tuc:\[addon_id]\n\thttps://www.tukui.org/classic-wotlk-addons.ph'
'p?id=\[addon_id] [bold white]|[/bold white] tuwc:\[addon_id]\n\thttps://github.com/\[userna'
'me]/\[repository_name] [bold white]|[/bold white] gh:\[username]/\[repository_name]\n\tElvU'
'I [bold white]|[/bold white] ElvUI:Dev\n\tTukui [bold white]|[/bold white] Tukui:Dev\n\tSha'
'dow&Light:Dev', highlight=False)

def c_exit(self, _):
sys.exit(0)
Expand Down
28 changes: 14 additions & 14 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Read the instructions on the top of the screen.
Already installed addons will not be recognized by **CurseBreaker** and they need to be reinstalled.\
This process can be partially automated by using the `import` command.

_Retail_, _WotLK_, _Burning Crusade_ and _Classic_ clients are supported. The client version is detected automatically.\
_Retail_, _WotLK Classic_ and _Classic_ clients are supported. The client version is detected automatically.\
By default **CurseBreaker** will create backups of the entire `WTF` directory.

## TIPS & TRICKS
Expand All @@ -31,7 +31,7 @@ By default **CurseBreaker** will create backups of the entire `WTF` directory.
## SUPPORTED URL
- Wago Addons: `https://addons.wago.io/addons/[addon_name]`, `wa:[addon_name]`
- WoWInterface: `https://www.wowinterface.com/downloads/[addon_name]`, `wowi:[addon_id]`
- Tukui: `ElvUI`, `Tukui`, `https://www.tukui.org/addons.php?id=[addon_id]`, `https://www.tukui.org/classic-addons.php?id=[addon_id]`, `https://www.tukui.org/classic-tbc-addons.php?id=[addon_id]`, `tu:[addon_id]`, `tuc:[addon_id]` , `tubc:[addon_id]`
- Tukui: `ElvUI`, `Tukui`, `https://www.tukui.org/addons.php?id=[addon_id]`, `https://www.tukui.org/classic-addons.php?id=[addon_id]`, `https://www.tukui.org/classic-wotlk-addons.php?id=[addon_id]`, `tu:[addon_id]`, `tuc:[addon_id]` , `tuwc:[addon_id]`
- GitHub: `ElvUI:Dev`, `Tukui:Dev`, `Shadow&Light:Dev`
- GitHub Releases: `https://github.com/[username]/[repository_name]`, `gh:[username]/[repository_name]`
- Wago: **CurseBreaker** can update auras and Plater profiles/scripts like WeakAuras Companion.
Expand Down

0 comments on commit e0ef078

Please sign in to comment.