Q00182_NewRecruits.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.Q00182_NewRecruits;
  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. * New Recruits (182)
  28. * @author Gnacik
  29. * @version 2010-10-15 Based on official server Naia
  30. */
  31. public class Q00182_NewRecruits extends Quest
  32. {
  33. // NPCs
  34. private static final int KEKROPUS = 32138;
  35. private static final int MENACING_MACHINE = 32258;
  36. public Q00182_NewRecruits()
  37. {
  38. super(182, Q00182_NewRecruits.class.getSimpleName(), "New Recruits");
  39. addStartNpc(KEKROPUS);
  40. addTalkId(KEKROPUS, MENACING_MACHINE);
  41. }
  42. @Override
  43. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  44. {
  45. String htmltext = event;
  46. final QuestState st = getQuestState(player, false);
  47. if (st == null)
  48. {
  49. return htmltext;
  50. }
  51. if (npc.getId() == KEKROPUS)
  52. {
  53. if (event.equalsIgnoreCase("32138-03.html"))
  54. {
  55. st.startQuest();
  56. }
  57. }
  58. else if (npc.getId() == MENACING_MACHINE)
  59. {
  60. if (event.equalsIgnoreCase("32258-04.html"))
  61. {
  62. st.giveItems(847, 2);
  63. st.exitQuest(false, true);
  64. }
  65. else if (event.equalsIgnoreCase("32258-05.html"))
  66. {
  67. st.giveItems(890, 2);
  68. st.exitQuest(false, true);
  69. }
  70. }
  71. return htmltext;
  72. }
  73. @Override
  74. public String onTalk(L2Npc npc, L2PcInstance player)
  75. {
  76. String htmltext = getNoQuestMsg(player);
  77. final QuestState st = getQuestState(player, true);
  78. if (st == null)
  79. {
  80. return htmltext;
  81. }
  82. final int npcId = npc.getId();
  83. if (npcId == KEKROPUS)
  84. {
  85. switch (st.getState())
  86. {
  87. case State.CREATED:
  88. final int level = player.getLevel();
  89. if (player.getRace() == Race.KAMAEL)
  90. {
  91. htmltext = "32138-00.html";
  92. }
  93. else if ((level >= 17) && (level <= 21) && (player.getClassId().ordinal() == 0))
  94. {
  95. htmltext = "32138-01.htm";
  96. }
  97. else
  98. {
  99. htmltext = "32138-00b.html";
  100. }
  101. break;
  102. case State.STARTED:
  103. if (st.getInt("cond") == 1)
  104. {
  105. htmltext = "32138-04.html";
  106. }
  107. break;
  108. case State.COMPLETED:
  109. htmltext = getAlreadyCompletedMsg(player);
  110. break;
  111. }
  112. }
  113. else if ((npcId == MENACING_MACHINE) && st.isStarted())
  114. {
  115. htmltext = "32258-01.html";
  116. }
  117. return htmltext;
  118. }
  119. }