From 837df03f05536fd7c4d00f9445f653baa6f15e1c Mon Sep 17 00:00:00 2001 From: Giuseppe Guerra Date: Fri, 4 Aug 2017 00:09:50 +0200 Subject: [PATCH] Fix typo --- constants/fokabotCommands.py | 13 ++++++++++++- objects/match.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/constants/fokabotCommands.py b/constants/fokabotCommands.py index eee8e38..940af93 100644 --- a/constants/fokabotCommands.py +++ b/constants/fokabotCommands.py @@ -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 = 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: diff --git a/objects/match.py b/objects/match.py index d40e721..22ea313 100644 --- a/objects/match.py +++ b/objects/match.py @@ -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