From e3f468681ad31c840bb8f4230d5e98b0bf9951e0 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 15 Aug 2023 15:25:50 -0400 Subject: [PATCH] Cleaner rank filter on display --- src/engine/net/client/msg/ManageNPCMsg.java | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index 2a99e252..03caea83 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -26,7 +26,9 @@ import org.pmw.tinylog.Logger; import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; /** * Order NPC @@ -362,6 +364,7 @@ public class ManageNPCMsg extends ClientNetMsg { long curTime = System.currentTimeMillis() / 1000; long upgradeTime = (mob.deathTime + (mob.spawnTime * 1000)) / 1000; long timeLife = upgradeTime - curTime; + if (upgradeTime * 1000 > System.currentTimeMillis()) { if (mob.npcOwner.isAlive()) { writer.put((byte) 0);//shows respawning timer @@ -402,13 +405,14 @@ public class ManageNPCMsg extends ClientNetMsg { writer.putInt(0); else writer.putInt(npc.getRank()); //vendor slots + writer.putInt(0); //artilerist slots writer.putInt(0); //runemaster slots writer.putInt(1); //is this static? - for (int i = 0; i < 4; i++) { + + for (int i = 0; i < 4; i++) writer.putInt(0); //statics - } HashSet rollableSet = npc.getCanRoll(); @@ -428,17 +432,19 @@ public class ManageNPCMsg extends ClientNetMsg { writer.put((byte) item.getModTable()); writer.put((byte) item.getModTable());//EffectItemType } - ArrayList itemList = npc.getRolling(); - writer.putInt(itemList.size()); + List itemList = npc.getRolling(); + itemList = itemList.stream().limit(npc.getRank()).collect(Collectors.toList()); + + writer.putInt(itemList.size()); - for (Item i : itemList) { + for (Item i : itemList) { - ItemBase ib = i.getItemBase(); + ItemBase ib = i.getItemBase(); - writer.put((byte) 0); // ? Unknown45 - writer.putInt(i.getObjectType().ordinal()); - writer.putInt(i.getObjectUUID()); + writer.put((byte) 0); // ? Unknown45 + writer.putInt(i.getObjectType().ordinal()); + writer.putInt(i.getObjectUUID()); writer.putInt(0); writer.putInt(i.getItemBaseID());