[ci] auto-format

This commit is contained in:
BroBordd 2025-08-10 13:02:22 +00:00 committed by github-actions[bot]
parent bba1a27837
commit 99611b9ae6
8 changed files with 1960 additions and 1387 deletions

View file

@ -46,22 +46,25 @@ from bauiv1lib.ingamemenu import InGameMenuWindow as igm
from babase import Plugin, InputType as IT from babase import Plugin, InputType as IT
from math import sqrt, dist from math import sqrt, dist
class Camera: class Camera:
__doc__ = 'A simple camera.' __doc__ = 'A simple camera.'
__ins__ = None __ins__ = None
__lst__ = None __lst__ = None
__yes__ = False __yes__ = False
def __init__(s) -> None: def __init__(s) -> None:
c = s.__class__ c = s.__class__
if c.__yes__: if c.__yes__:
note('Stopped camera!',True) note('Stopped camera!', True)
c.__ins__.done(talk=False) c.__ins__.done(talk=False)
return return
c.__ins__ = s c.__ins__ = s
c.__yes__ = True c.__yes__ = True
if c.__lst__: SCM(False) if c.__lst__:
SCM(False)
s.stage = 0 s.stage = 0
p = (0,1,0) p = (0, 1, 0)
s.tex = 'achievementCrossHair' s.tex = 'achievementCrossHair'
s.kids = [] s.kids = []
s.okay = [] s.okay = []
@ -94,7 +97,7 @@ class Camera:
'is_area_of_interest': True 'is_area_of_interest': True
} }
) )
tick(0.15, animate(n,'mesh_scale',{0:2,0.1:0.5}).delete) tick(0.15, animate(n, 'mesh_scale', {0: 2, 0.1: 0.5}).delete)
gbs('powerup01').play(position=p) gbs('powerup01').play(position=p)
s.step = 0.01 s.step = 0.01
s.node = n s.node = n
@ -104,7 +107,7 @@ class Camera:
s.overlay = Overlay() s.overlay = Overlay()
LN({ LN({
'UP_DOWN': lambda a: s.manage(a), 'UP_DOWN': lambda a: s.manage(a),
'LEFT_RIGHT': lambda a: s.manage(a,1), 'LEFT_RIGHT': lambda a: s.manage(a, 1),
'PICK_UP_PRESS': lambda: s.start(2), 'PICK_UP_PRESS': lambda: s.start(2),
'JUMP_PRESS': lambda: s.start(0), 'JUMP_PRESS': lambda: s.start(0),
'PICK_UP_RELEASE': lambda: s.stop(2), 'PICK_UP_RELEASE': lambda: s.stop(2),
@ -116,24 +119,25 @@ class Camera:
}) })
s.move() s.move()
"""Write a tip""" """Write a tip"""
def tip(s,t,p,h='left',b=True): def tip(s, t, p, h='left', b=True):
n = newnode( n = newnode(
'text', 'text',
attrs={ attrs={
'in_world': True, 'in_world': True,
'scale': 0.01, 'scale': 0.01,
'flatness': 1, 'flatness': 1,
'color': (1,1,1), 'color': (1, 1, 1),
'shadow': 1.0, 'shadow': 1.0,
'position': p, 'position': p,
'text': t, 'text': t,
'h_align': h 'h_align': h
} }
) )
if b: s.kids.append(n) if b:
s.kids.append(n)
return n return n
"""Create a dot""" """Create a dot"""
def dot(s,p,b=True,tex='black'): def dot(s, p, b=True, tex='black'):
n = newnode( n = newnode(
'prop', 'prop',
delegate=s, delegate=s,
@ -147,27 +151,29 @@ class Camera:
'materials': [s.M], 'materials': [s.M],
} }
) )
if b: s.kids.append(n) if b:
s.kids.append(n)
return n return n
"""Draw a line""" """Draw a line"""
def line(s,p1,p2,i=2,tex='black'): def line(s, p1, p2, i=2, tex='black'):
x1,y1,z1 = p1 x1, y1, z1 = p1
x2,y2,z2 = p2 x2, y2, z2 = p2
n = dist(p1,p2)*i n = dist(p1, p2)*i
for i in range(1,int(n+1)): for i in range(1, int(n+1)):
t = i/n t = i/n
x = x1+t*(x2-x1) x = x1+t*(x2-x1)
y = y1+t*(y2-y1) y = y1+t*(y2-y1)
z = z1+t*(z2-z1) z = z1+t*(z2-z1)
s.kids.append(s.dot((x,y,z),tex=tex)) s.kids.append(s.dot((x, y, z), tex=tex))
"""Mark""" """Mark"""
def mark(s): def mark(s):
if not s.stage: if not s.stage:
s.stage = 1 s.stage = 1
p = s.getpos() p = s.getpos()
s.p1 = (p[0]-0.01,p[1],p[2]) s.p1 = (p[0]-0.01, p[1], p[2])
s.okay.append(s.dot(s.p1,b=False)) s.okay.append(s.dot(s.p1, b=False))
s.okay.append(s.tip(f'Camera position\n{tuple([round(i,2) for i in s.p1])}',s.p1,b=False)) s.okay.append(
s.tip(f'Camera position\n{tuple([round(i, 2) for i in s.p1])}', s.p1, b=False))
else: else:
[i.delete() for i in s.kids] [i.delete() for i in s.kids]
s.kids.clear() s.kids.clear()
@ -201,16 +207,17 @@ class Camera:
s.line(s.p1, bl) s.line(s.p1, bl)
m = 4 m = 4
j = {'tex':'crossOutMask'} j = {'tex': 'crossOutMask'}
s.line(tr, tl, m, **j) s.line(tr, tl, m, **j)
s.line(tl, bl, m, **j) s.line(tl, bl, m, **j)
s.line(bl, br, m, **j) s.line(bl, br, m, **j)
s.line(br, tr, m, **j) s.line(br, tr, m, **j)
s.tip(f'Your display\n{r[0]}x{r[1]} px\n{tuple([round(i,2) for i in p2])}',tr,'right') s.tip(
f'Your display\n{r[0]}x{r[1]} px\n{tuple([round(i, 2) for i in p2])}', tr, 'right')
s.stage = 2 s.stage = 2
s.overlay.press(3) s.overlay.press(3)
tick(0.25, animate(s.node,'mesh_scale',{0:0.5,0.1:0.2,0.2:0.5}).delete) tick(0.25, animate(s.node, 'mesh_scale', {0: 0.5, 0.1: 0.2, 0.2: 0.5}).delete)
gbs('gunCocking').play(position=s.node.position) gbs('gunCocking').play(position=s.node.position)
"""Handle events""" """Handle events"""
def handlemessage(s, m): def handlemessage(s, m):
@ -237,117 +244,132 @@ class Camera:
def reset(s): def reset(s):
s.__class__.__yes__ = False s.__class__.__yes__ = False
me = getme() me = getme()
if not me: return if not me:
return
me.resetinput() me.resetinput()
with ga().context: me.actor.connect_controls_to_player() with ga().context:
me.actor.connect_controls_to_player()
[i.delete() for i in (s.kids+s.okay)] [i.delete() for i in (s.kids+s.okay)]
"""Manage movement""" """Manage movement"""
def manage(s,a,lr=0): def manage(s, a, lr=0):
if lr: s.llr = a; return if lr:
s.llr = a
return
s.lud = a s.lud = a
"""Move""" """Move"""
def move(s): def move(s):
m = getme(1) m = getme(1)
if (not m) or m._dead: s.destroy() if (not m) or m._dead:
try: p = s.getpos() s.destroy()
try:
p = s.getpos()
except: except:
s.overlay.destroy() s.overlay.destroy()
return return
s.setpos((p[0]+s.llr*s.step,p[1],p[2]-s.lud*s.step)) s.setpos((p[0]+s.llr*s.step, p[1], p[2]-s.lud*s.step))
s.overlay.up(*p,s.llr,s.lud) s.overlay.up(*p, s.llr, s.lud)
SCT(*p) SCT(*p)
teck(s.wait,s.move) teck(s.wait, s.move)
"""Start elevating""" """Start elevating"""
def start(s,i): def start(s, i):
s.overlay.press(i) s.overlay.press(i)
s.mode = i s.mode = i
s.loop(i) s.loop(i)
"""Keep elevating""" """Keep elevating"""
def loop(s,i): def loop(s, i):
if s.mode != i: return if s.mode != i:
try: p = list(s.node.position) return
except: return try:
p = list(s.node.position)
except:
return
p[1] += s.step if i else -s.step p[1] += s.step if i else -s.step
s.node.position = tuple(p) s.node.position = tuple(p)
teck(s.wait, lambda: s.loop(i)) teck(s.wait, lambda: s.loop(i))
"""Stop elevating""" """Stop elevating"""
def stop(s,i): def stop(s, i):
s.overlay.release(i) s.overlay.release(i)
s.mode = 4 s.mode = 4
"""Get position""" """Get position"""
def getpos(s): def getpos(s):
return s.node.position return s.node.position
"""Set position""" """Set position"""
def setpos(s,p): def setpos(s, p):
s.node.position = p s.node.position = p
"""Done""" """Done"""
def done(s,talk=True): def done(s, talk=True):
s.overlay.press(1) s.overlay.press(1)
s.overlay.destroy() s.overlay.destroy()
try: p = s.node.position try:
except: return p = s.node.position
except:
return
with ga().context: with ga().context:
gbs('laser').play(position=p) gbs('laser').play(position=p)
tick(0.2,animate(s.node,'mesh_scale',{0:0.5,0.08:1,0.2:0}).delete) tick(0.2, animate(s.node, 'mesh_scale', {0: 0.5, 0.08: 1, 0.2: 0}).delete)
tick(0.2,s.node.delete) tick(0.2, s.node.delete)
s.reset() s.reset()
if s.stage > 1 and talk: if s.stage > 1 and talk:
SCM(True) SCM(True)
SCP(*s.p1) SCP(*s.p1)
SCT(*s.p2) SCT(*s.p2)
var('lp1',s.p1) var('lp1', s.p1)
var('lp2',s.p2) var('lp2', s.p2)
nice('Applied!') nice('Applied!')
elif talk: elif talk:
note('Incomplete camera setup\nNo changes applied.') note('Incomplete camera setup\nNo changes applied.')
if s.__class__.__ins__ == s: s.__class__.__ins__ = None if s.__class__.__ins__ == s:
s.__class__.__ins__ = None
"""Controls overlay""" """Controls overlay"""
class Overlay: class Overlay:
__lst__ = None __lst__ = None
"""Place nodes""" """Place nodes"""
def __init__(s): def __init__(s):
s.__class__.__lst__ = str(ga()) s.__class__.__lst__ = str(ga())
s.colors = [ s.colors = [
[(0.2,0.6,0.2),(0.4,1,0.4)], [(0.2, 0.6, 0.2), (0.4, 1, 0.4)],
[(0.6,0,0),(1,0,0)], [(0.6, 0, 0), (1, 0, 0)],
[(0.2,0.6,0.6),(0.4,1,1)], [(0.2, 0.6, 0.6), (0.4, 1, 1)],
[(0.6,0.6,0.2),(1,1,0.4)], [(0.6, 0.6, 0.2), (1, 1, 0.4)],
[(0.3,0.23,0.5),(0.2,0.13,0.3)] [(0.3, 0.23, 0.5), (0.2, 0.13, 0.3)]
] ]
s.pics = [] s.pics = []
s.texts = [] s.texts = []
s.pos = [] s.pos = []
s.nub = [] s.nub = []
s.old = [0,0,0] s.old = [0, 0, 0]
s.dead = False s.dead = False
with ga().context: with ga().context:
for i in range(4): for i in range(4):
j = ['Jump','Bomb','PickUp','Punch'][i] j = ['Jump', 'Bomb', 'PickUp', 'Punch'][i]
k = [600,650,600,550][i] k = [600, 650, 600, 550][i]
l = [170,220,270,220][i] l = [170, 220, 270, 220][i]
c = s.colors[i][0] c = s.colors[i][0]
n = newnode( n = newnode(
'image', 'image',
attrs={ attrs={
'texture': gbt('button'+j), 'texture': gbt('button'+j),
'absolute_scale': True, 'absolute_scale': True,
'position': (k,l), 'position': (k, l),
'scale': (60,60), 'scale': (60, 60),
'color': c 'color': c
} }
) )
s.pics.append(n) s.pics.append(n)
j = ['Down','Done','Up','Mark'][i] j = ['Down', 'Done', 'Up', 'Mark'][i]
k = [600,680,600,515][i] k = [600, 680, 600, 515][i]
l = [115,220,325,220][i] l = [115, 220, 325, 220][i]
h = ['center','left','center','right'][i] h = ['center', 'left', 'center', 'right'][i]
v = ['bottom','center','top','center'][i] v = ['bottom', 'center', 'top', 'center'][i]
n = newnode( n = newnode(
'text', 'text',
attrs={ attrs={
'text': j, 'text': j,
'position': (k,l), 'position': (k, l),
'color': c, 'color': c,
'h_align': h, 'h_align': h,
'v_align': v 'v_align': v
@ -355,92 +377,103 @@ class Overlay:
) )
s.texts.append(n) s.texts.append(n)
for i in range(3): for i in range(3):
c = s.colors[[1,0,2][i]][0] c = s.colors[[1, 0, 2][i]][0]
n = newnode( n = newnode(
'text', 'text',
attrs={ attrs={
'text': '0', 'text': '0',
'position': (640,155-30*i), 'position': (640, 155-30*i),
'color': c, 'color': c,
'h_align': 'left' 'h_align': 'left'
} }
) )
s.pos.append(n) s.pos.append(n)
s.np = (790,140) s.np = (790, 140)
for i in [0,1]: for i in [0, 1]:
j = [110,60][i] j = [110, 60][i]
n = newnode( n = newnode(
'image', 'image',
attrs={ attrs={
'texture': gbt('nub'), 'texture': gbt('nub'),
'absolute_scale': True, 'absolute_scale': True,
'position': s.np, 'position': s.np,
'scale': (j,j), 'scale': (j, j),
'color': s.colors[4][i] 'color': s.colors[4][i]
} }
) )
s.nub.append(n) s.nub.append(n)
s.fade() s.fade()
"""Color overlays""" """Color overlays"""
def set(s,i,c): def set(s, i, c):
s.pics[i].color = s.texts[i].color = c s.pics[i].color = s.texts[i].color = c
"""Color position""" """Color position"""
def pset(s,i,c): def pset(s, i, c):
s.pos[i].color = c s.pos[i].color = c
"""Simulate pressed""" """Simulate pressed"""
def press(s,i): def press(s, i):
s.set(i,s.colors[i][1]) s.set(i, s.colors[i][1])
s.pics[i].opacity = 1.0 s.pics[i].opacity = 1.0
"""Simulate released""" """Simulate released"""
def release(s,i): def release(s, i):
s.set(i,s.colors[i][0]) s.set(i, s.colors[i][0])
s.pics[i].opacity = 0.7 s.pics[i].opacity = 0.7
"""Get all nodes""" """Get all nodes"""
def nodes(s): def nodes(s):
return s.pics+s.texts+s.pos+s.nub return s.pics+s.texts+s.pos+s.nub
"""Update position""" """Update position"""
def up(s,x,y,z,lr,ud): def up(s, x, y, z, lr, ud):
new = [x,y,z] new = [x, y, z]
for i in range(3): for i in range(3):
c = s.colors[[1,0,2][i]] c = s.colors[[1, 0, 2][i]]
if s.old[i] == new[i]: s.pset(i,c[0]); continue if s.old[i] == new[i]:
s.pset(i, c[0])
continue
t = s.pos[i] t = s.pos[i]
t.text = str(round(new[i],5)) t.text = str(round(new[i], 5))
s.pset(i,c[1]) s.pset(i, c[1])
s.old = new s.old = new
[setattr(s.nub[i],'opacity',[[0.5,0.2],[0.7,0.3]][bool(lr or ud)][i]) for i in [0,1]] [setattr(s.nub[i], 'opacity', [[0.5, 0.2], [0.7, 0.3]][bool(lr or ud)][i]) for i in [0, 1]]
p = s.np p = s.np
m = sqrt(lr**2+ud**2) or 1 m = sqrt(lr**2+ud**2) or 1
d = 25*min(sqrt(lr**2+ud**2),1) d = 25*min(sqrt(lr**2+ud**2), 1)
lr /= m lr /= m
ud /= m ud /= m
s.nub[1].position = (p[0]+lr*d,p[1]+ud*d) s.nub[1].position = (p[0]+lr*d, p[1]+ud*d)
"""Fade""" """Fade"""
def fade(s,i=0): def fade(s, i=0):
if str(ga()) != s.__class__.__lst__: return if str(ga()) != s.__class__.__lst__:
return
mem = s.nodes() mem = s.nodes()
[tick(1, animate(n,'opacity',{0:i,0.5:abs(i-0.7)}).delete) for n in mem] [tick(1, animate(n, 'opacity', {0: i, 0.5: abs(i-0.7)}).delete) for n in mem]
"""Destroy overlay""" """Destroy overlay"""
def destroy(s): def destroy(s):
if s.dead: return if s.dead:
return
s.dead = True s.dead = True
with ga().context: with ga().context:
tick(0.2,lambda:s.fade(0.7)) tick(0.2, lambda: s.fade(0.7))
tick(2,lambda: [n.delete() for n in s.nodes()]) tick(2, lambda: [n.delete() for n in s.nodes()])
# Mini tools # Mini tools
note = lambda t, b=False: (push(t,color=(1,1,0)),gs('block').play() if b else None) def note(t, b=False): return (push(t, color=(1, 1, 0)), gs('block').play() if b else None)
nice = lambda t: (push(t,color=(0,1,0)),gs('dingSmallHigh').play()) def nice(t): return (push(t, color=(0, 1, 0)), gs('dingSmallHigh').play())
SCM = lambda b: (setattr(Camera,'__lst__',b),SSCM(b)) def SCM(b): return (setattr(Camera, '__lst__', b), SSCM(b))
scale = lambda v,s: (v[0]*s,v[1]*s,v[2]*s) def scale(v, s): return (v[0]*s, v[1]*s, v[2]*s)
cross = lambda a,b: (a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]) def cross(a, b): return (a[1]*b[2]-a[2]*b[1], a[2]*b[0]-a[0]*b[2], a[0]*b[1]-a[1]*b[0])
sub = lambda a,b: (a[0]-b[0],a[1]-b[1],a[2]-b[2]) def sub(a, b): return (a[0]-b[0], a[1]-b[1], a[2]-b[2])
add = lambda a,b: (a[0]+b[0],a[1]+b[1],a[2]+b[2]) def add(a, b): return (a[0]+b[0], a[1]+b[1], a[2]+b[2])
def getme(actor=0): def getme(actor=0):
for p in ga().players: for p in ga().players:
if p.sessionplayer.inputdevice.client_id == -1: if p.sessionplayer.inputdevice.client_id == -1:
return p.actor if actor else p return p.actor if actor else p
def LN(d): me = getme(); [me.assigninput(getattr(IT,k), d[k]) for k in d]
def LN(d): me = getme(); [me.assigninput(getattr(IT, k), d[k]) for k in d]
def RESUME(): def RESUME():
u = APP.ui_v1 u = APP.ui_v1
c = APP.classic c = APP.classic
@ -448,70 +481,80 @@ def RESUME():
u.clear_main_window() u.clear_main_window()
[z() for z in c.main_menu_resume_callbacks] [z() for z in c.main_menu_resume_callbacks]
c.main_menu_resume_callbacks.clear() c.main_menu_resume_callbacks.clear()
def norm(v): def norm(v):
a,b,c = v a, b, c = v
l = sqrt(a**2+b**2+c**2) l = sqrt(a**2+b**2+c**2)
return (0, 0, 0) if l == 0 else (a/l,b/l,c/l) return (0, 0, 0) if l == 0 else (a/l, b/l, c/l)
def var(s,v=None):
def var(s, v=None):
c = APP.config c = APP.config
s = 'cam_'+s s = 'cam_'+s
if v is None: return c.get(s,v) if v is None:
return c.get(s, v)
c[s] = v c[s] = v
c.commit() c.commit()
# brobord collide grass # brobord collide grass
# ba_meta require api 9 # ba_meta require api 9
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class byBordd(Plugin): class byBordd(Plugin):
has_settings_ui = lambda s: True def has_settings_ui(s): return True
show_settings_ui = lambda s, src: s.ui(source=src) def show_settings_ui(s, src): return s.ui(source=src)
col = (0.18,0.18,0.18) col = (0.18, 0.18, 0.18)
def __init__(s): def __init__(s):
o = igm._refresh_in_game o = igm._refresh_in_game
def e(f,*a,**k):
r = o(f,*a,**k) def e(f, *a, **k):
r = o(f, *a, **k)
b = bw( b = bw(
label='', label='',
size=(90,40), size=(90, 40),
button_type='square', button_type='square',
parent=f._root_widget, parent=f._root_widget,
color=(0.18,0.18,0.18), color=(0.18, 0.18, 0.18),
position=(f._width-20,0), position=(f._width-20, 0),
) )
bw(b,on_activate_call=lambda:s.ui(source=b,main=True)) bw(b, on_activate_call=lambda: s.ui(source=b, main=True))
iw( iw(
size=(40,40), size=(40, 40),
texture=gt('tv'), texture=gt('tv'),
parent=f._root_widget, parent=f._root_widget,
position=(f._width-20,5) position=(f._width-20, 5)
) )
tw( tw(
maxwidth=50, maxwidth=50,
text='Camera', text='Camera',
h_align='left', h_align='left',
parent=f._root_widget, parent=f._root_widget,
position=(f._width+15,0) position=(f._width+15, 0)
) )
return r return r
igm._refresh_in_game = e igm._refresh_in_game = e
"""The UI""" """The UI"""
def ui(s,source=None,main=False): def ui(s, source=None, main=False):
s.main = main s.main = main
off = source.get_screen_space_center() if source else (0,0) off = source.get_screen_space_center() if source else (0, 0)
w = cw( w = cw(
color=s.col, color=s.col,
size=(350,305), size=(350, 305),
stack_offset=off, stack_offset=off,
transition='in_scale', transition='in_scale',
parent=gsw('overlay_stack'), parent=gsw('overlay_stack'),
scale_origin_stack_offset=off scale_origin_stack_offset=off
) )
s.back = lambda b=True: (cw(w,transition=['out_right','out_scale'][bool(source) and b]),gs('swish').play() if b else None) s.back = lambda b=True: (
cw(w,on_outside_click_call=s.back) cw(w, transition=['out_right', 'out_scale'][bool(source) and b]), gs('swish').play() if b else None)
cw(w, on_outside_click_call=s.back)
b = Camera.__yes__ b = Camera.__yes__
t = [ t = [
('Camera is ready!',(0,1,1)), ('Camera is ready!', (0, 1, 1)),
('Camera is running!',(0,1,0)), ('Camera is running!', (0, 1, 0)),
][b] ][b]
tw( tw(
parent=w, parent=w,
@ -519,59 +562,68 @@ class byBordd(Plugin):
scale=1.5, scale=1.5,
color=t[1], color=t[1],
h_align='center', h_align='center',
position=(155,250) position=(155, 250)
) )
for i in range(4): for i in range(4):
j = [ j = [
('3D Camera mapper',s.start), ('3D Camera mapper', s.start),
('Last mapped config',s.load), ('Last mapped config', s.load),
('Last dev command',s.copy), ('Last dev command', s.copy),
('Reset all settings',s.reset) ('Reset all settings', s.reset)
][i] ][i]
tw( tw(
parent=w, parent=w,
text=j[0], text=j[0],
maxwidth=195, maxwidth=195,
position=(20,30+55*i) position=(20, 30+55*i)
) )
k = [ k = [
(['Start','Stop'][b],'cursor'), (['Start', 'Stop'][b], 'cursor'),
('Load','achievementOutline'), ('Load', 'achievementOutline'),
('Copy','file'), ('Copy', 'file'),
('Reset','replayIcon') ('Reset', 'replayIcon')
][i] ][i]
bw( bw(
parent=w, parent=w,
label=k[0], label=k[0],
color=s.col, color=s.col,
size=(120,50), size=(120, 50),
icon=gt(k[1]), icon=gt(k[1]),
enable_sound=not i, enable_sound=not i,
textcolor=(1,1,1), textcolor=(1, 1, 1),
button_type='square', button_type='square',
on_activate_call=j[1], on_activate_call=j[1],
position=(220,20+55*i) position=(220, 20+55*i)
) )
"""Gather last""" """Gather last"""
def gather(s): def gather(s):
return var('lp1'),var('lp2') return var('lp1'), var('lp2')
"""Reset""" """Reset"""
def reset(s): def reset(s):
SCM(False) SCM(False)
nice('Resetored original settings!') nice('Resetored original settings!')
"""Copy last""" """Copy last"""
def copy(s): def copy(s):
if not CIS(): note('Unsupported!',True); return if not CIS():
note('Unsupported!', True)
return
g = s.gather() g = s.gather()
if not g[1]: note('Apply something first!',True); return if not g[1]:
g = [tuple([round(i,2) for i in j]) for j in g] note('Apply something first!', True)
COPY(f'from _babase import set_camera_manual as SCM, set_camera_target as SCT, set_camera_position as SCP; SCM(True); SCP(*{g[0]}); SCT(*{g[1]})') return
g = [tuple([round(i, 2) for i in j]) for j in g]
COPY(
f'from _babase import set_camera_manual as SCM, set_camera_target as SCT, set_camera_position as SCP; SCM(True); SCP(*{g[0]}); SCT(*{g[1]})')
nice('Copied command!\nPaste it in dev console anytime to load config!') nice('Copied command!\nPaste it in dev console anytime to load config!')
"""Load last""" """Load last"""
def load(s): def load(s):
g = s.gather() g = s.gather()
if not g[1]: note('Apply something first!',True); return if not g[1]:
if Camera.__yes__: note('Stop camera first!',True); return note('Apply something first!', True)
return
if Camera.__yes__:
note('Stop camera first!', True)
return
SCM(True) SCM(True)
SCP(*g[0]) SCP(*g[0])
SCT(*g[1]) SCT(*g[1])
@ -579,8 +631,13 @@ class byBordd(Plugin):
"""Start camera""" """Start camera"""
def start(s): def start(s):
a = ga() a = ga()
if not a: note('Only mapping requires you to be the host!\nYou still can load previous config though',True); return if not a:
if not getme(): note('Join the game first!',True); return note('Only mapping requires you to be the host!\nYou still can load previous config though', True)
return
if not getme():
note('Join the game first!', True)
return
s.back(False) s.back(False)
RESUME() if s.main else None RESUME() if s.main else None
with a.context: Camera() with a.context:
Camera()

File diff suppressed because it is too large Load diff

View file

@ -44,26 +44,28 @@ from bascenev1 import (
get_game_roster as GGR get_game_roster as GGR
) )
class Finder: class Finder:
COL1 = (0,0.3,0.3) COL1 = (0, 0.3, 0.3)
COL2 = (0,0.55,0.55) COL2 = (0, 0.55, 0.55)
COL3 = (0,0.7,0.7) COL3 = (0, 0.7, 0.7)
COL4 = (0,1,1) COL4 = (0, 1, 1)
COL5 = (1,1,0) COL5 = (1, 1, 0)
MAX = 0.3 MAX = 0.3
TOP = 15 TOP = 15
VER = '1.0' VER = '1.0'
MEM = [] MEM = []
BST = [] BST = []
SL = None SL = None
def __init__(s,src):
def __init__(s, src):
s.thr = [] s.thr = []
s.ikids = [] s.ikids = []
s.busy = False s.busy = False
s.s1 = s.snd('powerup01') s.s1 = s.snd('powerup01')
c = s.__class__ c = s.__class__
# parent # parent
z = (460,400) z = (460, 400)
s.p = cw( s.p = cw(
scale_origin_stack_offset=src.get_screen_space_center(), scale_origin_stack_offset=src.get_screen_space_center(),
size=z, size=z,
@ -80,12 +82,12 @@ class Finder:
parent=s.p, parent=s.p,
text='Fetch Servers', text='Fetch Servers',
color=s.COL4, color=s.COL4,
position=(19,359) position=(19, 359)
) )
bw( bw(
parent=s.p, parent=s.p,
position=(360,343), position=(360, 343),
size=(80,39), size=(80, 39),
label='Fetch', label='Fetch',
color=s.COL2, color=s.COL2,
textcolor=s.COL4, textcolor=s.COL4,
@ -96,14 +98,14 @@ class Finder:
text='Fetches, pings, and sorts public servers.', text='Fetches, pings, and sorts public servers.',
color=s.COL3, color=s.COL3,
scale=0.8, scale=0.8,
position=(15,330), position=(15, 330),
maxwidth=320 maxwidth=320
) )
# separator # separator
iw( iw(
parent=s.p, parent=s.p,
size=(429,1), size=(429, 1),
position=(17,330), position=(17, 330),
texture=gt('white'), texture=gt('white'),
color=s.COL2 color=s.COL2
) )
@ -112,12 +114,12 @@ class Finder:
parent=s.p, parent=s.p,
text='Cycle Servers', text='Cycle Servers',
color=s.COL4, color=s.COL4,
position=(19,294) position=(19, 294)
) )
bw( bw(
parent=s.p, parent=s.p,
position=(360,278), position=(360, 278),
size=(80,39), size=(80, 39),
label='Cycle', label='Cycle',
color=s.COL2, color=s.COL2,
textcolor=s.COL4, textcolor=s.COL4,
@ -128,15 +130,15 @@ class Finder:
text='Cycles through best servers and saves their players.', text='Cycles through best servers and saves their players.',
color=s.COL3, color=s.COL3,
scale=0.8, scale=0.8,
position=(15,265), position=(15, 265),
maxwidth=320, maxwidth=320,
v_align='center' v_align='center'
) )
# separator # separator
iw( iw(
parent=s.p, parent=s.p,
size=(429,1), size=(429, 1),
position=(17,265), position=(17, 265),
texture=gt('white'), texture=gt('white'),
color=s.COL2 color=s.COL2
) )
@ -145,12 +147,12 @@ class Finder:
parent=s.p, parent=s.p,
text='Server Cycle Limit', text='Server Cycle Limit',
color=s.COL4, color=s.COL4,
position=(19,230) position=(19, 230)
) )
s.top = tw( s.top = tw(
parent=s.p, parent=s.p,
position=(398,228), position=(398, 228),
size=(80,50), size=(80, 50),
text=str(c.TOP), text=str(c.TOP),
color=s.COL4, color=s.COL4,
editable=True, editable=True,
@ -167,76 +169,78 @@ class Finder:
text='Maximum number of servers to cycle.', text='Maximum number of servers to cycle.',
color=s.COL3, color=s.COL3,
scale=0.8, scale=0.8,
position=(15,201), position=(15, 201),
maxwidth=320 maxwidth=320
) )
# separator # separator
iw( iw(
parent=s.p, parent=s.p,
size=(429,1), size=(429, 1),
position=(17,200), position=(17, 200),
texture=gt('white'), texture=gt('white'),
color=s.COL2 color=s.COL2
) )
# players # players
pl = s.plys() pl = s.plys()
sy = max(len(pl)*30,140) sy = max(len(pl)*30, 140)
p1 = sw( p1 = sw(
parent=s.p, parent=s.p,
position=(20,18), position=(20, 18),
size=(205,172), size=(205, 172),
border_opacity=0.4 border_opacity=0.4
) )
p2 = ocw( p2 = ocw(
parent=p1, parent=p1,
size=(205,sy), size=(205, sy),
background=False background=False
) )
0 if pl else tw( 0 if pl else tw(
parent=s.p, parent=s.p,
position=(90,100), position=(90, 100),
text='Cycle some servers\nto collect players', text='Cycle some servers\nto collect players',
color=s.COL4, color=s.COL4,
maxwidth=175, maxwidth=175,
h_align='center' h_align='center'
) )
s.kids = [] s.kids = []
for _,g in enumerate(pl): for _, g in enumerate(pl):
p,a = g p, a = g
s.kids.append(tw( s.kids.append(tw(
parent=p2, parent=p2,
size=(200,30), size=(200, 30),
selectable=True, selectable=True,
click_activate=True, click_activate=True,
color=s.COL3, color=s.COL3,
text=p, text=p,
position=(0,sy-30-30*_), position=(0, sy-30-30*_),
maxwidth=175, maxwidth=175,
on_activate_call=Call(s.hl,_,p), on_activate_call=Call(s.hl, _, p),
v_align='center' v_align='center'
)) ))
# info # info
iw( iw(
parent=s.p, parent=s.p,
position=(235,18), position=(235, 18),
size=(205,172), size=(205, 172),
texture=gt('scrollWidget'), texture=gt('scrollWidget'),
mesh_transparent=gm('softEdgeOutside'), mesh_transparent=gm('softEdgeOutside'),
opacity=0.4 opacity=0.4
) )
s.tip = tw( s.tip = tw(
parent=s.p, parent=s.p,
position=(310,98), position=(310, 98),
text='Select something to\nview server info', text='Select something to\nview server info',
color=s.COL4, color=s.COL4,
maxwidth=170, maxwidth=170,
h_align='center' h_align='center'
) if c.SL is None else 0 ) if c.SL is None else 0
def hl(s,_,p):
[tw(t,color=s.COL3) for t in s.kids] def hl(s, _, p):
tw(s.kids[_],color=s.COL4) [tw(t, color=s.COL3) for t in s.kids]
tw(s.kids[_], color=s.COL4)
s.info(p) s.info(p)
def info(s,p):
def info(s, p):
[_.delete() for _ in s.ikids] [_.delete() for _ in s.ikids]
s.ikids.clear() s.ikids.clear()
s.tip and s.tip.delete() s.tip and s.tip.delete()
@ -250,61 +254,69 @@ class Finder:
t = str(i['nap'[_]]) t = str(i['nap'[_]])
s.ikids.append(tw( s.ikids.append(tw(
parent=s.p, parent=s.p,
position=(250,155-40*_), position=(250, 155-40*_),
h_align='center', h_align='center',
v_align='center', v_align='center',
maxwidth=175, maxwidth=175,
text=t, text=t,
color=s.COL4, color=s.COL4,
size=(175,30), size=(175, 30),
selectable=True, selectable=True,
click_activate=True, click_activate=True,
on_activate_call=Call(s.copy,t) on_activate_call=Call(s.copy, t)
)) ))
s.ikids.append(bw( s.ikids.append(bw(
parent=s.p, parent=s.p,
position=(253,30), position=(253, 30),
size=(166,30), size=(166, 30),
label='Connect', label='Connect',
color=s.COL2, color=s.COL2,
textcolor=s.COL4, textcolor=s.COL4,
oac=Call(CON,i['a'],i['p'],False) oac=Call(CON, i['a'], i['p'], False)
)) ))
def copy(s,t):
s.ding(1,1) def copy(s, t):
s.ding(1, 1)
TIP('Copied to clipboard!') TIP('Copied to clipboard!')
COPY(t) COPY(t)
def plys(s): def plys(s):
z = [] z = []
me = app.plus.get_v1_account_name() me = app.plus.get_v1_account_name()
me = [me,'\ue063'+me] me = [me, '\ue063'+me]
for _ in s.__class__.BST: for _ in s.__class__.BST:
a = _['a'] a = _['a']
if (r:=_.get('roster',{})): if (r := _.get('roster', {})):
for p in r: for p in r:
ds = p['display_string'] ds = p['display_string']
0 if ds in me else z.append((ds,a)) 0 if ds in me else z.append((ds, a))
return sorted(z,key=lambda _: _[0].startswith('\ue030Server')) return sorted(z, key=lambda _: _[0].startswith('\ue030Server'))
def snd(s,t):
def snd(s, t):
l = gs(t) l = gs(t)
l.play() l.play()
teck(uf(0.14,0.18),l.stop) teck(uf(0.14, 0.18), l.stop)
return l return l
def bye(s): def bye(s):
s.s1.stop() s.s1.stop()
ocw(s.p,transition='out_scale') ocw(s.p, transition='out_scale')
l = s.snd('laser') l = s.snd('laser')
f = lambda: teck(0.01,f) if s.p else l.stop() def f(): return teck(0.01, f) if s.p else l.stop()
f() f()
def ding(s,i,j):
a = ['Small',''] def ding(s, i, j):
x,y = a[i],a[j] a = ['Small', '']
x, y = a[i], a[j]
s.snd('ding'+x) s.snd('ding'+x)
teck(0.1,gs('ding'+y).play) teck(0.1, gs('ding'+y).play)
def fresh(s): def fresh(s):
if s.busy: BTW("Still busy!"); return if s.busy:
BTW("Still busy!")
return
TIP('Fetching servers...') TIP('Fetching servers...')
s.ding(1,0) s.ding(1, 0)
s.busy = True s.busy = True
p = app.plus p = app.plus
p.add_v1_account_transaction( p.add_v1_account_transaction(
@ -316,15 +328,17 @@ class Finder:
callback=s.kang, callback=s.kang,
) )
p.run_v1_account_transactions() p.run_v1_account_transactions()
def kang(s,r):
def kang(s, r):
c = s.__class__ c = s.__class__
c.MEM = r['l'] c.MEM = r['l']
s.thr = [] s.thr = []
for _ in s.__class__.MEM: for _ in s.__class__.MEM:
t = Thread(target=Call(s.ping,_)) t = Thread(target=Call(s.ping, _))
s.thr.append(t) s.thr.append(t)
t.start() t.start()
teck(s.MAX*4,s.join) teck(s.MAX*4, s.join)
def join(s): def join(s):
c = s.__class__ c = s.__class__
[t.join() for t in s.thr] [t.join() for t in s.thr]
@ -333,10 +347,13 @@ class Finder:
c.MEM.sort(key=lambda _: _['ping']) c.MEM.sort(key=lambda _: _['ping'])
s.thr.clear() s.thr.clear()
TIP(f'Loaded {len(c.MEM)} servers!') TIP(f'Loaded {len(c.MEM)} servers!')
s.ding(0,1) s.ding(0, 1)
s.busy = False s.busy = False
def find(s): def find(s):
if s.busy: BTW("Still busy!"); return if s.busy:
BTW("Still busy!")
return
c = s.__class__ c = s.__class__
if not c.MEM: if not c.MEM:
BTW('Fetch some servers first!') BTW('Fetch some servers first!')
@ -347,44 +364,55 @@ class Finder:
return return
top = int(t) top = int(t)
if not (0 < top < len(c.MEM)): if not (0 < top < len(c.MEM)):
BTW('Cycle count is too '+['big','small'][top<=0]+'!') BTW('Cycle count is too '+['big', 'small'][top <= 0]+'!')
return return
c.TOP = top c.TOP = top
s.ding(1,0) s.ding(1, 0)
TIP('Starting cycle...') TIP('Starting cycle...')
s.busy = True s.busy = True
s.ci = s.lr = 0 s.ci = s.lr = 0
c.BST = c.MEM[:top] c.BST = c.MEM[:top]
s.cycle() s.cycle()
def cycle(s): def cycle(s):
_ = s.__class__.BST[s.ci] _ = s.__class__.BST[s.ci]
s.ca = _['a'] s.ca = _['a']
CON(s.ca,_['p'],False) CON(s.ca, _['p'], False)
s.wait() s.wait()
def wait(s,i=5):
def wait(s, i=5):
r = GGR() r = GGR()
if (r != s.lr) and r: s.__class__.BST[s.ci]['roster'] = s.lr = r; return s.next() if (r != s.lr) and r:
if not i: s.__class__.BST[s.ci]['roster'] = []; return s.next() s.__class__.BST[s.ci]['roster'] = s.lr = r
teck(0.1,Call(s.wait,i-1)) return s.next()
if not i:
s.__class__.BST[s.ci]['roster'] = []
return s.next()
teck(0.1, Call(s.wait, i-1))
def next(s): def next(s):
s.ci += 1 s.ci += 1
if s.ci >= len(s.__class__.BST): if s.ci >= len(s.__class__.BST):
BYE() BYE()
teck(0.5,s.yay) teck(0.5, s.yay)
return return
s.cycle() s.cycle()
def yay(s): def yay(s):
TIP('Cycle finished!') TIP('Cycle finished!')
s.ding(0,1) s.ding(0, 1)
s.busy = False s.busy = False
zw('squad_button').activate() zw('squad_button').activate()
teck(0.3,byBordd.up) teck(0.3, byBordd.up)
def ping(s,_):
def ping(s, _):
sock = ping = None sock = ping = None
a,p = _['a'],_['p'] a, p = _['a'], _['p']
sock = socket(IPT(a),SOCK_DGRAM) sock = socket(IPT(a), SOCK_DGRAM)
try: sock.connect((a,p)) try:
except: ping = None sock.connect((a, p))
except:
ping = None
else: else:
st = time() st = time()
sock.settimeout(s.MAX) sock.settimeout(s.MAX)
@ -393,7 +421,8 @@ class Finder:
try: try:
sock.send(b'\x0b') sock.send(b'\x0b')
r = sock.recv(10) r = sock.recv(10)
except: r = None except:
r = None
if r == b'\x0c': if r == b'\x0c':
yes = True yes = True
break break
@ -403,28 +432,29 @@ class Finder:
_['ping'] = ping _['ping'] = ping
sock.close() sock.close()
# Patches # Patches
bw = lambda *,oac=None,**k: obw( bw = lambda *, oac=None, **k: obw(
texture=gt('white'), texture=gt('white'),
on_activate_call=oac, on_activate_call=oac,
enable_sound=False, enable_sound=False,
**k **k
) )
cw = lambda *,size=None,oac=None,**k: (p:=ocw( cw = lambda *, size=None, oac=None, **k: (p := ocw(
parent=zw('overlay_stack'), parent=zw('overlay_stack'),
background=False, background=False,
transition='in_scale', transition='in_scale',
size=size, size=size,
on_outside_click_call=oac, on_outside_click_call=oac,
**k **k
)) and (p,iw( )) and (p, iw(
parent=p, parent=p,
texture=gt('softRect'), texture=gt('softRect'),
size=(size[0]*1.2,size[1]*1.2), size=(size[0]*1.2, size[1]*1.2),
position=(-size[0]*0.1,-size[1]*0.1), position=(-size[0]*0.1, -size[1]*0.1),
opacity=0.55, opacity=0.55,
color=(0,0,0) color=(0, 0, 0)
),iw( ), iw(
parent=p, parent=p,
size=size, size=size,
texture=gt('white'), texture=gt('white'),
@ -432,40 +462,47 @@ cw = lambda *,size=None,oac=None,**k: (p:=ocw(
)) ))
# Global # Global
BTW = lambda t: (push(t,color=(1,1,0)),gs('block').play())
TIP = lambda t: push(t,Finder.COL3)
def BTW(t): return (push(t, color=(1, 1, 0)), gs('block').play())
def TIP(t): return push(t, Finder.COL3)
# ba_meta require api 9 # ba_meta require api 9
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class byBordd(Plugin): class byBordd(Plugin):
BTN = None BTN = None
@classmethod @classmethod
def up(c): def up(c):
c.BTN.activate() if c.BTN.exists() else None c.BTN.activate() if c.BTN.exists() else None
def __init__(s): def __init__(s):
from bauiv1lib import party from bauiv1lib import party
p = party.PartyWindow p = party.PartyWindow
a = '__init__' a = '__init__'
o = getattr(p,a) o = getattr(p, a)
setattr(p,a,lambda z,*a,**k:(o(z,*a,**k),s.make(z))[0]) setattr(p, a, lambda z, *a, **k: (o(z, *a, **k), s.make(z))[0])
def make(s,z):
sz = (80,30) def make(s, z):
sz = (80, 30)
p = z._root_widget p = z._root_widget
x,y = (-60,z._height-45) x, y = (-60, z._height-45)
iw( iw(
parent=p, parent=p,
size=(sz[0]*1.34,sz[1]*1.4), size=(sz[0]*1.34, sz[1]*1.4),
position=(x-sz[0]*0.14,y-sz[1]*0.20), position=(x-sz[0]*0.14, y-sz[1]*0.20),
texture=gt('softRect'), texture=gt('softRect'),
opacity=0.2, opacity=0.2,
color=(0,0,0) color=(0, 0, 0)
) )
s.b = s.__class__.BTN = bw( s.b = s.__class__.BTN = bw(
parent=p, parent=p,
position=(x,y), position=(x, y),
label='Finder', label='Finder',
color=Finder.COL1, color=Finder.COL1,
textcolor=Finder.COL3, textcolor=Finder.COL3,
size=sz, size=sz,
oac=lambda:Finder(s.b) oac=lambda: Finder(s.b)
) )

View file

@ -16,12 +16,15 @@ from bascenev1 import (
newnode newnode
) )
class Path: class Path:
def __init__(s,node,holder=None): def __init__(s, node, holder=None):
if node.body == 'crate': return if node.body == 'crate':
s.node,s.kids = node,[] return
s.node, s.kids = node, []
s.me = holder s.me = holder
s.spy() s.spy()
def spy(s): def spy(s):
n = s.node n = s.node
if not n.exists(): if not n.exists():
@ -29,13 +32,14 @@ class Path:
s.kids.clear() s.kids.clear()
return return
[_.delete() for _ in s.kids]; s.kids.clear() [_.delete() for _ in s.kids]
s.kids.clear()
ip = n.position ip = n.position
iv = n.velocity iv = n.velocity
if s.me and s.me.hold_node == n: if s.me and s.me.hold_node == n:
mv = s.me.velocity mv = s.me.velocity
iv = (iv[0]+mv[0],iv[1]+mv[1],iv[2]+mv[2]) iv = (iv[0]+mv[0], iv[1]+mv[1], iv[2]+mv[2])
dots = 200 dots = 200
ti = 1.2 ti = 1.2
@ -48,17 +52,17 @@ class Path:
py = ip[1] + iv[1] * t + 0.5 * -24 * t**2 py = ip[1] + iv[1] * t + 0.5 * -24 * t**2
pz = ip[2] + iv[2] * t pz = ip[2] + iv[2] * t
if py <=0: if py <= 0:
l = newnode( l = newnode(
'locator', 'locator',
owner=n, owner=n,
attrs={ attrs={
'shape': 'circleOutline', 'shape': 'circleOutline',
'size': [1], 'size': [1],
'color': (1,1,0), 'color': (1, 1, 0),
'draw_beauty': False, 'draw_beauty': False,
'additive': True, 'additive': True,
'position':(px,py,pz) 'position': (px, py, pz)
} }
) )
s.kids.append(l) s.kids.append(l)
@ -67,13 +71,13 @@ class Path:
'text', 'text',
owner=n, owner=n,
attrs={ attrs={
'text':'.', 'text': '.',
'scale':0.02, 'scale': 0.02,
'position':(px, py, pz), 'position': (px, py, pz),
'flatness':1, 'flatness': 1,
'in_world':True, 'in_world': True,
'color':(1-i*4/dots,0,0), 'color': (1-i*4/dots, 0, 0),
'shadow':0 'shadow': 0
} }
) )
s.kids.append(dot_node) s.kids.append(dot_node)
@ -81,8 +85,10 @@ class Path:
# brobord collide grass # brobord collide grass
# ba_meta require api 9 # ba_meta require api 9
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class byBordd(Plugin): class byBordd(Plugin):
def __init__(s): def __init__(s):
_ = __import__('bascenev1lib').actor.bomb.Bomb _ = __import__('bascenev1lib').actor.bomb.Bomb
o = _.__init__ o = _.__init__
_.__init__ = lambda z,*a,**k: (o(z,*a,**k),Path(z.node))[0] _.__init__ = lambda z, *a, **k: (o(z, *a, **k), Path(z.node))[0]

