mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2025-11-14 17:46:03 +00:00
auto stats reset , more mini games , known bugs fix
This commit is contained in:
parent
d7f7d751f5
commit
a9441c3e0a
15 changed files with 82 additions and 30 deletions
|
|
@ -48,7 +48,7 @@ max_party_size: 6
|
||||||
# playlist editor in the regular version of the game.
|
# playlist editor in the regular version of the game.
|
||||||
# This will give you a numeric code you can enter here to host that
|
# This will give you a numeric code you can enter here to host that
|
||||||
# playlist.
|
# playlist.
|
||||||
playlist_code: 345700
|
playlist_code: 347990
|
||||||
|
|
||||||
# Alternately, you can embed playlist data here instead of using codes.
|
# Alternately, you can embed playlist data here instead of using codes.
|
||||||
# Make sure to set session_type to the correct type for the data here.
|
# Make sure to set session_type to the correct type for the data here.
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ def filter(msg,pb_id,client_id):
|
||||||
addWarn(pb_id,client_id)
|
addWarn(pb_id,client_id)
|
||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
if pb_id not in serverdata.clients:
|
||||||
|
return None
|
||||||
|
|
||||||
if "lastMsgTime" in serverdata.clients[pb_id]:
|
if "lastMsgTime" in serverdata.clients[pb_id]:
|
||||||
count=serverdata.clients[pb_id]["cMsgCount"]
|
count=serverdata.clients[pb_id]["cMsgCount"]
|
||||||
|
|
|
||||||
19
dist/ba_root/mods/custom_hooks.py
vendored
19
dist/ba_root/mods/custom_hooks.py
vendored
|
|
@ -165,9 +165,18 @@ def on_kick_vote_end():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
import importlib
|
||||||
def importgames():
|
def importgames():
|
||||||
from games import SquidRace
|
games=os.listdir("ba_root/mods/games")
|
||||||
from games import StumbleRace
|
for game in games:
|
||||||
from games import SubwayRun
|
if game.endswith(".py") or game.endswith(".so"):
|
||||||
from maps import InTheAir
|
importlib.import_module("games."+game.replace(".so","").replace(".py",""))
|
||||||
|
maps=os.listdir("ba_root/mods/maps")
|
||||||
|
for map in maps:
|
||||||
|
if map.endswith(".py") or map.endswith(".so"):
|
||||||
|
importlib.import_module("maps."+map.replace(".so","").replace(".py",""))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
dist/ba_root/mods/games/CanonFight.so
vendored
Normal file
BIN
dist/ba_root/mods/games/CanonFight.so
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/games/DuelElimination.so
vendored
Normal file
BIN
dist/ba_root/mods/games/DuelElimination.so
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/games/FlappyBird.so
vendored
Normal file
BIN
dist/ba_root/mods/games/FlappyBird.so
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/games/MonkeyClimb.so
vendored
Normal file
BIN
dist/ba_root/mods/games/MonkeyClimb.so
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/games/OneNightNoStand.so
vendored
Normal file
BIN
dist/ba_root/mods/games/OneNightNoStand.so
vendored
Normal file
Binary file not shown.
0
dist/ba_root/mods/games/__init__.py
vendored
Normal file
0
dist/ba_root/mods/games/__init__.py
vendored
Normal file
BIN
dist/ba_root/mods/maps/CreativeThoughts.so
vendored
Normal file
BIN
dist/ba_root/mods/maps/CreativeThoughts.so
vendored
Normal file
Binary file not shown.
BIN
dist/ba_root/mods/maps/FloatingIsland.so
vendored
Normal file
BIN
dist/ba_root/mods/maps/FloatingIsland.so
vendored
Normal file
Binary file not shown.
2
dist/ba_root/mods/playersData/roles.json
vendored
2
dist/ba_root/mods/playersData/roles.json
vendored
|
|
@ -29,7 +29,7 @@
|
||||||
1
|
1
|
||||||
],
|
],
|
||||||
"commands": [],
|
"commands": [],
|
||||||
"ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="]
|
"ids": ["pb-IF4VAk4a"]
|
||||||
},
|
},
|
||||||
"smoothy": {
|
"smoothy": {
|
||||||
"tag": "smoothy", "tagcolor": [1,
|
"tag": "smoothy", "tagcolor": [1,
|
||||||
|
|
|
||||||
1
dist/ba_root/mods/setting.json
vendored
1
dist/ba_root/mods/setting.json
vendored
|
|
@ -17,6 +17,7 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"statsResetAfterDays":31,
|
||||||
"leaderboard":{
|
"leaderboard":{
|
||||||
"enable":true,
|
"enable":true,
|
||||||
"barsBehindName":true
|
"barsBehindName":true
|
||||||
|
|
|
||||||
1
dist/ba_root/mods/spazmod/tag.py
vendored
1
dist/ba_root/mods/spazmod/tag.py
vendored
|
|
@ -9,6 +9,7 @@ def addtag(node,player):
|
||||||
roles=pdata.get_roles()
|
roles=pdata.get_roles()
|
||||||
p_roles=pdata.get_player_roles(account_id)
|
p_roles=pdata.get_player_roles(account_id)
|
||||||
tag=None
|
tag=None
|
||||||
|
col=(0.5,0.5,1) # default color for custom tags
|
||||||
if account_id in customtag:
|
if account_id in customtag:
|
||||||
tag=customtag[account_id]
|
tag=customtag[account_id]
|
||||||
elif p_roles !=[]:
|
elif p_roles !=[]:
|
||||||
|
|
|
||||||
85
dist/ba_root/mods/stats/mystats.py
vendored
85
dist/ba_root/mods/stats/mystats.py
vendored
|
|
@ -18,6 +18,7 @@ from ba import _activitytypes as ba_actypes
|
||||||
from ba._activitytypes import *
|
from ba._activitytypes import *
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import custom_hooks
|
import custom_hooks
|
||||||
|
import datetime
|
||||||
#variables
|
#variables
|
||||||
our_settings = setting.get_settings_data()
|
our_settings = setting.get_settings_data()
|
||||||
# where our stats file and pretty html output will go
|
# where our stats file and pretty html output will go
|
||||||
|
|
@ -45,16 +46,55 @@ html_start = f'''<!DOCTYPE html>
|
||||||
<th><b>Games Played</b></th>
|
<th><b>Games Played</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
'''
|
'''
|
||||||
|
statsDefault={
|
||||||
|
"pb-IF4VAk4a": {
|
||||||
|
"rank": 65,
|
||||||
|
"name": "pb-IF4VAk4a",
|
||||||
|
"scores": 0,
|
||||||
|
"total_damage": 0.0,
|
||||||
|
"kills": 0,
|
||||||
|
"deaths": 0,
|
||||||
|
"games": 18,
|
||||||
|
"kd": 0.0,
|
||||||
|
"avg_score": 0.0,
|
||||||
|
"aid": "pb-IF4VAk4a"
|
||||||
|
}
|
||||||
|
}
|
||||||
# <th><b>Total Damage</b></th> #removed this line as it isn't crt data
|
# <th><b>Total Damage</b></th> #removed this line as it isn't crt data
|
||||||
|
|
||||||
#useful functions
|
#useful functions
|
||||||
|
seasonStartDate=None
|
||||||
|
import shutil,os
|
||||||
def get_all_stats():
|
def get_all_stats():
|
||||||
|
global seasonStartDate
|
||||||
if os.path.exists(statsfile):
|
if os.path.exists(statsfile):
|
||||||
|
renameFile=False
|
||||||
with open(statsfile, 'r') as f:
|
with open(statsfile, 'r') as f:
|
||||||
return json.loads(f.read())
|
jsonData=json.loads(f.read())
|
||||||
else: print('Stats file not found!')
|
try:
|
||||||
|
stats=jsonData["stats"]
|
||||||
|
|
||||||
|
seasonStartDate=datetime.datetime.strptime(jsonData["startDate"],"%d-%m-%Y")
|
||||||
|
if (datetime.datetime.now()-seasonStartDate).days >=our_settings["statsResetAfterDays"]:
|
||||||
|
backupStatsFile()
|
||||||
|
seasonStartDate=datetime.datetime.now()
|
||||||
|
return statsDefault
|
||||||
|
return stats
|
||||||
|
except:
|
||||||
|
return jsonData
|
||||||
|
else:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def backupStatsFile():
|
||||||
|
shutil.copy(statsfile,statsfile.replace(".json","")+str(seasonStartDate)+".json")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def dump_stats(s: dict):
|
def dump_stats(s: dict):
|
||||||
|
global seasonStartDate
|
||||||
|
if seasonStartDate ==None:
|
||||||
|
seasonStartDate=datetime.datetime.now()
|
||||||
|
s={"startDate":seasonStartDate.strftime("%d-%m-%Y") , "stats":s}
|
||||||
if os.path.exists(statsfile):
|
if os.path.exists(statsfile):
|
||||||
with open(statsfile, 'w') as f:
|
with open(statsfile, 'w') as f:
|
||||||
f.write(json.dumps(s, indent=4))
|
f.write(json.dumps(s, indent=4))
|
||||||
|
|
@ -73,8 +113,9 @@ def refreshStats():
|
||||||
# lastly, write a pretty html version.
|
# lastly, write a pretty html version.
|
||||||
# our stats url could point at something like this...
|
# our stats url could point at something like this...
|
||||||
pStats = get_all_stats()
|
pStats = get_all_stats()
|
||||||
f=open(htmlfile, 'w')
|
# f=open(htmlfile, 'w')
|
||||||
f.write(html_start)
|
# f.write(html_start)
|
||||||
|
|
||||||
entries = [(a['scores'], a['kills'], a['deaths'], a['games'], a['name'], a['aid']) for a in pStats.values()]
|
entries = [(a['scores'], a['kills'], a['deaths'], a['games'], a['name'], a['aid']) for a in pStats.values()]
|
||||||
# this gives us a list of kills/names sorted high-to-low
|
# this gives us a list of kills/names sorted high-to-low
|
||||||
entries.sort(reverse=True)
|
entries.sort(reverse=True)
|
||||||
|
|
@ -123,24 +164,24 @@ def refreshStats():
|
||||||
pStats[str(aid)]["kd"] = float(p_kd)
|
pStats[str(aid)]["kd"] = float(p_kd)
|
||||||
pStats[str(aid)]["avg_score"] = float(p_avg_score)
|
pStats[str(aid)]["avg_score"] = float(p_avg_score)
|
||||||
|
|
||||||
if rank < 201:
|
# if rank < 201:
|
||||||
#<td>{str(dmg)}</td> #removed this line as it isn't crt data
|
# #<td>{str(dmg)}</td> #removed this line as it isn't crt data
|
||||||
f.write(f'''
|
# f.write(f'''
|
||||||
<tr>
|
# <tr>
|
||||||
<td>{str(rank)}</td>
|
# <td>{str(rank)}</td>
|
||||||
<td style="text-align:center">{str(name)}</td>
|
# <td style="text-align:center">{str(name)}</td>
|
||||||
<td>{str(scores)}</td>
|
# <td>{str(scores)}</td>
|
||||||
<td>{str(kills)}</td>
|
# <td>{str(kills)}</td>
|
||||||
<td>{str(deaths)}</td>
|
# <td>{str(deaths)}</td>
|
||||||
<td>{str(games)}</td>
|
# <td>{str(games)}</td>
|
||||||
</tr>''')
|
# </tr>''')
|
||||||
f.write('''
|
# f.write('''
|
||||||
</table>
|
# </table>
|
||||||
</body>
|
# </body>
|
||||||
</html>''')
|
# </html>''')
|
||||||
|
|
||||||
|
|
||||||
f.close()
|
# f.close()
|
||||||
global ranks
|
global ranks
|
||||||
ranks=_ranks
|
ranks=_ranks
|
||||||
|
|
||||||
|
|
@ -192,9 +233,7 @@ class UpdateThread(threading.Thread):
|
||||||
# pull our existing stats from disk
|
# pull our existing stats from disk
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if os.path.exists(statsfile):
|
stats=get_all_stats()
|
||||||
with open(statsfile) as f:
|
|
||||||
stats = json.loads(f.read())
|
|
||||||
except:
|
except:
|
||||||
stats={}
|
stats={}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue