Falk.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (C) 2004-2014 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 hellbound.Falk;
  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. /**
  25. * @author DS
  26. */
  27. public class Falk extends Quest
  28. {
  29. private static final int FALK = 32297;
  30. private static final int BASIC_CERT = 9850;
  31. private static final int STANDART_CERT = 9851;
  32. private static final int PREMIUM_CERT = 9852;
  33. private static final int DARION_BADGE = 9674;
  34. @Override
  35. public final String onFirstTalk(L2Npc npc, L2PcInstance player)
  36. {
  37. QuestState qs = player.getQuestState(getName());
  38. if (qs == null)
  39. {
  40. qs = newQuestState(player);
  41. }
  42. if (qs.hasQuestItems(BASIC_CERT) || qs.hasQuestItems(STANDART_CERT) || qs.hasQuestItems(PREMIUM_CERT))
  43. {
  44. return "32297-01a.htm";
  45. }
  46. return "32297-01.htm";
  47. }
  48. @Override
  49. public final String onTalk(L2Npc npc, L2PcInstance player)
  50. {
  51. QuestState qs = player.getQuestState(getName());
  52. if (qs == null)
  53. {
  54. qs = newQuestState(player);
  55. }
  56. if (qs.hasQuestItems(BASIC_CERT) || qs.hasQuestItems(STANDART_CERT) || qs.hasQuestItems(PREMIUM_CERT))
  57. {
  58. return "32297-01a.htm";
  59. }
  60. return "32297-02.htm";
  61. }
  62. @Override
  63. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  64. {
  65. QuestState qs = player.getQuestState(getName());
  66. if (qs == null)
  67. {
  68. qs = newQuestState(player);
  69. }
  70. if (event.equalsIgnoreCase("badges"))
  71. {
  72. if (!qs.hasQuestItems(BASIC_CERT) && !qs.hasQuestItems(STANDART_CERT) && !qs.hasQuestItems(PREMIUM_CERT))
  73. {
  74. if (qs.getQuestItemsCount(DARION_BADGE) >= 20)
  75. {
  76. qs.takeItems(DARION_BADGE, 20);
  77. qs.giveItems(BASIC_CERT, 1);
  78. return "32297-02a.htm";
  79. }
  80. return "32297-02b.htm";
  81. }
  82. }
  83. return event;
  84. }
  85. public Falk(int questId, String name, String descr)
  86. {
  87. super(questId, name, descr);
  88. addFirstTalkId(FALK);
  89. addStartNpc(FALK);
  90. addTalkId(FALK);
  91. }
  92. public static void main(String[] args)
  93. {
  94. new Falk(-1, "Falk", "hellbound");
  95. }
  96. }