Rafforty.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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.Rafforty;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. /**
  24. * Rafforty AI.
  25. * @author malyelfik, Gladicek
  26. */
  27. public final class Rafforty extends AbstractNpcAI
  28. {
  29. // NPC
  30. private static final int RAFFORTY = 32020;
  31. // Items
  32. private static final int NECKLACE = 16025;
  33. private static final int BLESSED_NECKLACE = 16026;
  34. private static final int BOTTLE = 16027;
  35. @Override
  36. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  37. {
  38. String htmltext = event;
  39. switch (event)
  40. {
  41. case "32020-01.html":
  42. if (!hasQuestItems(player, NECKLACE))
  43. {
  44. htmltext = "32020-02.html";
  45. }
  46. break;
  47. case "32020-04.html":
  48. if (!hasQuestItems(player, BOTTLE))
  49. {
  50. htmltext = "32020-05.html";
  51. }
  52. break;
  53. case "32020-07.html":
  54. if (!hasQuestItems(player, BOTTLE, NECKLACE))
  55. {
  56. return "32020-08.html";
  57. }
  58. takeItems(player, NECKLACE, 1);
  59. takeItems(player, BOTTLE, 1);
  60. giveItems(player, BLESSED_NECKLACE, 1);
  61. break;
  62. }
  63. return htmltext;
  64. }
  65. private Rafforty()
  66. {
  67. super(Rafforty.class.getSimpleName(), "ai/npc");
  68. addStartNpc(RAFFORTY);
  69. addFirstTalkId(RAFFORTY);
  70. addTalkId(RAFFORTY);
  71. }
  72. public static void main(String[] args)
  73. {
  74. new Rafforty();
  75. }
  76. }