This commit is contained in:
Ayush Saini 2023-07-02 18:29:12 +05:30
commit d28f558470
2 changed files with 342 additions and 335 deletions

View file

@ -367,7 +367,12 @@
} }
], ],
"versions": { "versions": {
"2.0.0":null, "2.0.0": {
"api_version": 8,
"commit_sha": "da0e63d",
"released_on": "02-07-2023",
"md5sum": "7d90768d603fcf91b38ba7fa1d30501e"
},
"1.0.1": { "1.0.1": {
"api_version": 7, "api_version": 7,
"commit_sha": "64e8a5c", "commit_sha": "64e8a5c",

View file

@ -20,7 +20,7 @@ https://bombsquad-community.web.app/mods
''' '''
# added advanced ID revealer # added advanced ID revealer
# live ping # live ping
# Made by Mr.Smoothy - Plasma Boson # Made by Mr.Smoothy - Plasma Boson
import traceback import traceback
@ -193,12 +193,9 @@ if not isinstance(SystemEncode, str):
SystemEncode = "utf-8" SystemEncode = "utf-8"
PingThread().start() PingThread().start()
class chatloggThread(): class chatloggThread():
"""Thread for sending out game pings.""" """Thread for sending out game pings."""
@ -424,27 +421,27 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
240, 0) if uiscale is babase.UIScale.MEDIUM else (330, 20))) 240, 0) if uiscale is babase.UIScale.MEDIUM else (330, 20)))
self._cancel_button = bui.buttonwidget(parent=self._root_widget, self._cancel_button = bui.buttonwidget(parent=self._root_widget,
scale=0.7, scale=0.7,
position=(30, self._height - 47), position=(30, self._height - 47),
size=(50, 50),
label='',
on_activate_call=self.close,
autoselect=True,
color=(0.45, 0.63, 0.15),
icon=bui.gettexture('crossOut'),
iconscale=1.2)
self._smoothy_button = bui.buttonwidget(parent=self._root_widget,
scale=0.6,
position=(5, self._height - 47 - 40),
size=(50, 50), size=(50, 50),
label='69', label='',
on_activate_call=self.smoothy_roster_changer, on_activate_call=self.close,
autoselect=True, autoselect=True,
color=(0.45, 0.63, 0.15), color=(0.45, 0.63, 0.15),
icon=bui.gettexture('replayIcon'), icon=bui.gettexture('crossOut'),
iconscale=1.2) iconscale=1.2)
self._smoothy_button = bui.buttonwidget(parent=self._root_widget,
scale=0.6,
position=(5, self._height - 47 - 40),
size=(50, 50),
label='69',
on_activate_call=self.smoothy_roster_changer,
autoselect=True,
color=(0.45, 0.63, 0.15),
icon=bui.gettexture('replayIcon'),
iconscale=1.2)
bui.containerwidget(edit=self._root_widget, bui.containerwidget(edit=self._root_widget,
cancel_button=self._cancel_button) cancel_button=self._cancel_button)
self._menu_button = bui.buttonwidget( self._menu_button = bui.buttonwidget(
parent=self._root_widget, parent=self._root_widget,
@ -466,37 +463,37 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
title = babase.Lstr(resource=self._r + '.titleText') title = babase.Lstr(resource=self._r + '.titleText')
self._title_text = bui.textwidget(parent=self._root_widget, self._title_text = bui.textwidget(parent=self._root_widget,
scale=0.9, scale=0.9,
color=(0.5, 0.7, 0.5), color=(0.5, 0.7, 0.5),
text=title, text=title,
size=(120, 20), size=(120, 20),
position=(self._width * 0.5-60, position=(self._width * 0.5-60,
self._height - 29), self._height - 29),
on_select_call=self.title_selected, on_select_call=self.title_selected,
selectable=True, selectable=True,
maxwidth=self._width * 0.7, maxwidth=self._width * 0.7,
h_align='center',
v_align='center')
self._empty_str = bui.textwidget(parent=self._root_widget,
scale=0.75,
size=(0, 0),
position=(self._width * 0.5,
self._height - 65),
maxwidth=self._width * 0.85,
text="no one",
h_align='center', h_align='center',
v_align='center') v_align='center')
self._empty_str = bui.textwidget(parent=self._root_widget,
scale=0.75,
size=(0, 0),
position=(self._width * 0.5,
self._height - 65),
maxwidth=self._width * 0.85,
text="no one",
h_align='center',
v_align='center')
self._scroll_width = self._width - 50 self._scroll_width = self._width - 50
self._scrollwidget = bui.scrollwidget(parent=self._root_widget, self._scrollwidget = bui.scrollwidget(parent=self._root_widget,
size=(self._scroll_width, size=(self._scroll_width,
self._height - 200), self._height - 200),
position=(30, 80), position=(30, 80),
color=(0.4, 0.6, 0.3)) color=(0.4, 0.6, 0.3))
self._columnwidget = bui.columnwidget(parent=self._scrollwidget, self._columnwidget = bui.columnwidget(parent=self._scrollwidget,
border=2, border=2,
margin=0) margin=0)
bui.widget(edit=self._menu_button, down_widget=self._columnwidget) bui.widget(edit=self._menu_button, down_widget=self._columnwidget)
self._muted_text = bui.textwidget( self._muted_text = bui.textwidget(
@ -579,22 +576,22 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
# ) # )
bui.widget(edit=self._scrollwidget, bui.widget(edit=self._scrollwidget,
autoselect=True, autoselect=True,
left_widget=self._cancel_button, left_widget=self._cancel_button,
up_widget=self._cancel_button, up_widget=self._cancel_button,
down_widget=self._text_field) down_widget=self._text_field)
bui.widget(edit=self._columnwidget, bui.widget(edit=self._columnwidget,
autoselect=True, autoselect=True,
up_widget=self._cancel_button, up_widget=self._cancel_button,
down_widget=self._text_field) down_widget=self._text_field)
bui.containerwidget(edit=self._root_widget, selected_child=txt) bui.containerwidget(edit=self._root_widget, selected_child=txt)
btn = bui.buttonwidget(parent=self._root_widget, btn = bui.buttonwidget(parent=self._root_widget,
size=(50, 35), size=(50, 35),
label=babase.Lstr(resource=self._r + '.sendText'), label=babase.Lstr(resource=self._r + '.sendText'),
button_type='square', button_type='square',
autoselect=True, autoselect=True,
position=(self._width - 70, 35), position=(self._width - 70, 35),
on_activate_call=self._send_chat_message) on_activate_call=self._send_chat_message)
def _times_button_on_click(): def _times_button_on_click():
# self._popup_type = "send_Times_Press" # self._popup_type = "send_Times_Press"
@ -618,12 +615,12 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
self._send_msg_times = 1 self._send_msg_times = 1
self._times_button = bui.buttonwidget(parent=self._root_widget, self._times_button = bui.buttonwidget(parent=self._root_widget,
size=(50, 35), size=(50, 35),
label="Quick", label="Quick",
button_type='square', button_type='square',
autoselect=True, autoselect=True,
position=(30, 35), position=(30, 35),
on_activate_call=_times_button_on_click) on_activate_call=_times_button_on_click)
bui.textwidget(edit=txt, on_return_press_call=btn.activate) bui.textwidget(edit=txt, on_return_press_call=btn.activate)
self._name_widgets: List[bui.Widget] = [] self._name_widgets: List[bui.Widget] = []
@ -632,8 +629,8 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
self.smoothy_mode = 1 self.smoothy_mode = 1
self.full_chat_mode = False self.full_chat_mode = False
self._update_timer = babase.AppTimer(1.0, self._update_timer = babase.AppTimer(1.0,
bs.WeakCall(self._update), bs.WeakCall(self._update),
repeat=True) repeat=True)
self._update() self._update()
@ -679,34 +676,34 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
if babase.app.config.resolve('Chat Muted'): if babase.app.config.resolve('Chat Muted'):
txt = bui.textwidget(parent=self._columnwidget, txt = bui.textwidget(parent=self._columnwidget,
text=msg, text=msg,
h_align='left', h_align='left',
v_align='center', v_align='center',
size=(130, 13), size=(130, 13),
scale=0.55, scale=0.55,
position=(-0.6, 0), position=(-0.6, 0),
selectable=True, selectable=True,
click_activate=True, click_activate=True,
maxwidth=self._scroll_width * 0.94, maxwidth=self._scroll_width * 0.94,
shadow=0.3, shadow=0.3,
flatness=1.0) flatness=1.0)
bui.textwidget(edit=txt, bui.textwidget(edit=txt,
on_activate_call=babase.Call( on_activate_call=babase.Call(
self._on_chat_press, self._on_chat_press,
msg, txt)) msg, txt))
else: else:
txt = bui.textwidget(parent=self._columnwidget, txt = bui.textwidget(parent=self._columnwidget,
text=msg, text=msg,
h_align='left', h_align='left',
v_align='center', v_align='center',
size=(0, 13), size=(0, 13),
scale=0.55, scale=0.55,
maxwidth=self._scroll_width * 0.94, maxwidth=self._scroll_width * 0.94,
shadow=0.3, shadow=0.3,
flatness=1.0) flatness=1.0)
# btn = bui.buttonwidget(parent=self._columnwidget, # btn = bui.buttonwidget(parent=self._columnwidget,
# scale=0.7, # scale=0.7,
@ -726,14 +723,14 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
def _add_msg_when_muted(self, msg: str) -> None: def _add_msg_when_muted(self, msg: str) -> None:
txt = bui.textwidget(parent=self._columnwidget, txt = bui.textwidget(parent=self._columnwidget,
text=msg, text=msg,
h_align='left', h_align='left',
v_align='center', v_align='center',
size=(0, 13), size=(0, 13),
scale=0.55, scale=0.55,
maxwidth=self._scroll_width * 0.94, maxwidth=self._scroll_width * 0.94,
shadow=0.3, shadow=0.3,
flatness=1.0) flatness=1.0)
self._chat_texts.append(txt) self._chat_texts.append(txt)
if len(self._chat_texts) > 40: if len(self._chat_texts) > 40:
first = self._chat_texts.pop(0) first = self._chat_texts.pop(0)
@ -763,12 +760,12 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
transition='in_scale') transition='in_scale')
bui.textwidget(parent=cnt, bui.textwidget(parent=cnt,
size=(0, 0), size=(0, 0),
h_align='center', h_align='center',
v_align='center', v_align='center',
text='Enter nickname', text='Enter nickname',
maxwidth=c_width * 0.8, maxwidth=c_width * 0.8,
position=(c_width * 0.5, c_height - 60)) position=(c_width * 0.5, c_height - 60))
id = self._get_nick(arg) id = self._get_nick(arg)
self._player_nick_text = txt89 = bui.textwidget( self._player_nick_text = txt89 = bui.textwidget(
parent=cnt, parent=cnt,
@ -792,12 +789,12 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
position=(30, 30), position=(30, 30),
autoselect=True) autoselect=True)
okb = bui.buttonwidget(parent=cnt, okb = bui.buttonwidget(parent=cnt,
label='Rename', label='Rename',
size=(180, 60), size=(180, 60),
position=(c_width - 230, 30), position=(c_width - 230, 30),
on_activate_call=babase.Call( on_activate_call=babase.Call(
self._add_nick, arg), self._add_nick, arg),
autoselect=True) autoselect=True)
bui.widget(edit=cbtn, right_widget=okb) bui.widget(edit=cbtn, right_widget=okb)
bui.widget(edit=okb, left_widget=cbtn) bui.widget(edit=okb, left_widget=cbtn)
bui.textwidget(edit=txt89, on_return_press_call=okb.activate) bui.textwidget(edit=txt89, on_return_press_call=okb.activate)
@ -812,7 +809,7 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
config['players nick'][arg] = new_name_raw config['players nick'][arg] = new_name_raw
config.commit() config.commit()
bui.containerwidget(edit=self._nick_rename_window, bui.containerwidget(edit=self._nick_rename_window,
transition='out_scale') transition='out_scale')
# bui.containerwidget(edit=self._root_widget,transition='in_scale') # bui.containerwidget(edit=self._root_widget,transition='in_scale')
def _get_nick(self, id): def _get_nick(self, id):
@ -838,7 +835,7 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
except: except:
babase.print_exception() babase.print_exception()
bs.broadcastmessage(babase.Lstr(resource="replayWriteErrorText").evaluate() + bs.broadcastmessage(babase.Lstr(resource="replayWriteErrorText").evaluate() +
""+traceback.format_exc(), color=(1, 0, 0)) ""+traceback.format_exc(), color=(1, 0, 0))
def _on_menu_button_press(self) -> None: def _on_menu_button_press(self) -> None:
is_muted = babase.app.config.resolve('Chat Muted') is_muted = babase.app.config.resolve('Chat Muted')
@ -1187,7 +1184,7 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
#NewShareCodeWindow(origin_widget=self.get_root_widget(), delegate=None,code = "300",execText = u"_babase._disconnectClient(%d,{Value})"%self._popup_party_member_client_id) #NewShareCodeWindow(origin_widget=self.get_root_widget(), delegate=None,code = "300",execText = u"_babase._disconnectClient(%d,{Value})"%self._popup_party_member_client_id)
def joinbombspot(self): def joinbombspot(self):
bui.open_url("https://discord.gg/ucyaesh") bui.open_url("https://discord.gg/ucyaesh")
def _update(self) -> None: def _update(self) -> None:
@ -1224,17 +1221,17 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
if not self._roster: if not self._roster:
top_section_height = 60 top_section_height = 60
bui.textwidget(edit=self._empty_str, bui.textwidget(edit=self._empty_str,
text=babase.Lstr(resource=self._r + '.emptyText')) text=babase.Lstr(resource=self._r + '.emptyText'))
bui.scrollwidget(edit=self._scrollwidget, bui.scrollwidget(edit=self._scrollwidget,
size=(self._width - 50, size=(self._width - 50,
self._height - top_section_height - 110), self._height - top_section_height - 110),
position=(30, 80)) position=(30, 80))
elif self.full_chat_mode: elif self.full_chat_mode:
top_section_height = 60 top_section_height = 60
bui.scrollwidget(edit=self._scrollwidget, bui.scrollwidget(edit=self._scrollwidget,
size=(self._width - 50, size=(self._width - 50,
self._height - top_section_height - 75), self._height - top_section_height - 75),
position=(30, 80)) position=(30, 80))
else: else:
columns = 1 if len( columns = 1 if len(
@ -1286,19 +1283,19 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
p_str = '???' p_str = '???'
try: try:
widget = bui.textwidget(parent=self._root_widget, widget = bui.textwidget(parent=self._root_widget,
position=(pos[0], pos[1]), position=(pos[0], pos[1]),
scale=t_scale, scale=t_scale,
size=(c_width * 0.85, 30), size=(c_width * 0.85, 30),
maxwidth=c_width * 0.85, maxwidth=c_width * 0.85,
color=(1, 1, color=(1, 1,
1) if index == 0 else 1) if index == 0 else
(1, 1, 1), (1, 1, 1),
selectable=True, selectable=True,
autoselect=True, autoselect=True,
click_activate=True, click_activate=True,
text=babase.Lstr(value=p_str), text=babase.Lstr(value=p_str),
h_align='left', h_align='left',
v_align='center') v_align='center')
self._name_widgets.append(widget) self._name_widgets.append(widget)
except Exception: except Exception:
pass pass
@ -1317,10 +1314,10 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
# client_id is more readily available though). # client_id is more readily available though).
try: try:
bui.textwidget(edit=widget, bui.textwidget(edit=widget,
on_activate_call=babase.Call( on_activate_call=babase.Call(
self._on_party_member_press, self._on_party_member_press,
self._roster[index]['client_id'], self._roster[index]['client_id'],
is_host, widget)) is_host, widget))
except Exception: except Exception:
pass pass
pos = (self._width * 0.53 - c_width_total * 0.5 + pos = (self._width * 0.53 - c_width_total * 0.5 +
@ -1348,7 +1345,7 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
maxwidth=c_width * 0.96 - twd, maxwidth=c_width * 0.96 - twd,
color=(0.1, 1, 0.1, 0.5), color=(0.1, 1, 0.1, 0.5),
text=babase.Lstr(resource=self._r + text=babase.Lstr(resource=self._r +
'.hostText'), '.hostText'),
scale=0.4, scale=0.4,
shadow=0.1, shadow=0.1,
flatness=1.0)) flatness=1.0))
@ -1357,10 +1354,10 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
try: try:
bui.textwidget(edit=self._empty_str, text='') bui.textwidget(edit=self._empty_str, text='')
bui.scrollwidget(edit=self._scrollwidget, bui.scrollwidget(edit=self._scrollwidget,
size=(self._width - 50, size=(self._width - 50,
max(100, self._height - 139 - max(100, self._height - 139 -
c_height_total)), c_height_total)),
position=(30, 80)) position=(30, 80))
except Exception: except Exception:
pass pass
@ -1410,7 +1407,8 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
"""Called when a choice is selected in the popup.""" """Called when a choice is selected in the popup."""
global unmuted_names global unmuted_names
if self._popup_type == "banTimePress": if self._popup_type == "banTimePress":
result = _babase.disconnect_client(self._popup_party_member_client_id, ban_time=int(choice)) result = _babase.disconnect_client(
self._popup_party_member_client_id, ban_time=int(choice))
if not result: if not result:
bui.getsound('error').play() bui.getsound('error').play()
bs.broadcastmessage( bs.broadcastmessage(
@ -1419,7 +1417,7 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
elif self._popup_type == "send_Times_Press": elif self._popup_type == "send_Times_Press":
self._send_msg_times = int(choice) self._send_msg_times = int(choice)
bui.buttonwidget(edit=self._times_button, label="%s:%d" % bui.buttonwidget(edit=self._times_button, label="%s:%d" %
(_getTransText("Times"), getattr(self, "_send_msg_times", 1))) (_getTransText("Times"), getattr(self, "_send_msg_times", 1)))
elif self._popup_type == "chatmessagepress": elif self._popup_type == "chatmessagepress":
if choice == "mute": if choice == "mute":
@ -1539,7 +1537,7 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
data.append(newReply) data.append(newReply)
self._write_quick_responds(data) self._write_quick_responds(data)
bs.broadcastmessage(_getTransText("Something_is_added") % bs.broadcastmessage(_getTransText("Something_is_added") %
newReply, color=(0, 1, 0)) newReply, color=(0, 1, 0))
bui.getsound("dingSmallHigh").play() bui.getsound("dingSmallHigh").play()
except: except:
babase.print_exception() babase.print_exception()
@ -1653,7 +1651,8 @@ class ModifiedPartyWindow(bascenev1lib_party.PartyWindow):
self.popup_menu_selected_choice(popup_window, choice.replace( self.popup_menu_selected_choice(popup_window, choice.replace(
r"{$PlayerID}", str(playerID).replace("'", r"'").replace('"', r'\\"'))) r"{$PlayerID}", str(playerID).replace("'", r"'").replace('"', r'\\"')))
else: else:
bs.broadcastmessage(_getTransText("No_valid_player_id_found"), (1, 0, 0)) bs.broadcastmessage(_getTransText(
"No_valid_player_id_found"), (1, 0, 0))
bui.getsound("error").play() bui.getsound("error").play()
elif curKeyWord in (r"{$AccountInfo}",) != 0: elif curKeyWord in (r"{$AccountInfo}",) != 0:
self.popup_menu_selected_choice(popup_window, choice.replace( self.popup_menu_selected_choice(popup_window, choice.replace(
@ -1695,7 +1694,8 @@ def fetchAccountInfo(account, loading_widget):
if account in fdata: if account in fdata:
servers = fdata[account] servers = fdata[account]
url = f'https://{BCSSERVER}/player?key={base64.b64encode(account.encode("utf-8")).decode("utf-8")}&base64=true' url = f'https://{BCSSERVER}/player?key={base64.b64encode(account.encode("utf-8")).decode("utf-8")}&base64=true'
req = urllib.request.Request(url, headers={"User-Agent": f'BS{_babase.env().get("build_number", 0)}',"Accept-Language": "en-US,en;q=0.9",}) req = urllib.request.Request(url, headers={
"User-Agent": f'BS{_babase.env().get("build_number", 0)}', "Accept-Language": "en-US,en;q=0.9", })
data = urllib.request.urlopen(req) data = urllib.request.urlopen(req)
account_data = json.loads(data.read().decode('utf-8'))[0] account_data = json.loads(data.read().decode('utf-8'))[0]
pbid = account_data["pbid"] pbid = account_data["pbid"]
@ -1705,7 +1705,7 @@ def fetchAccountInfo(account, loading_widget):
pass pass
# _babase.pushcall(Call(updateAccountWindow,loading_widget,accounts[0]),from_other_thread=True) # _babase.pushcall(Call(updateAccountWindow,loading_widget,accounts[0]),from_other_thread=True)
_babase.pushcall(Call(CustomAccountViewerWindow, pbid, account_data, _babase.pushcall(Call(CustomAccountViewerWindow, pbid, account_data,
servers, loading_widget), from_other_thread=True) servers, loading_widget), from_other_thread=True)
class CustomAccountViewerWindow(viewer.AccountViewerWindow): class CustomAccountViewerWindow(viewer.AccountViewerWindow):
@ -1728,25 +1728,25 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
if data is None: if data is None:
bui.textwidget(edit=self._loading_text, text="") bui.textwidget(edit=self._loading_text, text="")
bui.textwidget(parent=self._scrollwidget, bui.textwidget(parent=self._scrollwidget,
size=(0, 0), size=(0, 0),
position=(170, 200), position=(170, 200),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.5, scale=0.5,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text="Mutual servers", text="Mutual servers",
maxwidth=300) maxwidth=300)
v = 200-21 v = 200-21
for server in self.servers: for server in self.servers:
bui.textwidget(parent=self._scrollwidget, bui.textwidget(parent=self._scrollwidget,
size=(0, 0), size=(0, 0),
position=(170, v), position=(170, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55, scale=0.55,
text=server, text=server,
maxwidth=300) maxwidth=300)
v -= 23 v -= 23
else: else:
for account in self.custom_data["accounts"]: for account in self.custom_data["accounts"]:
@ -1770,7 +1770,7 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
account_name_spacing = 15 account_name_spacing = 15
tscale = 0.65 tscale = 0.65
ts_height = _babase.get_string_height(trophystr, ts_height = _babase.get_string_height(trophystr,
suppress_warning=True) suppress_warning=True)
sub_width = self._width - 80 sub_width = self._width - 80
sub_height = 500 + ts_height * tscale + \ sub_height = 500 + ts_height * tscale + \
account_name_spacing * len(data['accountDisplayStrings']) account_name_spacing * len(data['accountDisplayStrings'])
@ -1840,42 +1840,42 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
resource='accountSettingsWindow.accountsText', resource='accountSettingsWindow.accountsText',
fallback_resource='settingsWindow.accountText') fallback_resource='settingsWindow.accountText')
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text=account_title, text=account_title,
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
draw_small = (showing_character draw_small = (showing_character
or len(data['accountDisplayStrings']) > 1) or len(data['accountDisplayStrings']) > 1)
v -= 14 if draw_small else 20 v -= 14 if draw_small else 20
for account_string in data['accountDisplayStrings']: for account_string in data['accountDisplayStrings']:
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55 if draw_small else 0.8, scale=0.55 if draw_small else 0.8,
text=account_string, text=account_string,
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= account_name_spacing v -= account_name_spacing
v += account_name_spacing v += account_name_spacing
v -= 25 if showing_character else 29 v -= 25 if showing_character else 29
# ======================================================================= # =======================================================================
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text=str(self.pb_id), text=str(self.pb_id),
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
self._copy_btn = bui.buttonwidget( self._copy_btn = bui.buttonwidget(
parent=self._subcontainer, parent=self._subcontainer,
position=(sub_width * center - 120, v - 9), position=(sub_width * center - 120, v - 9),
@ -1888,106 +1888,106 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
v -= 24 v -= 24
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text="Name", text="Name",
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 26 v -= 26
for name in self.custom_data["names"]: for name in self.custom_data["names"]:
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.51, scale=0.51,
text=name, text=name,
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 13 v -= 13
v -= 8 v -= 8
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text="Created On", text="Created On",
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 19 v -= 19
d = self.custom_data["createdOn"] d = self.custom_data["createdOn"]
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55, scale=0.55,
text=d[:d.index("T")], text=d[:d.index("T")],
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 29 v -= 29
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text="Discord", text="Discord",
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 19 v -= 19
if len(self.custom_data["discord"]) > 0: if len(self.custom_data["discord"]) > 0:
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55, scale=0.55,
text=self.custom_data["discord"][0]["username"] + text=self.custom_data["discord"][0]["username"] +
","+self.custom_data["discord"][0]["id"], ","+self.custom_data["discord"][0]["id"],
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 26 v -= 26
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text="Mutual servers", text="Mutual servers",
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v = -19 v = -19
v = 270 v = 270
for server in self.servers: for server in self.servers:
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55, scale=0.55,
text=server, text=server,
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 13 v -= 13
v -= 16 v -= 16
# ================================================================== # ==================================================================
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text=babase.Lstr(resource='rankText'), text=babase.Lstr(resource='rankText'),
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 14 v -= 14
if data['rank'] is None: if data['rank'] is None:
rank_str = '-' rank_str = '-'
@ -2001,7 +2001,7 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
subs=[('${RANK}', str(data['rank'][2])), subs=[('${RANK}', str(data['rank'][2])),
('${NAME}', ('${NAME}',
babase.Lstr(translate=('leagueNames', babase.Lstr(translate=('leagueNames',
data['rank'][0]))), data['rank'][0]))),
('${SUFFIX}', '')]).evaluate() ('${SUFFIX}', '')]).evaluate()
rank_str_width = min( rank_str_width = min(
sub_width * maxwidth_scale, sub_width * maxwidth_scale,
@ -2017,24 +2017,24 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
suffix_offset = None suffix_offset = None
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55, scale=0.55,
text=rank_str, text=rank_str,
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
if suffix_offset is not None: if suffix_offset is not None:
assert data['rank'] is not None assert data['rank'] is not None
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center + suffix_offset, position=(sub_width * center + suffix_offset,
v + 3), v + 3),
h_align='left', h_align='left',
v_align='center', v_align='center',
scale=0.29, scale=0.29,
flatness=1.0, flatness=1.0,
text='[' + str(data['rank'][1]) + ']') text='[' + str(data['rank'][1]) + ']')
v -= 14 v -= 14
str_raw = babase.Lstr( str_raw = babase.Lstr(
@ -2047,14 +2047,14 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
subs=[ subs=[
('${S}', ('${S}',
babase.Lstr(resource='league.seasonText', babase.Lstr(resource='league.seasonText',
subs=[('${NUMBER}', str(prev_rank[0]))])), subs=[('${NUMBER}', str(prev_rank[0]))])),
('${I}', ('${I}',
babase.Lstr(resource='league.rankInLeagueText', babase.Lstr(resource='league.rankInLeagueText',
subs=[('${RANK}', str(prev_rank[3])), subs=[('${RANK}', str(prev_rank[3])),
('${NAME}', ('${NAME}',
babase.Lstr(translate=('leagueNames', babase.Lstr(translate=('leagueNames',
prev_rank[1]))), prev_rank[1]))),
('${SUFFIX}', '')])) ('${SUFFIX}', '')]))
]).evaluate() ]).evaluate()
rank_str_width = min( rank_str_width = min(
sub_width * maxwidth_scale, sub_width * maxwidth_scale,
@ -2069,49 +2069,49 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
else: else:
suffix_offset = None suffix_offset = None
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center + old_offs, v), position=(sub_width * center + old_offs, v),
h_align='left', h_align='left',
v_align='center', v_align='center',
scale=0.3, scale=0.3,
text=rank_str, text=rank_str,
flatness=1.0, flatness=1.0,
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
if suffix_offset is not None: if suffix_offset is not None:
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center + old_offs + position=(sub_width * center + old_offs +
suffix_offset, v + 1), suffix_offset, v + 1),
h_align='left', h_align='left',
v_align='center', v_align='center',
scale=0.20, scale=0.20,
flatness=1.0, flatness=1.0,
text='[' + str(prev_rank[2]) + ']') text='[' + str(prev_rank[2]) + ']')
prev_ranks_shown += 1 prev_ranks_shown += 1
v -= 10 v -= 10
v -= 13 v -= 13
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
flatness=1.0, flatness=1.0,
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
text=babase.Lstr(resource='achievementsText'), text=babase.Lstr(resource='achievementsText'),
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 14 v -= 14
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=0.55, scale=0.55,
text=str(data['achievementsCompleted']) + ' / ' + text=str(data['achievementsCompleted']) + ' / ' +
str(len(bui.app.classic.ach.achievements)), str(len(bui.app.classic.ach.achievements)),
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 25 v -= 25
if prev_ranks_shown == 0 and showing_character: if prev_ranks_shown == 0 and showing_character:
@ -2123,30 +2123,32 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
maxwidth_scale = 0.9 maxwidth_scale = 0.9
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, 0), size=(0, 0),
position=(sub_width * center, v), position=(sub_width * center, v),
h_align='center', h_align='center',
v_align='center', v_align='center',
scale=title_scale, scale=title_scale,
color=bui.app.ui_v1.infotextcolor, color=bui.app.ui_v1.infotextcolor,
flatness=1.0, flatness=1.0,
text=babase.Lstr(resource='trophiesThisSeasonText', text=babase.Lstr(resource='trophiesThisSeasonText',
fallback_resource='trophiesText'), fallback_resource='trophiesText'),
maxwidth=sub_width * maxwidth_scale) maxwidth=sub_width * maxwidth_scale)
v -= 19 v -= 19
bui.textwidget(parent=self._subcontainer, bui.textwidget(parent=self._subcontainer,
size=(0, ts_height), size=(0, ts_height),
position=(sub_width * 0.5, position=(sub_width * 0.5,
v - ts_height * tscale), v - ts_height * tscale),
h_align='center', h_align='center',
v_align='top', v_align='top',
corner_scale=tscale, corner_scale=tscale,
text=trophystr) text=trophystr)
except Exception: except Exception:
babase.print_exception('Error displaying account info.') babase.print_exception('Error displaying account info.')
# ba_meta export plugin # ba_meta export plugin
class bySmoothy(babase.Plugin): class bySmoothy(babase.Plugin):
def __init__(self): def __init__(self):
bs.connect_to_party = newconnect_to_party bs.connect_to_party = newconnect_to_party