mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-20 21:40:27 -07:00
Massive varp/varbit related refactoring + new client command
This commit is contained in:
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,6 +261,15 @@ class VisualCommand : CommandPlugin() {
|
|||
PacketRepository.send(Varbit::class.java, VarbitContext(player, value, val2))
|
||||
return true
|
||||
}
|
||||
"setbits" -> {
|
||||
args ?: return false
|
||||
val start = toInteger(args[1]!!)
|
||||
val end = toInteger(args[2]!!)
|
||||
val value = toInteger(args[3]!!)
|
||||
for(i in start until end){
|
||||
player?.varpManager?.setVarbit(i, value)
|
||||
}
|
||||
}
|
||||
"loop_anim_on_i" -> {
|
||||
var anim = toInteger(args!![1]!!)
|
||||
ContentAPI.submitWorldPulse(object : Pulse(3){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue