replaced deprecated methods

This commit is contained in:
Loup-Garou911XD 2025-01-25 17:47:38 +05:30
parent 8e064ae970
commit a93fda3a85
5 changed files with 28 additions and 26 deletions

View file

@ -36,7 +36,7 @@ jobs:
autopep8 --in-place --recursive --max-line-length=100 .
- name: Commit AutoPEP8
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[ci] auto-format"
branch: ${{ github.head_ref }}
@ -46,7 +46,7 @@ jobs:
python test/auto_apply_version_metadata.py $(git log --pretty=format:'%h' -n 1)
- name: Commit Version Metadata
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[ci] apply-version-metadata"
branch: ${{ github.head_ref }}

View file

@ -692,6 +692,7 @@
}
],
"versions": {
"3.0.1": null,
"3.0.0": {
"api_version": 9,
"commit_sha": "32e5180",
@ -735,6 +736,7 @@
}
],
"versions": {
"2.1.1": null,
"2.1.0": {
"api_version": 9,
"commit_sha": "bb129cc",
@ -1421,6 +1423,7 @@
}
],
"versions": {
"1.5.1": null,
"1.5.0": {
"api_version": 9,
"commit_sha": "bb129cc",

View file

@ -77,11 +77,11 @@ def newconnect_to_party(address, port=43210, print_progress=False):
global ip_add
global p_port
bs.chatmessage(" Joined IP "+ip_add+" PORT "+str(p_port))
dd = bs.get_connection_to_host_info()
if dd.get('name', '') != '':
dd = bs.get_connection_to_host_info_2()
if dd != None and dd.get('name', '') != '':
title = dd['name']
bs.chatmessage(title)
if (dd != {}):
if (bool(dd)):
bs.disconnect_from_host()
ip_add = address
@ -240,8 +240,8 @@ class mututalServerThread():
self.timer = babase.AppTimer(10, self.checkPlayers, repeat=True)
def checkPlayers(self):
if bs.get_connection_to_host_info() != {}:
server_name = bs.get_connection_to_host_info()["name"]
if bool(bs.get_connection_to_host_info_2()):
server_name = bs.get_connection_to_host_info_2().name
players = []
for ros in bs.get_game_roster():
players.append(ros["display_string"])
@ -460,9 +460,9 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
icon=bui.gettexture('menuButton'),
iconscale=1.2)
info = bs.get_connection_to_host_info()
if info.get('name', '') != '':
title = info['name']
info = bs.get_connection_to_host_info_2()
if info != None:
title = info.name
else:
title = babase.Lstr(resource=self._r + '.titleText')
@ -907,10 +907,10 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
bui.textwidget(edit=self._text_field, text="")
return
elif sendtext == ".info":
if bs.get_connection_to_host_info() == {}:
if bs.get_connection_to_host_info_2() == None:
s_build = 0
else:
s_build = bs.get_connection_to_host_info()['build_number']
s_build = bs.get_connection_to_host_info_2()['build_number']
s_v = "0"
if s_build <= 14365:
s_v = " 1.4.148 or below"
@ -930,9 +930,9 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
bui.textwidget(edit=self._text_field, text="")
return
elif sendtext == ".save":
info = bs.get_connection_to_host_info()
info = bs.get_connection_to_host_info_2()
config = babase.app.config
if info.get('name', '') != '':
if info != None and info.get('name', '') != '':
title = info['name']
if not isinstance(config.get('Saved Servers'), dict):
config['Saved Servers'] = {}
@ -1163,8 +1163,9 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
"""
else:
# kick-votes appeared in build 14248
if (bs.get_connection_to_host_info().get('build_number', 0) <
14248):
info = bs.get_connection_to_host_info_2()
if bool(info) and (info.get('build_number', 0) <
14248):
bui.getsound('error').play()
bs.broadcastmessage(
babase.Lstr(resource='getTicketsWindow.unavailableText'),
@ -1554,12 +1555,12 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
current_choice=Quickreply[0],
delegate=self)
self._popup_type = "removeQuickReplySelect"
elif choice in ("hostInfo_Debug",) and isinstance(bs.get_connection_to_host_info(), dict):
if len(bs.get_connection_to_host_info()) > 0:
elif choice in ("hostInfo_Debug",) and isinstance(bs.get_connection_to_host_info_2(), dict):
if bs.get_connection_to_host_info_2() != None:
# print(_babase.get_connection_to_host_info(),type(_babase.get_connection_to_host_info()))
ChoiceDis = list(bs.get_connection_to_host_info().keys())
NewChoices = ["bs.broadcastmessage(str(bs.get_connection_to_host_info().get('%s')))" % (
ChoiceDis = list(bs.get_connection_to_host_info_2().keys())
NewChoices = ["bs.broadcastmessage(str(bs.get_connection_to_host_info_2().get('%s')))" % (
(str(i)).replace("'", r"'").replace('"', r'\\"')) for i in ChoiceDis]
PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
scale=_get_popup_window_scale(),

View file

@ -372,8 +372,7 @@ def get_event_loop(force_fresh=False):
def _generate_join_secret(self):
# resp = requests.get('https://legacy.ballistica.net/bsAccessCheck').text
try:
connection_info = bs.get_connection_to_host_info(
) if build_number < 21727 else bs.get_connection_to_host_info_2()
connection_info = bs.get_connection_to_host_info_2()
if connection_info:
addr = _last_server_addr
port = _last_server_port
@ -872,8 +871,7 @@ class DiscordRP(babase.Plugin):
def update_status(self) -> None:
roster = bs.get_game_roster()
connection_info = bs.get_connection_to_host_info(
) if build_number < 21727 else bs.get_connection_to_host_info_2()
connection_info = bs.get_connection_to_host_info_2()
self.rpc_thread.large_image_key = "bombsquadicon"
self.rpc_thread.large_image_text = "BombSquad"

View file

@ -274,7 +274,7 @@ def new_on_favorites_connect_press(self) -> None:
call=bs.WeakCall(
self._host_lookup_result)).start()
if self.retry_inter > 0 and (bs.get_connection_to_host_info() == {} or bs.get_connection_to_host_info()['build_number'] == 0):
if self.retry_inter > 0 and (bs.get_connection_to_host_info_2() == {} or bs.get_connection_to_host_info_2() == None or bs.get_connection_to_host_info_2()['build_number'] == 0):
bui.screenmessage("Server full or unreachable, Retrying....")
self._retry_timer = bs.AppTimer(self.retry_inter, babase.Call(
self._on_favorites_connect_press))
@ -714,7 +714,7 @@ class PartyQuickConnect(bui.Window):
self.direction = "right"
def connect(self, address, port):
if not self.closed and (bs.get_connection_to_host_info() == {} or bs.get_connection_to_host_info()['build_number'] == 0):
if not self.closed and (bs.get_connection_to_host_info_2() == {} or bs.get_connection_to_host_info_2() == None or bs.get_connection_to_host_info_2()['build_number'] == 0):
bui.textwidget(edit=self._title_text, text="Retrying....("+str(self.retry_count)+")")
self.retry_count += 1
bs.connect_to_party(address, port=port)