Q00286_FabulousFeathers.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.Q00286_FabulousFeathers;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.holders.ItemHolder;
  25. import com.l2jserver.gameserver.model.quest.Quest;
  26. import com.l2jserver.gameserver.model.quest.QuestState;
  27. /**
  28. * Fabulous Feathers (286).
  29. * @author xban1x
  30. */
  31. public final class Q00286_FabulousFeathers extends Quest
  32. {
  33. // NPC
  34. private static final int ERINU = 32164;
  35. // Item
  36. private static final ItemHolder COMMANDERS_FEATHER = new ItemHolder(9746, 80);
  37. // Monsters
  38. private static final Map<Integer, Double> MOB_DROP_CHANCES = new HashMap<>();
  39. static
  40. {
  41. MOB_DROP_CHANCES.put(22251, 0.748); // Shady Muertos Captain
  42. MOB_DROP_CHANCES.put(22253, 0.772); // Shady Muertos Warrior
  43. MOB_DROP_CHANCES.put(22254, 0.772); // Shady Muertos Archer
  44. MOB_DROP_CHANCES.put(22255, 0.796); // Shady Muertos Commander
  45. MOB_DROP_CHANCES.put(22256, 0.952); // Shady Muertos Wizard
  46. }
  47. // Misc
  48. private static final int MIN_LVL = 17;
  49. public Q00286_FabulousFeathers()
  50. {
  51. super(286, Q00286_FabulousFeathers.class.getSimpleName(), "Fabulous Feathers");
  52. addStartNpc(ERINU);
  53. addTalkId(ERINU);
  54. addKillId(MOB_DROP_CHANCES.keySet());
  55. registerQuestItems(COMMANDERS_FEATHER.getId());
  56. }
  57. @Override
  58. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  59. {
  60. final QuestState qs = getQuestState(player, false);
  61. String html = null;
  62. if (qs == null)
  63. {
  64. return html;
  65. }
  66. switch (event)
  67. {
  68. case "32164-03.htm":
  69. {
  70. qs.startQuest();
  71. html = event;
  72. break;
  73. }
  74. case "32164-06.html":
  75. {
  76. if (qs.isCond(2) && hasItem(player, COMMANDERS_FEATHER))
  77. {
  78. takeItem(player, COMMANDERS_FEATHER);
  79. giveAdena(player, 4160, true);
  80. qs.exitQuest(true, true);
  81. html = event;
  82. }
  83. else
  84. {
  85. html = "32164-07.html";
  86. }
  87. break;
  88. }
  89. }
  90. return html;
  91. }
  92. @Override
  93. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  94. {
  95. final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
  96. if (qs != null)
  97. {
  98. if (giveItemRandomly(qs.getPlayer(), npc, COMMANDERS_FEATHER.getId(), 1, COMMANDERS_FEATHER.getCount(), MOB_DROP_CHANCES.get(npc.getId()), true))
  99. {
  100. qs.setCond(2);
  101. }
  102. }
  103. return super.onKill(npc, killer, isSummon);
  104. }
  105. @Override
  106. public String onTalk(L2Npc npc, L2PcInstance player)
  107. {
  108. final QuestState qs = getQuestState(player, true);
  109. String html = getNoQuestMsg(player);
  110. if (qs.isCreated())
  111. {
  112. html = ((player.getLevel() >= MIN_LVL) ? "32164-01.htm" : "32164-02.htm");
  113. }
  114. else if (qs.isStarted())
  115. {
  116. html = ((qs.isCond(2) && hasItem(player, COMMANDERS_FEATHER)) ? "32164-04.html" : "32164-05.html");
  117. }
  118. return html;
  119. }
  120. }