Advertisement
BossForever

Zaken

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