/* * Copyright (C) 2004-2015 L2J DataPack * * This file is part of L2J DataPack. * * L2J DataPack is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * L2J DataPack is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package ai.npc.Dorian; import quests.Q00024_InhabitantsOfTheForestOfTheDead.Q00024_InhabitantsOfTheForestOfTheDead; import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; /** * Dorian (Raid Fighter) - Quest AI * @author malyelfik */ public final class Dorian extends AbstractNpcAI { // NPC private static final int DORIAN = 25332; // Items private static final int SILVER_CROSS = 7153; private static final int BROKEN_SILVER_CROSS = 7154; private Dorian() { super(Dorian.class.getSimpleName(), "ai/npc"); addSeeCreatureId(DORIAN); } @Override public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) { if (creature.isPlayer()) { final L2PcInstance pl = creature.getActingPlayer(); final QuestState qs = pl.getQuestState(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName()); if ((qs != null) && qs.isCond(3)) { takeItems(pl, SILVER_CROSS, -1); giveItems(pl, BROKEN_SILVER_CROSS, 1); qs.setCond(4, true); broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THAT_SIGN); } } return super.onSeeCreature(npc, creature, isSummon); } public static void main(String[] args) { new Dorian(); } }