Q19_GoToThePastureland.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package quests.Q19_GoToThePastureland;
  16. import com.l2jserver.gameserver.model.actor.L2Npc;
  17. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18. import com.l2jserver.gameserver.model.quest.Quest;
  19. import com.l2jserver.gameserver.model.quest.QuestState;
  20. import com.l2jserver.gameserver.model.quest.State;
  21. /**
  22. * Go to the Pastureland (19)
  23. * @author disKret, malyelfik
  24. */
  25. public class Q19_GoToThePastureland extends Quest
  26. {
  27. private static final String qn = "19_GoToThePastureland";
  28. // NPC
  29. private static final int Vladimir = 31302;
  30. private static final int Tunatun = 31537;
  31. // Items
  32. private static final int Veal = 15532;
  33. private static final int YoungWildBeastMeat = 7547;
  34. @Override
  35. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  36. {
  37. String htmltext = event;
  38. QuestState st = player.getQuestState(qn);
  39. if (st == null)
  40. return getNoQuestMsg(player);
  41. if (event.equalsIgnoreCase("31302-02.htm"))
  42. {
  43. st.set("cond", "1");
  44. st.setState(State.STARTED);
  45. st.playSound("ItemSound.quest_accept");
  46. st.giveItems(Veal, 1);
  47. }
  48. else if (event.equalsIgnoreCase("31537-02.html"))
  49. {
  50. if (st.getQuestItemsCount(YoungWildBeastMeat) >= 1)
  51. {
  52. st.takeItems(YoungWildBeastMeat, 1);
  53. st.giveItems(57, 50000);
  54. st.addExpAndSp(136766, 12688);
  55. st.playSound("ItemSound.quest_finish");
  56. st.exitQuest(false);
  57. htmltext = "31537-02.html";
  58. }
  59. else if (st.getQuestItemsCount(Veal) >= 1)
  60. {
  61. st.takeItems(Veal, 1);
  62. st.giveItems(57, 147200);
  63. st.addExpAndSp(385040, 75250);
  64. st.playSound("ItemSound.quest_finish");
  65. st.exitQuest(false);
  66. htmltext = "31537-02.html";
  67. }
  68. else
  69. {
  70. htmltext = "31537-03.html";
  71. }
  72. }
  73. return htmltext;
  74. }
  75. @Override
  76. public String onTalk(L2Npc npc, L2PcInstance player)
  77. {
  78. String htmltext = getNoQuestMsg(player);
  79. QuestState st = player.getQuestState(qn);
  80. if (st == null)
  81. return htmltext;
  82. if (npc.getNpcId() == Vladimir)
  83. {
  84. switch (st.getState())
  85. {
  86. case State.CREATED:
  87. if (player.getLevel() >= 82)
  88. htmltext = "31302-01.htm";
  89. else
  90. htmltext = "31302-03.html";
  91. break;
  92. case State.STARTED:
  93. htmltext = "31302-04.html";
  94. break;
  95. case State.COMPLETED:
  96. htmltext = getAlreadyCompletedMsg(player);
  97. break;
  98. }
  99. }
  100. else if (npc.getNpcId() == Tunatun && st.getInt("cond") == 1)
  101. {
  102. htmltext = "31537-01.html";
  103. }
  104. return htmltext;
  105. }
  106. public Q19_GoToThePastureland(int questId, String name, String descr)
  107. {
  108. super(questId, name, descr);
  109. addStartNpc(Vladimir);
  110. addTalkId(Vladimir);
  111. addTalkId(Tunatun);
  112. questItemIds = new int[] { Veal, YoungWildBeastMeat };
  113. }
  114. public static void main(String[] args)
  115. {
  116. new Q19_GoToThePastureland(19, qn, "Go to the Pastureland");
  117. }
  118. }