Q00155_FindSirWindawood.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.Q00155_FindSirWindawood;
  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. * Find Sir Windawood (155)
  27. * @author malyelfik
  28. */
  29. public class Q00155_FindSirWindawood extends Quest
  30. {
  31. // NPCs
  32. private static final int ABELLOS = 30042;
  33. private static final int SIR_COLLIN_WINDAWOOD = 30311;
  34. // Items
  35. private static final int OFFICIAL_LETTER = 1019;
  36. private static final int HASTE_POTION = 734;
  37. // Misc
  38. private static final int MIN_LEVEL = 3;
  39. public Q00155_FindSirWindawood()
  40. {
  41. super(155, Q00155_FindSirWindawood.class.getSimpleName(), "Find Sir Windawood");
  42. addStartNpc(ABELLOS);
  43. addTalkId(ABELLOS, SIR_COLLIN_WINDAWOOD);
  44. registerQuestItems(OFFICIAL_LETTER);
  45. }
  46. @Override
  47. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  48. {
  49. final QuestState st = getQuestState(player, false);
  50. if ((st != null) && event.equalsIgnoreCase("30042-03.htm"))
  51. {
  52. st.startQuest();
  53. st.giveItems(OFFICIAL_LETTER, 1);
  54. return event;
  55. }
  56. return null;
  57. }
  58. @Override
  59. public String onTalk(L2Npc npc, L2PcInstance player)
  60. {
  61. String htmltext = getNoQuestMsg(player);
  62. final QuestState st = getQuestState(player, true);
  63. if (st == null)
  64. {
  65. return htmltext;
  66. }
  67. switch (npc.getId())
  68. {
  69. case ABELLOS:
  70. switch (st.getState())
  71. {
  72. case State.CREATED:
  73. htmltext = (player.getLevel() >= MIN_LEVEL) ? "30042-02.htm" : "30042-01.htm";
  74. break;
  75. case State.STARTED:
  76. htmltext = "30042-04.html";
  77. break;
  78. case State.COMPLETED:
  79. htmltext = getAlreadyCompletedMsg(player);
  80. break;
  81. }
  82. break;
  83. case SIR_COLLIN_WINDAWOOD:
  84. if (st.isStarted() && st.hasQuestItems(OFFICIAL_LETTER))
  85. {
  86. st.giveItems(HASTE_POTION, 1);
  87. st.exitQuest(false, true);
  88. htmltext = "30311-01.html";
  89. }
  90. break;
  91. }
  92. return htmltext;
  93. }
  94. }