Advertisement
Guest User

zaken frozen

a guest
Sep 29th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 36.91 KB | None | 0 0
  1. /*
  2.  * L2jFrozen Project - www.l2jfrozen.com
  3.  *
  4.  * This program is free software: you can redistribute it and/or modify it under
  5.  * the terms of the GNU General Public License as published by the Free Software
  6.  * Foundation, either version 3 of the License, or (at your option) any later
  7.  * version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful, but WITHOUT
  10.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  12.  * details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License along with
  15.  * this program. If not, see <http://www.gnu.org/licenses/>.
  16.  */
  17. package com.l2jfrozen.gameserver.ai.special;
  18.  
  19. import org.apache.log4j.Logger;
  20.  
  21. import com.l2jfrozen.Config;
  22. import com.l2jfrozen.gameserver.ai.CtrlIntention;
  23. import com.l2jfrozen.gameserver.controllers.GameTimeController;
  24. import com.l2jfrozen.gameserver.datatables.SkillTable;
  25. import com.l2jfrozen.gameserver.datatables.csv.DoorTable;
  26. import com.l2jfrozen.gameserver.managers.GrandBossManager;
  27. import com.l2jfrozen.gameserver.model.L2Attackable;
  28. import com.l2jfrozen.gameserver.model.L2Character;
  29. import com.l2jfrozen.gameserver.model.L2Effect;
  30. import com.l2jfrozen.gameserver.model.L2Skill;
  31. import com.l2jfrozen.gameserver.model.actor.instance.L2GrandBossInstance;
  32. import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
  33. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  34. import com.l2jfrozen.gameserver.model.quest.Quest;
  35. import com.l2jfrozen.gameserver.model.zone.type.L2BossZone;
  36. import com.l2jfrozen.gameserver.network.serverpackets.PlaySound;
  37. import com.l2jfrozen.gameserver.templates.StatsSet;
  38. import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  39. import com.l2jfrozen.util.random.Rnd;
  40.  
  41. /**
  42.  * Zaken AI
  43.  */
  44. public class Zaken extends Quest implements Runnable
  45. {
  46.     protected static final Logger LOGGER = Logger.getLogger(Zaken.class);
  47.    
  48.     private int _1001 = 0; // used for first cancel of QuestTimer "1001"
  49.     private int _ai0 = 0; // used for zaken coords updater
  50.     private int _ai1 = 0; // used for X coord tracking for non-random teleporting in zaken's self teleport skill
  51.     private int _ai2 = 0; // used for Y coord tracking for non-random teleporting in zaken's self teleport skill
  52.     private int _ai3 = 0; // used for Z coord tracking for non-random teleporting in zaken's self teleport skill
  53.     private int _ai4 = 0; // used for spawning minions cycles
  54.     private int _quest0 = 0; // used for teleporting progress
  55.     private int _quest1 = 0; // used for most hated players progress
  56.     private int _quest2 = 0; // used for zaken HP check for teleport
  57.     private L2PcInstance c_quest0 = null; // 1st player used for area teleport
  58.     private L2PcInstance c_quest1 = null; // 2nd player used for area teleport
  59.     private L2PcInstance c_quest2 = null; // 3rd player used for area teleport
  60.     private L2PcInstance c_quest3 = null; // 4th player used for area teleport
  61.     private L2PcInstance c_quest4 = null; // 5th player used for area teleport
  62.     private static final int ZAKEN = 29022;
  63.     private static final int doll_blader_b = 29023;
  64.     private static final int vale_master_b = 29024;
  65.     private static final int pirates_zombie_captain_b = 29026;
  66.     private static final int pirates_zombie_b = 29027;
  67.     private static final int[] Xcoords =
  68.     {
  69.         53950,
  70.         55980,
  71.         54950,
  72.         55970,
  73.         53930,
  74.         55970,
  75.         55980,
  76.         54960,
  77.         53950,
  78.         53930,
  79.         55970,
  80.         55980,
  81.         54960,
  82.         53950,
  83.         53930
  84.     };
  85.     private static final int[] Ycoords =
  86.     {
  87.         219860,
  88.         219820,
  89.         218790,
  90.         217770,
  91.         217760,
  92.         217770,
  93.         219920,
  94.         218790,
  95.         219860,
  96.         217760,
  97.         217770,
  98.         219920,
  99.         218790,
  100.         219860,
  101.         217760
  102.     };
  103.     private static final int[] Zcoords =
  104.     {
  105.         -3488,
  106.         -3488,
  107.         -3488,
  108.         -3488,
  109.         -3488,
  110.         -3216,
  111.         -3216,
  112.         -3216,
  113.         -3216,
  114.         -3216,
  115.         -2944,
  116.         -2944,
  117.         -2944,
  118.         -2944,
  119.         -2944
  120.     };
  121.    
  122.     // ZAKEN Status Tracking :
  123.     private static final byte ALIVE = 0; // Zaken is spawned.
  124.     private static final byte DEAD = 1; // Zaken has been killed.
  125.    
  126.     private static L2BossZone _Zone;
  127.    
  128.     public Zaken(final int questId, final String name, final String descr)
  129.     {
  130.         super(questId, name, descr);
  131.        
  132.         // Zaken doors handling
  133.         ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  134.         {
  135.             @Override
  136.             public void run()
  137.             {
  138.                 try
  139.                 {
  140.                     if (getTimeHour() == 0)
  141.                     {
  142.                         LOGGER.info("Zaken door id 21240006 opened, game time 00.00.");
  143.                         DoorTable.getInstance().getDoor(21240006).openMe();
  144.                         ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
  145.                         {
  146.                             @Override
  147.                             public void run()
  148.                             {
  149.                                 try
  150.                                 {
  151.                                     LOGGER.info("Zaken door id 21240006 closed.");
  152.                                     DoorTable.getInstance().getDoor(21240006).closeMe();
  153.                                 }
  154.                                 catch (final Throwable e)
  155.                                 {
  156.                                     if (Config.ENABLE_ALL_EXCEPTIONS)
  157.                                         e.printStackTrace();
  158.                                    
  159.                                     LOGGER.warn("Cannot close door ID: 21240006 " + e);
  160.                                 }
  161.                             }
  162.                         }, 300000L);
  163.                     }
  164.                 }
  165.                 catch (final Throwable e)
  166.                 {
  167.                     if (Config.ENABLE_ALL_EXCEPTIONS)
  168.                         e.printStackTrace();
  169.                    
  170.                     LOGGER.warn("Cannot open door ID: 21240006 " + e);
  171.                 }
  172.             }
  173.         }, 2000L, 600000L);
  174.        
  175.         addEventId(ZAKEN, Quest.QuestEventType.ON_KILL);
  176.         addEventId(ZAKEN, Quest.QuestEventType.ON_ATTACK);
  177.        
  178.         _Zone = GrandBossManager.getInstance().getZone(55262, 219138, -3251);
  179.        
  180.         final StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
  181.         final Integer status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
  182.         if (status == DEAD)
  183.         {
  184.             // load the unlock date and time for zaken from DB
  185.             final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
  186.             // if zaken is locked until a certain time, mark it so and start the unlock timer
  187.             // the unlock time has not yet expired.
  188.             if (temp > 0)
  189.                 startQuestTimer("zaken_unlock", temp, null, null);
  190.             else
  191.             {
  192.                 // the time has already expired while the server was offline. Immediately spawn zaken.
  193.                 final L2GrandBossInstance zaken = (L2GrandBossInstance) addSpawn(ZAKEN, 55262, 219138, -3251, 0, false, 0);
  194.                 GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
  195.                 spawnBoss(zaken);
  196.             }
  197.         }
  198.         else
  199.         {
  200.             final int loc_x = info.getInteger("loc_x");
  201.             final int loc_y = info.getInteger("loc_y");
  202.             final int loc_z = info.getInteger("loc_z");
  203.             final int heading = info.getInteger("heading");
  204.             final int hp = info.getInteger("currentHP");
  205.             final int mp = info.getInteger("currentMP");
  206.             final L2GrandBossInstance zaken = (L2GrandBossInstance) addSpawn(ZAKEN, loc_x, loc_y, loc_z, heading, false, 0);
  207.             zaken.setCurrentHpMp(hp, mp);
  208.             spawnBoss(zaken);
  209.         }
  210.     }
  211.    
  212.     public void spawnBoss(final L2GrandBossInstance npc)
  213.     {
  214.         if (npc == null)
  215.         {
  216.             LOGGER.warn("Zaken AI failed to load, missing Zaken in grandboss_data.sql");
  217.             return;
  218.         }
  219.         GrandBossManager.getInstance().addBoss(npc);
  220.        
  221.         npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
  222.         _ai0 = 0;
  223.         _ai1 = npc.getX();
  224.         _ai2 = npc.getY();
  225.         _ai3 = npc.getZ();
  226.         _quest0 = 0;
  227.         _quest1 = 0;
  228.         _quest2 = 3;
  229.         if (_Zone == null)
  230.         {
  231.             LOGGER.warn("Zaken AI failed to load, missing zone for Zaken");
  232.             return;
  233.         }
  234.         if (_Zone.isInsideZone(npc))
  235.         {
  236.             _ai4 = 1;
  237.             startQuestTimer("1003", 1700, null, null);
  238.         }
  239.         _1001 = 1;
  240.         startQuestTimer("1001", 1000, npc, null); // buffs,random teleports
  241.     }
  242.    
  243.     @Override
  244.     public String onAdvEvent(final String event, final L2NpcInstance npc, final L2PcInstance player)
  245.     {
  246.         final Integer status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
  247.        
  248.         if (status == DEAD && event == null || !event.equalsIgnoreCase("zaken_unlock"))
  249.             return super.onAdvEvent(event, npc, player);
  250.        
  251.         if (event.equalsIgnoreCase("1001"))
  252.         {
  253.             if (_1001 == 1)
  254.             {
  255.                 _1001 = 0;
  256.                 cancelQuestTimer("1001", npc, null);
  257.             }
  258.             int sk_4223 = 0;
  259.             int sk_4227 = 0;
  260.             final L2Effect[] effects = npc.getAllEffects();
  261.             if (effects != null && effects.length != 0)
  262.             {
  263.                 for (final L2Effect e : effects)
  264.                 {
  265.                     if (e.getSkill().getId() == 4227)
  266.                     {
  267.                         sk_4227 = 1;
  268.                     }
  269.                     if (e.getSkill().getId() == 4223)
  270.                     {
  271.                         sk_4223 = 1;
  272.                     }
  273.                 }
  274.             }
  275.             if (getTimeHour() < 5)
  276.             {
  277.                 if (sk_4223 == 1) // use night face if zaken have day face
  278.                 {
  279.                     npc.setTarget(npc);
  280.                     npc.doCast(SkillTable.getInstance().getInfo(4224, 1));
  281.                     _ai1 = npc.getX();
  282.                     _ai2 = npc.getY();
  283.                     _ai3 = npc.getZ();
  284.                 }
  285.                 if (sk_4227 == 0) // use zaken regeneration
  286.                 {
  287.                     npc.setTarget(npc);
  288.                     npc.doCast(SkillTable.getInstance().getInfo(4227, 1));
  289.                 }
  290.                 if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_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.                             i0 = 1;
  298.                         else
  299.                             i0 = 0;
  300.                         if (i0 == 0)
  301.                             i1 = 0;
  302.                         if (_quest0 > 0)
  303.                         {
  304.                             if (c_quest0 == null)
  305.                                 i0 = 0;
  306.                             else if ((((c_quest0.getX() - _ai1) * (c_quest0.getX() - _ai1)) + ((c_quest0.getY() - _ai2) * (c_quest0.getY() - _ai2))) > (1500 * 1500))
  307.                                 i0 = 1;
  308.                             else
  309.                                 i0 = 0;
  310.                             if (i0 == 0)
  311.                                 i1 = 0;
  312.                         }
  313.                         if (_quest0 > 1)
  314.                         {
  315.                             if (c_quest1 == null)
  316.                                 i0 = 0;
  317.                             else if ((((c_quest1.getX() - _ai1) * (c_quest1.getX() - _ai1)) + ((c_quest1.getY() - _ai2) * (c_quest1.getY() - _ai2))) > (1500 * 1500))
  318.                                 i0 = 1;
  319.                             else
  320.                                 i0 = 0;
  321.                             if (i0 == 0)
  322.                                 i1 = 0;
  323.                         }
  324.                         if (_quest0 > 2)
  325.                         {
  326.                             if (c_quest2 == null)
  327.                                 i0 = 0;
  328.                             else if ((((c_quest2.getX() - _ai1) * (c_quest2.getX() - _ai1)) + ((c_quest2.getY() - _ai2) * (c_quest2.getY() - _ai2))) > (1500 * 1500))
  329.                                 i0 = 1;
  330.                             else
  331.                                 i0 = 0;
  332.                             if (i0 == 0)
  333.                                 i1 = 0;
  334.                         }
  335.                         if (_quest0 > 3)
  336.                         {
  337.                             if (c_quest3 == null)
  338.                                 i0 = 0;
  339.                             else if ((((c_quest3.getX() - _ai1) * (c_quest3.getX() - _ai1)) + ((c_quest3.getY() - _ai2) * (c_quest3.getY() - _ai2))) > (1500 * 1500))
  340.                                 i0 = 1;
  341.                             else
  342.                                 i0 = 0;
  343.                             if (i0 == 0)
  344.                                 i1 = 0;
  345.                         }
  346.                         if (_quest0 > 4)
  347.                         {
  348.                             if (c_quest4 == null)
  349.                                 i0 = 0;
  350.                             else if ((((c_quest4.getX() - _ai1) * (c_quest4.getX() - _ai1)) + ((c_quest4.getY() - _ai2) * (c_quest4.getY() - _ai2))) > (1500 * 1500))
  351.                                 i0 = 1;
  352.                             else
  353.                                 i0 = 0;
  354.                             if (i0 == 0)
  355.                                 i1 = 0;
  356.                         }
  357.                         if (i1 == 1)
  358.                         {
  359.                             _quest0 = 0;
  360.                             final int i2 = Rnd.get(15);
  361.                             _ai1 = Xcoords[i2] + Rnd.get(650);
  362.                             _ai2 = Ycoords[i2] + Rnd.get(650);
  363.                             _ai3 = Zcoords[i2];
  364.                             npc.setTarget(npc);
  365.                             npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  366.                         }
  367.                     }
  368.                 }
  369.                 if (Rnd.get(20) < 1 && _ai0 == 0)
  370.                 {
  371.                     _ai1 = npc.getX();
  372.                     _ai2 = npc.getY();
  373.                     _ai3 = npc.getZ();
  374.                 }
  375.                 L2Character c_ai0 = null;
  376.                 if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK && _quest1 == 0)
  377.                 {
  378.                     if (((L2Attackable) npc).getMostHated() != null)
  379.                     {
  380.                         c_ai0 = ((L2Attackable) npc).getMostHated();
  381.                         _quest1 = 1;
  382.                     }
  383.                 }
  384.                 else if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK && _quest1 != 0)
  385.                 {
  386.                     if (((L2Attackable) npc).getMostHated() != null)
  387.                     {
  388.                         if (c_ai0 == ((L2Attackable) npc).getMostHated())
  389.                         {
  390.                             _quest1 = (_quest1 + 1);
  391.                         }
  392.                         else
  393.                         {
  394.                             _quest1 = 1;
  395.                             c_ai0 = ((L2Attackable) npc).getMostHated();
  396.                         }
  397.                     }
  398.                 }
  399.                 if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
  400.                 {
  401.                     _quest1 = 0;
  402.                 }
  403.                 if (_quest1 > 5)
  404.                 {
  405.                     ((L2Attackable) npc).stopHating(c_ai0);
  406.                     final L2Character nextTarget = ((L2Attackable) npc).getMostHated();
  407.                     if (nextTarget != null)
  408.                         npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
  409.                     _quest1 = 0;
  410.                 }
  411.             }
  412.             else if (sk_4223 == 0) // use day face if not night time
  413.             {
  414.                 npc.setTarget(npc);
  415.                 npc.doCast(SkillTable.getInstance().getInfo(4223, 1));
  416.                 _quest2 = 3;
  417.             }
  418.             if (sk_4227 == 1) // when switching to day time, cancel zaken night regen
  419.             {
  420.                 npc.setTarget(npc);
  421.                 npc.doCast(SkillTable.getInstance().getInfo(4242, 1));
  422.             }
  423.             if (Rnd.get(40) < 1)
  424.             {
  425.                 final int i2 = Rnd.get(15);
  426.                 _ai1 = Xcoords[i2] + Rnd.get(650);
  427.                 _ai2 = Ycoords[i2] + Rnd.get(650);
  428.                 _ai3 = Zcoords[i2];
  429.                 npc.setTarget(npc);
  430.                 npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  431.             }
  432.             startQuestTimer("1001", 30000, npc, null);
  433.         }
  434.         if (event.equalsIgnoreCase("1002"))
  435.         {
  436.             _quest0 = 0;
  437.             npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  438.             _ai0 = 0;
  439.         }
  440.         if (event.equalsIgnoreCase("1003"))
  441.         {
  442.             if (_ai4 == 1)
  443.             {
  444.                 final int rr = Rnd.get(15);
  445.                 addSpawn(pirates_zombie_captain_b, Xcoords[rr] + Rnd.get(650), Ycoords[rr] + Rnd.get(650), Zcoords[rr], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  446.                 _ai4 = 2;
  447.             }
  448.             else if (_ai4 == 2)
  449.             {
  450.                 final int rr = Rnd.get(15);
  451.                 addSpawn(doll_blader_b, Xcoords[rr] + Rnd.get(650), Ycoords[rr] + Rnd.get(650), Zcoords[rr], Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  452.                 _ai4 = 3;
  453.             }
  454.             else if (_ai4 == 3)
  455.             {
  456.                 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)/* .setIsRaidMinion(true) */;
  457.                 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)/* .setIsRaidMinion(true) */;
  458.                 _ai4 = 4;
  459.             }
  460.             else if (_ai4 == 4)
  461.             {
  462.                 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)/* .setIsRaidMinion(true) */;
  463.                 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)/* .setIsRaidMinion(true) */;
  464.                 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)/* .setIsRaidMinion(true) */;
  465.                 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)/* .setIsRaidMinion(true) */;
  466.                 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)/* .setIsRaidMinion(true) */;
  467.                 _ai4 = 5;
  468.             }
  469.             else if (_ai4 == 5)
  470.             {
  471.                 addSpawn(doll_blader_b, 52675, 219371, -3290, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  472.                 addSpawn(doll_blader_b, 52687, 219596, -3368, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  473.                 addSpawn(doll_blader_b, 52672, 219740, -3418, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  474.                 addSpawn(pirates_zombie_b, 52857, 219992, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  475.                 addSpawn(pirates_zombie_captain_b, 52959, 219997, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  476.                 addSpawn(vale_master_b, 53381, 220151, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  477.                 addSpawn(pirates_zombie_captain_b, 54236, 220948, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  478.                 addSpawn(pirates_zombie_b, 54885, 220144, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  479.                 addSpawn(pirates_zombie_b, 55264, 219860, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  480.                 addSpawn(pirates_zombie_captain_b, 55399, 220263, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  481.                 addSpawn(pirates_zombie_b, 55679, 220129, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  482.                 addSpawn(vale_master_b, 56276, 220783, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  483.                 addSpawn(vale_master_b, 57173, 220234, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  484.                 addSpawn(pirates_zombie_b, 56267, 218826, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  485.                 addSpawn(doll_blader_b, 56294, 219482, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  486.                 addSpawn(pirates_zombie_captain_b, 56094, 219113, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  487.                 addSpawn(doll_blader_b, 56364, 218967, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  488.                 addSpawn(pirates_zombie_b, 57113, 218079, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  489.                 addSpawn(doll_blader_b, 56186, 217153, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  490.                 addSpawn(pirates_zombie_b, 55440, 218081, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  491.                 addSpawn(pirates_zombie_captain_b, 55202, 217940, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  492.                 addSpawn(pirates_zombie_b, 55225, 218236, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  493.                 addSpawn(pirates_zombie_b, 54973, 218075, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  494.                 addSpawn(pirates_zombie_captain_b, 53412, 218077, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  495.                 addSpawn(vale_master_b, 54226, 218797, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  496.                 addSpawn(vale_master_b, 54394, 219067, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  497.                 addSpawn(pirates_zombie_b, 54139, 219253, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  498.                 addSpawn(doll_blader_b, 54262, 219480, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  499.                 _ai4 = 6;
  500.             }
  501.             else if (_ai4 == 6)
  502.             {
  503.                 addSpawn(pirates_zombie_b, 53412, 218077, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  504.                 addSpawn(vale_master_b, 54413, 217132, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  505.                 addSpawn(doll_blader_b, 54841, 217132, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  506.                 addSpawn(doll_blader_b, 55372, 217128, -3343, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  507.                 addSpawn(doll_blader_b, 55893, 217122, -3488, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  508.                 addSpawn(pirates_zombie_captain_b, 56282, 217237, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  509.                 addSpawn(vale_master_b, 56963, 218080, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  510.                 addSpawn(pirates_zombie_b, 56267, 218826, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  511.                 addSpawn(doll_blader_b, 56294, 219482, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  512.                 addSpawn(pirates_zombie_captain_b, 56094, 219113, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  513.                 addSpawn(doll_blader_b, 56364, 218967, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  514.                 addSpawn(vale_master_b, 56276, 220783, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  515.                 addSpawn(vale_master_b, 57173, 220234, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  516.                 addSpawn(pirates_zombie_b, 54885, 220144, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  517.                 addSpawn(pirates_zombie_b, 55264, 219860, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  518.                 addSpawn(pirates_zombie_captain_b, 55399, 220263, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  519.                 addSpawn(pirates_zombie_b, 55679, 220129, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  520.                 addSpawn(pirates_zombie_captain_b, 54236, 220948, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  521.                 addSpawn(pirates_zombie_captain_b, 54464, 219095, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  522.                 addSpawn(vale_master_b, 54226, 218797, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  523.                 addSpawn(vale_master_b, 54394, 219067, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  524.                 addSpawn(pirates_zombie_b, 54139, 219253, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  525.                 addSpawn(doll_blader_b, 54262, 219480, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  526.                 addSpawn(pirates_zombie_captain_b, 53412, 218077, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  527.                 addSpawn(pirates_zombie_b, 55440, 218081, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  528.                 addSpawn(pirates_zombie_captain_b, 55202, 217940, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  529.                 addSpawn(pirates_zombie_b, 55225, 218236, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  530.                 addSpawn(pirates_zombie_b, 54973, 218075, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  531.                 _ai4 = 7;
  532.             }
  533.             else if (_ai4 == 7)
  534.             {
  535.                 addSpawn(pirates_zombie_b, 54228, 217504, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  536.                 addSpawn(vale_master_b, 54181, 217168, -3216, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  537.                 addSpawn(doll_blader_b, 54714, 217123, -3168, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  538.                 addSpawn(doll_blader_b, 55298, 217127, -3073, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  539.                 addSpawn(doll_blader_b, 55787, 217130, -2993, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  540.                 addSpawn(pirates_zombie_captain_b, 56284, 217216, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  541.                 addSpawn(vale_master_b, 56963, 218080, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  542.                 addSpawn(pirates_zombie_b, 56267, 218826, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  543.                 addSpawn(doll_blader_b, 56294, 219482, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  544.                 addSpawn(pirates_zombie_captain_b, 56094, 219113, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  545.                 addSpawn(doll_blader_b, 56364, 218967, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  546.                 addSpawn(vale_master_b, 56276, 220783, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  547.                 addSpawn(vale_master_b, 57173, 220234, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  548.                 addSpawn(pirates_zombie_b, 54885, 220144, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  549.                 addSpawn(pirates_zombie_b, 55264, 219860, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  550.                 addSpawn(pirates_zombie_captain_b, 55399, 220263, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  551.                 addSpawn(pirates_zombie_b, 55679, 220129, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  552.                 addSpawn(pirates_zombie_captain_b, 54236, 220948, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  553.                 addSpawn(pirates_zombie_captain_b, 54464, 219095, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  554.                 addSpawn(vale_master_b, 54226, 218797, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  555.                 addSpawn(vale_master_b, 54394, 219067, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  556.                 addSpawn(pirates_zombie_b, 54139, 219253, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  557.                 addSpawn(doll_blader_b, 54262, 219480, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  558.                 addSpawn(pirates_zombie_captain_b, 53412, 218077, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  559.                 addSpawn(pirates_zombie_captain_b, 54280, 217200, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  560.                 addSpawn(pirates_zombie_b, 55440, 218081, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  561.                 addSpawn(pirates_zombie_captain_b, 55202, 217940, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  562.                 addSpawn(pirates_zombie_b, 55225, 218236, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  563.                 addSpawn(pirates_zombie_b, 54973, 218075, -2944, Rnd.get(65536), false, 0)/* .setIsRaidMinion(true) */;
  564.                 _ai4 = 8;
  565.                 cancelQuestTimer("1003", null, null);
  566.             }
  567.         }
  568.        
  569.         else if (event.equalsIgnoreCase("zaken_unlock"))
  570.         {
  571.             final L2GrandBossInstance zaken = (L2GrandBossInstance) addSpawn(ZAKEN, 55312, 219168, -3223, 0, false, 0);
  572.             GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
  573.             spawnBoss(zaken);
  574.         }
  575.         else if (event.equalsIgnoreCase("CreateOnePrivateEx"))
  576.         {
  577.             addSpawn(npc.getNpcId(), npc.getX(), npc.getY(), npc.getZ(), 0, false, 0)/* .setIsRaidMinion(true) */;
  578.         }
  579.         return super.onAdvEvent(event, npc, player);
  580.     }
  581.    
  582.     @Override
  583.     public String onFactionCall(final L2NpcInstance npc, final L2NpcInstance caller, final L2PcInstance attacker, final boolean isPet)
  584.     {
  585.         if (caller == null || npc == null)
  586.             return super.onFactionCall(npc, caller, attacker, isPet);
  587.         final int npcId = npc.getNpcId();
  588.         final int callerId = caller.getNpcId();
  589.        
  590.         if (getTimeHour() < 5 && callerId != ZAKEN && npcId == ZAKEN)
  591.         {
  592.             final int damage = 0; // well damage required :x
  593.             if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE && _ai0 == 0 && damage < 10 && Rnd.get((30 * 15)) < 1)// todo - damage missing
  594.             {
  595.                 _ai0 = 1;
  596.                 _ai1 = caller.getX();
  597.                 _ai2 = caller.getY();
  598.                 _ai3 = caller.getZ();
  599.                 startQuestTimer("1002", 300, caller, null);
  600.             }
  601.         }
  602.         return super.onFactionCall(npc, caller, attacker, isPet);
  603.     }
  604.    
  605.     @Override
  606.     public String onSpellFinished(final L2NpcInstance npc, final L2PcInstance player, final L2Skill skill)
  607.     {
  608.         if (npc.getNpcId() == ZAKEN)
  609.         {
  610.             final int skillId = skill.getId();
  611.             if (skillId == 4222)
  612.             {
  613.                 npc.teleToLocation(_ai1, _ai2, _ai3);
  614.                 npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
  615.             }
  616.             else if (skillId == 4216)
  617.             {
  618.                 final int i1 = Rnd.get(15);
  619.                 player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  620.                 ((L2Attackable) npc).stopHating(player);
  621.                 final L2Character nextTarget = ((L2Attackable) npc).getMostHated();
  622.                 if (nextTarget != null)
  623.                     npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
  624.                
  625.             }
  626.             else if (skillId == 4217)
  627.             {
  628.                 int i0 = 0;
  629.                 int i1 = Rnd.get(15);
  630.                 player.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  631.                 ((L2Attackable) npc).stopHating(player);
  632.                
  633.                 if (c_quest0 != null && _quest0 > 0 && c_quest0 != player && c_quest0.getZ() > (player.getZ() - 100) && c_quest0.getZ() < (player.getZ() + 100))
  634.                 {
  635.                     if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX())) + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY()))) > (250 * 250))
  636.                     {
  637.                         i0 = 1;
  638.                     }
  639.                     else
  640.                     {
  641.                         i0 = 0;
  642.                     }
  643.                     if (i0 == 0)
  644.                     {
  645.                         i1 = Rnd.get(15);
  646.                         c_quest0.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  647.                         ((L2Attackable) npc).stopHating(c_quest0);
  648.                     }
  649.                 }
  650.                 if (c_quest1 != null && _quest0 > 1 && c_quest1 != player && c_quest1.getZ() > (player.getZ() - 100) && c_quest1.getZ() < (player.getZ() + 100))
  651.                 {
  652.                     if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX())) + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY()))) > (250 * 250))
  653.                     {
  654.                         i0 = 1;
  655.                     }
  656.                     else
  657.                     {
  658.                         i0 = 0;
  659.                     }
  660.                     if (i0 == 0)
  661.                     {
  662.                         i1 = Rnd.get(15);
  663.                         c_quest1.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  664.                         ((L2Attackable) npc).stopHating(c_quest1);
  665.                     }
  666.                 }
  667.                 if (c_quest2 != null && _quest0 > 2 && c_quest2 != player && c_quest2.getZ() > (player.getZ() - 100) && c_quest2.getZ() < (player.getZ() + 100))
  668.                 {
  669.                     if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX())) + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY()))) > (250 * 250))
  670.                     {
  671.                         i0 = 1;
  672.                     }
  673.                     else
  674.                     {
  675.                         i0 = 0;
  676.                     }
  677.                     if (i0 == 0)
  678.                     {
  679.                         i1 = Rnd.get(15);
  680.                         c_quest2.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  681.                         ((L2Attackable) npc).stopHating(c_quest2);
  682.                     }
  683.                 }
  684.                 if (c_quest3 != null && _quest0 > 3 && c_quest3 != player && c_quest3.getZ() > (player.getZ() - 100) && c_quest3.getZ() < (player.getZ() + 100))
  685.                 {
  686.                     if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX())) + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY()))) > (250 * 250))
  687.                     {
  688.                         i0 = 1;
  689.                     }
  690.                     else
  691.                     {
  692.                         i0 = 0;
  693.                     }
  694.                     if (i0 == 0)
  695.                     {
  696.                         i1 = Rnd.get(15);
  697.                         c_quest3.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  698.                         ((L2Attackable) npc).stopHating(c_quest3);
  699.                     }
  700.                 }
  701.                 if (c_quest4 != null && _quest0 > 4 && c_quest4 != player && c_quest4.getZ() > (player.getZ() - 100) && c_quest4.getZ() < (player.getZ() + 100))
  702.                 {
  703.                     if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX())) + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY()))) > (250 * 250))
  704.                     {
  705.                         i0 = 1;
  706.                     }
  707.                     else
  708.                     {
  709.                         i0 = 0;
  710.                     }
  711.                     if (i0 == 0)
  712.                     {
  713.                         i1 = Rnd.get(15);
  714.                         c_quest4.teleToLocation(Xcoords[i1] + Rnd.get(650), Ycoords[i1] + Rnd.get(650), Zcoords[i1]);
  715.                         ((L2Attackable) npc).stopHating(c_quest4);
  716.                     }
  717.                 }
  718.                 final L2Character nextTarget = ((L2Attackable) npc).getMostHated();
  719.                 if (nextTarget != null)
  720.                     npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
  721.             }
  722.         }
  723.         return super.onSpellFinished(npc, player, skill);
  724.     }
  725.    
  726.     @Override
  727.     public String onAttack(final L2NpcInstance npc, final L2PcInstance attacker, final int damage, final boolean isPet)
  728.     {
  729.         final int npcId = npc.getNpcId();
  730.         if (npcId == ZAKEN)
  731.         {
  732.             if (attacker.getMountType() == 1)
  733.             {
  734.                 int sk_4258 = 0;
  735.                 final L2Effect[] effects = attacker.getAllEffects();
  736.                 if (effects != null && effects.length != 0)
  737.                 {
  738.                     for (final L2Effect e : effects)
  739.                     {
  740.                         if (e.getSkill().getId() == 4258)
  741.                         {
  742.                             sk_4258 = 1;
  743.                         }
  744.                     }
  745.                 }
  746.                 if (sk_4258 == 0)
  747.                 {
  748.                     npc.setTarget(attacker);
  749.                     npc.doCast(SkillTable.getInstance().getInfo(4258, 1));
  750.                 }
  751.             }
  752.             final L2Character originalAttacker = isPet ? attacker.getPet() : attacker;
  753.             final int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000);
  754.             ((L2Attackable) npc).addDamageHate(originalAttacker, 0, hate);
  755.             if (Rnd.get(10) < 1)
  756.             {
  757.                 final int i0 = Rnd.get((15 * 15));
  758.                 if (i0 < 1)
  759.                 {
  760.                     npc.setTarget(attacker);
  761.                     npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
  762.                 }
  763.                 else if (i0 < 2)
  764.                 {
  765.                     npc.setTarget(attacker);
  766.                     npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
  767.                 }
  768.                 else if (i0 < 4)
  769.                 {
  770.                     npc.setTarget(attacker);
  771.                     npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
  772.                 }
  773.                 else if (i0 < 8)
  774.                 {
  775.                     npc.setTarget(attacker);
  776.                     npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
  777.                 }
  778.                 else if (i0 < 15)
  779.                 {
  780.                     for (final L2Character character : npc.getKnownList().getKnownCharactersInRadius(100))
  781.                     {
  782.                         if (character != attacker)
  783.                             continue;
  784.                         if (attacker != ((L2Attackable) npc).getMostHated())
  785.                         {
  786.                             npc.setTarget(attacker);
  787.                             npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
  788.                         }
  789.                     }
  790.                 }
  791.                 if (Rnd.get(2) < 1)
  792.                 {
  793.                     if (attacker == ((L2Attackable) npc).getMostHated())
  794.                     {
  795.                         npc.setTarget(attacker);
  796.                         npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
  797.                     }
  798.                 }
  799.             }
  800.             if (getTimeHour() < 5)
  801.             {
  802.             }
  803.             else if (npc.getCurrentHp() < ((npc.getMaxHp() * _quest2) / 4.0))
  804.             {
  805.                 _quest2 = (_quest2 - 1);
  806.                 final int i2 = Rnd.get(15);
  807.                 _ai1 = Xcoords[i2] + Rnd.get(650);
  808.                 _ai2 = Ycoords[i2] + Rnd.get(650);
  809.                 _ai3 = Zcoords[i2];
  810.                 npc.setTarget(npc);
  811.                 npc.doCast(SkillTable.getInstance().getInfo(4222, 1));
  812.             }
  813.         }
  814.         return super.onAttack(npc, attacker, damage, isPet);
  815.     }
  816.    
  817.     @Override
  818.     public String onKill(final L2NpcInstance npc, final L2PcInstance killer, final boolean isPet)
  819.     {
  820.         final int npcId = npc.getNpcId();
  821.        
  822.         final Integer status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
  823.        
  824.         if (npcId == ZAKEN)
  825.         {
  826.             npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
  827.            
  828.             if (!npc.getSpawn().is_customBossInstance())
  829.             {
  830.                 GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
  831.                 // time is 36hour +/- 17hour
  832.                 final long respawnTime = (long) (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
  833.                 startQuestTimer("zaken_unlock", respawnTime, null, null);
  834.                 cancelQuestTimer("1001", npc, null);
  835.                 cancelQuestTimer("1003", npc, null);
  836.                 // also save the respawn time so that the info is maintained past reboots
  837.                 final StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
  838.                 info.set("respawn_time", System.currentTimeMillis() + respawnTime);
  839.                 GrandBossManager.getInstance().setStatsSet(ZAKEN, info);
  840.             }
  841.         }
  842.         else if (status == ALIVE)
  843.         {
  844.             if (npcId != ZAKEN)
  845.             {
  846.                 startQuestTimer("CreateOnePrivateEx", ((30 + Rnd.get(60)) * 1000), npc, null);
  847.             }
  848.         }
  849.         return super.onKill(npc, killer, isPet);
  850.     }
  851.    
  852.     /*
  853.      * public String onSkillSee(L2NpcInstance npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) { int npcId = npc.getNpcId(); if (npcId == ZAKEN) { if (skill.getAggroPoints() > 0) { ((L2Attackable) npc).addDamageHate(caster, 0, (((skill.getAggroPoints() / npc.getMaxHp()) *
  854.      * 10) * 150)); } if (Rnd.get(12) < 1) { int i0 = Rnd.get((15 * 15)); if (i0 < 1) { npc.setTarget(caster); npc.doCast(SkillTable.getInstance().getInfo(4216, 1)); } else if (i0 < 2) { npc.setTarget(caster); npc.doCast(SkillTable.getInstance().getInfo(4217, 1)); } else if (i0 < 4) {
  855.      * npc.setTarget(caster); npc.doCast(SkillTable.getInstance().getInfo(4219, 1)); } else if (i0 < 8) { npc.setTarget(caster); npc.doCast(SkillTable.getInstance().getInfo(4218, 1)); } else if (i0 < 15) { for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100)) { if
  856.      * (character != caster) continue; if (caster != ((L2Attackable) npc).getMostHated()) { npc.setTarget(caster); npc.doCast(SkillTable.getInstance().getInfo(4221, 1)); } } } if (Rnd.get(2) < 1) { if (caster == ((L2Attackable) npc).getMostHated()) { npc.setTarget(caster);
  857.      * npc.doCast(SkillTable.getInstance().getInfo(4220, 1)); } } } } return super.onSkillSee(npc, caster, skill, targets, isPet); }
  858.      */
  859.    
  860.     @Override
  861.     public String onAggroRangeEnter(final L2NpcInstance npc, final L2PcInstance player, final boolean isPet)
  862.     {
  863.         final int npcId = npc.getNpcId();
  864.         if (npcId == ZAKEN)
  865.         {
  866.             if (_Zone.isInsideZone(npc))
  867.             {
  868.                 final L2Character target = isPet ? player.getPet() : player;
  869.                 ((L2Attackable) npc).addDamageHate(target, 1, 200);
  870.             }
  871.             if (player.getZ() > (npc.getZ() - 100) && player.getZ() < (npc.getZ() + 100))
  872.             {
  873.                 if (_quest0 < 5 && Rnd.get(3) < 1)
  874.                 {
  875.                     if (_quest0 == 0)
  876.                     {
  877.                         c_quest0 = player;
  878.                     }
  879.                     else if (_quest0 == 1)
  880.                     {
  881.                         c_quest1 = player;
  882.                     }
  883.                     else if (_quest0 == 2)
  884.                     {
  885.                         c_quest2 = player;
  886.                     }
  887.                     else if (_quest0 == 3)
  888.                     {
  889.                         c_quest3 = player;
  890.                     }
  891.                     else if (_quest0 == 4)
  892.                     {
  893.                         c_quest4 = player;
  894.                     }
  895.                     _quest0++;
  896.                 }
  897.                 if (Rnd.get(15) < 1)
  898.                 {
  899.                     final int i0 = Rnd.get((15 * 15));
  900.                     if (i0 < 1)
  901.                     {
  902.                         npc.setTarget(player);
  903.                         npc.doCast(SkillTable.getInstance().getInfo(4216, 1));
  904.                     }
  905.                     else if (i0 < 2)
  906.                     {
  907.                         npc.setTarget(player);
  908.                         npc.doCast(SkillTable.getInstance().getInfo(4217, 1));
  909.                     }
  910.                     else if (i0 < 4)
  911.                     {
  912.                         npc.setTarget(player);
  913.                         npc.doCast(SkillTable.getInstance().getInfo(4219, 1));
  914.                     }
  915.                     else if (i0 < 8)
  916.                     {
  917.                         npc.setTarget(player);
  918.                         npc.doCast(SkillTable.getInstance().getInfo(4218, 1));
  919.                     }
  920.                     else if (i0 < 15)
  921.                     {
  922.                         for (final L2Character character : npc.getKnownList().getKnownCharactersInRadius(100))
  923.                         {
  924.                             if (character != player)
  925.                                 continue;
  926.                             if (player != ((L2Attackable) npc).getMostHated())
  927.                             {
  928.                                 npc.setTarget(player);
  929.                                 npc.doCast(SkillTable.getInstance().getInfo(4221, 1));
  930.                             }
  931.                         }
  932.                     }
  933.                     if (Rnd.get(2) < 1)
  934.                     {
  935.                         if (player == ((L2Attackable) npc).getMostHated())
  936.                         {
  937.                             npc.setTarget(player);
  938.                             npc.doCast(SkillTable.getInstance().getInfo(4220, 1));
  939.                         }
  940.                     }
  941.                 }
  942.             }
  943.         }
  944.         return super.onAggroRangeEnter(npc, player, isPet);
  945.     }
  946.    
  947.     public int getTimeHour()
  948.     {
  949.         return (GameTimeController.getInstance().getGameTime() / 60) % 24;
  950.     }
  951.    
  952.     @Override
  953.     public void run()
  954.     {
  955.     }
  956. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement