示例#1
0
	def cmd_create_room(self, args):
		print "creating room"


		blind		= int(args["blind"])
		max_stake	= int(args["max_stake"])
		min_stake	= int(args["min_stake"])
		max_player	= int(args["max_player"])
		routing_key = args['source']
		roomType	= int(args["roomType"])


		newRoom = Room.new(self.exchange,blind,max_player,
				max_stake,
				min_stake,roomType)

		self.room_list[newRoom.id] = GameRoom(
				newRoom, args["user_id"], self,
				max_player,blind,min_stake,max_stake)
		print newRoom
		message = {"room_id":newRoom.id}

		self.channel.basic_publish( exchange    = self.exchange,
				routing_key = routing_key,
				body        = json.dumps(message))

		self.info.rooms += 1
示例#2
0
    def handle_init_file(self, fname, isDebug):
        info = Room.find_all(exchange=self.exchange)
        for room in info:
            room.remove()

    #	if os.path.isfile(fname):
        print len(fname)
        print os.getcwd()
        with open(fname) as f:
            for line in f:
                if line[0] == '#':
                    continue

                (roomType, blind, max_stake, min_stake,
                 max_player) = (int(x) for x in line.strip().split(','))

                newRoom = Room.new(self.exchange, blind, max_player, max_stake,
                                   min_stake, roomType)
                self.room_list[newRoom.id] = GameRoom(newRoom, 1, self,
                                                      max_player, blind,
                                                      min_stake, max_stake)
                self.info.rooms += 1
                print newRoom
示例#3
0
    def cmd_create_room(self, args):
        print "creating room"

        blind = int(args["blind"])
        max_stake = int(args["max_stake"])
        min_stake = int(args["min_stake"])
        max_player = int(args["max_player"])
        routing_key = args['source']
        roomType = int(args["roomType"])

        newRoom = Room.new(self.exchange, blind, max_player, max_stake,
                           min_stake, roomType)

        self.room_list[newRoom.id] = GameRoom(newRoom, args["user_id"], self,
                                              max_player, blind, min_stake,
                                              max_stake)
        print newRoom
        message = {"room_id": newRoom.id}

        self.channel.basic_publish(exchange=self.exchange,
                                   routing_key=routing_key,
                                   body=json.dumps(message))

        self.info.rooms += 1
示例#4
0
	def handle_init_file(self,fname,isDebug):
		info = Room.find_all(exchange = self.exchange)
		for room in info:
			room.remove()


	#	if os.path.isfile(fname):
		print len(fname)
		print os.getcwd()
		with open(fname) as f:
			for line in f:
				if line[0] == '#':
					continue

				(roomType,blind,max_stake,min_stake,max_player) = ( int(x) for x in line.strip().split(','))

				newRoom = Room.new(self.exchange,blind,max_player,
						max_stake,
						min_stake,roomType)
				self.room_list[newRoom.id] = GameRoom(
						newRoom, 1, self,
						max_player, blind, min_stake, max_stake)
				self.info.rooms += 1
				print newRoom