From 94253f547da074e2cd1489ab0e31001d522fba8c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 28 Mar 2024 20:44:14 -0400 Subject: [PATCH] Bugfix in deserialization --- src/engine/objects/Item.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index da96cb6e..dbe828d3 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -397,34 +397,45 @@ public class Item extends AbstractWorldObject { if (includeSlot) reader.getInt(); reader.getInt(); + int templateID = reader.getInt(); //itemBase int objectType = reader.getInt(); //object type; int UUID = reader.getInt(); - for (int i = 0; i < 14; i++) { + + for (int i = 0; i < 14; i++) reader.getInt(); // Pads and statics - } + int unknown = reader.getInt(); byte readString = reader.get(); + if (readString == 1) reader.getString(); + byte readDurability = reader.get(); + if (readDurability == 1) { reader.getInt(); reader.getInt(); } byte readEnchants = reader.get(); + if (readEnchants == 1) { reader.getInt(); reader.getInt(); reader.getInt(); reader.getInt(); + int enchantSize = reader.getInt(); + for (int i = 0; i < enchantSize; i++) { reader.getInt(); //effect token reader.getInt(); //trains + int type = reader.getInt(); + reader.get(); + if (type == 1) reader.getLong(); //item comp else @@ -432,13 +443,14 @@ public class Item extends AbstractWorldObject { reader.getString(); //name reader.getFloat(); //duration } - for (int i = 0; i < 5; i++) { + + for (int i = 0; i < 5; i++) reader.getInt(); - } } reader.get(); byte isContract = reader.get(); + if (isContract == 1) { reader.getInt(); reader.getInt(); @@ -448,8 +460,10 @@ public class Item extends AbstractWorldObject { if (UUID == 0 || objectType == 0) return null; + if (objectType == GameObjectType.MobLoot.ordinal()) return MobLoot.getFromCache(UUID); + return Item.getFromCache(UUID); }