Added HitMessages, Damage Statistics, and fixed some Errors

This commit is contained in:
FireFighter1027 2021-05-04 14:05:14 +05:30
parent 44a934b120
commit a5949493bf
4 changed files with 60 additions and 19 deletions

View file

@ -29,6 +29,7 @@
"enablehptag": true,
"enablerank": true,
"enablestats": true,
"enableeffects": false,
"enableTop5effects": false
"enableHitTexts": true,
"enableeffects": true,
"enableTop5effects": true
}

View file

@ -58,7 +58,6 @@ class SurroundBallFactory(object):
class SurroundBall(ba.Actor):
def __init__(self, spaz, shape="bones"):
if spaz is None or not spaz.is_alive(): return
ba.Actor.__init__(self)
self.spazRef = weakref.ref(spaz)
factory = self.getFactory()
@ -196,19 +195,24 @@ class Effect(ba.Actor):
if _settings['enablestats']:
pats = mystats.get_all_stats()
if aid in pats:
rank = pats[aid]["rank"]
if int(rank) < 6:
if rank == '1':
if flag == 0 and _settings['enableTop5effects']: self.add_multicolor_effect() #self.neroLightTimer = ba.Timer(500, ba.WeakCall(self.neonLightSwitch,("shine" in self.Decorations),("extra_Highlight" in self.Decorations),("extra_NameColor" in self.Decorations)),repeat = True, timetype=tt, timeformat=tf)
elif rank == '2':
if flag == 0 and _settings['enableTop5effects']: self.smokeTimer = ba.Timer(40, ba.WeakCall(self.emitSmoke), repeat=True, timetype=tt, timeformat=tf)
elif rank == '3':
if flag == 0 and _settings['enableTop5effects']: self.addLightColor((1, 0.6, 0.4));self.scorchTimer = ba.Timer(500, ba.WeakCall(self.update_Scorch), repeat=True, timetype=tt, timeformat=tf)
elif rank == '4':
if flag == 0 and _settings['enableTop5effects']: self.metalTimer = ba.Timer(500, ba.WeakCall(self.emitMetal), repeat=True, timetype=tt, timeformat=tf)
if cl_str in pats:
rank = pats[cl_str]["rank"]
if rank < 6:
if rank == 1:
if flag == 0 and _settings['enableTop5effects']:
self.surround = SurroundBall(spaz, shape="bones") #self.neroLightTimer = ba.Timer(500, ba.WeakCall(self.neonLightSwitch,("shine" in self.Decorations),("extra_Highlight" in self.Decorations),("extra_NameColor" in self.Decorations)),repeat = True, timetype=tt, timeformat=tf)
elif rank == 2:
if flag == 0 and _settings['enableTop5effects']:
self.smokeTimer = ba.Timer(40, ba.WeakCall(self.emitSmoke), repeat=True, timetype=tt, timeformat=tf)
elif rank == 3:
if flag == 0 and _settings['enableTop5effects']:
self.addLightColor((1, 0.6, 0.4));self.scorchTimer = ba.Timer(500, ba.WeakCall(self.update_Scorch), repeat=True, timetype=tt, timeformat=tf)
elif rank == 4:
if flag == 0 and _settings['enableTop5effects']:
self.metalTimer = ba.Timer(500, ba.WeakCall(self.emitMetal), repeat=True, timetype=tt, timeformat=tf)
else:
if flag == 0 and _settings['enableTop5effects']: self.addLightColor((1, 0.6, 0.4));self.checkDeadTimer = ba.Timer(150, ba.WeakCall(self.checkPlayerifDead), repeat=True, timetype=tt, timeformat=tf)
if flag == 0 and _settings['enableTop5effects']:
self.addLightColor((1, 0.6, 0.4));self.checkDeadTimer = ba.Timer(150, ba.WeakCall(self.checkPlayerifDead), repeat=True, timetype=tt, timeformat=tf)
if "smoke" and "spark" and "snowDrops" and "slimeDrops" and "metalDrops" and "Distortion" and "neroLight" and "scorch" and "HealTimer" and "KamikazeCheck" not in self.Decorations:
#self.checkDeadTimer = ba.Timer(150, ba.WeakCall(self.checkPlayerifDead), repeat=True, timetype=tt, timeformat=tf)

View file

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Released under the MIT License. See LICENSE for details.
import ba, _ba, setting
from stats.mystats import damage_data
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.get_foreground_host_session().sessionplayers:
if (c.activityplayer) and (c.activityplayer.node.playerID == hit_by_id):
hit_by_account_id = c.get_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)
#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()
except: pass
return

View file

@ -5,12 +5,11 @@ import setting
# all activites related to modify spaz by any how will be here
def main(spaz, node, player):
_setting=setting.get_settings_data()
if _setting['enablehptag']:
tag.addhp(spaz)
if _setting['enabletags']:
tag.addtag(node,player)
if _setting['enablerank']:
tag.addrank(node,player)
if _setting['enableeffects']:
effects.Effect(spaz,player)
#HP should be called on each 0.1 sec, [check on settings in done in tag.addhp()]
tag.addhp(node)