PurchaseBracelet.java 3.0 KB

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