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 {
if (includeSlot) if (includeSlot)
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
int templateID = reader.getInt(); //itemBase
int objectType = reader.getInt(); //object type; int objectType = reader.getInt(); //object type;
int UUID = reader.getInt(); int UUID = reader.getInt();
for (int i = 0; i < 14; i++) {
for (int i = 0; i < 14; i++)
reader.getInt(); // Pads and statics reader.getInt(); // Pads and statics
}
int unknown = reader.getInt(); int unknown = reader.getInt();
byte readString = reader.get(); byte readString = reader.get();
if (readString == 1) if (readString == 1)
reader.getString(); reader.getString();
byte readDurability = reader.get(); byte readDurability = reader.get();
if (readDurability == 1) { if (readDurability == 1) {
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
} }
byte readEnchants = reader.get(); byte readEnchants = reader.get();
if (readEnchants == 1) { if (readEnchants == 1) {
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
int enchantSize = reader.getInt(); int enchantSize = reader.getInt();
for (int i = 0; i < enchantSize; i++) { for (int i = 0; i < enchantSize; i++) {
reader.getInt(); //effect token reader.getInt(); //effect token
reader.getInt(); //trains reader.getInt(); //trains
int type = reader.getInt(); int type = reader.getInt();
reader.get(); reader.get();
if (type == 1) if (type == 1)
reader.getLong(); //item comp reader.getLong(); //item comp
else else
@ -432,13 +443,14 @@ public class Item extends AbstractWorldObject {
reader.getString(); //name reader.getString(); //name
reader.getFloat(); //duration reader.getFloat(); //duration
} }
for (int i = 0; i < 5; i++) {
for (int i = 0; i < 5; i++)
reader.getInt(); reader.getInt();
} }
}
reader.get(); reader.get();
byte isContract = reader.get(); byte isContract = reader.get();
if (isContract == 1) { if (isContract == 1) {
reader.getInt(); reader.getInt();
reader.getInt(); reader.getInt();
@ -448,8 +460,10 @@ public class Item extends AbstractWorldObject {
if (UUID == 0 || objectType == 0) if (UUID == 0 || objectType == 0)
return null; return null;
if (objectType == GameObjectType.MobLoot.ordinal()) if (objectType == GameObjectType.MobLoot.ordinal())
return MobLoot.getFromCache(UUID); return MobLoot.getFromCache(UUID);
return Item.getFromCache(UUID); return Item.getFromCache(UUID);
} }

Loading…
Cancel
Save