Unsummon previous existing pet, return null if template does not exist.
This commit is contained in:
@ -216,10 +216,12 @@ public class PetInstance extends Summon
|
||||
|
||||
public static synchronized PetInstance spawnPet(NpcTemplate template, PlayerInstance owner, ItemInstance control)
|
||||
{
|
||||
if (World.getInstance().getPet(owner.getObjectId()) != null)
|
||||
final PetInstance existingPet = World.getInstance().getPet(owner.getObjectId());
|
||||
if (existingPet != null) // owner has a pet listed in world
|
||||
{
|
||||
return null; // owner has a pet listed in world
|
||||
existingPet.unSummon(owner);
|
||||
}
|
||||
|
||||
final PetData data = PetDataTable.getInstance().getPetData(template.getId());
|
||||
final PetInstance pet = restore(control, template, owner);
|
||||
// add the pet instance to world
|
||||
|
Reference in New Issue
Block a user