rework on player effects , fixed hitmessage , hptag

This commit is contained in:
Ayush Saini 2023-05-06 18:16:29 +05:30
parent c78d7e5ba0
commit 0bda9ae3c7
8 changed files with 449 additions and 500 deletions

View file

@ -8,31 +8,24 @@ from bastd.actor.popuptext import PopupText
our_settings = setting.get_settings_data()
def handle_hit(msg, hp, dmg, hit_by, msg_pos):
#Check
if not msg.hit_type: return
#Record Out Data
dmg = dmg / 10
if hit_by is not None:
hit_by_id = None
hit_by_id = hit_by.node.playerID
if hit_by_id is not None:
hit_by_account_id = None
for c in ba.internal.get_foreground_host_session().sessionplayers:
if (c.activityplayer) and (c.activityplayer.node.playerID == hit_by_id):
hit_by_account_id = c.get_v1_account_id()
if hit_by_account_id in damage_data: damage_data[hit_by_account_id] += float(dmg)
else: damage_data[hit_by_account_id] = float(dmg)
def handle_hit(mag, pos):
if not mag: return
#Send Screen Texts in enabled
if our_settings['enableHitTexts']:
try:
if hp <= 0: PopupText("Rest In Peace !",color=(1,0.2,0.2),scale=1.6,position=msg_pos).autoretain()
else:
if dmg >= 800: PopupText("#PRO !",color=(1,0.2,0.2),scale=1.6,position=msg_pos).autoretain()
elif dmg >= 600 and dmg < 800: PopupText("GOOD ONE!",color=(1,0.3,0.1),scale=1.6,position=msg_pos).autoretain()
elif dmg >= 400 and dmg < 600: PopupText("OH! YEAH",color=(1,0.5,0.2),scale=1.6,position=msg_pos).autoretain()
elif dmg >= 200 and dmg < 400: PopupText("WTF!",color=(0.7,0.4,0.2),scale=1.6,position=msg_pos).autoretain()
elif dmg > 0 and dmg < 200: PopupText("!!!",color=(1,1,1),scale=1.6,position=msg_pos).autoretain()
if mag >= 110: PopupText("#PRO !",color=(1,0.2,0.2),scale=1.6,position=pos).autoretain()
elif mag >= 93 and mag < 110: PopupText("GOOD ONE!",color=(1,0.3,0.1),scale=1.6,position=pos).autoretain()
elif mag >= 63 and mag < 93: PopupText("OH! YEAH",color=(1,0.5,0.2),scale=1.6,position=pos).autoretain()
elif mag >= 45 and mag < 63: PopupText("WTF!",color=(0.7,0.4,0.2),scale=1.6,position=pos).autoretain()
elif mag > 30 and mag < 45: PopupText("!!!",color=(1,1,1),scale=1.6,position=pos).autoretain()
except: pass
return
return
class hit_message(ba.HitMessage):
def __init__(self, *args, **kwargs):
hit_type = kwargs["hit_type"]
if hit_type == "punch":
handle_hit(kwargs['magnitude'], kwargs['pos'])
super().__init__(*args, **kwargs)
ba.HitMessage = hit_message