.BANCHO. Send userPanel and userStats packets to restricted users
This commit is contained in:
parent
d957356f67
commit
799fe7dc25
|
@ -84,12 +84,12 @@ def onlineUsers():
|
||||||
def userLogout(userID):
|
def userLogout(userID):
|
||||||
return packetHelper.buildPacket(packetIDs.server_userLogout, [[userID, dataTypes.sInt32], [0, dataTypes.byte]])
|
return packetHelper.buildPacket(packetIDs.server_userLogout, [[userID, dataTypes.sInt32], [0, dataTypes.byte]])
|
||||||
|
|
||||||
def userPanel(userID):
|
def userPanel(userID, force = False):
|
||||||
# Connected and restricted check
|
# Connected and restricted check
|
||||||
userToken = glob.tokens.getTokenFromUserID(userID)
|
userToken = glob.tokens.getTokenFromUserID(userID)
|
||||||
if userToken == None:
|
if userToken == None:
|
||||||
return bytes()
|
return bytes()
|
||||||
if userToken.restricted == True:
|
if userToken.restricted == True and force == False:
|
||||||
return bytes()
|
return bytes()
|
||||||
|
|
||||||
# Get user data
|
# Get user data
|
||||||
|
@ -126,12 +126,12 @@ def userPanel(userID):
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
def userStats(userID):
|
def userStats(userID, force = False):
|
||||||
# Get userID's token from tokens list
|
# Get userID's token from tokens list
|
||||||
userToken = glob.tokens.getTokenFromUserID(userID)
|
userToken = glob.tokens.getTokenFromUserID(userID)
|
||||||
if userToken == None:
|
if userToken == None:
|
||||||
return bytes() # NOTE: ???
|
return bytes() # NOTE: ???
|
||||||
if userToken.restricted == True:
|
if userToken.restricted == True and force == False:
|
||||||
return bytes()
|
return bytes()
|
||||||
# Stats are cached in token object
|
# Stats are cached in token object
|
||||||
#rankedScore = userHelper.getRankedScore(userID, userToken.gameMode)
|
#rankedScore = userHelper.getRankedScore(userID, userToken.gameMode)
|
||||||
|
|
|
@ -49,12 +49,10 @@ def handle(userToken, packetData):
|
||||||
token = glob.tokens.getTokenFromUserID(i)
|
token = glob.tokens.getTokenFromUserID(i)
|
||||||
|
|
||||||
if token != None:
|
if token != None:
|
||||||
token.enqueue(serverPackets.userPanel(userID))
|
# Force our own packet
|
||||||
token.enqueue(serverPackets.userStats(userID))
|
force = True if token.userID == userID else False
|
||||||
|
token.enqueue(serverPackets.userPanel(userID, force))
|
||||||
# TODO: Enqueue all if we've changed game mode, (maybe not needed because it's cached)
|
token.enqueue(serverPackets.userStats(userID, force))
|
||||||
#glob.tokens.enqueueAll(serverPackets.userPanel(userID))
|
|
||||||
#glob.tokens.enqueueAll(serverPackets.userStats(userID))
|
|
||||||
|
|
||||||
# Send osu!direct alert if needed
|
# Send osu!direct alert if needed
|
||||||
# NOTE: Remove this when osu!direct will be fixed
|
# NOTE: Remove this when osu!direct will be fixed
|
||||||
|
|
Loading…
Reference in New Issue
Block a user