def createClub(self, club_name, create_dict): DEBUG_MSG("create club name = {} args = {}".format( club_name, create_dict)) game_round = create_dict['game_round'] lucky_num = create_dict['lucky_num'] hand_prepare = create_dict['hand_prepare'] pay_mode = create_dict['pay_mode'] room_type = create_dict['room_type'] if game_round not in const.ROUND \ or lucky_num not in const.LUCKY_NUM \ or pay_mode not in (const.NORMAL_PAY_MODE, const.AA_PAY_MODE, const.CLUB_PAY_MODE) \ or room_type not in (const.NORMAL_ROOM, const.CLUB_ROOM) \ or hand_prepare not in const.PREPARE_MODE: self.clubOperationFailed(const.CLUB_OP_ERR_WRONG_ARGS) return # 检查代理创建茶楼的权限 if not self.isAgent: self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) return if len(self.clubList) >= const.CLUB_NUM_LIMIT: self.clubOperationFailed(const.CLUB_OP_ERR_NUM_LIMIT) return # @formatter:off room_params = { 'owner_uid': self.userId, 'king_num': 1, 'player_num': 4, 'game_round': game_round, 'pay_mode': pay_mode, 'lucky_num': lucky_num, 'hand_prepare': hand_prepare, 'room_type': room_type, } def query_cb(club_name, room_params, content): res = False DEBUG_MSG("query proxy cb: {}".format(content)) try: ret = json.loads(content) if ret['errcode'] == 0 and ret['is_proxy']: res = True except: import traceback ERROR_MSG(traceback.format_exc()) finally: if res: self.isAgent = 1 x42.ClubStub.createClub(self, club_name, room_params) else: self.isAgent = 0 self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) if switch.DEBUG_BASE == 0: utility.get_is_proxy(self.accountName, Functor(query_cb, club_name, room_params)) else: x42.ClubStub.createClub(self, club_name, room_params)
def createClub(self, club_name, create_dict): DEBUG_MSG("create club name = {} args = {}".format( club_name, create_dict)) game_mode = create_dict['game_mode'] king_mode = create_dict['king_mode'] reward = create_dict['reward'] add_dealer = create_dict['add_dealer'] game_round = create_dict['game_round'] hand_prepare = create_dict['hand_prepare'] pay_mode = create_dict['pay_mode'] room_type = const.CLUB_ROOM if game_mode not in const.GAME_MODE \ or king_mode not in const.KING_MODE \ or reward not in const.REWARD_MODE \ or add_dealer not in const.ADD_DEALER \ or game_round not in const.GAME_ROUND \ or hand_prepare not in const.PREPARE_MODE \ or pay_mode not in (const.CLUB_PAY_MODE, const.AA_PAY_MODE) \ or room_type not in const.OPEN_ROOM_MODE: self.clubOperationFailed(const.CLUB_OP_ERR_WRONG_ARGS) return # 检查代理创建茶楼的权限 if not self.isAgent: self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) return if len(self.clubList) >= const.CLUB_NUM_LIMIT: self.clubOperationFailed(const.CLUB_OP_ERR_NUM_LIMIT) return room_params = { # 基本必填信息 'owner_uid': self.userId, 'king_num': 0 if game_mode <= 1 else 1, 'player_num': 4, 'lucky_num': 0, # client 2 svr 'game_mode': game_mode, 'king_mode': king_mode, 'reward': reward, 'add_dealer': add_dealer, 'game_round': game_round, 'hand_prepare': hand_prepare, 'pay_mode': pay_mode, 'room_type': room_type, } def query_cb(club_name, room_params, content): res = False DEBUG_MSG("query proxy cb: {}".format(content)) try: ret = json.loads(content) if ret['errcode'] == 0 and ret['is_proxy']: res = True except: import traceback ERROR_MSG(traceback.format_exc()) finally: if res: self.isAgent = 1 x42.ClubStub.createClub(self, club_name, room_params) else: self.isAgent = 0 self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) if switch.DEBUG_BASE == 0: utility.get_is_proxy(self.accountName, Functor(query_cb, club_name, room_params)) else: x42.ClubStub.createClub(self, club_name, room_params)
def createClub(self, club_name, create_dict): DEBUG_MSG("create club name = {} args = {}".format( club_name, create_dict)) game_mode = create_dict['game_mode'] base_score = create_dict['base_score'] play_list = create_dict['play_list'] round_max_lose = create_dict['round_max_lose'] game_max_lose = create_dict['game_max_lose'] game_round = create_dict['game_round'] hand_prepare = create_dict['hand_prepare'] pay_mode = create_dict['pay_mode'] room_type = const.CLUB_ROOM if game_mode not in const.GAME_MODE \ or base_score not in const.BASE_SCORE \ or len(play_list) != 6 \ or play_list[0] not in const.KING_MODE \ or play_list[1] not in const.BEGIN_DEALER_MUL \ or play_list[2] not in const.WIN_MODE \ or play_list[3] not in const.THREE_JOB \ or play_list[4] not in const.PONG_USEFUL \ or play_list[5] not in const.BAO_TOU \ or round_max_lose not in const.ROUND_MAX_LOSE \ or game_max_lose not in const.GAME_MAX_LOSE \ or game_round not in const.GAME_ROUND \ or hand_prepare not in const.PREPARE_MODE \ or pay_mode not in (const.CLUB_PAY_MODE, const.AA_PAY_MODE) \ or room_type not in const.OPEN_ROOM_MODE: self.clubOperationFailed(const.CLUB_OP_ERR_WRONG_ARGS) return # 检查代理创建茶楼的权限 if not self.isAgent: self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) return if len(self.clubList) >= const.CLUB_NUM_LIMIT: self.clubOperationFailed(const.CLUB_OP_ERR_NUM_LIMIT) return room_params = { # 基本必填信息 'owner_uid': self.userId, 'king_num': 1, 'player_num': 4, 'lucky_num': 0, # client 2 svr 'game_mode': game_mode, 'base_score': base_score if game_mode == 0 else 1, 'king_mode': play_list[0], 'begin_dealer_mul': play_list[1], 'win_mode': play_list[2], 'three_job': play_list[3], 'pong_useful': play_list[4], 'bao_tou': play_list[5], 'round_max_lose': round_max_lose if game_mode == 0 else 0, 'game_max_lose': game_max_lose if game_mode == 1 else 999999, 'game_round': game_round if game_mode == 0 else 999999, 'hand_prepare': hand_prepare, 'pay_mode': pay_mode, 'room_type': room_type, } def query_cb(club_name, room_params, content): res = False DEBUG_MSG("query proxy cb: {}".format(content)) try: ret = json.loads(content) if ret['errcode'] == 0 and ret['is_proxy']: res = True except: import traceback ERROR_MSG(traceback.format_exc()) finally: if res: self.isAgent = 1 x42.ClubStub.createClub(self, club_name, room_params) else: self.isAgent = 0 self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) if switch.DEBUG_BASE == 0: utility.get_is_proxy(self.accountName, Functor(query_cb, club_name, room_params)) else: x42.ClubStub.createClub(self, club_name, room_params)
def createClub(self, club_name, create_dict): DEBUG_MSG("create club name = {} args = {}".format( club_name, create_dict)) game_round = create_dict['game_round'] game_mode = create_dict['game_mode'] player_num = create_dict['player_num'] hand_prepare = create_dict['hand_prepare'] op_seconds = create_dict['op_seconds'] room_type = create_dict['room_type'] pay_mode = create_dict['pay_mode'] max_boom_times = create_dict['max_boom_times'] if game_round not in const.GAME_ROUND \ or game_mode not in const.GAME_MODE \ or max_boom_times not in const.MAX_BOOM_TIMES \ or player_num != 3 \ or hand_prepare not in const.PREPARE_MODE \ or op_seconds not in const.OP_SECONDS \ or pay_mode not in (const.CLUB_PAY_MODE, const.AA_PAY_MODE) \ or room_type not in const.OPEN_ROOM_MODE: return # 检查代理创建茶楼的权限 if not self.isAgent: self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) return if len(self.clubList) >= const.CLUB_NUM_LIMIT: self.clubOperationFailed(const.CLUB_OP_ERR_NUM_LIMIT) return room_params = { # 基本必填信息 'owner_uid': self.userId, 'player_num': player_num, # client 2 svr 'game_mode': game_mode, 'op_seconds': op_seconds, 'max_boom_times': max_boom_times, 'game_max_lose': 999999, 'game_round': game_round, 'hand_prepare': hand_prepare, 'pay_mode': pay_mode, 'room_type': room_type, } def query_cb(club_name, room_params, content): res = False DEBUG_MSG("query proxy cb: {}".format(content)) try: ret = json.loads(content) if ret['errcode'] == 0 and ret['is_proxy']: res = True except: import traceback ERROR_MSG(traceback.format_exc()) finally: if res: self.isAgent = 1 x42.ClubStub.createClub(self, club_name, room_params) else: self.isAgent = 0 self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) if switch.DEBUG_BASE == 0: utility.get_is_proxy(self.accountName, Functor(query_cb, club_name, room_params)) else: x42.ClubStub.createClub(self, club_name, room_params)
def createClub(self, club_name, create_dict): DEBUG_MSG("create club name = {} args = {}".format( club_name, create_dict)) game_mode = create_dict['game_mode'] pay_mode = create_dict['pay_mode'] king_mode = create_dict['king_mode'] game_round = create_dict['game_round'] round_mode = create_dict['round_mode'] base_score_mode = create_dict['base_score_mode'] max_lose = create_dict['max_lose'] score = create_dict['score'] job = create_dict['job'] discard_seconds = create_dict['discard_seconds'] hand_prepare = create_dict['hand_prepare'] room_type = const.CLUB_ROOM if game_mode not in const.GAME_MODE \ or pay_mode not in (const.CLUB_PAY_MODE, const.AA_PAY_MODE) \ or game_round not in const.ROUND \ or king_mode not in const.KING_MODES \ or round_mode not in const.ROUND_MODE \ or base_score_mode not in const.BASE_SCORE_MODE \ or max_lose not in const.MAX_LOSE \ or score not in const.GAME_SCORE \ or job not in const.JOB_MODE \ or discard_seconds not in const.DISCARD_SECONDS \ or hand_prepare not in const.PREPARE_MODE \ or room_type not in (const.CLUB_ROOM,): self.clubOperationFailed(const.CLUB_OP_ERR_WRONG_ARGS, ) return game_round = game_round if round_mode == const.ROUND_MODE_SCORE: game_round = 9999 # 检查代理创建茶楼的权限 if not self.isAgent: self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) return if len(self.clubList) >= const.CLUB_NUM_LIMIT: self.clubOperationFailed(const.CLUB_OP_ERR_NUM_LIMIT) return room_params = { # 基本必填信息 'owner_uid': self.userId, 'king_num': 1, 'player_num': 4, 'lucky_num': 0, # client 2 svr 'game_mode': game_mode, 'pay_mode': pay_mode, 'king_mode': king_mode, 'game_round': game_round, 'round_mode': round_mode, 'base_score_mode': base_score_mode, 'max_lose': max_lose, 'score': score, 'job': job, 'discard_seconds': discard_seconds, 'hand_prepare': hand_prepare, 'room_type': room_type, } def query_cb(club_name, room_params, content): res = False DEBUG_MSG("query proxy cb: {}".format(content)) try: ret = json.loads(content) if ret['errcode'] == 0 and ret['is_proxy']: res = True except: import traceback ERROR_MSG(traceback.format_exc()) finally: if res: self.isAgent = 1 x42.ClubStub.createClub(self, club_name, room_params) else: self.isAgent = 0 self.clubOperationFailed(const.CLUB_OP_ERR_PERMISSION_DENY) if switch.DEBUG_BASE == 0: utility.get_is_proxy(self.accountName, Functor(query_cb, club_name, room_params)) else: x42.ClubStub.createClub(self, club_name, room_params)