mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
[ci] auto-format
This commit is contained in:
parent
723579c969
commit
7337368ad7
2 changed files with 1313 additions and 1170 deletions
|
|
@ -16,33 +16,37 @@
|
||||||
# live ping support for bcs
|
# live ping support for bcs
|
||||||
|
|
||||||
# Made by Mr.Smoothy - Plasma Boson
|
# Made by Mr.Smoothy - Plasma Boson
|
||||||
|
import traceback
|
||||||
|
import codecs
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import shutil
|
||||||
|
import copy
|
||||||
|
import urllib
|
||||||
|
import os
|
||||||
|
from bastd.ui.account import viewer
|
||||||
|
from bastd.ui.popup import PopupMenuWindow, PopupWindow
|
||||||
|
from ba._general import Call
|
||||||
|
import base64
|
||||||
|
import datetime
|
||||||
|
import ssl
|
||||||
|
import bastd.ui.party as bastd_party
|
||||||
|
from typing import List, Sequence, Optional, Dict, Any, Union
|
||||||
|
from bastd.ui.colorpicker import ColorPickerExact
|
||||||
|
from bastd.ui.confirm import ConfirmWindow
|
||||||
|
from dataclasses import dataclass
|
||||||
|
import math
|
||||||
|
import time
|
||||||
|
import ba
|
||||||
|
import _ba
|
||||||
|
from typing import TYPE_CHECKING, cast
|
||||||
|
import urllib.request
|
||||||
|
from _thread import start_new_thread
|
||||||
|
import threading
|
||||||
version_str = "7"
|
version_str = "7"
|
||||||
|
|
||||||
import os,urllib
|
|
||||||
import os,sys,re,json,codecs,traceback,base64
|
|
||||||
import threading
|
|
||||||
import time,copy,datetime,shutil
|
|
||||||
|
|
||||||
from _thread import start_new_thread
|
|
||||||
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, cast
|
|
||||||
|
|
||||||
import _ba
|
|
||||||
import ba
|
|
||||||
import time
|
|
||||||
import math
|
|
||||||
import threading
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from bastd.ui.popup import PopupMenuWindow,PopupWindow
|
|
||||||
from bastd.ui.confirm import ConfirmWindow
|
|
||||||
from bastd.ui.colorpicker import ColorPickerExact
|
|
||||||
|
|
||||||
from typing import List, Sequence, Optional, Dict, Any, Union
|
|
||||||
|
|
||||||
import bastd.ui.party as bastd_party
|
|
||||||
cache_chat = []
|
cache_chat = []
|
||||||
connect = _ba.connect_to_party
|
connect = _ba.connect_to_party
|
||||||
disconnect = _ba.disconnect_from_host
|
disconnect = _ba.disconnect_from_host
|
||||||
|
|
@ -56,8 +60,9 @@ p_port=43210
|
||||||
p_name = "local"
|
p_name = "local"
|
||||||
current_ping = 0.0
|
current_ping = 0.0
|
||||||
enable_typing = False # this will prevent auto ping to update textwidget when user actually typing chat message
|
enable_typing = False # this will prevent auto ping to update textwidget when user actually typing chat message
|
||||||
import ssl
|
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
ssl._create_default_https_context = ssl._create_unverified_context
|
||||||
|
|
||||||
|
|
||||||
def newconnect_to_party(address, port=43210, print_progress=False):
|
def newconnect_to_party(address, port=43210, print_progress=False):
|
||||||
global ip_add
|
global ip_add
|
||||||
global p_port
|
global p_port
|
||||||
|
|
@ -77,6 +82,8 @@ def newconnect_to_party(address,port=43210,print_progress=False):
|
||||||
|
|
||||||
DEBUG_SERVER_COMMUNICATION = False
|
DEBUG_SERVER_COMMUNICATION = False
|
||||||
DEBUG_PROCESSING = False
|
DEBUG_PROCESSING = False
|
||||||
|
|
||||||
|
|
||||||
class PingThread(threading.Thread):
|
class PingThread(threading.Thread):
|
||||||
"""Thread for sending out game pings."""
|
"""Thread for sending out game pings."""
|
||||||
|
|
||||||
|
|
@ -166,11 +173,14 @@ class PingThread(threading.Thread):
|
||||||
try:
|
try:
|
||||||
import OnlineTranslator
|
import OnlineTranslator
|
||||||
tranTypes = [item for item in dir(OnlineTranslator) if item.startswith("Translator_")]
|
tranTypes = [item for item in dir(OnlineTranslator) if item.startswith("Translator_")]
|
||||||
if "item" in globals():del item
|
if "item" in globals():
|
||||||
except:tranTypes = []#;ba.print_exception()
|
del item
|
||||||
|
except:
|
||||||
|
tranTypes = [] # ;ba.print_exception()
|
||||||
|
|
||||||
RecordFilesDir = os.path.join(_ba.env()["python_directory_user"], "Configs" + os.sep)
|
RecordFilesDir = os.path.join(_ba.env()["python_directory_user"], "Configs" + os.sep)
|
||||||
if not os.path.exists(RecordFilesDir):os.makedirs(RecordFilesDir)
|
if not os.path.exists(RecordFilesDir):
|
||||||
|
os.makedirs(RecordFilesDir)
|
||||||
|
|
||||||
version_str = "3.0.1"
|
version_str = "3.0.1"
|
||||||
|
|
||||||
|
|
@ -180,6 +190,7 @@ SystemEncode = sys.getfilesystemencoding()
|
||||||
if not isinstance(SystemEncode, str):
|
if not isinstance(SystemEncode, str):
|
||||||
SystemEncode = "utf-8"
|
SystemEncode = "utf-8"
|
||||||
|
|
||||||
|
|
||||||
def update_ping():
|
def update_ping():
|
||||||
try:
|
try:
|
||||||
_ba.set_ping_widget_value(current_ping)
|
_ba.set_ping_widget_value(current_ping)
|
||||||
|
|
@ -188,23 +199,28 @@ def update_ping():
|
||||||
if hasattr(_ba, "ping_widget") and _ba.ping_widget.exists():
|
if hasattr(_ba, "ping_widget") and _ba.ping_widget.exists():
|
||||||
ba.textwidget(edit=_ba.ping_widget, text="Ping:"+str(current_ping)+" ms")
|
ba.textwidget(edit=_ba.ping_widget, text="Ping:"+str(current_ping)+" ms")
|
||||||
|
|
||||||
|
|
||||||
PingThread().start()
|
PingThread().start()
|
||||||
|
|
||||||
import datetime
|
|
||||||
try:
|
try:
|
||||||
from ba._generated.enums import TimeType
|
from ba._generated.enums import TimeType
|
||||||
except:
|
except:
|
||||||
from ba._enums import TimeType
|
from ba._enums import TimeType
|
||||||
|
|
||||||
|
|
||||||
class chatloggThread():
|
class chatloggThread():
|
||||||
"""Thread for sending out game pings."""
|
"""Thread for sending out game pings."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.saved_msg = []
|
self.saved_msg = []
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
global chatlogger
|
global chatlogger
|
||||||
self.timerr = ba.Timer(5.0, self.chatlogg, repeat=True, timetype=TimeType.REAL)
|
self.timerr = ba.Timer(5.0, self.chatlogg, repeat=True, timetype=TimeType.REAL)
|
||||||
|
|
||||||
def chatlogg(self):
|
def chatlogg(self):
|
||||||
global chatlogger
|
global chatlogger
|
||||||
chats = _ba.get_chat_messages()
|
chats = _ba.get_chat_messages()
|
||||||
|
|
@ -220,14 +236,18 @@ class chatloggThread():
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.timerr = None
|
self.timerr = None
|
||||||
|
|
||||||
def save(self, msg):
|
def save(self, msg):
|
||||||
x = str(datetime.datetime.now())
|
x = str(datetime.datetime.now())
|
||||||
t = open(os.path.join(_ba.env()["python_directory_user"], "Chat logged.txt"), "a+")
|
t = open(os.path.join(_ba.env()["python_directory_user"], "Chat logged.txt"), "a+")
|
||||||
t.write(x+" : " + msg + "\n")
|
t.write(x+" : " + msg + "\n")
|
||||||
t.close()
|
t.close()
|
||||||
|
|
||||||
|
|
||||||
class mututalServerThread():
|
class mututalServerThread():
|
||||||
def run(self):
|
def run(self):
|
||||||
self.timer = ba.Timer(10, self.checkPlayers, repeat=True, timetype=TimeType.REAL)
|
self.timer = ba.Timer(10, self.checkPlayers, repeat=True, timetype=TimeType.REAL)
|
||||||
|
|
||||||
def checkPlayers(self):
|
def checkPlayers(self):
|
||||||
if _ba.get_connection_to_host_info() != {}:
|
if _ba.get_connection_to_host_info() != {}:
|
||||||
server_name = _ba.get_connection_to_host_info()["name"]
|
server_name = _ba.get_connection_to_host_info()["name"]
|
||||||
|
|
@ -236,6 +256,7 @@ class mututalServerThread():
|
||||||
players.append(ros["display_string"])
|
players.append(ros["display_string"])
|
||||||
start_new_thread(dump_mutual_servers, (players, server_name,))
|
start_new_thread(dump_mutual_servers, (players, server_name,))
|
||||||
|
|
||||||
|
|
||||||
def dump_mutual_servers(players, server_name):
|
def dump_mutual_servers(players, server_name):
|
||||||
filePath = os.path.join(RecordFilesDir, "players.json")
|
filePath = os.path.join(RecordFilesDir, "players.json")
|
||||||
data = {}
|
data = {}
|
||||||
|
|
@ -251,6 +272,8 @@ def dump_mutual_servers(players,server_name):
|
||||||
data[player] = [server_name]
|
data[player] = [server_name]
|
||||||
f = open(filePath, "w")
|
f = open(filePath, "w")
|
||||||
json.dump(data, f)
|
json.dump(data, f)
|
||||||
|
|
||||||
|
|
||||||
mututalServerThread().run()
|
mututalServerThread().run()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -264,6 +287,7 @@ class customchatThread():
|
||||||
chats = _ba.get_chat_messages()
|
chats = _ba.get_chat_messages()
|
||||||
for msg in chats: # fill up old chat , to avoid old msg popup
|
for msg in chats: # fill up old chat , to avoid old msg popup
|
||||||
cache_chat.append(msg)
|
cache_chat.append(msg)
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
|
|
@ -288,6 +312,7 @@ class customchatThread():
|
||||||
else:
|
else:
|
||||||
self.timerr = None
|
self.timerr = None
|
||||||
|
|
||||||
|
|
||||||
def chatloggerstatus():
|
def chatloggerstatus():
|
||||||
global chatlogger
|
global chatlogger
|
||||||
if chatlogger:
|
if chatlogger:
|
||||||
|
|
@ -295,6 +320,7 @@ def chatloggerstatus():
|
||||||
else:
|
else:
|
||||||
return "Turn on chat logger"
|
return "Turn on chat logger"
|
||||||
|
|
||||||
|
|
||||||
def _getTransText(text, isBaLstr=False, same_fb=False):
|
def _getTransText(text, isBaLstr=False, same_fb=False):
|
||||||
global Current_Lang
|
global Current_Lang
|
||||||
global chatlogger
|
global chatlogger
|
||||||
|
|
@ -354,19 +380,20 @@ command to kick %s?",
|
||||||
return (Language_Texts.get(text, "#Unknown Text#" if not same_fb else text) if not isBaLstr else
|
return (Language_Texts.get(text, "#Unknown Text#" if not same_fb else text) if not isBaLstr else
|
||||||
ba.Lstr(resource="??Unknown??", fallback_value=Language_Texts.get(text, "#Unknown Text#" if not same_fb else text)))
|
ba.Lstr(resource="??Unknown??", fallback_value=Language_Texts.get(text, "#Unknown Text#" if not same_fb else text)))
|
||||||
|
|
||||||
|
|
||||||
def _get_popup_window_scale() -> float:
|
def _get_popup_window_scale() -> float:
|
||||||
uiscale = ba.app.ui.uiscale
|
uiscale = ba.app.ui.uiscale
|
||||||
return (2.3 if uiscale is ba.UIScale.SMALL else
|
return (2.3 if uiscale is ba.UIScale.SMALL else
|
||||||
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
|
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
|
||||||
|
|
||||||
|
|
||||||
def _creat_Lstr_list(string_list: list = []) -> list:
|
def _creat_Lstr_list(string_list: list = []) -> list:
|
||||||
return ([ba.Lstr(resource="??Unknown??", fallback_value=item) for item in string_list])
|
return ([ba.Lstr(resource="??Unknown??", fallback_value=item) for item in string_list])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
customchatThread().run()
|
customchatThread().run()
|
||||||
|
|
||||||
|
|
||||||
class ModifiedPartyWindow(bastd_party.PartyWindow):
|
class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
def __init__(self, origin: Sequence[float] = (0, 0)):
|
def __init__(self, origin: Sequence[float] = (0, 0)):
|
||||||
_ba.set_party_window_open(True)
|
_ba.set_party_window_open(True)
|
||||||
|
|
@ -377,17 +404,15 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
self._popup_party_member_is_host: Optional[bool] = None
|
self._popup_party_member_is_host: Optional[bool] = None
|
||||||
self._width = 500
|
self._width = 500
|
||||||
|
|
||||||
|
|
||||||
uiscale = ba.app.ui.uiscale
|
uiscale = ba.app.ui.uiscale
|
||||||
self._height = (365 if uiscale is ba.UIScale.SMALL else
|
self._height = (365 if uiscale is ba.UIScale.SMALL else
|
||||||
480 if uiscale is ba.UIScale.MEDIUM else 600)
|
480 if uiscale is ba.UIScale.MEDIUM else 600)
|
||||||
|
|
||||||
# Custom color here
|
# Custom color here
|
||||||
self._bg_color = ba.app.config.get("PartyWindow_Main_Color",(0.40, 0.55, 0.20)) if not isinstance(self._getCustomSets().get("Color"),(list,tuple)) else self._getCustomSets().get("Color")
|
self._bg_color = ba.app.config.get("PartyWindow_Main_Color", (0.40, 0.55, 0.20)) if not isinstance(
|
||||||
if not isinstance(self._bg_color,(list,tuple)) or not len(self._bg_color) == 3:self._bg_color = (0.40, 0.55, 0.20)
|
self._getCustomSets().get("Color"), (list, tuple)) else self._getCustomSets().get("Color")
|
||||||
|
if not isinstance(self._bg_color, (list, tuple)) or not len(self._bg_color) == 3:
|
||||||
|
self._bg_color = (0.40, 0.55, 0.20)
|
||||||
|
|
||||||
|
|
||||||
ba.Window.__init__(self, root_widget=ba.containerwidget(
|
ba.Window.__init__(self, root_widget=ba.containerwidget(
|
||||||
size=(self._width, self._height),
|
size=(self._width, self._height),
|
||||||
|
|
@ -541,7 +566,6 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
v_align='center',
|
v_align='center',
|
||||||
corner_scale=0.7)
|
corner_scale=0.7)
|
||||||
|
|
||||||
|
|
||||||
# for m in _ba.get_chat_messages():
|
# for m in _ba.get_chat_messages():
|
||||||
# if m:
|
# if m:
|
||||||
# ttchat=ba.textwidget(
|
# ttchat=ba.textwidget(
|
||||||
|
|
@ -575,8 +599,6 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
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"
|
||||||
# allow_range = 100 if _ba.get_foreground_host_session() is not None else 4
|
# allow_range = 100 if _ba.get_foreground_host_session() is not None else 4
|
||||||
|
|
@ -618,16 +640,16 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
timetype=ba.TimeType.REAL)
|
timetype=ba.TimeType.REAL)
|
||||||
|
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def title_selected(self):
|
def title_selected(self):
|
||||||
|
|
||||||
self.full_chat_mode = self.full_chat_mode == False
|
self.full_chat_mode = self.full_chat_mode == False
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def smoothy_roster_changer(self):
|
def smoothy_roster_changer(self):
|
||||||
|
|
||||||
self.smoothy_mode = (self.smoothy_mode+1) % 3
|
self.smoothy_mode = (self.smoothy_mode+1) % 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def on_chat_message(self, msg: str) -> None:
|
def on_chat_message(self, msg: str) -> None:
|
||||||
|
|
@ -635,6 +657,7 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
# print("on_chat"+msg)
|
# print("on_chat"+msg)
|
||||||
if True:
|
if True:
|
||||||
self._add_msg(msg)
|
self._add_msg(msg)
|
||||||
|
|
||||||
def _on_chat_press(self, msg, widget):
|
def _on_chat_press(self, msg, widget):
|
||||||
global unmuted_names
|
global unmuted_names
|
||||||
if msg.split(":")[0] in unmuted_names:
|
if msg.split(":")[0] in unmuted_names:
|
||||||
|
|
@ -655,12 +678,10 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
|
|
||||||
# _ba.chatmessage("pressed")
|
# _ba.chatmessage("pressed")
|
||||||
|
|
||||||
|
|
||||||
def _add_msg(self, msg: str) -> None:
|
def _add_msg(self, msg: str) -> None:
|
||||||
try:
|
try:
|
||||||
if ba.app.config.resolve('Chat Muted'):
|
if ba.app.config.resolve('Chat Muted'):
|
||||||
|
|
||||||
|
|
||||||
txt = ba.textwidget(parent=self._columnwidget,
|
txt = ba.textwidget(parent=self._columnwidget,
|
||||||
text=msg,
|
text=msg,
|
||||||
h_align='left',
|
h_align='left',
|
||||||
|
|
@ -722,13 +743,16 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
first = self._chat_texts.pop(0)
|
first = self._chat_texts.pop(0)
|
||||||
first.delete()
|
first.delete()
|
||||||
ba.containerwidget(edit=self._columnwidget, visible_child=txt)
|
ba.containerwidget(edit=self._columnwidget, visible_child=txt)
|
||||||
|
|
||||||
def color_picker_closing(self, picker) -> None:
|
def color_picker_closing(self, picker) -> None:
|
||||||
ba._appconfig.commit_app_config()
|
ba._appconfig.commit_app_config()
|
||||||
|
|
||||||
def color_picker_selected_color(self, picker, color) -> None:
|
def color_picker_selected_color(self, picker, color) -> None:
|
||||||
# bs.animateArray(self._root_widget,"color",3,{0:self._bg_color,1500:color})
|
# bs.animateArray(self._root_widget,"color",3,{0:self._bg_color,1500:color})
|
||||||
ba.containerwidget(edit=self._root_widget, color=color)
|
ba.containerwidget(edit=self._root_widget, color=color)
|
||||||
self._bg_color = color
|
self._bg_color = color
|
||||||
ba.app.config["PartyWindow_Main_Color"] = color
|
ba.app.config["PartyWindow_Main_Color"] = color
|
||||||
|
|
||||||
def _on_nick_rename_press(self, arg) -> None:
|
def _on_nick_rename_press(self, arg) -> None:
|
||||||
|
|
||||||
ba.containerwidget(edit=self._root_widget, transition='out_scale')
|
ba.containerwidget(edit=self._root_widget, transition='out_scale')
|
||||||
|
|
@ -782,6 +806,7 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
ba.widget(edit=okb, left_widget=cbtn)
|
ba.widget(edit=okb, left_widget=cbtn)
|
||||||
ba.textwidget(edit=txt89, on_return_press_call=okb.activate)
|
ba.textwidget(edit=txt89, on_return_press_call=okb.activate)
|
||||||
ba.containerwidget(edit=cnt, cancel_button=cbtn, start_button=okb)
|
ba.containerwidget(edit=cnt, cancel_button=cbtn, start_button=okb)
|
||||||
|
|
||||||
def _add_nick(self, arg):
|
def _add_nick(self, arg):
|
||||||
config = ba.app.config
|
config = ba.app.config
|
||||||
new_name_raw = cast(str, ba.textwidget(query=self._player_nick_text))
|
new_name_raw = cast(str, ba.textwidget(query=self._player_nick_text))
|
||||||
|
|
@ -793,6 +818,7 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
ba.containerwidget(edit=self._nick_rename_window,
|
ba.containerwidget(edit=self._nick_rename_window,
|
||||||
transition='out_scale')
|
transition='out_scale')
|
||||||
# ba.containerwidget(edit=self._root_widget,transition='in_scale')
|
# ba.containerwidget(edit=self._root_widget,transition='in_scale')
|
||||||
|
|
||||||
def _get_nick(self, id):
|
def _get_nick(self, id):
|
||||||
config = ba.app.config
|
config = ba.app.config
|
||||||
if not isinstance(config.get('players nick'), dict):
|
if not isinstance(config.get('players nick'), dict):
|
||||||
|
|
@ -804,36 +830,46 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
|
|
||||||
def _reset_game_record(self) -> None:
|
def _reset_game_record(self) -> None:
|
||||||
try:
|
try:
|
||||||
dir_path = _ba.get_replays_dir();curFilePath = os.path.join(dir_path+os.sep,"__lastReplay.brp").encode(SystemEncode)
|
dir_path = _ba.get_replays_dir()
|
||||||
newFileName = str(ba.Lstr(resource="replayNameDefaultText").evaluate()+" (%s)"%(datetime.datetime.strftime(datetime.datetime.now(),"%Y_%m_%d_%H_%M_%S"))+".brp")
|
curFilePath = os.path.join(dir_path+os.sep, "__lastReplay.brp").encode(SystemEncode)
|
||||||
|
newFileName = str(ba.Lstr(resource="replayNameDefaultText").evaluate(
|
||||||
|
)+" (%s)" % (datetime.datetime.strftime(datetime.datetime.now(), "%Y_%m_%d_%H_%M_%S"))+".brp")
|
||||||
newFilePath = os.path.join(dir_path+os.sep, newFileName).encode(SystemEncode)
|
newFilePath = os.path.join(dir_path+os.sep, newFileName).encode(SystemEncode)
|
||||||
#print(curFilePath, newFilePath)
|
#print(curFilePath, newFilePath)
|
||||||
# os.rename(curFilePath,newFilePath)
|
# os.rename(curFilePath,newFilePath)
|
||||||
shutil.copyfile(curFilePath, newFilePath)
|
shutil.copyfile(curFilePath, newFilePath)
|
||||||
_ba.reset_game_activity_tracking()
|
_ba.reset_game_activity_tracking()
|
||||||
ba.screenmessage(_getTransText("Game_Record_Saved") % newFileName, color=(1, 1, 1))
|
ba.screenmessage(_getTransText("Game_Record_Saved") % newFileName, color=(1, 1, 1))
|
||||||
except:ba.print_exception();ba.screenmessage(ba.Lstr(resource="replayWriteErrorText").evaluate()+"\
|
except:
|
||||||
"+traceback.format_exc(),color = (1,0,0))
|
ba.print_exception()
|
||||||
|
ba.screenmessage(ba.Lstr(resource="replayWriteErrorText").evaluate() +
|
||||||
|
""+traceback.format_exc(), color=(1, 0, 0))
|
||||||
|
|
||||||
def _on_menu_button_press(self) -> None:
|
def _on_menu_button_press(self) -> None:
|
||||||
is_muted = ba.app.config.resolve('Chat Muted')
|
is_muted = ba.app.config.resolve('Chat Muted')
|
||||||
global chatlogger
|
global chatlogger
|
||||||
choices = ["unmute" if is_muted else "mute","screenmsg","addQuickReply","removeQuickReply","chatlogger","credits"]
|
choices = ["unmute" if is_muted else "mute", "screenmsg",
|
||||||
|
"addQuickReply", "removeQuickReply", "chatlogger", "credits"]
|
||||||
DisChoices = [_getTransText("unmuteall", isBaLstr=True) if is_muted else _getTransText("muteall", isBaLstr=True),
|
DisChoices = [_getTransText("unmuteall", isBaLstr=True) if is_muted else _getTransText("muteall", isBaLstr=True),
|
||||||
_getTransText("screenmsgoff",isBaLstr = True) if screenmsg else _getTransText("screenmsgon",isBaLstr = True),
|
_getTransText("screenmsgoff", isBaLstr=True) if screenmsg else _getTransText(
|
||||||
|
"screenmsgon", isBaLstr=True),
|
||||||
|
|
||||||
_getTransText("Add_a_Quick_Reply", isBaLstr=True),
|
_getTransText("Add_a_Quick_Reply", isBaLstr=True),
|
||||||
_getTransText("Remove_a_Quick_Reply", isBaLstr=True),
|
_getTransText("Remove_a_Quick_Reply", isBaLstr=True),
|
||||||
_getTransText("chatloggeroff",isBaLstr = True) if chatlogger else _getTransText("chatloggeron",isBaLstr = True),
|
_getTransText("chatloggeroff", isBaLstr=True) if chatlogger else _getTransText(
|
||||||
|
"chatloggeron", isBaLstr=True),
|
||||||
_getTransText("Credits_for_This", isBaLstr=True)
|
_getTransText("Credits_for_This", isBaLstr=True)
|
||||||
]
|
]
|
||||||
|
|
||||||
if len(tranTypes) > 0:
|
if len(tranTypes) > 0:
|
||||||
choices.append("translator");DisChoices.append(_getTransText("Translator",isBaLstr = True))
|
choices.append("translator")
|
||||||
|
DisChoices.append(_getTransText("Translator", isBaLstr=True))
|
||||||
|
|
||||||
choices.append("resetGameRecord")
|
choices.append("resetGameRecord")
|
||||||
DisChoices.append(_getTransText("Restart_Game_Record", isBaLstr=True))
|
DisChoices.append(_getTransText("Restart_Game_Record", isBaLstr=True))
|
||||||
if self._getCustomSets().get("Enable_HostInfo_Debug", False):
|
if self._getCustomSets().get("Enable_HostInfo_Debug", False):
|
||||||
choices.append("hostInfo_Debug");DisChoices.append(_getTransText("Debug_for_Host_Info",isBaLstr = True))
|
choices.append("hostInfo_Debug")
|
||||||
|
DisChoices.append(_getTransText("Debug_for_Host_Info", isBaLstr=True))
|
||||||
|
|
||||||
PopupMenuWindow(
|
PopupMenuWindow(
|
||||||
position=self._menu_button.get_screen_space_center(),
|
position=self._menu_button.get_screen_space_center(),
|
||||||
|
|
@ -842,12 +878,14 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
choices_display=DisChoices,
|
choices_display=DisChoices,
|
||||||
current_choice="unmute" if is_muted else "mute", delegate=self)
|
current_choice="unmute" if is_muted else "mute", delegate=self)
|
||||||
self._popup_type = "menu"
|
self._popup_type = "menu"
|
||||||
|
|
||||||
def _on_party_member_press(self, client_id: int, is_host: bool,
|
def _on_party_member_press(self, client_id: int, is_host: bool,
|
||||||
widget: ba.Widget) -> None:
|
widget: ba.Widget) -> None:
|
||||||
# if we"re the host, pop up "kick" options for all non-host members
|
# if we"re the host, pop up "kick" options for all non-host members
|
||||||
if _ba.get_foreground_host_session() is not None:
|
if _ba.get_foreground_host_session() is not None:
|
||||||
kick_str = ba.Lstr(resource="kickText")
|
kick_str = ba.Lstr(resource="kickText")
|
||||||
else:kick_str = ba.Lstr(resource="kickVoteText")
|
else:
|
||||||
|
kick_str = ba.Lstr(resource="kickVoteText")
|
||||||
choices = ["kick", "@ this guy", "info", "adminkick"]
|
choices = ["kick", "@ this guy", "info", "adminkick"]
|
||||||
|
|
||||||
choices_display = [kick_str, _getTransText("Mention_this_guy", isBaLstr=True), ba.Lstr(resource="??Unknown??", fallback_value="Info"),
|
choices_display = [kick_str, _getTransText("Mention_this_guy", isBaLstr=True), ba.Lstr(resource="??Unknown??", fallback_value="Info"),
|
||||||
|
|
@ -855,10 +893,10 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if len(self._getCustomSets().get("partyMemberPress_Custom") if isinstance(self._getCustomSets().get("partyMemberPress_Custom"), dict) else {}) > 0:
|
if len(self._getCustomSets().get("partyMemberPress_Custom") if isinstance(self._getCustomSets().get("partyMemberPress_Custom"), dict) else {}) > 0:
|
||||||
choices.append("customAction");choices_display.append(_getTransText("Custom_Action",isBaLstr = True))
|
choices.append("customAction")
|
||||||
except:ba.print_exception()
|
choices_display.append(_getTransText("Custom_Action", isBaLstr=True))
|
||||||
|
except:
|
||||||
|
ba.print_exception()
|
||||||
|
|
||||||
PopupMenuWindow(position=widget.get_screen_space_center(),
|
PopupMenuWindow(position=widget.get_screen_space_center(),
|
||||||
scale=_get_popup_window_scale(),
|
scale=_get_popup_window_scale(),
|
||||||
|
|
@ -970,8 +1008,10 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
# else:
|
# else:
|
||||||
# _ba.chatmessage(sendtext)
|
# _ba.chatmessage(sendtext)
|
||||||
# ba.textwidget(edit=self._text_field,text="")
|
# ba.textwidget(edit=self._text_field,text="")
|
||||||
|
|
||||||
def _get_quick_responds(self):
|
def _get_quick_responds(self):
|
||||||
if not hasattr(self,"_caches") or not isinstance(self._caches,dict):self._caches = {}
|
if not hasattr(self, "_caches") or not isinstance(self._caches, dict):
|
||||||
|
self._caches = {}
|
||||||
try:
|
try:
|
||||||
filePath = os.path.join(RecordFilesDir, "Quickmessage.txt")
|
filePath = os.path.join(RecordFilesDir, "Quickmessage.txt")
|
||||||
|
|
||||||
|
|
@ -991,19 +1031,29 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
self._caches["quickReplys"] = (Text).split("\\n")
|
self._caches["quickReplys"] = (Text).split("\\n")
|
||||||
self._caches["Vertify_Quickresponse_Text"] = os.path.getmtime(filePath)
|
self._caches["Vertify_Quickresponse_Text"] = os.path.getmtime(filePath)
|
||||||
return (self._caches.get("quickReplys", []))
|
return (self._caches.get("quickReplys", []))
|
||||||
except:ba.print_exception();ba.screenmessage(ba.Lstr(resource="errorText"),(1,0,0));ba.playsound(ba.getsound("error"))
|
except:
|
||||||
|
ba.print_exception()
|
||||||
|
ba.screenmessage(ba.Lstr(resource="errorText"), (1, 0, 0))
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
|
|
||||||
def _write_quick_responds(self, data):
|
def _write_quick_responds(self, data):
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(RecordFilesDir, "Quickmessage.txt"), "wb") as writer:
|
with open(os.path.join(RecordFilesDir, "Quickmessage.txt"), "wb") as writer:
|
||||||
writer.write("\\n".join(data).encode("utf-8"))
|
writer.write("\\n".join(data).encode("utf-8"))
|
||||||
except:ba.print_exception();ba.screenmessage(ba.Lstr(resource="errorText"),(1,0,0));ba.playsound(ba.getsound("error"))
|
except:
|
||||||
|
ba.print_exception()
|
||||||
|
ba.screenmessage(ba.Lstr(resource="errorText"), (1, 0, 0))
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
|
|
||||||
def _getCustomSets(self):
|
def _getCustomSets(self):
|
||||||
try:
|
try:
|
||||||
if not hasattr(self,"_caches") or not isinstance(self._caches,dict):self._caches = {}
|
if not hasattr(self, "_caches") or not isinstance(self._caches, dict):
|
||||||
|
self._caches = {}
|
||||||
try:
|
try:
|
||||||
from VirtualHost import MainSettings
|
from VirtualHost import MainSettings
|
||||||
if MainSettings.get("Custom_PartyWindow_Sets", {}) != self._caches.get("PartyWindow_Sets", {}):
|
if MainSettings.get("Custom_PartyWindow_Sets", {}) != self._caches.get("PartyWindow_Sets", {}):
|
||||||
self._caches["PartyWindow_Sets"] = MainSettings.get("Custom_PartyWindow_Sets",{})
|
self._caches["PartyWindow_Sets"] = MainSettings.get(
|
||||||
|
"Custom_PartyWindow_Sets", {})
|
||||||
except:
|
except:
|
||||||
try:
|
try:
|
||||||
filePath = os.path.join(RecordFilesDir, "Settings.json")
|
filePath = os.path.join(RecordFilesDir, "Settings.json")
|
||||||
|
|
@ -1013,50 +1063,80 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
Text = Reader.read()
|
Text = Reader.read()
|
||||||
if Text.startswith(str(codecs.BOM_UTF8)):
|
if Text.startswith(str(codecs.BOM_UTF8)):
|
||||||
Text = Text[3:]
|
Text = Text[3:]
|
||||||
self._caches["PartyWindow_Sets"] = json.loads(Text.decode("utf-8")).get("Custom_PartyWindow_Sets",{})
|
self._caches["PartyWindow_Sets"] = json.loads(
|
||||||
self._caches["Vertify_MainSettings.json_Text"] = os.path.getmtime(filePath)
|
Text.decode("utf-8")).get("Custom_PartyWindow_Sets", {})
|
||||||
except:ba.print_exception()
|
self._caches["Vertify_MainSettings.json_Text"] = os.path.getmtime(
|
||||||
|
filePath)
|
||||||
|
except:
|
||||||
|
ba.print_exception()
|
||||||
return (self._caches.get("PartyWindow_Sets") if isinstance(self._caches.get("PartyWindow_Sets"), dict) else {})
|
return (self._caches.get("PartyWindow_Sets") if isinstance(self._caches.get("PartyWindow_Sets"), dict) else {})
|
||||||
|
|
||||||
except:ba.print_exception()
|
except:
|
||||||
|
ba.print_exception()
|
||||||
|
|
||||||
def _getObjectByID(self, type="playerName", ID=None):
|
def _getObjectByID(self, type="playerName", ID=None):
|
||||||
if ID is None:ID = self._popup_party_member_client_id
|
if ID is None:
|
||||||
type = type.lower();output = []
|
ID = self._popup_party_member_client_id
|
||||||
|
type = type.lower()
|
||||||
|
output = []
|
||||||
for roster in self._roster:
|
for roster in self._roster:
|
||||||
if type.startswith("all"):
|
if type.startswith("all"):
|
||||||
if type in ("roster","fullrecord"):output += [roster]
|
if type in ("roster", "fullrecord"):
|
||||||
|
output += [roster]
|
||||||
elif type.find("player") != -1 and roster["players"] != []:
|
elif type.find("player") != -1 and roster["players"] != []:
|
||||||
if type.find("namefull") != -1:output += [(i["name_full"]) for i in roster["players"]]
|
if type.find("namefull") != -1:
|
||||||
elif type.find("name") != -1:output += [(i["name"]) for i in roster["players"]]
|
output += [(i["name_full"]) for i in roster["players"]]
|
||||||
elif type.find("playerid") != -1:output += [i["id"] for i in roster["players"]]
|
elif type.find("name") != -1:
|
||||||
elif type.lower() in ("account","displaystring"):output += [(roster["display_string"])]
|
output += [(i["name"]) for i in roster["players"]]
|
||||||
|
elif type.find("playerid") != -1:
|
||||||
|
output += [i["id"] for i in roster["players"]]
|
||||||
|
elif type.lower() in ("account", "displaystring"):
|
||||||
|
output += [(roster["display_string"])]
|
||||||
elif roster["client_id"] == ID and not type.startswith("all"):
|
elif roster["client_id"] == ID and not type.startswith("all"):
|
||||||
try:
|
try:
|
||||||
if type in ("roster","fullrecord"):return(roster)
|
if type in ("roster", "fullrecord"):
|
||||||
|
return (roster)
|
||||||
elif type.find("player") != -1 and roster["players"] != []:
|
elif type.find("player") != -1 and roster["players"] != []:
|
||||||
if len(roster["players"]) == 1 or type.find("singleplayer") != -1:
|
if len(roster["players"]) == 1 or type.find("singleplayer") != -1:
|
||||||
if type.find("namefull") != -1:return((roster["players"][0]["name_full"]))
|
if type.find("namefull") != -1:
|
||||||
elif type.find("name") != -1:return((roster["players"][0]["name"]))
|
return ((roster["players"][0]["name_full"]))
|
||||||
elif type.find("playerid") != -1:return(roster["players"][0]["id"])
|
elif type.find("name") != -1:
|
||||||
|
return ((roster["players"][0]["name"]))
|
||||||
|
elif type.find("playerid") != -1:
|
||||||
|
return (roster["players"][0]["id"])
|
||||||
else:
|
else:
|
||||||
if type.find("namefull") != -1:return([(i["name_full"]) for i in roster["players"]])
|
if type.find("namefull") != -1:
|
||||||
elif type.find("name") != -1:return([(i["name"]) for i in roster["players"]])
|
return ([(i["name_full"]) for i in roster["players"]])
|
||||||
elif type.find("playerid") != -1:return([i["id"] for i in roster["players"]])
|
elif type.find("name") != -1:
|
||||||
elif type.lower() in ("account","displaystring"):return((roster["display_string"]))
|
return ([(i["name"]) for i in roster["players"]])
|
||||||
except:ba.print_exception()
|
elif type.find("playerid") != -1:
|
||||||
|
return ([i["id"] for i in roster["players"]])
|
||||||
|
elif type.lower() in ("account", "displaystring"):
|
||||||
|
return ((roster["display_string"]))
|
||||||
|
except:
|
||||||
|
ba.print_exception()
|
||||||
|
|
||||||
return (None if len(output) == 0 else output)
|
return (None if len(output) == 0 else output)
|
||||||
|
|
||||||
def _edit_text_msg_box(self, text, type="rewrite"):
|
def _edit_text_msg_box(self, text, type="rewrite"):
|
||||||
if not isinstance(type,str) or not isinstance(text,str):return
|
if not isinstance(type, str) or not isinstance(text, str):
|
||||||
type = type.lower();text = (text)
|
return
|
||||||
if type.find("add") != -1:ba.textwidget(edit=self._text_field,text=ba.textwidget(query=self._text_field)+text)
|
type = type.lower()
|
||||||
else:ba.textwidget(edit=self._text_field,text=text)
|
text = (text)
|
||||||
def _send_admin_kick_command(self):_ba.chatmessage("/kick " + str(self._popup_party_member_client_id))
|
if type.find("add") != -1:
|
||||||
|
ba.textwidget(edit=self._text_field, text=ba.textwidget(query=self._text_field)+text)
|
||||||
|
else:
|
||||||
|
ba.textwidget(edit=self._text_field, text=text)
|
||||||
|
|
||||||
|
def _send_admin_kick_command(self): _ba.chatmessage(
|
||||||
|
"/kick " + str(self._popup_party_member_client_id))
|
||||||
|
|
||||||
def new_input_window_callback(self, got_text, flag, code):
|
def new_input_window_callback(self, got_text, flag, code):
|
||||||
if got_text:
|
if got_text:
|
||||||
if flag.startswith("Host_Kick_Player:"):
|
if flag.startswith("Host_Kick_Player:"):
|
||||||
try:
|
try:
|
||||||
result = _ba.disconnect_client(self._popup_party_member_client_id, ban_time=int(code))
|
result = _ba.disconnect_client(
|
||||||
|
self._popup_party_member_client_id, ban_time=int(code))
|
||||||
if not result:
|
if not result:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
ba.screenmessage(
|
ba.screenmessage(
|
||||||
|
|
@ -1066,7 +1146,6 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
def _kick_selected_player(self):
|
def _kick_selected_player(self):
|
||||||
"""
|
"""
|
||||||
result = _ba._disconnectClient(self._popup_party_member_client_id,banTime)
|
result = _ba._disconnectClient(self._popup_party_member_client_id,banTime)
|
||||||
|
|
@ -1082,7 +1161,8 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
PopupMenuWindow(position=self.get_root_widget().get_screen_space_center(),
|
PopupMenuWindow(position=self.get_root_widget().get_screen_space_center(),
|
||||||
scale=_get_popup_window_scale(),
|
scale=_get_popup_window_scale(),
|
||||||
choices=[str(item) for item in choices],
|
choices=[str(item) for item in choices],
|
||||||
choices_display=_creat_Lstr_list([_getTransText("Ban_For_%d_Seconds")%item for item in choices]),
|
choices_display=_creat_Lstr_list(
|
||||||
|
[_getTransText("Ban_For_%d_Seconds") % item for item in choices]),
|
||||||
current_choice="Share_Server_Info",
|
current_choice="Share_Server_Info",
|
||||||
delegate=self)
|
delegate=self)
|
||||||
"""
|
"""
|
||||||
|
|
@ -1101,7 +1181,8 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# Ban for 5 minutes.
|
# Ban for 5 minutes.
|
||||||
result = _ba.disconnect_client(self._popup_party_member_client_id, ban_time=5 * 60)
|
result = _ba.disconnect_client(
|
||||||
|
self._popup_party_member_client_id, ban_time=5 * 60)
|
||||||
if not result:
|
if not result:
|
||||||
ba.playsound(ba.getsound('error'))
|
ba.playsound(ba.getsound('error'))
|
||||||
ba.screenmessage(
|
ba.screenmessage(
|
||||||
|
|
@ -1118,6 +1199,7 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
import random
|
import random
|
||||||
url = ['https://discord.gg/CbxhJTrRta', 'https://discord.gg/ucyaesh']
|
url = ['https://discord.gg/CbxhJTrRta', 'https://discord.gg/ucyaesh']
|
||||||
ba.open_url(url[random.randint(0, 1)])
|
ba.open_url(url[random.randint(0, 1)])
|
||||||
|
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
|
|
@ -1208,7 +1290,6 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
p_str = self._roster[index][
|
p_str = self._roster[index][
|
||||||
'display_string']
|
'display_string']
|
||||||
|
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
ba.print_exception(
|
ba.print_exception(
|
||||||
'Error calcing client name str.')
|
'Error calcing client name str.')
|
||||||
|
|
@ -1292,6 +1373,7 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
position=(30, 80))
|
position=(30, 80))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def hide_screen_msg(self):
|
def hide_screen_msg(self):
|
||||||
file = open('ba_data/data/languages/english.json')
|
file = open('ba_data/data/languages/english.json')
|
||||||
eng = json.loads(file.read())
|
eng = json.loads(file.read())
|
||||||
|
|
@ -1346,7 +1428,8 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
color=(1, 0, 0))
|
color=(1, 0, 0))
|
||||||
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)
|
||||||
ba.buttonwidget(edit = self._times_button,label="%s:%d"%(_getTransText("Times"),getattr(self,"_send_msg_times",1)))
|
ba.buttonwidget(edit=self._times_button, label="%s:%d" %
|
||||||
|
(_getTransText("Times"), getattr(self, "_send_msg_times", 1)))
|
||||||
|
|
||||||
elif self._popup_type == "chatmessagepress":
|
elif self._popup_type == "chatmessagepress":
|
||||||
if choice == "mute":
|
if choice == "mute":
|
||||||
|
|
@ -1355,7 +1438,6 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
if choice == "unmute":
|
if choice == "unmute":
|
||||||
unmuted_names.append(self.msg_user_selected)
|
unmuted_names.append(self.msg_user_selected)
|
||||||
|
|
||||||
|
|
||||||
elif self._popup_type == "partyMemberPress":
|
elif self._popup_type == "partyMemberPress":
|
||||||
if choice == "kick":
|
if choice == "kick":
|
||||||
ConfirmWindow(text=_getTransText("Normal_kick_confirm") % self._getObjectByID("account"),
|
ConfirmWindow(text=_getTransText("Normal_kick_confirm") % self._getObjectByID("account"),
|
||||||
|
|
@ -1377,19 +1459,23 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
origin_widget=self.get_root_widget())
|
origin_widget=self.get_root_widget())
|
||||||
|
|
||||||
elif choice == "@ this guy":
|
elif choice == "@ this guy":
|
||||||
ChoiceDis = [];NewChoices = []
|
ChoiceDis = []
|
||||||
|
NewChoices = []
|
||||||
account = self._getObjectByID("account")
|
account = self._getObjectByID("account")
|
||||||
ChoiceDis.append(account)
|
ChoiceDis.append(account)
|
||||||
temp = self._getObjectByID("playerNameFull")
|
temp = self._getObjectByID("playerNameFull")
|
||||||
if temp is not None:
|
if temp is not None:
|
||||||
if isinstance(temp,str) and temp not in ChoiceDis:ChoiceDis.append(temp)
|
if isinstance(temp, str) and temp not in ChoiceDis:
|
||||||
|
ChoiceDis.append(temp)
|
||||||
elif isinstance(temp, (list, tuple)):
|
elif isinstance(temp, (list, tuple)):
|
||||||
for item in temp:
|
for item in temp:
|
||||||
if isinstance(item,str) and item not in ChoiceDis:ChoiceDis.append(item)
|
if isinstance(item, str) and item not in ChoiceDis:
|
||||||
|
ChoiceDis.append(item)
|
||||||
# print("r\\""
|
# print("r\\""
|
||||||
|
|
||||||
for item in ChoiceDis:
|
for item in ChoiceDis:
|
||||||
NewChoices.append(u"self._edit_text_msg_box('%s','add')"%(item.replace("'",r"'").replace('"',r'\\"')))
|
NewChoices.append(u"self._edit_text_msg_box('%s','add')" %
|
||||||
|
(item.replace("'", r"'").replace('"', r'\\"')))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
nick = self._get_nick(account)
|
nick = self._get_nick(account)
|
||||||
|
|
@ -1404,10 +1490,13 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
self._popup_type = "Custom_Exec_Choice"
|
self._popup_type = "Custom_Exec_Choice"
|
||||||
elif choice == "customAction":
|
elif choice == "customAction":
|
||||||
customActionSets = self._getCustomSets()
|
customActionSets = self._getCustomSets()
|
||||||
customActionSets = customActionSets.get("partyMemberPress_Custom") if isinstance(customActionSets.get("partyMemberPress_Custom"),dict) else {}
|
customActionSets = customActionSets.get("partyMemberPress_Custom") if isinstance(
|
||||||
ChoiceDis = [];NewChoices = []
|
customActionSets.get("partyMemberPress_Custom"), dict) else {}
|
||||||
|
ChoiceDis = []
|
||||||
|
NewChoices = []
|
||||||
for key, item in customActionSets.items():
|
for key, item in customActionSets.items():
|
||||||
ChoiceDis.append(key);NewChoices.append(item)
|
ChoiceDis.append(key)
|
||||||
|
NewChoices.append(item)
|
||||||
if len(ChoiceDis) > 0:
|
if len(ChoiceDis) > 0:
|
||||||
p = PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
|
p = PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
|
||||||
scale=_get_popup_window_scale(),
|
scale=_get_popup_window_scale(),
|
||||||
|
|
@ -1416,7 +1505,10 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
current_choice=NewChoices[0],
|
current_choice=NewChoices[0],
|
||||||
delegate=self)
|
delegate=self)
|
||||||
self._popup_type = "customAction_partyMemberPress"
|
self._popup_type = "customAction_partyMemberPress"
|
||||||
else:ba.playsound(ba.getsound("error"));ba.screenmessage(ba.Lstr(resource="getTicketsWindow.unavailableText"),color=(1,0,0))
|
else:
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
|
ba.screenmessage(
|
||||||
|
ba.Lstr(resource="getTicketsWindow.unavailableText"), color=(1, 0, 0))
|
||||||
elif self._popup_type == "menu":
|
elif self._popup_type == "menu":
|
||||||
if choice in ("mute", "unmute"):
|
if choice in ("mute", "unmute"):
|
||||||
cfg = ba.app.config
|
cfg = ba.app.config
|
||||||
|
|
@ -1456,9 +1548,11 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
data = self._get_quick_responds()
|
data = self._get_quick_responds()
|
||||||
data.append(newReply)
|
data.append(newReply)
|
||||||
self._write_quick_responds(data)
|
self._write_quick_responds(data)
|
||||||
ba.screenmessage(_getTransText("Something_is_added")%newReply,color=(0,1,0))
|
ba.screenmessage(_getTransText("Something_is_added") %
|
||||||
|
newReply, color=(0, 1, 0))
|
||||||
ba.playsound(ba.getsound("dingSmallHigh"))
|
ba.playsound(ba.getsound("dingSmallHigh"))
|
||||||
except:ba.print_exception()
|
except:
|
||||||
|
ba.print_exception()
|
||||||
elif choice == "removeQuickReply":
|
elif choice == "removeQuickReply":
|
||||||
Quickreply = self._get_quick_responds()
|
Quickreply = self._get_quick_responds()
|
||||||
PopupMenuWindow(position=self._text_field.get_screen_space_center(),
|
PopupMenuWindow(position=self._text_field.get_screen_space_center(),
|
||||||
|
|
@ -1473,7 +1567,8 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
# print(_ba.get_connection_to_host_info(),type(_ba.get_connection_to_host_info()))
|
# print(_ba.get_connection_to_host_info(),type(_ba.get_connection_to_host_info()))
|
||||||
|
|
||||||
ChoiceDis = list(_ba.get_connection_to_host_info().keys())
|
ChoiceDis = list(_ba.get_connection_to_host_info().keys())
|
||||||
NewChoices = ["ba.screenmessage(str(_ba.get_connection_to_host_info().get('%s')))"%((str(i)).replace("'",r"'").replace('"',r'\\"')) for i in ChoiceDis]
|
NewChoices = ["ba.screenmessage(str(_ba.get_connection_to_host_info().get('%s')))" % (
|
||||||
|
(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(),
|
||||||
choices=NewChoices,
|
choices=NewChoices,
|
||||||
|
|
@ -1482,7 +1577,10 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
delegate=self)
|
delegate=self)
|
||||||
|
|
||||||
self._popup_type = "Custom_Exec_Choice"
|
self._popup_type = "Custom_Exec_Choice"
|
||||||
else:ba.playsound(ba.getsound("error"));ba.screenmessage(ba.Lstr(resource="getTicketsWindow.unavailableText"),color=(1,0,0))
|
else:
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
|
ba.screenmessage(
|
||||||
|
ba.Lstr(resource="getTicketsWindow.unavailableText"), color=(1, 0, 0))
|
||||||
elif choice == "translator":
|
elif choice == "translator":
|
||||||
chats = _ba._getChatMessages()
|
chats = _ba._getChatMessages()
|
||||||
if len(chats) > 0:
|
if len(chats) > 0:
|
||||||
|
|
@ -1494,7 +1592,10 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
current_choice=choices[0],
|
current_choice=choices[0],
|
||||||
delegate=self)
|
delegate=self)
|
||||||
self._popup_type = "translator_Press"
|
self._popup_type = "translator_Press"
|
||||||
else:ba.playsound(ba.getsound("error"));ba.screenmessage(ba.Lstr(resource="getTicketsWindow.unavailableText"),color=(1,0,0))
|
else:
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
|
ba.screenmessage(
|
||||||
|
ba.Lstr(resource="getTicketsWindow.unavailableText"), color=(1, 0, 0))
|
||||||
elif choice == "resetGameRecord":
|
elif choice == "resetGameRecord":
|
||||||
ConfirmWindow(text=_getTransText("Restart_Game_Record_Confirm"),
|
ConfirmWindow(text=_getTransText("Restart_Game_Record_Confirm"),
|
||||||
action=self._reset_game_record, cancel_button=True, cancel_is_selected=True,
|
action=self._reset_game_record, cancel_button=True, cancel_is_selected=True,
|
||||||
|
|
@ -1503,9 +1604,11 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
elif self._popup_type == "translator_Press":
|
elif self._popup_type == "translator_Press":
|
||||||
|
|
||||||
if len(tranTypes) == 1:
|
if len(tranTypes) == 1:
|
||||||
exec("start_new_thread(OnlineTranslator.%s,(u'%s',))"%(tranTypes[0],choice.replace("'",r"'").replace('"',r'\\"')))
|
exec("start_new_thread(OnlineTranslator.%s,(u'%s',))" %
|
||||||
|
(tranTypes[0], choice.replace("'", r"'").replace('"', r'\\"')))
|
||||||
elif len(tranTypes) > 1:
|
elif len(tranTypes) > 1:
|
||||||
choices = ["start_new_thread(OnlineTranslator.%s,(u'%s',))"%(item,choice.replace("'",r"'").replace('"',r'\\"')) for item in tranTypes]
|
choices = ["start_new_thread(OnlineTranslator.%s,(u'%s',))" % (
|
||||||
|
item, choice.replace("'", r"'").replace('"', r'\\"')) for item in tranTypes]
|
||||||
|
|
||||||
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(),
|
||||||
|
|
@ -1514,25 +1617,34 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
current_choice=choices[0],
|
current_choice=choices[0],
|
||||||
delegate=self)
|
delegate=self)
|
||||||
self._popup_type = "Custom_Exec_Choice"
|
self._popup_type = "Custom_Exec_Choice"
|
||||||
else:ba.playsound(ba.getsound("error"));ba.screenmessage(ba.Lstr(resource="getTicketsWindow.unavailableText"),color=(1,0,0))
|
else:
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
|
ba.screenmessage(
|
||||||
|
ba.Lstr(resource="getTicketsWindow.unavailableText"), color=(1, 0, 0))
|
||||||
elif self._popup_type == "customAction_partyMemberPress":
|
elif self._popup_type == "customAction_partyMemberPress":
|
||||||
|
|
||||||
try:
|
try:
|
||||||
keyReplaceValue = (r"{$PlayerNameFull}",r"{$PlayerName}",r"{$PlayerID}",r"{$AccountInfo}",r"{$AllPlayerName}",r"{$AllPlayerNameFull}")
|
keyReplaceValue = (r"{$PlayerNameFull}", r"{$PlayerName}", r"{$PlayerID}",
|
||||||
pos = None;curKeyWord = None
|
r"{$AccountInfo}", r"{$AllPlayerName}", r"{$AllPlayerNameFull}")
|
||||||
|
pos = None
|
||||||
|
curKeyWord = None
|
||||||
for keyWord in keyReplaceValue:
|
for keyWord in keyReplaceValue:
|
||||||
CurPos = choice.find(keyWord)
|
CurPos = choice.find(keyWord)
|
||||||
if CurPos != -1 and (pos is None or CurPos < pos):
|
if CurPos != -1 and (pos is None or CurPos < pos):
|
||||||
pos = CurPos;curKeyWord = keyWord
|
pos = CurPos
|
||||||
|
curKeyWord = keyWord
|
||||||
if isinstance(pos, int) and isinstance(curKeyWord, str):
|
if isinstance(pos, int) and isinstance(curKeyWord, str):
|
||||||
if curKeyWord in (r"{$PlayerNameFull}", r"{$PlayerName}", r"{$AllPlayerName}", r"{$AllPlayerNameFull}"):
|
if curKeyWord in (r"{$PlayerNameFull}", r"{$PlayerName}", r"{$AllPlayerName}", r"{$AllPlayerNameFull}"):
|
||||||
# if choice.count(curKeyWord) != 0:
|
# if choice.count(curKeyWord) != 0:
|
||||||
playerName = self._getObjectByID(curKeyWord.replace("{$","").replace("}",""))
|
playerName = self._getObjectByID(
|
||||||
|
curKeyWord.replace("{$", "").replace("}", ""))
|
||||||
if isinstance(playerName, (list, tuple)):
|
if isinstance(playerName, (list, tuple)):
|
||||||
ChoiceDis = [];NewChoices = []
|
ChoiceDis = []
|
||||||
|
NewChoices = []
|
||||||
for i in playerName:
|
for i in playerName:
|
||||||
ChoiceDis.append(i)
|
ChoiceDis.append(i)
|
||||||
NewChoices.append(choice.replace(curKeyWord,(i.replace("'",r"'").replace('"',r'\\"')),1))
|
NewChoices.append(choice.replace(
|
||||||
|
curKeyWord, (i.replace("'", r"'").replace('"', r'\\"')), 1))
|
||||||
p = PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
|
p = PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
|
||||||
scale=_get_popup_window_scale(),
|
scale=_get_popup_window_scale(),
|
||||||
choices=NewChoices,
|
choices=NewChoices,
|
||||||
|
|
@ -1541,16 +1653,22 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
delegate=self)
|
delegate=self)
|
||||||
self._popup_type = "customAction_partyMemberPress"
|
self._popup_type = "customAction_partyMemberPress"
|
||||||
elif isinstance(playerName, str):
|
elif isinstance(playerName, str):
|
||||||
self.popup_menu_selected_choice(popup_window,choice.replace(curKeyWord,(playerName.replace("'",r"'").replace('"',r'\\"')),1))
|
self.popup_menu_selected_choice(popup_window, choice.replace(
|
||||||
else:ba.screenmessage(_getTransText("No_valid_player_found"),(1,0,0));ba.playsound(ba.getsound("error"))
|
curKeyWord, (playerName.replace("'", r"'").replace('"', r'\\"')), 1))
|
||||||
|
else:
|
||||||
|
ba.screenmessage(_getTransText("No_valid_player_found"), (1, 0, 0))
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
elif curKeyWord in (r"{$PlayerID}",) != 0:
|
elif curKeyWord in (r"{$PlayerID}",) != 0:
|
||||||
playerID = self._getObjectByID("PlayerID")
|
playerID = self._getObjectByID("PlayerID")
|
||||||
playerName = self._getObjectByID("PlayerName")
|
playerName = self._getObjectByID("PlayerName")
|
||||||
# print(playerID,playerName)
|
# print(playerID,playerName)
|
||||||
if isinstance(playerID, (list, tuple)) and isinstance(playerName, (list, tuple)) and len(playerName) == len(playerID):
|
if isinstance(playerID, (list, tuple)) and isinstance(playerName, (list, tuple)) and len(playerName) == len(playerID):
|
||||||
ChoiceDis = [];NewChoices = []
|
ChoiceDis = []
|
||||||
|
NewChoices = []
|
||||||
for i1, i2 in playerName, playerID:
|
for i1, i2 in playerName, playerID:
|
||||||
ChoiceDis.append(i1);NewChoices.append(choice.replace(r"{$PlayerID}",str(i2).replace("'",r"'").replace('"',r'\\"')),1)
|
ChoiceDis.append(i1)
|
||||||
|
NewChoices.append(choice.replace(r"{$PlayerID}", str(
|
||||||
|
i2).replace("'", r"'").replace('"', r'\\"')), 1)
|
||||||
p = PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
|
p = PopupMenuWindow(position=popup_window.root_widget.get_screen_space_center(),
|
||||||
scale=_get_popup_window_scale(),
|
scale=_get_popup_window_scale(),
|
||||||
choices=NewChoices,
|
choices=NewChoices,
|
||||||
|
|
@ -1559,12 +1677,18 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
delegate=self)
|
delegate=self)
|
||||||
self._popup_type = "customAction_partyMemberPress"
|
self._popup_type = "customAction_partyMemberPress"
|
||||||
elif isinstance(playerID, int):
|
elif isinstance(playerID, int):
|
||||||
self.popup_menu_selected_choice(popup_window,choice.replace(r"{$PlayerID}",str(playerID).replace("'",r"'").replace('"',r'\\"')))
|
self.popup_menu_selected_choice(popup_window, choice.replace(
|
||||||
else:ba.screenmessage(_getTransText("No_valid_player_id_found"),(1,0,0));ba.playsound(ba.getsound("error"))
|
r"{$PlayerID}", str(playerID).replace("'", r"'").replace('"', r'\\"')))
|
||||||
|
else:
|
||||||
|
ba.screenmessage(_getTransText("No_valid_player_id_found"), (1, 0, 0))
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
elif curKeyWord in (r"{$AccountInfo}",) != 0:
|
elif curKeyWord in (r"{$AccountInfo}",) != 0:
|
||||||
self.popup_menu_selected_choice(popup_window,choice.replace(r"{$AccountInfo}",(str(self._getObjectByID("roster"))).replace("'",r"'").replace('"',r'\\"'),1))
|
self.popup_menu_selected_choice(popup_window, choice.replace(
|
||||||
else:exec(choice)
|
r"{$AccountInfo}", (str(self._getObjectByID("roster"))).replace("'", r"'").replace('"', r'\\"'), 1))
|
||||||
except Exception as e:ba.screenmessage(repr(e),(1,0,0))
|
else:
|
||||||
|
exec(choice)
|
||||||
|
except Exception as e:
|
||||||
|
ba.screenmessage(repr(e), (1, 0, 0))
|
||||||
elif self._popup_type == "QuickMessageSelect":
|
elif self._popup_type == "QuickMessageSelect":
|
||||||
# ba.textwidget(edit=self._text_field,text=self._get_quick_responds()[index])
|
# ba.textwidget(edit=self._text_field,text=self._get_quick_responds()[index])
|
||||||
self._edit_text_msg_box(choice, "add")
|
self._edit_text_msg_box(choice, "add")
|
||||||
|
|
@ -1575,15 +1699,16 @@ class ModifiedPartyWindow(bastd_party.PartyWindow):
|
||||||
self._write_quick_responds(data)
|
self._write_quick_responds(data)
|
||||||
ba.screenmessage(_getTransText("Something_is_removed") % choice, (1, 0, 0))
|
ba.screenmessage(_getTransText("Something_is_removed") % choice, (1, 0, 0))
|
||||||
ba.playsound(ba.getsound("shieldDown"))
|
ba.playsound(ba.getsound("shieldDown"))
|
||||||
else:ba.screenmessage(ba.Lstr(resource="errorText"),(1,0,0));ba.playsound(ba.getsound("error"))
|
else:
|
||||||
|
ba.screenmessage(ba.Lstr(resource="errorText"), (1, 0, 0))
|
||||||
|
ba.playsound(ba.getsound("error"))
|
||||||
elif choice.startswith("custom_Exec_Choice_") or self._popup_type == "Custom_Exec_Choice":
|
elif choice.startswith("custom_Exec_Choice_") or self._popup_type == "Custom_Exec_Choice":
|
||||||
exec(choice[len("custom_Exec_Choice_"):] if choice.startswith("custom_Exec_Choice_") else choice)
|
exec(choice[len("custom_Exec_Choice_"):]
|
||||||
|
if choice.startswith("custom_Exec_Choice_") else choice)
|
||||||
else:
|
else:
|
||||||
print("unhandled popup type: "+str(self._popup_type))
|
print("unhandled popup type: "+str(self._popup_type))
|
||||||
|
|
||||||
|
|
||||||
import base64
|
|
||||||
from ba._general import Call
|
|
||||||
def fetchAccountInfo(account, loading_widget):
|
def fetchAccountInfo(account, loading_widget):
|
||||||
pbid = ""
|
pbid = ""
|
||||||
account_data = []
|
account_data = []
|
||||||
|
|
@ -1596,16 +1721,17 @@ def fetchAccountInfo(account,loading_widget):
|
||||||
fdata = json.load(f)
|
fdata = json.load(f)
|
||||||
if account in fdata:
|
if account in fdata:
|
||||||
servers = fdata[account]
|
servers = fdata[account]
|
||||||
data = urllib.request.urlopen(f'https://api.bombsquad.ga/player?key={base64.b64encode(account.encode("utf-8")).decode("utf-8")}&base64=true')
|
data = urllib.request.urlopen(
|
||||||
|
f'https://api.bombsquad.ga/player?key={base64.b64encode(account.encode("utf-8")).decode("utf-8")}&base64=true')
|
||||||
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"]
|
||||||
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# _ba.pushcall(Call(updateAccountWindow,loading_widget,accounts[0]),from_other_thread=True)
|
# _ba.pushcall(Call(updateAccountWindow,loading_widget,accounts[0]),from_other_thread=True)
|
||||||
_ba.pushcall(Call(CustomAccountViewerWindow,pbid,account_data,servers,loading_widget),from_other_thread =True)
|
_ba.pushcall(Call(CustomAccountViewerWindow, pbid, account_data,
|
||||||
|
servers, loading_widget), from_other_thread=True)
|
||||||
|
|
||||||
from bastd.ui.account import viewer
|
|
||||||
|
|
||||||
class CustomAccountViewerWindow(viewer.AccountViewerWindow):
|
class CustomAccountViewerWindow(viewer.AccountViewerWindow):
|
||||||
def __init__(self, account_id, custom_data, servers, loading_widget):
|
def __init__(self, account_id, custom_data, servers, loading_widget):
|
||||||
|
|
@ -1617,9 +1743,11 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
|
||||||
self.custom_data = custom_data
|
self.custom_data = custom_data
|
||||||
self.pb_id = account_id
|
self.pb_id = account_id
|
||||||
self.servers = servers
|
self.servers = servers
|
||||||
|
|
||||||
def _copy_pb(self):
|
def _copy_pb(self):
|
||||||
ba.clipboard_set_text(self.pb_id)
|
ba.clipboard_set_text(self.pb_id)
|
||||||
ba.screenmessage(ba.Lstr(resource='gatherWindow.copyCodeConfirmText'))
|
ba.screenmessage(ba.Lstr(resource='gatherWindow.copyCodeConfirmText'))
|
||||||
|
|
||||||
def _on_query_response(self, data):
|
def _on_query_response(self, data):
|
||||||
|
|
||||||
if data is None:
|
if data is None:
|
||||||
|
|
@ -1846,7 +1974,8 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
|
||||||
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"]+ ","+self.custom_data["discord"][0]["id"],
|
text=self.custom_data["discord"][0]["username"] +
|
||||||
|
","+self.custom_data["discord"][0]["id"],
|
||||||
maxwidth=sub_width * maxwidth_scale)
|
maxwidth=sub_width * maxwidth_scale)
|
||||||
v -= 26
|
v -= 26
|
||||||
ba.textwidget(parent=self._subcontainer,
|
ba.textwidget(parent=self._subcontainer,
|
||||||
|
|
@ -2043,9 +2172,12 @@ class CustomAccountViewerWindow(viewer.AccountViewerWindow):
|
||||||
ba.print_exception('Error displaying account info.')
|
ba.print_exception('Error displaying account info.')
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class bySmoothy(ba.Plugin):
|
class bySmoothy(ba.Plugin):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if _ba.env().get("build_number", 0) >= 20577:
|
if _ba.env().get("build_number", 0) >= 20577:
|
||||||
_ba.connect_to_party = newconnect_to_party
|
_ba.connect_to_party = newconnect_to_party
|
||||||
bastd_party.PartyWindow = ModifiedPartyWindow
|
bastd_party.PartyWindow = ModifiedPartyWindow
|
||||||
else:print("AdvancePartyWindow only runs with BombSquad version equal or higher than 1.7")
|
else:
|
||||||
|
print("AdvancePartyWindow only runs with BombSquad version equal or higher than 1.7")
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ server=[]
|
||||||
ip_add = "private"
|
ip_add = "private"
|
||||||
p_port = 44444
|
p_port = 44444
|
||||||
p_name = "nothing here"
|
p_name = "nothing here"
|
||||||
|
|
||||||
|
|
||||||
def newconnect_to_party(address, port=43210, print_progress=False):
|
def newconnect_to_party(address, port=43210, print_progress=False):
|
||||||
global ip_add
|
global ip_add
|
||||||
global p_port
|
global p_port
|
||||||
|
|
@ -43,11 +45,12 @@ def newconnect_to_party(address,port=43210,print_progress=False):
|
||||||
connect(address, port, print_progress)
|
connect(address, port, print_progress)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
||||||
ip_add = address
|
ip_add = address
|
||||||
p_port = port
|
p_port = port
|
||||||
# print(ip_add,p_port)
|
# print(ip_add,p_port)
|
||||||
connect(ip_add, port, print_progress)
|
connect(ip_add, port, print_progress)
|
||||||
|
|
||||||
|
|
||||||
def newdisconnect_from_host():
|
def newdisconnect_from_host():
|
||||||
try:
|
try:
|
||||||
name = _ba.get_connection_to_host_info()['name']
|
name = _ba.get_connection_to_host_info()['name']
|
||||||
|
|
@ -62,8 +65,11 @@ def newdisconnect_from_host():
|
||||||
pass
|
pass
|
||||||
disconnect()
|
disconnect()
|
||||||
|
|
||||||
|
|
||||||
def printip():
|
def printip():
|
||||||
ba.screenmessage("ip address is"+ip_add)
|
ba.screenmessage("ip address is"+ip_add)
|
||||||
|
|
||||||
|
|
||||||
def new_refresh_in_game(
|
def new_refresh_in_game(
|
||||||
self, positions: List[Tuple[float, float,
|
self, positions: List[Tuple[float, float,
|
||||||
float]]) -> Tuple[float, float, float]:
|
float]]) -> Tuple[float, float, float]:
|
||||||
|
|
@ -126,6 +132,7 @@ def new_refresh_in_game(
|
||||||
v_h = v
|
v_h = v
|
||||||
|
|
||||||
global server
|
global server
|
||||||
|
|
||||||
def con(address, port):
|
def con(address, port):
|
||||||
global ip_add
|
global ip_add
|
||||||
global p_port
|
global p_port
|
||||||
|
|
@ -245,6 +252,8 @@ def new_refresh_in_game(
|
||||||
scale=0.45,
|
scale=0.45,
|
||||||
maxwidth=self._button_width * 0.9)
|
maxwidth=self._button_width * 0.9)
|
||||||
return h, v, scale
|
return h, v, scale
|
||||||
|
|
||||||
|
|
||||||
def new_refresh(self) -> None:
|
def new_refresh(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
|
|
@ -284,7 +293,6 @@ def new_refresh(self) -> None:
|
||||||
input_device.is_connected_to_remote_player()
|
input_device.is_connected_to_remote_player()
|
||||||
if input_device else False)
|
if input_device else False)
|
||||||
|
|
||||||
|
|
||||||
positions: List[Tuple[float, float, float]] = []
|
positions: List[Tuple[float, float, float]] = []
|
||||||
self._p_index = 0
|
self._p_index = 0
|
||||||
|
|
||||||
|
|
@ -552,10 +560,13 @@ def new_refresh(self) -> None:
|
||||||
scale=3.0 * t_scale)
|
scale=3.0 * t_scale)
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class bySmoothy(ba.Plugin):
|
class bySmoothy(ba.Plugin):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if _ba.env().get("build_number", 0) >= 20577:
|
if _ba.env().get("build_number", 0) >= 20577:
|
||||||
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game = new_refresh_in_game
|
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game = new_refresh_in_game
|
||||||
_ba.connect_to_party = newconnect_to_party
|
_ba.connect_to_party = newconnect_to_party
|
||||||
_ba.disconnect_from_host = newdisconnect_from_host
|
_ba.disconnect_from_host = newdisconnect_from_host
|
||||||
else:print("Server Switch only works on bs 1.7 and above")
|
else:
|
||||||
|
print("Server Switch only works on bs 1.7 and above")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue