Q00452_FindingtheLostSoldiers.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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.Q00452_FindingtheLostSoldiers;
  20. import com.l2jserver.gameserver.enums.QuestType;
  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. * Finding the Lost Soldiers (452)
  28. * @author Gigiikun
  29. * @version 2012-08-10
  30. */
  31. public class Q00452_FindingtheLostSoldiers extends Quest
  32. {
  33. private static final int JAKAN = 32773;
  34. private static final int TAG_ID = 15513;
  35. private static final int[] SOLDIER_CORPSES =
  36. {
  37. 32769,
  38. 32770,
  39. 32771,
  40. 32772
  41. };
  42. public Q00452_FindingtheLostSoldiers()
  43. {
  44. super(452, Q00452_FindingtheLostSoldiers.class.getSimpleName(), "Finding the Lost Soldiers");
  45. addStartNpc(JAKAN);
  46. addTalkId(JAKAN);
  47. addTalkId(SOLDIER_CORPSES);
  48. registerQuestItems(TAG_ID);
  49. }
  50. @Override
  51. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  52. {
  53. QuestState st = getQuestState(player, false);
  54. if (st == null)
  55. {
  56. return getNoQuestMsg(player);
  57. }
  58. String htmltext = event;
  59. if (npc.getId() == JAKAN)
  60. {
  61. if (event.equals("32773-3.htm"))
  62. {
  63. st.startQuest();
  64. }
  65. }
  66. else
  67. {
  68. if (st.isCond(1))
  69. {
  70. if (getRandom(10) < 5)
  71. {
  72. st.giveItems(TAG_ID, 1);
  73. }
  74. else
  75. {
  76. htmltext = "corpse-3.html";
  77. }
  78. st.setCond(2, true);
  79. npc.deleteMe();
  80. }
  81. else
  82. {
  83. htmltext = "corpse-3.html";
  84. }
  85. }
  86. return htmltext;
  87. }
  88. @Override
  89. public String onTalk(L2Npc npc, L2PcInstance player)
  90. {
  91. String htmltext = getNoQuestMsg(player);
  92. final QuestState st = getQuestState(player, true);
  93. if (st == null)
  94. {
  95. return htmltext;
  96. }
  97. if (npc.getId() == JAKAN)
  98. {
  99. switch (st.getState())
  100. {
  101. case State.CREATED:
  102. htmltext = (player.getLevel() < 84) ? "32773-0.html" : "32773-1.htm";
  103. break;
  104. case State.STARTED:
  105. if (st.isCond(1))
  106. {
  107. htmltext = "32773-4.html";
  108. }
  109. else if (st.isCond(2))
  110. {
  111. htmltext = "32773-5.html";
  112. st.takeItems(TAG_ID, -1);
  113. st.giveAdena(95200, true);
  114. st.addExpAndSp(435024, 50366);
  115. st.exitQuest(QuestType.DAILY, true);
  116. }
  117. break;
  118. case State.COMPLETED:
  119. if (st.isNowAvailable())
  120. {
  121. st.setState(State.CREATED);
  122. htmltext = (player.getLevel() < 84) ? "32773-0.html" : "32773-1.htm";
  123. }
  124. else
  125. {
  126. htmltext = "32773-6.html";
  127. }
  128. break;
  129. }
  130. }
  131. else
  132. {
  133. if (st.isCond(1))
  134. {
  135. htmltext = "corpse-1.html";
  136. }
  137. }
  138. return htmltext;
  139. }
  140. }