Send the api fail info and teams too when a mp match finishes.
This commit is contained in:
parent
aa1887e2c4
commit
5f279da6cf
|
@ -27,6 +27,7 @@ def handle(userToken, packetData):
|
||||||
|
|
||||||
# Update the score
|
# Update the score
|
||||||
match.updateScore(slotID, data["totalScore"])
|
match.updateScore(slotID, data["totalScore"])
|
||||||
|
match.updateHP(slotID, data["currentHp"])
|
||||||
|
|
||||||
# Enqueue frames to who's playing
|
# Enqueue frames to who's playing
|
||||||
glob.streams.broadcast(match.playingStreamName, serverPackets.matchFrames(slotID, packetData))
|
glob.streams.broadcast(match.playingStreamName, serverPackets.matchFrames(slotID, packetData))
|
|
@ -23,6 +23,8 @@ class slot:
|
||||||
self.skip = False
|
self.skip = False
|
||||||
self.complete = False
|
self.complete = False
|
||||||
self.score = 0
|
self.score = 0
|
||||||
|
self.failed = False
|
||||||
|
self.passed = True
|
||||||
|
|
||||||
class match:
|
class match:
|
||||||
def __init__(self, matchID, matchName, matchPassword, beatmapID, beatmapName, beatmapMD5, gameMode, hostUserID, isTourney=False):
|
def __init__(self, matchID, matchName, matchPassword, beatmapID, beatmapName, beatmapMD5, gameMode, hostUserID, isTourney=False):
|
||||||
|
@ -339,6 +341,16 @@ class match:
|
||||||
"""
|
"""
|
||||||
self.slots[slotID].score = score
|
self.slots[slotID].score = score
|
||||||
|
|
||||||
|
def updateHP(self, slotID, hp):
|
||||||
|
"""
|
||||||
|
Update HP for a slot
|
||||||
|
|
||||||
|
:param slotID: the slot that the user that is updating their hp is in
|
||||||
|
:param hp: the new hp to update
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
self.slots[slotID].failed = True if hp == 254 else False
|
||||||
|
|
||||||
def playerCompleted(self, userID):
|
def playerCompleted(self, userID):
|
||||||
"""
|
"""
|
||||||
Set userID's slot completed to True
|
Set userID's slot completed to True
|
||||||
|
@ -386,7 +398,10 @@ class match:
|
||||||
if self.slots[i].user is not None and self.slots[i].status == slotStatuses.PLAYING:
|
if self.slots[i].user is not None and self.slots[i].status == slotStatuses.PLAYING:
|
||||||
infoToSend["scores"][glob.tokens.tokens[self.slots[i].user].userID] = {
|
infoToSend["scores"][glob.tokens.tokens[self.slots[i].user].userID] = {
|
||||||
"score": self.slots[i].score,
|
"score": self.slots[i].score,
|
||||||
"mods": self.slots[i].mods
|
"mods": self.slots[i].mods,
|
||||||
|
"failed": self.slots[i].failed,
|
||||||
|
"pass": self.slots[i].passed,
|
||||||
|
"team": self.slots[i].team
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send the info to the api
|
# Send the info to the api
|
||||||
|
@ -419,6 +434,8 @@ class match:
|
||||||
self.slots[i].skip = False
|
self.slots[i].skip = False
|
||||||
self.slots[i].complete = False
|
self.slots[i].complete = False
|
||||||
self.slots[i].score = 0
|
self.slots[i].score = 0
|
||||||
|
self.slots[i].failed = False
|
||||||
|
self.slots[i].passed = True
|
||||||
|
|
||||||
def getUserSlotID(self, userID):
|
def getUserSlotID(self, userID):
|
||||||
"""
|
"""
|
||||||
|
@ -612,6 +629,8 @@ class match:
|
||||||
if slotID is None:
|
if slotID is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.slots[slotID].passed = False
|
||||||
|
|
||||||
# Send packet to everyone
|
# Send packet to everyone
|
||||||
glob.streams.broadcast(self.playingStreamName, serverPackets.playerFailed(slotID))
|
glob.streams.broadcast(self.playingStreamName, serverPackets.playerFailed(slotID))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user