Q00148_PathtoBecominganExaltedMercenary.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.Q00148_PathtoBecominganExaltedMercenary;
  20. import quests.Q00147_PathtoBecominganEliteMercenary.Q00147_PathtoBecominganEliteMercenary;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * Path to Becoming an Exalted Mercenary (148)
  28. * @author Gnacik
  29. * @version 2010-09-30 Based on official server Franz
  30. */
  31. public class Q00148_PathtoBecominganExaltedMercenary extends Quest
  32. {
  33. // NPCs
  34. private static final int[] MERC =
  35. {
  36. 36481,
  37. 36482,
  38. 36483,
  39. 36484,
  40. 36485,
  41. 36486,
  42. 36487,
  43. 36488,
  44. 36489
  45. };
  46. // Items
  47. private static final int ELITE_CERTIFICATE = 13767;
  48. private static final int TOP_ELITE_CERTIFICATE = 13768;
  49. public Q00148_PathtoBecominganExaltedMercenary()
  50. {
  51. super(148, Q00148_PathtoBecominganExaltedMercenary.class.getSimpleName(), "Path to Becoming an Exalted Mercenary");
  52. addStartNpc(MERC);
  53. addTalkId(MERC);
  54. }
  55. @Override
  56. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  57. {
  58. String htmltext = event;
  59. final QuestState st = getQuestState(player, false);
  60. if (st == null)
  61. {
  62. return htmltext;
  63. }
  64. if (event.equalsIgnoreCase("exalted-00b.htm"))
  65. {
  66. st.giveItems(ELITE_CERTIFICATE, 1);
  67. }
  68. else if (event.equalsIgnoreCase("exalted-03.htm"))
  69. {
  70. st.startQuest();
  71. }
  72. return htmltext;
  73. }
  74. @Override
  75. public String onTalk(L2Npc npc, L2PcInstance player)
  76. {
  77. String htmltext = getNoQuestMsg(player);
  78. final QuestState st = getQuestState(player, true);
  79. if (st == null)
  80. {
  81. return htmltext;
  82. }
  83. switch (st.getState())
  84. {
  85. case State.CREATED:
  86. QuestState _prev = player.getQuestState(Q00147_PathtoBecominganEliteMercenary.class.getSimpleName());
  87. if ((player.getClan() != null) && (player.getClan().getCastleId() > 0))
  88. {
  89. htmltext = "castle.htm";
  90. }
  91. else if (st.hasQuestItems(ELITE_CERTIFICATE))
  92. {
  93. htmltext = "exalted-01.htm";
  94. }
  95. else
  96. {
  97. if ((_prev != null) && _prev.isCompleted())
  98. {
  99. htmltext = "exalted-00a.htm";
  100. }
  101. else
  102. {
  103. htmltext = "exalted-00.htm";
  104. }
  105. }
  106. break;
  107. case State.STARTED:
  108. if (st.getCond() < 4)
  109. {
  110. htmltext = "exalted-04.htm";
  111. }
  112. else if (st.isCond(4))
  113. {
  114. st.takeItems(ELITE_CERTIFICATE, -1);
  115. st.giveItems(TOP_ELITE_CERTIFICATE, 1);
  116. st.exitQuest(false);
  117. htmltext = "exalted-05.htm";
  118. }
  119. break;
  120. case State.COMPLETED:
  121. htmltext = getAlreadyCompletedMsg(player);
  122. break;
  123. }
  124. return htmltext;
  125. }
  126. }