RandomAnimationTaskManager simplifications.

This commit is contained in:
MobiusDevelopment 2019-06-10 10:19:16 +00:00
parent b4ae2ea50f
commit a64034de2e
14 changed files with 14 additions and 197 deletions

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,8 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Attackable;
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
/**
@ -44,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final NpcInstance npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if ((npc instanceof Attackable) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.isStunned() && !npc.isSleeping() && !npc.isParalyzed())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.isStunned() && !npc.isSleeping() && !npc.isParalyzed())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.isStunned() && !npc.isSleeping() && !npc.isParalyzed())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.isStunned() && !npc.isSleeping() && !npc.isParalyzed())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}

View File

@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.ai.CtrlIntention;
import org.l2jmobius.gameserver.model.actor.Npc;
/**
@ -43,22 +42,10 @@ public class RandomAnimationTaskManager
if (time > entry.getValue())
{
final Npc npc = entry.getKey();
if (!npc.isInActiveRegion())
{
continue;
}
// Cancel further animation schedules until intention is changed to ACTIVE again.
if (npc.isAttackable() && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ACTIVE))
{
continue;
}
if (!npc.isDead() && !npc.hasBlockActions())
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
{
npc.onRandomAnimation(Rnd.get(2, 3));
}
PENDING_ANIMATIONS.put(npc, time + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
}
}