public boolean verify(UserDomain userDomain, StoryVerify storyVerify) { if (userDomain == null || storyVerify == null) { return false; } Collection<Long> propsIds = propsManager.getUserPropsIdList(userDomain.getId(), BackpackType.DEFAULT_BACKPACK); int totleNumber = 0; for (long userPropsId : propsIds) { UserProps userProps = propsManager.getUserProps(userPropsId); if (userProps == null) { continue; } if (userProps.getBaseId() == storyVerify.getParam1()) { totleNumber += userProps.getCount(); } } if (totleNumber < storyVerify.getParam2()) { return false; } return true; }
/** * 获取基础道具 * * @param itemId 用户道具ID * @return {@link PropsConfig} 查询用户道具类型 */ protected PropsConfig getBaseItem(int itemId) { return itemManager.getPropsConfig(itemId); }