.BANCHO. Add support for tournament client
This commit is contained in:
@@ -104,8 +104,10 @@ def handle(tornadoRequest):
|
||||
userUtils.logIP(userID, requestIP)
|
||||
|
||||
# Delete old tokens for that user and generate a new one
|
||||
glob.tokens.deleteOldTokens(userID)
|
||||
responseToken = glob.tokens.addToken(userID, requestIP, timeOffset=timeOffset)
|
||||
isTournament = "tourney" in osuVersion
|
||||
if not isTournament:
|
||||
glob.tokens.deleteOldTokens(userID)
|
||||
responseToken = glob.tokens.addToken(userID, requestIP, timeOffset=timeOffset, tournament=isTournament)
|
||||
responseTokenString = responseToken.token
|
||||
|
||||
# Check restricted mode (and eventually send message)
|
||||
@@ -205,7 +207,7 @@ def handle(tornadoRequest):
|
||||
if userUtils.getCountry(userID) == "XX":
|
||||
userUtils.setCountry(userID, countryLetters)
|
||||
|
||||
# Send to everyone our userpanel if we are not restricted
|
||||
# Send to everyone our userpanel if we are not restricted or tournament
|
||||
if not responseToken.restricted:
|
||||
glob.streams.broadcast("main", serverPackets.userPanel(userID))
|
||||
|
||||
|
11
events/tournamentJoinMatchChannelEvent.py
Normal file
11
events/tournamentJoinMatchChannelEvent.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
from helpers import chatHelper as chat
|
||||
|
||||
def handle(userToken, packetData):
|
||||
packetData = clientPackets.tournamentJoinMatchChannel(packetData)
|
||||
matchID = packetData["matchID"]
|
||||
if matchID not in glob.matches.matches:
|
||||
return
|
||||
userToken.matchID = matchID
|
||||
chat.joinChannel(token=userToken, channel="#multi_{}".format(matchID))
|
11
events/tournamentLeaveMatchChannelEvent.py
Normal file
11
events/tournamentLeaveMatchChannelEvent.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from constants import clientPackets
|
||||
from objects import glob
|
||||
from helpers import chatHelper as chat
|
||||
|
||||
def handle(userToken, packetData):
|
||||
packetData = clientPackets.tournamentLeaveMatchChannel(packetData)
|
||||
matchID = packetData["matchID"]
|
||||
if matchID not in glob.matches.matches:
|
||||
return
|
||||
chat.partChannel(token=userToken, channel="#multi_{}".format(matchID))
|
||||
userToken.matchID = 0
|
10
events/tournamentMatchInfoRequestEvent.py
Normal file
10
events/tournamentMatchInfoRequestEvent.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from constants import clientPackets
|
||||
from constants import serverPackets
|
||||
from objects import glob
|
||||
|
||||
def handle(userToken, packetData):
|
||||
packetData = clientPackets.tournamentMatchInfoRequest(packetData)
|
||||
matchID = packetData["matchID"]
|
||||
if matchID not in glob.matches.matches:
|
||||
return
|
||||
userToken.enqueue(serverPackets.updateMatch(matchID))
|
Reference in New Issue
Block a user