Advertisement
Sarada-L2

zaken

Dec 12th, 2020
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.62 KB | None | 0 0
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2, or (at your option)
  5. * any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. * 02111-1307, USA.
  16. *
  17. * http://www.gnu.org/copyleft/gpl.html
  18. */
  19. package net.sf.l2j.gameserver.scripting.scripts.ai.individual;
  20.  
  21. import java.util.logging.Logger;
  22.  
  23. import net.sf.l2j.commons.concurrent.ThreadPool;
  24. import net.sf.l2j.commons.random.Rnd;
  25.  
  26. import net.sf.l2j.Config;
  27. import net.sf.l2j.gameserver.data.DoorTable;
  28. import net.sf.l2j.gameserver.data.SkillTable;
  29. import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
  30. import net.sf.l2j.gameserver.instancemanager.ZoneManager;
  31. import net.sf.l2j.gameserver.model.L2Effect;
  32. import net.sf.l2j.gameserver.model.L2Skill;
  33. import net.sf.l2j.gameserver.model.WorldObject;
  34. import net.sf.l2j.gameserver.model.actor.Attackable;
  35. import net.sf.l2j.gameserver.model.actor.Creature;
  36. import net.sf.l2j.gameserver.model.actor.Npc;
  37. import net.sf.l2j.gameserver.model.actor.ai.CtrlIntention;
  38. import net.sf.l2j.gameserver.model.actor.instance.GrandBoss;
  39. import net.sf.l2j.gameserver.model.actor.instance.Player;
  40. import net.sf.l2j.gameserver.model.zone.type.L2BossZone;
  41. import net.sf.l2j.gameserver.network.serverpackets.PlaySound;
  42. import net.sf.l2j.gameserver.scripting.EventType;
  43. import net.sf.l2j.gameserver.scripting.scripts.ai.L2AttackableAIScript;
  44. import net.sf.l2j.gameserver.taskmanager.GameTimeTaskManager;
  45. import net.sf.l2j.gameserver.templates.StatsSet;
  46. import net.sf.l2j.gameserver.util.Broadcast;
  47.  
  48. public class Zaken extends L2AttackableAIScript
  49. {
  50. protected static final Logger log = Logger.getLogger(Zaken.class.getName());
  51. private static final L2BossZone _zakenLair = ZoneManager.getInstance().getZoneById(110000, L2BossZone.class);
  52. private int _1001 = 0;
  53. private int _ai0 = 0;
  54. private int _ai1 = 0;
  55. private int _ai2 = 0;
  56. private int _ai3 = 0;
  57. private int _ai4 = 0;
  58. private int _quest0 = 0;
  59. private int _quest1 = 0;
  60. private int _quest2 = 0;
  61. private Player c_quest0 = null;
  62. private Player c_quest1 = null;
  63. private Player c_quest2 = null;
  64. private Player c_quest3 = null;
  65. private Player c_quest4 = null;
  66. private static final int ZAKEN = 29022;
  67. private static final int doll_blader_b = 29023;
  68. private static final int vale_master_b = 29024;
  69. private static final int pirates_zombie_captain_b = 29026;
  70. private static final int pirates_zombie_b = 29027;
  71. private static final int[] Xcoords =
  72. {
  73. 53950,
  74. 55980,
  75. 54950,
  76. 55970,
  77. 53930,
  78. 55970,
  79. 55980,
  80. 54960,
  81. 53950,
  82. 53930,
  83. 55970,
  84. 55980,
  85. 54960,
  86. 53950,
  87. 53930
  88. };
  89. private static final int[] Ycoords =
  90. {
  91. 219860,
  92. 219820,
  93. 218790,
  94. 217770,
  95. 217760,
  96. 217770,
  97. 219920,
  98. 218790,
  99. 219860,
  100. 217760,
  101. 217770,
  102. 219920,
  103. 218790,
  104. 219860,
  105. 217760
  106. };
  107. private static final int[] Zcoords =
  108. {
  109. -3488,
  110. -3488,
  111. -3488,
  112. -3488,
  113. -3488,
  114. -3216,
  115. -3216,
  116. -3216,
  117. -3216,
  118. -3216,
  119. -2944,
  120. -2944,
  121. -2944,
  122. -2944,
  123. -2944
  124. };
  125. private static final byte ALIVE = 0;
  126. private static final byte DEAD = 1;
  127.  
  128. public Zaken()
  129. {
  130. super("ai/individual");
  131. ThreadPool.scheduleAtFixedRate(new Runnable()
  132. {
  133. @Override
  134. public void run()
  135. {
  136. try
  137. {
  138. int time = GameTimeTaskManager.getInstance().getGameTime();
  139. int hour = (time / 60) % 24;
  140. if (hour == Config.ZAKEN_ENABLE_DOOR)
  141. {
  142. _log.info("Zaken door id 21240006 opened, game time 00.00.");
  143.  
  144. DoorTable.getInstance().getDoor(21240006).openMe();
  145. Broadcast.gameAnnounceToOnlinePlayers("Devil's Isle door is now opened for 2 minutes!");
  146. ThreadPool.schedule(new Runnable()
  147. {
  148. @Override
  149. public void run()
  150. {
  151. try
  152. {
  153. Broadcast.gameAnnounceToOnlinePlayers("Devil's Isle door is now closed!");
  154. DoorTable.getInstance().getDoor(21240006).closeMe();
  155. }
  156. catch (Throwable e)
  157. {
  158. log.warning("Cannot close door ID: 21240006 " + e);
  159. }
  160. }
  161. }, 300000L);
  162. }
  163. }
  164. catch (Throwable e)
  165. {
  166. log.warning("Cannot open door ID: 21240006 " + e);
  167. }
  168. }
  169. }, 2000L, 600000L);
  170. StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
  171. int status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
  172. if (status == DEAD)
  173. {
  174. long temp = info.getLong("respawn_time") - System.currentTimeMillis();
  175. if (temp > 0)
  176. {
  177. startQuestTimer("zaken_unlock", temp, null, null, false);
  178. }
  179. else
  180. {
  181. final GrandBoss zaken = (GrandBoss) addSpawn(ZAKEN, 55276, 219176, -3227, 0, false, 0,false);
  182. GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
  183. spawnBoss(zaken);
  184. if (Config.ANNOUNCE_BOSS_ALIVE)
  185. {
  186. Broadcast.gameAnnounceToOnlinePlayers("Epic Boss: " + zaken.getName() + " spawned in world.");
  187. }
  188. }
  189. }
  190. else
  191. {
  192. info.getInteger("loc_x");
  193. info.getInteger("loc_y");
  194. info.getInteger("loc_z");
  195. info.getInteger("heading");
  196. int hp = info.getInteger("currentHP");
  197. int mp = info.getInteger("currentMP");
  198. final GrandBoss zaken = (GrandBoss) addSpawn(ZAKEN, 55276, 219176, -3227, 0, false, 0,false);
  199. zaken.setCurrentHpMp(hp, mp);
  200. zaken.setCurrentHp(zaken.getMaxHp());
  201. zaken.setCurrentMp(zaken.getMaxMp());
  202. spawnBoss(zaken);
  203. if (Config.ANNOUNCE_BOSS_ALIVE)
  204. {
  205. Broadcast.gameAnnounceToOnlinePlayers("Epic Boss: " + zaken.getName() + " spawned in world.");
  206. }
  207. }
  208. }
  209.  
  210. @Override
  211. protected void registerNpcs()
  212. {
  213. addEventIds(ZAKEN, EventType.ON_ATTACK, EventType.ON_KILL, EventType.ON_SPAWN, EventType.ON_SPELL_FINISHED, EventType.ON_SKILL_SEE, EventType.ON_FACTION_CALL, EventType.ON_AGGRO);
  214. addEventIds(doll_blader_b, EventType.ON_ATTACK, EventType.ON_KILL, EventType.ON_SPAWN, EventType.ON_SPELL_FINISHED, EventType.ON_SKILL_SEE, EventType.ON_FACTION_CALL, EventType.ON_AGGRO);
  215. addEventIds(vale_master_b, EventType.ON_ATTACK, EventType.ON_KILL, EventType.ON_SPAWN, EventType.ON_SPELL_FINISHED, EventType.ON_SKILL_SEE, EventType.ON_FACTION_CALL, EventType.ON_AGGRO);
  216. addEventIds(pirates_zombie_captain_b, EventType.ON_ATTACK, EventType.ON_KILL, EventType.ON_SPAWN, EventType.ON_SPELL_FINISHED, EventType.ON_SKILL_SEE, EventType.ON_FACTION_CALL, EventType.ON_AGGRO);
  217. addEventIds(pirates_zombie_captain_b, EventType.ON_ATTACK, EventType.ON_KILL, EventType.ON_SPAWN, EventType.ON_SPELL_FINISHED, EventType.ON_SKILL_SEE, EventType.ON_FACTION_CALL, EventType.ON_AGGRO);
  218. }
  219.  
  220. public void spawnBoss(GrandBoss npc)
  221. {
  222. if (npc == null)
  223. {
  224. log.warning("Zaken AI failed to load, missing Zaken in grandboss_data.sql");
  225. return;
  226. }
  227.  
  228. GrandBossManager.getInstance().addBoss(npc);
  229. npc.broadcastPacket(new PlaySound(1, "BS01_A", npc));
  230. _ai0 = 0;
  231. _ai1 = npc.getX();
  232. _ai2 = npc.getY();
  233. _ai3 = npc.getZ();
  234. _quest0 = 0;
  235. _quest1 = 0;
  236. _quest2 = 3;
  237. if (_zakenLair == null)
  238. {
  239. log.warning("Zaken AI failed to load, missing zone for Zaken");
  240. return;
  241. }
  242.  
  243. if (_zakenLair.isInsideZone(npc))
  244. {
  245. _ai4 = 1;
  246. startQuestTimer("1003", 1700, null, null, false);
  247. }
  248. _1001 = 1;
  249. startQuestTimer("1001", 1000, npc, null, false);
  250. }
  251.  
  252. @Override
  253. public String onAdvEvent(String event, Npc npc, Player player)
  254. {
  255. int status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
  256. if (status == DEAD && !event.equalsIgnoreCase("zaken_unlock"))
  257. {
  258. return super.onAdvEvent(event, npc, player);
  259. }
  260.  
  261. if (event.equalsIgnoreCase("1001"))
  262. {
  263. if (_1001 == 1)
  264. {
  265. _1001 = 0;
  266. cancelQuestTimer("1001", npc, null);
  267. }
  268.  
  269. int sk_4223 = 0;
  270. int sk_4227 = 0;
  271. L2Effect[] effects = npc.getAllEffects();
  272. if (effects.length != 0)
  273. {
  274. for (L2Effect e : effects)
  275. {
  276. if (e.getSkill().getId() == 4227)
  277. {
  278. sk_4227 = 1;
  279. }
  280.  
  281. if (e.getSkill().getId() == 4223)
  282. {
  283. sk_4223 = 1;
  284. }
  285. }
  286. }
  287.  
  288. if (getTimeHour() < 5)
  289. {
  290. if (sk_4223 == 1)
  291. {
  292. npc.setTarget(npc);
  293. npc.doCast(SkillTable.getInstance().getInfo(4224, 1));
  294. _ai1 = npc.getX();
  295. _ai2 = npc.getY();
  296. _ai3 = npc.getZ();
  297. }
  298.  
  299. if (sk_4227 == 0)
  300. {
  301. npc.setTarget(npc);
  302. npc.doCast(SkillTable.getInstance().getInfo(4227, 1));
  303. }
  304.  
  305. if (npc.getAI().getIntention() == CtrlIntention.ATTACK && _ai0 == 0)
  306. {
  307. int i0 = 0;
  308. int i1 = 1;
  309. if (((Attackable) npc).getMostHated() != null)
  310. {
  311. if ((((((Attackable) npc).getMostHated().getX() - _ai1) * (((Attackable) npc).getMostHated().getX() - _ai1)) + ((((Attackable) npc).getMostHated().getY() - _ai2) * (((Attackable) npc).getMostHated().getY() - _ai2))) > (1500 * 1500))
  312. {
  313. i0 = 1;
  314. }
  315. else
  316. {
  317. i0 = 0;
  318. }
  319.  
  320. if (i0 == 0)
  321. {
  322. i1 = 0;
  323. }
  324.  
  325. if (_quest0 > 0)
  326. {
  327. if (c_quest0 == null)
  328. {
  329. i0 = 0;
  330. }
  331. else if ((((c_quest0.getX() - _ai1) * (c_quest0.getX() - _ai1)) + ((c_quest0.getY() - _ai2) * (c_quest0.getY() - _ai2))) > (1500 * 1500))
  332. {
  333. i0 = 1;
  334. }
  335. else
  336. {
  337. i0 = 0;
  338. }
  339.  
  340. if (i0 == 0)
  341. {
  342. i1 = 0;
  343. }
  344. }
  345.  
  346. if (_quest0 > 1)
  347. {
  348. if (c_quest1 == null)
  349. {
  350. i0 = 0;
  351. }
  352. else if ((((c_quest1.getX() - _ai1) * (c_quest1.getX() - _ai1)) + ((c_quest1.getY() - _ai2) * (c_quest1.getY() - _ai2))) > (1500 * 1500))
  353. {
  354. i0 = 1;
  355. }
  356. else
  357. {
  358. i0 = 0;
  359. }
  360.  
  361. if (i0 == 0)
  362. {
  363. i1 = 0;
  364. }
  365. }
  366.  
  367. if (_quest0 > 2)
  368. {
  369. if (c_quest2 == null)
  370. {
  371. i0 = 0;
  372. }
  373. else if ((((c_quest2.getX() - _ai1) * (c_quest2.getX() - _ai1)) + ((c_quest2.getY() - _ai2) * (c_quest2.getY() - _ai2))) > (1500 * 1500))
  374. {
  375. i0 = 1;
  376. }
  377. else
  378. {
  379. i0 = 0;
  380. }
  381.  
  382. if (i0 == 0)
  383. {
  384. i1 = 0;
  385. }
  386. }
  387.  
  388. if (_quest0 > 3)
  389. {
  390. if (c_quest3 == null)
  391. {
  392. i0 = 0;
  393. }
  394. else if ((((c_quest3.getX() - _ai1) * (c_quest3.getX() - _ai1)) + ((c_quest3.getY() - _ai2) * (c_quest3.getY() - _ai2))) > (1500 * 1500))
  395. {
  396. i0 = 1;
  397. }
  398. else
  399. {
  400. i0 = 0;
  401. }
  402.  
  403. if (i0 == 0)
  404. {
  405. i1 = 0;
  406. }
  407. }
  408.  
  409. if (_quest0 > 4)
  410. {
  411. if (c_quest4 == null)
  412. {
  413. i0 = 0;
  414. }
  415. else if ((((c_quest4.getX() - _ai1) * (c_quest4.getX() - _ai1)) + ((c_quest4.getY() - _ai2) * (c_quest4.getY() - _ai2))) > (1500 * 1500))
  416. {
  417. i0 = 1;
  418. }
  419. else
  420. {
  421. i0 = 0;
  422. }
  423.  
  424. if (i0 == 0)
  425. {
  426. i1 = 0;
  427. }
  428. }
  429.  
  430. if (i1 == 1)
  431. {
  432. _quest0 = 0;
  433. int i2 = Rnd.get(15);
  434. _ai1 = Xcoords[i2] + Rnd.get(650);
  435. _ai2 = Ycoords[i2] + Rnd.get(650);
  436. _ai3 = Zcoords[i2];
  437. npc.setTarget(npc);
  438. npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  439. }
  440. }
  441. }
  442.  
  443. if (Rnd.get(20) < 1 && _ai0 == 0)
  444. {
  445. _ai1 = npc.getX();
  446. _ai2 = npc.getY();
  447. _ai3 = npc.getZ();
  448. }
  449.  
  450. Creature c_ai0 = null;
  451. if (npc.getAI().getIntention() == CtrlIntention.ATTACK && _quest1 == 0)
  452. {
  453. if (((Attackable) npc).getMostHated() != null)
  454. {
  455. c_ai0 = ((Attackable) npc).getMostHated();
  456. _quest1 = 1;
  457. }
  458. }
  459. else if (npc.getAI().getIntention() == CtrlIntention.ATTACK && _quest1 != 0)
  460. {
  461. if (((Attackable) npc).getMostHated() != null)
  462. {
  463. if (c_ai0 == ((Attackable) npc).getMostHated())
  464. {
  465. _quest1 = (_quest1 + 1);
  466. }
  467. else
  468. {
  469. _quest1 = 1;
  470. c_ai0 = ((Attackable) npc).getMostHated();
  471. }
  472. }
  473. }
  474.  
  475. if (npc.getAI().getIntention() == CtrlIntention.IDLE)
  476. {
  477. _quest1 = 0;
  478. }
  479.  
  480. if (_quest1 > 5)
  481. {
  482. ((Attackable) npc).stopHating(c_ai0);
  483. Creature nextTarget = ((Attackable) npc).getMostHated();
  484. if (nextTarget != null)
  485. {
  486. npc.getAI().setIntention(CtrlIntention.ATTACK, nextTarget);
  487. }
  488. _quest1 = 0;
  489. }
  490. }
  491. else if (sk_4223 == 0)
  492. {
  493. npc.setTarget(npc);
  494. npc.doCast(SkillTable.getInstance().getInfo(4223, 1));
  495. _quest2 = 3;
  496. }
  497.  
  498. if (sk_4227 == 1)
  499. {
  500. npc.setTarget(npc);
  501. npc.doCast(SkillTable.getInstance().getInfo(4242, 1));
  502. }
  503.  
  504. if (Rnd.get(40) < 1)
  505. {
  506. int i2 = Rnd.get(15);
  507. _ai1 = Xcoords[i2] + Rnd.get(650);
  508. _ai2 = Ycoords[i2] + Rnd.get(650);
  509. _ai3 = Zcoords[i2];
  510. npc.setTarget(npc);
  511. npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  512. }
  513. startQuestTimer("1001", 30000, npc, null, false);
  514. }
  515.  
  516. if (event.equalsIgnoreCase("1002"))
  517. {
  518. _quest0 = 0;
  519. npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  520. _ai0 = 0;
  521. }
  522.  
  523. if (event.equalsIgnoreCase("1003"))
  524. {
  525. if (_ai4 == 1)
  526. {
  527. int rr = Rnd.get(15);
  528. addSpawn(pirates_zombie_captain_b, Xcoords[rr] + Rnd.get(650), Ycoords[rr] + Rnd.get(650), Zcoords[rr], Rnd.get(65536), false, 0, true).isRaidMinion();
  529. _ai4 = 2;
  530. }
  531. else if (_ai4 == 2)
  532. {
  533. int rr = Rnd.get(15);
  534. addSpawn(doll_blader_b, Xcoords[rr] + Rnd.get(650), Ycoords[rr] + Rnd.get(650), Zcoords[rr], Rnd.get(65536), false, 0, true).isRaidMinion();
  535. _ai4 = 3;
  536. }
  537. else if (_ai4 == 3)
  538. {
  539. addSpawn(vale_master_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  540. addSpawn(vale_master_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  541. _ai4 = 4;
  542. }
  543. else if (_ai4 == 4)
  544. {
  545. addSpawn(pirates_zombie_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  546. addSpawn(pirates_zombie_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  547. addSpawn(pirates_zombie_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  548. addSpawn(pirates_zombie_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  549. addSpawn(pirates_zombie_b, Xcoords[Rnd.get(15)] + Rnd.get(650), Ycoords[Rnd.get(15)] + Rnd.get(650), Zcoords[Rnd.get(15)], Rnd.get(65536), false, 0, true).isRaidMinion();
  550. _ai4 = 5;
  551. }
  552. else if (_ai4 == 5)
  553. {
  554. addSpawn(doll_blader_b, 52675, 219371, -3290, Rnd.get(65536), false, 0, true).isRaidMinion();
  555. addSpawn(doll_blader_b, 52687, 219596, -3368, Rnd.get(65536), false, 0, true).isRaidMinion();
  556. addSpawn(doll_blader_b, 52672, 219740, -3418, Rnd.get(65536), false, 0, true).isRaidMinion();
  557. addSpawn(pirates_zombie_b, 52857, 219992, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  558. addSpawn(pirates_zombie_captain_b, 52959, 219997, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  559. addSpawn(vale_master_b, 53381, 220151, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  560. addSpawn(pirates_zombie_captain_b, 54236, 220948, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  561. addSpawn(pirates_zombie_b, 54885, 220144, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  562. addSpawn(pirates_zombie_b, 55264, 219860, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  563. addSpawn(pirates_zombie_captain_b, 55399, 220263, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  564. addSpawn(pirates_zombie_b, 55679, 220129, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  565. addSpawn(vale_master_b, 56276, 220783, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  566. addSpawn(vale_master_b, 57173, 220234, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  567. addSpawn(pirates_zombie_b, 56267, 218826, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  568. addSpawn(doll_blader_b, 56294, 219482, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  569. addSpawn(pirates_zombie_captain_b, 56094, 219113, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  570. addSpawn(doll_blader_b, 56364, 218967, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  571. addSpawn(pirates_zombie_b, 57113, 218079, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  572. addSpawn(doll_blader_b, 56186, 217153, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  573. addSpawn(pirates_zombie_b, 55440, 218081, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  574. addSpawn(pirates_zombie_captain_b, 55202, 217940, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  575. addSpawn(pirates_zombie_b, 55225, 218236, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  576. addSpawn(pirates_zombie_b, 54973, 218075, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  577. addSpawn(pirates_zombie_captain_b, 53412, 218077, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  578. addSpawn(vale_master_b, 54226, 218797, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  579. addSpawn(vale_master_b, 54394, 219067, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  580. addSpawn(pirates_zombie_b, 54139, 219253, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  581. addSpawn(doll_blader_b, 54262, 219480, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  582. _ai4 = 6;
  583. }
  584. else if (_ai4 == 6)
  585. {
  586. addSpawn(pirates_zombie_b, 53412, 218077, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  587. addSpawn(vale_master_b, 54413, 217132, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  588. addSpawn(doll_blader_b, 54841, 217132, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  589. addSpawn(doll_blader_b, 55372, 217128, -3343, Rnd.get(65536), false, 0, true).isRaidMinion();
  590. addSpawn(doll_blader_b, 55893, 217122, -3488, Rnd.get(65536), false, 0, true).isRaidMinion();
  591. addSpawn(pirates_zombie_captain_b, 56282, 217237, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  592. addSpawn(vale_master_b, 56963, 218080, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  593. addSpawn(pirates_zombie_b, 56267, 218826, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  594. addSpawn(doll_blader_b, 56294, 219482, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  595. addSpawn(pirates_zombie_captain_b, 56094, 219113, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  596. addSpawn(doll_blader_b, 56364, 218967, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  597. addSpawn(vale_master_b, 56276, 220783, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  598. addSpawn(vale_master_b, 57173, 220234, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  599. addSpawn(pirates_zombie_b, 54885, 220144, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  600. addSpawn(pirates_zombie_b, 55264, 219860, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  601. addSpawn(pirates_zombie_captain_b, 55399, 220263, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  602. addSpawn(pirates_zombie_b, 55679, 220129, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  603. addSpawn(pirates_zombie_captain_b, 54236, 220948, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  604. addSpawn(pirates_zombie_captain_b, 54464, 219095, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  605. addSpawn(vale_master_b, 54226, 218797, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  606. addSpawn(vale_master_b, 54394, 219067, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  607. addSpawn(pirates_zombie_b, 54139, 219253, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  608. addSpawn(doll_blader_b, 54262, 219480, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  609. addSpawn(pirates_zombie_captain_b, 53412, 218077, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  610. addSpawn(pirates_zombie_b, 55440, 218081, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  611. addSpawn(pirates_zombie_captain_b, 55202, 217940, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  612. addSpawn(pirates_zombie_b, 55225, 218236, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  613. addSpawn(pirates_zombie_b, 54973, 218075, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  614. _ai4 = 7;
  615. }
  616. else if (_ai4 == 7)
  617. {
  618. addSpawn(pirates_zombie_b, 54228, 217504, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  619. addSpawn(vale_master_b, 54181, 217168, -3216, Rnd.get(65536), false, 0, true).isRaidMinion();
  620. addSpawn(doll_blader_b, 54714, 217123, -3168, Rnd.get(65536), false, 0, true).isRaidMinion();
  621. addSpawn(doll_blader_b, 55298, 217127, -3073, Rnd.get(65536), false, 0, true).isRaidMinion();
  622. addSpawn(doll_blader_b, 55787, 217130, -2993, Rnd.get(65536), false, 0, true).isRaidMinion();
  623. addSpawn(pirates_zombie_captain_b, 56284, 217216, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  624. addSpawn(vale_master_b, 56963, 218080, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  625. addSpawn(pirates_zombie_b, 56267, 218826, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  626. addSpawn(doll_blader_b, 56294, 219482, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  627. addSpawn(pirates_zombie_captain_b, 56094, 219113, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  628. addSpawn(doll_blader_b, 56364, 218967, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  629. addSpawn(vale_master_b, 56276, 220783, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  630. addSpawn(vale_master_b, 57173, 220234, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  631. addSpawn(pirates_zombie_b, 54885, 220144, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  632. addSpawn(pirates_zombie_b, 55264, 219860, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  633. addSpawn(pirates_zombie_captain_b, 55399, 220263, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  634. addSpawn(pirates_zombie_b, 55679, 220129, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  635. addSpawn(pirates_zombie_captain_b, 54236, 220948, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  636. addSpawn(pirates_zombie_captain_b, 54464, 219095, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  637. addSpawn(vale_master_b, 54226, 218797, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  638. addSpawn(vale_master_b, 54394, 219067, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  639. addSpawn(pirates_zombie_b, 54139, 219253, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  640. addSpawn(doll_blader_b, 54262, 219480, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  641. addSpawn(pirates_zombie_captain_b, 53412, 218077, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  642. addSpawn(pirates_zombie_captain_b, 54280, 217200, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  643. addSpawn(pirates_zombie_b, 55440, 218081, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  644. addSpawn(pirates_zombie_captain_b, 55202, 217940, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  645. addSpawn(pirates_zombie_b, 55225, 218236, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  646. addSpawn(pirates_zombie_b, 54973, 218075, -2944, Rnd.get(65536), false, 0, true).isRaidMinion();
  647. _ai4 = 8;
  648. cancelQuestTimer("1003", null, null);
  649. }
  650. }
  651. else if (event.equalsIgnoreCase("zaken_unlock"))
  652. {
  653. final GrandBoss zaken = (GrandBoss) addSpawn(ZAKEN, 55276, 219176, -3227, 0, false, 0,false);
  654. GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
  655. spawnBoss(zaken);
  656. if (Config.ANNOUNCE_BOSS_ALIVE)
  657. {
  658. Broadcast.gameAnnounceToOnlinePlayers("Epic Boss: " + zaken.getName() + " spawned in world.");
  659. }
  660. }
  661. else if (event.equalsIgnoreCase("CreateOnePrivateEx"))
  662. {
  663. addSpawn(npc.getNpcId(), npc.getX(), npc.getY(), npc.getZ(), 0, false, 0, true).isRaidMinion();
  664. }
  665.  
  666. return super.onAdvEvent(event, npc, player);
  667. }
  668.  
  669. @Override
  670. public String onFactionCall(Npc npc, Npc caller, Player attacker, boolean isPet)
  671. {
  672. if (caller == null || npc == null)
  673. {
  674. return super.onFactionCall(npc, caller, attacker, isPet);
  675. }
  676.  
  677. int npcId = npc.getNpcId();
  678. int callerId = caller.getNpcId();
  679. if (getTimeHour() < 5 && callerId != ZAKEN && npcId == ZAKEN)
  680. {
  681. int damage = 0;
  682. if (npc.getAI().getIntention() == CtrlIntention.IDLE && _ai0 == 0 && damage < 10 && Rnd.get((30 * 15)) < 1)
  683. {
  684. _ai0 = 1;
  685. _ai1 = caller.getX();
  686. _ai2 = caller.getY();
  687. _ai3 = caller.getZ();
  688. startQuestTimer("1002", 300, caller, null, false);
  689. }
  690. }
  691.  
  692. return super.onFactionCall(npc, caller, attacker, isPet);
  693. }
  694.  
  695. @Override
  696. public String onSpellFinished(Npc npc, Player player, L2Skill skill)
  697. {
  698. if (npc.getNpcId() == ZAKEN)
  699. {
  700. int skillId = skill.getId();
  701. if (skillId == 4222)
  702. {
  703. npc.teleToLocation(_ai1, _ai2, _ai3, 0);
  704. npc.getAI().setIntention(CtrlIntention.IDLE);
  705. }
  706. else if (skillId == 4216)
  707. {
  708. int i1 = Rnd.get(15);
  709. player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  710. ((Attackable) npc).stopHating(player);
  711. Creature nextTarget = ((Attackable) npc).getMostHated();
  712. if (nextTarget != null)
  713. {
  714. npc.getAI().setIntention(CtrlIntention.ATTACK, nextTarget);
  715. }
  716. }
  717. else if (skillId == 4217)
  718. {
  719. int i0 = 0;
  720. int i1 = Rnd.get(15);
  721. player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  722. ((Attackable) npc).stopHating(player);
  723. if (c_quest0 != null && _quest0 > 0 && c_quest0 != player && c_quest0.getZ() > (player.getZ() - 100) && c_quest0.getZ() < (player.getZ() + 100))
  724. {
  725. if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX())) + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY()))) > (250 * 250))
  726. {
  727. i0 = 1;
  728. }
  729. else
  730. {
  731. i0 = 0;
  732. }
  733.  
  734. if (i0 == 0)
  735. {
  736. i1 = Rnd.get(15);
  737. c_quest0.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  738. ((Attackable) npc).stopHating(c_quest0);
  739. }
  740. }
  741.  
  742. if (c_quest1 != null && _quest0 > 1 && c_quest1 != player && c_quest1.getZ() > (player.getZ() - 100) && c_quest1.getZ() < (player.getZ() + 100))
  743. {
  744. if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX())) + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY()))) > (250 * 250))
  745. {
  746. i0 = 1;
  747. }
  748. else
  749. {
  750. i0 = 0;
  751. }
  752.  
  753. if (i0 == 0)
  754. {
  755. i1 = Rnd.get(15);
  756. c_quest1.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  757. ((Attackable) npc).stopHating(c_quest1);
  758. }
  759. }
  760.  
  761. if (c_quest2 != null && _quest0 > 2 && c_quest2 != player && c_quest2.getZ() > (player.getZ() - 100) && c_quest2.getZ() < (player.getZ() + 100))
  762. {
  763. if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX())) + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY()))) > (250 * 250))
  764. {
  765. i0 = 1;
  766. }
  767. else
  768. {
  769. i0 = 0;
  770. }
  771.  
  772. if (i0 == 0)
  773. {
  774. i1 = Rnd.get(15);
  775. c_quest2.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  776. ((Attackable) npc).stopHating(c_quest2);
  777. }
  778. }
  779.  
  780. if (c_quest3 != null && _quest0 > 3 && c_quest3 != player && c_quest3.getZ() > (player.getZ() - 100) && c_quest3.getZ() < (player.getZ() + 100))
  781. {
  782. if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX())) + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY()))) > (250 * 250))
  783. {
  784. i0 = 1;
  785. }
  786. else
  787. {
  788. i0 = 0;
  789. }
  790.  
  791. if (i0 == 0)
  792. {
  793. i1 = Rnd.get(15);
  794. c_quest3.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  795. ((Attackable) npc).stopHating(c_quest3);
  796. }
  797. }
  798.  
  799. if (c_quest4 != null && _quest0 > 4 && c_quest4 != player && c_quest4.getZ() > (player.getZ() - 100) && c_quest4.getZ() < (player.getZ() + 100))
  800. {
  801. if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX())) + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY()))) > (250 * 250))
  802. {
  803. i0 = 1;
  804. }
  805. else
  806. {
  807. i0 = 0;
  808. }
  809.  
  810. if (i0 == 0)
  811. {
  812. i1 = Rnd.get(15);
  813. c_quest4.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1], 0);
  814. ((Attackable) npc).stopHating(c_quest4);
  815. }
  816. }
  817.  
  818. Creature nextTarget = ((Attackable) npc).getMostHated();
  819. if (nextTarget != null)
  820. {
  821. npc.getAI().setIntention(CtrlIntention.ATTACK, nextTarget);
  822. }
  823. }
  824. }
  825.  
  826. return super.onSpellFinished(npc, player, skill);
  827. }
  828.  
  829. @Override
  830. public String onAttack(Npc npc, Player attacker, int damage, boolean isPet, L2Skill skill)
  831. {
  832. int npcId = npc.getNpcId();
  833. if (npcId == ZAKEN)
  834. {
  835. if (attacker.getMountType() == 1)
  836. {
  837. int sk_4258 = 0;
  838. L2Effect[] effects = attacker.getAllEffects();
  839. if (effects.length != 0)
  840. {
  841. for (L2Effect e : effects)
  842. {
  843. if (e.getSkill().getId() == 4258)
  844. {
  845. sk_4258 = 1;
  846. }
  847. }
  848. }
  849.  
  850. if (sk_4258 == 0)
  851. {
  852. npc.setTarget(attacker);
  853. npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
  854. }
  855. }
  856.  
  857. Creature originalAttacker = isPet ? attacker.getPet() : attacker;
  858. int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000);
  859. ((Attackable) npc).addDamageHate(originalAttacker, 0, hate);
  860. if (Rnd.get(10) < 1)
  861. {
  862. int i0 = Rnd.get((15 * 15));
  863. if (i0 < 1)
  864. {
  865. npc.setTarget(attacker);
  866. npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
  867. }
  868. else if (i0 < 2)
  869. {
  870. npc.setTarget(attacker);
  871. npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
  872. }
  873. else if (i0 < 4)
  874. {
  875. npc.setTarget(attacker);
  876. npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
  877. }
  878. else if (i0 < 8)
  879. {
  880. npc.setTarget(attacker);
  881. npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
  882. }
  883. else if (i0 < 15)
  884. {
  885. for (Creature character : npc.getKnownTypeInRadius(Creature.class, 100))
  886. {
  887. if (character != attacker)
  888. {
  889. continue;
  890. }
  891.  
  892. if (attacker != ((Attackable) npc).getMostHated())
  893. {
  894. npc.setTarget(attacker);
  895. npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
  896. }
  897. }
  898. }
  899.  
  900. if (Rnd.get(2) < 1)
  901. {
  902. if (attacker == ((Attackable) npc).getMostHated())
  903. {
  904. npc.setTarget(attacker);
  905. npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
  906. }
  907. }
  908. }
  909.  
  910. if (getTimeHour() < 5)
  911. {
  912. }
  913. else if (npc.getCurrentHp() < ((npc.getMaxHp() * _quest2) / 4.0))
  914. {
  915. _quest2 = (_quest2 - 1);
  916. int i2 = Rnd.get(15);
  917. _ai1 = Xcoords[i2] + Rnd.get(650);
  918. _ai2 = Ycoords[i2] + Rnd.get(650);
  919. _ai3 = Zcoords[i2];
  920. npc.setTarget(npc);
  921. npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  922. }
  923. }
  924.  
  925. return super.onAttack(npc, attacker, damage, isPet, skill);
  926. }
  927.  
  928. @Override
  929. public String onKill(Npc npc, Player killer, boolean isPet)
  930. {
  931. int npcId = npc.getNpcId();
  932. if (npcId == ZAKEN)
  933. {
  934.  
  935. npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
  936. GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
  937. long respawnTime = (long) Config.SPAWN_INTERVAL_ZAKEN + Rnd.get(-Config.RANDOM_SPAWN_TIME_ZAKEN, Config.RANDOM_SPAWN_TIME_ZAKEN);
  938. respawnTime *= 3600000;
  939. startQuestTimer("zaken_unlock", respawnTime, null, null, false);
  940. cancelQuestTimer("1001", npc, null);
  941. cancelQuestTimer("1003", npc, null);
  942. StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
  943. info.set("respawn_time", System.currentTimeMillis() + respawnTime);
  944. GrandBossManager.getInstance().setStatsSet(ZAKEN, info);
  945.  
  946. }
  947. else if (GrandBossManager.getInstance().getBossStatus(ZAKEN) == ALIVE)
  948. {
  949. if (npcId != ZAKEN)
  950. {
  951. startQuestTimer("CreateOnePrivateEx", ((30 + Rnd.get(60)) * 1000), npc, null, false);
  952. }
  953. }
  954.  
  955. return super.onKill(npc, killer, isPet);
  956. }
  957.  
  958. @Override
  959. public String onSkillSee(Npc npc, Player caster, L2Skill skill, WorldObject[] targets, boolean isPet)
  960. {
  961. int npcId = npc.getNpcId();
  962. if (npcId == ZAKEN)
  963. {
  964. if (skill.getAggroPoints() > 0)
  965. {
  966. ((Attackable) npc).addDamageHate(caster, 0, (((skill.getAggroPoints() / npc.getMaxHp()) * 10) * 150));
  967. }
  968.  
  969. if (Rnd.get(12) < 1)
  970. {
  971. int i0 = Rnd.get((15 * 15));
  972. if (i0 < 1)
  973. {
  974. npc.setTarget(caster);
  975. npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
  976. }
  977. else if (i0 < 2)
  978. {
  979. npc.setTarget(caster);
  980. npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
  981. }
  982. else if (i0 < 4)
  983. {
  984. npc.setTarget(caster);
  985. npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
  986. }
  987. else if (i0 < 8)
  988. {
  989. npc.setTarget(caster);
  990. npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
  991. }
  992. else if (i0 < 15)
  993. {
  994. for (Creature character : npc.getKnownTypeInRadius(Creature.class, 100))
  995. {
  996. if (character != caster)
  997. {
  998. continue;
  999. }
  1000.  
  1001. if (caster != ((Attackable) npc).getMostHated())
  1002. {
  1003. npc.setTarget(caster);
  1004. npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
  1005. }
  1006. }
  1007. }
  1008.  
  1009. if (Rnd.get(2) < 1)
  1010. {
  1011. if (caster == ((Attackable) npc).getMostHated())
  1012. {
  1013. npc.setTarget(caster);
  1014. npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
  1015. }
  1016. }
  1017. }
  1018. }
  1019. return super.onSkillSee(npc, caster, skill, targets, isPet);
  1020. }
  1021.  
  1022. @Override
  1023. public String onAggro(Npc npc, Player player, boolean isPet)
  1024. {
  1025. int npcId = npc.getNpcId();
  1026. if (npcId == ZAKEN)
  1027. {
  1028. if (_zakenLair.isInsideZone(npc))
  1029. {
  1030. Creature target = isPet ? player.getPet() : player;
  1031. ((Attackable) npc).addDamageHate(target, 1, 200);
  1032. }
  1033.  
  1034. if (player.getZ() > (npc.getZ() - 100) && player.getZ() < (npc.getZ() + 100))
  1035. {
  1036. if (_quest0 < 5 && Rnd.get(3) < 1)
  1037. {
  1038. if (_quest0 == 0)
  1039. {
  1040. c_quest0 = player;
  1041. }
  1042. else if (_quest0 == 1)
  1043. {
  1044. c_quest1 = player;
  1045. }
  1046. else if (_quest0 == 2)
  1047. {
  1048. c_quest2 = player;
  1049. }
  1050. else if (_quest0 == 3)
  1051. {
  1052. c_quest3 = player;
  1053. }
  1054. else if (_quest0 == 4)
  1055. {
  1056. c_quest4 = player;
  1057. }
  1058. _quest0++;
  1059. }
  1060.  
  1061. if (Rnd.get(15) < 1)
  1062. {
  1063. int i0 = Rnd.get((15 * 15));
  1064. if (i0 < 1)
  1065. {
  1066. npc.setTarget(player);
  1067. npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
  1068. }
  1069. else if (i0 < 2)
  1070. {
  1071. npc.setTarget(player);
  1072. npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
  1073. }
  1074. else if (i0 < 4)
  1075. {
  1076. npc.setTarget(player);
  1077. npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
  1078. }
  1079. else if (i0 < 8)
  1080. {
  1081. npc.setTarget(player);
  1082. npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
  1083. }
  1084. else if (i0 < 15)
  1085. {
  1086. for (Creature character : npc.getKnownTypeInRadius(Creature.class, 100))
  1087. {
  1088. if (character != player)
  1089. {
  1090. continue;
  1091. }
  1092.  
  1093. if (player != ((Attackable) npc).getMostHated())
  1094. {
  1095. npc.setTarget(player);
  1096. npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
  1097. }
  1098. }
  1099. }
  1100.  
  1101. if (Rnd.get(2) < 1)
  1102. {
  1103. if (player == ((Attackable) npc).getMostHated())
  1104. {
  1105. npc.setTarget(player);
  1106. npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
  1107. }
  1108. }
  1109. }
  1110. }
  1111. }
  1112.  
  1113. return super.onAggro(npc, player, isPet);
  1114. }
  1115.  
  1116. public int getTimeHour()
  1117. {
  1118. return (GameTimeTaskManager.getInstance().getGameTime() / 60) % 24;
  1119. }
  1120.  
  1121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement