private static List<AttriItem> getGoodsMosaicArrti(RoleGoods roleGoods) { Collection<AttriItem> attriItems = GameContext.getRuneApp().getMosaicRuneAttriList(roleGoods.getMosaicRune()); if (Util.isEmpty(attriItems)) { return null; } List<AttriItem> list = Lists.newArrayList(); list.addAll(attriItems); return list; }
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; }
/** * 拆分镶嵌 * * @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; } }
// 镶嵌合并 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)); }
/** * 统计镶嵌在装备身上等级超过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; }