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

View file

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

View file

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

View file

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

View file

@ -274,7 +274,7 @@ def new_on_favorites_connect_press(self) -> None:
call=bs.WeakCall( call=bs.WeakCall(
self._host_lookup_result)).start() 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....") bui.screenmessage("Server full or unreachable, Retrying....")
self._retry_timer = bs.AppTimer(self.retry_inter, babase.Call( self._retry_timer = bs.AppTimer(self.retry_inter, babase.Call(
self._on_favorites_connect_press)) self._on_favorites_connect_press))
@ -714,7 +714,7 @@ class PartyQuickConnect(bui.Window):
self.direction = "right" self.direction = "right"
def connect(self, address, port): 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)+")") bui.textwidget(edit=self._title_text, text="Retrying....("+str(self.retry_count)+")")
self.retry_count += 1 self.retry_count += 1
bs.connect_to_party(address, port=port) bs.connect_to_party(address, port=port)