Apply latest Classic commit to GoD branches.

This commit is contained in:
MobiusDev
2017-08-06 18:21:28 +00:00
parent bdde7f8a96
commit a2473ea19e
6 changed files with 16 additions and 12 deletions

View File

@ -28,9 +28,9 @@ import static com.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.ThreadPoolManager;
import com.l2jmobius.gameserver.enums.ItemLocation;
import com.l2jmobius.gameserver.geodata.GeoData;
@ -306,9 +306,9 @@ public class L2CharacterAI extends AbstractAI
return;
}
if (_actor.getAttackEndTime() > GameTimeController.getInstance().getGameTicks())
if (_actor.isAttackingNow())
{
ThreadPoolManager.getInstance().scheduleGeneral(new CastTask(_actor, skill, target, item, forceUse, dontMove), _actor.getAttackEndTime() - System.currentTimeMillis());
ThreadPoolManager.getInstance().scheduleGeneral(new CastTask(_actor, skill, target, item, forceUse, dontMove), _actor.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
}
else
{

View File

@ -33,6 +33,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Predicate;
@ -1139,7 +1140,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
final int timeToHit = timeAtk / 2; // the hit is calculated to happen halfway to the animation - might need further tuning e.g. in bow case
final int ssGrade = (weaponItem != null) ? weaponItem.getItemGrade().ordinal() : 0;
final Attack attack = new Attack(this, target, wasSSCharged, ssGrade);
_attackEndTime = System.currentTimeMillis() + timeAtk;
_attackEndTime = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeAtk);
// Make sure that char is facing selected target
// also works: setHeading(Util.convertDegreeToClientHeading(Util.calculateAngleFrom(this, target)));
@ -3156,7 +3157,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
*/
public final boolean isAttackingNow()
{
return _attackEndTime > System.currentTimeMillis();
return _attackEndTime > System.nanoTime();
}
/**

View File

@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.clientpackets;
import java.util.List;
import java.util.concurrent.TimeUnit;
import com.l2jmobius.Config;
import com.l2jmobius.commons.network.PacketReader;
@ -255,7 +256,7 @@ public final class UseItem implements IClientIncomingPacket
// Equip or unEquip
activeChar.useEquippableItem(item, false);
}, activeChar.getAttackEndTime() - System.currentTimeMillis());
}, activeChar.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
}
else
{