diff --git a/core/src/com/riiablo/codec/D2S.java b/core/src/com/riiablo/codec/D2S.java index 5fc9c03b..a8a17452 100644 --- a/core/src/com/riiablo/codec/D2S.java +++ b/core/src/com/riiablo/codec/D2S.java @@ -295,17 +295,17 @@ public class D2S { return sb.toString(); } - static class MercData { + public static class MercData { static final int SIZE = 16; static final int FLAG_DEAD = 0x100000; - int flags; - int seed; - short name; - short type; - int xp; - MercItemData items; + public int flags; + public int seed; + public short name; + public short type; + public int xp; + public MercItemData items; static MercData obtain(ByteBuffer buffer) { return new MercData().read(buffer); @@ -338,7 +338,7 @@ public class D2S { return (flags & FLAG_DEAD) == FLAG_DEAD; } - static class MercItemData { + public static class MercItemData { static final byte[] SECTION_HEADER = {0x6A, 0x66}; public byte header[]; diff --git a/core/src/com/riiablo/entity/Player.java b/core/src/com/riiablo/entity/Player.java index 301b3b7b..ba7f1a3e 100644 --- a/core/src/com/riiablo/entity/Player.java +++ b/core/src/com/riiablo/entity/Player.java @@ -107,6 +107,7 @@ public class Player extends Entity { EnumMap equipped = new EnumMap<>(BodyLoc.class); final Set SLOT_LISTENERS = new CopyOnWriteArraySet<>(); + public D2S.MercData merc; /** total number of items equipped for each set */ public final IntIntMap SETS_EQUIP = new IntIntMap(); @@ -129,6 +130,10 @@ public class Player extends Entity { actions = d2s.actions; loadEquipped(d2s.items.equipped); loadInventory(d2s.items.inventory); + merc = d2s.merc; + for (Item item : merc.items.items.items) { + item.load(); + } } public Player(Connect connect) { diff --git a/core/src/com/riiablo/panel/HirelingPanel.java b/core/src/com/riiablo/panel/HirelingPanel.java index c913bb9c..b3569c49 100644 --- a/core/src/com/riiablo/panel/HirelingPanel.java +++ b/core/src/com/riiablo/panel/HirelingPanel.java @@ -136,7 +136,7 @@ public class HirelingPanel extends WidgetGroup implements Disposable { for (int i = BodyLocs.HEAD; i < BodyLocs.NUM_LOCS; i++) { if (bodyParts[i] == null) continue; bodyParts[i].slot = i; - //bodyParts[i].item = gameScreen.player.getSlot(BodyLoc.valueOf(i)); + bodyParts[i].item = gameScreen.player.merc.items.items.equipped.get(BodyLoc.valueOf(i)); bodyParts[i].setBodyPart(Riiablo.files.bodylocs.get(i).Code); }