1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Improved Brawlhalla rank change code

This commit is contained in:
Steffo 2016-11-08 15:20:46 +01:00
parent 74e25c81a5
commit 4f5f868ed1

View file

@ -208,11 +208,14 @@ async def brawlhalla_update_mmr(timeout):
continue continue
# Get the current mmr # Get the current mmr
mmr = int(list(row.children)[7].string) mmr = int(list(row.children)[7].string)
try:
old_mmr = db[player]["brawlhalla"]["mmr"]
except KeyError:
old_mmr = 0
# Compare the mmr with the value saved in the database # Compare the mmr with the value saved in the database
if mmr != db[player]["brawlhalla"]["mmr"]: if mmr != old_mmr:
# Send a message # Send a message
loop.create_task(send_event(s.brawlhalla_new_mmr, player, mmr=mmr, loop.create_task(send_event(s.brawlhalla_new_mmr, player, mmr=mmr, oldmmr=old_mmr))
oldmmr=db[player]["brawlhalla"]["mmr"]))
# Update database # Update database
db[player]["brawlhalla"]["mmr"] = mmr db[player]["brawlhalla"]["mmr"] = mmr
f = open("db.json", "w") f = open("db.json", "w")