@Override
 public Message execute(ActionContext context, C1753_QualifyChallengeReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   String[] infos = this.getHeroInfos(reqMsg.getInfo());
   if (null == infos || infos.length < INFO_LENGTH) {
     C0002_ErrorRespMessage message = new C0002_ErrorRespMessage();
     message.setInfo(GameContext.getI18n().getText(TextId.ERROR_INPUT));
     return message;
   }
   Result result =
       GameContext.getQualifyApp().qualifyChallenge(role, infos[0], this.isConfirm(infos[1]));
   if (result.isIgnore()) {
     return null;
   }
   if (!result.isSuccess()) {
     C0002_ErrorRespMessage message = new C0002_ErrorRespMessage();
     message.setInfo(result.getInfo());
     return message;
   }
   C0003_TipNotifyMessage message = new C0003_TipNotifyMessage();
   message.setMsgContext(result.getInfo());
   return message;
 }
Exemplo n.º 2
0
  private boolean boxed(
      RoleInstance role, List<GoodsOperateBean> goodsList, int x, int y, OutputConsumeType ocType) {
    if (Util.isEmpty(goodsList)) {
      return false;
    }
    // 未拾取完毕的物品直接掉落背包
    // 将未放入背包的物品(背包已满)放入box
    BoxEntry box = new BoxEntry(role, goodsList, this.getBoxId(), x, y, ocType.getType());
    box.cache();
    box.notifyOwner();

    C0003_TipNotifyMessage tipNotifyMsg = new C0003_TipNotifyMessage();
    tipNotifyMsg.setMsgContext(Status.GOODS_BACKPACK_FULL_TIPS.getTips());
    role.getBehavior().sendMessage(tipNotifyMsg);

    return true;
  }
Exemplo n.º 3
0
  private AddGoodsBeanResult fallMail(
      RoleInstance role, List<GoodsOperateBean> addList, OutputConsumeType ocType) {
    if (role == null) {
      return new AddGoodsBeanResult().setInfo(GameContext.getI18n().getText(TextId.SYSTEM_ERROR));
    }

    if (Util.isEmpty(addList)) {
      return new AddGoodsBeanResult().success();
    }

    // 大于等于此品质发邮件
    byte mailQualityType = GameContext.getParasConfig().getSendMailQualityType();
    AddGoodsBeanResult result = new AddGoodsBeanResult();
    List<GoodsOperateBean> sendMailList = new ArrayList<GoodsOperateBean>();
    for (GoodsOperateBean bean : addList) {
      if (null == bean) {
        continue;
      }
      GoodsBase gb = GameContext.getGoodsApp().getGoodsBase(bean.getGoodsId());
      if (null == gb) {
        continue;
      }
      if (gb.getQualityType() >= mailQualityType) {
        sendMailList.add(bean);
        continue;
      }
      result.getPutFailureList().add(bean);
    }

    if (Util.isEmpty(sendMailList)) {
      return result;
    }
    // 发送邮件
    this.sendGoodsByMail(role, sendMailList, ocType);

    C0003_TipNotifyMessage tipNotifyMsg = new C0003_TipNotifyMessage();
    tipNotifyMsg.setMsgContext(GameContext.getI18n().getText(TextId.FALL_MAIL_TIPS));
    role.getBehavior().sendMessage(tipNotifyMsg);

    return result;
  }