Q00998_FallenAngelSelect.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 quests.Q00998_FallenAngelSelect;
  20. import quests.Q00141_ShadowFoxPart3.Q00141_ShadowFoxPart3;
  21. import quests.Q00142_FallenAngelRequestOfDawn.Q00142_FallenAngelRequestOfDawn;
  22. import quests.Q00143_FallenAngelRequestOfDusk.Q00143_FallenAngelRequestOfDusk;
  23. import com.l2jserver.gameserver.instancemanager.QuestManager;
  24. import com.l2jserver.gameserver.model.actor.L2Npc;
  25. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  26. import com.l2jserver.gameserver.model.quest.Quest;
  27. import com.l2jserver.gameserver.model.quest.QuestState;
  28. import com.l2jserver.gameserver.model.quest.State;
  29. /**
  30. * Fallen Angel Select (998 - Custom)<br>
  31. * NOTE: This quest is used for start quest 142 or 143
  32. * @author Nono
  33. */
  34. public class Q00998_FallenAngelSelect extends Quest
  35. {
  36. // NPCs
  37. private static final int NATOOLS = 30894;
  38. // Misc
  39. private static final int MIN_LEVEL = 38;
  40. public Q00998_FallenAngelSelect()
  41. {
  42. super(998, Q00998_FallenAngelSelect.class.getSimpleName(), "Fallen Angel - Select");
  43. setIsCustom(true);
  44. addStartNpc(NATOOLS);
  45. addTalkId(NATOOLS);
  46. }
  47. @Override
  48. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. final QuestState st = getQuestState(player, false);
  51. if (st == null)
  52. {
  53. return null;
  54. }
  55. switch (event)
  56. {
  57. case "30894-01.html":
  58. case "30894-02.html":
  59. case "30894-03.html":
  60. return event;
  61. case "dawn":
  62. startQuest(Q00142_FallenAngelRequestOfDawn.class.getSimpleName(), player);
  63. break;
  64. case "dusk":
  65. startQuest(Q00143_FallenAngelRequestOfDusk.class.getSimpleName(), player);
  66. break;
  67. }
  68. return null;
  69. }
  70. private void startQuest(String name, L2PcInstance player)
  71. {
  72. final Quest q = QuestManager.getInstance().getQuest(name);
  73. if (q != null)
  74. {
  75. q.newQuestState(player);
  76. q.notifyEvent("30894-01.html", null, player);
  77. player.getQuestState(getName()).setState(State.COMPLETED);
  78. }
  79. }
  80. @Override
  81. public String onTalk(L2Npc npc, L2PcInstance player)
  82. {
  83. final QuestState st = getQuestState(player, true);
  84. final QuestState qs = player.getQuestState(Q00141_ShadowFoxPart3.class.getSimpleName());
  85. if ((st == null) || !st.isStarted())
  86. {
  87. return getNoQuestMsg(player);
  88. }
  89. return ((player.getLevel() >= MIN_LEVEL) && (qs != null) && qs.isCompleted()) ? "30894-01.html" : "30894-00.html";
  90. }
  91. }