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

@ -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)
{
}
}