Q00011_SecretMeetingWithKetraOrcs.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.Q00011_SecretMeetingWithKetraOrcs;
  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. * Secret Meeting With Ketra Orcs (11)<br>
  27. * Original Jython script by Emperorc.
  28. * @author nonom
  29. */
  30. public class Q00011_SecretMeetingWithKetraOrcs extends Quest
  31. {
  32. // NPCs
  33. private static final int CADMON = 31296;
  34. private static final int LEON = 31256;
  35. private static final int WAHKAN = 31371;
  36. // Item
  37. private static final int BOX = 7231;
  38. public Q00011_SecretMeetingWithKetraOrcs()
  39. {
  40. super(11, Q00011_SecretMeetingWithKetraOrcs.class.getSimpleName(), "Secret Meeting With Ketra Orcs");
  41. addStartNpc(CADMON);
  42. addTalkId(CADMON, LEON, WAHKAN);
  43. registerQuestItems(BOX);
  44. }
  45. @Override
  46. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  47. {
  48. String htmltext = event;
  49. final QuestState st = getQuestState(player, false);
  50. if (st == null)
  51. {
  52. return htmltext;
  53. }
  54. switch (event)
  55. {
  56. case "31296-03.html":
  57. st.startQuest();
  58. break;
  59. case "31256-02.html":
  60. if (st.isCond(1))
  61. {
  62. st.setCond(2, true);
  63. st.giveItems(BOX, 1);
  64. }
  65. break;
  66. case "31371-02.html":
  67. if (st.isCond(2) && st.hasQuestItems(BOX))
  68. {
  69. st.addExpAndSp(233125, 18142);
  70. st.exitQuest(false, true);
  71. }
  72. else
  73. {
  74. htmltext = "31371-03.html";
  75. }
  76. break;
  77. }
  78. return htmltext;
  79. }
  80. @Override
  81. public String onTalk(L2Npc npc, L2PcInstance player)
  82. {
  83. String htmltext = getNoQuestMsg(player);
  84. final QuestState st = getQuestState(player, true);
  85. if (st == null)
  86. {
  87. return htmltext;
  88. }
  89. int npcId = npc.getId();
  90. switch (st.getState())
  91. {
  92. case State.COMPLETED:
  93. htmltext = getAlreadyCompletedMsg(player);
  94. break;
  95. case State.CREATED:
  96. if (npcId == CADMON)
  97. {
  98. htmltext = (player.getLevel() >= 74) ? "31296-01.htm" : "31296-02.html";
  99. }
  100. break;
  101. case State.STARTED:
  102. if ((npcId == CADMON) && st.isCond(1))
  103. {
  104. htmltext = "31296-04.html";
  105. }
  106. else if (npcId == LEON)
  107. {
  108. if (st.isCond(1))
  109. {
  110. htmltext = "31256-01.html";
  111. }
  112. else if (st.isCond(2))
  113. {
  114. htmltext = "31256-03.html";
  115. }
  116. }
  117. else if ((npcId == WAHKAN) && st.isCond(2))
  118. {
  119. htmltext = "31371-01.html";
  120. }
  121. break;
  122. }
  123. return htmltext;
  124. }
  125. }