Q00113_StatusOfTheBeaconTower.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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.Q00113_StatusOfTheBeaconTower;
  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. * Status of the Beacon Tower (113)<br>
  27. * Original Jython script by Kerberos.
  28. * @author malyelfik
  29. */
  30. public class Q00113_StatusOfTheBeaconTower extends Quest
  31. {
  32. // NPCs
  33. private static final int MOIRA = 31979;
  34. private static final int TORRANT = 32016;
  35. // Items
  36. private static final int FLAME_BOX = 14860;
  37. private static final int FIRE_BOX = 8086;
  38. public Q00113_StatusOfTheBeaconTower()
  39. {
  40. super(113, Q00113_StatusOfTheBeaconTower.class.getSimpleName(), "Status of the Beacon Tower");
  41. addStartNpc(MOIRA);
  42. addTalkId(MOIRA, TORRANT);
  43. registerQuestItems(FIRE_BOX, FLAME_BOX);
  44. }
  45. @Override
  46. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  47. {
  48. final QuestState st = getQuestState(player, false);
  49. if (st == null)
  50. {
  51. return null;
  52. }
  53. String htmltext = event;
  54. switch (event)
  55. {
  56. case "31979-02.htm":
  57. st.startQuest();
  58. st.giveItems(FLAME_BOX, 1);
  59. break;
  60. case "32016-02.html":
  61. if (st.hasQuestItems(FIRE_BOX))
  62. {
  63. st.giveAdena(21578, true);
  64. st.addExpAndSp(76665, 5333);
  65. }
  66. else
  67. {
  68. st.giveAdena(154800, true);
  69. st.addExpAndSp(619300, 44200);
  70. }
  71. st.exitQuest(false, true);
  72. break;
  73. default:
  74. htmltext = null;
  75. break;
  76. }
  77. return htmltext;
  78. }
  79. @Override
  80. public String onTalk(L2Npc npc, L2PcInstance player)
  81. {
  82. String htmltext = getNoQuestMsg(player);
  83. final QuestState st = getQuestState(player, true);
  84. if (st == null)
  85. {
  86. return htmltext;
  87. }
  88. switch (npc.getId())
  89. {
  90. case MOIRA:
  91. switch (st.getState())
  92. {
  93. case State.CREATED:
  94. htmltext = (player.getLevel() >= 80) ? "31979-01.htm" : "31979-00.htm";
  95. break;
  96. case State.STARTED:
  97. htmltext = "31979-03.html";
  98. break;
  99. case State.COMPLETED:
  100. htmltext = getAlreadyCompletedMsg(player);
  101. break;
  102. }
  103. break;
  104. case TORRANT:
  105. if (st.isStarted())
  106. {
  107. htmltext = "32016-01.html";
  108. }
  109. break;
  110. }
  111. return htmltext;
  112. }
  113. }