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/Gordon.java

    r7691 r8630  
    3030 * Gordon AI 
    3131 * @author TOFIZ 
    32  * @version $Revision: 1.1 $ $Date: 2008/08/21 $ 
    3332 */ 
    3433public class Gordon extends L2AttackableAIScript 
     
    3938        private static int _isWalkTo = 0; 
    4039        private static int _npcBlock = 0; 
    41         private static int X = 0; 
    42         private static int Y = 0; 
    43         private static int Z = 0; 
    44         private static final int[][] WALKS = { 
    45                 {141569, -45908, -2387},{142494, -45456, -2397},{142922, -44561, -2395}, 
    46                 {143672, -44130, -2398},{144557, -43378, -2325},{145839, -43267, -2301}, 
    47                 {147044, -43601, -2307},{148140, -43206, -2303},{148815, -43434, -2328}, 
    48                 {149862, -44151, -2558},{151037, -44197, -2708},{152555, -42756, -2836}, 
    49                 {154808, -39546, -3236},{155333, -39962, -3272},{156531, -41240, -3470}, 
    50                 {156863, -43232, -3707},{156783, -44198, -3764},{158169, -45163, -3541}, 
    51                 {158952, -45479, -3473},{160039, -46514, -3634},{160244, -47429, -3656}, 
    52                 {159155, -48109, -3665},{159558, -51027, -3523},{159396, -53362, -3244}, 
    53                 {160872, -56556, -2789},{160857, -59072, -2613},{160410, -59888, -2647}, 
    54                 {158770, -60173, -2673},{156368, -59557, -2638},{155188, -59868, -2642}, 
    55                 {154118, -60591, -2731},{153571, -61567, -2821},{153457, -62819, -2886}, 
    56                 {152939, -63778, -3003},{151816, -64209, -3120},{147655, -64826, -3433}, 
    57                 {145422, -64576, -3369},{144097, -64320, -3404},{140780, -61618, -3096}, 
    58                 {139688, -61450, -3062},{138267, -61743, -3056},{138613, -58491, -3465}, 
    59                 {138139, -57252, -3517},{139555, -56044, -3310},{139107, -54537, -3240}, 
    60                 {139279, -53781, -3091},{139810, -52687, -2866},{139657, -52041, -2793}, 
    61                 {139215, -51355, -2698},{139334, -50514, -2594},{139817, -49715, -2449}, 
    62                 {139824, -48976, -2263},{140130, -47578, -2213},{140483, -46339, -2382}, 
    63                 {141569, -45908, -2387}}; 
     40        private static final L2CharPosition[] WALKS =  
     41        { 
     42                new L2CharPosition(141569, -45908, -2387, 0), 
     43                new L2CharPosition(142494, -45456, -2397, 0), 
     44                new L2CharPosition(142922, -44561, -2395, 0), 
     45                new L2CharPosition(143672, -44130, -2398, 0), 
     46                new L2CharPosition(144557, -43378, -2325, 0), 
     47                new L2CharPosition(145839, -43267, -2301, 0), 
     48                new L2CharPosition(147044, -43601, -2307, 0), 
     49                new L2CharPosition(148140, -43206, -2303, 0), 
     50                new L2CharPosition(148815, -43434, -2328, 0), 
     51                new L2CharPosition(149862, -44151, -2558, 0), 
     52                new L2CharPosition(151037, -44197, -2708, 0), 
     53                new L2CharPosition(152555, -42756, -2836, 0), 
     54                new L2CharPosition(154808, -39546, -3236, 0), 
     55                new L2CharPosition(155333, -39962, -3272, 0), 
     56                new L2CharPosition(156531, -41240, -3470, 0), 
     57                new L2CharPosition(156863, -43232, -3707, 0), 
     58                new L2CharPosition(156783, -44198, -3764, 0), 
     59                new L2CharPosition(158169, -45163, -3541, 0), 
     60                new L2CharPosition(158952, -45479, -3473, 0), 
     61                new L2CharPosition(160039, -46514, -3634, 0), 
     62                new L2CharPosition(160244, -47429, -3656, 0), 
     63                new L2CharPosition(159155, -48109, -3665, 0), 
     64                new L2CharPosition(159558, -51027, -3523, 0), 
     65                new L2CharPosition(159396, -53362, -3244, 0), 
     66                new L2CharPosition(160872, -56556, -2789, 0), 
     67                new L2CharPosition(160857, -59072, -2613, 0), 
     68                new L2CharPosition(160410, -59888, -2647, 0), 
     69                new L2CharPosition(158770, -60173, -2673, 0), 
     70                new L2CharPosition(156368, -59557, -2638, 0), 
     71                new L2CharPosition(155188, -59868, -2642, 0), 
     72                new L2CharPosition(154118, -60591, -2731, 0), 
     73                new L2CharPosition(153571, -61567, -2821, 0), 
     74                new L2CharPosition(153457, -62819, -2886, 0), 
     75                new L2CharPosition(152939, -63778, -3003, 0), 
     76                new L2CharPosition(151816, -64209, -3120, 0), 
     77                new L2CharPosition(147655, -64826, -3433, 0), 
     78                new L2CharPosition(145422, -64576, -3369, 0), 
     79                new L2CharPosition(144097, -64320, -3404, 0), 
     80                new L2CharPosition(140780, -61618, -3096, 0), 
     81                new L2CharPosition(139688, -61450, -3062, 0), 
     82                new L2CharPosition(138267, -61743, -3056, 0), 
     83                new L2CharPosition(138613, -58491, -3465, 0), 
     84                new L2CharPosition(138139, -57252, -3517, 0), 
     85                new L2CharPosition(139555, -56044, -3310, 0), 
     86                new L2CharPosition(139107, -54537, -3240, 0), 
     87                new L2CharPosition(139279, -53781, -3091, 0), 
     88                new L2CharPosition(139810, -52687, -2866, 0), 
     89                new L2CharPosition(139657, -52041, -2793, 0), 
     90                new L2CharPosition(139215, -51355, -2698, 0), 
     91                new L2CharPosition(139334, -50514, -2594, 0), 
     92                new L2CharPosition(139817, -49715, -2449, 0), 
     93                new L2CharPosition(139824, -48976, -2263, 0), 
     94                new L2CharPosition(140130, -47578, -2213, 0), 
     95                new L2CharPosition(140483, -46339, -2382, 0), 
     96                new L2CharPosition(141569, -45908, -2387, 0) 
     97        }; 
    6498         
    6599        private static boolean _isAttacked = false; 
    66100        private static boolean _isSpawned = false; 
    67101         
    68         public Gordon (int id, String name, String descr) 
    69         { 
    70                 super(id,name,descr); 
    71                 int[] mobs = {GORDON}; 
     102        public Gordon(int id, String name, String descr) 
     103        { 
     104                super(id, name, descr); 
     105                int[] mobs = 
     106                { 
     107                        GORDON 
     108                }; 
    72109                registerMobs(mobs, QuestEventType.ON_ATTACK, QuestEventType.ON_KILL, QuestEventType.ON_SPAWN); 
    73110                // wait 2 minutes after Start AI 
     
    97134         
    98135        @Override 
    99         public String onAdvEvent (String event, L2Npc npc, L2PcInstance player) 
    100         { 
    101                 X = WALKS[_isWalkTo-1][0]; 
    102                 Y = WALKS[_isWalkTo-1][1]; 
    103                 Z = WALKS[_isWalkTo-1][2]; 
     136        public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) 
     137        { 
     138                L2CharPosition loc = WALKS[_isWalkTo - 1]; 
    104139                if (event.equalsIgnoreCase("time_isAttacked")) 
    105140                { 
     
    108143                        { 
    109144                                npc.setWalking(); 
    110                                 npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(X, Y, Z, 0)); 
     145                                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc); 
    111146                        } 
    112147                } 
     
    137172                                                for (L2PcInstance pc : chars) 
    138173                                                { 
    139                                                         if (pc.isCursedWeaponEquipped() && pc.isInsideRadius(npc,5000,false,false)) 
     174                                                        if (pc.isCursedWeaponEquipped() && pc.isInsideRadius(npc, 5000, false, false)) 
    140175                                                        { 
    141176                                                                npc.setRunning(); 
    142                                                                 ((L2Attackable)npc).addDamageHate(pc,0,9999); 
     177                                                                ((L2Attackable) npc).addDamageHate(pc, 0, 9999); 
    143178                                                                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, pc); 
    144179                                                                _isAttacked = true; 
    145                                                                 cancelQuestTimer("time_isAttacked",null, null); 
    146                                                                 startQuestTimer("time_isAttacked",180000, npc, null); 
     180                                                                cancelQuestTimer("time_isAttacked", null, null); 
     181                                                                startQuestTimer("time_isAttacked", 180000, npc, null); 
    147182                                                                return super.onAdvEvent(event, npc, player); 
    148183                                                        } 
     
    153188                                if (_isAttacked == true) 
    154189                                        return super.onAdvEvent(event, npc, player); 
    155                                 if (npc.getNpcId() == GORDON && (npc.getX()-50) <= X && (npc.getX()+50) >= X && (npc.getY()-50) <= Y && (npc.getY()+50) >= Y) 
     190                                if (npc.getNpcId() == GORDON && (npc.getX() - 50) <= loc.x && (npc.getX() + 50) >= loc.y && (npc.getY() - 50) <= loc.y && (npc.getY() + 50) >= loc.y) 
    156191                                { 
    157192                                        _isWalkTo++; 
    158193                                        if (_isWalkTo > 55) 
    159194                                                _isWalkTo = 1; 
    160                                         X = WALKS[_isWalkTo-1][0]; 
    161                                         Y = WALKS[_isWalkTo-1][1]; 
    162                                         Z = WALKS[_isWalkTo-1][2]; 
     195                                        loc = WALKS[_isWalkTo - 1]; 
    163196                                        npc.setWalking(); 
    164                                         npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,new L2CharPosition(X, Y, Z, 0)); 
     197                                        npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc); 
    165198                                } 
    166199                                 
     
    177210                                        if (_npcBlock > 2) 
    178211                                        { 
    179                                                 npc.teleToLocation(X, Y, Z); 
     212                                                npc.teleToLocation(loc.x, loc.y, loc.z); 
    180213                                                return super.onAdvEvent(event, npc, player); 
    181214                                        } 
    182215                                        if (_npcBlock > 0) 
    183                                                 npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,new L2CharPosition(X, Y, Z, 0)); 
     216                                                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, loc); 
    184217                                } 
    185218                                // End Test unblock Npc 
     
    190223         
    191224        @Override 
    192         public String onSpawn (L2Npc npc) 
     225        public String onSpawn(L2Npc npc) 
    193226        { 
    194227                if (npc.getNpcId() == GORDON && _npcBlock == 0) 
     
    202235         
    203236        @Override 
    204         public String onAttack (L2Npc npc, L2PcInstance player, int damage, boolean isPet) 
     237        public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet) 
    205238        { 
    206239                if (npc.getNpcId() == GORDON) 
     
    212245                        { 
    213246                                npc.setRunning(); 
    214                                 ((L2Attackable)npc).addDamageHate(player, 0, 100); 
     247                                ((L2Attackable) npc).addDamageHate(player, 0, 100); 
    215248                                npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); 
    216249                        } 
     
    220253         
    221254        @Override 
    222         public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet) 
     255        public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) 
    223256        { 
    224257                if (npc.getNpcId() == GORDON) 
     
    228261                        _isSpawned = false; 
    229262                } 
    230                 return super.onKill(npc,killer,isPet); 
     263                return super.onKill(npc, killer, isPet); 
    231264        } 
    232265         
    233266        public static void main(String[] args) 
    234267        { 
    235                 new Gordon(-1,"gordon","ai"); 
     268                new Gordon(-1, Gordon.class.getSimpleName(), "ai"); 
    236269        } 
    237270} 
Note: See TracChangeset for help on using the changeset viewer.