final SpeakerNPC npc = npcs.get("Whiggins");
// player asks about fabric/quest
npc.add(ConversationStates.ATTENDING,
Arrays.asList("weave", "fabric", "magical", "mithril fabric", "ida", "mithril", "cloak", "mithril cloak", "task", "quest"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_mithril_thread"),
ConversationStates.QUEST_OFFERED,
"I would love to weave you some fabric but I'm afraid my mind is full of other things. I have offended a fellow wizard. I was up all night writing him an apology letter, but I have no-one to deliver it to him. Unless ... that is ... would YOU deliver this letter for me?",
null);
// Player says yes they want to help
npc.add(ConversationStates.QUEST_OFFERED,
ConversationPhrases.YES_MESSAGES, null,
ConversationStates.ATTENDING,
"Wonderful! I'm so relieved! Please take this note to Pedinghaus, you will find him in Ados goldsmiths. Tell him you have a #letter for him.",
new MultipleActions(new EquipItemAction("sealed envelope", 1, true),
new SetQuestAction(mithrilcloak.getQuestSlot(), "taking_letter"))
);
// player said no they didn't want to help
npc.add(
ConversationStates.QUEST_OFFERED,
ConversationPhrases.NO_MESSAGES,
null,
ConversationStates.QUEST_OFFERED,
"Oh dear, I'm ever so worried. Please help?",
null);
// player returns without having taking letter
npc.add(ConversationStates.ATTENDING,
Arrays.asList("weave", "fabric", "magical", "mithril fabric", "ida", "mithril", "cloak", "mithril cloak", "pedinghaus", "task", "quest", "letter", "note"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_letter"),
ConversationStates.ATTENDING,
"Please don't forget to take that letter to Pedinghaus. It means a lot to me.", null);
// player returns having taking letter
npc.add(ConversationStates.ATTENDING,
Arrays.asList("weave", "fabric", "magical", "mithril fabric", "ida", "mithril", "cloak",
"mithril cloak", "pedinghaus", "regards", "forgiven", "task", "quest"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
ConversationStates.SERVICE_OFFERED,
"Thank you so much for taking that letter! Now, do you have the 40 spools of mithril thread "
+ "so that I may weave you a couple yards of fabric?", null);
// player's quest state is in nothing to do with the letter, thread or weaving.
npc.add(ConversationStates.ATTENDING,
Arrays.asList("weave", "fabric", "magical", "mithril fabric", "ida", "mithril", "cloak", "mithril cloak", "pedinghaus", "task", "quest"),
new NotCondition(
new OrCondition(new QuestInStateCondition(mithrilcloak.getQuestSlot(), "got_mithril_thread"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "taking_letter"),
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
new QuestStateStartsWithCondition(mithrilcloak.getQuestSlot(), "weavingfabric;")
)
),
ConversationStates.ATTENDING,
"I haven't got any quest for you now.", null);
// player says yes they brought the items needed
// we can't use the nice ChatActions here because we have to timestamp the quest slot
npc.add(
ConversationStates.SERVICE_OFFERED,
ConversationPhrases.YES_MESSAGES,
new QuestInStateCondition(mithrilcloak.getQuestSlot(), "took_letter"),
ConversationStates.ATTENDING,
null,
new ChatAction() {
public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
if (player.isEquipped("mithril thread", 40)) {