예제 #1
0
 /**
  * 获取镶嵌的item
  *
  * @param roleGoods
  * @return
  */
 private List<GoodsEquRuneItem> getMosaicItem(RoleGoods roleGoods) {
   // 获得宝石镶嵌属性
   MosaicRune[] runes = roleGoods.getMosaicRune();
   if (null == runes || runes.length <= 0) {
     return null;
   }
   List<GoodsEquRuneItem> runeItemList = new ArrayList<GoodsEquRuneItem>();
   for (int index = 0; index < runes.length; index++) {
     MosaicRune rune = runes[index];
     if (null == rune) {
       continue;
     }
     int runeId = rune.getGoodsId();
     GoodsRune gb = GameContext.getGoodsApp().getGoodsTemplate(GoodsRune.class, runeId);
     if (null == gb) {
       continue;
     }
     GoodsEquRuneItem runeItem = new GoodsEquRuneItem();
     runeItem.setHole(rune.getHole());
     runeItem.setGoodsLiteItem(rune.getGoodsLiteItem());
     runeItem.setRuneName(gb.getName());
     runeItem.setAttriItems(rune.getAttriStrValueList());
     runeItemList.add(runeItem);
   }
   return runeItemList;
 }
예제 #2
0
 public static boolean hadMosaicRune(RoleGoods roleGoods) {
   MosaicRune[] mosaicRunes = roleGoods.getMosaicRune();
   for (MosaicRune hole : mosaicRunes) {
     if (null == hole || hole.getGoodsId() <= 0) {
       continue;
     }
     return true;
   }
   return false;
 }
예제 #3
0
 /**
  * 拆分镶嵌
  *
  * @param roleGoods
  * @param templateHoles
  */
 private static void splitMosaic(RoleGoods roleGoods) {
   Map<Byte, MosaicRune> mosaicRuneMap =
       GameContext.getRuneApp().getMosaicRuneMap(roleGoods.getMosaic());
   roleGoods.setMosaicRune(new MosaicRune[EQUMENT_MAX_HOLE]);
   for (MosaicRune mosaicRune : mosaicRuneMap.values()) {
     if (null == mosaicRune) {
       continue;
     }
     roleGoods.getMosaicRune()[mosaicRune.getHole()] = mosaicRune;
   }
 }
예제 #4
0
 // 镶嵌合并
 private static void uniteMosaic(RoleGoods roleGoods) {
   MosaicRune[] mosaicRunes = roleGoods.getMosaicRune();
   Map<Byte, MosaicRune> mosaicRuneMap = Maps.newHashMap();
   for (MosaicRune mosaic : mosaicRunes) {
     if (null == mosaic) {
       continue;
     }
     mosaicRuneMap.put(mosaic.getHole(), mosaic);
   }
   if (Util.isEmpty(mosaicRuneMap)) {
     // 如果没有镶嵌符文
     roleGoods.setMosaic("");
     return;
   }
   roleGoods.setMosaic(GameContext.getRuneApp().getMosaicString(mosaicRuneMap));
 }
예제 #5
0
 /**
  * 统计镶嵌在装备身上等级超过level的个数
  *
  * @param level
  * @return
  */
 public static int countGemLevel(RoleGoods roleGoods, int level) {
   MosaicRune[] mosaicRunes = roleGoods.getMosaicRune();
   if (null == mosaicRunes || 0 == mosaicRunes.length) {
     return 0;
   }
   int total = 0;
   for (MosaicRune hole : mosaicRunes) {
     if (null == hole || hole.getGoodsId() <= 0) {
       continue;
     }
     GoodsBase gb = GameContext.getGoodsApp().getGoodsBase(hole.getGoodsId());
     if (null == gb) {
       continue;
     }
     if (gb.getLevel() < level) {
       continue;
     }
     total++;
   }
   return total;
 }