Merge pull request #457 from anasdhaoidi/main

fix some plugins and add new plugin
This commit is contained in:
Loup 2026-05-07 23:14:23 +05:30 committed by GitHub
commit 05c3f1d023
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 3205 additions and 3101 deletions

View file

@ -2387,6 +2387,12 @@
}
],
"versions": {
"1.0.1": {
"api_version": 9,
"commit_sha": "023b733",
"released_on": "01-05-2026",
"md5sum": "045eb589b2969398f7fcb171216303d1"
},
"1.0.0": {
"api_version": 9,
"commit_sha": "f38a7ac",
@ -2396,7 +2402,7 @@
}
},
"custom_hits": {
"description": "when someone hited rainbow text whit effect will appear",
"description": "when someone hited text whit random effect will appear",
"external_url": "",
"authors": [
{
@ -2406,6 +2412,12 @@
}
],
"versions": {
"1.1.0": {
"api_version": 9,
"commit_sha": "023b733",
"released_on": "01-05-2026",
"md5sum": "bc39a552ab7f40a71ce2813f7860a62f"
},
"1.0.1": {
"api_version": 9,
"commit_sha": "b48a4bd",
@ -2538,6 +2550,25 @@
"md5sum": "f2b1b542cf8cb7b633c5b460966bd26c"
}
}
},
"rank_system": {
"description": "ranks system for servers or for local players",
"external_url": "",
"authors": [
{
"name": "ATD",
"email": "anasdhaoidi001@gmail.com",
"discord": ""
}
],
"versions": {
"1.0.0": {
"api_version": 9,
"commit_sha": "023b733",
"released_on": "01-05-2026",
"md5sum": "487c0520dc833f15942941e0dbc82f1e"
}
}
}
}
}

View file

