Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void restorePet(L2PcInstance activeChar)
- {
- L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_pets.get(activeChar.getObjectId()));
- final L2SummonItem sitem = SummonItemsData.getInstance().getSummonItem(item.getItemId());
- L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(sitem.getNpcId());
- if (npcTemplate == null)
- return;
- final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, activeChar, item);
- if (petSummon == null)
- return;
- petSummon.setShowSummonAnimation(true);
- petSummon.setTitle(activeChar.getName());
- if (!petSummon.isRespawned())
- {
- petSummon.setCurrentHp(petSummon.getMaxHp());
- petSummon.setCurrentMp(petSummon.getMaxMp());
- petSummon.getStat().setExp(petSummon.getExpForThisLevel());
- petSummon.setCurrentFed(petSummon.getMaxFed());
- }
- petSummon.setRunning();
- if (!petSummon.isRespawned())
- petSummon.store();
- activeChar.setPet(petSummon);
- petSummon.spawnMe(activeChar.getX() + 50, activeChar.getY() + 100, activeChar.getZ());
- petSummon.startFeed();
- item.setEnchantLevel(petSummon.getLevel());
- if (petSummon.getCurrentFed() <= 0)
- petSummon.unSummon(activeChar);
- else
- petSummon.startFeed();
- petSummon.setFollowStatus(true);
- petSummon.getOwner().sendPacket(new PetItemList(petSummon));
- petSummon.broadcastStatusUpdate();
- }
Add Comment
Please, Sign In to add comment