diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java index e6f4bfcdaf..ae6ef5fab3 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java @@ -16,9 +16,7 @@ */ package ai.areas.TalkingIsland; -import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.L2World; -import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -26,7 +24,7 @@ import ai.AbstractNpcAI; /** * Trainning Soldier AI. - * @author St3eT + * @author Mobius */ public final class TrainningSoldier extends AbstractNpcAI { @@ -36,42 +34,36 @@ public final class TrainningSoldier extends AbstractNpcAI private TrainningSoldier() { - addSeeCreatureId(SOLDIER); + addSpawnId(SOLDIER); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equals("START_ATTACK")) + if ((npc != null) && !npc.isDead()) { - //@formatter:off - final L2Npc dummy = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150) - .stream() - .filter(obj -> (obj.getId() == DUMMY)) - .findFirst() - .orElse(null); - //@formatter:on - - if (dummy != null) + if (!npc.isInCombat()) { - addAttackDesire(npc, dummy); - } - else - { - startQuestTimer("START_ATTACK", 250, npc, null); + for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150)) + { + if ((nearby != null) && (nearby.getId() == DUMMY)) + { + addAttackDesire(npc, nearby); + break; + } + } } + startQuestTimer("START_ATTACK", 10000, npc, null); } return super.onAdvEvent(event, npc, player); } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) + public String onSpawn(L2Npc npc) { - if (creature.isPlayer() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) - { - startQuestTimer("START_ATTACK", 250, npc, null); - } - return super.onSeeCreature(npc, creature, isSummon); + npc.setRandomAnimation(false); + startQuestTimer("START_ATTACK", 5000, npc, null); + return super.onSpawn(npc); } public static void main(String[] args) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/33000-33099.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/33000-33099.xml index 8e53592303..bd2a82cbbf 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/33000-33099.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/33000-33099.xml @@ -780,7 +780,7 @@ - + diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index f03731a7f7..a53a1af1f4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1171,13 +1171,8 @@ public class L2AttackableAI extends L2CharacterAI @Override protected void onEvtThink() { - // Check if the actor can't use skills - if (getActiveChar().isAllSkillsDisabled()) - { - return; - } - // Check if a thinking action isn't already in progress - if (_thinking) + // Check if the actor can't use skills and if a thinking action isn't already in progress + if (_thinking || getActiveChar().isAllSkillsDisabled()) { return; } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java index e6f4bfcdaf..ae6ef5fab3 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java @@ -16,9 +16,7 @@ */ package ai.areas.TalkingIsland; -import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.L2World; -import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -26,7 +24,7 @@ import ai.AbstractNpcAI; /** * Trainning Soldier AI. - * @author St3eT + * @author Mobius */ public final class TrainningSoldier extends AbstractNpcAI { @@ -36,42 +34,36 @@ public final class TrainningSoldier extends AbstractNpcAI private TrainningSoldier() { - addSeeCreatureId(SOLDIER); + addSpawnId(SOLDIER); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equals("START_ATTACK")) + if ((npc != null) && !npc.isDead()) { - //@formatter:off - final L2Npc dummy = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150) - .stream() - .filter(obj -> (obj.getId() == DUMMY)) - .findFirst() - .orElse(null); - //@formatter:on - - if (dummy != null) + if (!npc.isInCombat()) { - addAttackDesire(npc, dummy); - } - else - { - startQuestTimer("START_ATTACK", 250, npc, null); + for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150)) + { + if ((nearby != null) && (nearby.getId() == DUMMY)) + { + addAttackDesire(npc, nearby); + break; + } + } } + startQuestTimer("START_ATTACK", 10000, npc, null); } return super.onAdvEvent(event, npc, player); } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) + public String onSpawn(L2Npc npc) { - if (creature.isPlayer() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) - { - startQuestTimer("START_ATTACK", 250, npc, null); - } - return super.onSeeCreature(npc, creature, isSummon); + npc.setRandomAnimation(false); + startQuestTimer("START_ATTACK", 5000, npc, null); + return super.onSpawn(npc); } public static void main(String[] args) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/33000-33099.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/33000-33099.xml index 39e6ca3f8b..30807a4486 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/33000-33099.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/33000-33099.xml @@ -780,7 +780,7 @@ - + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java index e6f4bfcdaf..ae6ef5fab3 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java @@ -16,9 +16,7 @@ */ package ai.areas.TalkingIsland; -import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.L2World; -import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -26,7 +24,7 @@ import ai.AbstractNpcAI; /** * Trainning Soldier AI. - * @author St3eT + * @author Mobius */ public final class TrainningSoldier extends AbstractNpcAI { @@ -36,42 +34,36 @@ public final class TrainningSoldier extends AbstractNpcAI private TrainningSoldier() { - addSeeCreatureId(SOLDIER); + addSpawnId(SOLDIER); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equals("START_ATTACK")) + if ((npc != null) && !npc.isDead()) { - //@formatter:off - final L2Npc dummy = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150) - .stream() - .filter(obj -> (obj.getId() == DUMMY)) - .findFirst() - .orElse(null); - //@formatter:on - - if (dummy != null) + if (!npc.isInCombat()) { - addAttackDesire(npc, dummy); - } - else - { - startQuestTimer("START_ATTACK", 250, npc, null); + for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150)) + { + if ((nearby != null) && (nearby.getId() == DUMMY)) + { + addAttackDesire(npc, nearby); + break; + } + } } + startQuestTimer("START_ATTACK", 10000, npc, null); } return super.onAdvEvent(event, npc, player); } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) + public String onSpawn(L2Npc npc) { - if (creature.isPlayer() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) - { - startQuestTimer("START_ATTACK", 250, npc, null); - } - return super.onSeeCreature(npc, creature, isSummon); + npc.setRandomAnimation(false); + startQuestTimer("START_ATTACK", 5000, npc, null); + return super.onSpawn(npc); } public static void main(String[] args) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/33000-33099.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/33000-33099.xml index 39e6ca3f8b..30807a4486 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/33000-33099.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/33000-33099.xml @@ -780,7 +780,7 @@ - + diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java index e6f4bfcdaf..ae6ef5fab3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/TrainningSoldier.java @@ -16,9 +16,7 @@ */ package ai.areas.TalkingIsland; -import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.model.L2World; -import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -26,7 +24,7 @@ import ai.AbstractNpcAI; /** * Trainning Soldier AI. - * @author St3eT + * @author Mobius */ public final class TrainningSoldier extends AbstractNpcAI { @@ -36,42 +34,36 @@ public final class TrainningSoldier extends AbstractNpcAI private TrainningSoldier() { - addSeeCreatureId(SOLDIER); + addSpawnId(SOLDIER); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equals("START_ATTACK")) + if ((npc != null) && !npc.isDead()) { - //@formatter:off - final L2Npc dummy = L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150) - .stream() - .filter(obj -> (obj.getId() == DUMMY)) - .findFirst() - .orElse(null); - //@formatter:on - - if (dummy != null) + if (!npc.isInCombat()) { - addAttackDesire(npc, dummy); - } - else - { - startQuestTimer("START_ATTACK", 250, npc, null); + for (L2Npc nearby : L2World.getInstance().getVisibleObjects(npc, L2Npc.class, 150)) + { + if ((nearby != null) && (nearby.getId() == DUMMY)) + { + addAttackDesire(npc, nearby); + break; + } + } } + startQuestTimer("START_ATTACK", 10000, npc, null); } return super.onAdvEvent(event, npc, player); } @Override - public String onSeeCreature(L2Npc npc, L2Character creature, boolean isSummon) + public String onSpawn(L2Npc npc) { - if (creature.isPlayer() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK)) - { - startQuestTimer("START_ATTACK", 250, npc, null); - } - return super.onSeeCreature(npc, creature, isSummon); + npc.setRandomAnimation(false); + startQuestTimer("START_ATTACK", 5000, npc, null); + return super.onSpawn(npc); } public static void main(String[] args) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/33000-33099.xml b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/33000-33099.xml index 39e6ca3f8b..30807a4486 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/33000-33099.xml +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/stats/npcs/33000-33099.xml @@ -780,7 +780,7 @@ - +