Q00653_WildMaiden.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.Q00653_WildMaiden;
  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. * Wild Maiden (653)
  27. * @author malyelfik
  28. */
  29. public class Q00653_WildMaiden extends Quest
  30. {
  31. // NPCs
  32. private static final int GALIBREDO = 30181;
  33. private static final int SUKI = 32013;
  34. // Item
  35. private static final int SOE = 736;
  36. // Misc
  37. private static final int MIN_LEVEL = 36;
  38. public Q00653_WildMaiden()
  39. {
  40. super(653, Q00653_WildMaiden.class.getSimpleName(), "Wild Maiden");
  41. addStartNpc(SUKI);
  42. addTalkId(GALIBREDO, SUKI);
  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)
  49. {
  50. return null;
  51. }
  52. String htmltext = null;
  53. if (event.equals("32013-03.html"))
  54. {
  55. htmltext = event;
  56. }
  57. else if (event.equals("32013-04.htm"))
  58. {
  59. if (!st.hasQuestItems(SOE))
  60. {
  61. return "32013-05.htm";
  62. }
  63. st.startQuest();
  64. st.takeItems(SOE, 1);
  65. npc.deleteMe();
  66. htmltext = (getRandom(2) == 0) ? event : "32013-04a.htm";
  67. }
  68. return htmltext;
  69. }
  70. @Override
  71. public String onTalk(L2Npc npc, L2PcInstance player)
  72. {
  73. String htmltext = getNoQuestMsg(player);
  74. final QuestState st = getQuestState(player, true);
  75. if (st == null)
  76. {
  77. return htmltext;
  78. }
  79. switch (npc.getId())
  80. {
  81. case SUKI:
  82. switch (st.getState())
  83. {
  84. case State.CREATED:
  85. htmltext = (player.getLevel() >= MIN_LEVEL) ? "32013-01.htm" : "32013-01a.htm";
  86. break;
  87. case State.STARTED:
  88. htmltext = "32013-02.htm";
  89. break;
  90. }
  91. break;
  92. case GALIBREDO:
  93. if (st.isStarted())
  94. {
  95. st.giveAdena(2553, true);
  96. st.exitQuest(true, true);
  97. htmltext = "30181-01.html";
  98. }
  99. break;
  100. }
  101. return htmltext;
  102. }
  103. }