mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
a62fe55ca8
commit
0db98e8618
3 changed files with 26 additions and 23 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
# ba_meta require api 9
|
# ba_meta require api 9
|
||||||
#!"Made to you by @brostos & @Dliwk"
|
#!"Made to you by @brostos & @Dliwk"
|
||||||
# TODO
|
# TODO
|
||||||
# - Update to the latest libs
|
# - Update to the latest libs
|
||||||
# - Use account id to hash the tkn
|
# - Use account id to hash the tkn
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -483,7 +483,7 @@ if not ANDROID:
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
|
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
|
||||||
asyncio.set_event_loop(get_event_loop())
|
asyncio.set_event_loop(get_event_loop())
|
||||||
|
|
||||||
while not self.should_close:
|
while not self.should_close:
|
||||||
if time.time() - self._last_update_time > 0.1:
|
if time.time() - self._last_update_time > 0.1:
|
||||||
self._do_update_presence()
|
self._do_update_presence()
|
||||||
|
|
@ -854,8 +854,6 @@ class Discordlogin(PopupWindow):
|
||||||
PresenceUpdate().close()
|
PresenceUpdate().close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_class():
|
def get_class():
|
||||||
if ANDROID:
|
if ANDROID:
|
||||||
return PresenceUpdate()
|
return PresenceUpdate()
|
||||||
|
|
@ -901,7 +899,6 @@ class DiscordRP(babase.Plugin):
|
||||||
if not ANDROID and self.rpc_thread.is_discord_running():
|
if not ANDROID and self.rpc_thread.is_discord_running():
|
||||||
self.rpc_thread.rpc.close()
|
self.rpc_thread.rpc.close()
|
||||||
self.rpc_thread.should_close = True
|
self.rpc_thread.should_close = True
|
||||||
|
|
||||||
|
|
||||||
def on_app_pause(self) -> None:
|
def on_app_pause(self) -> None:
|
||||||
self.rpc_thread.close()
|
self.rpc_thread.close()
|
||||||
|
|
@ -981,12 +978,12 @@ class DiscordRP(babase.Plugin):
|
||||||
if connection_info:
|
if connection_info:
|
||||||
hostname = socket.gethostname()
|
hostname = socket.gethostname()
|
||||||
local_ip = socket.gethostbyname(hostname)
|
local_ip = socket.gethostbyname(hostname)
|
||||||
|
|
||||||
if bs.get_connection_to_host_info_2().address == local_ip:
|
if bs.get_connection_to_host_info_2().address == local_ip:
|
||||||
self.rpc_thread.details = "Local Server"
|
self.rpc_thread.details = "Local Server"
|
||||||
else:
|
else:
|
||||||
self.rpc_thread.details = "Online"
|
self.rpc_thread.details = "Online"
|
||||||
|
|
||||||
servername = connection_info.name
|
servername = connection_info.name
|
||||||
self.rpc_thread.party_size = max(
|
self.rpc_thread.party_size = max(
|
||||||
1, sum(len(client["players"]) for client in roster)
|
1, sum(len(client["players"]) for client in roster)
|
||||||
|
|
@ -1054,7 +1051,7 @@ class DiscordRP(babase.Plugin):
|
||||||
from bascenev1lib.game.thelaststand import TheLastStandGame
|
from bascenev1lib.game.thelaststand import TheLastStandGame
|
||||||
from bascenev1lib.game.meteorshower import MeteorShowerGame
|
from bascenev1lib.game.meteorshower import MeteorShowerGame
|
||||||
from bascenev1lib.game.football import FootballCoopGame
|
from bascenev1lib.game.football import FootballCoopGame
|
||||||
from bascenev1lib.game.easteregghunt import EasterEggHuntGame
|
from bascenev1lib.game.easteregghunt import EasterEggHuntGame
|
||||||
|
|
||||||
# noinspection PyUnresolvedReferences,PyProtectedMember
|
# noinspection PyUnresolvedReferences,PyProtectedMember
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ def get_modules() -> None:
|
||||||
}
|
}
|
||||||
|
|
||||||
system = platform.platform()
|
system = platform.platform()
|
||||||
|
|
||||||
if "Windows" in system:
|
if "Windows" in system:
|
||||||
packages["lxml"] = {
|
packages["lxml"] = {
|
||||||
"url": "https://files.pythonhosted.org/packages/36/88/684d4e800f5aa28df2a991a6a622783fb73cf0e46235cfa690f9776f032e/lxml-5.3.0-cp312-cp312-win32.whl",
|
"url": "https://files.pythonhosted.org/packages/36/88/684d4e800f5aa28df2a991a6a622783fb73cf0e46235cfa690f9776f032e/lxml-5.3.0-cp312-cp312-win32.whl",
|
||||||
|
|
@ -234,9 +234,10 @@ def get_modules() -> None:
|
||||||
with zipfile.ZipFile(package_filename, "r") as zip_ref:
|
with zipfile.ZipFile(package_filename, "r") as zip_ref:
|
||||||
zip_ref.extractall(install_path)
|
zip_ref.extractall(install_path)
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(Path(f"{install_path}/lxml-5.3.0.dist-info")) #! Remember to update accordingly
|
# ! Remember to update accordingly
|
||||||
|
shutil.rmtree(Path(f"{install_path}/lxml-5.3.0.dist-info"))
|
||||||
except:
|
except:
|
||||||
shutil.rmtree(Path(f"{install_path}/charset_normalizer-3.4.1.dist-info")) #!
|
shutil.rmtree(Path(f"{install_path}/charset_normalizer-3.4.1.dist-info")) # !
|
||||||
remove(package_path)
|
remove(package_path)
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
@ -297,7 +298,10 @@ def play_sound(sound):
|
||||||
with bs.get_foreground_host_activity().context:
|
with bs.get_foreground_host_activity().context:
|
||||||
bs.getsound(sound).play()
|
bs.getsound(sound).play()
|
||||||
|
|
||||||
|
|
||||||
accessible_online = None
|
accessible_online = None
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def confirm_port():
|
def confirm_port():
|
||||||
global accessible_online
|
global accessible_online
|
||||||
|
|
@ -393,14 +397,14 @@ def add_port_mapping():
|
||||||
NewLeaseDuration=14400,
|
NewLeaseDuration=14400,
|
||||||
)
|
)
|
||||||
babase.pushcall(
|
babase.pushcall(
|
||||||
babase.Call(play_sound, "shieldUp"),
|
babase.Call(play_sound, "shieldUp"),
|
||||||
from_other_thread=True,
|
from_other_thread=True,
|
||||||
)
|
)
|
||||||
except (SOAPError, HTTPError, UnicodeDecodeError):
|
except (SOAPError, HTTPError, UnicodeDecodeError):
|
||||||
babase.screenmessage(
|
babase.screenmessage(
|
||||||
"You will need to manualy port forward at the router :("
|
"You will need to manualy port forward at the router :("
|
||||||
)
|
)
|
||||||
babase.pushcall(babase.Call(play_sound, "error"),from_other_thread=True,)
|
babase.pushcall(babase.Call(play_sound, "error"), from_other_thread=True,)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -419,11 +423,11 @@ class Joinable(babase.Plugin):
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
install_path = Path(f"{getcwd()}/ba_data/python")
|
install_path = Path(f"{getcwd()}/ba_data/python")
|
||||||
shutil.rmtree(f"{install_path}/upnpy")
|
shutil.rmtree(f"{install_path}/upnpy")
|
||||||
shutil.rmtree(f"{install_path}/natpmp")
|
shutil.rmtree(f"{install_path}/natpmp")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
get_modules()
|
get_modules()
|
||||||
|
|
||||||
def on_app_resume(self) -> None:
|
def on_app_resume(self) -> None:
|
||||||
confirm_port()
|
confirm_port()
|
||||||
add_port_mapping()
|
add_port_mapping()
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,10 @@ import bascenev1 as bs
|
||||||
|
|
||||||
last_len_msg = 0 # Initialize the global variable outside the function
|
last_len_msg = 0 # Initialize the global variable outside the function
|
||||||
|
|
||||||
|
|
||||||
def wave_emote():
|
def wave_emote():
|
||||||
global last_len_msg # To modify the global variable
|
global last_len_msg # To modify the global variable
|
||||||
|
|
||||||
# Check if the players are in game first
|
# Check if the players are in game first
|
||||||
try:
|
try:
|
||||||
act_players = bs.get_foreground_host_activity().players
|
act_players = bs.get_foreground_host_activity().players
|
||||||
|
|
@ -19,21 +20,21 @@ def wave_emote():
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Except the attribute error if the player is in a server
|
# Except the attribute error if the player is in a server
|
||||||
return
|
return
|
||||||
|
|
||||||
# Incase chats are empty or in replay
|
# Incase chats are empty or in replay
|
||||||
try:
|
try:
|
||||||
lastmsg = bs.get_chat_messages()[-1]
|
lastmsg = bs.get_chat_messages()[-1]
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Perform a check to see if the player is playing|spectating
|
# Perform a check to see if the player is playing|spectating
|
||||||
for player in act_players:
|
for player in act_players:
|
||||||
try:
|
try:
|
||||||
if player.actor.node:
|
if player.actor.node:
|
||||||
continue
|
continue
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if the message contains "hello"
|
# Check if the message contains "hello"
|
||||||
if len(bs.get_chat_messages()) != last_len_msg:
|
if len(bs.get_chat_messages()) != last_len_msg:
|
||||||
if act_players and "hello" in lastmsg:
|
if act_players and "hello" in lastmsg:
|
||||||
|
|
@ -46,6 +47,7 @@ def wave_emote():
|
||||||
print(last_len_msg, "last_len_msg")
|
print(last_len_msg, "last_len_msg")
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class brostos(babase.Plugin):
|
class brostos(babase.Plugin):
|
||||||
timer = bs.AppTimer(0.5, wave_emote, repeat=True)
|
timer = bs.AppTimer(0.5, wave_emote, repeat=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue