Skip to content
Snippets Groups Projects
Commit adac7179 authored by Rumen Nikiforov's avatar Rumen Nikiforov
Browse files

BETA: DP-Part of [L6569]

parent 86dc4220
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,8 @@ import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK; ...@@ -22,6 +22,8 @@ import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
import java.util.List; import java.util.List;
import ai.npc.AbstractNpcAI;
import com.l2jserver.Config; import com.l2jserver.Config;
import com.l2jserver.gameserver.ai.CtrlEvent; import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.ai.CtrlIntention;
...@@ -35,7 +37,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; ...@@ -35,7 +37,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2RiftInvaderInstance; import com.l2jserver.gameserver.model.actor.instance.L2RiftInvaderInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.util.Util; import com.l2jserver.gameserver.util.Util;
...@@ -43,11 +44,33 @@ import com.l2jserver.gameserver.util.Util; ...@@ -43,11 +44,33 @@ import com.l2jserver.gameserver.util.Util;
* Overarching Superclass for all mob AI. * Overarching Superclass for all mob AI.
* @author Fulminus * @author Fulminus
*/ */
public final class L2AttackableAIScript extends Quest public final class L2AttackableAIScript extends AbstractNpcAI
{ {
private L2AttackableAIScript(int questId, String name, String descr) private L2AttackableAIScript()
{ {
super(questId, name, descr); super(L2AttackableAIScript.class.getSimpleName(), "ai");
final List<L2NpcTemplate> templates = NpcData.getInstance().getTemplates(npc -> (npc.getLevel() >= 1) && (npc.getLevel() < 100));
// register all mobs here...
for (L2NpcTemplate t : templates)
{
try
{
if (L2Attackable.class.isAssignableFrom(Class.forName("com.l2jserver.gameserver.model.actor.instance." + t.getType() + "Instance")))
{
addAttackId(t.getId());
addKillId(t.getId());
addSkillSeeId(t.getId());
addSpawnId(t.getId());
addFactionCallId(t.getId());
addAggroRangeEnterId(t.getId());
}
}
catch (ClassNotFoundException ex)
{
_log.info("Class not found " + t.getType() + "Instance");
}
}
} }
@Override @Override
...@@ -194,30 +217,6 @@ public final class L2AttackableAIScript extends Quest ...@@ -194,30 +217,6 @@ public final class L2AttackableAIScript extends Quest
public static void main(String[] args) public static void main(String[] args)
{ {
L2AttackableAIScript ai = new L2AttackableAIScript(-1, L2AttackableAIScript.class.getSimpleName(), "ai"); new L2AttackableAIScript();
// register all mobs here...
for (int level = 1; level < 100; level++)
{
final List<L2NpcTemplate> templates = NpcData.getInstance().getAllOfLevel(level);
for (L2NpcTemplate t : templates)
{
try
{
if (L2Attackable.class.isAssignableFrom(Class.forName("com.l2jserver.gameserver.model.actor.instance." + t.getType() + "Instance")))
{
ai.addAttackId(t.getId());
ai.addKillId(t.getId());
ai.addSkillSeeId(t.getId());
ai.addSpawnId(t.getId());
ai.addFactionCallId(t.getId());
ai.addAggroRangeEnterId(t.getId());
}
}
catch (ClassNotFoundException ex)
{
_log.info("Class not found " + t.getType() + "Instance");
}
}
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment