PurchaseBracelet.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (C) 2004-2013 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 custom.PurchaseBracelet;
  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. * Purchase Bracelet AI.
  26. * @author Nyaran
  27. */
  28. public class PurchaseBracelet extends Quest
  29. {
  30. private static final String qn = "PurchaseBracelet";
  31. private static final int NPC = 30098;
  32. private static final int ANGEL_BRACELET = 10320;
  33. private static final int DEVIL_BRACELET = 10326;
  34. private static final int ADENA = 57;
  35. private static final int BIG_RED_NIBLE_FISH = 6471;
  36. private static final int GREAT_CODRAN = 5094;
  37. private static final int MEMENTO_MORI = 9814;
  38. private static final int EARTH_EGG = 9816;
  39. private static final int NONLIVING_NUCLEUS = 9817;
  40. private static final int DRAGON_HEART = 9815;
  41. @Override
  42. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  43. {
  44. String htmltext = event;
  45. QuestState st = player.getQuestState(qn);
  46. if (st == null)
  47. {
  48. return htmltext;
  49. }
  50. if ((st.getQuestItemsCount(6471) >= 20) && (st.getQuestItemsCount(GREAT_CODRAN) >= 50) && (st.getQuestItemsCount(MEMENTO_MORI) >= 4) && (st.getQuestItemsCount(EARTH_EGG) >= 5) && (st.getQuestItemsCount(NONLIVING_NUCLEUS) >= 5) && (st.getQuestItemsCount(DRAGON_HEART) >= 3) && (st.getQuestItemsCount(ADENA) >= 7500000))
  51. {
  52. st.takeItems(BIG_RED_NIBLE_FISH, 25);
  53. st.takeItems(GREAT_CODRAN, 50);
  54. st.takeItems(MEMENTO_MORI, 4);
  55. st.takeItems(EARTH_EGG, 5);
  56. st.takeItems(NONLIVING_NUCLEUS, 5);
  57. st.takeItems(DRAGON_HEART, 3);
  58. st.takeItems(ADENA, 7500000);
  59. htmltext = "";
  60. if (event.equals("Little_Devil"))
  61. {
  62. st.giveItems(DEVIL_BRACELET, 1);
  63. }
  64. else if (event.equals("Little_Angel"))
  65. {
  66. st.giveItems(ANGEL_BRACELET, 1);
  67. }
  68. }
  69. else
  70. {
  71. htmltext = "30098-no.htm";
  72. }
  73. st.exitQuest(true);
  74. return htmltext;
  75. }
  76. @Override
  77. public String onTalk(L2Npc npc, L2PcInstance player)
  78. {
  79. String htmltext = "";
  80. QuestState st = player.getQuestState(qn);
  81. if (st == null)
  82. {
  83. st = newQuestState(player);
  84. }
  85. htmltext = "30098.htm";
  86. return htmltext;
  87. }
  88. public PurchaseBracelet(int id, String name, String descr)
  89. {
  90. super(id, name, descr);
  91. addStartNpc(NPC);
  92. addTalkId(NPC);
  93. }
  94. public static void main(String args[])
  95. {
  96. new PurchaseBracelet(-1, qn, "custom");
  97. }
  98. }