Q00019_GoToThePastureland.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.Q00019_GoToThePastureland;
  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. * Go to the Pastureland (19)<br>
  27. * Original Jython script by disKret.
  28. * @author malyelfik
  29. */
  30. public class Q00019_GoToThePastureland extends Quest
  31. {
  32. // NPCs
  33. private static final int VLADIMIR = 31302;
  34. private static final int TUNATUN = 31537;
  35. // Items
  36. private static final int VEAL = 15532;
  37. private static final int YOUNG_WILD_BEAST_MEAT = 7547;
  38. public Q00019_GoToThePastureland()
  39. {
  40. super(19, Q00019_GoToThePastureland.class.getSimpleName(), "Go to the Pastureland");
  41. addStartNpc(VLADIMIR);
  42. addTalkId(VLADIMIR, TUNATUN);
  43. registerQuestItems(VEAL, YOUNG_WILD_BEAST_MEAT);
  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 getNoQuestMsg(player);
  53. }
  54. if (event.equalsIgnoreCase("31302-02.htm"))
  55. {
  56. st.startQuest();
  57. st.giveItems(VEAL, 1);
  58. }
  59. else if (event.equalsIgnoreCase("31537-02.html"))
  60. {
  61. if (st.hasQuestItems(YOUNG_WILD_BEAST_MEAT))
  62. {
  63. st.giveAdena(50000, true);
  64. st.addExpAndSp(136766, 12688);
  65. st.exitQuest(false, true);
  66. htmltext = "31537-02.html";
  67. }
  68. else if (st.hasQuestItems(VEAL))
  69. {
  70. st.giveAdena(147200, true);
  71. st.addExpAndSp(385040, 75250);
  72. st.exitQuest(false, true);
  73. htmltext = "31537-02.html";
  74. }
  75. else
  76. {
  77. htmltext = "31537-03.html";
  78. }
  79. }
  80. return htmltext;
  81. }
  82. @Override
  83. public String onTalk(L2Npc npc, L2PcInstance player)
  84. {
  85. String htmltext = getNoQuestMsg(player);
  86. final QuestState st = getQuestState(player, true);
  87. if (st == null)
  88. {
  89. return htmltext;
  90. }
  91. if (npc.getId() == VLADIMIR)
  92. {
  93. switch (st.getState())
  94. {
  95. case State.CREATED:
  96. if (player.getLevel() >= 82)
  97. {
  98. htmltext = "31302-01.htm";
  99. }
  100. else
  101. {
  102. htmltext = "31302-03.html";
  103. }
  104. break;
  105. case State.STARTED:
  106. htmltext = "31302-04.html";
  107. break;
  108. case State.COMPLETED:
  109. htmltext = getAlreadyCompletedMsg(player);
  110. break;
  111. }
  112. }
  113. else if ((npc.getId() == TUNATUN) && (st.isCond(1)))
  114. {
  115. htmltext = "31537-01.html";
  116. }
  117. return htmltext;
  118. }
  119. }