private void offerKnifeStep() {
final SpeakerNPC npc = npcs.get("Alrak");
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestStateStartsWithCondition(QUEST_SLOT, "reading;"),
new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_DAYS * MINUTES_IN_DAYS))),
ConversationStates.IDLE,
null,
new SayTimeRemainingAction(QUEST_SLOT, 1, REQUIRED_DAYS * MINUTES_IN_DAYS, "I haven't finished reading that book. Maybe I'll be done in"));
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestStateStartsWithCondition(QUEST_SLOT, "reading;"),
new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_DAYS * MINUTES_IN_DAYS)),
ConversationStates.QUEST_2_OFFERED,
"I've finished reading! That was really interesting. I learned how to make a special #knife from #obsidian.",
new SetQuestAction(QUEST_SLOT, "book_read"));
npc.add(ConversationStates.QUEST_2_OFFERED,
"obsidian",
new LevelGreaterThanCondition(REQUIRED_LEVEL),
ConversationStates.QUEST_2_OFFERED,
"That book says that the black gem, obsidian, can be used to make a very sharp cutting edge. Fascinating! If you slay a black dragon to bring it, I'll make a #knife for you.",
new SetQuestAction(QUEST_SLOT, "knife_offered"));
npc.add(ConversationStates.QUEST_2_OFFERED,
"knife",
new LevelGreaterThanCondition(REQUIRED_LEVEL),
ConversationStates.QUEST_2_OFFERED,
"I'll make an obsidian knife if you can slay a black dragon and get the gem which makes the blade. Bring a "
+ FISH
+ " so that I can make the bone handle, too.",
new SetQuestAction(QUEST_SLOT, "knife_offered"));
npc.add(ConversationStates.QUEST_2_OFFERED,
Arrays.asList("obsidian", "knife"),
new NotCondition(new LevelGreaterThanCondition(REQUIRED_LEVEL)),
ConversationStates.ATTENDING,
"Well, I don't think you're quite ready for such a dangerous weapon yet. How about you come back when you're above level " + Integer.toString(REQUIRED_LEVEL) + "?",
null);
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "book_read")),
ConversationStates.QUEST_2_OFFERED,
"Hi! Perhaps you have come to ask about that #knife again ... ",
null);
// player says hi to NPC when equipped with the fish and the gem and
// he's killed a black dragon
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "knife_offered"),
new KilledCondition("black dragon"),
new PlayerHasItemWithHimCondition("obsidian"),
new PlayerHasItemWithHimCondition(FISH)),
ConversationStates.IDLE,
"You found the gem for the blade and the fish bone to make the handle! I'll start work right away. Come back in "
+ REQUIRED_MINUTES + " minutes.",
new MultipleActions(
new DropItemAction("obsidian"),
new DropItemAction(FISH),
new SetQuestAction(QUEST_SLOT, "forging;"),
new SetQuestToTimeStampAction(QUEST_SLOT, 1)));
// player says hi to NPC when equipped with the fish and the gem and
// he's not killed a black dragon
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "knife_offered"),
new NotCondition(new KilledCondition("black dragon")),
new PlayerHasItemWithHimCondition("obsidian"),
new PlayerHasItemWithHimCondition(FISH)),
ConversationStates.ATTENDING,
"Didn't you hear me properly? I told you to go slay a black dragon for the obsidian, not buy it! How do I know this isn't a fake gem? *grumble* I'm not making a special knife for someone who is scared to face a dragon.",
null);
// player says hi to NPC when not equipped with the fish and the gem
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "knife_offered"),
new NotCondition(
new AndCondition(
new PlayerHasItemWithHimCondition("obsidian"),
new PlayerHasItemWithHimCondition(FISH)))),
ConversationStates.ATTENDING,
"Hello again. Don't forget I offered to make that obsidian knife, if you bring me a "
+ FISH
+ " and a piece of obsidian from a black dragon you killed. In the meantime if I can #help you, just say the word.",
null);
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestStateStartsWithCondition(QUEST_SLOT, "forging;"),
new NotCondition(new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES))),
ConversationStates.IDLE,
null,
new SayTimeRemainingAction(QUEST_SLOT, 1, REQUIRED_MINUTES, "I haven't finished making the knife. Please check back in"));
final List<ChatAction> reward = new LinkedList<ChatAction>();
reward.add(new IncreaseXPAction(10000));
reward.add(new SetQuestAction(QUEST_SLOT, "done"));
reward.add(new EquipItemAction("obsidian knife", 1, true));
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestStateStartsWithCondition(QUEST_SLOT, "forging;"),
new TimePassedCondition(QUEST_SLOT, 1, REQUIRED_MINUTES)),
ConversationStates.IDLE,
"The knife is ready! You know, that was enjoyable. I think I'll start making things again. Thanks!",
new MultipleActions(reward));