handleCooking(tries);
}
}
});
} else {
final ItemCookingDef cookingDef = ItemAttributes
.getCookingDef(item.id);
if (cookingDef == null) {
owner.getActionSender().sendMessage(
"Nothing interesting happens.");
return;
}
if (owner.getCurStat(7) < cookingDef.getReqLevel()) {
owner.getActionSender().sendMessage(
"You need a cooking level of "
+ cookingDef.getReqLevel()
+ " to cook this.");
return;
}
owner.setBusy(true);
showBubble();
owner.getActionSender().sendSound("cooking");
owner.getActionSender().sendMessage(
"You cook the "
+ item.getDef().getName()
+ " on the "
+ object.getGameObjectDef()
.getName() + ".");
Instance.getDelayedEventHandler().add(
new ShortEvent(owner) {
public void action() {
InvItem cookedFood = new InvItem(
cookingDef.getCookedId());
if (owner.getInventory()
.remove(item.id,
item.amount, false)) {
if (!Formulae.burnFood(item.id,
owner.getCurStat(7))) {
owner.getInventory().add(
cookedFood.id,
cookedFood.amount,
false);
owner.getActionSender()
.sendMessage(
"The "
+ item.getDef()
.getName()
+ " is now nicely cooked.");
owner.incExp(
7,
cookingDef.getExp(),
true);
owner.getActionSender()
.sendStat(7);
} else {
owner.getInventory()
.add(cookingDef
.getBurnedId(),
1, false);
owner.getActionSender()
.sendMessage(
"You accidently burn the "