Q00283_TheFewTheProudTheBrave.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.Q00283_TheFewTheProudTheBrave;
  20. import quests.Q00261_CollectorsDream.Q00261_CollectorsDream;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * The Few, The Proud, The Brave (283)
  28. * @author xban1x
  29. */
  30. public final class Q00283_TheFewTheProudTheBrave extends Quest
  31. {
  32. // NPC
  33. private static final int PERWAN = 32133;
  34. // Item
  35. private static final int CRIMSON_SPIDER_CLAW = 9747;
  36. // Monster
  37. private static final int CRIMSON_SPIDER = 22244;
  38. // Misc
  39. private static final int CLAW_PRICE = 45;
  40. private static final int BONUS = 2187;
  41. private static final int MIN_LVL = 15;
  42. public Q00283_TheFewTheProudTheBrave()
  43. {
  44. super(283, Q00283_TheFewTheProudTheBrave.class.getSimpleName(), "The Few, The Proud, The Brave");
  45. addKillId(CRIMSON_SPIDER);
  46. addStartNpc(PERWAN);
  47. addTalkId(PERWAN);
  48. registerQuestItems(CRIMSON_SPIDER_CLAW);
  49. }
  50. @Override
  51. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  52. {
  53. final QuestState st = getQuestState(player, false);
  54. String htmltext = null;
  55. if (st == null)
  56. {
  57. return htmltext;
  58. }
  59. switch (event)
  60. {
  61. case "32133-03.htm":
  62. {
  63. st.startQuest();
  64. htmltext = event;
  65. break;
  66. }
  67. case "32133-06.html":
  68. {
  69. htmltext = event;
  70. break;
  71. }
  72. case "32133-08.html":
  73. {
  74. if (st.hasQuestItems(CRIMSON_SPIDER_CLAW))
  75. {
  76. final long claws = st.getQuestItemsCount(CRIMSON_SPIDER_CLAW);
  77. st.giveAdena((claws * CLAW_PRICE) + ((claws >= 10) ? BONUS : 0), true);
  78. st.takeItems(CRIMSON_SPIDER_CLAW, -1);
  79. Q00261_CollectorsDream.giveNewbieReward(player);
  80. htmltext = event;
  81. }
  82. else
  83. {
  84. htmltext = "32133-07.html";
  85. }
  86. break;
  87. }
  88. case "32133-09.html":
  89. {
  90. st.exitQuest(true, true);
  91. htmltext = event;
  92. break;
  93. }
  94. }
  95. return htmltext;
  96. }
  97. @Override
  98. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  99. {
  100. final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc);
  101. if (st != null)
  102. {
  103. st.giveItemRandomly(npc, CRIMSON_SPIDER_CLAW, 1, 0, 0.6, true);
  104. }
  105. return super.onKill(npc, killer, isSummon);
  106. }
  107. @Override
  108. public String onTalk(L2Npc npc, L2PcInstance talker)
  109. {
  110. final QuestState st = getQuestState(talker, true);
  111. String htmltext = getNoQuestMsg(talker);
  112. if (st == null)
  113. {
  114. return htmltext;
  115. }
  116. switch (st.getState())
  117. {
  118. case State.CREATED:
  119. {
  120. htmltext = (talker.getLevel() >= MIN_LVL) ? "32133-01.htm" : "32133-02.htm";
  121. break;
  122. }
  123. case State.STARTED:
  124. {
  125. htmltext = st.hasQuestItems(CRIMSON_SPIDER_CLAW) ? "32133-04.html" : "32133-05.html";
  126. break;
  127. }
  128. }
  129. return htmltext;
  130. }
  131. }