Q10283_RequestOfIceMerchant.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.Q10283_RequestOfIceMerchant;
  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. ** @author Gnacik
  23. **
  24. ** 2010-08-07 Based on Freya PTS
  25. */
  26. public class Q10283_RequestOfIceMerchant extends Quest
  27. {
  28. private static final String qn = "10283_RequestOfIceMerchant";
  29. // NPC's
  30. private static final int _rafforty = 32020;
  31. private static final int _kier = 32022;
  32. private static final int _jinia = 32760;
  33. public Q10283_RequestOfIceMerchant(int questId, String name, String descr)
  34. {
  35. super(questId, name, descr);
  36. addStartNpc(_rafforty);
  37. addTalkId(_rafforty);
  38. addTalkId(_kier);
  39. addFirstTalkId(_jinia);
  40. addTalkId(_jinia);
  41. }
  42. @Override
  43. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  44. {
  45. String htmltext = event;
  46. QuestState st = player.getQuestState(qn);
  47. if (st == null)
  48. return htmltext;
  49. if (npc.getNpcId() == _rafforty)
  50. {
  51. if (event.equalsIgnoreCase("32020-03.htm"))
  52. {
  53. st.setState(State.STARTED);
  54. st.set("cond", "1");
  55. st.playSound("ItemSound.quest_accept");
  56. }
  57. else if (event.equalsIgnoreCase("32020-07.htm"))
  58. {
  59. st.set("cond", "2");
  60. st.playSound("ItemSound.quest_middle");
  61. }
  62. }
  63. else if (npc.getNpcId() == _kier && event.equalsIgnoreCase("spawn"))
  64. {
  65. addSpawn(_jinia, 104322, -107669, -3680, 44954, false, 60000);
  66. return null;
  67. }
  68. else if (npc.getNpcId() == _jinia && event.equalsIgnoreCase("32760-04.html"))
  69. {
  70. st.giveItems(57, 190000);
  71. st.addExpAndSp(627000, 50300);
  72. st.playSound("ItemSound.quest_finish");
  73. st.exitQuest(false);
  74. npc.deleteMe();
  75. }
  76. return htmltext;
  77. }
  78. @Override
  79. public String onTalk(L2Npc npc, L2PcInstance player)
  80. {
  81. String htmltext = getNoQuestMsg(player);
  82. QuestState st = player.getQuestState(qn);
  83. if (st == null)
  84. return htmltext;
  85. if (npc.getNpcId() == _rafforty)
  86. {
  87. switch (st.getState())
  88. {
  89. case State.CREATED:
  90. QuestState _prev = player.getQuestState("115_TheOtherSideOfTruth");
  91. if ((_prev != null) && (_prev.getState() == State.COMPLETED) && (player.getLevel() >= 82))
  92. htmltext = "32020-01.htm";
  93. else
  94. htmltext = "32020-00.htm";
  95. break;
  96. case State.STARTED:
  97. if (st.getInt("cond") == 1)
  98. htmltext = "32020-04.htm";
  99. else if (st.getInt("cond") == 2)
  100. htmltext = "32020-08.htm";
  101. break;
  102. case State.COMPLETED:
  103. htmltext = "32020-09.htm";
  104. break;
  105. }
  106. }
  107. else if (npc.getNpcId() == _kier && st.getInt("cond") == 2)
  108. {
  109. htmltext = "32022-01.html";
  110. }
  111. else if (npc.getNpcId() == _jinia && st.getInt("cond") == 2)
  112. {
  113. htmltext = "32760-02.html";
  114. }
  115. return htmltext;
  116. }
  117. @Override
  118. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  119. {
  120. QuestState st = player.getQuestState(qn);
  121. if (npc.getInstanceId() > 0)
  122. return "32760-10.html";
  123. if (npc.getNpcId() == _jinia && st != null && st.getInt("cond") == 2)
  124. return "32760-01.html";
  125. return null;
  126. }
  127. public static void main(String[] args)
  128. {
  129. new Q10283_RequestOfIceMerchant(10283, qn, "Request of Ice Merchant");
  130. }
  131. }