@ -1,7 +1,6 @@
# ba_meta require api 9
from __future__ import annotations
from typing import TYPE_CHECKING
import babase
@ -14,136 +13,81 @@ if TYPE_CHECKING:
plugman = dict(
plugin_name="custom_hits",
description="when someone hited rainbow text whit effect will appear",
description="when someone hited text whit random effect will appear",
external_url="",
authors=[
{"name": "ATD", "email": "anasdhaoidi001@gmail.com", "discord": ""},
],
version="1.0.1",
version="1.1.0",
)
# ___________________________________________________
####################################
first_damage = (u'\ue042TRY AGAIN?\ue042', (0, 1, 0), '6')
second_damage = (u'\ue048GOOD!\ue048', (0, 1, 1), '2')
third_damage = (u'\ue041NICE!\ue041', (0.8, 0.4, 1), '3')
fourth_damage = (u'\ue049UPPS\ue049', (1, 1, 0), '4')
five_damage = (u'\ue043DEATH!\ue043', (1, 0, 0), '5')
first_damage = (u'NAH NOOB?', (1, 1, 1), '6')
second_damage = (u'GOOD!', (0, 1, 0), '2')
third_damage = (u'DAMN!', (0, 0, 0), '3')
fourth_damage = (u'SRY NOOB', (1, 1, 0), '4')
five_damage = (u'FAH!!!', (1, 0, 0), '5')
def custom_effects(pos: float, effect: str = None) -> None:
if effect == '1':
bs.emitfx(
position=pos,
count=3,
scale=0.1,
spread=0.1,
chunk_type='rock')
bs.emitfx(position=pos, count=3, scale=0.1, spread=0.1, chunk_type='rock')
elif effect == '2':
bs.emitfx(
position=pos,
count=70,
scale=2,
spread=0.8,
chunk_type='spark')
bs.emitfx(position=pos, count=70, scale=2, spread=0.8, chunk_type='spark')
elif effect == '3':
bs.emitfx(
position=pos,
count=6,
scale=0.3,
spread=0.4,
chunk_type='splinter')
bs.emitfx(position=pos, count=6, scale=0.3, spread=0.4, chunk_type='splinter')
elif effect == '4':
bs.emitfx(
position=pos,
count=50,
scale=3.0,
spread=0.9,
chunk_type='ice')
bs.emitfx(position=pos, count=50, scale=3.0, spread=0.9, chunk_type='ice')
elif effect == '5':
bs.emitfx(
position=pos,
count=80,
scale=3.0,
spread=1.5,
chunk_type='metal')
bs.emitfx(position=pos, count=80, scale=3.0, spread=1.5, chunk_type='metal')
elif effect == '6':
bs.emitfx(
position=pos,
count=30,
scale=1.2,
spread=0.8,
chunk_type='slime')
bs.emitfx(position=pos, count=30, scale=1.2, spread=0.8, chunk_type='slime')
def on_punched(self, damage: int) -> None:
pos = self.node.position
def custom_text(msg: str, color: float) -> None:
text = bs.newnode('text', attrs={
'text': msg,
'color': color,
'in_world': True,
'h_align': 'center',
'shadow': 0.5,
'flatness': 1.0,
})
bs.animate_array(text, 'position', 3, {
0.0: (pos[0], pos[1] + 1.2, pos[2]),
2.0: (pos[0], pos[1] + 1.7, pos[2]),
})
bs.animate(text, 'opacity', {0.8: 1.0, 2.0: 0.0})
bs.animate(text, 'scale', {0: 0, 0.1: 0.017, 0.15: 0.014, 2.0: 0.016})
bs.timer(2.0, text.delete)
if damage < 200:
custom_text(first_damage[0], first_damage[1])
custom_effects(pos, first_damage[2])
elif damage < 500:
custom_text(second_damage[0], second_damage[1])
custom_effects(pos, second_damage[2])
elif damage < 800:
custom_text(third_damage[0], third_damage[1])
custom_effects(pos, third_damage[2])
elif damage < 1000:
custom_text(fourth_damage[0], fourth_damage[1])
custom_effects(pos, fourth_damage[2])
else:
custom_text(five_damage[0], five_damage[1])
custom_effects(pos, five_damage[2])
####################################
# ba_meta export babase.Plugin
class CustomHitsPlugin(babase.Plugin):
def on_punched(self, damage: int) -> None:
pos = self.node.position
def custom_text(msg: str, color: float) -> None:
text = bs.newnode(
'text',
attrs={
'text': msg,
'color': color,
'in_world': True,
'h_align': 'center',
'shadow': 0.5,
'flatness': 1.0})
bs.animate_array(text, 'position', 3, {
0.0: (pos[0], pos[1] + 1.2, pos[2]),
2.0: (pos[0], pos[1] + 1.7, pos[2])
})
bs.animate(text, 'opacity', {
0.8: 1.0,
2.0: 0.0
})
bs.animate(text, 'scale', {
0: 0,
0.1: 0.017,
0.15: 0.014,
2.0: 0.016
})
bs.animate_array(text, 'color', 3, {
0.0: (0, 0, 0), # Black
0.2: (2.55, 2.55, 2.55), # White
0.4: (2, 0, 0), # Red
0.6: (0, 2.55, 0), # Lime
0.8: (0, 0, 2.55), # Blue
1.0: (2.55, 2.55, 0), # Yellow
1.2: (0, 2.55, 2.55), # Cyan / Aqua
1.4: (2.55, 0, 2.55), # Magenta / Fuchsia
1.6: (1.92, 1.92, 1.92), # Silver
1.8: (1.28, 1.28, 1.28), # Gray
2.0: (1.28, 0, 0), # Maroon
2.2: (1.28, 1.28, 0), # Olive
2.4: (0, 1.28, 0), # Green
2.6: (1.28, 0, 1.28), # Purple
2.8: (0, 1.28, 1.28), # Teal
3.0: (0, 0, 1.28), # Navy
3.2: (1.5, 0.5, 0), # Orange
3.4: (1.8, 0.5, 1.6), # Pink
3.6: (0.5, 0.5, 0.5), # Gray
}, loop=True)
bs.timer(2.0, text.delete)
if damage < 200:
custom_text(first_damage[0], first_damage[1])
custom_effects(pos, first_damage[2])
elif damage < 500:
custom_text(second_damage[0], second_damage[1])
custom_effects(pos, second_damage[2])
elif damage < 800:
custom_text(third_damage[0], third_damage[1])
custom_effects(pos, third_damage[2])
elif damage < 1000:
custom_text(fourth_damage[0], fourth_damage[1])
custom_effects(pos, fourth_damage[2])
else:
custom_text(five_damage[0], five_damage[1])
custom_effects(pos, five_damage[2])
class byATD(babase.Plugin):
"""تفعيل ATD Hits — يُستدعى من bootstraping()."""
Spaz.on_punched = on_punched
try:
from bascenev1lib.actor.spazbot import SpazBot
SpazBot.on_punched = on_punched
except Exception:
pass
bs.broadcastmessage(u' || WELCOME || ', color=(0, 1, 0))

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,142 @@
# ba_meta require api 9
import os
import json
import babase
import bascenev1 as bs
plugman = dict(
plugin_name="rank_system",
description="ranks system for servers or for local players",
external_url="",
authors=[
{"name": "ATD", "email": "anasdhaoidi001@gmail.com", "discord": ""},
],
version="1.0.0",
)
MODS_DIR = os.path.dirname(__file__)
STATS_DIR = os.path.join(MODS_DIR, "stats")
STATS_FILE = os.path.join(STATS_DIR, "ranks.json")
class RankSystem:
def __init__(self):
self.data = {}
self.load()
def load(self):
if not os.path.exists(STATS_DIR):
os.makedirs(STATS_DIR)
if os.path.exists(STATS_FILE):
try:
with open(STATS_FILE, "r") as f:
self.data = json.load(f)
except:
self.data = {}
def save(self):
with open(STATS_FILE, "w") as f:
json.dump(self.data, f, indent=4)
def add_score(self, account_id, score=1):
if account_id not in self.data:
self.data[account_id] = {
"score": 0,
"rank": 0
}
self.data[account_id]["score"] += score
self.update_ranks()
self.save()
def update_ranks(self):
sorted_players = sorted(
self.data.items(),
key=lambda x: x[1]["score"],
reverse=True
)
for i, (aid, p) in enumerate(sorted_players):
p["rank"] = i + 1
def get_rank(self, account_id):
return self.data.get(account_id, {}).get("rank")
rank_sys = RankSystem()
class RankTag:
def __init__(self, node, rank):
m = bs.newnode(
"math",
owner=node,
attrs={
"input1": (0, 1.2, 0),
"operation": "add"
}
)
node.connectattr("torso_position", m, "input2")
if rank == 1:
text = "1"
color = (1, 1, 1)
elif rank == 2:
text = "2"
color = (1, 1, 1)
elif rank == 3:
text = "3"
color = (1, 1, 1)
else:
text = f"#{rank}"
color = (1, 1, 1)
t = bs.newnode(
"text",
owner=node,
attrs={
"text": text,
"in_world": True,
"color": color,
"scale": 0.01,
"h_align": "center"
}
)
m.connectattr("output", t, "position")
# 🔌 plugin
# ba_meta export babase.Plugin
class byATD(babase.Plugin):
def on_app_running(self):
print("Rank System Loaded ")
import bascenev1._gameactivity as ga
old_spawn = ga.GameActivity.spawn_player_spaz
def new_spawn(self, player, *args, **kwargs):
spaz = old_spawn(self, player, *args, **kwargs)
try:
aid = player.sessionplayer.get_account_id()
rank_sys.add_score(aid, 1)
rank = rank_sys.get_rank(aid)
if rank:
RankTag(spaz.node, rank)
except Exception as e:
print("Rank error:", e)
return spaz
ga.GameActivity.spawn_player_spaz = new_spawn