Browse Source

Bugfix in deserialization

combat-2
MagicBot 8 months ago
parent
commit
94253f547d
  1. 22
      src/engine/objects/Item.java

22
src/engine/objects/Item.java

@ -397,34 +397,45 @@ public class Item extends AbstractWorldObject { @@ -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 { @@ -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 { @@ -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);
}

Loading…
Cancel
Save