def room(client, params): if params: try: id = int(params[0]) except ValueError: id = get_room_id(params[0]) if not id: print "Room not found" return client.join_room(id) else: print "Current room: " + get_room_name(client.room_id)
def room(clients, params): if params: try: id = int(params[0]) except ValueError: id = login.get_room_id(params[0]) if not id: print "Room not found" return for client in clients: client.join_room(id) else: print "An argument is required"
# as host python client_example.py # as member python client_example.py --join """ if __name__ == '__main__': connect(ENDPOINT) global started started = False room_name = 'AAA' is_host = not (len(sys.argv) >= 2 and sys.argv[1] == '--join') if is_host: create_room(room_name) else: join_room(room_name) if is_host: print('matching 10s ...') time.sleep(10) game_start(room_name) else: while not started: print('waiting start ... %s' % started) time.sleep(1) i = 5 while i > 0: i -= 1 move(input())
import json import client import login from time import sleep if __name__ == "__main__": cpps = "PL" data = login.get_server(cpps) user = raw_input("Username: "******"Server: ").lower() ip = data["ip"] login_port = data["login"] game_port = data["servers"] if not server in game_port: sys.exit("Server not found") game_port = game_port[server] client = client.Client(ip, login_port, game_port, True) if not client.log: print "Connecting..." error = client.connect(user, password, encrypted) if error: sys.exit("Failed to connect") print "Connected!" client.join_room(811) client.add_coins(16000000) for i in xrange(1, 50000): client.add_furniture(i)