Emberveil sourcetests/SoundPacketCheck.java
import com.rs2.game.players.Client;
/** The shared sound sender protects every combat and skilling path, including old clients. */
public final class SoundPacketCheck {
public static void main(String[] args) {
Client p=new Client(null,1);p.getOutStream().packetEncryption=new org.apollo.util.security.IsaacRandom(new int[]{1,2,3,4});p.soundOn=true;
p.getPacketSender().frame174(-1,100,0);p.getPacketSender().frame174(65535,100,0);p.sendSound(-1,100,0);
if(p.getOutStream().currentOffset!=0)throw new AssertionError("Invalid sound packet emitted");
p.getPacketSender().sendSound(398,1,7,100);
byte[] b=p.getOutStream().buffer;
if(p.getOutStream().currentOffset!=6 || (b[1]&255)!=1 || (b[2]&255)!=142 || b[3]!=0 || b[4]!=7 || b[5]!=100)throw new AssertionError("Sound wire format must be opcode + id(2), delay(2), volume(1)");
p.getOutStream().currentOffset=0;p.sendSound(398,100,7);if(p.getOutStream().currentOffset!=6)throw new AssertionError("Legacy sender uses same fixed packet");
System.out.println("PASS shared sound packet validation and both sender formats");
}
}