private void sendGoodsByMail(
     RoleInstance role, List<GoodsOperateBean> addList, OutputConsumeType ocType) {
   String title = GameContext.getI18n().getText(TextId.FALL_MAIL_TITLE);
   String content = GameContext.getI18n().getText(TextId.FALL_MAIL_CONTENT);
   GameContext.getMailApp()
       .sendMail(
           role.getRoleId(),
           title,
           content,
           MailSendRoleType.System.getName(),
           ocType.getType(),
           addList);
 }
 @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;
 }
  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;
  }
  private void sendSummonFall(
      Collection<RoleInstance> sameMapMembers, List<GoodsOperateBean> goodsList, String name) {
    try {
      if (Util.isEmpty(goodsList)) {
        return;
      }
      String mapStr = Wildcard.getChatGoodsName(goodsList, ChannelType.Map);

      C1802_ChatRouteRespMessage mapTrsMsg = new C1802_ChatRouteRespMessage();
      mapTrsMsg.setChannelType(ChannelType.Map.getType());
      mapTrsMsg.setMessage(name + GameContext.getI18n().getText(TextId.FALL_GAIN) + mapStr);
      mapTrsMsg.setContextList(null);
      mapTrsMsg.setSendRoleId(-1);
      mapTrsMsg.setSendRoleName(GameContext.getI18n().getText(TextId.SYSTEM));
      for (AbstractRole role : sameMapMembers) {
        role.getBehavior().sendMessage(mapTrsMsg);
      }
    } catch (Exception e) {
      logger.error("sendSummonFall error", e);
    }
  }
 @Override
 public void pickupEntry(String entryId, RoleInstance role, int itemId) {
   MapInstance mapInstance = role.getMapInstance();
   if (null == mapInstance) {
     return;
   }
   PointType pointType = this.getPointType(entryId);
   if (pointType.isCollectPoint()) {
     // 采集点
     CollectablePoint<RoleInstance> cp = mapInstance.getCollectPointMap().get(entryId);
     if (null == cp) {
       C0603_FallPickupRespMessage respMsg = new C0603_FallPickupRespMessage();
       respMsg.setStatus(RespTypeStatus.SUCCESS);
       respMsg.setInfo(GameContext.getI18n().getText(TextId.FALL_HAS_PICK));
       respMsg.setInstanceId(entryId);
       role.getBehavior().sendMessage(respMsg);
       return;
     }
     cp.pickup(role, itemId);
     return;
   }
   if (pointType.isBox()) {
     // 宝箱
     Cache<String, BoxEntry> boxes = GameContext.getMapApp().getBoxesCache();
     BoxEntry boxEntry = boxes.getQuiet(entryId);
     if (null == boxEntry || !boxEntry.isOwner(role)) {
       C0603_FallPickupRespMessage respMsg = new C0603_FallPickupRespMessage();
       respMsg.setInstanceId(entryId);
       respMsg.setStatus(RespTypeStatus.FAILURE);
       respMsg.setInfo(GameContext.getI18n().getText(TextId.FALL_INVALID_TARGET));
       role.getBehavior().sendMessage(respMsg);
       return;
     }
     boxEntry.pickup(role, itemId);
   }
 }
 private void sendRollInfo(
     List<AbstractRole> sameMapMembers,
     int[] points,
     GoodsBase goodsBase,
     int num,
     AbstractRole winner,
     int maxIndex) {
   // 构建roll点信息
   StringBuffer buffer = new StringBuffer();
   buffer.append(((RoleInstance) winner).getRoleName());
   buffer.append(
       GameContext.getI18n().messageFormat(TextId.FALL_ROLL_POINT_GAIN, points[maxIndex]));
   buffer.append(Wildcard.getChatGoodsContent(goodsBase, ChannelType.System, num));
   // buffer.append("[").append(goodsBase.getName()).append("]");
   int index = -1;
   for (AbstractRole role : sameMapMembers) {
     index++;
     if (role.getRoleId().equals(winner.getRoleId())) {
       continue;
     }
     buffer.append(",");
     buffer.append(((RoleInstance) role).getRoleName());
     buffer.append(" ");
     buffer.append(points[index]);
     buffer.append(GameContext.getI18n().getText(TextId.FALL_ROLL_POINT));
   }
   C1802_ChatRouteRespMessage trsMsg = new C1802_ChatRouteRespMessage();
   trsMsg.setChannelType(ChannelType.System.getType());
   trsMsg.setMessage(buffer.toString());
   trsMsg.setContextList(null);
   trsMsg.setSendRoleId(-1);
   trsMsg.setSendRoleName(GameContext.getI18n().getText(TextId.SYSTEM));
   for (AbstractRole role : sameMapMembers) {
     role.getBehavior().sendMessage(trsMsg);
   }
 }
  private C0540_GoodsStrengthenRespMessage buildStrengthenRespMesage(
      RoleInstance role, RoleGoods equRG, GoodsEquipment goodsTemplate) {
    C0540_GoodsStrengthenRespMessage respMsg = new C0540_GoodsStrengthenRespMessage();
    respMsg.setStatus(RespTypeStatus.FAILURE);
    try {
      int targetStrengThenNum = equRG.getStrengthenLevel() + 1;
      // int qualityType = goodsTemplate.getQualityType();
      EquipStrengthenConfig strengthenObj =
          GameContext.getGoodsApp().getEquipStrengthenConfig(targetStrengThenNum);
      if (null == strengthenObj) {
        respMsg.setStatus(RespTypeStatus.FAILURE);
        respMsg.setInfo(GameContext.getI18n().getText(TextId.GOODS_MAX_STRENGTHEN_LV));
        return respMsg;
      }
      respMsg.setFee(strengthenObj.getGameMoney());
      // respMsg.setMaxRelegation((byte)strengthenObj.getMaxRelegation());

      if (strengthenObj.getMaterialId() > 0) {
        GoodsLiteNamedItem mitem = strengthenObj.getMaterialGoods().getGoodsLiteNamedItem();
        mitem.setNum((short) strengthenObj.getMaterialNum());
        respMsg.setMaterialItem(mitem);
      }
      /*if(strengthenObj.getStoneId()>0){
      	GoodsLiteNamedItem sitem = strengthenObj.getStoneGoods().getGoodsLiteNamedItem();
      	sitem.setNum((short)strengthenObj.getStoneNum());
      	respMsg.setStoneItem(sitem);
      }*/
      // 成功率从配置中获取
      respMsg.setAttriList(
          GameContext.getEquipApp().getStrengthenAttriDifferent(equRG, goodsTemplate, 1));
      respMsg.setSuccessRate(strengthenObj.getShowHitProb());
      // 开启vip等级
      respMsg.setOneKeyVipLevel(
          (byte)
              GameContext.getVipApp()
                  .getOpenVipLevel(VipPrivilegeType.EQUIP_ONEKEY_STRENGTHEN.getType(), ""));
      respMsg.setStatus(RespTypeStatus.SUCCESS);
      return respMsg;
    } catch (Exception e) {
      logger.error("buildStrengthenRespMesage ", e);
      return respMsg;
    }
  }
 @Override
 public Message execute(ActionContext context, C1655_PetStarUpReqMessage reqMsg) {
   RoleInstance role = this.getCurrentRole(context);
   if (null == role) {
     return null;
   }
   String roleId = role.getRoleId();
   RolePet rolePet = GameContext.getUserPetApp().getRolePet(roleId, reqMsg.getPetId());
   if (null == rolePet) {
     C0002_ErrorRespMessage message = new C0002_ErrorRespMessage();
     message.setInfo(GameContext.getI18n().getText(TextId.Pet_Not_Owned));
     return message;
   }
   Result result = GameContext.getPetApp().petStarUp(role, rolePet);
   C1655_PetStarUpRespMessage resp = new C1655_PetStarUpRespMessage();
   resp.setPetId(reqMsg.getPetId());
   resp.setInfo(result.getInfo());
   resp.setStatus(result.getResult());
   resp.setStarProgress(rolePet.getStarProgress());
   if (GameContext.getPetApp().isPetMaxStar(rolePet)) {
     resp.setFullStar((byte) 1);
   }
   return resp;
 }