diff --git a/config.yaml b/config.yaml index 2e7d38d..49a4c9d 100644 --- a/config.yaml +++ b/config.yaml @@ -48,7 +48,7 @@ max_party_size: 6 # playlist editor in the regular version of the game. # This will give you a numeric code you can enter here to host that # playlist. -playlist_code: 345700 +playlist_code: 347990 # 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. diff --git a/dist/ba_root/mods/chatHandle/chatFilter/ChatFilter.py b/dist/ba_root/mods/chatHandle/chatFilter/ChatFilter.py index 08f5abc..95fa9ee 100644 --- a/dist/ba_root/mods/chatHandle/chatFilter/ChatFilter.py +++ b/dist/ba_root/mods/chatHandle/chatFilter/ChatFilter.py @@ -16,6 +16,8 @@ def filter(msg,pb_id,client_id): addWarn(pb_id,client_id) now = time.time() + if pb_id not in serverdata.clients: + return None if "lastMsgTime" in serverdata.clients[pb_id]: count=serverdata.clients[pb_id]["cMsgCount"] diff --git a/dist/ba_root/mods/custom_hooks.py b/dist/ba_root/mods/custom_hooks.py index 243dbec..1ac64ca 100644 --- a/dist/ba_root/mods/custom_hooks.py +++ b/dist/ba_root/mods/custom_hooks.py @@ -165,9 +165,18 @@ def on_kick_vote_end(): - +import os +import importlib def importgames(): - from games import SquidRace - from games import StumbleRace - from games import SubwayRun - from maps import InTheAir \ No newline at end of file + games=os.listdir("ba_root/mods/games") + for game in games: + if game.endswith(".py") or game.endswith(".so"): + 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","")) + + + + \ No newline at end of file diff --git a/dist/ba_root/mods/games/CanonFight.so b/dist/ba_root/mods/games/CanonFight.so new file mode 100644 index 0000000..a93622e Binary files /dev/null and b/dist/ba_root/mods/games/CanonFight.so differ diff --git a/dist/ba_root/mods/games/DuelElimination.so b/dist/ba_root/mods/games/DuelElimination.so new file mode 100644 index 0000000..177ec44 Binary files /dev/null and b/dist/ba_root/mods/games/DuelElimination.so differ diff --git a/dist/ba_root/mods/games/FlappyBird.so b/dist/ba_root/mods/games/FlappyBird.so new file mode 100644 index 0000000..dbf6859 Binary files /dev/null and b/dist/ba_root/mods/games/FlappyBird.so differ diff --git a/dist/ba_root/mods/games/MonkeyClimb.so b/dist/ba_root/mods/games/MonkeyClimb.so new file mode 100644 index 0000000..fe37677 Binary files /dev/null and b/dist/ba_root/mods/games/MonkeyClimb.so differ diff --git a/dist/ba_root/mods/games/OneNightNoStand.so b/dist/ba_root/mods/games/OneNightNoStand.so new file mode 100644 index 0000000..f817a39 Binary files /dev/null and b/dist/ba_root/mods/games/OneNightNoStand.so differ diff --git a/dist/ba_root/mods/games/__init__.py b/dist/ba_root/mods/games/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dist/ba_root/mods/maps/CreativeThoughts.so b/dist/ba_root/mods/maps/CreativeThoughts.so new file mode 100644 index 0000000..f94b788 Binary files /dev/null and b/dist/ba_root/mods/maps/CreativeThoughts.so differ diff --git a/dist/ba_root/mods/maps/FloatingIsland.so b/dist/ba_root/mods/maps/FloatingIsland.so new file mode 100644 index 0000000..31881b3 Binary files /dev/null and b/dist/ba_root/mods/maps/FloatingIsland.so differ diff --git a/dist/ba_root/mods/playersData/roles.json b/dist/ba_root/mods/playersData/roles.json index fbbef73..fd31c15 100644 --- a/dist/ba_root/mods/playersData/roles.json +++ b/dist/ba_root/mods/playersData/roles.json @@ -29,7 +29,7 @@ 1 ], "commands": [], - "ids": ["pb-IF5XUm9eAg==", "pb-IF43VUwlAg==", "pb-IF4iVUc5Cg==", "pb-IF4vNnMJ", "pb-IF4TVWwZUQ=="] + "ids": ["pb-IF4VAk4a"] }, "smoothy": { "tag": "smoothy", "tagcolor": [1, diff --git a/dist/ba_root/mods/setting.json b/dist/ba_root/mods/setting.json index 9180d32..e65f4ae 100644 --- a/dist/ba_root/mods/setting.json +++ b/dist/ba_root/mods/setting.json @@ -17,6 +17,7 @@ ] } }, + "statsResetAfterDays":31, "leaderboard":{ "enable":true, "barsBehindName":true diff --git a/dist/ba_root/mods/spazmod/tag.py b/dist/ba_root/mods/spazmod/tag.py index 2ad14af..544882c 100644 --- a/dist/ba_root/mods/spazmod/tag.py +++ b/dist/ba_root/mods/spazmod/tag.py @@ -9,6 +9,7 @@ def addtag(node,player): roles=pdata.get_roles() p_roles=pdata.get_player_roles(account_id) tag=None + col=(0.5,0.5,1) # default color for custom tags if account_id in customtag: tag=customtag[account_id] elif p_roles !=[]: diff --git a/dist/ba_root/mods/stats/mystats.py b/dist/ba_root/mods/stats/mystats.py index 8fedd87..a55792f 100644 --- a/dist/ba_root/mods/stats/mystats.py +++ b/dist/ba_root/mods/stats/mystats.py @@ -18,6 +18,7 @@ from ba import _activitytypes as ba_actypes from ba._activitytypes import * import urllib.request import custom_hooks +import datetime #variables our_settings = setting.get_settings_data() # where our stats file and pretty html output will go @@ -45,16 +46,55 @@ html_start = f''' Games Played ''' +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" + } +} # Total Damage #removed this line as it isn't crt data #useful functions +seasonStartDate=None +import shutil,os def get_all_stats(): + global seasonStartDate if os.path.exists(statsfile): + renameFile=False with open(statsfile, 'r') as f: - return json.loads(f.read()) - else: print('Stats file not found!') + jsonData=json.loads(f.read()) + 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): + global seasonStartDate + if seasonStartDate ==None: + seasonStartDate=datetime.datetime.now() + s={"startDate":seasonStartDate.strftime("%d-%m-%Y") , "stats":s} if os.path.exists(statsfile): with open(statsfile, 'w') as f: f.write(json.dumps(s, indent=4)) @@ -73,8 +113,9 @@ def refreshStats(): # lastly, write a pretty html version. # our stats url could point at something like this... pStats = get_all_stats() - f=open(htmlfile, 'w') - f.write(html_start) + # f=open(htmlfile, 'w') + # f.write(html_start) + 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 entries.sort(reverse=True) @@ -123,24 +164,24 @@ def refreshStats(): pStats[str(aid)]["kd"] = float(p_kd) pStats[str(aid)]["avg_score"] = float(p_avg_score) - if rank < 201: - #{str(dmg)} #removed this line as it isn't crt data - f.write(f''' - - {str(rank)} - {str(name)} - {str(scores)} - {str(kills)} - {str(deaths)} - {str(games)} - ''') - f.write(''' - - -''') +# if rank < 201: +# #{str(dmg)} #removed this line as it isn't crt data +# f.write(f''' +# +# {str(rank)} +# {str(name)} +# {str(scores)} +# {str(kills)} +# {str(deaths)} +# {str(games)} +# ''') +# f.write(''' +# +# +# ''') - f.close() + # f.close() global ranks ranks=_ranks @@ -192,9 +233,7 @@ class UpdateThread(threading.Thread): # pull our existing stats from disk try: - if os.path.exists(statsfile): - with open(statsfile) as f: - stats = json.loads(f.read()) + stats=get_all_stats() except: stats={}