From d55b57f7d0f98c8d35a907f42026b344c1f7459c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 11 May 2024 10:46:34 -0400 Subject: [PATCH] Flag testing --- src/engine/mbEnums.java | 10 ++++++++++ src/engine/net/client/msg/ManageNPCMsg.java | 10 ++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/engine/mbEnums.java b/src/engine/mbEnums.java index 8c4a8b3f..2dfcd6cd 100644 --- a/src/engine/mbEnums.java +++ b/src/engine/mbEnums.java @@ -37,6 +37,16 @@ import java.util.concurrent.ThreadLocalRandom; public class mbEnums { + public static > int toInt(EnumSet enumSet) { + + int bitvector = 0; + + for (T value : enumSet) + bitvector |= 1 << value.ordinal(); + + return bitvector; + } + public static > long toLong(EnumSet enumSet) { long bitvector = 0L; diff --git a/src/engine/net/client/msg/ManageNPCMsg.java b/src/engine/net/client/msg/ManageNPCMsg.java index 7c4d6647..caf2bb87 100644 --- a/src/engine/net/client/msg/ManageNPCMsg.java +++ b/src/engine/net/client/msg/ManageNPCMsg.java @@ -10,6 +10,7 @@ package engine.net.client.msg; import engine.gameManager.NPCManager; +import engine.mbEnums; import engine.mbEnums.GameObjectType; import engine.mbEnums.MinionType; import engine.mbEnums.ProtectionState; @@ -456,10 +457,11 @@ public class ManageNPCMsg extends ClientNetMsg { else writer.put((byte) 0); - if ((item.prefixToken == 0 && item.suffixToken == 0)) - writer.putInt(0); - else - writer.putInt(-1497023830); + writer.putInt(mbEnums.toInt(item.flags)); + // if ((item.prefixToken == 0 && item.suffixToken == 0)) + // writer.putInt(0); + // else + // writer.putInt(-1497023830); writer.putInt(item.prefixToken); writer.putInt(item.suffixToken);