L2JMobius

C6 Pet items destroyed from inventory

Strelook66 · 8 · 3226

Offline Strelook66

  • Knight
  • ***
    • Posts: 82
Hi,

I noticed a rather annoying bug with the inventory of the hatchling. In case you have the pet equipped with items, have some food in there, and the server restarts, the items get destroyed and not moved back to the player's inventory.

I have no further information regarding this because there is no error. I tried several times, same result. if the player doesn't unsummon the pet, and the server issues a restart, the items carried by the pet are destroyed.



Online Mobius

  • Distinguished King
  • *****
    • Posts: 16009
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/instancemanager/IdManager.java
===================================================================
--- java/org/l2jmobius/gameserver/instancemanager/IdManager.java (revision 8817)
+++ java/org/l2jmobius/gameserver/instancemanager/IdManager.java (working copy)
@@ -123,7 +123,7 @@
  cleanCount += statement.executeUpdate("DELETE FROM posts WHERE posts.post_forum_id NOT IN (SELECT forum_id FROM forums);");
 
  // Update needed items after cleaning has taken place.
- cleanCount += statement.executeUpdate("DELETE FROM items WHERE items.owner_id NOT IN (SELECT charId FROM characters) AND items.owner_id NOT IN (SELECT clan_id FROM clan_data);");
+ cleanCount += statement.executeUpdate("DELETE FROM items WHERE items.owner_id NOT IN (SELECT charId FROM characters) AND items.owner_id NOT IN (SELECT clan_id FROM clan_data) AND items.owner_id NOT IN (SELECT item_obj_id FROM pets);");
  statement.executeUpdate("UPDATE characters SET clanid=0 WHERE characters.clanid NOT IN (SELECT clan_id FROM clan_data);");
 
  LOGGER.info("IdManager: Cleaned " + cleanCount + " elements from database in " + ((Chronos.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16009
From what I see when you logout the items are returned to player inventory.


Offline zillion

  • Vassal
  • *
    • Posts: 3
The issue is when the Player doesn't log out and the server restarts.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16009
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/Shutdown.java
===================================================================
--- java/org/l2jmobius/gameserver/Shutdown.java (revision 9061)
+++ java/org/l2jmobius/gameserver/Shutdown.java (working copy)
@@ -518,6 +518,12 @@
  // Logout Character
  try
  {
+ // Unsummon pets
+ if (player.getPet() != null)
+ {
+ player.getPet().unSummon(player);
+ }
+
  // Save player status
  player.store();
  }