From ee12aa92a098b9f29ecff29410b80b6e8d0b50d6 Mon Sep 17 00:00:00 2001 From: Ayush Saini <36878972+imayushsaini@users.noreply.github.com> Date: Thu, 30 Jun 2022 00:37:05 +0530 Subject: [PATCH] updated mods to api 7 --- dist/ba_root/mods/features/fire_flies.py | 277 +++++++++++------- dist/ba_root/mods/features/map_fun.py | 17 ++ .../mods/playersData/custom.json.backup | 10 + dist/ba_root/mods/playersData/pdata.py | 11 +- dist/ba_root/mods/playersData/profiles.json | 73 +++++ .../mods/playersData/profiles.json.backup | 102 +++++++ dist/ba_root/mods/playersData/roles.json | 62 +++- .../mods/playersData/roles.json.backup | 94 ++++++ dist/ba_root/mods/plugins/CharacterChooser.py | 18 +- dist/ba_root/mods/plugins/__init__.py | 2 +- dist/ba_root/mods/plugins/bcs_plugin.py | 28 +- dist/ba_root/mods/plugins/color_explosion.py | 2 +- dist/ba_root/mods/plugins/colorfulmaps.py | 127 ++++++++ dist/ba_root/mods/plugins/elPatronPowerups.py | 6 +- .../mods/plugins/importcustomcharacters.py | 2 +- dist/ba_root/mods/plugins/wavedash.py | 46 +-- dist/ba_root/mods/setting.json | 14 +- dist/ba_root/mods/tools/file_handle.py | 2 +- dist/ba_root/mods/tools/logger.py | 2 +- dist/ba_root/mods/tools/playlist.py | 10 +- dist/ba_root/mods/tools/servercheck.py | 3 +- 21 files changed, 715 insertions(+), 193 deletions(-) create mode 100644 dist/ba_root/mods/features/map_fun.py create mode 100644 dist/ba_root/mods/playersData/custom.json.backup create mode 100644 dist/ba_root/mods/playersData/profiles.json.backup create mode 100644 dist/ba_root/mods/playersData/roles.json.backup create mode 100644 dist/ba_root/mods/plugins/colorfulmaps.py diff --git a/dist/ba_root/mods/features/fire_flies.py b/dist/ba_root/mods/features/fire_flies.py index 4f1640d..d4bb06c 100644 --- a/dist/ba_root/mods/features/fire_flies.py +++ b/dist/ba_root/mods/features/fire_flies.py @@ -1,117 +1,168 @@ -import ba,_ba + +import ba +import _ba from bastd.gameutils import SharedObjects import random -from ba._gameactivity import GameActivity - -import random -def factory(random_col:bool): - act=_ba.get_foreground_host_activity() - if not isinstance(act,GameActivity): - return - m=_ba.get_foreground_host_activity().map.get_def_bound_box('area_of_interest_bounds') - part1=list(m) - part2=list(m) - half=(m[0]+m[3])/2 - part1[3]=half - part2[0]=half - ba.timer(0.3,ba.Call(create_fly,part1,random_col)) - ba.timer(1,ba.Call(create_fly,part2,random_col)) - ba.timer(0.12,ba.Call(create_fly,part1,random_col)) - ba.timer(0.88,ba.Call(create_fly,part2,random_col)) - ba.timer(1.8,ba.Call(create_fly,part1,random_col)) - ba.timer(3.3,ba.Call(create_fly,part2,random_col)) - ba.timer(4.78,ba.Call(create_fly,part1,random_col)) - ba.timer(2,ba.Call(create_fly,part2,random_col)) - ba.timer(6.3,ba.Call(create_fly,part1,random_col)) - ba.timer(3.3,ba.Call(create_fly,part2,random_col)) - ba.timer(4.78,ba.Call(create_fly,part1,random_col)) - ba.timer(2,ba.Call(create_fly,part2,random_col)) - ba.timer(6.3,ba.Call(create_fly,part1,random_col)) - ba.timer(3.5,ba.Call(create_fly,part2,random_col)) - ba.timer(4.28,ba.Call(create_fly,part1,random_col)) - ba.timer(2.2,ba.Call(create_fly,part2,random_col)) - ba.timer(6.1,ba.Call(create_fly,part1,random_col)) - -def create_fly(points,random_col): - flies(points,random_col).autoretain() - -class flies(ba.Actor): - def __init__(self,m,random_col): - super().__init__() - shared = SharedObjects.get() - - if random_col: - col=(random.uniform(0,1.2),random.uniform(0,1.2),random.uniform(0,1.2)) - else: - col=(0.9,0.7,0.0) - self.mat = ba.Material() - self.mat.add_actions( - actions=( - ('modify_part_collision', 'collide', False), - ('modify_part_collision','physical',False), - )) - - - self.node = ba.newnode('prop', - delegate=self, - attrs={ - 'model':ba.getmodel('bomb'), - 'position':(2,4,2), - 'body':'capsule', - 'shadow_size':0.0, - 'color_texture':ba.gettexture('coin'), - 'reflection':'soft', - 'reflection_scale':[1.5], - 'materials':[shared.object_material,self.mat] - - }) - ba.animate(self.node,'model_scale',{0:0,1:0.19,5:0.10,10:0.0},loop=True) - ba.animate_array(self.node,'position',3,self.generateKeys(m),loop=True) - - self.light=ba.newnode('light',owner=self.node,attrs={'intensity':0.6, - 'height_attenuated':True, - 'radius':0.2, - 'color':col}) - ba.animate(self.light,'radius',{0:0.0,20:0.4,70:0.1,100:0.3,150:0},loop=True) - self.node.connectattr('position',self.light,'position') - def handlemessage(self,msg): - - if isinstance(msg,ba.DieMessage): - - pass - # self.node.delete() - else: - super().handlemessage(msg) - - def generateKeys(self,m): - - keys={} - t=0 - - last_x=random.randrange(int(m[0]),int(m[3])) - last_y=random.randrange(int(m[1]),int(m[4])) - if int(m[2])==int(m[5]): - last_z=int(m[2]) - else: - last_z=random.randrange(int(m[2]),int(m[5])) - for i in range(0,7): - x=self.generateRandom(int(m[0]),int(m[3]),last_x) - last_x=x - y=self.generateRandom(int(m[1]),int(m[4]),last_y) - last_y=y - z=self.generateRandom(int(m[2]),int(m[5]),last_z) - last_z=z - keys[t]=(x,abs(y),z) - t +=30 - - return keys - def generateRandom(self,a,b,z): - if a==b: - return a - - while True: - n= random.randrange(a,b) - if abs(z-n) < 6: - return n +from ba._messages import DieMessage, DeathType, OutOfBoundsMessage, UNHANDLED +on_begin_original = ba._activity.Activity.on_begin +def fireflies_generator(activity, count, random_color:False): + if random_color: + color=(random.uniform(0,1.2),random.uniform(0,1.2),random.uniform(0,1.2)) + else: + color=(0.9,0.7,0.0) + increment = count - len(activity.fireflies) + + if increment > 0: + spawn_areas = _calculate_spawn_areas() + if not spawn_areas: + return + for _ in range(increment): + with ba.Context(activity): + firefly = FireFly(random.choice(spawn_areas), color) + activity.fireflies.append(firefly) + else: + for _ in range(abs(increment)): + firefly = activity.fireflies.pop() + try: + firefly.handlemessage(ba.DieMessage()) + except AttributeError: + pass + firefly.timer = None + + +def _calculate_spawn_areas(): + activity = _ba.get_foreground_host_activity() + if not isinstance(activity, ba.GameActivity): + return + aoi_bounds = activity.map.get_def_bound_box("area_of_interest_bounds") + # aoi_bounds = activity.map.get_def_bound_box("map_bounds") + first_half = list(aoi_bounds) + second_half = list(aoi_bounds) + midpoint_x = (aoi_bounds[0] + aoi_bounds[3]) / 2 + first_half[3] = midpoint_x + second_half[0] = midpoint_x + spawn_areas = (first_half, second_half) + return spawn_areas + + +class FireFly(ba.Actor): + def __init__(self, area, color, *args, **kwargs): + super().__init__(*args, **kwargs) + self.area = area + self.color = color + initial_timer = random.uniform(0.5, 6) + self.timer = ba.Timer(initial_timer, self.on) + + def on(self): + shared = SharedObjects.get() + self.mat = ba.Material() + self.mat.add_actions( + actions=( + ('modify_part_collision', 'collide', False), + ('modify_part_collision', 'physical', False), + )) + self.node = ba.newnode( + 'prop', + attrs={ + 'model': ba.getmodel('bomb'), + 'position': (2,4,2), + 'body': 'capsule', + 'shadow_size': 0.0, + 'color_texture': random.choice([ba.gettexture(tex) for tex in ("egg1", "egg2", "egg3")]), + 'reflection': 'soft', + 'reflection_scale': [1.5], + 'materials': (shared.object_material, self.mat) + }) + ba.animate( + self.node, + 'model_scale', + {0:0, 1:0.23, 5:0.15, 10:0.0}, + loop=True, + ) + ba.animate_array( + self.node, + 'position', + 3, + self.generate_keys(self.area), + loop=True + ) + + self.light = ba.newnode( + 'light', + owner=self.node, + attrs={ + 'intensity':0.6, + 'height_attenuated':True, + 'radius':0.2, + 'color':self.color + }) + ba.animate( + self.light, + 'radius', + {0:0.0, 20:0.4 ,70:0.1 ,100:0.3 ,150:0}, + loop=True + ) + self.node.connectattr('position', self.light, 'position') + + def off(self): + death_secs = random.uniform(0.5, 3) + with ba.Context(self._activity()): + ba.animate( + self.node, + 'model_scale', + {0: self.node.model_scale, death_secs: 0} + ) + ba.animate( + self.light, + 'radius', + {0:self.light.radius, death_secs:0} + ) + ba.timer(death_secs, self.node.delete) + + def handlemessage(self, msg): + if isinstance(msg, ba.DieMessage): + self.off() + elif isinstance(msg, OutOfBoundMessage): + self.handlemessage(ba.DieMessage(how=OutOfBoundMessage)) + else: + return super().handlemessage(msg) + + def generate_keys(self,m): + keys = {} + t = 0 + last_x = random.randrange(int(m[0]),int(m[3])) + last_y = random.randrange(int(m[1]),int(m[4])) + if int(m[2]) == int(m[5]): + last_z = int(m[2]) + else: + last_z = random.randrange(int(m[2]),int(m[5])) + for i in range(0,7): + x = self.generate_random(int(m[0]),int(m[3]),last_x) + last_x = x + y = self.generate_random(int(m[1]),int(m[4]),last_y) + last_y = y + z = self.generate_random(int(m[2]),int(m[5]),last_z) + last_z = z + keys[t] = (x, abs(y), z) + t += 30 + return keys + + def generate_random(self, a, b, z): + if a == b: + return a + while True: + n = random.randrange(a,b) + if abs(z-n) < 6: + return n + + +def on_begin(self, *args, **kwargs) -> None: + self.fireflies = [] + return on_begin_original(self, *args, **kwargs) + + + +ba._activity.Activity.fireflies_generator = fireflies_generator +ba._activity.Activity.on_begin = on_begin diff --git a/dist/ba_root/mods/features/map_fun.py b/dist/ba_root/mods/features/map_fun.py new file mode 100644 index 0000000..feae6e1 --- /dev/null +++ b/dist/ba_root/mods/features/map_fun.py @@ -0,0 +1,17 @@ +import _ba +import random + +def decorate_map(): + try: + activity = _ba.get_foreground_host_activity() + activity.fireflies_generator(20,True) + activity.map.node.reflection = "powerup" + activity.map.node.reflection_scale = [4] + activity.globalsnode.tint = (0.5,0.7,1) + # activity.map.node.color = random.choices([(0.8,0.3,0.3),(0.6,0.5,0.7),(0.3,0.8,0.5)])[0] + m = 5 + s = 5000 + ba.animate_array(activity.globalsnode, 'ambient_color', 3, {0: (1*m,0,0), s: (0,1*m,0),s*2:(0,0,1*m),s*3:(1*m,0,0)},True) + activity.map.background.reflection = "soft" + except: + pass diff --git a/dist/ba_root/mods/playersData/custom.json.backup b/dist/ba_root/mods/playersData/custom.json.backup new file mode 100644 index 0000000..2453437 --- /dev/null +++ b/dist/ba_root/mods/playersData/custom.json.backup @@ -0,0 +1,10 @@ +{ + "customtag": { + "pb-id": "smoothy", + "pb-45": "something", + "pb-IF4TVWwZUQ==": "proowner" + }, + "customeffects": { + "pb-IF4TVWwZUQ==": "spark" + } +} \ No newline at end of file diff --git a/dist/ba_root/mods/playersData/pdata.py b/dist/ba_root/mods/playersData/pdata.py index 476b501..ad1cd4b 100644 --- a/dist/ba_root/mods/playersData/pdata.py +++ b/dist/ba_root/mods/playersData/pdata.py @@ -120,7 +120,6 @@ def add_profile( "spamCount": 0, "lastSpam": time.time(), "totaltimeplayer": 0, - "lastseen": 0, } CacheData.profiles=profiles commit_profiles() @@ -131,6 +130,16 @@ def add_profile( serverdata.clients[account_id]["verified"] = False serverdata.clients[account_id]["rejoincount"] = 1 serverdata.clients[account_id]["lastJoin"] = time.time() + cid = 113 + for ros in _ba.get_game_roster(): + if ros['account_id'] == account_id: + cid = ros['client_id'] + serverdata.clients[account_id]["lastIP"] = _ba.get_client_ip(cid) + + device_id = _ba.get_client_public_device_uuid(cid) + if(device_id==None): + device_id = _ba.get_client_device_uuid(cid) + serverdata.clients[account_id]["deviceUUID"] = device_id def update_display_string(account_id: str, display_string: str) -> None: diff --git a/dist/ba_root/mods/playersData/profiles.json b/dist/ba_root/mods/playersData/profiles.json index a917aa8..cddd30e 100644 --- a/dist/ba_root/mods/playersData/profiles.json +++ b/dist/ba_root/mods/playersData/profiles.json @@ -25,5 +25,78 @@ "lastseen": 0, "spamCount": 4, "lastSpam": 1637912278.8745685 + }, + "pb-IF4eUxk5KA==": { + "display_string": [ + "\ue063HeySmoothy" + ], + "profiles": [], + "name": "\ue063HeySmoothy", + "isBan": false, + "isMuted": false, + "accountAge": "2022-05-29 21:53:44", + "registerOn": 1655022106.4740922, + "canStartKickVote": true, + "spamCount": 0, + "lastSpam": 1655022106.4740927, + "totaltimeplayer": 0, + "lastseen": 0, + "warnCount": 0, + "lastWarned": 1655552812.9632144, + "verified": true, + "rejoincount": 1, + "lastJoin": 1655552812.963215, + "cMsgCount": 0, + "lastMsgTime": 1655406931.728448, + "lastMsg": "ok", + "cSameMsg": 0, + "lastIP": "axj~}j~~n`ai", + "deviceUUID": "eedccec9b0c17d3716b936981bb753c3872d905c" + }, + "pb-IF4RU2ECAg==": { + "display_string": [ + "\ue030PC452402" + ], + "profiles": [], + "name": "\ue030PC452402", + "isBan": false, + "isMuted": false, + "accountAge": "2022-06-04 01:42:22", + "registerOn": 1655407521.4853234, + "canStartKickVote": true, + "spamCount": 0, + "lastSpam": 1655407521.4853249, + "totaltimeplayer": 0, + "warnCount": 0, + "lastWarned": 1655407521.4853408, + "verified": true, + "rejoincount": 2, + "lastJoin": 1655407536.1110733, + "lastIP": "axj~}j~~n`ai", + "deviceUUID": "\u0003\u0005^\u0005VFYYULL\u0007Z\u0005L@QU\u0004L\u0015QZ\u0002L\u0016XX" + }, + "pb-IF43U2cIVw==": { + "display_string": "\ue063Smoothy", + "profiles": [], + "name": "\ue063Smoothy", + "isBan": false, + "isMuted": false, + "accountAge": "2022-06-23 22:27:13", + "registerOn": 1656442709.8344862, + "canStartKickVote": true, + "spamCount": 0, + "lastSpam": 1656442709.8344867, + "totaltimeplayer": 0, + "warnCount": 0, + "lastWarned": 1656527532.2340264, + "verified": true, + "rejoincount": 0, + "lastJoin": 1656527777.355527, + "lastIP": "axj~}m~}jdai", + "deviceUUID": "c49fafb7d66d14198924c1b9dcc59e23fb838042", + "cMsgCount": 0, + "lastMsgTime": 1656525491.3282282, + "lastMsg": "/end", + "cSameMsg": 0 } } \ No newline at end of file diff --git a/dist/ba_root/mods/playersData/profiles.json.backup b/dist/ba_root/mods/playersData/profiles.json.backup new file mode 100644 index 0000000..cddd30e --- /dev/null +++ b/dist/ba_root/mods/playersData/profiles.json.backup @@ -0,0 +1,102 @@ +{ + "pb-IF4TVWwZUQ=9=": { + "display_string": "\ue030PC295588", + "profiles": [], + "name": "\ue030PC295588", + "isBan": false, + "isMuted": false, + "totaltimeplayer": 0, + "lastseen": 0, + "spamCount": 0, + "lastSpam": 1637911682.2054627 + }, + "pb-IF5XUm9eAg==": { + "display_string": [ + "\ue030PC402015" + ], + "profiles": [], + "name": "\ue030PC402015", + "isBan": false, + "isMuted": false, + "accountAge": "2021-11-12 20:30:30", + "registerOn": 1636801177.809589, + "canStartKickVote": true, + "totaltimeplayer": 0, + "lastseen": 0, + "spamCount": 4, + "lastSpam": 1637912278.8745685 + }, + "pb-IF4eUxk5KA==": { + "display_string": [ + "\ue063HeySmoothy" + ], + "profiles": [], + "name": "\ue063HeySmoothy", + "isBan": false, + "isMuted": false, + "accountAge": "2022-05-29 21:53:44", + "registerOn": 1655022106.4740922, + "canStartKickVote": true, + "spamCount": 0, + "lastSpam": 1655022106.4740927, + "totaltimeplayer": 0, + "lastseen": 0, + "warnCount": 0, + "lastWarned": 1655552812.9632144, + "verified": true, + "rejoincount": 1, + "lastJoin": 1655552812.963215, + "cMsgCount": 0, + "lastMsgTime": 1655406931.728448, + "lastMsg": "ok", + "cSameMsg": 0, + "lastIP": "axj~}j~~n`ai", + "deviceUUID": "eedccec9b0c17d3716b936981bb753c3872d905c" + }, + "pb-IF4RU2ECAg==": { + "display_string": [ + "\ue030PC452402" + ], + "profiles": [], + "name": "\ue030PC452402", + "isBan": false, + "isMuted": false, + "accountAge": "2022-06-04 01:42:22", + "registerOn": 1655407521.4853234, + "canStartKickVote": true, + "spamCount": 0, + "lastSpam": 1655407521.4853249, + "totaltimeplayer": 0, + "warnCount": 0, + "lastWarned": 1655407521.4853408, + "verified": true, + "rejoincount": 2, + "lastJoin": 1655407536.1110733, + "lastIP": "axj~}j~~n`ai", + "deviceUUID": "\u0003\u0005^\u0005VFYYULL\u0007Z\u0005L@QU\u0004L\u0015QZ\u0002L\u0016XX" + }, + "pb-IF43U2cIVw==": { + "display_string": "\ue063Smoothy", + "profiles": [], + "name": "\ue063Smoothy", + "isBan": false, + "isMuted": false, + "accountAge": "2022-06-23 22:27:13", + "registerOn": 1656442709.8344862, + "canStartKickVote": true, + "spamCount": 0, + "lastSpam": 1656442709.8344867, + "totaltimeplayer": 0, + "warnCount": 0, + "lastWarned": 1656527532.2340264, + "verified": true, + "rejoincount": 0, + "lastJoin": 1656527777.355527, + "lastIP": "axj~}m~}jdai", + "deviceUUID": "c49fafb7d66d14198924c1b9dcc59e23fb838042", + "cMsgCount": 0, + "lastMsgTime": 1656525491.3282282, + "lastMsg": "/end", + "cSameMsg": 0 + } +} \ No newline at end of file diff --git a/dist/ba_root/mods/playersData/roles.json b/dist/ba_root/mods/playersData/roles.json index 335ea7c..9055d7c 100644 --- a/dist/ba_root/mods/playersData/roles.json +++ b/dist/ba_root/mods/playersData/roles.json @@ -1,22 +1,40 @@ { "owner": { - "tag": "\\cowner\\c", "tagcolor": [1, + "tag": "\\cowner\\c", + "tagcolor": [ + 1, 0.6, 0.4 ], - "commands": ["ALL"], - "ids": ["pb-IF48VWkBFQ", "pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE", "pb-IF4TVWwZUQ==", "pb-IF4SVW9dEg==", "pb-IF5XUm9eAg=="] + "commands": [ + "ALL" + ], + "ids": [ + "pb-IF48VWkBFQ", + "pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE", + "pb-IF4TVWwZUQ==", + "pb-IF4SVW9dEg==", + "pb-IF5XUm9eAg==" + ] }, "admin": { - "tag": "\ue043admin\ue043", "tagcolor": [1, + "tag": "\ue043admin\ue043", + "tagcolor": [ + 1, 1, 1 ], - "commands": ["createrole"], - "ids": ["pb-IF4TVWwZUQ=="] + "commands": [ + "createrole" + ], + "ids": [ + "pb-IF4TVWwZUQ==" + ] }, "vip": { - "tag": "vip", "tagcolor": [1, + "tag": "vip", + "tagcolor": [ + 1, 1, 1 ], @@ -24,7 +42,9 @@ "ids": [] }, "smoothy": { - "tag": "smoothy", "tagcolor": [1, + "tag": "smoothy", + "tagcolor": [ + 1, 1, 1 ], @@ -32,7 +52,9 @@ "ids": [] }, "pros": { - "tag": "pros", "tagcolor": [1, + "tag": "pros", + "tagcolor": [ + 1, 1, 1 ], @@ -40,19 +62,33 @@ "ids": [] }, "top5": { - "tag": "top5", "tagcolor": [1, + "tag": "top5", + "tagcolor": [ + 1, 1, 1 ], "commands": [], - "ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="] + "ids": [ + "pb-IF4VAk4a", + "pb-IF4eUxk5KA==", + "pb-IF43U2cIVw==" + ] }, "bypass-warn": { - "tag": "", "tagcolor": [1, + "tag": "", + "tagcolor": [ + 1, 1, 1 ], "commands": [], - "ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="] + "ids": [ + "pb-IF5XUm9eAg==", + "pb-IF43VUwlAg==", + "pb-IF4iVUc5Cg==", + "pb-IF4vNnMJ", + "pb-IF4TVWwZUQ==" + ] } } \ No newline at end of file diff --git a/dist/ba_root/mods/playersData/roles.json.backup b/dist/ba_root/mods/playersData/roles.json.backup new file mode 100644 index 0000000..9055d7c --- /dev/null +++ b/dist/ba_root/mods/playersData/roles.json.backup @@ -0,0 +1,94 @@ +{ + "owner": { + "tag": "\\cowner\\c", + "tagcolor": [ + 1, + 0.6, + 0.4 + ], + "commands": [ + "ALL" + ], + "ids": [ + "pb-IF48VWkBFQ", + "pb-JiNJARBaXEFBVF9HFkNXXF1EF0ZaRlZE", + "pb-IF4TVWwZUQ==", + "pb-IF4SVW9dEg==", + "pb-IF5XUm9eAg==" + ] + }, + "admin": { + "tag": "\ue043admin\ue043", + "tagcolor": [ + 1, + 1, + 1 + ], + "commands": [ + "createrole" + ], + "ids": [ + "pb-IF4TVWwZUQ==" + ] + }, + "vip": { + "tag": "vip", + "tagcolor": [ + 1, + 1, + 1 + ], + "commands": [], + "ids": [] + }, + "smoothy": { + "tag": "smoothy", + "tagcolor": [ + 1, + 1, + 1 + ], + "commands": [], + "ids": [] + }, + "pros": { + "tag": "pros", + "tagcolor": [ + 1, + 1, + 1 + ], + "commands": [], + "ids": [] + }, + "top5": { + "tag": "top5", + "tagcolor": [ + 1, + 1, + 1 + ], + "commands": [], + "ids": [ + "pb-IF4VAk4a", + "pb-IF4eUxk5KA==", + "pb-IF43U2cIVw==" + ] + }, + "bypass-warn": { + "tag": "", + "tagcolor": [ + 1, + 1, + 1 + ], + "commands": [], + "ids": [ + "pb-IF5XUm9eAg==", + "pb-IF43VUwlAg==", + "pb-IF4iVUc5Cg==", + "pb-IF4vNnMJ", + "pb-IF4TVWwZUQ==" + ] + } +} \ No newline at end of file diff --git a/dist/ba_root/mods/plugins/CharacterChooser.py b/dist/ba_root/mods/plugins/CharacterChooser.py index 7d14fd5..aa6d8ab 100644 --- a/dist/ba_root/mods/plugins/CharacterChooser.py +++ b/dist/ba_root/mods/plugins/CharacterChooser.py @@ -1,4 +1,4 @@ -# ba_meta require api 6 +# ba_meta require api 7 ''' Character Chooser by Mr.Smoothy @@ -8,17 +8,17 @@ This plugin will let you choose your character from lobby. Install this plugin on your Phone/PC or on Server If installed on server :- this will also let players choose server specific custom characters . so no more sharing of character file with all players, -just install this plugin on server ...and players can pick character from lobby . +just install this plugin on server ...and players can pick character from lobby . Use:- > select your profile (focus on color and name) > press ready (punch) > now use UP/DOWN buttons to scroll character list -> Press ready again (punch) to join the game +> Press ready again (punch) to join the game > or press Bomb button to go back to profile choosing menu -> END +> END -Watch : https://www.youtube.com/watch?v=hNmv2l-NahE +Watch : https://www.youtube.com/watch?v=hNmv2l-NahE Join : https://discord.gg/ucyaesh Contact : discord mr.smoothy#5824 @@ -202,7 +202,7 @@ def _set_ready(self, ready: bool) -> None: (InputType.DOWN_PRESS),Call(self.handlemessage,ChangeMessage('characterchooser',1))) self._sessionplayer.assigninput( (InputType.BOMB_PRESS),Call(self.handlemessage,ChangeMessage('ready',0))) - + self._sessionplayer.assigninput( (InputType.JUMP_PRESS,InputType.PICK_UP_PRESS, InputType.PUNCH_PRESS), Call(self.handlemessage, ChangeMessage('ready', 2))) @@ -236,7 +236,7 @@ def _set_ready(self, ready: bool) -> None: self._ready = True self._update_text() else: - + # Inform the session that this player is ready. @@ -343,12 +343,12 @@ def _update_text(self) -> None: }) else: self._text_node.color = fin_color - + self._text_node.text = text def enable() -> None: _lobby.Chooser.__init__=__init__ _lobby.Chooser._set_ready=_set_ready - + _lobby.Chooser._update_text=_update_text _lobby.Chooser.handlemessage=handlemessage diff --git a/dist/ba_root/mods/plugins/__init__.py b/dist/ba_root/mods/plugins/__init__.py index e2c0392..c7700f8 100644 --- a/dist/ba_root/mods/plugins/__init__.py +++ b/dist/ba_root/mods/plugins/__init__.py @@ -6,7 +6,7 @@ tests since they are widely used in live client and server code. license : MIT, see LICENSE for more details. """ -# ba_meta require api 6 +# ba_meta require api 7 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations diff --git a/dist/ba_root/mods/plugins/bcs_plugin.py b/dist/ba_root/mods/plugins/bcs_plugin.py index aee1a93..493978f 100644 --- a/dist/ba_root/mods/plugins/bcs_plugin.py +++ b/dist/ba_root/mods/plugins/bcs_plugin.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # coding: utf-8 -# ba_meta require api 6 +# ba_meta require api 7 from typing import Optional, Any, Dict, List, Type, Sequence from ba._gameactivity import GameActivity import ba,_ba @@ -19,9 +19,9 @@ top200={} class BsDataThread(object): def __init__(self): - self.Timer = ba.Timer( 8,ba.Call(self.refreshStats),timetype = ba.TimeType.REAL,repeat = True) + self.Timer = ba.Timer( 8,ba.Call(self.refreshStats),timetype = ba.TimeType.REAL,repeat = True) self.Timerr = ba.Timer( 10,ba.Call(self.startThread),timetype = ba.TimeType.REAL,repeat = True) - + def startThread(self): _thread.start_new_thread(self.refreshLeaderboard,()) @@ -29,7 +29,7 @@ class BsDataThread(object): global leaderboard global top200 _t200={} - + lboard=mystats.get_all_stats() leaderboard=lboard try: @@ -46,26 +46,26 @@ class BsDataThread(object): break _t200[entry[5]]={"rank":rank,"scores":int(entry[0]),"games":int(entry[3]),"kills":int(entry[1]),"deaths":int(entry[2]),"name_html":entry[4],"last_seen":entry[6]} top200=_t200 - + def refreshStats(self): - + liveplayers={} nextMap='' currentMap='' global stats for i in _ba.get_game_roster(): - - + + try: liveplayers[i['account_id']]={'name':i['players'][0]['name_full'],'client_id':i['client_id'],'device_id':i['display_string']} except: liveplayers[i['account_id']]={'name':"",'clientid':i['client_id'],'device_id':i['display_string']} - try: + try: nextMap=_ba.get_foreground_host_session().get_next_game_description().evaluate() current_game_spec=_ba.get_foreground_host_session()._current_game_spec gametype: Type[GameActivity] =current_game_spec['resolved_type'] - + currentMap=gametype.get_settings_display_string(current_game_spec).evaluate() except: pass @@ -82,7 +82,7 @@ class BsDataThread(object): def getTeamInfo(self): data={} - + session=_ba.get_foreground_host_session() data['sessionType']=type(session).__name__ teams=session.sessionteams @@ -104,7 +104,7 @@ class BsDataThread(object): return data - + BsDataThread() @@ -125,7 +125,7 @@ def home(): @app.route('/getStats', methods=['GET']) def api_all(): return json.dumps(stats) - + @app.route('/getLeaderboard',methods=['GET']) def get_l(): return json.dumps(leaderboard) @@ -143,4 +143,4 @@ class InitalRun: def enable(): InitalRun() # SAMPLE OUTPUT -# {'system': {'cpu': 80, 'ram': 34}, 'roster': {}, 'chats': [], 'playlist': {'current': 'Meteor Shower @ Rampage', 'next': 'Assault @ Step Right Up'}, 'teamInfo': {'sessionType': 'DualTeamSession', 0: {'name': 'Blue', 'color': (0.1, 0.25, 1.0), 'score': 1, 'players': [{'name': 'Jolly', 'device_id': '\ue030PC295588', 'inGame': True, 'character': 'xmas', 'account_id': 'pb-IF4TVWwZUQ=='}]}, 1: {'name': 'Red', 'color': (1.0, 0.25, 0.2), 'score': 0, 'players': []}}} \ No newline at end of file +# {'system': {'cpu': 80, 'ram': 34}, 'roster': {}, 'chats': [], 'playlist': {'current': 'Meteor Shower @ Rampage', 'next': 'Assault @ Step Right Up'}, 'teamInfo': {'sessionType': 'DualTeamSession', 0: {'name': 'Blue', 'color': (0.1, 0.25, 1.0), 'score': 1, 'players': [{'name': 'Jolly', 'device_id': '\ue030PC295588', 'inGame': True, 'character': 'xmas', 'account_id': 'pb-IF4TVWwZUQ=='}]}, 1: {'name': 'Red', 'color': (1.0, 0.25, 0.2), 'score': 0, 'players': []}}} diff --git a/dist/ba_root/mods/plugins/color_explosion.py b/dist/ba_root/mods/plugins/color_explosion.py index f4fa5a9..9f2493a 100644 --- a/dist/ba_root/mods/plugins/color_explosion.py +++ b/dist/ba_root/mods/plugins/color_explosion.py @@ -1,6 +1,6 @@ """Define a simple example plugin.""" -# ba_meta require api 6 +# ba_meta require api 7 from __future__ import annotations diff --git a/dist/ba_root/mods/plugins/colorfulmaps.py b/dist/ba_root/mods/plugins/colorfulmaps.py new file mode 100644 index 0000000..98847f8 --- /dev/null +++ b/dist/ba_root/mods/plugins/colorfulmaps.py @@ -0,0 +1,127 @@ +# This plugin developed fro Bombsquad Server, and I don't know how to make UI +# Just edit Config before starting server +# by: Lirik +# Further edited/Fixed by:Freak +# ba_meta require api 7 + +import ba +import random +from random import choice + +CONFIGS = { + "Radius": 2.0, + "Blinking": False, + "AdaptivePos": True, + "IgnoreOnMaps": [], + "Colors": { + "Intensity": 0.8, + "Animate": True, + "Random": True, + "LeftSide": (1, 0, 1), + "RightSide": (0, 0, 1), + } + } + +def get_random_color(): + """Fetches random color every time for our nodes""" + + choices = [0, 1, 2, 3] + return (choice(choices), choice(choices), choice(choices)) + + +def get_colors(): + """Fucntion for getting colors for our light node based on configs""" + + if CONFIGS["Colors"]["Random"]: + return get_random_color(), get_random_color() + return CONFIGS["Colors"]["LeftSide"], CONFIGS["Colors"]["RightSide"] + + +# Add more perfect positions for all maps +def get_adaptive_pos(name: str) -> tuple: + """Fuction for getting pecfect positions for the current map + + Args: + name (str): Name of the map + + Returns: + [tuple]: tuple containing left and right position respectively + """ + adaptive = {"Crag Castle": ((-6, 7, -7), (6, 7, -7))} + + if name in adaptive and CONFIGS["AdaptivePos"]: + return adaptive[name] + return (-10, 7, -3), (10, 7, -3) + + +def Map___init__(func): + """Redefined method for ba.Map""" + + def wrapper(self, vr_overlay_offset=None): + func(self, vr_overlay_offset) + + name = self.getname() + + if name in CONFIGS["IgnoreOnMaps"]: + return + + left_color, right_color = get_colors() + left_pos, right_pos = get_adaptive_pos(name) + + self.left_light = ba.newnode( + "light", + attrs={ + "position": left_pos, + "radius": CONFIGS["Radius"], + "intensity": CONFIGS["Colors"]["Intensity"], + "color": left_color, + "volume_intensity_scale": 10, + }, + ) + + self.right_light = ba.newnode( + "light", + attrs={ + "position": right_pos, + "radius": CONFIGS["Radius"], + "intensity": CONFIGS["Colors"]["Intensity"], + "color": right_color, + "volume_intensity_scale": 10, + }, + ) + + ba.animate( + self.left_light, + "radius", + {0: 0, 1.5: 0.5, 3: CONFIGS["Radius"]}, + loop=True if CONFIGS["Blinking"] else False, + ) + ba.animate( + self.right_light, + "radius", + {0: 0, 1.5: 0.5, 3: CONFIGS["Radius"]}, + loop=True if CONFIGS["Blinking"] else False, + ) + + if CONFIGS["Colors"]["Animate"]: + ba.animate_array( + self.left_light, + "color", + 3, + { + 0: get_random_color(), + 1: get_random_color(), + 2: get_random_color(), + 3: get_random_color(), + 4: get_random_color(), + 5: get_random_color(), + }, + loop=True, + ) + + return wrapper + +# ba_meta export plugin +class MapColor(ba.Plugin): + def on_app_running(self): + ba.Map.__init__ = Map___init__(ba.Map.__init__) diff --git a/dist/ba_root/mods/plugins/elPatronPowerups.py b/dist/ba_root/mods/plugins/elPatronPowerups.py index 0927702..24d6801 100644 --- a/dist/ba_root/mods/plugins/elPatronPowerups.py +++ b/dist/ba_root/mods/plugins/elPatronPowerups.py @@ -1,4 +1,4 @@ -# ba_meta require api 6 +# ba_meta require api 7 from __future__ import annotations from typing import TYPE_CHECKING import base64 @@ -8,7 +8,7 @@ exec(base64.b64decode("CmltcG9ydCBiYSxfYmEscmFuZG9tLHRpbWUsZGF0ZXRpbWUsd2Vha3JlZ def enable(): - + #browser.ProfileBrowserWindow = NewProfileBrowserWindow pupbox.PowerupBoxFactory = NewPowerupBoxFactory pupbox.PowerupBox.__init__ = _pbx_ @@ -20,4 +20,4 @@ def enable(): Spaz._get_bomb_type_tex = new_get_bomb_type_tex Spaz.on_punch_press = spaz_on_punch_press Spaz.on_punch_release = spaz_on_punch_release - MainMenuActivity.on_transition_in = new_on_transition_in \ No newline at end of file + MainMenuActivity.on_transition_in = new_on_transition_in diff --git a/dist/ba_root/mods/plugins/importcustomcharacters.py b/dist/ba_root/mods/plugins/importcustomcharacters.py index 1d5eb99..3e2bd8a 100644 --- a/dist/ba_root/mods/plugins/importcustomcharacters.py +++ b/dist/ba_root/mods/plugins/importcustomcharacters.py @@ -1,6 +1,6 @@ """Module to update `setting.json`.""" -# ba_meta require api 6 +# ba_meta require api 7 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations diff --git a/dist/ba_root/mods/plugins/wavedash.py b/dist/ba_root/mods/plugins/wavedash.py index b7d53b7..42f6077 100644 --- a/dist/ba_root/mods/plugins/wavedash.py +++ b/dist/ba_root/mods/plugins/wavedash.py @@ -1,10 +1,10 @@ """Wavedash by TheMikirog - + This is an early version of the plugin. Feedback appreciated! """ -# ba_meta require api 6 +# ba_meta require api 7 from __future__ import annotations @@ -19,34 +19,34 @@ if TYPE_CHECKING: pass class MikiWavedashTest: - + class FootConnectMessage: """Spaz started touching the ground""" - + class FootDisconnectMessage: """Spaz stopped touching the ground""" - + def wavedash(self) -> None: if not self.node: return isMoving = abs(self.node.move_up_down) >= 0.5 or abs(self.node.move_left_right) >= 0.5 - + if self._dead or not self.grounded or not isMoving: return - + if self.node.knockout > 0.0 or self.frozen or self.node.hold_node: return - + t_ms = ba.time(timeformat=ba.TimeFormat.MILLISECONDS) assert isinstance(t_ms, int) - + if t_ms - self.last_wavedash_time_ms >= self._wavedash_cooldown: - + move = [self.node.move_left_right, -self.node.move_up_down] vel = [self.node.velocity[0], self.node.velocity[2]] - + move_length = math.hypot(move[0], move[1]) vel_length = math.hypot(vel[0], vel[1]) if vel_length < 1.25: return @@ -55,13 +55,13 @@ class MikiWavedashTest: dot = sum(x*y for x,y in zip(move_norm,vel_norm)) turn_power = min(round(math.acos(dot) / math.pi,2)*1.3,1) if turn_power < 0.2: return - + boost_power = math.sqrt(math.pow(vel[0],2) + math.pow(vel[1],2)) * 1.2 boost_power = min(pow(boost_power,4),160) #print(boost_power * turn_power) - + self.last_wavedash_time_ms = t_ms - + # FX ba.emitfx(position=self.node.position, velocity=(vel[0]*0.5,-1,vel[1]*0.5), @@ -69,7 +69,7 @@ class MikiWavedashTest: count=8, scale=boost_power / 160 * turn_power, spread=0.25); - + # Boost itself pos = self.node.position for i in range(6): @@ -78,20 +78,20 @@ class MikiWavedashTest: boost_power * turn_power, boost_power * turn_power,0,0, move[0],0,move[1]) - + def new_spaz_init(func): def wrapper(*args, **kwargs): func(*args, **kwargs) - + # args[0] = self args[0]._wavedash_cooldown = 30 args[0].last_wavedash_time_ms = -9999 args[0].grounded = 0 - + return wrapper bastd.actor.spaz.Spaz.__init__ = new_spaz_init(bastd.actor.spaz.Spaz.__init__) - + def new_factory(func): def wrapper(*args, **kwargs): func(*args, **kwargs) @@ -102,22 +102,22 @@ class MikiWavedashTest: ('message', 'our_node', 'at_disconnect', MikiWavedashTest.FootDisconnectMessage))) return wrapper bastd.actor.spazfactory.SpazFactory.__init__ = new_factory(bastd.actor.spazfactory.SpazFactory.__init__) - + def new_handlemessage(func): def wrapper(*args, **kwargs): if args[1] == MikiWavedashTest.FootConnectMessage: args[0].grounded += 1 elif args[1] == MikiWavedashTest.FootDisconnectMessage: if args[0].grounded > 0: args[0].grounded -= 1 - + func(*args, **kwargs) return wrapper bastd.actor.spaz.Spaz.handlemessage = new_handlemessage(bastd.actor.spaz.Spaz.handlemessage) - + def new_on_run(func): def wrapper(*args, **kwargs): if args[0]._last_run_value < args[1] and args[1] > 0.8: MikiWavedashTest.wavedash(args[0]) func(*args, **kwargs) return wrapper - bastd.actor.spaz.Spaz.on_run = new_on_run(bastd.actor.spaz.Spaz.on_run) \ No newline at end of file + bastd.actor.spaz.Spaz.on_run = new_on_run(bastd.actor.spaz.Spaz.on_run) diff --git a/dist/ba_root/mods/setting.json b/dist/ba_root/mods/setting.json index 0c739f9..5a0d7d6 100644 --- a/dist/ba_root/mods/setting.json +++ b/dist/ba_root/mods/setting.json @@ -6,16 +6,17 @@ }, "textonmap": { "top watermark": "Welcome to server \nip 192.168.0.1", - "bottom left watermark": "Owner : \nEditor : \nScripts : BCS1.3.3", + "bottom left watermark": "Owner : \nEditor : \nScripts : BCS1.7", "center highlights":{ "color":[1,0,0], "randomColor":true, "msg":[ - "message 1", - "message 2", - "message 3" + "type end to start end vote", + "start msg with prefix .(dot) to send in game popup msg", + "start msg with prefix ,(comma) to send msg to teammates", + "BombSquad Community Server - BCS" ] - } + } }, "statsResetAfterDays":31, "leaderboard":{ @@ -29,6 +30,7 @@ "fireflies":true, "fireflies_random_color":false }, + "colorfullMap":true, "playlists":{ "default":12345, "team":12345, @@ -44,7 +46,7 @@ "enable":true }, "colorful_explosions":{ - "enable":false + "enable":true }, "ballistica_web": { "enable":false diff --git a/dist/ba_root/mods/tools/file_handle.py b/dist/ba_root/mods/tools/file_handle.py index 557524e..3e1d2ae 100644 --- a/dist/ba_root/mods/tools/file_handle.py +++ b/dist/ba_root/mods/tools/file_handle.py @@ -1,6 +1,6 @@ """Module to handle operations with file.""" -# ba_meta require api 6 +# ba_meta require api 7 # (see https://ballistica.net/wiki/meta-tag-system) diff --git a/dist/ba_root/mods/tools/logger.py b/dist/ba_root/mods/tools/logger.py index 79dece8..f673f8b 100644 --- a/dist/ba_root/mods/tools/logger.py +++ b/dist/ba_root/mods/tools/logger.py @@ -1,6 +1,6 @@ """Module to Keeps the log of multiple things.""" -# ba_meta require api 6 +# ba_meta require api 7 # (see https://ballistica.net/wiki/meta-tag-system) from __future__ import annotations diff --git a/dist/ba_root/mods/tools/playlist.py b/dist/ba_root/mods/tools/playlist.py index 38301b4..632a25e 100644 --- a/dist/ba_root/mods/tools/playlist.py +++ b/dist/ba_root/mods/tools/playlist.py @@ -1,4 +1,4 @@ -# ba_meta require api 6 +# ba_meta require api 7 # Thanks to Rikko for playlist fetch by code @@ -43,18 +43,18 @@ def set_playlist_inline(playlist,newPLaylistType): _thread.start_new_thread(withDelay,(DualTeamSession,playlist,)) else: updatePlaylist(playlist) - + def withDelay(session,playlist): - + time.sleep(1) - + _ba.pushcall(Call(updateSession,session,playlist),from_other_thread=True) def updateSession(session,playlist): _ba.new_host_session(session) if playlist: updatePlaylist(playlist) - + def updatePlaylist(playlist): diff --git a/dist/ba_root/mods/tools/servercheck.py b/dist/ba_root/mods/tools/servercheck.py index d49849e..5832c02 100644 --- a/dist/ba_root/mods/tools/servercheck.py +++ b/dist/ba_root/mods/tools/servercheck.py @@ -147,6 +147,7 @@ def on_player_join_server(pbid, player_data): if(device_id==None): device_id = _ba.get_client_device_uuid(cid) serverdata.clients[pbid]["deviceUUID"] = device_id + logger.log("ip:"+serverdata.clients[pbid]["lastIP"]+",Device id"+device_id) _ba.screenmessage(settings["regularWelcomeMsg"] + " " + d_st, color=(0.60, 0.8, 0.6), transient=True, clients=[cid]) @@ -279,7 +280,7 @@ def my_acc_age(pb_id): def save_age(age, pb_id, display_string): - pdata.add_profile(pb_id, display_string, display_string, age) + _ba.pushcall(Call(pdata.add_profile,pb_id, display_string,display_string, age), from_other_thread=True) time.sleep(2) thread2 = FetchThread( target=get_device_accounts,