def getClass(player, line): """ Get's the player's choice of character class. """ if line == "" or not line.isdigit(): player.sendLine("Invalid choice, please try again.") askClass(player) return choice = int(line) if choice in character.classes.Classes.keys(): from world.maps import World from character.players import AllPlayers AllPlayers[player.name] = player character.functions.applyClassAttributes(player, choice) player.status = PURGATORY from character.communicate import tellWorld, sendToRoomNotPlayer from world.maps import World tellWorld( player, "Welcome!", "{0} has joined!".format(player.name) ) utils.gameutils.purgatoryHelpMsg(player) else: player.sendLine("Invalid choice, please try again.") askClass(player) return
def spawnPlayer( player ): """ Spawn the player in the map. """ room = random.sample(world.maps.World.roomsList, 1)[0] # Uncomment below to force spawn in a certain room room = "544" player.room = room world.maps.World.mapGrid[room].players[player.name] = player player.status = PLAYING sendToRoomNotPlayer( player, "{0}{1} appears in a flash!{2}".format(BLUE, player, WHITE) ) tellWorld( player, None, "{0} has entered the arena!".format(player.name) ) displayRoom(player, player.room)