private List<FallItem> getBoxFallItemList(String boxId, RoleInstance role) { if (null == role) { return null; } Cache<String, BoxEntry> boxes = GameContext.getMapApp().getBoxesCache(); BoxEntry entry = boxes.getQuiet(boxId); if (null == entry) { return null; } if (!entry.isOwner(role)) { // 非自己宝箱 return null; } return entry.listFallItem(); }
@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); } }