Advertisement
Guest User

Icequeencastle1.java

a guest
Mar 26th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.22 KB | None | 0 0
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package instances.IceQueenCastle1;
  16.  
  17. import javolution.util.FastList;
  18.  
  19. import com.l2jserver.gameserver.ai.CtrlIntention;
  20. import com.l2jserver.gameserver.datatables.SkillTable;
  21. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  22. import com.l2jserver.gameserver.instancemanager.InstanceManager.InstanceWorld;
  23. import com.l2jserver.gameserver.model.L2CharPosition;
  24. import com.l2jserver.gameserver.model.L2Object;
  25. import com.l2jserver.gameserver.model.L2Skill;
  26. import com.l2jserver.gameserver.model.actor.L2Attackable;
  27. import com.l2jserver.gameserver.model.actor.L2Character;
  28. import com.l2jserver.gameserver.model.actor.L2Npc;
  29. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  30. import com.l2jserver.gameserver.model.quest.Quest;
  31. import com.l2jserver.gameserver.model.quest.QuestState;
  32. import com.l2jserver.gameserver.model.quest.State;
  33. import com.l2jserver.gameserver.network.SystemMessageId;
  34. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  35. import com.l2jserver.gameserver.network.clientpackets.Say2;
  36. import com.l2jserver.util.Rnd;
  37.  
  38. public class IceQueenCastle1 extends Quest
  39. {
  40. private static final String qn = "IceQueenCastle1";
  41. private static final int INSTANCEID = 137;
  42.  
  43. private static final int _jinia_2 = 32781;
  44. private static final int _freya = 18847;
  45. private static final int _jinia_guard1 = 18848;
  46. private static final int _jinia_guard2 = 18849;
  47. private static final int _jinia_guard3 = 18926;
  48. private static final int _ice_knight = 22767;
  49. private static final int _freya_controller = 18930; // TODO:Custom npc
  50.  
  51. private static final int[] ENTRY_POINT = { 114000, -112357, -11200 };
  52.  
  53. private class IQWorld extends InstanceWorld
  54. {
  55. public L2Attackable _freya = null;
  56. public L2Attackable _jinia_guard1 = null;
  57. public L2Attackable _jinia_guard2 = null;
  58. public L2Attackable _jinia_guard3 = null;
  59. public L2Attackable _jinia_guard4 = null;
  60. public L2Attackable _jinia_guard5 = null;
  61. public L2Attackable _jinia_guard6 = null;
  62. public L2Attackable _freya_guard1 = null;
  63. public L2Attackable _freya_guard2 = null;
  64. public L2Attackable _freya_guard3 = null;
  65. public L2Attackable _freya_guard4 = null;
  66. public L2Attackable _freya_guard5 = null;
  67. public L2Attackable _freya_controller = null;
  68.  
  69. public IQWorld()
  70. {
  71. }
  72. }
  73.  
  74. private class teleCoord {int instanceId; int x; int y; int z;}
  75.  
  76. private void teleportplayer(L2PcInstance player, teleCoord teleto)
  77. {
  78. player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  79. player.setInstanceId(teleto.instanceId);
  80. player.teleToLocation(teleto.x, teleto.y, teleto.z);
  81. return;
  82. }
  83.  
  84. @Override
  85. public String onTalk(L2Npc npc, L2PcInstance player)
  86. {
  87. int npcId = npc.getNpcId();
  88. QuestState st = player.getQuestState(qn);
  89. if (st == null)
  90. st = newQuestState(player);
  91.  
  92. if (npcId == _jinia_2)
  93. {
  94. teleCoord tele = new teleCoord();
  95. tele.x = ENTRY_POINT[0];
  96. tele.y = ENTRY_POINT[1];
  97. tele.z = ENTRY_POINT[2];
  98.  
  99. QuestState hostQuest = player.getQuestState("10285_MeetingSirra");
  100.  
  101. if (hostQuest != null && hostQuest.getState() == State.STARTED && hostQuest.getInt("progress") == 2)
  102. {
  103. hostQuest.set("cond", "9");
  104. hostQuest.playSound("ItemSound.quest_middle");
  105. }
  106.  
  107. if (enterInstance(player, "IceQueenCastle1.xml", tele) <= 0)
  108. return "32781-10.htm";
  109. }
  110. return "";
  111. }
  112.  
  113. @Override
  114. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  115. {
  116. InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
  117. if (tmpworld instanceof IQWorld)
  118. {
  119. IQWorld world = (IQWorld) tmpworld;
  120.  
  121. if (event.equalsIgnoreCase("check_guards"))
  122. {
  123. if ((world._freya_guard1 == null || world._freya_guard1.isDead()) && getQuestTimer("spawn_ice_guard1", null, player) == null)
  124. {
  125. startQuestTimer("spawn_ice_guard1", 30000, null, player);
  126. }
  127. if ((world._freya_guard2 == null || world._freya_guard2.isDead()) && getQuestTimer("spawn_ice_guard2", null, player) == null)
  128. {
  129. startQuestTimer("spawn_ice_guard2", 30000, null, player);
  130. }
  131. if ((world._freya_guard3 == null || world._freya_guard3.isDead()) && getQuestTimer("spawn_ice_guard3", null, player) == null)
  132. {
  133. startQuestTimer("spawn_ice_guard3", 30000, null, player);
  134. }
  135. if ((world._freya_guard4 == null || world._freya_guard4.isDead()) && getQuestTimer("spawn_ice_guard4", null, player) == null)
  136. {
  137. startQuestTimer("spawn_ice_guard4", 30000, null, player);
  138. }
  139. if ((world._freya_guard5 == null || world._freya_guard5.isDead()) && getQuestTimer("spawn_ice_guard5", null, player) == null)
  140. {
  141. startQuestTimer("spawn_ice_guard5", 30000, null, player);
  142. }
  143.  
  144. if ((world._jinia_guard1 == null || world._jinia_guard1.isDead()) && getQuestTimer("spawn_guard1", null, player) == null)
  145. {
  146. startQuestTimer("spawn_guard1", 60000, null, player);
  147. }
  148. else
  149. {
  150. world._jinia_guard1.stopHating(player);
  151. }
  152. if ((world._jinia_guard2 == null || world._jinia_guard2.isDead()) && getQuestTimer("spawn_guard2", null, player) == null)
  153. {
  154. startQuestTimer("spawn_guard2", 45000, null, player);
  155. }
  156. else
  157. {
  158. world._jinia_guard2.stopHating(player);
  159. }
  160. if ((world._jinia_guard3 == null || world._jinia_guard3.isDead()) && getQuestTimer("spawn_guard3", null, player) == null)
  161. {
  162. startQuestTimer("spawn_guard3", 45000, null, player);
  163. }
  164. else
  165. {
  166. world._jinia_guard3.stopHating(player);
  167. }
  168. if ((world._jinia_guard4 == null || world._jinia_guard4.isDead()) && getQuestTimer("spawn_guard4", null, player) == null)
  169. {
  170. startQuestTimer("spawn_guard4", 60000, null, player);
  171. }
  172. else
  173. {
  174. world._jinia_guard4.stopHating(player);
  175. }
  176. if ((world._jinia_guard5 == null || world._jinia_guard5.isDead()) && getQuestTimer("spawn_guard5", null, player) == null)
  177. {
  178. startQuestTimer("spawn_guard5", 45000, null, player);
  179. }
  180. else
  181. {
  182. world._jinia_guard5.stopHating(player);
  183. }
  184. if ((world._jinia_guard6 == null || world._jinia_guard6.isDead()) && getQuestTimer("spawn_guard6", null, player) == null)
  185. {
  186. startQuestTimer("spawn_guard6", 45000, null, player);
  187. }
  188. else
  189. {
  190. world._jinia_guard6.stopHating(player);
  191. }
  192. }
  193. else if (event.equalsIgnoreCase("spawn_ice_guard1"))
  194. {
  195. world._freya_guard1 = (L2Attackable) addSpawn(_ice_knight, 114713, -115109, -11198, 16456, false, 0, false, world.instanceId);
  196. L2Character target = getRandomTargetFreya(world);
  197. world._freya_guard1.addDamageHate(target, 9999, 9999);
  198. world._freya_guard1.setRunning();
  199. world._freya_guard1.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  200. }
  201. else if (event.equalsIgnoreCase("spawn_ice_guard2"))
  202. {
  203. world._freya_guard2 = (L2Attackable) addSpawn(_ice_knight, 114008, -115080, -11198, 3568, false, 0, false, world.instanceId);
  204. L2Character target = getRandomTargetFreya(world);
  205. world._freya_guard2.addDamageHate(target, 9999, 9999);
  206. world._freya_guard2.setRunning();
  207. world._freya_guard2.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  208. }
  209. else if (event.equalsIgnoreCase("spawn_ice_guard3"))
  210. {
  211. world._freya_guard3 = (L2Attackable) addSpawn(_ice_knight, 114422, -115508, -11198, 12400, false, 0, false, world.instanceId);
  212. L2Character target = getRandomTargetFreya(world);
  213. world._freya_guard3.addDamageHate(target, 9999, 9999);
  214. world._freya_guard3.setRunning();
  215. world._freya_guard3.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  216. }
  217. else if (event.equalsIgnoreCase("spawn_ice_guard4"))
  218. {
  219. world._freya_guard4 = (L2Attackable) addSpawn(_ice_knight, 115023, -115508, -11198, 20016, false, 0, false, world.instanceId);
  220. L2Character target = getRandomTargetFreya(world);
  221. world._freya_guard4.addDamageHate(target, 9999, 9999);
  222. world._freya_guard4.setRunning();
  223. world._freya_guard4.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  224. }
  225. else if (event.equalsIgnoreCase("spawn_ice_guard5"))
  226. {
  227. world._freya_guard5 = (L2Attackable) addSpawn(_ice_knight, 115459, -115079, -11198, 27936, false, 0, false, world.instanceId);
  228. L2Character target = getRandomTargetFreya(world);
  229. world._freya_guard5.addDamageHate(target, 9999, 9999);
  230. world._freya_guard5.setRunning();
  231. world._freya_guard5.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  232. }
  233. else if (event.equalsIgnoreCase("spawn_guard1"))
  234. {
  235. world._jinia_guard1 = (L2Attackable) addSpawn(_jinia_guard1, 114861, -113615, -11198, -21832, false, 0, false, world.instanceId);
  236. world._jinia_guard1.setRunning();
  237. L2Character target = getRandomTargetGuard(world);
  238. world._jinia_guard1.addDamageHate(target, 9999, 9999);
  239. world._jinia_guard1.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  240. }
  241. else if (event.equalsIgnoreCase("spawn_guard2"))
  242. {
  243. world._jinia_guard2 = (L2Attackable) addSpawn(_jinia_guard2, 114950, -113647, -11198, -20880, false, 0, false, world.instanceId);
  244. world._jinia_guard2.setRunning();
  245. L2Character target = getRandomTargetGuard(world);
  246. world._jinia_guard2.addDamageHate(target, 9999, 9999);
  247. world._jinia_guard2.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  248. }
  249. else if (event.equalsIgnoreCase("spawn_guard3"))
  250. {
  251. world._jinia_guard3 = (L2Attackable) addSpawn(_jinia_guard3, 115041, -113694, -11198, -22440, false, 0, false, world.instanceId);
  252. world._jinia_guard3.setRunning();
  253. L2Character target = getRandomTargetGuard(world);
  254. world._jinia_guard3.addDamageHate(target, 9999, 9999);
  255. world._jinia_guard3.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  256. }
  257. else if (event.equalsIgnoreCase("spawn_guard4"))
  258. {
  259. world._jinia_guard4 = (L2Attackable) addSpawn(_jinia_guard1, 114633, -113619, -11198, -12224, false, 0, false, world.instanceId);
  260. world._jinia_guard4.setRunning();
  261. L2Character target = getRandomTargetGuard(world);
  262. world._jinia_guard4.addDamageHate(target, 9999, 9999);
  263. world._jinia_guard4.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  264. }
  265. else if (event.equalsIgnoreCase("spawn_guard5"))
  266. {
  267. world._jinia_guard5 = (L2Attackable) addSpawn(_jinia_guard2, 114540, -113654, -11198, -12880, false, 0, false, world.instanceId);
  268. world._jinia_guard5.setRunning();
  269. L2Character target = getRandomTargetGuard(world);
  270. world._jinia_guard5.addDamageHate(target, 9999, 9999);
  271. world._jinia_guard5.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  272. }
  273. else if (event.equalsIgnoreCase("spawn_guard6"))
  274. {
  275. world._jinia_guard6 = (L2Attackable) addSpawn(_jinia_guard3, 114446, -113698, -11198, -11264, false, 0, false, world.instanceId);
  276. world._jinia_guard6.setRunning();
  277. L2Character target = getRandomTargetGuard(world);
  278. world._jinia_guard6.addDamageHate(target, 9999, 9999);
  279. world._jinia_guard6.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  280. }
  281. else if (event.equalsIgnoreCase("call_freya_skill"))
  282. {
  283. // call freya skill
  284. L2Object target = world._freya.getTarget();
  285. if (target != null && player != null && target.getObjectId() == player.getObjectId() && !world._freya.isCastingNow())
  286. {
  287. if (Rnd.get(100) < 40)
  288. {
  289. world._freya.doCast(SkillTable.getInstance().getInfo(6278, 1));
  290. }
  291. }
  292. }
  293. else if (event.equalsIgnoreCase("go_guards"))
  294. {
  295.  
  296. NpcSay cs = new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), "S1_MAY_THE_PROTECTION_OF_THE_GODS_BE_UPON_YOU.");
  297. cs.addStringParameter(player.getAppearance().getVisibleName());
  298. player.sendPacket(cs);
  299.  
  300. world._jinia_guard1.setRunning();
  301. world._jinia_guard2.setRunning();
  302. world._jinia_guard3.setRunning();
  303. world._jinia_guard4.setRunning();
  304. world._jinia_guard5.setRunning();
  305. world._jinia_guard6.setRunning();
  306. world._jinia_guard1.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114673, -113374, -11200, 0));
  307. world._jinia_guard4.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114745, -113383, -11200, 0));
  308. world._jinia_guard2.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114711, -113382, -11200, 0));
  309. world._jinia_guard5.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114662, -113382, -11200, 0));
  310.  
  311. startQuestTimer("go_fight", 3000, null, player);
  312. }
  313. else if (event.equalsIgnoreCase("go_fight"))
  314. {
  315. world._jinia_guard1.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114673, -114324, -11200, 0));
  316. world._jinia_guard4.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114745, -114324, -11200, 0));
  317. world._jinia_guard2.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114711, -114324, -11200, 0));
  318. world._jinia_guard5.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114662, -114324, -11200, 0));
  319. world._jinia_guard3.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(115041, -114324, -11200, 0));
  320. world._jinia_guard6.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114446, -114324, -11200, 0));
  321.  
  322. world._freya_guard1.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114713, -114920, -11200, 0));
  323. world._freya_guard2.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114008, -114920, -11200, 0));
  324. world._freya_guard3.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114422, -114920, -11200, 0));
  325. world._freya_guard4.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(115023, -114920, -11200, 0));
  326. world._freya_guard5.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(115459, -114920, -11200, 0));
  327. world._freya.setRunning();
  328. world._freya.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114722, -114798, -11205, 15956));
  329. startQuestTimer("freya", 17000, null, player);
  330. startQuestTimer("go_fight2", 7000, null, player);
  331. }
  332. else if (event.equalsIgnoreCase("go_fight2"))
  333. {
  334. world._jinia_guard1.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getRandomTargetGuard(world));
  335. world._jinia_guard4.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getRandomTargetGuard(world));
  336. world._jinia_guard2.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getRandomTargetGuard(world));
  337. world._jinia_guard5.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getRandomTargetGuard(world));
  338. world._jinia_guard3.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getRandomTargetGuard(world));
  339. world._jinia_guard6.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getRandomTargetGuard(world));
  340. }
  341. else if (event.equalsIgnoreCase("freya"))
  342. {
  343. L2Character target = getRandomTargetFreya(world);
  344. world._freya.addDamageHate(target, 9999, 9999);
  345. world._freya.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
  346. }
  347. else if (event.equalsIgnoreCase("end_inst"))
  348. {
  349. cancelQuestTimer("spawn_guard1", null, player);
  350. cancelQuestTimer("spawn_guard2", null, player);
  351. cancelQuestTimer("spawn_guard3", null, player);
  352. cancelQuestTimer("spawn_guard4", null, player);
  353. cancelQuestTimer("spawn_guard5", null, player);
  354. cancelQuestTimer("spawn_guard6", null, player);
  355. cancelQuestTimer("check_guards", null, player);
  356. cancelQuestTimer("spawn_ice_guard1", null, player);
  357. cancelQuestTimer("spawn_ice_guard2", null, player);
  358. cancelQuestTimer("spawn_ice_guard3", null, player);
  359. cancelQuestTimer("spawn_ice_guard4", null, player);
  360. cancelQuestTimer("spawn_ice_guard5", null, player);
  361. cancelQuestTimer("call_freya_skill", null, player);
  362. world._freya.abortAttack();
  363. world._freya.abortCast();
  364. world._freya.setTarget(player);
  365. world._freya.doCast(SkillTable.getInstance().getInfo(6275, 1));
  366. startQuestTimer("movie", 7000, null, player);
  367. NpcSay cs = new NpcSay(npc.getObjectId(), Say2.ALL, npc.getNpcId(), "I can no longer stand by.");
  368. player.sendPacket(cs);
  369. }
  370. else if (event.equalsIgnoreCase("movie"))
  371. {
  372. startQuestTimer("movie2", 3000, null, player);
  373.  
  374. QuestState st = player.getQuestState("10285_MeetingSirra");
  375. if (st != null && st.getState() == State.STARTED && st.getInt("progress") == 2)
  376. {
  377. st.set("cond", "10");
  378. st.playSound("ItemSound.quest_middle");
  379. st.set("progress", "3");
  380. }
  381. }
  382. else if (event.equalsIgnoreCase("movie2"))
  383. {
  384. player.showQuestMovie(21);
  385. player.setInstanceId(0);
  386. player.teleToLocation(113851, -108987, -837);
  387. InstanceManager.getInstance().destroyInstance(world.instanceId);
  388. }
  389. }
  390. return null;
  391. }
  392.  
  393. private boolean checkCond(L2PcInstance player)
  394. {
  395. if (player.getLevel() < 82)
  396. return false;
  397.  
  398. return true;
  399. }
  400.  
  401. protected int enterInstance(L2PcInstance player, String template, teleCoord teleto)
  402. {
  403. int instanceId = 0;
  404. //check for existing instances for this player
  405. InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  406. //existing instance
  407. if (world != null)
  408. {
  409. if (!(world instanceof IQWorld))
  410. {
  411. player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
  412. return 0;
  413. }
  414. teleto.instanceId = world.instanceId;
  415. teleportplayer(player,teleto);
  416. return instanceId;
  417. }
  418. //New instance
  419. if (!checkCond(player))
  420. return 0;
  421. instanceId = InstanceManager.getInstance().createDynamicInstance(template);
  422. world = new IQWorld();
  423.  
  424. world.instanceId = instanceId;
  425. world.templateId = INSTANCEID;
  426. world.status = 0;
  427.  
  428. world.allowed.add(player.getObjectId());
  429.  
  430. InstanceManager.getInstance().addWorld(world);
  431. _log.info("Freya started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
  432. teleto.instanceId = instanceId;
  433. teleportplayer(player,teleto);
  434. world.allowed.add(player.getObjectId());
  435. spawnFirst((IQWorld) world);
  436.  
  437. return instanceId;
  438. }
  439.  
  440. @Override
  441. public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isPet)
  442. {
  443. InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
  444. if (tmpworld instanceof IQWorld)
  445. {
  446. IQWorld world = (IQWorld) tmpworld;
  447. if (npc.getNpcId() == _freya_controller)
  448. {
  449. world._jinia_guard1.setIsImmobilized(false);
  450. world._jinia_guard2.setIsImmobilized(false);
  451. world._jinia_guard3.setIsImmobilized(false);
  452. world._jinia_guard4.setIsImmobilized(false);
  453. world._jinia_guard5.setIsImmobilized(false);
  454. world._jinia_guard6.setIsImmobilized(false);
  455. world._freya.setIsImmobilized(false);
  456. world._freya_guard1.setIsImmobilized(false);
  457. world._freya_guard2.setIsImmobilized(false);
  458. world._freya_guard3.setIsImmobilized(false);
  459. world._freya_guard4.setIsImmobilized(false);
  460. world._freya_guard5.setIsImmobilized(false);
  461.  
  462. startQuestTimer("go_guards", 300, npc, player);
  463. startQuestTimer("end_inst", 120000, npc, player);
  464. startQuestTimer("check_guards", 1000, null, player, true);
  465. startQuestTimer("call_freya_skill", 7000, null, player, true);
  466. world._freya_controller.deleteMe();
  467. world._freya_controller = null;
  468. }
  469. }
  470. return null;
  471. }
  472.  
  473. @Override
  474. public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, L2Skill skill)
  475. {
  476. int npcId = npc.getNpcId();
  477. if (npcId == _jinia_guard1 || npcId == _jinia_guard2 || npcId == _jinia_guard3)
  478. {
  479. npc.setCurrentHp(npc.getCurrentHp() + damage);
  480. ((L2Attackable) npc).stopHating(attacker);
  481. }
  482. return onAttack(npc, attacker, damage, isPet);
  483. }
  484.  
  485. private void spawnFirst(IQWorld world)
  486. {
  487. world._freya = (L2Attackable) addSpawn(_freya, 114722, -114798, -11205, 15956, false, 0, false, world.instanceId);
  488. world._freya.teleToLocation(114720, -117085, -11088, 15956, false);
  489. world._jinia_guard1 = (L2Attackable) addSpawn(_jinia_guard1, 114861, -113615, -11198, -21832, false, 0, false, world.instanceId);
  490. world._jinia_guard2 = (L2Attackable) addSpawn(_jinia_guard2, 114950, -113647, -11198, -20880, false, 0, false, world.instanceId);
  491. world._jinia_guard3 = (L2Attackable) addSpawn(_jinia_guard3, 115041, -113694, -11198, -22440, false, 0, false, world.instanceId);
  492. world._jinia_guard4 = (L2Attackable) addSpawn(_jinia_guard1, 114633, -113619, -11198, -12224, false, 0, false, world.instanceId);
  493. world._jinia_guard5 = (L2Attackable) addSpawn(_jinia_guard2, 114540, -113654, -11198, -12880, false, 0, false, world.instanceId);
  494. world._jinia_guard6 = (L2Attackable) addSpawn(_jinia_guard3, 114446, -113698, -11198, -11264, false, 0, false, world.instanceId);
  495. world._freya_guard1 = (L2Attackable) addSpawn(_ice_knight, 114713, -115109, -11198, 16456, false, 0, false, world.instanceId);
  496. world._freya_guard2 = (L2Attackable) addSpawn(_ice_knight, 114008, -115080, -11198, 3568, false, 0, false, world.instanceId);
  497. world._freya_guard3 = (L2Attackable) addSpawn(_ice_knight, 114422, -115508, -11198, 12400, false, 0, false, world.instanceId);
  498. world._freya_guard4 = (L2Attackable) addSpawn(_ice_knight, 115023, -115508, -11198, 20016, false, 0, false, world.instanceId);
  499. world._freya_guard5 = (L2Attackable) addSpawn(_ice_knight, 115459, -115079, -11198, 27936, false, 0, false, world.instanceId);
  500. world._freya_controller = (L2Attackable) addSpawn(_freya_controller, 114713, -113578, -11200, 27936, false, 0, false, world.instanceId);
  501.  
  502. world._freya_controller.setIsImmobilized(true);
  503. world._jinia_guard1.setIsImmobilized(true);
  504. world._jinia_guard2.setIsImmobilized(true);
  505. world._jinia_guard3.setIsImmobilized(true);
  506. world._jinia_guard4.setIsImmobilized(true);
  507. world._jinia_guard5.setIsImmobilized(true);
  508. world._jinia_guard6.setIsImmobilized(true);
  509. world._freya.setIsImmobilized(true);
  510. world._freya_guard1.setIsImmobilized(true);
  511. world._freya_guard2.setIsImmobilized(true);
  512. world._freya_guard3.setIsImmobilized(true);
  513. world._freya_guard4.setIsImmobilized(true);
  514. world._freya_guard5.setIsImmobilized(true);
  515. world._freya_guard1.setRunning();
  516. world._freya_guard2.setRunning();
  517. world._freya_guard3.setRunning();
  518. world._freya_guard4.setRunning();
  519. world._freya_guard5.setRunning();
  520.  
  521. InstanceManager.getInstance().getInstance(world.instanceId).getDoor(23140101).openMe();
  522. }
  523.  
  524. private L2Npc getRandomTargetFreya(IQWorld world)
  525. {
  526. FastList<L2Npc> npcList = new FastList<L2Npc>();
  527. L2Npc victim = null;
  528. victim = world._jinia_guard1;
  529. if (victim != null && !victim.isDead())
  530. {
  531. npcList.add(victim);
  532. }
  533. victim = world._jinia_guard2;
  534. if (victim != null && !victim.isDead())
  535. {
  536. npcList.add(victim);
  537. }
  538. victim = world._jinia_guard3;
  539. if (victim != null && !victim.isDead())
  540. {
  541. npcList.add(victim);
  542. }
  543. victim = world._jinia_guard4;
  544. if (victim != null && !victim.isDead())
  545. {
  546. npcList.add(victim);
  547. }
  548. victim = world._jinia_guard5;
  549. if (victim != null && !victim.isDead())
  550. {
  551. npcList.add(victim);
  552. }
  553. victim = world._jinia_guard6;
  554. if (victim != null && !victim.isDead())
  555. {
  556. npcList.add(victim);
  557. }
  558. if (npcList.size() > 0)
  559. return npcList.get(Rnd.get(npcList.size()-1));
  560. return null;
  561. }
  562.  
  563. private L2Npc getRandomTargetGuard(IQWorld world)
  564. {
  565. FastList<L2Npc> npcList = new FastList<L2Npc>();
  566. L2Npc victim = null;
  567. victim = world._freya_guard1;
  568. if (victim != null && !victim.isDead())
  569. {
  570. npcList.add(victim);
  571. }
  572. victim = world._freya_guard2;
  573. if (victim != null && !victim.isDead())
  574. {
  575. npcList.add(victim);
  576. }
  577. victim = world._freya_guard3;
  578. if (victim != null && !victim.isDead())
  579. {
  580. npcList.add(victim);
  581. }
  582. victim = world._freya_guard4;
  583. if (victim != null && !victim.isDead())
  584. {
  585. npcList.add(victim);
  586. }
  587. victim = world._freya_guard5;
  588. if (victim != null && !victim.isDead())
  589. {
  590. npcList.add(victim);
  591. }
  592. if (npcList.size() > 0)
  593. return npcList.get(Rnd.get(npcList.size()-1));
  594. return null;
  595. }
  596.  
  597. public IceQueenCastle1(int questId, String name, String descr)
  598. {
  599. super(questId, name, descr);
  600.  
  601. addStartNpc(_jinia_2);
  602. addTalkId(_jinia_2);
  603. addAggroRangeEnterId(_freya_controller);
  604. addAttackId(_jinia_guard1);
  605. addAttackId(_jinia_guard2);
  606. addAttackId(_jinia_guard3);
  607. }
  608.  
  609. public static void main(String[] args)
  610. {
  611. new IceQueenCastle1(-1,qn,"instances");
  612. }
  613. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement