Q10267_JourneyToGracia.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.Q10267_JourneyToGracia;
  20. import com.l2jserver.gameserver.model.actor.L2Npc;
  21. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  22. import com.l2jserver.gameserver.model.quest.Quest;
  23. import com.l2jserver.gameserver.model.quest.QuestState;
  24. import com.l2jserver.gameserver.model.quest.State;
  25. /**
  26. * Journey To Gracia (10267)<br>
  27. * Original Jython script by Kerberos.
  28. * @author nonom
  29. */
  30. public class Q10267_JourneyToGracia extends Quest
  31. {
  32. // NPCs
  33. private static final int ORVEN = 30857;
  34. private static final int KEUCEREUS = 32548;
  35. private static final int PAPIKU = 32564;
  36. // Item
  37. private static final int LETTER = 13810;
  38. public Q10267_JourneyToGracia()
  39. {
  40. super(10267, Q10267_JourneyToGracia.class.getSimpleName(), "Journey to Gracia");
  41. addStartNpc(ORVEN);
  42. addTalkId(ORVEN, KEUCEREUS, PAPIKU);
  43. registerQuestItems(LETTER);
  44. }
  45. @Override
  46. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  47. {
  48. final QuestState st = getQuestState(player, false);
  49. if (st == null)
  50. {
  51. return getNoQuestMsg(player);
  52. }
  53. switch (event)
  54. {
  55. case "30857-06.html":
  56. st.startQuest();
  57. st.giveItems(LETTER, 1);
  58. break;
  59. case "32564-02.html":
  60. st.setCond(2, true);
  61. break;
  62. case "32548-02.html":
  63. st.giveAdena(92500, true);
  64. st.addExpAndSp(75480, 7570);
  65. st.exitQuest(false, true);
  66. break;
  67. }
  68. return event;
  69. }
  70. @Override
  71. public String onTalk(L2Npc npc, L2PcInstance player)
  72. {
  73. String htmltext = getNoQuestMsg(player);
  74. final QuestState st = getQuestState(player, true);
  75. if (st == null)
  76. {
  77. return htmltext;
  78. }
  79. switch (npc.getId())
  80. {
  81. case ORVEN:
  82. switch (st.getState())
  83. {
  84. case State.CREATED:
  85. htmltext = (player.getLevel() < 75) ? "30857-00.html" : "30857-01.htm";
  86. break;
  87. case State.STARTED:
  88. htmltext = "30857-07.html";
  89. break;
  90. case State.COMPLETED:
  91. htmltext = "30857-0a.html";
  92. break;
  93. }
  94. break;
  95. case PAPIKU:
  96. if (st.isStarted())
  97. {
  98. htmltext = st.isCond(1) ? "32564-01.html" : "32564-03.html";
  99. }
  100. break;
  101. case KEUCEREUS:
  102. if (st.isStarted() && st.isCond(2))
  103. {
  104. htmltext = "32548-01.html";
  105. }
  106. else if (st.isCompleted())
  107. {
  108. htmltext = "32548-03.html";
  109. }
  110. break;
  111. }
  112. return htmltext;
  113. }
  114. }