From 6f2bd47a4c3e036c812591c85139cc50814f4812 Mon Sep 17 00:00:00 2001 From: TrialTemp Date: Tue, 9 Jan 2024 12:19:42 -0600 Subject: [PATCH 1/7] Practice in Tournaments! --- .../ba_data/python/bascenev1/_coopsession.py | 12 +- .../ba_data/python/bascenev1/_session.py | 2 + .../python/bascenev1lib/activity/coopscore.py | 14 +- .../python/bauiv1lib/tournamententry.py | 131 +++++++++++++----- 4 files changed, 115 insertions(+), 44 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1/_coopsession.py b/src/assets/ba_data/python/bascenev1/_coopsession.py index 72a67919..268b8ae8 100644 --- a/src/assets/ba_data/python/bascenev1/_coopsession.py +++ b/src/assets/ba_data/python/bascenev1/_coopsession.py @@ -60,7 +60,11 @@ class CoopSession(Session): max_players = classic.coop_session_args['max_players'] else: max_players = app.config.get('Coop Game Max Players', 4) - + if 'submit_score' in classic.coop_session_args: + submit_score = classic.coop_session_args['submit_score'] + else: + submit_score = True + # print('FIXME: COOP SESSION WOULD CALC DEPS.') depsets: Sequence[bascenev1.DependencySet] = [] @@ -70,6 +74,7 @@ class CoopSession(Session): team_colors=TEAM_COLORS, min_players=min_players, max_players=max_players, + submit_score=submit_score, ) # Tournament-ID if we correspond to a co-op tournament (otherwise None) @@ -341,7 +346,10 @@ class CoopSession(Session): self.setactivity(next_game) if not (env.demo or env.arcade): - if self.tournament_id is not None: + if ( + self.tournament_id is not None and + activity.session._submit_score + ): self._custom_menu_ui = [ { 'label': babase.Lstr(resource='restartText'), diff --git a/src/assets/ba_data/python/bascenev1/_session.py b/src/assets/ba_data/python/bascenev1/_session.py index 9ee55313..a76167b5 100644 --- a/src/assets/ba_data/python/bascenev1/_session.py +++ b/src/assets/ba_data/python/bascenev1/_session.py @@ -91,6 +91,7 @@ class Session: team_colors: Sequence[Sequence[float]] | None = None, min_players: int = 1, max_players: int = 8, + submit_score: bool = True, ): """Instantiate a session. @@ -162,6 +163,7 @@ class Session: self.sessionplayers = [] self.min_players = min_players self.max_players = max_players + self._submit_score = submit_score self.customdata = {} self._in_set_activity = False diff --git a/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py b/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py index 8b335a19..2bcf5514 100644 --- a/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py +++ b/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py @@ -124,6 +124,7 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): self._tournament_time_remaining: float | None = None self._tournament_time_remaining_text: Text | None = None self._tournament_time_remaining_text_timer: bs.BaseTimer | None = None + self._submit_score = self.session._submit_score # Stuff for activity skip by pressing button self._birth_time = bs.time() @@ -776,7 +777,7 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): transition_delay=2.0, ) - if self._score is not None: + if self._score is not None and self._submit_score: bs.timer(0.4, bs.WeakCall(self._play_drumroll)) # Add us to high scores, filter, and store. @@ -1371,7 +1372,7 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): assert self._show_info is not None available = self._show_info['results'] is not None - if available: + if available and self._submit_score: error = ( self._show_info['results']['error'] if 'error' in self._show_info['results'] @@ -1504,7 +1505,7 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): maxwidth=400, transition_delay=1.0, ).autoretain() - else: + elif self._submit_score: ZoomText( ( ('#' + str(player_rank)) @@ -1722,9 +1723,10 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): transition_delay=0, ).autoretain() - bs.timer(0.35, self._score_display_sound.play) - if not error: - bs.timer(0.35, self.cymbal_sound.play) + if self._submit_score: + bs.timer(0.35, self._score_display_sound.play) + if not error: + bs.timer(0.35, self.cymbal_sound.play) def _show_fail(self) -> None: ZoomText( diff --git a/src/assets/ba_data/python/bauiv1lib/tournamententry.py b/src/assets/ba_data/python/bauiv1lib/tournamententry.py index d00c37dd..bea86616 100644 --- a/src/assets/ba_data/python/bauiv1lib/tournamententry.py +++ b/src/assets/ba_data/python/bauiv1lib/tournamententry.py @@ -85,6 +85,17 @@ class TournamentEntryWindow(PopupWindow): bg_color = (0.5, 0.4, 0.6) + # Show the practice button as long as we're not + # restarting while on a paid tournament run. + from bascenev1lib.activity.coopscore import CoopScoreScreen + self._do_practice = ( + self._tournament_activity is None or + isinstance(self._tournament_activity, CoopScoreScreen) + ) + + off_p = 0 if not self._do_practice else 48 + self._height += (off_p*0.933) + # Creates our root_widget. super().__init__( position=position, @@ -107,7 +118,7 @@ class TournamentEntryWindow(PopupWindow): self._cancel_button = bui.buttonwidget( parent=self.root_widget, - position=(20, self._height - 34), + position=(40, self._height - 34), size=(60, 60), scale=0.5, label='', @@ -132,15 +143,15 @@ class TournamentEntryWindow(PopupWindow): btn = self._pay_with_tickets_button = bui.buttonwidget( parent=self.root_widget, - position=(30 + x_offs, 60), + position=(30 + x_offs, 60 + off_p), autoselect=True, button_type='square', size=(120, 120), label='', on_activate_call=self._on_pay_with_tickets_press, ) - self._ticket_img_pos = (50 + x_offs, 94) - self._ticket_img_pos_free = (50 + x_offs, 80) + self._ticket_img_pos = (50 + x_offs, 94 + off_p) + self._ticket_img_pos_free = (50 + x_offs, 80 + off_p) self._ticket_img = bui.imagewidget( parent=self.root_widget, draw_controller=btn, @@ -148,8 +159,8 @@ class TournamentEntryWindow(PopupWindow): position=self._ticket_img_pos, texture=bui.gettexture('tickets'), ) - self._ticket_cost_text_position = (87 + x_offs, 88) - self._ticket_cost_text_position_free = (87 + x_offs, 120) + self._ticket_cost_text_position = (87 + x_offs, 88 + off_p) + self._ticket_cost_text_position_free = (87 + x_offs, 120 + off_p) self._ticket_cost_text = bui.textwidget( parent=self.root_widget, draw_controller=btn, @@ -165,7 +176,7 @@ class TournamentEntryWindow(PopupWindow): self._free_plays_remaining_text = bui.textwidget( parent=self.root_widget, draw_controller=btn, - position=(87 + x_offs, 78), + position=(87 + x_offs, 78 + off_p), size=(0, 0), h_align='center', v_align='center', @@ -178,7 +189,7 @@ class TournamentEntryWindow(PopupWindow): if self._do_ad_btn: btn = self._pay_with_ad_btn = bui.buttonwidget( parent=self.root_widget, - position=(190, 60), + position=(190, 60 + off_p), autoselect=True, button_type='square', size=(120, 120), @@ -189,12 +200,12 @@ class TournamentEntryWindow(PopupWindow): parent=self.root_widget, draw_controller=btn, size=(80, 80), - position=(210, 94), + position=(210, 94 + off_p), texture=bui.gettexture('tv'), ) - self._ad_text_position = (251, 88) - self._ad_text_position_remaining = (251, 92) + self._ad_text_position = (251, 88 + off_p) + self._ad_text_position_remaining = (251, 92 + off_p) have_ad_tries_remaining = ( self._tournament_info['adTriesRemaining'] is not None ) @@ -222,7 +233,7 @@ class TournamentEntryWindow(PopupWindow): self._ad_plays_remaining_text = bui.textwidget( parent=self.root_widget, draw_controller=btn, - position=(251, 78), + position=(251, 78 + off_p), size=(0, 0), h_align='center', v_align='center', @@ -234,7 +245,7 @@ class TournamentEntryWindow(PopupWindow): bui.textwidget( parent=self.root_widget, - position=(self._width * 0.5, 120), + position=(self._width * 0.5, 120 + off_p), size=(0, 0), h_align='center', v_align='center', @@ -248,13 +259,28 @@ class TournamentEntryWindow(PopupWindow): else: self._pay_with_ad_btn = None + btn_size = (150, 45) + btn_pos = ( + self._width / 2 - btn_size[0]/2, + self._width / 2 - 110 + ) + if self._do_practice: + self._practice_button = bui.buttonwidget( + parent=self.root_widget, + position=btn_pos, + autoselect=True, + size=btn_size, + label=bui.Lstr(resource='practiceText'), + on_activate_call=self.on_practice_press, + ) + self._get_tickets_button: bui.Widget | None = None self._ticket_count_text: bui.Widget | None = None if not bui.app.ui_v1.use_toolbars: if bui.app.classic.allow_ticket_purchases: self._get_tickets_button = bui.buttonwidget( parent=self.root_widget, - position=(self._width - 190 + 125, self._height - 34), + position=(self._width - 190 + 105, self._height - 34), autoselect=True, scale=0.5, size=(120, 60), @@ -370,6 +396,8 @@ class TournamentEntryWindow(PopupWindow): sel = self.root_widget.get_selected_child() if sel == self._pay_with_ad_btn: sel_name = 'Ad' + elif sel == self._practice_button: + sel_name = 'Practice' else: sel_name = 'Tickets' cfg = bui.app.config @@ -380,6 +408,8 @@ class TournamentEntryWindow(PopupWindow): sel_name = bui.app.config.get('Tournament Pay Selection', 'Tickets') if sel_name == 'Ad' and self._pay_with_ad_btn is not None: sel = self._pay_with_ad_btn + elif sel_name == 'Practice' and self._practice_button is not None: + sel = self._practice_button else: sel = self._pay_with_tickets_button bui.containerwidget(edit=self.root_widget, selected_child=sel) @@ -523,29 +553,37 @@ class TournamentEntryWindow(PopupWindow): text=bui.charstr(bui.SpecialChar.TICKET) + t_str, ) - def _launch(self) -> None: + def _launch(self, practice = False) -> None: assert bui.app.classic is not None if self._launched: return self._launched = True launched = False - # If they gave us an existing activity, just restart it. - if self._tournament_activity is not None: + # If they gave us an existing, non-consistent + # practice activity, just restart it. + if ( + self._tournament_activity is not None and + not practice == self._tournament_activity.session._submit_score + ): try: - bui.apptimer(0.1, bui.getsound('cashRegister').play) + if not practice: + bui.apptimer(0.1, bui.getsound('cashRegister').play) + bui.screenmessage( + bui.Lstr( + translate=('serverResponses', 'Entering tournament...') + ), + color=(0, 1, 0), + ) + bui.apptimer( + 0 if practice else 0.3, + self._transition_out + ) + launched = True with self._tournament_activity.context: self._tournament_activity.end( {'outcome': 'restart'}, force=True ) - bui.apptimer(0.3, self._transition_out) - launched = True - bui.screenmessage( - bui.Lstr( - translate=('serverResponses', 'Entering tournament...') - ), - color=(0, 1, 0), - ) # We can hit exceptions here if _tournament_activity ends before # our restart attempt happens. @@ -558,27 +596,29 @@ class TournamentEntryWindow(PopupWindow): # If we had no existing activity (or were unable to restart it) # launch a new session. if not launched: - bui.apptimer(0.1, bui.getsound('cashRegister').play) + if not practice: + bui.apptimer(0.1, bui.getsound('cashRegister').play) + bui.screenmessage( + bui.Lstr( + translate=('serverResponses', 'Entering tournament...') + ), + color=(0, 1, 0), + ) bui.apptimer( - 1.0, + 0 if practice else 1.0, lambda: bui.app.classic.launch_coop_game( self._tournament_info['game'], args={ 'min_players': self._tournament_info['minPlayers'], 'max_players': self._tournament_info['maxPlayers'], 'tournament_id': self._tournament_id, + 'submit_score': not practice, }, ) if bui.app.classic is not None else None, ) - bui.apptimer(0.7, self._transition_out) - bui.screenmessage( - bui.Lstr( - translate=('serverResponses', 'Entering tournament...') - ), - color=(0, 1, 0), - ) + bui.apptimer(0 if practice else 0.7, self._transition_out) def _on_pay_with_tickets_press(self) -> None: from bauiv1lib import getcurrency @@ -674,6 +714,25 @@ class TournamentEntryWindow(PopupWindow): 'tournament_entry', on_completion_call=bui.WeakCall(self._on_ad_complete), ) + + def on_practice_press(self) -> None: + plus = bui.app.plus + assert plus is not None + + # If we're already entering, ignore. + if self._entering: + return + + # Deny if it looks like the tourney has ended. + if self._seconds_remaining == 0: + bui.screenmessage( + bui.Lstr(resource='tournamentEndedText'), color=(1, 0, 0) + ) + bui.getsound('error').play() + return + + self._entering = True + self._launch(practice=True) def _on_ad_complete(self, actually_showed: bool) -> None: plus = bui.app.plus @@ -751,4 +810,4 @@ class TournamentEntryWindow(PopupWindow): def on_popup_cancel(self) -> None: bui.getsound('swish').play() - self._on_cancel() + self._on_cancel() \ No newline at end of file From 7d176131ad93249f5255b7f128a7df0e0237b356 Mon Sep 17 00:00:00 2001 From: TrialTemp Date: Tue, 9 Jan 2024 12:23:56 -0600 Subject: [PATCH 2/7] md --- CHANGELOG.md | 2 ++ CONTRIBUTORS.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1480580..f103923a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ - Players now get points for killing bots with their own bombs by catching it and throwing it back at them. This is actually old logic but was disabled due to a logic flaw, but should be fixed now. (Thanks VinniTR!) +- Added a 'Practice' button in tournaments, letting you play them free of + charge while not submitting scores. (Thanks Temp!) ### 1.7.32 (build 21741, api 8, 2023-12-20) - Fixed a screen message that no one will ever see (Thanks vishal332008?...) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 8fccc544..626648a1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -50,3 +50,6 @@ ### Rikko - Created the original "reject_recently_left_players" plugin + +### Temp (3alTemp) +- Modder & Bug Fixer \ No newline at end of file From ddc00c764d9a0286bd7c92d288a4c664dc6df203 Mon Sep 17 00:00:00 2001 From: TrialTemp Date: Tue, 9 Jan 2024 12:40:52 -0600 Subject: [PATCH 3/7] Window transition delay increased --- src/assets/ba_data/python/bauiv1lib/tournamententry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/ba_data/python/bauiv1lib/tournamententry.py b/src/assets/ba_data/python/bauiv1lib/tournamententry.py index bea86616..fee7c0b9 100644 --- a/src/assets/ba_data/python/bauiv1lib/tournamententry.py +++ b/src/assets/ba_data/python/bauiv1lib/tournamententry.py @@ -618,7 +618,7 @@ class TournamentEntryWindow(PopupWindow): if bui.app.classic is not None else None, ) - bui.apptimer(0 if practice else 0.7, self._transition_out) + bui.apptimer(0 if practice else 1.25, self._transition_out) def _on_pay_with_tickets_press(self) -> None: from bauiv1lib import getcurrency From 3ca2f2b5c3af1759cf8dbae29922699e5cbab109 Mon Sep 17 00:00:00 2001 From: TrialTemp Date: Tue, 9 Jan 2024 12:47:52 -0600 Subject: [PATCH 4/7] preflight doing preflight things again --- .../ba_data/python/bascenev1/_coopsession.py | 6 +-- .../python/bauiv1lib/tournamententry.py | 37 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1/_coopsession.py b/src/assets/ba_data/python/bascenev1/_coopsession.py index 268b8ae8..abfa3771 100644 --- a/src/assets/ba_data/python/bascenev1/_coopsession.py +++ b/src/assets/ba_data/python/bascenev1/_coopsession.py @@ -64,7 +64,7 @@ class CoopSession(Session): submit_score = classic.coop_session_args['submit_score'] else: submit_score = True - + # print('FIXME: COOP SESSION WOULD CALC DEPS.') depsets: Sequence[bascenev1.DependencySet] = [] @@ -347,8 +347,8 @@ class CoopSession(Session): if not (env.demo or env.arcade): if ( - self.tournament_id is not None and - activity.session._submit_score + self.tournament_id is not None + and activity.session._submit_score ): self._custom_menu_ui = [ { diff --git a/src/assets/ba_data/python/bauiv1lib/tournamententry.py b/src/assets/ba_data/python/bauiv1lib/tournamententry.py index fee7c0b9..bfac56bc 100644 --- a/src/assets/ba_data/python/bauiv1lib/tournamententry.py +++ b/src/assets/ba_data/python/bauiv1lib/tournamententry.py @@ -88,13 +88,13 @@ class TournamentEntryWindow(PopupWindow): # Show the practice button as long as we're not # restarting while on a paid tournament run. from bascenev1lib.activity.coopscore import CoopScoreScreen - self._do_practice = ( - self._tournament_activity is None or - isinstance(self._tournament_activity, CoopScoreScreen) + + self._do_practice = self._tournament_activity is None or isinstance( + self._tournament_activity, CoopScoreScreen ) - + off_p = 0 if not self._do_practice else 48 - self._height += (off_p*0.933) + self._height += off_p * 0.933 # Creates our root_widget. super().__init__( @@ -260,10 +260,7 @@ class TournamentEntryWindow(PopupWindow): self._pay_with_ad_btn = None btn_size = (150, 45) - btn_pos = ( - self._width / 2 - btn_size[0]/2, - self._width / 2 - 110 - ) + btn_pos = (self._width / 2 - btn_size[0] / 2, self._width / 2 - 110) if self._do_practice: self._practice_button = bui.buttonwidget( parent=self.root_widget, @@ -553,7 +550,7 @@ class TournamentEntryWindow(PopupWindow): text=bui.charstr(bui.SpecialChar.TICKET) + t_str, ) - def _launch(self, practice = False) -> None: + def _launch(self, practice=False) -> None: assert bui.app.classic is not None if self._launched: return @@ -563,22 +560,22 @@ class TournamentEntryWindow(PopupWindow): # If they gave us an existing, non-consistent # practice activity, just restart it. if ( - self._tournament_activity is not None and - not practice == self._tournament_activity.session._submit_score + self._tournament_activity is not None + and not practice == self._tournament_activity.session._submit_score ): try: if not practice: bui.apptimer(0.1, bui.getsound('cashRegister').play) bui.screenmessage( bui.Lstr( - translate=('serverResponses', 'Entering tournament...') + translate=( + 'serverResponses', + 'Entering tournament...', + ) ), color=(0, 1, 0), ) - bui.apptimer( - 0 if practice else 0.3, - self._transition_out - ) + bui.apptimer(0 if practice else 0.3, self._transition_out) launched = True with self._tournament_activity.context: self._tournament_activity.end( @@ -714,7 +711,7 @@ class TournamentEntryWindow(PopupWindow): 'tournament_entry', on_completion_call=bui.WeakCall(self._on_ad_complete), ) - + def on_practice_press(self) -> None: plus = bui.app.plus assert plus is not None @@ -722,7 +719,7 @@ class TournamentEntryWindow(PopupWindow): # If we're already entering, ignore. if self._entering: return - + # Deny if it looks like the tourney has ended. if self._seconds_remaining == 0: bui.screenmessage( @@ -810,4 +807,4 @@ class TournamentEntryWindow(PopupWindow): def on_popup_cancel(self) -> None: bui.getsound('swish').play() - self._on_cancel() \ No newline at end of file + self._on_cancel() From 8bdd4b9cddfb7b8262100cf38da80c65ad894b49 Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Tue, 5 Mar 2024 02:42:45 -0600 Subject: [PATCH 5/7] underscore jumpscare --- .../ba_data/python/bascenev1/_coopsession.py | 2 +- src/assets/ba_data/python/bascenev1/_session.py | 2 +- .../ba_data/python/bauiv1lib/tournamententry.py | 17 ++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1/_coopsession.py b/src/assets/ba_data/python/bascenev1/_coopsession.py index 719c5879..a68a72c4 100644 --- a/src/assets/ba_data/python/bascenev1/_coopsession.py +++ b/src/assets/ba_data/python/bascenev1/_coopsession.py @@ -353,7 +353,7 @@ class CoopSession(Session): if not (env.demo or env.arcade): if ( self.tournament_id is not None - and activity.session._submit_score + and classic.coop_session_args['submit_score'] ): self._custom_menu_ui = [ { diff --git a/src/assets/ba_data/python/bascenev1/_session.py b/src/assets/ba_data/python/bascenev1/_session.py index f9d58126..dd757346 100644 --- a/src/assets/ba_data/python/bascenev1/_session.py +++ b/src/assets/ba_data/python/bascenev1/_session.py @@ -176,7 +176,7 @@ class Session: if _max_players_override is None else _max_players_override ) - self._submit_score = submit_score + self.submit_score = submit_score self.customdata = {} self._in_set_activity = False diff --git a/src/assets/ba_data/python/bauiv1lib/tournamententry.py b/src/assets/ba_data/python/bauiv1lib/tournamententry.py index 3a5c0f55..36aa14a4 100644 --- a/src/assets/ba_data/python/bauiv1lib/tournamententry.py +++ b/src/assets/ba_data/python/bauiv1lib/tournamententry.py @@ -14,7 +14,7 @@ import bauiv1 as bui if TYPE_CHECKING: from typing import Any, Callable - + from bascenev1lib.activity.coopscore import CoopScoreScreen import bascenev1 as bs @@ -32,6 +32,7 @@ class TournamentEntryWindow(PopupWindow): on_close_call: Callable[[], Any] | None = None, ): # Needs some tidying. + # pylint: disable=too-many-locals # pylint: disable=too-many-branches # pylint: disable=too-many-statements @@ -82,15 +83,13 @@ class TournamentEntryWindow(PopupWindow): self._tournament_activity = tournament_activity - self._width = 340 - self._height = 225 + self._width: float = 340.0 + self._height: float = 225.0 bg_color = (0.5, 0.4, 0.6) # Show the practice button as long as we're not # restarting while on a paid tournament run. - from bascenev1lib.activity.coopscore import CoopScoreScreen - self._do_practice = self._tournament_activity is None or isinstance( self._tournament_activity, CoopScoreScreen ) @@ -270,7 +269,7 @@ class TournamentEntryWindow(PopupWindow): autoselect=True, size=btn_size, label=bui.Lstr(resource='practiceText'), - on_activate_call=self.on_practice_press, + on_activate_call=self._on_practice_press, ) self._get_tickets_button: bui.Widget | None = None @@ -552,7 +551,7 @@ class TournamentEntryWindow(PopupWindow): text=bui.charstr(bui.SpecialChar.TICKET) + t_str, ) - def _launch(self, practice=False) -> None: + def _launch(self, practice: bool = False) -> None: assert bui.app.classic is not None if self._launched: return @@ -563,7 +562,7 @@ class TournamentEntryWindow(PopupWindow): # practice activity, just restart it. if ( self._tournament_activity is not None - and not practice == self._tournament_activity.session._submit_score + and not practice == self._tournament_activity.session.submit_score ): try: if not practice: @@ -714,7 +713,7 @@ class TournamentEntryWindow(PopupWindow): on_completion_call=bui.WeakCall(self._on_ad_complete), ) - def on_practice_press(self) -> None: + def _on_practice_press(self) -> None: plus = bui.app.plus assert plus is not None From c312a0206a3d782a4ec0af14710e9f64925ac7b4 Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Tue, 5 Mar 2024 02:51:32 -0600 Subject: [PATCH 6/7] _ --- src/assets/ba_data/python/bascenev1lib/activity/coopscore.py | 2 +- src/assets/ba_data/python/bauiv1lib/tournamententry.py | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py b/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py index 21ae486b..7b1bc9a7 100644 --- a/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py +++ b/src/assets/ba_data/python/bascenev1lib/activity/coopscore.py @@ -125,7 +125,7 @@ class CoopScoreScreen(bs.Activity[bs.Player, bs.Team]): self._tournament_time_remaining: float | None = None self._tournament_time_remaining_text: Text | None = None self._tournament_time_remaining_text_timer: bs.BaseTimer | None = None - self._submit_score = self.session._submit_score + self._submit_score = self.session.submit_score # Stuff for activity skip by pressing button self._birth_time = bs.time() diff --git a/src/assets/ba_data/python/bauiv1lib/tournamententry.py b/src/assets/ba_data/python/bauiv1lib/tournamententry.py index 36aa14a4..010b2c8c 100644 --- a/src/assets/ba_data/python/bauiv1lib/tournamententry.py +++ b/src/assets/ba_data/python/bauiv1lib/tournamententry.py @@ -14,7 +14,6 @@ import bauiv1 as bui if TYPE_CHECKING: from typing import Any, Callable - from bascenev1lib.activity.coopscore import CoopScoreScreen import bascenev1 as bs @@ -90,9 +89,7 @@ class TournamentEntryWindow(PopupWindow): # Show the practice button as long as we're not # restarting while on a paid tournament run. - self._do_practice = self._tournament_activity is None or isinstance( - self._tournament_activity, CoopScoreScreen - ) + self._do_practice = self._tournament_activity is None off_p = 0 if not self._do_practice else 48 self._height += off_p * 0.933 From 0d00b75d1846f31898070c3d897c721679236bcc Mon Sep 17 00:00:00 2001 From: 3alTemp Date: Thu, 14 Mar 2024 19:08:07 -0600 Subject: [PATCH 7/7] Configo --- .../python/bauiv1lib/tournamententry.py | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/assets/ba_data/python/bauiv1lib/tournamententry.py b/src/assets/ba_data/python/bauiv1lib/tournamententry.py index f3a5197e..7c7a1206 100644 --- a/src/assets/ba_data/python/bauiv1lib/tournamententry.py +++ b/src/assets/ba_data/python/bauiv1lib/tournamententry.py @@ -87,7 +87,10 @@ class TournamentEntryWindow(PopupWindow): # Show the practice button as long as we're not # restarting while on a paid tournament run. - self._do_practice = self._tournament_activity is None + self._do_practice = ( + self._tournament_activity is None and + bui.app.config.get('tournament_practice_enabled', False) + ) off_p = 0 if not self._do_practice else 48 self._height += off_p * 0.933 @@ -259,6 +262,7 @@ class TournamentEntryWindow(PopupWindow): btn_size = (150, 45) btn_pos = (self._width / 2 - btn_size[0] / 2, self._width / 2 - 110) + self._practice_button = None if self._do_practice: self._practice_button = bui.buttonwidget( parent=self.root_widget, @@ -621,22 +625,8 @@ class TournamentEntryWindow(PopupWindow): 'tournament_id': self._tournament_id, 'submit_score': not practice, }, - ) - if bui.app.classic is not None - else None, - 1.0, - lambda: ( - bui.app.classic.launch_coop_game( - self._tournament_info['game'], - args={ - 'min_players': self._tournament_info['minPlayers'], - 'max_players': self._tournament_info['maxPlayers'], - 'tournament_id': self._tournament_id, - }, - ) - if bui.app.classic is not None - else None - ), + ) if bui.app.classic is not None + else None ) bui.apptimer(0 if practice else 1.25, self._transition_out)