Get MakerItemCreateEntry from new info provider
This commit is contained in:
@@ -4,6 +4,7 @@ import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import constants.id.ItemId;
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
import server.MakerItemFactory.MakerItemCreateEntry;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -60,4 +61,21 @@ public class MakerInfoProvider {
|
||||
fee *= 1000;
|
||||
return fee;
|
||||
}
|
||||
|
||||
public Optional<MakerItemCreateEntry> getMakerItemEntry(int itemId) {
|
||||
Optional<MakerRecipe> optionalRecipe = getMakerRecipe(itemId);
|
||||
if (optionalRecipe.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
final MakerRecipe recipe = optionalRecipe.get();
|
||||
final MakerItemCreateEntry makerEntry = new MakerItemCreateEntry(recipe.mesoCost(), recipe.requiredLevel(),
|
||||
recipe.requiredMakerLevel());
|
||||
makerEntry.addGainItem(itemId, recipe.quantity());
|
||||
|
||||
final List<MakerIngredient> ingredients = getIngredients(itemId);
|
||||
ingredients.forEach(i -> makerEntry.addReqItem(i.itemId(), i.count()));
|
||||
|
||||
return Optional.of(makerEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user