.BANCHO. Force stop spectating/quit match if user is not spectating or multiplaying
This commit is contained in:
parent
255a0958ff
commit
7fc6d4c540
|
@ -24,12 +24,12 @@ def handle(userToken, packetData):
|
||||||
packetData = clientPackets.userActionChange(packetData)
|
packetData = clientPackets.userActionChange(packetData)
|
||||||
|
|
||||||
# If we are not in spectate status but we're spectating someone, stop spectating
|
# 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:
|
if userToken.spectating != 0 and userToken.actionID != actions.watching and userToken.actionID != actions.idle and userToken.actionID != actions.afk:
|
||||||
# userToken.stopSpectating()
|
userToken.stopSpectating()
|
||||||
|
|
||||||
# If we are not in multiplayer but we are in a match, part match
|
# 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:
|
if userToken.matchID != -1 and userToken.actionID != actions.multiplaying and userToken.actionID != actions.multiplayer and userToken.actionID != actions.afk:
|
||||||
# userToken.partMatch()
|
userToken.partMatch()
|
||||||
|
|
||||||
# Update cached stats if our pp changedm if we've just submitted a score or we've changed gameMode
|
# 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"]):
|
if (userToken.actionID == actions.PLAYING or userToken.actionID == actions.MULTIPLAYING) or (userToken.pp != userHelper.getPP(userID, userToken.gameMode)) or (userToken.gameMode != packetData["gameMode"]):
|
||||||
|
|
|
@ -391,6 +391,12 @@ class match:
|
||||||
return -- True if join success, False if fail (room is full)
|
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
|
# Find first free slot
|
||||||
for i in range(0,16):
|
for i in range(0,16):
|
||||||
if self.slots[i].status == slotStatuses.free:
|
if self.slots[i].status == slotStatuses.free:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user