Skip to content

Commit

Permalink
replaced deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
Loup-Garou911XD committed Jan 25, 2025
1 parent 8e064ae commit 68737c7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
33 changes: 17 additions & 16 deletions plugins/utilities/advanced_party_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -240,8 +240,8 @@ def run(self):
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"])
Expand Down Expand Up @@ -460,8 +460,8 @@ def __init__(self, origin: Sequence[float] = (0, 0)):
icon=bui.gettexture('menuButton'),
iconscale=1.2)

info = bs.get_connection_to_host_info()
if info.get('name', '') != '':
info = bs.get_connection_to_host_info_2()
if info != None and info.get('name', '') != '':
title = info['name']
else:
title = babase.Lstr(resource=self._r + '.titleText')
Expand Down Expand Up @@ -907,10 +907,10 @@ def _send_chat_message(self) -> None:
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"
Expand All @@ -930,9 +930,9 @@ def _send_chat_message(self) -> None:
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'] = {}
Expand Down Expand Up @@ -1163,7 +1163,8 @@ def _kick_selected_player(self):
"""
else:
# 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):
bui.getsound('error').play()
bs.broadcastmessage(
Expand Down Expand Up @@ -1554,12 +1555,12 @@ def popup_menu_selected_choice(self, popup_window: PopupMenuWindow,
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(),
Expand Down
6 changes: 2 additions & 4 deletions plugins/utilities/discord_richpresence.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ def is_discord_running():
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
Expand Down Expand Up @@ -872,8 +871,7 @@ def _get_current_map_name(self) -> Tuple[str | None, str | None]:

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"
Expand Down
4 changes: 2 additions & 2 deletions plugins/utilities/easy_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -714,7 +714,7 @@ def move_right(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion plugins/utilities/rejoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def j(address, port=43210, print_progress=False):
try:
if bs.get_connection_to_host_info() is not None:
if bs.get_connection_to_host_info_2() is not None:
bs.disconnect_from_host()
m.i = address
m.p = port
Expand Down

0 comments on commit 68737c7

Please sign in to comment.