PurchaseBracelet.java 3.0 KB

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