2021-11-26 13:18:24 +05:30
|
|
|
from playersData import pdata
|
|
|
|
|
import time
|
|
|
|
|
import _thread
|
2021-12-01 23:52:54 +05:30
|
|
|
import urllib.request
|
|
|
|
|
from efro.terminal import Clr
|
2021-12-01 23:57:52 +05:30
|
|
|
import json
|
2022-10-02 17:27:15 +05:30
|
|
|
VERSION=71
|
2021-11-26 13:18:24 +05:30
|
|
|
|
|
|
|
|
def check():
|
|
|
|
|
_thread.start_new_thread(updateProfilesJson,())
|
2021-12-01 23:52:54 +05:30
|
|
|
_thread.start_new_thread(checkChangelog,())
|
2021-11-26 13:18:24 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
def updateProfilesJson():
|
|
|
|
|
profiles=pdata.get_profiles()
|
|
|
|
|
|
|
|
|
|
for id in profiles:
|
|
|
|
|
if "spamCount" not in profiles[id]:
|
|
|
|
|
profiles[id]["spamCount"]=0
|
|
|
|
|
profiles[id]["lastSpam"]=time.time()
|
|
|
|
|
|
|
|
|
|
pdata.commit_profiles(profiles)
|
2021-12-01 23:52:54 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fetchChangelogs():
|
|
|
|
|
url="https://raw.githubusercontent.com/imayushsaini/Bombsquad-Ballistica-Modded-Server/public-server/dist/ba_root/mods/changelogs.json"
|
2022-10-02 17:27:15 +05:30
|
|
|
|
2021-12-01 23:52:54 +05:30
|
|
|
if 2*2==4:
|
|
|
|
|
try:
|
|
|
|
|
data=urllib.request.urlopen(url)
|
|
|
|
|
changelog=json.loads(data.read())
|
|
|
|
|
except:
|
|
|
|
|
return None
|
|
|
|
|
else:
|
|
|
|
|
return changelog
|
|
|
|
|
|
|
|
|
|
def checkChangelog():
|
|
|
|
|
changelog=fetchChangelogs()
|
|
|
|
|
if changelog==None:
|
|
|
|
|
print(f'{Clr.BRED} UNABLE TO CHECK UPDATES , CHECK MANUALLY FROM URL {Clr.RST}',flush=True)
|
|
|
|
|
else:
|
|
|
|
|
msg=""
|
|
|
|
|
avail=False
|
|
|
|
|
for log in changelog:
|
|
|
|
|
if int(log)>VERSION:
|
|
|
|
|
avail=True
|
|
|
|
|
|
|
|
|
|
if not avail:
|
|
|
|
|
print(f'{Clr.BGRN}{Clr.WHT} YOU ARE ON LATEST VERSION {Clr.RST}',flush=True)
|
|
|
|
|
else:
|
|
|
|
|
print(f'{Clr.BYLW}{Clr.BLU} UPDATES AVAILABLE {Clr.RST}',flush=True)
|
|
|
|
|
for log in changelog:
|
|
|
|
|
if int(log)>VERSION:
|
|
|
|
|
msg=changelog[log]["time"]
|
|
|
|
|
print(f'{Clr.CYN} {msg} {Clr.RST}',flush=True)
|
|
|
|
|
|
|
|
|
|
msg=changelog[log]["log"]
|
|
|
|
|
print(f'{Clr.MAG} {msg} {Clr.RST}',flush=True)
|
|
|
|
|
|
2022-10-02 17:27:15 +05:30
|
|
|
|
2021-12-01 23:52:54 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|