.BANCHO. Force stop spectating/quit match if user is not spectating or multiplaying

This commit is contained in:
Nyo 2016-09-04 16:24:00 +02:00
parent 255a0958ff
commit 7fc6d4c540
2 changed files with 10 additions and 4 deletions

View File

@ -24,12 +24,12 @@ def handle(userToken, packetData):
packetData = clientPackets.userActionChange(packetData)
# If we are not in spectate status but we're spectating someone, stop spectating
#if userToken.spectating != 0 and userToken.actionID != actions.watching and userToken.actionID != actions.idle and userToken.actionID != actions.afk:
# userToken.stopSpectating()
if userToken.spectating != 0 and userToken.actionID != actions.watching and userToken.actionID != actions.idle and userToken.actionID != actions.afk:
userToken.stopSpectating()
# If we are not in multiplayer but we are in a match, part match
#if userToken.matchID != -1 and userToken.actionID != actions.multiplaying and userToken.actionID != actions.multiplayer and userToken.actionID != actions.afk:
# userToken.partMatch()
if userToken.matchID != -1 and userToken.actionID != actions.multiplaying and userToken.actionID != actions.multiplayer and userToken.actionID != actions.afk:
userToken.partMatch()
# Update cached stats if our pp changedm if we've just submitted a score or we've changed gameMode
if (userToken.actionID == actions.PLAYING or userToken.actionID == actions.MULTIPLAYING) or (userToken.pp != userHelper.getPP(userID, userToken.gameMode)) or (userToken.gameMode != packetData["gameMode"]):

View File

@ -391,6 +391,12 @@ class match:
return -- True if join success, False if fail (room is full)
"""
# Make sure we're not in this match
for i in range(0,16):
if self.slots[i].userID == userID:
# Set bugged slot to free
self.setSlot(i, slotStatuses.free, 0, -1, 0)
# Find first free slot
for i in range(0,16):
if self.slots[i].status == slotStatuses.free: