player.notifyWorldAboutChanges();
}
}
}
final ProducerBehaviour behaviour = new SpecialProducerBehaviour("make", "bobbin",
requiredResources, 10 * 60);
// we are not using producer adder at all here because that uses Conversations states IDLE and saying 'hi' heavily.
// we can't do that here because Pequod uses that all the time in his fishing quest. so player is going to have to #remind
// him if he wants his oil back!
add(
ConversationStates.ATTENDING,
"make",
new QuestNotActiveCondition(behaviour.getQuestSlot()),
ConversationStates.ATTENDING, null,
new ProducerBehaviourAction(behaviour) {
@Override
public void fireRequestOK(final ItemParserResult res, final Player player, final Sentence sentence, final EventRaiser npc) {
// Find out how much items we shall produce.
if (res.getAmount() > 1000) {
logger.warn("Decreasing very large amount of "
+ res.getAmount()
+ " " + res.getChosenItemName()
+ " to 1 for player "
+ player.getName() + " talking to "
+ npc.getName() + " saying " + sentence);
res.setAmount(1);
}
if (behaviour.askForResources(res, npc, player)) {
currentBehavRes = res;
npc.setCurrentState(ConversationStates.PRODUCTION_OFFERED);
}
}
});
add(ConversationStates.PRODUCTION_OFFERED,
ConversationPhrases.YES_MESSAGES, null,
ConversationStates.ATTENDING, null,
new ChatAction() {
public void fire(final Player player, final Sentence sentence,
final EventRaiser npc) {
behaviour.transactAgreedDeal(currentBehavRes, npc, player);
currentBehavRes = null;
}
});
add(ConversationStates.PRODUCTION_OFFERED,
ConversationPhrases.NO_MESSAGES, null,
ConversationStates.ATTENDING, "OK, no problem.", null);
add(ConversationStates.ATTENDING,
Arrays.asList(behaviour.getProductionActivity(), "remind"),
new QuestActiveCondition(behaviour.getQuestSlot()),
ConversationStates.ATTENDING, null,
new ChatAction() {
public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
behaviour.giveProduct(npc, player);
}
});
}