Advertisement
horato

Frintezza.java

Aug 1st, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.45 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 ai.individual;
  16.  
  17. import java.util.Calendar;
  18. import java.util.List;
  19. import java.util.logging.Level;
  20. import java.util.logging.Logger;
  21.  
  22. import javolution.util.FastList;
  23. import ai.group_template.L2AttackableAIScript;
  24.  
  25. import com.l2jserver.gameserver.ai.CtrlIntention;
  26. import com.l2jserver.gameserver.datatables.SkillTable;
  27. import com.l2jserver.gameserver.instancemanager.GrandBossManager;
  28. import com.l2jserver.gameserver.instancemanager.InstanceManager;
  29. import com.l2jserver.gameserver.model.L2CommandChannel;
  30. import com.l2jserver.gameserver.model.L2Party;
  31. import com.l2jserver.gameserver.model.L2Skill;
  32. import com.l2jserver.gameserver.model.actor.L2Attackable;
  33. import com.l2jserver.gameserver.model.actor.L2Character;
  34. import com.l2jserver.gameserver.model.actor.L2Npc;
  35. import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
  36. import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
  37. import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
  38. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  39. import com.l2jserver.gameserver.model.quest.*;
  40. import com.l2jserver.gameserver.model.zone.type.L2BossZone;
  41. import com.l2jserver.gameserver.network.SystemMessageId;
  42. import com.l2jserver.gameserver.network.serverpackets.AbstractNpcInfo.NpcInfo;
  43. import com.l2jserver.gameserver.network.serverpackets.Earthquake;
  44. import com.l2jserver.gameserver.network.serverpackets.MagicSkillCanceld;
  45. import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
  46. import com.l2jserver.gameserver.network.serverpackets.NpcSay;
  47. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  48. import com.l2jserver.gameserver.network.serverpackets.SocialAction;
  49. import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
  50. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  51. import com.l2jserver.gameserver.skills.AbnormalEffect;
  52. import com.l2jserver.gameserver.util.Util;
  53. import com.l2jserver.util.Rnd;
  54.  
  55. /**
  56. * Frintezza AI
  57. *
  58. * @author Darki699
  59. * @author SANDMAN L2J_JP(modified)
  60. * @author JOJO
  61. *
  62. * Update by rocknow
  63. * Updated by L2jOff team
  64. * Updated to use instances by horato
  65. *
  66. * <BR>
  67. * Warn: be careful with adding new spawns {@link #getXFix(int)}
  68. *
  69. */
  70. public class Frintezza extends L2AttackableAIScript
  71. {
  72. private static final int[][] _invadeLoc =
  73. {
  74. { 174102, -76039, -5105 },
  75. { 173235, -76884, -5105 },
  76. { 175003, -76933, -5105 },
  77. { 174196, -76190, -5105 },
  78. { 174013, -76120, -5105 },
  79. { 173263, -75161, -5105 }
  80. };
  81.  
  82. private static final int[][] _skill =
  83. {
  84. { 5015, 1, 5000 },
  85. { 5015, 4, 5000 },
  86. { 5015, 2, 5000 },
  87. { 5015, 5, 5000 },
  88. { 5018, 1, 10000 },
  89. { 5016, 1, 5000 },
  90. { 5015, 3, 5000 },
  91. { 5015, 6, 5000 },
  92. { 5018, 2, 10000 },
  93. { 5019, 1, 10000 },
  94. { 5016, 1, 5000 }
  95. };
  96.  
  97. private static final int[][] _mobLoc =
  98. {
  99. { 18328,172894,-76019,-5107,243 },
  100. { 18328,174095,-77279,-5107,16216 },
  101. { 18328,174111,-74833,-5107,49043 },
  102. { 18328,175344,-76042,-5107,32847 },
  103. { 18330,173489,-76227,-5134,63565 },
  104. { 18330,173498,-75724,-5107,58498 },
  105. { 18330,174365,-76745,-5107,22424 },
  106. { 18330,174570,-75584,-5107,31968 },
  107. { 18330,174613,-76179,-5107,31471 },
  108. { 18332,173620,-75981,-5107,4588 },
  109. { 18332,173630,-76340,-5107,62454 },
  110. { 18332,173755,-75613,-5107,57892 },
  111. { 18332,173823,-76688,-5107,2411 },
  112. { 18332,174000,-75411,-5107,54718 },
  113. { 18332,174487,-75555,-5107,33861 },
  114. { 18332,174517,-76471,-5107,21893 },
  115. { 18332,174576,-76122,-5107,31176 },
  116. { 18332,174600,-75841,-5134,35927 },
  117. { 18329,173481,-76043,-5107,61312 },
  118. { 18329,173539,-75678,-5107,59524 },
  119. { 18329,173584,-76386,-5107,3041 },
  120. { 18329,173773,-75420,-5107,51115 },
  121. { 18329,173777,-76650,-5107,12588 },
  122. { 18329,174585,-76510,-5107,21704 },
  123. { 18329,174623,-75571,-5107,40141 },
  124. { 18329,174744,-76240,-5107,29202 },
  125. { 18329,174769,-75895,-5107,29572 },
  126. { 18333,173861,-76011,-5107,383 },
  127. { 18333,173872,-76461,-5107,8041 },
  128. { 18333,173898,-75668,-5107,51856 },
  129. { 18333,174422,-75689,-5107,42878 },
  130. { 18333,174460,-76355,-5107,27311 },
  131. { 18333,174483,-76041,-5107,30947 },
  132. { 18331,173515,-76184,-5107,6971 },
  133. { 18331,173516,-75790,-5134,3142 },
  134. { 18331,173696,-76675,-5107,6757 },
  135. { 18331,173766,-75502,-5134,60827 },
  136. { 18331,174473,-75321,-5107,37147 },
  137. { 18331,174493,-76505,-5107,34503 },
  138. { 18331,174568,-75654,-5134,41661 },
  139. { 18331,174584,-76263,-5107,31729 },
  140. { 18339,173892,-81592,-5123,50849 },
  141. { 18339,173958,-81820,-5123,7459 },
  142. { 18339,174128,-81805,-5150,21495 },
  143. { 18339,174245,-81566,-5123,41760 },
  144. { 18334,173264,-81529,-5072,1646 },
  145. { 18334,173265,-81656,-5072,441 },
  146. { 18334,173267,-81889,-5072,0 },
  147. { 18334,173271,-82015,-5072,65382 },
  148. { 18334,174867,-81655,-5073,32537 },
  149. { 18334,174868,-81890,-5073,32768 },
  150. { 18334,174869,-81485,-5073,32315 },
  151. { 18334,174871,-82017,-5073,33007 },
  152. { 18335,173074,-80817,-5107,8353 },
  153. { 18335,173128,-82702,-5107,5345 },
  154. { 18335,173181,-82544,-5107,65135 },
  155. { 18335,173191,-80981,-5107,6947 },
  156. { 18335,174859,-80889,-5134,24103 },
  157. { 18335,174924,-82666,-5107,38710 },
  158. { 18335,174947,-80733,-5107,22449 },
  159. { 18335,175096,-82724,-5107,42205 },
  160. { 18336,173435,-80512,-5107,65215 },
  161. { 18336,173440,-82948,-5107,417 },
  162. { 18336,173443,-83120,-5107,1094 },
  163. { 18336,173463,-83064,-5107,286 },
  164. { 18336,173465,-80453,-5107,174 },
  165. { 18336,173465,-83006,-5107,2604 },
  166. { 18336,173468,-82889,-5107,316 },
  167. { 18336,173469,-80570,-5107,65353 },
  168. { 18336,173469,-80628,-5107,166 },
  169. { 18336,173492,-83121,-5107,394 },
  170. { 18336,173493,-80683,-5107,0 },
  171. { 18336,173497,-80510,-5134,417 },
  172. { 18336,173499,-82947,-5107,0 },
  173. { 18336,173521,-83063,-5107,316 },
  174. { 18336,173523,-82889,-5107,128 },
  175. { 18336,173524,-80627,-5134,65027 },
  176. { 18336,173524,-83007,-5107,0 },
  177. { 18336,173526,-80452,-5107,64735 },
  178. { 18336,173527,-80569,-5134,65062 },
  179. { 18336,174602,-83122,-5107,33104 },
  180. { 18336,174604,-82949,-5107,33184 },
  181. { 18336,174609,-80514,-5107,33234 },
  182. { 18336,174609,-80684,-5107,32851 },
  183. { 18336,174629,-80627,-5107,33346 },
  184. { 18336,174632,-80570,-5107,32896 },
  185. { 18336,174632,-83066,-5107,32768 },
  186. { 18336,174635,-82893,-5107,33594 },
  187. { 18336,174636,-80456,-5107,32065 },
  188. { 18336,174639,-83008,-5107,33057 },
  189. { 18336,174660,-80512,-5107,33057 },
  190. { 18336,174661,-83121,-5107,32768 },
  191. { 18336,174663,-82948,-5107,32768 },
  192. { 18336,174664,-80685,-5107,32676 },
  193. { 18336,174687,-83008,-5107,32520 },
  194. { 18336,174691,-83066,-5107,32961 },
  195. { 18336,174692,-80455,-5107,33202 },
  196. { 18336,174692,-80571,-5107,32768 },
  197. { 18336,174693,-80630,-5107,32994 },
  198. { 18336,174693,-82889,-5107,32622 },
  199. { 18337,172837,-82382,-5107,58363 },
  200. { 18337,172867,-81123,-5107,64055 },
  201. { 18337,172883,-82495,-5107,64764 },
  202. { 18337,172916,-81033,-5107,7099 },
  203. { 18337,172940,-82325,-5107,58998 },
  204. { 18337,172946,-82435,-5107,58038 },
  205. { 18337,172971,-81198,-5107,14768 },
  206. { 18337,172992,-81091,-5107,9438 },
  207. { 18337,173032,-82365,-5107,59041 },
  208. { 18337,173064,-81125,-5107,5827 },
  209. { 18337,175014,-81173,-5107,26398 },
  210. { 18337,175061,-82374,-5107,43290 },
  211. { 18337,175096,-81080,-5107,24719 },
  212. { 18337,175169,-82453,-5107,37672 },
  213. { 18337,175172,-80972,-5107,32315 },
  214. { 18337,175174,-82328,-5107,41760 },
  215. { 18337,175197,-81157,-5107,27617 },
  216. { 18337,175245,-82547,-5107,40275 },
  217. { 18337,175249,-81075,-5107,28435 },
  218. { 18337,175292,-82432,-5107,42225 },
  219. { 18338,173014,-82628,-5107,11874 },
  220. { 18338,173033,-80920,-5107,10425 },
  221. { 18338,173095,-82520,-5107,49152 },
  222. { 18338,173115,-80986,-5107,9611 },
  223. { 18338,173144,-80894,-5107,5345 },
  224. { 18338,173147,-82602,-5107,51316 },
  225. { 18338,174912,-80825,-5107,24270 },
  226. { 18338,174935,-80899,-5107,18061 },
  227. { 18338,175016,-82697,-5107,39533 },
  228. { 18338,175041,-80834,-5107,25420 },
  229. { 18338,175071,-82549,-5107,39163 },
  230. { 18338,175154,-82619,-5107,36345 }
  231. };
  232.  
  233. private static final int SCARLET1 = 29046;
  234. private static final int SCARLET2 = 29047;
  235. private static final int FRINTEZZA = 29045;
  236. private static final int GUIDE = 32011;
  237. private static final int CUBE = 29061;
  238.  
  239. private static final int INSTANCEID = 136; // Taken from instancenames.xml, I have no idea if it is right but I hope so :}}
  240.  
  241. //Frintezza Status Tracking :
  242. private static final byte DORMANT = 0; //Frintezza is spawned and no one has entered yet. Entry is unlocked
  243. private static final byte WAITING = 1; //Frintezza is spawend and someone has entered, triggering a 30 minute window for additional people to enter
  244. //before he unleashes his attack. Entry is unlocked
  245. private static final byte FIGHTING = 2; //Frintezza is engaged in battle, annihilating his foes. Entry is locked
  246.  
  247. private static byte CurrentStatus = DORMANT;
  248.  
  249. private static long _LastAction = 0;
  250. private static int _Angle = 0;
  251. private static int _Heading = 0;
  252. private static int _LocCycle = 0;
  253. private static int _Bomber = 0;
  254. private static int _CheckDie = 0;
  255. private static int _OnCheck = 0;
  256. private static int _OnSong = 0;
  257. private static int _Abnormal = 0;
  258. private static int _OnMorph = 0;
  259. private static int _Scarlet_x = 0;
  260. private static int _Scarlet_y = 0;
  261. private static int _Scarlet_z = 0;
  262. private static int _Scarlet_h = 0;
  263. private static int _SecondMorph = 0;
  264. private static int _ThirdMorph = 0;
  265. private static int _KillHallAlarmDevice = 0;
  266. private static int _KillDarkChoirPlayer = 0;
  267. private static int _KillDarkChoirCaptain = 0;
  268.  
  269. private static QuestState st = null;
  270. private static L2BossZone _Zone;
  271. private L2GrandBossInstance frintezza, weakScarlet, strongScarlet, activeScarlet;
  272. private L2MonsterInstance demon1, demon2, demon3, demon4, portrait1, portrait2, portrait3, portrait4;
  273. private L2Npc _frintezzaDummy, _overheadDummy, _portraitDummy1, _portraitDummy3, _scarletDummy;
  274. private static List<L2PcInstance> _PlayersInside = new FastList<L2PcInstance>();
  275. private static List<L2Npc> _Room1Mobs = new FastList<L2Npc>();
  276. private static List<L2Npc> _Room2Mobs = new FastList<L2Npc>();
  277. private static List<L2Attackable> Minions = new FastList<L2Attackable>();
  278.  
  279. private static List<String> _TimerControl = new FastList<String>();
  280. // Initialization at 6:30 am on Wednesday and Saturday
  281. private static final int RESET_HOUR = 6;
  282. private static final int RESET_MIN = 30;
  283. private static final int RESET_DAY_1 = 4;
  284. private static final int RESET_DAY_2 = 7;
  285. private static int currentInstanceID = 0;
  286. private final static Logger _log = Logger.getLogger("FrintezzaInstance");
  287.  
  288. // Boss: Frintezza
  289. public Frintezza(int id, String name, String descr)
  290. {
  291. super(id,name,descr);
  292. int[] mob = {SCARLET1, SCARLET2, FRINTEZZA, 18328, 18329, 18330, 18331, 18332, 18333, 18334, 18335, 18336, 18337, 18338, 18339, 29048, 29049, 29050, 29051};
  293. _Zone = GrandBossManager.getInstance().getZone(getXFix(174232), getYFix(-88020), getZFix(-5116));
  294. registerMobs(mob);
  295. addStartNpc(GUIDE);
  296. addTalkId(GUIDE);
  297. addStartNpc(CUBE);
  298. addTalkId(CUBE);
  299.  
  300. /*
  301. //tempfix for messed door cords
  302. for (int i = 0; i < 8; i++)
  303. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130051 + i).setRange(0, 0, 0, 0, 0, 0);
  304. */
  305. }
  306.  
  307. @Override
  308. public String onAdvEvent (String event, L2Npc npc, L2PcInstance player)
  309. {
  310. long temp = 0;
  311. if (event.equalsIgnoreCase("waiting"))
  312. {
  313. startQuestTimer("close", 27000, npc, null);
  314. startQuestTimer("camera_1", 30000, npc, null);
  315. _Zone.broadcastPacket(new Earthquake(getXFix(174232), getYFix(-88020), getZFix(-5116), 45, 27));
  316. }
  317. else if (event.equalsIgnoreCase("room1_spawn"))
  318. {
  319. for (int i = 0; i <= 17; i++)
  320. {
  321. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  322. _Room1Mobs.add(mob);
  323. }
  324. }
  325. else if (event.equalsIgnoreCase("room1_spawn2"))
  326. {
  327. for (int i = 18; i <= 26; i++)
  328. {
  329. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  330. _Room1Mobs.add(mob);
  331. }
  332. }
  333. else if (event.equalsIgnoreCase("room1_spawn3"))
  334. {
  335. for (int i = 27; i <= 32; i++)
  336. {
  337. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  338. _Room1Mobs.add(mob);
  339. }
  340. }
  341. else if (event.equalsIgnoreCase("room1_spawn4"))
  342. {
  343. for (int i = 33; i <= 40; i++)
  344. {
  345. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  346. _Room1Mobs.add(mob);
  347. }
  348. }
  349. else if (event.equalsIgnoreCase("room2_spawn"))
  350. {
  351. for (int i = 41; i <= 44; i++)
  352. {
  353. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  354. _Room2Mobs.add(mob);
  355. }
  356. }
  357. else if (event.equalsIgnoreCase("room2_spawn2"))
  358. {
  359. for (int i = 45; i <= 131; i++)
  360. {
  361. L2Npc mob = addSpawn(_mobLoc[i][0],_mobLoc[i][1],_mobLoc[i][2],_mobLoc[i][3],_mobLoc[i][4],false,0);
  362. _Room2Mobs.add(mob);
  363. }
  364. }
  365. else if (event.equalsIgnoreCase("room1_del"))
  366. {
  367. for (L2Npc mob : _Room1Mobs)
  368. {
  369. if (mob != null)
  370. mob.deleteMe();
  371. }
  372. _Room1Mobs.clear();
  373. }
  374. else if (event.equalsIgnoreCase("room2_del"))
  375. {
  376. for (L2Npc mob : _Room2Mobs)
  377. {
  378. if (mob != null)
  379. mob.deleteMe();
  380. }
  381. _Room2Mobs.clear();
  382. }
  383. else if (event.equalsIgnoreCase("room3_del"))
  384. {
  385. if (demon1 != null)
  386. demon1.deleteMe();
  387. if (demon2 != null)
  388. demon2.deleteMe();
  389. if (demon3 != null)
  390. demon3.deleteMe();
  391. if (demon4 != null)
  392. demon4.deleteMe();
  393. if (portrait1 != null)
  394. portrait1.deleteMe();
  395. if (portrait2 != null)
  396. portrait2.deleteMe();
  397. if (portrait3 != null)
  398. portrait3.deleteMe();
  399. if (portrait4 != null)
  400. portrait4.deleteMe();
  401. if (frintezza != null)
  402. frintezza.deleteMe();
  403. if (weakScarlet != null)
  404. weakScarlet.deleteMe();
  405. if (strongScarlet != null)
  406. strongScarlet.deleteMe();
  407.  
  408. demon1 = null;
  409. demon2 = null;
  410. demon3 = null;
  411. demon4 = null;
  412. portrait1 = null;
  413. portrait2 = null;
  414. portrait3 = null;
  415. portrait4 = null;
  416. frintezza = null;
  417. weakScarlet = null;
  418. strongScarlet = null;
  419. activeScarlet = null;
  420. }
  421. else if (event.equalsIgnoreCase("clean"))
  422. {
  423. for(L2PcInstance temps : _PlayersInside)
  424. temps.removeNotifyQuestOfDeath(st);
  425. _LastAction = 0;
  426. _LocCycle = 0;
  427. _CheckDie = 0;
  428. _OnCheck = 0;
  429. _Abnormal = 0;
  430. _OnMorph = 0;
  431. _SecondMorph = 0;
  432. _ThirdMorph = 0;
  433. _KillHallAlarmDevice = 0;
  434. _KillDarkChoirPlayer = 0;
  435. _KillDarkChoirCaptain = 0;
  436. }
  437. else if (event.equalsIgnoreCase("close"))
  438. {
  439. for (int i = 17130051; i <= 17130058; i++)
  440. {
  441. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  442. if(door != null)
  443. door.closeMe();
  444. }
  445. for (int i = 17130061; i <= 17130070; i++)
  446. {
  447. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  448. if(door != null)
  449. door.closeMe();
  450. }
  451.  
  452. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  453. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  454. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  455. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  456. }
  457. else if (event.equalsIgnoreCase("loc_check"))
  458. {
  459. if (CurrentStatus == FIGHTING)
  460. {
  461. if (!_Zone.isInsideZone(npc))
  462. npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
  463. if (npc.getX() < getXFix(171932) || npc.getX() > getXFix(176532) || npc.getY() < getYFix(-90320) || npc.getY() > getYFix(-85720) || npc.getZ() < getZFix(-5130))
  464. npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
  465. }
  466. }
  467. else if (event.equalsIgnoreCase("camera_1"))
  468. {
  469. CurrentStatus = FIGHTING;
  470.  
  471. _frintezzaDummy = addSpawn(29052,174240,-89805,-5022,16048,false,0);
  472. _frintezzaDummy.setIsInvul(true);
  473. _frintezzaDummy.setIsImmobilized(true);
  474.  
  475. _overheadDummy = addSpawn(29052,174232,-88020,-5110,16384,false,0);
  476. _overheadDummy.setIsInvul(true);
  477. _overheadDummy.setIsImmobilized(true);
  478. _overheadDummy.setCollisionHeight(600);
  479. _Zone.broadcastPacket(new NpcInfo(_overheadDummy, null));
  480.  
  481. _portraitDummy1 = addSpawn(29052, 172450, -87890, -5100, 16048,false,0);
  482. _portraitDummy1.setIsImmobilized(true);
  483. _portraitDummy1.setIsInvul(true);
  484.  
  485. _portraitDummy3 = addSpawn(29052, 176012, -87890, -5100, 16048,false,0);
  486. _portraitDummy3.setIsImmobilized(true);
  487. _portraitDummy3.setIsInvul(true);
  488.  
  489. _scarletDummy = addSpawn(29053,174232,-88020,-5110,16384,false,0);
  490. _scarletDummy.setIsInvul(true);
  491. _scarletDummy.setIsImmobilized(true);
  492.  
  493. startQuestTimer("stop_pc", 0, npc, null);
  494. startQuestTimer("camera_2", 1000, _overheadDummy, null);
  495. }
  496. else if (event.equalsIgnoreCase("camera_2"))
  497. {
  498. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100,0,0,1,0));
  499. startQuestTimer("camera_2b", 0, _overheadDummy, null);
  500. }
  501. else if (event.equalsIgnoreCase("camera_2b"))
  502. {
  503. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100,0,0,1,0));
  504. startQuestTimer("camera_3", 0, _overheadDummy, null);
  505. }
  506. else if (event.equalsIgnoreCase("camera_3"))
  507. {
  508. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),300, 90, -10, 6500, 7000,0,0,1,0));
  509.  
  510. frintezza = (L2GrandBossInstance) addSpawn(FRINTEZZA,174240,-89805,-5022,16048,false,0);
  511. frintezza.setIsImmobilized(true);
  512. frintezza.setIsInvul(true);
  513. frintezza.disableAllSkills();
  514. _Zone.updateKnownList(frintezza);
  515.  
  516. demon2 = (L2MonsterInstance) addSpawn(29051, 175876, -88713, -5100, 28205,false,0);
  517. demon2.setIsImmobilized(true);
  518. demon2.disableAllSkills();
  519. _Zone.updateKnownList(demon2);
  520.  
  521. demon3 = (L2MonsterInstance) addSpawn(29051, 172608, -88702, -5100, 64817,false,0);
  522. demon3.setIsImmobilized(true);
  523. demon3.disableAllSkills();
  524. _Zone.updateKnownList(demon3);
  525.  
  526. demon1 = (L2MonsterInstance) addSpawn(29050, 175833, -87165, -5100, 35048,false,0);
  527. demon1.setIsImmobilized(true);
  528. demon1.disableAllSkills();
  529. _Zone.updateKnownList(demon1);
  530.  
  531. demon4 = (L2MonsterInstance) addSpawn(29050, 172634, -87165, -5100, 57730,false,0);
  532. demon4.setIsImmobilized(true);
  533. demon4.disableAllSkills();
  534. _Zone.updateKnownList(demon4);
  535.  
  536. startQuestTimer("camera_4", 6500, _overheadDummy, null);
  537. }
  538. else if (event.equalsIgnoreCase("camera_4"))
  539. {
  540. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),1800, 90, 8, 6500, 7000,0,0,1,0));
  541. startQuestTimer("camera_5", 900, _frintezzaDummy, null);
  542. }
  543. else if (event.equalsIgnoreCase("camera_5"))
  544. {
  545. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),140, 90, 10, 2500, 4500,0,0,1,0));
  546. startQuestTimer("camera_5b", 4000, _frintezzaDummy, null);
  547. }
  548. else if (event.equalsIgnoreCase("camera_5b"))
  549. {
  550. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 1000,0,0,1,0));
  551. startQuestTimer("camera_6", 0, frintezza, null);
  552. }
  553. else if (event.equalsIgnoreCase("camera_6"))
  554. {
  555. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 12000,0,0,1,0));
  556. startQuestTimer("camera_7", 1350, frintezza, null);
  557. }
  558. else if (event.equalsIgnoreCase("camera_7"))
  559. {
  560. _Zone.broadcastPacket(new SocialAction(frintezza,2));
  561. startQuestTimer("camera_8", 7000, frintezza, null);
  562. }
  563. else if (event.equalsIgnoreCase("camera_8"))
  564. {
  565. startQuestTimer("camera_9", 1000, frintezza, null);
  566. _frintezzaDummy.deleteMe();
  567. _frintezzaDummy = null;
  568. }
  569. else if (event.equalsIgnoreCase("camera_9"))
  570. {
  571. _Zone.broadcastPacket(new SocialAction(demon2,1));
  572. _Zone.broadcastPacket(new SocialAction(demon3,1));
  573. startQuestTimer("camera_9b", 400, frintezza, null);
  574. }
  575. else if (event.equalsIgnoreCase("camera_9b"))
  576. {
  577. _Zone.broadcastPacket(new SocialAction(demon1,1));
  578. _Zone.broadcastPacket(new SocialAction(demon4,1));
  579.  
  580. for (L2Character pc : _Zone.getCharactersInside().values())
  581. {
  582. if (pc instanceof L2PcInstance)
  583. {
  584. if (pc.getX() < getXFix(174232))
  585. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 1000,0,0,1,0));
  586. else
  587. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 1000,0,0,1,0));
  588. }
  589. }
  590. startQuestTimer("camera_9c", 0, frintezza, null);
  591. }
  592. else if (event.equalsIgnoreCase("camera_9c"))
  593. {
  594. for (L2Character pc : _Zone.getCharactersInside().values())
  595. {
  596. if (pc instanceof L2PcInstance)
  597. {
  598. if (pc.getX() < getXFix(174232))
  599. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 10000,0,0,1,0));
  600. else
  601. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 10000,0,0,1,0));
  602. }
  603. }
  604. startQuestTimer("camera_10", 2000, frintezza, null);
  605. }
  606. else if (event.equalsIgnoreCase("camera_10"))
  607. {
  608. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 0, 0, 1000,0,0,1,0));
  609. startQuestTimer("camera_11", 0, frintezza, null);
  610. }
  611. else if (event.equalsIgnoreCase("camera_11"))
  612. {
  613. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 25, 5500, 10000,0,0,1,0));
  614. _Zone.broadcastPacket(new SocialAction(frintezza,3));
  615. _portraitDummy1.deleteMe();
  616. _portraitDummy3.deleteMe();
  617. _portraitDummy1 = null;
  618. _portraitDummy3 = null;
  619.  
  620. startQuestTimer("camera_12", 4500, frintezza, null);
  621. }
  622. else if (event.equalsIgnoreCase("camera_12"))
  623. {
  624. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000,0,0,1,0));
  625. startQuestTimer("camera_13", 700, frintezza, null);
  626. }
  627. else if (event.equalsIgnoreCase("camera_13"))
  628. {
  629. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000,0,0,1,0));
  630. startQuestTimer("camera_14", 1300, frintezza, null);
  631. }
  632. else if (event.equalsIgnoreCase("camera_14"))
  633. {
  634. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),120, 180, 45, 1500, 10000,0,0,1,0));
  635. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  636. startQuestTimer("camera_16", 1500, frintezza, null);
  637. }
  638. else if (event.equalsIgnoreCase("camera_16"))
  639. {
  640. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),520, 135, 45, 8000, 10000,0,0,1,0));
  641. startQuestTimer("camera_17", 7500, frintezza, null);
  642. }
  643. else if (event.equalsIgnoreCase("camera_17"))
  644. {
  645. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),1500, 110, 25, 10000, 13000,0,0,1,0));
  646. startQuestTimer("camera_18", 9500, frintezza, null);
  647. }
  648. else if (event.equalsIgnoreCase("camera_18"))
  649. {
  650. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),930, 160, -20, 0, 1000,0,0,1,0));
  651. startQuestTimer("camera_18b", 0, _overheadDummy, null);
  652. }
  653. else if (event.equalsIgnoreCase("camera_18b"))
  654. {
  655. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 600, 180, -25, 0, 10000,0,0,1,0));
  656. _Zone.broadcastPacket(new MagicSkillUse(_scarletDummy,_overheadDummy, 5004, 1, 5800, 0));
  657.  
  658. weakScarlet = (L2GrandBossInstance) addSpawn(29046, 174232, -88020, -5110, 16384, false, 0, true);
  659. weakScarlet.setIsInvul(true);
  660. weakScarlet.setIsImmobilized(true);
  661. weakScarlet.disableAllSkills();
  662. _Zone.updateKnownList(weakScarlet);
  663. activeScarlet = weakScarlet;
  664.  
  665. startQuestTimer("camera_19", 2400, _scarletDummy, null);
  666. startQuestTimer("camera_19b", 5000, _scarletDummy, null);
  667. }
  668. else if (event.equalsIgnoreCase("camera_19"))
  669. {
  670. weakScarlet.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5110));
  671. }
  672. else if (event.equalsIgnoreCase("camera_19b"))
  673. {
  674. _Zone.broadcastPacket(new SpecialCamera(_scarletDummy.getObjectId(), 800, 180, 10, 1000, 10000,0,0,1,0));
  675. startQuestTimer("camera_20", 2100, _scarletDummy, null);
  676. }
  677. else if (event.equalsIgnoreCase("camera_20"))
  678. {
  679. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),300, 60, 8, 0, 10000,0,0,1,0));
  680. startQuestTimer("camera_21", 2000, weakScarlet, null);
  681. }
  682. else if (event.equalsIgnoreCase("camera_21"))
  683. {
  684. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),500, 90, 10, 3000, 5000,0,0,1,0));
  685. startQuestTimer("camera_22", 3000, weakScarlet, null);
  686. }
  687. else if (event.equalsIgnoreCase("camera_22"))
  688. {
  689. portrait2 = (L2MonsterInstance) addSpawn(29049, 175876, -88713, -5000, 28205,false,0);
  690. portrait2.setIsImmobilized(true);
  691. portrait2.disableAllSkills();
  692. _Zone.updateKnownList(portrait2);
  693.  
  694. portrait3 = (L2MonsterInstance) addSpawn(29049, 172608, -88702, -5000, 64817,false,0);
  695. portrait3.setIsImmobilized(true);
  696. portrait3.disableAllSkills();
  697. _Zone.updateKnownList(portrait3);
  698.  
  699. portrait1 = (L2MonsterInstance) addSpawn(29048, 175833, -87165, -5000, 35048,false,0);
  700. portrait1.setIsImmobilized(true);
  701. portrait1.disableAllSkills();
  702. _Zone.updateKnownList(portrait1);
  703.  
  704. portrait4 = (L2MonsterInstance) addSpawn(29048, 172634, -87165, -5000, 57730,false,0);
  705. portrait4.setIsImmobilized(true);
  706. portrait4.disableAllSkills();
  707. _Zone.updateKnownList(portrait4);
  708.  
  709. _overheadDummy.deleteMe();
  710. _scarletDummy.deleteMe();
  711. _overheadDummy = null;
  712. _scarletDummy = null;
  713.  
  714. startQuestTimer("camera_23", 2000, weakScarlet, null);
  715. startQuestTimer("start_pc", 2000, weakScarlet, null);
  716. startQuestTimer("loc_check", 60000, weakScarlet, null, true);
  717. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  718. startQuestTimer("skill01", 10000 + Rnd.get(10000), weakScarlet, null);
  719. }
  720. else if (event.equalsIgnoreCase("camera_23"))
  721. {
  722. demon1.setIsImmobilized(false);
  723. demon2.setIsImmobilized(false);
  724. demon3.setIsImmobilized(false);
  725. demon4.setIsImmobilized(false);
  726. demon1.enableAllSkills();
  727. demon2.enableAllSkills();
  728. demon3.enableAllSkills();
  729. demon4.enableAllSkills();
  730. portrait1.setIsImmobilized(false);
  731. portrait2.setIsImmobilized(false);
  732. portrait3.setIsImmobilized(false);
  733. portrait4.setIsImmobilized(false);
  734. portrait1.enableAllSkills();
  735. portrait2.enableAllSkills();
  736. portrait3.enableAllSkills();
  737. portrait4.enableAllSkills();
  738. weakScarlet.setIsInvul(false);
  739. weakScarlet.setIsImmobilized(false);
  740. weakScarlet.enableAllSkills();
  741. weakScarlet.setRunning();
  742.  
  743. startQuestTimer("spawn_minion", 20000, portrait1, null);
  744. startQuestTimer("spawn_minion", 20000, portrait2, null);
  745. startQuestTimer("spawn_minion", 20000, portrait3, null);
  746. startQuestTimer("spawn_minion", 20000, portrait4, null);
  747. }
  748. else if (event.equalsIgnoreCase("stop_pc"))
  749. {
  750. for (L2Character cha : _Zone.getCharactersInside().values())
  751. {
  752. cha.abortAttack();
  753. cha.abortCast();
  754. cha.disableAllSkills();
  755. cha.setTarget(null);
  756. cha.stopMove(null);
  757. cha.setIsImmobilized(true);
  758. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  759. }
  760. }
  761. else if (event.equalsIgnoreCase("stop_npc"))
  762. {
  763. _Heading = npc.getHeading();
  764. if (_Heading < 32768)
  765. _Angle = Math.abs(180 - (int)(_Heading / 182.044444444));
  766. else
  767. _Angle = Math.abs(540 - (int)(_Heading / 182.044444444));
  768. }
  769. else if (event.equalsIgnoreCase("start_pc"))
  770. {
  771. for (L2Character cha : _Zone.getCharactersInside().values())
  772. {
  773. if (cha != frintezza)
  774. {
  775. cha.enableAllSkills();
  776. cha.setIsImmobilized(false);
  777. }
  778. }
  779. }
  780. else if (event.equalsIgnoreCase("start_npc"))
  781. {
  782. npc.setRunning();
  783. npc.setIsInvul(false);
  784. }
  785. else if (event.equalsIgnoreCase("morph_end"))
  786. {
  787. _OnMorph = 0;
  788. }
  789. else if (event.equalsIgnoreCase("morph_01"))
  790. {
  791. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 2000, 15000,0,0,1,0));
  792. startQuestTimer("morph_02", 3000, weakScarlet, null);
  793. }
  794. else if (event.equalsIgnoreCase("morph_02"))
  795. {
  796. _Zone.broadcastPacket(new SocialAction(weakScarlet,1));
  797. weakScarlet.setRHandId(7903);
  798. startQuestTimer("morph_03", 4000, weakScarlet, null);
  799. }
  800. else if (event.equalsIgnoreCase("morph_03"))
  801. {
  802. startQuestTimer("morph_04", 1500, weakScarlet, null);
  803. }
  804. else if (event.equalsIgnoreCase("morph_04"))
  805. {
  806. _Zone.broadcastPacket(new SocialAction(weakScarlet,4));
  807. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  808. if (skill != null)
  809. skill.getEffects(weakScarlet, weakScarlet);
  810.  
  811. startQuestTimer("morph_end", 6000, weakScarlet, null);
  812. startQuestTimer("start_pc", 3000, weakScarlet, null);
  813. startQuestTimer("start_npc", 3000, weakScarlet, null);
  814. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  815. startQuestTimer("skill02", 10000 + Rnd.get(10000), weakScarlet, null);
  816. }
  817. else if (event.equalsIgnoreCase("morph_05a"))
  818. {
  819. _Zone.broadcastPacket(new SocialAction(frintezza,4));
  820. }
  821. else if (event.equalsIgnoreCase("morph_05"))
  822. {
  823. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 1000,0,0,1,0));
  824. startQuestTimer("morph_06", 0, frintezza, null);
  825. }
  826. else if (event.equalsIgnoreCase("morph_06"))
  827. {
  828. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 10000,0,0,1,0));
  829.  
  830. cancelQuestTimers("loc_check");
  831.  
  832. _Scarlet_x = weakScarlet.getX();
  833. _Scarlet_y = weakScarlet.getY();
  834. _Scarlet_z = weakScarlet.getZ();
  835. _Scarlet_h = weakScarlet.getHeading();
  836. weakScarlet.deleteMe();
  837. weakScarlet = null;
  838. activeScarlet = null;
  839. weakScarlet = (L2GrandBossInstance) addSpawn(29046, _Scarlet_x, _Scarlet_y, _Scarlet_z, _Scarlet_h, false,0);
  840. weakScarlet.setIsInvul(true);
  841. weakScarlet.setIsImmobilized(true);
  842. weakScarlet.disableAllSkills();
  843. weakScarlet.setRHandId(7903);
  844. _Zone.updateKnownList(weakScarlet);
  845.  
  846. startQuestTimer("morph_07", 7000, frintezza, null);
  847. }
  848. else if (event.equalsIgnoreCase("morph_07"))
  849. {
  850. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  851. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),500, 70, 15, 3000, 10000,0,0,1,0));
  852. startQuestTimer("morph_08", 3000, frintezza, null);
  853. }
  854. else if (event.equalsIgnoreCase("morph_08"))
  855. {
  856. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),2500, 90, 12, 6000, 10000,0,0,1,0));
  857. startQuestTimer("morph_09", 3000, frintezza, null);
  858. }
  859. else if (event.equalsIgnoreCase("morph_09"))
  860. {
  861. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 1000,0,0,1,0));
  862. startQuestTimer("morph_10", 0, weakScarlet, null);
  863. }
  864. else if (event.equalsIgnoreCase("morph_10"))
  865. {
  866. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 10000,0,0,1,0));
  867. startQuestTimer("morph_11", 500, weakScarlet, null);
  868. }
  869. else if (event.equalsIgnoreCase("morph_11"))
  870. {
  871. weakScarlet.doDie(weakScarlet);
  872. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),450, _Angle, 14, 8000, 8000,0,0,1,0));
  873.  
  874. startQuestTimer("morph_12", 6250, weakScarlet, null);
  875. startQuestTimer("morph_13", 7200, weakScarlet, null);
  876. }
  877. else if (event.equalsIgnoreCase("morph_12"))
  878. {
  879. weakScarlet.deleteMe();
  880. weakScarlet = null;
  881. }
  882. else if (event.equalsIgnoreCase("morph_13"))
  883. {
  884. strongScarlet = (L2GrandBossInstance) addSpawn(SCARLET2, reverseXFix(_Scarlet_x), reverseYFix(_Scarlet_y), reverseZFix(_Scarlet_z), _Scarlet_h, false,0);
  885. strongScarlet.setIsInvul(true);
  886. strongScarlet.setIsImmobilized(true);
  887. strongScarlet.disableAllSkills();
  888. _Zone.updateKnownList(strongScarlet);
  889. activeScarlet = strongScarlet;
  890.  
  891. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),450, _Angle, 12, 500, 14000,0,0,1,0));
  892.  
  893. startQuestTimer("morph_14", 3000, strongScarlet, null);
  894. startQuestTimer("loc_check", 60000, strongScarlet, null, true);
  895. }
  896. else if (event.equalsIgnoreCase("morph_14"))
  897. {
  898. startQuestTimer("morph_15", 5100, strongScarlet, null);
  899. }
  900. else if (event.equalsIgnoreCase("morph_15"))
  901. {
  902. _Zone.broadcastPacket(new SocialAction(strongScarlet,2));
  903. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  904. if (skill != null)
  905. skill.getEffects(strongScarlet, strongScarlet);
  906.  
  907. startQuestTimer("morph_end", 9000, strongScarlet, null);
  908. startQuestTimer("start_pc", 6000, strongScarlet, null);
  909. startQuestTimer("start_npc", 6000, strongScarlet, null);
  910. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  911. startQuestTimer("skill03", 10000 + Rnd.get(10000), strongScarlet, null);
  912. }
  913. else if (event.equalsIgnoreCase("morph_16"))
  914. {
  915. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),300, _Angle - 180 , 5, 0, 7000,0,0,1,0));
  916. startQuestTimer("morph_17", 0, strongScarlet, null);
  917. }
  918. else if (event.equalsIgnoreCase("morph_17"))
  919. {
  920. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),200, _Angle, 85, 4000, 10000,0,0,1,0));
  921. startQuestTimer("morph_17b", 7400, frintezza, null);
  922. startQuestTimer("morph_18", 7500, frintezza, null);
  923. }
  924. else if (event.equalsIgnoreCase("morph_17b"))
  925. {
  926. frintezza.doDie(frintezza);
  927. }
  928. else if (event.equalsIgnoreCase("morph_18"))
  929. {
  930. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 120, 5, 0, 7000,0,0,1,0));
  931. startQuestTimer("morph_19", 0, frintezza, null);
  932. }
  933. else if (event.equalsIgnoreCase("morph_19"))
  934. {
  935. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 90, 5, 5000, 15000,0,0,1,0));
  936. startQuestTimer("morph_20", 7000, frintezza, null);
  937. startQuestTimer("spawn_cubes", 7000, frintezza, null);
  938. }
  939. else if (event.equalsIgnoreCase("morph_20"))
  940. {
  941. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),900, 90, 25, 7000, 10000,0,0,1,0));
  942. startQuestTimer("start_pc", 7000, frintezza, null);
  943. }
  944. else if (event.equalsIgnoreCase("songs_play"))
  945. {
  946. if (frintezza != null && !frintezza.isDead() && _OnMorph == 0)
  947. {
  948. _OnSong = Rnd.get(1, 5);
  949. if (_OnSong == 1 && _ThirdMorph == 1 && strongScarlet.getCurrentHp() < strongScarlet.getMaxHp() * 0.6 && Rnd.get(100) < 80)
  950. {
  951. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 1, 32000, 0));
  952. startQuestTimer("songs_effect", 5000, frintezza, null);
  953. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  954. }
  955. else if (_OnSong == 2 || _OnSong == 3)
  956. {
  957. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, _OnSong, 32000, 0));
  958. startQuestTimer("songs_effect", 5000, frintezza, null);
  959. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  960. }
  961. else if (_OnSong == 4 && _SecondMorph == 1)
  962. {
  963. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 4, 31000, 0));
  964. startQuestTimer("songs_effect", 5000, frintezza, null);
  965. startQuestTimer("songs_play", 31000 + Rnd.get(10000), frintezza, null);
  966. }
  967. else if (_OnSong == 5 && _ThirdMorph == 1 && _Abnormal == 0)
  968. {
  969. _Abnormal = 1;
  970. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 5, 35000, 0));
  971. startQuestTimer("songs_effect", 5000, frintezza, null);
  972. startQuestTimer("songs_play", 35000 + Rnd.get(10000), frintezza, null);
  973. }
  974. else
  975. startQuestTimer("songs_play", 5000 + Rnd.get(5000), frintezza, null);
  976. }
  977. }
  978. else if (event.equalsIgnoreCase("songs_effect"))
  979. {
  980. L2Skill skill = SkillTable.getInstance().getInfo(5008, _OnSong);
  981. if (skill == null)
  982. return null;
  983.  
  984. if (_OnSong == 1 || _OnSong == 2 || _OnSong == 3)
  985. {
  986. if (frintezza != null && !frintezza.isDead() && activeScarlet != null && !activeScarlet.isDead())
  987. skill.getEffects(frintezza, activeScarlet);
  988. }
  989. else if (_OnSong == 4)
  990. {
  991. for (L2Character cha : _Zone.getCharactersInside().values())
  992. {
  993. if (cha instanceof L2PcInstance && Rnd.get(100) < 80)
  994. {
  995. skill.getEffects(frintezza, cha);
  996. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 4));
  997. }
  998. }
  999. }
  1000. else if (_OnSong == 5)
  1001. {
  1002. for (L2Character cha : _Zone.getCharactersInside().values())
  1003. {
  1004. if (cha instanceof L2PcInstance && Rnd.get(100) < 70)
  1005. {
  1006. cha.abortAttack();
  1007. cha.abortCast();
  1008. cha.disableAllSkills();
  1009. cha.stopMove(null);
  1010. cha.setIsParalyzed(true);
  1011. cha.setIsImmobilized(true);
  1012. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1013. skill.getEffects(frintezza, cha);
  1014. cha.startAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1015. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 5));
  1016. }
  1017. }
  1018. startQuestTimer("stop_effect", 25000, frintezza, null);
  1019. }
  1020. }
  1021. else if (event.equalsIgnoreCase("stop_effect"))
  1022. {
  1023. for (L2Character cha : _Zone.getCharactersInside().values())
  1024. {
  1025. if (cha instanceof L2PcInstance)
  1026. {
  1027. cha.stopAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1028. cha.stopAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1029. cha.enableAllSkills();
  1030. cha.setIsImmobilized(false);
  1031. cha.setIsParalyzed(false);
  1032. }
  1033. }
  1034. _Abnormal = 0;
  1035. }
  1036. else if (event.equalsIgnoreCase("attack_stop"))
  1037. {
  1038. cancelQuestTimers("skill01");
  1039. cancelQuestTimers("skill02");
  1040. cancelQuestTimers("skill03");
  1041. cancelQuestTimers("songs_play");
  1042. cancelQuestTimers("songs_effect");
  1043.  
  1044. if (frintezza != null)
  1045. _Zone.broadcastPacket(new MagicSkillCanceld(frintezza.getObjectId()));
  1046. }
  1047. else if (event.equalsIgnoreCase("check_hp"))
  1048. {
  1049. if (npc.isDead())
  1050. {
  1051. _OnMorph = 1;
  1052. _Zone.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
  1053.  
  1054. startQuestTimer("attack_stop", 0, frintezza, null);
  1055. startQuestTimer("stop_pc", 0, npc, null);
  1056. startQuestTimer("stop_npc", 0, npc, null);
  1057. startQuestTimer("morph_16", 0, npc, null);
  1058. }
  1059. else
  1060. {
  1061. _CheckDie = _CheckDie + 10;
  1062. if (_CheckDie < 3000)
  1063. startQuestTimer("check_hp", 10, npc, null);
  1064. else
  1065. {
  1066. _OnCheck = 0;
  1067. _CheckDie = 0;
  1068. }
  1069. }
  1070. }
  1071. else if (event.equalsIgnoreCase("skill01"))
  1072. {
  1073. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0)
  1074. {
  1075. int i = Rnd.get(0,1);
  1076. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1077. if (skill != null)
  1078. {
  1079. weakScarlet.stopMove(null);
  1080. weakScarlet.setIsCastingNow(true);
  1081. weakScarlet.doCast(skill);
  1082. }
  1083. startQuestTimer("skill01", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1084. }
  1085. }
  1086. else if (event.equalsIgnoreCase("skill02"))
  1087. {
  1088. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0)
  1089. {
  1090. int i = 0;
  1091. if (_Abnormal == 0)
  1092. i = Rnd.get(2,5);
  1093. else
  1094. i = Rnd.get(2,4);
  1095.  
  1096. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1097. if (skill != null)
  1098. {
  1099. weakScarlet.stopMove(null);
  1100. weakScarlet.setIsCastingNow(true);
  1101. weakScarlet.doCast(skill);
  1102. }
  1103. startQuestTimer("skill02", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1104.  
  1105. if (i == 5)
  1106. {
  1107. _Abnormal = 1;
  1108. startQuestTimer("float_effect", 4000, weakScarlet, null);
  1109. }
  1110. }
  1111. }
  1112. else if (event.equalsIgnoreCase("skill03"))
  1113. {
  1114. if (strongScarlet != null && !strongScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 1 && _OnMorph == 0)
  1115. {
  1116. int i = 0;
  1117. if (_Abnormal == 0)
  1118. i = Rnd.get(6,10);
  1119. else
  1120. i = Rnd.get(6,9);
  1121.  
  1122. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1123. if (skill != null)
  1124. {
  1125. strongScarlet.stopMove(null);
  1126. strongScarlet.setIsCastingNow(true);
  1127. strongScarlet.doCast(skill);
  1128. }
  1129. startQuestTimer("skill03", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1130.  
  1131. if (i == 10)
  1132. {
  1133. _Abnormal = 1;
  1134. startQuestTimer("float_effect", 3000, npc, null);
  1135. }
  1136. }
  1137. }
  1138. else if (event.equalsIgnoreCase("float_effect"))
  1139. {
  1140. if (npc.isCastingNow())
  1141. {
  1142. startQuestTimer("float_effect", 500, npc, null);
  1143. }
  1144. else
  1145. {
  1146. for (L2Character cha : _Zone.getCharactersInside().values())
  1147. {
  1148. if (cha instanceof L2PcInstance)
  1149. {
  1150. if (cha.getFirstEffect(5016) != null)
  1151. {
  1152. cha.abortAttack();
  1153. cha.abortCast();
  1154. cha.disableAllSkills();
  1155. cha.stopMove(null);
  1156. cha.setIsParalyzed(true);
  1157. cha.setIsImmobilized(true);
  1158. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1159. cha.startAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1160. }
  1161. }
  1162. }
  1163. startQuestTimer("stop_effect", 25000, npc, null);
  1164. }
  1165. }
  1166. else if (event.equalsIgnoreCase("action"))
  1167. {
  1168. _Zone.broadcastPacket(new SocialAction(npc,1));
  1169. }
  1170. else if (event.equalsIgnoreCase("bomber"))
  1171. {
  1172. _Bomber = 0;
  1173. }
  1174. else if (event.equalsIgnoreCase("room_final"))
  1175. {
  1176. _Zone.broadcastPacket(new NpcSay(npc.getObjectId(),1,npc.getNpcId(),"Exceeded his time limit, challenge failed!"));
  1177. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1178. playerInsideTezza.setInstanceId(0);
  1179. _Zone.oustAllPlayers();
  1180.  
  1181. cancelQuestTimers("waiting");
  1182. cancelQuestTimers("frintezza_despawn");
  1183. startQuestTimer("clean", 1000, npc, null);
  1184. startQuestTimer("close", 1000, npc, null);
  1185. startQuestTimer("room1_del", 1000, npc, null);
  1186. startQuestTimer("room2_del", 1000, npc, null);
  1187. startQuestTimer("destroy_instance", 30000, npc, null);
  1188. }
  1189. else if (event.equalsIgnoreCase("all_dead_frintezza_despawn"))
  1190. {
  1191. temp = (System.currentTimeMillis() - _LastAction);
  1192. if (temp > 30000)
  1193. {
  1194. //Maybe they ressed?
  1195. for(L2PcInstance temps : _PlayersInside)
  1196. {
  1197. if(!temps.isDead())
  1198. {
  1199. _log.log(Level.INFO, "Frintezza Manager: Someone is still alive, cancelling instance deletion.");
  1200. cancelQuestTimers("all_dead_frintezza_despawn");
  1201. return "";
  1202. }
  1203. }
  1204. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1205. playerInsideTezza.setInstanceId(0);
  1206.  
  1207. _Zone.oustAllPlayers();
  1208. cancelQuestTimers("all_dead_frintezza_despawn");
  1209. cancelQuestTimers("waiting");
  1210. cancelQuestTimers("loc_check");
  1211. cancelQuestTimers("room_final");
  1212. cancelQuestTimers("spawn_minion");
  1213. startQuestTimer("clean", 1000, npc, null);
  1214. startQuestTimer("close", 1000, npc, null);
  1215. startQuestTimer("attack_stop", 1000, npc, null);
  1216. startQuestTimer("room1_del", 1000, npc, null);
  1217. startQuestTimer("room2_del", 1000, npc, null);
  1218. startQuestTimer("room3_del", 1000, npc, null);
  1219. startQuestTimer("minions_despawn", 1000, npc, null);
  1220. startQuestTimer("destroy_instance", 30000, npc, null);
  1221.  
  1222. }
  1223. }
  1224. else if (event.equalsIgnoreCase("frintezza_despawn"))
  1225. {
  1226. temp = (System.currentTimeMillis() - _LastAction);
  1227. if (temp > 900000)
  1228. {
  1229. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1230. playerInsideTezza.setInstanceId(0);
  1231.  
  1232. _Zone.oustAllPlayers();
  1233.  
  1234. cancelQuestTimers("frintezza_despawn");
  1235. cancelQuestTimers("waiting");
  1236. cancelQuestTimers("loc_check");
  1237. cancelQuestTimers("room_final");
  1238. cancelQuestTimers("spawn_minion");
  1239. startQuestTimer("clean", 1000, npc, null);
  1240. startQuestTimer("close", 1000, npc, null);
  1241. startQuestTimer("attack_stop", 1000, npc, null);
  1242. startQuestTimer("room1_del", 1000, npc, null);
  1243. startQuestTimer("room2_del", 1000, npc, null);
  1244. startQuestTimer("room3_del", 1000, npc, null);
  1245. startQuestTimer("minions_despawn", 1000, npc, null);
  1246. startQuestTimer("destroy_instance", 30000, npc, null);
  1247. }
  1248. }
  1249. else if (event.equalsIgnoreCase("minions_despawn"))
  1250. {
  1251. for (int i = 0; i < Minions.size(); i++)
  1252. {
  1253. L2Attackable mob = Minions.get(i);
  1254. if (mob != null)
  1255. mob.decayMe();
  1256. }
  1257. Minions.clear();
  1258. }
  1259. else if (event.equalsIgnoreCase("spawn_minion"))
  1260. {
  1261. if (npc != null && !npc.isDead() && frintezza != null && !frintezza.isDead())
  1262. {
  1263. L2Attackable mob = (L2Attackable)addSpawn(npc.getNpcId()+2,npc.getX(),npc.getY(),npc.getZ(),npc.getHeading(),false,0);
  1264. if(mob != null)
  1265. {
  1266. mob.setIsRaidMinion(true);
  1267. Minions.add(mob);
  1268.  
  1269. startQuestTimer("action", 200, mob, null);
  1270. startQuestTimer("spawn_minion", 18000, npc, null);
  1271. }
  1272. }
  1273. }
  1274. else if (event.equalsIgnoreCase("spawn_cubes"))
  1275. {
  1276. addSpawn(CUBE,174232,-88020,-5114,16384,false,900000);
  1277. }
  1278. else if (event.equalsIgnoreCase("remove_players"))
  1279. {
  1280. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1281. playerInsideTezza.setInstanceId(0);
  1282. _Zone.oustAllPlayers();
  1283.  
  1284. }else if (event.equalsIgnoreCase("destroy_instance"))
  1285. {
  1286. InstanceManager.getInstance().destroyInstance(currentInstanceID);
  1287.  
  1288. for(String timer : _TimerControl)
  1289. if(timer != null)
  1290. cancelQuestTimers(timer);
  1291. _TimerControl.clear();
  1292. _PlayersInside.clear();
  1293. _log.log(Level.INFO, "Frintezza Manager: Frintezza's instance is opened.");
  1294. CurrentStatus = DORMANT;
  1295. }
  1296.  
  1297. return super.onAdvEvent(event, npc, player);
  1298. }
  1299.  
  1300. @Override
  1301. public String onTalk (L2Npc npc, L2PcInstance player)
  1302. {
  1303. if (npc.getNpcId() == CUBE)
  1304. {
  1305. int x = 150037 + Rnd.get(500);
  1306. int y = -57720 + Rnd.get(500);
  1307. player.setInstanceId(0);
  1308. player.teleToLocation(x, y, -2976);
  1309. _PlayersInside.remove(player);
  1310.  
  1311. if(_PlayersInside.isEmpty())
  1312. startQuestTimer("destroy_instance", 30000, npc, null);
  1313.  
  1314. return null;
  1315. }
  1316.  
  1317. if(CurrentStatus != DORMANT)
  1318. return "<html><body>Someone is already inside instance. Try again later.</body></html>";
  1319.  
  1320. st = player.getQuestState(getName());
  1321.  
  1322. if (player.getParty() == null || player.getParty().getCommandChannel() == null || player.getParty().getCommandChannel().getChannelLeader() != player)
  1323. return "<html><body>I speak only with command channel leader.</body></html>";
  1324.  
  1325. if (player.getParty().getCommandChannel().getMemberCount() < 36 || player.getParty().getCommandChannel().getMemberCount() > 45)
  1326. return "<html><body>Your command channel have incorrect size. You need between 36 and 45 players.</body></html>";
  1327.  
  1328. if (player.getInventory().getItemByItemId(8073) == null)
  1329. return "<html><body>You dont have required item.</body></html>";
  1330.  
  1331. L2CommandChannel CC = player.getParty().getCommandChannel();
  1332. for (L2Party _party : CC.getPartys())
  1333. {
  1334. if (_party == null)
  1335. continue;
  1336. for (L2PcInstance _member : _party.getPartyMembers())
  1337. {
  1338. if (_member == null)
  1339. continue;
  1340.  
  1341. if (_member.getLevel() < 80)
  1342. return "<html><body>Player " + _member.getName() + " have too low level. Minimum level required is 80.</body></html>";
  1343. if (!Util.checkIfInRange(1000, player, _member, false))
  1344. return "<html><body>" + _member.getName() + " is not near NPC.</body></html>";
  1345.  
  1346. Long reentertime = InstanceManager.getInstance().getInstanceTime(_member.getObjectId(), INSTANCEID);
  1347. if (System.currentTimeMillis() < reentertime)
  1348. {
  1349. return "<html><body>" + _member.getName() + " may not reenter yet.</body></html>";
  1350. }
  1351.  
  1352. }
  1353. }
  1354. ClearVariables();
  1355. currentInstanceID = InstanceManager.getInstance().createDynamicInstance("Frintezza.xml");
  1356.  
  1357. player.destroyItemByItemId("Quest", 8073, 1, player, true);
  1358. CurrentStatus = WAITING;
  1359.  
  1360. startQuestTimer("close", 0, npc, null);
  1361. startQuestTimer("room1_spawn", 5000, npc, null);
  1362. startQuestTimer("room_final", 2100000, npc, null);
  1363. startQuestTimer("frintezza_despawn", 60000, npc, null, true);
  1364.  
  1365. _LastAction = System.currentTimeMillis();
  1366. for (L2Party party : CC.getPartys())
  1367. {
  1368. if (party == null)
  1369. continue;
  1370. for (L2PcInstance member : party.getPartyMembers())
  1371. {
  1372. _PlayersInside.add(member);
  1373. _Zone.allowPlayerEntry(member, 300);
  1374. member.addNotifyQuestOfDeath(st);
  1375. member.setInstanceId(currentInstanceID);
  1376. member.teleToLocation(getXFix(_invadeLoc[_LocCycle][0]) + Rnd.get(50), getYFix(_invadeLoc[_LocCycle][1]) + Rnd.get(50), getZFix(_invadeLoc[_LocCycle][2]));
  1377. }
  1378. _LocCycle++;
  1379. if (_LocCycle >= 6)
  1380. _LocCycle = 1;
  1381. }
  1382.  
  1383. setInstanceTimeRestrictions();
  1384. _log.log(Level.INFO, "Frintezza Manager: Frintezza's instance with ID "+currentInstanceID+" has been created by player "+player.getName());
  1385. return "";
  1386. }
  1387.  
  1388. private void ClearVariables()
  1389. {
  1390. _PlayersInside.clear();
  1391. _TimerControl.clear();
  1392. _KillHallAlarmDevice = 0;
  1393. _KillDarkChoirPlayer = 0;
  1394. _KillDarkChoirCaptain = 0;
  1395. currentInstanceID = 0;
  1396. _LastAction = 0;
  1397. _LocCycle = 0;
  1398. _CheckDie = 0;
  1399. _OnCheck = 0;
  1400. _Abnormal = 0;
  1401. _OnMorph = 0;
  1402. _SecondMorph = 0;
  1403. _ThirdMorph = 0;
  1404. }
  1405.  
  1406. @Override
  1407. public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
  1408. {
  1409. _LastAction = System.currentTimeMillis();
  1410. if (npc.getNpcId() == FRINTEZZA)
  1411. {
  1412. npc.setCurrentHpMp(npc.getMaxHp(), 0);
  1413. return null;
  1414. }
  1415. if (npc.getNpcId() == SCARLET1 && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.75 && CurrentStatus == FIGHTING)
  1416. {
  1417. startQuestTimer("attack_stop", 0, frintezza, null);
  1418.  
  1419. _SecondMorph = 1;
  1420. _OnMorph = 1;
  1421.  
  1422. startQuestTimer("stop_pc", 1000, npc, null);
  1423. startQuestTimer("stop_npc", 1000, npc, null);
  1424. startQuestTimer("morph_01", 1100, npc, null);
  1425. }
  1426. else if (npc.getNpcId() == SCARLET1 && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.5 && CurrentStatus == FIGHTING)
  1427. {
  1428. startQuestTimer("attack_stop", 0, frintezza, null);
  1429.  
  1430. _ThirdMorph = 1;
  1431. _OnMorph = 1;
  1432.  
  1433. startQuestTimer("stop_pc", 2000, npc, null);
  1434. startQuestTimer("stop_npc", 2000, npc, null);
  1435. startQuestTimer("morph_05a", 2000, npc, null);
  1436. startQuestTimer("morph_05", 2100, npc, null);
  1437. }
  1438. else if (npc.getNpcId() == SCARLET2 && _SecondMorph == 1 && _ThirdMorph == 1 && _OnCheck == 0 && damage >= npc.getCurrentHp() && CurrentStatus == FIGHTING)
  1439. {
  1440. _OnCheck = 1;
  1441. startQuestTimer("check_hp", 0, npc, null);
  1442. }
  1443. else if ((npc.getNpcId() == 29050 || npc.getNpcId() == 29051) && _Bomber == 0)
  1444. {
  1445. if (npc.getCurrentHp() < npc.getMaxHp() * 0.1)
  1446. {
  1447. if (Rnd.get(100) < 30)
  1448. {
  1449. _Bomber = 1;
  1450. startQuestTimer("bomber", 3000, npc, null);
  1451.  
  1452. L2Skill skill = SkillTable.getInstance().getInfo(5011,1);
  1453. if (skill != null)
  1454. {
  1455. npc.setIsCastingNow(true);
  1456. npc.doCast(skill);
  1457. }
  1458. }
  1459. }
  1460. }
  1461.  
  1462. return super.onAttack(npc, attacker, damage, isPet);
  1463. }
  1464.  
  1465. @Override
  1466. public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet)
  1467. {
  1468. if (npc.getNpcId() == FRINTEZZA)
  1469. {
  1470. return null;
  1471. }
  1472. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 0 && CurrentStatus == FIGHTING)
  1473. {
  1474. _OnCheck = 1;
  1475. startQuestTimer("stop_pc", 0, npc, null);
  1476. startQuestTimer("stop_npc", 0, npc, null);
  1477. startQuestTimer("morph_16", 0, npc, null);
  1478. }
  1479. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 1 && CurrentStatus == FIGHTING)
  1480. {
  1481. cancelQuestTimers("loc_check");
  1482. cancelQuestTimers("spawn_minion");
  1483. cancelQuestTimers("frintezza_despawn");
  1484. startQuestTimer("clean", 30000, npc, null);
  1485. startQuestTimer("close", 30000, npc, null);
  1486. startQuestTimer("room3_del", 60000, npc, null);
  1487. startQuestTimer("minions_despawn", 60000, npc, null);
  1488. startQuestTimer("remove_players", 900000, npc, null);
  1489. startQuestTimer("destroy_instance", 900001, npc, null);
  1490. }
  1491. else if (npc.getNpcId() == 18328)
  1492. {
  1493. _KillHallAlarmDevice++;
  1494. if (_KillHallAlarmDevice == 4)
  1495. {
  1496. startQuestTimer("room1_del", 100, npc, null);
  1497. startQuestTimer("room2_spawn", 100, npc, null);
  1498.  
  1499. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).openMe();
  1500. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).openMe();
  1501. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1502. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1503. for (int i = 17130051; i <= 17130058; i++)
  1504. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1505. }
  1506. }
  1507. else if (npc.getNpcId() == 18339)
  1508. {
  1509. _KillDarkChoirPlayer ++;
  1510. if (_KillDarkChoirPlayer == 2)
  1511. {
  1512. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  1513. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  1514. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  1515. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  1516. int outside = 0;
  1517. for (L2PcInstance room2_pc : _PlayersInside)
  1518. {
  1519. if (_Zone.isInsideZone(room2_pc) && room2_pc.getY() > getYFix(-86130))
  1520. outside++;
  1521. }
  1522. if (outside == 0)
  1523. {
  1524. startQuestTimer("room2_del", 100, npc, null);
  1525. startQuestTimer("waiting", 180000, npc, null);
  1526. cancelQuestTimers("room_final");
  1527. }
  1528. else
  1529. {
  1530. for (int i = 17130061; i <= 17130070; i++)
  1531. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1532.  
  1533. startQuestTimer("room2_spawn2", 1000, npc, null);
  1534. }
  1535. }
  1536. }
  1537. else if (npc.getNpcId() == 18334)
  1538. {
  1539. _KillDarkChoirCaptain ++;
  1540. if (_KillDarkChoirCaptain == 8)
  1541. {
  1542. startQuestTimer("room2_del", 100, npc, null);
  1543.  
  1544. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1545. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1546.  
  1547. startQuestTimer("waiting", 180000, npc, null);
  1548. cancelQuestTimers("room_final");
  1549. }
  1550. }
  1551.  
  1552. return super.onKill(npc,killer,isPet);
  1553. }
  1554.  
  1555. @Override
  1556. public String onDeath(L2Character killer, L2Character victim, QuestState qs)
  1557. {
  1558. for(L2PcInstance player : _PlayersInside)
  1559. {
  1560. if(player.getInstanceId() != currentInstanceID)
  1561. {
  1562. player.removeNotifyQuestOfDeath(st);
  1563. _PlayersInside.remove(player);
  1564. continue;
  1565. }
  1566. if(!player.isDead())
  1567. return "";
  1568. }
  1569. _log.log(Level.INFO, "Frintezza Manager: Everyone inside Frintezza are dead. Closing instance in 30s.");
  1570. startQuestTimer("all_dead_frintezza_despawn", 1000, null, null, true);
  1571. return super.onDeath(killer, victim, qs);
  1572. }
  1573.  
  1574.  
  1575.  
  1576. /**
  1577. * Override spawn method to correct spawn cords after lair move<BR>
  1578. * TODO: Update cords in script, im just lazy :)
  1579. */
  1580. @Override
  1581. public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
  1582. {
  1583.  
  1584. // cords fix:
  1585. return super.addSpawn(npcId, getXFix(x), getYFix(y), getZFix(z), heading, randomOffset, despawnDelay, isSummonSpawn, currentInstanceID);
  1586. }
  1587.  
  1588.  
  1589. public int getXFix(int x)
  1590. {
  1591. return x - 262016;
  1592. }
  1593. public int getYFix(int y)
  1594. {
  1595. return y - 65278;
  1596. }
  1597. public int getZFix(int z)
  1598. {
  1599. return z - 4065;
  1600. }
  1601.  
  1602. public int reverseXFix(int x)
  1603. {
  1604. return x + 262016;
  1605. }
  1606. public int reverseYFix(int y)
  1607. {
  1608. return y + 65278;
  1609. }
  1610. public int reverseZFix(int z)
  1611. {
  1612. return z + 4065;
  1613. }
  1614.  
  1615. protected void setInstanceTimeRestrictions()
  1616. {
  1617. Calendar reenter = Calendar.getInstance();
  1618. reenter.set(Calendar.MINUTE, RESET_MIN);
  1619. reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
  1620. // if time is >= RESET_HOUR - roll to the next day
  1621. if (reenter.getTimeInMillis() <= System.currentTimeMillis())
  1622. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1623. if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
  1624. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
  1625. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1626. else
  1627. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
  1628. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1629.  
  1630. // set instance reenter time for all allowed players
  1631. for (L2PcInstance playerInside : _PlayersInside)
  1632. InstanceManager.getInstance().setInstanceTime(playerInside.getObjectId(), INSTANCEID, reenter.getTimeInMillis());
  1633. }
  1634.  
  1635. @Override
  1636. public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player)
  1637. {
  1638. _TimerControl.add(name);
  1639. super.startQuestTimer(name, time, npc, player);
  1640. }
  1641.  
  1642. @Override
  1643. public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player, boolean repeating)
  1644. {
  1645. _TimerControl.add(name);
  1646. super.startQuestTimer(name, time, npc, player, repeating);
  1647. }
  1648.  
  1649. @Override
  1650. public void cancelQuestTimers(String name)
  1651. {
  1652. _TimerControl.remove(name);
  1653. super.cancelQuestTimers(name);
  1654. }
  1655.  
  1656. public static void main(String[] args)
  1657. {
  1658. // now call the constructor (starts up the ai)
  1659. new Frintezza(-1,"Frintezza","ai");
  1660. }
  1661. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement