);
// Player returns within one week of completing quest
npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestCompletedCondition(QUEST_SLOT),
new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, DELAY))),
ConversationStates.ATTENDING, "Welcome back to the Ados Wildlife Refuge! Thanks again for rescuing our animals!",
null
);
// Player returns and longer than a week has passed, ask to help again
npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestCompletedCondition(QUEST_SLOT),
new TimePassedCondition(QUEST_SLOT, 1, DELAY)),
ConversationStates.QUEST_OFFERED, "Welcome back to the Ados Wildlife "
+ "Refuge! Our animals are hungry again, can you bring some more food please?",
null);
// Player has never done the zoo quest, player asks what the task was
npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES,
new QuestNotCompletedCondition(QUEST_SLOT),
ConversationStates.QUEST_OFFERED, "Our animals are hungry. We need " +
"more food to feed them. Can you help us?",
null);
final Map<String,Integer> items = new HashMap<String, Integer>();
items.put("ham",10);
items.put("meat",15);
items.put("grain",20);
items.put("salad",10);
items.put("button mushroom",5);
items.put("carrot",5);
items.put("spinach",5);
items.put("apple",5);
items.put("roach",3);
// Player has done quest before and agrees to help again
npc.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.YES_MESSAGES,
null,
ConversationStates.ATTENDING, null,
new MultipleActions(new SetQuestAndModifyKarmaAction(QUEST_SLOT, "start;", 2.0),
new StartRecordingRandomItemCollectionAction(QUEST_SLOT, 1, items, "Oh, thank you! Please help us by"
+ " bringing [item] as soon as you can."))
);
// player is not willing to help
npc.add(ConversationStates.QUEST_OFFERED, ConversationPhrases.NO_MESSAGES,
null,
ConversationStates.ATTENDING, "Oh dear... I guess we're going to have to feed them with the deer...",
new SetQuestAndModifyKarmaAction(QUEST_SLOT, "rejected", -5.0)
);
// Player returns within one week of completing quest
npc.add(ConversationStates.ATTENDING, ConversationPhrases.QUEST_MESSAGES,
new AndCondition(new QuestCompletedCondition(QUEST_SLOT),
new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, DELAY))),
ConversationStates.ATTENDING, null,
new SayTimeRemainingAction(QUEST_SLOT, 1, DELAY, "Thanks, we have enough food to feed the animals here for another"));
}