View file

@ -69,47 +69,54 @@ from ast import (
Name Name
) )
class PlugTools(TAB): class PlugTools(TAB):
KEY = 'PT_BY' KEY = 'PT_BY'
def __init__(s): def __init__(s):
s.bys = META() s.bys = META()
s.bad = [] s.bad = []
s.logs = 'No errors' s.logs = 'No errors'
s.mem = {_:MT(_) for _ in s.bys} s.mem = {_: MT(_) for _ in s.bys}
s.eye = look() s.eye = look()
s.e = False s.e = False
s.spy() s.spy()
def spy(s): def spy(s):
b = 0 b = 0
for _ in s.bys.copy(): for _ in s.bys.copy():
if not exists(PAT(_)): if not exists(PAT(_)):
s.bys.remove(_) s.bys.remove(_)
push(f'Plugin {_} suddenly disappeared!\nAnd so, was removed from list.',color=(1,1,0)) push(f'Plugin {_} suddenly disappeared!\nAnd so, was removed from list.', color=(1, 1, 0))
gs('block').play() gs('block').play()
s.eye = look() s.eye = look()
if s.hl() == _: s.hl(None) if s.hl() == _:
s.hl(None)
b = 1 b = 1
sp = app.plugins.plugin_specs.get(_,0) sp = app.plugins.plugin_specs.get(_, 0)
if not sp: continue if not sp:
continue
p = app.plugins p = app.plugins
if getattr(sp,'enabled',False): if getattr(sp, 'enabled', False):
o = s.sp.plugin o = s.sp.plugin
if o in p.active_plugins: if o in p.active_plugins:
p.active_plugins.remove(o) p.active_plugins.remove(o)
if o in p.plugin_specs: if o in p.plugin_specs:
p.plugin_specs.pop(o) p.plugin_specs.pop(o)
del s.sp.plugin,o del s.sp.plugin, o
collect() collect()
try: reload(modules[NAM(_,0)]) try:
except: pass reload(modules[NAM(_, 0)])
except:
pass
continue continue
if MT(_) != s.mem[_] and _ not in s.bad: if MT(_) != s.mem[_] and _ not in s.bad:
s.bad.append(_) s.bad.append(_)
push(f'Plugin {_} was modified!\nSee if you want to take action.',color=(1,1,0)) push(f'Plugin {_} was modified!\nSee if you want to take action.', color=(1, 1, 0))
gs('dingSmall').play() gs('dingSmall').play()
b = 1 b = 1
if hasattr(s,'sp'): if hasattr(s, 'sp'):
e = getattr(s.sp,'enabled',False) e = getattr(s.sp, 'enabled', False)
if e != s.e: if e != s.e:
s.e = e s.e = e
b = 1 b = 1
@ -120,7 +127,8 @@ class PlugTools(TAB):
nu = [] nu = []
if df: if df:
for dd in df: for dd in df:
try: _ = kang(dd) try:
_ = kang(dd)
except: except:
eye.remove(dd) eye.remove(dd)
continue continue
@ -132,12 +140,16 @@ class PlugTools(TAB):
b = 1 b = 1
if nu: if nu:
l = len(nu) l = len(nu)
push(f"Found {l} new plugin{['s',''][l==1]}:\n{', '.join(nu)}\nSee what to do with {['it','them'][l!=1]}",color=(1,1,0)) push(f"Found {l} new plugin{['s', ''][l == 1]}:\n{', '.join(nu)}\nSee what to do with {['it', 'them'][l != 1]}", color=(
1, 1, 0))
gs('dingSmallHigh').play() gs('dingSmallHigh').play()
if b: if b:
try: s.request_refresh() try:
except RuntimeError: pass s.request_refresh()
teck(0.1,s.spy) except RuntimeError:
pass
teck(0.1, s.spy)
@override @override
def refresh(s): def refresh(s):
# Preload # Preload
@ -146,14 +158,14 @@ class PlugTools(TAB):
by = None by = None
s.hl(None) s.hl(None)
s.by = by s.by = by
s.sp = app.plugins.plugin_specs.get(by,0) if by else 0 s.sp = app.plugins.plugin_specs.get(by, 0) if by else 0
s.i = getattr(s,'i',0 if by is None else s.bys.index(by)//10) s.i = getattr(s, 'i', 0 if by is None else s.bys.index(by)//10)
# UI # UI
w = s.width w = s.width
x = -w/2 x = -w/2
z = x+w z = x+w
# Bools # Bools
e = s.e = getattr(s.sp,'enabled',False) e = s.e = getattr(s.sp, 'enabled', False)
m = by in s.bad m = by in s.bad
d = by is None d = by is None
# Buttons # Buttons
@ -162,23 +174,23 @@ class PlugTools(TAB):
z -= sx z -= sx
s.button( s.button(
'Metadata', 'Metadata',
pos=(z,50), pos=(z, 50),
size=(mx,43), size=(mx, 43),
call=s.metadata, call=s.metadata,
disabled=d disabled=d
) )
s.button( s.button(
['Load','Reload'][e], ['Load', 'Reload'][e],
pos=(z,5), pos=(z, 5),
size=(mx,43), size=(mx, 43),
call=s._load, call=s._load,
disabled=d disabled=d
) )
# Separator # Separator
s.button( s.button(
'', '',
pos=(z-(w*0.006),5), pos=(z-(w*0.006), 5),
size=(2,90) size=(2, 90)
) )
# Plugin info # Plugin info
sx = w*0.1 sx = w*0.1
@ -189,28 +201,28 @@ class PlugTools(TAB):
mx = sx*0.9 mx = sx*0.9
s.text( s.text(
t, t,
pos=(az,80), pos=(az, 80),
scale=1 if tw<mx else mx/tw, scale=1 if tw < mx else mx/tw,
) )
t = 'State' if d else ['Disabled','Enabled'][e] t = 'State' if d else ['Disabled', 'Enabled'][e]
tw = GSW(t) tw = GSW(t)
s.text( s.text(
t, t,
pos=(az,50), pos=(az, 50),
scale=1 if tw<mx else mx/tw, scale=1 if tw < mx else mx/tw,
) )
t = 'Purity' if d else ['Original','Modified'][m] t = 'Purity' if d else ['Original', 'Modified'][m]
tw = GSW(t) tw = GSW(t)
s.text( s.text(
t, t,
pos=(az,20), pos=(az, 20),
scale=1 if tw<mx else mx/tw, scale=1 if tw < mx else mx/tw,
) )
# Separator # Separator
s.button( s.button(
'', '',
pos=(z-(w*0.0075),5), pos=(z-(w*0.0075), 5),
size=(2,90) size=(2, 90)
) )
# Next # Next
sx = w*0.03 sx = w*0.03
@ -218,8 +230,8 @@ class PlugTools(TAB):
z -= sx z -= sx
s.button( s.button(
cs(sc.RIGHT_ARROW), cs(sc.RIGHT_ARROW),
pos=(z,5), pos=(z, 5),
size=(mx,90), size=(mx, 90),
call=s.next, call=s.next,
disabled=(s.i+1)*10 > len(s.bys) disabled=(s.i+1)*10 > len(s.bys)
) )
@ -231,16 +243,17 @@ class PlugTools(TAB):
for i in range(5): for i in range(5):
for j in range(2): for j in range(2):
k = j*5+i+s.i*10 k = j*5+i+s.i*10
if k >= len(s.bys): break if k >= len(s.bys):
break
t = s.bys[k] t = s.bys[k]
tw = GSW(t) tw = GSW(t)
s.button( s.button(
t, t,
size=(mx,43), size=(mx, 43),
pos=(z+sx*i,50-45*j), pos=(z+sx*i, 50-45*j),
label_scale=1 if tw<zx else zx/tw, label_scale=1 if tw < zx else zx/tw,
call=Call(s.hl,t), call=Call(s.hl, t),
style=[['blue','blue_bright'],['purple','purple_bright']][t in s.bad][t==by] style=[['blue', 'blue_bright'], ['purple', 'purple_bright']][t in s.bad][t == by]
) )
# Prev # Prev
sx = w*0.03 sx = w*0.03
@ -248,32 +261,35 @@ class PlugTools(TAB):
z -= sx*0.7 z -= sx*0.7
s.button( s.button(
cs(sc.LEFT_ARROW), cs(sc.LEFT_ARROW),
pos=(z,5), pos=(z, 5),
size=(mx,90), size=(mx, 90),
call=s.prev, call=s.prev,
disabled=s.i==0 disabled=s.i == 0
) )
if s.height <= 100: return if s.height <= 100:
return
# Expanded logs # Expanded logs
t = s.logs t = s.logs
h = 25 h = 25
pos = (x+10,s.height) pos = (x+10, s.height)
z = len(t) z = len(t)
p = list(pos) p = list(pos)
m = max(t.replace('\\n','') or [''],key=GSW) m = max(t.replace('\\n', '') or [''], key=GSW)
l = GSW(str(m))/1.2 l = GSW(str(m))/1.2
ln = t.split('\\n') ln = t.split('\\n')
mm = max(ln,key=GSW) mm = max(ln, key=GSW)
sk = 0.8 sk = 0.8
ml = (s.height-100) * 0.04 ml = (s.height-100) * 0.04
ww = (l*sk)*len(mm) ww = (l*sk)*len(mm)
sk = sk if ww<s.width else (s.width*0.98/ww)*sk sk = sk if ww < s.width else (s.width*0.98/ww)*sk
zz = len(ln) zz = len(ln)
sk = sk if zz<=ml else (ml/zz)*sk sk = sk if zz <= ml else (ml/zz)*sk
xf = 0 xf = 0
for i in range(z): for i in range(z):
p[0] += [l*sk,0][i==0] p[0] += [l*sk, 0][i == 0]
if xf: xf = 0; continue if xf:
xf = 0
continue
j = t[i] j = t[i]
k = t[i+1] if (i+1) < z else j k = t[i+1] if (i+1) < z else j
if j == '\\' and k == 'n': if j == '\\' and k == 'n':
@ -288,31 +304,36 @@ class PlugTools(TAB):
v_align='top', v_align='top',
scale=sk scale=sk
) )
def hl(s,i=None):
def hl(s, i=None):
i and deek() i and deek()
c = app.config c = app.config
if i is None: return c.get(s.KEY,None) if i is None:
return c.get(s.KEY, None)
c[s.KEY] = i c[s.KEY] = i
c.commit() c.commit()
s.request_refresh() s.request_refresh()
def _load(s): def _load(s):
h = ['load','reload'][s.e] h = ['load', 'reload'][s.e]
ex,er = s.load() ex, er = s.load()
if ex: if ex:
k = f': {ex}' if str(ex).strip() else '' k = f': {ex}' if str(ex).strip() else ''
j = f'Error {h}ing {s.by}' j = f'Error {h}ing {s.by}'
push(f'{j}{k}\nExpand dev console to see more.\nTraceback dumped to terminal too.',color=(1,0,0)) push(f'{j}{k}\nExpand dev console to see more.\nTraceback dumped to terminal too.', color=(1, 0, 0))
gs('error').play() gs('error').play()
m = j+':\n'+er m = j+':\n'+er
print('[PlugTools] '+m) print('[PlugTools] '+m)
s.logs = m.replace('\n','\\n') s.logs = m.replace('\n', '\\n')
s.request_refresh() s.request_refresh()
return return
s.logs = 'No errors' s.logs = 'No errors'
if ex is False: return if ex is False:
push(h.title()+'ed '+s.by,color=(0,1,0)) return
push(h.title()+'ed '+s.by, color=(0, 1, 0))
gs('gunCocking').play() gs('gunCocking').play()
s.request_refresh() s.request_refresh()
def load(s): def load(s):
_ = s.by _ = s.by
if _ in s.bad: if _ in s.bad:
@ -320,31 +341,41 @@ class PlugTools(TAB):
s.mem[_] = MT(_) s.mem[_] = MT(_)
p = app.plugins p = app.plugins
if s.e: if s.e:
if hasattr(s.sp,'plugin'): if hasattr(s.sp, 'plugin'):
o = s.sp.plugin o = s.sp.plugin
if o in p.active_plugins: if o in p.active_plugins:
p.active_plugins.remove(o) p.active_plugins.remove(o)
del s.sp.plugin del s.sp.plugin
collect() collect()
try: m = reload(modules[NAM(_,0)]) try:
m = reload(modules[NAM(_, 0)])
except KeyError: except KeyError:
gs('block').play() gs('block').play()
push(f"{s.by} is malformed!\nAre you sure there's no errors?",color=(1,1,0)) push(f"{s.by} is malformed!\nAre you sure there's no errors?", color=(1, 1, 0))
return (False,0) return (False, 0)
except Exception as ex: return (ex,ERR()) except Exception as ex:
else: m = __import__(NAM(_,0)) return (ex, ERR())
try: cls = getattr(m,_.split('.',1)[1]) else:
except Exception as ex: return (ex,ERR()) m = __import__(NAM(_, 0))
try: ins = cls() try:
except Exception as ex: return (ex,ERR()) cls = getattr(m, _.split('.', 1)[1])
try: ins.on_app_running() except Exception as ex:
except Exception as ex: return (ex,ERR()) return (ex, ERR())
s.sp = PluginSpec(class_path=_,loadable=True) try:
ins = cls()
except Exception as ex:
return (ex, ERR())
try:
ins.on_app_running()
except Exception as ex:
return (ex, ERR())
s.sp = PluginSpec(class_path=_, loadable=True)
s.sp.enabled = True s.sp.enabled = True
s.sp.plugin = ins s.sp.plugin = ins
p.plugin_specs[_] = s.sp p.plugin_specs[_] = s.sp
p.active_plugins.append(ins) p.active_plugins.append(ins)
return (0,0) return (0, 0)
def metadata(s): def metadata(s):
f = PAT(s.sp.class_path) f = PAT(s.sp.class_path)
info = [] info = []
@ -409,21 +440,30 @@ class PlugTools(TAB):
info.append("File Exists: No") info.append("File Exists: No")
push('\n'.join(info)) push('\n'.join(info))
gs('powerup01').play() gs('powerup01').play()
def next(s): def next(s):
deek() deek()
s.i += 1 s.i += 1
s.request_refresh() s.request_refresh()
def prev(s): def prev(s):
deek() deek()
s.i -= 1 s.i -= 1
s.request_refresh() s.request_refresh()
MT = lambda _: stat(PAT(_))
GSW = lambda s: sw(s,suppress_warning=True) def MT(_): return stat(PAT(_))
NAM = lambda _,py=1: _.split('.',1)[0]+['','.py'][py] def GSW(s): return sw(s, suppress_warning=True)
PAT = lambda _: join(ROOT,NAM(_))
def NAM(_, py=1): return _.split('.', 1)[0]+['', '.py'][py]
def PAT(_): return join(ROOT, NAM(_))
ROOT = env()['python_directory_user'] ROOT = env()['python_directory_user']
META = lambda: app.meta.scanresults.exports_by_name('babase.Plugin') def META(): return app.meta.scanresults.exports_by_name('babase.Plugin')
def look(): def look():
python_files = [] python_files = []
try: try:
@ -437,6 +477,8 @@ def look():
except PermissionError: except PermissionError:
pass pass
return python_files return python_files
def kang(file_path): def kang(file_path):
with open(file_path, 'r', encoding='utf-8') as f: with open(file_path, 'r', encoding='utf-8') as f:
source_code = f.read() source_code = f.read()
@ -460,16 +502,20 @@ def kang(file_path):
(isinstance(base, Attribute) and base.attr == 'Plugin' and isinstance(base.value, Name) and base.value.id == 'babase'): (isinstance(base, Attribute) and base.attr == 'Plugin' and isinstance(base.value, Name) and base.value.id == 'babase'):
return f"{filename_without_ext}.{node.name}" return f"{filename_without_ext}.{node.name}"
return None return None
deek = lambda: gs('deek').play()
def deek(): return gs('deek').play()
# brobord collide grass # brobord collide grass
# ba_meta require api 9 # ba_meta require api 9
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class byBordd(Plugin): class byBordd(Plugin):
def __init__(s): def __init__(s):
C = PlugTools C = PlugTools
N = C.__name__ N = C.__name__
E = ENT(N,C) E = ENT(N, C)
I = app.devconsole I = app.devconsole
I.tabs = [_ for _ in I.tabs if _.name != N]+[E] I.tabs = [_ for _ in I.tabs if _.name != N]+[E]
I._tab_instances[N] = E.factory() I._tab_instances[N] = E.factory()

