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;
    }
  }
Esempio n. 2
0
  @Override
  public AddGoodsBeanResult pickupAction(
      String entryId, RoleInstance role, int itemId, List<FallItem> fallList, int outputType) {

    AddGoodsBeanResult result = new AddGoodsBeanResult();
    if (Util.isEmpty(fallList)) {
      result.setResult(Result.FAIL);
      return result;
    }

    List<GoodsOperateBean> pickupList = new ArrayList<GoodsOperateBean>();
    for (Iterator<FallItem> it = fallList.iterator(); it.hasNext(); ) {
      FallItem item = it.next();
      GoodsLiteNamedItem goodsItem = item.getGoodsItem();
      // 全部拾取
      if (itemId <= 0) {
        pickupList.add(
            GoodsOperateBean.createAddGoodsBean(
                goodsItem.getGoodsId(), goodsItem.getNum(), goodsItem.getBindType()));
        continue;
      }
      // 单个拾取
      if (goodsItem.getGoodsId() == itemId) {
        pickupList.add(
            GoodsOperateBean.createAddGoodsBean(
                goodsItem.getGoodsId(), goodsItem.getNum(), goodsItem.getBindType()));
        break;
      }
    }

    if (Util.isEmpty(pickupList)) {
      result.setResult(Result.FAIL);
      return result;
    }

    result =
        GameContext.getUserGoodsApp()
            .addSomeGoodsBeanForBag(role, pickupList, OutputConsumeType.getType(outputType));
    result.setResult(Result.SUCCESS);

    return result;
  }