示例#1
0
        # move on to the next one
        if id not in players:
            continue

        # go through all the players in the game
        for pid, pl in players.items():
            # send each player a message to tell them about the diconnected
            # player
            mud.send_message(pid,
                             "{} quit the game".format(players[id]["name"]))

        # remove the player's entry in the player dictionary
        del (players[id])

    # go through any new commands sent from players
    for id, command, params in mud.get_commands():

        # if for any reason the player isn't in the player map, skip them and
        # move on to the next one
        if id not in players:
            continue

        # if the player hasn't given their name yet, use this first command as
        # their name
        if players[id]["name"] is None:

            players[id]["name"] = command

            # go through all the players in the game
            for pid, pl in players.items():
                # send each player a message to tell them about the new player
示例#2
0
        # move on to the next one
        if id not in players:
            continue

        # go through all the players in the game
        for pid, pl in players.items():
            # send each player a message to tell them about the diconnected
            # player
            mud.send_message(pid, "{} quit the game".format(
                                                        players[id]["name"]))

        # remove the player's entry in the player dictionary
        del(players[id])

    # go through any new commands sent from players
    for id, command, params in mud.get_commands():

        # if for any reason the player isn't in the player map, skip them and
        # move on to the next one
        if id not in players:
            continue

        # if the player hasn't given their name yet, use this first command as
        # their name and move them to the starting room.
        if players[id]["name"] is None:

            players[id]["name"] = command
            players[id]["room"] = "Tavern"

            # go through all the players in the game
            for pid, pl in players.items():
示例#3
0
		
		# TODO: IDEA - Some sort of a timer to have the character remain in the game for some time after disconnection?

		# Create a deep copy of fights, iterate through it and remove fights disconnected player was taking part in
		fightsCopy = deepcopy(fights)
		for (fight, pl) in fightsCopy.items():
			if fightsCopy[fight]['s1'] == players[id]['name'] or fightsCopy[fight]['s2'] == players[id]['name']:
				del fights[fight]


		# remove the player's entry in the player dictionary
		del players[id]

	
	# go through any new commands sent from players
	for (id, command, params) in mud.get_commands():
		# if for any reason the player isn't in the player map, skip them and
		# move on to the next one
		if id not in players:
			continue
		
		# print(str(players[id]['authenticated']))
		if command.lower() == "startover" and players[id]['exAttribute0'] != None and players[id]['authenticated'] == None:
			players[id]['idleStart'] = int(time.time())
			mud.send_message(id, "<f220>Ok, Starting character creation from the beginning!\n")
			players[id]['exAttribute0'] = 1000
		
		if command.lower() == "exit" and players[id]['exAttribute0'] != None and players[id]['authenticated'] == None:
			players[id]['idleStart'] = int(time.time())
			mud.send_message(id, "<f220>Ok, leaving the character creation.\n")
			players[id]['exAttribute0'] = None
示例#4
0
        # move on to the next one
        if id not in players:
            continue

        # go through all the players in the game
        for pid, pl in players.items():
            # send each player a message to tell them about the diconnected
            # player
            mud.send_message(pid,
                             "{} quit the game".format(players[id]["name"]))

        # remove the player's entry in the player dictionary
        del (players[id])

    # go through any new commands sent from players
    for id, command, params in mud.get_commands():

        # if for any reason the player isn't in the player map, skip them and
        # move on to the next one
        if id not in players:
            continue

        # if the player hasn't given their name yet, use this first command as
        # their name and move them to the starting room.
        if players[id]["name"] is None:
            if command == "" or str.isdigit(command) or re.match(
                    "[^a-zA-Z0-9_]*$", command):
                mud.send_message(id, "Please enter a valid name...")
                break
            players[id]["name"] = command
            players[id]["room"] = "Tavern"