Browse Source

Serialization update

combat-2
MagicBot 9 months ago
parent
commit
48f88ec819
  1. 11
      src/engine/net/client/msg/ManageNPCMsg.java

11
src/engine/net/client/msg/ManageNPCMsg.java

@ -27,8 +27,6 @@ import org.pmw.tinylog.Logger; @@ -27,8 +27,6 @@ import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
/**
* Order NPC
@ -436,12 +434,13 @@ public class ManageNPCMsg extends ClientNetMsg { @@ -436,12 +434,13 @@ public class ManageNPCMsg extends ClientNetMsg {
writer.put((byte) template.modTable);//EffectItemType
}
List<Item> itemList = ForgeManager.vendorItemLookup.get(npc);
itemList = itemList.stream().limit(npc.getRank()).collect(Collectors.toList());
// Sanity check.
writer.putInt(itemList.size());
ForgeManager.vendorItemLookup.computeIfAbsent(npc, k -> new ArrayList<>()); // Forge lookup
for (Item item : itemList) {
writer.putInt(ForgeManager.vendorItemLookup.get(npc).size());
for (Item item : ForgeManager.vendorItemLookup.get(npc)) {
writer.put((byte) 0); // ? Unknown45
writer.putInt(item.getObjectType().ordinal());

Loading…
Cancel
Save