View file

@ -41,22 +41,28 @@ from bauiv1 import (
Call Call
) )
class Power(TAB): class Power(TAB):
def __init__(s): def __init__(s):
s.j = [None,None,None]; s.ji = 1 s.j = [None, None, None]
[setattr(s,_,None) for _ in 'cpnh'] s.ji = 1
[setattr(s,_,{}) for _ in ['rr','hi']] [setattr(s, _, None) for _ in 'cpnh']
[setattr(s,_,[]) for _ in ['cm','og','r','ls']] [setattr(s, _, {}) for _ in ['rr', 'hi']]
[setattr(s,_,0) for _ in ['ii','eii','ci','re','ri','eri','li','lii']] [setattr(s, _, []) for _ in ['cm', 'og', 'r', 'ls']]
teck(3,s.spy) [setattr(s, _, 0) for _ in ['ii', 'eii', 'ci', 're', 'ri', 'eri', 'li', 'lii']]
teck(3, s.spy)
def rf(s): def rf(s):
try: s.request_refresh() try:
except RuntimeError: pass s.request_refresh()
except RuntimeError:
pass
def spy(s): def spy(s):
_ = 0 _ = 0
r = ROST() r = ROST()
if r != s.r: if r != s.r:
s.rr = {i['display_string']:(i['client_id'],i['players']) for i in r} s.rr = {i['display_string']: (i['client_id'], i['players']) for i in r}
s.r = r s.r = r
_ = 1 _ = 1
h = HOST() h = HOST()
@ -79,37 +85,44 @@ class Power(TAB):
s.og = ng s.og = ng
ls = ng[-1] ls = ng[-1]
ch = s.cm[0][1] if len(s.cm) else 0 ch = s.cm[0][1] if len(s.cm) else 0
if ch and ls == s.cm[0][0]: s.cm[0] = (ls,ch+1) if ch and ls == s.cm[0][0]:
else: s.cm.insert(0,(ls,1)) s.cm[0] = (ls, ch+1)
if s.ci: s.ci += 1 else:
s.cm.insert(0, (ls, 1))
if s.ci:
s.ci += 1
_ = 1 _ = 1
_ and s.rf() _ and s.rf()
teck(0.1,s.spy) teck(0.1, s.spy)
@override @override
def refresh(s): def refresh(s):
sf = s.width / 1605.3 sf = s.width / 1605.3
zf = s.height / 648 zf = s.height / 648
x = -s.width/2 x = -s.width/2
T,B = s.text,s.button T, B = s.text, s.button
if len(s.r) and s.ri >= len(s.r): s.ri = len(s.r) - 1 if len(s.r) and s.ri >= len(s.r):
if len(s.r) and s.eri >= len(s.r): s.eri = len(s.r) - 1 s.ri = len(s.r) - 1
if len(s.r) and s.eri >= len(s.r):
s.eri = len(s.r) - 1
if s.j[0] == 'JRejoin' and s.ji <= s.re: if s.j[0] == 'JRejoin' and s.ji <= s.re:
s.ji = s.re + 1 s.ji = s.re + 1
push('Job time cannot be less than rejoin time\nwhen job is JRejoin. Updated job time to '+str(s.ji),color=(1,1,0)) push('Job time cannot be less than rejoin time\nwhen job is JRejoin. Updated job time to ' +
str(s.ji), color=(1, 1, 0))
if s.height > 100: if s.height > 100:
B( B(
cs(sc.UP_ARROW), cs(sc.UP_ARROW),
pos=(x + 10 * sf, 606*zf), pos=(x + 10 * sf, 606*zf),
size=(280*sf,35*zf), size=(280*sf, 35*zf),
disabled=s.eri <= 0, disabled=s.eri <= 0,
call=Call(s.mv,'eri',-1) call=Call(s.mv, 'eri', -1)
) )
B( B(
cs(sc.DOWN_ARROW), cs(sc.DOWN_ARROW),
pos=(x + 10 * sf, 290*zf), pos=(x + 10 * sf, 290*zf),
size=(280*sf,35*zf), size=(280*sf, 35*zf),
disabled=s.eri >= len(s.r)-7, disabled=s.eri >= len(s.r)-7,
call=Call(s.mv,'eri',1) call=Call(s.mv, 'eri', 1)
) )
nt = "No roster detected\nJoin some public party" nt = "No roster detected\nJoin some public party"
w = GSW(nt) w = GSW(nt)
@ -118,20 +131,22 @@ class Power(TAB):
pos=(x + 150 * sf, 495*zf), pos=(x + 150 * sf, 495*zf),
h_align='center', h_align='center',
v_align='top', v_align='top',
scale=1 if w<(290*sf) else (290*sf)/w scale=1 if w < (290*sf) else (290*sf)/w
) )
for i,z in enumerate(s.rr.items()): for i, z in enumerate(s.rr.items()):
if i < s.eri: continue if i < s.eri:
if i>=(s.eri+7): break continue
n,g = z if i >= (s.eri+7):
c,p = g break
n, g = z
c, p = g
w = GSW(n) w = GSW(n)
B( B(
n, n,
size=(280 * sf, 37*zf), size=(280 * sf, 37*zf),
pos=(x + 10 * sf, (564-39*(i-s.eri))*zf), pos=(x + 10 * sf, (564-39*(i-s.eri))*zf),
style=[['blue','blue_bright'],['purple','purple_bright']][not p][s.c==c], style=[['blue', 'blue_bright'], ['purple', 'purple_bright']][not p][s.c == c],
call=Call(s.prv,c,p,n), call=Call(s.prv, c, p, n),
label_scale=1 if w < 280 * sf else (280 * sf)/w label_scale=1 if w < 280 * sf else (280 * sf)/w
) )
B( B(
@ -142,45 +157,46 @@ class Power(TAB):
) )
bb = s.c is None bb = s.c is None
B( B(
'Bomb' if bb else (['Client','Host'][s.c==-1]+f' {s.c}'), 'Bomb' if bb else (['Client', 'Host'][s.c == -1]+f' {s.c}'),
pos=(x + 10 * sf, 230*zf), pos=(x + 10 * sf, 230*zf),
size=(280 * sf, 40*zf), size=(280 * sf, 40*zf),
disabled=bb, disabled=bb,
call=Call(push,str(s.n)) call=Call(push, str(s.n))
) )
B( B(
'Mention', 'Mention',
size=(280 * sf, 40*zf), size=(280 * sf, 40*zf),
pos=(x + 10 * sf, 185*zf), pos=(x + 10 * sf, 185*zf),
call=Call(chat,str(s.n)), call=Call(chat, str(s.n)),
disabled=bb disabled=bb
) )
B( B(
'Players', 'Players',
size=(280 * sf, 40*zf), size=(280 * sf, 40*zf),
pos=(x + 10 * sf, 140*zf), pos=(x + 10 * sf, 140*zf),
call=Call(push,'\n'.join([' '.join([f'{i}={j}' for i,j in _.items()]) for _ in s.p]) if s.p else ''), call=Call(push, '\n'.join(
[' '.join([f'{i}={j}' for i, j in _.items()]) for _ in s.p]) if s.p else ''),
disabled=bb or (not s.p) disabled=bb or (not s.p)
) )
B( B(
'Kick', 'Kick',
size=(280 * sf, 40*zf), size=(280 * sf, 40*zf),
pos=(x + 10 * sf, 95*zf), pos=(x + 10 * sf, 95*zf),
call=Call(KICK,lambda:s.rr[s.n][0]), call=Call(KICK, lambda: s.rr[s.n][0]),
disabled=bb or (s.c==-1) disabled=bb or (s.c == -1)
) )
B( B(
'JKick', 'JKick',
size=(280 * sf, 40*zf), size=(280 * sf, 40*zf),
pos=(x + 10 * sf, 50*zf), pos=(x + 10 * sf, 50*zf),
call=Call(s.job,Call(KICK,lambda:s.rr[s.n][0]),['JKick',s.c,s.n]), call=Call(s.job, Call(KICK, lambda: s.rr[s.n][0]), ['JKick', s.c, s.n]),
disabled=bb or (s.c==-1) disabled=bb or (s.c == -1)
) )
B( B(
'Vote', 'Vote',
size=(280 * sf, 40*zf), size=(280 * sf, 40*zf),
pos=(x + 10 * sf, 5*zf), pos=(x + 10 * sf, 5*zf),
call=Call(chat,'1'), call=Call(chat, '1'),
disabled=not s.r disabled=not s.r
) )
B( B(
@ -189,9 +205,9 @@ class Power(TAB):
pos=(x + 300 * sf, 5*zf), pos=(x + 300 * sf, 5*zf),
style='bright' style='bright'
) )
t = getattr(s.h,'name','Not in a server') t = getattr(s.h, 'name', 'Not in a server')
a = getattr(s.h,'address','127.0.0.1') a = getattr(s.h, 'address', '127.0.0.1')
p = getattr(s.h,'port','43210') p = getattr(s.h, 'port', '43210')
w = GSW(t) w = GSW(t)
B( B(
t if t.strip() else 'Loading...', t if t.strip() else 'Loading...',
@ -199,14 +215,15 @@ class Power(TAB):
pos=(x + 311 * sf, 606*zf), pos=(x + 311 * sf, 606*zf),
disabled=not s.h, disabled=not s.h,
label_scale=1 if w < 390 * sf else (390 * sf)/w, label_scale=1 if w < 390 * sf else (390 * sf)/w,
call=Call(push,f"{t}\nHosted on build {getattr(s.h,'build_number','0')}" if t.strip() else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'), call=Call(push, f"{t}\nHosted on build {getattr(s.h, 'build_number', '0')}" if t.strip(
) else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'),
) )
w = GSW(a) w = GSW(a)
B( B(
a, a,
size=(300 * sf, 35*zf), size=(300 * sf, 35*zf),
pos=(x + 311 * sf, 568*zf), pos=(x + 311 * sf, 568*zf),
call=Call(COPY,a), call=Call(COPY, a),
disabled=not s.h, disabled=not s.h,
label_scale=1 if w < 290 * sf else (290 * sf)/w label_scale=1 if w < 290 * sf else (290 * sf)/w
) )
@ -216,7 +233,7 @@ class Power(TAB):
size=(97 * sf, 35*zf), size=(97 * sf, 35*zf),
pos=(x + 614 * sf, 568*zf), pos=(x + 614 * sf, 568*zf),
disabled=not s.h, disabled=not s.h,
call=Call(COPY,str(p)), call=Call(COPY, str(p)),
label_scale=1 if w < 90 * sf else (90 * sf)/w label_scale=1 if w < 90 * sf else (90 * sf)/w
) )
B( B(
@ -230,34 +247,35 @@ class Power(TAB):
'Rejoin', 'Rejoin',
size=(200 * sf, 35*zf), size=(200 * sf, 35*zf),
pos=(x + 311 * sf, 492*zf), pos=(x + 311 * sf, 492*zf),
call=Call(REJOIN,a,p,lambda:s.re), call=Call(REJOIN, a, p, lambda: s.re),
disabled=not s.h disabled=not s.h
) )
B( B(
'JRejoin', 'JRejoin',
size=(197 * sf, 35*zf), size=(197 * sf, 35*zf),
pos=(x + 514 * sf, 492*zf), pos=(x + 514 * sf, 492*zf),
call=Call(s.job,Call(REJOIN,a,p,lambda:s.re),['JRejoin',a,str(p)]), call=Call(s.job, Call(REJOIN, a, p, lambda: s.re), ['JRejoin', a, str(p)]),
disabled=not s.h disabled=not s.h
) )
B( B(
'+', '+',
size=(131 * sf, 35*zf), size=(131 * sf, 35*zf),
pos=(x + 579 * sf, 454*zf), pos=(x + 579 * sf, 454*zf),
call=Call(s.mv,'re',1) call=Call(s.mv, 're', 1)
) )
B( B(
str(s.re or 0.1), str(s.re or 0.1),
size=(131 * sf, 35*zf), size=(131 * sf, 35*zf),
pos=(x + 444 * sf, 454*zf), pos=(x + 444 * sf, 454*zf),
call=Call(push,f"Rejoins after {s.re or 0.1} second{['','s'][s.re!=1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time") call=Call(
push, f"Rejoins after {s.re or 0.1} second{['', 's'][s.re != 1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time")
) )
B( B(
'-', '-',
size=(131 * sf, 35*zf), size=(131 * sf, 35*zf),
pos=(x + 311 * sf, 454*zf), pos=(x + 311 * sf, 454*zf),
disabled=s.re<=0.5, disabled=s.re <= 0.5,
call=Call(s.mv,'re',-1) call=Call(s.mv, 're', -1)
) )
B( B(
'', '',
@ -271,19 +289,21 @@ class Power(TAB):
pos=(x + 311 * sf, 445*zf), pos=(x + 311 * sf, 445*zf),
style='bright' style='bright'
) )
for i,e in enumerate(s.hi.items()): for i, e in enumerate(s.hi.items()):
if i < s.eii: continue if i < s.eii:
if i >= (s.eii+9): break continue
g,v = e if i >= (s.eii+9):
_,a = g break
n,p = v g, v = e
_, a = g
n, p = v
w = GSW(n) w = GSW(n)
B( B(
n, n,
size=(400 * sf, 37*zf), size=(400 * sf, 37*zf),
pos=(x + 311 * sf, (358-39*(i-s.eii))*zf), pos=(x + 311 * sf, (358-39*(i-s.eii))*zf),
label_scale=1 if w < 290 * sf else (290 * sf)/w, label_scale=1 if w < 290 * sf else (290 * sf)/w,
call=Call(JOIN,a,p,False), call=Call(JOIN, a, p, False),
disabled=n == '...' disabled=n == '...'
) )
nt = "Server join history\nServers you join are saved here" nt = "Server join history\nServers you join are saved here"
@ -292,28 +312,28 @@ class Power(TAB):
nt, nt,
pos=(x + 510 * sf, 265*zf), pos=(x + 510 * sf, 265*zf),
v_align='top', v_align='top',
scale=1 if w<(380*sf) else (380*sf)/w scale=1 if w < (380*sf) else (380*sf)/w
) )
B( B(
cs(sc.DOWN_ARROW), cs(sc.DOWN_ARROW),
pos=(x + 311 * sf, 8*zf), pos=(x + 311 * sf, 8*zf),
size=(398*sf, 35*zf), size=(398*sf, 35*zf),
disabled=s.eii >= len(s.hi)-9, disabled=s.eii >= len(s.hi)-9,
call=Call(s.mv,'eii',1) call=Call(s.mv, 'eii', 1)
) )
B( B(
cs(sc.UP_ARROW), cs(sc.UP_ARROW),
pos=(x + 311 * sf, 400*zf), pos=(x + 311 * sf, 400*zf),
size=(400*sf, 35*zf), size=(400*sf, 35*zf),
disabled=s.eii <= 0, disabled=s.eii <= 0,
call=Call(s.mv,'eii',-1) call=Call(s.mv, 'eii', -1)
) )
bb = s.j[0] is None bb = s.j[0] is None
B( B(
'No job' if bb else 'Job', 'No job' if bb else 'Job',
size=(300 * sf, 35*zf), size=(300 * sf, 35*zf),
pos=(x + 727 * sf, 606*zf), pos=(x + 727 * sf, 606*zf),
call=Call(push,s.j[0]), call=Call(push, s.j[0]),
disabled=bb disabled=bb
) )
w = 0 if bb else GSW(str(s.j[1])) w = 0 if bb else GSW(str(s.j[1]))
@ -321,41 +341,41 @@ class Power(TAB):
'Target' if bb else str(s.j[1]), 'Target' if bb else str(s.j[1]),
size=(300 * sf, 35*zf), size=(300 * sf, 35*zf),
pos=(x + 727 * sf, 568*zf), pos=(x + 727 * sf, 568*zf),
call=Call(push,s.j[2]), call=Call(push, s.j[2]),
disabled=bb, disabled=bb,
label_scale=1 if w<110 * sf else (110 * sf)/w label_scale=1 if w < 110 * sf else (110 * sf)/w
) )
B( B(
'Stop', 'Stop',
size=(300 * sf, 35*zf), size=(300 * sf, 35*zf),
pos=(x + 727 * sf, 530*zf), pos=(x + 727 * sf, 530*zf),
call=Call(s.job,None,[None,None,None]), call=Call(s.job, None, [None, None, None]),
disabled=bb disabled=bb
) )
B( B(
'+', '+',
size=(96 * sf, 35*zf), size=(96 * sf, 35*zf),
pos=(x + 931 * sf, 492*zf), pos=(x + 931 * sf, 492*zf),
call=Call(s.mv,'ji',1) call=Call(s.mv, 'ji', 1)
) )
B( B(
str(s.ji or 0.1), str(s.ji or 0.1),
size=(100 * sf, 35*zf), size=(100 * sf, 35*zf),
pos=(x + 828 * sf, 492*zf), pos=(x + 828 * sf, 492*zf),
call=Call(push,f"Job runs every {s.ji or 0.1} second{['','s'][s.ji!=1]}") call=Call(push, f"Job runs every {s.ji or 0.1} second{['', 's'][s.ji != 1]}")
) )
B( B(
'-', '-',
size=(98 * sf, 35*zf), size=(98 * sf, 35*zf),
pos=(x + 727 * sf, 492*zf), pos=(x + 727 * sf, 492*zf),
disabled=s.ji<=0.5, disabled=s.ji <= 0.5,
call=Call(s.mv,'ji',-1) call=Call(s.mv, 'ji', -1)
) )
B( B(
'Power', 'Power',
size=(300 * sf, 35*zf), size=(300 * sf, 35*zf),
pos=(x + 727 * sf, 454*zf), pos=(x + 727 * sf, 454*zf),
call=Call(push,'Power v2.5 FullUI\nCollapse dev console to switch to MinUI') call=Call(push, 'Power v2.5 FullUI\nCollapse dev console to switch to MinUI')
) )
B( B(
'', '',
@ -373,27 +393,29 @@ class Power(TAB):
'Chat is still empty.\nHurry up and fill it with nonesense', 'Chat is still empty.\nHurry up and fill it with nonesense',
pos=(x+1320 * sf, 330 * zf) pos=(x+1320 * sf, 330 * zf)
) )
for i,g in enumerate(s.cm): for i, g in enumerate(s.cm):
if i < s.ci: continue if i < s.ci:
if i >= s.ci+15: break continue
if i >= s.ci+15:
break
i = i - s.ci i = i - s.ci
m,_ = g m, _ = g
sn,ms = m.split(': ',1) sn, ms = m.split(': ', 1)
w = GSW(sn) w = GSW(sn)
w = [w,30*sf][w<30*sf] w = [w, 30*sf][w < 30*sf]
s1 = [w,200*sf][w>200*sf] s1 = [w, 200*sf][w > 200*sf]
B( B(
sn, sn,
size=(s1,35*zf), size=(s1, 35*zf),
pos=(x + 1040*sf, (48+37*i)*zf), pos=(x + 1040*sf, (48+37*i)*zf),
style='purple', style='purple',
label_scale=1 if w<(s1-10*sf) else (s1-10*sf)/w, label_scale=1 if w < (s1-10*sf) else (s1-10*sf)/w,
call=Call(s.chk,sn) call=Call(s.chk, sn)
) )
s2 = 555*sf - s1 - 53*(_>1) s2 = 555*sf - s1 - 53*(_ > 1)
B( B(
'', '',
size=(s2,35*zf), size=(s2, 35*zf),
pos=(x + 1045*sf+s1, (48+37*i)*zf), pos=(x + 1045*sf+s1, (48+37*i)*zf),
style='black' style='black'
) )
@ -401,67 +423,69 @@ class Power(TAB):
T( T(
ms, ms,
pos=(x + s1+(1050)*sf, (48+17+37*i)*zf), pos=(x + s1+(1050)*sf, (48+17+37*i)*zf),
scale=1 if w<(s2-10*sf) else (s2-10*sf)/w, scale=1 if w < (s2-10*sf) else (s2-10*sf)/w,
h_align='left' h_align='left'
) )
z = f'x{_}' z = f'x{_}'
w = GSW(z) w = GSW(z)
_>1 and B( _ > 1 and B(
z, z,
pos=(x+s1+s2+(1050)*sf,(48+37*i)*zf), pos=(x+s1+s2+(1050)*sf, (48+37*i)*zf),
size=(50*sf,35*zf), size=(50*sf, 35*zf),
label_scale=1 if w<(40*sf) else (40*sf)/w, label_scale=1 if w < (40*sf) else (40*sf)/w,
style='yellow_bright' style='yellow_bright'
) )
B( B(
cs(sc.DOWN_ARROW), cs(sc.DOWN_ARROW),
pos=(x+1042*sf,8*zf), pos=(x+1042*sf, 8*zf),
size=(555*sf,35*zf), size=(555*sf, 35*zf),
call=Call(s.mv,'ci',-1), call=Call(s.mv, 'ci', -1),
disabled=s.ci <= 0 or not s.cm disabled=s.ci <= 0 or not s.cm
) )
B( B(
cs(sc.UP_ARROW), cs(sc.UP_ARROW),
pos=(x+1042*sf,606*zf), pos=(x+1042*sf, 606*zf),
size=(555*sf,35*zf), size=(555*sf, 35*zf),
call=Call(s.mv,'ci',1), call=Call(s.mv, 'ci', 1),
disabled=(s.ci >= len(s.cm)-15) or not s.cm disabled=(s.ci >= len(s.cm)-15) or not s.cm
) )
B( B(
cs(sc.DOWN_ARROW), cs(sc.DOWN_ARROW),
pos=(x+727*sf,8*zf), pos=(x+727*sf, 8*zf),
size=(300*sf,35*zf), size=(300*sf, 35*zf),
disabled=(s.li >= len(s.ls)-16) or not s.ls, disabled=(s.li >= len(s.ls)-16) or not s.ls,
call=Call(s.mv,'li',1) call=Call(s.mv, 'li', 1)
) )
B( B(
cs(sc.UP_ARROW), cs(sc.UP_ARROW),
pos=(x+727*sf,400*zf), pos=(x+727*sf, 400*zf),
size=(300*sf,35*zf), size=(300*sf, 35*zf),
disabled=s.li<=0, disabled=s.li <= 0,
call=Call(s.mv,'li',-1) call=Call(s.mv, 'li', -1)
) )
0 if s.ls else T( 0 if s.ls else T(
'Job logs here\nLike you even care', 'Job logs here\nLike you even care',
pos=(x+875*sf,232*zf) pos=(x+875*sf, 232*zf)
) )
for _,g in enumerate(s.ls): for _, g in enumerate(s.ls):
if _ < s.li: continue if _ < s.li:
if _ >= s.li+16: break continue
if _ >= s.li+16:
break
_ = _ - s.li _ = _ - s.li
l,t = g l, t = g
B( B(
'', '',
pos=(x+727*sf,(376-_*22)*zf), pos=(x+727*sf, (376-_*22)*zf),
size=(300*sf,20*zf), size=(300*sf, 20*zf),
label_scale=0.7, label_scale=0.7,
corner_radius=0, corner_radius=0,
style='black', style='black',
call=Call(push,t) call=Call(push, t)
) )
T( T(
l, l,
pos=(x+732*sf,(386-_*22)*zf), pos=(x+732*sf, (386-_*22)*zf),
scale=0.6, scale=0.6,
h_align='left' h_align='left'
) )
@ -471,14 +495,14 @@ class Power(TAB):
pos=(x + 10 * sf, 10), pos=(x + 10 * sf, 10),
size=(30 * sf, s.height-17), size=(30 * sf, s.height-17),
disabled=(s.ri >= len(s.r)-3) or not s.r, disabled=(s.ri >= len(s.r)-3) or not s.r,
call=Call(s.mv,'ri',1) call=Call(s.mv, 'ri', 1)
) )
B( B(
cs(sc.UP_ARROW), cs(sc.UP_ARROW),
pos=(x + 250 * sf, 10), pos=(x + 250 * sf, 10),
size=(30 * sf, s.height-17), size=(30 * sf, s.height-17),
disabled=(s.ri <= 0) or not s.r, disabled=(s.ri <= 0) or not s.r,
call=Call(s.mv,'ri',-1) call=Call(s.mv, 'ri', -1)
) )
nt = "No roster\nYou're alone" nt = "No roster\nYou're alone"
w = GSW(nt) w = GSW(nt)
@ -487,63 +511,66 @@ class Power(TAB):
pos=(x + 147 * sf, s.height-17), pos=(x + 147 * sf, s.height-17),
h_align='center', h_align='center',
v_align='top', v_align='top',
scale=1 if w<(200*sf) else (200*sf)/w scale=1 if w < (200*sf) else (200*sf)/w
) )
for i,z in enumerate(s.rr.items()): for i, z in enumerate(s.rr.items()):
if i < s.ri: continue if i < s.ri:
if i>=(s.ri+3): break continue
n,g = z if i >= (s.ri+3):
c,p = g break
n, g = z
c, p = g
w = GSW(n) w = GSW(n)
B( B(
n, n,
size=(210 * sf, 27), size=(210 * sf, 27),
pos=(x + 40 * sf, s.height-35-27*(i-s.ri)), pos=(x + 40 * sf, s.height-35-27*(i-s.ri)),
style=[['blue','blue_bright'],['purple','purple_bright']][not p][s.c==c], style=[['blue', 'blue_bright'], ['purple', 'purple_bright']][not p][s.c == c],
call=Call(s.prv,c,p,n), call=Call(s.prv, c, p, n),
label_scale=1 if w < 200 * sf else (200 * sf)/w label_scale=1 if w < 200 * sf else (200 * sf)/w
) )
bb = s.c is None bb = s.c is None
B( B(
'Bomb' if bb else (['Client','Host'][s.c==-1]+f' {s.c}'), 'Bomb' if bb else (['Client', 'Host'][s.c == -1]+f' {s.c}'),
pos=(x + 287 * sf, s.height-34), pos=(x + 287 * sf, s.height-34),
size=(120 * sf, 27), size=(120 * sf, 27),
disabled=bb, disabled=bb,
call=Call(push,str(s.n)) call=Call(push, str(s.n))
) )
B( B(
'Mention', 'Mention',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 287 * sf, s.height-90), pos=(x + 287 * sf, s.height-90),
call=Call(chat,str(s.n)), call=Call(chat, str(s.n)),
disabled=bb disabled=bb
) )
B( B(
'Players', 'Players',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 287 * sf, s.height-62), pos=(x + 287 * sf, s.height-62),
call=Call(push,'\n'.join([' '.join([f'{i}={j}' for i,j in _.items()]) for _ in s.p]) if s.p else ''), call=Call(push, '\n'.join(
[' '.join([f'{i}={j}' for i, j in _.items()]) for _ in s.p]) if s.p else ''),
disabled=bb or (not s.p) disabled=bb or (not s.p)
) )
B( B(
'Kick', 'Kick',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 407 * sf, s.height-34), pos=(x + 407 * sf, s.height-34),
call=Call(KICK,lambda:s.rr[s.n][0]), call=Call(KICK, lambda: s.rr[s.n][0]),
disabled=bb or (s.c==-1) disabled=bb or (s.c == -1)
) )
B( B(
'JKick', 'JKick',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 407 * sf, s.height-62), pos=(x + 407 * sf, s.height-62),
call=Call(s.job,Call(KICK,lambda:s.rr[s.n][0]),['JKick',s.c,s.n]), call=Call(s.job, Call(KICK, lambda: s.rr[s.n][0]), ['JKick', s.c, s.n]),
disabled=bb or (s.c==-1) disabled=bb or (s.c == -1)
) )
B( B(
'Vote', 'Vote',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 407 * sf, s.height-90), pos=(x + 407 * sf, s.height-90),
call=Call(chat,'1'), call=Call(chat, '1'),
disabled=not s.r disabled=not s.r
) )
B( B(
@ -557,7 +584,7 @@ class Power(TAB):
'No job' if bb else 'Job', 'No job' if bb else 'Job',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 544 * sf, s.height-34), pos=(x + 544 * sf, s.height-34),
call=Call(push,s.j[0]), call=Call(push, s.j[0]),
disabled=bb disabled=bb
) )
w = 0 if bb else GSW(str(s.j[1])) w = 0 if bb else GSW(str(s.j[1]))
@ -565,35 +592,35 @@ class Power(TAB):
'Target' if bb else str(s.j[1]), 'Target' if bb else str(s.j[1]),
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 544 * sf, s.height-62), pos=(x + 544 * sf, s.height-62),
call=Call(push,s.j[2]), call=Call(push, s.j[2]),
disabled=bb, disabled=bb,
label_scale=1 if w<110 * sf else (110 * sf)/w label_scale=1 if w < 110 * sf else (110 * sf)/w
) )
B( B(
'Stop', 'Stop',
size=(120 * sf, 27), size=(120 * sf, 27),
pos=(x + 544 * sf, s.height-90), pos=(x + 544 * sf, s.height-90),
call=Call(s.job,None,[None,None,None]), call=Call(s.job, None, [None, None, None]),
disabled=bb disabled=bb
) )
B( B(
'+', '+',
size=(50 * sf, 27), size=(50 * sf, 27),
pos=(x + 664 * sf, s.height-34), pos=(x + 664 * sf, s.height-34),
call=Call(s.mv,'ji',1) call=Call(s.mv, 'ji', 1)
) )
B( B(
str(s.ji or 0.1), str(s.ji or 0.1),
size=(50 * sf, 27), size=(50 * sf, 27),
pos=(x + 664 * sf, s.height-62), pos=(x + 664 * sf, s.height-62),
call=Call(push,f"Job runs every {s.ji or 0.1} second{['','s'][s.ji!=1]}") call=Call(push, f"Job runs every {s.ji or 0.1} second{['', 's'][s.ji != 1]}")
) )
B( B(
'-', '-',
size=(50 * sf, 27), size=(50 * sf, 27),
pos=(x + 664 * sf, s.height-90), pos=(x + 664 * sf, s.height-90),
disabled=s.ji<=0.5, disabled=s.ji <= 0.5,
call=Call(s.mv,'ji',-1) call=Call(s.mv, 'ji', -1)
) )
B( B(
'', '',
@ -601,9 +628,9 @@ class Power(TAB):
pos=(x + 722 * sf, 10), pos=(x + 722 * sf, 10),
style='bright' style='bright'
) )
t = getattr(s.h,'name','Not in a server') t = getattr(s.h, 'name', 'Not in a server')
a = getattr(s.h,'address','127.0.0.1') a = getattr(s.h, 'address', '127.0.0.1')
p = getattr(s.h,'port','43210') p = getattr(s.h, 'port', '43210')
w = GSW(t) w = GSW(t)
B( B(
t if t.strip() else 'Loading...', t if t.strip() else 'Loading...',
@ -611,14 +638,15 @@ class Power(TAB):
pos=(x + 732 * sf, s.height-34), pos=(x + 732 * sf, s.height-34),
disabled=not s.h, disabled=not s.h,
label_scale=1 if w < 290 * sf else (290 * sf)/w, label_scale=1 if w < 290 * sf else (290 * sf)/w,
call=Call(push,f"{t}\nHosted on build {getattr(s.h,'build_number','0')}" if t.strip() else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'), call=Call(push, f"{t}\nHosted on build {getattr(s.h, 'build_number', '0')}" if t.strip(
) else 'Server is still loading...\nIf it remains stuck on this\nthen either party is full, or a network issue.'),
) )
w = GSW(a) w = GSW(a)
B( B(
a, a,
size=(200 * sf, 27), size=(200 * sf, 27),
pos=(x + 732 * sf, s.height-62), pos=(x + 732 * sf, s.height-62),
call=Call(COPY,a), call=Call(COPY, a),
disabled=not s.h, disabled=not s.h,
label_scale=1 if w < 190 * sf else (190 * sf)/w label_scale=1 if w < 190 * sf else (190 * sf)/w
) )
@ -628,7 +656,7 @@ class Power(TAB):
size=(97 * sf, 27), size=(97 * sf, 27),
pos=(x + 935 * sf, s.height-62), pos=(x + 935 * sf, s.height-62),
disabled=not s.h, disabled=not s.h,
call=Call(COPY,str(p)), call=Call(COPY, str(p)),
label_scale=1 if w < 90 * sf else (90 * sf)/w label_scale=1 if w < 90 * sf else (90 * sf)/w
) )
B( B(
@ -642,34 +670,35 @@ class Power(TAB):
'Rejoin', 'Rejoin',
size=(97 * sf, 27), size=(97 * sf, 27),
pos=(x + 835 * sf, s.height-90), pos=(x + 835 * sf, s.height-90),
call=Call(REJOIN,a,p,lambda:s.re), call=Call(REJOIN, a, p, lambda: s.re),
disabled=not s.h disabled=not s.h
) )
B( B(
'JRejoin', 'JRejoin',
size=(97 * sf, 27), size=(97 * sf, 27),
pos=(x + 935 * sf, s.height-90), pos=(x + 935 * sf, s.height-90),
call=Call(s.job,Call(REJOIN,a,p,lambda:s.re),['JRejoin',a,str(p)]), call=Call(s.job, Call(REJOIN, a, p, lambda: s.re), ['JRejoin', a, str(p)]),
disabled=not s.h disabled=not s.h
) )
B( B(
'+', '+',
size=(50 * sf, 27), size=(50 * sf, 27),
pos=(x + 1035 * sf, s.height-34), pos=(x + 1035 * sf, s.height-34),
call=Call(s.mv,'re',1) call=Call(s.mv, 're', 1)
) )
B( B(
str(s.re or 0.1), str(s.re or 0.1),
size=(50 * sf, 27), size=(50 * sf, 27),
pos=(x + 1035 * sf, s.height-62), pos=(x + 1035 * sf, s.height-62),
call=Call(push,f"Rejoins after {s.re or 0.1} second{['','s'][s.re!=1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time") call=Call(
push, f"Rejoins after {s.re or 0.1} second{['', 's'][s.re != 1]}\nKeep this 0.1 unless server kicks fast rejoins\nLife in server = job time - rejoin time")
) )
B( B(
'-', '-',
size=(50 * sf, 27), size=(50 * sf, 27),
pos=(x + 1035 * sf, s.height-90), pos=(x + 1035 * sf, s.height-90),
disabled=s.re<=0.5, disabled=s.re <= 0.5,
call=Call(s.mv,'re',-1) call=Call(s.mv, 're', -1)
) )
B( B(
'', '',
@ -677,19 +706,21 @@ class Power(TAB):
pos=(x + 1092 * sf, 10), pos=(x + 1092 * sf, 10),
style='bright' style='bright'
) )
for i,e in enumerate(s.hi.items()): for i, e in enumerate(s.hi.items()):
if i < s.ii: continue if i < s.ii:
if i >= (s.ii+3): break continue
g,v = e if i >= (s.ii+3):
_,a = g break
n,p = v g, v = e
_, a = g
n, p = v
w = GSW(n) w = GSW(n)
B( B(
n, n,
size=(300 * sf, 27), size=(300 * sf, 27),
pos=(x + 1134 * sf, s.height-34-28*(i-s.ii)), pos=(x + 1134 * sf, s.height-34-28*(i-s.ii)),
label_scale=1 if w < 290 * sf else (290 * sf)/w, label_scale=1 if w < 290 * sf else (290 * sf)/w,
call=Call(JOIN,a,p,False), call=Call(JOIN, a, p, False),
disabled=n == '...' disabled=n == '...'
) )
nt = "Your server join history\nwill appear here. Hi." nt = "Your server join history\nwill appear here. Hi."
@ -699,21 +730,21 @@ class Power(TAB):
pos=(x + 1285 * sf, s.height-17), pos=(x + 1285 * sf, s.height-17),
h_align='center', h_align='center',
v_align='top', v_align='top',
scale=1 if w<(280*sf) else (280*sf)/w scale=1 if w < (280*sf) else (280*sf)/w
) )
B( B(
cs(sc.DOWN_ARROW), cs(sc.DOWN_ARROW),
pos=(x + 1102 * sf, 10), pos=(x + 1102 * sf, 10),
size=(30 * sf, s.height-17), size=(30 * sf, s.height-17),
disabled=s.ii >= len(s.hi)-3, disabled=s.ii >= len(s.hi)-3,
call=Call(s.mv,'ii',1) call=Call(s.mv, 'ii', 1)
) )
B( B(
cs(sc.UP_ARROW), cs(sc.UP_ARROW),
pos=(x + 1436 * sf, 10), pos=(x + 1436 * sf, 10),
size=(30 * sf, s.height-17), size=(30 * sf, s.height-17),
disabled=s.ii <= 0, disabled=s.ii <= 0,
call=Call(s.mv,'ii',-1) call=Call(s.mv, 'ii', -1)
) )
B( B(
'Force leave', 'Force leave',
@ -724,70 +755,99 @@ class Power(TAB):
) )
B( B(
'Laugh', 'Laugh',
call=Call(chat,'hahaha'), call=Call(chat, 'hahaha'),
pos=(x + 1469 * sf, s.height-62), pos=(x + 1469 * sf, s.height-62),
size=(130 * sf, 27) size=(130 * sf, 27)
) )
B( B(
'Power', 'Power',
call=Call(push,'Power v2.5 MinUI\nExpand dev console to switch to FullUI. thanks.'), call=Call(push, 'Power v2.5 MinUI\nExpand dev console to switch to FullUI. thanks.'),
pos=(x + 1469 * sf, s.height-90), pos=(x + 1469 * sf, s.height-90),
size=(130 * sf, 27) size=(130 * sf, 27)
) )
def log(s,t):
s.ls.append((t,NOW())) def log(s, t):
s.ls.append((t, NOW()))
if s.lii < 99: if s.lii < 99:
s.lii += 1 s.lii += 1
if s.li == s.lii-17: s.li += 1 if s.li == s.lii-17:
else: s.ls.pop(0) s.li += 1
else:
s.ls.pop(0)
s.rf() s.rf()
def mv(s,a,i):
setattr(s,a,getattr(s,a)+i) def mv(s, a, i):
setattr(s, a, getattr(s, a)+i)
s.rf() s.rf()
def job(s,f,j):
def job(s, f, j):
s.j = j s.j = j
s.lf = f s.lf = f
s.hd = j[1] if s.j[0] == 'JRejoin' else j[2] s.hd = j[1] if s.j[0] == 'JRejoin' else j[2]
if f is not None: if f is not None:
s._job(f) s._job(f)
push('Job started',color=(1,1,0)) push('Job started', color=(1, 1, 0))
else: push('Job stopped',color=(1,1,0)) else:
push('Job stopped', color=(1, 1, 0))
s.rf() s.rf()
def _job(s,f):
if f != s.lf: return def _job(s, f):
if f != s.lf:
return
s.log(f'[{s.lii:02}] [{s.j[0]}] {s.hd}') s.log(f'[{s.lii:02}] [{s.j[0]}] {s.hd}')
f(); teck(s.ji or 0.1,Call(s._job,f)) f()
def prv(s,c,p,n): teck(s.ji or 0.1, Call(s._job, f))
s.c,s.p,s.n = c,p,n
def prv(s, c, p, n):
s.c, s.p, s.n = c, p, n
s.rf() s.rf()
def chk(s,pn):
def chk(s, pn):
y = 0 y = 0
for n,g in s.rr.items(): for n, g in s.rr.items():
c,p = g c, p = g
if n == pn: y = 1 if n == pn:
y = 1
else: else:
for _ in p: for _ in p:
if pn in [_['name'],_['name_full']]: y = 1 if pn in [_['name'], _['name_full']]:
if y: s.prv(c,p,n); break y = 1
if y:
s.prv(c, p, n)
break
HAS = app.ui_v1.has_main_window HAS = app.ui_v1.has_main_window
SAVE = app.classic.save_ui_state SAVE = app.classic.save_ui_state
KICK = lambda f: DISC(f()) def KICK(f): return DISC(f())
FORCE = lambda: teck(0.7 if HAS() else 0.1,lambda: 0 if HAS() else app.classic.return_to_main_menu_session_gracefully())
def FORCE(): return teck(0.7 if HAS() else 0.1, lambda: 0 if HAS()
else app.classic.return_to_main_menu_session_gracefully())
JOIN = lambda *a: (SAVE() or 1) and CON(*a) JOIN = lambda *a: (SAVE() or 1) and CON(*a)
GSW = lambda s: sw(s,suppress_warning=True) def GSW(s): return sw(s, suppress_warning=True)
REJOIN = lambda a,p,f: ((LEAVE() if getattr(HOST(),'name','') else 0) or 1) and teck(f() or 0.1,Call(JOIN,a,p,False))
COPY = lambda s: ((CST(s) or 1) if CIS() else push('Clipboard not supported!')) and push('Copied!',color=(0,1,0))
NOW = lambda: DT.now().strftime("%H:%M:%S") def REJOIN(a, p, f): return ((LEAVE() if getattr(HOST(), 'name', '') else 0)
or 1) and teck(f() or 0.1, Call(JOIN, a, p, False))
def COPY(s): return ((CST(s) or 1) if CIS() else push(
'Clipboard not supported!')) and push('Copied!', color=(0, 1, 0))
def NOW(): return DT.now().strftime("%H:%M:%S")
# brobord collide grass # brobord collide grass
# ba_meta require api 9 # ba_meta require api 9
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class byBordd(Plugin): class byBordd(Plugin):
def __init__(s): def __init__(s):
C = Power C = Power
N = C.__name__ N = C.__name__
E = ENT(N,C) E = ENT(N, C)
I = app.devconsole I = app.devconsole
I.tabs = [_ for _ in I.tabs if _.name != N]+[E] I.tabs = [_ for _ in I.tabs if _.name != N]+[E]
I._tab_instances[N] = E.factory() I._tab_instances[N] = E.factory()

File diff suppressed because it is too large Load diff

View file

@ -19,13 +19,15 @@ from bascenev1 import (
# ba_meta require api 9 # ba_meta require api 9
# ba_meta export babase.Plugin # ba_meta export babase.Plugin
class byBordd(Plugin): class byBordd(Plugin):
__init__ = lambda s: (setattr(s,'la',None),z(5,s.ear))[1] def __init__(s): return (setattr(s, 'la', None), z(5, s.ear))[1]
def ear(s): def ear(s):
a = gcm() a = gcm()
if a and s.la != a[-1]: if a and s.la != a[-1]:
if app.config.resolve('Chat Muted'): if app.config.resolve('Chat Muted'):
push(a[-1],(1,1,1),True) push(a[-1], (1, 1, 1), True)
s.la = a[-1] s.la = a[-1]
z(0.1, s.ear) z(0.1, s.ear)