Advertisement
horato

Frintezza.java

Jul 29th, 2011
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.52 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. _PlayersInside.clear();
  437. }
  438. else if (event.equalsIgnoreCase("close"))
  439. {
  440. for (int i = 17130051; i <= 17130058; i++)
  441. {
  442. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  443. if(door != null)
  444. door.closeMe();
  445. }
  446. for (int i = 17130061; i <= 17130070; i++)
  447. {
  448. L2DoorInstance door = InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i);
  449. if(door != null)
  450. door.closeMe();
  451. }
  452.  
  453. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  454. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  455. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  456. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  457. }
  458. else if (event.equalsIgnoreCase("loc_check"))
  459. {
  460. if (CurrentStatus == FIGHTING)
  461. {
  462. if (!_Zone.isInsideZone(npc))
  463. npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
  464. if (npc.getX() < getXFix(171932) || npc.getX() > getXFix(176532) || npc.getY() < getYFix(-90320) || npc.getY() > getYFix(-85720) || npc.getZ() < getZFix(-5130))
  465. npc.teleToLocation(getXFix(174232),getYFix(-88020),getZFix(-5116));
  466. }
  467. }
  468. else if (event.equalsIgnoreCase("camera_1"))
  469. {
  470. CurrentStatus = FIGHTING;
  471.  
  472. _frintezzaDummy = addSpawn(29052,174240,-89805,-5022,16048,false,0);
  473. _frintezzaDummy.setIsInvul(true);
  474. _frintezzaDummy.setIsImmobilized(true);
  475.  
  476. _overheadDummy = addSpawn(29052,174232,-88020,-5110,16384,false,0);
  477. _overheadDummy.setIsInvul(true);
  478. _overheadDummy.setIsImmobilized(true);
  479. _overheadDummy.setCollisionHeight(600);
  480. _Zone.broadcastPacket(new NpcInfo(_overheadDummy, null));
  481.  
  482. _portraitDummy1 = addSpawn(29052, 172450, -87890, -5100, 16048,false,0);
  483. _portraitDummy1.setIsImmobilized(true);
  484. _portraitDummy1.setIsInvul(true);
  485.  
  486. _portraitDummy3 = addSpawn(29052, 176012, -87890, -5100, 16048,false,0);
  487. _portraitDummy3.setIsImmobilized(true);
  488. _portraitDummy3.setIsInvul(true);
  489.  
  490. _scarletDummy = addSpawn(29053,174232,-88020,-5110,16384,false,0);
  491. _scarletDummy.setIsInvul(true);
  492. _scarletDummy.setIsImmobilized(true);
  493.  
  494. startQuestTimer("stop_pc", 0, npc, null);
  495. startQuestTimer("camera_2", 1000, _overheadDummy, null);
  496. }
  497. else if (event.equalsIgnoreCase("camera_2"))
  498. {
  499. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100,0,0,1,0));
  500. startQuestTimer("camera_2b", 0, _overheadDummy, null);
  501. }
  502. else if (event.equalsIgnoreCase("camera_2b"))
  503. {
  504. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),0, 75, -89, 0, 100,0,0,1,0));
  505. startQuestTimer("camera_3", 0, _overheadDummy, null);
  506. }
  507. else if (event.equalsIgnoreCase("camera_3"))
  508. {
  509. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),300, 90, -10, 6500, 7000,0,0,1,0));
  510.  
  511. frintezza = (L2GrandBossInstance) addSpawn(FRINTEZZA,174240,-89805,-5022,16048,false,0);
  512. frintezza.setIsImmobilized(true);
  513. frintezza.setIsInvul(true);
  514. frintezza.disableAllSkills();
  515. _Zone.updateKnownList(frintezza);
  516.  
  517. demon2 = (L2MonsterInstance) addSpawn(29051, 175876, -88713, -5100, 28205,false,0);
  518. demon2.setIsImmobilized(true);
  519. demon2.disableAllSkills();
  520. _Zone.updateKnownList(demon2);
  521.  
  522. demon3 = (L2MonsterInstance) addSpawn(29051, 172608, -88702, -5100, 64817,false,0);
  523. demon3.setIsImmobilized(true);
  524. demon3.disableAllSkills();
  525. _Zone.updateKnownList(demon3);
  526.  
  527. demon1 = (L2MonsterInstance) addSpawn(29050, 175833, -87165, -5100, 35048,false,0);
  528. demon1.setIsImmobilized(true);
  529. demon1.disableAllSkills();
  530. _Zone.updateKnownList(demon1);
  531.  
  532. demon4 = (L2MonsterInstance) addSpawn(29050, 172634, -87165, -5100, 57730,false,0);
  533. demon4.setIsImmobilized(true);
  534. demon4.disableAllSkills();
  535. _Zone.updateKnownList(demon4);
  536.  
  537. startQuestTimer("camera_4", 6500, _overheadDummy, null);
  538. }
  539. else if (event.equalsIgnoreCase("camera_4"))
  540. {
  541. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),1800, 90, 8, 6500, 7000,0,0,1,0));
  542. startQuestTimer("camera_5", 900, _frintezzaDummy, null);
  543. }
  544. else if (event.equalsIgnoreCase("camera_5"))
  545. {
  546. _Zone.broadcastPacket(new SpecialCamera(_frintezzaDummy.getObjectId(),140, 90, 10, 2500, 4500,0,0,1,0));
  547. startQuestTimer("camera_5b", 4000, _frintezzaDummy, null);
  548. }
  549. else if (event.equalsIgnoreCase("camera_5b"))
  550. {
  551. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 1000,0,0,1,0));
  552. startQuestTimer("camera_6", 0, frintezza, null);
  553. }
  554. else if (event.equalsIgnoreCase("camera_6"))
  555. {
  556. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),40, 75, -10, 0, 12000,0,0,1,0));
  557. startQuestTimer("camera_7", 1350, frintezza, null);
  558. }
  559. else if (event.equalsIgnoreCase("camera_7"))
  560. {
  561. _Zone.broadcastPacket(new SocialAction(frintezza,2));
  562. startQuestTimer("camera_8", 7000, frintezza, null);
  563. }
  564. else if (event.equalsIgnoreCase("camera_8"))
  565. {
  566. startQuestTimer("camera_9", 1000, frintezza, null);
  567. _frintezzaDummy.deleteMe();
  568. _frintezzaDummy = null;
  569. }
  570. else if (event.equalsIgnoreCase("camera_9"))
  571. {
  572. _Zone.broadcastPacket(new SocialAction(demon2,1));
  573. _Zone.broadcastPacket(new SocialAction(demon3,1));
  574. startQuestTimer("camera_9b", 400, frintezza, null);
  575. }
  576. else if (event.equalsIgnoreCase("camera_9b"))
  577. {
  578. _Zone.broadcastPacket(new SocialAction(demon1,1));
  579. _Zone.broadcastPacket(new SocialAction(demon4,1));
  580.  
  581. for (L2Character pc : _Zone.getCharactersInside().values())
  582. {
  583. if (pc instanceof L2PcInstance)
  584. {
  585. if (pc.getX() < getXFix(174232))
  586. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 1000,0,0,1,0));
  587. else
  588. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 1000,0,0,1,0));
  589. }
  590. }
  591. startQuestTimer("camera_9c", 0, frintezza, null);
  592. }
  593. else if (event.equalsIgnoreCase("camera_9c"))
  594. {
  595. for (L2Character pc : _Zone.getCharactersInside().values())
  596. {
  597. if (pc instanceof L2PcInstance)
  598. {
  599. if (pc.getX() < getXFix(174232))
  600. pc.broadcastPacket(new SpecialCamera(_portraitDummy1.getObjectId(),1000, 118, 0, 0, 10000,0,0,1,0));
  601. else
  602. pc.broadcastPacket(new SpecialCamera(_portraitDummy3.getObjectId(),1000, 62, 0, 0, 10000,0,0,1,0));
  603. }
  604. }
  605. startQuestTimer("camera_10", 2000, frintezza, null);
  606. }
  607. else if (event.equalsIgnoreCase("camera_10"))
  608. {
  609. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 0, 0, 1000,0,0,1,0));
  610. startQuestTimer("camera_11", 0, frintezza, null);
  611. }
  612. else if (event.equalsIgnoreCase("camera_11"))
  613. {
  614. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),240, 90, 25, 5500, 10000,0,0,1,0));
  615. _Zone.broadcastPacket(new SocialAction(frintezza,3));
  616. _portraitDummy1.deleteMe();
  617. _portraitDummy3.deleteMe();
  618. _portraitDummy1 = null;
  619. _portraitDummy3 = null;
  620.  
  621. startQuestTimer("camera_12", 4500, frintezza, null);
  622. }
  623. else if (event.equalsIgnoreCase("camera_12"))
  624. {
  625. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000,0,0,1,0));
  626. startQuestTimer("camera_13", 700, frintezza, null);
  627. }
  628. else if (event.equalsIgnoreCase("camera_13"))
  629. {
  630. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 195, 35, 0, 10000,0,0,1,0));
  631. startQuestTimer("camera_14", 1300, frintezza, null);
  632. }
  633. else if (event.equalsIgnoreCase("camera_14"))
  634. {
  635. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),120, 180, 45, 1500, 10000,0,0,1,0));
  636. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  637. startQuestTimer("camera_16", 1500, frintezza, null);
  638. }
  639. else if (event.equalsIgnoreCase("camera_16"))
  640. {
  641. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),520, 135, 45, 8000, 10000,0,0,1,0));
  642. startQuestTimer("camera_17", 7500, frintezza, null);
  643. }
  644. else if (event.equalsIgnoreCase("camera_17"))
  645. {
  646. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),1500, 110, 25, 10000, 13000,0,0,1,0));
  647. startQuestTimer("camera_18", 9500, frintezza, null);
  648. }
  649. else if (event.equalsIgnoreCase("camera_18"))
  650. {
  651. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(),930, 160, -20, 0, 1000,0,0,1,0));
  652. startQuestTimer("camera_18b", 0, _overheadDummy, null);
  653. }
  654. else if (event.equalsIgnoreCase("camera_18b"))
  655. {
  656. _Zone.broadcastPacket(new SpecialCamera(_overheadDummy.getObjectId(), 600, 180, -25, 0, 10000,0,0,1,0));
  657. _Zone.broadcastPacket(new MagicSkillUse(_scarletDummy,_overheadDummy, 5004, 1, 5800, 0));
  658.  
  659. weakScarlet = (L2GrandBossInstance) addSpawn(29046, 174232, -88020, -5110, 16384, false, 0, true);
  660. weakScarlet.setIsInvul(true);
  661. weakScarlet.setIsImmobilized(true);
  662. weakScarlet.disableAllSkills();
  663. _Zone.updateKnownList(weakScarlet);
  664. activeScarlet = weakScarlet;
  665.  
  666. startQuestTimer("camera_19", 2400, _scarletDummy, null);
  667. startQuestTimer("camera_19b", 5000, _scarletDummy, null);
  668. }
  669. else if (event.equalsIgnoreCase("camera_19"))
  670. {
  671. weakScarlet.teleToLocation(getXFix(174232), getYFix(-88020), getZFix(-5110));
  672. }
  673. else if (event.equalsIgnoreCase("camera_19b"))
  674. {
  675. _Zone.broadcastPacket(new SpecialCamera(_scarletDummy.getObjectId(), 800, 180, 10, 1000, 10000,0,0,1,0));
  676. startQuestTimer("camera_20", 2100, _scarletDummy, null);
  677. }
  678. else if (event.equalsIgnoreCase("camera_20"))
  679. {
  680. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),300, 60, 8, 0, 10000,0,0,1,0));
  681. startQuestTimer("camera_21", 2000, weakScarlet, null);
  682. }
  683. else if (event.equalsIgnoreCase("camera_21"))
  684. {
  685. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),500, 90, 10, 3000, 5000,0,0,1,0));
  686. startQuestTimer("camera_22", 3000, weakScarlet, null);
  687. }
  688. else if (event.equalsIgnoreCase("camera_22"))
  689. {
  690. portrait2 = (L2MonsterInstance) addSpawn(29049, 175876, -88713, -5000, 28205,false,0);
  691. portrait2.setIsImmobilized(true);
  692. portrait2.disableAllSkills();
  693. _Zone.updateKnownList(portrait2);
  694.  
  695. portrait3 = (L2MonsterInstance) addSpawn(29049, 172608, -88702, -5000, 64817,false,0);
  696. portrait3.setIsImmobilized(true);
  697. portrait3.disableAllSkills();
  698. _Zone.updateKnownList(portrait3);
  699.  
  700. portrait1 = (L2MonsterInstance) addSpawn(29048, 175833, -87165, -5000, 35048,false,0);
  701. portrait1.setIsImmobilized(true);
  702. portrait1.disableAllSkills();
  703. _Zone.updateKnownList(portrait1);
  704.  
  705. portrait4 = (L2MonsterInstance) addSpawn(29048, 172634, -87165, -5000, 57730,false,0);
  706. portrait4.setIsImmobilized(true);
  707. portrait4.disableAllSkills();
  708. _Zone.updateKnownList(portrait4);
  709.  
  710. _overheadDummy.deleteMe();
  711. _scarletDummy.deleteMe();
  712. _overheadDummy = null;
  713. _scarletDummy = null;
  714.  
  715. startQuestTimer("camera_23", 2000, weakScarlet, null);
  716. startQuestTimer("start_pc", 2000, weakScarlet, null);
  717. startQuestTimer("loc_check", 60000, weakScarlet, null, true);
  718. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  719. startQuestTimer("skill01", 10000 + Rnd.get(10000), weakScarlet, null);
  720. }
  721. else if (event.equalsIgnoreCase("camera_23"))
  722. {
  723. demon1.setIsImmobilized(false);
  724. demon2.setIsImmobilized(false);
  725. demon3.setIsImmobilized(false);
  726. demon4.setIsImmobilized(false);
  727. demon1.enableAllSkills();
  728. demon2.enableAllSkills();
  729. demon3.enableAllSkills();
  730. demon4.enableAllSkills();
  731. portrait1.setIsImmobilized(false);
  732. portrait2.setIsImmobilized(false);
  733. portrait3.setIsImmobilized(false);
  734. portrait4.setIsImmobilized(false);
  735. portrait1.enableAllSkills();
  736. portrait2.enableAllSkills();
  737. portrait3.enableAllSkills();
  738. portrait4.enableAllSkills();
  739. weakScarlet.setIsInvul(false);
  740. weakScarlet.setIsImmobilized(false);
  741. weakScarlet.enableAllSkills();
  742. weakScarlet.setRunning();
  743.  
  744. startQuestTimer("spawn_minion", 20000, portrait1, null);
  745. startQuestTimer("spawn_minion", 20000, portrait2, null);
  746. startQuestTimer("spawn_minion", 20000, portrait3, null);
  747. startQuestTimer("spawn_minion", 20000, portrait4, null);
  748. }
  749. else if (event.equalsIgnoreCase("stop_pc"))
  750. {
  751. for (L2Character cha : _Zone.getCharactersInside().values())
  752. {
  753. cha.abortAttack();
  754. cha.abortCast();
  755. cha.disableAllSkills();
  756. cha.setTarget(null);
  757. cha.stopMove(null);
  758. cha.setIsImmobilized(true);
  759. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  760. }
  761. }
  762. else if (event.equalsIgnoreCase("stop_npc"))
  763. {
  764. _Heading = npc.getHeading();
  765. if (_Heading < 32768)
  766. _Angle = Math.abs(180 - (int)(_Heading / 182.044444444));
  767. else
  768. _Angle = Math.abs(540 - (int)(_Heading / 182.044444444));
  769. }
  770. else if (event.equalsIgnoreCase("start_pc"))
  771. {
  772. for (L2Character cha : _Zone.getCharactersInside().values())
  773. {
  774. if (cha != frintezza)
  775. {
  776. cha.enableAllSkills();
  777. cha.setIsImmobilized(false);
  778. }
  779. }
  780. }
  781. else if (event.equalsIgnoreCase("start_npc"))
  782. {
  783. npc.setRunning();
  784. npc.setIsInvul(false);
  785. }
  786. else if (event.equalsIgnoreCase("morph_end"))
  787. {
  788. _OnMorph = 0;
  789. }
  790. else if (event.equalsIgnoreCase("morph_01"))
  791. {
  792. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 2000, 15000,0,0,1,0));
  793. startQuestTimer("morph_02", 3000, weakScarlet, null);
  794. }
  795. else if (event.equalsIgnoreCase("morph_02"))
  796. {
  797. _Zone.broadcastPacket(new SocialAction(weakScarlet,1));
  798. weakScarlet.setRHandId(7903);
  799. startQuestTimer("morph_03", 4000, weakScarlet, null);
  800. }
  801. else if (event.equalsIgnoreCase("morph_03"))
  802. {
  803. startQuestTimer("morph_04", 1500, weakScarlet, null);
  804. }
  805. else if (event.equalsIgnoreCase("morph_04"))
  806. {
  807. _Zone.broadcastPacket(new SocialAction(weakScarlet,4));
  808. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  809. if (skill != null)
  810. skill.getEffects(weakScarlet, weakScarlet);
  811.  
  812. startQuestTimer("morph_end", 6000, weakScarlet, null);
  813. startQuestTimer("start_pc", 3000, weakScarlet, null);
  814. startQuestTimer("start_npc", 3000, weakScarlet, null);
  815. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  816. startQuestTimer("skill02", 10000 + Rnd.get(10000), weakScarlet, null);
  817. }
  818. else if (event.equalsIgnoreCase("morph_05a"))
  819. {
  820. _Zone.broadcastPacket(new SocialAction(frintezza,4));
  821. }
  822. else if (event.equalsIgnoreCase("morph_05"))
  823. {
  824. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 1000,0,0,1,0));
  825. startQuestTimer("morph_06", 0, frintezza, null);
  826. }
  827. else if (event.equalsIgnoreCase("morph_06"))
  828. {
  829. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),250, 120, 15, 0, 10000,0,0,1,0));
  830.  
  831. cancelQuestTimers("loc_check");
  832.  
  833. _Scarlet_x = weakScarlet.getX();
  834. _Scarlet_y = weakScarlet.getY();
  835. _Scarlet_z = weakScarlet.getZ();
  836. _Scarlet_h = weakScarlet.getHeading();
  837. weakScarlet.deleteMe();
  838. weakScarlet = null;
  839. activeScarlet = null;
  840. weakScarlet = (L2GrandBossInstance) addSpawn(29046, _Scarlet_x, _Scarlet_y, _Scarlet_z, _Scarlet_h, false,0);
  841. weakScarlet.setIsInvul(true);
  842. weakScarlet.setIsImmobilized(true);
  843. weakScarlet.disableAllSkills();
  844. weakScarlet.setRHandId(7903);
  845. _Zone.updateKnownList(weakScarlet);
  846.  
  847. startQuestTimer("morph_07", 7000, frintezza, null);
  848. }
  849. else if (event.equalsIgnoreCase("morph_07"))
  850. {
  851. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
  852. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),500, 70, 15, 3000, 10000,0,0,1,0));
  853. startQuestTimer("morph_08", 3000, frintezza, null);
  854. }
  855. else if (event.equalsIgnoreCase("morph_08"))
  856. {
  857. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),2500, 90, 12, 6000, 10000,0,0,1,0));
  858. startQuestTimer("morph_09", 3000, frintezza, null);
  859. }
  860. else if (event.equalsIgnoreCase("morph_09"))
  861. {
  862. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 1000,0,0,1,0));
  863. startQuestTimer("morph_10", 0, weakScarlet, null);
  864. }
  865. else if (event.equalsIgnoreCase("morph_10"))
  866. {
  867. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),250, _Angle, 12, 0, 10000,0,0,1,0));
  868. startQuestTimer("morph_11", 500, weakScarlet, null);
  869. }
  870. else if (event.equalsIgnoreCase("morph_11"))
  871. {
  872. weakScarlet.doDie(weakScarlet);
  873. _Zone.broadcastPacket(new SpecialCamera(weakScarlet.getObjectId(),450, _Angle, 14, 8000, 8000,0,0,1,0));
  874.  
  875. startQuestTimer("morph_12", 6250, weakScarlet, null);
  876. startQuestTimer("morph_13", 7200, weakScarlet, null);
  877. }
  878. else if (event.equalsIgnoreCase("morph_12"))
  879. {
  880. weakScarlet.deleteMe();
  881. weakScarlet = null;
  882. }
  883. else if (event.equalsIgnoreCase("morph_13"))
  884. {
  885. strongScarlet = (L2GrandBossInstance) addSpawn(SCARLET2, reverseXFix(_Scarlet_x), reverseYFix(_Scarlet_y), reverseZFix(_Scarlet_z), _Scarlet_h, false,0);
  886. strongScarlet.setIsInvul(true);
  887. strongScarlet.setIsImmobilized(true);
  888. strongScarlet.disableAllSkills();
  889. _Zone.updateKnownList(strongScarlet);
  890. activeScarlet = strongScarlet;
  891.  
  892. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),450, _Angle, 12, 500, 14000,0,0,1,0));
  893.  
  894. startQuestTimer("morph_14", 3000, strongScarlet, null);
  895. startQuestTimer("loc_check", 60000, strongScarlet, null, true);
  896. }
  897. else if (event.equalsIgnoreCase("morph_14"))
  898. {
  899. startQuestTimer("morph_15", 5100, strongScarlet, null);
  900. }
  901. else if (event.equalsIgnoreCase("morph_15"))
  902. {
  903. _Zone.broadcastPacket(new SocialAction(strongScarlet,2));
  904. L2Skill skill = SkillTable.getInstance().getInfo(5017, 1);
  905. if (skill != null)
  906. skill.getEffects(strongScarlet, strongScarlet);
  907.  
  908. startQuestTimer("morph_end", 9000, strongScarlet, null);
  909. startQuestTimer("start_pc", 6000, strongScarlet, null);
  910. startQuestTimer("start_npc", 6000, strongScarlet, null);
  911. startQuestTimer("songs_play", 10000 + Rnd.get(10000), frintezza, null);
  912. startQuestTimer("skill03", 10000 + Rnd.get(10000), strongScarlet, null);
  913. }
  914. else if (event.equalsIgnoreCase("morph_16"))
  915. {
  916. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),300, _Angle - 180 , 5, 0, 7000,0,0,1,0));
  917. startQuestTimer("morph_17", 0, strongScarlet, null);
  918. }
  919. else if (event.equalsIgnoreCase("morph_17"))
  920. {
  921. _Zone.broadcastPacket(new SpecialCamera(strongScarlet.getObjectId(),200, _Angle, 85, 4000, 10000,0,0,1,0));
  922. startQuestTimer("morph_17b", 7400, frintezza, null);
  923. startQuestTimer("morph_18", 7500, frintezza, null);
  924. }
  925. else if (event.equalsIgnoreCase("morph_17b"))
  926. {
  927. frintezza.doDie(frintezza);
  928. }
  929. else if (event.equalsIgnoreCase("morph_18"))
  930. {
  931. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 120, 5, 0, 7000,0,0,1,0));
  932. startQuestTimer("morph_19", 0, frintezza, null);
  933. }
  934. else if (event.equalsIgnoreCase("morph_19"))
  935. {
  936. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),100, 90, 5, 5000, 15000,0,0,1,0));
  937. startQuestTimer("morph_20", 7000, frintezza, null);
  938. startQuestTimer("spawn_cubes", 7000, frintezza, null);
  939. }
  940. else if (event.equalsIgnoreCase("morph_20"))
  941. {
  942. _Zone.broadcastPacket(new SpecialCamera(frintezza.getObjectId(),900, 90, 25, 7000, 10000,0,0,1,0));
  943. startQuestTimer("start_pc", 7000, frintezza, null);
  944. }
  945. else if (event.equalsIgnoreCase("songs_play"))
  946. {
  947. if (frintezza != null && !frintezza.isDead() && _OnMorph == 0)
  948. {
  949. _OnSong = Rnd.get(1, 5);
  950. if (_OnSong == 1 && _ThirdMorph == 1 && strongScarlet.getCurrentHp() < strongScarlet.getMaxHp() * 0.6 && Rnd.get(100) < 80)
  951. {
  952. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 1, 32000, 0));
  953. startQuestTimer("songs_effect", 5000, frintezza, null);
  954. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  955. }
  956. else if (_OnSong == 2 || _OnSong == 3)
  957. {
  958. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, _OnSong, 32000, 0));
  959. startQuestTimer("songs_effect", 5000, frintezza, null);
  960. startQuestTimer("songs_play", 32000 + Rnd.get(10000), frintezza, null);
  961. }
  962. else if (_OnSong == 4 && _SecondMorph == 1)
  963. {
  964. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 4, 31000, 0));
  965. startQuestTimer("songs_effect", 5000, frintezza, null);
  966. startQuestTimer("songs_play", 31000 + Rnd.get(10000), frintezza, null);
  967. }
  968. else if (_OnSong == 5 && _ThirdMorph == 1 && _Abnormal == 0)
  969. {
  970. _Abnormal = 1;
  971. _Zone.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5007, 5, 35000, 0));
  972. startQuestTimer("songs_effect", 5000, frintezza, null);
  973. startQuestTimer("songs_play", 35000 + Rnd.get(10000), frintezza, null);
  974. }
  975. else
  976. startQuestTimer("songs_play", 5000 + Rnd.get(5000), frintezza, null);
  977. }
  978. }
  979. else if (event.equalsIgnoreCase("songs_effect"))
  980. {
  981. L2Skill skill = SkillTable.getInstance().getInfo(5008, _OnSong);
  982. if (skill == null)
  983. return null;
  984.  
  985. if (_OnSong == 1 || _OnSong == 2 || _OnSong == 3)
  986. {
  987. if (frintezza != null && !frintezza.isDead() && activeScarlet != null && !activeScarlet.isDead())
  988. skill.getEffects(frintezza, activeScarlet);
  989. }
  990. else if (_OnSong == 4)
  991. {
  992. for (L2Character cha : _Zone.getCharactersInside().values())
  993. {
  994. if (cha instanceof L2PcInstance && Rnd.get(100) < 80)
  995. {
  996. skill.getEffects(frintezza, cha);
  997. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 4));
  998. }
  999. }
  1000. }
  1001. else if (_OnSong == 5)
  1002. {
  1003. for (L2Character cha : _Zone.getCharactersInside().values())
  1004. {
  1005. if (cha instanceof L2PcInstance && Rnd.get(100) < 70)
  1006. {
  1007. cha.abortAttack();
  1008. cha.abortCast();
  1009. cha.disableAllSkills();
  1010. cha.stopMove(null);
  1011. cha.setIsParalyzed(true);
  1012. cha.setIsImmobilized(true);
  1013. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1014. skill.getEffects(frintezza, cha);
  1015. cha.startAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1016. cha.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT).addSkillName(5008, 5));
  1017. }
  1018. }
  1019. startQuestTimer("stop_effect", 25000, frintezza, null);
  1020. }
  1021. }
  1022. else if (event.equalsIgnoreCase("stop_effect"))
  1023. {
  1024. for (L2Character cha : _Zone.getCharactersInside().values())
  1025. {
  1026. if (cha instanceof L2PcInstance)
  1027. {
  1028. cha.stopAbnormalEffect(AbnormalEffect.DANCE_STUNNED);
  1029. cha.stopAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1030. cha.enableAllSkills();
  1031. cha.setIsImmobilized(false);
  1032. cha.setIsParalyzed(false);
  1033. }
  1034. }
  1035. _Abnormal = 0;
  1036. }
  1037. else if (event.equalsIgnoreCase("attack_stop"))
  1038. {
  1039. cancelQuestTimers("skill01");
  1040. cancelQuestTimers("skill02");
  1041. cancelQuestTimers("skill03");
  1042. cancelQuestTimers("songs_play");
  1043. cancelQuestTimers("songs_effect");
  1044.  
  1045. if (frintezza != null)
  1046. _Zone.broadcastPacket(new MagicSkillCanceld(frintezza.getObjectId()));
  1047. }
  1048. else if (event.equalsIgnoreCase("check_hp"))
  1049. {
  1050. if (npc.isDead())
  1051. {
  1052. _OnMorph = 1;
  1053. _Zone.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
  1054.  
  1055. startQuestTimer("attack_stop", 0, frintezza, null);
  1056. startQuestTimer("stop_pc", 0, npc, null);
  1057. startQuestTimer("stop_npc", 0, npc, null);
  1058. startQuestTimer("morph_16", 0, npc, null);
  1059. }
  1060. else
  1061. {
  1062. _CheckDie = _CheckDie + 10;
  1063. if (_CheckDie < 3000)
  1064. startQuestTimer("check_hp", 10, npc, null);
  1065. else
  1066. {
  1067. _OnCheck = 0;
  1068. _CheckDie = 0;
  1069. }
  1070. }
  1071. }
  1072. else if (event.equalsIgnoreCase("skill01"))
  1073. {
  1074. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0)
  1075. {
  1076. int i = Rnd.get(0,1);
  1077. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1078. if (skill != null)
  1079. {
  1080. weakScarlet.stopMove(null);
  1081. weakScarlet.setIsCastingNow(true);
  1082. weakScarlet.doCast(skill);
  1083. }
  1084. startQuestTimer("skill01", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1085. }
  1086. }
  1087. else if (event.equalsIgnoreCase("skill02"))
  1088. {
  1089. if (weakScarlet != null && !weakScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0)
  1090. {
  1091. int i = 0;
  1092. if (_Abnormal == 0)
  1093. i = Rnd.get(2,5);
  1094. else
  1095. i = Rnd.get(2,4);
  1096.  
  1097. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1098. if (skill != null)
  1099. {
  1100. weakScarlet.stopMove(null);
  1101. weakScarlet.setIsCastingNow(true);
  1102. weakScarlet.doCast(skill);
  1103. }
  1104. startQuestTimer("skill02", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1105.  
  1106. if (i == 5)
  1107. {
  1108. _Abnormal = 1;
  1109. startQuestTimer("float_effect", 4000, weakScarlet, null);
  1110. }
  1111. }
  1112. }
  1113. else if (event.equalsIgnoreCase("skill03"))
  1114. {
  1115. if (strongScarlet != null && !strongScarlet.isDead() && _SecondMorph == 1 && _ThirdMorph == 1 && _OnMorph == 0)
  1116. {
  1117. int i = 0;
  1118. if (_Abnormal == 0)
  1119. i = Rnd.get(6,10);
  1120. else
  1121. i = Rnd.get(6,9);
  1122.  
  1123. L2Skill skill = SkillTable.getInstance().getInfo(_skill[i][0],_skill[i][1]);
  1124. if (skill != null)
  1125. {
  1126. strongScarlet.stopMove(null);
  1127. strongScarlet.setIsCastingNow(true);
  1128. strongScarlet.doCast(skill);
  1129. }
  1130. startQuestTimer("skill03", _skill[i][2] + 5000 + Rnd.get(10000), npc, null);
  1131.  
  1132. if (i == 10)
  1133. {
  1134. _Abnormal = 1;
  1135. startQuestTimer("float_effect", 3000, npc, null);
  1136. }
  1137. }
  1138. }
  1139. else if (event.equalsIgnoreCase("float_effect"))
  1140. {
  1141. if (npc.isCastingNow())
  1142. {
  1143. startQuestTimer("float_effect", 500, npc, null);
  1144. }
  1145. else
  1146. {
  1147. for (L2Character cha : _Zone.getCharactersInside().values())
  1148. {
  1149. if (cha instanceof L2PcInstance)
  1150. {
  1151. if (cha.getFirstEffect(5016) != null)
  1152. {
  1153. cha.abortAttack();
  1154. cha.abortCast();
  1155. cha.disableAllSkills();
  1156. cha.stopMove(null);
  1157. cha.setIsParalyzed(true);
  1158. cha.setIsImmobilized(true);
  1159. cha.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  1160. cha.startAbnormalEffect(AbnormalEffect.FLOATING_ROOT);
  1161. }
  1162. }
  1163. }
  1164. startQuestTimer("stop_effect", 25000, npc, null);
  1165. }
  1166. }
  1167. else if (event.equalsIgnoreCase("action"))
  1168. {
  1169. _Zone.broadcastPacket(new SocialAction(npc,1));
  1170. }
  1171. else if (event.equalsIgnoreCase("bomber"))
  1172. {
  1173. _Bomber = 0;
  1174. }
  1175. else if (event.equalsIgnoreCase("room_final"))
  1176. {
  1177. _Zone.broadcastPacket(new NpcSay(npc.getObjectId(),1,npc.getNpcId(),"Exceeded his time limit, challenge failed!"));
  1178. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1179. playerInsideTezza.setInstanceId(0);
  1180. _Zone.oustAllPlayers();
  1181.  
  1182. cancelQuestTimers("waiting");
  1183. cancelQuestTimers("frintezza_despawn");
  1184. startQuestTimer("clean", 1000, npc, null);
  1185. startQuestTimer("close", 1000, npc, null);
  1186. startQuestTimer("room1_del", 1000, npc, null);
  1187. startQuestTimer("room2_del", 1000, npc, null);
  1188. startQuestTimer("destroy_instance", 30000, npc, null);
  1189. }
  1190. else if (event.equalsIgnoreCase("all_dead_frintezza_despawn"))
  1191. {
  1192. temp = (System.currentTimeMillis() - _LastAction);
  1193. if (temp > 30000)
  1194. {
  1195. //Maybe they ressed?
  1196. for(L2PcInstance temps : _PlayersInside)
  1197. {
  1198. if(!temps.isDead())
  1199. {
  1200. _log.log(Level.INFO, "Frintezza Manager: Someone is still alive, cancelling instance deletion.");
  1201. cancelQuestTimers("all_dead_frintezza_despawn");
  1202. return "";
  1203. }
  1204. }
  1205. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1206. playerInsideTezza.setInstanceId(0);
  1207.  
  1208. _Zone.oustAllPlayers();
  1209. cancelQuestTimers("all_dead_frintezza_despawn");
  1210. cancelQuestTimers("waiting");
  1211. cancelQuestTimers("loc_check");
  1212. cancelQuestTimers("room_final");
  1213. cancelQuestTimers("spawn_minion");
  1214. startQuestTimer("clean", 1000, npc, null);
  1215. startQuestTimer("close", 1000, npc, null);
  1216. startQuestTimer("attack_stop", 1000, npc, null);
  1217. startQuestTimer("room1_del", 1000, npc, null);
  1218. startQuestTimer("room2_del", 1000, npc, null);
  1219. startQuestTimer("room3_del", 1000, npc, null);
  1220. startQuestTimer("minions_despawn", 1000, npc, null);
  1221. startQuestTimer("destroy_instance", 30000, npc, null);
  1222.  
  1223. }
  1224. }
  1225. else if (event.equalsIgnoreCase("frintezza_despawn"))
  1226. {
  1227. temp = (System.currentTimeMillis() - _LastAction);
  1228. if (temp > 900000)
  1229. {
  1230. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1231. playerInsideTezza.setInstanceId(0);
  1232.  
  1233. _Zone.oustAllPlayers();
  1234.  
  1235. cancelQuestTimers("frintezza_despawn");
  1236. cancelQuestTimers("waiting");
  1237. cancelQuestTimers("loc_check");
  1238. cancelQuestTimers("room_final");
  1239. cancelQuestTimers("spawn_minion");
  1240. startQuestTimer("clean", 1000, npc, null);
  1241. startQuestTimer("close", 1000, npc, null);
  1242. startQuestTimer("attack_stop", 1000, npc, null);
  1243. startQuestTimer("room1_del", 1000, npc, null);
  1244. startQuestTimer("room2_del", 1000, npc, null);
  1245. startQuestTimer("room3_del", 1000, npc, null);
  1246. startQuestTimer("minions_despawn", 1000, npc, null);
  1247. startQuestTimer("destroy_instance", 30000, npc, null);
  1248. }
  1249. }
  1250. else if (event.equalsIgnoreCase("minions_despawn"))
  1251. {
  1252. for (int i = 0; i < Minions.size(); i++)
  1253. {
  1254. L2Attackable mob = Minions.get(i);
  1255. if (mob != null)
  1256. mob.decayMe();
  1257. }
  1258. Minions.clear();
  1259. }
  1260. else if (event.equalsIgnoreCase("spawn_minion"))
  1261. {
  1262. if (npc != null && !npc.isDead() && frintezza != null && !frintezza.isDead())
  1263. {
  1264. L2Attackable mob = (L2Attackable)addSpawn(npc.getNpcId()+2,npc.getX(),npc.getY(),npc.getZ(),npc.getHeading(),false,0);
  1265. if(mob != null)
  1266. {
  1267. mob.setIsRaidMinion(true);
  1268. Minions.add(mob);
  1269.  
  1270. startQuestTimer("action", 200, mob, null);
  1271. startQuestTimer("spawn_minion", 18000, npc, null);
  1272. }
  1273. }
  1274. }
  1275. else if (event.equalsIgnoreCase("spawn_cubes"))
  1276. {
  1277. addSpawn(CUBE,174232,-88020,-5114,16384,false,900000);
  1278. startQuestTimer("frintezza_despawn", 60000, null, null, true);
  1279. }
  1280. else if (event.equalsIgnoreCase("remove_players"))
  1281. {
  1282. for(L2PcInstance playerInsideTezza : _PlayersInside)
  1283. playerInsideTezza.setInstanceId(0);
  1284. _Zone.oustAllPlayers();
  1285.  
  1286. }else if (event.equalsIgnoreCase("destroy_instance"))
  1287. {
  1288. InstanceManager.getInstance().destroyInstance(currentInstanceID);
  1289.  
  1290. for(String timer : _TimerControl)
  1291. if(timer != null)
  1292. cancelQuestTimers(timer);
  1293. _TimerControl.clear();
  1294.  
  1295. _log.log(Level.INFO, "Frintezza Manager: Frintezza's instance is opened.");
  1296. CurrentStatus = DORMANT;
  1297. }
  1298.  
  1299. return super.onAdvEvent(event, npc, player);
  1300. }
  1301.  
  1302. @Override
  1303. public String onTalk (L2Npc npc, L2PcInstance player)
  1304. {
  1305. if (npc.getNpcId() == CUBE)
  1306. {
  1307. int x = 150037 + Rnd.get(500);
  1308. int y = -57720 + Rnd.get(500);
  1309. player.setInstanceId(0);
  1310. player.teleToLocation(x, y, -2976);
  1311. _PlayersInside.remove(player);
  1312.  
  1313. if(_PlayersInside.isEmpty())
  1314. startQuestTimer("destroy_instance", 30000, npc, null);
  1315.  
  1316. return null;
  1317. }
  1318.  
  1319. if(CurrentStatus != DORMANT)
  1320. return "<html><body>Someone is already inside instance. Try again later.</body></html>";
  1321.  
  1322. st = player.getQuestState(getName());
  1323.  
  1324. if (player.getParty() == null || player.getParty().getCommandChannel() == null || player.getParty().getCommandChannel().getChannelLeader() != player)
  1325. return "<html><body>I speak only with command channel leader.</body></html>";
  1326.  
  1327. if (player.getParty().getCommandChannel().getMemberCount() < 36 || player.getParty().getCommandChannel().getMemberCount() > 45)
  1328. return "<html><body>Your command channel have incorrect size. You need between 36 and 45 players.</body></html>";
  1329.  
  1330. if (player.getInventory().getItemByItemId(8073) == null)
  1331. return "<html><body>You dont have required item.</body></html>";
  1332.  
  1333. L2CommandChannel CC = player.getParty().getCommandChannel();
  1334. for (L2Party _party : CC.getPartys())
  1335. {
  1336. if (_party == null)
  1337. continue;
  1338. for (L2PcInstance _member : _party.getPartyMembers())
  1339. {
  1340. if (_member == null)
  1341. continue;
  1342.  
  1343. if (_member.getLevel() < 80)
  1344. return "<html><body>Player " + _member.getName() + " have too low level. Minimum level required is 80.</body></html>";
  1345. if (!Util.checkIfInRange(1000, player, _member, false))
  1346. return "<html><body>" + _member.getName() + " is not near NPC.</body></html>";
  1347.  
  1348. Long reentertime = InstanceManager.getInstance().getInstanceTime(_member.getObjectId(), INSTANCEID);
  1349. if (System.currentTimeMillis() < reentertime)
  1350. {
  1351. return "<html><body>" + _member.getName() + " may not reenter yet.</body></html>";
  1352. }
  1353.  
  1354. }
  1355. }
  1356. ClearVariables();
  1357. currentInstanceID = InstanceManager.getInstance().createDynamicInstance("Frintezza.xml");
  1358.  
  1359. player.destroyItemByItemId("Quest", 8073, 1, player, true);
  1360. CurrentStatus = WAITING;
  1361.  
  1362. startQuestTimer("close", 0, npc, null);
  1363. startQuestTimer("room1_spawn", 5000, npc, null);
  1364. startQuestTimer("room_final", 2100000, npc, null);
  1365. startQuestTimer("frintezza_despawn", 60000, npc, null, true);
  1366.  
  1367. _LastAction = System.currentTimeMillis();
  1368. for (L2Party party : CC.getPartys())
  1369. {
  1370. if (party == null)
  1371. continue;
  1372. for (L2PcInstance member : party.getPartyMembers())
  1373. {
  1374. _PlayersInside.add(member);
  1375. _Zone.allowPlayerEntry(member, 300);
  1376. member.addNotifyQuestOfDeath(st);
  1377. member.setInstanceId(currentInstanceID);
  1378. member.teleToLocation(getXFix(_invadeLoc[_LocCycle][0]) + Rnd.get(50), getYFix(_invadeLoc[_LocCycle][1]) + Rnd.get(50), getZFix(_invadeLoc[_LocCycle][2]));
  1379. }
  1380. _LocCycle++;
  1381. if (_LocCycle >= 6)
  1382. _LocCycle = 1;
  1383. }
  1384.  
  1385. setInstanceTimeRestrictions();
  1386. _log.log(Level.INFO, "Frintezza Manager: Frintezza's instance with ID "+currentInstanceID+" has been created by player "+player.getName());
  1387. return "";
  1388. }
  1389.  
  1390. private void ClearVariables()
  1391. {
  1392. _PlayersInside.clear();
  1393. _TimerControl.clear();
  1394. _KillHallAlarmDevice = 0;
  1395. _KillDarkChoirPlayer = 0;
  1396. _KillDarkChoirCaptain = 0;
  1397. currentInstanceID = 0;
  1398. _LastAction = 0;
  1399. _LocCycle = 0;
  1400. _CheckDie = 0;
  1401. _OnCheck = 0;
  1402. _Abnormal = 0;
  1403. _OnMorph = 0;
  1404. _SecondMorph = 0;
  1405. _ThirdMorph = 0;
  1406. }
  1407.  
  1408. @Override
  1409. public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet)
  1410. {
  1411. _LastAction = System.currentTimeMillis();
  1412. if (npc.getNpcId() == FRINTEZZA)
  1413. {
  1414. npc.setCurrentHpMp(npc.getMaxHp(), 0);
  1415. return null;
  1416. }
  1417. if (npc.getNpcId() == SCARLET1 && _SecondMorph == 0 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.75 && CurrentStatus == FIGHTING)
  1418. {
  1419. startQuestTimer("attack_stop", 0, frintezza, null);
  1420.  
  1421. _SecondMorph = 1;
  1422. _OnMorph = 1;
  1423.  
  1424. startQuestTimer("stop_pc", 1000, npc, null);
  1425. startQuestTimer("stop_npc", 1000, npc, null);
  1426. startQuestTimer("morph_01", 1100, npc, null);
  1427. }
  1428. else if (npc.getNpcId() == SCARLET1 && _SecondMorph == 1 && _ThirdMorph == 0 && _OnMorph == 0 && npc.getCurrentHp() < npc.getMaxHp() * 0.5 && CurrentStatus == FIGHTING)
  1429. {
  1430. startQuestTimer("attack_stop", 0, frintezza, null);
  1431.  
  1432. _ThirdMorph = 1;
  1433. _OnMorph = 1;
  1434.  
  1435. startQuestTimer("stop_pc", 2000, npc, null);
  1436. startQuestTimer("stop_npc", 2000, npc, null);
  1437. startQuestTimer("morph_05a", 2000, npc, null);
  1438. startQuestTimer("morph_05", 2100, npc, null);
  1439. }
  1440. else if (npc.getNpcId() == SCARLET2 && _SecondMorph == 1 && _ThirdMorph == 1 && _OnCheck == 0 && damage >= npc.getCurrentHp() && CurrentStatus == FIGHTING)
  1441. {
  1442. _OnCheck = 1;
  1443. startQuestTimer("check_hp", 0, npc, null);
  1444. }
  1445. else if ((npc.getNpcId() == 29050 || npc.getNpcId() == 29051) && _Bomber == 0)
  1446. {
  1447. if (npc.getCurrentHp() < npc.getMaxHp() * 0.1)
  1448. {
  1449. if (Rnd.get(100) < 30)
  1450. {
  1451. _Bomber = 1;
  1452. startQuestTimer("bomber", 3000, npc, null);
  1453.  
  1454. L2Skill skill = SkillTable.getInstance().getInfo(5011,1);
  1455. if (skill != null)
  1456. {
  1457. npc.setIsCastingNow(true);
  1458. npc.doCast(skill);
  1459. }
  1460. }
  1461. }
  1462. }
  1463.  
  1464. return super.onAttack(npc, attacker, damage, isPet);
  1465. }
  1466.  
  1467. @Override
  1468. public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet)
  1469. {
  1470. if (npc.getNpcId() == FRINTEZZA)
  1471. {
  1472. return null;
  1473. }
  1474. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 0 && CurrentStatus == FIGHTING)
  1475. {
  1476. _OnCheck = 1;
  1477. startQuestTimer("stop_pc", 0, npc, null);
  1478. startQuestTimer("stop_npc", 0, npc, null);
  1479. startQuestTimer("morph_16", 0, npc, null);
  1480. }
  1481. else if (npc.getNpcId() == SCARLET2 && _OnCheck == 1 && CurrentStatus == FIGHTING)
  1482. {
  1483. cancelQuestTimers("loc_check");
  1484. cancelQuestTimers("spawn_minion");
  1485. cancelQuestTimers("frintezza_despawn");
  1486. startQuestTimer("clean", 30000, npc, null);
  1487. startQuestTimer("close", 30000, npc, null);
  1488. startQuestTimer("room3_del", 60000, npc, null);
  1489. startQuestTimer("minions_despawn", 60000, npc, null);
  1490. startQuestTimer("remove_players", 900000, npc, null);
  1491. startQuestTimer("destroy_instance", 900001, npc, null);
  1492. }
  1493. else if (npc.getNpcId() == 18328)
  1494. {
  1495. _KillHallAlarmDevice++;
  1496. if (_KillHallAlarmDevice == 4)
  1497. {
  1498. startQuestTimer("room1_del", 100, npc, null);
  1499. startQuestTimer("room2_spawn", 100, npc, null);
  1500.  
  1501. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).openMe();
  1502. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).openMe();
  1503. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1504. // InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1505. for (int i = 17130051; i <= 17130058; i++)
  1506. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1507. }
  1508. }
  1509. else if (npc.getNpcId() == 18339)
  1510. {
  1511. _KillDarkChoirPlayer ++;
  1512. if (_KillDarkChoirPlayer == 2)
  1513. {
  1514. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130042).closeMe();
  1515. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130043).closeMe();
  1516. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).closeMe();
  1517. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).closeMe();
  1518. int outside = 0;
  1519. for (L2PcInstance room2_pc : _PlayersInside)
  1520. {
  1521. if (_Zone.isInsideZone(room2_pc) && room2_pc.getY() > getYFix(-86130))
  1522. outside++;
  1523. }
  1524. if (outside == 0)
  1525. {
  1526. startQuestTimer("room2_del", 100, npc, null);
  1527. startQuestTimer("waiting", 180000, npc, null);
  1528. cancelQuestTimers("room_final");
  1529. }
  1530. else
  1531. {
  1532. for (int i = 17130061; i <= 17130070; i++)
  1533. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(i).openMe();
  1534.  
  1535. startQuestTimer("room2_spawn2", 1000, npc, null);
  1536. }
  1537. }
  1538. }
  1539. else if (npc.getNpcId() == 18334)
  1540. {
  1541. _KillDarkChoirCaptain ++;
  1542. if (_KillDarkChoirCaptain == 8)
  1543. {
  1544. startQuestTimer("room2_del", 100, npc, null);
  1545.  
  1546. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130045).openMe();
  1547. InstanceManager.getInstance().getInstance(currentInstanceID).getDoor(17130046).openMe();
  1548.  
  1549. startQuestTimer("waiting", 180000, npc, null);
  1550. cancelQuestTimers("room_final");
  1551. }
  1552. }
  1553.  
  1554. return super.onKill(npc,killer,isPet);
  1555. }
  1556.  
  1557. @Override
  1558. public String onDeath(L2Character killer, L2Character victim, QuestState qs)
  1559. {
  1560. for(L2PcInstance player : _PlayersInside)
  1561. {
  1562. if(player.getInstanceId() != currentInstanceID)
  1563. {
  1564. player.removeNotifyQuestOfDeath(st);
  1565. _PlayersInside.remove(player);
  1566. continue;
  1567. }
  1568. if(!player.isDead())
  1569. return "";
  1570. }
  1571. _log.log(Level.INFO, "Frintezza Manager: Everyone inside Frintezza are dead. Closing instance in 30s.");
  1572. startQuestTimer("all_dead_frintezza_despawn", 1000, null, null, true);
  1573. return super.onDeath(killer, victim, qs);
  1574. }
  1575.  
  1576.  
  1577.  
  1578. /**
  1579. * Override spawn method to correct spawn cords after lair move<BR>
  1580. * TODO: Update cords in script, im just lazy :)
  1581. */
  1582. @Override
  1583. public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
  1584. {
  1585.  
  1586. // cords fix:
  1587. return super.addSpawn(npcId, getXFix(x), getYFix(y), getZFix(z), heading, randomOffset, despawnDelay, isSummonSpawn, currentInstanceID);
  1588. }
  1589.  
  1590.  
  1591. public int getXFix(int x)
  1592. {
  1593. return x - 262016;
  1594. }
  1595. public int getYFix(int y)
  1596. {
  1597. return y - 65278;
  1598. }
  1599. public int getZFix(int z)
  1600. {
  1601. return z - 4065;
  1602. }
  1603.  
  1604. public int reverseXFix(int x)
  1605. {
  1606. return x + 262016;
  1607. }
  1608. public int reverseYFix(int y)
  1609. {
  1610. return y + 65278;
  1611. }
  1612. public int reverseZFix(int z)
  1613. {
  1614. return z + 4065;
  1615. }
  1616.  
  1617. protected void setInstanceTimeRestrictions()
  1618. {
  1619. Calendar reenter = Calendar.getInstance();
  1620. reenter.set(Calendar.MINUTE, RESET_MIN);
  1621. reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
  1622. // if time is >= RESET_HOUR - roll to the next day
  1623. if (reenter.getTimeInMillis() <= System.currentTimeMillis())
  1624. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1625. if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
  1626. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
  1627. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1628. else
  1629. while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
  1630. reenter.add(Calendar.DAY_OF_MONTH, 1);
  1631.  
  1632. // set instance reenter time for all allowed players
  1633. for (L2PcInstance playerInside : _PlayersInside)
  1634. InstanceManager.getInstance().setInstanceTime(playerInside.getObjectId(), INSTANCEID, reenter.getTimeInMillis());
  1635. }
  1636.  
  1637. @Override
  1638. public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player)
  1639. {
  1640. _TimerControl.add(name);
  1641. super.startQuestTimer(name, time, npc, player);
  1642. }
  1643.  
  1644. @Override
  1645. public void startQuestTimer(String name, long time, L2Npc npc, L2PcInstance player, boolean repeating)
  1646. {
  1647. _TimerControl.add(name);
  1648. super.startQuestTimer(name, time, npc, player, repeating);
  1649. }
  1650.  
  1651. @Override
  1652. public void cancelQuestTimers(String name)
  1653. {
  1654. _TimerControl.remove(name);
  1655. super.cancelQuestTimers(name);
  1656. }
  1657.  
  1658. public static void main(String[] args)
  1659. {
  1660. // now call the constructor (starts up the ai)
  1661. new Frintezza(-1,"Frintezza","ai");
  1662. }
  1663. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement