rendered paste bodyIndex: GameServer/java/net/sf/l2j/gameserver/model/L2Character.java
===================================================================
--- GameServer/java/net/sf/l2j/gameserver/model/L2Character.java (revision 18)
+++ GameServer/java/net/sf/l2j/gameserver/model/L2Character.java (revision 29)
@@ -153,4 +153,8 @@
private String _aiClass = "default";
private boolean _champion = false;
+
+ private long _lastAttackTime = 0;
+ private long _lastCurrentTime = 0;
+ private boolean _nowDoAttack = false;
/** Table of Calculators containing all used calculator */
@@ -396,5 +400,9 @@
if (Config.DEBUG)
_log.fine(this.getName()+" doAttack: target="+target);
-
+
+ long ctime = System.currentTimeMillis();
+ if (ctime - _lastAttackTime < _lastCurrentTime || _nowDoAttack) return;
+ _nowDoAttack = true;
+
if (isAlikeDead() || target == null || (this instanceof L2NpcInstance && target.isAlikeDead())
|| (this instanceof L2PcInstance && target.isDead() && !target.isFakeDeath())
@@ -406,9 +414,13 @@
sendPacket(new ActionFailed());
+ _nowDoAttack = false;
return;
}
- if (isAttackingDisabled())
+ if (isAttackingDisabled())
+ {
+ _nowDoAttack = false;
return;
+ }
if ((this instanceof L2PcInstance) && (((L2PcInstance)this).inObserverMode()))
@@ -416,4 +428,5 @@
((L2PcInstance)this).sendMessage("Cant attack in observer mode");
sendPacket(new ActionFailed());
+ _nowDoAttack = false;
return;
}
@@ -433,4 +446,5 @@
ActionFailed af = new ActionFailed();
sendPacket(af);
+ _nowDoAttack = false;
return;
}
@@ -457,4 +471,5 @@
sendPacket(new SystemMessage(SystemMessage.NOT_ENOUGH_MP));
sendPacket(new ActionFailed());
+ _nowDoAttack = false;
return;
}
@@ -471,4 +486,5 @@
sendPacket(new ActionFailed());
+ _nowDoAttack = false;
return;
}
@@ -482,4 +498,5 @@
sendPacket(new ActionFailed());
sendPacket(new SystemMessage(SystemMessage.NOT_ENOUGH_ARROWS));
+ _nowDoAttack = false;
return;
}
@@ -488,5 +505,6 @@
{
if (_disableBowAttackEndTime > GameTimeController.getGameTicks())
- return;
+ _nowDoAttack = false;
+ return;
}
}
@@ -601,4 +619,7 @@
// Notify AI with EVT_READY_TO_ACT
+ _nowDoAttack = false;
+ _lastCurrentTime = System.currentTimeMillis();
+ _lastAttackTime = sAtk+reuse;
ThreadPoolManager.getInstance().scheduleAi(new NotifyAITask(CtrlEvent.EVT_READY_TO_ACT), sAtk+reuse);
}