Sync with L2jServer HighFive Mar 1st 2015.

This commit is contained in:
mobius
2015-03-01 22:48:14 +00:00
parent f14af24b41
commit 6fa0ed56e3
116 changed files with 971 additions and 676 deletions

View File

@@ -131,9 +131,6 @@ public abstract class AbstractAI implements Ctrl
/** The character that this AI manages */
protected final L2Character _actor;
/** An accessor for private methods of the actor */
protected final L2Character.AIAccessor _accessor;
/** Current long-term intention */
protected CtrlIntention _intention = AI_INTENTION_IDLE;
/** Current long-term intention parameter */
@@ -166,14 +163,11 @@ public abstract class AbstractAI implements Ctrl
/**
* Constructor of AbstractAI.
* @param accessor The AI accessor of the L2Character
* @param creature the creature
*/
protected AbstractAI(L2Character.AIAccessor accessor)
protected AbstractAI(L2Character creature)
{
_accessor = accessor;
// Get the L2Character managed by this Accessor AI
_actor = accessor.getActor();
_actor = creature;
}
/**
@@ -542,13 +536,13 @@ public abstract class AbstractAI implements Ctrl
_moveToPawnTimeout = GameTimeController.getInstance().getGameTicks();
_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
if ((pawn == null) || (_accessor == null))
if (pawn == null)
{
return;
}
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_accessor.moveTo(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
_actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset);
if (!_actor.isMoving())
{
@@ -597,7 +591,7 @@ public abstract class AbstractAI implements Ctrl
_clientMovingToPawnOffset = 0;
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeController
_accessor.moveTo(x, y, z);
_actor.moveToLocation(x, y, z, 0);
// Send a Server->Client packet CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers
_actor.broadcastPacket(new MoveToLocation(_actor));
@@ -619,7 +613,7 @@ public abstract class AbstractAI implements Ctrl
// Stop movement of the L2Character
if (_actor.isMoving())
{
_accessor.stopMove(loc);
_actor.stopMove(loc);
}
_clientMovingToPawnOffset = 0;

View File

@@ -29,9 +29,9 @@ import com.l2jserver.gameserver.network.serverpackets.ExStopMoveAirShip;
*/
public class L2AirShipAI extends L2VehicleAI
{
public L2AirShipAI(L2AirShipInstance.AIAccessor accessor)
public L2AirShipAI(L2AirShipInstance creature)
{
super(accessor);
super(creature);
}
@Override
@@ -40,7 +40,7 @@ public class L2AirShipAI extends L2VehicleAI
if (!_actor.isMovementDisabled())
{
_clientMoving = true;
_accessor.moveTo(x, y, z);
_actor.moveToLocation(x, y, z, 0);
_actor.broadcastPacket(new ExMoveToLocationAirShip(getActor()));
}
}
@@ -50,7 +50,7 @@ public class L2AirShipAI extends L2VehicleAI
{
if (_actor.isMoving())
{
_accessor.stopMove(loc);
_actor.stopMove(loc);
}
if (_clientMoving || (loc != null))

View File

@@ -94,11 +94,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
/**
* Constructor of L2AttackableAI.
* @param accessor The AI accessor of the L2Character
* @param creature the creature
*/
public L2AttackableAI(L2Character.AIAccessor accessor)
public L2AttackableAI(L2Attackable creature)
{
super(accessor);
super(creature);
_skillrender = NpcData.getInstance().getTemplate(getActiveChar().getTemplate().getId());
_attackTimeout = Integer.MAX_VALUE;
_globalAggro = -10; // 10 seconds timeout of ATTACK after respawn
@@ -352,7 +352,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// Cancel the AI
_accessor.detachAI();
_actor.detachAI();
return;
}
@@ -405,7 +405,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
clientStopMoving(null);
setIntention(AI_INTENTION_ACTIVE);
_accessor.doCast(_skill);
_actor.doCast(_skill);
}
/**
@@ -1280,7 +1280,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
}
_accessor.doAttack(getAttackTarget());
_actor.doAttack(getAttackTarget());
}
private boolean cast(Skill sk)

View File

@@ -30,9 +30,9 @@ import com.l2jserver.gameserver.network.serverpackets.VehicleStarted;
*/
public class L2BoatAI extends L2VehicleAI
{
public L2BoatAI(L2BoatInstance.AIAccessor accessor)
public L2BoatAI(L2BoatInstance creature)
{
super(accessor);
super(creature);
}
@Override
@@ -46,7 +46,7 @@ public class L2BoatAI extends L2VehicleAI
}
_clientMoving = true;
_accessor.moveTo(x, y, z);
_actor.moveToLocation(x, y, z, 0);
_actor.broadcastPacket(new VehicleDeparture(getActor()));
}
}
@@ -56,7 +56,7 @@ public class L2BoatAI extends L2VehicleAI
{
if (_actor.isMoving())
{
_accessor.stopMove(loc);
_actor.stopMove(loc);
}
if (_clientMoving || (loc != null))

View File

@@ -120,11 +120,11 @@ public class L2CharacterAI extends AbstractAI
/**
* Constructor of L2CharacterAI.
* @param accessor The AI accessor of the L2Character
* @param creature the creature
*/
public L2CharacterAI(L2Character.AIAccessor accessor)
public L2CharacterAI(L2Character creature)
{
super(accessor);
super(creature);
}
public IntentionCommand getNextIntention()
@@ -727,16 +727,16 @@ public class L2CharacterAI extends AbstractAI
@Override
protected void onEvtArrived()
{
_accessor.getActor().revalidateZone(true);
_actor.revalidateZone(true);
if (_accessor.getActor().moveToNextRoutePoint())
if (_actor.moveToNextRoutePoint())
{
return;
}
if (_accessor.getActor() instanceof L2Attackable)
if (_actor instanceof L2Attackable)
{
((L2Attackable) _accessor.getActor()).setisReturningToSpawnPoint(false);
((L2Attackable) _actor).setisReturningToSpawnPoint(false);
}
clientStoppedMoving();

View File

@@ -30,7 +30,6 @@ import com.l2jserver.gameserver.model.MobGroup;
import com.l2jserver.gameserver.model.MobGroupTable;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Character.AIAccessor;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2ControllableMobInstance;
@@ -62,6 +61,12 @@ public final class L2ControllableMobAI extends L2AttackableAI
private L2Character _forcedTarget;
private MobGroup _targetGroup;
public L2ControllableMobAI(L2ControllableMobInstance creature)
{
super(creature);
setAlternateAI(AI_IDLE);
}
protected void thinkFollow()
{
L2Attackable me = (L2Attackable) _actor;
@@ -153,7 +158,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
{
if (Util.checkIfInRange(sk.getCastRange(), _actor, getAttackTarget(), true) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
_actor.doCast(sk);
return;
}
@@ -203,7 +208,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
_actor.doCast(sk);
return;
}
@@ -217,7 +222,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
return;
}
_accessor.doAttack(target);
_actor.doAttack(target);
}
protected void thinkForceAttack()
@@ -243,7 +248,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
_actor.doCast(sk);
return;
}
@@ -258,7 +263,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
return;
}
_accessor.doAttack(getForcedTarget());
_actor.doAttack(getForcedTarget());
}
@Override
@@ -316,7 +321,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
_actor.doCast(sk);
return;
}
@@ -358,13 +363,13 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() < _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
_actor.doCast(sk);
return;
}
}
}
_accessor.doAttack(getAttackTarget());
_actor.doAttack(getAttackTarget());
}
}
@@ -494,12 +499,6 @@ public final class L2ControllableMobAI extends L2AttackableAI
return getGroupTarget().getRandomMob();
}
public L2ControllableMobAI(AIAccessor accessor)
{
super(accessor);
setAlternateAI(AI_IDLE);
}
public int getAlternateAI()
{
return _alternateAI;

View File

@@ -31,12 +31,11 @@ import com.l2jserver.gameserver.model.skills.Skill;
*/
public class L2DoorAI extends L2CharacterAI
{
public L2DoorAI(L2DoorInstance.AIAccessor accessor)
public L2DoorAI(L2DoorInstance creature)
{
super(accessor);
super(creature);
}
// rather stupid AI... well, it's for doors :D
@Override
protected void onIntentionIdle()
{
@@ -90,8 +89,7 @@ public class L2DoorAI extends L2CharacterAI
@Override
protected void onEvtAttacked(L2Character attacker)
{
L2DoorInstance me = (L2DoorInstance) _actor;
ThreadPoolManager.getInstance().executeGeneral(new onEventAttackedDoorTask(me, attacker));
ThreadPoolManager.getInstance().executeGeneral(new onEventAttackedDoorTask((L2DoorInstance) _actor, attacker));
}
@Override

View File

@@ -71,11 +71,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
/**
* Constructor of L2AttackableAI.
* @param accessor The AI accessor of the L2Character
* @param creature the creature
*/
public L2FortSiegeGuardAI(L2Character.AIAccessor accessor)
public L2FortSiegeGuardAI(L2DefenderInstance creature)
{
super(accessor);
super(creature);
_selfAnalysis.init();
_attackTimeout = Integer.MAX_VALUE;
_globalAggro = -10; // 10 seconds timeout of ATTACK after respawn
@@ -227,7 +227,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
}
// Cancel the AI
_accessor.detachAI();
_actor.detachAI();
return;
}
@@ -470,7 +470,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
L2Object OldTarget = _actor.getTarget();
_actor.setTarget(cha);
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -529,7 +529,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
L2Object OldTarget = _actor.getTarget();
_actor.setTarget(npc);
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -627,7 +627,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
}
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -772,14 +772,14 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
}
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
}
}
// Finally, do the physical attack itself
_accessor.doAttack(attackTarget);
_actor.doAttack(attackTarget);
}
}
@@ -963,7 +963,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
_aiTask.cancel(false);
_aiTask = null;
}
_accessor.detachAI();
_actor.detachAI();
super.stopAITask();
}
}

