- Timestamp:
- Jan 16, 2012 7:56:19 AM (4 months ago)
- Location:
- trunk/L2J_DataPack
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
dist/game/data/scripts/ai/individual/DarkWaterDragon.java (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/L2J_DataPack
- Property svn:mergeinfo changed
/branches/unstable/L2J_DataPack_BETA merged: 8407-8426,8428-8480,8482-8491,8493-8588,8590-8629
- Property svn:mergeinfo changed
-
trunk/L2J_DataPack/dist/game/data/scripts/ai/individual/DarkWaterDragon.java
r7665 r8630 14 14 */ 15 15 package ai.individual; 16 17 16 18 17 import javolution.util.FastMap; … … 35 34 private static final int DETRACTOR1 = 22270; 36 35 private static final int DETRACTOR2 = 22271; 37 private static FastSet<Integer> secondSpawn = new FastSet<Integer>(); // Used to track if second Shades were already spawned38 private static FastSet<Integer> myTrackingSet = new FastSet<Integer>(); // Used to track instances of npcs39 private static FastMap<Integer, L2PcInstance> _idmap = new FastMap<Integer, L2PcInstance>().shared(); // Used to track instances of npcs36 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 40 39 41 40 public DarkWaterDragon(int id, String name, String descr) 42 41 { 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); 46 48 myTrackingSet.clear(); 47 49 secondSpawn.clear(); 48 50 } 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) 51 54 { 52 55 if (npc != null) 53 56 { 54 if (event.equalsIgnoreCase("first_spawn")) // timer to start timer "1"55 { 56 this.startQuestTimer("1",40000, npc, null, true); //spawns detractor every 40 seconds57 } 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 seconds61 } 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 seconds65 } 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 seconds69 } 70 else if (event.equalsIgnoreCase("1")) // spawns a detractor71 { 72 this.addSpawn(DETRACTOR1,(npc.getX()+100),(npc.getY()+100),npc.getZ(),0,false,40000);73 } 74 else if (event.equalsIgnoreCase("2")) // spawns a detractor75 { 76 this.addSpawn(DETRACTOR2,(npc.getX()+100),(npc.getY()-100),npc.getZ(),0,false,40000);77 } 78 else if (event.equalsIgnoreCase("3")) // spawns a detractor79 { 80 this.addSpawn(DETRACTOR1,(npc.getX()-100),(npc.getY()+100),npc.getZ(),0,false,40000);81 } 82 else if (event.equalsIgnoreCase("4")) // spawns a detractor83 { 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 reward87 { 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); 93 96 94 97 myTrackingSet.remove(npc.getObjectId()); 95 98 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); 98 101 99 102 npc.deleteMe(); 100 103 } 101 else if (event.equalsIgnoreCase("fafurion_poison")) //Reduces Fafurions hp like it is poisoned104 else if (event.equalsIgnoreCase("fafurion_poison")) // Reduces Fafurions hp like it is poisoned 102 105 { 103 106 if (npc.getCurrentHp() <= 500) 104 107 { 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); 114 117 myTrackingSet.remove(npc.getObjectId()); 115 118 _idmap.remove(npc.getObjectId()); 116 119 } 117 npc.reduceCurrentHp(500, npc, null); // poison kills Fafurion if he is not healed118 } 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) 125 128 { 126 129 int npcId = npc.getNpcId(); … … 128 131 if (npcId == DRAGON) 129 132 { 130 if (!myTrackingSet.contains(npcObjId)) // this allows to handle multiple instances of npc133 if (!myTrackingSet.contains(npcObjId)) // this allows to handle multiple instances of npc 131 134 { 132 135 myTrackingSet.add(npcObjId); 133 // Spawn first 5 shades on first attack on Dark Water Dragon134 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; 135 138 spawnShade(originalAttacker, SHADE1, npc.getX() + 100, npc.getY() + 100, npc.getZ()); 136 139 spawnShade(originalAttacker, SHADE2, npc.getX() + 100, npc.getY() - 100, npc.getZ()); … … 142 145 { 143 146 secondSpawn.add(npcObjId); 144 // Spawn second 5 shades on half hp of on Dark Water Dragon145 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; 146 149 spawnShade(originalAttacker, SHADE2, npc.getX() + 100, npc.getY() + 100, npc.getZ()); 147 150 spawnShade(originalAttacker, SHADE1, npc.getX() + 100, npc.getY() - 100, npc.getZ()); … … 155 158 156 159 @Override 157 public String onKill (L2Npc npc, L2PcInstance killer, boolean isPet)160 public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet) 158 161 { 159 162 int npcId = npc.getNpcId(); … … 163 166 myTrackingSet.remove(npcObjId); 164 167 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 dead166 _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); 167 170 } 168 171 else if (npcId == FAFURION) 169 172 { 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); 180 183 myTrackingSet.remove(npcObjId); 181 184 _idmap.remove(npcObjId); 182 185 } 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) 188 191 { 189 192 int npcId = npc.getNpcId(); … … 194 197 { 195 198 myTrackingSet.add(npcObjId); 196 // Spawn 4 Detractors on spawn of Fafurion199 // Spawn 4 Detractors on spawn of Fafurion 197 200 int x = npc.getX(); 198 201 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 poisoned208 this.startQuestTimer("fafurion_despawn",120000, npc, null); //Fafurion Kindred disappears after two minutes202 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 209 212 } 210 213 } … … 214 217 public void spawnShade(L2Character attacker, int npcId, int x, int y, int z) 215 218 { 216 final L2Npc shade = addSpawn(npcId, x,y,z,0,false,0);219 final L2Npc shade = addSpawn(npcId, x, y, z, 0, false, 0); 217 220 shade.setRunning(); 218 ((L2Attackable) shade).addDamageHate(attacker,0,999);221 ((L2Attackable) shade).addDamageHate(attacker, 0, 999); 219 222 shade.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); 220 223 } … … 223 226 { 224 227 // Quest class and state definition 225 new DarkWaterDragon(-1, "DarkWaterDragon","ai");228 new DarkWaterDragon(-1, "DarkWaterDragon", "ai"); 226 229 } 227 230 }
Note: See TracChangeset
for help on using the changeset viewer.
