[cli] Improve Ubisoft activation messaging

This commit is contained in:
derrod 2021-12-03 17:23:24 +01:00
parent c8189460c2
commit e1b5245252

View file

@ -1746,8 +1746,10 @@ class LegendaryCLI:
ubi_account_id = ext_auth['externalAuthId']
break
else:
logger.error('No ubisoft account found! Please link your accounts via the following link: '
'https://www.epicgames.com/id/link/ubisoft')
logger.error('No linked ubisoft account found! Please link your accounts via your browser and try again.')
webbrowser.open('https://www.epicgames.com/id/link/ubisoft')
print('If web page did not open automatically, please manually open the following URL: '
'https://www.epicgames.com/id/link/ubisoft')
return
uplay_keys = self.core.egs.store_get_uplay_codes()
@ -1756,15 +1758,17 @@ class LegendaryCLI:
games = self.core.get_game_list()
uplay_games = []
activated = 0
for game in games:
if game.metadata.get('customAttributes', {}).get('partnerLinkType', {}).get('value') != 'ubisoft':
continue
if game.metadata.get('customAttributes', {}).get('partnerLinkId', {}).get('value') in redeemed:
activated += 1
continue
uplay_games.append(game)
if not uplay_games:
logger.info('No remaining games found.')
logger.info(f'All of your {activated} Uplay titles have already been activated on your Ubisoft account.')
return
logger.info(f'Found {len(uplay_games)} game(s) to redeem:')