Dorian.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package ai.npc.Dorian;
  20. import quests.Q00024_InhabitantsOfTheForestOfTheDead.Q00024_InhabitantsOfTheForestOfTheDead;
  21. import ai.npc.AbstractNpcAI;
  22. import com.l2jserver.gameserver.model.actor.L2Character;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. import com.l2jserver.gameserver.network.NpcStringId;
  27. import com.l2jserver.gameserver.network.clientpackets.Say2;
  28. /**
  29. * Dorian (Raid Fighter) - Quest AI
  30. * @author malyelfik
  31. */
  32. public final class Dorian extends AbstractNpcAI
  33. {
  34. // NPC
  35. private static final int DORIAN = 25332;
  36. // Items
  37. private static final int SILVER_CROSS = 7153;
  38. private static final int BROKEN_SILVER_CROSS = 7154;
  39. private Dorian()
  40. {
  41. super(Dorian.class.getSimpleName(), "ai/npc");
  42. addSeeCreatureId(DORIAN);
  43. }
  44. @Override
  45. public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon)
  46. {
  47. if (creature.isPlayer())
  48. {
  49. final L2PcInstance pl = creature.getActingPlayer();
  50. final QuestState qs = pl.getQuestState(Q00024_InhabitantsOfTheForestOfTheDead.class.getSimpleName());
  51. if ((qs != null) && qs.isCond(3))
  52. {
  53. takeItems(pl, SILVER_CROSS, -1);
  54. giveItems(pl, BROKEN_SILVER_CROSS, 1);
  55. qs.setCond(4, true);
  56. broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THAT_SIGN);
  57. }
  58. }
  59. return super.onSeeCreature(npc, creature, isSummon);
  60. }
  61. public static void main(String[] args)
  62. {
  63. new Dorian();
  64. }
  65. }