Q00012_SecretMeetingWithVarkaSilenos.java 3.4 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.Q00012_SecretMeetingWithVarkaSilenos;
  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 Varka Silenos (12)<br>
  27. * Original Jython script by Emperorc.
  28. * @author nonom
  29. */
  30. public class Q00012_SecretMeetingWithVarkaSilenos extends Quest
  31. {
  32. // NPCs
  33. private static final int CADMON = 31296;
  34. private static final int HELMUT = 31258;
  35. private static final int NARAN = 31378;
  36. // Item
  37. private static final int BOX = 7232;
  38. public Q00012_SecretMeetingWithVarkaSilenos()
  39. {
  40. super(12, Q00012_SecretMeetingWithVarkaSilenos.class.getSimpleName(), "Secret Meeting With Varka Silenos");
  41. addStartNpc(CADMON);
  42. addTalkId(CADMON, HELMUT, NARAN);
  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 "31258-02.html":
  60. if (st.isCond(1))
  61. {
  62. st.setCond(2, true);
  63. giveItems(player, BOX, 1);
  64. }
  65. break;
  66. case "31378-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 = "31378-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. final 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. final int cond = st.getInt("cond");
  103. if ((npcId == CADMON) && (cond == 1))
  104. {
  105. htmltext = "31296-04.html";
  106. }
  107. else if (npcId == HELMUT)
  108. {
  109. if (cond == 1)
  110. {
  111. htmltext = "31258-01.html";
  112. }
  113. else if (cond == 2)
  114. {
  115. htmltext = "31258-03.html";
  116. }
  117. }
  118. else if ((npcId == NARAN) && (cond == 2))
  119. {
  120. htmltext = "31378-01.html";
  121. }
  122. break;
  123. }
  124. return htmltext;
  125. }
  126. }