use of com.code.server.game.poker.robot.ResponseRobotVo in project summer by foxsugar.
the class DouDiZhuGoldRobot method play.
@Override
public void play(GameDouDiZhu game) {
PlayerCardInfoDouDiZhu playerInfo = game.getPlayerCardInfos().get(game.playTurn);
if (playerInfo.cards.size() == 0) {
return;
}
if (game.lastCardStruct == null || game.playTurn == game.lastCardStruct.getUserId()) {
CardStruct cardStruct = new CardStruct();
cardStruct.type = 1;
cardStruct.dan = game.getPlayerCardInfos().get(game.getPlayTurn()).MinimumCards();
cardStruct.cards = game.getPlayerCardInfos().get(game.getPlayTurn()).MinimumCards();
cardStruct.setUserId(game.getPlayTurn());
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setUserId(game.getPlayTurn());
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
// {"service":"gameService","method":"play","params":{"cards":{"userId":"5","cards":[12],"type":1,"dan":[12]}}}
Map<String, Object> put = new HashMap<>();
put.put("cards", cardStruct);
ResponseRobotVo result = new ResponseRobotVo("gameService", "play", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
} else {
pass(game);
}
}
use of com.code.server.game.poker.robot.ResponseRobotVo in project summer by foxsugar.
the class DouDiZhuGoldRobot method qiangDizhu.
@Override
public void qiangDizhu(GameDouDiZhu game) {
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setUserId(game.canQiangUser);
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
// 按service的名字 分topic
// {"service":"gameService","method":"qiangDizhu","params":{"isQiang":false}}
Map<String, Object> put = new HashMap<>();
put.put("isQiang", false);
ResponseRobotVo result = new ResponseRobotVo("gameService", "qiangDizhu", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
}
use of com.code.server.game.poker.robot.ResponseRobotVo in project summer by foxsugar.
the class TTZRobot method open.
@Override
public void open(GameTuiTongZi game) {
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
Map<String, Object> put = new HashMap();
for (PlayerTuiTongZi p : game.getPlayerCardInfos().values()) {
if (!p.isOpen()) {
msgKey.setUserId(p.getUserId());
put.put("userId", p.getUserId());
}
}
ResponseRobotVo result = new ResponseRobotVo("gameService", "open", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
}
use of com.code.server.game.poker.robot.ResponseRobotVo in project summer by foxsugar.
the class TTZRobot method crap.
@Override
public void crap(GameTuiTongZi game) {
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
Map<String, Object> put = new HashMap();
for (PlayerTuiTongZi p : game.getPlayerCardInfos().values()) {
if (p.getUserId() == game.room.getBankerId()) {
msgKey.setUserId(p.getUserId());
put.put("userId", p.getUserId());
}
}
ResponseRobotVo result = new ResponseRobotVo("gameService", "crap", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
}
use of com.code.server.game.poker.robot.ResponseRobotVo in project summer by foxsugar.
the class TTZRobot method getReady.
@Override
public void getReady(RoomTuiTongZi room) {
String roomId = room.getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
for (Long l : room.getUserStatus().keySet()) {
if (0 == room.getUserStatus().get(l)) {
msgKey.setUserId(l);
}
}
Map<String, Object> put = new HashMap();
ResponseRobotVo result = new ResponseRobotVo("roomService", "getReady", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("roomService", partition, msgKey, result);
}
Aggregations