Replaced instanceof L2PetInstance with isPet method.

This commit is contained in:
MobiusDev
2018-07-02 01:12:00 +00:00
parent 856ff5ebdc
commit e9e7d40628
19 changed files with 45 additions and 47 deletions

View File

@@ -598,7 +598,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -767,7 +767,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -809,7 +809,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1625,7 +1625,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -598,7 +598,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -767,7 +767,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -809,7 +809,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1645,7 +1645,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -598,7 +598,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -767,7 +767,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -809,7 +809,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1645,7 +1645,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -598,7 +598,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -767,7 +767,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -809,7 +809,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1645,7 +1645,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -590,7 +590,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -763,7 +763,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -805,7 +805,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1537,7 +1537,7 @@ public class AdminEditChar implements IAdminCommandHandler
html.replace("%mp%", (int) target.getStatus().getCurrentMp() + "/" + target.getStat().getMaxMp()); html.replace("%mp%", (int) target.getStatus().getCurrentMp() + "/" + target.getStat().getMaxMp());
html.replace("%karma%", Integer.toString(target.getKarma())); html.replace("%karma%", Integer.toString(target.getKarma()));
html.replace("%race%", target.getTemplate().getRace().toString()); html.replace("%race%", target.getTemplate().getRace().toString());
if (target instanceof L2PetInstance) if (target.isPet())
{ {
final int objId = target.getActingPlayer().getObjectId(); final int objId = target.getActingPlayer().getObjectId();
html.replace("%inv%", " <a action=\"bypass admin_show_pet_inv " + objId + "\">view</a>"); html.replace("%inv%", " <a action=\"bypass admin_show_pet_inv " + objId + "\">view</a>");
@@ -1546,7 +1546,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", ((L2PetInstance) target).getInventory().getTotalWeight() + "/" + ((L2PetInstance) target).getMaxLoad()); html.replace("%load%", ((L2PetInstance) target).getInventory().getTotalWeight() + "/" + ((L2PetInstance) target).getMaxLoad());

View File

@@ -36,7 +36,6 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; import com.l2jmobius.gameserver.model.holders.ItemChanceHolder;
import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld; import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
@@ -969,7 +968,7 @@ public class Q00144_PailakaInjuredDragon extends Quest
private void checkMaxSummonLevel(L2PcInstance player) private void checkMaxSummonLevel(L2PcInstance player)
{ {
final L2Summon pet = player.getSummon(); final L2Summon pet = player.getSummon();
if (pet instanceof L2PetInstance) if ((pet != null) && pet.isPet())
{ {
if (pet.getLevel() > MAX_SUMMON_LEVEL) if (pet.getLevel() > MAX_SUMMON_LEVEL)
{ {

View File

@@ -61,7 +61,7 @@ public class PlayableStat extends CharStat
setExp(getExp() + value); setExp(getExp() + value);
byte minimumLevel = 1; byte minimumLevel = 1;
if (getActiveChar() instanceof L2PetInstance) if (getActiveChar().isPet())
{ {
// get minimum level from L2NpcTemplate // get minimum level from L2NpcTemplate
minimumLevel = (byte) PetDataTable.getInstance().getPetMinLevel(((L2PetInstance) getActiveChar()).getTemplate().getId()); minimumLevel = (byte) PetDataTable.getInstance().getPetMinLevel(((L2PetInstance) getActiveChar()).getTemplate().getId());
@@ -96,7 +96,7 @@ public class PlayableStat extends CharStat
setExp(getExp() - value); setExp(getExp() - value);
byte minimumLevel = 1; byte minimumLevel = 1;
if (getActiveChar() instanceof L2PetInstance) if (getActiveChar().isPet())
{ {
// get minimum level from L2NpcTemplate // get minimum level from L2NpcTemplate
minimumLevel = (byte) PetDataTable.getInstance().getPetMinLevel(((L2PetInstance) getActiveChar()).getTemplate().getId()); minimumLevel = (byte) PetDataTable.getInstance().getPetMinLevel(((L2PetInstance) getActiveChar()).getTemplate().getId());

View File

@@ -40,7 +40,6 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance; import com.l2jmobius.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2ServitorInstance; import com.l2jmobius.gameserver.model.actor.instance.L2ServitorInstance;
import com.l2jmobius.gameserver.model.events.EventDispatcher; import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.events.OnTvTEventFinish; import com.l2jmobius.gameserver.model.events.impl.events.OnTvTEventFinish;
@@ -817,7 +816,7 @@ public class TvTEvent
L2PcInstance killerPlayerInstance = null; L2PcInstance killerPlayerInstance = null;
if ((killerCharacter instanceof L2PetInstance) || (killerCharacter instanceof L2ServitorInstance)) if (killerCharacter.isPet() || (killerCharacter instanceof L2ServitorInstance))
{ {
killerPlayerInstance = ((L2Summon) killerCharacter).getOwner(); killerPlayerInstance = ((L2Summon) killerCharacter).getOwner();

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -594,7 +594,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -763,7 +763,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -805,7 +805,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1621,7 +1621,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -594,7 +594,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -763,7 +763,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -805,7 +805,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList((L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList((L2PetInstance) target));
} }
@@ -1621,7 +1621,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is

View File

@@ -594,7 +594,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_fullfood")) else if (command.startsWith("admin_fullfood"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance targetPet = (L2PetInstance) target; final L2PetInstance targetPet = (L2PetInstance) target;
targetPet.setCurrentFed(targetPet.getMaxFed()); targetPet.setCurrentFed(targetPet.getMaxFed());
@@ -763,7 +763,7 @@ public class AdminEditChar implements IAdminCommandHandler
else if (command.startsWith("admin_summon_setlvl")) else if (command.startsWith("admin_summon_setlvl"))
{ {
final L2Object target = activeChar.getTarget(); final L2Object target = activeChar.getTarget();
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) target; final L2PetInstance pet = (L2PetInstance) target;
try try
@@ -805,7 +805,7 @@ public class AdminEditChar implements IAdminCommandHandler
target = activeChar.getTarget(); target = activeChar.getTarget();
} }
if (target instanceof L2PetInstance) if ((target != null) && target.isPet())
{ {
activeChar.sendPacket(new GMViewItemList(1, (L2PetInstance) target)); activeChar.sendPacket(new GMViewItemList(1, (L2PetInstance) target));
} }
@@ -1621,7 +1621,7 @@ public class AdminEditChar implements IAdminCommandHandler
{ {
html.replace("%inv%", "none"); html.replace("%inv%", "none");
} }
if (target instanceof L2PetInstance) if (target.isPet())
{ {
html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed()); html.replace("%food%", ((L2PetInstance) target).getCurrentFed() + "/" + ((L2PetInstance) target).getPetLevelData().getPetMaxFeed());
html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad()); html.replace("%load%", target.getInventory().getTotalWeight() + "/" + target.getMaxLoad());

View File

@@ -34,7 +34,7 @@ public class PetStatusUpdate implements IClientOutgoingPacket
public PetStatusUpdate(L2Summon summon) public PetStatusUpdate(L2Summon summon)
{ {
_summon = summon; _summon = summon;
if (_summon instanceof L2PetInstance) if (_summon.isPet())
{ {
final L2PetInstance pet = (L2PetInstance) _summon; final L2PetInstance pet = (L2PetInstance) _summon;
_curFed = pet.getCurrentFed(); // how fed it is _curFed = pet.getCurrentFed(); // how fed it is