Falk.java 2.8 KB

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