Proper random walking override.
This commit is contained in:
@@ -539,7 +539,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Order to the MonsterInstance to random walk (1/100)
|
// Order to the MonsterInstance to random walk (1/100)
|
||||||
else if (npc.hasRandomAnimation() && (npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0))
|
else if (npc.isRandomWalkingEnabled() && (npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0))
|
||||||
{
|
{
|
||||||
int x1;
|
int x1;
|
||||||
int y1;
|
int y1;
|
||||||
|
@@ -2736,16 +2736,6 @@ public class Attackable extends NpcInstance
|
|||||||
return getTemplate().getAbsorbLevel();
|
return getTemplate().getAbsorbLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the server allows Random Animation.<br>
|
|
||||||
* This is located here because Monster and FriendlyMob both extend this class. The other non-pc instances extend either NpcInstance or MonsterInstance.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean hasRandomAnimation()
|
|
||||||
{
|
|
||||||
return (Config.MAX_MONSTER_ANIMATION > 0) && isMonster() && !(this instanceof GrandBossInstance);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setCommandChannelTimer(CommandChannelTimer commandChannelTimer)
|
protected void setCommandChannelTimer(CommandChannelTimer commandChannelTimer)
|
||||||
{
|
{
|
||||||
_commandChannelTimer = commandChannelTimer;
|
_commandChannelTimer = commandChannelTimer;
|
||||||
|
@@ -230,7 +230,13 @@ public class ChestInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,12 @@ public class ControllableMobInstance extends MonsterInstance
|
|||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public ControllableMobInstance(int objectId, NpcTemplate template)
|
public ControllableMobInstance(int objectId, NpcTemplate template)
|
||||||
{
|
{
|
||||||
super(objectId, template);
|
super(objectId, template);
|
||||||
|
@@ -27,4 +27,10 @@ public class FeedableBeastInstance extends MonsterInstance
|
|||||||
{
|
{
|
||||||
super(objectId, template);
|
super(objectId, template);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -78,10 +78,10 @@ public class FestivalMonsterInstance extends MonsterInstance
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* All mobs in the festival really don't need random animation.
|
* All mobs in the festival really don't need random animation.
|
||||||
* @return true, if successful
|
* @return false
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ public class FortSiegeGuardInstance extends Attackable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -83,4 +83,10 @@ public class GourdInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
super.reduceCurrentHp(damage, attacker, awake);
|
super.reduceCurrentHp(damage, attacker, awake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -111,15 +111,27 @@ public class GrandBossInstance extends MonsterInstance
|
|||||||
}, 60000, 20000);
|
}, 60000, 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRaid()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void healFull()
|
public void healFull()
|
||||||
{
|
{
|
||||||
super.setCurrentHp(super.getMaxHp());
|
super.setCurrentHp(super.getMaxHp());
|
||||||
super.setCurrentMp(super.getMaxMp());
|
super.setCurrentMp(super.getMaxMp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomAnimationEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRaid()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -291,6 +291,12 @@ public class MonsterInstance extends Attackable
|
|||||||
_minionList.clearRespawnList();
|
_minionList.clearRespawnList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return Config.MAX_DRIFT_RANGE > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMonster()
|
public boolean isMonster()
|
||||||
{
|
{
|
||||||
|
@@ -151,15 +151,16 @@ public class NpcInstance extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public boolean isRandomAnimationEnabled()
|
||||||
* Check if the server allows Random Animation.
|
|
||||||
* @return true, if successful
|
|
||||||
*/
|
|
||||||
public boolean hasRandomAnimation()
|
|
||||||
{
|
{
|
||||||
return Config.MAX_NPC_ANIMATION > 0;
|
return Config.MAX_NPC_ANIMATION > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public class destroyTemporalNPC implements Runnable
|
public class destroyTemporalNPC implements Runnable
|
||||||
{
|
{
|
||||||
private final Spawn _oldSpawn;
|
private final Spawn _oldSpawn;
|
||||||
|
@@ -80,4 +80,10 @@ public class PenaltyMonsterInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,7 +83,7 @@ public class SiegeGuardInstance extends Attackable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ public class RandomAnimationTaskManager implements Runnable
|
|||||||
|
|
||||||
public void add(NpcInstance npc)
|
public void add(NpcInstance npc)
|
||||||
{
|
{
|
||||||
if (npc.hasRandomAnimation())
|
if (npc.isRandomAnimationEnabled())
|
||||||
{
|
{
|
||||||
PENDING_ANIMATIONS.putIfAbsent(npc, Chronos.currentTimeMillis() + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
|
PENDING_ANIMATIONS.putIfAbsent(npc, Chronos.currentTimeMillis() + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
|
||||||
}
|
}
|
||||||
|
@@ -539,7 +539,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Order to the MonsterInstance to random walk (1/100)
|
// Order to the MonsterInstance to random walk (1/100)
|
||||||
else if (npc.hasRandomAnimation() && (npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0))
|
else if (npc.isRandomWalkingEnabled() && (npc.getSpawn() != null) && (Rnd.get(RANDOM_WALK_RATE) == 0))
|
||||||
{
|
{
|
||||||
int x1;
|
int x1;
|
||||||
int y1;
|
int y1;
|
||||||
|
@@ -3088,16 +3088,6 @@ public class Attackable extends NpcInstance
|
|||||||
return getTemplate().getAbsorbLevel();
|
return getTemplate().getAbsorbLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the server allows Random Animation.<br>
|
|
||||||
* This is located here because Monster and FriendlyMob both extend this class. The other non-pc instances extend either NpcInstance or MonsterInstance.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean hasRandomAnimation()
|
|
||||||
{
|
|
||||||
return (Config.MAX_MONSTER_ANIMATION > 0) && isMonster() && !(this instanceof GrandBossInstance);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setCommandChannelTimer(CommandChannelTimer commandChannelTimer)
|
protected void setCommandChannelTimer(CommandChannelTimer commandChannelTimer)
|
||||||
{
|
{
|
||||||
_commandChannelTimer = commandChannelTimer;
|
_commandChannelTimer = commandChannelTimer;
|
||||||
|
@@ -230,7 +230,13 @@ public class ChestInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -52,6 +52,12 @@ public class ControllableMobInstance extends MonsterInstance
|
|||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public ControllableMobInstance(int objectId, NpcTemplate template)
|
public ControllableMobInstance(int objectId, NpcTemplate template)
|
||||||
{
|
{
|
||||||
super(objectId, template);
|
super(objectId, template);
|
||||||
|
@@ -27,4 +27,10 @@ public class FeedableBeastInstance extends MonsterInstance
|
|||||||
{
|
{
|
||||||
super(objectId, template);
|
super(objectId, template);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -78,10 +78,10 @@ public class FestivalMonsterInstance extends MonsterInstance
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* All mobs in the festival really don't need random animation.
|
* All mobs in the festival really don't need random animation.
|
||||||
* @return true, if successful
|
* @return false
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ public class FortSiegeGuardInstance extends Attackable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -83,4 +83,10 @@ public class GourdInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
super.reduceCurrentHp(damage, attacker, awake);
|
super.reduceCurrentHp(damage, attacker, awake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -111,15 +111,27 @@ public class GrandBossInstance extends MonsterInstance
|
|||||||
}, 60000, 20000);
|
}, 60000, 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRaid()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void healFull()
|
public void healFull()
|
||||||
{
|
{
|
||||||
super.setCurrentHp(super.getMaxHp());
|
super.setCurrentHp(super.getMaxHp());
|
||||||
super.setCurrentMp(super.getMaxMp());
|
super.setCurrentMp(super.getMaxMp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomAnimationEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRaid()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -291,6 +291,12 @@ public class MonsterInstance extends Attackable
|
|||||||
_minionList.clearRespawnList();
|
_minionList.clearRespawnList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return Config.MAX_DRIFT_RANGE > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMonster()
|
public boolean isMonster()
|
||||||
{
|
{
|
||||||
|
@@ -153,15 +153,16 @@ public class NpcInstance extends Creature
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public boolean isRandomAnimationEnabled()
|
||||||
* Check if the server allows Random Animation.
|
|
||||||
* @return true, if successful
|
|
||||||
*/
|
|
||||||
public boolean hasRandomAnimation()
|
|
||||||
{
|
{
|
||||||
return Config.MAX_NPC_ANIMATION > 0;
|
return Config.MAX_NPC_ANIMATION > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public class destroyTemporalNPC implements Runnable
|
public class destroyTemporalNPC implements Runnable
|
||||||
{
|
{
|
||||||
private final Spawn _oldSpawn;
|
private final Spawn _oldSpawn;
|
||||||
|
@@ -80,4 +80,10 @@ public class PenaltyMonsterInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRandomWalkingEnabled()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -83,7 +83,7 @@ public class SiegeGuardInstance extends Attackable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRandomAnimation()
|
public boolean isRandomAnimationEnabled()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ public class RandomAnimationTaskManager implements Runnable
|
|||||||
|
|
||||||
public void add(NpcInstance npc)
|
public void add(NpcInstance npc)
|
||||||
{
|
{
|
||||||
if (npc.hasRandomAnimation())
|
if (npc.isRandomAnimationEnabled())
|
||||||
{
|
{
|
||||||
PENDING_ANIMATIONS.putIfAbsent(npc, Chronos.currentTimeMillis() + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
|
PENDING_ANIMATIONS.putIfAbsent(npc, Chronos.currentTimeMillis() + (Rnd.get((npc.isAttackable() ? Config.MIN_MONSTER_ANIMATION : Config.MIN_NPC_ANIMATION), (npc.isAttackable() ? Config.MAX_MONSTER_ANIMATION : Config.MAX_NPC_ANIMATION)) * 1000));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user