Q00121_PavelTheGiant.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.Q00121_PavelTheGiant;
  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. * Pavel the Giants (121)<br>
  27. * Original Jython script by Ethernaly.
  28. * @author malyelfik
  29. */
  30. public class Q00121_PavelTheGiant extends Quest
  31. {
  32. // NPCs
  33. private static final int NEWYEAR = 31961;
  34. private static final int YUMI = 32041;
  35. public Q00121_PavelTheGiant()
  36. {
  37. super(121, Q00121_PavelTheGiant.class.getSimpleName(), "Pavel the Giant");
  38. addStartNpc(NEWYEAR);
  39. addTalkId(NEWYEAR, YUMI);
  40. }
  41. @Override
  42. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  43. {
  44. final QuestState st = getQuestState(player, false);
  45. if (st == null)
  46. {
  47. return getNoQuestMsg(player);
  48. }
  49. switch (event)
  50. {
  51. case "31961-02.htm":
  52. st.startQuest();
  53. break;
  54. case "32041-02.html":
  55. st.addExpAndSp(346320, 26069);
  56. st.exitQuest(false, true);
  57. break;
  58. }
  59. return event;
  60. }
  61. @Override
  62. public String onTalk(L2Npc npc, L2PcInstance player)
  63. {
  64. String htmltext = getNoQuestMsg(player);
  65. final QuestState st = getQuestState(player, true);
  66. if (st == null)
  67. {
  68. return htmltext;
  69. }
  70. switch (npc.getId())
  71. {
  72. case NEWYEAR:
  73. switch (st.getState())
  74. {
  75. case State.CREATED:
  76. htmltext = (player.getLevel() >= 70) ? "31961-01.htm" : "31961-00.htm";
  77. break;
  78. case State.STARTED:
  79. htmltext = "31961-03.html";
  80. break;
  81. case State.COMPLETED:
  82. htmltext = getAlreadyCompletedMsg(player);
  83. break;
  84. }
  85. break;
  86. case YUMI:
  87. if (st.isStarted())
  88. {
  89. htmltext = "32041-01.html";
  90. }
  91. break;
  92. }
  93. return htmltext;
  94. }
  95. }