2025-08-03 13:53:51 +03:00
|
|
|
# Copyright 2025 - Solely by BrotherBoard
|
|
|
|
|
# Intended for personal use only
|
|
|
|
|
# Bug? Feedback? Telegram >> GalaxyA14user
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Finder v1.0 - Find anyone
|
|
|
|
|
|
|
|
|
|
Experimental. Feedback is appreciated.
|
|
|
|
|
Useful if you are looking for someone, or just messing around.
|
|
|
|
|
|
|
|
|
|
Features:
|
|
|
|
|
- Fetch servers: Pings all servers, then sorts them by lowest
|
|
|
|
|
- Ability to cycle through x servers to collect users
|
|
|
|
|
- Ability to connect to servers by player name there
|
|
|
|
|
|
|
|
|
|
Combine with Power plugin for better control.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from socket import socket, SOCK_DGRAM
|
|
|
|
|
from random import uniform as uf
|
|
|
|
|
from babase import Plugin, app
|
|
|
|
|
from threading import Thread
|
|
|
|
|
from time import time, sleep
|
|
|
|
|
from bauiv1 import (
|
|
|
|
|
get_ip_address_type as IPT,
|
|
|
|
|
clipboard_set_text as COPY,
|
|
|
|
|
get_special_widget as zw,
|
|
|
|
|
containerwidget as ocw,
|
|
|
|
|
screenmessage as push,
|
|
|
|
|
buttonwidget as obw,
|
|
|
|
|
scrollwidget as sw,
|
|
|
|
|
imagewidget as iw,
|
|
|
|
|
textwidget as tw,
|
|
|
|
|
gettexture as gt,
|
|
|
|
|
apptimer as teck,
|
|
|
|
|
getsound as gs,
|
|
|
|
|
getmesh as gm,
|
|
|
|
|
Call
|
|
|
|
|
)
|
|
|
|
|
from bascenev1 import (
|
|
|
|
|
disconnect_from_host as BYE,
|
|
|
|
|
connect_to_party as CON,
|
|
|
|
|
protocol_version as PT,
|
|
|
|
|
get_game_roster as GGR
|
|
|
|
|
)
|
|
|
|
|
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
class Finder:
|
2025-08-10 13:02:22 +00:00
|
|
|
COL1 = (0, 0.3, 0.3)
|
|
|
|
|
COL2 = (0, 0.55, 0.55)
|
|
|
|
|
COL3 = (0, 0.7, 0.7)
|
|
|
|
|
COL4 = (0, 1, 1)
|
|
|
|
|
COL5 = (1, 1, 0)
|
2025-08-03 13:53:51 +03:00
|
|
|
MAX = 0.3
|
|
|
|
|
TOP = 15
|
|
|
|
|
VER = '1.0'
|
|
|
|
|
MEM = []
|
|
|
|
|
BST = []
|
|
|
|
|
SL = None
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def __init__(s, src):
|
2025-08-03 13:53:51 +03:00
|
|
|
s.thr = []
|
|
|
|
|
s.ikids = []
|
|
|
|
|
s.busy = False
|
|
|
|
|
s.s1 = s.snd('powerup01')
|
|
|
|
|
c = s.__class__
|
|
|
|
|
# parent
|
2025-08-10 13:02:22 +00:00
|
|
|
z = (460, 400)
|
2025-08-03 13:53:51 +03:00
|
|
|
s.p = cw(
|
|
|
|
|
scale_origin_stack_offset=src.get_screen_space_center(),
|
|
|
|
|
size=z,
|
|
|
|
|
oac=s.bye
|
|
|
|
|
)[0]
|
|
|
|
|
# footing
|
|
|
|
|
sw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
size=z,
|
|
|
|
|
border_opacity=0
|
|
|
|
|
)
|
|
|
|
|
# fetch
|
|
|
|
|
tw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
text='Fetch Servers',
|
|
|
|
|
color=s.COL4,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(19, 359)
|
2025-08-03 13:53:51 +03:00
|
|
|
)
|
|
|
|
|
bw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(360, 343),
|
|
|
|
|
size=(80, 39),
|
2025-08-03 13:53:51 +03:00
|
|
|
label='Fetch',
|
|
|
|
|
color=s.COL2,
|
|
|
|
|
textcolor=s.COL4,
|
|
|
|
|
oac=s.fresh
|
|
|
|
|
)
|
|
|
|
|
tw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
text='Fetches, pings, and sorts public servers.',
|
|
|
|
|
color=s.COL3,
|
|
|
|
|
scale=0.8,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(15, 330),
|
2025-08-03 13:53:51 +03:00
|
|
|
maxwidth=320
|
|
|
|
|
)
|
|
|
|
|
# separator
|
|
|
|
|
iw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(429, 1),
|
|
|
|
|
position=(17, 330),
|
2025-08-03 13:53:51 +03:00
|
|
|
texture=gt('white'),
|
|
|
|
|
color=s.COL2
|
|
|
|
|
)
|
|
|
|
|
# cycle
|
|
|
|
|
tw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
text='Cycle Servers',
|
|
|
|
|
color=s.COL4,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(19, 294)
|
2025-08-03 13:53:51 +03:00
|
|
|
)
|
|
|
|
|
bw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(360, 278),
|
|
|
|
|
size=(80, 39),
|
2025-08-03 13:53:51 +03:00
|
|
|
label='Cycle',
|
|
|
|
|
color=s.COL2,
|
|
|
|
|
textcolor=s.COL4,
|
|
|
|
|
oac=s.find
|
|
|
|
|
)
|
|
|
|
|
tw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
text='Cycles through best servers and saves their players.',
|
|
|
|
|
color=s.COL3,
|
|
|
|
|
scale=0.8,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(15, 265),
|
2025-08-03 13:53:51 +03:00
|
|
|
maxwidth=320,
|
|
|
|
|
v_align='center'
|
|
|
|
|
)
|
|
|
|
|
# separator
|
|
|
|
|
iw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(429, 1),
|
|
|
|
|
position=(17, 265),
|
2025-08-03 13:53:51 +03:00
|
|
|
texture=gt('white'),
|
|
|
|
|
color=s.COL2
|
|
|
|
|
)
|
|
|
|
|
# top
|
|
|
|
|
tw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
text='Server Cycle Limit',
|
|
|
|
|
color=s.COL4,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(19, 230)
|
2025-08-03 13:53:51 +03:00
|
|
|
)
|
|
|
|
|
s.top = tw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(398, 228),
|
|
|
|
|
size=(80, 50),
|
2025-08-03 13:53:51 +03:00
|
|
|
text=str(c.TOP),
|
|
|
|
|
color=s.COL4,
|
|
|
|
|
editable=True,
|
|
|
|
|
h_align='center',
|
|
|
|
|
v_align='center',
|
|
|
|
|
corner_scale=0.1,
|
|
|
|
|
scale=10,
|
|
|
|
|
allow_clear_button=False,
|
|
|
|
|
shadow=0,
|
|
|
|
|
flatness=1,
|
|
|
|
|
)
|
|
|
|
|
tw(
|
|
|
|
|
parent=s.p,
|
|
|
|
|
text='Maximum number of servers to cycle.',
|
|
|
|
|
color=s.COL3,
|
|
|
|
|
scale=0.8,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(15, 201),
|
2025-08-03 13:53:51 +03:00
|
|
|
maxwidth=320
|
|
|
|
|
)
|
|
|
|
|
# separator
|
|
|
|
|
iw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(429, 1),
|
|
|
|
|
position=(17, 200),
|
2025-08-03 13:53:51 +03:00
|
|
|
texture=gt('white'),
|
|
|
|
|
color=s.COL2
|
|
|
|
|
)
|
|
|
|
|
# players
|
|
|
|
|
pl = s.plys()
|
2025-08-10 13:02:22 +00:00
|
|
|
sy = max(len(pl)*30, 140)
|
2025-08-03 13:53:51 +03:00
|
|
|
p1 = sw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(20, 18),
|
|
|
|
|
size=(205, 172),
|
2025-08-03 13:53:51 +03:00
|
|
|
border_opacity=0.4
|
|
|
|
|
)
|
|
|
|
|
p2 = ocw(
|
|
|
|
|
parent=p1,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(205, sy),
|
2025-08-03 13:53:51 +03:00
|
|
|
background=False
|
|
|
|
|
)
|
|
|
|
|
0 if pl else tw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(90, 100),
|
2025-08-03 13:53:51 +03:00
|
|
|
text='Cycle some servers\nto collect players',
|
|
|
|
|
color=s.COL4,
|
|
|
|
|
maxwidth=175,
|
|
|
|
|
h_align='center'
|
|
|
|
|
)
|
|
|
|
|
s.kids = []
|
2025-08-10 13:02:22 +00:00
|
|
|
for _, g in enumerate(pl):
|
|
|
|
|
p, a = g
|
2025-08-03 13:53:51 +03:00
|
|
|
s.kids.append(tw(
|
|
|
|
|
parent=p2,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(200, 30),
|
2025-08-03 13:53:51 +03:00
|
|
|
selectable=True,
|
|
|
|
|
click_activate=True,
|
|
|
|
|
color=s.COL3,
|
|
|
|
|
text=p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(0, sy-30-30*_),
|
2025-08-03 13:53:51 +03:00
|
|
|
maxwidth=175,
|
2025-08-10 13:02:22 +00:00
|
|
|
on_activate_call=Call(s.hl, _, p),
|
2025-08-03 13:53:51 +03:00
|
|
|
v_align='center'
|
|
|
|
|
))
|
|
|
|
|
# info
|
|
|
|
|
iw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(235, 18),
|
|
|
|
|
size=(205, 172),
|
2025-08-03 13:53:51 +03:00
|
|
|
texture=gt('scrollWidget'),
|
|
|
|
|
mesh_transparent=gm('softEdgeOutside'),
|
|
|
|
|
opacity=0.4
|
|
|
|
|
)
|
|
|
|
|
s.tip = tw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(310, 98),
|
2025-08-03 13:53:51 +03:00
|
|
|
text='Select something to\nview server info',
|
|
|
|
|
color=s.COL4,
|
|
|
|
|
maxwidth=170,
|
|
|
|
|
h_align='center'
|
|
|
|
|
) if c.SL is None else 0
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def hl(s, _, p):
|
|
|
|
|
[tw(t, color=s.COL3) for t in s.kids]
|
|
|
|
|
tw(s.kids[_], color=s.COL4)
|
2025-08-03 13:53:51 +03:00
|
|
|
s.info(p)
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def info(s, p):
|
2025-08-03 13:53:51 +03:00
|
|
|
[_.delete() for _ in s.ikids]
|
|
|
|
|
s.ikids.clear()
|
|
|
|
|
s.tip and s.tip.delete()
|
|
|
|
|
bst = s.__class__.BST
|
|
|
|
|
for _ in bst:
|
|
|
|
|
for r in _['roster']:
|
|
|
|
|
if r['display_string'] == p:
|
|
|
|
|
i = _
|
|
|
|
|
break
|
|
|
|
|
for _ in range(3):
|
|
|
|
|
t = str(i['nap'[_]])
|
|
|
|
|
s.ikids.append(tw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(250, 155-40*_),
|
2025-08-03 13:53:51 +03:00
|
|
|
h_align='center',
|
|
|
|
|
v_align='center',
|
|
|
|
|
maxwidth=175,
|
|
|
|
|
text=t,
|
|
|
|
|
color=s.COL4,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(175, 30),
|
2025-08-03 13:53:51 +03:00
|
|
|
selectable=True,
|
|
|
|
|
click_activate=True,
|
2025-08-10 13:02:22 +00:00
|
|
|
on_activate_call=Call(s.copy, t)
|
2025-08-03 13:53:51 +03:00
|
|
|
))
|
|
|
|
|
s.ikids.append(bw(
|
|
|
|
|
parent=s.p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(253, 30),
|
|
|
|
|
size=(166, 30),
|
2025-08-03 13:53:51 +03:00
|
|
|
label='Connect',
|
|
|
|
|
color=s.COL2,
|
|
|
|
|
textcolor=s.COL4,
|
2025-08-10 13:02:22 +00:00
|
|
|
oac=Call(CON, i['a'], i['p'], False)
|
2025-08-03 13:53:51 +03:00
|
|
|
))
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def copy(s, t):
|
|
|
|
|
s.ding(1, 1)
|
2025-08-03 13:53:51 +03:00
|
|
|
TIP('Copied to clipboard!')
|
|
|
|
|
COPY(t)
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def plys(s):
|
|
|
|
|
z = []
|
|
|
|
|
me = app.plus.get_v1_account_name()
|
2025-08-10 13:02:22 +00:00
|
|
|
me = [me, '\ue063'+me]
|
2025-08-03 13:53:51 +03:00
|
|
|
for _ in s.__class__.BST:
|
|
|
|
|
a = _['a']
|
2025-08-10 13:02:22 +00:00
|
|
|
if (r := _.get('roster', {})):
|
2025-08-03 13:53:51 +03:00
|
|
|
for p in r:
|
|
|
|
|
ds = p['display_string']
|
2025-08-10 13:02:22 +00:00
|
|
|
0 if ds in me else z.append((ds, a))
|
|
|
|
|
return sorted(z, key=lambda _: _[0].startswith('\ue030Server'))
|
|
|
|
|
|
|
|
|
|
def snd(s, t):
|
2025-08-03 13:53:51 +03:00
|
|
|
l = gs(t)
|
|
|
|
|
l.play()
|
2025-08-10 13:02:22 +00:00
|
|
|
teck(uf(0.14, 0.18), l.stop)
|
2025-08-03 13:53:51 +03:00
|
|
|
return l
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def bye(s):
|
|
|
|
|
s.s1.stop()
|
2025-08-10 13:02:22 +00:00
|
|
|
ocw(s.p, transition='out_scale')
|
2025-08-03 13:53:51 +03:00
|
|
|
l = s.snd('laser')
|
2025-08-10 13:02:22 +00:00
|
|
|
def f(): return teck(0.01, f) if s.p else l.stop()
|
2025-08-03 13:53:51 +03:00
|
|
|
f()
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def ding(s, i, j):
|
|
|
|
|
a = ['Small', '']
|
|
|
|
|
x, y = a[i], a[j]
|
2025-08-03 13:53:51 +03:00
|
|
|
s.snd('ding'+x)
|
2025-08-10 13:02:22 +00:00
|
|
|
teck(0.1, gs('ding'+y).play)
|
|
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def fresh(s):
|
2025-08-10 13:02:22 +00:00
|
|
|
if s.busy:
|
|
|
|
|
BTW("Still busy!")
|
|
|
|
|
return
|
2025-08-03 13:53:51 +03:00
|
|
|
TIP('Fetching servers...')
|
2025-08-10 13:02:22 +00:00
|
|
|
s.ding(1, 0)
|
2025-08-03 13:53:51 +03:00
|
|
|
s.busy = True
|
|
|
|
|
p = app.plus
|
|
|
|
|
p.add_v1_account_transaction(
|
|
|
|
|
{
|
|
|
|
|
'type': 'PUBLIC_PARTY_QUERY',
|
|
|
|
|
'proto': PT(),
|
|
|
|
|
'lang': 'English'
|
|
|
|
|
},
|
|
|
|
|
callback=s.kang,
|
|
|
|
|
)
|
|
|
|
|
p.run_v1_account_transactions()
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def kang(s, r):
|
2025-08-03 13:53:51 +03:00
|
|
|
c = s.__class__
|
|
|
|
|
c.MEM = r['l']
|
|
|
|
|
s.thr = []
|
|
|
|
|
for _ in s.__class__.MEM:
|
2025-08-10 13:02:22 +00:00
|
|
|
t = Thread(target=Call(s.ping, _))
|
2025-08-03 13:53:51 +03:00
|
|
|
s.thr.append(t)
|
|
|
|
|
t.start()
|
2025-08-10 13:02:22 +00:00
|
|
|
teck(s.MAX*4, s.join)
|
|
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def join(s):
|
|
|
|
|
c = s.__class__
|
|
|
|
|
[t.join() for t in s.thr]
|
|
|
|
|
far = s.MAX*3000
|
|
|
|
|
c.MEM = [_ for _ in c.MEM if _['ping']]
|
|
|
|
|
c.MEM.sort(key=lambda _: _['ping'])
|
|
|
|
|
s.thr.clear()
|
|
|
|
|
TIP(f'Loaded {len(c.MEM)} servers!')
|
2025-08-10 13:02:22 +00:00
|
|
|
s.ding(0, 1)
|
2025-08-03 13:53:51 +03:00
|
|
|
s.busy = False
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def find(s):
|
2025-08-10 13:02:22 +00:00
|
|
|
if s.busy:
|
|
|
|
|
BTW("Still busy!")
|
|
|
|
|
return
|
2025-08-03 13:53:51 +03:00
|
|
|
c = s.__class__
|
|
|
|
|
if not c.MEM:
|
|
|
|
|
BTW('Fetch some servers first!')
|
|
|
|
|
return
|
|
|
|
|
t = tw(query=s.top)
|
|
|
|
|
if not t.isdigit():
|
|
|
|
|
BTW('Invalid cycle limit!')
|
|
|
|
|
return
|
|
|
|
|
top = int(t)
|
|
|
|
|
if not (0 < top < len(c.MEM)):
|
2025-08-10 13:02:22 +00:00
|
|
|
BTW('Cycle count is too '+['big', 'small'][top <= 0]+'!')
|
2025-08-03 13:53:51 +03:00
|
|
|
return
|
|
|
|
|
c.TOP = top
|
2025-08-10 13:02:22 +00:00
|
|
|
s.ding(1, 0)
|
2025-08-03 13:53:51 +03:00
|
|
|
TIP('Starting cycle...')
|
|
|
|
|
s.busy = True
|
|
|
|
|
s.ci = s.lr = 0
|
|
|
|
|
c.BST = c.MEM[:top]
|
|
|
|
|
s.cycle()
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def cycle(s):
|
|
|
|
|
_ = s.__class__.BST[s.ci]
|
|
|
|
|
s.ca = _['a']
|
2025-08-10 13:02:22 +00:00
|
|
|
CON(s.ca, _['p'], False)
|
2025-08-03 13:53:51 +03:00
|
|
|
s.wait()
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
def wait(s, i=5):
|
2025-08-03 13:53:51 +03:00
|
|
|
r = GGR()
|
2025-08-10 13:02:22 +00:00
|
|
|
if (r != s.lr) and r:
|
|
|
|
|
s.__class__.BST[s.ci]['roster'] = s.lr = r
|
|
|
|
|
return s.next()
|
|
|
|
|
if not i:
|
|
|
|
|
s.__class__.BST[s.ci]['roster'] = []
|
|
|
|
|
return s.next()
|
|
|
|
|
teck(0.1, Call(s.wait, i-1))
|
|
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def next(s):
|
|
|
|
|
s.ci += 1
|
|
|
|
|
if s.ci >= len(s.__class__.BST):
|
|
|
|
|
BYE()
|
2025-08-10 13:02:22 +00:00
|
|
|
teck(0.5, s.yay)
|
2025-08-03 13:53:51 +03:00
|
|
|
return
|
|
|
|
|
s.cycle()
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def yay(s):
|
|
|
|
|
TIP('Cycle finished!')
|
2025-08-10 13:02:22 +00:00
|
|
|
s.ding(0, 1)
|
2025-08-03 13:53:51 +03:00
|
|
|
s.busy = False
|
|
|
|
|
zw('squad_button').activate()
|
2025-08-10 13:02:22 +00:00
|
|
|
teck(0.3, byBordd.up)
|
|
|
|
|
|
|
|
|
|
def ping(s, _):
|
2025-08-03 13:53:51 +03:00
|
|
|
sock = ping = None
|
2025-08-10 13:02:22 +00:00
|
|
|
a, p = _['a'], _['p']
|
|
|
|
|
sock = socket(IPT(a), SOCK_DGRAM)
|
|
|
|
|
try:
|
|
|
|
|
sock.connect((a, p))
|
|
|
|
|
except:
|
|
|
|
|
ping = None
|
2025-08-03 13:53:51 +03:00
|
|
|
else:
|
|
|
|
|
st = time()
|
|
|
|
|
sock.settimeout(s.MAX)
|
|
|
|
|
yes = False
|
|
|
|
|
for _i in range(3):
|
|
|
|
|
try:
|
|
|
|
|
sock.send(b'\x0b')
|
|
|
|
|
r = sock.recv(10)
|
2025-08-10 13:02:22 +00:00
|
|
|
except:
|
|
|
|
|
r = None
|
2025-08-03 13:53:51 +03:00
|
|
|
if r == b'\x0c':
|
|
|
|
|
yes = True
|
|
|
|
|
break
|
|
|
|
|
sleep(s.MAX)
|
|
|
|
|
ping = (time()-st)*1000 if yes else None
|
|
|
|
|
finally:
|
|
|
|
|
_['ping'] = ping
|
|
|
|
|
sock.close()
|
|
|
|
|
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
# Patches
|
2025-08-10 13:02:22 +00:00
|
|
|
bw = lambda *, oac=None, **k: obw(
|
2025-08-03 13:53:51 +03:00
|
|
|
texture=gt('white'),
|
|
|
|
|
on_activate_call=oac,
|
|
|
|
|
enable_sound=False,
|
|
|
|
|
**k
|
|
|
|
|
)
|
2025-08-10 13:02:22 +00:00
|
|
|
cw = lambda *, size=None, oac=None, **k: (p := ocw(
|
2025-08-03 13:53:51 +03:00
|
|
|
parent=zw('overlay_stack'),
|
|
|
|
|
background=False,
|
|
|
|
|
transition='in_scale',
|
|
|
|
|
size=size,
|
|
|
|
|
on_outside_click_call=oac,
|
|
|
|
|
**k
|
2025-08-10 13:02:22 +00:00
|
|
|
)) and (p, iw(
|
2025-08-03 13:53:51 +03:00
|
|
|
parent=p,
|
|
|
|
|
texture=gt('softRect'),
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(size[0]*1.2, size[1]*1.2),
|
|
|
|
|
position=(-size[0]*0.1, -size[1]*0.1),
|
2025-08-03 13:53:51 +03:00
|
|
|
opacity=0.55,
|
2025-08-10 13:02:22 +00:00
|
|
|
color=(0, 0, 0)
|
|
|
|
|
), iw(
|
2025-08-03 13:53:51 +03:00
|
|
|
parent=p,
|
|
|
|
|
size=size,
|
|
|
|
|
texture=gt('white'),
|
|
|
|
|
color=Finder.COL1
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
# Global
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def BTW(t): return (push(t, color=(1, 1, 0)), gs('block').play())
|
|
|
|
|
def TIP(t): return push(t, Finder.COL3)
|
2025-08-03 13:53:51 +03:00
|
|
|
|
|
|
|
|
# ba_meta require api 9
|
|
|
|
|
# ba_meta export babase.Plugin
|
2025-08-10 13:02:22 +00:00
|
|
|
|
|
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
class byBordd(Plugin):
|
|
|
|
|
BTN = None
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
@classmethod
|
|
|
|
|
def up(c):
|
|
|
|
|
c.BTN.activate() if c.BTN.exists() else None
|
2025-08-10 13:02:22 +00:00
|
|
|
|
2025-08-03 13:53:51 +03:00
|
|
|
def __init__(s):
|
|
|
|
|
from bauiv1lib import party
|
|
|
|
|
p = party.PartyWindow
|
|
|
|
|
a = '__init__'
|
2025-08-10 13:02:22 +00:00
|
|
|
o = getattr(p, a)
|
|
|
|
|
setattr(p, a, lambda z, *a, **k: (o(z, *a, **k), s.make(z))[0])
|
|
|
|
|
|
|
|
|
|
def make(s, z):
|
|
|
|
|
sz = (80, 30)
|
2025-08-03 13:53:51 +03:00
|
|
|
p = z._root_widget
|
2025-08-10 13:02:22 +00:00
|
|
|
x, y = (-60, z._height-45)
|
2025-08-03 13:53:51 +03:00
|
|
|
iw(
|
|
|
|
|
parent=p,
|
2025-08-10 13:02:22 +00:00
|
|
|
size=(sz[0]*1.34, sz[1]*1.4),
|
|
|
|
|
position=(x-sz[0]*0.14, y-sz[1]*0.20),
|
2025-08-03 13:53:51 +03:00
|
|
|
texture=gt('softRect'),
|
|
|
|
|
opacity=0.2,
|
2025-08-10 13:02:22 +00:00
|
|
|
color=(0, 0, 0)
|
2025-08-03 13:53:51 +03:00
|
|
|
)
|
|
|
|
|
s.b = s.__class__.BTN = bw(
|
|
|
|
|
parent=p,
|
2025-08-10 13:02:22 +00:00
|
|
|
position=(x, y),
|
2025-08-03 13:53:51 +03:00
|
|
|
label='Finder',
|
|
|
|
|
color=Finder.COL1,
|
|
|
|
|
textcolor=Finder.COL3,
|
|
|
|
|
size=sz,
|
2025-08-10 13:02:22 +00:00
|
|
|
oac=lambda: Finder(s.b)
|
2025-08-03 13:53:51 +03:00
|
|
|
)
|