From c03c1f4057c80c7461837f0f3d0974cfa32e8b54 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 19 Apr 2024 10:11:27 -0400 Subject: [PATCH] Update to item effect serialization --- src/engine/net/client/msg/ManageNPCMsg.java | 30 +++++++++++++++------ src/engine/objects/Item.java | 9 ------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index 4e422bcd..2aaaa484 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -476,15 +476,29 @@ public class ManageNPCMsg extends ClientNetMsg { else writer.putInt(-1497023830); - if ((prefix != null && !item.isRandom()) || (prefix != null && item.isComplete())) - writer.putInt(prefix.getToken()); - else - writer.putInt(0); + if (item.prefixToken == 0) { + if (!item.isComplete()) + writer.putInt(0); + else + writer.putInt(prefix.getToken()); + } else { + if (prefix != null) + writer.putInt(prefix.getToken()); + else + writer.putInt(0); + } - if ((suffix != null && !item.isRandom()) || (suffix != null && item.isComplete())) - writer.putInt(suffix.getToken()); - else - writer.putInt(0); + if (item.suffixToken == 0) { + if (!item.isComplete()) + writer.putInt(0); + else + writer.putInt(suffix.getToken()); + } else { + if (suffix != null) + writer.putInt(suffix.getToken()); + else + writer.putInt(0); + } writer.putString(item.name); } diff --git a/src/engine/objects/Item.java b/src/engine/objects/Item.java index d5b7ddd5..bc437ea7 100644 --- a/src/engine/objects/Item.java +++ b/src/engine/objects/Item.java @@ -51,7 +51,6 @@ public class Item extends AbstractWorldObject { public int chargesRemaining; public mbEnums.EquipSlotType equipSlot; private boolean canDestroy; - private boolean isRandom = false; public int value; public OwnerType ownerType; public int templateID; @@ -1129,14 +1128,6 @@ public class Item extends AbstractWorldObject { this.value = value; } - public boolean isRandom() { - return isRandom; - } - - public void setRandom(boolean isRandom) { - this.isRandom = isRandom; - } - public boolean isCustomValue() { if (this.value == 0) return false;