Gladicek

Freya script 1.0

Jan 4th, 2013
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.82 KB | None | 0 0
  1. Index: dist/game/data/html/default/32781.htm
  2. ===================================================================
  3. --- dist/game/data/html/default/32781.htm (revision 0)
  4. +++ dist/game/data/html/default/32781.htm (working copy)
  5. @@ -0,0 +1,6 @@
  6. +<html><body>Jinia<br>
  7. +This place is so cold I can´t feel my nose. I´m sure it´s so red,
  8. + I could lead a pack of flying reindeer.<br>
  9. +
  10. +<a action="bypass -h npc_%objectId%_Quest FreyaInstance">"TEST TEST TEST."</a><br>
  11. +</body></html>
  12. \ No newline at end of file
  13. Index: dist/game/data/scripts/instances/Freya/FreyaInstance.java
  14. ===================================================================
  15. --- dist/game/data/scripts/instances/Freya/FreyaInstance.java (revision 0)
  16. +++ dist/game/data/scripts/instances/Freya/FreyaInstance.java (working copy)
  17. @@ -0,0 +1,1143 @@
  18. +/*
  19. + * This program is free software: you can redistribute it and/or modify it under
  20. + * the terms of the GNU General Public License as published by the Free Software
  21. + * Foundation, either version 3 of the License, or (at your option) any later
  22. + * version.
  23. + *
  24. + * This program is distributed in the hope that it will be useful, but WITHOUT
  25. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  26. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  27. + * details.
  28. + *
  29. + * You should have received a copy of the GNU General Public License along with
  30. + * this program. If not, see <http://www.gnu.org/licenses/>.
  31. + */
  32. +package instances.Freya;
  33. +
  34. +import java.util.Calendar;
  35. +import java.util.List;
  36. +import java.util.concurrent.locks.Lock;
  37. +import java.util.concurrent.locks.ReentrantLock;
  38. +
  39. +import javolution.util.FastList;
  40. +
  41. +import com.l2jserver.gameserver.ai.CtrlIntention;
  42. +import com.l2jserver.gameserver.instancemanager.InstanceManager;
  43. +import com.l2jserver.gameserver.model.L2CharPosition;
  44. +import com.l2jserver.gameserver.model.L2CommandChannel;
  45. +import com.l2jserver.gameserver.model.L2Party;
  46. +import com.l2jserver.gameserver.model.L2Spawn;
  47. +import com.l2jserver.gameserver.model.L2World;
  48. +import com.l2jserver.gameserver.model.Location;
  49. +import com.l2jserver.gameserver.model.actor.L2Attackable;
  50. +import com.l2jserver.gameserver.model.actor.L2Character;
  51. +import com.l2jserver.gameserver.model.actor.L2Npc;
  52. +import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance;
  53. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  54. +import com.l2jserver.gameserver.model.entity.Instance;
  55. +import com.l2jserver.gameserver.model.holders.SkillHolder;
  56. +import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
  57. +import com.l2jserver.gameserver.model.quest.Quest;
  58. +import com.l2jserver.gameserver.model.quest.QuestState;
  59. +import com.l2jserver.gameserver.model.quest.State;
  60. +import com.l2jserver.gameserver.model.zone.L2ZoneType;
  61. +import com.l2jserver.gameserver.network.NpcStringId;
  62. +import com.l2jserver.gameserver.network.SystemMessageId;
  63. +import com.l2jserver.gameserver.network.clientpackets.Say2;
  64. +import com.l2jserver.gameserver.network.serverpackets.ExSendUIEvent;
  65. +import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
  66. +import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  67. +import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  68. +import com.l2jserver.gameserver.taskmanager.DecayTaskManager;
  69. +import com.l2jserver.gameserver.util.Util;
  70. +import com.l2jserver.util.Rnd;
  71. +
  72. +/**
  73. + ** @author Gnacik, Gladicek
  74. + * TODO: Glaciers, Ice Queen Castle room animation (we currently have only "blizzard" effect)
  75. + */
  76. +
  77. +public class FreyaInstance extends Quest
  78. +{
  79. + // Debug
  80. + private static final boolean DEBUG = true;
  81. +
  82. + // Instance ID
  83. + private static final int INSTANCEID = 139;
  84. +
  85. + // Zone
  86. + private static final int ZONE = 90578;
  87. +
  88. + // Instance limits
  89. + private static final int MIN_PLAYERS = 9;
  90. + private static final int MAX_PLAYERS = 27;
  91. + private static final int MIN_LEVEL = 82;
  92. +
  93. + // Doors
  94. + private static final int HALL_DOORS = 23140101;
  95. +
  96. + // NPC's
  97. + private static final int JINIA = 32781; // ENTER
  98. + private static final int SIRRA = 32762; // DOOR OPENER
  99. + private static final int KEGOR_EXIT = 49302; // EXIT
  100. +
  101. + // Skills
  102. + private static SkillHolder JINIA_PRAYER = new SkillHolder(6288, 1);
  103. + private static SkillHolder KEGOR_COURAGE = new SkillHolder(6289, 1);
  104. + private static SkillHolder ETERNAL_BLIZZARD1 = new SkillHolder(6274, 1);
  105. + private static SkillHolder ETERNAL_BLIZZARD2 = new SkillHolder(6275, 1);
  106. +
  107. + // Initialization at 6:30 am on Wednesday and Saturday
  108. + private static final int RESET_HOUR = 6;
  109. + private static final int RESET_MIN = 30;
  110. + private static final int RESET_DAY_1 = 4;
  111. + private static final int RESET_DAY_2 = 7;
  112. +
  113. + // Epic one with client animation
  114. + // private static SkillHolder ETERNAL_BLIZZARD3 = new SkillHolder(6276, 1);
  115. +
  116. + // Monsters
  117. + private static final int[] MOBS =
  118. + {
  119. + 29177,
  120. + 29178,
  121. + 29179,
  122. + 29180,
  123. + 18854,
  124. + 18855,
  125. + 18856,
  126. + 25699,
  127. + 25700
  128. + };
  129. +
  130. + // Enter/Exit
  131. + private static final int[] ENTER_TELEPORT =
  132. + {
  133. + 114185,
  134. + -112435,
  135. + -11210
  136. + };
  137. +
  138. + // Timers
  139. + private static final int TIMER_FIRST_MOVIE = 60000;
  140. + private static final int TIMER_GLAKIAS = 100000;
  141. + private static final int TIMER_BREATHS = 30000;
  142. + // Movies
  143. + private static final int MOVIE_START = 15;
  144. + private static final int MOVIE_SECOND = 16;
  145. + private static final int MOVIE_FREYA = 17;
  146. + private static final int MOVIE_KEGOR = 18;
  147. + private static final int MOVIE_DEATH = 19;
  148. + private static final int MOVIE_FINAL = 20;
  149. + private static final int MOVIE_GLAKIAS = 23;
  150. +
  151. + // Spawns
  152. + private static final Location[] MONUMENTS =
  153. + {
  154. + new Location(113845, -116091, -11168, 8264),
  155. + new Location(113381, -115622, -11168, 8264),
  156. + new Location(113380, -113978, -11168, -8224),
  157. + new Location(113845, -113518, -11168, -8224),
  158. + new Location(115591, -113516, -11168, -24504),
  159. + new Location(116053, -113981, -11168, -24504),
  160. + new Location(116061, -115611, -11168, 24804),
  161. + new Location(115597, -116080, -11168, 24804),
  162. + new Location(112942, -115480, -10960, 52),
  163. + new Location(112940, -115146, -10960, 52),
  164. + new Location(112945, -114453, -10960, 52),
  165. + new Location(112945, -114123, -10960, 52),
  166. + new Location(116497, -114117, -10960, 32724),
  167. + new Location(116499, -114454, -10960, 32724),
  168. + new Location(116501, -115145, -10960, 32724),
  169. + new Location(116502, -115473, -10960, 32724)
  170. + };
  171. +
  172. + private static final Location[] SPAWNS =
  173. + {
  174. + new Location(114713, -115109, -11202, 16456),
  175. + new Location(114008, -115080, -11202, 3568),
  176. + new Location(114422, -115508, -11202, 12400),
  177. + new Location(115023, -115508, -11202, 20016),
  178. + new Location(115459, -115079, -11202, 27936)
  179. + };
  180. +
  181. +
  182. + protected class FreyaWorld extends InstanceWorld
  183. + {
  184. + public Lock lock = new ReentrantLock();
  185. + public List<L2PcInstance> PlayersInInstance = new FastList<>();
  186. + public boolean showed = false;
  187. + public boolean screen_message = false;
  188. + public boolean screen_message2 = false;
  189. + public boolean screen_message3 = false;
  190. + public boolean started = false;
  191. + public boolean opened = false;
  192. + int id_freya_first;
  193. + int id_freya_second;
  194. + int id_freya_last;
  195. + int id_glakias;
  196. + int id_ice_knight;
  197. + int id_arch_breath;
  198. + int id_kegor;
  199. + int id_jinia;
  200. + FastList<L2Npc> allmobs = null;
  201. + FastList<L2Npc> monuments = null;
  202. + L2Npc freya;
  203. + L2Npc kegor;
  204. + L2Npc jinia;
  205. + L2Npc kegor_exit;
  206. + L2Npc freya_exit;
  207. +
  208. + public FreyaWorld()
  209. + {
  210. + allmobs = new FastList<>();
  211. + monuments = new FastList<>();
  212. + id_freya_first = 0;
  213. + id_freya_second = 0;
  214. + id_freya_last = 0;
  215. + id_glakias = 0;
  216. + id_ice_knight = 0;
  217. + id_arch_breath = 0;
  218. + id_kegor = 0;
  219. + id_jinia = 0;
  220. + }
  221. + }
  222. +
  223. + public FreyaInstance(int questId, String name, String descr)
  224. + {
  225. + super(questId, name, descr);
  226. +
  227. + addEnterZoneId(ZONE);
  228. + addStartNpc(JINIA);
  229. + addTalkId(JINIA);
  230. + addTalkId(SIRRA);
  231. + addStartNpc(KEGOR_EXIT);
  232. + addFirstTalkId(KEGOR_EXIT);
  233. + addTalkId(KEGOR_EXIT);
  234. +
  235. + for (int mob : MOBS)
  236. + {
  237. + addAttackId(mob);
  238. + addKillId(mob);
  239. + addSpawnId(mob);
  240. + }
  241. + }
  242. +
  243. + private void setupIDs(FreyaWorld world, int template_id)
  244. + {
  245. + {
  246. + world.id_freya_first = 29177;
  247. + world.id_freya_second = 29178;
  248. + world.id_freya_last = 29179;
  249. + world.id_glakias = 25699;
  250. + world.id_ice_knight = 18855;
  251. + world.id_arch_breath = 18854;
  252. + world.id_kegor = 18851;
  253. + world.id_jinia = 18850;
  254. + }
  255. + }
  256. +
  257. + @Override
  258. + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  259. + {
  260. +
  261. + if (DEBUG)
  262. + _log.info(getName() + "onAdvEvent=" + event);
  263. +
  264. + InstanceWorld wrld = null;
  265. + if (npc != null)
  266. + wrld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  267. + else if (player != null)
  268. + wrld = InstanceManager.getInstance().getPlayerWorld(player);
  269. + else
  270. + {
  271. + _log.warning("Freya Instance: onAdvEvent : Unable to get world.");
  272. + return null;
  273. + }
  274. + if (wrld != null && wrld instanceof FreyaWorld)
  275. + {
  276. + FreyaWorld world = (FreyaWorld) wrld;
  277. +
  278. + switch (event)
  279. + {
  280. + case "start_freya":
  281. + {
  282. + if (DEBUG)
  283. + _log.info("Freya Instance: Starting timer for stage 1 movie!");
  284. + if (world.getStatus() == 0)
  285. + {
  286. + // Set status
  287. + world.setStatus(1);
  288. + // Schedule Movie
  289. + startQuestTimer("stage_1_movie", TIMER_FIRST_MOVIE, npc, null);
  290. + /**
  291. + * If you are using GMChar to test, you can skip parts here and schedule some next timer not stage_1_movie
  292. + * startQuestTimer("stage_3_begin", TIMER_FIRST_MOVIE, npc, null);
  293. + */
  294. + }
  295. + break;
  296. + }
  297. + case "open_doors":
  298. + {
  299. + if (DEBUG)
  300. + _log.info("Freya instance: Opening doors!");
  301. + // Open Door
  302. + if (!world.opened)
  303. + InstanceManager.getInstance().getInstance(INSTANCEID).getDoor(HALL_DOORS).openMe();
  304. + world.opened = true;
  305. + break;
  306. + }
  307. + case "knight_pillar":
  308. + {
  309. + if (npc != null)
  310. + {
  311. + npc.setDisplayEffect(1);
  312. + }
  313. + break;
  314. + }
  315. + case "random_first_attack":
  316. + {
  317. + if (npc != null)
  318. + {
  319. + if (!world.monuments.isEmpty())
  320. + {
  321. + if (world.getStatus() < 6 && world.monuments.contains(npc))
  322. + return null;
  323. + if (world.getStatus() == 6 && world.monuments.contains(npc))
  324. + npc.setDisplayEffect(2);
  325. +
  326. + for (int objId : world.getAllowed())
  327. + {
  328. + L2PcInstance victim = L2World.getInstance().getPlayer(objId);
  329. + if (victim != null && victim.isOnline() && victim.getInstanceId() == world.getInstanceId() && (!(victim.isDead() || victim.isGM() || victim.isInvul() || victim.getAppearance().getInvisible())) && !npc.isDead() && !npc.isImmobilized() && npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ACTIVE)
  330. + {
  331. + ((L2Attackable) npc).addDamageHate(victim, 0, 99);
  332. + npc.setIsRunning(true);
  333. + npc.setTarget(victim);
  334. + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, victim, null);
  335. + }
  336. + startQuestTimer("random_first_attack", Rnd.get(1000, 2000), npc, null);
  337. + }
  338. + }
  339. + else
  340. + {
  341. + // Monuments are always in battle time
  342. + // If world.monuments is empty just delete npc, should not be happend
  343. + if (npc.getNpcId() == world.id_glakias || npc.getNpcId() == world.id_arch_breath)
  344. + npc.deleteMe();
  345. + }
  346. + break;
  347. + }
  348. + }
  349. + case "stage_1_movie":
  350. + {
  351. + // Stop players before movie
  352. + stopPc(world);
  353. + // Show movie
  354. + showMovie(world, MOVIE_START);
  355. + // Close Door
  356. + InstanceManager.getInstance().getInstance(world.getInstanceId()).getDoor(HALL_DOORS).closeMe();
  357. + startQuestTimer("stage_1_begin", 53500 + 1000, npc, null);
  358. + break;
  359. + }
  360. + case "stage_1_begin":
  361. + {
  362. + world.setStatus(2);
  363. + spawnMonuments(world);
  364. + // Spawn boos
  365. + world.freya = addSpawn(world.id_freya_first, 114720, -117085, -11088, 15956, false, 0, true, world.getInstanceId());
  366. + // Begin stage 1
  367. + ExShowScreenMessage message1 = new ExShowScreenMessage(NpcStringId.BEGIN_STAGE_1, 2, 7000);
  368. + sendScreenMessage(world, message1);
  369. + // Move freya
  370. + startQuestTimer("freya_move", 2000, world.freya, null, false);
  371. + // start ai for cast skill
  372. + startQuestTimer("cast_skill", 15000, world.freya, null, false);
  373. + break;
  374. + }
  375. + case "freya_move":
  376. + {
  377. + ExShowScreenMessage message2 = new ExShowScreenMessage(NpcStringId.FREYA_HAS_STARTED_TO_MOVE, 2, 5000);
  378. + sendScreenMessage(world, message2);
  379. + // Initialize movement
  380. + world.freya.setIsRunning(true);
  381. + world.freya.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(114717, -114973, -11200, 0));
  382. + world.freya.getSpawn().setLocx(114717);
  383. + world.freya.getSpawn().setLocy(-114973);
  384. + world.freya.getSpawn().setLocz(-11200);
  385. + // Spawn Knights
  386. + spawnMobs(world, world.id_ice_knight);
  387. + break;
  388. + }
  389. + case "cast_skill":
  390. + {
  391. + ExShowScreenMessage message3 = new ExShowScreenMessage(NpcStringId.STRONG_MAGIC_POWER_CAN_BE_FELT_FROM_SOMEWHERE, 2, 4000);
  392. + sendScreenMessage(world, message3);
  393. + world.freya.doCast(ETERNAL_BLIZZARD1.getSkill());
  394. + startQuestTimer("cast_skill", 60000, world.freya, null, false);
  395. + break;
  396. + }
  397. + case "cast_skill_3stage":
  398. + {
  399. + ExShowScreenMessage message4 = new ExShowScreenMessage(NpcStringId.STRONG_MAGIC_POWER_CAN_BE_FELT_FROM_SOMEWHERE, 2, 4000);
  400. + sendScreenMessage(world, message4);
  401. + world.freya.doCast(ETERNAL_BLIZZARD2.getSkill());
  402. + // Here you can setup Eternal Blizzard with client animation!
  403. + // world.freya.doCast(ETERNAL_BLIZZARD3.getSkill());
  404. + startQuestTimer("cast_skill_3stage", 60000, world.freya, null, false);
  405. + break;
  406. + }
  407. + case "stage_1_final_movie":
  408. + {
  409. + cancelQuestTimer("cast_skill", npc, null);
  410. + // Delete freya
  411. + world.freya.deleteMe();
  412. + // Despawn mobs
  413. + despawnAll(world);
  414. + // Stop players before movie
  415. + stopPc(world);
  416. + // Show movie
  417. + showMovie(world, MOVIE_SECOND);
  418. + startQuestTimer("stage_1_pause", 21100 + 1000, npc, null);
  419. + break;
  420. + }
  421. + case "stage_1_pause":
  422. + {
  423. + // Spawn boss upstairs
  424. + L2Npc freya = addSpawn(world.id_freya_second, 114723, -117502, -10672, 15956, false, 0, true, world.getInstanceId());
  425. + freya.setIsImmobilized(true);
  426. + freya.setIsInvul(true);
  427. + freya.disableCoreAI(true);
  428. + freya.disableAllSkills();
  429. + world.freya = freya;
  430. + // Set world status
  431. + world.setStatus(4);
  432. + // Despawn monuments
  433. + despawnMonuments(world);
  434. + // 1 min pause for rebuff
  435. + showTimer(world, false);
  436. + // Start Stage 2
  437. + startQuestTimer("stage_2_begin", 60000, npc, null);
  438. + break;
  439. + }
  440. + case "stage_2_begin":
  441. + {
  442. + // Set world status
  443. + world.setStatus(5);
  444. + // Begin stage 2
  445. + ExShowScreenMessage message5 = new ExShowScreenMessage(NpcStringId.BEGIN_STAGE_2, 2, 7000);
  446. + sendScreenMessage(world, message5);
  447. + // Spawn monuments
  448. + spawnMonuments(world);
  449. + // Spawn Knights
  450. + spawnMobs(world, world.id_ice_knight);
  451. + // 4 min to Glakias spawn
  452. + startQuestTimer("stage_2_glakias_movie", TIMER_GLAKIAS, npc, null);
  453. + // 2 min to Breaths spawn
  454. + startQuestTimer("stage_2_breaths", TIMER_BREATHS, npc, null);
  455. + break;
  456. + }
  457. + case "stage_2_breaths":
  458. + {
  459. + // Disable new spawns for knights
  460. + for (L2Npc knight : world.allmobs)
  461. + knight.getSpawn().stopRespawn();
  462. + // Spawn Breaths
  463. + spawnMobs(world, world.id_arch_breath);
  464. + break;
  465. + }
  466. + case "stage_2_glakias_movie":
  467. + {
  468. + showMovie(world, MOVIE_GLAKIAS);
  469. + startQuestTimer("stage_2_glakias_spawn", 7000 + 1000, npc, null);
  470. + break;
  471. + }
  472. + case "stage_2_glakias_spawn":
  473. + {
  474. + addSpawn(world.id_glakias, 114707, -114799, -11199, 15956, false, 0, true, world.getInstanceId());
  475. + break;
  476. + }
  477. + case "stage_2_pause":
  478. + {
  479. + // Despawn mobs
  480. + despawnAll(world);
  481. + // Despawn monuments
  482. + despawnMonuments(world);
  483. + // 1 min pause for rebuff
  484. + showTimer(world, false);
  485. + // Start Stage 3
  486. + startQuestTimer("stage_3_movie", 60000, npc, null);
  487. + break;
  488. + }
  489. + case "stage_3_movie":
  490. + {
  491. + // Delete freya
  492. + world.freya.deleteMe();
  493. + // Show movie
  494. + showMovie(world, MOVIE_FREYA);
  495. + // Begin Stage 3
  496. + startQuestTimer("stage_3_begin", 21500 + 1000, npc, null);
  497. + break;
  498. + }
  499. + case "stage_3_begin":
  500. + {
  501. + // TODO: Here must be done room animation!
  502. + // Spawn monuments
  503. + spawnMonuments(world);
  504. + // Spawn Freya
  505. + world.freya = addSpawn(world.id_freya_last, 114720, -117085, -11088, 15956, false, 0, true, world.getInstanceId());
  506. + // Begin stage 2
  507. + ExShowScreenMessage message6 = new ExShowScreenMessage(NpcStringId.BEGIN_STAGE_3, 2, 7000);
  508. + sendScreenMessage(world, message6);
  509. + // Spawn Knights
  510. + spawnMobs(world, world.id_arch_breath);
  511. + // Add monument timers
  512. + startQuestTimer("stage_3_monuments", 60000, npc, null);
  513. + // start ai for cast skill
  514. + startQuestTimer("cast_skill_3stage", 15000, world.freya, null, false);
  515. + break;
  516. + }
  517. + case "stage_3_monuments":
  518. + {
  519. + // Set status
  520. + world.setStatus(6);
  521. + // Monuments start move
  522. + for (L2Npc monument : world.monuments)
  523. + {
  524. + monument.getSpawn().stopRespawn();
  525. + monument.setIsImmobilized(false);
  526. + monument.setIsInvul(false);
  527. + monument.enableAllSkills();
  528. + monument.disableCoreAI(false);
  529. + startQuestTimer("random_first_attack", Rnd.get(1000, 10000), monument, null);
  530. + }
  531. + break;
  532. + }
  533. + case "finish_world":
  534. + {
  535. + cancelQuestTimer("player_buff", npc, null);
  536. + cancelQuestTimer("cast_skill_3stage", npc, null);
  537. + cancelQuestTimer("check_for_enemies", npc, null);
  538. + // Despawn mobs
  539. + despawnAll(world);
  540. + // Despawn monuments
  541. + despawnMonuments(world);
  542. + // Begin Movie 2
  543. + startQuestTimer("finish_world2", 100, npc, null);
  544. + break;
  545. + }
  546. + case "buff_support":
  547. + {
  548. + startWorld(world);
  549. + startQuestTimer("cast_skill_3stage", 15000, npc, null);
  550. + ExShowScreenMessage message7 = new ExShowScreenMessage(NpcStringId.BEGIN_STAGE_4, 2, 7000);
  551. + sendScreenMessage(world, message7);
  552. + world.kegor = addSpawn(world.id_kegor, 114659, -114796, -11205, 0, false, 0, true, world.getInstanceId());
  553. + world.jinia = addSpawn(world.id_jinia, 114751, -114781, -11205, 0, false, 0, true, world.getInstanceId());
  554. + world.kegor.setIsInvul(true);
  555. + world.kegor.setIsRunning(true);
  556. + world.jinia.setIsInvul(true);
  557. + world.jinia.setIsRunning(true);
  558. + startQuestTimer("player_buff", 3000, npc, null);
  559. + startQuestTimer("check_for_enemies", 5000, npc, null);
  560. + break;
  561. + }
  562. + case "player_buff":
  563. + {
  564. + world.kegor.doCast(KEGOR_COURAGE.getSkill());
  565. + world.jinia.doCast(JINIA_PRAYER.getSkill());
  566. + startQuestTimer("player_buff", 30000, npc, null);
  567. + break;
  568. + }
  569. + case "finish_world2":
  570. + {
  571. + world.kegor.deleteMe();
  572. + world.jinia.deleteMe();
  573. + despawnAll(world);
  574. + // Show movie 2
  575. + showMovie(world, MOVIE_DEATH);
  576. + // Spawn exit NPC + Freya (dying)
  577. + startQuestTimer("spawn_exit", 500, npc, null);
  578. + // Set 5 min time
  579. + Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
  580. + if (inst != null)
  581. + inst.setDuration(300000);
  582. + break;
  583. + }
  584. + case "finish_world3":
  585. + {
  586. + // Show movie 3
  587. + showMovie(world, MOVIE_FINAL);
  588. + questSupport2(npc, player);
  589. + world.kegor_exit.deleteMe();
  590. + world.freya_exit.deleteMe();
  591. + break;
  592. + }
  593. + case "spawn_exit":
  594. + {
  595. + world.kegor_exit = addSpawn(KEGOR_EXIT, 114659, -114796, -11205, 0, false, 0, true, world.getInstanceId());
  596. + world.freya_exit = addSpawn(world.id_freya_last, 114785, -114789, -11206, 0, false, 0, true, world.getInstanceId());
  597. + world.freya_exit.setIsImmobilized(true);
  598. + world.freya_exit.setIsInvul(true);
  599. + world.freya_exit.doDie(world.freya_exit);
  600. + DecayTaskManager.getInstance().cancelDecayTask(world.freya_exit);
  601. + world.freya_exit.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  602. + world.freya_exit.disableCoreAI(true);
  603. + world.freya_exit.disableAllSkills();
  604. + break;
  605. + }
  606. + case "check_for_enemies":
  607. + {
  608. + ((L2GuardInstance) world.kegor).addDamageHate(world.freya, 0, 10000);
  609. + ((L2GuardInstance) world.kegor).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, world.freya, null);
  610. + ((L2GuardInstance) world.jinia).addDamageHate(world.freya, 0, 10000);
  611. + ((L2GuardInstance) world.jinia).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, world.freya, null);
  612. + startQuestTimer("check_for_enemies", 15000, npc, null);
  613. + break;
  614. + }
  615. + }
  616. + }
  617. + return null;
  618. + }
  619. +
  620. +
  621. + @Override
  622. + public String onFirstTalk(L2Npc npc, L2PcInstance player)
  623. + {
  624. + int npcid = npc.getNpcId();
  625. +
  626. + if (npcid == KEGOR_EXIT)
  627. + {
  628. + return "kegor.htm";
  629. + }
  630. + return null;
  631. + }
  632. +
  633. + @Override
  634. + public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  635. + {
  636. + if (DEBUG)
  637. + _log.info("onKill [" + npc.getNpcId() + "]" + npc.getName());
  638. +
  639. + InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  640. + if (tmpworld instanceof FreyaWorld)
  641. + {
  642. + FreyaWorld world = (FreyaWorld) tmpworld;
  643. + // Delete corpse, because doesn't look good
  644. + npc.deleteMe();
  645. +
  646. + if (npc.getNpcId() == world.id_ice_knight)
  647. + {
  648. + // Start timer to change effectId
  649. + startQuestTimer("knight_pillar", 5000, npc, null);
  650. + }
  651. + else if (npc.getNpcId() == world.id_glakias)
  652. + {
  653. + // Run Pause before stage 3
  654. + startQuestTimer("stage_2_pause", 500, npc, null);
  655. + showTimer(world, false);
  656. + }
  657. + else if (npc.getNpcId() == world.id_freya_last)
  658. + {
  659. + // Finish Instance
  660. + startQuestTimer("finish_world", 500, npc, null);
  661. + for (L2PcInstance p : world.PlayersInInstance)
  662. + {
  663. + if (p != null)
  664. + {
  665. + setInstanceTimeRestrictions(world);
  666. + if (DEBUG)
  667. + _log.info("Save reenter for " + p.getName() + ".");
  668. + }
  669. + }
  670. + }
  671. + else if ((npc.getNpcId() == 29179 || npc.getNpcId() == 29180) && killer.isInParty())
  672. + {
  673. +
  674. + if (killer.getParty().getCommandChannel() != null)
  675. + {
  676. + for (L2PcInstance ccm : killer.getParty().getCommandChannel().getMembers())
  677. + {
  678. + questSupport(npc, ccm);
  679. + }
  680. + }
  681. + }
  682. + }
  683. + return super.onKill(npc, killer, isPet);
  684. + }
  685. +
  686. + private void questSupport(L2Npc npc, L2PcInstance player)
  687. + {
  688. + if (player.isInsideRadius(npc, 2000, false, false))
  689. + {
  690. + final int _fragment = 21723;
  691. + final QuestState st = player.getQuestState("Q10502_FreyaEmbroideredSoulCloak");
  692. + if (st != null && st.getState() == State.STARTED && st.getInt("cond") == 1)
  693. + {
  694. + if (player.getQuestState("Q10502_FreyaEmbroideredSoulCloak").getQuestItemsCount(_fragment) < 19)
  695. + {
  696. + player.getQuestState("Q10502_FreyaEmbroideredSoulCloak").giveItems(_fragment, Rnd.get(1, 2));
  697. + st.playSound("ItemSound.quest_middle");
  698. + }
  699. + else
  700. + {
  701. + player.getQuestState("Q10502_FreyaEmbroideredSoulCloak").giveItems(_fragment, 1);
  702. + }
  703. + if (player.getQuestState("Q10502_FreyaEmbroideredSoulCloak").getQuestItemsCount(_fragment) >= 20)
  704. + {
  705. + player.getQuestState("Q10502_FreyaEmbroideredSoulCloak").set("cond", "2");
  706. + }
  707. + }
  708. + }
  709. + }
  710. +
  711. +
  712. + protected void setInstanceTimeRestrictions(FreyaWorld world)
  713. + {
  714. + Calendar reenter = Calendar.getInstance();
  715. + reenter.set(Calendar.MINUTE, RESET_MIN);
  716. + reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
  717. + // if time is >= RESET_HOUR - roll to the next day
  718. + if (reenter.getTimeInMillis() <= System.currentTimeMillis())
  719. + {
  720. + reenter.add(Calendar.DAY_OF_MONTH, 1);
  721. + }
  722. + if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
  723. + {
  724. + while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
  725. + {
  726. + reenter.add(Calendar.DAY_OF_MONTH, 1);
  727. + }
  728. + }
  729. + else
  730. + {
  731. + while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
  732. + {
  733. + reenter.add(Calendar.DAY_OF_MONTH, 1);
  734. + }
  735. + }
  736. +
  737. + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
  738. + sm.addInstanceName(INSTANCEID);
  739. +
  740. + // set instance reenter time for all allowed players
  741. + for (int objectId : world.getAllowed())
  742. + {
  743. + L2PcInstance player = L2World.getInstance().getPlayer(objectId);
  744. + InstanceManager.getInstance().setInstanceTime(objectId, INSTANCEID, reenter.getTimeInMillis());
  745. + if ((player != null) && player.isOnline())
  746. + {
  747. + player.sendPacket(sm);
  748. + }
  749. + }
  750. + }
  751. +
  752. + @Override
  753. + public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
  754. + {
  755. + if (npc == null || attacker == null)
  756. + return null;
  757. +
  758. + final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
  759. + if (tmpWorld instanceof FreyaWorld)
  760. + {
  761. + final FreyaWorld world = (FreyaWorld) tmpWorld;
  762. + // First freya
  763. + if (world.getStatus() == 2 && npc.getNpcId() == world.id_freya_first)
  764. + {
  765. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.1))
  766. + {
  767. + if (world.lock.tryLock())
  768. + {
  769. + try
  770. + {
  771. + world.setStatus(3);
  772. + startQuestTimer("stage_1_final_movie", 1000, npc, attacker);
  773. + }
  774. + finally
  775. + {
  776. + world.lock.unlock();
  777. + }
  778. + }
  779. + }
  780. + }
  781. + else if (npc.getNpcId() == world.id_ice_knight && npc.getDisplayEffect() == 1)
  782. + {
  783. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.3))
  784. + npc.setDisplayEffect(2);
  785. + }
  786. + else if (npc.getNpcId() == world.id_freya_last)
  787. + {
  788. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25) && !world.showed)
  789. + {
  790. + world.showed = true;
  791. + stopWorld(world);
  792. + // Show Movie 4
  793. + showMovie(world, MOVIE_KEGOR);
  794. + startQuestTimer("buff_support", 27000 + 200, npc, null);
  795. + cancelQuestTimer("cast_skill_3stage", npc, null);
  796. + }
  797. + }
  798. + else if (npc.getNpcId() == world.id_glakias)
  799. + {
  800. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.2) && !world.screen_message)
  801. + {
  802. + world.screen_message = true;
  803. + npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getNpcId(), NpcStringId.I_CAN_TAKE_IT_NO_LONGER));
  804. + }
  805. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.4) && !world.screen_message)
  806. + {
  807. + world.screen_message = true;
  808. + npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getNpcId(), NpcStringId.ARCHER_HEED_MY_CALL));
  809. + }
  810. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.6) && !world.screen_message2)
  811. + {
  812. + world.screen_message2 = true;
  813. + ExShowScreenMessage message8 = new ExShowScreenMessage(NpcStringId.THE_SPACE_FEELS_LIKE_ITS_GRADUALLY_STARTING_TO_SHAKE, 2, 7000);
  814. + sendScreenMessage(world, message8);
  815. + npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getNpcId(), NpcStringId.MY_KNIGHTS_SHOW_YOUR_LOYALTY));
  816. + }
  817. + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.8) && !world.screen_message3)
  818. + {
  819. + world.screen_message3 = true;
  820. + npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getNpcId(), NpcStringId.ARCHER_GIVE_YOUR_BREATH_FOR_THE_INTRUDER));
  821. + }
  822. + }
  823. + }
  824. + return super.onAttack(npc, attacker, damage, isPet);
  825. + }
  826. +
  827. + private void startWorld(FreyaWorld world)
  828. + {
  829. + Instance instance = InstanceManager.getInstance().getInstance(world.getInstanceId());
  830. + for (L2Npc npc : instance.getNpcs())
  831. + {
  832. + if (npc != null)
  833. + {
  834. + npc.setIsImmobilized(false);
  835. + npc.setIsInvul(false);
  836. + npc.disableCoreAI(false);
  837. + npc.enableAllSkills();
  838. + }
  839. + }
  840. + }
  841. +
  842. + private void stopWorld(FreyaWorld world)
  843. + {
  844. + Instance instance = InstanceManager.getInstance().getInstance(world.getInstanceId());
  845. + for (L2Npc npc : instance.getNpcs())
  846. + {
  847. + if (npc != null)
  848. + {
  849. + npc.abortAttack();
  850. + npc.abortCast();
  851. + npc.setTarget(null);
  852. + npc.stopMove(null);
  853. + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  854. + npc.setIsImmobilized(true);
  855. + npc.setIsInvul(true);
  856. + npc.disableCoreAI(true);
  857. + npc.disableAllSkills();
  858. + }
  859. + }
  860. + }
  861. +
  862. + private void questSupport2(L2Npc npc, L2PcInstance player)
  863. + {
  864. + if (player.isInsideRadius(npc, 2000, false, false))
  865. + {
  866. + final QuestState st = player.getQuestState("Q10286_ReunionWithSirra");
  867. + if (st != null && st.getState() == State.STARTED && st.getInt("cond") == 6)
  868. + {
  869. + st.playSound("ItemSound.quest_middle");
  870. + player.getQuestState("Q10286_ReunionWithSirra").set("cond", "7");
  871. + }
  872. + }
  873. + }
  874. +
  875. + private void setupPlayer(FreyaWorld world, L2PcInstance player, int template_id)
  876. + {
  877. + // Remove buffs from player
  878. + player.stopAllEffectsExceptThoseThatLastThroughDeath();
  879. + // Add player to allowed list
  880. + world.PlayersInInstance.add(player);
  881. + if (player.getQuestState("Q10286_ReunionWithSirra") != null && player.getQuestState("Q10286_ReunionWithSirra").getState() == State.STARTED && player.getQuestState("Q10286_ReunionWithSirra").getInt("cond") == 5)
  882. + {
  883. + player.getQuestState("Q10286_ReunionWithSirra").set("cond", "6");
  884. + }
  885. + }
  886. +
  887. + private void showMovie(FreyaWorld world, int movie)
  888. + {
  889. + for (int objId : world.getAllowed())
  890. + {
  891. + L2PcInstance player = L2World.getInstance().getPlayer(objId);
  892. + if (player != null && player.isOnline() && player.getInstanceId() == world.getInstanceId())
  893. + player.showQuestMovie(movie);
  894. + }
  895. + }
  896. +
  897. + private void showTimer(FreyaWorld world, boolean hide)
  898. + {
  899. + for (int objId : world.getAllowed())
  900. + {
  901. + L2PcInstance player = L2World.getInstance().getPlayer(objId);
  902. + if (player != null && player.isOnline() && player.getInstanceId() == world.getInstanceId())
  903. + // TODO: Rework it for NpcStringId.TIME_REMAINING_UNTIL_NEXT_BATTLE
  904. + player.sendPacket(new ExSendUIEvent(player, hide, false, 60, 0, "Time remaining until next battle"));
  905. + }
  906. + }
  907. +
  908. + private void sendScreenMessage(FreyaWorld world, ExShowScreenMessage message)
  909. + {
  910. + for (int objId : world.getAllowed())
  911. + {
  912. + L2PcInstance player = L2World.getInstance().getPlayer(objId);
  913. + if (player != null)
  914. + player.sendPacket(message);
  915. + }
  916. + }
  917. +
  918. + private void stopPc(FreyaWorld world)
  919. + {
  920. + for (int objId : world.getAllowed())
  921. + {
  922. + L2PcInstance player = L2World.getInstance().getPlayer(objId);
  923. + if (player != null && player.isOnline() && player.getInstanceId() == world.getInstanceId())
  924. + {
  925. + player.abortAttack();
  926. + player.abortCast();
  927. + player.setTarget(null);
  928. + player.stopMove(null);
  929. + player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  930. + }
  931. + }
  932. + }
  933. +
  934. + private void despawnAll(FreyaWorld world)
  935. + {
  936. + for (L2Npc npc : world.allmobs)
  937. + {
  938. + npc.getSpawn().stopRespawn();
  939. + npc.deleteMe();
  940. + }
  941. +
  942. + world.allmobs.clear();
  943. + }
  944. +
  945. + private void spawnMonuments(FreyaWorld world)
  946. + {
  947. + if (DEBUG)
  948. + _log.info("spawnMonuments");
  949. +
  950. + for (Location loc : MONUMENTS)
  951. + {
  952. + L2Npc npc = addSpawn(world.id_ice_knight, loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), false, 0, true, world.getInstanceId());
  953. + world.monuments.add(npc);
  954. + npc.disableCoreAI(true);
  955. + npc.setIsImmobilized(true);
  956. + npc.setIsInvul(true);
  957. + npc.disableAllSkills();
  958. + npc.setDisplayEffect(1);
  959. + npc.setEnchant(1);
  960. + L2Spawn spawn = npc.getSpawn();
  961. + spawn.getLastSpawn().setSpawn(spawn);
  962. + spawn.setRespawnDelay(20);
  963. + spawn.setAmount(1);
  964. + spawn.startRespawn();
  965. + }
  966. + }
  967. +
  968. + private void despawnMonuments(FreyaWorld world)
  969. + {
  970. + for (L2Npc npc : world.monuments)
  971. + {
  972. + npc.setDisplayEffect(2);
  973. + npc.getSpawn().stopRespawn();
  974. + npc.doDie(npc);
  975. + }
  976. + world.monuments.clear();
  977. + }
  978. +
  979. + private void spawnMobs(FreyaWorld world, int mobId)
  980. + {
  981. + if (DEBUG)
  982. + {
  983. + _log.info("spawnMobs");
  984. + }
  985. +
  986. + for (Location loc : SPAWNS)
  987. + {
  988. + L2Npc npc = addSpawn(mobId, loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), false, 0, true, world.getInstanceId());
  989. + world.allmobs.add(npc);
  990. + npc.setDisplayEffect(1);
  991. + L2Spawn spawn = npc.getSpawn();
  992. + spawn.setRespawnDelay(20);
  993. + spawn.setAmount(1);
  994. + spawn.startRespawn();
  995. + }
  996. + }
  997. +
  998. + @Override
  999. + public String onTalk(L2Npc npc, L2PcInstance player)
  1000. + {
  1001. + int npcId = npc.getNpcId();
  1002. + QuestState st = player.getQuestState(getName());
  1003. + if (st == null)
  1004. + {
  1005. + st = newQuestState(player);
  1006. + }
  1007. + if (npcId == JINIA)
  1008. + {
  1009. + if (DEBUG)
  1010. + _log.info("Freya Instance: Teleporting player/s into Freya instance!");
  1011. + enterInstance(player, "Freya.xml", ENTER_TELEPORT);
  1012. + startQuestTimer("open_doors", 1500, npc, player);
  1013. + }
  1014. + return "";
  1015. + }
  1016. +
  1017. + private void teleportPlayer(L2PcInstance player, int[] coords, int instanceId)
  1018. + {
  1019. + player.setInstanceId(instanceId);
  1020. + player.teleToLocation(coords[0], coords[1], coords[2]);
  1021. + }
  1022. +
  1023. + protected int enterInstance(L2PcInstance player, String template, int[] coords)
  1024. + {
  1025. + int instanceId = 0;
  1026. + // check for existing instances for this player
  1027. + InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
  1028. + // existing instance
  1029. + if (world != null)
  1030. + {
  1031. + if (!(world instanceof FreyaWorld))
  1032. + {
  1033. + player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
  1034. + return 0;
  1035. + }
  1036. + teleportPlayer(player, coords, world.getInstanceId());
  1037. + return world.getInstanceId();
  1038. + }
  1039. +
  1040. + // New instance
  1041. + if (!checkConditions(player))
  1042. + {
  1043. + return 0;
  1044. + }
  1045. + instanceId = InstanceManager.getInstance().createDynamicInstance(template);
  1046. + world = new FreyaWorld();
  1047. + world.setInstanceId(instanceId);
  1048. + world.setStatus(0);
  1049. + InstanceManager.getInstance().addWorld(world);
  1050. + setupIDs((FreyaWorld) world, INSTANCEID);
  1051. + _log.info("Freya instance started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
  1052. + // Teleport players
  1053. + if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null))
  1054. + {
  1055. + setupPlayer((FreyaWorld) world, player, instanceId);
  1056. + world.addAllowed(player.getObjectId());
  1057. + teleportPlayer(player, coords, instanceId);
  1058. + }
  1059. + else
  1060. + {
  1061. + for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
  1062. + {
  1063. + setupPlayer((FreyaWorld) world, channelMember, instanceId);
  1064. + world.addAllowed(channelMember.getObjectId());
  1065. + teleportPlayer(channelMember, coords, instanceId);
  1066. + }
  1067. + }
  1068. + return instanceId;
  1069. + }
  1070. +
  1071. + private boolean checkConditions(L2PcInstance player)
  1072. + {
  1073. + if (DEBUG)
  1074. + {
  1075. + _log.info("Freya instance: Started wtih DEBUG mode on!");
  1076. + return true;
  1077. + }
  1078. + L2Party party = player.getParty();
  1079. + if (party == null)
  1080. + {
  1081. + player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER);
  1082. + return false;
  1083. + }
  1084. + L2CommandChannel channel = player.getParty().getCommandChannel();
  1085. + if (channel == null)
  1086. + {
  1087. + player.sendPacket(SystemMessageId.NOT_IN_COMMAND_CHANNEL_CANT_ENTER);
  1088. + return false;
  1089. + }
  1090. + else if (channel.getLeader() != player)
  1091. + {
  1092. + player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER);
  1093. + return false;
  1094. + }
  1095. + else if ((channel.getMemberCount() < MIN_PLAYERS) || (channel.getMemberCount() > MAX_PLAYERS))
  1096. + {
  1097. + player.sendPacket(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER);
  1098. + return false;
  1099. + }
  1100. + for (L2PcInstance channelMember : channel.getMembers())
  1101. + {
  1102. + if (channelMember.getLevel() < MIN_LEVEL)
  1103. + {
  1104. + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT);
  1105. + sm.addPcName(channelMember);
  1106. + party.broadcastPacket(sm);
  1107. + return false;
  1108. + }
  1109. + QuestState st = channelMember.getQuestState("Q10286_ReunionWithSirra");
  1110. + if (!(st != null && (st.getState() == State.COMPLETED || st.isCond(4))))
  1111. + {
  1112. + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT);
  1113. + sm.addPcName(channelMember);
  1114. + party.broadcastPacket(sm);
  1115. + return false;
  1116. + }
  1117. + if (!Util.checkIfInRange(1000, player, channelMember, true))
  1118. + {
  1119. + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED);
  1120. + sm.addPcName(channelMember);
  1121. + party.broadcastPacket(sm);
  1122. + return false;
  1123. + }
  1124. + Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), INSTANCEID);
  1125. + if (System.currentTimeMillis() < reentertime)
  1126. + {
  1127. + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET);
  1128. + sm.addPcName(channelMember);
  1129. + party.broadcastPacket(sm);
  1130. + return false;
  1131. + }
  1132. + }
  1133. + return true;
  1134. + }
  1135. +
  1136. + @Override
  1137. + public String onEnterZone(L2Character character, L2ZoneType zone)
  1138. + {
  1139. + final InstanceWorld tmpWorld = InstanceManager.getInstance().getWorld(zone.getInstanceId());
  1140. + if (tmpWorld instanceof FreyaWorld)
  1141. + {
  1142. + final FreyaWorld world = (FreyaWorld) tmpWorld;
  1143. +
  1144. + if (((character.isPlayer() && !world.started)))
  1145. + {
  1146. + if (DEBUG)
  1147. + _log.info("Freya Instance: Player entered zone. Starting timer start_freya!");
  1148. +
  1149. + world.started = true;
  1150. + startQuestTimer("start_freya", 5000, null, null);
  1151. + }
  1152. + }
  1153. + return null;
  1154. + }
  1155. +
  1156. + public static void main(String[] args)
  1157. + {
  1158. + new FreyaInstance(-1, FreyaInstance.class.getSimpleName(), "instances");
  1159. + }
  1160. +}
  1161. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment