Example #1
0
  public void setBytes(ChannelBuffer buf) {
    super.setBytes(buf);

    if (this.getValues() != null && this.getValues().size() > 0) {
      this.skillId = this.getIntVaule(0);
      logger.info("ccmd11009  " + this.player.getName() + "   sillId:" + skillId);
    }

    Room r = this.player.getRoom();
    if (r.isInTuoguan(player)) {
      return;
    }

    this.touchedPai = this.player.getTouchedPai();
    int hupai = 0;
    boolean zimo = false;
    if (this.touchedPai == -1) // 放炮
    {
      if (r.getTimeFlag() != Room.TIME_DEALPAI) {
        return;
      }
      boolean flag = checkInDealArray(this.player);
      if (!flag) return;
      this.hu_type = CCMD11009.DIANPAO;
      this.dianpao = r.getCurPlayer();
      // 点炮
      // 抢杠
      hupai = r.getCurPaiId();
    } else // 自摸
    {
      this.hu_type = CCMD11009.ZIMO;
      zimo = true;
      hupai = touchedPai;
    }
    logger.info("ccmd11009   hu:" + this.player.getName() + "   hupaiid:" + hupai);
    //		hupai = 1;
    List<Integer> arr_sp = player.getShoupai();
    arr_sp = MyArrays.sort(arr_sp);
    hu = new Algorithm_Hu();
    hu.hupaiId = hupai;
    hu.isZimo = zimo;
    boolean b = hu.testHu(arr_sp);
    if (b == false) {
      System.out.println("");
    }
    if (hu_type == 0) b = false; // 错误
    if (b) {
      arr_sp.add(hupai);
      player.setShoupai(arr_sp);
      r.waitDeal_back(player, "胡", this);
    } else {
      logger.info("hupai fail  cmd11009:" + this.player.getAllPaiStr());
      CCMD11111 c111 = new CCMD11111();
      c111.auto_deal(this.player, "数据出错,本局已托管! 胡   " + hupai);
      this.player.getRoom().deal_pass(this.player); // 托管的触发:  1. 断线  2前后台数据判断不一致  3.主动托管
      this.player.getRoom().addTuoGuanQueue(player); // 让玩家断线
      //			this.player.closing();									//清理cache中缓存的玩家
      //			MgsCache.getInstance().removeCache(this.player);
    }
  }
Example #2
0
  public void deal_back() {

    logger.info("cmd11009:" + this.player.getAllPaiStr());

    if (this.skillId != -1) {}
    Room r = this.player.getRoom();
    if (r.getCountDapai() == 0 && r.getZhuang() == this.player) this.player.setTianhe(true);
    if (this.player.getCountDapai() == 0 && r.getZhuang() != this.player && r.isTiantingFlag())
      this.player.setDihe(true);
    if (r.getTimeFlag() == Room.TIME_QIANGGANGHU) this.player.setQianggang(true);

    // 保存在player中, 胡牌类型
    if (this.hu_type == CCMD11009.DIANPAO) {
      this.player.getHuMap().put(CCMD11009.DIANPAO, this.dianpao);
      this.player.getRoom().checkTask.checkTaskAtterHuPai(dianpao, CheckTask.TASK_DIANPAO);
    }
    r.lastHuPai = this.hu.hupaiId;
    r.hupai(this.player, hu);
  }