From 8ff280ef92e4d38a7778e094a339f78b556a63cc Mon Sep 17 00:00:00 2001 From: bkarnow Date: Thu, 22 Aug 2019 11:05:34 -0700 Subject: [PATCH] quests: Fixes and improvements for the First Contact / Meet flow - Adding 'Quickstart' quest to allow replay of the tutorial - Removing hint in First Contact -- Playtests have shown 2 lines at this point is excessive - Migrating to new aysnc future method for questions --- eosclubhouse/quests/hack2/firstcontact.py | 7 +---- eosclubhouse/quests/hack2/meet.py | 22 +++++++++------- eosclubhouse/quests/hack2/quickstart.py | 32 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 eosclubhouse/quests/hack2/quickstart.py diff --git a/eosclubhouse/quests/hack2/firstcontact.py b/eosclubhouse/quests/hack2/firstcontact.py index 01789963d..29195a320 100644 --- a/eosclubhouse/quests/hack2/firstcontact.py +++ b/eosclubhouse/quests/hack2/firstcontact.py @@ -96,12 +96,7 @@ def step_wait_for_hack(self): @Quest.with_app_launched(APP_NAME) def step_wait_for_flipback(self): - self.show_message('FLIPBACK') - - if not self._is_app_flipped_back(): - self.wait_for_app_js_props_changed(self._app, ['mode'], timeout=8) - if not self._is_app_flipped_back(): - self.show_message('FLIPBACK_HINT1') + self.show_message('FLIPBACK_HINT1') while not self._is_app_flipped_back() and not self.is_cancelled(): self.wait_for_app_js_props_changed(self._app, ['mode']) diff --git a/eosclubhouse/quests/hack2/meet.py b/eosclubhouse/quests/hack2/meet.py index 62107a943..5f3484d08 100644 --- a/eosclubhouse/quests/hack2/meet.py +++ b/eosclubhouse/quests/hack2/meet.py @@ -47,22 +47,26 @@ def step_profile(self): # explain the profile for msgid in ['EXPLAIN_PROFILE1', 'EXPLAIN_PROFILE2', 'EXPLAIN_PROFILE3']: self.wait_confirm(msgid) + # ask if player wants to change their name - showme = ('CHANGE_NAME_YES', self.step_changename, True) - notnow = ('CHANGE_NAME_NO', self.step_changename, False) - # this function needs a wait() to prevent a hang after the callback - self.show_choices_message('CHANGE_NAME_ASK', showme, notnow).wait() - return self.step_end + def _choice(choice_var): + return choice_var - def step_changename(self, result): - if result: + action = self.show_choices_message('CHANGE_NAME_ASK', ('CHANGE_NAME_YES', _choice, True), + ('CHANGE_NAME_NO', _choice, False)).wait() + choice = action.future.result() + + if choice: for msgid in ['CHANGE_NAME1', 'CHANGE_NAME2', 'CHANGE_NAME3']: self.wait_confirm(msgid) - def step_end(self): self.wait_confirm('END1') self.wait_confirm('END2') + self.show_message('END3', choices=[('Got it!', self.step_end)]) + return self.step_end + + def step_end(self): self.complete = True self.available = False - self.show_message('END3', choices=[('Got it!', self.stop)]) Sound.play('quests/quest-complete') + self.stop() diff --git a/eosclubhouse/quests/hack2/quickstart.py b/eosclubhouse/quests/hack2/quickstart.py new file mode 100644 index 000000000..49e42cb57 --- /dev/null +++ b/eosclubhouse/quests/hack2/quickstart.py @@ -0,0 +1,32 @@ +from eosclubhouse.libquest import Quest +from eosclubhouse.system import Sound + + +class Quickstart(Quest): + + __quest_name__ = 'Tutorial - The Clubhouse' + __tags__ = ['mission:ada'] + __mission_order__ = 10 + + def step_begin(self): + self.wait_confirm('WELCOME1') + + def _choice(choice_var): + return choice_var + + action = self.show_choices_message('WELCOME2', ('POSITIVE', _choice, True), + ('NEGATIVE', _choice, False)).wait() + choice = action.future.result() + + if choice: + for msgid in ['HACKSWITCH', 'PATHWAYS1', 'PATHWAYS2', 'PROFILE1', 'PROFILE2']: + self.wait_confirm(msgid) + + self.wait_confirm('END1') + self.show_message('END2', choices=[('Got it!', self.step_end)]) + + def step_end(self): + self.complete = True + self.available = False + Sound.play('quests/quest-complete') + self.stop()