Browse Source

Flag testing

combat-2
MagicBot 6 months ago
parent
commit
d55b57f7d0
  1. 10
      src/engine/mbEnums.java
  2. 10
      src/engine/net/client/msg/ManageNPCMsg.java

10
src/engine/mbEnums.java

@ -37,6 +37,16 @@ import java.util.concurrent.ThreadLocalRandom; @@ -37,6 +37,16 @@ import java.util.concurrent.ThreadLocalRandom;
public class mbEnums {
public static <T extends Enum<T>> int toInt(EnumSet<T> enumSet) {
int bitvector = 0;
for (T value : enumSet)
bitvector |= 1 << value.ordinal();
return bitvector;
}
public static <T extends Enum<T>> long toLong(EnumSet<T> enumSet) {
long bitvector = 0L;

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

@ -10,6 +10,7 @@ @@ -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 { @@ -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);

Loading…
Cancel
Save