void fixRingStep(final SpeakerNPC npc) {
npc.add(ConversationStates.ATTENDING, Arrays.asList("emerald ring", "life", "emerald"),
new AndCondition(new PlayerHasItemWithHimCondition("emerald ring"),
new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING))),
ConversationStates.QUEST_ITEM_BROUGHT,
null,
new ChatAction() {
public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
final RingOfLife emeraldRing = (RingOfLife) player.getFirstEquipped("emerald ring");
if (emeraldRing.isBroken()) {
npc.say("What a pity, your emerald ring is broken. I can fix it, for a #price.");
} else {
// ring is not broken so he just lets player know
// where it can be fixed
npc.say("I see you already have an emerald ring. If it gets broken, you can come to me to fix it.");
npc.setCurrentState(ConversationStates.ATTENDING);
}
}
});
npc.add(ConversationStates.ATTENDING,
Arrays.asList("emerald ring", "life", "emerald"),
new AndCondition(new NotCondition(new PlayerHasItemWithHimCondition("emerald ring")),
new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING))),
ConversationStates.ATTENDING,
"It is difficult to get the ring of life. Do a favour for a powerful elf in Nal'wor and you may receive one as a reward."
, null);
npc.add(ConversationStates.ATTENDING,
Arrays.asList("emerald ring", "life", "emerald"),
new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
new NotCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING + "unbound")),
new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES)),
ConversationStates.ATTENDING,
"I'm pleased to say, your ring of life is fixed! It's good as new now.",
new MultipleActions(
new IncreaseXPAction(500),
new SetQuestAction(QUEST_SLOT, "done"),
new EquipItemAction("emerald ring", 1, true)));
npc.add(ConversationStates.ATTENDING,
Arrays.asList("emerald ring", "life", "emerald"),
new AndCondition(new QuestStateStartsWithCondition(QUEST_SLOT, FORGING),
new QuestStateStartsWithCondition(QUEST_SLOT, FORGING + "unbound"),
new TimePassedCondition(QUEST_SLOT,1,REQUIRED_MINUTES)),
ConversationStates.ATTENDING,
"I'm pleased to say, your ring of life is fixed! It's good as new now.",
new MultipleActions(
new IncreaseXPAction(500),
new SetQuestAction(QUEST_SLOT, "done"),
new EquipItemAction("emerald ring", 1, false)));
npc.add(ConversationStates.ATTENDING,
Arrays.asList("emerald ring", "life", "emerald"),
new AndCondition(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 fixing your ring of life. Please check back in"));