Пример #1
0
 /**
  * 获得道具全部属性,包含模板属性
  *
  * @return
  */
 public static AttriBuffer getAttriBuffer(RoleGoods roleGoods) {
   AttriBuffer buffer = AttriBuffer.createAttriBuffer();
   // 模板属性
   int goodsId = roleGoods.getGoodsId();
   GoodsBase goodsBase = GameContext.getGoodsApp().getGoodsBase(goodsId);
   if (goodsBase == null) {
     return buffer;
   }
   buffer.append(goodsBase.getAttriItemList());
   if (GoodsType.GoodsRune.getType() == goodsBase.getGoodsType()) {
     buffer.append(buildRandomAttri(roleGoods));
     return buffer;
   }
   if (!goodsBase.isEquipment()) {
     // 非装备
     return buffer;
   }
   buffer.append(
       GameContext.getEquipApp()
           .getBaseAttriBuffer(goodsId, roleGoods.getQuality(), roleGoods.getStar()));
   // 获得强化属性
   buffer.append(
       GameContext.getEquipApp()
           .getStrengthenAttriBuffer(
               goodsId,
               roleGoods.getQuality(),
               roleGoods.getStar(),
               roleGoods.getStrengthenLevel()));
   buffer.append(buildRandomAttri(roleGoods));
   // 获得镶嵌宝石属性
   buffer.append(getMosaicArrti(roleGoods));
   return buffer;
 }
Пример #2
0
  public GoodsBaseItem getGoodsBaseInfo(RoleGoods roleGoods) {
    GoodsBaseEquItem item = new GoodsBaseEquItem();
    this.setGoodsBaseItem(roleGoods, item);
    item.setStar(this.star);
    item.setSecondType(this.secondType);
    item.setStrengthenLevel((byte) 0);
    item.setMaxStrengthenLevel((byte) this.maxStrengthenLevel);
    item.setQualityType(this.getQualityType());
    item.setLvLimit((byte) this.getLvLimit());
    item.setDesc(this.getDesc());
    item.setActivateType(this.getActivateType());
    item.setResId((short) this.getResId());
    item.setDeadline(this.getDeadline());
    item.setSex((byte) this.getSex());
    item.setExpireType(this.getExpireType());
    item.setMaxAttriNum((byte) this.attriNum);
    // 装备评分
    item.setGs(this.calculateScore(roleGoods));
    // 基本属性+强化属性
    item.setBaseAttriItem(GameContext.getEquipApp().getBaseAttriItem(roleGoods, this));
    if (null == roleGoods) {
      // 装备模板信息
      return item;
    }
    item.setQualityType(roleGoods.getQuality());
    item.setStar(roleGoods.getStar());
    // 实例存在
    if (!Util.isEmpty(roleGoods.getExpiredTime())) {
      item.setExpiredTime(DateUtil.getMinFormat(roleGoods.getExpiredTime()));
    }
    if (roleGoods.getDeadline() > 0) {
      item.setDeadline(roleGoods.getDeadline());
    }
    item.setExpired((byte) (RoleGoodsHelper.isExpired(roleGoods) ? 1 : 0));
    item.setStrengthenLevel((byte) roleGoods.getStrengthenLevel());

    // 获得衍生属性
    item.setDerivativeItems(this.getRecatingAttriList(roleGoods));
    // 镶嵌 相关
    // 装备开启孔位
    item.setMaxHole(GameContext.getEquipApp().getEquipMaxHole(roleGoods));
    // 装备镶嵌的符文
    List<GoodsEquRuneItem> runeItems = this.getMosaicItem(roleGoods);
    if (!Util.isEmpty(runeItems)) {
      item.setRuneItems(runeItems);
    }
    // 设置英雄id
    if (StorageType.hero.getType() == roleGoods.getStorageType()) {
      item.setHeroId(Integer.parseInt(roleGoods.getOtherParm()));
    }
    return item;
  }
  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;
    }
  }