Reverted last two commits from Interlude.

This commit is contained in:
MobiusDev 2018-07-01 00:06:02 +00:00
parent 049a9b02aa
commit 0259b6527c
44 changed files with 86 additions and 82 deletions

View File

@ -485,7 +485,7 @@ public class Baium extends Quest
{ {
for (L2Object obj : objs) for (L2Object obj : objs)
{ {
if (obj.isCharacter()) if (obj instanceof L2Character)
{ {
if (((((L2Character) obj).getZ() < (npc.getZ() - 100)) && (((L2Character) obj).getZ() > (npc.getZ() + 100))) || !GeoData.getInstance().canSeeTarget(obj, npc)) if (((((L2Character) obj).getZ() < (npc.getZ() - 100)) && (((L2Character) obj).getZ() > (npc.getZ() + 100))) || !GeoData.getInstance().canSeeTarget(obj, npc))
{ {

View File

@ -572,7 +572,7 @@ abstract class AbstractAI implements Ctrl
} }
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers // Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all L2PcInstance in its _knownPlayers
if (pawn.isCharacter()) if (pawn instanceof L2Character)
{ {
if (_actor.isOnGeodataPath()) if (_actor.isOnGeodataPath())
{ {

View File

@ -427,7 +427,7 @@ public class L2AttackableAI extends L2CharacterAI
// Go through visible objects // Go through visible objects
for (L2Object obj : npc.getKnownList().getKnownObjects().values()) for (L2Object obj : npc.getKnownList().getKnownObjects().values())
{ {
if ((obj == null) || !obj.isCharacter()) if ((obj == null) || !(obj instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -507,7 +507,7 @@ public class L2CharacterAI extends AbstractAI
return; return;
} }
if (object.isItem() && (((L2ItemInstance) object).getLocation() != ItemLocation.VOID)) if ((object instanceof L2ItemInstance) && (((L2ItemInstance) object).getLocation() != ItemLocation.VOID))
{ {
// Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor // Cancel action client side by sending Server->Client packet ActionFailed to the L2PcInstance actor
clientActionFailed(); clientActionFailed();
@ -1029,7 +1029,7 @@ public class L2CharacterAI extends AbstractAI
offset += _actor.getTemplate().collisionRadius; offset += _actor.getTemplate().collisionRadius;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
offset += ((L2Character) target).getTemplate().collisionRadius; offset += ((L2Character) target).getTemplate().collisionRadius;
} }
@ -1086,7 +1086,7 @@ public class L2CharacterAI extends AbstractAI
stopFollow(); stopFollow();
if (target.isCharacter() && !(target instanceof L2DoorInstance)) if ((target instanceof L2Character) && !(target instanceof L2DoorInstance))
{ {
if (((L2Character) target).isMoving()) if (((L2Character) target).isMoving())
{ {

View File

@ -440,7 +440,7 @@ public class L2ControllableMobAI extends L2AttackableAI
for (L2Object obj : npc.getKnownList().getKnownObjects().values()) for (L2Object obj : npc.getKnownList().getKnownObjects().values())
{ {
if (!obj.isCharacter()) if (!(obj instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -239,7 +239,7 @@ public class AdminEffects implements IAdminCommandHandler
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
L2Character player = null; L2Character player = null;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
player = (L2Character) target; player = (L2Character) target;
if (type.equals("1")) if (type.equals("1"))
@ -267,7 +267,7 @@ public class AdminEffects implements IAdminCommandHandler
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
L2Character player = null; L2Character player = null;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
player = (L2Character) target; player = (L2Character) target;
player.stopAbnormalEffect((short) 0x0400); player.stopAbnormalEffect((short) 0x0400);
@ -322,7 +322,7 @@ public class AdminEffects implements IAdminCommandHandler
L2Object target = activeChar.getTarget(); L2Object target = activeChar.getTarget();
L2Character player = null; L2Character player = null;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
player = (L2Character) target; player = (L2Character) target;
player.startAbnormalEffect(0x2000); player.startAbnormalEffect(0x2000);
@ -340,7 +340,7 @@ public class AdminEffects implements IAdminCommandHandler
L2Object target = activeChar.getTarget(); L2Object target = activeChar.getTarget();
L2Character player = null; L2Character player = null;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
player = (L2Character) target; player = (L2Character) target;
player.stopAbnormalEffect((short) 0x2000); player.stopAbnormalEffect((short) 0x2000);
@ -545,7 +545,7 @@ public class AdminEffects implements IAdminCommandHandler
L2Object target = activeChar.getTarget(); L2Object target = activeChar.getTarget();
L2Character player = null; L2Character player = null;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
player = (L2Character) target; player = (L2Character) target;
player.stopAllEffects(); player.stopAllEffects();
@ -662,7 +662,7 @@ public class AdminEffects implements IAdminCommandHandler
obj = activeChar; obj = activeChar;
} }
if (!obj.isCharacter()) if (!(obj instanceof L2Character))
{ {
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
} }
@ -696,7 +696,7 @@ public class AdminEffects implements IAdminCommandHandler
*/ */
private boolean performAbnormal(int action, L2Object target) private boolean performAbnormal(int action, L2Object target)
{ {
if (target.isCharacter()) if (target instanceof L2Character)
{ {
L2Character character = (L2Character) target; L2Character character = (L2Character) target;
@ -718,7 +718,7 @@ public class AdminEffects implements IAdminCommandHandler
{ {
try try
{ {
if (target.isCharacter()) if (target instanceof L2Character)
{ {
if ((target instanceof L2Summon) || (target instanceof L2ChestInstance)) if ((target instanceof L2Summon) || (target instanceof L2ChestInstance))
{ {

View File

@ -95,7 +95,7 @@ public class AdminHeal implements IAdminCommandHandler
final int radius = Integer.parseInt(player); final int radius = Integer.parseInt(player);
for (L2Object object : activeChar.getKnownList().getKnownObjects().values()) for (L2Object object : activeChar.getKnownList().getKnownObjects().values())
{ {
if (object.isCharacter()) if (object instanceof L2Character)
{ {
L2Character character = (L2Character) object; L2Character character = (L2Character) object;
character.setCurrentHpMp(character.getMaxHp(), character.getMaxMp()); character.setCurrentHpMp(character.getMaxHp(), character.getMaxMp());
@ -121,7 +121,7 @@ public class AdminHeal implements IAdminCommandHandler
obj = activeChar; obj = activeChar;
} }
if (obj.isCharacter()) if (obj instanceof L2Character)
{ {
final L2Character target = (L2Character) obj; final L2Character target = (L2Character) obj;
target.setCurrentHpMp(target.getMaxHp(), target.getMaxMp()); target.setCurrentHpMp(target.getMaxHp(), target.getMaxMp());

View File

@ -123,7 +123,7 @@ public class AdminKill implements IAdminCommandHandler
{ {
L2Object obj = activeChar.getTarget(); L2Object obj = activeChar.getTarget();
if ((obj == null) || (obj instanceof L2ControllableMobInstance) || !obj.isCharacter()) if ((obj == null) || (obj instanceof L2ControllableMobInstance) || !(obj instanceof L2Character))
{ {
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET); activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
} }

View File

@ -105,7 +105,7 @@ public class AdminMobGroup implements IAdminCommandHandler
} }
else if (command.startsWith("admin_mobgroup_attack")) else if (command.startsWith("admin_mobgroup_attack"))
{ {
if (activeChar.getTarget().isCharacter()) if (activeChar.getTarget() instanceof L2Character)
{ {
L2Character target = (L2Character) activeChar.getTarget(); L2Character target = (L2Character) activeChar.getTarget();
attack(command, activeChar, target); attack(command, activeChar, target);

View File

@ -107,7 +107,7 @@ public class AdminPolymorph implements IAdminCommandHandler
obj.getPoly().setPolyInfo(type, id); obj.getPoly().setPolyInfo(type, id);
// animation // animation
if (obj.isCharacter()) if (obj instanceof L2Character)
{ {
L2Character Char = (L2Character) obj; L2Character Char = (L2Character) obj;
MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0); MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0);

View File

@ -196,7 +196,7 @@ public class AdminTest implements IAdminCommandHandler
L2Character player; L2Character player;
L2Object target = activeChar.getTarget(); L2Object target = activeChar.getTarget();
if ((target == null) || !target.isCharacter()) if ((target == null) || !(target instanceof L2Character))
{ {
player = activeChar; player = activeChar;
} }

View File

@ -53,7 +53,7 @@ public class CombatPointHeal implements ISkillHandler
for (L2Object object : targets) for (L2Object object : targets)
{ {
if (!object.isCharacter()) if (!(object instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -95,7 +95,7 @@ public class Disablers implements ISkillHandler
for (L2Object target2 : targets) for (L2Object target2 : targets)
{ {
// Get a target // Get a target
if (!target2.isCharacter()) if (!(target2 instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -77,7 +77,7 @@ public class Recall implements ISkillHandler
for (L2Object target1 : targets) for (L2Object target1 : targets)
{ {
if (!target1.isCharacter()) if (!(target1 instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -112,7 +112,7 @@ public class SummonFriend implements ISkillHandler
{ {
for (L2Object target1 : targets) for (L2Object target1 : targets)
{ {
if (!target1.isCharacter()) if (!(target1 instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -38,7 +38,7 @@ public class ZakenPlayer implements ISkillHandler
{ {
for (L2Object target1 : targets) for (L2Object target1 : targets)
{ {
if (!target1.isCharacter()) if (!(target1 instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -38,7 +38,7 @@ public class ZakenSelf implements ISkillHandler
{ {
for (L2Object target1 : targets) for (L2Object target1 : targets)
{ {
if (!target1.isCharacter()) if (!(target1 instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -297,7 +297,7 @@ public abstract class L2Object
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this.isItem().</li> * <li>this instanceof L2ItemInstance</li>
* <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li> <BR> * <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li> <BR>
* <BR> * <BR>
* <B><U> Example of use </U> :</B><BR> * <B><U> Example of use </U> :</B><BR>
@ -331,7 +331,7 @@ public abstract class L2Object
} }
// if this item is a mercenary ticket, remove the spawns! // if this item is a mercenary ticket, remove the spawns!
if (isItem()) if (this instanceof L2ItemInstance)
{ {
final int itemId = ((L2ItemInstance) this).getItemId(); final int itemId = ((L2ItemInstance) this).getItemId();
if (MercTicketManager.getInstance().getTicketCastleId(itemId) > 0) if (MercTicketManager.getInstance().getTicketCastleId(itemId) > 0)

View File

@ -1402,7 +1402,7 @@ public abstract class L2Skill
Env env = new Env(); Env env = new Env();
env.player = activeChar; env.player = activeChar;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
env.target = (L2Character) target; env.target = (L2Character) target;
} }
@ -1432,7 +1432,7 @@ public abstract class L2Skill
// Get the L2Objcet targeted by the user of the skill at this moment // Get the L2Objcet targeted by the user of the skill at this moment
final L2Object objTarget = activeChar.getTarget(); final L2Object objTarget = activeChar.getTarget();
// If the L2Object targeted is a L2Character, it becomes the L2Character target // If the L2Object targeted is a L2Character, it becomes the L2Character target
if (objTarget.isCharacter()) if (objTarget instanceof L2Character)
{ {
target = (L2Character) objTarget; target = (L2Character) objTarget;
} }

View File

@ -339,7 +339,7 @@ public class TradeList
L2Object o = L2World.getInstance().findObject(objectId); L2Object o = L2World.getInstance().findObject(objectId);
if ((o == null) || !o.isItem()) if ((o == null) || !(o instanceof L2ItemInstance))
{ {
Util.handleIllegalPlayerAction(_owner, "Player " + _owner.getName() + " Attempt to add invalid item to TradeList! ", Config.DEFAULT_PUNISH); Util.handleIllegalPlayerAction(_owner, "Player " + _owner.getName() + " Attempt to add invalid item to TradeList! ", Config.DEFAULT_PUNISH);
LOGGER.warning(_owner.getName() + ": Attempt to add invalid item to TradeList!"); LOGGER.warning(_owner.getName() + ": Attempt to add invalid item to TradeList!");
@ -1159,7 +1159,7 @@ public class TradeList
} }
final L2Object obj = L2World.getInstance().findObject(item.getObjectId()); final L2Object obj = L2World.getInstance().findObject(item.getObjectId());
if ((obj == null) || !obj.isItem()) if ((obj == null) || (!(obj instanceof L2ItemInstance)))
{ {
final String msgErr = "[RequestPrivateStoreSell] player " + _owner.getName() + " tried to sell null item in a private store (buy), ban this player!"; final String msgErr = "[RequestPrivateStoreSell] player " + _owner.getName() + " tried to sell null item in a private store (buy), ban this player!";
Util.handleIllegalPlayerAction(_owner, msgErr, Config.DEFAULT_PUNISH); Util.handleIllegalPlayerAction(_owner, msgErr, Config.DEFAULT_PUNISH);

View File

@ -1581,7 +1581,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
L2Character target; L2Character target;
for (L2Object obj : getKnownList().getKnownObjects().values()) for (L2Object obj : getKnownList().getKnownObjects().values())
{ {
if (obj.isCharacter()) if (obj instanceof L2Character)
{ {
if ((obj instanceof L2PetInstance) && (this instanceof L2PcInstance) && (((L2PetInstance) obj).getOwner() == (L2PcInstance) this)) if ((obj instanceof L2PetInstance) && (this instanceof L2PcInstance) && (((L2PetInstance) obj).getOwner() == (L2PcInstance) this))
{ {
@ -3195,7 +3195,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
* <BR> * <BR>
* <B><U> Assert </U> :</B><BR> * <B><U> Assert </U> :</B><BR>
* <BR> * <BR>
* <li>this.isCharacter().</li><BR> * <li>this instanceof L2Character</li><BR>
* <BR * <BR
* @param template the new template * @param template the new template
*/ */
@ -7457,7 +7457,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
@Override @Override
public void onForcedAttack(L2PcInstance player) public void onForcedAttack(L2PcInstance player)
{ {
if ((player.getTarget() == null) || !player.getTarget().isCharacter()) if ((player.getTarget() == null) || !(player.getTarget() instanceof L2Character))
{ {
// If target is not attackable, send a Server->Client packet ActionFailed // If target is not attackable, send a Server->Client packet ActionFailed
player.sendPacket(ActionFailed.STATIC_PACKET); player.sendPacket(ActionFailed.STATIC_PACKET);
@ -7668,7 +7668,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
} }
} }
if (attacker.isCharacter() && ((L2Character) attacker).isInsideZone(ZoneId.PEACE) if ((attacker instanceof L2Character) && ((L2Character) attacker).isInsideZone(ZoneId.PEACE)
// the townzone has to be already peace zone // the townzone has to be already peace zone
// || TownManager.getInstance().getTown(attacker.getX(), attacker.getY(), attacker.getZ())!= null // || TownManager.getInstance().getTown(attacker.getX(), attacker.getY(), attacker.getZ())!= null
) )
@ -7676,7 +7676,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
return true; return true;
} }
if (target.isCharacter() && ((L2Character) target).isInsideZone(ZoneId.PEACE) if ((target instanceof L2Character) && ((L2Character) target).isInsideZone(ZoneId.PEACE)
// the townzone has to be already peace zone // the townzone has to be already peace zone
// || TownManager.getInstance().getTown(target.getX(), target.getY(), target.getZ())!= null // || TownManager.getInstance().getTown(target.getX(), target.getY(), target.getZ())!= null
) )
@ -8387,7 +8387,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
for (int i = 0; (targets != null) && (i < targets.length); i++) for (int i = 0; (targets != null) && (i < targets.length); i++)
{ {
if (targets[i].isCharacter()) if (targets[i] instanceof L2Character)
{ {
if (!Util.checkIfInRange(escapeRange, this, targets[i], true)) if (!Util.checkIfInRange(escapeRange, this, targets[i], true))
{ {
@ -8712,12 +8712,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
// Like L2OFF if the skill is BLOW the player doesn't auto attack // Like L2OFF if the skill is BLOW the player doesn't auto attack
// If on XML skill nextActionAttack = true the char auto attack // If on XML skill nextActionAttack = true the char auto attack
// If CTRL is pressed the autoattack is aborted (like L2OFF) // If CTRL is pressed the autoattack is aborted (like L2OFF)
if ((skilldat != null) && !skilldat.isCtrlPressed() && skill.nextActionIsAttack() && (_target != null) && _target.isCharacter()) if ((skilldat != null) && !skilldat.isCtrlPressed() && skill.nextActionIsAttack() && (_target != null) && (_target instanceof L2Character))
{ {
getAI().setIntention(AI_INTENTION_ATTACK, _target); getAI().setIntention(AI_INTENTION_ATTACK, _target);
} }
} }
else if (skill.nextActionIsAttack() && (_target != null) && _target.isCharacter()) else if (skill.nextActionIsAttack() && (_target != null) && (_target instanceof L2Character))
{ {
getAI().setIntention(AI_INTENTION_ATTACK, _target); getAI().setIntention(AI_INTENTION_ATTACK, _target);
} }
@ -8790,7 +8790,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
{ {
for (L2Object target : targets) for (L2Object target : targets)
{ {
if ((target != null) && target.isCharacter() && !((L2Character) target).isDead()) if ((target != null) && (target instanceof L2Character) && !((L2Character) target).isDead())
{ {
final L2Character player = (L2Character) target; final L2Character player = (L2Character) target;
@ -9048,7 +9048,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
// Do initial checkings for skills and set pvp flag/draw aggro when needed // Do initial checkings for skills and set pvp flag/draw aggro when needed
for (L2Object target : targets) for (L2Object target : targets)
{ {
if (target.isCharacter()) if (target instanceof L2Character)
{ {
// Set some values inside target's instance for later use // Set some values inside target's instance for later use
L2Character player = (L2Character) target; L2Character player = (L2Character) target;
@ -9066,7 +9066,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
* instanceof L2PcInstance) { sendPacket(SystemMessage.sendString("Target affected by weapon special ability!")); } } * instanceof L2PcInstance) { sendPacket(SystemMessage.sendString("Target affected by weapon special ability!")); } }
*/ */
if (target.isCharacter()) if (target instanceof L2Character)
{ {
final L2Character targ = (L2Character) target; final L2Character targ = (L2Character) target;
@ -9476,7 +9476,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
return false; return false;
} }
if (target.isCharacter()) if (target instanceof L2Character)
{ {
((L2Character) target).sendPacket(new ValidateLocation(this)); ((L2Character) target).sendPacket(new ValidateLocation(this));
sendPacket(new ValidateLocation(((L2Character) target))); sendPacket(new ValidateLocation(((L2Character) target)));
@ -9567,7 +9567,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
return false; return false;
} }
if (target.isCharacter()) if (target instanceof L2Character)
{ {
((L2Character) target).sendPacket(new ValidateLocation(this)); ((L2Character) target).sendPacket(new ValidateLocation(this));
sendPacket(new ValidateLocation(((L2Character) target))); sendPacket(new ValidateLocation(((L2Character) target)));
@ -9628,7 +9628,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder
return false; return false;
} }
if (target.isCharacter()) if (target instanceof L2Character)
{ {
if (isBehind(_target) || isFront(_target)) if (isBehind(_target) || isFront(_target))
{ {

View File

@ -534,7 +534,7 @@ public class L2CubicInstance
} }
// test owners target if it is valid then use it // test owners target if it is valid then use it
if (ownerTarget.isCharacter() && (ownerTarget != _owner.getPet()) && (ownerTarget != _owner)) if ((ownerTarget instanceof L2Character) && (ownerTarget != _owner.getPet()) && (ownerTarget != _owner))
{ {
// target mob which has aggro on you or your summon // target mob which has aggro on you or your summon
if (ownerTarget instanceof L2Attackable) if (ownerTarget instanceof L2Attackable)

View File

@ -607,7 +607,7 @@ public class L2NpcInstance extends L2Character
return 10000; return 10000;
} }
if ((object instanceof L2FolkInstance) || !object.isCharacter()) if ((object instanceof L2FolkInstance) || !(object instanceof L2Character))
{ {
return 0; return 0;
} }

View File

@ -1297,7 +1297,7 @@ public final class L2PcInstance extends L2Playable
default: default:
{ {
L2Object mainTarget = skill.getFirstOfTargetList(L2PcInstance.this); L2Object mainTarget = skill.getFirstOfTargetList(L2PcInstance.this);
if ((mainTarget == null) || !mainTarget.isCharacter()) if ((mainTarget == null) || !(mainTarget instanceof L2Character))
{ {
return; return;
} }
@ -6647,7 +6647,7 @@ public final class L2PcInstance extends L2Playable
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
// Check if the L2Object to pick up is a L2ItemInstance // Check if the L2Object to pick up is a L2ItemInstance
if (!object.isItem()) if (!(object instanceof L2ItemInstance))
{ {
// dont try to pickup anything that is not an item :) // dont try to pickup anything that is not an item :)
LOGGER.warning(this + "trying to pickup wrong target." + getTarget()); LOGGER.warning(this + "trying to pickup wrong target." + getTarget());
@ -6893,7 +6893,7 @@ public final class L2PcInstance extends L2Playable
} }
// Remove the L2PcInstance from the _statusListener of the old target if it was a L2Character // Remove the L2PcInstance from the _statusListener of the old target if it was a L2Character
if (oldTarget.isCharacter()) if (oldTarget instanceof L2Character)
{ {
((L2Character) oldTarget).removeStatusListener(this); ((L2Character) oldTarget).removeStatusListener(this);
} }
@ -6901,7 +6901,7 @@ public final class L2PcInstance extends L2Playable
oldTarget = null; oldTarget = null;
// Add the L2PcInstance to the _statusListener of the new target if it's a L2Character // Add the L2PcInstance to the _statusListener of the new target if it's a L2Character
if ((newTarget != null) && newTarget.isCharacter()) if ((newTarget != null) && (newTarget instanceof L2Character))
{ {
((L2Character) newTarget).addStatusListener(this); ((L2Character) newTarget).addStatusListener(this);
TargetSelected my = new TargetSelected(getObjectId(), newTarget.getObjectId(), getX(), getY(), getZ()); TargetSelected my = new TargetSelected(getObjectId(), newTarget.getObjectId(), getX(), getY(), getZ());

View File

@ -558,7 +558,7 @@ public class L2PetInstance extends L2Summon
broadcastPacket(sm); broadcastPacket(sm);
if (!object.isItem()) if (!(object instanceof L2ItemInstance))
{ {
// dont try to pickup anything that is not an item :) // dont try to pickup anything that is not an item :)
LOGGER.warning("Trying to pickup wrong target." + object); LOGGER.warning("Trying to pickup wrong target." + object);

View File

@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.ai.L2CharacterAI; import com.l2jmobius.gameserver.ai.L2CharacterAI;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Attackable; import com.l2jmobius.gameserver.model.actor.L2Attackable;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.L2Playable;
import com.l2jmobius.gameserver.model.actor.instance.L2FolkInstance; import com.l2jmobius.gameserver.model.actor.instance.L2FolkInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
@ -49,7 +50,7 @@ public class AttackableKnownList extends NpcKnownList
} }
// Remove the L2Object from the _aggrolist of the L2Attackable // Remove the L2Object from the _aggrolist of the L2Attackable
if ((object != null) && object.isCharacter()) if ((object != null) && (object instanceof L2Character))
{ {
getActiveChar().getAggroList().remove(object); getActiveChar().getAggroList().remove(object);
} }
@ -94,7 +95,7 @@ public class AttackableKnownList extends NpcKnownList
@Override @Override
public int getDistanceToWatchObject(L2Object object) public int getDistanceToWatchObject(L2Object object)
{ {
if ((object instanceof L2FolkInstance) || !object.isCharacter()) if ((object instanceof L2FolkInstance) || !(object instanceof L2Character))
{ {
return 0; return 0;
} }

View File

@ -147,7 +147,7 @@ public class CharKnownList extends ObjectKnownList
for (L2Object obj : getKnownObjects().values()) for (L2Object obj : getKnownObjects().values())
{ {
if ((obj != null) && obj.isCharacter()) if ((obj != null) && (obj instanceof L2Character))
{ {
result.add((L2Character) obj); result.add((L2Character) obj);
} }

View File

@ -67,7 +67,7 @@ public class FriendlyMobKnownList extends AttackableKnownList
return false; return false;
} }
if (!object.isCharacter()) if (!(object instanceof L2Character))
{ {
return true; return true;
} }

View File

@ -68,7 +68,7 @@ public class MonsterKnownList extends AttackableKnownList
return false; return false;
} }
if (!object.isCharacter()) if (!(object instanceof L2Character))
{ {
return true; return true;
} }

View File

@ -46,7 +46,7 @@ public class NpcKnownList extends CharKnownList
return false; return false;
} }
if (getActiveObject().isNpc() && object.isCharacter()) if (getActiveObject().isNpc() && (object instanceof L2Character))
{ {
// Broadcast correct walking NPC position. // Broadcast correct walking NPC position.
if (object.isPlayer() && getActiveChar().isMoving() && !getActiveChar().isInCombat()) if (object.isPlayer() && getActiveChar().isMoving() && !getActiveChar().isInCombat())
@ -77,7 +77,7 @@ public class NpcKnownList extends CharKnownList
return 10000; return 10000;
} }
if ((object instanceof L2FolkInstance) || !object.isCharacter()) if ((object instanceof L2FolkInstance) || !(object instanceof L2Character))
{ {
return 0; return 0;
} }

View File

@ -114,7 +114,7 @@ public class ObjectKnownList
public final synchronized void updateKnownObjects() public final synchronized void updateKnownObjects()
{ {
// Only bother updating knownobjects for L2Character; don't for L2Object // Only bother updating knownobjects for L2Character; don't for L2Object
if (_activeObject.isCharacter()) if (_activeObject instanceof L2Character)
{ {
findCloseObjects(); findCloseObjects();
forgetObjects(); forgetObjects();
@ -150,7 +150,7 @@ public class ObjectKnownList
// Try to add active object to object's known objects // Try to add active object to object's known objects
// Only if object is a L2Character and active object is a L2PlayableInstance // Only if object is a L2Character and active object is a L2PlayableInstance
if (object.isCharacter()) if (object instanceof L2Character)
{ {
object.getKnownList().addKnownObject(_activeObject); object.getKnownList().addKnownObject(_activeObject);
} }

View File

@ -120,7 +120,7 @@ public class PcKnownList extends PlayableKnownList
} }
else else
{ {
if (object.isItem()) if (object instanceof L2ItemInstance)
{ {
if (dropper != null) if (dropper != null)
{ {
@ -229,7 +229,7 @@ public class PcKnownList extends PlayableKnownList
} }
} }
if (object.isCharacter()) if (object instanceof L2Character)
{ {
// Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance // Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance
L2Character obj = (L2Character) object; L2Character obj = (L2Character) object;

View File

@ -23,6 +23,7 @@ import com.l2jmobius.commons.util.Point3D;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.L2WorldRegion; import com.l2jmobius.gameserver.model.L2WorldRegion;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
/** /**
@ -106,7 +107,7 @@ public class ObjectPosition
((L2PcInstance) _activeObject).sendMessage("Error with your coords, Please ask a GM for help!"); ((L2PcInstance) _activeObject).sendMessage("Error with your coords, Please ask a GM for help!");
} }
else if (_activeObject.isCharacter()) else if (_activeObject instanceof L2Character)
{ {
_activeObject.decayMe(); _activeObject.decayMe();
} }

View File

@ -120,7 +120,7 @@ public final class Action extends L2GameClientPacket
} }
case 1: case 1:
{ {
if (obj.isCharacter() && ((L2Character) obj).isAlikeDead()) if ((obj instanceof L2Character) && ((L2Character) obj).isAlikeDead())
{ {
obj.onAction(activeChar); obj.onAction(activeChar);
} }

View File

@ -747,7 +747,7 @@ public final class RequestActionUse extends L2GameClientPacket
boolean force = _ctrlPressed; boolean force = _ctrlPressed;
if (target.isCharacter()) if (target instanceof L2Character)
{ {
if (activeSummon.isInsideZone(ZoneId.PVP) && ((L2Character) target).isInsideZone(ZoneId.PVP)) if (activeSummon.isInsideZone(ZoneId.PVP) && ((L2Character) target).isInsideZone(ZoneId.PVP))
{ {

View File

@ -84,7 +84,7 @@ public class RequestRecordInfo extends L2GameClientPacket
} }
else else
{ {
if (object.isItem()) if (object instanceof L2ItemInstance)
{ {
_activeChar.sendPacket(new SpawnItem((L2ItemInstance) object)); _activeChar.sendPacket(new SpawnItem((L2ItemInstance) object));
} }
@ -160,7 +160,7 @@ public class RequestRecordInfo extends L2GameClientPacket
} }
} }
if (object.isCharacter()) if (object instanceof L2Character)
{ {
// Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance // Update the state of the L2Character object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the L2PcInstance
final L2Character obj = (L2Character) object; final L2Character obj = (L2Character) object;

View File

@ -225,7 +225,7 @@ public final class Say2 extends L2GameClientPacket
final CreatureSay cs = new CreatureSay(actor, _type, name, _text); final CreatureSay cs = new CreatureSay(actor, _type, name, _text);
for (L2Object obj : list) for (L2Object obj : list)
{ {
if ((obj == null) || !obj.isCharacter()) if ((obj == null) || !(obj instanceof L2Character))
{ {
continue; continue;
} }

View File

@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.gameserver.datatables.sql.NpcTable; import com.l2jmobius.gameserver.datatables.sql.NpcTable;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate; import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate;
/** /**
@ -90,7 +91,7 @@ public class NpcInfoPoly extends L2GameServerPacket
_isSummoned = false; _isSummoned = false;
_collisionRadius = _template.collisionRadius; _collisionRadius = _template.collisionRadius;
_collisionHeight = _template.collisionHeight; _collisionHeight = _template.collisionHeight;
if (_obj.isCharacter()) if (_obj instanceof L2Character)
{ {
_activeChar = (L2Character) obj; _activeChar = (L2Character) obj;
_isAttackable = obj.isAutoAttackable(attacker); _isAttackable = obj.isAutoAttackable(attacker);
@ -98,7 +99,7 @@ public class NpcInfoPoly extends L2GameServerPacket
_lhand = _template.lhand; _lhand = _template.lhand;
} }
if (_obj.isItem()) if (_obj instanceof L2ItemInstance)
{ {
_x = _obj.getX(); _x = _obj.getX();
_y = _obj.getY(); _y = _obj.getY();

View File

@ -32,7 +32,7 @@ public class SpawnItemPoly extends L2GameServerPacket
public SpawnItemPoly(L2Object object) public SpawnItemPoly(L2Object object)
{ {
if (object.isItem()) if (object instanceof L2ItemInstance)
{ {
final L2ItemInstance item = (L2ItemInstance) object; final L2ItemInstance item = (L2ItemInstance) object;
_objectId = object.getObjectId(); _objectId = object.getObjectId();

View File

@ -71,7 +71,7 @@ final class EffectConfusion extends L2Effect
continue; continue;
} }
if (obj.isCharacter() && (obj != getEffected())) if ((obj instanceof L2Character) && (obj != getEffected()))
{ {
targetList.add((L2Character) obj); targetList.add((L2Character) obj);
} }

View File

@ -22,6 +22,7 @@ import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.L2WorldRegion; import com.l2jmobius.gameserver.model.L2WorldRegion;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.L2Playable; import com.l2jmobius.gameserver.model.actor.L2Playable;
public class KnownListUpdateTaskManager public class KnownListUpdateTaskManager
@ -117,7 +118,7 @@ public class KnownListUpdateTaskManager
} }
} }
} }
else if (object.isCharacter()) else if (object instanceof L2Character)
{ {
for (L2WorldRegion regi : region.getSurroundingRegions()) // offer members of this and surrounding regions for (L2WorldRegion regi : region.getSurroundingRegions()) // offer members of this and surrounding regions
{ {

View File

@ -177,11 +177,11 @@ public final class Util
} }
int rad = 0; int rad = 0;
if (obj1.isCharacter()) if (obj1 instanceof L2Character)
{ {
rad += ((L2Character) obj1).getTemplate().collisionRadius; rad += ((L2Character) obj1).getTemplate().collisionRadius;
} }
if (obj2.isCharacter()) if (obj2 instanceof L2Character)
{ {
rad += ((L2Character) obj2).getTemplate().collisionRadius; rad += ((L2Character) obj2).getTemplate().collisionRadius;
} }

View File

@ -53,7 +53,7 @@ public class ItemFilter implements Filter
} }
if (_excludeItemType != null) if (_excludeItemType != null)
{ {
// if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0].isItem().)) // if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0] instanceof L2ItemInstance))
// return true; // return true;
final L2ItemInstance item = (L2ItemInstance) record.getParameters()[0]; final L2ItemInstance item = (L2ItemInstance) record.getParameters()[0];

View File

@ -1097,14 +1097,14 @@ public class GameStatusThread extends Thread
{ {
continue; continue;
} }
if (obj.isCharacter()) if (obj instanceof L2Character)
{ {
if (((L2Character) obj).hasAI()) if (((L2Character) obj).hasAI())
{ {
AICount++; AICount++;
} }
} }
if (obj.isItem()) if (obj instanceof L2ItemInstance)
{ {
if (((L2ItemInstance) obj).getLocation() == L2ItemInstance.ItemLocation.VOID) if (((L2ItemInstance) obj).getLocation() == L2ItemInstance.ItemLocation.VOID)
{ {
@ -1144,7 +1144,7 @@ public class GameStatusThread extends Thread
{ {
doorCount++; doorCount++;
} }
else if (obj.isCharacter()) else if (obj instanceof L2Character)
{ {
charCount++; charCount++;
} }