Q00652_AnAgedExAdventurer.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (C) 2004-2015 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 quests.Q00652_AnAgedExAdventurer;
  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. import com.l2jserver.gameserver.model.quest.State;
  25. /**
  26. * An Aged Ex-Adventurer (652)
  27. * @author malyelfik
  28. */
  29. public class Q00652_AnAgedExAdventurer extends Quest
  30. {
  31. // NPCs
  32. private static final int TANTAN = 32012;
  33. private static final int SARA = 30180;
  34. // Items
  35. private static final int SOULSHOT_C = 1464;
  36. private static final int ENCHANT_ARMOR_D = 956;
  37. public Q00652_AnAgedExAdventurer()
  38. {
  39. super(652, Q00652_AnAgedExAdventurer.class.getSimpleName(), "An Aged Ex-Adventurer");
  40. addStartNpc(TANTAN);
  41. addTalkId(TANTAN, SARA);
  42. }
  43. @Override
  44. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  45. {
  46. final QuestState st = getQuestState(player, false);
  47. if (st == null)
  48. {
  49. return null;
  50. }
  51. String htmltext = null;
  52. if (event.equals("32012-04.htm"))
  53. {
  54. if (st.getQuestItemsCount(SOULSHOT_C) < 100)
  55. {
  56. return "32012-05.htm";
  57. }
  58. st.startQuest();
  59. st.takeItems(SOULSHOT_C, 100);
  60. npc.deleteMe();
  61. htmltext = event;
  62. }
  63. else if (event.equals("32012-03.html"))
  64. {
  65. htmltext = event;
  66. }
  67. return htmltext;
  68. }
  69. @Override
  70. public String onTalk(L2Npc npc, L2PcInstance player)
  71. {
  72. String htmltext = getNoQuestMsg(player);
  73. final QuestState st = getQuestState(player, true);
  74. if (st == null)
  75. {
  76. return htmltext;
  77. }
  78. switch (npc.getId())
  79. {
  80. case TANTAN:
  81. switch (st.getState())
  82. {
  83. case State.CREATED:
  84. htmltext = (player.getLevel() >= 46) ? "32012-01.htm" : "32012-01a.htm";
  85. break;
  86. case State.STARTED:
  87. htmltext = "32012-02.html";
  88. break;
  89. }
  90. break;
  91. case SARA:
  92. if (st.isStarted())
  93. {
  94. if (getRandom(10) <= 4)
  95. {
  96. st.giveItems(ENCHANT_ARMOR_D, 1);
  97. st.giveAdena(5026, true);
  98. htmltext = "30180-01.html";
  99. }
  100. else
  101. {
  102. st.giveAdena(10000, true);
  103. htmltext = "30180-02.html";
  104. }
  105. st.exitQuest(true, true);
  106. }
  107. break;
  108. }
  109. return htmltext;
  110. }
  111. }