def testQuickStart(self): '''测试快速开始''' gameId = 6 userId = 1234 roomId = 0 tableId = 0 chip = 800 clientId = "Android_3.501_tuyoo.YDJD.0-hall6.apphui.happy" onlinedata.setOnlineState(userId, onlinedata.ONLINE) onlinedata.cleanOnlineLoc(userId) userdata.setAttr(userId, "sessionClientId", clientId) # datas = sessiondata._getUserSessionValues(userId) # ftlog.debug("|userId, session:", userId, datas) oldChip = userchip.getChip(userId) userchip.incrChip(userId, gameId, chip - oldChip, 0, "GM_ADJUST_COIN", 0, 0) msg = MsgPack() msg.setCmd("quick_start") msg.setParam("gameId", gameId) msg.setParam("userId", userId) msg.setParam("roomId", roomId) msg.setParam("tableId", tableId) msg.setParam("clientId", clientId) print '=' * 30 print msg DizhuQuickStartDispatcher.dispatchQuickStart(msg) print '=' * 30
def testQuickStart(self): '''测试快速开始''' gameId = 6 userId = random.randint(10000, 20000) roomId = 0 tableId = 0 chip = 800 clientId = "Android_3.501_tuyoo.YDJD.0-hall6.apphui.happy" playMode = "happy" onlinedata.setOnlineState(userId, onlinedata.ONLINE) onlinedata.cleanOnlineLoc(userId) userdata.setAttr(userId, "sessionClientId", clientId) # datas = sessiondata._getUserSessionValues(userId) # ftlog.debug("|userId, session:", userId, datas) oldChip = userchip.getChip(userId) userchip.incrChip(userId, gameId, chip - oldChip, 0, "GM_ADJUST_COIN", 0, clientId) msg = MsgPack() msg.setCmd("quick_start") msg.setParam("gameId", gameId) msg.setParam("userId", userId) # msg.setParam("roomId", roomId) # msg.setParam("tableId", tableId) msg.setParam("clientId", clientId) print '='*30 print msg BaseQuickStartDispatcher.dispatchQuickStart(msg, userId, gameId, roomId, tableId, playMode, clientId) print '='*30
def _enterRoom(self): ftlog.debug('<<', caller=self) self.adjustChip() onlinedata.cleanOnlineLoc(self.userId) mo = MsgPack() mo.setCmdAction('game', 'quick_start') mo.setParam('userId', self.userId) mo.setParam('gameId', self.gameId) mo.setParam('clientId', self.clientId) mo.setParam('roomId', self.bigRoomId) self.writeMsg(mo)
def _enterRoom(self): ftlog.debug('<<', caller=self) self.adjustChip() onlinedata.cleanOnlineLoc(self.userId) mo = MsgPack() mo.setCmdAction('game', 'quick_start') mo.setParam('userId', self.userId) mo.setParam('gameId', self.gameId) mo.setParam('clientId', self.clientId) mo.setParam('roomId', self.bigRoomId) self.writeMsg(mo)
def asyncTest3PlayerMatchWithRobot(self): ftlog.debug("-" * 30) ctrlRoomId = 60121000 # clientId = "Android_3.501_tuyoo.YDJD.0-hall6.apphui.happy" clientId = "Android_3.372_momo.momo.0-hall6.momo.momo" userId1 = random.randint(10000, 20000) onlinedata.setOnlineState(userId1, onlinedata.ONLINE) onlinedata.cleanOnlineLoc(userId1) userdata.setAttr(userId1, "sessionClientId", clientId) bigMatchRoom = gdata.rooms()[ctrlRoomId] bigMatchRoom.doEnter(userId1) bigMatchRoom.doSignin(userId1)
def doGdssCleanOnLineLoc(self): mo = MsgPack() ec, result = self.checkCode() if ec == 0: uids = [] userIds = runhttp.getParamStr('userIds', '') userIds = userIds.split(',') for userId in userIds: try: userId = int(userId) except: pass if userId > 0: onlinedata.cleanOnlineLoc(userId) uids.append(userId) mo.setResult('clean', uids) if ec != 0: mo.setError(ec, result) return mo
def testQuickEnterTable(self): '''测试快速进入桌子''' gameId = 6 userId = 1234 roomId = 60110001 tableId = 1 clientId = "tuyoo_4.0_hall6" onlinedata.setOnlineState(userId, onlinedata.ONLINE) onlinedata.cleanOnlineLoc(userId) msg = MsgPack() msg.setCmd("quick_start") msg.setParam("userId", userId) msg.setParam("roomId", roomId) msg.setParam("tableId", tableId) msg.setParam("clientId", clientId) print '=' * 30 print msg DizhuQuickStartDispatcher.dispatchQuickStart(msg) print '=' * 30
def testQuickEnterTable(self): '''测试快速进入桌子''' gameId = 6 userId = random.randint(10000, 20000) roomId = 60011001 tableId = 1 clientId = "Android_3.501_tuyoo.YDJD.0-hall6.apphui.happy" playMode = "happy" onlinedata.setOnlineState(userId, onlinedata.ONLINE) onlinedata.cleanOnlineLoc(userId) msg = MsgPack() msg.setCmd("quick_start") msg.setParam("userId", userId) msg.setParam("roomId", roomId) msg.setParam("tableId", tableId) msg.setParam("clientId", clientId) print '='*30 print msg BaseQuickStartDispatcher.dispatchQuickStart(msg, userId, gameId, roomId, tableId, playMode, clientId) print '='*30
FTLoopTimer(0.1, 0, _main).start() # 回馈赛添加机器人 # 机器人参加比赛(测试服含机器人总人数不能超过70), SERVERIDS填写:UT9999000001 import json, random from freetime.entity.msg import MsgPack from poker.protocol import router from poker.entity.dao import userdata, gamedata, onlinedata roomId = 441041000 count = 70 for x in xrange(count): userId = 1 + x onlinedata.cleanOnlineLoc(userId) userdata.setSessionData(userId, {"ci": "robot_3.7_-hall6-robot"}) luckyValue = random.randint(1, 10000) rankArr = [] for _ in xrange(5): rankArr.append(random.randint(0,50)) gamedata.setGameAttrs(userId, 44, ["level", "gunSkinId", "userGuideStep","m.44101"], [1, 0, json.dumps([1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2200, 2300]), json.dumps({"bestRank": 1, "bestRankDate": 1523956838, "isGroup": 0, "crownCount": 4, "playCount": 4, "luckyValue": luckyValue, "recentRank": rankArr})]) mo = MsgPack() mo.setCmd("room") mo.setParam("action", "signin") mo.setParam("userId", userId) mo.setParam("gameId", 44) mo.setParam("roomId", roomId) mo.setParam("clientId", "robot_3.7_-hall6-robot") router.sendRoomServer(mo, roomId)