Unsummon previous existing pet, return null if template does not exist.

This commit is contained in:
MobiusDevelopment
2021-05-28 23:48:11 +00:00
parent 4055965fa9
commit 24e82859ca
23 changed files with 90 additions and 46 deletions

View File

@ -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