NornilsGarden.java 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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 instances.NornilsGarden;
  20. import instances.AbstractInstance;
  21. import quests.Q00179_IntoTheLargeCavern.Q00179_IntoTheLargeCavern;
  22. import com.l2jserver.gameserver.datatables.SkillData;
  23. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  24. import com.l2jserver.gameserver.model.L2Party;
  25. import com.l2jserver.gameserver.model.Location;
  26. import com.l2jserver.gameserver.model.actor.L2Character;
  27. import com.l2jserver.gameserver.model.actor.L2Npc;
  28. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  29. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  30. import com.l2jserver.gameserver.model.entity.Instance;
  31. import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
  32. import com.l2jserver.gameserver.model.quest.QuestState;
  33. import com.l2jserver.gameserver.model.quest.State;
  34. import com.l2jserver.gameserver.model.skills.Skill;
  35. import com.l2jserver.gameserver.model.zone.L2ZoneType;
  36. import com.l2jserver.gameserver.network.SystemMessageId;
  37. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  38. import com.l2jserver.gameserver.util.Util;
  39. /**
  40. * Nornil's Garden instance zone.
  41. * @author Gnacik
  42. * @version 2010-10-15 Based on official server Naia
  43. */
  44. public final class NornilsGarden extends AbstractInstance
  45. {
  46. protected class NornilsWorld extends InstanceWorld
  47. {
  48. protected L2Npc first_npc = null;
  49. protected boolean spawned_1 = false;
  50. protected boolean spawned_2 = false;
  51. protected boolean spawned_3 = false;
  52. protected boolean spawned_4 = false;
  53. }
  54. // NPCs
  55. private static final int _garden_guard = 32330;
  56. private static final int[] _final_gates =
  57. {
  58. 32260,
  59. 32261,
  60. 32262
  61. };
  62. // Skills
  63. private static final Skill skill1 = SkillData.getInstance().getSkill(4322, 1);
  64. private static final Skill skill2 = SkillData.getInstance().getSkill(4327, 1);
  65. private static final Skill skill3 = SkillData.getInstance().getSkill(4329, 1);
  66. private static final Skill skill4 = SkillData.getInstance().getSkill(4324, 1);
  67. // Locations
  68. private static final Location SPAWN_PPL = new Location(-111184, 74540, -12430);
  69. private static final Location EXIT_PPL = new Location(-74058, 52040, -3680);
  70. // Misc
  71. private static final int TEMPLATE_ID = 11;
  72. private static final int DURATION_TIME = 70;
  73. private static final int EMPTY_DESTROY_TIME = 5;
  74. private static final int INSTANCE_LVL_MIN = 18;
  75. private static final int INSTANCE_LVL_MAX = 22;
  76. private static final int[][] _auto_gates =
  77. {
  78. // Warriors gate
  79. {
  80. 20110,
  81. 16200001
  82. },
  83. // Midway gate
  84. {
  85. 20111,
  86. 16200004
  87. },
  88. // Gate
  89. {
  90. 20112,
  91. 16200013
  92. }
  93. };
  94. private static final int _herb_jar = 18478;
  95. // @formatter:off
  96. private static final int[][] _gatekeepers =
  97. {
  98. { 18352, 9703, 0 }, // Kamael Guard
  99. { 18353, 9704, 0 }, // Guardian of Records
  100. { 18354, 9705, 0 }, // Guardian of Observation
  101. { 18355, 9706, 0 }, // Spicula's Guard
  102. { 18356, 9707, 16200024 }, // Harkilgamed's Gatekeeper
  103. { 18357, 9708, 16200025 }, // Rodenpicula's Gatekeeper
  104. { 18358, 9713, 0 }, // Guardian of Secrets
  105. { 18359, 9709, 16200023 }, // Arviterre's Guardian
  106. { 18360, 9710, 0 }, // Katenar's Gatekeeper
  107. { 18361, 9711, 0 }, // Guardian of Prediction
  108. { 25528, 9712, 0 } // Tiberias
  109. };
  110. private static final int[][] HP_HERBS_DROPLIST =
  111. {
  112. // itemId, count, chance
  113. { 8602, 1, 10 },
  114. { 8601, 2, 40 },
  115. { 8600, 3, 70 }
  116. };
  117. private static final int[][] _group_1 =
  118. {
  119. { 18363, -109899, 74431, -12528, 16488 },
  120. { 18483, -109701, 74501, -12528, 24576 },
  121. { 18483, -109892, 74886, -12528, 0 },
  122. { 18363, -109703, 74879, -12528, 49336 }
  123. };
  124. private static final int[][] _group_2 =
  125. {
  126. { 18363, -110393, 78276, -12848, 49152 },
  127. { 18363, -110561, 78276, -12848, 49152 },
  128. { 18362, -110414, 78495, -12905, 48112 },
  129. { 18362, -110545, 78489, -12903, 48939 },
  130. { 18483, -110474, 78601, -12915, 49488 },
  131. { 18362, -110474, 78884, -12915, 49338 },
  132. { 18483, -110389, 79131, -12915, 48539 },
  133. { 18483, -110551, 79134, -12915, 49151 }
  134. };
  135. private static final int[][] _group_3 =
  136. {
  137. { 18483, -107798, 80721, -12912, 0 },
  138. { 18483, -107798, 80546, -12912, 0 },
  139. { 18347, -108033, 80644, -12912, 0 },
  140. { 18363, -108520, 80647, -12912, 0 },
  141. { 18483, -108740, 80752, -12912, 0 },
  142. { 18363, -109016, 80642, -12912, 0 },
  143. { 18483, -108740, 80546, -12912, 0 }
  144. };
  145. private static final int[][] _group_4 =
  146. {
  147. { 18362, -110082, 83998, -12928, 0 },
  148. { 18362, -110082, 84210, -12928, 0 },
  149. { 18363, -109963, 84102, -12896, 0 },
  150. { 18347, -109322, 84102, -12880, 0 },
  151. { 18362, -109131, 84097, -12880, 0 },
  152. { 18483, -108932, 84101, -12880, 0 },
  153. { 18483, -109313, 84488, -12880, 0 },
  154. { 18362, -109122, 84490, -12880, 0 },
  155. { 18347, -108939, 84489, -12880, 0 }
  156. };
  157. private static final int[][] MP_HERBS_DROPLIST =
  158. {
  159. // itemId, count, chance
  160. { 8605, 1, 10 },
  161. { 8604, 2, 40 },
  162. { 8603, 3, 70 }
  163. };
  164. // @formatter:on
  165. private static final void dropHerb(L2Npc mob, L2PcInstance player, int[][] drop)
  166. {
  167. final int chance = getRandom(100);
  168. for (int[] element : drop)
  169. {
  170. if (chance < element[2])
  171. {
  172. mob.dropItem(player, element[0], element[1]);
  173. }
  174. }
  175. }
  176. private static final void giveBuffs(L2Character ch)
  177. {
  178. if (skill1 != null)
  179. {
  180. skill1.applyEffects(ch, ch);
  181. }
  182. if (skill2 != null)
  183. {
  184. skill2.applyEffects(ch, ch);
  185. }
  186. if (skill3 != null)
  187. {
  188. skill3.applyEffects(ch, ch);
  189. }
  190. if (skill4 != null)
  191. {
  192. skill4.applyEffects(ch, ch);
  193. }
  194. }
  195. public NornilsGarden()
  196. {
  197. super(NornilsGarden.class.getSimpleName());
  198. addStartNpc(_garden_guard);
  199. addFirstTalkId(_garden_guard);
  200. addTalkId(_garden_guard);
  201. for (int i[] : _gatekeepers)
  202. {
  203. addKillId(i[0]);
  204. }
  205. for (int i[] : _auto_gates)
  206. {
  207. addEnterZoneId(i[0]);
  208. }
  209. addTalkId(_final_gates);
  210. addAttackId(_herb_jar);
  211. addAttackId(18362); // first garden guard
  212. }
  213. @Override
  214. public final void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
  215. {
  216. giveBuffs(player);
  217. if (player.hasSummon())
  218. {
  219. giveBuffs(player.getSummon());
  220. }
  221. super.teleportPlayer(player, loc, instanceId);
  222. }
  223. private void exitInstance(L2PcInstance player)
  224. {
  225. InstanceWorld inst = InstanceManager.getInstance().getWorld(player.getInstanceId());
  226. if (inst instanceof NornilsWorld)
  227. {
  228. NornilsWorld world = ((NornilsWorld) inst);
  229. world.removeAllowed(player.getObjectId());
  230. teleportPlayer(player, EXIT_PPL, 0);
  231. }
  232. }
  233. private final synchronized String enterInstance(L2Npc npc, L2PcInstance player)
  234. {
  235. InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  236. if (world != null)
  237. {
  238. if (!(world instanceof NornilsWorld) || (world.getTemplateId() != TEMPLATE_ID))
  239. {
  240. player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
  241. return null;
  242. }
  243. // check for level difference again on reenter
  244. if ((player.getLevel() > INSTANCE_LVL_MAX) || (player.getLevel() < INSTANCE_LVL_MIN))
  245. {
  246. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
  247. sm.addPcName(player);
  248. player.sendPacket(sm);
  249. return null;
  250. }
  251. // check what instance still exist
  252. final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
  253. if (inst != null)
  254. {
  255. teleportPlayer(player, SPAWN_PPL, world.getInstanceId());
  256. }
  257. return null;
  258. }
  259. // Creating new instance
  260. String result = checkConditions(npc, player);
  261. if (!(result.equalsIgnoreCase("ok")))
  262. {
  263. return result;
  264. }
  265. final int instanceId = InstanceManager.getInstance().createDynamicInstance("NornilsGarden.xml");
  266. final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
  267. inst.setName(InstanceManager.getInstance().getInstanceIdName(TEMPLATE_ID));
  268. inst.setSpawnLoc(new Location(player));
  269. inst.setAllowSummon(false);
  270. inst.setDuration(DURATION_TIME * 60000);
  271. inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000);
  272. world = new NornilsWorld();
  273. world.setInstanceId(instanceId);
  274. world.setTemplateId(TEMPLATE_ID);
  275. InstanceManager.getInstance().addWorld(world);
  276. _log.info("Nornils Garden: started, Instance: " + instanceId + " created by player: " + player.getName());
  277. prepareInstance((NornilsWorld) world);
  278. // and finally teleport party into instance
  279. final L2Party party = player.getParty();
  280. if (party != null)
  281. {
  282. for (L2PcInstance partyMember : party.getMembers())
  283. {
  284. world.addAllowed(partyMember.getObjectId());
  285. teleportPlayer(partyMember, SPAWN_PPL, instanceId);
  286. }
  287. }
  288. return null;
  289. }
  290. private void prepareInstance(NornilsWorld world)
  291. {
  292. world.first_npc = addSpawn(18362, -109702, 74696, -12528, 49568, false, 0, false, world.getInstanceId());
  293. final L2DoorInstance door = getDoor(16200010, world.getInstanceId());
  294. if (door != null)
  295. {
  296. door.setTargetable(false);
  297. door.setMeshIndex(2);
  298. }
  299. }
  300. private void spawn1(L2Npc npc)
  301. {
  302. InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  303. if (inst instanceof NornilsWorld)
  304. {
  305. NornilsWorld world = ((NornilsWorld) inst);
  306. if (npc.equals(world.first_npc) && !world.spawned_1)
  307. {
  308. world.spawned_1 = true;
  309. for (int mob[] : _group_1)
  310. {
  311. addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId());
  312. }
  313. }
  314. }
  315. }
  316. private void spawn2(L2Npc npc)
  317. {
  318. InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  319. if (inst instanceof NornilsWorld)
  320. {
  321. NornilsWorld world = ((NornilsWorld) inst);
  322. if (!world.spawned_2)
  323. {
  324. world.spawned_2 = true;
  325. for (int mob[] : _group_2)
  326. {
  327. addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId());
  328. }
  329. }
  330. }
  331. }
  332. private void spawn3(L2Character cha)
  333. {
  334. InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId());
  335. if (inst instanceof NornilsWorld)
  336. {
  337. NornilsWorld world = ((NornilsWorld) inst);
  338. if (!world.spawned_3)
  339. {
  340. world.spawned_3 = true;
  341. for (int mob[] : _group_3)
  342. {
  343. addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId());
  344. }
  345. }
  346. }
  347. }
  348. private void spawn4(L2Character cha)
  349. {
  350. InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId());
  351. if (inst instanceof NornilsWorld)
  352. {
  353. NornilsWorld world = ((NornilsWorld) inst);
  354. if (!world.spawned_4)
  355. {
  356. world.spawned_4 = true;
  357. for (int mob[] : _group_4)
  358. {
  359. addSpawn(mob[0], mob[1], mob[2], mob[3], mob[4], false, 0, false, world.getInstanceId());
  360. }
  361. }
  362. }
  363. }
  364. public void openDoor(QuestState st, L2PcInstance player, int doorId)
  365. {
  366. st.unset("correct");
  367. InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId());
  368. if (tmpworld instanceof NornilsWorld)
  369. {
  370. openDoor(doorId, tmpworld.getInstanceId());
  371. }
  372. }
  373. private static final String checkConditions(L2Npc npc, L2PcInstance player)
  374. {
  375. final L2Party party = player.getParty();
  376. // player must be in party
  377. if (party == null)
  378. {
  379. player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER);
  380. return "32330-05.html";
  381. }
  382. // ...and be party leader
  383. if (party.getLeader() != player)
  384. {
  385. player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER);
  386. return "32330-08.html";
  387. }
  388. boolean _kamael = false;
  389. // for each party member
  390. for (L2PcInstance partyMember : party.getMembers())
  391. {
  392. // player level must be in range
  393. if (partyMember.getLevel() > INSTANCE_LVL_MAX)
  394. {
  395. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
  396. sm.addPcName(partyMember);
  397. player.sendPacket(sm);
  398. return "32330-06.html";
  399. }
  400. if (partyMember.getLevel() < INSTANCE_LVL_MIN)
  401. {
  402. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
  403. sm.addPcName(partyMember);
  404. player.sendPacket(sm);
  405. return "32330-07.html";
  406. }
  407. if (partyMember.getClassId().level() != 0)
  408. {
  409. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
  410. sm.addPcName(partyMember);
  411. player.sendPacket(sm);
  412. return "32330-06.html";
  413. }
  414. // player must be near party leader
  415. if (!partyMember.isInsideRadius(player, 500, true, true))
  416. {
  417. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
  418. sm.addPcName(partyMember);
  419. player.sendPacket(sm);
  420. return "32330-08.html";
  421. }
  422. if (partyMember.getRace().ordinal() == 5)
  423. {
  424. QuestState checkst = partyMember.getQuestState(Q00179_IntoTheLargeCavern.class.getSimpleName());
  425. if ((checkst != null) && (checkst.getState() == State.STARTED))
  426. {
  427. _kamael = true;
  428. }
  429. else
  430. {
  431. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
  432. sm.addPcName(partyMember);
  433. player.sendPacket(sm);
  434. return "32330-08.html";
  435. }
  436. }
  437. }
  438. if (!_kamael)
  439. {
  440. return "32330-08.html";
  441. }
  442. return "ok";
  443. }
  444. @Override
  445. public String onEnterZone(L2Character character, L2ZoneType zone)
  446. {
  447. if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline())
  448. {
  449. InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId());
  450. if (tmpworld instanceof NornilsWorld)
  451. {
  452. for (int _auto[] : _auto_gates)
  453. {
  454. if (zone.getId() == _auto[0])
  455. {
  456. openDoor(_auto[1], tmpworld.getInstanceId());
  457. }
  458. if (zone.getId() == 20111)
  459. {
  460. spawn3(character);
  461. }
  462. else if (zone.getId() == 20112)
  463. {
  464. spawn4(character);
  465. }
  466. }
  467. }
  468. }
  469. return super.onEnterZone(character, zone);
  470. }
  471. @Override
  472. public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  473. {
  474. String htmltext = event;
  475. QuestState st = getQuestState(player, false);
  476. if (st == null)
  477. {
  478. return getNoQuestMsg(player);
  479. }
  480. if ((npc.getId() == _garden_guard) && event.equalsIgnoreCase("enter_instance"))
  481. {
  482. try
  483. {
  484. htmltext = enterInstance(npc, player);
  485. }
  486. catch (Exception e)
  487. {
  488. }
  489. }
  490. else if ((npc.getId() == 32258) && event.equalsIgnoreCase("exit"))
  491. {
  492. try
  493. {
  494. exitInstance(player);
  495. }
  496. catch (Exception e)
  497. {
  498. }
  499. }
  500. else if (Util.contains(_final_gates, npc.getId()))
  501. {
  502. if (event.equalsIgnoreCase("32260-02.html") || event.equalsIgnoreCase("32261-02.html") || event.equalsIgnoreCase("32262-02.html"))
  503. {
  504. st.unset("correct");
  505. }
  506. else if (Util.isDigit(event))
  507. {
  508. int correct = st.getInt("correct");
  509. correct++;
  510. st.set("correct", String.valueOf(correct));
  511. htmltext = npc.getId() + "-0" + String.valueOf(correct + 2) + ".html";
  512. }
  513. else if (event.equalsIgnoreCase("check"))
  514. {
  515. int correct = st.getInt("correct");
  516. if ((npc.getId() == 32260) && (correct == 3))
  517. {
  518. openDoor(st, player, 16200014);
  519. }
  520. else if ((npc.getId() == 32261) && (correct == 3))
  521. {
  522. openDoor(st, player, 16200015);
  523. }
  524. else if ((npc.getId() == 32262) && (correct == 4))
  525. {
  526. openDoor(st, player, 16200016);
  527. }
  528. else
  529. {
  530. return npc.getId() + "-00.html";
  531. }
  532. }
  533. }
  534. return htmltext;
  535. }
  536. @Override
  537. public final String onTalk(L2Npc npc, L2PcInstance player)
  538. {
  539. if (Util.contains(_final_gates, npc.getId()))
  540. {
  541. QuestState cst = player.getQuestState(Q00179_IntoTheLargeCavern.class.getSimpleName());
  542. if ((cst != null) && (cst.getState() == State.STARTED))
  543. {
  544. return npc.getId() + "-01.html";
  545. }
  546. return getNoQuestMsg(player);
  547. }
  548. return null;
  549. }
  550. @Override
  551. public final String onFirstTalk(L2Npc npc, L2PcInstance player)
  552. {
  553. getQuestState(player, true);
  554. return npc.getId() + ".html";
  555. }
  556. @Override
  557. public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
  558. {
  559. if ((npc.getId() == _herb_jar) && !npc.isDead())
  560. {
  561. dropHerb(npc, attacker, HP_HERBS_DROPLIST);
  562. dropHerb(npc, attacker, MP_HERBS_DROPLIST);
  563. npc.doDie(attacker);
  564. }
  565. else if ((npc.getId() == 18362) && (npc.getInstanceId() > 0))
  566. {
  567. spawn1(npc);
  568. }
  569. return null;
  570. }
  571. @Override
  572. public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  573. {
  574. final QuestState st = getQuestState(player, false);
  575. if (st == null)
  576. {
  577. return null;
  578. }
  579. for (int _gk[] : _gatekeepers)
  580. {
  581. if (npc.getId() == _gk[0])
  582. {
  583. // Drop key
  584. npc.dropItem(player, _gk[1], 1);
  585. // Check if gatekeeper should open bridge, and open it
  586. if (_gk[2] > 0)
  587. {
  588. InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId());
  589. if (tmpworld instanceof NornilsWorld)
  590. {
  591. openDoor(_gk[2], tmpworld.getInstanceId());
  592. }
  593. }
  594. }
  595. if (npc.getId() == 18355)
  596. {
  597. spawn2(npc);
  598. }
  599. }
  600. return super.onKill(npc, player, isSummon);
  601. }
  602. @Override
  603. public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
  604. {
  605. }
  606. }