Q00173_ToTheIsleOfSouls.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.Q00173_ToTheIsleOfSouls;
  20. import quests.Q00172_NewHorizons.Q00172_NewHorizons;
  21. import com.l2jserver.gameserver.enums.Race;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.quest.Quest;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. import com.l2jserver.gameserver.model.quest.State;
  27. /**
  28. * To the Isle of Souls (173)
  29. * @author malyelfik
  30. */
  31. public class Q00173_ToTheIsleOfSouls extends Quest
  32. {
  33. // NPCs
  34. private static final int GALLADUCCI = 30097;
  35. private static final int GENTLER = 30094;
  36. // Items
  37. private static final int GALLADUCCIS_ORDER = 7563;
  38. private static final int MAGIC_SWORD_HILT = 7568;
  39. private static final int MARK_OF_TRAVELER = 7570;
  40. private static final int SCROLL_OF_ESCAPE_KAMAEL_VILLAGE = 9716;
  41. public Q00173_ToTheIsleOfSouls()
  42. {
  43. super(173, Q00173_ToTheIsleOfSouls.class.getSimpleName(), "To the Isle of Souls");
  44. addStartNpc(GALLADUCCI);
  45. addTalkId(GALLADUCCI, GENTLER);
  46. registerQuestItems(GALLADUCCIS_ORDER, MAGIC_SWORD_HILT);
  47. }
  48. @Override
  49. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  50. {
  51. final QuestState st = getQuestState(player, false);
  52. if (st == null)
  53. {
  54. return null;
  55. }
  56. String htmltext = event;
  57. switch (event)
  58. {
  59. case "30097-03.htm":
  60. st.startQuest();
  61. st.giveItems(GALLADUCCIS_ORDER, 1);
  62. break;
  63. case "30097-06.html":
  64. st.giveItems(SCROLL_OF_ESCAPE_KAMAEL_VILLAGE, 1);
  65. st.takeItems(MARK_OF_TRAVELER, 1);
  66. st.exitQuest(false, true);
  67. break;
  68. case "30094-02.html":
  69. st.setCond(2, true);
  70. st.takeItems(GALLADUCCIS_ORDER, -1);
  71. st.giveItems(MAGIC_SWORD_HILT, 1);
  72. break;
  73. default:
  74. htmltext = null;
  75. break;
  76. }
  77. return htmltext;
  78. }
  79. @Override
  80. public String onTalk(L2Npc npc, L2PcInstance player)
  81. {
  82. String htmltext = getNoQuestMsg(player);
  83. final QuestState st = getQuestState(player, true);
  84. if (st == null)
  85. {
  86. return htmltext;
  87. }
  88. switch (npc.getId())
  89. {
  90. case GALLADUCCI:
  91. switch (st.getState())
  92. {
  93. case State.CREATED:
  94. final QuestState qs = player.getQuestState(Q00172_NewHorizons.class.getSimpleName());
  95. htmltext = ((qs != null) && qs.isCompleted() && (player.getRace() == Race.KAMAEL) && st.hasQuestItems(MARK_OF_TRAVELER)) ? "30097-01.htm" : "30097-02.htm";
  96. break;
  97. case State.STARTED:
  98. htmltext = (st.isCond(1)) ? "30097-04.html" : "30097-05.html";
  99. break;
  100. case State.COMPLETED:
  101. htmltext = getAlreadyCompletedMsg(player);
  102. break;
  103. }
  104. break;
  105. case GENTLER:
  106. if (st.isStarted())
  107. {
  108. htmltext = (st.isCond(1)) ? "30094-01.html" : "30094-03.html";
  109. }
  110. break;
  111. }
  112. return htmltext;
  113. }
  114. }