This commit is contained in:
Giuseppe Guerra 2017-08-04 00:09:50 +02:00
parent c2a2d9c97b
commit 837df03f05
2 changed files with 13 additions and 2 deletions

View File

@ -781,7 +781,7 @@ def multiplayer(fro, chan, message):
matchID = int(message[1])
userToken = glob.tokens.getTokenFromUsername(fro, ignoreIRC=True)
userToken.joinMatch(matchID)
return "Joined match #{}!".format(matchID)
return "Attempting to join match #{}!".format(matchID)
def mpClose():
myToken = glob.tokens.getTokenFromUsername(fro)
@ -813,6 +813,16 @@ def multiplayer(fro, chan, message):
_match.toggleSlotLocked(i)
return "Match size changed to {}".format(matchSize)
def mpMove():
if len(message) < 3 or not message[2].isdigit() or int(message[2]) < 0 or int(message[2]) > 16:
raise exceptions.invalidArgumentsException("Wrong syntax: !mp move <username> <slot>")
username = message[1]
newSlotID = int(message[2])
userID = userUtils.getIDSafe(username)
_match = glob.matches.matches[getMatchIDFromChannel(chan)]
_match.userChangeSlot(userID, newSlotID)
return "Player {} moved to slot {}".format(username, newSlotID)
try:
subcommands = {
"make": mpMake,
@ -821,6 +831,7 @@ def multiplayer(fro, chan, message):
"lock": mpLock,
"unlock": mpUnlock,
"size": mpSize,
"move": mpMove,
}
requestedSubcommand = message[0].lower().strip()
if requestedSubcommand not in subcommands:

View File

@ -498,7 +498,7 @@ class match:
return
# Make sure there is no one inside new slot
if self.slots[newSlotID].user is not None and self.slots[newSlotID].status != slotStatuses.FREE:
if self.slots[newSlotID].user is not None or self.slots[newSlotID].status != slotStatuses.FREE:
return
# Get old slot data