Advertisement
CostyKiller

krofin instance script

May 25th, 2021
1,407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 9.19 KB | None | 0 0
  1. Index: dist/game/data/scripts/instances/KrofinNest/KrofinNest.java
  2. ===================================================================
  3. --- dist/game/data/scripts/instances/KrofinNest/KrofinNest.java (nonexistent)
  4. +++ dist/game/data/scripts/instances/KrofinNest/KrofinNest.java (working copy)
  5. @@ -0,0 +1,278 @@
  6. +/*
  7. + * This file is part of the L2J Mobius project.
  8. + *
  9. + * This program is free software: you can redistribute it and/or modify
  10. + * it under the terms of the GNU General Public License as published by
  11. + * the Free Software Foundation, either version 3 of the License, or
  12. + * (at your option) any later version.
  13. + *
  14. + * This program is distributed in the hope that it will be useful,
  15. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. + * General Public License for more details.
  18. + *
  19. + * You should have received a copy of the GNU General Public License
  20. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. + */
  22. +package instances.KrofinNest;
  23. +
  24. +import org.l2jmobius.commons.util.CommonUtil;
  25. +import org.l2jmobius.gameserver.model.actor.Npc;
  26. +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
  27. +import org.l2jmobius.gameserver.model.holders.ItemHolder;
  28. +import org.l2jmobius.gameserver.model.instancezone.Instance;
  29. +import org.l2jmobius.gameserver.network.NpcStringId;
  30. +import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
  31. +
  32. +import instances.AbstractInstance;
  33. +
  34. +/**
  35. + * @author CostyKiller
  36. + * @URL https://youtu.be/D_OwpP2eWxk?t=1
  37. + * @URL https://youtu.be/RuNlJ9Dv0Gk?t=26
  38. + */
  39. +public class KrofinNest extends AbstractInstance
  40. +{
  41. +   // NPC
  42. +   private static final int BENUSTA = 34542;
  43. +   // Item
  44. +   private static final ItemHolder BENUSTAS_REWARD_BOX = new ItemHolder(81151, 1);
  45. +  
  46. +   // Misc
  47. +   private static final int TEMPLATE_ID = 291; // Krofin Nest
  48. +   private static final int DOOR1 = 23220101;
  49. +   private static final int DOOR2 = 23220102;
  50. +   private static final int DOOR3 = 23220103;
  51. +   private static final int DOOR4 = 23220104;
  52. +   private static final int[] FIRST_AREA_MOBS =
  53. +   {
  54. +       26396,
  55. +       26398
  56. +   };
  57. +   private static final int[] SECOND_AREA_MOBS =
  58. +   {
  59. +       26396,
  60. +       26398
  61. +   };
  62. +   private static final int[] THIRD_AREA_MOBS =
  63. +   {
  64. +       26395,
  65. +       26397
  66. +   };
  67. +   private static final int[] FOURTH_AREA_MOBS =
  68. +   {
  69. +       26395,
  70. +       26396,
  71. +       26397,
  72. +       26398
  73. +   };
  74. +   private static final int KROSHA_FIRST_FORM = 26389;
  75. +   private static final int KROSHA_FINAL_FORM = 26390;
  76. +   private static final int KROPION = 26396;
  77. +   private static final int[] KROSHA_FIRST_FORM_MINIONS =
  78. +   {
  79. +       26393,
  80. +       26394
  81. +   };
  82. +   private static final int[] ENHANCED_MINIONS =
  83. +   {
  84. +       26391,
  85. +       26392
  86. +   };
  87. +   private static final int SECOND_KROTANION_ILLUSSION = 26391;
  88. +  
  89. +   public KrofinNest()
  90. +   {
  91. +       super(TEMPLATE_ID);
  92. +       addStartNpc(BENUSTA);
  93. +       addTalkId(BENUSTA);
  94. +       addAttackId(FIRST_AREA_MOBS);
  95. +       addAttackId(SECOND_AREA_MOBS);
  96. +       addAttackId(THIRD_AREA_MOBS);
  97. +       addAttackId(FOURTH_AREA_MOBS);
  98. +       addAttackId(KROSHA_FIRST_FORM);
  99. +       addAttackId(KROSHA_FINAL_FORM);
  100. +       addKillId(KROSHA_FIRST_FORM_MINIONS);
  101. +       addKillId(ENHANCED_MINIONS);
  102. +       addKillId(SECOND_KROTANION_ILLUSSION);
  103. +       addKillId(KROSHA_FINAL_FORM);
  104. +   }
  105. +  
  106. +   @Override
  107. +   public String onAdvEvent(String event, Npc npc, PlayerInstance player)
  108. +   {
  109. +       switch (event)
  110. +       {
  111. +           case "enterInstance":
  112. +           {
  113. +               enterInstance(player, npc, TEMPLATE_ID);
  114. +               if (player.getInstanceWorld() != null)
  115. +               {
  116. +                   startQuestTimer("CHECK_STATUS", 10000, null, player);
  117. +               }
  118. +               return null;
  119. +           }
  120. +           case "CHECK_STATUS":
  121. +           {
  122. +               final Instance world = player.getInstanceWorld();
  123. +               if (!isInInstance(world))
  124. +               {
  125. +                   return null;
  126. +               }
  127. +               switch (world.getStatus())
  128. +               {
  129. +                   case 0:
  130. +                   {
  131. +                       world.setStatus(1);
  132. +                       world.spawnGroup("FIRST_AREA");
  133. +                       startQuestTimer("CHECK_STATUS", 10000, null, player);
  134. +                       break;
  135. +                   }
  136. +                   case 1:
  137. +                   {
  138. +                       if (world.getAliveNpcs(FIRST_AREA_MOBS).isEmpty())
  139. +                       {
  140. +                           world.setStatus(2);
  141. +                           world.getDoor(DOOR1).openMe();
  142. +                           world.spawnGroup("SECOND_AREA");
  143. +                       }
  144. +                       startQuestTimer("CHECK_STATUS", 10000, null, player);
  145. +                       break;
  146. +                   }
  147. +                   case 2:
  148. +                   {
  149. +                       if (world.getAliveNpcs(SECOND_AREA_MOBS).isEmpty())
  150. +                       {
  151. +                           world.setStatus(3);
  152. +                           world.getDoor(DOOR2).openMe();
  153. +                           world.spawnGroup("THIRD_AREA");
  154. +                       }
  155. +                       startQuestTimer("CHECK_STATUS", 10000, null, player);
  156. +                       break;
  157. +                   }
  158. +                   case 3:
  159. +                   {
  160. +                       if (world.getAliveNpcs(THIRD_AREA_MOBS).isEmpty())
  161. +                       {
  162. +                           world.setStatus(4);
  163. +                           world.getDoor(DOOR3).openMe();
  164. +                           world.spawnGroup("FOURTH_AREA");
  165. +                       }
  166. +                       startQuestTimer("CHECK_STATUS", 10000, null, player);
  167. +                       break;
  168. +                   }
  169. +                   case 4:
  170. +                   {
  171. +                       if (world.getAliveNpcs(FOURTH_AREA_MOBS).isEmpty())
  172. +                       {
  173. +                           world.setStatus(5);
  174. +                           world.getDoor(DOOR4).openMe();
  175. +                           world.spawnGroup("KROSHA_FIRST_FORM");
  176. +                       }
  177. +                       startQuestTimer("CHECK_STATUS", 10000, null, player);
  178. +                       break;
  179. +                   }
  180. +               }
  181. +               return null;
  182. +           }
  183. +       }
  184. +       return super.onAdvEvent(event, npc, player);
  185. +   }
  186. +  
  187. +   @Override
  188. +   public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
  189. +   {
  190. +       final Instance world = attacker.getInstanceWorld();
  191. +       if (isInInstance(world))
  192. +       {
  193. +           final boolean KROPION_MINIONS_SPAWNED = world.getParameters().getBoolean("KROPION_MINIONS_SPAWNED", false);
  194. +           final boolean KROSHA_FIRST_FORM_MINIONS_SPAWNED = world.getParameters().getBoolean("KROSHA_FIRST_FORM_MINIONS_SPAWNED", false);
  195. +           final boolean KROSHA_FINAL_FORM_MINIONS_SPAWNED = world.getParameters().getBoolean("KROSHA_FINAL_FORM_MINIONS_SPAWNED", false);
  196. +           if ((world.getStatus() == 2) && (npc.getId() == KROPION))
  197. +           {
  198. +               if (!KROPION_MINIONS_SPAWNED)
  199. +               {
  200. +                   world.getParameters().set("KROPION_MINIONS_SPAWNED", true);
  201. +                   world.spawnGroup("KROPION_MINIONS");
  202. +               }
  203. +           }
  204. +           else if (world.getStatus() == 5)
  205. +           {
  206. +               if ((npc.getId() == KROSHA_FIRST_FORM) && !KROSHA_FIRST_FORM_MINIONS_SPAWNED)
  207. +               {
  208. +                   world.getParameters().set("KROSHA_FIRST_FORM_MINIONS_SPAWNED", true);
  209. +                   world.spawnGroup("KROSHA_FIRST_FORM_MINIONS");
  210. +               }
  211. +               else if ((npc.getId() == KROSHA_FINAL_FORM) && !KROSHA_FINAL_FORM_MINIONS_SPAWNED)
  212. +               {
  213. +                   world.getParameters().set("KROSHA_FINAL_FORM_MINIONS_SPAWNED", true);
  214. +                   world.spawnGroup("KROSHA_FINAL_FORM_MINIONS");
  215. +               }
  216. +           }
  217. +       }
  218. +       return super.onAttack(npc, attacker, damage, isSummon);
  219. +   }
  220. +  
  221. +   @Override
  222. +   public String onKill(Npc npc, PlayerInstance killer, boolean isPet)
  223. +   {
  224. +       final Instance world = npc.getInstanceWorld();
  225. +       if (isInInstance(world))
  226. +       {
  227. +           final boolean KROSHA_FIRST_FORM_MINIONS_SPAWNED_TWICE = world.getParameters().getBoolean("KROSHA_FIRST_FORM_MINIONS_SPAWNED_TWICE", false);
  228. +           final boolean FIRST_KROTANION_ILLUSSION_SPAWNED = world.getParameters().getBoolean("FIRST_KROTANION_ILLUSSION_SPAWNED", false);
  229. +           final boolean SECOND_KROTANION_ILLUSSION_SPAWNED = world.getParameters().getBoolean("SECOND_KROTANION_ILLUSSION_SPAWNED", false);
  230. +           if (world.getStatus() == 5)
  231. +           {
  232. +               if (CommonUtil.contains(KROSHA_FIRST_FORM_MINIONS, npc.getId()))
  233. +               {
  234. +                   if (world.getAliveNpcs(KROSHA_FIRST_FORM_MINIONS).isEmpty() && !KROSHA_FIRST_FORM_MINIONS_SPAWNED_TWICE)
  235. +                   {
  236. +                       world.getParameters().set("KROSHA_FIRST_FORM_MINIONS_SPAWNED_TWICE", true);
  237. +                       world.spawnGroup("KROSHA_FIRST_FORM_MINIONS");
  238. +                   }
  239. +                   else if (world.getAliveNpcs(KROSHA_FIRST_FORM_MINIONS).isEmpty() && KROSHA_FIRST_FORM_MINIONS_SPAWNED_TWICE)
  240. +                   {
  241. +                       world.despawnGroup("KROSHA_FIRST_FORM");
  242. +                       showOnScreenMsg(world, NpcStringId.QUEEN_KROSHA_HAS_DISAPPEARED, ExShowScreenMessage.TOP_CENTER, 7000, true);
  243. +                       world.spawnGroup("ENHANCED_MINIONS");
  244. +                   }
  245. +               }
  246. +               else if (CommonUtil.contains(ENHANCED_MINIONS, npc.getId()))
  247. +               {
  248. +                   if ((world.getAliveNpcs(ENHANCED_MINIONS).size() == 2) && !FIRST_KROTANION_ILLUSSION_SPAWNED)
  249. +                   {
  250. +                       world.spawnGroup("FIRST_KROTANION_ILLUSSION");
  251. +                   }
  252. +                   else if (world.getAliveNpcs(ENHANCED_MINIONS).isEmpty() && !SECOND_KROTANION_ILLUSSION_SPAWNED)
  253. +                   {
  254. +                       world.spawnGroup("SECOND_KROTANION_ILLUSSION");
  255. +                   }
  256. +               }
  257. +               else if (npc.getId() == SECOND_KROTANION_ILLUSSION)
  258. +               {
  259. +                   if (world.getAliveNpcs(SECOND_KROTANION_ILLUSSION).isEmpty())
  260. +                   {
  261. +                       world.spawnGroup("KROSHA_FINAL_FORM");
  262. +                       showOnScreenMsg(world, NpcStringId.QUEEN_KROSHA_HAS_RETURNED_MORE_POWERFUL_THAN_EVER, ExShowScreenMessage.TOP_CENTER, 7000, true);
  263. +                   }
  264. +               }
  265. +               else if (npc.getId() == KROSHA_FINAL_FORM)
  266. +               {
  267. +                   for (PlayerInstance member : world.getPlayers())
  268. +                   {
  269. +                       giveItems(member, BENUSTAS_REWARD_BOX);
  270. +                   }
  271. +                   showOnScreenMsg(world, NpcStringId.THE_WATER_POWER_PROTECTING_QUEEN_KROSHA_HAS_DISAPPEARED, ExShowScreenMessage.TOP_CENTER, 7000, true);
  272. +                   world.finishInstance();
  273. +               }
  274. +           }
  275. +       }
  276. +       return super.onKill(npc, killer, isPet);
  277. +   }
  278. +  
  279. +   public static void main(String[] args)
  280. +   {
  281. +       new KrofinNest();
  282. +   }
  283. +}
  284.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement