Ignore:
Timestamp:
Jan 16, 2012 7:56:19 AM (4 months ago)
Author:
MELERIX
Message:

STABLE: Sync with BETA [8629]

Location:
trunk/L2J_DataPack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/L2J_DataPack

  • trunk/L2J_DataPack/dist/game/data/scripts/ai/individual/DarkWaterDragon.java

    r7665 r8630  
    1414 */ 
    1515package ai.individual; 
    16  
    1716 
    1817import javolution.util.FastMap; 
     
    3534        private static final int DETRACTOR1 = 22270; 
    3635        private static final int DETRACTOR2 = 22271; 
    37         private static FastSet<Integer> secondSpawn = new FastSet<Integer>(); //Used to track if second Shades were already spawned 
    38         private static FastSet<Integer> myTrackingSet = new FastSet<Integer>(); //Used to track instances of npcs 
    39         private static FastMap<Integer, L2PcInstance> _idmap = new FastMap<Integer, L2PcInstance>().shared(); //Used to track instances of npcs 
     36        private static FastSet<Integer> secondSpawn = new FastSet<Integer>(); // Used to track if second Shades were already spawned 
     37        private static FastSet<Integer> myTrackingSet = new FastSet<Integer>(); // Used to track instances of npcs 
     38        private static FastMap<Integer, L2PcInstance> _idmap = new FastMap<Integer, L2PcInstance>().shared(); // Used to track instances of npcs 
    4039         
    4140        public DarkWaterDragon(int id, String name, String descr) 
    4241        { 
    43                 super(id,name,descr); 
    44                 int[] mobs = {DRAGON, SHADE1, SHADE2, FAFURION, DETRACTOR1, DETRACTOR2}; 
    45                 this.registerMobs(mobs, QuestEventType.ON_KILL, QuestEventType.ON_SPAWN, QuestEventType.ON_ATTACK); 
     42                super(id, name, descr); 
     43                int[] mobs = 
     44                { 
     45                        DRAGON, SHADE1, SHADE2, FAFURION, DETRACTOR1, DETRACTOR2 
     46                }; 
     47                registerMobs(mobs, QuestEventType.ON_KILL, QuestEventType.ON_SPAWN, QuestEventType.ON_ATTACK); 
    4648                myTrackingSet.clear(); 
    4749                secondSpawn.clear(); 
    4850        } 
    49         @Override 
    50         public String onAdvEvent (String event, L2Npc npc, L2PcInstance player) 
     51         
     52        @Override 
     53        public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) 
    5154        { 
    5255                if (npc != null) 
    5356                { 
    54                         if (event.equalsIgnoreCase("first_spawn")) //timer to start timer "1" 
    55                         { 
    56                                 this.startQuestTimer("1",40000, npc, null, true); //spawns detractor every 40 seconds 
    57                         } 
    58                         else if (event.equalsIgnoreCase("second_spawn")) //timer to start timer "2" 
    59                         { 
    60                                 this.startQuestTimer("2",40000, npc, null, true); //spawns detractor every 40 seconds 
    61                         } 
    62                         else if (event.equalsIgnoreCase("third_spawn")) //timer to start timer "3" 
    63                         { 
    64                                 this.startQuestTimer("3",40000, npc, null, true); //spawns detractor every 40 seconds 
    65                         } 
    66                         else if (event.equalsIgnoreCase("fourth_spawn")) //timer to start timer "4" 
    67                         { 
    68                                 this.startQuestTimer("4",40000, npc, null, true); //spawns detractor every 40 seconds 
    69                         } 
    70                         else if (event.equalsIgnoreCase("1")) //spawns a detractor 
    71                         { 
    72                                 this.addSpawn(DETRACTOR1,(npc.getX()+100),(npc.getY()+100),npc.getZ(),0,false,40000); 
    73                         } 
    74                         else if (event.equalsIgnoreCase("2")) //spawns a detractor 
    75                         { 
    76                                 this.addSpawn(DETRACTOR2,(npc.getX()+100),(npc.getY()-100),npc.getZ(),0,false,40000); 
    77                         } 
    78                         else if (event.equalsIgnoreCase("3")) //spawns a detractor 
    79                         { 
    80                                 this.addSpawn(DETRACTOR1,(npc.getX()-100),(npc.getY()+100),npc.getZ(),0,false,40000); 
    81                         } 
    82                         else if (event.equalsIgnoreCase("4")) //spawns a detractor 
    83                         { 
    84                                 this.addSpawn(DETRACTOR2,(npc.getX()-100),(npc.getY()-100),npc.getZ(),0,false,40000); 
    85                         } 
    86                         else if (event.equalsIgnoreCase("fafurion_despawn"))    //Fafurion Kindred disappears and drops reward 
    87                         { 
    88                                 this.cancelQuestTimer("fafurion_poison", npc, null); 
    89                                 this.cancelQuestTimer("1", npc, null); 
    90                                 this.cancelQuestTimer("2", npc, null); 
    91                                 this.cancelQuestTimer("3", npc, null); 
    92                                 this.cancelQuestTimer("4", npc, null); 
     57                        if (event.equalsIgnoreCase("first_spawn")) // timer to start timer "1" 
     58                        { 
     59                                startQuestTimer("1", 40000, npc, null, true); // spawns detractor every 40 seconds 
     60                        } 
     61                        else if (event.equalsIgnoreCase("second_spawn")) // timer to start timer "2" 
     62                        { 
     63                                startQuestTimer("2", 40000, npc, null, true); // spawns detractor every 40 seconds 
     64                        } 
     65                        else if (event.equalsIgnoreCase("third_spawn")) // timer to start timer "3" 
     66                        { 
     67                                startQuestTimer("3", 40000, npc, null, true); // spawns detractor every 40 seconds 
     68                        } 
     69                        else if (event.equalsIgnoreCase("fourth_spawn")) // timer to start timer "4" 
     70                        { 
     71                                startQuestTimer("4", 40000, npc, null, true); // spawns detractor every 40 seconds 
     72                        } 
     73                        else if (event.equalsIgnoreCase("1")) // spawns a detractor 
     74                        { 
     75                                addSpawn(DETRACTOR1, (npc.getX() + 100), (npc.getY() + 100), npc.getZ(), 0, false, 40000); 
     76                        } 
     77                        else if (event.equalsIgnoreCase("2")) // spawns a detractor 
     78                        { 
     79                                addSpawn(DETRACTOR2, (npc.getX() + 100), (npc.getY() - 100), npc.getZ(), 0, false, 40000); 
     80                        } 
     81                        else if (event.equalsIgnoreCase("3")) // spawns a detractor 
     82                        { 
     83                                addSpawn(DETRACTOR1, (npc.getX() - 100), (npc.getY() + 100), npc.getZ(), 0, false, 40000); 
     84                        } 
     85                        else if (event.equalsIgnoreCase("4")) // spawns a detractor 
     86                        { 
     87                                addSpawn(DETRACTOR2, (npc.getX() - 100), (npc.getY() - 100), npc.getZ(), 0, false, 40000); 
     88                        } 
     89                        else if (event.equalsIgnoreCase("fafurion_despawn")) // Fafurion Kindred disappears and drops reward 
     90                        { 
     91                                cancelQuestTimer("fafurion_poison", npc, null); 
     92                                cancelQuestTimer("1", npc, null); 
     93                                cancelQuestTimer("2", npc, null); 
     94                                cancelQuestTimer("3", npc, null); 
     95                                cancelQuestTimer("4", npc, null); 
    9396                                 
    9497                                myTrackingSet.remove(npc.getObjectId()); 
    9598                                player = _idmap.remove(npc.getObjectId()); 
    96                                 if(player != null) //You never know ... 
    97                                         ((L2Attackable)npc).doItemDrop(NpcTable.getInstance().getTemplate(18485), player); 
     99                                if (player != null) // You never know ... 
     100                                        ((L2Attackable) npc).doItemDrop(NpcTable.getInstance().getTemplate(18485), player); 
    98101                                 
    99102                                npc.deleteMe(); 
    100103                        } 
    101                         else if (event.equalsIgnoreCase("fafurion_poison"))    //Reduces Fafurions hp like it is poisoned 
     104                        else if (event.equalsIgnoreCase("fafurion_poison")) // Reduces Fafurions hp like it is poisoned 
    102105                        { 
    103106                                if (npc.getCurrentHp() <= 500) 
    104107                                { 
    105                                         this.cancelQuestTimer("fafurion_despawn", npc, null); 
    106                                         this.cancelQuestTimer("first_spawn", npc, null); 
    107                                         this.cancelQuestTimer("second_spawn", npc, null); 
    108                                         this.cancelQuestTimer("third_spawn", npc, null); 
    109                                         this.cancelQuestTimer("fourth_spawn", npc, null); 
    110                                         this.cancelQuestTimer("1", npc, null); 
    111                                         this.cancelQuestTimer("2", npc, null); 
    112                                         this.cancelQuestTimer("3", npc, null); 
    113                                         this.cancelQuestTimer("4", npc, null); 
     108                                        cancelQuestTimer("fafurion_despawn", npc, null); 
     109                                        cancelQuestTimer("first_spawn", npc, null); 
     110                                        cancelQuestTimer("second_spawn", npc, null); 
     111                                        cancelQuestTimer("third_spawn", npc, null); 
     112                                        cancelQuestTimer("fourth_spawn", npc, null); 
     113                                        cancelQuestTimer("1", npc, null); 
     114                                        cancelQuestTimer("2", npc, null); 
     115                                        cancelQuestTimer("3", npc, null); 
     116                                        cancelQuestTimer("4", npc, null); 
    114117                                        myTrackingSet.remove(npc.getObjectId()); 
    115118                                        _idmap.remove(npc.getObjectId()); 
    116119                                } 
    117                                 npc.reduceCurrentHp(500, npc, null); //poison kills Fafurion if he is not healed 
    118                         } 
    119                 } 
    120                 return super.onAdvEvent(event,npc,player); 
    121         } 
    122          
    123         @Override 
    124         public String onAttack (L2Npc npc, L2PcInstance attacker, int damage, boolean isPet) 
     120                                npc.reduceCurrentHp(500, npc, null); // poison kills Fafurion if he is not healed 
     121                        } 
     122                } 
     123                return super.onAdvEvent(event, npc, player); 
     124        } 
     125         
     126        @Override 
     127        public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet) 
    125128        { 
    126129                int npcId = npc.getNpcId(); 
     
    128131                if (npcId == DRAGON) 
    129132                { 
    130                         if (!myTrackingSet.contains(npcObjId)) //this allows to handle multiple instances of npc 
     133                        if (!myTrackingSet.contains(npcObjId)) // this allows to handle multiple instances of npc 
    131134                        { 
    132135                                myTrackingSet.add(npcObjId); 
    133                                 //Spawn first 5 shades on first attack on Dark Water Dragon 
    134                                 L2Character originalAttacker = isPet? attacker.getPet(): attacker; 
     136                                // Spawn first 5 shades on first attack on Dark Water Dragon 
     137                                L2Character originalAttacker = isPet ? attacker.getPet() : attacker; 
    135138                                spawnShade(originalAttacker, SHADE1, npc.getX() + 100, npc.getY() + 100, npc.getZ()); 
    136139                                spawnShade(originalAttacker, SHADE2, npc.getX() + 100, npc.getY() - 100, npc.getZ()); 
     
    142145                        { 
    143146                                secondSpawn.add(npcObjId); 
    144                                 //Spawn second 5 shades on half hp of on Dark Water Dragon 
    145                                 L2Character originalAttacker = isPet? attacker.getPet(): attacker; 
     147                                // Spawn second 5 shades on half hp of on Dark Water Dragon 
     148                                L2Character originalAttacker = isPet ? attacker.getPet() : attacker; 
    146149                                spawnShade(originalAttacker, SHADE2, npc.getX() + 100, npc.getY() + 100, npc.getZ()); 
    147150                                spawnShade(originalAttacker, SHADE1, npc.getX() + 100, npc.getY() - 100, npc.getZ()); 
     
    155158         
    156159        @Override 
    157         public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet) 
     160        public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) 
    158161        { 
    159162                int npcId = npc.getNpcId(); 
     
    163166                        myTrackingSet.remove(npcObjId); 
    164167                        secondSpawn.remove(npcObjId); 
    165                         L2Attackable faf = (L2Attackable) this.addSpawn(FAFURION,npc.getX(),npc.getY(),npc.getZ(),0,false,0); //spawns Fafurion Kindred when Dard Water Dragon is dead 
    166                         _idmap.put(faf.getObjectId(),killer); 
     168                        L2Attackable faf = (L2Attackable) addSpawn(FAFURION, npc.getX(), npc.getY(), npc.getZ(), 0, false, 0); // spawns Fafurion Kindred when Dard Water Dragon is dead 
     169                        _idmap.put(faf.getObjectId(), killer); 
    167170                } 
    168171                else if (npcId == FAFURION) 
    169172                { 
    170                         this.cancelQuestTimer("fafurion_poison", npc, null); 
    171                         this.cancelQuestTimer("fafurion_despawn", npc, null); 
    172                         this.cancelQuestTimer("first_spawn", npc, null); 
    173                         this.cancelQuestTimer("second_spawn", npc, null); 
    174                         this.cancelQuestTimer("third_spawn", npc, null); 
    175                         this.cancelQuestTimer("fourth_spawn", npc, null); 
    176                         this.cancelQuestTimer("1", npc, null); 
    177                         this.cancelQuestTimer("2", npc, null); 
    178                         this.cancelQuestTimer("3", npc, null); 
    179                         this.cancelQuestTimer("4", npc, null); 
     173                        cancelQuestTimer("fafurion_poison", npc, null); 
     174                        cancelQuestTimer("fafurion_despawn", npc, null); 
     175                        cancelQuestTimer("first_spawn", npc, null); 
     176                        cancelQuestTimer("second_spawn", npc, null); 
     177                        cancelQuestTimer("third_spawn", npc, null); 
     178                        cancelQuestTimer("fourth_spawn", npc, null); 
     179                        cancelQuestTimer("1", npc, null); 
     180                        cancelQuestTimer("2", npc, null); 
     181                        cancelQuestTimer("3", npc, null); 
     182                        cancelQuestTimer("4", npc, null); 
    180183                        myTrackingSet.remove(npcObjId); 
    181184                        _idmap.remove(npcObjId); 
    182185                } 
    183                 return super.onKill(npc,killer,isPet); 
    184         } 
    185          
    186         @Override 
    187         public String onSpawn (L2Npc npc) 
     186                return super.onKill(npc, killer, isPet); 
     187        } 
     188         
     189        @Override 
     190        public String onSpawn(L2Npc npc) 
    188191        { 
    189192                int npcId = npc.getNpcId(); 
     
    194197                        { 
    195198                                myTrackingSet.add(npcObjId); 
    196                                 //Spawn 4 Detractors on spawn of Fafurion 
     199                                // Spawn 4 Detractors on spawn of Fafurion 
    197200                                int x = npc.getX(); 
    198201                                int y = npc.getY(); 
    199                                 this.addSpawn(DETRACTOR2,x+100,y+100,npc.getZ(),0,false,40000); 
    200                                 this.addSpawn(DETRACTOR1,x+100,y-100,npc.getZ(),0,false,40000); 
    201                                 this.addSpawn(DETRACTOR2,x-100,y+100,npc.getZ(),0,false,40000); 
    202                                 this.addSpawn(DETRACTOR1,x-100,y-100,npc.getZ(),0,false,40000); 
    203                                 this.startQuestTimer("first_spawn",2000, npc, null); //timer to delay timer "1" 
    204                                 this.startQuestTimer("second_spawn",4000, npc, null); //timer to delay timer "2" 
    205                                 this.startQuestTimer("third_spawn",8000, npc, null); //timer to delay timer "3" 
    206                                 this.startQuestTimer("fourth_spawn",10000, npc, null); //timer to delay timer "4" 
    207                                 this.startQuestTimer("fafurion_poison",3000, npc, null, true); //Every three seconds reduces Fafurions hp like it is poisoned 
    208                                 this.startQuestTimer("fafurion_despawn",120000, npc, null); //Fafurion Kindred disappears after two minutes 
     202                                addSpawn(DETRACTOR2, x + 100, y + 100, npc.getZ(), 0, false, 40000); 
     203                                addSpawn(DETRACTOR1, x + 100, y - 100, npc.getZ(), 0, false, 40000); 
     204                                addSpawn(DETRACTOR2, x - 100, y + 100, npc.getZ(), 0, false, 40000); 
     205                                addSpawn(DETRACTOR1, x - 100, y - 100, npc.getZ(), 0, false, 40000); 
     206                                startQuestTimer("first_spawn", 2000, npc, null); // timer to delay timer "1" 
     207                                startQuestTimer("second_spawn", 4000, npc, null); // timer to delay timer "2" 
     208                                startQuestTimer("third_spawn", 8000, npc, null); // timer to delay timer "3" 
     209                                startQuestTimer("fourth_spawn", 10000, npc, null); // timer to delay timer "4" 
     210                                startQuestTimer("fafurion_poison", 3000, npc, null, true); // Every three seconds reduces Fafurions hp like it is poisoned 
     211                                startQuestTimer("fafurion_despawn", 120000, npc, null); // Fafurion Kindred disappears after two minutes 
    209212                        } 
    210213                } 
     
    214217        public void spawnShade(L2Character attacker, int npcId, int x, int y, int z) 
    215218        { 
    216                 final L2Npc shade = addSpawn(npcId,x,y,z,0,false,0); 
     219                final L2Npc shade = addSpawn(npcId, x, y, z, 0, false, 0); 
    217220                shade.setRunning(); 
    218                 ((L2Attackable)shade).addDamageHate(attacker,0,999); 
     221                ((L2Attackable) shade).addDamageHate(attacker, 0, 999); 
    219222                shade.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); 
    220223        } 
     
    223226        { 
    224227                // Quest class and state definition 
    225                 new DarkWaterDragon(-1,"DarkWaterDragon","ai"); 
     228                new DarkWaterDragon(-1, "DarkWaterDragon", "ai"); 
    226229        } 
    227230} 
Note: See TracChangeset for help on using the changeset viewer.