// player wants to learn how to attack
npc.add(
ConversationStates.ATTENDING,
ConversationPhrases.YES_MESSAGES,
new QuestInStateCondition(QUEST_SLOT, 0, "start"),
ConversationStates.ATTENDING,
"Well, back when I was a young adventurer, I clicked on my enemies to attack them. I'm sure that will work for you, too. Good luck, and come back once you are done.",
null);
//player doesn't want to learn how to attack
npc.add(
ConversationStates.ATTENDING,
ConversationPhrases.NO_MESSAGES,
new QuestInStateCondition(QUEST_SLOT, 0, "start"),
ConversationStates.ATTENDING,
"Fine, you seem like an intelligent type. I'm sure you'll work it out!",
null);
//player returns to Hayunn not having killed a rat
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, 0, "start"),
new NotCondition(new KilledForQuestCondition(QUEST_SLOT,1))),
ConversationStates.ATTENDING,
"I see you haven't managed to kill a rat yet. Do you need me to tell you how to fight them?",
null);
//player returns to Hayunn having killed a rat
final List<ChatAction> actions = new LinkedList<ChatAction>();
actions.add(new IncreaseXPAction(10));
actions.add(new SetQuestAction(QUEST_SLOT, "killed"));
npc.add(
ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, 0, "start"),
new KilledForQuestCondition(QUEST_SLOT, 1)),
ConversationStates.INFORMATION_1,
"You killed the rat! Now, I guess you want to explore. Do you want to know the way to Semos?",
new MultipleActions(actions));
// The player has had enough info for now. Send them to semos. When they come back they can learn some more tips.
final List<ChatAction> reward = new LinkedList<ChatAction>();
reward.add(new EquipItemAction("money", 5));
reward.add(new IncreaseXPAction(10));
reward.add(new SetQuestAction(QUEST_SLOT, "taught"));
reward.add(new ExamineChatAction("monogenes.png", "Monogenes", "North part of Semos city."));
npc.add(
ConversationStates.INFORMATION_1,
ConversationPhrases.YES_MESSAGES,
null,
ConversationStates.IDLE,
"Follow the path through this village to the east, and you can't miss Semos. If you go and speak to Monogenes, the old man in this picture, he will give you a map. Here's 5 money to get you started. Bye bye!",
new MultipleActions(reward));
// incase player didn't finish learning everything when he came after killing the rat, he must have another chance. Here it is.
// 'little tip' is a pun as he gives some money, that is a tip, too.
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "killed")),
ConversationStates.INFORMATION_1,
"You ran off pretty fast after coming to tell me you killed that rat! I was about to give you a little tip. Do you want it?",
null);
// Player has returned to say hi again.
npc.add(ConversationStates.IDLE,
ConversationPhrases.GREETING_MESSAGES,
new AndCondition(new GreetingMatchesNameCondition(npc.getName()),
new QuestInStateCondition(QUEST_SLOT, "taught")),
ConversationStates.INFORMATION_2,
"Hello again. Have you come to learn more from me?",
null);
npc.add(
ConversationStates.INFORMATION_2,
ConversationPhrases.YES_MESSAGES,
null,
ConversationStates.INFORMATION_3,
"Perhaps you have found Semos dungeons by now. The corridors are pretty narrow down there, so there's a trick to moving quickly and accurately, if you'd like to hear it. #Yes?",
null);
npc.add(
ConversationStates.INFORMATION_3,
ConversationPhrases.YES_MESSAGES,
null,
ConversationStates.INFORMATION_4,
"Simple, really; just click the place you want to move to. There's a lot more information than I can relate just off the top of my head... do you want to know where to read more?",
null);
final String epilog = "You can find answers to frequently asked questions by typing #/faq \nYou can read about some of the currently most powerful and successful warriors at #http://stendhalgame.org\n ";
//This is used if the player returns, asks for #help and then say #yes
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.YES_MESSAGES, new QuestCompletedCondition(QUEST_SLOT),
ConversationStates.ATTENDING,
epilog + "You know, you remind me of my younger self...",
null);
final List<ChatAction> reward2 = new LinkedList<ChatAction>();
reward2.add(new EquipItemAction("studded shield"));
reward2.add(new IncreaseXPAction(20));
reward2.add(new SetQuestAction(QUEST_SLOT, "done"));
npc.add(ConversationStates.INFORMATION_4,
ConversationPhrases.YES_MESSAGES, new QuestNotCompletedCondition(QUEST_SLOT),
ConversationStates.IDLE,
epilog + "Well, good luck in the dungeons! This shield should help you. Here's hoping you find fame and glory, and keep watch for monsters!",
new MultipleActions(reward2));
npc.add(new ConversationStates[] { ConversationStates.ATTENDING,
ConversationStates.INFORMATION_1,
ConversationStates.INFORMATION_2,
ConversationStates.INFORMATION_3,
ConversationStates.INFORMATION_4},
ConversationPhrases.NO_MESSAGES, new NotCondition(new QuestInStateCondition(QUEST_SLOT, "start")), ConversationStates.IDLE,
"Oh well, I'm sure someone else will stop by for a chat soon. Bye...",
null);
npc.setPlayerChatTimeout(TIME_OUT);
}