Arcturus-Community/src/main/java/com/eu/habbo/messages/outgoing/crafting/CraftableProductsComposer.java

44 lines
1.2 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.outgoing.crafting;
import com.eu.habbo.habbohotel.crafting.CraftingRecipe;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import java.util.Collection;
import java.util.List;
public class CraftableProductsComposer extends MessageComposer
{
private final List<CraftingRecipe> recipes;
private final Collection<Item> ingredients;
public CraftableProductsComposer(List<CraftingRecipe> recipes, Collection<Item> ingredients)
{
this.recipes = recipes;
this.ingredients = ingredients;
}
@Override
public ServerMessage compose()
{
this.response.init(Outgoing.CraftableProductsComposer);
this.response.appendInt(this.recipes.size());
for (CraftingRecipe recipe : recipes)
{
this.response.appendString(recipe.getName());
this.response.appendString(recipe.getReward().getName());
}
this.response.appendInt(this.ingredients.size());
for (Item item : ingredients)
{
this.response.appendString(item.getName());
}
return this.response;
}
}