Q00179_IntoTheLargeCavern.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.Q00179_IntoTheLargeCavern;
  20. import com.l2jserver.gameserver.enums.Race;
  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. * Into the Large Cavern (179)
  28. * @author Gnacik
  29. * @version 2010-10-15 Based on official server Naia
  30. */
  31. public class Q00179_IntoTheLargeCavern extends Quest
  32. {
  33. // NPCs
  34. private static final int KEKROPUS = 32138;
  35. private static final int MENACING_MACHINE = 32258;
  36. public Q00179_IntoTheLargeCavern()
  37. {
  38. super(179, Q00179_IntoTheLargeCavern.class.getSimpleName(), "Into The Large Cavern");
  39. addStartNpc(KEKROPUS);
  40. addTalkId(KEKROPUS, MENACING_MACHINE);
  41. }
  42. @Override
  43. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  44. {
  45. String htmltext = event;
  46. final QuestState st = getQuestState(player, false);
  47. if (st == null)
  48. {
  49. return htmltext;
  50. }
  51. if (npc.getId() == KEKROPUS)
  52. {
  53. if (event.equalsIgnoreCase("32138-03.html"))
  54. {
  55. st.startQuest();
  56. }
  57. }
  58. else if (npc.getId() == MENACING_MACHINE)
  59. {
  60. if (event.equalsIgnoreCase("32258-08.html"))
  61. {
  62. st.giveItems(391, 1);
  63. st.giveItems(413, 1);
  64. st.exitQuest(false, true);
  65. }
  66. else if (event.equalsIgnoreCase("32258-09.html"))
  67. {
  68. st.giveItems(847, 2);
  69. st.giveItems(890, 2);
  70. st.giveItems(910, 1);
  71. st.exitQuest(false, true);
  72. }
  73. }
  74. return htmltext;
  75. }
  76. @Override
  77. public String onTalk(L2Npc npc, L2PcInstance player)
  78. {
  79. String htmltext = getNoQuestMsg(player);
  80. final QuestState st = getQuestState(player, true);
  81. if (st == null)
  82. {
  83. return htmltext;
  84. }
  85. if (npc.getId() == KEKROPUS)
  86. {
  87. switch (st.getState())
  88. {
  89. case State.CREATED:
  90. if (player.getRace() != Race.KAMAEL)
  91. {
  92. htmltext = "32138-00b.html";
  93. }
  94. else
  95. {
  96. final QuestState prev = player.getQuestState("178_IconicTrinity");
  97. final int level = player.getLevel();
  98. if ((prev != null) && prev.isCompleted() && (level >= 17) && (level <= 21) && (player.getClassId().level() == 0))
  99. {
  100. htmltext = "32138-01.htm";
  101. }
  102. else if (level < 17)
  103. {
  104. htmltext = "32138-00.html";
  105. }
  106. else
  107. {
  108. htmltext = "32138-00c.html";
  109. }
  110. }
  111. break;
  112. case State.STARTED:
  113. if (st.isCond(1))
  114. {
  115. htmltext = "32138-03.htm";
  116. }
  117. break;
  118. case State.COMPLETED:
  119. htmltext = getAlreadyCompletedMsg(player);
  120. break;
  121. }
  122. }
  123. else if ((npc.getId() == MENACING_MACHINE) && (st.getState() == State.STARTED))
  124. {
  125. htmltext = "32258-01.html";
  126. }
  127. return htmltext;
  128. }
  129. }