View File

@@ -20,7 +20,6 @@ package com.l2jserver.gameserver.ai;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Character.AIAccessor;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.zone.ZoneId;
@@ -34,11 +33,11 @@ import com.l2jserver.gameserver.network.SystemMessageId;
public abstract class L2PlayableAI extends L2CharacterAI
{
/**
* @param accessor
* @param creature the creature
*/
public L2PlayableAI(AIAccessor accessor)
public L2PlayableAI(L2Playable creature)
{
super(accessor);
super(creature);
}
@Override

View File

@@ -29,7 +29,6 @@ import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_REST;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Character.AIAccessor;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
import com.l2jserver.gameserver.model.skills.Skill;
@@ -39,11 +38,11 @@ public class L2PlayerAI extends L2PlayableAI
{
private boolean _thinking; // to prevent recursive thinking
IntentionCommand _nextIntention = null;
private IntentionCommand _nextIntention = null;
public L2PlayerAI(AIAccessor accessor)
public L2PlayerAI(L2PcInstance creature)
{
super(accessor);
super(creature);
}
void saveNextIntention(CtrlIntention intention, Object arg0, Object arg1)
@@ -240,7 +239,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
_accessor.doAttack(target);
_actor.doAttack(target);
}
private void thinkCast()
@@ -278,7 +277,7 @@ public class L2PlayerAI extends L2PlayableAI
clientStopMoving(null);
}
_accessor.doCast(_skill);
_actor.doCast(_skill);
}
private void thinkPickUp()
@@ -297,7 +296,7 @@ public class L2PlayerAI extends L2PlayableAI
return;
}
setIntention(AI_INTENTION_IDLE);
((L2PcInstance.AIAccessor) _accessor).doPickupItem(target);
_actor.getActingPlayer().doPickupItem(target);
}
private void thinkInteract()
@@ -317,7 +316,7 @@ public class L2PlayerAI extends L2PlayableAI
}
if (!(target instanceof L2StaticObjectInstance))
{
((L2PcInstance.AIAccessor) _accessor).doInteract((L2Character) target);
_actor.getActingPlayer().doInteract((L2Character) target);
}
setIntention(AI_INTENTION_IDLE);
}

