Q00167_DwarvenKinship.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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.Q00167_DwarvenKinship;
  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. * Dwarven Kinship (167)
  27. * @author xban1x
  28. */
  29. public class Q00167_DwarvenKinship extends Quest
  30. {
  31. // NPCs
  32. private static final int NORMAN = 30210;
  33. private static final int HAPROCK = 30255;
  34. private static final int CARLON = 30350;
  35. // Items
  36. private static final int CARLONS_LETTER = 1076;
  37. private static final int NORMANS_LETTER = 1106;
  38. // Misc
  39. private static final int MIN_LVL = 15;
  40. public Q00167_DwarvenKinship()
  41. {
  42. super(167, Q00167_DwarvenKinship.class.getSimpleName(), "Dwarven Kinship");
  43. addStartNpc(CARLON);
  44. addTalkId(CARLON, NORMAN, HAPROCK);
  45. registerQuestItems(CARLONS_LETTER, NORMANS_LETTER);
  46. }
  47. @Override
  48. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. final QuestState st = getQuestState(player, false);
  51. String htmltext = null;
  52. if (st != null)
  53. {
  54. switch (event)
  55. {
  56. case "30210-02.html":
  57. {
  58. if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER))
  59. {
  60. st.giveAdena(20000, true);
  61. st.exitQuest(false, true);
  62. htmltext = event;
  63. }
  64. break;
  65. }
  66. case "30255-02.html":
  67. {
  68. htmltext = event;
  69. break;
  70. }
  71. case "30255-03.html":
  72. {
  73. if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER))
  74. {
  75. st.takeItems(CARLONS_LETTER, -1);
  76. st.giveItems(NORMANS_LETTER, 1);
  77. st.giveAdena(2000, true);
  78. st.setCond(2);
  79. htmltext = event;
  80. }
  81. break;
  82. }
  83. case "30255-04.html":
  84. {
  85. if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER))
  86. {
  87. st.giveAdena(15000, true);
  88. st.exitQuest(false, true);
  89. htmltext = event;
  90. }
  91. break;
  92. }
  93. case "30350-03.htm":
  94. {
  95. st.startQuest();
  96. st.giveItems(CARLONS_LETTER, 1);
  97. htmltext = event;
  98. break;
  99. }
  100. }
  101. }
  102. return htmltext;
  103. }
  104. @Override
  105. public String onTalk(L2Npc npc, L2PcInstance player)
  106. {
  107. final QuestState st = getQuestState(player, true);
  108. String htmltext = getNoQuestMsg(player);
  109. if (st != null)
  110. {
  111. switch (npc.getId())
  112. {
  113. case CARLON:
  114. {
  115. switch (st.getState())
  116. {
  117. case State.CREATED:
  118. {
  119. htmltext = (player.getLevel() >= MIN_LVL) ? "30350-02.htm" : "30350-01.htm";
  120. break;
  121. }
  122. case State.STARTED:
  123. {
  124. if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER))
  125. {
  126. htmltext = "30350-04.html";
  127. }
  128. break;
  129. }
  130. case State.COMPLETED:
  131. {
  132. htmltext = getAlreadyCompletedMsg(player);
  133. break;
  134. }
  135. }
  136. break;
  137. }
  138. case HAPROCK:
  139. {
  140. if (st.isCond(1) && st.hasQuestItems(CARLONS_LETTER))
  141. {
  142. htmltext = "30255-01.html";
  143. }
  144. else if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER))
  145. {
  146. htmltext = "30255-05.html";
  147. }
  148. break;
  149. }
  150. case NORMAN:
  151. {
  152. if (st.isCond(2) && st.hasQuestItems(NORMANS_LETTER))
  153. {
  154. htmltext = "30210-01.html";
  155. }
  156. break;
  157. }
  158. }
  159. }
  160. return htmltext;
  161. }
  162. }