Guest User

Untitled

a guest
Dec 11th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. public void restorePet(L2PcInstance activeChar)
  2. {
  3. L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_pets.get(activeChar.getObjectId()));
  4. final L2SummonItem sitem = SummonItemsData.getInstance().getSummonItem(item.getItemId());
  5. L2NpcTemplate npcTemplate = NpcTable.getInstance().getTemplate(sitem.getNpcId());
  6.  
  7. if (npcTemplate == null)
  8. return;
  9.  
  10. final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, activeChar, item);
  11. if (petSummon == null)
  12. return;
  13.  
  14. petSummon.setShowSummonAnimation(true);
  15. petSummon.setTitle(activeChar.getName());
  16.  
  17. if (!petSummon.isRespawned())
  18. {
  19. petSummon.setCurrentHp(petSummon.getMaxHp());
  20. petSummon.setCurrentMp(petSummon.getMaxMp());
  21. petSummon.getStat().setExp(petSummon.getExpForThisLevel());
  22. petSummon.setCurrentFed(petSummon.getMaxFed());
  23. }
  24.  
  25. petSummon.setRunning();
  26.  
  27. if (!petSummon.isRespawned())
  28. petSummon.store();
  29.  
  30. activeChar.setPet(petSummon);
  31.  
  32. petSummon.spawnMe(activeChar.getX() + 50, activeChar.getY() + 100, activeChar.getZ());
  33. petSummon.startFeed();
  34. item.setEnchantLevel(petSummon.getLevel());
  35.  
  36. if (petSummon.getCurrentFed() <= 0)
  37. petSummon.unSummon(activeChar);
  38. else
  39. petSummon.startFeed();
  40.  
  41. petSummon.setFollowStatus(true);
  42.  
  43. petSummon.getOwner().sendPacket(new PetItemList(petSummon));
  44. petSummon.broadcastStatusUpdate();
  45. }
Add Comment
Please, Sign In to add comment