// player asks about quest, they haven't started it yet
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new OrCondition(new QuestNotStartedCondition(mithrilcloak.getQuestSlot()), new QuestInStateCondition(mithrilcloak.getQuestSlot(), "rejected")),
ConversationStates.QUEST_OFFERED,
"My sewing machine is broken, will you help me fix it?",
null);
final Map<String,Integer> items = new HashMap<String, Integer>();
items.put("leather armor",1);
items.put("oil",1);
items.put("bobbin",1);
// Player says yes they want to help
npc.add(ConversationStates.QUEST_OFFERED,
ConversationPhrases.YES_MESSAGES, null,
ConversationStates.ATTENDING,
null,
new MultipleActions(new SetQuestAndModifyKarmaAction(mithrilcloak.getQuestSlot(), "machine;", 15.0),
new StartRecordingRandomItemCollectionAction(mithrilcloak.getQuestSlot(), 1, items, "Thank you! To fix it, it needs [#item]. I'm ever so grateful for your help.")));
// player said no they didn't want to help
npc.add(
ConversationStates.QUEST_OFFERED,
ConversationPhrases.NO_MESSAGES,
null,
ConversationStates.IDLE,
"Oh dear, I don't know what I can do without a decent sewing machine. But don't worry I won't bother you any longer!",
new SetQuestAndModifyKarmaAction(mithrilcloak.getQuestSlot(), "rejected", -5.0));
// player asks for quest but they already did it
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new QuestCompletedCondition(mithrilcloak.getQuestSlot()),
ConversationStates.ATTENDING,
"You've already completed the only quest that I have for you.",
null);
//player fixed the machine but hadn't got mithril shield.
// they return and ask for quest but they still haven't got mithril shield
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(new NotCondition(new QuestCompletedCondition(mithrilcloak.getShieldQuestSlot())),
new OrCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_mithril_shield"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "fixed_machine"))
),
ConversationStates.ATTENDING,
"I don't have anything for you until you have proved yourself worthy of carrying mithril items, by getting the mithril shield.",
null);
// player fixed the machine but hadn't got mithril shield at time or didn't ask to hear more about the cloak.
// when they have got it and return to ask for quest she offers the cloak
npc.add(ConversationStates.ATTENDING,
ConversationPhrases.QUEST_MESSAGES,
new AndCondition(
new QuestCompletedCondition(mithrilcloak.getShieldQuestSlot()),
new OrCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "need_mithril_shield"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "fixed_machine"))
),
ConversationStates.QUEST_2_OFFERED,
"Congratulations, you completed the quest for the mithril shield! Now, I have another quest for you, do you want to hear it?",
null);