Jinia.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (C) 2004-2014 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.Jinia;
  20. import quests.Q10286_ReunionWithSirra.Q10286_ReunionWithSirra;
  21. import ai.npc.AbstractNpcAI;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. /**
  26. * Jinia AI.
  27. * @author Adry_85
  28. */
  29. public final class Jinia extends AbstractNpcAI
  30. {
  31. // NPC
  32. private static final int JINIA = 32781;
  33. // Items
  34. private static final int FROZEN_CORE = 15469;
  35. private static final int BLACK_FROZEN_CORE = 15470;
  36. // Misc
  37. private static final int MIN_LEVEL = 82;
  38. private Jinia()
  39. {
  40. super(Jinia.class.getSimpleName(), "ai/npc");
  41. addStartNpc(JINIA);
  42. addFirstTalkId(JINIA);
  43. addTalkId(JINIA);
  44. }
  45. @Override
  46. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  47. {
  48. String htmltext = event;
  49. switch (event)
  50. {
  51. case "32781-10.html":
  52. case "32781-11.html":
  53. {
  54. htmltext = event;
  55. break;
  56. }
  57. case "check":
  58. {
  59. if (hasAtLeastOneQuestItem(player, FROZEN_CORE, BLACK_FROZEN_CORE))
  60. {
  61. htmltext = "32781-03.html";
  62. }
  63. else
  64. {
  65. final QuestState st = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName());
  66. if ((st != null) && st.isCompleted())
  67. {
  68. giveItems(player, FROZEN_CORE, 1);
  69. }
  70. else
  71. {
  72. giveItems(player, BLACK_FROZEN_CORE, 1);
  73. }
  74. htmltext = "32781-04.html";
  75. }
  76. break;
  77. }
  78. }
  79. return htmltext;
  80. }
  81. @Override
  82. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  83. {
  84. final QuestState st = player.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName());
  85. if ((st != null) && (player.getLevel() >= MIN_LEVEL))
  86. {
  87. if (st.isCompleted())
  88. {
  89. return "32781-02.html";
  90. }
  91. else if (st.isCond(5) || st.isCond(6))
  92. {
  93. return "32781-09.html";
  94. }
  95. }
  96. return "32781-01.html";
  97. }
  98. public static void main(String[] args)
  99. {
  100. new Jinia();
  101. }
  102. }