Q00009_IntoTheCityOfHumans.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.Q00009_IntoTheCityOfHumans;
  20. import com.l2jserver.gameserver.enums.Race;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * Into the City of Humans (9)
  28. * @author malyelfik
  29. */
  30. public class Q00009_IntoTheCityOfHumans extends Quest
  31. {
  32. // NPCs
  33. private static final int PETUKAI = 30583;
  34. private static final int TANAPI = 30571;
  35. private static final int TAMIL = 30576;
  36. // Items
  37. private static final int SCROLL_OF_ESCAPE_GIRAN = 7559;
  38. private static final int MARK_OF_TRAVELER = 7570;
  39. // Misc
  40. private static final int MIN_LEVEL = 3;
  41. public Q00009_IntoTheCityOfHumans()
  42. {
  43. super(9, Q00009_IntoTheCityOfHumans.class.getSimpleName(), "Into the City of Humans");
  44. addStartNpc(PETUKAI);
  45. addTalkId(PETUKAI, TANAPI, TAMIL);
  46. }
  47. @Override
  48. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  49. {
  50. final QuestState st = getQuestState(player, false);
  51. if (st == null)
  52. {
  53. return null;
  54. }
  55. String htmltext = event;
  56. switch (event)
  57. {
  58. case "30583-04.htm":
  59. st.startQuest();
  60. break;
  61. case "30576-02.html":
  62. st.giveItems(MARK_OF_TRAVELER, 1);
  63. st.giveItems(SCROLL_OF_ESCAPE_GIRAN, 1);
  64. st.exitQuest(false, true);
  65. break;
  66. case "30571-02.html":
  67. st.setCond(2, true);
  68. break;
  69. default:
  70. htmltext = null;
  71. break;
  72. }
  73. return htmltext;
  74. }
  75. @Override
  76. public String onTalk(L2Npc npc, L2PcInstance player)
  77. {
  78. String htmltext = getNoQuestMsg(player);
  79. final QuestState st = getQuestState(player, true);
  80. if (st == null)
  81. {
  82. return htmltext;
  83. }
  84. switch (npc.getId())
  85. {
  86. case PETUKAI:
  87. switch (st.getState())
  88. {
  89. case State.CREATED:
  90. htmltext = (player.getLevel() >= MIN_LEVEL) ? (player.getRace() == Race.ORC) ? "30583-01.htm" : "30583-02.html" : "30583-03.html";
  91. break;
  92. case State.STARTED:
  93. if (st.isCond(1))
  94. {
  95. htmltext = "30583-05.html";
  96. }
  97. break;
  98. case State.COMPLETED:
  99. htmltext = getAlreadyCompletedMsg(player);
  100. break;
  101. }
  102. break;
  103. case TANAPI:
  104. if (st.isStarted())
  105. {
  106. htmltext = (st.isCond(1)) ? "30571-01.html" : "30571-03.html";
  107. }
  108. break;
  109. case TAMIL:
  110. if (st.isStarted() && st.isCond(2))
  111. {
  112. htmltext = "30576-01.html";
  113. }
  114. break;
  115. }
  116. return htmltext;
  117. }
  118. }