RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
SendConfig.java
1package com.osroyale.net.packet.out;
2
3import com.osroyale.net.codec.ByteOrder;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.net.packet.OutgoingPacket;
6
35
36public class SendConfig extends OutgoingPacket {
37
38 private final int id;
39 private final int value;
40 private final boolean intValue;
41
42 public SendConfig(int id, int value, boolean intValue) {
43 super(intValue ? 87 : 36, intValue ? 6 : 3);
44 this.id = id;
45 this.value = value;
46 this.intValue = intValue;
47 }
48
49 public SendConfig(int id, int value) {
50 this(id, value, value < Byte.MIN_VALUE || value > Byte.MAX_VALUE);
51 }
52
53 @Override
54 public boolean encode(Player player) {
55 if (value == -1) {
56 return false;
57 }
58 if(intValue) {
59 builder.writeShort(id, ByteOrder.LE).writeInt(value, ByteOrder.ME);
60 } else {
61 builder.writeShort(id, ByteOrder.LE).writeByte(value);
62 }
63
64 return true;
65 }
66
67}