Massive varp/varbit related refactoring + new client command

This commit is contained in:
ceikry
2021-08-09 13:20:07 -05:00
parent 3c5c702e7e
commit aa6bf95006
2 changed files with 17 additions and 2 deletions
@@ -7,8 +7,14 @@ import core.net.packet.context.VarbitContext;
public class Varbit implements OutgoingPacket<VarbitContext> {
@Override
public void send(VarbitContext varbitContext) {
IoBuffer buffer = new IoBuffer(37);
buffer.put((byte) varbitContext.value);
IoBuffer buffer;
if(varbitContext.value > 255){
buffer = new IoBuffer(84);
buffer.putLEInt((128 | varbitContext.value) & 255);
} else {
buffer = new IoBuffer(37);
buffer.put((byte) 128 | varbitContext.value);
}
buffer.putLEShort(varbitContext.varbitId);
varbitContext.getPlayer().getSession().write(buffer);
}