L2JMobius

Free Users => Solved/Invalid Bug Reports => Topic started by: Strelook66 on July 27, 2020, 10:04:27 PM

Title: Pet items destroyed from inventory
Post by: Strelook66 on July 27, 2020, 10:04:27 PM
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.
Title: Re: Pet items destroyed from inventory
Post by: borinet on August 09, 2021, 07:37:43 AM
Yes. I have this error too.
Title: Re: Pet items destroyed from inventory
Post by: Mobius on August 12, 2021, 05:35:22 AM
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.");
Title: Re: Pet items destroyed from inventory
Post by: Mobius on August 12, 2021, 11:57:40 PM
From what I see when you logout the items are returned to player inventory.
Title: Re: Pet items destroyed from inventory
Post by: zillion on August 12, 2021, 11:59:23 PM
The issue is when the Player doesn't log out and the server restarts.
Title: Re: Pet items destroyed from inventory
Post by: Mobius on August 13, 2021, 12:12:09 AM
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();
  }
Title: Re: Pet items destroyed from inventory
Post by: zillion on August 13, 2021, 12:33:48 AM
Working like a charm!
Title: Re: Pet items destroyed from inventory
Post by: Mobius on August 13, 2021, 01:23:25 AM
Fixed with https://bitbucket.org/MobiusDev/l2j_mobius/commits/387bc0b335bad689adda0d0a5acf8825e4e7ab20