Ejemplo n.º 1
0
 public void assignPrerequisites() {
   for (int i = 0; i < 5; ++i) {
     if (recipe.startsWith("00")) {
       break;
     }
     String lookup = recipe.substring(0, 6);
     String recipePartId = lookup.substring(0, 4);
     int recipePartQuantity = Integer.valueOf(lookup.substring(5, 6));
     recipe = recipe.substring(6);
     Resource r = DataParser.findResource(recipePartId);
     if (r != null) {
       temporaryRecipe.add(new RecipePart(r, recipePartQuantity));
     } else {
       System.out.println(
           craftingResource.name()
               + " "
               + recipePartId
               + "Recipe part not found. Recipe will fail.");
     }
   }
 }
Ejemplo n.º 2
0
 public void convertRecipe() {
   temporaryRecipe.forEach((p) -> craftingResource.addPrerequisite(p.resource(), p.quantity()));
   if (craftingResource.rarity().equals(DataParser.craftingRarities().get(0))) {
     craftingResource.unlock();
   }
 }