View File

@@ -18,7 +18,6 @@
*/
package com.l2jserver.gameserver.ai;
import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
import com.l2jserver.gameserver.model.actor.instance.L2ShuttleInstance;
import com.l2jserver.gameserver.network.serverpackets.shuttle.ExShuttleMove;
@@ -27,9 +26,9 @@ import com.l2jserver.gameserver.network.serverpackets.shuttle.ExShuttleMove;
*/
public class L2ShuttleAI extends L2VehicleAI
{
public L2ShuttleAI(L2AirShipInstance.AIAccessor accessor)
public L2ShuttleAI(L2ShuttleInstance l2ShuttleInstance)
{
super(accessor);
super(l2ShuttleInstance);
}
@Override
@@ -38,7 +37,7 @@ public class L2ShuttleAI extends L2VehicleAI
if (!_actor.isMovementDisabled())
{
_clientMoving = true;
_accessor.moveTo(x, y, z);
_actor.moveToLocation(x, y, z, 0);
_actor.broadcastPacket(new ExShuttleMove(getActor(), x, y, z));
}
}

View File

@@ -71,11 +71,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
/**
* Constructor of L2AttackableAI.
* @param accessor The AI accessor of the L2Character
* @param creature the creature
*/
public L2SiegeGuardAI(L2Character.AIAccessor accessor)
public L2SiegeGuardAI(L2DefenderInstance creature)
{
super(accessor);
super(creature);
_selfAnalysis.init();
_attackTimeout = Integer.MAX_VALUE;
_globalAggro = -10; // 10 seconds timeout of ATTACK after respawn
@@ -216,7 +216,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
}
// Cancel the AI
_accessor.detachAI();
_actor.detachAI();
return;
}
@@ -449,7 +449,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
L2Object OldTarget = _actor.getTarget();
_actor.setTarget(cha);
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -508,7 +508,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
L2Object OldTarget = _actor.getTarget();
_actor.setTarget(npc);
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -600,7 +600,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
}
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -741,7 +741,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
}
clientStopMoving(null);
_accessor.doCast(sk);
_actor.doCast(sk);
_actor.setTarget(OldTarget);
return;
}
@@ -750,7 +750,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
// Finally, do the physical attack itself
if (!_selfAnalysis.isHealer)
{
_accessor.doAttack(attackTarget);
_actor.doAttack(attackTarget);
}
}
}
@@ -927,7 +927,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
_aiTask.cancel(false);
_aiTask = null;
}
_accessor.detachAI();
_actor.detachAI();
super.stopAITask();
}
}

View File

@@ -19,27 +19,27 @@
package com.l2jserver.gameserver.ai;
import java.util.ArrayList;
import java.util.List;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Character.AIAccessor;
import com.l2jserver.gameserver.model.actor.instance.L2DefenderInstance;
/**
* @author BiggBoss
*/
public final class L2SpecialSiegeGuardAI extends L2SiegeGuardAI
{
private final ArrayList<Integer> _allied;
private final List<Integer> _allied = new ArrayList<>();
/**
* @param accessor
* @param creature
*/
public L2SpecialSiegeGuardAI(AIAccessor accessor)
public L2SpecialSiegeGuardAI(L2DefenderInstance creature)
{
super(accessor);
_allied = new ArrayList<>();
super(creature);
}
public ArrayList<Integer> getAlly()
public List<Integer> getAlly()
{
return _allied;
}

View File

@@ -28,7 +28,6 @@ import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Character.AIAccessor;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.util.Rnd;
@@ -44,9 +43,9 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
private volatile boolean _startAvoid = false;
private Future<?> _avoidTask = null;
public L2SummonAI(AIAccessor accessor)
public L2SummonAI(L2Summon creature)
{
super(accessor);
super(creature);
}
@Override
@@ -99,7 +98,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return;
}
clientStopMoving(null);
_accessor.doAttack(getAttackTarget());
_actor.doAttack(getAttackTarget());
}
private void thinkCast()
@@ -119,7 +118,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE);
_startFollow = val;
_accessor.doCast(_skill);
_actor.doCast(_skill);
}
private void thinkPickUp()
@@ -133,7 +132,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
return;
}
setIntention(AI_INTENTION_IDLE);
((L2Summon.AIAccessor) _accessor).doPickupItem(getTarget());
((L2Summon) _actor).doPickupItem(getTarget());
}
private void thinkInteract()

View File

@@ -30,11 +30,11 @@ public abstract class L2VehicleAI extends L2CharacterAI
{
/**
* Simple AI for vehicles
* @param accessor
* @param creature
*/
public L2VehicleAI(L2Vehicle.AIAccessor accessor)
public L2VehicleAI(L2Vehicle creature)
{
super(accessor);
super(creature);
}
@Override

View File

@@ -19,6 +19,7 @@
package com.l2jserver.gameserver.ai;
import java.util.ArrayList;
import java.util.List;
/**
* Class for AI action after some event.<br>
@@ -32,8 +33,8 @@ public class NextAction
public void doWork();
}
private ArrayList<CtrlEvent> _events;
private ArrayList<CtrlIntention> _intentions;
private List<CtrlEvent> _events;
private List<CtrlIntention> _intentions;
private NextActionCallback _callback;
/**
@@ -42,7 +43,7 @@ public class NextAction
* @param intentions
* @param callback
*/
public NextAction(ArrayList<CtrlEvent> events, ArrayList<CtrlIntention> intentions, NextActionCallback callback)
public NextAction(List<CtrlEvent> events, List<CtrlIntention> intentions, NextActionCallback callback)
{
_events = events;
_intentions = intentions;
@@ -93,7 +94,7 @@ public class NextAction
/**
* @return the _event
*/
public ArrayList<CtrlEvent> getEvents()
public List<CtrlEvent> getEvents()
{
// If null return empty list.
if (_events == null)
@@ -158,7 +159,7 @@ public class NextAction
/**
* @return the _intentions
*/
public ArrayList<CtrlIntention> getIntentions()
public List<CtrlIntention> getIntentions()
{
// If null return empty list.
if (_intentions == null)