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

36 lines
1.0 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.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
2019-05-26 20:14:53 +02:00
public class CraftingResultComposer extends MessageComposer {
2018-07-06 15:30:00 +02:00
private final CraftingRecipe recipe;
2018-12-22 11:39:00 +01:00
private final boolean succes;
2018-07-06 15:30:00 +02:00
2019-05-26 20:14:53 +02:00
public CraftingResultComposer(CraftingRecipe recipe) {
2018-07-06 15:30:00 +02:00
this.recipe = recipe;
2018-12-22 11:39:00 +01:00
this.succes = this.recipe != null;
}
2019-05-26 20:14:53 +02:00
public CraftingResultComposer(CraftingRecipe recipe, boolean success) {
2018-12-22 11:39:00 +01:00
this.recipe = recipe;
this.succes = success;
2018-07-06 15:30:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public ServerMessage compose() {
2018-07-06 15:30:00 +02:00
this.response.init(Outgoing.CraftingResultComposer);
2018-12-22 11:39:00 +01:00
this.response.appendBoolean(this.succes); //succes
2018-07-06 15:30:00 +02:00
2019-05-26 20:14:53 +02:00
if (this.recipe != null) {
2018-07-06 15:30:00 +02:00
this.response.appendString(this.recipe.getName());
this.response.appendString(this.recipe.getReward().getName());
}
return this.response;
}
}