Advertisement
SilentLtu

dadsafsfdgfdg

Jun 5th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. /*
  2. * This file is part of the L2J Mobius project.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package quests.Q10425_TheKetraOrcSupporters;
  18.  
  19. import java.util.HashSet;
  20. import java.util.Set;
  21.  
  22. import com.l2jmobius.commons.util.CommonUtil;
  23. import com.l2jmobius.gameserver.enums.CategoryType;
  24. import com.l2jmobius.gameserver.enums.ChatType;
  25. import com.l2jmobius.gameserver.enums.QuestSound;
  26. import com.l2jmobius.gameserver.enums.Race;
  27. import com.l2jmobius.gameserver.model.actor.L2Npc;
  28. import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
  29. import com.l2jmobius.gameserver.model.holders.NpcLogListHolder;
  30. import com.l2jmobius.gameserver.model.quest.Quest;
  31. import com.l2jmobius.gameserver.model.quest.QuestState;
  32. import com.l2jmobius.gameserver.model.quest.State;
  33. import com.l2jmobius.gameserver.network.NpcStringId;
  34.  
  35. /**
  36. * The Ketra Orc Supporters (10425)
  37. * @author Stayway
  38. */
  39. public final class Q10425_TheKetraOrcSupporters extends Quest
  40. {
  41. // NPCs
  42. private static final int LUGONNES = 33852;
  43. private static final int EMBRYO_SHOOTER = 27514;
  44. private static final int EMBRYO_WIZARD = 27515;
  45. private static final int[] SHOOTER_MONSTERS =
  46. {
  47. 21327, // Ketra Orc Raider
  48. 21331, // Ketra Orc Warrior
  49. 21332, // Ketra Orc Lieutenant
  50. 21335, // Ketra Orc Elite Soldier
  51. 21336, // Ketra Orc White Captain
  52. 21339, // Ketra Orc Officer
  53. 21340, // Ketra Orc Battalion Commander
  54. 27511, // Ketra Backup Shooter
  55. };
  56. private static final int[] WIZARD_MONSTERS =
  57. {
  58. 21334, // Ketra Orc Medium
  59. 21338, // Ketra Orc Seer
  60. 21342, // Ketra Orc Grand Priest
  61. 27512, // Varka Backup Wizard
  62. };
  63. // Misc
  64. private static final int MIN_LEVEL = 76;
  65.  
  66. public Q10425_TheKetraOrcSupporters()
  67. {
  68. super(10425);
  69. addStartNpc(LUGONNES);
  70. addTalkId(LUGONNES);
  71. addKillId(SHOOTER_MONSTERS);
  72. addKillId(WIZARD_MONSTERS);
  73. addCondNotRace(Race.ERTHEIA, "33852-09.html");
  74. addCondInCategory(CategoryType.WIZARD_GROUP, "33852-08.html");
  75. addCondMinLevel(MIN_LEVEL, "33852-08.html");
  76. }
  77.  
  78. @Override
  79. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  80. {
  81. final QuestState st = getQuestState(player, false);
  82. if (st == null)
  83. {
  84. return null;
  85. }
  86.  
  87. String htmltext = null;
  88. switch (event)
  89. {
  90. case "33852-02.htm":
  91. case "33852-03.htm":
  92. {
  93. htmltext = event;
  94. break;
  95. }
  96. case "33852-04.htm":
  97. {
  98. st.startQuest();
  99. htmltext = event;
  100. break;
  101. }
  102. case "33852-07.html":
  103. {
  104. if (st.isCond(2))
  105. {
  106. st.exitQuest(false, true);
  107. giveStoryQuestReward(npc, player);
  108. if (player.getLevel() >= MIN_LEVEL)
  109. {
  110. addExpAndSp(player, 492_760_460, 5519);
  111. }
  112. htmltext = event;
  113. }
  114. break;
  115. }
  116. }
  117. return htmltext;
  118. }
  119.  
  120. @Override
  121. public String onTalk(L2Npc npc, L2PcInstance player)
  122. {
  123. final QuestState st = getQuestState(player, true);
  124. String htmltext = null;
  125.  
  126. switch (st.getState())
  127. {
  128. case State.CREATED:
  129. {
  130. htmltext = "33852-01.htm";
  131. break;
  132. }
  133. case State.STARTED:
  134. {
  135. htmltext = st.isCond(1) ? "33852-05.html" : "33852-06.html";
  136. break;
  137. }
  138. case State.COMPLETED:
  139. {
  140. htmltext = getAlreadyCompletedMsg(player);
  141. break;
  142. }
  143. }
  144. return htmltext;
  145. }
  146.  
  147. @Override
  148. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  149. {
  150. final QuestState st = getQuestState(killer, false);
  151.  
  152. if ((st != null) && st.isCond(1))
  153. {
  154. if ((npc.getId() == EMBRYO_SHOOTER) || (npc.getId() == EMBRYO_WIZARD))
  155. {
  156. int shooterCount = st.getInt("KillCount_" + EMBRYO_SHOOTER);
  157. int wizardCount = st.getInt("KillCount_" + EMBRYO_WIZARD);
  158.  
  159. if (npc.getId() == EMBRYO_SHOOTER)
  160. {
  161. if (shooterCount < 100)
  162. {
  163. st.set("KillCount_" + EMBRYO_SHOOTER, ++shooterCount);
  164. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  165. }
  166. }
  167. else if (wizardCount < 100)
  168. {
  169. st.set("KillCount_" + EMBRYO_WIZARD, ++wizardCount);
  170. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  171. }
  172.  
  173. if ((shooterCount >= 100) && (wizardCount >= 100))
  174. {
  175. st.setCond(2, true);
  176. }
  177. }
  178. else if (CommonUtil.contains(WIZARD_MONSTERS, npc.getId()))
  179. {
  180. if (st.getInt("KillCount_" + EMBRYO_WIZARD) < 100)
  181. {
  182. final L2Npc embryo = addSpawn(EMBRYO_WIZARD, npc, false, 60000);
  183. addAttackPlayerDesire(embryo, killer);
  184. embryo.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_DARE_INTERFERE_WITH_EMBRYO_SURELY_YOU_WISH_FOR_DEATH);
  185. }
  186. }
  187. else if (st.getInt("KillCount_" + EMBRYO_SHOOTER) < 100)
  188. {
  189. final L2Npc embryo = addSpawn(EMBRYO_SHOOTER, npc, false, 60000);
  190. addAttackPlayerDesire(embryo, killer);
  191. embryo.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_DARE_INTERFERE_WITH_EMBRYO_SURELY_YOU_WISH_FOR_DEATH);
  192. }
  193. }
  194. return super.onKill(npc, killer, isSummon);
  195. }
  196.  
  197. @Override
  198. public Set<NpcLogListHolder> getNpcLogList(L2PcInstance activeChar)
  199. {
  200. final QuestState st = getQuestState(activeChar, false);
  201. if ((st != null) && st.isCond(1))
  202. {
  203. final Set<NpcLogListHolder> npcLogList = new HashSet<>(2);
  204. npcLogList.add(new NpcLogListHolder(EMBRYO_SHOOTER, false, st.getInt("KillCount_" + EMBRYO_SHOOTER)));
  205. npcLogList.add(new NpcLogListHolder(EMBRYO_WIZARD, false, st.getInt("KillCount_" + EMBRYO_WIZARD)));
  206. return npcLogList;
  207. }
  208. return super.getNpcLogList(activeChar);
  209. }
  210. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement