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)

View File

@@ -72,8 +72,6 @@ public final class AdminData implements IXmlReader
NamedNodeMap attrs;
Node attr;
StatsSet set;
L2AccessLevel level;
L2AdminCommandAccessRight command;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -89,7 +87,7 @@ public final class AdminData implements IXmlReader
attr = attrs.item(i);
set.set(attr.getNodeName(), attr.getNodeValue());
}
level = new L2AccessLevel(set);
final L2AccessLevel level = new L2AccessLevel(set);
if (level.getLevel() > _highestLevel)
{
_highestLevel = level.getLevel();
@@ -105,7 +103,7 @@ public final class AdminData implements IXmlReader
attr = attrs.item(i);
set.set(attr.getNodeName(), attr.getNodeValue());
}
command = new L2AdminCommandAccessRight(set);
final L2AdminCommandAccessRight command = new L2AdminCommandAccessRight(set);
_adminCommandAccessRights.put(command.getAdminCommand(), command);
}
}

View File

@@ -74,9 +74,6 @@ public class AppearanceItemData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
StatsSet set;
Node att;
NamedNodeMap attrs;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -85,11 +82,11 @@ public class AppearanceItemData implements IXmlReader
{
if ("appearance_stone".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
set = new StatsSet();
final NamedNodeMap attrs = d.getAttributes();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}

View File

@@ -57,8 +57,6 @@ public final class ArmorSetsData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
L2ArmorSet set;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -67,13 +65,13 @@ public final class ArmorSetsData implements IXmlReader
{
if ("set".equalsIgnoreCase(d.getNodeName()))
{
set = new L2ArmorSet();
final L2ArmorSet set = new L2ArmorSet();
set.setIsVisual(parseBoolean(d.getAttributes(), "visual", false));
set.setMinimumPieces(parseInteger(d.getAttributes(), "minimumPieces"));
for (Node a = d.getFirstChild(); a != null; a = a.getNextSibling())
{
attrs = a.getAttributes();
final NamedNodeMap attrs = a.getAttributes();
switch (a.getNodeName())
{
case "chest":

View File

@@ -56,26 +56,21 @@ public final class ClassListData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node attr;
ClassId classId;
String className;
ClassId parentClassId;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equals(n.getNodeName()))
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
if ("class".equals(d.getNodeName()))
{
attr = attrs.getNamedItem("classId");
classId = ClassId.getClassId(parseInteger(attr));
Node attr = attrs.getNamedItem("classId");
final ClassId classId = ClassId.getClassId(parseInteger(attr));
attr = attrs.getNamedItem("name");
className = attr.getNodeValue();
final String className = attr.getNodeValue();
attr = attrs.getNamedItem("parentClassId");
parentClassId = (attr != null) ? ClassId.getClassId(parseInteger(attr)) : null;
final ClassId parentClassId = (attr != null) ? ClassId.getClassId(parseInteger(attr)) : null;
_classData.put(classId, new ClassInfo(classId, className, parentClassId));
}
}
@@ -85,7 +80,7 @@ public final class ClassListData implements IXmlReader
/**
* Gets the class list.
* @return the complete class list.
* @return the complete class list
*/
public Map<ClassId, ClassInfo> getClassList()
{
@@ -94,8 +89,8 @@ public final class ClassListData implements IXmlReader
/**
* Gets the class info.
* @param classId the class Id.
* @return the class info related to the given {@code classId}.
* @param classId the class ID
* @return the class info related to the given {@code classId}
*/
public ClassInfo getClass(ClassId classId)
{
@@ -104,8 +99,8 @@ public final class ClassListData implements IXmlReader
/**
* Gets the class info.
* @param classId the class Id as integer.
* @return the class info related to the given {@code classId}.
* @param classId the class Id as integer
* @return the class info related to the given {@code classId}
*/
public ClassInfo getClass(int classId)
{
@@ -126,4 +121,4 @@ public final class ClassListData implements IXmlReader
{
protected static final ClassListData _instance = new ClassListData();
}
}
}

View File

@@ -66,9 +66,6 @@ public class DoorData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node att;
StatsSet set;
for (Node a = doc.getFirstChild(); a != null; a = a.getNextSibling())
{
if ("list".equalsIgnoreCase(a.getNodeName()))
@@ -77,12 +74,12 @@ public class DoorData implements IXmlReader
{
if ("door".equalsIgnoreCase(b.getNodeName()))
{
attrs = b.getAttributes();
set = new StatsSet();
final NamedNodeMap attrs = b.getAttributes();
final StatsSet set = new StatsSet();
set.set("baseHpMax", 1); // Avoid doors without HP value created dead due to default value 0 in L2CharTemplate
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
makeDoor(set);

View File

@@ -69,7 +69,7 @@ public final class EnchantItemGroupsData implements IXmlReader
{
if ("enchantRateGroup".equalsIgnoreCase(d.getNodeName()))
{
String name = parseString(d.getAttributes(), "name");
final String name = parseString(d.getAttributes(), "name");
final EnchantItemGroup group = new EnchantItemGroup(name);
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{

View File

@@ -65,12 +65,12 @@ public class EnchantItemHPBonusData implements IXmlReader
{
if ("enchantHP".equalsIgnoreCase(d.getNodeName()))
{
List<Integer> bonuses = new ArrayList<>();
final List<Integer> bonuses = new ArrayList<>(12);
for (Node e = d.getFirstChild(); e != null; e = e.getNextSibling())
{
if ("bonus".equalsIgnoreCase(e.getNodeName()))
{
bonuses.add(Integer.valueOf(e.getTextContent()));
bonuses.add(Integer.parseInt(e.getTextContent()));
}
}
_armorHPBonuses.put(parseEnum(d.getAttributes(), CrystalType.class, "grade"), bonuses);
@@ -82,12 +82,11 @@ public class EnchantItemHPBonusData implements IXmlReader
if (!_armorHPBonuses.isEmpty())
{
final ItemTable it = ItemTable.getInstance();
L2Item item;
// Armors
final Collection<Integer> armorIds = it.getAllArmorsId();
for (Integer itemId : armorIds)
{
item = it.getTemplate(itemId);
L2Item item = it.getTemplate(itemId);
if ((item != null) && (item.getCrystalType() != CrystalType.NONE))
{
switch (item.getBodyPart())

View File

@@ -52,9 +52,7 @@ public class EnchantItemOptionsData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
Node att = null;
int counter = 0;
EnchantOptions op = null;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -72,12 +70,12 @@ public class EnchantItemOptionsData implements IXmlReader
{
if ("options".equalsIgnoreCase(cd.getNodeName()))
{
op = new EnchantOptions(parseInteger(cd.getAttributes(), "level"));
final EnchantOptions op = new EnchantOptions(parseInteger(cd.getAttributes(), "level"));
_data.get(itemId).put(op.getLevel(), op);
for (byte i = 0; i < 3; i++)
{
att = cd.getAttributes().getNamedItem("option" + (i + 1));
final Node att = cd.getAttributes().getNamedItem("option" + (i + 1));
if ((att != null) && Util.isDigit(att.getNodeValue()))
{
op.setOption(i, parseInteger(att));

View File

@@ -77,11 +77,6 @@ public class EnchantSkillGroupsData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
StatsSet set;
Node att;
int id = 0;
L2EnchantSkillGroup group;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -90,10 +85,9 @@ public class EnchantSkillGroupsData implements IXmlReader
{
if ("group".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
id = parseInteger(attrs, "id");
group = _enchantSkillGroups.get(id);
NamedNodeMap attrs = d.getAttributes();
final int id = parseInteger(attrs, "id");
L2EnchantSkillGroup group = _enchantSkillGroups.get(id);
if (group == null)
{
group = new L2EnchantSkillGroup(id);
@@ -105,11 +99,11 @@ public class EnchantSkillGroupsData implements IXmlReader
if ("enchant".equalsIgnoreCase(b.getNodeName()))
{
attrs = b.getAttributes();
set = new StatsSet();
StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
group.addEnchantDetail(new EnchantSkillHolder(set));

View File

@@ -65,12 +65,11 @@ public final class ExperienceData implements IXmlReader
MAX_LEVEL = (byte) (Byte.parseByte(tableAttr.getNamedItem("maxLevel").getNodeValue()) + 1);
MAX_PET_LEVEL = (byte) (Byte.parseByte(tableAttr.getNamedItem("maxPetLevel").getNodeValue()) + 1);
NamedNodeMap attrs;
for (Node n = table.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("experience".equals(n.getNodeName()))
{
attrs = n.getAttributes();
NamedNodeMap attrs = n.getAttributes();
_expTable.put(parseInteger(attrs, "level"), parseLong(attrs, "tolevel"));
}
}

View File

@@ -62,10 +62,6 @@ public final class FishData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node att;
L2Fish fish;
StatsSet set;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -74,15 +70,16 @@ public final class FishData implements IXmlReader
{
if ("fish".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
set = new StatsSet();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
fish = new L2Fish(set);
final L2Fish fish = new L2Fish(set);
switch (fish.getFishGrade())
{
case 0:

View File

@@ -56,10 +56,6 @@ public final class FishingMonstersData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node att;
L2FishingMonster fishingMonster;
StatsSet set;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -69,15 +65,15 @@ public final class FishingMonstersData implements IXmlReader
if ("fishingMonster".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
set = new StatsSet();
final NamedNodeMap attrs = d.getAttributes();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
fishingMonster = new L2FishingMonster(set);
final L2FishingMonster fishingMonster = new L2FishingMonster(set);
_fishingMonstersData.put(fishingMonster.getFishingMonsterId(), fishingMonster);
}
}

View File

@@ -56,10 +56,6 @@ public final class FishingRodsData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node att;
L2FishingRod fishingRod;
StatsSet set;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -68,16 +64,15 @@ public final class FishingRodsData implements IXmlReader
{
if ("fishingRod".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
set = new StatsSet();
final NamedNodeMap attrs = d.getAttributes();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
fishingRod = new L2FishingRod(set);
final L2FishingRod fishingRod = new L2FishingRod(set);
_fishingRods.put(fishingRod.getFishingRodItemId(), fishingRod);
}
}

View File

@@ -87,7 +87,6 @@ public final class HennaData implements IXmlReader
final List<ClassId> wearClassIds = new ArrayList<>();
NamedNodeMap attrs = d.getAttributes();
Node attr;
String name;
for (int i = 0; i < attrs.getLength(); i++)
{
attr = attrs.item(i);
@@ -96,7 +95,7 @@ public final class HennaData implements IXmlReader
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
{
name = c.getNodeName();
final String name = c.getNodeName();
attrs = c.getAttributes();
switch (name)
{

View File

@@ -51,7 +51,6 @@ public class KarmaData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("pcKarmaIncrease".equalsIgnoreCase(n.getNodeName()))
@@ -60,7 +59,7 @@ public class KarmaData implements IXmlReader
{
if ("increase".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
_karmaTable.put(parseInteger(attrs, "lvl"), parseDouble(attrs, "val"));
}
}

View File

@@ -57,8 +57,6 @@ public class OptionData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
int id;
Options op;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -67,8 +65,8 @@ public class OptionData implements IXmlReader
{
if ("option".equalsIgnoreCase(d.getNodeName()))
{
id = parseInteger(d.getAttributes(), "id");
op = new Options(id);
final int id = parseInteger(d.getAttributes(), "id");
final Options op = new Options(id);
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{

View File

@@ -58,9 +58,6 @@ public final class StaticObjectData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node att;
StatsSet set;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -69,11 +66,11 @@ public final class StaticObjectData implements IXmlReader
{
if ("object".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
set = new StatsSet();
final NamedNodeMap attrs = d.getAttributes();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
addObject(set);

View File

@@ -60,9 +60,6 @@ public final class TransformData implements IXmlReader
@Override
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node att;
StatsSet set;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -71,11 +68,11 @@ public final class TransformData implements IXmlReader
{
if ("transform".equalsIgnoreCase(d.getNodeName()))
{
attrs = d.getAttributes();
set = new StatsSet();
NamedNodeMap attrs = d.getAttributes();
StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
final Transform transform = new Transform(set);
@@ -105,7 +102,7 @@ public final class TransformData implements IXmlReader
attrs = s.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
break;
@@ -202,7 +199,7 @@ public final class TransformData implements IXmlReader
attrs = s.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
Node att = attrs.item(i);
levelsSet.set(att.getNodeName(), att.getNodeValue());
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.enums;
/**
* @author Zealar
*/
public enum EffectCalculationType
{
DIFF,
PER
}

View File

@@ -149,7 +149,7 @@ public class L2Attackable extends L2Npc
@Override
protected L2CharacterAI initAI()
{
return new L2AttackableAI(new AIAccessor());
return new L2AttackableAI(this);
}
public final Map<L2Character, AggroInfo> getAggroList()

View File

@@ -823,7 +823,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* </ul>
* @param target The L2Character targeted
*/
protected void doAttack(L2Character target)
public void doAttack(L2Character target)
{
if (!_attackLock.tryLock())
{
@@ -2576,6 +2576,15 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return true;
}
public void detachAI()
{
if (isWalker())
{
return;
}
setAI(null);
}
protected void calculateRewards(L2Character killer)
{
}
@@ -2653,7 +2662,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
*/
protected L2CharacterAI initAI()
{
return new L2CharacterAI(new AIAccessor());
return new L2CharacterAI(this);
}
public void setAI(L2CharacterAI newAI)
@@ -3472,93 +3481,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return _effectList.isAffectedBySkill(skillId);
}
// TODO: NEED TO ORGANIZE AND MOVE TO PROPER PLACE
/** This class permit to the L2Character AI to obtain informations and uses L2Character method */
public class AIAccessor
{
/**
* @return the L2Character managed by this Accessor AI.
*/
public L2Character getActor()
{
return L2Character.this;
}
/**
* Accessor to L2Character moveToLocation() method with an interaction area.
* @param x
* @param y
* @param z
* @param offset
*/
public void moveTo(int x, int y, int z, int offset)
{
moveToLocation(x, y, z, offset);
}
/**
* Accessor to L2Character moveToLocation() method without interaction area.
* @param x
* @param y
* @param z
*/
public void moveTo(int x, int y, int z)
{
moveToLocation(x, y, z, 0);
}
/**
* Accessor to L2Character stopMove() method.
* @param loc
*/
public void stopMove(Location loc)
{
L2Character.this.stopMove(loc);
}
/**
* Accessor to L2Character doAttack() method.
* @param target
*/
public void doAttack(L2Character target)
{
L2Character.this.doAttack(target);
}
/**
* Accessor to L2Character doCast() method.
* @param skill
*/
public void doCast(Skill skill)
{
L2Character.this.doCast(skill);
}
/**
* Create a NotifyAITask.
* @param evt
* @return
*/
public NotifyAITask newNotifyTask(CtrlEvent evt)
{
return new NotifyAITask(getActor(), evt);
}
/**
* Cancel the AI.
*/
public void detachAI()
{
// Skip character, if it is controlled by Walking Manager
if (isWalker())
{
return;
}
setAI(null);
}
}
/**
* This class group all movement data.<br>
* <B><U> Data</U> :</B>
@@ -4482,7 +4404,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return _target;
}
// called from AIAccessor only
/**
* Calculate movement data for a move to location action and add the L2Character to movingObjects of GameTimeController (only called by AI Accessor).<br>
* <B><U>Concept</U>:</B><br>
@@ -4509,7 +4430,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
* @param z The Y position of the destination
* @param offset The size of the interaction area of the L2Character targeted
*/
protected void moveToLocation(int x, int y, int z, int offset)
public void moveToLocation(int x, int y, int z, int offset)
{
// Get the Move Speed of the L2Charcater
double speed = getMoveSpeed();
@@ -5175,18 +5096,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
}
}
}
}
// Launch weapon Special ability effect if available
if (crit)
{
L2Weapon activeWeapon = getActiveWeaponItem();
if (activeWeapon != null)
// Launch weapon onCritical Special ability effect if available
if (crit && (weapon != null))
{
activeWeapon.castOnCriticalSkill(this, target);
weapon.castOnCriticalSkill(this, target);
}
}
// Recharge any active auto-soulshot tasks for current creature.
rechargeShots(true, false);
}
@@ -7115,6 +7030,26 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return getTemplate().getRace();
}
public boolean isInDuel()
{
return false;
}
public int getDuelId()
{
return 0;
}
public byte getSiegeState()
{
return 0;
}
public int getSiegeSide()
{
return 0;
}
public int getMinShopDistance()
{
return 0;

View File

@@ -21,6 +21,7 @@ package com.l2jserver.gameserver.model.actor;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.knownlist.PlayableKnownList;
import com.l2jserver.gameserver.model.actor.stat.PlayableStat;
@@ -343,6 +344,8 @@ public abstract class L2Playable extends L2Character
return transferDmgTo;
}
public abstract void doPickupItem(L2Object object);
public abstract int getKarma();
public abstract byte getPvpFlag();

View File

@@ -90,24 +90,6 @@ public abstract class L2Summon extends L2Playable
};
// @formatter:on
public class AIAccessor extends L2Character.AIAccessor
{
public L2Summon getSummon()
{
return L2Summon.this;
}
public boolean isAutoFollow()
{
return getFollowStatus();
}
public void doPickupItem(L2Object object)
{
L2Summon.this.doPickupItem(object);
}
}
/**
* Creates an abstract summon.
* @param template the summon NPC template
@@ -194,7 +176,7 @@ public abstract class L2Summon extends L2Playable
@Override
protected L2CharacterAI initAI()
{
return new L2SummonAI(new L2Summon.AIAccessor());
return new L2SummonAI(this);
}
@Override
@@ -538,10 +520,6 @@ public abstract class L2Summon extends L2Playable
return null;
}
protected void doPickupItem(L2Object object)
{
}
public void setRestoreSummon(boolean val)
{
}

View File

@@ -509,14 +509,6 @@ public abstract class L2Vehicle extends L2Character
return false;
}
public class AIAccessor extends L2Character.AIAccessor
{
@Override
public void detachAI()
{
}
}
@Override
public boolean isVehicle()
{

View File

@@ -40,7 +40,7 @@ public class L2AirShipInstance extends L2Vehicle
{
super(template);
setInstanceType(InstanceType.L2AirShipInstance);
setAI(new L2AirShipAI(new AIAccessor()));
setAI(new L2AirShipAI(this));
}
@Override

View File

@@ -44,7 +44,7 @@ public class L2BoatInstance extends L2Vehicle
{
super(template);
setInstanceType(InstanceType.L2BoatInstance);
setAI(new L2BoatAI(new AIAccessor()));
setAI(new L2BoatAI(this));
}
@Override

View File

@@ -31,18 +31,9 @@ public class L2ControllableMobInstance extends L2MonsterInstance
{
private boolean _isInvul;
protected class ControllableAIAcessor extends AIAccessor
{
@Override
public void detachAI()
{
// do nothing, AI of controllable mobs can't be detached automatically
}
}
/**
* Creates a controllable monster.
* @param template the contrllable monster NPC template
* @param template the controllable monster NPC template
*/
public L2ControllableMobInstance(L2NpcTemplate template)
{
@@ -66,7 +57,7 @@ public class L2ControllableMobInstance extends L2MonsterInstance
@Override
protected L2CharacterAI initAI()
{
return new L2ControllableMobAI(new ControllableAIAcessor());
return new L2ControllableMobAI(this);
}
@Override
@@ -91,4 +82,10 @@ public class L2ControllableMobInstance extends L2MonsterInstance
setAI(null);
return true;
}
@Override
public void detachAI()
{
// do nothing, AI of controllable mobs can't be detached automatically
}
}

View File

@@ -70,13 +70,13 @@ public class L2DefenderInstance extends L2Attackable
{
if ((getConquerableHall() == null) && (getCastle(10000) == null))
{
return new L2FortSiegeGuardAI(new AIAccessor());
return new L2FortSiegeGuardAI(this);
}
else if (getCastle(10000) != null)
{
return new L2SiegeGuardAI(new AIAccessor());
return new L2SiegeGuardAI(this);
}
return new L2SpecialSiegeGuardAI(new AIAccessor());
return new L2SpecialSiegeGuardAI(this);
}
/**

View File

@@ -114,45 +114,10 @@ public class L2DoorInstance extends L2Character
}
}
/** This class may be created only by L2Character and only for AI */
public class AIAccessor extends L2Character.AIAccessor
{
@Override
public L2DoorInstance getActor()
{
return L2DoorInstance.this;
}
@Override
public void moveTo(int x, int y, int z, int offset)
{
}
@Override
public void moveTo(int x, int y, int z)
{
}
@Override
public void stopMove(Location loc)
{
}
@Override
public void doAttack(L2Character target)
{
}
@Override
public void doCast(Skill skill)
{
}
}
@Override
protected L2CharacterAI initAI()
{
return new L2DoorAI(new AIAccessor());
return new L2DoorAI(this);
}
private void startTimerOpen()
@@ -700,6 +665,26 @@ public class L2DoorInstance extends L2Character
return true;
}
@Override
public void moveToLocation(int x, int y, int z, int offset)
{
}
@Override
public void stopMove(Location loc)
{
}
@Override
public void doAttack(L2Character target)
{
}
@Override
public void doCast(Skill skill)
{
}
@Override
public void sendInfo(L2PcInstance activeChar)
{

View File

@@ -410,47 +410,6 @@ public final class L2PcInstance extends L2Playable
private final List<IEventListener> _eventListeners = new CopyOnWriteArrayList<>();
public class AIAccessor extends L2Character.AIAccessor
{
public L2PcInstance getPlayer()
{
return L2PcInstance.this;
}
public void doPickupItem(L2Object object)
{
L2PcInstance.this.doPickupItem(object);
}
public void doInteract(L2Character target)
{
L2PcInstance.this.doInteract(target);
}
@Override
public void doAttack(L2Character target)
{
if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((isGood() && target.getActingPlayer().isGood()) || (isEvil() && target.getActingPlayer().isEvil())))
{
return;
}
super.doAttack(target);
// cancel the recent fake-death protection instantly if the player attacks or casts spells
getPlayer().setRecentFakeDeath(false);
}
@Override
public void doCast(Skill skill)
{
super.doCast(skill);
// cancel the recent fake-death protection instantly if the player attacks or casts spells
getPlayer().setRecentFakeDeath(false);
}
}
private L2GameClient _client;
private final String _accountName;
@@ -1235,7 +1194,7 @@ public final class L2PcInstance extends L2Playable
@Override
protected L2CharacterAI initAI()
{
return new L2PlayerAI(new L2PcInstance.AIAccessor());
return new L2PlayerAI(this);
}
/** Return the Level of the L2PcInstance. */
@@ -1674,6 +1633,7 @@ public final class L2PcInstance extends L2Playable
* Get the siege state of the L2PcInstance.
* @return 1 = attacker, 2 = defender, 0 = not involved
*/
@Override
public byte getSiegeState()
{
return _siegeState;
@@ -1697,6 +1657,7 @@ public final class L2PcInstance extends L2Playable
return true;
}
@Override
public int getSiegeSide()
{
return _siegeSide;
@@ -4568,7 +4529,8 @@ public final class L2PcInstance extends L2Playable
* current weight</li> <FONT COLOR=#FF0000><B> <U>Caution</U> : If a Party is in progress, distribute Items between party members</B></FONT>
* @param object The L2ItemInstance to pick up
*/
protected void doPickupItem(L2Object object)
@Override
public void doPickupItem(L2Object object)
{
if (isAlikeDead() || isFakeDeath())
{
@@ -4756,6 +4718,20 @@ public final class L2PcInstance extends L2Playable
}
}
@Override
public void doAttack(L2Character target)
{
super.doAttack(target);
setRecentFakeDeath(false);
}
@Override
public void doCast(Skill skill)
{
super.doCast(skill);
setRecentFakeDeath(false);
}
public boolean canOpenPrivateStore()
{
if ((Config.SHOP_MIN_RANGE_FROM_NPC > 0) || (Config.SHOP_MIN_RANGE_FROM_PLAYER > 0))
@@ -5390,7 +5366,7 @@ public final class L2PcInstance extends L2Playable
// If player is Lucky shouldn't get penalized.
if (!isLucky() && !insidePvpZone)
{
calculateDeathExpPenalty(killer, atWarWith(pk));
calculateDeathExpPenalty(killer, isAtWarWith(pk));
}
}
}
@@ -10084,11 +10060,13 @@ public final class L2PcInstance extends L2Playable
return _inOlympiadMode;
}
@Override
public boolean isInDuel()
{
return _isInDuel;
}
@Override
public int getDuelId()
{
return _duelId;
@@ -14815,7 +14793,6 @@ public final class L2PcInstance extends L2Playable
public void setCharmOfCourage(boolean val)
{
_hasCharmOfCourage = val;
}
/**
@@ -14824,7 +14801,6 @@ public final class L2PcInstance extends L2Playable
public boolean hasCharmOfCourage()
{
return _hasCharmOfCourage;
}
public boolean isAwaken()
@@ -14872,15 +14848,15 @@ public final class L2PcInstance extends L2Playable
* @param target the target
* @return {@code true} if this player got war with the target, {@code false} otherwise.
*/
public boolean atWarWith(L2Playable target)
public boolean isAtWarWith(L2Character target)
{
if (target == null)
{
return false;
}
if ((_clan != null) && !isAcademyMember()) // Current player
if ((_clan != null) && !isAcademyMember())
{
if ((target.getClan() != null) && !target.isAcademyMember()) // Target player
if ((target.getClan() != null) && !target.isAcademyMember())
{
return _clan.isAtWarWith(target.getClan());
}
@@ -14888,6 +14864,85 @@ public final class L2PcInstance extends L2Playable
return false;
}
/**
* @param target the target
* @return {@code true} if this player in same party with the target, {@code false} otherwise.
*/
public boolean isInPartyWith(L2Character target)
{
if (!isInParty() || !target.isInParty())
{
return false;
}
return getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId();
}
/**
* @param target the target
* @return {@code true} if this player in same command channel with the target, {@code false} otherwise.
*/
public boolean isInCommandChannelWith(L2Character target)
{
if (!isInParty() || !target.isInParty())
{
return false;
}
if (!getParty().isInCommandChannel() || !target.getParty().isInCommandChannel())
{
return false;
}
return getParty().getCommandChannel().getLeaderObjectId() == target.getParty().getCommandChannel().getLeaderObjectId();
}
/**
* @param target the target
* @return {@code true} if this player in same clan with the target, {@code false} otherwise.
*/
public boolean isInClanWith(L2Character target)
{
if ((getClanId() == 0) || (target.getClanId() == 0))
{
return false;
}
return getClanId() == target.getClanId();
}
/**
* @param target the target
* @return {@code true} if this player in same ally with the target, {@code false} otherwise.
*/
public boolean isInAllyWith(L2Character target)
{
if ((getAllyId() == 0) || (target.getAllyId() == 0))
{
return false;
}
return getAllyId() == target.getAllyId();
}
/**
* @param target the target
* @return {@code true} if this player at duel with the target, {@code false} otherwise.
*/
public boolean isInDuelWith(L2Character target)
{
if (!isInDuel() || !target.isInDuel())
{
return false;
}
return getDuelId() == target.getDuelId();
}
/**
* @param target the target
* @return {@code true} if this player is on same siege side with the target, {@code false} otherwise.
*/
public boolean isOnSameSiegeSideWith(L2Character target)
{
return (getSiegeState() > 0) && isInsideZone(ZoneId.SIEGE) && (getSiegeState() == target.getSiegeState()) && (getSiegeSide() == target.getSiegeSide());
}
/**
* Sets the beauty shop hair
* @param hairId

View File

@@ -476,7 +476,7 @@ public class L2PetInstance extends L2Summon
}
@Override
protected void doPickupItem(L2Object object)
public void doPickupItem(L2Object object)
{
if (isDead())
{

View File

@@ -101,8 +101,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return 1;
}
// ************************************/
public void setExpMultiplier(float expMultiplier)
{
_expMultiplier = expMultiplier;
@@ -113,8 +111,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return _expMultiplier;
}
// ************************************/
public void setItemConsume(ItemHolder item)
{
_itemConsume = item;
@@ -125,8 +121,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return _itemConsume;
}
// ************************************/
public void setItemConsumeInterval(int interval)
{
_consumeItemInterval = interval;
@@ -138,8 +132,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return _consumeItemInterval;
}
// ************************************/
public void setLifeTime(int lifeTime)
{
_lifeTime = lifeTime;
@@ -151,8 +143,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return _lifeTime;
}
// ************************************/
public void setLifeTimeRemaining(int time)
{
_lifeTimeRemaining = time;
@@ -163,8 +153,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return _lifeTimeRemaining;
}
// ************************************/
public void setReferenceSkill(int skillId)
{
_referenceSkill = skillId;
@@ -193,6 +181,11 @@ public class L2ServitorInstance extends L2Summon implements Runnable
}
@Override
public void doPickupItem(L2Object object)
{
}
/**
* Servitors' skills automatically change their level based on the servitor's level.<br>
* Until level 70, the servitor gets 1 lv of skill per 10 levels.<br>

View File

@@ -43,7 +43,7 @@ public class L2ShuttleInstance extends L2Vehicle
{
super(template);
setInstanceType(InstanceType.L2ShuttleInstance);
setAI(new L2ShuttleAI(new AIAccessor()));
setAI(new L2ShuttleAI(this));
}
public List<L2ShuttleStop> getStops()

View File

@@ -46,41 +46,6 @@ public final class L2StaticObjectInstance extends L2Character
private int _type = -1; // 0 - map signs, 1 - throne , 2 - arena signs
private ShowTownMap _map;
/** This class may be created only by L2Character and only for AI */
public class AIAccessor extends L2Character.AIAccessor
{
@Override
public L2StaticObjectInstance getActor()
{
return L2StaticObjectInstance.this;
}
@Override
public void moveTo(int x, int y, int z, int offset)
{
}
@Override
public void moveTo(int x, int y, int z)
{
}
@Override
public void stopMove(Location loc)
{
}
@Override
public void doAttack(L2Character target)
{
}
@Override
public void doCast(Skill skill)
{
}
}
/**
* Creates a static object.
* @param template the static object
@@ -239,4 +204,24 @@ public final class L2StaticObjectInstance extends L2Character
{
activeChar.sendPacket(new StaticObject(this));
}
@Override
public void moveToLocation(int x, int y, int z, int offset)
{
}
@Override
public void stopMove(Location loc)
{
}
@Override
public void doAttack(L2Character target)
{
}
@Override
public void doCast(Skill skill)
{
}
}

View File

@@ -32,9 +32,9 @@ public final class ClassInfo
/**
* Constructor for ClassInfo.
* @param classId the class Id.
* @param className the in game class name.
* @param parentClassId the parent class for the given {@code classId}.
* @param classId the class ID
* @param className the in game class name
* @param parentClassId the parent class for the given {@code classId}
*/
public ClassInfo(ClassId classId, String className, ClassId parentClassId)
{
@@ -44,7 +44,7 @@ public final class ClassInfo
}
/**
* @return the class Id.
* @return the class ID
*/
public ClassId getClassId()
{
@@ -52,7 +52,7 @@ public final class ClassInfo
}
/**
* @return the hardcoded in-game class name.
* @return the hardcoded in-game class name
*/
public String getClassName()
{
@@ -60,7 +60,7 @@ public final class ClassInfo
}
/**
* @return the class client Id.
* @return the class client ID
*/
private int getClassClientId()
{
@@ -85,7 +85,7 @@ public final class ClassInfo
}
/**
* @return the class client Id formatted to be displayed on a HTML.
* @return the class client ID formatted to be displayed on a HTML.
*/
public String getClientCode()
{
@@ -93,7 +93,7 @@ public final class ClassInfo
}
/**
* @return the escaped class client Id formatted to be displayed on a HTML.
* @return the escaped class client ID formatted to be displayed on a HTML
*/
public String getEscapedClientCode()
{
@@ -101,7 +101,7 @@ public final class ClassInfo
}
/**
* @return the parent class Id.
* @return the parent class ID
*/
public ClassId getParentClassId()
{

View File

@@ -47,6 +47,10 @@ public class ConditionPlayerCanResurrect extends Condition
{
return true;
}
if (effected == null)
{
return false;
}
boolean canResurrect = true;
if (effected.isPlayer())

View File

@@ -399,6 +399,16 @@ public final class L2Weapon extends L2Item
return;
}
if (trigger.isToggle())
{
return;
}
if (caster.getAI().getCastTarget() != target)
{
return;
}
if (_skillsOnMagicCondition != null)
{
if (!_skillsOnMagicCondition.test(caster, target, onMagicSkill))

View File

@@ -202,7 +202,7 @@ public class SkillChannelizer implements Runnable
}
// Update PvP status
if (character.isPlayable() && getChannelizer().isPlayer())
if (character.isPlayable() && getChannelizer().isPlayer() && skill.isBad())
{
((L2PcInstance) getChannelizer()).updatePvPStatus(character);
}

View File

@@ -153,7 +153,7 @@ public final class Calculator
int i;
for (i = 0; (i < funcs.length) && (function != funcs[i]); i++)
for (i = 0; (i < (funcs.length - 1)) && (function != funcs[i]); i++)
{
tmp[i] = funcs[i];
}

View File

@@ -18,6 +18,8 @@
*/
package com.l2jserver.gameserver.network.clientpackets;
import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
import java.util.ArrayList;
import com.l2jserver.Config;
@@ -102,6 +104,15 @@ public class MultiSellChoose extends L2GameClientPacket
return;
}
if (!player.isGM() && (npc != null))
{
if (!player.isInsideRadius(npc, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != npc.getInstanceId()))
{
player.setMultiSell(null);
return;
}
}
for (Entry entry : list.getEntries())
{
if (entry.getEntryId() == _entryId)