From 64b39caea4bc82dcb4f49e89d37e20a66dd0398d Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 23 Dec 2018 16:14:51 -0500 Subject: [PATCH] Keystone Season Achievements (#49) * Keystone Season Achievements * Switching difficulty order --- app.py | 28 ++++++++++++++++------------ constants.py | 15 +++++++++------ tests.py | 14 ++++++-------- wow.py | 26 ++++++++++---------------- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/app.py b/app.py index 9c529d8..bf8959c 100644 --- a/app.py +++ b/app.py @@ -94,10 +94,9 @@ async def on_message(message): info['name'], info['realm'], region.upper(), info['ilvl']), inline=True) msg.add_field( - name='Keystone Achievements', - value='**`Master(+15)`:** `%s`\n**`Conqueror(+10)`:** `%s` \n**`Challenger(+5)`:** `%s`' % ( - info['keystone_master'], info['keystone_conqueror'], - info['keystone_challenger']), + name='Keystone Achievements (Season 1)', + value='**`Conqueror (+10)`:** `%s`\n**`Master (+15)`:** `%s` \n' % ( + info['keystone_season_conqueror'], info['keystone_season_master']), inline=True) msg.add_field( name='Uldir', @@ -138,7 +137,7 @@ async def on_message(message): title='%s' % (info['name']), colour=discord.Colour(info['class_colour']), url='%s' % (info['armory']), - description='%s %s %s %s' % ( + description='%s %s %s %s (BFA)' % ( info['level'], info['faction'], info['spec'], info['class_type'])) msg.set_thumbnail( url='https://render-%s.worldofwarcraft.com/character/%s?_%s' % ( @@ -224,20 +223,25 @@ async def on_message(message): @client.event async def on_ready(): - if WOW_CLIENT_ID == '' or WOW_CLIENT_SECRET == '': + if WOW_CLIENT_ID is None or WOW_CLIENT_ID == '' or WOW_CLIENT_SECRET is None or WOW_CLIENT_SECRET == '': print('Missing World of Warcraft Client ID/Secret. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details') + quit() - if WOW_REGION == '': + if WOW_REGION is None or WOW_REGION == '': print('Missing World of Warcraft player region. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details') + quit() - if LOCALE == '': + if LOCALE is None or LOCALE == '': print('Missing locale. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details') - - if DISCORD_BOT_TOKEN == '': - print('Missing Discord bot token. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details') + quit() else: print('Launch Succesful! The bot is now listening for commands...') -client.run(DISCORD_BOT_TOKEN) +if DISCORD_BOT_TOKEN is None or DISCORD_BOT_TOKEN == '': + print('Missing Discord bot token. Please refer to https://github.com/JamesIves/discord-wow-armory-bot#configuration for more details') + quit() + +else: + client.run(DISCORD_BOT_TOKEN) diff --git a/constants.py b/constants.py index a25a280..e197b02 100644 --- a/constants.py +++ b/constants.py @@ -3,16 +3,19 @@ """Dictionary of constants used throughout the application.""" -# Achievement Constants -AC_KEYSTONE_MASTER = 11162 -AC_KEYSTONE_CONQUEROR = 11185 -AC_KEYSTONE_CHALLENGER = 11184 +# Mythic Keystone Achievement Constants +AC_SEASON_KEYSTONE_CONQUEROR = 13079 +AC_SEASON_KEYSTONE_MASTER = 13080 + +# Raid Achievement Constants +AC_AOTC_UD = 12536 +AC_CE_UD = 12535 + +# PVP Achievement Constants AC_ARENA_CHALLENGER = 2090 AC_ARENA_RIVAL = 2093 AC_ARENA_DUELIST = 2092 AC_ARENA_GLADIATOR = 2091 -AC_AOTC_UD = 12536 -AC_CE_UD = 12535 AC_HIGH_WARLORD = 5356 AC_CHAMPION = 5353 AC_FIRST_SERGEANT = 5349 diff --git a/tests.py b/tests.py index 5438663..d0e6d7e 100644 --- a/tests.py +++ b/tests.py @@ -121,21 +121,20 @@ def test_for_achievement_progress(self): input_data_horde_sample = { "achievements": { "achievementsCompleted": [11611, 11162, 11185, 11184, 2090, 2093, - 2092, 2091, 11194, 11581, 11195, 11874, 5356, 5353, 5349, 11191, 11192, 11874, 12110, 12111, 12536, 12535] + 2092, 2091, 11194, 11581, 11195, 11874, 5356, 5353, 5349, 11191, 11192, 11874, 12110, 12111, 12536, 12535, 13079] } } input_data_alliance_sample = { "achievements": { "achievementsCompleted": [11611, 11162, 11185, 11184, 2090, 2093, - 2092, 2091, 11194, 11581, 11195, 11874, 5343, 5339, 5334, 11192, 11874, 11875, 12110, 12536] + 2092, 2091, 11194, 11581, 11195, 11874, 5343, 5339, 5334, 11192, 11874, 11875, 12110, 12536, 13079, 13080] } } expected_horde_data = { - 'keystone_master': 'Completed', - 'keystone_conqueror': 'Completed', - 'keystone_challenger': 'Completed', + 'keystone_season_master': 'In Progress', + 'keystone_season_conqueror': 'Completed', 'arena_challenger': 'Completed', 'arena_rival': 'Completed', 'arena_duelist': 'Completed', @@ -150,9 +149,8 @@ def test_for_achievement_progress(self): } expected_alliance_data = { - 'keystone_master': 'Completed', - 'keystone_conqueror': 'Completed', - 'keystone_challenger': 'Completed', + 'keystone_season_master': 'Completed', + 'keystone_season_conqueror': 'Completed', 'arena_challenger': 'Completed', 'arena_rival': 'Completed', 'arena_duelist': 'Completed', diff --git a/wow.py b/wow.py index aa86a13..df7b3c8 100644 --- a/wow.py +++ b/wow.py @@ -74,9 +74,8 @@ def character_achievements(achievement_data, faction): achievements = achievement_data['achievements'] # Return In Progress or empty unless they are found. - keystone_master = 'In Progress' - keystone_conqueror = 'In Progress' - keystone_challenger = 'In Progress' + keystone_season_master = 'In Progress' + keystone_season_conqueror = 'In Progress' arena_challenger = 'In Progress' arena_rival = 'In Progress' arena_duelist = 'In Progress' @@ -86,14 +85,11 @@ def character_achievements(achievement_data, faction): rbg_1500 = 'In Progress' ud_feat = '' - if AC_KEYSTONE_MASTER in achievements['achievementsCompleted']: - keystone_master = 'Completed' + if AC_SEASON_KEYSTONE_MASTER in achievements['achievementsCompleted']: + keystone_season_master = 'Completed' - if AC_KEYSTONE_CONQUEROR in achievements['achievementsCompleted']: - keystone_conqueror = 'Completed' - - if AC_KEYSTONE_CHALLENGER in achievements['achievementsCompleted']: - keystone_challenger = 'Completed' + if AC_SEASON_KEYSTONE_CONQUEROR in achievements['achievementsCompleted']: + keystone_season_conqueror = 'Completed' if AC_ARENA_CHALLENGER in achievements['achievementsCompleted']: arena_challenger = 'Completed' @@ -146,9 +142,8 @@ def character_achievements(achievement_data, faction): rbg_1500 = 'Completed' achievement_list = { - 'keystone_master': keystone_master, - 'keystone_conqueror': keystone_conqueror, - 'keystone_challenger': keystone_challenger, + 'keystone_season_master': keystone_season_master, + 'keystone_season_conqueror': keystone_season_conqueror, 'arena_challenger': arena_challenger, 'arena_rival': arena_rival, 'arena_duelist': arena_duelist, @@ -393,9 +388,8 @@ async def character_info(name, realm, query, region): region, realm, name), 'thumb': info['thumbnail'], 'ilvl': info['items']['averageItemLevelEquipped'], - 'keystone_master': achievements['keystone_master'], - 'keystone_conqueror': achievements['keystone_conqueror'], - 'keystone_challenger': achievements['keystone_challenger'], + 'keystone_season_master': achievements['keystone_season_master'], + 'keystone_season_conqueror': achievements['keystone_season_conqueror'], 'ud_feat': achievements['ud_feat'], 'uldir': progression['uldir'] }