From d32cf3556d38465e41fc4c0e0fef14c616460edd Mon Sep 17 00:00:00 2001 From: Cross Joy <87638792+CrossJoy@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:46:16 +0800 Subject: [PATCH 1/8] fixed easy connect for 1.7.7 and above --- plugins/utilities/easy_connect.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/plugins/utilities/easy_connect.py b/plugins/utilities/easy_connect.py index 0c9d6e0..ce566d0 100644 --- a/plugins/utilities/easy_connect.py +++ b/plugins/utilities/easy_connect.py @@ -156,7 +156,7 @@ def new_build_favorites_tab(self, region_height: float) -> None: autoselect=True) if uiscale is ba.UIScale.SMALL and ba.app.ui.use_toolbars: ba.widget(edit=btn1, - left_widget=_ba.get_special_widget('back_button')) + left_widget=ba_internal.get_special_widget('back_button')) btnv -= b_height + b_space_extra ba.buttonwidget(parent=self._container, size=(b_width, b_height), @@ -211,7 +211,7 @@ def new_on_favorites_connect_press(self) -> None: call=ba.WeakCall( self._host_lookup_result)).start() - if self.retry_inter > 0 and (_ba.get_connection_to_host_info() == {} or _ba.get_connection_to_host_info()['build_number'] == 0): + if self.retry_inter > 0 and (ba_internal.get_connection_to_host_info() == {} or ba_internal.get_connection_to_host_info()['build_number'] == 0): ba.screenmessage("Server full or unreachable, Retrying....") self._retry_timer = ba.Timer(self.retry_inter, ba.Call( self._on_favorites_connect_press), timetype=ba.TimeType.REAL) @@ -295,8 +295,8 @@ def update(self, index: int, party: PartyEntry, sub_scroll_width: float, if party.clean_display_index == index: return - ping_good = _ba.get_v1_account_misc_read_val('pingGood', 100) - ping_med = _ba.get_v1_account_misc_read_val('pingMed', 500) + ping_good = ba_internal.get_v1_account_misc_read_val('pingGood', 100) + ping_med = ba_internal.get_v1_account_misc_read_val('pingMed', 500) self._clear() hpos = 20 @@ -329,7 +329,7 @@ def update(self, index: int, party: PartyEntry, sub_scroll_width: float, if party.stats_addr or True: url = party.stats_addr.replace( '${ACCOUNT}', - _ba.get_v1_account_misc_read_val_2('resolvedAccountID', + ba_internal.get_v1_account_misc_read_val_2('resolvedAccountID', 'UNKNOWN')) self._stats_button = ba.buttonwidget( color=(0.5, 0.8, 0.8), @@ -432,7 +432,7 @@ def popup_menu_selected_choice(self, window: popup.PopupMenu, if choice == 'stats': url = _party.stats_addr.replace( '${ACCOUNT}', - _ba.get_v1_account_misc_read_val_2('resolvedAccountID', + ba_internal.get_v1_account_misc_read_val_2('resolvedAccountID', 'UNKNOWN')) ba.open_url(url) elif choice == 'connect': @@ -457,8 +457,22 @@ def popup_menu_selected_choice(self, window: popup.PopupMenu, ba.clipboard_set_text(_party.queue) ba.playsound(ba.getsound('gunCocking')) +def is_game_version_lower_than(version): + """ + Returns a boolean value indicating whether the current game + version is lower than the passed version. Useful for addressing + any breaking changes within game versions. + """ + game_version = tuple(map(int, ba.app.version.split("."))) + version = tuple(map(int, version.split("."))) + return game_version < version def replace(): + global ba_internal + if is_game_version_lower_than("1.7.7"): + ba_internal = _ba + else: + ba_internal = ba.internal manualtab.ManualGatherTab._build_favorites_tab = new_build_favorites_tab manualtab.ManualGatherTab._on_favorites_connect_press = new_on_favorites_connect_press manualtab.ManualGatherTab.auto_retry_dec = auto_retry_dec @@ -572,10 +586,10 @@ class PartyQuickConnect(ba.Window): self.direction = "right" def connect(self, address, port): - if not self.closed and (_ba.get_connection_to_host_info() == {} or _ba.get_connection_to_host_info()['build_number'] == 0): + if not self.closed and (ba_internal.get_connection_to_host_info() == {} or ba_internal.get_connection_to_host_info()['build_number'] == 0): ba.textwidget(edit=self._title_text, text="Retrying....("+str(self.retry_count)+")") self.retry_count += 1 - _ba.connect_to_party(address, port=port) + ba_internal.connect_to_party(address, port=port) self._retry_timer = ba.Timer(1.5, ba.Call( self.connect, address, port), timetype=ba.TimeType.REAL) From b3f01804634a376542423b9b4ea1cb3f6925c1db Mon Sep 17 00:00:00 2001 From: Cross Joy <87638792+CrossJoy@users.noreply.github.com> Date: Mon, 26 Sep 2022 19:05:24 +0800 Subject: [PATCH 2/8] Update easy_connect version --- plugins/utilities.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index d9b415f..25f628b 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -119,6 +119,7 @@ } ], "versions": { + "1.2.0": null "1.0.0": { "api_version": 7, "commit_sha": "3a8ba07", @@ -204,4 +205,4 @@ } } } -} \ No newline at end of file +} From d61d420909a66cc4881bd0c73c87c77e56a08c47 Mon Sep 17 00:00:00 2001 From: CrossJoy Date: Mon, 26 Sep 2022 11:19:43 +0000 Subject: [PATCH 3/8] [ci] auto-format --- plugins/utilities/easy_connect.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/utilities/easy_connect.py b/plugins/utilities/easy_connect.py index ce566d0..8f5eb24 100644 --- a/plugins/utilities/easy_connect.py +++ b/plugins/utilities/easy_connect.py @@ -330,7 +330,7 @@ def update(self, index: int, party: PartyEntry, sub_scroll_width: float, url = party.stats_addr.replace( '${ACCOUNT}', ba_internal.get_v1_account_misc_read_val_2('resolvedAccountID', - 'UNKNOWN')) + 'UNKNOWN')) self._stats_button = ba.buttonwidget( color=(0.5, 0.8, 0.8), textcolor=(1.0, 1.0, 1.0), @@ -433,7 +433,7 @@ def popup_menu_selected_choice(self, window: popup.PopupMenu, url = _party.stats_addr.replace( '${ACCOUNT}', ba_internal.get_v1_account_misc_read_val_2('resolvedAccountID', - 'UNKNOWN')) + 'UNKNOWN')) ba.open_url(url) elif choice == 'connect': @@ -457,6 +457,7 @@ def popup_menu_selected_choice(self, window: popup.PopupMenu, ba.clipboard_set_text(_party.queue) ba.playsound(ba.getsound('gunCocking')) + def is_game_version_lower_than(version): """ Returns a boolean value indicating whether the current game @@ -467,6 +468,7 @@ def is_game_version_lower_than(version): version = tuple(map(int, version.split("."))) return game_version < version + def replace(): global ba_internal if is_game_version_lower_than("1.7.7"): From d8d29852875f4002952854ec66226abec9943d05 Mon Sep 17 00:00:00 2001 From: Cross Joy <87638792+CrossJoy@users.noreply.github.com> Date: Tue, 27 Sep 2022 07:22:44 +0800 Subject: [PATCH 4/8] added comma --- plugins/utilities.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index 25f628b..bfd1197 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -119,7 +119,7 @@ } ], "versions": { - "1.2.0": null + "1.2.0": null, "1.0.0": { "api_version": 7, "commit_sha": "3a8ba07", From a58e12c609be974028ba003b63b7e46012dc6cf1 Mon Sep 17 00:00:00 2001 From: CrossJoy Date: Mon, 26 Sep 2022 23:23:05 +0000 Subject: [PATCH 5/8] [ci] apply-version-metadata --- plugins/utilities.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index bfd1197..f51a3b4 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -119,7 +119,12 @@ } ], "versions": { - "1.2.0": null, + "1.2.0": { + "api_version": 7, + "commit_sha": "d8d2985", + "released_on": "26-09-2022", + "md5sum": "1ef7d937e49a1aa954f56b3f9bf8a5fe" + }, "1.0.0": { "api_version": 7, "commit_sha": "3a8ba07", @@ -205,4 +210,4 @@ } } } -} +} \ No newline at end of file From cd25d292c8fc280a9500056598c05289c682fbff Mon Sep 17 00:00:00 2001 From: Cross Joy <87638792+CrossJoy@users.noreply.github.com> Date: Tue, 27 Sep 2022 22:29:10 +0800 Subject: [PATCH 6/8] Organize the version checker func Make it more readable on the top. --- plugins/utilities/easy_connect.py | 33 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/plugins/utilities/easy_connect.py b/plugins/utilities/easy_connect.py index 8f5eb24..e55f101 100644 --- a/plugins/utilities/easy_connect.py +++ b/plugins/utilities/easy_connect.py @@ -47,6 +47,23 @@ from typing import Any, Optional, Dict, List, Tuple, Type, Union, Callable from bastd.ui.gather.publictab import PublicGatherTab +def is_game_version_lower_than(version): + """ + Returns a boolean value indicating whether the current game + version is lower than the passed version. Useful for addressing + any breaking changes within game versions. + """ + game_version = tuple(map(int, ba.app.version.split("."))) + version = tuple(map(int, version.split("."))) + return game_version < version + + +if is_game_version_lower_than("1.7.7"): + ba_internal = _ba +else: + ba_internal = ba.internal + + class _HostLookupThread(threading.Thread): """Thread to fetch an addr.""" @@ -458,23 +475,7 @@ def popup_menu_selected_choice(self, window: popup.PopupMenu, ba.playsound(ba.getsound('gunCocking')) -def is_game_version_lower_than(version): - """ - Returns a boolean value indicating whether the current game - version is lower than the passed version. Useful for addressing - any breaking changes within game versions. - """ - game_version = tuple(map(int, ba.app.version.split("."))) - version = tuple(map(int, version.split("."))) - return game_version < version - - def replace(): - global ba_internal - if is_game_version_lower_than("1.7.7"): - ba_internal = _ba - else: - ba_internal = ba.internal manualtab.ManualGatherTab._build_favorites_tab = new_build_favorites_tab manualtab.ManualGatherTab._on_favorites_connect_press = new_on_favorites_connect_press manualtab.ManualGatherTab.auto_retry_dec = auto_retry_dec From b7036af184ada314dc40b04e76986355d9fc6951 Mon Sep 17 00:00:00 2001 From: Rikko Date: Tue, 27 Sep 2022 20:34:06 +0530 Subject: [PATCH 7/8] Set version to null for ci to autofill --- plugins/utilities.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index f51a3b4..bfd1197 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -119,12 +119,7 @@ } ], "versions": { - "1.2.0": { - "api_version": 7, - "commit_sha": "d8d2985", - "released_on": "26-09-2022", - "md5sum": "1ef7d937e49a1aa954f56b3f9bf8a5fe" - }, + "1.2.0": null, "1.0.0": { "api_version": 7, "commit_sha": "3a8ba07", @@ -210,4 +205,4 @@ } } } -} \ No newline at end of file +} From 2355cbdbc38a6bf6126ece07436888244e0fbfeb Mon Sep 17 00:00:00 2001 From: rikkolovescats Date: Tue, 27 Sep 2022 15:05:10 +0000 Subject: [PATCH 8/8] [ci] apply-version-metadata --- plugins/utilities.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/utilities.json b/plugins/utilities.json index bfd1197..ae08b42 100644 --- a/plugins/utilities.json +++ b/plugins/utilities.json @@ -119,7 +119,12 @@ } ], "versions": { - "1.2.0": null, + "1.2.0": { + "api_version": 7, + "commit_sha": "b7036af", + "released_on": "27-09-2022", + "md5sum": "c9d694c1beafba7957da34014a38d278" + }, "1.0.0": { "api_version": 7, "commit_sha": "3a8ba07", @@ -205,4 +210,4 @@ } } } -} +} \ No newline at end of file