Hude.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 hellbound.Hude;
  16. import com.l2jserver.gameserver.datatables.MultiSell;
  17. import com.l2jserver.gameserver.instancemanager.HellboundManager;
  18. import com.l2jserver.gameserver.model.actor.L2Npc;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. import com.l2jserver.gameserver.model.quest.Quest;
  21. import com.l2jserver.gameserver.model.quest.QuestState;
  22. /**
  23. * @author DS
  24. */
  25. public class Hude extends Quest
  26. {
  27. private static final int HUDE = 32298;
  28. private static final int BASIC_CERT = 9850;
  29. private static final int STANDART_CERT = 9851;
  30. private static final int PREMIUM_CERT = 9852;
  31. private static final int MARK_OF_BETRAYAL = 9676;
  32. private static final int LIFE_FORCE = 9681;
  33. private static final int CONTAINED_LIFE_FORCE = 9682;
  34. private static final int MAP = 9994;
  35. private static final int STINGER = 10012;
  36. @Override
  37. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  38. {
  39. QuestState qs = player.getQuestState(getName());
  40. if (qs == null)
  41. {
  42. qs = newQuestState(player);
  43. }
  44. if ("scertif".equalsIgnoreCase(event))
  45. {
  46. if (HellboundManager.getInstance().getLevel() > 3)
  47. {
  48. if (qs.hasQuestItems(BASIC_CERT) && (qs.getQuestItemsCount(MARK_OF_BETRAYAL) >= 30) && (qs.getQuestItemsCount(STINGER) >= 60))
  49. {
  50. qs.takeItems(MARK_OF_BETRAYAL, 30);
  51. qs.takeItems(STINGER, 60);
  52. qs.takeItems(BASIC_CERT, 1);
  53. qs.giveItems(STANDART_CERT, 1);
  54. return "32298-04a.htm";
  55. }
  56. }
  57. return "32298-04b.htm";
  58. }
  59. else if ("pcertif".equalsIgnoreCase(event))
  60. {
  61. if (HellboundManager.getInstance().getLevel() > 6)
  62. {
  63. if (qs.hasQuestItems(STANDART_CERT) && (qs.getQuestItemsCount(LIFE_FORCE) >= 56) && (qs.getQuestItemsCount(CONTAINED_LIFE_FORCE) >= 14))
  64. {
  65. qs.takeItems(LIFE_FORCE, 56);
  66. qs.takeItems(CONTAINED_LIFE_FORCE, 14);
  67. qs.takeItems(STANDART_CERT, 1);
  68. qs.giveItems(PREMIUM_CERT, 1);
  69. qs.giveItems(MAP, 1);
  70. return "32298-06a.htm";
  71. }
  72. }
  73. return "32298-06b.htm";
  74. }
  75. else if ("multisell1".equalsIgnoreCase(event))
  76. {
  77. if (qs.hasQuestItems(STANDART_CERT) || qs.hasQuestItems(PREMIUM_CERT))
  78. {
  79. MultiSell.getInstance().separateAndSend(322980001, player, npc, false);
  80. }
  81. }
  82. else if ("multisell2".equalsIgnoreCase(event))
  83. {
  84. if (qs.hasQuestItems(PREMIUM_CERT))
  85. {
  86. MultiSell.getInstance().separateAndSend(322980002, player, npc, false);
  87. }
  88. }
  89. return null;
  90. }
  91. @Override
  92. public final String onFirstTalk(L2Npc npc, L2PcInstance player)
  93. {
  94. String htmltext = "";
  95. QuestState qs = player.getQuestState(getName());
  96. if (qs == null)
  97. {
  98. qs = newQuestState(player);
  99. }
  100. if (!qs.hasQuestItems(BASIC_CERT) && !qs.hasQuestItems(STANDART_CERT) && !qs.hasQuestItems(PREMIUM_CERT))
  101. {
  102. htmltext = "32298-01.htm";
  103. }
  104. else if (qs.hasQuestItems(BASIC_CERT) && !qs.hasQuestItems(STANDART_CERT) && !qs.hasQuestItems(PREMIUM_CERT))
  105. {
  106. htmltext = "32298-03.htm";
  107. }
  108. else if (qs.hasQuestItems(STANDART_CERT) && !qs.hasQuestItems(PREMIUM_CERT))
  109. {
  110. htmltext = "32298-05.htm";
  111. }
  112. else if (qs.hasQuestItems(PREMIUM_CERT))
  113. {
  114. htmltext = "32298-07.htm";
  115. }
  116. return htmltext;
  117. }
  118. public Hude(int questId, String name, String descr)
  119. {
  120. super(questId, name, descr);
  121. addFirstTalkId(HUDE);
  122. addStartNpc(HUDE);
  123. addTalkId(HUDE);
  124. }
  125. public static void main(String[] args)
  126. {
  127. new Hude(-1, "Hude", "hellbound");
  128. }
  129. }