Q00013_ParcelDelivery.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.Q00013_ParcelDelivery;
  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. * Parcel Delivery (13)<br>
  27. * Original Jython script by Emperorc.
  28. * @author nonom
  29. */
  30. public class Q00013_ParcelDelivery extends Quest
  31. {
  32. // NPCs
  33. private static final int FUNDIN = 31274;
  34. private static final int VULCAN = 31539;
  35. // Item
  36. private static final int PACKAGE = 7263;
  37. public Q00013_ParcelDelivery()
  38. {
  39. super(13, Q00013_ParcelDelivery.class.getSimpleName(), "Parcel Delivery");
  40. addStartNpc(FUNDIN);
  41. addTalkId(FUNDIN, VULCAN);
  42. registerQuestItems(PACKAGE);
  43. }
  44. @Override
  45. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  46. {
  47. String htmltext = event;
  48. final QuestState st = getQuestState(player, false);
  49. if (st == null)
  50. {
  51. return htmltext;
  52. }
  53. switch (event)
  54. {
  55. case "31274-02.html":
  56. st.startQuest();
  57. st.giveItems(PACKAGE, 1);
  58. break;
  59. case "31539-01.html":
  60. if (st.isCond(1) && st.hasQuestItems(PACKAGE))
  61. {
  62. st.giveAdena(157834, true);
  63. st.addExpAndSp(589092, 58794);
  64. st.exitQuest(false, true);
  65. }
  66. else
  67. {
  68. htmltext = "31539-02.html";
  69. }
  70. break;
  71. }
  72. return htmltext;
  73. }
  74. @Override
  75. public String onTalk(L2Npc npc, L2PcInstance player)
  76. {
  77. String htmltext = getNoQuestMsg(player);
  78. final QuestState st = getQuestState(player, true);
  79. if (st == null)
  80. {
  81. return htmltext;
  82. }
  83. final int npcId = npc.getId();
  84. switch (st.getState())
  85. {
  86. case State.COMPLETED:
  87. htmltext = getAlreadyCompletedMsg(player);
  88. break;
  89. case State.CREATED:
  90. if (npcId == FUNDIN)
  91. {
  92. htmltext = (player.getLevel() >= 74) ? "31274-00.htm" : "31274-01.html";
  93. }
  94. break;
  95. case State.STARTED:
  96. if (st.isCond(1))
  97. {
  98. switch (npcId)
  99. {
  100. case FUNDIN:
  101. htmltext = "31274-02.html";
  102. break;
  103. case VULCAN:
  104. htmltext = "31539-00.html";
  105. break;
  106. }
  107. }
  108. break;
  109. }
  110. return htmltext;
  111. }
  112. }