Q00112_WalkOfFate.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.Q00112_WalkOfFate;
  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. * Walk of Fate (112)
  27. * @author Zoey76
  28. */
  29. public class Q00112_WalkOfFate extends Quest
  30. {
  31. // NPCs
  32. private static final int LIVINA = 30572;
  33. private static final int KARUDA = 32017;
  34. // Item
  35. private static final int SCROLL_ENCHANT_ARMOR_D_GRADE = 956;
  36. // Misc
  37. private static final int MIN_LEVEL = 20;
  38. public Q00112_WalkOfFate()
  39. {
  40. super(112, Q00112_WalkOfFate.class.getSimpleName(), "Walk of Fate");
  41. addStartNpc(LIVINA);
  42. addTalkId(LIVINA, KARUDA);
  43. }
  44. @Override
  45. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  46. {
  47. final QuestState st = getQuestState(player, false);
  48. if ((st == null) || (player.getLevel() < MIN_LEVEL))
  49. {
  50. return null;
  51. }
  52. String htmltext = null;
  53. switch (event)
  54. {
  55. case "30572-04.htm":
  56. {
  57. st.startQuest();
  58. htmltext = event;
  59. break;
  60. }
  61. case "32017-02.html":
  62. {
  63. st.giveAdena(22308, true);
  64. st.addExpAndSp(112876, 5774);
  65. st.giveItems(SCROLL_ENCHANT_ARMOR_D_GRADE, 1);
  66. st.exitQuest(false, true);
  67. htmltext = event;
  68. }
  69. }
  70. return htmltext;
  71. }
  72. @Override
  73. public String onTalk(L2Npc npc, L2PcInstance player)
  74. {
  75. final QuestState st = getQuestState(player, true);
  76. String htmltext = getNoQuestMsg(player);
  77. if (st == null)
  78. {
  79. return htmltext;
  80. }
  81. switch (st.getState())
  82. {
  83. case State.CREATED:
  84. htmltext = (player.getLevel() < MIN_LEVEL) ? "30572-03.html" : "30572-01.htm";
  85. break;
  86. case State.STARTED:
  87. switch (npc.getId())
  88. {
  89. case LIVINA:
  90. {
  91. htmltext = "30572-05.html";
  92. break;
  93. }
  94. case KARUDA:
  95. {
  96. htmltext = "32017-01.html";
  97. break;
  98. }
  99. }
  100. break;
  101. case State.COMPLETED:
  102. {
  103. htmltext = getAlreadyCompletedMsg(player);
  104. break;
  105. }
  106. }
  107. return htmltext;
  108. }
  109. }