Q00018_MeetingWithTheGoldenRam.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.Q00018_MeetingWithTheGoldenRam;
  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. * Meeting With The Golden Ram (18)<br>
  27. * Original jython script by disKret.
  28. * @author nonom
  29. */
  30. public class Q00018_MeetingWithTheGoldenRam extends Quest
  31. {
  32. // NPCs
  33. private static final int DONAL = 31314;
  34. private static final int DAISY = 31315;
  35. private static final int ABERCROMBIE = 31555;
  36. // Item
  37. private static final int BOX = 7245;
  38. public Q00018_MeetingWithTheGoldenRam()
  39. {
  40. super(18, Q00018_MeetingWithTheGoldenRam.class.getSimpleName(), "Meeting With The Golden Ram");
  41. addStartNpc(DONAL);
  42. addTalkId(DONAL, DAISY, ABERCROMBIE);
  43. registerQuestItems(BOX);
  44. }
  45. @Override
  46. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  47. {
  48. String htmltext = event;
  49. final QuestState st = getQuestState(player, false);
  50. if (st == null)
  51. {
  52. return htmltext;
  53. }
  54. switch (event)
  55. {
  56. case "31314-03.html":
  57. if (player.getLevel() >= 66)
  58. {
  59. st.startQuest();
  60. }
  61. else
  62. {
  63. htmltext = "31314-02.html";
  64. }
  65. break;
  66. case "31315-02.html":
  67. st.setCond(2, true);
  68. st.giveItems(BOX, 1);
  69. break;
  70. case "31555-02.html":
  71. if (st.hasQuestItems(BOX))
  72. {
  73. st.giveAdena(40000, true);
  74. st.addExpAndSp(126668, 11731);
  75. st.exitQuest(false, true);
  76. }
  77. break;
  78. }
  79. return htmltext;
  80. }
  81. @Override
  82. public String onTalk(L2Npc npc, L2PcInstance player)
  83. {
  84. String htmltext = getNoQuestMsg(player);
  85. final QuestState st = getQuestState(player, true);
  86. if (st == null)
  87. {
  88. return htmltext;
  89. }
  90. final int npcId = npc.getId();
  91. switch (st.getState())
  92. {
  93. case State.COMPLETED:
  94. htmltext = getAlreadyCompletedMsg(player);
  95. break;
  96. case State.CREATED:
  97. if (npcId == DONAL)
  98. {
  99. htmltext = "31314-01.htm";
  100. }
  101. break;
  102. case State.STARTED:
  103. if (npcId == DONAL)
  104. {
  105. htmltext = "31314-04.html";
  106. }
  107. else if (npcId == DAISY)
  108. {
  109. htmltext = (st.getCond() < 2) ? "31315-01.html" : "31315-03.html";
  110. }
  111. else if ((npcId == ABERCROMBIE) && st.isCond(2) && st.hasQuestItems(BOX))
  112. {
  113. htmltext = "31555-01.html";
  114. }
  115. break;
  116. }
  117. return htmltext;
  118. }
  119. }